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,EAAsB31B,EAAgBpC,MAAQ,GAAIoC,EAAgB7B,SAAU/F,EAAK2N,GAUrF,SAAS4vB,EAAsBlB,EAAcppB,EAAkBjT,EAAqB2N,GACvF,OAAOsvB,EAAAA,EAAAA,IAAW,UAAWj9B,EAAK,CAC9B+V,QAAS,CAAEvQ,KAAM62B,GAAQ,GAAIt2B,SAAUkN,GACvCtF,SAAAA,+DCxBD,MAAM0jB,EAAmBmM,GACrBA,EAAKj+B,eAAea,YAAYq9B,IAAIt8B,IAAM,GAGxCmwB,EAAoBkM,GACtBA,EAAKj+B,eAAea,YAAYq9B,IAAIzjB,KAAO,GAGzC0jB,EAAwBF,IACjC,MAAMG,EAAWH,EAAKj+B,eAAea,YAAYq9B,IAAIG,SAC/CJ,EAAKj+B,eAAea,YAAYq9B,IAAIG,SACpCJ,EAAKj+B,eAAea,YAAYq9B,IAAIzjB,KAAO,GACjD,OAAI2jB,EAAS/5B,OAAS,GAAK+5B,EAASE,SAAS,KAClCF,EAASG,UAAU,EAAGH,EAAS/5B,OAAS,GAE5C+5B,2CCXJ,MAAM3D,EAKTl7B,YAAYmD,EAAkCmgB,GAC1ChjB,KAAK6C,gBAAkBA,EACvB7C,KAAKgjB,YAAcA,GAYpB,MAAM+V,EAOTr5B,YAAYqf,EAA0B6Y,EAAyC3Y,GAC3Ejf,KAAK+e,YAAcA,EACnB/e,KAAK43B,mBAAqBA,EAC1B53B,KAAKif,WAAaA","sources":["webpack://Msdyn365.Commerce.Online/../../src/add-address.ts?fb17","webpack://Msdyn365.Commerce.Online/../../src/add-item-to-product-list.ts?580e","webpack://Msdyn365.Commerce.Online/../../src/add-organization-user.ts?ed86","webpack://Msdyn365.Commerce.Online/../../src/checkout.ts?57e0","webpack://Msdyn365.Commerce.Online/../../src/create-product-list.ts?7367","webpack://Msdyn365.Commerce.Online/../../src/delete-address.ts?f9a3","webpack://Msdyn365.Commerce.Online/../../src/delete-organization-user.ts?7f5d","webpack://Msdyn365.Commerce.Online/../../src/edit-organization-user.ts?d2ac","webpack://Msdyn365.Commerce.Online/../../src/generic-data-action.ts?f887","webpack://Msdyn365.Commerce.Online/../../src/get-address.ts?20a3","webpack://Msdyn365.Commerce.Online/../../src/get-attribute-definitions.ts?cc6b","webpack://Msdyn365.Commerce.Online/../../src/get-attributes-for-selected-variant.ts?af00","webpack://Msdyn365.Commerce.Online/../../src/get-availabilities-cartlines.ts?b8e8","webpack://Msdyn365.Commerce.Online/../../src/get-catalogs.ts?7332","webpack://Msdyn365.Commerce.Online/../../src/get-categories-hierarchy.ts?acde","webpack://Msdyn365.Commerce.Online/../../src/get-categories.ts?8dc6","webpack://Msdyn365.Commerce.Online/../../src/get-category-paths.ts?b007","webpack://Msdyn365.Commerce.Online/../../src/get-channel-delivery-option-configuration.ts?a716","webpack://Msdyn365.Commerce.Online/../../src/get-checkout-cart.ts?79bc","webpack://Msdyn365.Commerce.Online/../../src/get-current-category-hierarchy.ts?d48e","webpack://Msdyn365.Commerce.Online/../../src/get-current-category.ts?354d","webpack://Msdyn365.Commerce.Online/../../src/get-customer-balance.ts?d165","webpack://Msdyn365.Commerce.Online/../../src/get-customer-loyalty-cards.ts?2466","webpack://Msdyn365.Commerce.Online/../../src/get-customer.ts?8319","webpack://Msdyn365.Commerce.Online/../../src/get-delivery-options-for-cartlines.ts?4dfe","webpack://Msdyn365.Commerce.Online/../../src/get-delivery-options-for-selected-variant.ts?3f6c","webpack://Msdyn365.Commerce.Online/../../src/get-dimension-availabilities-for-product-search-result.ts?5259","webpack://Msdyn365.Commerce.Online/../../src/get-dimension-availabilities-for-products.ts?f656","webpack://Msdyn365.Commerce.Online/../../src/get-dimensions-for-selected-variant.ts?6bf4","webpack://Msdyn365.Commerce.Online/../../src/get-feature-state.ts?1a1d","webpack://Msdyn365.Commerce.Online/../../src/get-full-available-inventory-nearby.ts?20be","webpack://Msdyn365.Commerce.Online/../../../src/utilities/quick-order-templates.ts?0ea6","webpack://Msdyn365.Commerce.Online/../../src/get-full-product-list.ts?ccfb","webpack://Msdyn365.Commerce.Online/../../src/get-full-products-by-refine-search-category.ts?30ab","webpack://Msdyn365.Commerce.Online/../../src/get-full-products-by-refine-search-text.ts?2ad7","webpack://Msdyn365.Commerce.Online/../../../src/utilities/refiner-utils.ts?1e61","webpack://Msdyn365.Commerce.Online/../../src/get-full-products.ts?ba9a","webpack://Msdyn365.Commerce.Online/../../src/get-items-in-wishlist.ts?0d27","webpack://Msdyn365.Commerce.Online/../../src/get-list.ts?4fd5","webpack://Msdyn365.Commerce.Online/../../src/get-loyalty-card.ts?7213","webpack://Msdyn365.Commerce.Online/../../src/get-loyalty-transaction-estimation.ts?e254","webpack://Msdyn365.Commerce.Online/../../src/get-media-locations-by-id.ts?8462","webpack://Msdyn365.Commerce.Online/../../src/get-media-locations-for-selected-variant.ts?fd54","webpack://Msdyn365.Commerce.Online/../../src/get-order-history.ts?76fd","webpack://Msdyn365.Commerce.Online/../../src/get-org-unit-configuration.ts?4793","webpack://Msdyn365.Commerce.Online/../../src/get-organization-users-count.ts?b5f7","webpack://Msdyn365.Commerce.Online/../../src/get-organization-users.ts?b72e","webpack://Msdyn365.Commerce.Online/../../src/get-organization-wide-order-history.ts?92b8","webpack://Msdyn365.Commerce.Online/../../src/get-pickup-options-for-cartlines.ts?843b","webpack://Msdyn365.Commerce.Online/../../src/get-price-for-product-search-result.ts?36f8","webpack://Msdyn365.Commerce.Online/../../src/get-price-for-selected-variant.ts?9e79","webpack://Msdyn365.Commerce.Online/../../src/get-product-availabilities-for-selected-variant.ts?0abd","webpack://Msdyn365.Commerce.Online/../../src/get-product-dimensions-with-availabilities.ts?347b","webpack://Msdyn365.Commerce.Online/../../../src/utilities/quick-order-template-line.ts?56d5","webpack://Msdyn365.Commerce.Online/../../src/get-product-list-lines.ts?ae74","webpack://Msdyn365.Commerce.Online/../../src/get-product-list.ts?ef13","webpack://Msdyn365.Commerce.Online/../../src/get-products-by-category.ts?accf","webpack://Msdyn365.Commerce.Online/../../src/get-products-in-active-cart.ts?3376","webpack://Msdyn365.Commerce.Online/../../src/get-promotion-options-for-cartlines.ts?1a35","webpack://Msdyn365.Commerce.Online/../../src/get-ratings-summary-input.ts?3ccb","webpack://Msdyn365.Commerce.Online/../../src/get-ratings-summary.ts?49bc","webpack://Msdyn365.Commerce.Online/../../src/get-refiners-by-category.ts?6d4e","webpack://Msdyn365.Commerce.Online/../../src/get-refiners-by-text.ts?c52a","webpack://Msdyn365.Commerce.Online/../../src/get-related-products.ts?6f93","webpack://Msdyn365.Commerce.Online/../../src/get-scan-results.ts?6b44","webpack://Msdyn365.Commerce.Online/../../src/get-search-configuration.ts?acd1","webpack://Msdyn365.Commerce.Online/../../src/get-simple-products.ts?fed7","webpack://Msdyn365.Commerce.Online/../../src/get-store-location-information.ts?1df0","webpack://Msdyn365.Commerce.Online/../../src/get-wishlist-by-customer-id.ts?e873","webpack://Msdyn365.Commerce.Online/../../../src/invoices/get-invoice-details.ts?66a9","webpack://Msdyn365.Commerce.Online/../../../src/invoices/get-invoices.ts?22cb","webpack://Msdyn365.Commerce.Online/../../src/issue-loyalty.ts?f8fa","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/add-item-to-order-template.ts?fff3","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/add-order-template-to-cart.ts?6ee4","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/create-order-template.ts?03c1","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-full-order-template.ts?72c6","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-full-order-templates.ts?b553","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-order-templates-preview.ts?b8c3","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-order-templates.ts?a3b1","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-paginated-order-template-lines.ts?9b12","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/update-order-template-header.ts?1f77","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/update-order-template-line.ts?527b","webpack://Msdyn365.Commerce.Online/../../src/refine-search-by-category.ts?3e65","webpack://Msdyn365.Commerce.Online/../../src/search-by-text.ts?ebe1","webpack://Msdyn365.Commerce.Online/../../src/update-address.ts?3e4d","webpack://Msdyn365.Commerce.Online/../../src/update-customer-attributes.ts?8d49","webpack://Msdyn365.Commerce.Online/../../src/update-customer-personalization.ts?4aa9","webpack://Msdyn365.Commerce.Online/../../src/update-primary-address.ts?83fa","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/parameterize.ts?f5a5","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/category-url-builder.ts?e564","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/invoice-url-builder.ts?d542","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/product-url-builder.ts?baf1","webpack://Msdyn365.Commerce.Online/../../../src/utilities/getRnrKeys.ts?700f","webpack://Msdyn365.Commerce.Online/../../../src/utilities/order-templates.ts?d593"],"sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy';\nimport { createReadAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport getCustomer, { GetCustomerInput } from './get-customer';\n\nexport interface IAddressManagementData {\n address: Address;\n}\nexport interface IAddressManagementInput extends IActionInput {\n address: Address;\n userAccountNumber?: string;\n}\n\n/**\n * The input class for the addAddress data action.\n */\nexport class AddressManagementInput implements IAddressManagementInput {\n public address: Address;\n\n public userAccountNumber?: string;\n\n constructor(address: Address, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.address = address;\n }\n\n public getCacheKey = () => 'AddAddress';\n\n public getCacheObjectType = () => 'AddAddress';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the addAddress data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createAddressManagementInput = (\n inputData: ICreateActionContext, IAddressManagementData>\n): IAddressManagementInput => {\n if (inputData.requestContext.user.isAuthenticated) {\n throw new Error('User is not authenticated. Cannot call UpdateAddress API');\n }\n\n const { address } = inputData.data || { address: undefined };\n\n if (!address) {\n throw new Error('address is not provided. Cannot call UpdateAddress API');\n }\n\n return new AddressManagementInput(address);\n};\n\nexport async function doAddressManagementOperation(\n input: IAddressManagementInput,\n ctx: IActionContext,\n operationHandler: (customer: Customer, address: Address) => Customer\n): Promise {\n const { userAccountNumber, address } = input;\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, userAccountNumber, 'none');\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n throw new Error('Not able to create customer');\n }\n\n const newCustomer = operationHandler({ ...customer }, address);\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n throw new Error('Not able to update customer');\n }\n\n ctx.update(createReadAsync(updatedCustomer.AccountNumber), updatedCustomer);\n\n return updatedCustomer.Addresses || [];\n}\n\nexport function addAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = [...(customer.Addresses || [])];\n customer.Addresses.push(address);\n return customer;\n}\n\nexport async function addAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, addAddressHandler);\n}\n\n/**\n * The addAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Adds the passed address information to the retireved customer, and\n * then updates that customer via the update RetailServer API.\n */\nexport const addAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-address',\n action: >addAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\n\nexport default addAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductListLine, ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Input class for the AddItemToProductList data action.\n */\nexport class AddItemToProductListInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n\n public constructor(productListId: string, productId: number, quantity: number, unitOfMeasure: string) {\n this.productListId = productListId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'AddItemToProductListInput';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'AddItemToProductListInput';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddItemToProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - The id of product list to update.\n * @param productId - The id of a product to add.\n * @param quantity - How many items of this product to add.\n * @param unitOfMeasure - Product measuring unit.\n * @returns - Input data for productlist add api.\n */\nexport const addItemToProductListInput = (\n inputData: ICreateActionContext,\n productListId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string\n): AddItemToProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create product list. User is not authenticated.');\n }\n return new AddItemToProductListInput(productListId, productId, quantity, unitOfMeasure);\n};\n\n/**\n * The action method for the AddItemToProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList.\n */\nexport async function addItemToProductListAction(input: AddItemToProductListInput, context: IActionContext): Promise {\n try {\n const productListLineToAdd: ProductListLine = {\n ProductListId: input.productListId,\n ProductId: input.productId,\n Quantity: input.quantity,\n UnitOfMeasure: input.unitOfMeasure\n };\n\n const productListLine: ProductListLine[] = await ProductListsDataActions.addProductListLinesAsync(\n {\n callerContext: context\n },\n input.productListId,\n [productListLineToAdd]\n );\n\n if (ArrayExtensions.hasElements(productListLine) && productListLine[0].ProductListId) {\n return productListLine[0];\n }\n context.telemetry.error('Product list line was not returned when adding it to quick order bag');\n throw new Error('Product list line was not returned when adding it to quick order bag');\n } catch (error) {\n context.telemetry.error('Not able to add an item to quick order bag', error);\n throw error;\n }\n}\n\n/**\n * The AddItemToOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport const addItemToProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-item-to-product-list',\n action: addItemToProductListAction as IAction,\n input: addItemToProductListInput\n});\n\nexport default addItemToProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartner, BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\nimport { createBusinessPartnerUserAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for addOrganizationUser data action.\n */\nexport class AddOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'AddOrganizationUser';\n\n public getCacheObjectType = () => 'AddOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for addOrganizationUser data action.\n * @param inputData\n * @param newUser\n */\nexport const createAddOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new AddOrganizationUserInput(newUser);\n};\n\n/**\n * The addOrganizationUser data action\n * Calls getCurrent() to get a businessPartnerId from the user requesting the action.\n * It then maps the newUsers' businessPartnerId to the same as the above user.\n * Calls the createBusinessPartner to then create a new entitiy in the database with the\n * information passed into through newUser.\n * @param input\n * @param ctx\n */\nexport async function addOrganizationUser(input: AddOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n\n return getCurrentAsync({ callerContext: ctx })\n .then((businessPartner: BusinessPartner) => {\n // Set the new accounts businessPartnerId from the admin account\n user.BusinessPartnerId = businessPartner.BusinessPartnerId;\n\n return createBusinessPartnerUserAsync({ callerContext: ctx }, user)\n .then(newUser => {\n return newUser;\n })\n .catch(() => {\n ctx.telemetry.debug('[add-organization-user] Unable to create BusinessPartnerUser account');\n throw new Error('[add-organization-user] Unable to create BusinessPartnerUser account');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[add-organization-user] Unable to get BusinessPartner Admin account');\n throw new Error('[add-organization-user] Unable to get BusinessPartner Admin account');\n });\n}\n\n/**\n * The addOrganizationUser data action\n * Calls the read RetailServer API to get the BusinessPartnerId from the admin\n * account and adds that businessPartner to the recieved input (new User)/\n * We then send this new User through the RetailServer API so that the database\n * is updated.\n */\nexport const addOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-organization-user',\n action: >addOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createAddOrganizationUserInput)\n});\n\nexport default addOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IHTTPRequestOptions,\n IHTTPResponse,\n sendCommerceRequest\n} from '@msdyn365-commerce/core';\nimport { Address, CartTenderLine, SalesOrder } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Check Out action Input.\n */\nexport class CheckOutInput implements IActionInput {\n public cartId: string;\n\n public cartVersion: number;\n\n public receiptEmail?: string;\n\n public cartTenderLines?: CartTenderLine[];\n\n public billingAddress?: Address;\n\n constructor(cartId: string, cartVersion: number, receiptEmail?: string, cartTenderLines?: CartTenderLine[], billingAddress?: Address) {\n this.cartId = cartId;\n this.cartVersion = cartVersion;\n this.receiptEmail = receiptEmail;\n this.cartTenderLines = cartTenderLines;\n this.billingAddress = billingAddress;\n }\n\n public getCacheKey = () => `${this.cartId}-${this.cartVersion}`;\n\n public getCacheObjectType = () => 'CheckOut';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Calls the Retail API to check out and returns sales order.\n * @param input\n * @param ctx\n */\nexport async function checkOutAction(input: CheckOutInput, ctx: IActionContext): Promise {\n const { apiSettings } = ctx.requestContext;\n const requestUrl = `${apiSettings.baseUrl}Commerce/Carts('${input.cartId}')/Checkout?api-version=7.3`;\n const requestOptions: IHTTPRequestOptions = {\n headers: {\n oun: apiSettings.oun,\n 'Content-Type': 'application/json'\n }\n };\n\n if (requestOptions.headers && ctx.requestContext.user.token) {\n requestOptions.headers.Authorization = `id_token ${ctx.requestContext.user.token}`;\n }\n\n if (input.cartTenderLines && input.cartTenderLines.length > 0) {\n input.cartTenderLines = input.cartTenderLines.map((cartTenderLineItem: CartTenderLine) => {\n // @ts-expect-error\n cartTenderLineItem['@odata.type'] = '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CartTenderLine';\n\n // @ts-expect-error\n cartTenderLineItem['Amount@odata.type'] = '#Decimal';\n\n if (cartTenderLineItem.TokenizedPaymentCard) {\n // @ts-expect-error\n cartTenderLineItem.TokenizedPaymentCard['@odata.type'] =\n '#Microsoft.Dynamics.Commerce.Runtime.DataModel.TokenizedPaymentCard';\n\n // Force the House prop to be set, so that call succeeds\n if (!cartTenderLineItem.TokenizedPaymentCard.House) {\n cartTenderLineItem.TokenizedPaymentCard.House = 'N/A';\n }\n\n if (cartTenderLineItem.TokenizedPaymentCard.CardTokenInfo) {\n // @ts-expect-error\n cartTenderLineItem.TokenizedPaymentCard.CardTokenInfo['@odata.type'] =\n '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardTokenInfo';\n }\n\n if (input.billingAddress) {\n const { Phone, ThreeLetterISORegionName = '', Street, City, State, ZipCode } = input.billingAddress;\n cartTenderLineItem.TokenizedPaymentCard = {\n ...cartTenderLineItem.TokenizedPaymentCard,\n Phone,\n Country: ThreeLetterISORegionName.toUpperCase(),\n Address1: Street,\n City,\n State,\n Zip: ZipCode\n };\n }\n }\n\n return cartTenderLineItem;\n });\n }\n\n const requestBody = {\n receiptEmail: input.receiptEmail,\n cartVersion: input.cartVersion || null,\n ...(input.cartTenderLines && { cartTenderLines: input.cartTenderLines })\n };\n\n // Perform check-out operation\n return sendCommerceRequest(requestUrl, 'post', requestBody, requestOptions).then((response: IHTTPResponse) => {\n if (response.status >= 200 && response.status < 300 && response.data) {\n return response.data;\n } else if (response.data) {\n throw response.data;\n }\n throw new Error('[checkOutAction] Invalid response recieved from RetailServer');\n });\n}\n\nexport const checkOutActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/checkout',\n action: >checkOutAction\n});\nexport default checkOutActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductList, ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for the CreateProductList data action.\n */\nexport class CreateProductListInput implements IActionInput {\n public readonly templateName: string;\n\n public readonly templateType: number;\n\n public constructor(templateName: string, templateType: number) {\n this.templateName = templateName;\n this.templateType = templateType;\n }\n\n /**\n * GetCacheObjectType.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => 'CreateProductListInput';\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheObjectType = (): string => 'CreateProductListInput';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the CreateProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param templateName - The name of template.\n * @param templateType - The type of template.\n * @returns - The Action input.\n */\nexport const createProductListInput = (\n inputData: ICreateActionContext,\n templateName: string,\n templateType: number\n): CreateProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create product list. User is not authenticated.');\n }\n return new CreateProductListInput(templateName, templateType);\n};\n\n/**\n * The action method for the CreateProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList object.\n */\nexport async function createProductListAction(input: CreateProductListInput, context: IActionContext): Promise {\n try {\n const orderTemplate: ProductList = {\n Id: '',\n Name: input.templateName,\n ProductListTypeValue: input.templateType\n };\n const createdProductList = await ProductListsDataActions.createProductListAsync(\n {\n callerContext: context\n },\n orderTemplate\n );\n if (createdProductList.Id !== '') {\n return createdProductList;\n }\n context.telemetry.error('Created product list was null');\n throw new Error('Created product list was null');\n } catch (error) {\n context.telemetry.error('Not able to create product list', error);\n throw error;\n }\n}\n\n/**\n * The CreateProductList Data Action.\n * Returns created Product List.\n */\nexport const createProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/create-product-list',\n action: createProductListAction as IAction,\n input: createProductListInput\n});\n\nexport default createProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy';\n\nimport { createAddressManagementInput, doAddressManagementOperation, IAddressManagementInput } from './add-address';\n\nexport function deleteAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = customer.Addresses || [];\n customer.Addresses = [...customer.Addresses.filter(cur => cur.RecordId !== address.RecordId)];\n return customer;\n}\n\nexport async function deleteAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, deleteAddressHandler);\n}\n\n/**\n * The deleteAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Removes all address information from the retireved customer, and\n * then updates that customer via the update RetailServer API.\n */\nexport const deleteAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/delete-address',\n action: >deleteAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\n\nexport default deleteAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser, NullResult } from '@msdyn365-commerce/retail-proxy';\nimport { deleteAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for DeleteOrganizationUser data action.\n */\nexport class DeleteOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'DeleteOrganizationUser';\n\n public getCacheObjectType = () => 'DeleteOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for DeleteOrganizationUser data action.\n * @param inputData\n * @param newUser\n */\nexport const createDeleteOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new DeleteOrganizationUserInput(newUser);\n};\n\n/**\n * The DeleteOrganizationUser data action\n * Calls getCurrent() to get a businessPartnerId from the user requesting the action.\n * It then maps the newUsers' businessPartnerId to the same as the above user.\n * Calls the createBusinessPartner to then create a new entitiy in the database with the\n * information passed into through newUser.\n * @param input\n * @param ctx\n */\nexport async function deleteOrganizationUser(input: DeleteOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n\n return deleteAsync({ callerContext: ctx }, user).catch(error => {\n console.log(error);\n ctx.telemetry.debug('[Delete-organization-user] Unable to delete BusinessPartnerUser account');\n throw new Error('[Delete-organization-user] Unable to delete BusinessPartnerUser account');\n });\n}\n\n/**\n * The DeleteOrganizationUser data action\n * Calls the read RetailServer API to get the BusinessPartnerId from the admin\n * account and Deletes that businessPartner to the recieved input (new User)/\n * We then send this new User through the RetailServer API so that the database\n * is updated.\n */\nexport const deleteOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/delete-organization-user',\n action: >deleteOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createDeleteOrganizationUserInput)\n});\n\nexport default deleteOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for edit organization user data action.\n */\nexport class EditOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'EditOrganizationUser';\n\n public getCacheObjectType = () => 'EditOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for edit organization user data action.\n * @param inputData\n * @param newUser\n */\nexport const createEditOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new EditOrganizationUserInput(newUser);\n};\n\nexport async function editOrganizationUser(input: EditOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n\n return updateAsync({ callerContext: ctx }, user)\n .then(updatedUser => {\n return updatedUser;\n })\n .catch(() => {\n ctx.telemetry.debug('[Edit-organization-user] Unable to update BusinessPartnerUser account');\n throw new Error('[Edit-organization-user] Unable to update BusinessPartnerUser account');\n });\n}\n\n/**\n * The EditOrganizationUser data action\n * Takes in an instance of a BusinessPartnerUser and updates the\n * same user with the new information.\n */\nexport const editOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/Edit-organization-user',\n action: >editOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createEditOrganizationUserInput)\n});\n\nexport default editOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, IActionContext, IActionInput } from '@msdyn365-commerce/core';\n\n/**\n * Generic input type for use with generic data actions.\n */\nexport class GenericInput implements IActionInput {\n public result: T;\n\n public cacheKey: string;\n\n public cacheObjectType: string;\n\n constructor(cacheKey: string, result: T, cacheObjectType: string) {\n this.cacheKey = cacheKey;\n this.cacheObjectType = cacheObjectType;\n this.result = result;\n }\n\n public getCacheKey = () => `Generic-${this.cacheKey}`;\n\n public getCacheObjectType = () => `${this.cacheObjectType}`;\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Generic data action that is just used for passing data around the app.\n *\n * Note that this doesn't actually expose a data action, its just a base action\n * that others can use to create a data action with their own input.\n * @param input\n * @param ctx\n */\nexport async function getGenericAction(input: GenericInput, ctx: IActionContext): Promise {\n return input.result;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { Address } from '@msdyn365-commerce/retail-proxy';\n\nimport getCustomer, { GetCustomerInput } from './get-customer';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for the getAddress data action.\n */\nexport class AddressInput implements IActionInput {\n public userAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetAddress-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetAddress';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getAddress method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetAddressInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create address input. User is not authenticated.');\n }\n\n return new AddressInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getAddress data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getAddressAction(input: AddressInput, ctx: IActionContext): Promise {\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, input.userAccountNumber);\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n throw new Error('Not able to get customer');\n }\n\n return customer.Addresses || [];\n}\n\n/**\n * The getAddress data action\n * Gets a customers information via the read RetailServer API\n * Returns address information associated with the retrieved customer.\n */\nexport const getAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-address',\n action: >getAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetAddressInput\n});\n\nexport default getAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getAttributeDefinitionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { AttributeDefinition, AttributeDefinitionCriteria } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get attribute definitions data action.\n */\nexport class GetAttributeDefinitionsInput implements IActionInput {\n public attributeDefinitionCriteria?: AttributeDefinitionCriteria;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, attributeDefinitionCriteria?: AttributeDefinitionCriteria) {\n this.attributeDefinitionCriteria = attributeDefinitionCriteria;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('AttributeDefinitions', this.apiSettings);\n\n public getCacheObjectType = () => 'CustomerAttribute';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): GetAttributeDefinitionsInput => {\n const { apiSettings, channel } = inputData.requestContext;\n if (!channel || !channel.CustomerAttributeGroupId) {\n throw new Error('[getAttributeDefinitions][createInput]: Customer attribute group id is not found.');\n }\n\n return new GetAttributeDefinitionsInput(apiSettings, { AttributeGroupIdentifier: channel.CustomerAttributeGroupId });\n};\n\nconst getAttributeDefinitionsAction = async (input: GetAttributeDefinitionsInput, ctx: IActionContext): Promise => {\n if (input && ctx.requestContext.channel && ctx.requestContext.channel.CustomerAttributeGroupId) {\n return getAttributeDefinitionsAsync({ callerContext: ctx }, input.attributeDefinitionCriteria || null).then(response => {\n return response;\n });\n }\n\n ctx.trace('[getAttributeDefinitions]Invalid input passed to action');\n return [];\n};\n\nexport const getAttributeDefinitionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-custom-attributes',\n action: >getAttributeDefinitionsAction,\n input: createInput\n});\n\nexport default getAttributeDefinitionsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { AttributeValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { getSelectedProductIdFromActionInput, SelectedVariantInput } from '.';\nimport { getSelectedVariantActionDataAction } from './get-selected-variant';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Chains getting the SelectedVariant with GetActivePrice.\n */\nexport class AttributesForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.catalogId = catalogId || 0;\n }\n\n public getCacheKey = () => 'AttributesForSelectedVariant';\n\n public getCacheObjectType = () => 'ProductAttributeValue';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createAttributesForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): AttributesForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new AttributesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined, catalogId);\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Calls the Retail API a get a list of dimension values for a given product.\n * @param input\n * @param ctx\n */\nexport async function getAttributesForSelectedVariantAction(\n input: AttributesForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariantActionDataAction(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return getAttributeValuesAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n }\n\n return null;\n })\n .then((attributeValues: AttributeValue[] | null) => {\n const resultArray = attributeValues;\n if (resultArray) {\n return resultArray;\n }\n\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getAttributesForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-attributes-for-selected-variant',\n action: >getAttributesForSelectedVariantAction,\n input: createAttributesForSelectedVariantInput\n});\n\nexport default getAttributesForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartLine, ChannelDeliveryOptionConfiguration, FeatureState, ProductWarehouse } from '@msdyn365-commerce/retail-proxy';\nimport { getOrgUnitConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport {\n getEstimatedAvailabilityAsync,\n getEstimatedProductWarehouseAvailabilityAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { getChannelDeliveryOptionConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport {\n ActiveCartProductsInput,\n ArrayExtensions,\n buildCacheKey,\n createInventoryAvailabilitySearchCriteria,\n getActiveCartProductsAction,\n IProductInventoryInformation,\n mapAggregatedProductInventoryInformation,\n mapProductInventoryInformation\n} from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\n\n/**\n * Input class for availabilities for items in cart.\n */\nexport class ProductAvailabilitiesForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsAvailability', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsAvailability';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductAvailabilitiesForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param cartLine\n * @param featureSate\n * @param channelDeliveryOptionConfig\n * @param pickupDeliveryMode\n */\nconst getDeliveryMode = (\n cartLine: CartLine,\n featureSate: boolean = false,\n channelDeliveryOptionConfig: ChannelDeliveryOptionConfiguration,\n pickupDeliveryMode?: string\n) => {\n if (!featureSate) {\n return cartLine.DeliveryMode === pickupDeliveryMode;\n }\n return (\n cartLine.DeliveryMode ===\n channelDeliveryOptionConfig?.PickupDeliveryModeCodes?.find(deliveryMode => deliveryMode === cartLine.DeliveryMode)\n );\n};\n\n/**\n * Calls the Retail API to get the product availabilities for items in the cart.\n * @param input\n * @param ctx\n */\n// eslint-disable-next-line complexity\nexport async function getAvailabilitiesForCartLineItems(\n input: ProductAvailabilitiesForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getAvailabilitiesForCartLineItems]No valid Input was provided, failing');\n }\n\n const shippingItems: CartLine[] = [];\n const bopisItems = [];\n let productAvailabilities: IProductInventoryInformation[] = [];\n const multiplePickupStoreSwitchName = 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let channelDeliveryOptionConfig: any;\n\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n const channelConfiguration = await getOrgUnitConfigurationAsync({ callerContext: ctx });\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n /**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\n async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n }\n const featureState = await getFeatureState(ctx);\n const retailMultiplePickUpOptionEnabled = featureState?.find(item => item.Name === multiplePickupStoreSwitchName)?.IsEnabled;\n if (retailMultiplePickUpOptionEnabled) {\n channelDeliveryOptionConfig = await getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx });\n }\n const PickupDeliveryModeCode = channelConfiguration.PickupDeliveryModeCode;\n const EmailDeliveryModeCode = channelConfiguration.EmailDeliveryModeCode;\n\n if (!cart || !channelConfiguration || !products || products.length === 0) {\n ctx.trace('[getAvailabilitiesForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n if (cart && cart.Id && cart.CartLines && cart.CartLines.length > 0 && channelConfiguration) {\n for (const cartLine of cart.CartLines) {\n if (\n cartLine.DeliveryMode &&\n cartLine.DeliveryMode !== '' &&\n getDeliveryMode(cartLine, retailMultiplePickUpOptionEnabled, channelDeliveryOptionConfig, PickupDeliveryModeCode)\n ) {\n bopisItems.push(cartLine);\n } else if (EmailDeliveryModeCode === '' || cartLine.DeliveryMode !== EmailDeliveryModeCode) {\n shippingItems.push(cartLine);\n }\n }\n }\n\n if (shippingItems && shippingItems.length > 0) {\n let productIds = shippingItems.map(x => x.ProductId!);\n productIds = ArrayExtensions.unique(productIds);\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, productIds, true);\n const shippingProductAvailabilities = await getEstimatedAvailabilityAsync(\n { callerContext: ctx, bypassCache: 'get' },\n searchCriteria\n );\n\n if (\n shippingProductAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities.length > 0\n ) {\n productAvailabilities = mapAggregatedProductInventoryInformation(ctx, shippingProductAvailabilities);\n }\n }\n\n if (bopisItems && bopisItems.length > 0) {\n const productWarehouses: ProductWarehouse[] = [];\n\n for (const bopisItem of bopisItems) {\n const productWarehouse: ProductWarehouse = {\n ProductId: bopisItem.ProductId,\n InventLocationId: bopisItem.WarehouseId\n };\n\n if (ctx.requestContext.channel && ctx.requestContext.channel.InventLocationDataAreaId) {\n productWarehouse.DataAreaId = ctx.requestContext.channel.InventLocationDataAreaId;\n }\n productWarehouses.push(productWarehouse);\n }\n const quantityUnitTypeSales: number = 2;\n const getProductWarehouseAvail = await getEstimatedProductWarehouseAvailabilityAsync(\n { callerContext: ctx, bypassCache: 'get', queryResultSettings: {} },\n productWarehouses,\n quantityUnitTypeSales\n );\n\n if (\n getProductWarehouseAvail &&\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities &&\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities.length > 0\n ) {\n const productWarehouseMapping = mapProductInventoryInformation(\n ctx,\n getProductWarehouseAvail?.ProductWarehouseInventoryAvailabilities\n );\n if (productWarehouseMapping && productWarehouseMapping.length > 0) {\n for (const item of productWarehouseMapping) {\n productAvailabilities.push(item);\n }\n }\n }\n }\n\n if (productAvailabilities && productAvailabilities.length > 0) {\n return productAvailabilities;\n }\n\n ctx.trace('[getAvailabilitiesForCartLineItems] unable to get availabilities for product');\n return [];\n}\n\nexport const getAvailabilitiesForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-availabilities-cartlines',\n action: >getAvailabilitiesForCartLineItems,\n input: createInput\n});\n\nexport default getAvailabilitiesForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { CatalogsDataActions, ProductCatalog } from '@msdyn365-commerce/retail-proxy';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input for get-catalogs data action.\n */\nexport class CatalogsInput implements IActionInput {\n public readonly channelId: number;\n\n public readonly customerAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n public constructor(context: IRequestContext, customerAccountNumber?: string) {\n this.channelId = context.apiSettings.channelId ? Number(context.apiSettings.channelId) : 0;\n this.customerAccountNumber = customerAccountNumber ? customerAccountNumber : context.user.customerAccountNumber;\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- customer account number can be undefined.\n public getCacheKey = (): string => buildCacheKey(`${this.channelId}|${this.customerAccountNumber}`, this.apiSettings, this.locale);\n\n /**\n * Get Cache object type.\n * @returns - Cache object type.\n */\n public getCacheObjectType = (): string => 'productCatalogs';\n\n /**\n * Get data cache type.\n * @returns - Cache type enum.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - The input data passed to the createInput method.\n * @param customerAccountNumber - Customer account number.\n * @returns - Catalogs input.\n */\nexport const createCatalogsInput = (inputData: ICreateActionContext>, customerAccountNumber?: string): IActionInput => {\n if (!inputData.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get product catalog. User is not authenticated.');\n }\n return new CatalogsInput(inputData.requestContext, customerAccountNumber);\n};\n\n/**\n * Calls the Retail API and returns the product catalog for an user.\n * @param input - Catalogs Input.\n * @param context - Current context.\n * @returns - Product catalog for the user.\n */\nexport async function getCatalogAction(input: CatalogsInput, context: IActionContext): Promise {\n const productCatalogs = await CatalogsDataActions.getCatalogsAsync(\n { callerContext: context, bypassCache: 'getAndPut' },\n input.channelId,\n true\n );\n return productCatalogs;\n}\n\n/**\n * The GetProductCatalogs Data Action\n * Returns product catalogs.\n */\nexport const getCatalogActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-catalogs',\n action: getCatalogAction as IAction,\n input: createCatalogsInput\n});\n\nexport default getCatalogActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { Category, TextValueTranslation } from '@msdyn365-commerce/retail-proxy';\n\nimport getCategoryAction, { CategoriesInput as RawCategoriesInput } from './get-categories';\nimport { getCategoryUrl } from './utilities/Url-builder';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input for get-categories data action.\n */\nexport class CategoriesInput implements IActionInput {\n public readonly maxItems: number;\n\n public readonly channelId: number;\n\n private readonly catalogId: number;\n\n private readonly sitePath: string;\n\n private readonly _mappedToHierarchy: boolean;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number) {\n this._mappedToHierarchy = mappedToHierarchy;\n this.maxItems = maxItems || 250;\n this.channelId = context && context.apiSettings && context.apiSettings.channelId ? +context.apiSettings.channelId : 0;\n this.sitePath = (context && context.sitePath) || '';\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n this.catalogId = getCatalogId(context);\n }\n\n public getCacheKey = () =>\n buildCacheKey(`${this.channelId}|${this.sitePath}|top-${this.maxItems || 250} | ${this.catalogId}`, this.apiSettings, this.locale);\n\n public getCacheObjectType = () => (this._mappedToHierarchy ? 'CategoryHierarchy' : 'Category');\n\n public dataCacheType = (): CacheType => 'request';\n\n public getLocale = (): string => this.locale || '';\n}\n\nconst getFriendlyName = (locale?: string, nameTranslations?: TextValueTranslation[]): string | undefined => {\n let nameTranslation: TextValueTranslation | undefined;\n if (locale && nameTranslations && nameTranslations.length > 0) {\n nameTranslation = nameTranslations.find(item => item.Language!.toLowerCase() === locale.toLowerCase());\n }\n\n return nameTranslation && nameTranslation.Text;\n};\n\nexport interface ICategoryMap {\n [RecordId: number]: CategoryHierarchy;\n}\n\n/**\n * Creates a hierarchy of categories based on the ParentCategory property.\n * @param categoryList Categories that will be converted into a hierarchy.\n * @param ctx\n * @param locale\n * @returns Hierarchy of categories in array.\n */\nexport const mapCategoryToHierarchy = (categoryList: Category[], ctx: IActionContext, locale?: string): CategoryHierarchy[] => {\n if (!categoryList || categoryList.length === 0) {\n return [];\n }\n\n const categoryMap: ICategoryMap = categoryList.reduce((memo: ICategoryMap, category: Category) => {\n const localName = getFriendlyName(locale, category.NameTranslations);\n const categoryHierarchy = { ...category };\n categoryHierarchy.NeutralizedName = category.Name;\n categoryHierarchy.Name = localName || categoryHierarchy.NeutralizedName;\n memo[category.RecordId] = categoryHierarchy;\n return memo;\n }, {});\n\n let zeroCategory = categoryMap[0];\n\n Object.keys(categoryMap).forEach((id: string) => {\n const element = categoryMap[+id];\n const parentId = element.ParentCategory;\n element.Url = getCategoryUrl(element, ctx, categoryMap);\n if (parentId === 0) {\n zeroCategory = element;\n return;\n }\n\n const parent = parentId && categoryMap[parentId];\n if (parent) {\n parent.Children = parent.Children || [];\n parent.Children.push(element);\n }\n });\n\n return (zeroCategory && zeroCategory.Children) || [];\n};\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createCategoriesHierarchyInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config && inputData.config.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n return new CategoriesInput(inputData.requestContext, true, topItems);\n};\n\n/**\n * Calls the Retail API and returns all the categories as a hierarchy.\n * @param input\n * @param ctx\n */\nexport async function getCategoryHierarchyAction(input: CategoriesInput, ctx: IActionContext): Promise {\n const categories = await getCategoryAction(new RawCategoriesInput(ctx.requestContext, false, input.maxItems), ctx);\n return mapCategoryToHierarchy(categories, ctx, input.getLocale());\n}\n\nexport const getCategoryHierarchyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-categories-hierarchy',\n action: >getCategoryHierarchyAction,\n input: createCategoriesHierarchyInput\n});\n\nexport default getCategoryHierarchyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { CategoriesDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input for get-categories data action.\n */\nexport class CategoriesInput implements IActionInput {\n public readonly maxItems: number;\n\n public readonly channelId: number;\n\n public readonly catalogId?: number;\n\n private readonly _mappedToHierarchy: boolean;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number) {\n this._mappedToHierarchy = mappedToHierarchy;\n this.maxItems = maxItems || 250;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Required.\n this.channelId = context?.apiSettings?.channelId ? Number(context.apiSettings.channelId) : 0;\n this.catalogId = getCatalogId(context);\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => `${this.channelId}|top-${this.maxItems || 250}|${this.catalogId ?? 0}`;\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => (this._mappedToHierarchy ? 'CategoryHierarchy' : 'Category');\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- Input data.\n * @returns -- IActionInput.\n */\nexport const createCategoriesInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config?.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n return new CategoriesInput(inputData.requestContext, false, topItems);\n};\n\n/**\n * Calls the Retail API and returns all the categories as a flat list.\n * @param input - Input.\n * @param ctx - Context.\n * @returns - CategoryHierarchy.\n */\nexport async function getCategoryAction(input: CategoriesInput, ctx: IActionContext): Promise {\n return ((await CategoriesDataActions.getCategoriesAsync(\n {\n callerContext: ctx\n },\n input.channelId,\n input.catalogId\n )) as unknown) as CategoryHierarchy[];\n}\n\n/**\n * The getCategory Data Action.\n */\nexport const getCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-categories',\n action: getCategoryAction as IAction,\n input: createCategoriesInput\n});\n\nexport default getCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n getCategoriesUrlSync,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { ICategoryPath, ICategoryUrl } from '@msdyn365-commerce/core-internal/dist/types/interfaces/ICategoryPathInterfaces';\nimport { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { CategoryPathLookup } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey, getSelectedProductIdFromActionInput } from './utilities/utils';\n\n/**\n * Category path input.\n */\nexport class GetCategoryPathsInput implements IActionInput {\n public readonly ChannelId: number;\n\n public readonly CatalogId: number;\n\n public readonly categoryPathLooksups: CategoryPathLookup[];\n\n public readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale: string;\n\n private constructedCacheKey: string;\n\n public constructor(context: IRequestContext, categoryPathLooksups: CategoryPathLookup[]) {\n this.ChannelId = context.apiSettings.channelId;\n this.CatalogId = getCatalogId(context);\n this.categoryPathLooksups = categoryPathLooksups;\n this.apiSettings = context.apiSettings;\n this.constructedCacheKey = '';\n categoryPathLooksups.forEach(categoryPath => {\n this.constructedCacheKey += `${categoryPath.ProductId && categoryPath.ProductId.toString()}|`;\n });\n this.constructedCacheKey += `${this.ChannelId.toString()}|`;\n this.constructedCacheKey += `${this.CatalogId.toString()}|`;\n this.locale = context.locale;\n }\n\n public getCacheKey = () => buildCacheKey(this.constructedCacheKey, this.apiSettings, this.locale);\n\n public getCacheObjectType = () => 'CategoryPath';\n\n public dataCacheType = (): CacheType => 'request';\n\n /**\n * Retrieves locale to use for the current API call.\n * @returns A string which represents locale.\n */\n public getLocale = (): string => this.locale;\n}\n\n/**\n * Creates the input required to make the getCategoryPath retail api call.\n * @param inputData\n */\nexport const createGetCategoryPathsInput = (inputData: ICreateActionContext>): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n if (productId) {\n return new GetCategoryPathsInput(inputData.requestContext, [{ ProductId: +productId }]);\n }\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Calls the Retail API and returns the category path for a product.\n * @param input\n * @param ctx\n */\nexport async function getCategoryPathsAction(input: GetCategoryPathsInput, ctx: IActionContext): Promise {\n const categoryPathResults = await getCategoryPathsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n input.ChannelId,\n input.CatalogId,\n input.categoryPathLooksups\n );\n const categoryPath = categoryPathResults[0].CategoryPath && categoryPathResults[0].CategoryPath[0];\n const categoryUrl = getCategoriesUrlSync(categoryPath, ctx);\n if (categoryUrl) {\n /* Do not return the root category of the product*/\n return categoryUrl.slice(1);\n }\n return [];\n}\n\nexport const getCategoryPathsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-category-paths',\n action: >getCategoryPathsAction,\n input: createGetCategoryPathsInput\n});\n\nexport default getCategoryPathsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ChannelDeliveryOptionConfiguration } from '@msdyn365-commerce/retail-proxy';\nimport { getChannelDeliveryOptionConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get channel delivery option configuration data action.\n */\nexport class GetChannelDeliveryConfigurationInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, accountNumber?: string) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ChannelDeliveryConfiguration', this.apiSettings);\n\n public getCacheObjectType = () => 'ChannelDeliveryConfiguration';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): GetChannelDeliveryConfigurationInput => {\n const { apiSettings } = inputData.requestContext;\n if (!apiSettings) {\n throw new Error('[getChannelDeliveryOptionConfiguration][createInput]: API setting not available.');\n }\n\n return new GetChannelDeliveryConfigurationInput(apiSettings);\n};\n\nconst getChannelDeliveryOptionConfigurationAction = async (\n input: GetChannelDeliveryConfigurationInput,\n ctx: IActionContext\n): Promise => {\n if (input) {\n return getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx }).then(response => {\n return response;\n });\n }\n\n ctx.trace('[get-channel-delivery-option-configuration]Invalid input passed to action');\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-channel-delivery-option-configuration',\n action: >getChannelDeliveryOptionConfigurationAction,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n msdyn365Commerce\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\nimport { copyAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport Cookie from 'js-cookie';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for getCheckoutCart data action.\n */\nexport class GetCheckoutCartInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCheckoutCart', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCheckoutCart';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new GetCheckoutCartInput(inputData.requestContext.apiSettings);\n};\n\nconst CartCookieName: string = msdyn365Commerce.CartCookie || 'cart';\n\n/**\n * Data action to copy the cart for checkout actions.\n * @param input\n * @param ctx\n */\nexport async function getCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\n const cartId = Cookie.get(CartCookieName) || '';\n if (cartId) {\n const currentCartState = await getCartState(ctx);\n const activeCart = currentCartState.cart;\n\n // Check if there is an active cart and it isn't empty\n if (activeCart && Object.keys(activeCart).length > 0) {\n const checkoutCart = await copyAsync({ callerContext: ctx }, activeCart.Id, 2);\n\n if (checkoutCart) {\n return Array.isArray(checkoutCart) ? checkoutCart[0] : checkoutCart;\n }\n } else {\n ctx.trace(\"[get-checkout-cart] Can't create a checkout cart since active cart is empty\");\n }\n }\n\n return {};\n}\n\nexport const getCheckoutCartDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-checkout-cart',\n action: >getCheckoutCart,\n input: createInput\n});\n\nexport default getCheckoutCartDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\n\nimport getCategoriesHierarchy, { CategoriesInput } from './get-categories-hierarchy';\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Action Input Class for get-current-category-hierarchy.\n */\nexport class CurrentCategoryHierarchyInput extends CategoriesInput {\n public activeCategoryId: number;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number, activeCategoryId?: number) {\n super(context, mappedToHierarchy, maxItems);\n const defaultActiveCategoryId = 0;\n this.activeCategoryId = activeCategoryId ?? defaultActiveCategoryId;\n }\n\n // @ts-expect-error: Overriding cache object type\n public getCacheObjectType = () => 'CurrentCategoryHierarchy';\n\n public getCacheKey = () => `${this.activeCategoryId}-${this.channelId}`;\n}\n\n/**\n * Creates the input required for the data action.\n * @param inputData\n */\nexport const createCategoriesHierarchyInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config?.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n let activeCategoryId =\n inputData.requestContext.urlTokens.pageType === 'Category' ? inputData.requestContext.urlTokens.itemId : undefined;\n activeCategoryId = activeCategoryId ?? inputData.requestContext.query?.categoryId;\n const activeCategoryParsedId = activeCategoryId ? Number.parseInt(activeCategoryId, 10) : undefined;\n\n return new CurrentCategoryHierarchyInput(inputData.requestContext, true, topItems, activeCategoryParsedId);\n};\n\n/**\n * Finds the given category in the list of categories and returns an array with the info on where it's located.\n * @param categories - Categories list to search from.\n * @param categoryId - The category id to find.\n * @returns A list of categories starting from the given category id, ending up the root parent.\n */\nconst findCategoryHierarchy = (categories: CategoryHierarchy[], categoryId: number): CategoryHierarchy[] | null => {\n for (const category of categories) {\n if (category.RecordId === categoryId) {\n return [category];\n }\n\n if (ArrayExtensions.hasElements(category.Children)) {\n const innerCategoryHierarchy = findCategoryHierarchy(category.Children, categoryId);\n if (ArrayExtensions.hasElements(innerCategoryHierarchy)) {\n innerCategoryHierarchy.push(category);\n return innerCategoryHierarchy;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the hierarchy of categories that are currently active as a parent -> child array.\n * Return will be as follows: [ParentCategory, Child, SubChild, SubSubChild].\n * @param input\n * @param ctx\n */\nexport async function getCurrentCategoryHierarchyAction(\n input: CurrentCategoryHierarchyInput,\n ctx: IActionContext\n): Promise {\n const fullCategoryHierarchy = await getCategoriesHierarchy(new CategoriesInput(ctx.requestContext, true, input.maxItems), ctx);\n const categoryArray = findCategoryHierarchy(fullCategoryHierarchy, input.activeCategoryId) ?? [];\n const sortedCategoryArray = categoryArray.reverse();\n return sortedCategoryArray;\n}\n\nexport const getCurrentCategoryHierarchyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-current-category-hierarchy',\n action: getCurrentCategoryHierarchyAction as IAction,\n input: createCategoriesHierarchyInput\n});\n\nexport default getCurrentCategoryHierarchyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getParameterizeFeatureFlags,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IParameterizeFeatureFlags,\n IRequestContext\n} from '@msdyn365-commerce/core';\n\nimport { buildCacheKey } from '.';\nimport getCategoryHierarchy, { CategoriesInput } from './get-categories-hierarchy';\nimport { parameterize } from './utilities/Url-builder';\n\n/**\n * Input class for GetCurrentCategory data action.\n */\nexport class CurrentCategoryInput implements IActionInput {\n public categoryId?: number;\n\n public categorySlug?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n constructor(context: IRequestContext) {\n let categoryId;\n let categorySlug;\n if (context.query && context.query.categoryId) {\n categoryId = Number(context.query.categoryId);\n\n if (Number.isNaN(categoryId)) {\n throw new Error('Failed to cast category id into a number.');\n }\n } else if (context.urlTokens && context.urlTokens.recordId) {\n categoryId = Number(context.urlTokens.recordId);\n if (Number.isNaN(categoryId)) {\n throw new Error('Failed to cast category id into a number.');\n }\n } else if (context.urlTokens && context.urlTokens.categories && context.urlTokens.categories.length > 0) {\n const categories: string[] = (context.urlTokens.categories);\n\n if (categories.length === 0) {\n throw new Error('Failed to get category name from urlTokens');\n }\n\n // TODO: fix getParameterizeFeatureFlags to take requestContext as input.\n const tempActionContext = {\n requestContext: context\n };\n categorySlug = `/${categories\n .map(category => {\n // @ts-expect-error TODO: fix getParameterizeFeatureFlags to take requestContext as an input\n const parameterizeFeatureFlags: IParameterizeFeatureFlags = getParameterizeFeatureFlags(tempActionContext);\n return parameterize(category, undefined, parameterizeFeatureFlags);\n })\n .join('/')}`;\n }\n this.categoryId = categoryId;\n this.categorySlug = categorySlug;\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n }\n\n public getCacheKey = () => buildCacheKey(`${this.categoryId || this.categorySlug}`, this.apiSettings, this.locale);\n\n public getCacheObjectType = () => 'Current-Category';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates a current category input from an ICreateActionContext.\n * @param inputData\n */\nexport const createGetCurrentCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n return new CurrentCategoryInput(inputData.requestContext);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Rescrusive Search Method to find a given category amongts a complete CategoryHierarcy.\n * @param categories The current Category Hierarchy.\n * @param categorySlug The category slug being searched for.\n * @param categoryId The category Id being search for.\n */\nexport function searchCategory(categories: CategoryHierarchy[], categorySlug?: string, categoryId?: number): CategoryHierarchy | undefined {\n let foundCategory;\n categories.forEach((cat: CategoryHierarchy) => {\n if ((categoryId && cat.RecordId === categoryId) || (categorySlug && cat.Slug === categorySlug)) {\n return (foundCategory = cat);\n } else if (cat.Children && cat.Children.length > 0) {\n const matchingChild = searchCategory(cat.Children, categorySlug, categoryId);\n if (matchingChild) {\n foundCategory = matchingChild;\n }\n }\n });\n return foundCategory;\n}\n\n/**\n * Action method for the getCurrentCategory Data Action.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getCurrentCategoryAction(input: CurrentCategoryInput, ctx: IActionContext): Promise {\n if (input.categorySlug || input.categoryId) {\n const categoryInput = new CategoriesInput(ctx.requestContext, true);\n const categories = await getCategoryHierarchy(categoryInput, ctx);\n if (!categories) {\n ctx.trace('[getCurrentCategory] Unable to get categories from server');\n return;\n }\n\n const category = searchCategory(categories, input.categorySlug, input.categoryId);\n if (!category) {\n ctx.trace('[getCurrentCategory] Unable to find category');\n return;\n }\n return category;\n }\n}\n\n/**\n * The getCurrentCategory data action\n * First makes a call to the getCategories RetailServer API\n * to get a list of every available category, then returns a CategoryHierarchy\n * based on the categoryId query param set in the URL of the request.\n */\nexport const getCurrentCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-current-category',\n action: >getCurrentCategoryAction,\n input: createGetCurrentCategoryInput\n});\n\nexport default getCurrentCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { CustomerBalances } from '@msdyn365-commerce/retail-proxy';\nimport { getCustomerBalanceAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport getCustomer, { GetCustomerInput } from './get-customer';\n\n/**\n * Input class for the GetCustomerBalance data action.\n */\nexport class GetCustomerBalanceInput implements IActionInput {\n public customerAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, customerAccountNumber?: string) {\n this.customerAccountNumber = customerAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`CustomerBalance-${this.customerAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetCustomerBalance';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetCustomerBalance method.\n * @param inputData The input data passed to the createInput method.\n */\n\nexport const createGetCustomerBalanceInput = (inputData: ICreateActionContext): GetCustomerBalanceInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get customer balance input. User is not authenticated.');\n }\n\n return new GetCustomerBalanceInput(requestContext.apiSettings);\n};\n\n/**\n * The action method for the GetCustomerBalance data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getCustomerBalanceAction(input: GetCustomerBalanceInput, ctx: IActionContext): Promise {\n const customerInput = new GetCustomerInput(input.apiSettings, input.customerAccountNumber);\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n ctx.telemetry.error('Not able to get customer', new Error('Not able to get customer'));\n }\n\n return getCustomerBalanceAsync(\n {\n callerContext: ctx,\n queryResultSettings: {}\n },\n customer.AccountNumber,\n customer.InvoiceAccount\n );\n}\n\n/**\n * The GetCustomerBalance data action\n * Returns the customer's balance.\n */\nexport const getCustomerBalanceActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer-balance',\n action: >getCustomerBalanceAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetCustomerBalanceInput\n});\n\nexport default getCustomerBalanceActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionInput, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { LoyaltyCard, retailAction } from '@msdyn365-commerce/retail-proxy';\nimport { createGetCustomerLoyaltyCardsInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createCustomerLoyaltyCardsInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetCustomerLoyaltyCardsInput({}, null);\n }\n\n throw new Error('Unable to create order history input. User is not authenticated.');\n};\n\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer-loyalty-cards',\n action: >retailAction,\n input: createCustomerLoyaltyCardsInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { Customer, CustomersDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get customer data action.\n */\nexport class GetCustomerInput implements IActionInput {\n public customerAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly cacheType?: CacheType;\n\n public constructor(apiSettings: ICommerceApiSettings, accountNumber?: string, cacheType?: CacheType) {\n this.customerAccountNumber = accountNumber;\n this.apiSettings = apiSettings;\n this.cacheType = cacheType;\n }\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => buildCacheKey(`Customer-${this.customerAccountNumber}`, this.apiSettings);\n\n /**\n * GetCacheObjectType.\n * @returns - Cache Object Type string.\n */\n public getCacheObjectType = (): string => 'Customer';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => {\n return this.cacheType ? this.cacheType : 'request';\n };\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - ProductAvailabilitiesForSelectedVariant or error.\n */\nconst createInput = (inputData: ICreateActionContext>): GetCustomerInput => {\n const { user, apiSettings } = inputData.requestContext;\n if (!user.token || !user.isAuthenticated) {\n throw new Error('[getCustomer][createInput]: User is not Authenticated.');\n }\n\n return new GetCustomerInput(apiSettings);\n};\n\n/**\n * GetCustomerAction.\n * @param input - GetCustomerInput.\n * @param ctx - Action Context.\n * @returns - Customer information.\n */\nconst getCustomerAction = async (input: GetCustomerInput, ctx: IActionContext): Promise => {\n if (input && ctx.requestContext.user.isAuthenticated) {\n // TO-DO- Need to clean up this code once SDK releases new proxy that handles null.\n return CustomersDataActions.readAsync({ callerContext: ctx, bypassCache: 'get' }, input.customerAccountNumber || '').then(\n response => {\n return Array.isArray(response) ? response[0] : response;\n }\n );\n }\n\n ctx.trace('[getCustomer]Invalid input passed to action');\n return {};\n};\n\n/**\n * The customer data action.\n */\nexport const getCustomerActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer',\n action: >getCustomerAction,\n input: createInput\n});\n\nexport default getCustomerActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { ProductAvailableQuantity, ProductDeliveryOptions, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for delivery options for items in cart.\n */\nexport class ProductDeliveryOptionsForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsDeliveryOptions', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsDeliveryOptions';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductDeliveryOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API to get the delivery options for items in the cart.\n * @param input\n * @param ctx\n */\nexport async function getDeliveryOptionsForCartLineItems(\n input: ProductDeliveryOptionsForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getDeliveryOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n if (!cart || !products || products.length === 0) {\n ctx.trace('[getDeliveryOptionsForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n return ProductsDataActions.getDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n products.map(x => x.RecordId),\n {},\n null\n )\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getDeliveryOptionsForCartLineItems]Error executing action');\n throw new Error('[getDeliveryOptionsForCartLineItems]Error executing action');\n });\n}\n\nexport const getDeliveryOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-delivery-options-for-cartlines',\n action: >getDeliveryOptionsForCartLineItems,\n input: createInput\n});\n\nexport default getDeliveryOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { getDeliveryOptionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n FilterDeliveryModeOption,\n ProductDeliveryOptions,\n ReleasedProductType,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetDeliveryOptionsForSelectedVariant Data Action.\n */\nexport class GetDeliveryOptionsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n public customerId: string;\n\n public featureState?: boolean;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, customerId?: string, featureState?: boolean) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.customerId = customerId || '';\n this.featureState = featureState;\n }\n\n public getCacheKey = () => 'DeliveryOptionsForSelectedVariant';\n\n public getCacheObjectType = () => 'DeliveryOptions';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * The createInput method for the GetDeliveryOptionsForSelectedVariant Data Action.\n * @param inputData The input data for the createInput method.\n */\nexport const createDeliveryOptionsForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): GetDeliveryOptionsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new GetDeliveryOptionsForSelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n undefined,\n undefined\n );\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The Action Method for the GetDeliveryOptionsForSelectedVariant Data Action\n * Pulls the currently selected variant from the cache using the getSelectedVariant data action, and gets it's supported delivery options\n * via the getDeliveryOptionsAsync RetailServer API.\n * @param input\n * @param ctx\n */\nexport async function getDeliveryOptionsForSelectedVariantAction(\n input: GetDeliveryOptionsForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n if (input.featureState === undefined) {\n const featureState = await getFeatureState(ctx);\n input.featureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n }\n\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return getDeliveryOptionsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n [activeProduct.RecordId],\n {},\n\n // For service item, should not apply the filter, otherwise there will be no electronic delivery mode\n input.featureState && productResult?.ItemTypeValue !== ReleasedProductType.Service\n ? FilterDeliveryModeOption.FilterOutNonPickupDeliveryMode\n : null\n ).then(response => {\n if (response && response.length > 0) {\n return response[0];\n }\n\n return undefined;\n });\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getDeliveryOptionsForSelectedVariantAction]Error executing action');\n throw new Error('[getDeliveryOptionsForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getDeliveryOptionsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-delivery-options-for-selected-variant',\n action: >getDeliveryOptionsForSelectedVariantAction,\n input: createDeliveryOptionsForSelectedVariantInput\n});\n\nexport default getDeliveryOptionsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput, ICoreContext } from '@msdyn365-commerce/core';\nimport { ProductDimensionType, ProductDimensionValueInventoryAvailability, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\n\nimport {\n getDimensionAvailabilitiesForProductsAction,\n ProductsDimensionAvailabilitiesInput\n} from './get-dimension-availabilities-for-products';\nimport {\n ArrayExtensions,\n checkIfShouldDisplayAsSwatch,\n DimensionTypes,\n DimensionSwatchDisplayTypes,\n getInventoryLevelCodeFromDimensionValue,\n IDimensionsApp,\n InventoryLevelValues\n} from './utilities';\n\n/**\n * Input class for the GetDimensionAvailabilitiesForProductSearchResult Data Action.\n */\nexport class DimensionAvailabilitiesForProductSearchResultInput implements IActionInput {\n public products: ProductSearchResult[];\n\n public dimensionContext: ICoreContext;\n\n public displayType: DimensionSwatchDisplayTypes | undefined;\n\n public constructor(\n products: ProductSearchResult[],\n dimensionContext: ICoreContext,\n displayType?: DimensionSwatchDisplayTypes\n ) {\n this.products = products;\n this.dimensionContext = dimensionContext;\n this.displayType = displayType;\n }\n\n /**\n * Get the cache key.\n * @returns The cache key.\n */\n public getCacheKey = (): string =>\n `DimensionAvailabilitiesForProductSearchResult-${this.products.map(product => product.RecordId).join('-')}`;\n\n /**\n * Get the cache object type.\n * @returns The cache object type.\n */\n public getCacheObjectType = (): string => 'ProductDimensionValueInventoryAvailability';\n\n /**\n * Define the data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetDimensionAvailabilitiesForProductSearchResultDataAction.\n * @param products -- The product search result.\n * @param dimensionContext -- The dimension app context.\n * @returns The input.\n */\nexport const createDimensionAvailabilitiesForProductSearchResultInput = (\n products: ProductSearchResult[],\n dimensionContext: ICoreContext\n): DimensionAvailabilitiesForProductSearchResultInput => {\n return new DimensionAvailabilitiesForProductSearchResultInput(products, dimensionContext);\n};\n\n/**\n * The Action Method for the GetDimensionAvailabilitiesForProductSearchResultInput Data Action\n * Gets the active price for product search result via the getDimensionAvailabilitiesForProduct API.\n * @param input -- The data input.\n * @param context -- The core context.\n * @returns The ProductsDimensionsAvailabilities.\n */\nexport async function getDimensionAvailabilitiesForProductSearchResultAction(\n input: DimensionAvailabilitiesForProductSearchResultInput,\n context: IActionContext\n): Promise {\n const products = input.products;\n const productsDimensionInputs: ProductsDimensionAvailabilitiesInput[] = [];\n const inventoryLevel = input.dimensionContext.app.config.inventoryLevel;\n const displayType = input.displayType;\n\n for (const product of products) {\n const filteredProductAttributes = product.AttributeValues?.filter(attributeValue => {\n return checkIfShouldDisplayAsSwatch(\n (attributeValue.Name?.toLocaleLowerCase() ?? '') as DimensionTypes,\n input.dimensionContext,\n displayType\n );\n });\n\n if (ArrayExtensions.hasElements(filteredProductAttributes)) {\n for (const attributeValue of filteredProductAttributes) {\n if (attributeValue.Name) {\n const productionDimensionType: ProductDimensionType =\n ProductDimensionType[attributeValue.Name as keyof typeof ProductDimensionType];\n\n productsDimensionInputs.push(\n new ProductsDimensionAvailabilitiesInput(\n product.MasterProductId ?? product.RecordId,\n productionDimensionType,\n context.requestContext\n )\n );\n }\n }\n }\n }\n\n if (!ArrayExtensions.hasElements(productsDimensionInputs)) {\n return Promise.resolve([]);\n }\n\n try {\n const dimensionForProducts: ProductDimensionValueInventoryAvailability[][] = await getDimensionAvailabilitiesForProductsAction(\n productsDimensionInputs,\n context\n );\n const productsDimensionAvailabilities = productsDimensionInputs.map((dimensionInput, index) => {\n return dimensionForProducts[index].map(dimensionValuesWithInventory => {\n const inventoryLevelCode = getInventoryLevelCodeFromDimensionValue(dimensionValuesWithInventory, inventoryLevel);\n const dimensionValue = dimensionValuesWithInventory.DimensionValue!;\n return {\n value: dimensionValue.Value ?? '',\n isDisabled: inventoryLevelCode === InventoryLevelValues.outOfStock,\n masterProductId: dimensionInput.masterProductId\n };\n });\n });\n\n if (!ArrayExtensions.hasElements(productsDimensionAvailabilities)) {\n context.telemetry.warning('ProductsDimensionAvailabilities is empty');\n return Promise.resolve([]);\n }\n\n return Promise.resolve(productsDimensionAvailabilities);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error.\n context.telemetry.warning(error);\n }\n\n return Promise.resolve([]);\n}\n\n/**\n * The GetDimensionAvailabilitiesForProductSearchResult data action.\n */\nexport const getDimensionAvailabilitiesForProductSearchResultDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimension-availabilities-for-product-search-result',\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\n action: >getDimensionAvailabilitiesForProductSearchResultAction,\n input: createDimensionAvailabilitiesForProductSearchResultInput\n});\n\nexport default getDimensionAvailabilitiesForProductSearchResultDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n ProductDimensionAvailabilitySearchCriteria,\n ProductDimensionType,\n ProductDimensionValueInventoryAvailability,\n ProductsDataActions\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Interface for IProductDimension.\n */\nexport interface IProductDimension {\n masterProductId: number;\n requestDimensionType: ProductDimensionType;\n}\n\n/**\n * Product Input.\n */\nexport class ProductsDimensionAvailabilitiesInput implements IActionInput {\n public masterProductId: number;\n\n public requestDimensionType: ProductDimensionType;\n\n public catalogId?: number;\n\n public constructor(masterProductId: number, requestDimensionType: ProductDimensionType, requestContext?: IRequestContext) {\n this.masterProductId = masterProductId;\n this.requestDimensionType = requestDimensionType;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => {\n return `MasterProductId-${this.masterProductId.toString()}-DimensionType-${this.requestDimensionType}-Availabilities-${this\n .catalogId ?? 0}`;\n };\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType = (): string => 'MasterProductDimensionAvailabilities';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Create input method for the getDimensionsForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nexport const createProductsDimensionAvailabilitiesInput = (\n inputData: ICreateActionContext>\n): ProductsDimensionAvailabilitiesInput[] => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- ignore type of config.\n const productsDimensions: IProductDimension[] = inputData.config?.productsDimensions;\n\n return productsDimensions.map((productDimension: IProductDimension) => {\n return new ProductsDimensionAvailabilitiesInput(\n productDimension.masterProductId,\n productDimension.requestDimensionType,\n inputData.requestContext\n );\n });\n};\n\n/**\n * Action Method for the getDimensionsForSelectedVariant Data Action.\n * @param inputs - Input for the data action.\n * @param context - Action context.\n * @returns Master product dimensions with availabilities.\n */\nexport async function getDimensionAvailabilitiesForProductsAction(\n inputs: ProductsDimensionAvailabilitiesInput[],\n context: IActionContext\n): Promise {\n if (!Array.isArray(inputs) || !ArrayExtensions.hasElements(inputs)) {\n context.trace('[getDimensionAvailabilitiesForProductsAction] Invalid or empty inputs passed.');\n return [];\n }\n\n const promise = inputs.map(input => {\n // As per default PDP loads shipping inventory policies, so making swatch to pick the same configuration\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(\n context,\n [input.masterProductId],\n true,\n undefined,\n undefined\n );\n\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValue: input.requestDimensionType,\n MatchingDimensionValues: undefined,\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n input.masterProductId,\n searchCriteria\n );\n\n return dimensionValuesPromise;\n });\n\n // eslint-disable-next-line no-return-await -- existing code\n return await Promise.all(promise);\n}\n\n/**\n * The GetDimensionAvailabilitiesForProductsAction\n * Gets the available product dimensions for the master product via the getDimensionValues RetailServer API.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimension-availabilities-for-products',\n action: getDimensionAvailabilitiesForProductsAction as IAction,\n input: createProductsDimensionAvailabilitiesInput,\n isBatched: true\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductDimensionsWithAvailabilitiesFull, ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n ProductDimension,\n ProductDimensionAvailabilitySearchCriteria,\n ProductDimensionValue,\n ProductDimensionValueInventoryAvailability,\n ProductsDataActions\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getDimensionValuesFromQuery, getSelectedProductIdFromActionInput } from './utilities/utils';\n\n/**\n * Defines the dimension value type for get dimensions for selected variant data action.\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\n */\nexport interface IDimensionValueForSelectedVariant extends ProductDimensionValueInventoryAvailability, ProductDimensionValue {}\n\n/**\n * Defines the returned type for get dimensions for selected variant data action.\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\n */\nexport interface IDimensionForSelectedVariant extends ProductDimensionFull, IProductDimensionsWithAvailabilitiesFull {}\n\n/**\n * Input class for the getDimensionsForSelectedVariant data action.\n */\nexport class GetDimensionsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public matchingDimensionValues: ProductDimension[];\n\n public catalogId?: number;\n\n public constructor(\n productId: number,\n channelId: number,\n matchingDimensionValues?: ProductDimension[],\n requestContext?: IRequestContext\n ) {\n this.productId = productId;\n this.channelId = channelId;\n this.matchingDimensionValues = matchingDimensionValues || [];\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => `DimensionsForSelectedVariantInput-${this.productId}-${this.channelId}-${this.catalogId ?? 0}`;\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType: () => string = () => 'DimensionsForSelectedVariantInput';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create input method for the getDimensionsForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nconst createDimensionsForSelectedVariantInput = (inputData: ICreateActionContext>): GetDimensionsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new GetDimensionsForSelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n getDimensionValuesFromQuery(inputData.requestContext.url.requestUrl),\n inputData.requestContext\n );\n }\n throw new Error('Unable to create DimensionsForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Converts new API type with availabilities to old API type to preserve backward compatibility.\n * @param dimensions - Dimensions to convert.\n * @returns Dimensions in old API format.\n */\nconst prepareDimensionsDataResult = (dimensions: IProductDimensionsWithAvailabilitiesFull[]): IDimensionForSelectedVariant[] => {\n return dimensions.map(newDimension => {\n const oldDimension: IDimensionForSelectedVariant = { ...newDimension };\n oldDimension.DimensionValues = ArrayExtensions.validValues(\n newDimension.dimensionValuesWithInventory?.map(value => value.DimensionValue)\n );\n return oldDimension;\n });\n};\n\n/**\n * Action Method for the getDimensionsForSelectedVariant Data Action.\n * @param input - Input for the data action.\n * @param context - Action context.\n * @returns Product dimensions with availability.\n */\nexport async function getDimensionsForSelectedVariantAction(\n input: GetDimensionsForSelectedVariantInput,\n context: IActionContext\n): Promise {\n const activeProducts = ArrayExtensions.validValues(\n await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n input.channelId,\n [input.productId],\n null,\n input.catalogId ?? 0\n )\n );\n\n if (!ArrayExtensions.hasElements(activeProducts)) {\n return [];\n }\n\n const activeProduct = activeProducts[0];\n\n if (!ArrayExtensions.hasElements(activeProduct.Dimensions)) {\n return [];\n }\n\n const promises = activeProduct.Dimensions.map(dimension => {\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\n\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\n MatchingDimensionValues: input.matchingDimensionValues.filter(item => item.DimensionTypeValue !== dimension.DimensionTypeValue),\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n activeProduct.MasterProductId ? activeProduct.MasterProductId : activeProduct.RecordId,\n searchCriteria\n );\n const fullDimensionPromise = dimensionValuesPromise.then(dimensionValues => {\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\n ...dimension,\n dimensionValuesWithInventory: dimensionValues\n };\n return fullDimension;\n });\n\n return fullDimensionPromise;\n });\n\n const dimensionValuesResults = await Promise.all(promises);\n\n return prepareDimensionsDataResult(dimensionValuesResults);\n}\n\n/**\n * The GetDimensionsForSelectedVariantDataAction\n * Get the currently selected Variant via the getSelectedVariant data action, and the gets the\n * available product dimensions for the variant via the getDimensionValues RetailServer API.\n */\nexport const getDimensionsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimensions/for-selected-variant',\n action: getDimensionsForSelectedVariantAction as IAction,\n input: createDimensionsForSelectedVariantInput\n});\n\nexport default getDimensionsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { FeatureState, StoreOperationsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the getFeatureState data action.\n * The life time of the data action is 'application'.\n */\nexport class FeatureStateInput implements IActionInput {\n // Any additional feature names that needs to be checked in the code for enablement needs to be appended here:\n public readonly featureNames: string[] = [\n 'Dynamics.AX.Application.RetailB2BEcommerceFeature',\n 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature',\n 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature',\n 'Dynamics.AX.Application.RetailSearchPriceRangeFeature',\n 'Dynamics.AX.Application.RetailSalesAgreementPriceSupportFeature',\n 'Dynamics.AX.Application.ChannelMultipleCatalogsFeature',\n 'Dynamics.AX.Application.RetailAsyncAddressCreationFeature'\n ];\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'FeatureState';\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'FeatureState';\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput method for the getFeatureState method.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nexport const createGetFeatureStateInput = (inputData: ICreateActionContext>): IActionInput => {\n return new FeatureStateInput();\n};\n\n/**\n * The action method for the getFeatureState data action.\n * @param input -- The action input.\n * @param ctx -- The action context.\n * @returns -- Feature state.\n */\nexport async function getFeatureStateAction(input: FeatureStateInput, ctx: IActionContext): Promise {\n const featureState = await StoreOperationsDataActions.getFeatureStatesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n input.featureNames\n );\n return featureState;\n}\n\n/**\n * The getFeatureState data action.\n * Gets the feature state via the read RetailServer API.\n * @returns Address information associated with the retrieved customer.\n */\nexport const getFeatureStateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-feature-state',\n action: getFeatureStateAction as IAction,\n input: createGetFeatureStateInput\n});\n\nexport default getFeatureStateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ChannelDeliveryOption,\n DeliveryModeTypeFilter,\n FeatureState,\n ItemAvailability,\n OrgUnitAvailability,\n OrgUnitLocation,\n ProductWarehouseInventoryInformation,\n SearchArea,\n StoreHours\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n getChannelDeliveryOptionsAsync,\n getOrgUnitLocationsByAreaAsync,\n getStoreHoursAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport { getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { IFullOrgUnitAvailability } from './utilities/full-org-unit-availability';\nimport { DeliveryMode, IProductInventoryInformation } from './utilities/product-inventory-information';\nimport { createInventoryAvailabilitySearchCriteria, mapProductInventoryInformation } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Get selected variant action input class.\n */\nexport class GetFullAvailableInventoryNearbyInput implements IActionInput {\n public latitude?: number;\n\n public longitude?: number;\n\n public radius?: number;\n\n public productId?: number;\n\n public DistanceUnitValue?: number;\n\n public IgnoreLocation?: boolean;\n\n constructor(\n _productId?: number,\n _latitude?: number,\n _longitude?: number,\n _radius?: number,\n _DistanceUnitValue?: number,\n _IgnoreLocation?: boolean\n ) {\n this.productId = _productId;\n this.latitude = _latitude;\n this.longitude = _longitude;\n this.radius = _radius;\n this.DistanceUnitValue = _DistanceUnitValue;\n this.IgnoreLocation = _IgnoreLocation;\n }\n\n public getCacheKey = () => 'GetFullAvailableInventoryNearbyInputCache';\n\n public getCacheObjectType = () => 'GetFullAvailableInventoryNearbyInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns GetFullAvailableInventoryNearbyInput - The action input.\n */\nexport const createGetFullAvailableInventoryNearbyInput = (\n inputData: ICreateActionContext>\n): GetFullAvailableInventoryNearbyInput => {\n return new GetFullAvailableInventoryNearbyInput();\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context - The context.\n * @returns FeatureState - The feature state.\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * Action method for the getSelectedVariant data aciton.\n * @param input - The action input class.\n * @param ctx - The action context.\n * @returns IFullOrgUnitAvailability - The full org unit availability.\n */\nexport async function getFullAvailableInventoryNearbyAction(\n input: GetFullAvailableInventoryNearbyInput,\n ctx: IActionContext\n): Promise {\n // No valid product we want to return undefined so module knows there are no results yet\n if (!input.productId) {\n return undefined;\n }\n\n if (((!input.radius && input.radius !== 0) || !input.latitude || !input.longitude) && !input.IgnoreLocation) {\n // No valid location we want to return empty array so module can show no locations message\n return [];\n }\n\n const searchArea: SearchArea = {\n Latitude: input.latitude,\n Longitude: input.longitude,\n Radius: input.radius,\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\n };\n\n const featureState = await getFeatureState(ctx);\n const retailMulitplePickupMFeatureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, [input.productId], false, true, searchArea, DeliveryMode.pickup);\n return getEstimatedAvailabilityAsync({ callerContext: ctx }, searchCriteria)\n .then(async (productWarehouseInformation: ProductWarehouseInventoryInformation) => {\n // For store selector, inventory should always come from an individual store\n const productInventoryInformation = mapProductInventoryInformation(\n ctx,\n productWarehouseInformation.ProductWarehouseInventoryAvailabilities\n );\n return getOrgUnitLocationsByAreaAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n searchArea,\n DeliveryModeTypeFilter.Pickup\n )\n .then(async (stores: OrgUnitLocation[]) => {\n // Constructing a store mapping based on the InventoryId.\n const storeMap = new Map();\n stores.forEach(store => {\n if (store.InventoryLocationId) {\n storeMap.set(store.InventoryLocationId, store);\n }\n });\n\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\n\n // If multiple pickup mode is enable then call getchanneldeliveryoption\n if (retailMulitplePickupMFeatureState) {\n const orgUnitChannel = stores.map(store => store.ChannelId);\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\n }\n\n const availabilityPromiseList = stores.map(store => {\n const locationDeliveryOption = locationDeliveryOptions?.find(\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\n );\n return _getAvailabilityWithHours(store, productInventoryInformation, storeMap, ctx, locationDeliveryOption);\n });\n\n return Promise.all(availabilityPromiseList);\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\n return [];\n });\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\n );\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\n );\n return [];\n });\n}\n\n/**\n * Action method that obtains the store information along with store hours and product availability.\n * @param orgUnitLocation - The org unit location.\n * @param productInventoryInformation - The product inventory information.\n * @param storeMap - A map that contains store information group by the inventory location id.\n * @param ctx The action context.\n * @param channelDeleiveryOptions - The channel delivery options.\n * @returns IFullOrgUnitAvailability - The full org unit availability.\n */\nasync function _getAvailabilityWithHours(\n orgUnitLocation: OrgUnitLocation,\n productInventoryInformation: IProductInventoryInformation[],\n storeMap: Map,\n ctx: IActionContext,\n channelDeleiveryOptions: ChannelDeliveryOption | undefined\n): Promise {\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\n return { OrgUnitAvailability: undefined };\n }\n\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\n .then((hours: StoreHours) => {\n const itemAvailabilities: ItemAvailability[] = [];\n if (productInventoryInformation && storeMap) {\n productInventoryInformation.forEach(element => {\n if (\n element.InventLocationId &&\n storeMap.has(element.InventLocationId) &&\n element.InventLocationId === orgUnitLocation.InventoryLocationId\n ) {\n itemAvailabilities.push({ AvailableQuantity: element.ProductAvailableQuantity?.AvailableQuantity });\n }\n });\n }\n\n const availability: OrgUnitAvailability = {\n OrgUnitLocation: orgUnitLocation,\n ItemAvailabilities: itemAvailabilities\n };\n\n if (hours && !(hours instanceof Error)) {\n return {\n OrgUnitAvailability: availability,\n StoreHours: hours,\n ProductInventoryInformation: productInventoryInformation,\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\n };\n }\n\n return {\n OrgUnitAvailability: availability,\n ProductInventoryInformation: productInventoryInformation,\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\n };\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting availability with hours');\n return { OrgUnitAvailability: {} };\n });\n}\n\n/**\n * Action method that obtains the channel delivery option information.\n * @param channelCollection - The org unit channel Id list.\n * @param ctx - The action context.\n * @returns ChannelDeliveryOption - The channel delivery option collection.\n */\nasync function _getLocationPickUpDeliveryModes(\n channelCollection: (number | undefined)[],\n ctx: IActionContext\n): Promise {\n if (channelCollection?.length === 0 || channelCollection === undefined) {\n return undefined;\n }\n\n const channelIdList: number[] = [];\n channelCollection?.map(id => {\n if (id !== undefined) {\n return channelIdList.push(id);\n }\n });\n\n // To get all channel pickup delivery mode filterOption should be 4\n return getChannelDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n channelIdList,\n 4\n )\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\n return channelDeliveryOptions;\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n return [];\n });\n}\n\n/**\n * The complete getFullAvailableInventoryNearby data action.\n */\nexport const getFullAvailableInventoryNearbyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-available-inventory-nearby',\n action: >getFullAvailableInventoryNearbyAction,\n input: createGetFullAvailableInventoryNearbyInput\n});\n\nexport default getFullAvailableInventoryNearbyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ProductList } from '@msdyn365-commerce/retail-proxy';\n\nimport { QuickOrderTemplateLine } from './quick-order-template-line';\n\n/**\n * Quick Order template class.\n */\nexport class QuickOrderTemplate {\n public productList: ProductList;\n\n public quickOrderTemplateLines: QuickOrderTemplateLine[];\n\n public totalLines: number;\n\n public constructor(productList: ProductList, quickOrderTemplateLines: QuickOrderTemplateLine[], totalLines: number) {\n this.productList = productList;\n this.quickOrderTemplateLines = quickOrderTemplateLines;\n this.totalLines = totalLines;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\n\nimport getProductList, { GetProductListInput } from './get-product-list';\nimport getProductListLines, { GetProductListLinesInput } from './get-product-list-lines';\nimport { QuickOrderTemplate } from './utilities/quick-order-templates';\n\n/**\n * Input class for the GetProductList data action.\n */\nexport class GetFullProductListInput implements IActionInput {\n public productListId: string | undefined;\n\n public constructor(productListId?: string) {\n this.productListId = productListId;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'GetFullProductList';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'GetFullProductList';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - ProductListId.\n * @returns - Input for data action.\n */\nexport const createGetFullProductListInput = (inputData: ICreateActionContext, productListId?: string): GetFullProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full product list. User is not authenticated.');\n }\n\n return new GetFullProductListInput(productListId);\n};\n\n/**\n * The action method for the GetFullProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Quick Order Template object.\n */\nexport async function getFullProductListAction(input: GetFullProductListInput, context: IActionContext): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full quick order template. User is not authenticated.');\n }\n\n const inputParameters = new GetProductListInput(input.productListId);\n const quickorderTemplate = await getProductList(inputParameters, context).then(productLists => {\n const inputLines = new GetProductListLinesInput(productLists[0].Id);\n return getProductListLines(inputLines, context).then(linesState => {\n return new QuickOrderTemplate(productLists[0], linesState.lines, linesState.totalCount);\n });\n });\n return quickorderTemplate;\n}\n\n/**\n * The GetFullProductList Data Action\n * Returns order templates.\n */\nexport const getFullProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-product-list',\n action: getFullProductListAction as IAction,\n input: createGetFullProductListInput\n});\n\nexport default getFullProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct, IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport { refineSearchByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from './get-full-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Refine search for full products input.\n */\nexport class FullProductsRefineSearchByCategoryInput implements IActionInput {\n public readonly categoryId?: number;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly catalogId: number;\n\n public ProductDetailsCriteria?: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n categoryId?: number,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number,\n criteria?: ProductDetailsCriteria\n ) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.categoryId = categoryId;\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.catalogId = catalogId ?? 0;\n this.ProductDetailsCriteria = criteria;\n }\n\n public getCacheKey = () => 'FullProductsRefineSearchByCategoryInputCache';\n\n public getCacheObjectType = () => 'FullProductsRefineSearchByCategoryInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the core action calls.\n * @param inputData\n */\nexport const createFullProductsRefineSearchByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n if (!Array.isArray(refinementCriteria)) {\n return new FullProductsRefineSearchByCategoryInput(queryResultSettingsProxy);\n }\n\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.categoryId) {\n const categoryId = Number(inputData.requestContext.query.categoryId);\n const channelId = inputData.requestContext.apiSettings.channelId;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n return new FullProductsRefineSearchByCategoryInput(\n queryResultSettingsProxy,\n categoryId,\n +channelId,\n refinementCriteria,\n undefined,\n productDetailsCriteria\n );\n }\n\n throw new Error('Please specify categoryId, refinerId, and refinerSourceValue query string in request.');\n};\n\n/**\n * Calls the refine-search-by-category action.\n * Based on search result calls get-full-products to get all the product details.\n * @param input\n * @param ctx\n */\nexport async function getFullProductsByRefineSearchCategoryAction(\n input: FullProductsRefineSearchByCategoryInput,\n ctx: IActionContext\n): Promise {\n if (!input || !input.refinementCriteria) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] Invalid input.');\n return {};\n }\n\n const hasSortingColumn =\n input.queryResultSettingsProxy.QueryResultSettings &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting.Columns &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting.Columns.length > 0;\n if (input.refinementCriteria.length === 0 && !hasSortingColumn) {\n ctx.telemetry.trace('[getFullProductsByRefineSearchCategoryAction] No refiners or sorting specified.');\n return {};\n }\n const { apiSettings } = ctx.requestContext;\n\n const catalogId = getCatalogId(ctx.requestContext);\n\n let refinementCriteria: ProductRefinerValue[] = [];\n const fullProductInputs = await refineSearchByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.channelId || 0,\n input.catalogId || catalogId,\n input.categoryId || 0,\n input.refinementCriteria\n ).then(searchResults => {\n refinementCriteria = input.refinementCriteria;\n return searchResults.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(\n product.RecordId,\n apiSettings,\n input.ProductDetailsCriteria || new ProductDetailsCriteria(),\n ctx.requestContext\n );\n }\n );\n });\n\n if (fullProductInputs.length > 0) {\n const productResult = await (>getFullProducts(fullProductInputs, ctx));\n return {\n productSearchResult: productResult,\n refinementCriteria\n };\n }\n return {\n productSearchResult: [],\n refinementCriteria\n };\n}\n\nexport const getFullProductsByRefineSearchCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products-by-refine-search-category',\n action: >getFullProductsByRefineSearchCategoryAction,\n input: createFullProductsRefineSearchByCategoryInput,\n isBatched: false\n});\n\nexport default getFullProductsByRefineSearchCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\nimport { refineSearchByTextAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { ProductDetailsCriteria } from './get-full-products';\nimport { parseSearchData } from './utilities/input-data-parser';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getRefinedFullProducts, IRefinableProductsInput } from './utilities/refiner-utils';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Input for refining products returned by the search text.\n */\nexport class FullProductsRefineSearchByTextInput implements IActionInput, IRefinableProductsInput {\n public readonly searchText: string;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly itemsPerPage?: number;\n\n public readonly skipCount?: number;\n\n public readonly catalogId: number;\n\n public productDetailsCriteria?: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n public constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n searchText?: string,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number,\n criteria?: ProductDetailsCriteria\n ) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.searchText = searchText || '';\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.catalogId = catalogId ?? 0;\n this.productDetailsCriteria = criteria;\n }\n\n public getCacheKey = () => 'FullProductsRefineSearchByTextInputCache';\n\n public getCacheObjectType = () => 'FullProductsRefineSearchByTextInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the core action calls.\n * @param inputData\n */\nexport const createFullProductsRefineSearchByTextInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n if (!Array.isArray(refinementCriteria)) {\n return new FullProductsRefineSearchByTextInput(queryResultSettingsProxy);\n }\n\n const searchInputData = parseSearchData(inputData);\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n\n return new FullProductsRefineSearchByTextInput(\n queryResultSettingsProxy,\n searchInputData.q,\n searchInputData.channelId,\n refinementCriteria,\n undefined,\n productDetailsCriteria\n );\n};\n\n/**\n * Calls the refine-search-by-text action.\n * Based on search result calls get-full-products to get all the product details.\n * @param input\n * @param ctx\n */\nexport function getFullProductsByRefineSearchTextAction(\n input: FullProductsRefineSearchByTextInput,\n ctx: IActionContext\n): Promise {\n const catalogId = getCatalogId(ctx.requestContext);\n\n return getRefinedFullProducts(input, ctx, () => {\n return refineSearchByTextAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.channelId || 0,\n input.catalogId || catalogId,\n input.searchText,\n input.refinementCriteria\n );\n });\n}\n\nexport const getFullProductsByRefineSearchTextActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products-by-refine-search-text',\n action: >getFullProductsByRefineSearchTextAction,\n input: createFullProductsRefineSearchByTextInput,\n isBatched: false\n});\n\nexport default getFullProductsByRefineSearchTextActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from '../get-full-products';\n\n/**\n * Common refinable products input includes both product detail criteria and refinement criteria.\n */\nexport interface IRefinableProductsInput {\n refinementCriteria: ProductRefinerValue[];\n productDetailsCriteria?: ProductDetailsCriteria;\n}\n\n/**\n * If refinement criteria is set, then gets refined products.\n * @param input Refinable products input.\n * @param ctx Action context.\n * @param getRefinedProducts Callback function to get a promise (e.g. RefineSearchByCategoryAsync, refineSearchByTextAsync)\n * that is executed to get refined products or full set of products.\n */\nexport async function getRefinedFullProducts(\n input: IRefinableProductsInput,\n ctx: IActionContext,\n getRefinedProducts: () => Promise\n): Promise {\n if (!input || !input.refinementCriteria) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] Invalid input.');\n return {};\n }\n\n if (input.refinementCriteria.length === 0) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] No refiners specified.');\n return {};\n }\n const { apiSettings } = ctx.requestContext;\n\n let fullProductInputs: FullProductInput[] = [];\n\n const searchResults = await getRefinedProducts();\n if (!searchResults) {\n ctx.telemetry.error('[getFullProductsByRefineSearchCategoryAction] no searchResults returned');\n } else {\n fullProductInputs = searchResults.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(\n product.RecordId,\n apiSettings,\n input.productDetailsCriteria || new ProductDetailsCriteria(),\n ctx.requestContext\n );\n }\n );\n }\n\n if (fullProductInputs.length > 0) {\n const productResult = await getFullProducts(fullProductInputs, ctx);\n return {\n productSearchResult: productResult,\n refinementCriteria: input.refinementCriteria\n };\n }\n return {\n productSearchResult: [],\n refinementCriteria: input.refinementCriteria\n };\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCatalogId, IRequestContext, versionLt } from '@msdyn365-commerce/core-internal';\nimport { getCartFromCustomer } from '@msdyn365-commerce/global-state';\nimport { AffiliationLoyaltyTier, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\nimport { getActivePricesAsync, getProductRatingsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getSimpleProducts, { ProductInput } from './get-simple-products';\nimport { ArrayExtensions, QueryResultSettingsProxy } from './utilities';\nimport { buildCacheKey, generateKey, getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Full Product Input.\n */\nexport class FullProductInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public readonly catalogId?: number;\n\n public ProductDetailsCriteria: ProductDetailsCriteria;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n productId: number | string,\n apiSettings: ICommerceApiSettings,\n criteria: ProductDetailsCriteria,\n requestContext?: IRequestContext,\n catalogId?: number\n ) {\n this.productId = typeof productId === 'string' ? Number.parseInt(productId, 10) : productId;\n this.ProductDetailsCriteria = criteria;\n this.apiSettings = apiSettings;\n this.channelId = apiSettings.channelId;\n this.catalogId = catalogId;\n\n if (this.catalogId === undefined && requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () => {\n const { getPrice, getRating } = this.ProductDetailsCriteria;\n return buildCacheKey(generateKey([this.productId, this.catalogId, getPrice, getRating]), this.apiSettings);\n };\n\n public getCacheObjectType = () => 'FullProduct';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Class to define criteria to get full product like price, ratings etc.\n */\nexport class ProductDetailsCriteria {\n public getPrice: boolean;\n\n public getRating: boolean;\n\n constructor(getPrice?: boolean, getRating?: boolean) {\n this.getPrice = getPrice || false;\n this.getRating = getRating || false;\n }\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createInput = (inputData: ICreateActionContext>): IActionInput[] => {\n let productIds = inputData.config && inputData.config.productIds;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n if (typeof productIds === 'string') {\n productIds = productIds.split(',');\n }\n if (Array.isArray(productIds) && productIds.length > 0) {\n return productIds.map((productId: string) => {\n return new FullProductInput(+productId, inputData.requestContext.apiSettings, productDetailsCriteria, inputData.requestContext);\n });\n }\n return [];\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed ProductInput.\n * @param inputs\n * @param ctx\n */\nexport async function getFullProductsAction(inputs: FullProductInput[], ctx: IActionContext): Promise {\n if (!Array.isArray(inputs) || inputs.length === 0) {\n ctx.trace('[getFullProductsAction] Invalid or empty inputs passed.');\n return {};\n }\n\n const { apiSettings } = ctx.requestContext;\n const productInputs = inputs.map(\n (input: FullProductInput): ProductInput => {\n return new ProductInput(input.productId, apiSettings, undefined, undefined, ctx.requestContext);\n }\n );\n\n return getSimpleProducts(productInputs, ctx)\n .then(result => {\n return result.map(product => {\n return { ProductDetails: product };\n });\n })\n .then((productCollection: FullProduct[]) => {\n const validProductIds = new Set(productCollection.map(input => input.ProductDetails && input.ProductDetails.RecordId));\n\n const ratingsAndPricePromises = [\n _getActivePrices(inputs, validProductIds, productCollection, ctx),\n _getProductRatings(inputs, validProductIds, productCollection, ctx)\n ];\n return Promise.all(ratingsAndPricePromises).then(() => {\n return productCollection;\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to get Simple products');\n return [];\n });\n}\n\nasync function _getActivePrices(\n inputs: FullProductInput[],\n validProductIds: Set,\n productCollection: FullProduct[],\n ctx: IActionContext\n): Promise {\n let catalogId = 0;\n if (ArrayExtensions.hasElements(inputs)) {\n catalogId = inputs[0].catalogId ?? 0;\n }\n\n const projectDomain: ProjectionDomain = { ChannelId: +ctx.requestContext.apiSettings.channelId, CatalogId: catalogId };\n const validInputs = inputs\n .map(input => {\n if (input.ProductDetailsCriteria.getPrice && validProductIds.has(input.productId)) {\n return input.productId;\n }\n })\n .filter(Boolean);\n\n let affiliations: AffiliationLoyaltyTier[] | undefined = [];\n if (ctx.requestContext.user.isAuthenticated) {\n const cart = await getCartFromCustomer(ctx);\n affiliations = cart?.AffiliationLines;\n }\n\n if (validInputs.length === 0) {\n return Promise.resolve();\n }\n\n return getActivePricesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n projectDomain,\n validInputs,\n new Date(),\n null,\n affiliations,\n true\n )\n .then(result => {\n result.forEach(productPrice => {\n const fullProduct: FullProduct | undefined = productCollection.find(x => {\n return x.ProductDetails && x.ProductDetails.RecordId === productPrice.ProductId;\n });\n if (fullProduct) {\n // If RS Version < 9.16.0 (aka 10.0.6), customer contextual price won't be\n // included so instead just use AdjustedPrice\n if (versionLt(ctx.requestContext.apiSettings.retailServerProxyVersion, '9.16.0')) {\n productPrice.CustomerContextualPrice = productPrice.AdjustedPrice;\n }\n fullProduct.ProductPrice = productPrice;\n }\n });\n })\n .catch((error: Error) => {\n const telemetry = ctx.telemetry;\n telemetry.debug('[getActivePricesAsync] Unable to get active price.');\n telemetry.exception(error);\n });\n}\n\nasync function _getProductRatings(\n inputs: FullProductInput[],\n validProductIds: Set,\n productCollection: FullProduct[],\n ctx: IActionContext\n): Promise {\n const validInputs = inputs\n .map(input => {\n if (input.ProductDetailsCriteria.getRating && validProductIds.has(input.productId)) {\n return input.productId;\n }\n })\n .filter(Boolean);\n\n if (validInputs.length === 0) {\n return Promise.resolve();\n }\n\n return getProductRatingsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n validInputs\n )\n .then(result => {\n result.forEach(productRating => {\n const fullProduct: FullProduct | undefined = productCollection.find(x => {\n return x.ProductDetails && x.ProductDetails.RecordId === productRating.ProductId;\n });\n if (fullProduct) {\n fullProduct.ProductRating = productRating;\n }\n });\n })\n .catch(error => {\n const telemetry = ctx.telemetry;\n telemetry.debug('[getProductRatingsAsync] Unable to get product ratings.');\n telemetry.exception(error);\n });\n}\n\nexport const getFullProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products',\n action: >getFullProductsAction,\n input: createInput,\n isBatched: true\n});\n\nexport default getFullProductsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { CommerceListLine } from '@msdyn365-commerce/retail-proxy';\nimport { getByCustomerAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CommerceListsDataActions.g';\n\nimport { FullProductInput, getFullProducts, getProductDetailsCriteriaFromActionInput } from '.';\n\n/**\n * Input class for getActiveWishlistItems data action.\n */\nexport class ActiveWishlistInput implements IActionInput {\n public getCacheKey = () => 'ActiveWishlistItems';\n\n public getCacheObjectType = () => 'ActiveWishlistItems';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new ActiveWishlistInput();\n};\n\n/**\n * Calls the Retail API and returns a CommerceList object based on the passed GetCartInput.\n * @param input\n * @param ctx\n */\nexport async function getActiveWishlistItems(input: ActiveWishlistInput, ctx: IActionContext): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n throw new Error('[getActiveWishlistItems]No valid Input was provided, failing');\n }\n\n if (ctx.requestContext.user.isAuthenticated) {\n const wishlists = await getByCustomerAsync(\n {\n callerContext: ctx,\n queryResultSettings: {}\n },\n null\n );\n\n if (wishlists && wishlists.length > 0) {\n const productInputs: FullProductInput[] = [];\n if (wishlists[0].CommerceListLines) {\n wishlists[0].CommerceListLines.forEach((commerceListLine: CommerceListLine) => {\n if (commerceListLine.ProductId) {\n productInputs.push(\n new FullProductInput(\n commerceListLine.ProductId,\n ctx.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(ctx),\n ctx.requestContext\n )\n );\n }\n });\n }\n\n if (productInputs.length > 0) {\n return getFullProducts(productInputs, ctx)\n .then(products => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n ctx.trace(error);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getActiveWishlistItems]Unable to hydrate cart with product information');\n throw new Error('[getActiveWishlistItems]Unable to hydrate cart with product information');\n });\n }\n ctx.trace('No productIds found for wishlist');\n } else {\n ctx.trace('[getActiveWishlistItems]Not able to get wishlists for the customer');\n return [];\n }\n }\n ctx.trace('[getActiveWishlistItems]User token not found for wishlists');\n return [];\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-items-in-wishlist',\n action: >getActiveWishlistItems,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { Image, ISubList, List } from '@msdyn365-commerce-modules/data-types';\n\nimport GetProducts, { ProductInput } from './get-simple-products';\n\n/**\n * List Input action.\n */\nexport class ListInput implements IActionInput {\n public DocumentId: string;\n\n public Title: string;\n\n public Description: string;\n\n public ShortDescription: string;\n\n public BackgroundColor: string;\n\n public ForegroundColor: string;\n\n public Images: Image[];\n\n public Items: (IProductItem[] | ISubList)[];\n\n public ProductItems: IProductItem[];\n\n public ItemsCount: number;\n\n public ItemsPerPage: number;\n\n public SkipCount: number;\n\n constructor(\n documentId: string,\n title: string,\n description: string,\n shortDescription: string,\n backgroundColor: string,\n foregroundColor: string,\n images: Image[],\n items: (IProductItem[] | ISubList)[],\n productItems: IProductItem[],\n itemsCount: number,\n itemsPerPage: number,\n skipCount: number\n ) {\n this.DocumentId = documentId;\n this.Title = title;\n this.Description = description;\n this.ShortDescription = shortDescription;\n this.BackgroundColor = backgroundColor;\n this.ForegroundColor = foregroundColor;\n this.Images = images;\n this.Items = items;\n this.ProductItems = productItems;\n this.ItemsCount = itemsCount;\n this.ItemsPerPage = itemsPerPage;\n this.SkipCount = skipCount;\n }\n\n public shouldCacheOutput = () => true;\n\n public getCacheObjectType = () => 'LIST';\n\n public getCacheKey = () => `${this.DocumentId}-${this.ItemsCount}-${this.ItemsPerPage}-${this.SkipCount}`;\n}\n\nexport interface IProductItem {\n RecordId: string;\n CatalogId: string;\n}\n\n/**\n * List item type enum.\n */\nenum ListItemType {\n list = 'list',\n product = 'product'\n}\n\n/**\n * Calls to getSimpleProducts to get product array by ID's in list.\n * @param input\n * @param ctx\n */\nexport async function getListData(input: ListInput, ctx: IActionContext): Promise {\n ctx.trace(`List Title: ${input.Title}`);\n\n const { apiSettings } = ctx.requestContext;\n\n const sublists: (SimpleProduct | ISubList)[] = [];\n const result: List = {\n Title: input.Title,\n Description: input.Description,\n ShortDescription: input.ShortDescription,\n BackgroundColor: input.BackgroundColor,\n ForegroundColor: input.ForegroundColor,\n Items: sublists,\n ItemsCount: input.ItemsCount\n };\n\n if (input && input.Items && input.Items.length > 0) {\n // Get all products\n let products: SimpleProduct[] = [];\n if (input.ProductItems && input.ProductItems.length > 0) {\n const inputArray = input.ProductItems.map(\n item => new ProductInput(+item.RecordId, apiSettings, undefined, undefined, ctx.requestContext)\n );\n products = await GetProducts(inputArray, ctx);\n }\n\n // Build map from recordId to product, which will be used later when build the output.\n const productMap: { [recordId: string]: SimpleProduct } = {};\n products.forEach(item => {\n if (item) {\n productMap[`${item.RecordId}`] = item;\n }\n });\n\n for (const listitem of input.Items) {\n if (isSublist(listitem)) {\n result.Items.push(listitem);\n } else {\n listitem.forEach(item => {\n if (productMap[item.RecordId]) {\n result.Items.push(productMap[item.RecordId]);\n }\n });\n }\n }\n }\n\n return result;\n}\n\n/**\n * Check if an item is sublist.\n * @param listItem\n */\nfunction isSublist(listItem: IProductItem[] | ISubList): listItem is ISubList {\n return (listItem).Images !== undefined;\n}\n\n/**\n * Get images.\n * @param images\n */\nfunction getImages(images: IGeneric[]): Image[] {\n const resultImageList: Image[] = [];\n\n if (!images) {\n return resultImageList;\n }\n\n images.forEach(item => {\n if (item && item.image && item.image.href) {\n // Add image item\n const imageItem: Image = {\n href: item.image.href,\n altText: item.image.altText,\n title: item.image.title,\n width: item.image.width,\n height: item.image.height\n };\n\n resultImageList.push(imageItem);\n }\n });\n\n return resultImageList;\n}\n\n/**\n * Get the url of sub list.\n * @param listName\n * @param sitePath\n */\nfunction getSubListUrl(listName: string, sitePath: string): string {\n if (!listName) {\n return '';\n }\n\n if (!sitePath) {\n return `/${listName}.l`;\n }\n\n // SitePath has a leading '/'\n return `${sitePath}/${listName}.l`;\n}\n\n/**\n * Get input list data.\n * @param inputData\n */\nfunction getInutListData(inputData: ICreateActionContext, IGeneric>): IGeneric {\n let listData =\n !inputData || !inputData.requestContext || !inputData.requestContext.pageData ? null : inputData.requestContext.pageData.list;\n if (\n !inputData ||\n !inputData.requestContext ||\n !inputData.requestContext.pageData ||\n !inputData.requestContext.pageData.list ||\n !inputData.requestContext.pageData.list.content ||\n !inputData.requestContext.pageData.list.content.items ||\n !inputData.requestContext.pageData.list.content.title ||\n !inputData.requestContext.pageData.list._id\n ) {\n if (\n !inputData ||\n !inputData.data ||\n !inputData.data.list ||\n !inputData.data.list.content ||\n !inputData.data.list.content.items ||\n !inputData.data.list.content.title ||\n !inputData.data.list._id\n ) {\n console.error('data is not well defined for list action input');\n throw new Error('data is not well defined for list action input');\n }\n\n listData = inputData.data.list;\n }\n return listData;\n}\n\n/**\n * Get sub list item.\n * @param item\n * @param sitePathOfRequest\n */\nfunction getSubListItem(item: IGeneric, sitePathOfRequest: string): ISubList {\n const imageList: Image[] = getImages(item.fields.content.images);\n\n const sublistHref = getSubListUrl(item.fields._name, sitePathOfRequest);\n return {\n Title: item.fields.content.title,\n Description: item.fields.content.description,\n ShortDescription: item.fields.content.shortDescription,\n BackgroundColor: item.fields.content.backgroundColor,\n ForegroundColor: item.fields.content.foregroundColor,\n Href: sublistHref,\n Images: imageList\n };\n}\n\n/**\n * Get site path.\n * @param inputData\n */\nfunction getSitePath(inputData: ICreateActionContext, IGeneric>): string {\n return inputData && inputData.requestContext && inputData.requestContext.sitePath ? inputData.requestContext.sitePath : '';\n}\n\n/**\n * Get items per page.\n * @param inputData\n */\nfunction getItemsPerPage(inputData: ICreateActionContext, IGeneric>): number {\n if (!inputData || !inputData.config || !inputData.config.itemsPerPage) {\n return 50;\n }\n\n const result = Number(inputData.config.itemsPerPage);\n if (isNaN(result)) {\n return 50;\n }\n\n return result;\n}\n\n/**\n * Get skip count.\n * @param inputData\n */\nfunction getSkipCount(inputData: ICreateActionContext, IGeneric>): number {\n return inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.skipCount\n ? Number(inputData.requestContext.query.skipCount)\n : 0;\n}\n\n/**\n * Creates the input required to make the list call to get products.\n * @param inputData\n */\nconst createListInput = (inputData: ICreateActionContext, IGeneric>): IActionInput => {\n const listData: IGeneric = getInutListData(inputData);\n const listItems: (IProductItem[] | ISubList)[] = [];\n let productList: IProductItem[] = [];\n\n const parentImageList: Image[] = getImages(listData.content.images);\n\n const itemsPerPage = getItemsPerPage(inputData);\n const skipCount = getSkipCount(inputData);\n\n // This is the list contains all product and will be used to call getSimpleProducts data action.\n const productItems: IProductItem[] = [];\n const sum = skipCount + itemsPerPage;\n for (let index = skipCount; index < listData.content.items.length && index < sum; index++) {\n const item = listData.content.items[index];\n if (item.type === ListItemType.list) {\n if (!item.fields || !item.fields.content || !item.fields.content.title) {\n console.error(`sublist item fields, content or title missing in list ${listData._id}`);\n continue;\n }\n\n // If any elements in product list, then copy it and add to list items\n if (productList.length > 0) {\n const clonedList = [...productList];\n listItems.push(clonedList);\n productList = [];\n }\n\n // Build and add sublist item\n listItems.push(getSubListItem(item, getSitePath(inputData)));\n }\n\n if (item.type === ListItemType.product) {\n if (!item.fields || !item.fields.recordId) {\n console.error(`product item missing recordId in list ${listData._id}`);\n continue;\n }\n\n // Add product item\n const productItem: IProductItem = {\n RecordId: item.fields.recordId,\n CatalogId: item.fields.catalogId || '0'\n };\n\n productList.push(productItem);\n productItems.push(productItem);\n }\n }\n\n // Save the last portion of product items.\n if (productList.length > 0) {\n listItems.push(productList);\n }\n\n return new ListInput(\n listData._id,\n listData.content.title,\n listData.content.description,\n listData.content.shortDescription,\n listData.content.backgroundColor,\n listData.content.foregroundColor,\n parentImageList,\n listItems,\n productItems,\n listData.content.items.length,\n itemsPerPage,\n skipCount\n );\n};\n\nexport const getListDataDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-list',\n action: >getListData,\n input: createListInput\n});\n\nexport default getListDataDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { LoyaltyCard } from '@msdyn365-commerce/retail-proxy';\nimport {\n getCustomerLoyaltyCardsAsync,\n getLoyaltyCardAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey, QueryResultSettingsProxy } from '.';\n\n/**\n * Input class for the getLoyaltyCard data action.\n */\nexport class GetLoyaltyCardInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetLoyaltyCard-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetLoyaltyCard';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getLoyaltyCard method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetLoyaltyCardInput = (inputData: ICreateActionContext): GetLoyaltyCardInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get loyalty card input. User is not authenticated.');\n }\n\n return new GetLoyaltyCardInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getLoyaltyCard data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getLoyaltyAction(input: GetLoyaltyCardInput, ctx: IActionContext): Promise {\n return getCustomerLoyaltyCardsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n input.userAccountNumber || null\n )\n .then(cards => {\n if (!cards || cards.length === 0) {\n return {};\n }\n\n const firstCard = cards[0];\n\n return getLoyaltyCardAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n firstCard.CardNumber\n )\n .then(card => {\n card.LoyaltyEnrollmentDate = firstCard.LoyaltyEnrollmentDate;\n card.LoyaltyEnrollmentDateLocal = firstCard.LoyaltyEnrollmentDateLocal;\n return card;\n })\n\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to get loyalty card');\n throw new Error('Unable to get loyalty card');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error.message);\n ctx.telemetry.debug('Unable to get customers loyalty card');\n throw new Error('Unable to get customers loyalty card');\n });\n}\n\n/**\n * The getLoyaltyCard data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const getLoyaltyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-loyalty-card',\n action: >getLoyaltyAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetLoyaltyCardInput\n});\n\nexport default getLoyaltyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { Cart, ChannelConfiguration, LoyaltyCard, LoyaltyPointRedemptionEstimate } from '@msdyn365-commerce/retail-proxy';\nimport { getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { getOrgUnitConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\n\nimport { buildCacheKey, getLoyalty, GetLoyaltyCardInput } from '.';\n\n/**\n * Input class for the getLoyaltyCard data action.\n */\nexport class GetLoyaltyTransactionEstimationInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetLoyaltyCardTransactionEstimation-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetLoyaltyCardTransactionEstimation';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getLoyaltyCard method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetLoyaltyTransactionEstimationInput = (inputData: ICreateActionContext): GetLoyaltyTransactionEstimationInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n return new GetLoyaltyTransactionEstimationInput(inputData.requestContext.apiSettings);\n }\n\n return new GetLoyaltyTransactionEstimationInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getLoyaltyCard data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getLoyaltyTransactionEstimationAction(\n input: GetLoyaltyTransactionEstimationInput,\n ctx: IActionContext\n): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n return {};\n }\n\n const promises: [Promise, Promise, Promise] = [\n _getCart(ctx),\n _getLoyalty(input, ctx),\n _getOrgUnits(ctx)\n ];\n return Promise.all(promises)\n .then(result => {\n if (result && result.length >= 2 && result[1].CardNumber) {\n return getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync(\n { callerContext: ctx },\n result[0].Id,\n result[1].CardNumber,\n result[2].Currency || ''\n )\n .then(points => {\n return points;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Error getting Loyalty Point Redemption Estimate');\n throw new Error('Error getting Loyalty Point Redemption Estimate');\n });\n }\n return {};\n })\n .catch(error => {\n return {};\n });\n}\n\nasync function _getCart(ctx: IActionContext): Promise {\n const cartState = await getCartState(ctx);\n\n return cartState.cart;\n}\n\nasync function _getLoyalty(input: GetLoyaltyTransactionEstimationInput, ctx: IActionContext): Promise {\n const loyaltyCardInput = new GetLoyaltyCardInput(input.apiSettings);\n return getLoyalty(loyaltyCardInput, ctx);\n}\n\nasync function _getOrgUnits(ctx: IActionContext): Promise {\n return getOrgUnitConfigurationAsync({ callerContext: ctx, queryResultSettings: {} });\n}\n\n/**\n * The getLoyaltyTransactionEstimation data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const getLoyaltyTransactionEstimationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-loyalty-transaction-estimation',\n action: >getLoyaltyTransactionEstimationAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetLoyaltyTransactionEstimationInput\n});\n\nexport default getLoyaltyTransactionEstimationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getMediaLocationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { MediaLocation } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey, generateImageUrl } from './utilities/utils';\n\n/**\n * Product Input.\n */\nexport class MediaLocationsByIdInput implements IActionInput {\n public productId?: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, productId?: number, catalogId?: number) {\n this.productId = productId;\n this.channelId = +apiSettings.channelId;\n this.catalogId = catalogId || 0;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () =>\n buildCacheKey(`MediaLocationID-${this.productId && this.productId.toString()}-${this.catalogId}`, this.apiSettings);\n\n public getCacheObjectType = () => 'MediaLocations';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createMediaLocationsByIdInput = (inputData: ICreateActionContext>): MediaLocationsByIdInput => {\n const productId = (inputData.config && +inputData.config.productId) || undefined;\n const catalogId = getCatalogId(inputData.requestContext);\n return new MediaLocationsByIdInput(inputData.requestContext.apiSettings, productId, catalogId);\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed MediaLocationsByIdInput.\n * @param input\n * @param ctx\n */\nexport async function getMediaLocationsByIdAction(input: MediaLocationsByIdInput, ctx: IActionContext): Promise {\n if (input.productId) {\n return getMediaLocationsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n input.productId,\n input.channelId,\n input.catalogId\n ).then(response => {\n return response.map(\n (mediaLocation: MediaLocation): MediaLocation => {\n mediaLocation.Uri = generateImageUrl(mediaLocation.Uri, ctx.requestContext.apiSettings);\n mediaLocation.AltText = mediaLocation.AltText ? mediaLocation.AltText : '';\n return mediaLocation;\n }\n );\n });\n }\n return [];\n}\n\nexport const getMediaLocationsByIdActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-media-locations-by-id',\n action: >getMediaLocationsByIdAction,\n input: createMediaLocationsByIdInput\n});\n\nexport default getMediaLocationsByIdActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { AsyncResult, MediaLocation, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getMediaLocationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getSelectedVariant, { SelectedVariantInput } from './get-selected-variant';\nimport { generateImageUrl, getSelectedProductIdFromActionInput } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * The action input class for the getMediaLocationsForSelectedVariant data action.\n */\nexport class MediaLocationsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.catalogId = catalogId || 0;\n this.selectedProduct = selectedProduct;\n }\n\n public getCacheKey = () => 'MediaLocationsForSelectedVariant';\n\n public getCacheObjectType = () => 'MediaLocations';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the getMediaLocationsForSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createMediaLocationsForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): MediaLocationsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new MediaLocationsForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined, catalogId);\n }\n throw new Error('Unable to create MediaLocationsForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The action method for the getMediaLocationsForSelectedVariant data action.\n * @param input\n * @param ctx\n */\nexport async function getMediaLocationsForSelectedVariantAction(\n input: MediaLocationsForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return AsyncResult.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then(productResult => {\n const activeProduct = productResult?.productVariant ?? productResult;\n\n if (activeProduct) {\n return getMediaLocationsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n ).then(response => {\n return response.map(\n (mediaLocation: MediaLocation): MediaLocation => {\n mediaLocation.Uri = generateImageUrl(mediaLocation.Uri, ctx.requestContext.apiSettings);\n mediaLocation.AltText = mediaLocation.AltText ? mediaLocation.AltText : activeProduct.Name;\n return mediaLocation;\n }\n );\n });\n }\n\n return [];\n })\n .catch(error => {\n ctx.trace(error);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[getMediaLocationsForSelectedVariantAction]Error executing action');\n throw new Error('[getMediaLocationsForSelectedVariantAction]Error executing action');\n });\n}\n\n/**\n * The getMediaLocationsForSelectedVariant data action\n * Gets the currently selected variant for the page via the getSelectedVariant data action,\n * and then gets the media location information for the variant via the MediaLocations RetailServer API.\n */\nexport const getMediaLocationsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-media-locations-for-selected-variant',\n action: >getMediaLocationsForSelectedVariantAction,\n input: createMediaLocationsForSelectedVariantInput\n});\n\nexport default getMediaLocationsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { IDataServiceRequest, retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetOrderShipmentsHistoryInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\nimport { OrderShipments } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): IDataServiceRequest => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetOrderShipmentsHistoryInput(\n {\n Paging: {\n Top: 100,\n Skip: 0\n }\n },\n\n // @ts-expect-error\n null\n );\n }\n\n throw new Error('Unable to create order history input. User is not authenticated.');\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-order-history',\n action: >retailAction,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction } from '@msdyn365-commerce/core';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetOrgUnitConfigurationInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport { ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Get Org Unit Configuration Data Action.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-org-unit-configuration',\n action: >retailAction,\n input: () => {\n return createGetOrgUnitConfigurationInput();\n }\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCurrentAsync, getUsersAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\n/**\n * Input class for get customer data action.\n */\nexport class OrganizationUsersCountInput implements IActionInput {\n public getCacheKey = () => 'OrganizationUsersCount';\n\n public getCacheObjectType = () => 'BusinessPartner';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createGetOrganizationUsersCountInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new OrganizationUsersCountInput();\n};\n\nexport async function getOrganizationUsersCount(input: OrganizationUsersCountInput, ctx: IActionContext): Promise {\n return getCurrentAsync({ callerContext: ctx })\n .then(businessPartner => {\n if (!businessPartner) {\n return 0;\n }\n\n return getUsersAsync({ callerContext: ctx }, businessPartner.BusinessPartnerId)\n .then(users => {\n return users.length;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.trace('[get-organization-users-count] Unable to load users');\n throw new Error('[get-organization-users-count] Unable to load users');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[get-organization-users-count] Unable to get BusinessPartner');\n throw new Error('[get-organization-users-count] Unable to get BusinessPartner');\n });\n}\nexport default createObservableDataAction({\n id: 'get-organization-users-count',\n action: >(getOrganizationUsersCount),\n input: createGetOrganizationUsersCountInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync, getUsersAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get customer data action.\n */\nexport class OrganizationUsersInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('OrganizationUsers', this.apiSettings);\n\n public getCacheObjectType = () => 'BusinessPartner';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nexport const createGetOrganizationUsersInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new OrganizationUsersInput(requestContext.apiSettings);\n};\n\nexport async function getOrganizationUsers(input: OrganizationUsersInput, ctx: IActionContext): Promise {\n return getCurrentAsync({ callerContext: ctx })\n .then(businessPartner => {\n return getUsersAsync({ callerContext: ctx }, businessPartner.BusinessPartnerId)\n .then(users => {\n return users;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.trace('[get-organization-users] Unable to load users');\n throw new Error('[get-organization-users] Unable to load users');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[get-organization-users] Unable to get BusinessPartner');\n throw new Error('[get-organization-users] Unable to get BusinessPartner');\n });\n}\nexport const getOrganizationUsersDataAction = createObservableDataAction({\n id: 'get-organization-users',\n action: >(getOrganizationUsers),\n input: createGetOrganizationUsersInput\n});\n\nexport default getOrganizationUsersDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { convertToString, IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync, getOrderHistoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\nimport { OrderShipments } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetOrganizationWideOrderHistory data action.\n */\nexport class GetOrganizationWideOrderHistoryInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n\n constructor(queryResultSettings: IQueryResultSettings) {\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => `GetOrganizationWideOrderHistoryInput|${convertToString(this.queryResultSettings)}`;\n\n public getCacheObjectType = () => 'GetOrganizationWideOrderHistoryInput';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetOrganizationWideOrderHistory method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n */\nexport const getOrganizationWideOrderHistoryInput = (inputData: ICreateActionContext): GetOrganizationWideOrderHistoryInput => {\n if (!inputData?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get order history. User is not authenticated.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return new GetOrganizationWideOrderHistoryInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetOrganizationWideOrderHistory data action.\n * @param {GetOrganizationWideOrderHistory} input The action input.\n * @param {IActionContext} ctx The action context.\n * @param context\n */\nexport async function getOrganizationWideOrderHistory(\n input: GetOrganizationWideOrderHistoryInput,\n context: IActionContext\n): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get order history. User is not authenticated.');\n }\n\n const businessPartner = await getCurrentAsync({ callerContext: context });\n if (!businessPartner) {\n throw new Error('Unable to get order history. Failed to retrieve business partner id.');\n }\n\n return getOrderHistoryAsync(\n { callerContext: context, queryResultSettings: input.queryResultSettings },\n businessPartner.BusinessPartnerId\n );\n}\n\nexport const getOrganizationWideOrderHistoryDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-organization-wide-order-history',\n action: >getOrganizationWideOrderHistory,\n input: getOrganizationWideOrderHistoryInput\n});\n\nexport default getOrganizationWideOrderHistoryDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { ProductDeliveryOptions, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for pickup delivery options for items in cart.\n */\nexport class ProductPickUpOptionsForCartLineItems implements IActionInput {\n public readonly apiSettings: ICommerceApiSettings;\n\n public constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => buildCacheKey('ActiveCartLineItemsPickUpOptions', this.apiSettings);\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'ActiveCartLineItemsPickUpOptions';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetPickUpOptionCartLineItems method.\n * @param inputData - The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductPickUpOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the GetPickUpOptionCartLineItems data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Order Template object.\n */\nexport async function getPickUpOptionsForCartLineItems(\n input: ProductPickUpOptionsForCartLineItems,\n context: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input.apiSettings.channelId) {\n throw new Error('[getPickUpOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(context);\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), context);\n const filterOption = 4;\n const response: ProductDeliveryOptions[] = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- existing code.\n if (cart === undefined || !ArrayExtensions.hasElements(products)) {\n return Promise.resolve(response);\n }\n\n const pickupoptions = await ProductsDataActions.getDeliveryOptionsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n products.map(product => product.RecordId),\n {},\n filterOption\n );\n\n return pickupoptions;\n}\n\n/**\n * The GetPickupOptionCartLineItems Data Action\n * Returns pickup options.\n */\nexport const getPickUpOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-pickup-options-for-cartlines',\n action: getPickUpOptionsForCartLineItems as IAction,\n input: createInput\n});\n\nexport default getPickUpOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, createObservableDataAction, getCatalogId, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { getCartFromCustomer } from '@msdyn365-commerce/global-state';\nimport { ProductPrice, ProductsDataActions, ProductSearchResult, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetPriceForProductSearchResult Data Action.\n */\nexport class PriceForProductSearchResultInput implements IActionInput {\n public products: ProductSearchResult[];\n\n public constructor(products: ProductSearchResult[]) {\n this.products = products;\n }\n\n /**\n * Get the cache key.\n * @returns The cache key.\n */\n public getCacheKey = (): string => `PriceForProductSearchResult-${JSON.stringify(this.products)}`;\n\n /**\n * Get the cache object type.\n * @returns The cache object type.\n */\n public getCacheObjectType = (): string => 'ProductSearchResult';\n\n /**\n * Define the data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetPriceForProductSearchResultDataAction.\n * @param products -- The product search result.\n * @returns The input.\n */\nexport const createActivePriceForProductSearchResultInput = (products: ProductSearchResult[]): PriceForProductSearchResultInput => {\n return new PriceForProductSearchResultInput(products);\n};\n\n/**\n * The Action Method for the GetPriceForProductSearchResult Data Action\n * Gets the active price for product search result via the getActivePrice RetailServer API.\n * @param input -- The data input.\n * @param context -- The action context.\n * @returns The product search result updated with price.\n */\nexport async function getPriceForProductSearchResultAction(\n input: PriceForProductSearchResultInput,\n context: IActionContext\n): Promise {\n let productRecIds: number[];\n if (ArrayExtensions.hasElements(input.products)) {\n productRecIds = input.products.map(product => product.RecordId);\n } else {\n return Promise.resolve([]);\n }\n\n const catalogId = getCatalogId(context.requestContext);\n\n const projectDomain: ProjectionDomain = { ChannelId: +context.requestContext.apiSettings.channelId, CatalogId: catalogId };\n const cart = await getCartFromCustomer(context);\n const affiliation = cart?.AffiliationLines;\n const priceZero = 0;\n\n try {\n const productPrices: ProductPrice[] = await ProductsDataActions.getActivePricesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n projectDomain,\n productRecIds,\n new Date(),\n null,\n affiliation,\n true\n );\n\n const productResults: ProductSearchResult[] = input.products.map(product => {\n const activePrice = productPrices.find(price => price.ProductId === product.RecordId);\n if (activePrice) {\n product.Price = activePrice.CustomerContextualPrice ?? product.Price;\n product.BasePrice = Math.max(\n activePrice.BasePrice ?? priceZero,\n activePrice.TradeAgreementPrice ?? priceZero,\n activePrice.AdjustedPrice ?? priceZero\n );\n }\n return product;\n });\n\n return Promise.resolve(productResults);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error type.\n context.telemetry.exception(error);\n context.telemetry.debug('[getPriceForProductSearchResultAction]Error executing action');\n throw new Error('[getPriceForProductSearchResultAction]Error executing action');\n }\n}\n\n/**\n * The getPriceForProductSearchResult data action.\n */\nexport const getPriceForProductSearchResultDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-price-for-product-search-result',\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\n action: >getPriceForProductSearchResultAction,\n input: createActivePriceForProductSearchResultInput\n});\n\nexport default getPriceForProductSearchResultDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartFromCustomer } from '@msdyn365-commerce/global-state';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { getActivePricesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n AffiliationLoyaltyTier,\n ProductPrice,\n ProductType,\n ProjectionDomain,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetPriceForSelectedVariant Data Action.\n */\nexport class PriceForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n public customerId?: string;\n\n public constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, customerId?: string) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.customerId = customerId ?? '';\n }\n\n public getCacheKey = (): string => 'PriceForSelectedVariant';\n\n public getCacheObjectType = (): string => 'Price';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetPriceForSelectedVariantDataAction.\n * @param inputData - The input data for the createInput method.\n * @returns The PriceForSelectedVariantInput.\n */\nexport const createActivePriceForSelectedVariantInput = (inputData: ICreateActionContext>): PriceForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new PriceForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined);\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The Action Method for the GetPriceForSelectedVariant Data Action\n * Pulls the currently selected variant from the cache using the getSelectedVariant data action, and gets it's current contextual price\n * via the getActivePrice RetailServer API.\n * @param input - The input.\n * @param ctx - The ctx.\n * @returns The Promise.\n */\nexport async function getPriceForSelectedVariantAction(\n input: PriceForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n let affiliations: AffiliationLoyaltyTier[] | undefined = [];\n if (ctx.requestContext.user.isAuthenticated) {\n const cart = await getCartFromCustomer(ctx);\n affiliations = cart?.AffiliationLines;\n }\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then(async (productResult: SimpleProduct | null) => {\n const catalogId = getCatalogId(ctx.requestContext);\n const projectDomain: ProjectionDomain = {\n ChannelId: +ctx.requestContext.apiSettings.channelId,\n CatalogId: catalogId\n };\n\n const activeProduct: SimpleProduct | undefined = productResult as SimpleProduct | undefined;\n if (activeProduct) {\n const featureStates: FeatureState[] = await getFeatureStateActionDataAction(new FeatureStateInput(), ctx);\n return getActivePricesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n projectDomain,\n [activeProduct.RecordId],\n new Date(),\n input.customerId,\n affiliations,\n true,\n featureStates.find(featureState => featureState.Name === 'Dynamics.AX.Application.RetailSearchPriceRangeFeature')\n ?.IsEnabled &&\n (activeProduct.ProductTypeValue === ProductType.Master || activeProduct.ProductTypeValue === ProductType.KitMaster),\n featureStates.find(\n featureState => featureState.Name === 'Dynamics.AX.Application.RetailSalesAgreementPriceSupportFeature'\n )?.IsEnabled\n ).then((productPrices: ProductPrice[]) => {\n if (!ArrayExtensions.hasElements(productPrices)) {\n throw new Error('[getPriceForSelectedVariantAction]Invalid response recieved from getActivePricesAsync');\n }\n return productPrices[0];\n });\n }\n\n return null;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getPriceForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-price-for-selected-variant',\n action: getPriceForSelectedVariantAction as IAction,\n input: createActivePriceForSelectedVariantInput\n});\n\nexport default getPriceForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ProductAvailableQuantity,\n ProductsDataActions,\n ProductType,\n ProductWarehouseInventoryAvailability,\n ReleasedProductType\n} from '@msdyn365-commerce/retail-proxy';\n\nimport getSelectedVariant, { SelectedVariantInput } from './get-selected-variant';\nimport { ArrayExtensions, getSelectedProductIdFromActionInput } from './utilities';\nimport { DeliveryMode, IProductInventoryInformation } from './utilities/product-inventory-information';\nimport { createInventoryAvailabilitySearchCriteria, mapAggregatedProductInventoryInformation } from './utilities/product-inventory-utils';\n\n/**\n * Input class for the getProductAvailabilitiesForSelectedVariant Data Action.\n */\nexport class ProductAvailabilitiesForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public constructor(productId: number | string, channelId: number) {\n this.productId = typeof productId === 'string' ? +productId : productId;\n this.channelId = channelId;\n }\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => 'ProductAvailabilitiesForSelectedVariant';\n\n /**\n * GetCacheObjectType.\n * @returns - Cache Object Type string.\n */\n public getCacheObjectType = (): string => 'ProductAvailabilities';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getProductAvailabilitiesForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - ProductAvailabilitiesForSelectedVariant or error.\n */\nexport const createProductAvailabilitiesForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): ProductAvailabilitiesForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new ProductAvailabilitiesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId);\n }\n throw new Error('Unable to create ProductAvailabilitiesForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The action method for the getProductAvailabilitiesForSelectedVariant data action.\n * @param input - ProductAvailabilitiesForSelectedVariant.\n * @param ctx - Action Context.\n * @returns - Product inventory information.\n */\nexport async function getProductAvailabilitiesForSelectedVariantAction(\n input: ProductAvailabilitiesForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n const selectedVariantInput = new SelectedVariantInput(input.productId, input.channelId, undefined, undefined, ctx.requestContext);\n const productInventoryInformation: IProductInventoryInformation[] = [];\n\n try {\n const productResult = await getSelectedVariant(selectedVariantInput, ctx);\n\n // Don't get availability if it is service item && enableStockCheck is disbaled.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Reading config.\n if (\n ctx.requestContext.app.config.enableStockCheck &&\n productResult &&\n productResult.ItemTypeValue !== ReleasedProductType.Service &&\n productResult.ProductTypeValue !== ProductType.Master\n ) {\n const shippingSearchCriteria = createInventoryAvailabilitySearchCriteria(\n ctx,\n [productResult.RecordId],\n true,\n undefined,\n undefined,\n DeliveryMode.shipping\n );\n const pickupSearchCriteria = createInventoryAvailabilitySearchCriteria(\n ctx,\n [input.productId],\n false,\n true,\n undefined,\n DeliveryMode.pickup\n );\n const shippingAvailability = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: ctx },\n shippingSearchCriteria\n );\n if (shippingAvailability.ProductWarehouseInventoryAvailabilities) {\n const shippingInventory = mapAggregatedProductInventoryInformation(ctx, shippingAvailability);\n if (ArrayExtensions.hasElements(shippingInventory)) {\n shippingInventory[0].deliveryType = DeliveryMode.shipping;\n productInventoryInformation.push(shippingInventory[0]);\n }\n }\n const pickupAvailability = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: ctx },\n pickupSearchCriteria\n );\n if (pickupAvailability.ProductWarehouseInventoryAvailabilities) {\n const pickupInventory = mapAggregatedProductInventoryInformation(ctx, pickupAvailability);\n if (ArrayExtensions.hasElements(pickupInventory)) {\n pickupInventory[0].deliveryType = DeliveryMode.pickup;\n productInventoryInformation.push(pickupInventory[0]);\n }\n }\n return productInventoryInformation;\n }\n return undefined;\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- cann't assign type to the error variable.\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n return undefined;\n }\n}\n\n/**\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity.\n * @param productsWarehouseInventory - Product warehouse inventory.\n * @returns Product Available quantity.\n */\nexport function mergeProductWarehouseToProductAvailabities(\n productsWarehouseInventory: ProductWarehouseInventoryAvailability[]\n): ProductAvailableQuantity[] {\n const productAvailable: ProductAvailableQuantity[] = [];\n if (ArrayExtensions.hasElements(productsWarehouseInventory)) {\n for (const product of productsWarehouseInventory) {\n if (product.TotalAvailable !== undefined && product.ProductId !== undefined) {\n productAvailable.push({ ProductId: product.ProductId, AvailableQuantity: product.TotalAvailable });\n }\n }\n }\n return productAvailable;\n}\n\n/**\n * The complete getProductAvailabilitiesForSelectedVariant data action\n * Get the currently selected variant via the getSelectedVariant data action, and\n * then gets the availabilities for the variant via the getProductAvailabilities RetailServer API.\n */\nexport const getProductAvailabilitiesForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-availabilities-for-selected-variant',\n action: >getProductAvailabilitiesForSelectedVariantAction,\n input: createProductAvailabilitiesForSelectedVariantInput\n});\n\nexport default getProductAvailabilitiesForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductDimensionsWithAvailabilitiesFull } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { ProductDimensionAvailabilitySearchCriteria, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions, getSelectedProductIdFromActionInput } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Product dimension with availability Input.\n */\nexport class ProductDimensionsWithAvailabilitiesInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId?: number;\n\n public constructor(productId: number, channelId: number, requestContext?: IRequestContext) {\n this.productId = productId;\n this.channelId = channelId;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => 'ProductDimensionsWithAvailabilities';\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType: () => string = () => 'ProductDimensionsWithAvailabilities';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create input method for the get-product-dimension-with-availability data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nexport const createProductDimensionsWithAvailabilitiesInput = (\n inputData: ICreateActionContext>\n): ProductDimensionsWithAvailabilitiesInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new ProductDimensionsWithAvailabilitiesInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n inputData.requestContext\n );\n }\n throw new Error('Unable to create ProductDimensionsWithAvailabilitiesInput, no productId found on module config or query');\n};\n\n/**\n * Action method for the getProductDimensionsWithAvailabilities Data Action.\n * @param input - Input for the data action.\n * @param context - Action context.\n * @returns Product dimensions with availabilities.\n */\nexport async function getProductDimensionsWithAvailabilitiesAction(\n input: ProductDimensionsWithAvailabilitiesInput,\n context: IActionContext\n): Promise {\n const activeProducts = ArrayExtensions.validValues(\n await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n input.channelId,\n [input.productId],\n null,\n input.catalogId ?? 0\n )\n );\n\n if (!ArrayExtensions.hasElements(activeProducts)) {\n return [];\n }\n\n const activeProduct = activeProducts[0];\n\n if (!ArrayExtensions.hasElements(activeProduct.Dimensions)) {\n return [];\n }\n\n const promises = activeProduct.Dimensions.map(dimension => {\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\n MatchingDimensionValues: [],\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n activeProduct.MasterProductId ? activeProduct.MasterProductId : activeProduct.RecordId,\n searchCriteria\n );\n const fullDimensionPromise = dimensionValuesPromise.then(dimensionValues => {\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\n ...dimension,\n dimensionValuesWithInventory: dimensionValues\n };\n return fullDimension;\n });\n\n return fullDimensionPromise;\n });\n\n // eslint-disable-next-line no-return-await -- existing code\n return await Promise.all(promises);\n}\n\n/**\n * The GetProductDimensionsWithAvailabilitiesAction\n * Gets the available product dimensions for the product via the getDimensionValueswithEstimatedAvailibilities RetailServer API.\n */\nexport const getProductDimensionsWithAvailabilities = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-dimensions-with-availabilities',\n action: getProductDimensionsWithAvailabilitiesAction as IAction,\n input: createProductDimensionsWithAvailabilitiesInput\n});\n\nexport default getProductDimensionsWithAvailabilities;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * QuickOrderTemplateLine state information.\n */\nexport class QuickOrderTemplateLine {\n public productListLine: ProductListLine;\n\n public fullProduct?: FullProduct;\n\n public constructor(productListLine: ProductListLine, fullProduct?: FullProduct) {\n this.productListLine = productListLine;\n this.fullProduct = fullProduct;\n }\n}\n\n/**\n * Quick Order template line state.\n */\nexport interface IQuickOrderTemplateLinesState {\n lines: QuickOrderTemplateLine[];\n totalCount: number;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport getFullProducts, { FullProductInput } from './get-full-products';\nimport { ArrayExtensions } from './utilities';\nimport { IQuickOrderTemplateLinesState, QuickOrderTemplateLine } from './utilities/quick-order-template-line';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Input class for the GetProductListLines data action.\n *\n */\nexport class GetProductListLinesInput implements IActionInput {\n public productListId: string;\n\n public searchText: string;\n\n public constructor(productListId: string, searchText?: string) {\n this.productListId = productListId;\n this.searchText = searchText ?? '';\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => `GetProductListLines|${this.productListId}|${this.searchText}`;\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'GetProductListLines';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetProductListLines method.\n * @param productListId - ProductList Id.\n * @param searchText - Search Text.\n * @returns - Input data for getproductlistlines.\n */\nexport const createGetProductListLinesInput = (productListId: string, searchText?: string): GetProductListLinesInput => {\n return new GetProductListLinesInput(productListId, searchText);\n};\n\n/**\n * The action method for the GetProductListLines data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Product list lines.\n */\nexport async function getProductListLinesAction(\n input: GetProductListLinesInput,\n context: IActionContext\n): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full product list lines. User is not authenticated.');\n }\n\n const quickOrderTemplateLinesState: IQuickOrderTemplateLinesState = {\n lines: [],\n totalCount: 0\n };\n\n const promise = ProductListsDataActions.getProductListLinesAsync(\n {\n callerContext: context\n },\n input.productListId,\n input.searchText\n );\n\n const productListLines = await promise;\n const productInputs: FullProductInput[] = [];\n\n if (ArrayExtensions.hasElements(productListLines)) {\n quickOrderTemplateLinesState.totalCount = promise.metadata.count ?? quickOrderTemplateLinesState.lines.length;\n productListLines.map(listLine => {\n if (listLine.ProductId) {\n quickOrderTemplateLinesState.lines.push(new QuickOrderTemplateLine(listLine));\n productInputs.push(\n new FullProductInput(\n listLine.ProductId,\n context.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(context),\n context.requestContext\n )\n );\n }\n return productInputs;\n });\n if (ArrayExtensions.hasElements(productInputs)) {\n const fullProductsInfo = await getFullProducts(productInputs, context)\n .then((products: FullProduct[]) => {\n return products;\n })\n .catch((error: Error) => {\n context.trace(error.message);\n context.telemetry.error('[getProductListLinesAction] Unable to retrieve product info.');\n });\n if (fullProductsInfo) {\n quickOrderTemplateLinesState.lines.map(line => {\n const fullProduct = fullProductsInfo.find(\n product => product.ProductDetails.RecordId === line.productListLine.ProductId\n );\n if (!fullProduct) {\n context.telemetry.error('[getProductListLinesAction] Unable to find product info for an product list line.');\n return null;\n }\n line.fullProduct = fullProduct;\n return null;\n });\n }\n return quickOrderTemplateLinesState;\n }\n context.trace(quickOrderTemplateLinesState.lines.length.toString());\n return quickOrderTemplateLinesState;\n }\n return quickOrderTemplateLinesState;\n}\n\n/**\n * The GetProductListLines Data Action\n * Returns order templates.\n */\nexport const getProductListLinesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-list-lines',\n action: getProductListLinesAction as IAction,\n input: createGetProductListLinesInput\n});\n\nexport default getProductListLinesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport {\n ProductList,\n ProductListsDataActions,\n ProductListSearchCriteria,\n ProductListType,\n QueryResultSettings\n} from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for the GetProductList data action.\n */\nexport class GetProductListInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly queryResultSettings?: QueryResultSettings;\n\n public constructor(productListId?: string, queryResultSettings?: QueryResultSettings) {\n this.productListId = productListId ? productListId : '';\n this.queryResultSettings = queryResultSettings;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'ProductList';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'ProductList';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n\n /**\n * Set Cache output.\n * @returns - Flag for cache output.\n */\n public shouldCacheOutput = (): boolean => false;\n}\n\n/**\n * CreateInput method for the GetProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - The product list identifier.\n * @param queryResultSettings - The query result setting required for pagination/ordering.\n * @returns - Product List input.\n */\nexport const createGetProductListInput = (\n inputData: ICreateActionContext,\n productListId?: string,\n queryResultSettings?: QueryResultSettings\n): GetProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get product list. User is not authenticated.');\n }\n\n return new GetProductListInput(productListId ? productListId : '', queryResultSettings);\n};\n\n/**\n * The action method for the GetProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList array.\n */\nexport async function getProductListAction(input: GetProductListInput, context: IActionContext): Promise {\n const productListType = ProductListType.QuickOrder.toString();\n const productListSearchCriteria: ProductListSearchCriteria = {\n ProductListType: productListType\n };\n const productLists = await ProductListsDataActions.searchAsync(\n {\n callerContext: context,\n queryResultSettings: input.queryResultSettings\n },\n productListSearchCriteria\n ).then(result => {\n return result;\n });\n\n return productLists;\n}\n\n/**\n * The GetProductList Data Action\n * Returns product list.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-list',\n action: getProductListAction as IAction,\n input: createGetProductListInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductSearchResult, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { searchByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getCurrentCategory, { CurrentCategoryInput } from './get-current-category';\nimport getProducts, { ProductInput } from './get-simple-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Product by category ID Input action.\n */\nexport class ProductsByCategoryInput implements IActionInput {\n public categoryId?: number;\n\n public categorySlug?: string;\n\n public categoryName?: string;\n\n public catalogId: number;\n\n public currentCategory: CurrentCategoryInput;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(category: CurrentCategoryInput, apiSettings: ICommerceApiSettings, queryResultSettingsProxy: QueryResultSettingsProxy) {\n this.apiSettings = apiSettings;\n this.currentCategory = category;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = apiSettings.catalogId;\n this.categoryId = category.categoryId;\n this.categorySlug = category.categorySlug;\n }\n\n public getCacheKey = () =>\n buildCacheKey(\n `${this.categoryId || this.categorySlug}|${this.catalogId}|${this.queryResultSettingsProxy.cacheKeyHint}`,\n this.apiSettings\n );\n\n public getCacheObjectType = () => 'Products-From-Search';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput method for the getProductsByCategory data aciton.\n * @param inputData\n */\nexport const createGetProductsByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n const currentCategory = new CurrentCategoryInput(inputData.requestContext);\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return new ProductsByCategoryInput(currentCategory, inputData.requestContext.apiSettings, queryResultSettingsProxy);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Action method for the getProductsByCategory data action.\n * @param input\n * @param ctx\n */\nexport async function getProductsByCategoryAction(input: ProductsByCategoryInput, ctx: IActionContext): Promise {\n const { apiSettings } = ctx.requestContext;\n let categoryId = input.currentCategory.categoryId;\n if (input.currentCategory.categorySlug && !categoryId) {\n const category = await getCurrentCategory(input.currentCategory, ctx);\n if (!category) {\n ctx.trace('[getProductsByCategoryAction] Unable to find category');\n return [];\n }\n categoryId = category.RecordId;\n }\n\n const productInputs = await searchByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n +apiSettings.channelId,\n input.catalogId,\n categoryId || 0\n ).then(productSearchResults => {\n return productSearchResults.map(\n (product: ProductSearchResult): ProductInput => {\n return new ProductInput(product.RecordId, apiSettings, undefined, undefined, ctx.requestContext);\n }\n );\n });\n\n if (productInputs.length > 0) {\n // eslint-disable-next-line no-return-await -- existing code\n return await getProducts(productInputs, ctx);\n }\n return [];\n}\n\n/**\n * The getProductsByCategory data action\n * Retrieves the current category of the request via the getCurrentCategory data action\n * Then calls the searchByCategory RetailServer API to get a list of products associated with\n * the current category, and finally fully hydrates the data for those prodcuts via the\n * getProducts data action, returning a list of SimpleProducts within the current category.\n */\nexport const getProductsByCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-products-by-category',\n action: >getProductsByCategoryAction,\n input: createGetProductsByCategoryInput\n});\n\nexport default getProductsByCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { Cart, CartLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { createGetFeatureStateInput, getCustomer, GetCustomerInput, getFeatureState, getSimpleProducts, ProductInput } from '.';\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Input class for activeCartWithProducts data action.\n */\nexport class ActiveCartProductsInput implements IActionInput {\n public getCacheKey = () => 'ActiveCartProducts';\n\n public getCacheObjectType = () => 'ActiveCartProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new ActiveCartProductsInput();\n};\n\n/**\n * Calls the Retail API and returns a cart object based on the passed GetCartInput.\n * @param input\n * @param ctx\n */\nexport async function getActiveCartProductsAction(input: ActiveCartProductsInput, ctx: IActionContext): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n throw new Error('[getActiveCartWithProducts]No valid Input was provided, failing');\n }\n\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n\n const isQuantityLimitsFeatureIsOn: boolean = await isOrderQuantityLimitsFeatureEnabled(ctx);\n\n if (isQuantityLimitsFeatureIsOn) {\n return getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart, ctx);\n }\n\n // If there are cart lines, make call to get products\n if (!cartState.hasInvoiceLine && cart && cart.CartLines && cart.CartLines.length > 0) {\n ctx.trace('Getting cart product information...');\n return getSimpleProducts(\n cart.CartLines.map(cartLine => {\n if (cartLine.ProductId) {\n return new ProductInput(\n cartLine.ProductId,\n ctx.requestContext.apiSettings,\n undefined,\n undefined,\n ctx.requestContext,\n cartLine.CatalogId\n );\n }\n return undefined;\n }).filter(Boolean),\n ctx\n )\n .then((products: SimpleProduct[]) => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.toString());\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[getActiveCartWithProducts]Unable to hydrate cart with product information');\n throw new Error('[getActiveCartWithProducts]Unable to hydrate cart with product information');\n });\n }\n\n ctx.trace('[getActiveCartWithProducts]No Products Found in cart');\n return [];\n}\n\nexport const getActiveCartProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-products-in-active-cart',\n action: >getActiveCartProductsAction,\n input: createInput\n});\nexport default getActiveCartProductsActionDataAction;\n\nasync function getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart: Cart, ctx: IActionContext): Promise {\n const productIdsByWarehouseId: Map = new Map();\n let resultProducts: SimpleProduct[] = [];\n cart.CartLines?.forEach(cartLine =>\n productIdsByWarehouseId.has(cartLine.WarehouseId!)\n ? productIdsByWarehouseId.get(cartLine.WarehouseId!)?.push(cartLine)\n : productIdsByWarehouseId.set(cartLine.WarehouseId!, [cartLine])\n );\n return Promise.all(\n [...productIdsByWarehouseId].map(([entryWarehouseId, entryProductIds]) => {\n return getSimpleProducts(\n entryProductIds\n .map(cartLine => {\n if (cartLine.ProductId) {\n return new ProductInput(\n cartLine.ProductId,\n ctx.requestContext.apiSettings,\n undefined,\n entryWarehouseId,\n ctx.requestContext,\n cartLine.CatalogId\n );\n }\n return undefined;\n })\n .filter(Boolean),\n ctx\n ).then((products: SimpleProduct[]) => {\n if (products) {\n resultProducts = products.reduce((accum, product) => {\n if (product) {\n accum.push(product);\n }\n return accum;\n }, resultProducts);\n }\n });\n })\n ).then(() => resultProducts);\n}\n\nasync function isOrderQuantityLimitsFeatureEnabled(ctx: IActionContext): Promise {\n const defaultOrderQuantityLimitsFeatureConfig = ctx.requestContext.app?.platform?.enableDefaultOrderQuantityLimits;\n if (defaultOrderQuantityLimitsFeatureConfig === 'none') {\n return Promise.resolve(false);\n }\n\n const featureStates = await getFeatureState(createGetFeatureStateInput(ctx), ctx);\n let isQuantityLimitsFeatureEnabledInHq = false;\n if (ArrayExtensions.hasElements(featureStates)) {\n isQuantityLimitsFeatureEnabledInHq =\n featureStates.find(\n (featureState: FeatureState) => featureState.Name === 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature'\n )?.IsEnabled || false;\n }\n\n if (!isQuantityLimitsFeatureEnabledInHq) {\n return false;\n }\n\n if (defaultOrderQuantityLimitsFeatureConfig === 'all') {\n return Promise.resolve(true);\n }\n\n return getCustomer(new GetCustomerInput(ctx.requestContext.apiSettings), ctx)\n .then(customerInfo => {\n return (\n !!customerInfo &&\n ((defaultOrderQuantityLimitsFeatureConfig === 'b2b' && customerInfo.IsB2b) ||\n (defaultOrderQuantityLimitsFeatureConfig === 'b2c' && !customerInfo.IsB2b))\n );\n })\n .catch((error: Error) => {\n ctx.telemetry.warning(error.message);\n ctx.telemetry.debug('Unable to get customer info');\n return false;\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartPromotionLine } from '@msdyn365-commerce/retail-proxy';\nimport { getAvailablePromotionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\n\n/**\n * Input class for promotion options for items in cart.\n */\nexport class PromotionOptionsForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsPromotionOptions', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsPromotionOptions';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new PromotionOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API to get the promotion options for items in the cart.\n * @param input\n * @param ctx\n */\nexport async function getPromotionOptionsForCartLineItems(\n input: PromotionOptionsForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getPromotionOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(ctx);\n if (cartState.hasInvoiceLine) {\n ctx.trace('[getPromotionOptionsForCartLineItems] cart has invoice line');\n return [];\n }\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n if (!cart || !cart.CartLines || !products || products.length === 0) {\n ctx.trace('[getPromotionOptionsForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n const cartLineIds = cart.CartLines.map(c => c.LineId || '');\n\n return getAvailablePromotionsAsync({ callerContext: ctx, queryResultSettings: {}, bypassCache: 'get' }, cart.Id, cartLineIds || null)\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPromotionOptionsForCartLineItems]Error executing action');\n throw new Error('[getPromotionOptionsForCartLineItems]Error executing action');\n });\n}\n\nexport const getPromotionOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-promotion-options-for-cartlines',\n action: >getPromotionOptionsForCartLineItems,\n input: createInput\n});\n\nexport default getPromotionOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, IActionInput } from '@msdyn365-commerce/core';\n\n/**\n * ReviewsGetRatingsSummary Input Action.\n */\nexport class GetRatingsSummaryInput implements IActionInput {\n /**\n * The Id representing the product to get the ratings for.\n */\n public productId: string;\n\n /**\n * The ID representing the tenant.\n */\n public tenantId: string;\n\n /**\n * The ratings and reviews service endpoint.\n */\n public serviceEndpoint: string;\n\n constructor(productId: string, tenantId: string, serviceEndpoint: string) {\n this.productId = productId;\n this.tenantId = tenantId;\n this.serviceEndpoint = serviceEndpoint;\n }\n\n // RnR does not use RS endpoint, so shouldn't use buildCacheKey\n public getCacheKey = () => `${this.productId}-${this.tenantId}`;\n\n public getCacheObjectType = () => 'RatingsSummary';\n\n public dataCacheType = (): CacheType => 'application';\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { RatingsSummary } from '@msdyn365-commerce/commerce-entities';\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n sendRequest\n} from '@msdyn365-commerce/core';\n\nimport { GetRatingsSummaryInput, getSelectedProductIdFromActionInput } from '.';\nimport { getRnrEndpointId, getRnrPartnerId } from './utilities/getRnrKeys';\n\nexport const createInput = (input: ICreateActionContext>): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(input);\n if (productId) {\n return new GetRatingsSummaryInput(productId, getRnrPartnerId(input), getRnrEndpointId(input));\n }\n throw new Error('[GetRatingsSummary] Not all necessary parameters found while creating Input for getRatingsSummaryApi');\n};\n\n/**\n * This function gets the ratings summary.\n * @param input\n * @param ctx\n */\nexport async function getRatingsSummary(input: GetRatingsSummaryInput, ctx: IActionContext): Promise {\n if (!inputIsValid(input)) {\n ctx.trace('[GetRatingsSummary] Failed to get ratings summary for product');\n return {};\n }\n\n const requestUrl = `${input.serviceEndpoint}/v2.0/ratings/product/${input.productId}/summary?` + `tenantId=${input.tenantId}`;\n return sendRequest(requestUrl, 'get')\n .then(response => {\n return response.data;\n })\n .catch(error => {\n ctx.trace('[GetRatingsSummary] Failed to get ratings summary for product');\n throw error;\n });\n}\n\nfunction inputIsValid(input: GetRatingsSummaryInput): boolean {\n return input && input.productId.length > 0 && input.tenantId.length > 0;\n}\n\nexport const getRatingsSummaryDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-ratings-summary',\n action: >getRatingsSummary,\n input: createInput\n});\n\nexport default getRatingsSummaryDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefiner } from '@msdyn365-commerce/retail-proxy';\nimport { getRefinersByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getCurrentCategory, { CurrentCategoryInput } from './get-current-category';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Action Input class for the getRefinersByCategory data action.\n */\nexport class RefinersByCategoryInput implements IActionInput {\n public readonly catalogId: number;\n\n public readonly currentCategory: CurrentCategoryInput;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n constructor(category: CurrentCategoryInput, queryResultSettingsProxy: QueryResultSettingsProxy, catalogId?: number) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = catalogId || 0;\n this.currentCategory = category;\n }\n\n public getCacheKey = () => `${this.currentCategory.getCacheKey()}|${this.catalogId}|${this.queryResultSettingsProxy.cacheKeyHint}`;\n\n public getCacheObjectType = () => 'ProductRefiner';\n\n public shouldCacheOutput = () => true;\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createRefinersByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n const catalogId = getCatalogId(inputData.requestContext);\n const currentCategory = new CurrentCategoryInput(inputData.requestContext);\n\n return new RefinersByCategoryInput(currentCategory, QueryResultSettingsProxy.fromInputData(inputData), catalogId);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Calls the Retail API and returns all refiners by category.\n * @param input\n * @param ctx\n */\nexport async function getRefinersByCategoryAction(input: RefinersByCategoryInput, ctx: IActionContext): Promise {\n let categoryId = input.currentCategory.categoryId;\n if (input.currentCategory.categorySlug && !categoryId) {\n const category = await getCurrentCategory(input.currentCategory, ctx);\n if (!category) {\n ctx.trace('[getRefinersByCategoryAction] Unable to find category');\n return [];\n }\n categoryId = category.RecordId;\n }\n\n return getRefinersByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.catalogId,\n categoryId || 0\n );\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-refiners-by-category',\n action: >getRefinersByCategoryAction,\n input: createRefinersByCategoryInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefiner } from '@msdyn365-commerce/retail-proxy';\nimport { getRefinersByTextAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { parseSearchData } from './utilities/input-data-parser';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Action Input class for the getRefinersByText data action.\n */\nexport class RefinersByTextInput implements IActionInput {\n public readonly catalogId: number;\n\n public readonly searchText: string;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(\n searchText: string,\n catalogId: number,\n queryResultSettingsProxy: QueryResultSettingsProxy,\n apiSettings: ICommerceApiSettings\n ) {\n this.catalogId = catalogId;\n this.searchText = searchText;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () =>\n buildCacheKey(`${this.searchText}|${this.catalogId}|${this.queryResultSettingsProxy.cacheKeyHint}`, this.apiSettings);\n\n public getCacheObjectType = () => 'ProductRefiner';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createRefinersByTextInput = (inputData: ICreateActionContext>): IActionInput => {\n const searchInputData = parseSearchData(inputData);\n const catalogId = inputData.config ? Number(inputData.config.catalogId) : 0;\n\n return new RefinersByTextInput(\n searchInputData.q,\n Number.isNaN(catalogId) ? 0 : catalogId,\n QueryResultSettingsProxy.fromInputData(inputData),\n inputData.requestContext.apiSettings\n );\n};\n\n/**\n * Calls the Retail API and returns all refiners by text.\n * @param input\n * @param ctx\n */\nexport async function getRefinersByTextAction(input: RefinersByTextInput, ctx: IActionContext): Promise {\n return getRefinersByTextAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.catalogId,\n input.searchText\n );\n}\n\nexport const getRefinersByTextActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-refiners-by-text',\n action: >getRefinersByTextAction,\n input: createRefinersByTextInput\n});\n\nexport default getRefinersByTextActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getRelatedProductsAsync, getRelationTypesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { ProductRelationType, ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from './get-full-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * GetRelatedProducts Input Action.\n */\nexport class GetRelatedProductsInput implements IActionInput {\n public readonly productId: number;\n\n public readonly catalogId: number;\n\n public readonly relationType: string;\n\n public ProductDetailsCriteria: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n public constructor(\n productId: number,\n catalogId: number,\n relationType: string,\n queryResultSettingsProxy: QueryResultSettingsProxy,\n criteria: ProductDetailsCriteria\n ) {\n this.productId = productId;\n this.catalogId = catalogId;\n this.relationType = relationType;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.ProductDetailsCriteria = criteria;\n }\n\n public getCacheKey = () =>\n `${this.productId}|${this.catalogId}|${this.relationType.toLowerCase()}|${this.queryResultSettingsProxy.cacheKeyHint}|${\n this.ProductDetailsCriteria.getPrice\n }`;\n\n public getCacheObjectType = () => 'GetRelatedProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make GetRelatedProducts retail api call.\n * @param inputData\n */\nexport const createGetRelatedProductsInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext && inputData.config) {\n const catalogId = getCatalogId(inputData.requestContext);\n const relationType = inputData.config.relationType;\n\n let productId = inputData.requestContext.urlTokens ? Number(inputData.requestContext.urlTokens.recordId) : 0;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n if (!relationType) {\n throw new Error('Input relation type is invalid.');\n }\n\n // Query string may override the product id from url\n if (inputData.requestContext.query && inputData.requestContext.query.productId) {\n productId = Number(inputData.requestContext.query.productId);\n }\n\n if (Number.isNaN(productId) || productId <= 0) {\n throw new Error('No valid product id available in url or query string.');\n }\n\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return new GetRelatedProductsInput(productId, catalogId, relationType, queryResultSettingsProxy, productDetailsCriteria);\n }\n\n throw new Error('Invalid input data or request context');\n};\n\nexport function searchProductRelationType(productRelationTypes: ProductRelationType[], _productRelationType: string): number | undefined {\n let foundProductRelationTypeId;\n _productRelationType = _productRelationType.toLowerCase();\n productRelationTypes.forEach((productRelationType: ProductRelationType) => {\n if (productRelationType.Name && productRelationType.Name.toLowerCase() === _productRelationType) {\n return (foundProductRelationTypeId = productRelationType.RecordId);\n }\n });\n\n return foundProductRelationTypeId;\n}\n\nasync function getRelatedProductsAction(input: GetRelatedProductsInput, ctx: IActionContext): Promise {\n const apiSettings = ctx.requestContext.apiSettings;\n const querySettings = input.queryResultSettingsProxy.QueryResultSettings;\n\n const productRelationTypes = await getRelationTypesAsync(\n { callerContext: ctx, queryResultSettings: querySettings },\n input.productId,\n +apiSettings.channelId,\n input.catalogId\n );\n if (!productRelationTypes) {\n ctx.trace(`[getProductRelationType] Unable to get product relation types for product ${input.productId}`);\n return [];\n }\n const productRelationTypeId = searchProductRelationType(productRelationTypes, input.relationType);\n if (!productRelationTypeId) {\n ctx.trace(`[getRelatedProducts] Unable to find relation type ${input.relationType} for product ${input.productId}`);\n return [];\n }\n\n const productInputs = await getRelatedProductsAsync(\n { callerContext: ctx, queryResultSettings: querySettings },\n input.productId,\n +apiSettings.channelId,\n input.catalogId,\n productRelationTypeId\n )\n .then(response => {\n if (response && response.length > 0) {\n return response.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(product.RecordId, apiSettings, input.ProductDetailsCriteria, ctx.requestContext);\n }\n );\n }\n\n ctx.trace('[getRelatedProductsAction] Invalid response from server');\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.trace(error.stack || '');\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getRelatedProductsAction] Unable to Fetch Products.');\n ctx.trace('[getRelatedProductsAction] Unable to Fetch Products.');\n return [];\n });\n\n if (productInputs.length > 0) {\n return getFullProducts(productInputs, ctx);\n }\n return [];\n}\n\n/**\n * The getRelatedProducts data action\n * Uses a productId URL Token and finds the relation types for said product\n * using the getRelationTypes RetailServer API, and then finds and retusn all products that\n * share that relation type via the getRelatedProducts RetailServer API.\n */\nexport const getRelatedProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-related-products',\n action: >getRelatedProductsAction,\n input: createGetRelatedProductsInput\n});\n\nexport default getRelatedProductsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { readAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ScanResultsDataActions.g';\nimport { ProductDimension } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getDimensionsForSelectedVariant, GetDimensionsForSelectedVariantInput } from '.';\nimport { IScanResultWithProduct } from './utilities/scan-result-with-product';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class to get product from sku number.\n */\nexport class GetScanResultInput implements IActionInput {\n public skuNumber: string;\n\n public channelId: number;\n\n public matchingDimensionValues: ProductDimension[];\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, sku: string, channelId: number, matchingDimensionValues?: ProductDimension[]) {\n this.skuNumber = sku;\n this.channelId = channelId;\n this.matchingDimensionValues = matchingDimensionValues || [];\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`Product-${this.skuNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'ProductSKU';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n * @param skuuNumber SkuNumber to send ScanResult API.\n * @param skuNumber\n * @param channelId ChannelId required to get dimension for given product.\n * @param matchingDimensionValues\n */\nconst createInput = (\n inputData: ICreateActionContext,\n skuNumber: string,\n channelId: number,\n matchingDimensionValues?: ProductDimension[]\n) => {\n return new GetScanResultInput(inputData.requestContext.apiSettings, skuNumber, channelId, matchingDimensionValues);\n};\n\n/**\n * Action method for the product and dimension from scan result and dimension api.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getScanResult(input: GetScanResultInput, ctx: IActionContext): Promise {\n return readAsync({ callerContext: ctx }, input.skuNumber)\n .then(scanResults => {\n if (scanResults && scanResults.Product) {\n return getDimensionsForSelectedVariant(\n new GetDimensionsForSelectedVariantInput(\n scanResults.Product.MasterProductId ? scanResults.Product.MasterProductId : scanResults.Product.RecordId,\n input.channelId,\n input.matchingDimensionValues,\n ctx.requestContext\n ),\n ctx\n )\n .then(response => {\n if (response && response.length > 0) {\n return { ScanResult: scanResults, Product: scanResults.Product, ProductDimensionFull: response };\n }\n return { ScanResult: scanResults, Product: scanResults.Product };\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getScanResult, getDimensionsForSelectedVariant]Error executing action');\n throw new Error('[getScanResult, getDimensionsForSelectedVariant]Error executing action');\n });\n }\n\n throw new Error('Unable to get result from scan result data action.');\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getScanResult]Error executing action');\n throw new Error('[getScanResult]Error executing action');\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-scan-results',\n action: >getScanResult,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { SortColumn } from '@msdyn365-commerce/retail-proxy';\nimport { getSearchConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\n\n// TODO: import from commerce entities when available\n// eslint-disable-next-line @typescript-eslint/naming-convention\ninterface SearchConfiguration {\n ProductSortColumns?: SortColumn[];\n}\n\n/**\n * Action Input class for the getSearchConfiguration data action.\n */\nexport class SearchConfigurationInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('SearchConfig', this.apiSettings);\n\n public getCacheObjectType = () => 'SearchConfiguration';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createSearchConfigurationInput = (inputData: ICreateActionContext>): IActionInput => {\n return new SearchConfigurationInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API.\n * @param input\n * @param ctx\n */\nexport async function getSearchConfigurationAction(input: SearchConfigurationInput, ctx: IActionContext): Promise {\n return getSearchConfigurationAsync({ callerContext: ctx });\n}\n\nexport const getSearchConfigurationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-search-configurations',\n action: >getSearchConfigurationAction,\n input: createSearchConfigurationInput\n});\n\nexport default getSearchConfigurationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IDictionary,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey, generateProductImageUrl } from './utilities/utils';\n\n/**\n * Product Input.\n */\nexport class ProductInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public warehouseId?: string;\n\n public catalogId?: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n productId: number | string,\n apiSettings: ICommerceApiSettings,\n channelId?: number,\n warehouseId?: string,\n requestContext?: IRequestContext,\n catalogId?: number\n ) {\n this.apiSettings = apiSettings;\n this.productId = +productId;\n this.channelId = channelId || apiSettings.channelId;\n this.warehouseId = warehouseId;\n this.catalogId = catalogId;\n\n if (requestContext && catalogId === undefined) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () =>\n buildCacheKey(\n `RecordId-${this.productId.toString()}-ChannelId-${this.channelId.toString()}-WahehouseId-${this.warehouseId ?? ''}-${this\n .catalogId ?? 0}`,\n this.apiSettings\n );\n\n public getCacheObjectType = () => 'SimpleProduct';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createSimpleProductsInput = (inputData: ICreateActionContext>): IActionInput[] => {\n let productIds = inputData.config && inputData.config.productIds;\n if (!productIds) {\n return [];\n }\n\n productIds = typeof productIds === 'string' ? productIds.split(',') : productIds;\n return !Array.isArray(productIds)\n ? []\n : productIds.map((productId: string) => {\n return new ProductInput(productId, inputData.requestContext.apiSettings, undefined, undefined, inputData.requestContext);\n });\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed ProductInput.\n * @param inputs\n * @param ctx\n */\nexport async function getSimpleProductsAction(inputs: ProductInput[], ctx: IActionContext): Promise {\n if (!ArrayExtensions.hasElements(inputs)) {\n ctx.trace('[getSimpleProductsAction] Invalid or empty inputs passed.');\n return [];\n }\n\n const productIdMapping: IDictionary = {};\n\n for (let index = 0; index < inputs.length; ++index) {\n productIdMapping[inputs[index].productId] = index;\n }\n\n const getProductPromises: Promise[] = [];\n const catalogIds = ArrayExtensions.unique(inputs.map(input => input.catalogId));\n for (const catalogId of catalogIds) {\n const productInputs = inputs.filter(input => input.catalogId === catalogId);\n getProductPromises.push(\n getByIdsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n inputs[0].channelId,\n productInputs.map(input => input.productId),\n inputs[0].warehouseId ?? null,\n catalogId ?? 0\n )\n );\n }\n\n const products = ArrayExtensions.flatten(await Promise.all(getProductPromises));\n const mappedProducts = products\n .map(product => {\n try {\n const newImageUrl = generateProductImageUrl(product, ctx.requestContext.apiSettings);\n\n if (newImageUrl) {\n product.PrimaryImageUrl = newImageUrl;\n }\n\n return product;\n } catch {\n ctx.trace('[getSimpleProductsAction] Unable to update ImageURL for Product');\n return undefined;\n }\n })\n .reduce((memo: SimpleProduct[], product: SimpleProduct | undefined) => {\n if (!product) {\n return memo;\n }\n const index = productIdMapping[product.RecordId];\n memo[index] = product;\n return memo;\n }, []);\n\n // NOTE: This is not an ideal fix, but will resolve all current issues\n return inputs.map(input => {\n const foundProduct = mappedProducts.find(product => product && product.RecordId === input.productId);\n return foundProduct || {};\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-simple-products',\n action: >getSimpleProductsAction,\n input: createSimpleProductsInput,\n isBatched: true\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ChannelDeliveryOption,\n FeatureState,\n OrgUnitAvailability,\n OrgUnitLocation,\n SearchArea,\n StoreHours\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n getChannelDeliveryOptionsAsync,\n getOrgUnitLocationsByAreaAsync,\n getStoreHoursAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\n\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { IFullOrgUnitAvailability } from './utilities/full-org-unit-availability';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Get selected variant action input class.\n */\nexport class GetOrgUnitLocationsByAreaInput implements IActionInput {\n public Latitude?: number;\n\n public Longitude?: number;\n\n public Radius?: number;\n\n public DistanceUnitValue?: number;\n\n public IgnoreLocation?: boolean;\n\n constructor(_Latitude?: number, _Longitude?: number, _Radius?: number, _DistanceUnitValue?: number, _IgnoreLocation?: boolean) {\n this.Latitude = _Latitude;\n this.Longitude = _Longitude;\n this.Radius = _Radius;\n this.DistanceUnitValue = _DistanceUnitValue;\n this.IgnoreLocation = _IgnoreLocation;\n }\n\n public getCacheKey = () => 'GetOrgUnitLocationsByAreaInput';\n\n public getCacheObjectType = () => 'GetOrgUnitLocationsByAreaInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetOrgUnitLocationsByAreaInput = (inputData: ICreateActionContext>): GetOrgUnitLocationsByAreaInput => {\n return new GetOrgUnitLocationsByAreaInput();\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * Action method for the getSelectedVariant data action.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getOrgUnitLocationsByArea(\n input: GetOrgUnitLocationsByAreaInput,\n ctx: IActionContext\n): Promise {\n if ((input.Radius === undefined || !input.Latitude || !input.Longitude) && !input.IgnoreLocation) {\n // No valid location we want to return empty array so module can show no locations message\n return [];\n }\n\n const searchArea: SearchArea = {\n Latitude: input.Latitude,\n Longitude: input.Longitude,\n Radius: input.Radius,\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\n };\n\n const featureState = await getFeatureState(ctx);\n const retailMulitplePickupMFeatureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n\n return getOrgUnitLocationsByAreaAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n searchArea\n )\n .then(async (stores: OrgUnitLocation[]) => {\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\n\n // If mulitple pickup mode is enable then call getchanneldeliveryoption\n if (retailMulitplePickupMFeatureState) {\n const orgUnitChannel = stores.map(store => store.ChannelId);\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\n }\n const locationPromiseList = stores.map(store => {\n const locationDeliveryOption = locationDeliveryOptions?.find(\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\n );\n return _getLocationWithHours(store, locationDeliveryOption, ctx);\n });\n return Promise.all(locationPromiseList);\n })\n .catch((error: Error) => {\n ctx.trace('[GetOrgUnitLocationsByArea] error getting Locations');\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[GetOrgUnitLocationsByArea] error getting Locations');\n return [];\n });\n}\n\n/**\n * Action method that obtains the store information.\n * @param orgUnitLocation The org unit location.\n * @param storeMap A map that contains store information group by the inventory location id.\n * @param channelDeleiveryOptions\n * @param ctx The action context.\n */\nasync function _getLocationWithHours(\n orgUnitLocation: OrgUnitLocation,\n channelDeleiveryOptions: ChannelDeliveryOption | undefined,\n ctx: IActionContext\n): Promise {\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\n return { OrgUnitAvailability: undefined };\n }\n\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\n .then((hours: StoreHours) => {\n const availability: OrgUnitAvailability = {\n OrgUnitLocation: orgUnitLocation\n };\n\n if (hours && !(hours instanceof Error)) {\n return { OrgUnitAvailability: availability, StoreHours: hours, OrgUnitPickUpDeliveryModes: channelDeleiveryOptions };\n }\n\n return { OrgUnitAvailability: availability, OrgUnitPickUpDeliveryModes: channelDeleiveryOptions };\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting availability with hours');\n return { OrgUnitAvailability: {} };\n });\n}\n\n/**\n * Action method that obtains the store information.\n * @param channelCollection The org unit channel Id list.\n * @param ctx The action context.\n */\nasync function _getLocationPickUpDeliveryModes(\n channelCollection: (number | undefined)[],\n ctx: IActionContext\n): Promise {\n if (channelCollection?.length === 0 || channelCollection === undefined) {\n return undefined;\n }\n\n const channelIdList: number[] = [];\n channelCollection?.map(id => {\n if (id !== undefined) {\n return channelIdList.push(id);\n }\n });\n\n // To get all channel pickup delivery mode filterOption should be 4\n return getChannelDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n channelIdList,\n 4\n )\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\n return channelDeliveryOptions;\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n return [];\n });\n}\n\n/**\n * The complete getOrgUnitLocationsByArea data action.\n */\nexport const getOrgUnitLocationsByAreaDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-store-location-information',\n action: >getOrgUnitLocationsByArea,\n input: createGetOrgUnitLocationsByAreaInput\n});\n\nexport default getOrgUnitLocationsByAreaDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetByCustomerInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CommerceListsDataActions.g';\nimport { CommerceList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nconst createWishlistInput = (inputData: ICreateActionContext) => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetByCustomerInput({}, null);\n }\n\n throw new Error('[get-wishlist-by-customer-id] Unable to create input for getWishlists');\n};\n\n/**\n * Get Org Unit Configuration Data Action.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-wishlist-by-customer-id',\n action: >retailAction,\n input: createWishlistInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { InvoiceDetailsSearchCriteria, SalesInvoice, SalesOrdersDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for get invoice details data action.\n */\nexport class GetInvoiceDetailsInput implements IActionInput {\n public invoiceId: string;\n\n constructor(invoiceId: string) {\n this.invoiceId = invoiceId;\n }\n\n public getCacheKey = () => `GetInvoiceDetails|${this.invoiceId}`;\n\n public getCacheObjectType = () => 'SalesInvoice';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nexport const CreateGetInvoiceDetailsInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get invoice details as User is not logged in.');\n }\n if (!inputData?.requestContext?.query?.invoiceId) {\n throw new Error('Unable to get invoice details as no valid invoice id found.');\n }\n\n return new GetInvoiceDetailsInput(inputData.requestContext.query.invoiceId);\n};\n\nexport async function getInvoiceDetails(input: GetInvoiceDetailsInput, context: IActionContext): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get details for the invoice. User is not authenticated.');\n }\n\n if (!input.invoiceId) {\n throw new Error('Unable to get invoice details as no valid invoice id found.');\n }\n\n const invoiceId = input.invoiceId;\n\n const searchCriteria: InvoiceDetailsSearchCriteria = {\n InvoiceId: invoiceId\n };\n\n return SalesOrdersDataActions.getInvoiceDetailsAsync({ callerContext: context }, searchCriteria);\n}\n\nexport const getInvoiceDetailsDataAction = createObservableDataAction({\n id: 'get-invoice-details',\n action: >getInvoiceDetails,\n input: CreateGetInvoiceDetailsInput\n});\n\nexport default getInvoiceDetailsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport {\n InvoicePaidStatus,\n InvoiceSearchCriteria,\n InvoiceType,\n IQueryResultSettings,\n OrderInvoice,\n SalesOrdersDataActions\n} from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\nimport getCustomer, { GetCustomerInput } from '../get-customer';\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\n\nconst getDefaultSearchCriteria = (): InvoiceSearchCriteria => {\n return {\n InvoicePaidStatusValues: [InvoicePaidStatus.None]\n };\n};\n\n/**\n * Input class for get invoice data action.\n */\nexport class GetInvoicesInput implements IActionInput {\n public readonly searchCriteria: InvoiceSearchCriteria;\n\n public readonly queryResultSettings: IQueryResultSettings;\n\n constructor(searchCriteria: InvoiceSearchCriteria, queryResultSettings: IQueryResultSettings) {\n this.searchCriteria = searchCriteria;\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => 'BusinessPartnerInvoices';\n\n public getCacheObjectType = () => 'OrderInvoice';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const CreateGetInvoicesInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n\n return new GetInvoicesInput(getDefaultSearchCriteria(), queryResultSettings);\n};\n\nexport async function getInvoices(input: GetInvoicesInput, context: IActionContext): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get list of invoices. User is not authenticated.');\n }\n\n input.searchCriteria.InvoiceTypeValues = [InvoiceType.SalesOrderInvoice];\n\n const businessPartner = await getCurrentAsync({ callerContext: context });\n input.searchCriteria.BusinessPartnerId = businessPartner.BusinessPartnerId;\n\n const customer = await getCustomer(new GetCustomerInput(context.requestContext.apiSettings), context);\n input.searchCriteria.CustomerId = customer.AccountNumber;\n\n return SalesOrdersDataActions.getInvoicesAsync(\n { callerContext: context, queryResultSettings: input.queryResultSettings },\n input.searchCriteria\n );\n}\n\nexport const getInvoicesDataAction = createObservableDataAction({\n id: 'get-invoices',\n action: >getInvoices,\n input: CreateGetInvoicesInput\n});\n\nexport default getInvoicesDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState, ICartState } from '@msdyn365-commerce/global-state';\nimport { LoyaltyCard } from '@msdyn365-commerce/retail-proxy';\nimport { issueLoyaltyCardAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { getLoyaltyAction, GetLoyaltyCardInput } from './get-loyalty-card';\n\n/**\n * Input class for the issueLoyalty data action.\n */\nexport class IssueLoyaltyInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`IssueLoyalty-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetIssueLoyalty';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the issueLoyalty method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createIssueLoyaltyInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create issue loyalty input. User is not authenticated.');\n }\n\n return new IssueLoyaltyInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the issueLoyalty data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function issueLoyaltyAction(input: IssueLoyaltyInput, ctx: IActionContext): Promise {\n const promises: [Promise, Promise] = [getCartState(ctx), _getLoyalty(input, ctx)];\n return Promise.all(promises)\n .then(result => {\n const cartState = result[0];\n const card = result[1];\n if (card && card.CardNumber) {\n updateCart(cartState, card);\n return card;\n }\n\n // @ts-expect-error\n // TO-DO: Remove after SDK bug fix https://msdyneng.visualstudio.com/FinOps/_workitems/edit/473891\n return issueLoyaltyCardAsync({ callerContext: ctx }, { CustomerAccount: input.userAccountNumber || null })\n .then((issuedCard: LoyaltyCard) => {\n updateCart(cartState, issuedCard);\n return issuedCard;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Issuing loyalty card failed');\n throw new Error('Issuing loyalty card failed');\n });\n })\n .catch((error: Error) => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to issue loyalty card');\n throw new Error('Unable to issue loyalty card');\n });\n}\n\nasync function _getLoyalty(input: IssueLoyaltyInput, ctx: IActionContext): Promise {\n const loyaltyCardInput = new GetLoyaltyCardInput(input.apiSettings);\n return getLoyaltyAction(loyaltyCardInput, ctx);\n}\n\nfunction updateCart(cartState: ICartState, card: LoyaltyCard): void {\n cartState.updateLoyaltyCardId({ loyaltyCardNumber: card.CardNumber });\n}\n\n/**\n * The getLoyaltyCard data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const issueLoyaltyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/issue-loyalty',\n action: >issueLoyaltyAction,\n input: <(args: ICreateActionContext) => IActionInput>createIssueLoyaltyInput\n});\n\nexport default issueLoyaltyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { addProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Input class for the AddItemToOrderTemplate data action.\n */\nexport class AddItemToOrderTemplateInput implements IActionInput {\n public readonly orderTemplateId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n\n constructor(orderTemplateId: string, productId: number, quantity: number, unitOfMeasure: string) {\n this.orderTemplateId = orderTemplateId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n }\n\n public getCacheKey = () => 'AddItemToOrderTemplateInput';\n\n public getCacheObjectType = () => 'AddItemToOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddItemToOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of order template to update.\n * @param {number} productId The id of a product to add.\n * @param {number} quantity How many items of this product to add.\n * @param unitOfMeasure\n */\nexport const addItemToOrderTemplateInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string\n): AddItemToOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new AddItemToOrderTemplateInput(orderTemplateId, productId, quantity, unitOfMeasure);\n};\n\n/**\n * The action method for the AddItemToOrderTemplate data action.\n * @param {AddItemToOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function addItemToOrderTemplateAction(input: AddItemToOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n const productListLineToAdd: ProductListLine = {\n ProductListId: input.orderTemplateId,\n ProductId: input.productId,\n Quantity: input.quantity,\n UnitOfMeasure: input.unitOfMeasure\n };\n\n const productListLine: ProductListLine[] = await addProductListLinesAsync(\n {\n callerContext: ctx\n },\n input.orderTemplateId,\n [productListLineToAdd]\n );\n\n if (productListLine && productListLine.length === 1 && productListLine[0] && productListLine[0].ProductListId) {\n return productListLine[0];\n }\n ctx.telemetry.error('Product list line was not returned when adding it to order template');\n throw new Error('Product list line was not returned when adding it to order template');\n } catch (error) {\n ctx.telemetry.error('Not able to add an item to order template', error);\n throw error;\n }\n}\n\n/**\n * The AddItemToOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport const addItemToOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/add-item-to-order-template',\n action: >addItemToOrderTemplateAction,\n input: addItemToOrderTemplateInput\n});\n\nexport default addItemToOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartLine, QueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { addCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\n\nimport { getPaginatedOrderTemplateLinesAction, GetPaginatedOrderTemplateLinesInput } from './get-paginated-order-template-lines';\n\n/**\n * Input class for the AddOrderTemplateToCart data action.\n */\nexport class AddOrderTemplateToCartInput implements IActionInput {\n public readonly orderTemplateId: string;\n\n constructor(orderTemplateId: string) {\n this.orderTemplateId = orderTemplateId;\n }\n\n public getCacheKey = () => 'AddOrderTemplateToCartInput';\n\n public getCacheObjectType = () => 'AddOrderTemplateToCartInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddOrderTemplateToCart method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of template.\n */\nexport const addOrderTemplateToCartInput = (inputData: ICreateActionContext, orderTemplateId: string): AddOrderTemplateToCartInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new AddOrderTemplateToCartInput(orderTemplateId);\n};\n\n/**\n * The action method for the AddOrderTemplateToCart data action.\n * @param {AddOrderTemplateToCartInput} input The action input.\n * @param {IActionContext} ctx The action context.\n * @param context\n */\nexport async function addOrderTemplateToCartAction(input: AddOrderTemplateToCartInput, context: IActionContext): Promise {\n const cartState = await getCartState(context);\n const chunkCount = 1000;\n const queryResultSettings: QueryResultSettings = {\n Paging: {\n Top: chunkCount,\n Skip: 0\n }\n };\n const getPaginatedOrderTemplateLinesInput = new GetPaginatedOrderTemplateLinesInput(input.orderTemplateId, queryResultSettings);\n let orderTemplateLines = await getPaginatedOrderTemplateLinesAction(getPaginatedOrderTemplateLinesInput, context);\n let addedCartLines: CartLine[] = [];\n for (let skip = chunkCount; orderTemplateLines.lines.length > 0; skip += chunkCount) {\n const cartLines: CartLine[] = orderTemplateLines.lines.map(productLine => {\n const cartLine: CartLine = {\n ItemId: productLine.fullProduct?.ProductDetails.ItemId,\n ProductId: productLine.productListLine.ProductId,\n Quantity: productLine.productListLine.Quantity,\n TrackingId: '',\n UnitOfMeasureSymbol: productLine.productListLine.UnitOfMeasure\n };\n return cartLine;\n });\n await addCartLinesAsync({ callerContext: context }, cartState.cart.Id, cartLines, cartState.cart.Version).catch(error => {\n context.telemetry.trace(error.data?.ValidationResults);\n context.telemetry.trace('Unable to add order template to cart.');\n throw error.data?.ValidationResults;\n });\n addedCartLines = addedCartLines.concat(cartLines);\n getPaginatedOrderTemplateLinesInput.queryResultSettings.Paging!.Skip = skip;\n orderTemplateLines = await getPaginatedOrderTemplateLinesAction(getPaginatedOrderTemplateLinesInput, context);\n }\n await cartState.refreshCart({});\n return addedCartLines;\n}\n\n/**\n * The AddOrderTemplateToCart Data Action.\n * Returns created order template.\n */\nexport const addOrderTemplateToCartActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/add-order-template-to-cart',\n action: >addOrderTemplateToCartAction,\n input: addOrderTemplateToCartInput\n});\nexport default addOrderTemplateToCartActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductList, ProductListType } from '@msdyn365-commerce/retail-proxy';\nimport { createProductListAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\n\n/**\n * Input class for the CreateOrderTemplate data action.\n */\nexport class CreateOrderTemplateInput implements IActionInput {\n public readonly templateName: string;\n\n constructor(templateName: string) {\n this.templateName = templateName;\n }\n\n public getCacheKey = () => 'CreateOrderTemplateInput';\n\n public getCacheObjectType = () => 'CreateOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the CreateOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} templateName The name of template.\n */\nexport const createOrderTemplateInput = (inputData: ICreateActionContext, templateName: string): CreateOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new CreateOrderTemplateInput(templateName);\n};\n\n/**\n * The action method for the CreateOrderTemplate data action.\n * @param {CreateOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function createOrderTemplateAction(input: CreateOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n const orderTemplate: ProductList = {\n Id: '',\n Name: input.templateName,\n ProductListTypeValue: ProductListType.OrderTemplate\n };\n const createdProductList = await createProductListAsync(\n {\n callerContext: ctx\n },\n orderTemplate\n );\n if (createdProductList && createdProductList.Id !== '') {\n return createdProductList;\n }\n ctx.telemetry.error('Created product list was null');\n throw new Error('Created product list was null');\n } catch (error) {\n ctx.telemetry.error('Not able to create order template', error);\n throw error;\n }\n}\n\n/**\n * The CreateOrderTemplate Data Action.\n * Returns created order template.\n */\nexport const createOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/create-order-template',\n action: >createOrderTemplateAction,\n input: createOrderTemplateInput\n});\n\nexport default createOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport {\n getOrderTemplates,\n GetOrderTemplatesInput,\n getPaginatedOrderTemplateLinesAction,\n GetPaginatedOrderTemplateLinesInput,\n QueryResultSettingsProxy\n} from '..';\nimport { OrderTemplate } from '../utilities/order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetFullOrderTemplateInput implements IActionInput {\n public orderTemplateId: string;\n\n public queryResultSettings: IQueryResultSettings;\n\n constructor(orderTemplateId: string, queryResultSettings: IQueryResultSettings) {\n this.orderTemplateId = orderTemplateId;\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => `GetFullOrderTemplate|${this.orderTemplateId}`;\n\n public getCacheObjectType = () => 'GetFullOrderTemplate';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param orderTemplateId\n */\nexport const createGetFullOrderTemplateInput = (inputData: ICreateActionContext, orderTemplateId: string): GetFullOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n\n return new GetFullOrderTemplateInput(orderTemplateId, queryResultSettings);\n};\n\n/**\n * The action method for the GetFullOrderTemplate data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getFullOrderTemplateAction(input: GetFullOrderTemplateInput, ctx: IActionContext): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order template. User is not authenticated.');\n }\n\n const inputParams = new GetOrderTemplatesInput(input.orderTemplateId);\n const productLists: ProductList[] = await getOrderTemplates(inputParams, ctx);\n\n if (!productLists || productLists.length !== 1) {\n throw new Error('Unable to get full order template. Order template was not found.');\n }\n\n const inputLines = new GetPaginatedOrderTemplateLinesInput(productLists[0].Id, input.queryResultSettings);\n const linesState = await getPaginatedOrderTemplateLinesAction(inputLines, ctx);\n return new OrderTemplate(productLists[0], linesState.lines, linesState.totalCount);\n}\n\n/**\n * The GetFullOrderTemplate Data Action\n * Returns order templates.\n */\nexport const getFullOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-full-order-template',\n action: >getFullOrderTemplateAction,\n input: createGetFullOrderTemplateInput\n});\n\nexport default getFullOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n AsyncResult,\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport {\n getOrderTemplates,\n GetOrderTemplatesInput,\n getPaginatedOrderTemplateLinesAction,\n GetPaginatedOrderTemplateLinesInput,\n QueryResultSettingsProxy\n} from '..';\nimport { IOrderTemplateLinesState, OrderTemplate } from '../utilities/order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetFullOrderTemplatesInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n public getPrice?: boolean;\n public getRating?: boolean;\n\n constructor(queryResultSettings: IQueryResultSettings, getPrices = true, getRatings = true) {\n this.queryResultSettings = queryResultSettings;\n this.getPrice = getPrices;\n this.getRating = getRatings;\n }\n\n public getCacheKey = () => 'GetFullOrderTemplates';\n\n public getCacheObjectType = () => 'GetFullOrderTemplates';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetFullOrderTemplatesInput = (inputData: ICreateActionContext): GetFullOrderTemplatesInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n\n return new GetFullOrderTemplatesInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetFullOrderTemplates data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getFullOrderTemplatesAction(input: GetFullOrderTemplatesInput, ctx: IActionContext): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const orderTemplates: OrderTemplate[] = [];\n\n const inputParams = new GetOrderTemplatesInput();\n const productLists: ProductList[] = await getOrderTemplates(inputParams, ctx);\n\n if (!productLists || productLists.length === 0) {\n return orderTemplates;\n }\n\n const inputLinesRequests: AsyncResult[] = [];\n\n // Preparing requests for parallel queries.\n for (const list of productLists) {\n const inputLines = new GetPaginatedOrderTemplateLinesInput(\n list.Id,\n input.queryResultSettings,\n undefined,\n input.getPrice,\n input.getRating\n );\n\n inputLinesRequests.push(getPaginatedOrderTemplateLinesAction(inputLines, ctx));\n }\n\n const inputLinesResponses = await Promise.all(inputLinesRequests);\n\n for (const list of productLists) {\n const productLinesResponse = inputLinesResponses.filter(\n x => x.lines.length > 0 && x.lines[0].productListLine.ProductListId === list.Id\n );\n\n // Lines exist for this product\n if (productLinesResponse.length > 0) {\n orderTemplates.push(new OrderTemplate(list, productLinesResponse[0].lines, productLinesResponse[0].totalCount));\n } else {\n // Add empty order template\n orderTemplates.push(new OrderTemplate(list, [], 0));\n }\n }\n\n ctx.trace(orderTemplates.length.toString());\n return orderTemplates;\n}\n\n/**\n * The GetFullOrderTemplates Data Action\n * Returns order templates.\n */\nexport const getFullOrderTemplatesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-full-order-templates',\n action: >getFullOrderTemplatesAction,\n input: createGetFullOrderTemplatesInput\n});\n\nexport default getFullOrderTemplatesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\n\nimport { OrderTemplate } from '../utilities/order-templates';\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\nimport getFullOrderTemplates, { GetFullOrderTemplatesInput } from './get-full-order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetOrderTemplatesPreviewInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n\n constructor(queryResultSettings: IQueryResultSettings) {\n this.queryResultSettings = queryResultSettings;\n this.queryResultSettings.count = true;\n this.queryResultSettings.Paging!.Top = 4;\n }\n\n public getCacheKey = () => 'GetOrderTemplatesPreview';\n\n public getCacheObjectType = () => 'GetOrderTemplatesPreview';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetOrderTemplatesPreviewInput = (inputData: ICreateActionContext): GetOrderTemplatesPreviewInput => {\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return new GetOrderTemplatesPreviewInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetOrderTemplatesPreview data action.\n * @param input The action input.\n * @param context The action context.\n */\nexport async function getOrderTemplatesPreview(input: GetOrderTemplatesPreviewInput, context: IActionContext): Promise {\n const response: OrderTemplate[] = [];\n if (!context.requestContext.user.isAuthenticated) {\n context.trace('Unable to get order templates preview. User is not authenticated.');\n return Promise.resolve(response);\n }\n return getFullOrderTemplates(new GetFullOrderTemplatesInput(input.queryResultSettings, false, false), context);\n}\n\n/**\n * The GetOrderTemplatesPreview Data Action\n * Returns order templates.\n */\nexport const getOrderTemplatesPreviewDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-order-templates-preview',\n action: >getOrderTemplatesPreview,\n input: createGetOrderTemplatesPreviewInput\n});\n\nexport default getOrderTemplatesPreviewDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { QueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { searchAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductList, ProductListSearchCriteria, ProductListType } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetOrderTemplatesInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly queryResultSettings?: QueryResultSettings;\n\n constructor(productListId?: string, queryResultSettings?: QueryResultSettings) {\n this.productListId = productListId || '';\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = (): string =>\n `${this.productListId}|${this.queryResultSettings?.Paging?.Top}|${this.queryResultSettings?.Paging?.Skip}`;\n\n public getCacheObjectType = () => 'ProductList';\n\n public dataCacheType = (): CacheType => 'instance';\n\n public shouldCacheOutput = () => false;\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param productListId? The product list identifier.\n * @param queryResultSettings? The query result setting required for pagination/ordering.\n * @param productListId\n * @param queryResultSettings\n */\nexport const createGetOrderTemplatesInput = (\n inputData: ICreateActionContext,\n productListId?: string,\n queryResultSettings?: QueryResultSettings\n): GetOrderTemplatesInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get order template. User is not authenticated.');\n }\n\n return new GetOrderTemplatesInput(productListId || '', queryResultSettings);\n};\n\n/**\n * The action method for the GetOrderTemplates data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getOrderTemplatesAction(input: GetOrderTemplatesInput, ctx: IActionContext): Promise {\n try {\n const productListSearchCriteria: ProductListSearchCriteria = {\n ProductListId: input.productListId,\n ProductListType: `${ProductListType.OrderTemplate}`\n };\n return await searchAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n productListSearchCriteria\n );\n } catch (error) {\n ctx.telemetry.error('Not able to get order template(s)', error);\n throw error;\n }\n}\n\n/**\n * The GetOrderTemplates Data Action\n * Returns order templates.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-order-templates',\n action: >getOrderTemplatesAction,\n input: createGetOrderTemplatesInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { convertToString, IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { getProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\n\nimport { FullProductInput, getFullProducts, ProductDetailsCriteria, QueryResultSettingsProxy } from '..';\nimport { ArrayExtensions } from '../utilities';\nimport { IOrderTemplateLinesState, OrderTemplateLine } from '../utilities/order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetPaginatedOrderTemplateLinesInput implements IActionInput {\n public orderTemplateId: string;\n public queryResultSettings: IQueryResultSettings;\n public searchText: string;\n public getPrice: boolean = true;\n public getRating: boolean = true;\n\n constructor(\n orderTemplateId: string,\n queryResultSettings: IQueryResultSettings,\n searchText?: string,\n getPrice: boolean = true,\n getRating: boolean = true\n ) {\n this.orderTemplateId = orderTemplateId;\n this.queryResultSettings = queryResultSettings;\n this.searchText = searchText || '';\n this.getPrice = getPrice;\n this.getRating = getRating;\n }\n\n public getCacheKey = () =>\n `GetPaginatedOrderTemplateLines|${this.orderTemplateId}|${convertToString(this.queryResultSettings)}|${\n this.searchText\n }|${convertToString(this.getPrice)}|${convertToString(this.getRating)}`;\n\n public getCacheObjectType = () => 'GetPaginatedOrderTemplateLines';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param orderTemplateId\n * @param searchText\n */\nexport const createGetPaginatedOrderTemplateLinesInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n searchText?: string\n): GetPaginatedOrderTemplateLinesInput => {\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n return new GetPaginatedOrderTemplateLinesInput(orderTemplateId, queryResultSettings, searchText);\n};\n\nexport const getProductDetailsCriteriaFromActionInput = (inputData: GetPaginatedOrderTemplateLinesInput): ProductDetailsCriteria => {\n return {\n getPrice: inputData.getPrice ?? true,\n getRating: inputData.getRating ?? true\n };\n};\n\n/**\n * The action method for the GetPaginatedOrderTemplateLines data action.\n * @param input The action input.\n * @param context The action context.\n */\nexport async function getPaginatedOrderTemplateLinesAction(\n input: GetPaginatedOrderTemplateLinesInput,\n context: IActionContext\n): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const orderTemplateLinesState: IOrderTemplateLinesState = {\n lines: [],\n totalCount: 0\n };\n const promise = getProductListLinesAsync(\n {\n callerContext: context,\n queryResultSettings: input.queryResultSettings\n },\n input.orderTemplateId,\n input.searchText\n );\n const productListLines = await promise;\n const productInputs: FullProductInput[] = [];\n if (ArrayExtensions.hasElements(productListLines)) {\n orderTemplateLinesState.totalCount = promise.metadata.count || productListLines.length;\n productListLines.forEach(listLine => {\n if (listLine.ProductId) {\n orderTemplateLinesState.lines.push(new OrderTemplateLine(listLine));\n productInputs.push(\n new FullProductInput(\n listLine.ProductId,\n context.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(input),\n context.requestContext\n )\n );\n }\n });\n if (ArrayExtensions.hasElements(productInputs)) {\n const fullProductsInfo = await getFullProducts(productInputs, context)\n .then((products: FullProduct[]) => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n context.trace(error);\n context.telemetry.error(error.message);\n context.telemetry.error('[getPaginatedOrderTemplateLinesAction] Unable to retrieve product info.');\n });\n if (fullProductsInfo) {\n orderTemplateLinesState.lines.forEach(line => {\n const fullProduct = fullProductsInfo.find(\n product => product.ProductDetails.RecordId === line.productListLine.ProductId\n );\n if (!fullProduct) {\n context.telemetry.error(\n '[getPaginatedOrderTemplateLinesAction] Unable to find product info for an order template line.'\n );\n return;\n }\n line.fullProduct = fullProduct;\n });\n }\n return orderTemplateLinesState;\n }\n context.trace(orderTemplateLinesState.lines.length.toString());\n return orderTemplateLinesState;\n }\n return orderTemplateLinesState;\n}\n\n/**\n * The GetPaginatedOrderTemplateLines Data Action\n * Returns order templates.\n */\nexport const getPaginatedOrderTemplateLinesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-paginated-order-template-lines',\n action: getPaginatedOrderTemplateLinesAction as IAction,\n input: createGetPaginatedOrderTemplateLinesInput\n});\n\nexport default getPaginatedOrderTemplateLinesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Input class for the UpdateOrderTemplate data action.\n */\nexport class UpdateOrderTemplateHeaderInput implements IActionInput {\n public readonly orderTemplate: ProductList;\n\n constructor(orderTemplate: ProductList) {\n this.orderTemplate = orderTemplate;\n }\n\n public getCacheKey = () => 'UpdateOrderTemplateHeaderInput';\n\n public getCacheObjectType = () => 'UpdateOrderTemplateHeaderInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the UpdateOrderTemplateHeader method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {ProductList} orderTemplate The template header.\n */\nexport const updateOrderTemplateHeaderInput = (\n inputData: ICreateActionContext,\n orderTemplate: ProductList\n): UpdateOrderTemplateHeaderInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to update order template. User is not authenticated.');\n }\n return new UpdateOrderTemplateHeaderInput(orderTemplate);\n};\n\n/**\n * The action method for the UpdateOrderTemplate data action.\n * @param {UpdateOrderTemplateHeaderInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function updateOrderTemplateHeaderAction(input: UpdateOrderTemplateHeaderInput, ctx: IActionContext): Promise {\n try {\n const { orderTemplate } = input;\n const updatedProductList = await updateAsync(\n {\n callerContext: ctx\n },\n orderTemplate\n );\n if (updatedProductList) {\n return updatedProductList;\n }\n ctx.telemetry.error(`Updated product list ${orderTemplate.Id} came back as null.`);\n throw new Error('Updated product list was null.');\n } catch (error) {\n ctx.telemetry.error('Not able to update order template', error);\n throw error;\n }\n}\n\n/**\n * The UpdateOrderTemplate Data Action.\n * Returns updated order template.\n */\nexport const updateOrderTemplateHeaderActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/update-order-template-header',\n action: >updateOrderTemplateHeaderAction,\n input: updateOrderTemplateHeaderInput\n});\n\nexport default updateOrderTemplateHeaderActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { updateProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport getPaginatedOrderTemplateLines, { GetPaginatedOrderTemplateLinesInput } from './get-paginated-order-template-lines';\n\n/**\n * Input class for the UpdateOrderTemplate data action.\n */\nexport class UpdateOrderTemplateInput implements IActionInput {\n public readonly orderTemplateId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n\n constructor(orderTemplateId: string, productId: number, quantity: number, unitOfMeasure: string) {\n this.orderTemplateId = orderTemplateId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n }\n\n public getCacheKey = () => 'UpdateOrderTemplateInput';\n\n public getCacheObjectType = () => 'UpdateOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the UpdateOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of order template to update.\n * @param {number} productId The id of a product to add.\n * @param {number} quantity How many items of this product to add.\n * @param unitOfMeasure\n */\nexport const updateOrderTemplateInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string\n): UpdateOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new UpdateOrderTemplateInput(orderTemplateId, productId, quantity, unitOfMeasure);\n};\n\n/**\n * The action method for the UpdateOrderTemplate data action.\n * @param {UpdateOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function updateOrderTemplateAction(input: UpdateOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('User token was not found when updating the order template');\n }\n const getLinesInput = new GetPaginatedOrderTemplateLinesInput(input.orderTemplateId, {}, input.productId.toString());\n const linesState = await getPaginatedOrderTemplateLines(getLinesInput, ctx);\n if (!linesState) {\n throw new Error('Order template was not found when updating the order template');\n }\n\n const linesToUpdate = linesState.lines.filter(line => line.productListLine.ProductId === input.productId);\n if (linesToUpdate.length !== 1) {\n throw new Error('Unable to find the line to update when updating the order template');\n }\n\n const lineToUpdate = linesToUpdate[0].productListLine;\n\n lineToUpdate.UnitOfMeasure = input.unitOfMeasure;\n lineToUpdate.Quantity = input.quantity;\n\n const updatedLines: ProductListLine[] = await updateProductListLinesAsync(\n {\n callerContext: ctx\n },\n input.orderTemplateId,\n [lineToUpdate]\n );\n\n if (!updatedLines || updatedLines.length !== 1) {\n throw new Error('Server returned invalid lines when updating order template');\n }\n const updatedLine = updatedLines.filter(line => line.ProductId === input.productId);\n if (\n updatedLine.length !== 1 ||\n updatedLine[0].Quantity !== input.quantity ||\n updatedLine[0].UnitOfMeasure !== input.unitOfMeasure\n ) {\n throw new Error('Server did not update the line when updating order template');\n }\n return updatedLine[0];\n } catch (error) {\n ctx.telemetry.error('Not able to add an item to order template', error);\n throw error;\n }\n}\n\n/**\n * The UpdateOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/update-order-template-line',\n action: >updateOrderTemplateAction,\n input: updateOrderTemplateInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport { createRefineSearchByCategoryInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist/retail-action';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Action Input class for the refineSearchByCategory data action.\n */\nexport class RefineSearchByCriteriaInput implements IActionInput {\n public readonly categoryId?: number;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly catalogId: number;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n apiSettings: ICommerceApiSettings,\n categoryId?: number,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number\n ) {\n this.categoryId = categoryId;\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = catalogId || 0;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('RefineSearchByCriteriaInputCache', this.apiSettings);\n\n public getCacheObjectType = () => 'RefineSearchByCriteriaInput';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the refineSearchByCategory data action.\n * @param inputData\n */\nexport const createInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.categoryId) {\n return createRefineSearchByCategoryInput(\n QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings,\n +inputData.requestContext.apiSettings.channelId,\n inputData.config ? Number(inputData.config.catalogId) : 0,\n +inputData.requestContext.query.categoryId,\n !Array.isArray(refinementCriteria)\n ? []\n : refinementCriteria.map((refinementCriterion: ProductRefinerValue) => refinementCriterion)\n );\n }\n\n throw new Error('Please specify categoryId, refinerId, and refinerSourceValue query string in request.');\n};\n\n/**\n * The RefineSearchByCategory data action\n * Uses categoryId query string parameter to call the RefinerSearchByCategory\n * RetailServer API to get information about products.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/regin-search-by-category',\n action: >retailAction,\n input: createInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { IDataServiceRequest, retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createSearchByTextInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * CreateInput method for the searchByText data action.\n * @param inputData\n */\nexport function createSearchByTextInputFunc(inputData: ICreateActionContext, IGeneric>): IDataServiceRequest {\n const {\n requestContext: {\n query,\n apiSettings: { channelId }\n }\n } = inputData;\n\n const search = query && query.q;\n\n if (!search) {\n throw new Error(\n 'Unable to preform search without search text. Query string ?q={searchText} must be present or should be configued in module data.'\n );\n }\n\n const querySettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return createSearchByTextInput(querySettingsProxy.QueryResultSettings, Number(channelId), 0, search);\n}\n\n/**\n * The searchByText data action\n * Queries RetailServers product searchByText API using a\n * query string parameter and returns a list of ProductSearchResults.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/search-by-text',\n action: >retailAction,\n input: createSearchByTextInputFunc\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { createAddressManagementInput, doAddressManagementOperation, IAddressManagementInput } from './add-address';\n\n// TODO: Centralize this logic in a common utility area\nexport function updateAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = customer.Addresses || [];\n if (address.IsPrimary) {\n customer.Addresses.forEach(cur => (cur.IsPrimary = false));\n }\n customer.Addresses = [...customer.Addresses.filter(cur => cur.RecordId !== address.RecordId), address];\n return customer;\n}\n\nexport async function updateAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, updateAddressHandler);\n}\n\n/**\n * The updateAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Merge the passed address information with the address information from\n * the retireved customer, and then updates that customer via the update RetailServer API.\n */\nexport const updateAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-address',\n action: >updateAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput)\n});\n\nexport default updateAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings\n} from '@msdyn365-commerce/core';\nimport { Customer, CustomerAttribute } from '@msdyn365-commerce/retail-proxy';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { GetCustomerInput } from './get-customer';\n\nexport interface IUpdateCustomerAttributesInput extends IActionInput {\n phone?: string;\n vatNumber?: string;\n customerAttributes: CustomerAttribute[];\n userAccountNumber: string;\n apiSettings: ICommerceApiSettings;\n}\n\n/**\n * Input class for the updateCustomerAttributes.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class updateCustomerAttributesInput implements IUpdateCustomerAttributesInput {\n public userAccountNumber: string;\n\n public customerAttributes: CustomerAttribute[];\n\n public apiSettings: ICommerceApiSettings;\n\n public phone?: string;\n\n public vatNumber?: string;\n\n constructor(\n userAccountNumber: string,\n customerAttributes: CustomerAttribute[],\n apiSettings: ICommerceApiSettings,\n phone?: string,\n vatNumber?: string\n ) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n this.customerAttributes = customerAttributes;\n this.phone = phone;\n this.vatNumber = vatNumber;\n }\n\n public getCacheKey = (): string => buildCacheKey(`${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'Customer';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The action method for the updateCustomerAttributes data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function updateCustomerAttributesAction(input: IUpdateCustomerAttributesInput, ctx: IActionContext): Promise {\n const { customerAttributes, phone, vatNumber, userAccountNumber } = input;\n\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, userAccountNumber);\n\n if (!customer) {\n ctx.telemetry.debug('[update-customer-attributes] Unable to find customer');\n throw new Error('Unable to find customer');\n }\n\n const newCustomer = { ...customer };\n newCustomer.Phone = phone;\n newCustomer.VatNumber = vatNumber;\n newCustomer.Attributes = customerAttributes;\n\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n ctx.telemetry.debug('[update-customer-attributes] Unable to update customer attributes');\n throw new Error('Unable to update customer attributes');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer;\n}\n\n/**\n * The updateCustomerAttributes data action\n * Returns the updated customer.\n */\nexport const updateCustomerAttributesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-customer-attributes',\n action: >updateCustomerAttributesAction\n});\n\nexport default updateCustomerAttributesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings\n} from '@msdyn365-commerce/core';\nimport { Customer } from '@msdyn365-commerce/retail-proxy';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { GetCustomerInput } from './get-customer';\n\nexport interface IUpdateCustomerPersonalizationInput extends IActionInput {\n isOptOut: boolean;\n userAccountNumber: string;\n apiSettings: ICommerceApiSettings;\n preferenceType?: string;\n}\n\n/**\n * Input class for the updateCustomerPersonalization.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class updateCustomerPersonalizationInput implements IUpdateCustomerPersonalizationInput {\n public userAccountNumber: string;\n\n public isOptOut: boolean;\n\n public apiSettings: ICommerceApiSettings;\n\n public preferenceType: string | undefined;\n\n constructor(userAccountNumber: string, isOptOut: boolean, apiSettings: ICommerceApiSettings, preferenceType?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n this.isOptOut = isOptOut;\n this.preferenceType = preferenceType;\n }\n\n public getCacheKey = (): string => buildCacheKey(`${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'Customer';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The action method for the updateCustomerPersonalization data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function updateCustomerPersonalizationAction(\n input: IUpdateCustomerPersonalizationInput,\n ctx: IActionContext\n): Promise {\n const { userAccountNumber, isOptOut, preferenceType } = input;\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, userAccountNumber);\n if (!customer) {\n throw new Error('Unable to find customer');\n }\n\n const newCustomer = { ...customer };\n\n switch (preferenceType) {\n case 'web-tracking':\n newCustomer.OptOutWebActivityTracking = isOptOut;\n break;\n case undefined:\n case 'personalization':\n default:\n newCustomer.OptOutPersonalization = isOptOut;\n }\n\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n throw new Error('Unable to update customer');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer;\n}\n\n/**\n * The updateCustomerPersonalization data action\n * Returns the updated customer.\n */\nexport const updateCustomerPersonalizationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-customer-personalization',\n action: >updateCustomerPersonalizationAction\n});\n\nexport default updateCustomerPersonalizationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { createAddressManagementInput, IAddressManagementInput } from './add-address';\nimport { GetCustomerInput } from './get-customer';\n\nexport function updatePrimaryAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses || [])]);\n return customer;\n}\n\nexport async function updatePrimaryAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n const { address } = input;\n\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, '');\n\n if (!customer) {\n throw new Error('Unable to find customer');\n }\n\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses ?? [])]);\n const updatedCustomer = await updateAsync({ callerContext: ctx }, customer);\n\n if (!updatedCustomer) {\n throw new Error('Unable to update customer');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer.Addresses || [];\n}\n\n/**\n * The updatePrimaryAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Merge the passed address information with the address information from\n * the retireved customer, and then updates that customer via the update RetailServer API.\n */\nexport const updatePrimaryAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-primary-address',\n action: >updatePrimaryAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\nexport default updatePrimaryAddressActionDataAction;\n\nconst setPrimaryAddress = (primaryAddresses: Address, addresses: Address[]): Address[] => {\n return addresses.map(addr => {\n if (addr.RecordId === primaryAddresses.RecordId) {\n addr.IsPrimary = true;\n } else {\n addr.IsPrimary = false;\n }\n return addr;\n });\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport msdyn365Commerce, { IParameterizeFeatureFlags } from '@msdyn365-commerce/core';\n\nexport function parameterize(\n name: string = '',\n sep = '-',\n parameterizeFeatureFlags: IParameterizeFeatureFlags = {},\n neutralizedName?: string\n) {\n // If neutralizedName flag enabled, we use neutralizedName to construct string\n const candidateName =\n (msdyn365Commerce.platformSettings && msdyn365Commerce.platformSettings.enableUrlLocalization) ||\n parameterizeFeatureFlags.enableUrlLocalization\n ? name\n : neutralizedName || name;\n\n /*\n 1\t‘ ‘ (space)\t-> (single dash)\n 3\tAny character disallowed in URLs -> URL-encode\n 5\t‘ & ‘ (space ampersand space) -> (single dash)\n 6\t‘ - ‘ (space dash space) -> (single dash)\n 7\t‘ ‘ (2+ spaces) -> (single dash)\n 10\t[A-Z] (capital letters) -> [a-z] (lower-case)\n 12\tAny non-ASCII character outside of the set of disallowed characters -> URL-encode\n */\n if (\n parameterizeFeatureFlags.enableUrlEncoding ||\n (msdyn365Commerce.platformSettings && msdyn365Commerce.platformSettings.enableUrlEncoding)\n ) {\n // Replace url reserved characters with dash, and remove front and end dash;\n // &*!() reserved characters that can not be encoded by encodeURIComponent()\n return encodeURIComponent(\n candidateName\n .toLowerCase()\n .replace(/[\\s!&'()*]+/g, '-')\n .trim()\n .replace(/-+/g, '-')\n .replace(/^-+|-+$/g, '')\n );\n }\n return name\n .toLowerCase()\n .replace(/[^\\d_a-z\\-]+/g, ' ')\n .trim()\n .replace(/\\s+/g, sep);\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport { getParameterizeFeatureFlags, getUrlSync, IActionContext, IParameterizeFeatureFlags } from '@msdyn365-commerce/core';\n\nimport { parameterize } from './parameterize';\n\ninterface ICategoryMap {\n [RecordId: number]: CategoryHierarchy;\n}\n\n/**\n * Builds slugs for category.\n * @param category\n * @param categoryMap\n * @param parameterizeFeatureFlags\n */\nexport function getCategorySlug(\n category: CategoryHierarchy,\n categoryMap: ICategoryMap,\n parameterizeFeatureFlags?: IParameterizeFeatureFlags\n): string {\n if (!category || !category.Name) {\n // Invalid category\n return '';\n }\n const categoryName = parameterize(category.Name, undefined, parameterizeFeatureFlags, category.NeutralizedName);\n if (!category.ParentCategory || category.ParentCategory === 0) {\n // Base case assign url\n category.Slug = category.Slug || `/${categoryName}`;\n } else if (category.ParentCategory) {\n category.Slug =\n category.Slug ||\n `${getCategorySlug(categoryMap[category.ParentCategory], categoryMap, parameterizeFeatureFlags)}/${categoryName}`;\n }\n\n return category.Slug || '';\n}\n\n/**\n * Gets Url for category hierarchy. Returns string and adds url to Url property of category hierarchy.\n * @param category Category to generate URL for.\n * @param ctx\n * @param categoryMap Dictionary of all categories.\n */\nexport function getCategoryUrl(category: CategoryHierarchy, ctx?: IActionContext, categoryMap?: ICategoryMap): string | undefined {\n if (!category.Url && ctx && categoryMap) {\n if (!category.Slug) {\n const parameterizeFeatureFlags: IParameterizeFeatureFlags = ctx.requestContext ? getParameterizeFeatureFlags(ctx) : {};\n category.Slug = getCategorySlug(category, categoryMap, parameterizeFeatureFlags);\n }\n category.Url = getUrlSync('category', ctx, { category });\n }\n return category.Url;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { getUrlSync, IActionContext } from '@msdyn365-commerce/core';\n\n/**\n * Syncronously creates an invoice detail page url.\n * @param invoiceId Invoice Id.\n * @param ctx\n */\nexport function getInvoiceDetailsPageUrlSync(invoiceId: string, ctx: IActionContext): string {\n let url = getUrlSync('invoice-details', ctx) || '';\n url = url.includes('?') ? url.substr(0, url.indexOf('?')) : url;\n return `${url}?invoiceId=${invoiceId}`;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport { getUrlSync, IActionContext } from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Syncronously creates a product url.\n * @param product Simple product to get url from.\n * @param ctx\n * @param category Category to add to product url.\n */\nexport function getProductUrlSync(product: SimpleProduct, ctx: IActionContext, category?: CategoryHierarchy): string {\n const selectedProduct = { ...product, RecordId: product.MasterProductId || product.RecordId };\n\n return getProductPageUrlSync(selectedProduct.Name || '', selectedProduct.RecordId, ctx, category)!;\n}\n\n/**\n * Syncronously creates a product detail page url.\n * @param name Simple product name.\n * @param recordId Record id of product.\n * @param ctx\n * @param category\n */\nexport function getProductPageUrlSync(name: string, recordId: number, ctx: IActionContext, category?: CategoryHierarchy): string {\n return getUrlSync('product', ctx, {\n product: { Name: name || '', RecordId: recordId },\n category\n })!;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\n\nexport const getRnrPartnerId = (args: ICreateActionContext> | IActionContext): string => {\n return args.requestContext.apiSettings.rnr.id || '';\n};\n\nexport const getRnrEndpointId = (args: ICreateActionContext> | IActionContext): string => {\n return args.requestContext.apiSettings.rnr.url || '';\n};\n\nexport const getRnrAuthEndpointId = (args: ICreateActionContext> | IActionContext): string => {\n const endpoint = args.requestContext.apiSettings.rnr.proxyUrl\n ? args.requestContext.apiSettings.rnr.proxyUrl\n : args.requestContext.apiSettings.rnr.url || '';\n if (endpoint.length > 0 && endpoint.endsWith('/')) {\n return endpoint.substring(0, endpoint.length - 1);\n }\n return endpoint;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { ProductList, ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * OrderTemplateLine state information.\n */\nexport class OrderTemplateLine {\n public productListLine: ProductListLine;\n\n public fullProduct?: FullProduct;\n\n constructor(productListLine: ProductListLine, fullProduct?: FullProduct) {\n this.productListLine = productListLine;\n this.fullProduct = fullProduct;\n }\n}\n\nexport interface IOrderTemplateLinesState {\n lines: OrderTemplateLine[];\n totalCount: number;\n}\n\n/**\n * Order template class.\n */\nexport class OrderTemplate {\n public productList: ProductList;\n\n public orderTemplateLines: OrderTemplateLine[];\n\n public totalLines: number;\n\n constructor(productList: ProductList, orderTemplateLines: OrderTemplateLine[], totalLines: number) {\n this.productList = productList;\n this.orderTemplateLines = orderTemplateLines;\n this.totalLines = totalLines;\n }\n}\n"],"names":["AddressManagementInput","constructor","address","userAccountNumber","getCacheKey","getCacheObjectType","dataCacheType","this","createAddressManagementInput","inputData","requestContext","user","isAuthenticated","Error","data","undefined","async","doAddressManagementOperation","input","ctx","operationHandler","customerInput","GetCustomerInput","apiSettings","customer","getCustomer","newCustomer","_objectSpread","updatedCustomer","updateAsync","callerContext","update","createReadAsync","AccountNumber","Addresses","addAddressHandler","push","createObservableDataAction","id","action","isBatched","AddItemToProductListInput","productListId","productId","quantity","unitOfMeasure","context","productListLineToAdd","ProductListId","ProductId","Quantity","UnitOfMeasure","productListLine","ProductListsDataActions","ArrayExtensions","hasElements","telemetry","error","addItemToProductListInput","AddOrganizationUserInput","newUser","getCurrentAsync","then","businessPartner","BusinessPartnerId","createBusinessPartnerUserAsync","catch","debug","exception","createAddOrganizationUserInput","requestUrl","baseUrl","cartId","requestOptions","headers","oun","token","Authorization","cartTenderLines","length","map","cartTenderLineItem","TokenizedPaymentCard","House","CardTokenInfo","billingAddress","Phone","ThreeLetterISORegionName","Street","City","State","ZipCode","Country","toUpperCase","Address1","Zip","requestBody","receiptEmail","cartVersion","sendCommerceRequest","response","status","CreateProductListInput","templateName","templateType","orderTemplate","Id","Name","ProductListTypeValue","createdProductList","createProductListInput","deleteAddressHandler","filter","cur","RecordId","DeleteOrganizationUserInput","deleteAsync","console","log","createDeleteOrganizationUserInput","EditOrganizationUserInput","updatedUser","createEditOrganizationUserInput","GenericInput","cacheKey","result","cacheObjectType","getGenericAction","AddressInput","buildCacheKey","createGetAddressInput","getAddressAction","getAddressActionDataAction","GetAttributeDefinitionsInput","attributeDefinitionCriteria","getAttributeDefinitionsActionDataAction","channel","CustomerAttributeGroupId","getAttributeDefinitionsAsync","trace","AttributeGroupIdentifier","AttributesForSelectedVariantInput","channelId","selectedProduct","catalogId","getAttributesForSelectedVariantAction","Promise","resolve","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariantActionDataAction","productResult","getAttributeValuesAsync","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","attributeValues","message","getSelectedProductIdFromActionInput","getCatalogId","ProductAvailabilitiesForCartLineItems","getDeliveryMode","cartLine","_channelDeliveryOptio","featureSate","arguments","channelDeliveryOptionConfig","pickupDeliveryMode","DeliveryMode","PickupDeliveryModeCodes","find","deliveryMode","getAvailabilitiesForCartLineItems","_featureState$find","shippingItems","bopisItems","productAvailabilities","cart","getCartState","channelConfiguration","getOrgUnitConfigurationAsync","products","getActiveCartProductsAction","ActiveCartProductsInput","featureState","getFeatureStateActionDataAction","FeatureStateInput","getFeatureState","retailMultiplePickUpOptionEnabled","item","IsEnabled","getChannelDeliveryOptionConfigurationAsync","PickupDeliveryModeCode","EmailDeliveryModeCode","CartLines","productIds","x","unique","searchCriteria","createInventoryAvailabilitySearchCriteria","shippingProductAvailabilities","getEstimatedAvailabilityAsync","bypassCache","ProductWarehouseInventoryAvailabilities","mapAggregatedProductInventoryInformation","productWarehouses","bopisItem","productWarehouse","InventLocationId","WarehouseId","InventLocationDataAreaId","DataAreaId","quantityUnitTypeSales","getProductWarehouseAvail","getEstimatedProductWarehouseAvailabilityAsync","productWarehouseMapping","mapProductInventoryInformation","getAvailabilitiesForCartLineItemsDataAction","CatalogsInput","customerAccountNumber","locale","Number","createCatalogsInput","getCatalogAction","CatalogsDataActions","getCatalogActionDataAction","CategoriesInput","mappedToHierarchy","maxItems","sitePath","_mappedToHierarchy","getLocale","mapCategoryToHierarchy","categoryList","categoryMap","reduce","memo","category","localName","getFriendlyName","nameTranslations","nameTranslation","Language","toLowerCase","Text","NameTranslations","categoryHierarchy","NeutralizedName","zeroCategory","Object","keys","forEach","element","parentId","ParentCategory","Url","getCategoryUrl","parent","Children","createCategoriesHierarchyInput","topItems","config","topCategories","parseInt","getCategoryHierarchyAction","categories","getCategoryAction","RawCategoriesInput","getCategoryHierarchyActionDataAction","_context$apiSettings","_this$catalogId","CategoriesDataActions","_inputData$config","GetCategoryPathsInput","categoryPathLooksups","constructedCacheKey","ChannelId","CatalogId","categoryPath","toString","createGetCategoryPathsInput","getCategoryPathsAction","categoryPathResults","getCategoryPathsAsync","CategoryPath","categoryUrl","getCategoriesUrlSync","slice","getCategoryPathsActionDataAction","GetChannelDeliveryConfigurationInput","accountNumber","GetCheckoutCartInput","CartCookieName","msdyn365Commerce","CartCookie","Cookie","activeCart","checkoutCart","copyAsync","Array","isArray","CurrentCategoryHierarchyInput","activeCategoryId","super","_activeCategoryId","_inputData$requestCon","urlTokens","pageType","itemId","query","categoryId","activeCategoryParsedId","findCategoryHierarchy","innerCategoryHierarchy","getCurrentCategoryHierarchyAction","_findCategoryHierarch","fullCategoryHierarchy","getCategoriesHierarchy","reverse","getCurrentCategoryHierarchyActionDataAction","CurrentCategoryInput","categorySlug","isNaN","recordId","tempActionContext","parameterizeFeatureFlags","getParameterizeFeatureFlags","parameterize","join","createGetCurrentCategoryInput","searchCategory","foundCategory","cat","Slug","matchingChild","getCurrentCategoryAction","categoryInput","getCategoryHierarchy","getCurrentCategoryActionDataAction","GetCustomerBalanceInput","createGetCustomerBalanceInput","getCustomerBalanceAction","getCustomerBalanceAsync","InvoiceAccount","getCustomerBalanceActionDataAction","retailAction","createGetCustomerLoyaltyCardsInput","cacheType","getCustomerActionDataAction","CustomersDataActions","ProductDeliveryOptionsForCartLineItems","getDeliveryOptionsForCartLineItems","ProductsDataActions","getDeliveryOptionsForCartLineItemsDataAction","GetDeliveryOptionsForSelectedVariantInput","customerId","createDeliveryOptionsForSelectedVariantInput","getDeliveryOptionsForSelectedVariantAction","getSelectedVariant","getDeliveryOptionsAsync","ItemTypeValue","ReleasedProductType","Service","FilterDeliveryModeOption","FilterOutNonPickupDeliveryMode","getDeliveryOptionsForSelectedVariantActionDataAction","DimensionAvailabilitiesForProductSearchResultInput","dimensionContext","displayType","product","productsDimensionInputs","inventoryLevel","app","_product$AttributeVal","filteredProductAttributes","AttributeValues","attributeValue","_attributeValue$Name$","_attributeValue$Name","checkIfShouldDisplayAsSwatch","toLocaleLowerCase","_product$MasterProduc","productionDimensionType","ProductDimensionType","ProductsDimensionAvailabilitiesInput","MasterProductId","dimensionForProducts","getDimensionAvailabilitiesForProductsAction","productsDimensionAvailabilities","dimensionInput","index","dimensionValuesWithInventory","_dimensionValue$Value","inventoryLevelCode","getInventoryLevelCodeFromDimensionValue","value","DimensionValue","Value","isDisabled","InventoryLevelValues","outOfStock","masterProductId","warning","createDimensionAvailabilitiesForProductSearchResultInput","requestDimensionType","inputs","promise","shippingInventoryConfiguration","RequestedDimensionTypeValue","MatchingDimensionValues","DefaultWarehouseOnly","FilterByChannelFulfillmentGroup","DeliveryModeTypeFilterValue","all","productsDimensions","productDimension","GetDimensionsForSelectedVariantInput","matchingDimensionValues","getDimensionsForSelectedVariantAction","_input$catalogId","activeProducts","validValues","Dimensions","promises","dimension","DimensionTypeValue","dimensionValues","dimensionValuesResults","newDimension","_newDimension$dimensi","oldDimension","DimensionValues","getDimensionsForSelectedVariantActionDataAction","getDimensionValuesFromQuery","url","featureNames","createGetFeatureStateInput","getFeatureStateAction","StoreOperationsDataActions","GetFullAvailableInventoryNearbyInput","_productId","_latitude","_longitude","_radius","_DistanceUnitValue","_IgnoreLocation","latitude","longitude","radius","DistanceUnitValue","IgnoreLocation","createGetFullAvailableInventoryNearbyInput","getFullAvailableInventoryNearbyAction","searchArea","Latitude","Longitude","Radius","retailMulitplePickupMFeatureState","pickup","productInventoryInformation","productWarehouseInformation","getOrgUnitLocationsByAreaAsync","DeliveryModeTypeFilter","Pickup","storeMap","Map","stores","store","InventoryLocationId","set","locationDeliveryOptions","orgUnitChannel","channelCollection","channelIdList","getChannelDeliveryOptionsAsync","channelDeliveryOptions","_getLocationPickUpDeliveryModes","availabilityPromiseList","_locationDeliveryOpti","locationDeliveryOption","_channeldeliveryoption","orgUnitLocation","channelDeleiveryOptions","OrgUnitNumber","OrgUnitAvailability","getStoreHoursAsync","hours","itemAvailabilities","_element$ProductAvail","has","AvailableQuantity","ProductAvailableQuantity","availability","OrgUnitLocation","ItemAvailabilities","ProductInventoryInformation","OrgUnitPickUpDeliveryModes","StoreHours","_getAvailabilityWithHours","getFullAvailableInventoryNearbyActionDataAction","QuickOrderTemplate","productList","quickOrderTemplateLines","totalLines","GetFullProductListInput","inputParameters","GetProductListInput","getProductList","productLists","inputLines","GetProductListLinesInput","getProductListLines","linesState","lines","totalCount","createGetFullProductListInput","FullProductsRefineSearchByCategoryInput","queryResultSettingsProxy","refinementCriteria","criteria","ProductDetailsCriteria","hasSortingColumn","QueryResultSettings","Sorting","Columns","fullProductInputs","refineSearchByCategoryAsync","searchResults","FullProductInput","productSearchResult","getFullProducts","fromInputData","productDetailsCriteria","getProductDetailsCriteriaFromActionInput","FullProductsRefineSearchByTextInput","searchText","getRefinedProducts","getRefinedFullProducts","refineSearchByTextAsync","searchInputData","parseSearchData","q","getPrice","getRating","generateKey","getFullProductsAction","productInputs","ProductInput","getSimpleProducts","ProductDetails","productCollection","validProductIds","Set","ratingsAndPricePromises","_getActivePrices","_getProductRatings","_inputs$0$catalogId","projectDomain","validInputs","Boolean","affiliations","getCartFromCustomer","AffiliationLines","getActivePricesAsync","Date","productPrice","fullProduct","versionLt","retailServerProxyVersion","CustomerContextualPrice","AdjustedPrice","ProductPrice","getProductRatingsAsync","productRating","ProductRating","split","ActiveWishlistInput","getActiveWishlistItems","wishlists","getByCustomerAsync","CommerceListLines","commerceListLine","ListItemType","ListInput","documentId","title","description","shortDescription","backgroundColor","foregroundColor","images","items","productItems","itemsCount","itemsPerPage","skipCount","shouldCacheOutput","DocumentId","ItemsCount","ItemsPerPage","SkipCount","Title","Description","ShortDescription","BackgroundColor","ForegroundColor","Images","Items","ProductItems","getImages","resultImageList","image","href","imageItem","altText","width","height","getSubListItem","sitePathOfRequest","imageList","fields","content","sublistHref","listName","_name","Href","getSitePath","inputArray","GetProducts","productMap","listitem","listData","pageData","list","_id","getInutListData","listItems","parentImageList","getItemsPerPage","getSkipCount","sum","type","clonedList","productItem","GetLoyaltyCardInput","createGetLoyaltyCardInput","getLoyaltyAction","getCustomerLoyaltyCardsAsync","cards","firstCard","getLoyaltyCardAsync","CardNumber","card","LoyaltyEnrollmentDate","LoyaltyEnrollmentDateLocal","getLoyaltyActionDataAction","GetLoyaltyTransactionEstimationInput","createGetLoyaltyTransactionEstimationInput","getLoyaltyTransactionEstimationAction","_getCart","_getLoyalty","_getOrgUnits","getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync","Currency","points","loyaltyCardInput","getLoyalty","getLoyaltyTransactionEstimationActionDataAction","MediaLocationsByIdInput","createMediaLocationsByIdInput","getMediaLocationsByIdAction","getMediaLocationsAsync","mediaLocation","Uri","generateImageUrl","AltText","getMediaLocationsByIdActionDataAction","MediaLocationsForSelectedVariantInput","createMediaLocationsForSelectedVariantInput","getMediaLocationsForSelectedVariantAction","AsyncResult","_productResult$produc","productVariant","getMediaLocationsForSelectedVariantActionDataAction","createGetOrderShipmentsHistoryInput","Paging","Top","Skip","createGetOrgUnitConfigurationInput","OrganizationUsersCountInput","createGetOrganizationUsersCountInput","getOrganizationUsersCount","getUsersAsync","users","OrganizationUsersInput","createGetOrganizationUsersInput","getOrganizationUsers","getOrganizationUsersDataAction","GetOrganizationWideOrderHistoryInput","convertToString","_context$requestConte","getOrderHistoryAsync","ProductPickUpOptionsForCartLineItems","getPickUpOptionsForCartLineItems","getPickUpOptionsForCartLineItemsDataAction","PriceForProductSearchResultInput","JSON","stringify","getPriceForProductSearchResultDataAction","productRecIds","affiliation","productPrices","productResults","activePrice","price","_activePrice$Customer","_activePrice$BasePric","_activePrice$TradeAgr","_activePrice$Adjusted","Price","BasePrice","Math","max","TradeAgreementPrice","PriceForSelectedVariantInput","createActivePriceForSelectedVariantInput","getPriceForSelectedVariantAction","_featureStates$find","_featureStates$find2","featureStates","ProductTypeValue","ProductType","Master","KitMaster","getPriceForSelectedVariantActionDataAction","ProductAvailabilitiesForSelectedVariantInput","createProductAvailabilitiesForSelectedVariantInput","getProductAvailabilitiesForSelectedVariantAction","enableStockCheck","shippingSearchCriteria","shipping","pickupSearchCriteria","shippingAvailability","shippingInventory","deliveryType","pickupAvailability","pickupInventory","mergeProductWarehouseToProductAvailabities","productsWarehouseInventory","productAvailable","TotalAvailable","getProductAvailabilitiesForSelectedVariantActionDataAction","ProductDimensionsWithAvailabilitiesInput","createProductDimensionsWithAvailabilitiesInput","getProductDimensionsWithAvailabilitiesAction","getProductDimensionsWithAvailabilities","QuickOrderTemplateLine","quickOrderTemplateLinesState","productListLines","_promise$metadata$cou","metadata","count","listLine","fullProductsInfo","line","createGetProductListLinesInput","productListSearchCriteria","ProductListType","QuickOrder","createGetProductListInput","ProductsByCategoryInput","cacheKeyHint","currentCategory","getCurrentCategory","searchByCategoryAsync","productSearchResults","getProducts","cartState","_ctx$requestContext$a","defaultOrderQuantityLimitsFeatureConfig","platform","enableDefaultOrderQuantityLimits","isQuantityLimitsFeatureEnabledInHq","customerInfo","IsB2b","isOrderQuantityLimitsFeatureEnabled","_cart$CartLines","productIdsByWarehouseId","resultProducts","_productIdsByWarehous","get","_ref","entryWarehouseId","entryProductIds","accum","getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn","hasInvoiceLine","getActiveCartProductsActionDataAction","PromotionOptionsForCartLineItems","cartLineIds","c","LineId","getAvailablePromotionsAsync","GetRatingsSummaryInput","tenantId","serviceEndpoint","createInput","getRnrPartnerId","getRnrEndpointId","getRatingsSummary","inputIsValid","sendRequest","getRatingsSummaryDataAction","RefinersByCategoryInput","getRefinersByCategoryAsync","RefinersByTextInput","getRefinersByTextAsync","GetRelatedProductsInput","relationType","querySettings","productRelationTypes","getRelationTypesAsync","productRelationTypeId","_productRelationType","foundProductRelationTypeId","productRelationType","searchProductRelationType","getRelatedProductsAsync","stack","GetScanResultInput","sku","skuNumber","readAsync","scanResults","Product","getDimensionsForSelectedVariant","ScanResult","ProductDimensionFull","SearchConfigurationInput","getSearchConfigurationAsync","warehouseId","_this$warehouseId","getSimpleProductsAction","productIdMapping","getProductPromises","catalogIds","_inputs$0$warehouseId","getByIdsAsync","mappedProducts","flatten","newImageUrl","generateProductImageUrl","PrimaryImageUrl","_unused","GetOrgUnitLocationsByAreaInput","_Latitude","_Longitude","_Radius","createGetOrgUnitLocationsByAreaInput","getOrgUnitLocationsByArea","locationPromiseList","_getLocationWithHours","getOrgUnitLocationsByAreaDataAction","retailActionDataAction","createGetByCustomerInput","GetInvoiceDetailsInput","invoiceId","CreateGetInvoiceDetailsInput","getInvoiceDetails","InvoiceId","SalesOrdersDataActions","getInvoiceDetailsDataAction","GetInvoicesInput","CreateGetInvoicesInput","InvoicePaidStatusValues","InvoicePaidStatus","None","getInvoices","InvoiceTypeValues","InvoiceType","SalesOrderInvoice","CustomerId","getInvoicesDataAction","IssueLoyaltyInput","updateCart","updateLoyaltyCardId","loyaltyCardNumber","issueLoyaltyCardAsync","CustomerAccount","issuedCard","AddItemToOrderTemplateInput","orderTemplateId","addProductListLinesAsync","addItemToOrderTemplateInput","AddOrderTemplateToCartInput","chunkCount","getPaginatedOrderTemplateLinesInput","GetPaginatedOrderTemplateLinesInput","orderTemplateLines","getPaginatedOrderTemplateLinesAction","addedCartLines","skip","cartLines","productLine","_productLine$fullProd","ItemId","TrackingId","UnitOfMeasureSymbol","addCartLinesAsync","Version","_error$data","_error$data2","ValidationResults","concat","refreshCart","addOrderTemplateToCartInput","CreateOrderTemplateInput","OrderTemplate","createProductListAsync","createOrderTemplateInput","GetFullOrderTemplateInput","inputParams","GetOrderTemplatesInput","getOrderTemplates","createGetFullOrderTemplateInput","GetFullOrderTemplatesInput","getPrices","getRatings","orderTemplates","inputLinesRequests","inputLinesResponses","productLinesResponse","GetOrderTemplatesPreviewInput","createGetOrderTemplatesPreviewInput","getOrderTemplatesPreview","getFullOrderTemplates","getOrderTemplatesPreviewDataAction","_this$queryResultSett","_this$queryResultSett2","createGetOrderTemplatesInput","getOrderTemplatesAction","searchAsync","orderTemplateLinesState","getProductListLinesAsync","_inputData$getPrice","_inputData$getRating","OrderTemplateLine","createGetPaginatedOrderTemplateLinesInput","UpdateOrderTemplateHeaderInput","updatedProductList","updateOrderTemplateHeaderInput","UpdateOrderTemplateInput","getLinesInput","getPaginatedOrderTemplateLines","linesToUpdate","lineToUpdate","updatedLines","updateProductListLinesAsync","updatedLine","updateOrderTemplateInput","createRefineSearchByCategoryInput","refinementCriterion","search","querySettingsProxy","createSearchByTextInput","updateAddressHandler","IsPrimary","updateCustomerAttributesInput","customerAttributes","phone","vatNumber","VatNumber","Attributes","updateCustomerPersonalizationInput","isOptOut","preferenceType","OptOutWebActivityTracking","OptOutPersonalization","_customer$Addresses","setPrimaryAddress","primaryAddresses","addresses","addr","name","sep","neutralizedName","candidateName","platformSettings","enableUrlLocalization","enableUrlEncoding","encodeURIComponent","replace","trim","getCategorySlug","categoryName","getUrlSync","getInvoiceDetailsPageUrlSync","includes","substr","indexOf","getProductUrlSync","getProductPageUrlSync","args","rnr","getRnrAuthEndpointId","endpoint","proxyUrl","endsWith","substring"],"sourceRoot":""}