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AW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,YAId,KAAAC,YAA2B,CAC/B,CACIF,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,YAId,KAAAE,YAA2B,CAC/B,CACIH,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,YAId,KAAAG,YAA2B,CAC/B,CACIJ,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,UAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,aAAc,WAElB,CACID,UAAW,OACXC,a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GAAkB,cAClBwV,EAAAxV,UAAAnF,OAAA,QAAAN,IAAAyF,UAAA,GAAAA,UAAA,GAAsB,GACtBuV,EAAAvV,UAAAnF,OAAA,QAAAN,IAAAyF,UAAA,GAAAA,UAAA,GAAoB,EACpBmV,EAAAnV,UAAAnF,OAAA,QAAAN,IAAAyF,UAAA,GAAAA,UAAA,GAAmB,GACnByV,EAAAzV,UAAAnF,OAAA,QAAAN,IAAAyF,UAAA,GAAAA,UAAA,GAA2B,KAC3B0tB,EAAA1tB,UAAAnF,OAAA,QAAAN,IAAAyF,UAAA,GAAAA,UAAA,GAA6B,KAiB1B,KAAA/C,YAAc,IACjB,GAAGE,KAAKjB,aAAaiB,KAAK8X,YAAY9X,KAAK+X,oBAAoB/X,KAAKgY,YAAYhY,KAAKmY,WAAWnY,KAAKqY,eAAerY,KAAKoY,YAEtH,KAAAnY,mBAAqB,IAAM,gBAE3B,KAAAC,cAAgB,IAAiB,UApBpCF,KAAKjB,UAAYA,EACjBiB,KAAK8X,SAAWA,EAChB9X,KAAK+X,iBAAmBA,EAIxB/X,KAAKgY,SAAWA,EAAW,GAAK,GAAKA,EACrChY,KAAKmY,QAAUA,EACfnY,KAAKqY,YAAcA,EACnBrY,KAAKoY,UAAYA,EACjBpY,KAAKsY,UAAYA,EACjBtY,KAAKuwB,YAAcA,EACnBvwB,KAAKkY,gBAAkBA,qCC1FxB,MAAMmB,EAqBT1Z,YAAYZ,EAAmB+Y,EAAkBe,EAAuBX,GAOjE,KAAApY,YAAc,IAAM,gBAEpB,KAAAG,mBAAqB,IAAM,gBAE3B,KAAAC,cAAgB,IAAiB,OAVpCF,KAAKjB,UAAYA,EACjBiB,KAAK8X,SAAWA,EAChB9X,KAAK6Y,cAAgBA,EACrB7Y,KAAKkY,gBAAkBA","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/telemetry.action.helper.ts?7f4a","webpack://Msdyn365.Commerce.Online/./src/actions/get-country-regions.ts?9431","webpack://Msdyn365.Commerce.Online/./src/actions/get-address-purposes.ts?6b90","webpack://Msdyn365.Commerce.Online/./src/actions/get-country-state.ts?3ecd","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison-state/base/product-comparison-item.ts?940e","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison-state/base/comparison-item.ts?d1df","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison-state/product-comparison-state.ts?6916","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison-state/comparison-manager.ts?49d5","webpack://Msdyn365.Commerce.Online/./src/actions/get-channels.ts?fd22","webpack://Msdyn365.Commerce.Online/./src/actions/get-org-unit-locations.ts?0b40","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/common/refiner-option.ts?b3fd","webpack://Msdyn365.Commerce.Online/./src/store-selector-state-manager/base-store-selector-state-manager.ts?281e","webpack://Msdyn365.Commerce.Online/./src/store-selector-state-manager/map-store-selector-state-manager.ts?2ae0","webpack://Msdyn365.Commerce.Online/./src/store-selector-state-manager/store-selector-state-manager-data-action.ts?bd3e","webpack://Msdyn365.Commerce.Online/./src/data-actions/accordion-state-data-action.ts?eaf1","webpack://Msdyn365.Commerce.Online/./src/actions/get-tender-types.ts?d667","webpack://Msdyn365.Commerce.Online/./src/modules/checkout-payment-instrument/actions/get-card-payment-accept-point.ts?c747","webpack://Msdyn365.Commerce.Online/./src/actions/get-sales-order-originators.ts?f89a","webpack://Msdyn365.Commerce.Online/./src/dataActions/get-attributes-for-selected-variant.ts?e4b6","webpack://Msdyn365.Commerce.Online/./src/actions/ratings-reviews-state-data-action.ts?26cd","webpack://Msdyn365.Commerce.Online/./src/modules/msdyn365-pva-chat-connector/actions/getBotFrameworkToken.action.ts?0785","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/common/search-option.ts?20d1","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/common/sort-option.ts?5e94","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison/actions/get-products-in-product-comparison.ts?b12d","webpack://Msdyn365.Commerce.Online/./src/modules/product-comparison-preview/actions/get-products-in-preview-product-comparison.ts?1623","webpack://Msdyn365.Commerce.Online/./src/modules/quick-order-grid/actions/get-product-list.ts?d537","webpack://Msdyn365.Commerce.Online/./src/actions/get-product-reviews.ts?6edb","webpack://Msdyn365.Commerce.Online/./src/actions/get-user-review.ts?bad7","webpack://Msdyn365.Commerce.Online/./src/modules/category-page-summary/category-page-summary.action.ts?c40c","webpack://Msdyn365.Commerce.Online/./src/modules/default-page-summary/default-page-summary.action.ts?5b44","webpack://Msdyn365.Commerce.Online/./src/modules/list-page-summary/list-page-summary.action.ts?a1a8","webpack://Msdyn365.Commerce.Online/./src/modules/product-page-summary/product-page-summary.action.ts?9992","webpack://Msdyn365.Commerce.Online/./src/actions/get-state-provinces.ts?554d","webpack://Msdyn365.Commerce.Online/./src/modules/checkout/actions/get-products-in-active-checkout-cart.ts?1981","webpack://Msdyn365.Commerce.Online/./src/modules/checkout-express/actions/get-card-payment-accept-point.ts?e7e0","webpack://Msdyn365.Commerce.Online/./src/distributor-selector-state-manager/map-distributor-selector-state-manager.ts?573e","webpack://Msdyn365.Commerce.Online/./src/distributor-selector-state-manager/distributor-selector-state-manager-data-action.ts?b68c","webpack://Msdyn365.Commerce.Online/./src/actions/get-sales-order-details-by-confirmation-id.ts?ce6e","webpack://Msdyn365.Commerce.Online/./src/actions/get-sales-order-with-hydrations.ts?a5de","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/actions/get-date-refiner-options.ts?ceee","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/actions/get-order-status-refiner-options.ts?f617","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/actions/get-search-options.ts?f248","webpack://Msdyn365.Commerce.Online/./src/modules/order-history-with-search-and-filters/actions/get-sort-options.ts?7dea","webpack://Msdyn365.Commerce.Online/./src/modules/order-template/actions/get-order-template.ts?077e","webpack://Msdyn365.Commerce.Online/./src/actions/addToCart-telemetry.action.ts?4575","webpack://Msdyn365.Commerce.Online/./src/actions/copyCart-checkOut-telemetry.action.ts?403f","webpack://Msdyn365.Commerce.Online/./src/actions/getById-product-telemetry.action.ts?9e39","webpack://Msdyn365.Commerce.Online/./src/actions/getByIds-product-telemetry.action.ts?1a7f","webpack://Msdyn365.Commerce.Online/./src/actions/getVariantsByDimensionValues-telemetry.action.ts?b148","webpack://Msdyn365.Commerce.Online/./src/actions/purchase-telemetry.action.ts?d6c7","webpack://Msdyn365.Commerce.Online/./src/actions/readCart-telemetry.action.ts?ac14","webpack://Msdyn365.Commerce.Online/./src/actions/removeFromCart-telemetry.action.ts?b268","webpack://Msdyn365.Commerce.Online/./src/actions/updateCart-telemetry.action.ts?f56d","webpack://Msdyn365.Commerce.Online/./src/modules/actions/get-active-image-products.ts?0501","webpack://Msdyn365.Commerce.Online/./src/modules/checkout-apple-pay/actions/get-card-payment-accept-point.ts?819f","webpack://Msdyn365.Commerce.Online/./src/modules/checkout-delivery-options/actions/get-products-details-in-active-checkout-cart.ts?f6c5","webpack://Msdyn365.Commerce.Online/./src/actions/get-sales-order-confirmation-with-hydrations.ts?6854","webpack://Msdyn365.Commerce.Online/./src/connectors/msdyn365-exp-test/msdyn365-exp-test.provider.ts?04ad","webpack://Msdyn365.Commerce.Online/./src/connectors/msdyn365-exp-test/msdyn365-exp-test.listener.ts?1431","webpack://Msdyn365.Commerce.Online/./src/actions/inputs/get-product-reviews-input.ts?c654","webpack://Msdyn365.Commerce.Online/./src/actions/inputs/get-user-review-input.ts?ab81"],"sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core-internal';\nimport { CartLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getByIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { IProductInfo } from '@msdyn365-commerce/telemetry-internal';\n\n/**\n * Converts cart line products into promise of array of product info\n * @param cartLines Cart Lines with product info to collect\n * @param actionContext Action context\n * @returns Array of product info\n */\nexport const getProductInfoFromCartLinesAsync = async (cartLines: CartLine[], actionContext: IActionContext): Promise => {\n if (actionContext.requestContext.channel === undefined) {\n throw new Error('Unable to make product call, channel ID not provided');\n }\n\n const productPromises: Promise[] = [];\n\n // Call GetById API for all products in cartLines\n for (let i = 0; i < cartLines.length; i++) {\n // eslint-disable-next-line security/detect-object-injection -- bracket object notation with user input present leads to eslint security issue.\n const cartLine: CartLine = cartLines[i];\n\n if (cartLine.ProductId) {\n // The product id in cartLine actually contains recordId and not master product id so we can use it up here to lookup product.\n productPromises.push(\n getByIdAsync({ callerContext: actionContext }, cartLine.ProductId, actionContext.requestContext.channel.RecordId).then(\n result => {\n // Construct basic IProductInfo object for product\n const productInfo = getProductInfoFromSimpleProduct(result);\n\n // Attach fields from the CartLine\n productInfo.productPrice = cartLine.Price ? cartLine.Price.toString() : '';\n productInfo.productQuantity = cartLine.Quantity ? cartLine.Quantity.toString() : '';\n\n return productInfo;\n },\n reason => {\n throw new Error(`Failed to get product details for product ${cartLine.ProductId}.\\n${reason}`);\n }\n )\n );\n }\n }\n\n // Return promise for array of product results\n return Promise.all(productPromises);\n};\n\n/**\n * Converts a SimpleProduct object into an IProductInfo object\n * @param simpleProduct Simple Product object\n * @returns Populated IProductInfo\n */\nexport const getProductInfoFromSimpleProduct = (simpleProduct: SimpleProduct): IProductInfo => {\n const recordId = simpleProduct.RecordId || '';\n\n return {\n // If master product id is not available then product record id is master product id\n productId: simpleProduct.MasterProductId ? simpleProduct.MasterProductId.toString() : recordId.toString(),\n productSku: recordId ? recordId.toString() : '',\n productName: simpleProduct.Name || simpleProduct.Description || '',\n productPrice: simpleProduct.Price ? simpleProduct.Price.toString() : '',\n productChannelId: '', // Not needed for each product, sent as part of all events\n productChannelName: '',\n productCategoryId: '',\n productCategoryName: '',\n productQuantity: '', // Cannot be deteremined from SimpleProduct, will be added from CartLine later\n productCurrency: '' // Not needed for each product, sent as part of all events with product data\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 { getCountryRegionsByLanguageIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { CountryRegionInfo } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for get country regions data action.\n */\nexport class GetCountryRegionsInput implements IActionInput {\n public locale: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(locale: string, apiSettings: ICommerceApiSettings) {\n this.locale = locale;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`CountryRegionInfo-${this.locale}`, this.apiSettings);\n\n public getCacheObjectType = () => 'CountryRegionInfo';\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>): GetCountryRegionsInput => {\n if (!(inputData.requestContext && inputData.requestContext.locale)) {\n throw new Error('Unable to create country regions input. Locale is not provided.');\n }\n\n return new GetCountryRegionsInput(inputData.requestContext.locale, inputData.requestContext.apiSettings);\n};\n\nexport async function getCountryRegionsAction(input: GetCountryRegionsInput, ctx: IActionContext): Promise {\n // This API is returning more that 100 records. So, can't use the default page size for this.\n // Removing the query result setting.\n return getCountryRegionsByLanguageIdAsync({ callerContext: ctx, queryResultSettings: {} }, input.locale);\n}\n\nexport const getCountryRegionsActionDataAction = createObservableDataAction({\n action: >getCountryRegionsAction,\n input: createInput\n});\n\nexport default getCountryRegionsActionDataAction;\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 { getAddressPurposesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { AddressPurpose } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for get Address Purposes data action.\n */\nexport class GetAddressPurposesInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('AddressPurpose', this.apiSettings);\n\n public getCacheObjectType = () => 'AddressPurpose';\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>): GetAddressPurposesInput => {\n return new GetAddressPurposesInput(inputData.requestContext.apiSettings);\n};\n\nexport async function getAddressPurposesAction(input: GetAddressPurposesInput, ctx: IActionContext): Promise {\n return getAddressPurposesAsync({\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n });\n}\n\nexport const getAddressPurposesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/address/get-address-purposes',\n action: >getAddressPurposesAction,\n input: createInput\n});\n\nexport default getAddressPurposesActionDataAction;\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 { CountryRegionInfo, StateProvinceInfo } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { getCountryRegionsAction, GetCountryRegionsInput } from './get-country-regions';\nimport { getStateProvinceAction, GetStateProvincesInput } from './get-state-provinces';\n\n/**\n * Input class for get country regions data action.\n */\nexport class GetCountryStateInput implements IActionInput {\n public locale: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(locale: string, apiSettings: ICommerceApiSettings) {\n this.locale = locale;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`CountryStateInfo-${this.locale}`, this.apiSettings);\n\n public getCacheObjectType = () => 'StateProvinceInfo';\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>): GetCountryStateInput => {\n const { locale, apiSettings } = inputData.requestContext;\n if (!(inputData.requestContext && locale)) {\n throw new Error('Unable to create country regions input. Locale is not provided.');\n }\n return new GetCountryStateInput(locale, apiSettings);\n};\n\nexport async function getCountryStateAction(input: GetCountryStateInput, ctx: IActionContext): Promise {\n const countryInput = new GetCountryRegionsInput(input.locale, input.apiSettings);\n const countryRegionsInfo = await getCountryRegionsAction(countryInput, ctx);\n\n const channelConfiguration = ctx.requestContext.channel;\n\n const marketISOCode = (channelConfiguration && channelConfiguration.ChannelCountryRegionISOCode) || 'US';\n const currentCountryRegion = countryRegionsInfo.find(countryRegion => (countryRegion.ISOCode || '') === marketISOCode);\n const countryRegionId = (currentCountryRegion && currentCountryRegion.CountryRegionId) || 'USA';\n\n const stateInput = new GetStateProvincesInput(countryRegionId, input.apiSettings);\n return getStateProvinceAction(stateInput, ctx);\n}\n\nexport const getCountryStateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/address/get-country-state',\n action: >getCountryStateAction,\n input: createInput\n});\n\nexport default getCountryStateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ComparisonItem } from './comparison-item';\n\n/**\n * Represents a product for comparison.\n */\nexport class ProductComparisonItem extends ComparisonItem {\n public readonly productId: number;\n\n public readonly catalogId: number;\n\n public static getItemId(productId: number, catalogId: number): string {\n return `${productId}-${catalogId}`;\n }\n\n public constructor(productId: number, catalogId: number) {\n const itemId = ProductComparisonItem.getItemId(productId, catalogId);\n super(itemId);\n\n this.productId = productId;\n this.catalogId = catalogId;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Represents an item for comparison.\n */\nexport abstract class ComparisonItem {\n public readonly addedDate: Date;\n\n public readonly itemId: ItemId;\n\n public constructor(itemId: ItemId) {\n this.itemId = itemId;\n this.addedDate = new Date();\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ICookieContext, IRequestContext } from '@msdyn365-commerce/core';\nimport { Customer } from '@msdyn365-commerce/retail-proxy';\nimport { ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { ProductComparisonItem } from './base';\nimport { ComparisonManager } from './comparison-manager';\n\n/**\n * Represents a product comparison manager which operates a list of products and cookies to store the list.\n */\nexport class ProductComparisonState extends ComparisonManager {\n private static readonly _productComparisonItemsLocalStorageKey: string = '_msdyn365__productComparisonItems_';\n\n private static _instance?: ProductComparisonState;\n\n private readonly _requestContext: IRequestContext;\n\n public static instance(requestContext: IRequestContext, user?: Customer): ProductComparisonState {\n const items = ProductComparisonState._retrieveItemsFromCookies(requestContext, user);\n\n if (!ProductComparisonState._instance) {\n ProductComparisonState._instance = new ProductComparisonState(requestContext, items, user);\n } else if (!ArrayExtensions.equals(ProductComparisonState._instance.items, items)) {\n ProductComparisonState._instance.setItems(items);\n }\n\n return ProductComparisonState._instance;\n }\n\n private static _getCookieStorageKey(requestContext: IRequestContext, user?: Customer) {\n const userId = user?.RecordId ?? requestContext.user.customerAccountNumber ?? '';\n return `${ProductComparisonState._productComparisonItemsLocalStorageKey}__${requestContext.sitePath ?? ''}__${userId}`;\n }\n\n private static _retrieveItemsFromCookies(requestContext: IRequestContext, user?: Customer): ProductComparisonItem[] {\n const items = ProductComparisonState._readFromCookie(\n requestContext.cookies,\n ProductComparisonState._getCookieStorageKey(requestContext, user)\n );\n if (!ArrayExtensions.hasElements(items)) {\n return [];\n }\n return items;\n }\n\n private static _readFromCookie(cookieContext: ICookieContext, cookieKey: string): ProductComparisonItem[] | undefined | null {\n if (!cookieKey) {\n return undefined;\n }\n\n if (!cookieContext.isConsentGiven()) {\n return undefined;\n }\n\n const cookieValue = cookieContext.get(cookieKey);\n\n return cookieValue.value;\n }\n\n private static _writeToCookie(cookieContext: ICookieContext, cookieKey: string, value: ProductComparisonItem[]): void {\n if (!cookieKey) {\n return;\n }\n\n cookieContext.set(cookieKey, value, { secure: true, maxAge: 5_184_000 });\n }\n\n private constructor(requestContext: IRequestContext, items: ProductComparisonItem[], user?: Customer) {\n super(...items);\n\n this._requestContext = requestContext;\n\n this.listModifiedEvent.subscribe({\n /**\n * Unique identifier of the subscriber. Used to identify the subscriber among the other subscribers for the same event.\n */\n instanceId: 'ProductComparisonState instance',\n\n /**\n * Method which should be called once the event is triggered.\n */\n handler: () => {\n ProductComparisonState._writeToCookie(\n this._requestContext.cookies,\n ProductComparisonState._getCookieStorageKey(requestContext, user),\n this.items\n );\n }\n });\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { Event } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { ComparisonItem } from './base';\n\n/**\n * Represents base functionality of a comparison manager which operates a list of items for comparison.\n */\nexport class ComparisonManager = ComparisonItem> {\n public readonly listModifiedEvent: Event;\n\n public get lastUpdateDate(): Date {\n return this._lastUpdateDate;\n }\n\n private _lastUpdateDate: Date;\n\n private _comparisonItems: Item[];\n\n public get items(): Item[] {\n return this._comparisonItems;\n }\n\n public constructor(...items: Item[]) {\n this._comparisonItems = items;\n this.listModifiedEvent = new Event();\n this._lastUpdateDate = new Date(Date.now());\n }\n\n public setItems(items: Item[]): void {\n this._comparisonItems = items;\n this._update();\n }\n\n public addItem(item: Item): void {\n this._comparisonItems.push(item);\n this._update();\n }\n\n public clearAll(): void {\n this.setItems([]);\n }\n\n public removeItem(item: Item): void {\n this._comparisonItems = this._comparisonItems.filter(currentItem => currentItem !== item);\n this._update();\n }\n\n public removeItemById(itemId: ItemId): void {\n this._comparisonItems = this._comparisonItems.filter(currentItem => currentItem.itemId !== itemId);\n this._update();\n }\n\n public hasItem(item: Item): boolean {\n return this.items.includes(item);\n }\n\n public hasItemById(itemId: ItemId): boolean {\n return this.items.some(item => item.itemId === itemId);\n }\n\n private _update(): void {\n this._lastUpdateDate = new Date(Date.now());\n this.listModifiedEvent.trigger();\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 { ChannelIdentity } from '@msdyn365-commerce/retail-proxy';\nimport { getChannelsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Interface of Channel Identity..\n */\ninterface IChannelIdentity {\n channelIdentities: ChannelIdentity[];\n}\n\n/**\n * Calls the Retail API and returns the channels.\n * @returns - List of channel identity.\n */\nconst getChannels = () => async (ctx: IActionContext): Promise => {\n return getChannelsAsync({\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n });\n};\n\n/**\n * Action input.\n */\nexport class GetChannelIdentitiesInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ChannelIdentities', this.apiSettings);\n\n public getCacheObjectType = () => 'ChannelIdentities';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Data Input.\n * @returns - Input object.\n */\nconst createChannelIdentitiesInput = (inputData: ICreateActionContext>) => {\n return new GetChannelIdentitiesInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * Get channels action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - Channel Identity.\n */\nexport async function getChannelsAction(input: GetChannelIdentitiesInput, context: IActionContext): Promise {\n if (!context) {\n throw new Error('getChannelsAction - Action context cannot be null/undefined');\n }\n\n let channels: ChannelIdentity[] = [];\n\n try {\n channels = await getChannels()(context);\n } catch (error) {\n throw error;\n }\n\n return { channelIdentities: channels };\n}\n\n/**\n * Get sales order with hydrations action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Channel api response.\n */\nexport const getChannelsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-channels',\n action: >getChannelsAction,\n input: createChannelIdentitiesInput\n});\n\nexport default getChannelsActionDataAction;\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 { OrgUnitLocation, SearchArea } from '@msdyn365-commerce/retail-proxy';\nimport { getOrgUnitLocationsByAreaAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Interface of Org Unit Locations.\n */\ninterface IOrgUnitLocations {\n orgUnitLocations: OrgUnitLocation[];\n}\n\nconst searchArea: SearchArea = {\n Radius: Math.max(),\n DistanceUnitValue: 0 // 0 is miles\n};\n\n/**\n * Calls the Retail API and returns the orgUnitLocations.\n * @returns - List Org Unit Locations.\n */\nconst getOrgUnitLocations = () => async (ctx: IActionContext): Promise => {\n return getOrgUnitLocationsByAreaAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n searchArea\n );\n};\n\n/**\n * Action input.\n */\nexport class GetOrgUnitLocationsInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('OrgUnitLocations', this.apiSettings);\n\n public getCacheObjectType = () => 'OrgUnitLocations';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Context.\n * @returns - Org Unit Location input.\n */\nconst createOrgUnitLocationsInput = (inputData: ICreateActionContext>) => {\n return new GetOrgUnitLocationsInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * Get orgUnitLocations action.\n * @param input - Org UNit Locations Input.\n * @param context - Action Context.\n */\nexport async function getOrgUnitLocationsAction(input: GetOrgUnitLocationsInput, context: IActionContext): Promise {\n if (!context) {\n throw new Error('getOrgUnitLocationsAction - Action context cannot be null/undefined');\n }\n\n let orgUnitLocations: OrgUnitLocation[] = [];\n\n try {\n orgUnitLocations = await getOrgUnitLocations()(context);\n } catch (error) {\n throw error;\n }\n\n return { orgUnitLocations };\n}\n\nexport const getOrgUnitLocationsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-org-unit-locations',\n action: >getOrgUnitLocationsAction,\n input: createOrgUnitLocationsInput\n});\n\nexport default getOrgUnitLocationsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { SalesStatus } from '@msdyn365-commerce/retail-proxy';\n\nexport enum RefinerSourceType {\n Origin = 1,\n CreatedDate = 2,\n OrderStatus = 3\n}\n\nexport enum DateRefinerOptionItem {\n LastSevenDays = 0,\n LastThirtyDays = 1,\n LastThreeMonths = 2,\n LastSixMonths = 3,\n Customized = 999\n}\n\nexport enum OrderStatusRefinerOptionItem {\n Created = SalesStatus.Created,\n Delivered = SalesStatus.Delivered,\n Invoiced = SalesStatus.Invoiced,\n Canceled = SalesStatus.Canceled\n}\n\nexport interface IDateRange {\n startDate?: Date;\n endDate?: Date;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport MsDyn365, { IActionContext } from '@msdyn365-commerce/core';\nimport { action, computed, observable } from 'mobx';\n\nimport {\n IListMapViewState,\n ILoadMapApiInput,\n IStoreInfo,\n IStoreSelectionStateContext,\n IStoreSelectorLocation,\n IStoreSelectorStateManager\n} from './i-store-selection-state-manager';\n\n/**\n * Abstract instance of IStoreSelectorStateManager with base implementation\n * of everything except the geoLocate function.\n */\nexport abstract class BaseStoreSelectorStateManager implements IStoreSelectorStateManager {\n @computed public get isDialogOpen(): Readonly {\n return this._context !== undefined;\n }\n\n @computed public get context(): Readonly {\n return this._context;\n }\n\n @observable public isMapApiLoaded?: boolean;\n\n @observable public selectedStoreLocationId?: string;\n\n @observable public preferredStore?: IStoreInfo;\n\n @observable public listMapViewState: IListMapViewState = { displayList: true, displayMap: false };\n\n @observable public isMapModuleLoaded?: boolean;\n\n @observable public lastInlineShownStoreInfo?: IStoreInfo;\n\n @observable protected _context?: IStoreSelectionStateContext;\n\n private readonly preferredStoreLocalStorageKey: string = '_msdyn365__preferredStore_';\n\n constructor() {\n this.isMapModuleLoaded = false;\n const value = this._readFromToCookie(this.preferredStoreLocalStorageKey);\n try {\n const storeInfo: IStoreInfo | undefined = value ? JSON.parse(value) : undefined;\n if (storeInfo) {\n this.preferredStore = storeInfo;\n }\n } catch {\n this.preferredStore = undefined;\n }\n }\n\n public abstract geoLocate(searchTerm: string, actionContext: IActionContext): Promise;\n\n public abstract loadMapApi(input: ILoadMapApiInput): Promise;\n\n @action\n public async toggleListMapViewState(): Promise {\n this.listMapViewState = {\n displayList: !this.listMapViewState.displayList,\n displayMap: !this.listMapViewState.displayMap\n };\n }\n\n @action\n public async setMapModuleLoaded(input: boolean): Promise {\n this.isMapModuleLoaded = input;\n }\n\n @action\n public async setOrgUnitStoreInformation(input: IStoreSelectionStateContext): Promise {\n this._context = input;\n }\n\n @action\n public async setSelectedStoreLocationId(storeId: string | undefined): Promise {\n this.selectedStoreLocationId = storeId;\n }\n\n @action\n public async setPreferredStoreLocation(\n storeId?: string,\n storeName?: string | undefined,\n writeToCookie: boolean = false,\n latitude?: number,\n longitude?: number\n ): Promise {\n const storeInfo: IStoreInfo = { StoreId: storeId, StoreName: storeName, Latitude: latitude, Longitude: longitude };\n this.preferredStore = storeInfo;\n if (writeToCookie) {\n this._writeToCookie(this.preferredStoreLocalStorageKey, JSON.stringify(storeInfo));\n }\n }\n\n @action\n public async setLastInlineStoreInfo(latitude?: number, longitude?: number): Promise {\n const storeInfo: IStoreInfo = { StoreId: '', StoreName: '', Latitude: latitude, Longitude: longitude };\n this.lastInlineShownStoreInfo = storeInfo;\n }\n\n @action\n public async clearPreferredStore(writeToCookie: boolean): Promise {\n this.preferredStore = undefined;\n if (writeToCookie) {\n this._removeCookie(this.preferredStoreLocalStorageKey);\n }\n }\n\n @action\n public async openDialog(input: IStoreSelectionStateContext): Promise {\n if (this._context && this._context.id === input.id) {\n throw new Error('Dialog is already opened');\n }\n\n this._context = input;\n }\n\n @action\n public async closeDialog(): Promise {\n this._context = undefined;\n }\n\n private _removeCookie(key: string): void {\n if (!key) {\n return;\n }\n if (MsDyn365.isBrowser) {\n const storage = window.localStorage;\n storage.removeItem(key);\n }\n }\n\n private _writeToCookie(key: string, value: string | undefined): void {\n if (!key || !value) {\n return;\n }\n if (MsDyn365.isBrowser) {\n const storage = window.localStorage;\n storage.setItem(key, value);\n }\n }\n\n private _readFromToCookie(key: string): string | undefined {\n if (!key) {\n return undefined;\n }\n if (MsDyn365.isBrowser) {\n const storage = window.localStorage;\n const cookieValue = storage.getItem(key);\n if (cookieValue) {\n return cookieValue;\n }\n }\n\n return undefined;\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 } from '@msdyn365-commerce/core';\nimport { StringExtensions } from '@msdyn365-commerce-modules/retail-actions';\nimport { action } from 'mobx';\n\nimport { BaseStoreSelectorStateManager } from './base-store-selector-state-manager';\nimport { ILoadMapApiInput, IStoreSelectorLocation } from './i-store-selection-state-manager';\nimport { IMapWindow, MapLocationsResult } from './models/map-data';\n\ndeclare const window: IMapWindow;\n\n/**\n * Instance of IStoreSelectorStateManager manager that uses Map service\n * for geo location.\n */\nexport class MapStoreSelectorStateManager extends BaseStoreSelectorStateManager {\n private readonly SERVICE_ENDPOINT: string = 'https://dev.virtualearth.net/REST/v1/';\n\n private readonly MAP_API_ENDPOINT: string = 'https://www.bing.com/api/maps/mapcontrol?callback=mapAPIReady';\n\n @action\n public async geoLocate(searchTerm: string, actionContext: IActionContext): Promise {\n if (\n !searchTerm ||\n !actionContext.requestContext.channel ||\n !actionContext.requestContext.channel.BingMapsApiKey ||\n !actionContext.requestContext.channel.BingMapsEnabled\n ) {\n return undefined;\n }\n\n let searchContent: string = searchTerm;\n\n const jsonp = `mapSearchCallback_${crypto.getRandomValues(new Uint32Array(1))[0]}`;\n\n if (actionContext.requestContext.channel.ChannelCountryRegionISOCode) {\n searchContent = `${searchTerm.trim()} ${actionContext.requestContext.channel.ChannelCountryRegionISOCode}`;\n }\n\n const query = encodeURI(searchContent);\n const key = encodeURI(actionContext.requestContext.channel.BingMapsApiKey);\n\n const geolocationApiUrl =\n actionContext.requestContext.app &&\n actionContext.requestContext.app.config &&\n actionContext.requestContext.app.config.geolocationApiUrl;\n const requestUrl = `${\n geolocationApiUrl ? geolocationApiUrl : this.SERVICE_ENDPOINT\n }/Locations?query=${query}&key=${key}&jsonp=${jsonp}`;\n\n return new Promise(resolve => {\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', requestUrl);\n\n window[jsonp] = (data: MapLocationsResult) => {\n delete window[jsonp];\n script.remove();\n\n if (data && data.resourceSets && data.resourceSets.length > 0 && data.resourceSets[0].resources.length > 0) {\n resolve({\n latitude: data.resourceSets[0].resources[0].point.coordinates[0],\n longitude: data.resourceSets[0].resources[0].point.coordinates[1]\n });\n }\n\n resolve(undefined);\n };\n\n document.body.appendChild(script);\n });\n }\n\n @action\n public async loadMapApi(input: ILoadMapApiInput): Promise {\n if (StringExtensions.isNullOrEmpty(input.key)) {\n return Promise.resolve();\n }\n\n const isScriptAlreadyLoaded = !!document?.getElementById('msdyn_map-api-script');\n\n if (isScriptAlreadyLoaded) {\n if (window) {\n const currentWindowAPI = window.mapAPIReady;\n window.mapAPIReady = () => {\n if (currentWindowAPI) {\n currentWindowAPI();\n }\n this.isMapApiLoaded = true;\n };\n }\n // Prevents from loading multiple script into the body\n return Promise.resolve();\n }\n\n const url = `${this.MAP_API_ENDPOINT}${input.key ? `&key=${input.key}` : ''}${input.lang ? `&setLang=${input.lang}` : ''}${\n input.market ? `&setMkt=${input.market}` : ''\n }`;\n\n return new Promise((resolve, reject) => {\n const script = document?.createElement('script');\n script.type = 'text/javascript';\n script.async = true;\n script.defer = true;\n script.src = url;\n script.id = 'msdyn_map-api-script';\n if (window) {\n window.mapAPIReady = () => {\n this.isMapApiLoaded = true;\n resolve();\n };\n }\n script.addEventListener('error', (error: string | Event) => {\n reject(error);\n });\n document?.body?.appendChild(script);\n });\n }\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, IActionInput, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IStoreSelectorStateManager } from './i-store-selection-state-manager';\nimport { MapStoreSelectorStateManager } from './map-store-selector-state-manager';\n\nexport function createStoreSelectorStateInput(result: IStoreSelectorStateManager): GenericInput {\n return new GenericInput('mapSSSM', result, 'IStoreSelectorStateManager');\n}\n\nconst createStoreSelectorStateInputInternal = (inputData: ICreateActionContext>): IActionInput => {\n return createStoreSelectorStateInput(new MapStoreSelectorStateManager());\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createStoreSelectorStateInputInternal\n});\n\nexport default getGenericActionDataAction;\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 } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IAccordionExpandedState } from './accordion-state';\n\nexport function createAccordionStateInput(result: IAccordionExpandedState): GenericInput {\n return new GenericInput('accordionExpandedState', result, 'IAccordionExpandedState');\n}\n\nconst createAccordionStateInputInternal = (): IActionInput => {\n return createAccordionStateInput({});\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createAccordionStateInputInternal\n});\n\nexport default getGenericActionDataAction;\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 { getTenderTypesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { TenderType } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Action input.\n */\nexport class GetTenderTypesInput implements IActionInput {\n public getCacheKey = () => 'TenderTypes';\n\n public getCacheObjectType = () => 'TenderTypes';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getTenderTypes method.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nexport const createTenderTyperInput = (inputData: ICreateActionContext>): IActionInput => {\n return new GetTenderTypesInput();\n};\n\n/**\n * Get tender type action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - TenderType\n */\nexport async function getTenderTypeAction(input: GetTenderTypesInput, context: IActionContext): Promise {\n const tenderType = await getTenderTypesAsync({\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n });\n\n return tenderType;\n}\n\n/**\n * Get Tender Types Data Action.\n */\nexport const getTenderTypeActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-tender-types',\n action: getTenderTypeAction as IAction,\n input: createTenderTyperInput\n});\n\nexport default getTenderTypeActionDataAction;\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 isEmptyOrNullObject\n} from '@msdyn365-commerce/core';\nimport { getCheckoutState, ICheckoutState } from '@msdyn365-commerce/global-state';\nimport { getCardPaymentAcceptPointAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { CardPaymentAcceptPoint } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\nimport get from 'lodash/get';\n\nexport interface IGetCardPaymentAcceptPointInput {\n showBillingAddress?: boolean;\n paymenTenderType?: string;\n apiSettings: ICommerceApiSettings;\n shouldEnableSinglePaymentAuthorizationCheckout?: boolean;\n amountDue?: number;\n shouldPassLocaleToiFrame?: boolean;\n}\n\n/**\n * GetCardPaymentAcceptPointInput - Input for create GetCardPaymentAcceptPoint.\n */\nexport class GetCardPaymentAcceptPointInput implements IActionInput {\n public showBillingAddress?: boolean;\n\n public paymenTenderType?: string;\n\n public shouldEnableSinglePaymentAuthorizationCheckout?: boolean;\n\n public amountDue?: number;\n\n public shouldPassLocaleToiFrame?: boolean;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(input: IGetCardPaymentAcceptPointInput) {\n this.showBillingAddress = input.showBillingAddress;\n this.paymenTenderType = input.paymenTenderType;\n this.apiSettings = input.apiSettings;\n this.shouldEnableSinglePaymentAuthorizationCheckout = input.shouldEnableSinglePaymentAuthorizationCheckout;\n this.amountDue = input.amountDue;\n this.shouldPassLocaleToiFrame = input.shouldPassLocaleToiFrame;\n }\n\n public getCacheKey = () =>\n buildCacheKey(`CardPaymentAcceptPoint${this.paymenTenderType ? `-${this.paymenTenderType}` : ''}`, this.apiSettings);\n\n public getCacheObjectType = () => 'CardPaymentAcceptPoint';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createCheckoutPaymentInstrumentInput = (inputData: ICreateActionContext) => {\n // eslint-disable-next-line @typescript-eslint/naming-convention -- keep existing name.\n const { showBillingAddress, paymenTenderType, shouldEnableSinglePaymentAuthorizationCheckout, amountDue, shouldPassLocaleToiFrame } =\n inputData.config ?? {};\n const getCardPaymentAcceptPointInput = {\n showBillingAddres: showBillingAddress,\n paymenTenderType,\n apiSettings: inputData.requestContext.apiSettings,\n shouldEnableSinglePaymentAuthorizationCheckout,\n amountDue,\n shouldPassLocaleToiFrame\n };\n\n return new GetCardPaymentAcceptPointInput(getCardPaymentAcceptPointInput);\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 getCardPaymentAcceptPointAction(\n input: GetCardPaymentAcceptPointInput,\n ctx: IActionContext\n): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing'));\n throw new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing');\n }\n\n const { showBillingAddress, paymenTenderType, amountDue = 0, shouldPassLocaleToiFrame } = input;\n const checkoutState: ICheckoutState = await getCheckoutState(ctx).catch((error: Error) => {\n ctx.telemetry.exception(error);\n throw error;\n });\n\n if (\n isEmptyOrNullObject(checkoutState) ||\n isEmptyOrNullObject(checkoutState.checkoutCart) ||\n isEmptyOrNullObject(checkoutState.checkoutCart.cart)\n ) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Unable to get cart'));\n throw new Error('[getCardPaymentAcceptPointAction] Unable to get cart');\n }\n\n if (!checkoutState.checkoutCart.cart.CartLines || checkoutState.checkoutCart.cart.CartLines.length === 0) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Cart is empty'));\n throw new Error('[getCardPaymentAcceptPointAction] Cart is empty');\n }\n\n const requestUrl =\n typeof ctx.requestContext.url.requestUrl === 'string'\n ? new URL(ctx.requestContext.url.requestUrl)\n : ctx.requestContext.url.requestUrl;\n const origin = get(window, 'location.origin') || requestUrl.origin;\n\n const cardPaymentAcceptSettings = {\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardPaymentAcceptSettings',\n HostPageOrigin: origin,\n AdaptorPath: `${origin}/Connectors/` || origin,\n CardPaymentEnabled: false,\n CardTokenizationEnabled: true,\n ...(!showBillingAddress && { HideBillingAddress: true }),\n ...(paymenTenderType && { TenderTypeId: paymenTenderType }),\n PaymentAmount: amountDue !== 0 ? amountDue : checkoutState.checkoutCart.cart.AmountDue ?? 0,\n Locale: shouldPassLocaleToiFrame ? ctx.requestContext.locale || 'en-us' : undefined\n };\n\n return getCardPaymentAcceptPointAsync(\n { callerContext: ctx, bypassCache: 'get' },\n checkoutState.checkoutCart.cart.Id,\n cardPaymentAcceptSettings,\n []\n )\n .then(cardPaymentAcceptPoint => {\n if (!cardPaymentAcceptPoint.AcceptPageUrl && !cardPaymentAcceptPoint.AcceptPageContent) {\n throw new Error(\n '[getCardPaymentAcceptPointAction] Payment Accept Page has neither return AcceptPageUrl nor AcceptPageContent in updatePaymentAcceptPageData'\n );\n }\n return cardPaymentAcceptPoint;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to get Card Payment Accept Point');\n throw error;\n });\n}\n\nexport const getCardPaymentAcceptPointActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce/checkout-payment-instrument/get-card-payment-accept-point',\n action: >getCardPaymentAcceptPointAction,\n input: createCheckoutPaymentInstrumentInput\n});\n\nexport default getCardPaymentAcceptPointActionDataAction;\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 { OrderOriginator, SalesOrdersDataActions, OrderOriginatorSearchCriteria } from '@msdyn365-commerce/retail-proxy';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Action input.\n */\nexport class GetOrderOriginatorsInput implements IActionInput {\n public searchCriteria: OrderOriginatorSearchCriteria = {};\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(transactionIds: string[] | undefined, salesIds: string[] | undefined, apiSettings: ICommerceApiSettings) {\n this.searchCriteria = {\n TransactionIds: transactionIds,\n SalesIds: salesIds\n };\n this.apiSettings = apiSettings;\n }\n\n /**\n * GetCacheKey.\n * @returns - String.\n */\n public getCacheKey = (): string =>\n buildCacheKey(`OrderOriginators-${this.searchCriteria.TransactionIds}-${this.searchCriteria.SalesIds}`, this.apiSettings);\n\n /**\n * GetCacheObjectType.\n * @returns - String.\n */\n public getCacheObjectType = (): string => 'OrderOriginators';\n\n /**\n * DataCacheType.\n * @returns - String.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Get order originators by transaction ids or sales ids action.\n * @param input - GetOrderOriginators input.\n * @param context - Channel context.\n * @returns - Originators array.\n */\nexport async function getOriginatorsAction(input: GetOrderOriginatorsInput, context: IActionContext): Promise {\n return SalesOrdersDataActions.getOrderOriginatorsAsync({ callerContext: context }, input.searchCriteria);\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- InputData as ICreateActionContext.\n * @returns Action Input.\n */\nexport const createSalesOrderOriginatorsInput = (inputData: ICreateActionContext) => {\n const { salesId, transactionId } = inputData.requestContext.query ?? {};\n\n if (salesId) {\n return new GetOrderOriginatorsInput(undefined, [salesId], inputData.requestContext.apiSettings);\n } else if (transactionId) {\n return new GetOrderOriginatorsInput([transactionId], undefined, inputData.requestContext.apiSettings);\n }\n\n throw new Error('createSalesOrderOriginatorsInput - No salesId or transactionId provided.');\n};\n\n/**\n * GetSalesOrderOriginatorsActionDataAction.\n * @returns -- IObservableAction.\n */\nexport const getSalesOrderOriginatorsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-sales-order-originators',\n action: getOriginatorsAction as IAction,\n input: createSalesOrderOriginatorsInput\n});\n\nexport default getSalesOrderOriginatorsActionDataAction;\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, ProductsDataActions, SimpleProduct, StoreOperationsDataActions } from '@msdyn365-commerce/retail-proxy';\nimport {\n getAttributeValuesByConfiguration,\n getSelectedProductIdFromActionInput,\n getSelectedVariant,\n SelectedVariantInput\n} from '@msdyn365-commerce-modules/retail-actions';\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 - The input.\n * @param context - The context.\n * @returns The attribute values.\n */\nexport async function getAttributesForSelectedVariantAction(\n input: AttributesForSelectedVariantInput,\n context: 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 context.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, context);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return ProductsDataActions.getAttributeValuesAsync(\n {\n callerContext: context\n },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n }\n\n return null;\n })\n .then(async (attributeValues: AttributeValue[] | null) => {\n const channelInventoryConfiguration = await StoreOperationsDataActions.getInventoryConfigurationAsync({\n callerContext: context\n });\n\n return { attributeValues, channelInventoryConfiguration };\n })\n .then(result => {\n return getAttributeValuesByConfiguration(result.attributeValues, result.channelInventoryConfiguration);\n })\n .catch((error: Error) => {\n context.trace(error.message);\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/product-info/get-attributes-for-selected-variant',\n action: >getAttributesForSelectedVariantAction,\n input: createAttributesForSelectedVariantInput\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, IActionInput } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nexport interface IRatingsReviewsState {\n filterKey: string;\n}\n\nexport function createRatingsReviewsStateInput(result: IRatingsReviewsState): GenericInput {\n return new GenericInput('ratingsReviewsState', result, 'ratingsReviewsStateInput');\n}\n\nconst createInternalRatingsReviewsStateInput = (): IActionInput => {\n return createRatingsReviewsStateInput({ filterKey: '1;2;3;4;5' });\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createInternalRatingsReviewsStateInput\n});\n\nexport default getGenericActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport msdyn365Commerce, * as Msdyn365 from '@msdyn365-commerce/core';\n\n/**\n * Bot Framework input. Used to retrieve existing active bot framework session token.\n */\nexport class GetBotFrameworkInput implements Msdyn365.IActionInput {\n public getCacheKey = () => `CURRENT-BOTFRAMEWORKTOKEN`;\n public getCacheObjectType = () => 'CURRENT-BOTFRAMEWORK-KEY1';\n public dataCacheType = (): Msdyn365.CacheType => 'application';\n}\n\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\n return new GetBotFrameworkInput();\n};\n\nasync function action(input: GetBotFrameworkInput, ctx: Msdyn365.IActionContext): Promise {\n const ISecretValue = await msdyn365Commerce.secretManager?.getSecretValue(\n 'PVA-WEBCHANNELSECURITY-KEY',\n ctx.requestContext.apiSettings.baseUrl\n );\n const apiToken = ISecretValue?.value;\n return apiToken ?? '';\n}\n\nexport default Msdyn365.createObservableDataAction({\n action: >action,\n id: 'getBotFrameworkToken',\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\nexport enum SearchOption {\n OrderNumber = 0,\n ConfirmationId = 1,\n ChannelName = 2,\n CustomerRequisition = 3\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport enum SortOption {\n CreatedDateTimeAscending = 'CreatedDateTimeAscending',\n CreatedDateTimeDescending = 'CreatedDateTimeDescending',\n ConfirmedShipDateAscending = 'ConfirmedShipDateAscending',\n ConfirmedShipDateDescending = 'ConfirmedShipDateDescending'\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct, RatingsSummary } 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 { AttributeValue, ProductDimensionValueInventoryAvailability, ProductPrice, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n AttributesForSelectedVariantInput,\n FullProductInput,\n getAttributesForSelectedVariantAction,\n getFullProductsAction,\n getRatingsSummary,\n GetRatingsSummaryInput,\n ProductDetailsCriteria,\n getDimensionAvailabilitiesForProductsAction,\n ProductsDimensionAvailabilitiesInput,\n GetCustomerInput,\n getCustomer\n} from '@msdyn365-commerce-modules/retail-actions';\n\nimport { ProductComparisonItem, ProductComparisonState } from '../../product-comparison-state';\n\n/**\n * Represents the specifications of the product.\n */\nexport interface IProductSpecification {\n productId: number;\n catalogId: number;\n specificationsList: AttributeValue[];\n}\n\n/**\n * Represents the dimension of single product.\n */\nexport interface IDimensionResult {\n result: ProductDimensionValueInventoryAvailability[][];\n}\n\n/**\n * Represents the dimension of the product.\n */\nexport interface IProductDimensionAvailibility {\n dimensions: IDimensionResult[];\n recordId: number;\n masterId: number;\n}\n/**\n * Represents the data for a single product comparison item.\n */\nexport interface IProductComparisonItemData {\n itemId: string;\n productInfo: SimpleProduct;\n catalogId: number;\n price?: ProductPrice;\n rating?: RatingsSummary;\n specifications?: IProductSpecification;\n dimensions?: IProductDimensionAvailibility;\n}\n\n/**\n * Input class for GetProductsInProductComparisonInput data action.\n */\nexport class GetProductsInProductComparisonInput implements IActionInput {\n public readonly items?: ProductComparisonItem[];\n\n public constructor(items?: ProductComparisonItem[]) {\n this.items = items;\n }\n\n /**\n * Cache key.\n * @returns Cache key.\n */\n public getCacheKey = (): string => 'GetProductsInProductComparisonInput';\n\n /**\n * Cache object type.\n * @returns Cache object type.\n */\n public getCacheObjectType = (): string => 'GetProductsInProductComparison';\n\n /**\n * Data cache type.\n * @returns Data cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates input for the data action.\n * @param inputData - Action context info.\n * @returns Action input.\n */\nexport const createGetProductsInProductComparisonInput = (\n inputData: ICreateActionContext>\n): GetProductsInProductComparisonInput => {\n return new GetProductsInProductComparisonInput();\n};\n\n/**\n * Loads full product info for each comparison item.\n * @param input - Data action input.\n * @param actionContext - Action context.\n * @returns Full product info.\n */\nconst loadFullProducts = async (input: GetProductsInProductComparisonInput, actionContext: IActionContext) => {\n const fullProductInput = input.items!.map(\n item =>\n new FullProductInput(\n item.productId,\n actionContext.requestContext.apiSettings,\n new ProductDetailsCriteria(true, true),\n actionContext.requestContext,\n item.catalogId\n )\n );\n\n let productsInfo = await getFullProductsAction(fullProductInput, actionContext);\n productsInfo = ArrayExtensions.validValues(productsInfo);\n\n return productsInfo;\n};\n\n/**\n * Loads ratings for each comparison item.\n * @param input - Data action input.\n * @param actionContext - Action context.\n * @returns Ratings info.\n */\nconst loadRatings = async (input: GetProductsInProductComparisonInput, actionContext: IActionContext) => {\n const apiSettings = actionContext.requestContext.apiSettings;\n const ratingInputs = input.items!.map(\n item => new GetRatingsSummaryInput(item.productId.toString(), apiSettings.rnr.id || '', apiSettings.rnr.url || '')\n );\n\n const ratingsPromises = ratingInputs.map(ratingInput => getRatingsSummary(ratingInput, actionContext));\n let ratings = await Promise.all(ratingsPromises);\n ratings = ArrayExtensions.validValues(ratings);\n\n return ratings;\n};\n\n/**\n * Loads product specification for the given product.\n * @param item - Input item.\n * @param product - Product for specification.\n * @param actionContext - Action context.\n * @returns Product specifications.\n */\nconst loadProductSpecifications = async (item: ProductComparisonItem, product: FullProduct, actionContext: IActionContext) => {\n const apiSettings = actionContext.requestContext.apiSettings;\n const input = new AttributesForSelectedVariantInput(\n product.ProductDetails.RecordId,\n apiSettings.channelId,\n product.ProductDetails,\n item.catalogId\n );\n const specificationsList = await getAttributesForSelectedVariantAction(input, actionContext);\n\n const productSpecification: IProductSpecification = {\n productId: product.ProductDetails.RecordId,\n specificationsList,\n catalogId: item.catalogId\n };\n return productSpecification;\n};\n\n/**\n * Loads product specification for each comparison item.\n * @param input - Action input.\n * @param products - Products for specification.\n * @param actionContext - Action context.\n * @returns Products specifications info.\n */\nconst loadProductsSpecifications = async (\n input: GetProductsInProductComparisonInput,\n products: FullProduct[],\n actionContext: IActionContext\n) => {\n const productsSpecificationsPromises = products.map(async (product, index) => {\n const item = input.items![index];\n return loadProductSpecifications(item, product, actionContext);\n });\n\n let productsSpecifications = await Promise.all(productsSpecificationsPromises);\n productsSpecifications = ArrayExtensions.validValues(productsSpecifications);\n\n return productsSpecifications;\n};\n\n/**\n * Loads product dimension for each comparison item.\n * @param products - Products for specification.\n * @param actionContext - Action context.\n * @returns Products specifications info.\n */\nconst loadProductsDimensions = async (products: FullProduct[], actionContext: IActionContext) => {\n const productsDimensionPromises = products.map(async product => {\n const dimensionResult: IDimensionResult[] = [];\n\n for (const item of product.ProductDetails.Dimensions!) {\n const input = new ProductsDimensionAvailabilitiesInput(\n product.ProductDetails.MasterProductId ?? product.ProductDetails.RecordId,\n item.DimensionTypeValue,\n actionContext.requestContext\n );\n await getDimensionAvailabilitiesForProductsAction([input], actionContext).then(result => {\n dimensionResult.push({ result });\n });\n }\n\n product.ProductDetails.Dimensions?.map(async item => {\n return dimensionResult;\n });\n\n const getUpdatedDimension: IProductDimensionAvailibility | undefined =\n dimensionResult.length > 0\n ? {\n dimensions: dimensionResult,\n recordId: product.ProductDetails.RecordId,\n masterId: product.ProductDetails.MasterProductId!\n }\n : undefined;\n return getUpdatedDimension;\n });\n\n let productsDimensions = await Promise.all(productsDimensionPromises);\n productsDimensions = ArrayExtensions.validValues(productsDimensions);\n return productsDimensions;\n};\n\n/**\n * Retrieves product data for the items in the comparison.\n * @param input - Action input.\n * @param actionContext - Action context.\n * @returns Products data.\n */\nexport const getProductsInProductComparisonAction = async (\n input: GetProductsInProductComparisonInput,\n actionContext: IActionContext\n): Promise => {\n const catalogId = getCatalogId(actionContext.requestContext);\n\n let items = input.items;\n if (!ArrayExtensions.hasElements(items)) {\n const accountInformation = await getCustomer(new GetCustomerInput(actionContext.requestContext.apiSettings), actionContext);\n items = ProductComparisonState.instance(actionContext.requestContext, accountInformation).items;\n }\n\n const newInput: GetProductsInProductComparisonInput = {\n items: items.filter(item => item.catalogId === catalogId),\n getCacheKey: input.getCacheKey,\n getCacheObjectType: input.getCacheObjectType,\n dataCacheType: input.dataCacheType\n };\n\n if (!ArrayExtensions.hasElements(newInput.items)) {\n return [];\n }\n\n const productsPromises = loadFullProducts(newInput, actionContext);\n const ratingsPromises = loadRatings(newInput, actionContext);\n const [products, ratings] = await Promise.all([productsPromises, ratingsPromises]);\n const productDimensions = await loadProductsDimensions(products, actionContext);\n const productsSpecifications = await loadProductsSpecifications(newInput, products, actionContext);\n\n const productsData = newInput.items.map((item, index) => {\n const product = products[index];\n const productData: IProductComparisonItemData = {\n itemId: item.itemId,\n productInfo: product.ProductDetails,\n price: product.ProductPrice,\n catalogId: item.catalogId\n };\n productData.rating = ratings.find(rating => rating.productId === productData.productInfo.RecordId.toString());\n productData.specifications = productsSpecifications.find(\n productSpecifications =>\n productSpecifications.productId === productData.productInfo.RecordId &&\n productSpecifications.catalogId === productData.catalogId\n );\n productData.dimensions = productDimensions.find(dimension => dimension?.recordId === productData.productInfo.RecordId);\n return productData;\n });\n return productsData;\n};\n\n/**\n * Data action to retrieve products info for the items in the comparison.\n */\nexport const getActiveCheckoutCartProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/product-comparison/product-comparison/get-products-in-product-comparison',\n action: getProductsInProductComparisonAction as IAction,\n input: createGetProductsInProductComparisonInput\n});\n\nexport default getActiveCheckoutCartProductsActionDataAction;\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 { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { ArrayExtensions, getCustomer, GetCustomerInput, getSimpleProducts, ProductInput } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { ProductComparisonItem, ProductComparisonState } from '../../product-comparison-state';\n\n/**\n * Represents the data for a single product in the comparison.\n */\nexport interface IProductComparisonProductData {\n itemId: string;\n product: SimpleProduct;\n catalogId: number;\n}\n\n/**\n * Input class for GetProductsInProductComparisonInput data action.\n */\nexport class GetProductsInPreviewProductComparisonInput implements IActionInput {\n public readonly items?: ProductComparisonItem[];\n\n public constructor(items?: ProductComparisonItem[]) {\n this.items = items;\n }\n\n /**\n * Cache key.\n * @returns Cache key.\n */\n public getCacheKey = (): string => 'GetProductsInPreviewProductComparisonInput';\n\n /**\n * Cache object type.\n * @returns Cache object type.\n */\n public getCacheObjectType = (): string => 'GetProductsInPreviewProductComparisonInput';\n\n /**\n * Data cache type.\n * @returns Data cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates input for the data action.\n * @param inputData - Action context info.\n * @returns Action input.\n */\nexport const createGetProductsInPreviewProductComparisonInput = (\n inputData: ICreateActionContext>\n): GetProductsInPreviewProductComparisonInput => {\n return new GetProductsInPreviewProductComparisonInput();\n};\n\n/**\n * Retrieves product data for the items in the comparison.\n * @param input - Action input.\n * @param actionContext - Action context.\n * @returns Products data.\n */\nexport const getProductsInPreviewProductComparisonAction = async (\n input: GetProductsInPreviewProductComparisonInput,\n actionContext: IActionContext\n): Promise => {\n const catalogId = getCatalogId(actionContext.requestContext);\n\n let currentItems = input.items;\n if (!ArrayExtensions.hasElements(currentItems)) {\n const accountInformation = await getCustomer(new GetCustomerInput(actionContext.requestContext.apiSettings), actionContext);\n currentItems = ProductComparisonState.instance(actionContext.requestContext, accountInformation).items;\n }\n\n currentItems = currentItems.filter(item => item.catalogId === catalogId);\n if (!ArrayExtensions.hasElements(currentItems)) {\n return [];\n }\n\n const productInputs = currentItems.map(\n item => new ProductInput(item.productId, actionContext.requestContext.apiSettings, undefined, undefined, undefined, item.catalogId)\n );\n\n const simpleProducts = await getSimpleProducts(productInputs, actionContext);\n if (currentItems.length !== simpleProducts.length) {\n throw new Error('Product comparison preview: Failed to retrieve products info.');\n }\n\n return currentItems.map((item, index) => {\n return {\n itemId: ProductComparisonItem.getItemId(item.productId, item.catalogId),\n product: simpleProducts[index],\n catalogId: item.catalogId\n };\n });\n};\n\n/**\n * Data action to retrieve products info for the items in the comparison.\n */\nexport const getProductsInPreviewProductComparisonDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/product-comparison/product-comparison-preview/get-products-in-preview-product-comparison',\n action: getProductsInPreviewProductComparisonAction as IAction,\n input: createGetProductsInPreviewProductComparisonInput\n});\n\nexport default getProductsInPreviewProductComparisonDataAction;\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 IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n buildCacheKeyWithUrlTokens,\n getFullProductList,\n GetFullProductListInput,\n QuickOrderTemplate\n} from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for getActiveOrderTemplateLines data action.\n */\nexport class ActiveProductListInput implements IActionInput {\n public requestContext: IRequestContext;\n\n public productListId: string | undefined;\n\n public constructor(requestContext: IRequestContext, productListId?: string) {\n this.requestContext = requestContext;\n this.productListId = productListId;\n }\n\n /**\n * GetCacheObjectType.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => buildCacheKeyWithUrlTokens('ActiveProductList', this.requestContext);\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheObjectType = (): string => 'ActiveProductList';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'request';\n\n /**\n * Set Cache output.\n * @returns - Flag for cache output.\n */\n public shouldCacheOutput = (): boolean => false;\n}\n\n/**\n * Calls the Retail API and returns a ProductList object for user.\n * @param input - ProductList Input.\n * @param context - ActionContext.\n * @returns - OrderTemplate.\n */\nexport async function getActiveProductList(input: ActiveProductListInput, context: IActionContext): Promise {\n const fullProductListInput = new GetFullProductListInput(input.productListId);\n const productList = await getFullProductList(fullProductListInput, context);\n return productList;\n}\n\n/**\n * Calls the Retail API and returns a ProductList object for user.\n * @param input - ProductList Input.\n * @param context - ActionContext.\n * @returns - ProductList.\n */\nexport const getActiveProductListDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/quick-order-grid/get-product-list',\n action: getActiveProductList as IAction,\n\n /**\n * Method to call for input.\n * @param context - ActionContext.\n * @returns - Input for action..\n */\n input: (context: ICreateActionContext) => {\n return new ActiveProductListInput(context.requestContext);\n }\n});\n\nexport default getActiveProductListDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { Reviews } 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';\nimport { getRnrEndpointId, getRnrPartnerId, getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { GetProductReviewsInput } from './inputs/get-product-reviews-input';\n\n/**\n * TODO: Use this function to create the input required to make the API call.\n * @param input\n */\nexport const createInputForProductReviews = (input: ICreateActionContext>): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(input);\n if (productId) {\n // Task #211227597 Remove these hardcoded values.\n return new GetProductReviewsInput(productId, getRnrPartnerId(input), input.requestContext.locale, getRnrEndpointId(input));\n }\n throw new Error('[GetProductReviews] Not all necessary parameters found while creating Input for GetProductReviewsApi');\n};\n\nexport async function getReviewsForGivenProduct(input: GetProductReviewsInput, ctx: IActionContext): Promise {\n if (!inputIsValid(input)) {\n throw new Error(\n `[GetProductReviews] Invalid input. ProductId = ${input.productId}, TenantId = ${input.tenantId}, localeListFilter = ${input.localeListFilter}`\n );\n }\n let requestUrl =\n `${input.serviceEndpoint}/v2.0/reviews/product/${input.productId}` +\n `?tenantId=${input.tenantId}` +\n `&localeListFilter=${input.localeListFilter}` +\n `&pageSize=${input.pageSize}` +\n `&orderBy=${input.orderBy}` +\n `&skipItems=${input.skipItems}`;\n\n if (input.starFilters !== undefined && input.starFilters.length > 0) {\n requestUrl = `${requestUrl}&starFilters=${input.starFilters}`;\n }\n\n if (input.pageToken !== null) {\n requestUrl = `${requestUrl}&pageToken=${input.pageToken}`;\n }\n return sendRequest(requestUrl, 'get')\n .then(response => {\n if (response.data && response.data.items && response.data.items.length > 0) {\n return {\n items: response.data.items.filter(i => !i.isTakenDown),\n pagingInfo: response.data.pagingInfo\n };\n }\n ctx.trace('[GetProductReviews] No reviews found for this product.');\n return response.data;\n })\n .catch(error => {\n ctx.trace('[GetProductReviews] Failed to get reviews for product');\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[GetProductReviews] Failed to get reviews for product');\n throw error;\n });\n}\n\nfunction inputIsValid(input: GetProductReviewsInput): boolean {\n return input && input.productId.length > 0 && input.tenantId.length > 0 && input.localeListFilter.length > 0 && input.pageSize > 0;\n}\n\nexport const getReviewsForGivenProductDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/ratings-reviews/get-product-reviews',\n action: >getReviewsForGivenProduct,\n input: createInputForProductReviews\n});\n\nexport default getReviewsForGivenProductDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { Review } from '@msdyn365-commerce/commerce-entities';\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext,\n sendRequest\n} from '@msdyn365-commerce/core';\nimport { getRnrAuthEndpointId, getRnrPartnerId, getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { GetUserReviewInput } from './inputs/get-user-review-input';\n\n/**\n * This method builds the input for the getUserReviewApi call.\n * @param input\n */\nconst createInput = (input: ICreateActionContext): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(input);\n const userInfo = input.requestContext.user;\n if (productId && userInfo && userInfo.isAuthenticated) {\n // Task #211227597 Remove these hardcoded values.\n return new GetUserReviewInput(productId, getRnrPartnerId(input), userInfo.token, getRnrAuthEndpointId(input));\n }\n throw new Error('[GetUserReview] Not all necessary parameters found while creating Input for GetUserReviewAPI');\n};\n\n/**\n * This method gets the user's review from the RnR service endpoint.\n * @param input\n * @param ctx\n */\nasync function getUserReview(input: GetUserReviewInput, ctx: IActionContext): Promise {\n if (!inputIsValid(input)) {\n const errorMessage = `[GettUserReview] Failed to get user's review due to bad input ${input}`;\n ctx.trace(errorMessage);\n throw new Error(errorMessage);\n }\n\n const requestUrl = `${input.serviceEndpoint}/v2.0/reviews/product/${input.productId}/user?tenantId=${input.tenantId}`;\n\n return sendRequest(requestUrl, 'get', null, { headers: { Authorization: `id_token ${input.authorization}` } })\n .then(response => {\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers -- These are valid status code for requests.\n if (response.status !== 200 && response.status !== 201) {\n throw new Error(`An error occurred in getting user review. Response message - ${response.statusText}`);\n }\n return response.data;\n })\n .catch(error => {\n ctx.trace(\"[GettUserReview] Failed to get user's review for product\");\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\"[GettUserReview] Failed to get user's review for product\");\n ctx.trace(error);\n throw error;\n });\n}\n\nfunction inputIsValid(input: GetUserReviewInput): boolean {\n return input.productId.length > 0 && input.authorization.length > 0 && input.tenantId.length > 0;\n}\n\nexport const getUserReviewDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/ratings-reviews/get-user-review',\n action: >getUserReview,\n input: createInput\n});\n\nexport default getUserReviewDataAction;\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 getFriendlyName,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n buildCacheKeyWithUrlTokens,\n CurrentCategoryInput,\n getCategoryUrl,\n getCurrentCategory,\n removeDomainQspFromUrl\n} from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IPageSummaryData } from '../IPageSummaryData';\n\nimport { ICategoryPageSummaryConfig } from './category-page-summary.props.autogenerated';\nimport { IDefaultPageSummaryConfig } from '../default-page-summary';\n\n/**\n * Category Page Summary Input\n */\nexport class CategoryPageSummaryInput implements IActionInput {\n public requestContext: IRequestContext;\n\n public config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig;\n\n constructor(config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig, requestContext: IRequestContext) {\n this.config = config || {};\n this.requestContext = requestContext;\n }\n\n public getCacheObjectType = (): string => 'CategoryPageSummary';\n\n public getCacheKey = (): string => buildCacheKeyWithUrlTokens('CategoryPageSummary', this.requestContext);\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst createGetCurrentCategoryInput = (\n inputData: IActionContext,\n config?: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig\n): CurrentCategoryInput => {\n if (inputData && inputData.requestContext) {\n let includeRootCategory: boolean | undefined;\n if (config) {\n includeRootCategory = (config as ICategoryPageSummaryConfig).includeRootCategory;\n }\n return new CurrentCategoryInput(inputData.requestContext, includeRootCategory);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n/**\n * Get skip count.\n * @param inputData\n */\nfunction getSkipCount(inputData: ICreateActionContext, IGeneric>): string | undefined {\n return inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.skip;\n}\n\nconst action = async (input: CategoryPageSummaryInput, context: IActionContext): Promise => {\n const { config } = input;\n let currentCategoryResult;\n try {\n currentCategoryResult = await getCurrentCategory(createGetCurrentCategoryInput(context, input.config), context);\n } catch {\n // Do nothing, if the action fails fallback to values defined in data\n }\n if (currentCategoryResult) {\n const currentCategory = { ...currentCategoryResult };\n let categoryUrl: string | undefined;\n try {\n // Reset category's name neutralizedName\n const localName = getFriendlyName(context.requestContext.locale, currentCategory.NameTranslations);\n const neutralizedName = currentCategory.NeutralizedName || currentCategory.Name;\n currentCategory.Name = localName;\n currentCategory.NeutralizedName = neutralizedName;\n categoryUrl = getCategoryUrl(currentCategory);\n\n const canonicalDomain = context.requestContext.canonicalDomain;\n if (categoryUrl && canonicalDomain) {\n categoryUrl = `https://${canonicalDomain}${categoryUrl}`.toLocaleLowerCase();\n const skipCount = getSkipCount(context);\n const Url = new URL(categoryUrl);\n const urlParams: URLSearchParams = new URLSearchParams(Url.search);\n if (skipCount) {\n urlParams.set('skip', skipCount);\n }\n Url.search = urlParams.toString();\n categoryUrl = Url.toString();\n categoryUrl = removeDomainQspFromUrl(categoryUrl, context.requestContext);\n } else {\n categoryUrl = undefined;\n }\n } catch {\n categoryUrl = undefined;\n }\n return {\n title: currentCategory.Name,\n sharingImageUrl: currentCategory.OfflineImage,\n canonicalUrl: categoryUrl,\n faviconUrl: config && config.faviconUrl\n };\n\n // If the action fails fallback to values defined from data\n } else if (config) {\n return {\n title: config.title,\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\n faviconUrl: config && config.faviconUrl\n };\n }\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/page-summary/category-page-summary',\n action: >action,\n input: (args: ICreateActionContext) => {\n return new CategoryPageSummaryInput(args.config, args.requestContext);\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 IRequestContext\n} from '@msdyn365-commerce/core';\nimport { buildCacheKeyWithUrlTokens, removeDomainQspFromUrl } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IDefaultPageSummaryConfig } from './default-page-summary.props.autogenerated';\n\nexport interface IPageSummaryData {\n title?: string;\n description?: string;\n keywords?: string;\n sharingImageUrl?: string;\n canonicalUrl?: string;\n faviconUrl?: string;\n}\n\n/**\n * Page Summary Input\n */\nexport class PageSummaryInput implements IActionInput {\n public requestContext: IRequestContext;\n\n public config: IDefaultPageSummaryConfig;\n\n constructor(config: IDefaultPageSummaryConfig, requestContext: IRequestContext) {\n this.config = config || {};\n this.requestContext = requestContext;\n }\n\n public getCacheObjectType = (): string => 'PageSummary';\n\n public getCacheKey = (): string => `${buildCacheKeyWithUrlTokens('PageSummary', this.requestContext)}-${this.config.title}`;\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst action = async (input: PageSummaryInput, context: IActionContext): Promise => {\n const { config } = input;\n return {\n title: config && config.title,\n description: config && config.description,\n keywords: config && config.keywords,\n sharingImageUrl: config && config.sharingImage && config.sharingImage.src,\n canonicalUrl:\n context.requestContext && context.requestContext.canonicalUrl\n ? removeDomainQspFromUrl(context.requestContext.canonicalUrl, context.requestContext)\n : undefined,\n faviconUrl: config && config.faviconUrl\n };\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/page-summary/default-page-summary',\n action: >action,\n input: (args: ICreateActionContext) => {\n return new PageSummaryInput(args.config, args.requestContext);\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 ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { Image, ISubList } from '@msdyn365-commerce-modules/data-types';\nimport { buildCacheKeyWithUrlTokens, getList, ListInput } from '@msdyn365-commerce-modules/retail-actions';\nimport { IProductItem } from '@msdyn365-commerce-modules/retail-actions/dist/types/get-list';\n\nimport { IDefaultPageSummaryConfig } from '../default-page-summary/default-page-summary.props.autogenerated';\nimport { IPageSummaryData } from '../IPageSummaryData';\n\n/**\n * List Page Summary Input\n */\nexport class ListPageSummaryInput implements IActionInput {\n public requestContext: IRequestContext;\n\n public config: IDefaultPageSummaryConfig;\n\n constructor(config: IDefaultPageSummaryConfig, requestContext: IRequestContext) {\n this.config = config || {};\n this.requestContext = requestContext;\n }\n\n public getCacheObjectType = (): string => 'ListPageSummary';\n\n public getCacheKey = (): string => buildCacheKeyWithUrlTokens('ListPageSummary', this.requestContext);\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * List item type enum.\n */\nenum ListItemType {\n list = 'list',\n product = 'product'\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 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 * 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 input list data.\n * @param inputData\n */\nfunction getInputListData(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\nconst createGetListInput = (inputData: IActionContext): ListInput => {\n const listData: IGeneric = getInputListData(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\nconst action = async (input: ListPageSummaryInput, context: IActionContext): Promise => {\n const { config } = input;\n let listData;\n try {\n listData = await getList(createGetListInput(context), context);\n } catch {\n // Do nothing, if there's an error running the action fall back to values defined from data\n }\n if (listData && listData.Title) {\n return {\n title: listData.Title,\n description: listData.Description\n };\n\n // If the action fails fallback to values defined from data\n } else if (config) {\n return {\n title: config.title,\n description: config.description\n };\n }\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/page-summary/list-page-summary',\n action: >action,\n input: (args: ICreateActionContext) => {\n return new ListPageSummaryInput(args.config, args.requestContext);\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 getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getAttributeValuesAsync, getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n ArrayExtensions,\n generateCacheKey,\n generateImageUrl,\n getProductUrlSync,\n getSelectedProductIdFromActionInput,\n QueryResultSettingsProxy,\n removeDomainQspFromUrl\n} from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IPageSummaryData } from '../IPageSummaryData';\nimport { IProductPageSummaryConfig } from './product-page-summary.props.autogenerated';\n\n/**\n * Product Page Summary Input.\n */\nexport class ProductPageSummaryInput implements IActionInput {\n public apiSettings: ICommerceApiSettings;\n\n public config: IProductPageSummaryConfig;\n\n public productId: number;\n\n public catalogId?: number;\n\n public constructor(\n config: IProductPageSummaryConfig,\n apiSettings: ICommerceApiSettings,\n productId: number,\n requestContext?: IRequestContext\n ) {\n this.config = config || {};\n this.apiSettings = apiSettings;\n this.productId = productId;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheObjectType = (): string => 'ProductPageSummary';\n\n public getCacheKey = (): string =>\n generateCacheKey(\n this.apiSettings,\n { key: 'Key', value: 'ProductPageSummary' },\n { key: 'Title', value: this.config.title },\n { key: 'ProductId', value: this.productId },\n { key: 'CatalogId', value: this.catalogId }\n );\n\n public dataCacheType = (): CacheType => 'application';\n}\n\nexport interface IProductPageSummary extends IPageSummaryData {\n price?: number;\n productId?: number;\n productBrand?: string;\n}\n\nconst createInput = (args: ICreateActionContext) => {\n const productId = getSelectedProductIdFromActionInput(args);\n\n if (productId) {\n return new ProductPageSummaryInput(\n args.config,\n args.requestContext.apiSettings,\n +productId,\n args.requestContext\n );\n }\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\n};\n\n// Checks product attributes for the presence of brand attribute to extract the brand name for product metadata\nconst getProductBrand = async (\n context: IActionContext,\n recordId: number,\n channelId: number,\n catalogId: number\n): Promise => {\n const productAttributes = await getAttributeValuesAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n recordId,\n channelId,\n catalogId\n );\n for (const productAttribute of productAttributes) {\n if (productAttribute.Name === 'Brand') {\n return productAttribute.TextValue;\n }\n }\n return;\n};\n\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\n const { config, productId, apiSettings } = input;\n let simpleProductsData: SimpleProduct[] | undefined;\n try {\n simpleProductsData = ArrayExtensions.validValues(\n await getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n apiSettings.channelId,\n [productId],\n null,\n input.catalogId ?? 0\n )\n );\n } catch {\n // Do nothing, if there's an error we fall back to values defined from config\n }\n if (ArrayExtensions.hasElements(simpleProductsData)) {\n const simpleProductData = simpleProductsData[0];\n let productUrl: string | undefined;\n try {\n productUrl = getProductUrlSync(simpleProductData, context);\n const canonicalDomain = context.requestContext.canonicalDomain;\n if (productUrl && canonicalDomain) {\n productUrl = `https://${canonicalDomain}${productUrl}`.toLocaleLowerCase();\n productUrl = removeDomainQspFromUrl(productUrl, context.requestContext);\n } else {\n productUrl = undefined;\n }\n } catch {\n productUrl = undefined;\n }\n let productBrand: string | undefined;\n try {\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, input.catalogId ?? 0);\n } catch {\n productBrand = undefined;\n }\n return {\n title: simpleProductData.Name,\n description: simpleProductData.Description,\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\n canonicalUrl: productUrl,\n faviconUrl: config && config.faviconUrl,\n productId: simpleProductData.RecordId,\n price: simpleProductData.AdjustedPrice,\n productBrand\n };\n\n // If the action fails fallback to values defined from config\n } else if (config) {\n return {\n title: config.title,\n description: config.description,\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\n faviconUrl: config && config.faviconUrl\n };\n }\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/page-summary/product-page-summary',\n action: >action,\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} from '@msdyn365-commerce/core';\nimport { getStateProvincesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { StateProvinceInfo } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for get state provinces data action.\n */\nexport class GetStateProvincesInput implements IActionInput {\n public countryRegionId: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(countryRegionId: string, apiSettings: ICommerceApiSettings) {\n this.countryRegionId = countryRegionId;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`StateProvinceInfo-${this.countryRegionId}`, this.apiSettings);\n\n public getCacheObjectType = () => 'StateProvinceInfo';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nexport async function getStateProvinceAction(input: GetStateProvincesInput, ctx: IActionContext): Promise {\n return getStateProvincesAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n input.countryRegionId\n );\n}\n\nexport const getStateProvinceActionDataAction = createObservableDataAction({\n action: >getStateProvinceAction\n});\n\nexport default getStateProvinceActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { getCheckoutState } from '@msdyn365-commerce/global-state';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { getSimpleProducts, ProductInput } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for ActiveCheckoutCartWithProducts data action.\n */\nexport class ActiveCheckoutCartProductsInput implements IActionInput {\n public getCacheKey = () => 'ActiveCheckoutCartProducts';\n\n public getCacheObjectType = () => 'ActiveCheckoutCartProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createInput = () => {\n return new ActiveCheckoutCartProductsInput();\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 getActiveCheckoutCartProductsAction(\n input: ActiveCheckoutCartProductsInput,\n ctx: IActionContext\n): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n ctx.telemetry.exception(new Error('[getActiveCheckoutCartWithProducts]No valid Input was provided, failing'));\n throw new Error('[getActiveCheckoutCartWithProducts]No valid Input was provided, failing');\n }\n\n const checkoutState = await getCheckoutState(ctx);\n const cart = checkoutState.checkoutCart.cart;\n\n // If there are cart lines, make call to get products\n if (!checkoutState.checkoutCart.hasInvoiceLine && cart && cart.CartLines && cart.CartLines.length > 0) {\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 => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n throw new Error('[getActiveCheckoutCartWithProdcuts]Unable to hydrate cart with product information');\n });\n }\n\n return [];\n}\n\nexport const getActiveCheckoutCartProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/checkout/get-products-in-active-checkout-cart',\n action: >getActiveCheckoutCartProductsAction,\n input: createInput\n});\n\nexport default getActiveCheckoutCartProductsActionDataAction;\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 isEmptyOrNullObject\n} from '@msdyn365-commerce/core';\nimport { getCartState, getCheckoutState, ICartState, ICheckoutState } from '@msdyn365-commerce/global-state';\nimport { CardPaymentAcceptPoint, CartsDataActions } from '@msdyn365-commerce/retail-proxy';\nimport { ArrayExtensions, buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\nimport { get } from 'lodash';\n\n/**\n * Get card payment accept point input.\n */\nexport interface IGetCardPaymentAcceptPointInput {\n shouldShowBillingAddress?: boolean;\n paymentTenderType?: string;\n apiSettings: ICommerceApiSettings;\n shouldEnableSinglePaymentAuthorizationCheckout?: boolean;\n amountDue?: number;\n isInCartPage?: boolean;\n}\n\n/**\n * GetCardPaymentAcceptPointInput - Input for create GetCardPaymentAcceptPoint.\n */\nexport class GetCardPaymentAcceptPointInput implements IActionInput {\n public shouldShowBillingAddress?: boolean;\n\n public paymentTenderType?: string;\n\n public shouldEnableSinglePaymentAuthorizationCheckout?: boolean;\n\n public amountDue?: number;\n\n public isInCartPage?: boolean;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility -- Existing code.\n constructor(input: IGetCardPaymentAcceptPointInput) {\n this.shouldShowBillingAddress = input.shouldShowBillingAddress;\n this.paymentTenderType = input.paymentTenderType;\n this.apiSettings = input.apiSettings;\n this.shouldEnableSinglePaymentAuthorizationCheckout = input.shouldEnableSinglePaymentAuthorizationCheckout;\n this.amountDue = input.amountDue;\n this.isInCartPage = input.isInCartPage;\n }\n\n /**\n * Get the cache key.\n * @returns Cache key.\n */\n public getCacheKey = (): string =>\n buildCacheKey(`CardPaymentAcceptPoint${this.paymentTenderType ? `-${this.paymentTenderType}-express` : ''}`, this.apiSettings);\n\n /**\n * Get cache object type.\n * @returns Card payment accept point.\n */\n public getCacheObjectType = (): string => 'CardPaymentAcceptPoint';\n\n /**\n * Get data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create checkout express input.\n * @param inputData - Get card payment accept point.\n * @returns CardPaymentAcceptInput.\n */\nexport const createCheckoutPaymentInstrumentInput = (\n inputData: ICreateActionContext\n): GetCardPaymentAcceptPointInput => {\n const { shouldShowBillingAddress, paymentTenderType, shouldEnableSinglePaymentAuthorizationCheckout, amountDue, isInCartPage } =\n inputData.config ?? {};\n const getCardPaymentAcceptPointInput = {\n shouldShowBillingAddress,\n paymentTenderType,\n apiSettings: inputData.requestContext.apiSettings,\n shouldEnableSinglePaymentAuthorizationCheckout,\n amountDue,\n isInCartPage\n };\n\n return new GetCardPaymentAcceptPointInput(getCardPaymentAcceptPointInput);\n};\n\n/**\n * Calls the Retail API and returns a cart object based on the passed GetCartInput.\n * @param input - The get card payment accept point.\n * @param ctx - The action context.\n * @returns CardPaymentAcceptPoint.\n */\nexport async function getCardPaymentAcceptPointAction(\n input: GetCardPaymentAcceptPointInput,\n ctx: IActionContext\n): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Double check.\n if (!input) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing'));\n throw new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing');\n }\n\n const { paymentTenderType, amountDue = 0 } = input;\n const checkoutState: ICheckoutState = await getCheckoutState(ctx).catch((error: Error) => {\n ctx.telemetry.exception(error);\n throw error;\n });\n\n const cartState: ICartState = await getCartState(ctx).catch((error: Error) => {\n ctx.telemetry.exception(error);\n throw error;\n });\n\n if (\n isEmptyOrNullObject(checkoutState) ||\n isEmptyOrNullObject(checkoutState.checkoutCart) ||\n isEmptyOrNullObject(checkoutState.checkoutCart.cart)\n ) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Unable to get checkoutState cart'));\n throw new Error('[getCardPaymentAcceptPointAction] Unable to get checkoutState cart');\n }\n\n if (isEmptyOrNullObject(cartState) || isEmptyOrNullObject(cartState.cart)) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Unable to get cartState cart'));\n throw new Error('[getCardPaymentAcceptPointAction] Unable to get cartState cart');\n }\n\n // Cart lines could be updated after copying the cart to checkout state. So need to check cart instead of checkoutcart.\n if (!cartState.cart.CartLines || !ArrayExtensions.hasElements(cartState.cart.CartLines)) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Cart is empty'));\n throw new Error('[getCardPaymentAcceptPointAction] Cart is empty');\n }\n\n const requestUrl =\n typeof ctx.requestContext.url.requestUrl === 'string'\n ? new URL(ctx.requestContext.url.requestUrl)\n : ctx.requestContext.url.requestUrl;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Existing code.\n const origin = get(window, 'location.origin') || requestUrl.origin;\n\n const getCartAmountDue = () => {\n return input.isInCartPage ? cartState.cart.AmountDue : checkoutState.checkoutCart.cart.AmountDue ?? 0;\n };\n\n const cardPaymentAcceptSettings = {\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardPaymentAcceptSettings',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Any type.\n HostPageOrigin: origin,\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-assignment -- Any type.\n AdaptorPath: `${origin}/Connectors/` || origin,\n CardPaymentEnabled: false,\n CardTokenizationEnabled: true,\n HideBillingAddress: true,\n ...(paymentTenderType && { TenderTypeId: paymentTenderType }),\n PaymentAmount: amountDue !== 0 ? amountDue : getCartAmountDue(),\n RequireShippingAddress: true\n };\n\n return CartsDataActions.getCardPaymentAcceptPointAsync(\n { callerContext: ctx, bypassCache: 'get' },\n checkoutState.checkoutCart.cart.Id,\n cardPaymentAcceptSettings,\n []\n )\n .then(cardPaymentAcceptPoint => {\n if (!cardPaymentAcceptPoint.AcceptPageUrl && !cardPaymentAcceptPoint.AcceptPageContent) {\n throw new Error(\n '[getCardPaymentAcceptPointAction]Payment Accept Page has neither return AcceptPageUrl nor AcceptPageContent in updatePaymentAcceptPageData'\n );\n }\n return cardPaymentAcceptPoint;\n })\n .catch(error => {\n ctx.telemetry.exception(error as Error);\n ctx.telemetry.debug('Unable to get Card Payment Accept Point');\n throw error;\n });\n}\n\n/**\n * Get card payment accept point.\n */\nexport const getCardPaymentAcceptPointActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce/checkout-express/get-card-payment-accept-point',\n action: getCardPaymentAcceptPointAction as IAction,\n input: createCheckoutPaymentInstrumentInput\n});\n\nexport default getCardPaymentAcceptPointActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport MsDyn365, { IActionContext } from '@msdyn365-commerce/core';\nimport { action, computed, observable } from 'mobx';\n\nimport { IDistributorInfo, StringExtensions } from '@msdyn365-commerce-modules/retail-actions';\nimport {\n IListMapViewState,\n ILoadMapApiInput,\n IDistributorSelectionStateContext,\n IDistributorLocation,\n IDistributorSelectorStateManager\n} from './i-distributor-selection-state-manager';\n\nimport { IMapWindow, MapLocationsResult } from './models/map-data';\n\ndeclare const window: IMapWindow;\n\n/**\n * Instance of IDistributorSelectorStateManager manager that uses Map service\n * for geo location.\n */\nexport class MapDistributorSelectorStateManager implements IDistributorSelectorStateManager {\n @observable public isMapApiLoaded?: boolean;\n @observable public selectedDistributorId?: number;\n @observable public hideDistributorWarning?: boolean;\n @observable public listMapViewState: IListMapViewState = { displayList: true, displayMap: false };\n @observable public isMapModuleLoaded?: boolean;\n @observable public showDistributorDetailsOnMap?: boolean;\n @observable public distributorList?: IDistributorInfo[];\n @observable protected _distributorDetailContext?: IDistributorSelectionStateContext;\n @observable protected _distributorSelectorContext?: IDistributorSelectionStateContext;\n\n private readonly SERVICE_ENDPOINT: string = 'https://dev.virtualearth.net/REST/v1/';\n private readonly MAP_API_ENDPOINT: string = 'https://www.bing.com/api/maps/mapcontrol?callback=mapAPIReady';\n\n @computed public get isDistributorSelectorDialogOpen(): Readonly {\n return this._distributorSelectorContext !== undefined;\n }\n\n @computed public get isDistributorDetailPopupOpen(): Readonly {\n return this._distributorDetailContext !== undefined;\n }\n\n @computed public get distributorSelectorContext(): Readonly {\n return this._distributorSelectorContext;\n }\n\n private readonly hideDistributorWarningLocalStorageKey: string = '_msdyn365__hideDistributorWarning_';\n\n constructor() {\n this.isMapModuleLoaded = false;\n this.showDistributorDetailsOnMap = true;\n\n const hideDistributorWarning = this._readFromToCookie(this.hideDistributorWarningLocalStorageKey);\n try {\n const distributorWarning = hideDistributorWarning ? JSON.parse(hideDistributorWarning) : false;\n\n if (distributorWarning) {\n this.hideDistributorWarning = distributorWarning;\n }\n } catch {\n this.hideDistributorWarning = false;\n }\n }\n\n @action\n public async toggleListMapViewState(): Promise {\n this.listMapViewState = {\n displayList: !this.listMapViewState.displayList,\n displayMap: !this.listMapViewState.displayMap\n };\n }\n\n @action\n public async setMapModuleLoaded(input: boolean): Promise {\n this.isMapModuleLoaded = input;\n }\n\n @action\n public async setDistributorsList(input: IDistributorInfo[]): Promise {\n this.distributorList = input;\n }\n\n @action\n public async setSelectedDistributorId(distributorId: number | undefined): Promise {\n this.selectedDistributorId = distributorId;\n }\n\n @action\n public async hideWarningMessage(writeToCookie: boolean = false) {\n this.hideDistributorWarning = true;\n if (writeToCookie) {\n this._writeToCookie(this.hideDistributorWarningLocalStorageKey, JSON.stringify(true));\n }\n }\n\n @action\n public async updateDistributorMapVisibility(input: boolean) {\n this.showDistributorDetailsOnMap = input;\n }\n\n @action\n public async openDistributorSelectorDialog(input: IDistributorSelectionStateContext): Promise {\n if (this._distributorSelectorContext) {\n throw new Error('Distributor selector dialog is already opened');\n }\n\n this._distributorSelectorContext = input;\n }\n\n @action\n public async openDistributorDetailPopup(input: IDistributorSelectionStateContext): Promise {\n if (this._distributorDetailContext) {\n throw new Error('Distributor detail popup is already opened');\n }\n\n this._distributorDetailContext = input;\n }\n\n @action\n public async closeDistributorSelectorDialog(): Promise {\n this._distributorSelectorContext = undefined;\n }\n\n @action\n public async closeDistributorDetailPopup(): Promise {\n this._distributorDetailContext = undefined;\n }\n\n @action\n public async geoLocate(searchTerm: string, actionContext: IActionContext): Promise {\n if (\n !searchTerm ||\n !actionContext?.requestContext?.channel?.BingMapsApiKey ||\n !actionContext?.requestContext?.channel?.BingMapsEnabled\n ) {\n return undefined;\n }\n\n let searchContent: string = searchTerm;\n\n const jsonp = `mapSearchCallback_${crypto.getRandomValues(new Uint32Array(1))[0]}`;\n\n if (actionContext.requestContext.channel.ChannelCountryRegionISOCode) {\n searchContent = `${searchTerm.trim()} ${actionContext.requestContext.channel.ChannelCountryRegionISOCode}`;\n }\n\n const query = encodeURI(searchContent);\n const key = encodeURI(actionContext.requestContext.channel.BingMapsApiKey);\n\n const geolocationApiUrl =\n actionContext.requestContext.app &&\n actionContext.requestContext.app.config &&\n actionContext.requestContext.app.config.geolocationApiUrl;\n const requestUrl = `${\n geolocationApiUrl ? geolocationApiUrl : this.SERVICE_ENDPOINT\n }/Locations?query=${query}&key=${key}&jsonp=${jsonp}`;\n\n return new Promise(resolve => {\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', requestUrl);\n\n window[jsonp] = (data: MapLocationsResult) => {\n delete window[jsonp];\n script.remove();\n\n if (data && data.resourceSets && data.resourceSets.length > 0 && data.resourceSets[0].resources.length > 0) {\n resolve({\n latitude: data.resourceSets[0].resources[0].point.coordinates[0],\n longitude: data.resourceSets[0].resources[0].point.coordinates[1]\n });\n }\n\n resolve(undefined);\n };\n\n document.body.appendChild(script);\n });\n }\n\n @action\n public async loadMapApi(input: ILoadMapApiInput): Promise {\n if (StringExtensions.isNullOrEmpty(input.key)) {\n return Promise.resolve();\n }\n\n const isScriptAlreadyLoaded = !!document?.getElementById('msdyn_map-api-script');\n\n if (isScriptAlreadyLoaded) {\n if (window) {\n const currentWindowAPI = window.mapAPIReady;\n window.mapAPIReady = () => {\n if (currentWindowAPI) {\n currentWindowAPI();\n }\n this.isMapApiLoaded = true;\n };\n }\n // Prevents from loading multiple script into the body\n return Promise.resolve();\n }\n\n const url = `${this.MAP_API_ENDPOINT}${input.key ? `&key=${input.key}` : ''}${input.lang ? `&setLang=${input.lang}` : ''}${\n input.market ? `&setMkt=${input.market}` : ''\n }`;\n\n return new Promise((resolve, reject) => {\n const script = document?.createElement('script');\n script.type = 'text/javascript';\n script.async = true;\n script.defer = true;\n script.src = url;\n script.id = 'msdyn_map-api-script';\n if (window) {\n window.mapAPIReady = () => {\n this.isMapApiLoaded = true;\n resolve();\n };\n }\n script.addEventListener('error', (error: string | Event) => {\n reject(error);\n });\n document?.body?.appendChild(script);\n });\n }\n\n private _writeToCookie(key: string, value: string | undefined): void {\n if (!key || !value) {\n return;\n }\n if (MsDyn365.isBrowser) {\n const storage = window.localStorage;\n storage.setItem(key, value);\n }\n }\n\n private _readFromToCookie(key: string): string | undefined {\n if (!key) {\n return undefined;\n }\n if (MsDyn365.isBrowser) {\n const storage = window.localStorage;\n const cookieValue = storage.getItem(key);\n if (cookieValue) {\n return cookieValue;\n }\n }\n\n return undefined;\n }\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, IActionInput, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IDistributorSelectorStateManager } from './i-distributor-selection-state-manager';\nimport { MapDistributorSelectorStateManager } from './map-distributor-selector-state-manager';\n\nexport function createDistributorSelectorStateInput(\n result: IDistributorSelectorStateManager\n): GenericInput {\n return new GenericInput('mapDSSM', result, 'IDistributorSelectorStateManager');\n}\n\nconst createDistributorSelectorStateInputInternal = (inputData: ICreateActionContext>): IActionInput => {\n return createDistributorSelectorStateInput(new MapDistributorSelectorStateManager());\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createDistributorSelectorStateInputInternal\n});\n\nexport default getGenericActionDataAction;\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 {\n ChannelReferenceLookupCriteria,\n OrderShipments,\n SalesOrder,\n SalesOrdersDataActions,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * IOrderHistory.\n */\nexport interface IOrderHistory {\n salesOrders: OrderShipments[];\n products: SimpleProduct[];\n}\n\n/**\n * Action input.\n */\nexport class GetSalesOrderDetailsByConfirmationInput implements IActionInput {\n public channelReferenceLookupCriteria: ChannelReferenceLookupCriteria | null;\n\n public confirmationId: string | undefined;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(channelReferenceLookupCriteria: ChannelReferenceLookupCriteria | null, apiSettings: ICommerceApiSettings) {\n this.channelReferenceLookupCriteria = channelReferenceLookupCriteria;\n this.apiSettings = apiSettings;\n this.confirmationId = channelReferenceLookupCriteria?.ChannelReferenceId;\n }\n\n /**\n * GetCacheKey.\n * @returns - String.\n */\n public getCacheKey = (): string => buildCacheKey(`OrderDetails-${this.confirmationId ? this.confirmationId : ''}`, this.apiSettings);\n\n /**\n * GetCacheObjectType.\n * @returns - String.\n */\n public getCacheObjectType = (): string => 'OrderDetails';\n\n /**\n * DataCacheType.\n * @returns - String.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Get sales order details by confirmation id action.\n * @param input - GetOrderHistory hydration input.\n * @param context - Channel context.\n * @returns - Sales Order Details.\n */\nexport async function getSalesOrderDetailsByChannelReferenceIdAction(\n input: GetSalesOrderDetailsByConfirmationInput,\n context: IActionContext\n): Promise {\n return SalesOrdersDataActions.getOrderByChannelReferenceLookupCriteriaAsync(\n { callerContext: context },\n input.channelReferenceLookupCriteria\n );\n}\n\n/**\n * GetSalesOrderDetailsByConfirmationIdDataAction.\n * @returns -- IObservableAction.\n */\nexport const getSalesOrderDetailsByChannelReferenceIdDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/order-lookup/get-sales-order-details-by-confirmation-id',\n action: getSalesOrderDetailsByChannelReferenceIdAction as IAction\n});\n\nexport default getSalesOrderDetailsByChannelReferenceIdDataAction;\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 isChannelTypeB2B\n} from '@msdyn365-commerce/core';\nimport {\n CatalogsDataActions,\n ChannelReferenceAdditionalLookupCriteria,\n ChannelReferenceLookupCriteria,\n ExtensibleEnumeration,\n FeatureState,\n IDictionary,\n ProductDeliveryOptions,\n ProductsDataActions,\n SalesOrder,\n SalesOrdersDataActions,\n SearchLocation,\n SimpleProduct,\n StoreOperationsDataActions,\n TransactionType,\n SalesLine\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n buildCacheKey,\n getSimpleProducts,\n ObjectExtensions,\n ProductInput,\n QueryResultSettingsProxy\n} from '@msdyn365-commerce-modules/retail-actions';\n\nimport {\n getFeatureStatesAsync,\n getOnlineChannelAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport {\n getSalesOrderDetailsByChannelReferenceIdAction,\n GetSalesOrderDetailsByConfirmationInput\n} from './get-sales-order-details-by-confirmation-id';\n/**\n * ISalesOrderWithHydrations.\n */\ninterface ISalesOrderWithHydrations {\n salesOrder: SalesOrder;\n products: SimpleProduct[];\n productDeliveryOptions?: ProductDeliveryOptions[];\n isSameSiteType?: boolean;\n}\n\n/**\n * Product and Catalog Interface.\n */\ninterface IProductCatalog {\n productId: number;\n catalogId: number | undefined;\n}\n\n/**\n * AdditionalLookupCriteria entity interface.\n */\nexport interface IAdditionalLookupCriteria {\n orderStatusLookUpParameterTypeName: string;\n orderStatusLookUpParameterValue: string;\n}\n\n/**\n * OrderTypes Types of orders.\n */\nexport enum orderTypes {\n salesOrder = 'salesOrder',\n transaction = 'transaction'\n}\n\n/**\n * GetQueryStringParameters.\n * @param context -- URL.\n * @returns Additional lookup criteria -- IAdditionalLookupCriteria[].\n */\nconst getQueryStringParameters = (context: IActionContext): IAdditionalLookupCriteria[] => {\n const addtionalLookupParameter: IAdditionalLookupCriteria[] = [];\n let query: IDictionary;\n if (context.requestContext.query) {\n query = context.requestContext.query;\n const queryArray = Object.entries(query);\n\n for (let index = 1; index <= queryArray.length; index++) {\n const additionalFieldName: string = `field${index}Name`;\n const additionalFieldValue = `field${index}Value`;\n if (additionalFieldName in query && additionalFieldValue in query) {\n addtionalLookupParameter.push({\n orderStatusLookUpParameterTypeName: query[additionalFieldName],\n orderStatusLookUpParameterValue: query[additionalFieldValue]\n });\n }\n }\n }\n return addtionalLookupParameter;\n};\n\n/**\n * Calls the Retail API and returns the sales order for anonymous user.\n * @param confirmationId -- Confirmation Id.\n * @returns SalesOrder -- Promise.\n */\nconst getSalesOrderDetailsByLookupCriteria = (confirmationId: string) => async (context: IActionContext): Promise => {\n const { propertyName = '', propertyValue = '' } = context.requestContext.query ?? {};\n\n const addtionalLookupParameter: IAdditionalLookupCriteria[] = getQueryStringParameters(context);\n\n const getExtensibleEnumerations = await StoreOperationsDataActions.getExtensibleEnumerationsAsync({ callerContext: context });\n\n const orderLookupExtensibleEnum: ExtensibleEnumeration[] =\n getExtensibleEnumerations.find(item => item.TypeName === 'OrderLookupAdditionalCriteriaType')?.ExtensibleEnumerations ?? [];\n\n const channelReferenceAdditionalLookupCriteria: ChannelReferenceAdditionalLookupCriteria[] = [];\n\n for (const item of orderLookupExtensibleEnum) {\n const retailProxyValue: string = item.Name.toLocaleLowerCase();\n const retailProxyTypeValue: number = item.Value;\n const orderLookupSearchPropertyName: string = propertyName.toLocaleLowerCase();\n if (retailProxyValue === orderLookupSearchPropertyName) {\n channelReferenceAdditionalLookupCriteria.push({\n OrderLookupAdditionalCriteriaTypeValue: item.Value,\n OrderLookupAdditionalCriteriaTypeParameterValue: propertyValue\n });\n }\n if (ArrayExtensions.hasElements(addtionalLookupParameter)) {\n for (const additionalItem of addtionalLookupParameter) {\n if (retailProxyValue === additionalItem.orderStatusLookUpParameterTypeName.toLocaleLowerCase()) {\n channelReferenceAdditionalLookupCriteria.push({\n OrderLookupAdditionalCriteriaTypeValue: retailProxyTypeValue,\n OrderLookupAdditionalCriteriaTypeParameterValue: additionalItem.orderStatusLookUpParameterValue\n });\n }\n }\n }\n }\n\n const channelReferenceLookupCriteria: ChannelReferenceLookupCriteria = {\n ChannelReferenceId: confirmationId,\n ChannelReferenceAdditionalLookupCriteria: channelReferenceAdditionalLookupCriteria\n };\n\n const input = new GetSalesOrderDetailsByConfirmationInput(channelReferenceLookupCriteria, context.requestContext.apiSettings);\n\n return getSalesOrderDetailsByChannelReferenceIdAction(input, context);\n};\n\n/**\n * Calls the Retail API and returns the sales order.\n * @param orderType -- Order Type.\n * @param orderId -- Order id.\n * @returns SalesOrder -- Promise.\n */\nconst getSalesOrder = (orderType: string = '', orderId: string = '') => async (context: IActionContext): Promise => {\n const { confirmationId = '' } = context.requestContext.query ?? {};\n\n if (confirmationId) {\n return getSalesOrderDetailsByLookupCriteria(confirmationId)(context);\n } else if (orderType === orderTypes.salesOrder) {\n return SalesOrdersDataActions.getSalesOrderDetailsBySalesIdAsync({ callerContext: context }, orderId);\n }\n\n return SalesOrdersDataActions.getSalesOrderDetailsByTransactionIdAsync({ callerContext: context }, orderId, SearchLocation.All);\n};\n\n/**\n * Calls the Retail API and returns the products.\n * @param productCatalog - The product and catalog ids of the product to retrieve.\n * @param channelId - The channel id for the products.\n * @returns Simple product data.\n */\nconst getProductsWithCatalog = (productCatalog: IProductCatalog[], channelId?: number) => async (\n context: IActionContext\n): Promise => {\n const productInputs = productCatalog.map(\n index =>\n new ProductInput(\n index.productId,\n context.requestContext.apiSettings,\n channelId,\n undefined,\n context.requestContext,\n index.catalogId\n )\n );\n return getSimpleProducts(productInputs, context);\n};\n\n/**\n * Action input.\n */\nexport class GetSalesOrderWithHydrationsInput implements IActionInput {\n public orderType: string | undefined;\n\n public orderId: string | undefined;\n\n public confirmationId: string | undefined;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n orderType: string | undefined,\n orderId: string | undefined,\n apiSettings: ICommerceApiSettings,\n confirmationId?: string\n ) {\n this.orderType = orderType;\n this.orderId = orderId;\n this.apiSettings = apiSettings;\n this.confirmationId = confirmationId;\n }\n\n /**\n * GetCacheKey.\n * @returns String.\n */\n public getCacheKey = (): string => buildCacheKey('SalesOrderWithHydrations', this.apiSettings);\n\n /**\n * GetCacheObjectType.\n * @returns String.\n */\n public getCacheObjectType = (): string =>\n `SalesOrderWithHydrations-${this.orderType ?? ''}-${this.orderId ?? ''}-${this.confirmationId ?? ''}`;\n\n /**\n * DataCacheType.\n * @returns CacheType.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- InputData as ICreateActionContext.\n * @returns Action Input.\n */\nconst createSalesOrderWithHydrationsInput = (inputData: ICreateActionContext) => {\n const { salesId = '', transactionId = '', confirmationId = '' } = inputData.requestContext.query ?? {};\n\n if (confirmationId) {\n const orderType = undefined;\n const orderId = undefined;\n return new GetSalesOrderWithHydrationsInput(orderType, orderId, inputData.requestContext.apiSettings, confirmationId);\n } else if (salesId) {\n return new GetSalesOrderWithHydrationsInput(orderTypes.salesOrder, salesId, inputData.requestContext.apiSettings);\n } else if (transactionId) {\n return new GetSalesOrderWithHydrationsInput(orderTypes.transaction, transactionId, inputData.requestContext.apiSettings);\n }\n\n throw new Error('createSalesOrderWithHydrationsInput - No salesId, confirmationId or transactionId provided.');\n};\n\n/**\n * Get sales order with hydrations action.\n * @param input -- Input.\n * @param context -- Context.\n * @returns ISalesOrderWithHydrations.\n */\nexport async function getSalesOrderWithHydrationsAction(\n input: GetSalesOrderWithHydrationsInput,\n context: IActionContext\n): Promise {\n const { orderType, orderId } = input;\n\n const { confirmationId = '' } = context.requestContext.query ?? {};\n\n if (context.requestContext.user.isAuthenticated && (!orderType || !orderId) && !confirmationId) {\n context.trace('[getSalesOrderWithHydrationsAction] No orderType or orderId or confirmationId provided.');\n return {};\n }\n\n const salesOrder = await getSalesOrder(orderType, orderId)(context);\n if (salesOrder && salesOrder.SalesLines) {\n salesOrder.SalesLines = salesOrder.SalesLines.filter((saleline: SalesLine) => !saleline.IsVoided);\n }\n\n if (!salesOrder) {\n context.trace('[getSalesOrderWithHydrationsAction] No salesOrder found.');\n return {};\n }\n\n // If it is salesInvoice, return salesOrder and empty products\n if (salesOrder.TransactionTypeValue === TransactionType.SalesInvoice) {\n return {\n salesOrder,\n products: []\n };\n }\n let isEnabled: boolean = true;\n\n if (salesOrder.ChannelId !== context.requestContext.apiSettings.channelId && salesOrder.ChannelId !== undefined) {\n context.trace('[getSalesOrderWithHydrationsAction] SalesOrder is not from current channel.');\n try {\n const channelInfo = await getOnlineChannelAsync({ callerContext: context }, salesOrder.ChannelId);\n const salesOrderChannelType = channelInfo?.OnlineStoreCustomerTypeValue;\n isEnabled = salesOrderChannelType === 1 && isChannelTypeB2B(context.requestContext);\n } catch (error) {\n console.log('Please check the channel type if it is not online, 400 expected.', error);\n }\n }\n\n if (!ArrayExtensions.hasElements(salesOrder.SalesLines)) {\n context.trace('[getSalesOrderWithHydrationsAction] No salesLine found.');\n return {};\n }\n\n const productCatalogIds: IProductCatalog[] = salesOrder.SalesLines.map(salesLine => {\n return {\n productId: salesLine.ProductId !== undefined ? salesLine.ProductId : 0,\n catalogId: salesLine.CatalogId\n };\n });\n\n if (!ArrayExtensions.hasElements(productCatalogIds)) {\n context.trace('[getSalesOrderWithHydrationsAction] No products in saleLines found.');\n return {};\n }\n\n const featureStates = await getFeatureStatesAsync({ callerContext: context }, [\n 'Dynamics.AX.Application.ChannelMultipleCatalogsFeature'\n ]);\n const isCatalogsFeatureEnabled =\n featureStates?.find((featureState: FeatureState) => featureState.Name === 'Dynamics.AX.Application.ChannelMultipleCatalogsFeature')\n ?.IsEnabled || false;\n\n let products: SimpleProduct[] = [];\n\n if (!isCatalogsFeatureEnabled) {\n products = await getProductsWithCatalog(productCatalogIds, salesOrder.ChannelId)(context);\n } else {\n // Get product catalogs for current user. Catalog ids will be stored in RecordId property of userCatalogIds.\n const userCatalogIds = await CatalogsDataActions.getCatalogsAsync(\n { callerContext: context },\n context.requestContext.apiSettings.channelId,\n true\n );\n\n // Filter productCatalogIds to get only those that are in userCatalogIds.\n const matchingProductCatalogIds = productCatalogIds.filter(productCatalogId => {\n return userCatalogIds.some(userCatalogId => userCatalogId.RecordId === productCatalogId.catalogId);\n });\n\n // Filter productCatalogIds to get only those that are NOT in userCatalogIds.\n const nonMatchingProductCatalogIds = productCatalogIds.filter(productCatalogId => {\n return userCatalogIds.some(userCatalogId => userCatalogId.RecordId !== productCatalogId.catalogId);\n });\n\n let matchingProducts: SimpleProduct[] = [];\n if (matchingProductCatalogIds.length !== 0) {\n matchingProducts = await getProductsWithCatalog(\n matchingProductCatalogIds,\n context.requestContext.apiSettings.channelId\n )(context);\n }\n\n let nonMatchingProducts: SimpleProduct[] = [];\n if (nonMatchingProductCatalogIds.length !== 0) {\n nonMatchingProducts = await getProductsWithCatalog(nonMatchingProductCatalogIds, salesOrder.ChannelId)(context);\n }\n\n products = [...matchingProducts, ...nonMatchingProducts];\n }\n\n if (!ArrayExtensions.hasElements(products)) {\n context.trace('[getSalesOrderWithHydrationsAction] No simple products found.');\n return {};\n }\n const validProducts = products.filter(product => !ObjectExtensions.isNullOrUndefined(product.RecordId));\n\n const deliveryOptions = await ProductsDataActions.getDeliveryOptionsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n validProducts.map(product => product.RecordId),\n {},\n 4\n )\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n context.trace(error.message);\n context.telemetry.exception(error);\n context.telemetry.debug('[getDeliveryOptionsForCartLineItems]Error executing action');\n throw new Error('[getDeliveryOptionsForCartLineItems]Error executing action');\n });\n\n return {\n salesOrder,\n products,\n deliveryOptions,\n isSameSiteType: isEnabled\n };\n}\n\n/**\n * GetSalesOrderWithHydrationsAction Data Action.\n * @param options -- Options.\n */\nexport const getSalesOrderWithHydrationsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-sales-order-with-hydrations',\n action: getSalesOrderWithHydrationsAction as IAction,\n input: createSalesOrderWithHydrationsInput\n});\n\nexport default getSalesOrderWithHydrationsActionDataAction;\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 { DateRefinerOptionItem } from '../common/refiner-option';\n\n/**\n * Gets the date refiner options.\n * @returns - List of refiner options.\n */\nconst getDateRefinerOptions = () => async (ctx: IActionContext): Promise => {\n return Promise.resolve([\n DateRefinerOptionItem.LastSevenDays,\n DateRefinerOptionItem.LastThirtyDays,\n DateRefinerOptionItem.LastThreeMonths,\n DateRefinerOptionItem.LastSixMonths,\n DateRefinerOptionItem.Customized\n ]);\n};\n\n/**\n * Action input.\n */\nexport class GetDateRefinerOptionsInput implements IActionInput {\n public getCacheKey = () => 'OrderHistoryWithSearchAndFiltersDateRefinerOptions';\n\n public getCacheObjectType = () => 'OrderHistoryWithSearchAndFiltersDateRefinerOptions';\n\n public dataCacheType = (): CacheType => 'instance';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Data Input.\n * @returns - Input object.\n */\nconst createGetDateRefinerOptionsInput = (inputData: ICreateActionContext>): IActionInput => {\n return new GetDateRefinerOptionsInput();\n};\n\n/**\n * Get action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - List of refiner options.\n */\nexport async function getDateRefinerOptionsAction(\n input: GetDateRefinerOptionsInput,\n context: IActionContext\n): Promise {\n if (!context) {\n throw new Error('getDateRefinerOptionsAction - Action context cannot be null/undefined');\n }\n\n let refinerOptions: DateRefinerOptionItem[] = [];\n\n try {\n refinerOptions = await getDateRefinerOptions()(context);\n } catch (error) {\n throw error;\n }\n\n return refinerOptions;\n}\n\n/**\n * Get date refiner options action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Api response.\n */\nexport const getDateRefinerOptionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-history-with-search-and-filters/get-date-refiner-options',\n action: getDateRefinerOptionsAction as IAction,\n input: createGetDateRefinerOptionsInput\n});\n\nexport default getDateRefinerOptionsActionDataAction;\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 { OrderStatusRefinerOptionItem } from '../common/refiner-option';\n\n/**\n * Gets the order status refiner options.\n * @returns - List of refiner options.\n */\nconst getOrderStatusRefinerOptions = () => async (ctx: IActionContext): Promise => {\n return Promise.resolve([\n OrderStatusRefinerOptionItem.Created,\n OrderStatusRefinerOptionItem.Invoiced,\n OrderStatusRefinerOptionItem.Canceled\n ]);\n};\n\n/**\n * Action input.\n */\nexport class GetOrderStatusRefinerOptionsInput implements IActionInput {\n public getCacheKey = () => 'OrderHistoryWithSearchAndFiltersOrderStatusRefinerOptions';\n\n public getCacheObjectType = () => 'OrderHistoryWithSearchAndFiltersOrderStatusRefinerOptions';\n\n public dataCacheType = (): CacheType => 'instance';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Data Input.\n * @returns - Input object.\n */\nconst createGetOrderStatusRefinerOptionsInput = (inputData: ICreateActionContext>): IActionInput => {\n return new GetOrderStatusRefinerOptionsInput();\n};\n\n/**\n * Get action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - List of refiner options.\n */\nexport async function getOrderStatusRefinerOptionsAction(\n input: GetOrderStatusRefinerOptionsInput,\n context: IActionContext\n): Promise {\n if (!context) {\n throw new Error('getOrderStatusRefinerOptionsAction - Action context cannot be null/undefined');\n }\n\n let refinerOptions: OrderStatusRefinerOptionItem[] = [];\n\n try {\n refinerOptions = await getOrderStatusRefinerOptions()(context);\n } catch (error) {\n throw error;\n }\n\n return refinerOptions;\n}\n\n/**\n * Get order status refiner options action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Api response.\n */\nexport const getOrderStatusRefinerOptionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-history-with-search-and-filters/get-order-status-refiner-options',\n action: getOrderStatusRefinerOptionsAction as IAction,\n input: createGetOrderStatusRefinerOptionsInput\n});\n\nexport default getOrderStatusRefinerOptionsActionDataAction;\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 { SearchOption } from '../common/search-option';\n\n/**\n * Gets the search options.\n * @returns - List of search options.\n */\nconst getSearchOptions = () => async (ctx: IActionContext): Promise => {\n return Promise.resolve([\n SearchOption.OrderNumber,\n SearchOption.ConfirmationId,\n SearchOption.ChannelName,\n SearchOption.CustomerRequisition\n ]);\n};\n\n/**\n * Action input.\n */\nexport class GetSearchOptionsInput implements IActionInput {\n public getCacheKey = () => 'OrderHistoryWithSearchAndFiltersSearchOptions';\n\n public getCacheObjectType = () => 'OrderHistoryWithSearchAndFiltersSearchOptions';\n\n public dataCacheType = (): CacheType => 'instance';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Data Input.\n * @returns - Input object.\n */\nconst createGetSearchOptionsInput = (inputData: ICreateActionContext>): IActionInput => {\n return new GetSearchOptionsInput();\n};\n\n/**\n * Get action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - List of search options.\n */\nexport async function getSearchOptionsAction(input: GetSearchOptionsInput, context: IActionContext): Promise {\n if (!context) {\n throw new Error('getSearchOptionsAction - Action context cannot be null/undefined');\n }\n\n let searchOptions: SearchOption[] = [];\n\n try {\n searchOptions = await getSearchOptions()(context);\n } catch (error) {\n throw error;\n }\n\n return searchOptions;\n}\n\n/**\n * Get search options action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Api response.\n */\nexport const getSearchOptionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-history-with-search-and-filters/get-search-options',\n action: getSearchOptionsAction as IAction,\n input: createGetSearchOptionsInput\n});\n\nexport default getSearchOptionsActionDataAction;\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 { SortOption } from '../common/sort-option';\n\n/**\n * Gets the sort options.\n * @returns - List of sort options.\n */\nconst getAllSortOptions = () => async (ctx: IActionContext): Promise => {\n return Promise.resolve([\n SortOption.CreatedDateTimeDescending,\n SortOption.CreatedDateTimeAscending,\n SortOption.ConfirmedShipDateDescending,\n SortOption.ConfirmedShipDateAscending\n ]);\n};\n\n/**\n * Gets the sort options without confirmed ship date options.\n * @returns - List of sort options.\n */\nconst getSortOptionsWithoutConfirmedShipDate = () => async (ctx: IActionContext): Promise => {\n return Promise.resolve([SortOption.CreatedDateTimeDescending, SortOption.CreatedDateTimeAscending]);\n};\n\n/**\n * Action input.\n */\nexport class GetSortOptionsInput implements IActionInput {\n public allowSortingByConfirmedShipDate: boolean;\n\n constructor(allowSortingByConfirmedShipDate: boolean) {\n this.allowSortingByConfirmedShipDate = allowSortingByConfirmedShipDate;\n }\n\n public getCacheKey = () => 'OrderHistoryWithSearchAndFiltersSortOptions';\n\n public getCacheObjectType = () => 'OrderHistoryWithSearchAndFiltersSortOptions';\n\n public dataCacheType = (): CacheType => 'instance';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Action Data Input.\n * @returns - Input object.\n */\nconst createGetSortOptionsInput = (inputData: ICreateActionContext>): IActionInput => {\n return new GetSortOptionsInput(inputData.config?.showConfirmedShipDateSortingOptions || false);\n};\n\n/**\n * Get action.\n * @param input - Input data.\n * @param context - Action context.\n * @returns - List of sort options.\n */\nexport async function getSortOptionsAction(input: GetSortOptionsInput, context: IActionContext): Promise {\n if (!context) {\n throw new Error('getSortOptionsAction - Action context cannot be null/undefined');\n }\n\n let sortOptions: SortOption[] = [];\n\n try {\n sortOptions = input.allowSortingByConfirmedShipDate\n ? await getAllSortOptions()(context)\n : await getSortOptionsWithoutConfirmedShipDate()(context);\n } catch (error) {\n throw error;\n }\n\n return sortOptions;\n}\n\n/**\n * Get sort options action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Api response.\n */\nexport const getSortOptionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-history-with-search-and-filters/get-sort-options',\n action: getSortOptionsAction as IAction,\n input: createGetSortOptionsInput\n});\n\nexport default getSortOptionsActionDataAction;\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 IRequestContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport {\n buildCacheKeyWithUrlTokens,\n getFullOrderTemplate,\n GetFullOrderTemplateInput,\n IQueryResultSettingsModuleConfig,\n OrderTemplate,\n QueryResultSettingsProxy\n} from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for getActiveOrderTemplateLines data action.\n */\nexport class ActiveOrderTemplateLinesInput implements IActionInput {\n public requestContext: IRequestContext;\n\n public orderTemplateId: string;\n\n public queryResultSettings: IQueryResultSettings;\n\n constructor(requestContext: IRequestContext, config: IQueryResultSettingsModuleConfig) {\n if (!requestContext.query?.id) {\n throw new Error('Failed to get order template id from the query.');\n }\n if (!config) {\n throw new Error('Failed to get order template module configuration');\n }\n this.orderTemplateId = requestContext.query.id;\n this.queryResultSettings = QueryResultSettingsProxy.fromModuleData(requestContext, config).QueryResultSettings;\n\n this.queryResultSettings.count = true;\n this.requestContext = requestContext;\n }\n\n public getCacheKey = (): string => buildCacheKeyWithUrlTokens('ActiveOrderTemplateLines', this.requestContext);\n\n public getCacheObjectType = (): string => 'ActiveOrderTemplateLines';\n\n public dataCacheType = (): CacheType => 'instance';\n\n public shouldCacheOutput = () => false;\n}\n\n/**\n * Calls the Retail API and returns a ProductList object based on the passed GetCartInput.\n * @param input\n * @param context\n */\nexport async function getActiveOrderTemplateLines(input: ActiveOrderTemplateLinesInput, context: IActionContext): Promise {\n return getFullOrderTemplate(new GetFullOrderTemplateInput(input.orderTemplateId, input.queryResultSettings), context);\n}\n\nexport const getActiveOrderTemplateLinesDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-template/order-template/get-order-template-lines',\n action: >getActiveOrderTemplateLines,\n input: (context: ICreateActionContext) => {\n if (!context.config) {\n throw new Error('Failed to get order template module configuration');\n }\n return new ActiveOrderTemplateLinesInput(context.requestContext, context.config);\n }\n});\n\nexport default getActiveOrderTemplateLinesDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { IMSDyn365Window } from '@msdyn365-commerce/core-internal';\nimport { Cart, CartLine, IAddCartLinesParam, IDataServiceRequest } from '@msdyn365-commerce/retail-proxy';\nimport { IProductInfo, TelemetryEvent } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromCartLinesAsync } from './telemetry.action.helper';\n\ndeclare let window: IMSDyn365Window;\n\n/**\n * Saves info on cart lines added before calling data action\n * @param inputs Data action inputs\n * @param actionContext Action context\n */\nconst beforeAddToCart = async (inputs: IActionInput | IActionInput[], actionContext: IActionContext) => {\n try {\n const actionInput = Array.isArray(inputs) ? inputs[0] : inputs;\n\n // If cart lines were added\n if (actionInput.queryParams && typeof actionInput.queryParams === 'function') {\n const addCartLinesParams = actionInput.queryParams();\n if (addCartLinesParams && addCartLinesParams.cartLines) {\n // Save info on added cart lines for post data action hook to pick up\n actionContext.requestContext.telemetryData.addedCartLines = addCartLinesParams.cartLines;\n return;\n }\n }\n actionContext.telemetry.debug('AddToCart pre-data action hook failed - No added cart lines found');\n } catch (e) {\n actionContext.telemetry.debug('AddToCart pre-data action hook failed.', e);\n }\n};\n\n/**\n * Fires an AddToCart event after AddCartLines data action completed\n * @param _inputs Data action inputs\n * @param cart New cart object after cart lines have been added\n * @param actionContext Action context\n */\nconst afterAddToCart = async (_inputs: IActionInput | IActionInput[], cart: Cart | Cart[], actionContext: IActionContext) => {\n if (window && window._msdyn365 && window._msdyn365.telemetry) {\n const cartObject = Array.isArray(cart) ? cart[0] : cart;\n const addedCartLines = actionContext.requestContext.telemetryData.addedCartLines;\n let addedProducts: IProductInfo[] = [];\n\n // Collect info on products added to cart\n if (addedCartLines) {\n try {\n addedProducts = await getProductInfoFromCartLinesAsync(addedCartLines, actionContext);\n } catch (error) {\n actionContext.telemetry.error('AddCartLines post-data action hook failed to process cart lines.', error);\n }\n }\n\n // Fire AddToCart event\n window._msdyn365.telemetry.logEvent(TelemetryEvent.AddToCart, {\n cartId: cartObject.Id,\n cartVersion: cartObject.Version ? cartObject.Version.toString() : '',\n products: addedProducts,\n orderId: cartObject.OrderNumber ? cartObject.OrderNumber.toString() : ''\n });\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/AddCartLines',\n postReaderHook: afterAddToCart,\n preReaderHook: beforeAddToCart\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput, IMSDyn365Window } from '@msdyn365-commerce/core';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\nimport { IProductInfo, TelemetryEvent } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromCartLinesAsync } from './telemetry.action.helper';\n\ndeclare let window: IMSDyn365Window;\n\n/**\n * CopyCart data action pre-hook\n * @param inputs Data action inputs\n */\nconst beforeCopyCart = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\n/**\n * Fires an CheckOut event after CopyCart data action completed\n * @param _inputs Data action inputs\n * @param cart New checkout cart\n * @param actionContext Action context\n */\nconst afterCopyCart = async (_inputs: IActionInput | IActionInput[], cart: Cart | Cart[], actionContext: IActionContext) => {\n if (window && window._msdyn365 && window._msdyn365.telemetry) {\n const cartObject = Array.isArray(cart) ? cart[0] : cart;\n let cartLineProductUnits: IProductInfo[] = [];\n\n // Collect info on products in the cart\n if (cartObject && cartObject.CartLines && Array.isArray(cartObject.CartLines) && cartObject.CartLines.length > 0) {\n try {\n cartLineProductUnits = await getProductInfoFromCartLinesAsync(cartObject.CartLines, actionContext);\n } catch (error) {\n actionContext.telemetry.error('CopyCart post-data action hook failed to process cart lines.', error);\n }\n }\n\n // Fire Checkout event\n window._msdyn365.telemetry.logEvent(TelemetryEvent.CheckOut, {\n cartId: cartObject.Id,\n cartVersion: cartObject.Version ? cartObject.Version.toString() : '',\n products: cartLineProductUnits,\n orderId: cartObject.OrderNumber ? cartObject.OrderNumber.toString() : ''\n });\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/Copy',\n postReaderHook: afterCopyCart,\n preReaderHook: beforeCopyCart\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { TelemetryEvent } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromSimpleProduct } from './telemetry.action.helper';\n\nconst beforeGetById = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\nconst afterGetById = async (\n _inputs: IActionInput | IActionInput[],\n simpleProduct: SimpleProduct | SimpleProduct[],\n actionContext: IActionContext\n) => {\n simpleProduct = await Promise.resolve(Array.isArray(simpleProduct) ? simpleProduct[0] : simpleProduct);\n\n // If simple product result is defined run the post hook\n if (simpleProduct) {\n const productInfo = getProductInfoFromSimpleProduct(simpleProduct);\n actionContext.requestContext.telemetryData[productInfo.productSku] = productInfo;\n actionContext.requestContext.telemetryData[TelemetryEvent.ProductPageView] = productInfo ? [productInfo] : [];\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Products/GetById',\n postReaderHook: afterGetById,\n preReaderHook: beforeGetById\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getProductInfoFromSimpleProduct } from './telemetry.action.helper';\n\nconst beforeGetByIds = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\nconst afterGetByIds = async (\n _inputs: IActionInput | IActionInput[],\n simpleProducts: SimpleProduct | SimpleProduct[],\n actionContext: IActionContext\n) => {\n if (!Array.isArray(simpleProducts)) {\n simpleProducts = [simpleProducts];\n }\n\n simpleProducts.forEach(async product => {\n if (product) {\n product = await Promise.resolve(product);\n const productInfo = getProductInfoFromSimpleProduct(product);\n actionContext.requestContext.telemetryData[productInfo.productSku] = productInfo;\n }\n });\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Products/GetByIds',\n postReaderHook: afterGetByIds,\n preReaderHook: beforeGetByIds\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getProductInfoFromSimpleProduct } from './telemetry.action.helper';\n\nconst beforeGetVariantsByDimensionValues = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\nconst afterGetVariantsByDimensionValues = async (\n _inputs: IActionInput | IActionInput[],\n simpleProducts: SimpleProduct | SimpleProduct[],\n actionContext: IActionContext\n) => {\n if (!Array.isArray(simpleProducts)) {\n simpleProducts = [simpleProducts];\n }\n\n simpleProducts.forEach(async product => {\n if (product) {\n product = await Promise.resolve(product);\n const productInfo = getProductInfoFromSimpleProduct(product);\n actionContext.requestContext.telemetryData[productInfo.productSku] = productInfo;\n }\n });\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Products/GetVariantsByDimensionValues',\n postReaderHook: afterGetVariantsByDimensionValues,\n preReaderHook: beforeGetVariantsByDimensionValues\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput, IMSDyn365Window } from '@msdyn365-commerce/core';\nimport { SalesOrder } from '@msdyn365-commerce/retail-proxy';\nimport { IProductInfo, IProductTransaction, TelemetryEvent } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromCartLinesAsync } from './telemetry.action.helper';\n\ndeclare let window: IMSDyn365Window;\n\n/**\n * Checkout data action pre-hook\n * @param inputs Data action inputs\n */\nconst beforePurchase = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\n/**\n * Fires a Purchase event after Checkout data action completed\n * @param _inputs Data action inputs\n * @param salesOrder Sales order for transaction\n * @param actionContext Action context\n */\nconst afterPurchase = async (\n _inputs: IActionInput | IActionInput[],\n salesOrder: SalesOrder | SalesOrder[],\n actionContext: IActionContext\n) => {\n if (window && window._msdyn365 && window._msdyn365.telemetry) {\n const salesObject = Array.isArray(salesOrder) ? salesOrder[0] : salesOrder;\n let saleLineProductUnits: IProductInfo[] = [];\n\n // Collect info on products in the sales order\n if (salesObject && salesObject.SalesLines && Array.isArray(salesObject.SalesLines) && salesObject.SalesLines.length > 0) {\n try {\n saleLineProductUnits = await getProductInfoFromCartLinesAsync(salesObject.SalesLines, actionContext);\n } catch (error) {\n actionContext.telemetry.error('Checkout post-data action hook failed to process cart lines.', error);\n }\n }\n\n // Store the purchased product information so that we can avoid \"code triggered\" remove from cart telemetry event.\n actionContext.requestContext.telemetryData[TelemetryEvent.Purchase] = {\n id: salesObject.Id,\n affiliation: salesObject.ChannelId ? salesObject.ChannelId.toString() : '',\n revenue: salesObject.NetAmountWithoutTax,\n tax: salesObject.TaxAmount,\n // shippingCost?: // Confirm if it is delivery mode charge amount;\n products: saleLineProductUnits\n };\n\n // Fire Purchase event\n window._msdyn365.telemetry.logEvent(\n TelemetryEvent.Purchase,\n actionContext.requestContext.telemetryData[TelemetryEvent.Purchase]\n );\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/Checkout',\n postReaderHook: afterPurchase,\n preReaderHook: beforePurchase\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\n\nconst beforeRead = async (inputs: IActionInput | IActionInput[]) => {\n // placeholder\n};\n\nconst afterRead = async (_inputs: IActionInput | IActionInput[], cart: Cart | Cart[], actionContext: IActionContext) => {\n try {\n const activeCart = await Promise.resolve(Array.isArray(cart) ? cart[0] : cart);\n actionContext.requestContext.telemetryData.activeCart = activeCart;\n } catch (e) {\n actionContext.telemetry.debug('ReadCart post-data action hook failed.', e);\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/Read',\n postReaderHook: afterRead,\n preReaderHook: beforeRead\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput, IMSDyn365Window, TelemetryEvent } from '@msdyn365-commerce/core';\nimport { Cart, CartLine, IDataServiceRequest, IRemoveCartLinesParam } from '@msdyn365-commerce/retail-proxy';\nimport { IProductInfo, IProductTransaction } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromCartLinesAsync } from './telemetry.action.helper';\n\ndeclare let window: IMSDyn365Window;\n\n/**\n * Saves info on cart lines removed before calling data action\n * @param inputs Data action inputs\n * @param actionContext Action context\n */\nconst beforeRemoveFromCart = async (inputs: IActionInput | IActionInput[], actionContext: IActionContext) => {\n try {\n const actionInput = Array.isArray(inputs) ? inputs[0] : inputs;\n\n // If cart lines were removed\n if (actionInput.queryParams && typeof actionInput.queryParams === 'function') {\n const removeCartLinesParams = actionInput.queryParams();\n if (removeCartLinesParams && removeCartLinesParams.cartLineIds) {\n // Save info on removed cart lines for post data action hook to pick up\n actionContext.requestContext.telemetryData.removedCartLineIds = removeCartLinesParams.cartLineIds;\n return;\n }\n }\n actionContext.telemetry.debug('RemoveFromCart pre-data action hook failed - No removed cart lines found');\n } catch (e) {\n actionContext.telemetry.debug('RemoveFromCart pre-data action hook failed.', e);\n }\n};\n\n/**\n * Fires a RemoveFromCart event after RemoveCartLines data action completed\n * @param _inputs Data action inputs\n * @param cart New cart object after cart lines have been removed\n * @param actionContext Action context\n */\nconst afterRemoveFromCart = async (_inputs: IActionInput | IActionInput[], cart: Cart | Cart[], actionContext: IActionContext) => {\n if (window && window._msdyn365 && window._msdyn365.telemetry) {\n const cartObject = Array.isArray(cart) ? cart[0] : cart;\n const removeCartLineIds = actionContext.requestContext.telemetryData.removedCartLineIds;\n const activeCart = actionContext.requestContext.telemetryData.activeCart;\n const productTransaction = actionContext.requestContext.telemetryData[TelemetryEvent.Purchase];\n const removedCartLines: CartLine[] = [];\n let removedProducts: IProductInfo[] = [];\n\n // Collect info on products removed from cart\n if (removeCartLineIds && activeCart && activeCart.CartLines) {\n activeCart.CartLines.forEach((cartLine: CartLine) => {\n if (\n cartLine.ProductId &&\n removeCartLineIds.indexOf(cartLine.LineId ? cartLine.LineId : '') !== -1 &&\n !(\n productTransaction &&\n productTransaction.products &&\n productTransaction.products.some(product => +product.productSku === cartLine.ProductId)\n )\n ) {\n removedCartLines.push(cartLine);\n }\n });\n\n if (removedCartLines.length > 0) {\n try {\n removedProducts = await getProductInfoFromCartLinesAsync(removedCartLines, actionContext);\n } catch (error) {\n actionContext.telemetry.error('RemoveCartLines post-data action hook failed to process cart lines.', error);\n }\n }\n }\n\n // Fire RemoveFromCart event if cart lines were removed\n if (removedCartLines && removedCartLines.length > 0) {\n window._msdyn365.telemetry.logEvent(TelemetryEvent.RemoveFromCart, {\n cartId: cartObject.Id,\n cartVersion: cartObject.Version ? cartObject.Version.toString() : '',\n products: removedProducts,\n orderId: cartObject.OrderNumber ? cartObject.OrderNumber.toString() : ''\n });\n } else {\n actionContext.telemetry.debug('No RemoveFromCart event fired, no removed cart lines found');\n }\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/RemoveCartLines',\n postReaderHook: afterRemoveFromCart,\n preReaderHook: beforeRemoveFromCart\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createDataActionHook, IActionContext, IActionInput, TelemetryEvent } from '@msdyn365-commerce/core';\nimport { IMSDyn365Window } from '@msdyn365-commerce/core-internal';\nimport { Cart, CartLine, IDataServiceRequest, IUpdateCartLinesParam } from '@msdyn365-commerce/retail-proxy';\nimport { IProductInfo } from '@msdyn365-commerce/telemetry-internal';\nimport { getProductInfoFromCartLinesAsync } from './telemetry.action.helper';\n\ndeclare let window: IMSDyn365Window;\n\n/**\n * Saves info on cart lines updated before calling data action\n * @param inputs Data action inputs\n * @param actionContext Action context\n */\nconst beforeUpdateCart = async (inputs: IActionInput | IActionInput[], actionContext: IActionContext) => {\n try {\n const actionInput = Array.isArray(inputs) ? inputs[0] : inputs;\n\n // If cart lines were updated\n if (actionInput.queryParams && typeof actionInput.queryParams === 'function') {\n const updateCartLinesParams = actionInput.queryParams();\n if (updateCartLinesParams && updateCartLinesParams.cartLines) {\n // Save info on updated cart lines for post data action hook to pick up\n actionContext.requestContext.telemetryData.updatedCartLines = updateCartLinesParams.cartLines;\n return;\n }\n }\n actionContext.telemetry.debug('UpdateCart pre-data action hook failed - No updated cart lines found');\n } catch (e) {\n actionContext.telemetry.debug('UpdateCart pre-data action hook failed.', e);\n }\n};\n\n/**\n * Fires an UpdateInCart event after UpdateCartLines data action completed\n * @param _inputs Data action inputs\n * @param cart New cart object after cart lines have been added\n * @param actionContext Action context\n */\nconst afterUpdateCart = async (_inputs: IActionInput | IActionInput[], cart: Cart | Cart[], actionContext: IActionContext) => {\n if (window && window._msdyn365 && window._msdyn365.telemetry) {\n const cartObject = Array.isArray(cart) ? cart[0] : cart;\n const updatedCartLines = actionContext.requestContext.telemetryData.updatedCartLines;\n let updatedProducts: IProductInfo[] = [];\n\n // Collect info on products updated in cart\n if (updatedCartLines) {\n try {\n updatedProducts = await getProductInfoFromCartLinesAsync(updatedCartLines, actionContext);\n } catch (error) {\n actionContext.telemetry.error('UpdateCartLines post-data action hook failed to process cart lines.', error);\n }\n }\n\n // Fire UpdateInCart event\n window._msdyn365.telemetry.logEvent(TelemetryEvent.UpdateInCart, {\n cartId: cartObject.Id,\n cartVersion: cartObject.Version ? cartObject.Version.toString() : '',\n products: updatedProducts,\n orderId: cartObject.OrderNumber ? cartObject.OrderNumber.toString() : ''\n });\n }\n};\n\ncreateDataActionHook({\n actionId: '@msdyn365-commerce/retail-proxy/Carts/UpdateCartLines',\n postReaderHook: afterUpdateCart,\n preReaderHook: beforeUpdateCart\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 getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductLookupClause, ProductsDataActions, ProductSearchCriteria, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport { ArrayExtensions, validateCatalogId } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IActiveImageConfig, IActivePointsData } from '../active-image';\n\n/**\n * ActiveImageInput.\n */\nexport class ActiveImageInput implements IActionInput {\n public config: IActiveImageConfig;\n\n private readonly _cacheKey: string = 'ActiveImage';\n\n public constructor(config: IActiveImageConfig) {\n this.config = config;\n\n if (this.config.activePoints && ArrayExtensions.hasElements(this.config.activePoints)) {\n for (const activePointData of this.config.activePoints) {\n if (activePointData.itemId) {\n this._cacheKey = `${this._cacheKey}-${activePointData.itemId.toString()}`;\n }\n }\n }\n }\n\n /**\n * GetCacheObjectType.\n * @returns - Returns string.\n */\n public getCacheObjectType = (): string => 'ActiveImageFullProductSearchResult';\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => this._cacheKey;\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput.\n * @param inputData - IActionContext.\n * @returns - IActionInput.\n */\nexport const createInput = (inputData: ICreateActionContext): IActionInput => {\n return new ActiveImageInput(inputData.config as IActiveImageConfig);\n};\n\n/**\n * Action.\n * @param input - ActiveImageInput.\n * @param context - IActionContext.\n * @returns - ProductSearchResult[].\n */\nexport const getActiveImageproductAction = async (input: ActiveImageInput, context: IActionContext): Promise => {\n const { config } = input;\n const itemIds: ProductLookupClause[] = [];\n if (config.activePoints) {\n config.activePoints.map((activePointData: IActivePointsData) => itemIds.push({ ItemId: activePointData.itemId }));\n }\n const searchCriteriaInput: ProductSearchCriteria = {};\n const catalogId = getCatalogId(context.requestContext);\n validateCatalogId(catalogId);\n\n searchCriteriaInput.Context = {\n ChannelId: context.requestContext.apiSettings.channelId,\n CatalogId: catalogId\n };\n if (process.env.NODE_ENV === 'development' && process.env.ENABLE_CLOUD_SEARCH?.toLowerCase() !== 'true') {\n searchCriteriaInput.IncludeAttributes = false;\n } else {\n searchCriteriaInput.IncludeAttributes = true;\n }\n searchCriteriaInput.ItemIds = itemIds;\n if (!config.activePoints || !ArrayExtensions.hasElements(config.activePoints)) {\n throw new Error('Fail to call ActiveImage API no active points configured.');\n }\n // eslint-disable-next-line no-return-await -- Disable because we want to return the promise.\n return await ProductsDataActions.searchByCriteriaAsync({ callerContext: context }, searchCriteriaInput);\n};\n\n/**\n * Action.\n * @param id - Id.\n * @param action - Action.\n * @returns - Results.\n */\nexport const actionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/active-image/get-active-image-products',\n action: getActiveImageproductAction as IAction,\n input: createInput\n});\n\nexport default actionDataAction;\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 isEmptyOrNullObject\n} from '@msdyn365-commerce/core';\nimport { getCheckoutState, ICheckoutState } from '@msdyn365-commerce/global-state';\nimport { CardPaymentAcceptPoint, CartsDataActions } from '@msdyn365-commerce/retail-proxy';\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\nimport { get } from 'lodash';\n\n/**\n * Get card payment accept point input.\n */\nexport interface IGetCardPaymentAcceptPointInput {\n shouldShowBillingAddress?: boolean;\n paymentTenderType?: string;\n apiSettings: ICommerceApiSettings;\n amountDue?: number;\n}\n\n/**\n * GetCardPaymentAcceptPointInput - Input for create GetCardPaymentAcceptPoint.\n */\nexport class GetCardPaymentAcceptPointInput implements IActionInput {\n public shouldShowBillingAddress?: boolean;\n\n public paymentTenderType?: string;\n\n public amountDue?: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility -- Existing code.\n constructor(input: IGetCardPaymentAcceptPointInput) {\n this.shouldShowBillingAddress = input.shouldShowBillingAddress;\n this.paymentTenderType = input.paymentTenderType;\n this.apiSettings = input.apiSettings;\n this.amountDue = input.amountDue;\n }\n\n /**\n * Get the cache key.\n * @returns Cache key.\n */\n public getCacheKey = (): string => buildCacheKey(`CardPaymentAcceptPoint-apple-pay`, this.apiSettings);\n\n /**\n * Get cache object type.\n * @returns Card payment accept point.\n */\n public getCacheObjectType = (): string => 'CardPaymentAcceptPoint';\n\n /**\n * Get data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create checkout apple pay input.\n * @param inputData - Get card payment accept point.\n * @returns CardPaymentAcceptInput.\n */\nexport const createCheckoutPaymentInstrumentInput = (\n inputData: ICreateActionContext\n): GetCardPaymentAcceptPointInput => {\n const { shouldShowBillingAddress, paymentTenderType, amountDue } = inputData.config ?? {};\n const getCardPaymentAcceptPointInput = {\n shouldShowBillingAddress,\n paymentTenderType,\n apiSettings: inputData.requestContext.apiSettings,\n amountDue\n };\n\n return new GetCardPaymentAcceptPointInput(getCardPaymentAcceptPointInput);\n};\n\n/**\n * Calls the Retail API and returns a cart object based on the passed GetCartInput.\n * @param input - The get card payment accept point.\n * @param ctx - The action context.\n * @returns CardPaymentAcceptPoint.\n */\nexport async function getCardPaymentAcceptPointAction(\n input: GetCardPaymentAcceptPointInput,\n ctx: IActionContext\n): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Double check.\n if (!input) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing'));\n throw new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing');\n }\n\n const { paymentTenderType = 'applepay', amountDue = 0 } = input;\n const checkoutState: ICheckoutState = await getCheckoutState(ctx).catch((error: Error) => {\n ctx.telemetry.exception(error);\n throw error;\n });\n\n if (\n isEmptyOrNullObject(checkoutState) ||\n isEmptyOrNullObject(checkoutState.checkoutCart) ||\n isEmptyOrNullObject(checkoutState.checkoutCart.cart)\n ) {\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Unable to get cart'));\n throw new Error('[getCardPaymentAcceptPointAction] Unable to get cart');\n }\n\n // if (!checkoutState.checkoutCart.cart.CartLines || !ArrayExtensions.hasElements(checkoutState.checkoutCart.cart.CartLines)) {\n // ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Cart is empty'));\n // throw new Error('[getCardPaymentAcceptPointAction] Cart is empty');\n // }\n\n const requestUrl =\n typeof ctx.requestContext.url.requestUrl === 'string'\n ? new URL(ctx.requestContext.url.requestUrl)\n : ctx.requestContext.url.requestUrl;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Existing code.\n const origin = get(window, 'location.origin') || requestUrl.origin;\n\n const cardPaymentAcceptSettings = {\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardPaymentAcceptSettings',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Any type.\n HostPageOrigin: origin,\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-assignment -- Any type.\n AdaptorPath: `${origin}/Connectors/` || origin,\n CardPaymentEnabled: false,\n CardTokenizationEnabled: true,\n HideBillingAddress: true,\n ...(paymentTenderType && { TenderTypeId: paymentTenderType }),\n PaymentAmount: amountDue !== 0 ? amountDue : checkoutState.checkoutCart.cart.AmountDue ?? 0,\n RequireShippingAddress: true\n };\n\n return CartsDataActions.getCardPaymentAcceptPointAsync(\n { callerContext: ctx, bypassCache: 'get' },\n checkoutState.checkoutCart.cart.Id,\n cardPaymentAcceptSettings,\n []\n )\n .then(cardPaymentAcceptPoint => {\n if (!cardPaymentAcceptPoint.AcceptPageUrl && !cardPaymentAcceptPoint.AcceptPageContent) {\n throw new Error(\n '[getCardPaymentAcceptPointAction]Payment Accept Page has neither return AcceptPageUrl nor AcceptPageContent in updatePaymentAcceptPageData'\n );\n }\n return cardPaymentAcceptPoint;\n })\n .catch(error => {\n ctx.telemetry.exception(error as Error);\n ctx.telemetry.debug('Unable to get Card Payment Accept Point');\n throw error;\n });\n}\n\n/**\n * Get card payment accept point.\n */\nexport const getCardPaymentAcceptPointActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce/checkout-apple-pay/get-card-payment-accept-point',\n action: getCardPaymentAcceptPointAction as IAction,\n input: createCheckoutPaymentInstrumentInput\n});\n\nexport default getCardPaymentAcceptPointActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { getCheckoutState } from '@msdyn365-commerce/global-state';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getSimpleProducts, ProductInput } from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Input class for ActiveCheckoutCartWithProductsDetails data action.\n */\nexport class ActiveCheckoutCartProductsDetailsInput implements IActionInput {\n public getCacheKey = () => 'ActiveCheckoutCartProducts';\n\n public getCacheObjectType = () => 'ActiveCheckoutCartProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createCartInput = () => {\n return new ActiveCheckoutCartProductsDetailsInput();\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 getActiveCheckoutCartProductsDetailsAction(\n input: ActiveCheckoutCartProductsDetailsInput,\n ctx: IActionContext\n): Promise {\n // Check if the input is valid\n if (!input) {\n ctx.telemetry.exception(new Error('[getActiveCheckoutCartWithProductsDetails]No valid Input was provided, failing'));\n throw new Error('[getActiveCheckoutCartWithProductsDetails]No valid Input was provided, failing');\n }\n\n const checkoutState = await getCheckoutState(ctx);\n const cart = checkoutState.checkoutCart.cart;\n\n // If there are cart lines, make call to get products\n if (!checkoutState.checkoutCart.hasInvoiceLine && cart && cart.CartLines && cart.CartLines.length > 0) {\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 => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n throw new Error('[getActiveCheckoutCartWithProductsDetails]Unable to hydrate cart with product information');\n });\n }\n\n return [];\n}\n\nexport const getActiveCheckoutCartProductsDetailsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/checkout/get-products-details-in-active-checkout-cart',\n action: >getActiveCheckoutCartProductsDetailsAction,\n input: createCartInput\n});\n\nexport default getActiveCheckoutCartProductsDetailsActionDataAction;\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 { ProductDeliveryOptions, SalesOrder, SimpleProduct, TransactionType } from '@msdyn365-commerce/retail-proxy';\nimport { getDeliveryOptionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n getSalesOrderDetailsBySalesIdAsync,\n getSalesOrderDetailsByTransactionIdAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/SalesOrdersDataActions.g';\nimport {\n ArrayExtensions,\n buildCacheKey,\n getSimpleProducts,\n ObjectExtensions,\n ProductInput,\n QueryResultSettingsProxy\n} from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Sales order response interface.\n */\ninterface ISalesOrderWithHydrations {\n salesOrder: SalesOrder;\n products: SimpleProduct[];\n productDeliveryOptions?: ProductDeliveryOptions[];\n}\n\n/**\n * OrderTypes Types of orders.\n */\nexport enum orderTypes {\n salesOrder = 'salesOrder',\n transaction = 'transaction'\n}\n\n/**\n * Calls the Retail API and returns the sales order.\n * @param orderType - OrderType.\n * @param orderId - Unique OrderId for each order.\n * @returns Sales Order.\n */\nconst getSalesOrder = (orderType: string = '', orderId: string = '') => async (\n context: IActionContext\n): Promise => {\n // Local (1) searches the retail server database, and remote (2) searches\n // on the headquarters side. All (3) and none (0) are not supported.\n const localSearch = 1;\n return orderType === orderTypes.salesOrder\n ? getSalesOrderDetailsBySalesIdAsync({ callerContext: context }, orderId)\n : getSalesOrderDetailsByTransactionIdAsync({ callerContext: context }, orderId, localSearch);\n};\n\n/**\n * Calls the Retail API and returns the products.\n * @param productIds - The product ids of the product to retrieve.\n * @param channelId - The channel id for the products.\n * @returns Simple product data.\n */\nconst getProducts = (productIds: (string | number)[] = [], channelId?: number) => async (\n context: IActionContext\n): Promise => {\n const productInputs = productIds.map(\n productId => new ProductInput(productId, context.requestContext.apiSettings, channelId, undefined, context.requestContext)\n );\n return getSimpleProducts(productInputs, context);\n};\n\n/**\n * Action input.\n */\nexport class GetSalesOrderConfirmationWithHydrationsInput implements IActionInput {\n public orderType: string;\n\n public orderId: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(orderType: string, orderId: string, apiSettings: ICommerceApiSettings) {\n this.orderType = orderType;\n this.orderId = orderId;\n this.apiSettings = apiSettings;\n }\n\n /**\n * Get cache key.\n * @returns String.\n */\n public getCacheKey = () => buildCacheKey('SalesOrderConfirmationWithHydrations', this.apiSettings);\n\n /**\n * Get cache object.\n * @returns String.\n */\n public getCacheObjectType = () => `SalesOrderConfirmationWithHydrations-${this.orderType}-${this.orderId}`;\n\n /**\n * Get cache data type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - Actioncontext data.\n * @returns Sales Order Input.\n */\nconst createSalesOrderConfrimationWithHydrationsInput = (inputData: ICreateActionContext) => {\n const { salesId = '', transactionId = '' } = inputData.requestContext.query || {};\n if (salesId) {\n return new GetSalesOrderConfirmationWithHydrationsInput(orderTypes.salesOrder, salesId, inputData.requestContext.apiSettings);\n } else if (transactionId) {\n return new GetSalesOrderConfirmationWithHydrationsInput(\n orderTypes.transaction,\n transactionId,\n inputData.requestContext.apiSettings\n );\n }\n throw new Error('createSalesOrderConfrimationWithHydrationsInput - No salesId or transactionId provided.');\n};\n\n/**\n * Get sales order with hydrations action.\n * @param input - Input for data action.\n * @param context - Action context.\n * @returns Sales order response.\n */\nexport async function getSalesOrderConfirmationWithHydrationsAction(\n input: GetSalesOrderConfirmationWithHydrationsInput,\n context: IActionContext\n): Promise {\n if (!context) {\n throw new Error('getSalesOrderConfirmationWithHydrationsAction - Action context cannot be null/undefined');\n }\n\n const { orderType, orderId } = input;\n\n if (!orderType || !orderId) {\n context.trace('[getSalesOrderConfirmationWithHydrationsAction] No orderType or orderId provided.');\n return {};\n }\n\n const salesOrder = await getSalesOrder(orderType, orderId)(context);\n\n if (!salesOrder) {\n context.trace('[getSalesOrderWithHydrationsAction] No salesOrder found.');\n return {};\n }\n\n // If it is salesInvoice, return salesOrder and empty products\n if (salesOrder.TransactionTypeValue === TransactionType.SalesInvoice) {\n return {\n salesOrder,\n products: []\n };\n }\n\n if (!ArrayExtensions.hasElements(salesOrder.SalesLines)) {\n context.trace('[getSalesOrderWithHydrationsAction] No salesLine found.');\n return {};\n }\n\n const productIds = salesOrder.SalesLines.map(salesLine => salesLine.ProductId ?? '');\n\n if (!ArrayExtensions.hasElements(productIds)) {\n context.trace('[getSalesOrderWithHydrationsAction] No products in saleLines found.');\n return {};\n }\n\n const products = await getProducts(productIds, salesOrder.ChannelId)(context);\n\n if (!ArrayExtensions.hasElements(products)) {\n context.trace('[getSalesOrderWithHydrationsAction] No simple products found.');\n return {};\n }\n\n const validProducts = products.filter(product => !ObjectExtensions.isNullOrUndefined(product.RecordId));\n const filterPickup = 4;\n const deliveryOptions = await getDeliveryOptionsAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n validProducts.map(product => product.RecordId),\n {},\n filterPickup\n )\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n context.trace(error.message);\n context.telemetry.exception(error);\n context.telemetry.debug('[getDeliveryOptionsForCartLineItems]Error executing action');\n throw new Error('[getDeliveryOptionsForCartLineItems]Error executing action');\n });\n\n return {\n salesOrder,\n products,\n deliveryOptions\n };\n}\n\n/**\n * Get sales order with hydrations action.\n * @param id - Unique Id for data action.\n * @param context - Action context.\n * @param input - Input for data action.\n * @returns Sales order response.\n */\nexport const getSalesOrderConfirmationWithHydrationsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/order-management/get-sales-order-confirmation-with-hydrations',\n action: >getSalesOrderConfirmationWithHydrationsAction,\n input: createSalesOrderConfrimationWithHydrationsInput\n});\n\nexport default getSalesOrderConfirmationWithHydrationsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any, max-lines */\nimport { IExperimentationProvider, IExperimentsResult, ISecretManager, IVariants, State } from '@msdyn365-commerce/core';\n/**\n * A basic implementation of the ExperimentationProvider interface used for testing\n */\nclass MsDyn365ExpTestConnector implements IExperimentationProvider {\n private variantSet1: IVariants[] = [\n {\n variantId: 'var1',\n experimentId: 'expid1'\n },\n {\n variantId: 'var1',\n experimentId: 'expid4'\n },\n {\n variantId: 'var1',\n experimentId: 'expid6'\n },\n {\n variantId: 'var1',\n experimentId: 'expid7'\n },\n {\n variantId: 'var1',\n experimentId: 'expid8'\n },\n {\n variantId: 'var1',\n experimentId: 'expid9'\n },\n {\n variantId: 'var1',\n experimentId: 'expid10'\n },\n {\n variantId: 'var1',\n experimentId: 'expid11'\n },\n {\n variantId: 'var1',\n experimentId: 'expid12'\n }\n ];\n\n private variantSet2: IVariants[] = [\n {\n variantId: 'var2',\n experimentId: 'expid1'\n },\n {\n variantId: 'var2',\n experimentId: 'expid5'\n },\n {\n variantId: 'var2',\n experimentId: 'expid7'\n },\n {\n variantId: 'var2',\n experimentId: 'expid8'\n },\n {\n variantId: 'var2',\n experimentId: 'expid9'\n },\n {\n variantId: 'var2',\n experimentId: 'expid10'\n },\n {\n variantId: 'var2',\n experimentId: 'expid11'\n },\n {\n variantId: 'var2',\n experimentId: 'expid12'\n }\n ];\n\n private variantSet3: IVariants[] = [\n {\n variantId: 'var1',\n experimentId: 'expid5'\n },\n {\n variantId: 'var2',\n experimentId: 'expid13'\n },\n {\n variantId: 'var2',\n experimentId: 'expid14'\n },\n {\n variantId: 'var2',\n experimentId: 'expid15'\n },\n {\n variantId: 'var2',\n experimentId: 'expid16'\n },\n {\n variantId: 'var2',\n experimentId: 'expid17'\n },\n {\n variantId: 'var2',\n experimentId: 'expid18'\n },\n {\n variantId: 'var2',\n experimentId: 'expid19'\n },\n {\n variantId: 'var2',\n experimentId: 'expid20'\n },\n {\n variantId: 'var2',\n experimentId: 'expid21'\n },\n {\n variantId: 'var2',\n experimentId: 'expid22'\n },\n {\n variantId: 'var2',\n experimentId: 'expid23'\n },\n {\n variantId: 'var2',\n experimentId: 'expid24'\n },\n {\n variantId: 'var2',\n experimentId: 'expid25'\n }\n ];\n\n private variantSet4: IVariants[] = [\n {\n variantId: 'var1',\n experimentId: 'expid5'\n },\n {\n variantId: 'var1',\n experimentId: 'expid1'\n },\n {\n variantId: 'var1',\n experimentId: 'expid13'\n },\n {\n variantId: 'var1',\n experimentId: 'expid14'\n },\n {\n variantId: 'var1',\n experimentId: 'expid15'\n },\n {\n variantId: 'var1',\n experimentId: 'expid16'\n },\n {\n variantId: 'var1',\n experimentId: 'expid17'\n },\n {\n variantId: 'var1',\n experimentId: 'expid18'\n },\n {\n variantId: 'var1',\n experimentId: 'expid19'\n },\n {\n variantId: 'var1',\n experimentId: 'expid20'\n },\n {\n variantId: 'var1',\n experimentId: 'expid21'\n },\n {\n variantId: 'var1',\n experimentId: 'expid22'\n },\n {\n variantId: 'var1',\n experimentId: 'expid23'\n },\n {\n variantId: 'var1',\n experimentId: 'expid24'\n },\n {\n variantId: 'var1',\n experimentId: 'expid25'\n }\n ];\n\n public getConfigForClientSideInit(): Promise {\n return Promise.resolve({});\n }\n public initializeClientSide(config: any): boolean {\n console.log(`Initialize client side called on MsDyn365ExpTestConnector with config ${config}`);\n return true;\n }\n\n public getExperiments(): Promise {\n return Promise.resolve({\n name: 'msdyn365-exp-test-2',\n experiments: [\n {\n id: 'expid1',\n friendlyName: 'experiment-1',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n link: 'www.msdyn365-exp-test-connector/expid1',\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var3',\n friendlyName: 'variant-3',\n status: State.Draft,\n weight: '0.2'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid2',\n friendlyName: 'experiment-2',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Paused,\n link: 'www.msdyn365-exp-test-connector/expid2',\n variations: [\n {\n id: 'var3',\n friendlyName: 'variant-3',\n status: State.Paused,\n weight: '1.0'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid3',\n friendlyName: 'experiment-3',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Archived,\n variations: [\n {\n id: 'var4',\n friendlyName: 'variant-4',\n status: State.Archived,\n weight: '1.0'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid4',\n friendlyName: 'experiment-4',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid5',\n friendlyName: 'experiment-5',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid6',\n friendlyName: 'experiment-6',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid7',\n friendlyName: 'experiment-7',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid8',\n friendlyName: 'experiment-8',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid9',\n friendlyName: 'experiment-9',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid10',\n friendlyName: 'experiment-10',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid11',\n friendlyName: 'experiment-11',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid12',\n friendlyName: 'experiment-12',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid13',\n friendlyName: 'experiment-13',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid14',\n friendlyName: 'experiment-14',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid15',\n friendlyName: 'experiment-15',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid16',\n friendlyName: 'experiment-16',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid17',\n friendlyName: 'experiment-17',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid18',\n friendlyName: 'experiment-18',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid19',\n friendlyName: 'experiment-19',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid20',\n friendlyName: 'experiment-20',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid21',\n friendlyName: 'experiment-21',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid22',\n friendlyName: 'experiment-22',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid23',\n friendlyName: 'experiment-23',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid24',\n friendlyName: 'experiment-24',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n },\n {\n id: 'expid25',\n friendlyName: 'experiment-25',\n description: 'This is a msdyn365-exp test experiment',\n type: 'A/B Test',\n status: State.Running,\n variations: [\n {\n id: 'var1',\n friendlyName: 'variant-1',\n status: State.Active,\n weight: '0.4'\n },\n {\n id: 'var2',\n friendlyName: 'variant-2',\n status: State.Active,\n weight: '0.6'\n }\n ],\n createdDate: '05/01/2020',\n lastModifiedDate: '05/01/2020',\n lastModifiedBy: 'User 1'\n }\n ]\n });\n }\n public getVariantsForUser(userId: string, attributes?: { [index: string]: string } | undefined): IVariants[] {\n if (userId.match(/^[0-3].*$/)) {\n return this.variantSet1;\n } else if (userId.match(/^[4-7].*$/)) {\n return this.variantSet2;\n } else if (userId.match(/^[8-9|a-b].*$/)) {\n return this.variantSet3;\n } else {\n return this.variantSet4;\n }\n }\n public activateExperiment(userId: string, experiments: IVariants[], attributes?: { [index: string]: string } | undefined): boolean {\n console.log(\n `Active experiment called on MsDyn365ExpTestConnector with userId: ${userId}, experiments: ${JSON.stringify(\n experiments\n )}, attributes: ${JSON.stringify(attributes)}`\n );\n return true;\n }\n public initialize(config: any, secretManager?: ISecretManager): Promise {\n console.log(`MsDyn365 Exp Test Connector called with config: ${JSON.stringify(config)}`);\n return Promise.resolve(true);\n }\n}\n\nconst connector = new MsDyn365ExpTestConnector();\nexport default connector;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { IExpLogger } from '@msdyn365-commerce/telemetry-internal';\n\n/**\n * A basic implementation of the ExperimentationProvider interface used for testing\n */\nclass MsDyn365ExpTestConnectorListener implements IExpLogger {\n private userId: string = '';\n public initializeClientSide(config: any, userId: string): boolean {\n this.userId = userId;\n console.log(`Listener initialize called with config ${JSON.stringify(config)} and userId ${userId}`);\n return true;\n }\n public logEvent(eventName: string, payload: any, attributes?: any): void {\n console.log(`tracking events with event type - ${eventName}, payload - ${payload}, user id - ${this.userId}`);\n }\n}\n\nconst connectorListener = new MsDyn365ExpTestConnectorListener();\nexport default connectorListener;\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\nexport type OrderBy =\n | 'None'\n | 'MostRecent'\n | 'Oldest'\n | 'HighestRating'\n | 'LowestRating'\n | 'MostHelpful'\n | 'LeastHelpful'\n | 'MostAsked'\n | 'MostAnswered'\n | 'LeastConcerns'\n | 'MostConcerns'\n | 'ReviewerNameAsc'\n | 'ReviewerNameDesc';\n\n/**\n * ReviewsGetRatingsSummary Input Action.\n */\nexport class GetProductReviewsInput implements IActionInput {\n /**\n * The Id representing the product to get the reviews for.\n */\n public productId: string;\n\n /**\n * The ID representing the tenant.\n */\n public tenantId: string;\n\n /**\n * The market for which to get the reviews from.\n */\n public localeListFilter: string;\n\n /**\n * Number of reviews to be shown on each page.\n */\n public pageSize: number;\n\n /**\n * Order in which reviews to be shown.\n */\n public orderBy: string;\n\n /**\n * Need to set this value if reviews need to be filtered with specific star rating .\n */\n public starFilters?: string;\n\n /**\n * Need to set this value if we need to skip few reviews.\n */\n public skipItems: number;\n\n /**\n * The continuation token.\n */\n public pageToken: string | null;\n\n /**\n * Selects which data sources to use to retrieve data.\n */\n public dataSources: string | null;\n\n /**\n * The ratings and reviews service endpoint.\n */\n public serviceEndpoint: string;\n\n constructor(\n productId: string,\n tenantId: string,\n localeListFilter: string,\n serviceEndpoint: string,\n orderBy: string = 'MostHelpful',\n starFilters: string = '',\n skipItems: number = 0,\n pageSize: number = 10,\n pageToken: string | null = null,\n dataSources: string | null = null\n ) {\n this.productId = productId;\n this.tenantId = tenantId;\n this.localeListFilter = localeListFilter;\n\n // Max page size which Rnr API supports is 25.\n // Hence if config has page size more than 25, we'll default it to 25.\n this.pageSize = pageSize > 25 ? 25 : pageSize;\n this.orderBy = orderBy;\n this.starFilters = starFilters;\n this.skipItems = skipItems;\n this.pageToken = pageToken;\n this.dataSources = dataSources;\n this.serviceEndpoint = serviceEndpoint;\n }\n\n public getCacheKey = () =>\n `${this.productId}-${this.tenantId}-${this.localeListFilter}-${this.pageSize}-${this.orderBy}-${this.starFilters}-${this.skipItems}`;\n\n public getCacheObjectType = () => 'ProductReview';\n\n public dataCacheType = (): CacheType => 'request';\n}\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 * These are the get user review API inputs.\n */\nexport class GetUserReviewInput 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 user's authorization token.\n */\n public authorization: string;\n\n /**\n * The ratings and reviews service endpoint.\n */\n public serviceEndpoint: string;\n\n constructor(productId: string, tenantId: string, authorization: string, serviceEndpoint: string) {\n this.productId = productId;\n this.tenantId = tenantId;\n this.authorization = authorization;\n this.serviceEndpoint = serviceEndpoint;\n }\n\n public getCacheKey = () => 'GetUserReview';\n\n public getCacheObjectType = () => 'GetUserReview';\n\n public dataCacheType = (): CacheType => 'none';\n}\n"],"names":["getProductInfoFromCartLinesAsync","async","cartLines","actionContext","undefined","requestContext","channel","Error","productPromises","i","length","cartLine","ProductId","push","getByIdAsync","callerContext","RecordId","then","result","productInfo","getProductInfoFromSimpleProduct","productPrice","Price","toString","productQuantity","Quantity","reason","Promise","all","simpleProduct","recordId","productId","MasterProductId","productSku","productName","Name","Description","productChannelId","productChannelName","productCategoryId","productCategoryName","productCurrency","GetCountryRegionsInput","constructor","locale","apiSettings","getCacheKey","buildCacheKey","this","getCacheObjectType","dataCacheType","getCountryRegionsAction","input","ctx","getCountryRegionsByLanguageIdAsync","queryResultSettings","getCountryRegionsActionDataAction","createObservableDataAction","action","inputData","GetAddressPurposesInput","getAddressPurposesAction","getAddressPurposesAsync","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","getAddressPurposesActionDataAction","id","GetCountryStateInput","getCountryStateAction","countryInput","countryRegionsInfo","channelConfiguration","marketISOCode","ChannelCountryRegionISOCode","currentCountryRegion","find","countryRegion","ISOCode","countryRegionId","CountryRegionId","stateInput","GetStateProvincesInput","getStateProvinceAction","getCountryStateActionDataAction","ProductComparisonItem","itemId","addedDate","Date","catalogId","super","getItemId","ProductComparisonState","_len","arguments","items","Array","_key","_comparisonItems","listModifiedEvent","Event","_lastUpdateDate","now","setItems","_update","addItem","item","clearAll","removeItem","filter","currentItem","removeItemById","hasItem","includes","hasItemById","some","trigger","user","_requestContext","subscribe","instanceId","handler","_writeToCookie","cookies","_getCookieStorageKey","_retrieveItemsFromCookies","_instance","ArrayExtensions","equals","_ref","_user$RecordId","_requestContext$siteP","userId","customerAccountNumber","_productComparisonItemsLocalStorageKey","sitePath","_readFromCookie","hasElements","cookieContext","cookieKey","isConsentGiven","get","value","set","secure","maxAge","GetChannelIdentitiesInput","getChannelsAction","context","channels","getChannelsAsync","getChannels","error","channelIdentities","getChannelsActionDataAction","searchArea","Radius","Math","max","DistanceUnitValue","GetOrgUnitLocationsInput","getOrgUnitLocationsAction","orgUnitLocations","getOrgUnitLocationsByAreaAsync","getOrgUnitLocations","getOrgUnitLocationsActionDataAction","RefinerSourceType","DateRefinerOptionItem","OrderStatusRefinerOptionItem","BaseStoreSelectorStateManager","listMapViewState","displayList","displayMap","preferredStoreLocalStorageKey","isMapModuleLoaded","_readFromToCookie","storeInfo","JSON","parse","preferredStore","_unused","_context","storeId","selectedStoreLocationId","storeName","writeToCookie","StoreId","StoreName","Latitude","Longitude","stringify","latitude","longitude","lastInlineShownStoreInfo","_removeCookie","key","MsDyn365","isBrowser","window","localStorage","setItem","cookieValue","getItem","__decorate","computed","observable","MapStoreSelectorStateManager","SERVICE_ENDPOINT","MAP_API_ENDPOINT","searchTerm","BingMapsApiKey","BingMapsEnabled","searchContent","jsonp","crypto","getRandomValues","Uint32Array","trim","query","encodeURI","geolocationApiUrl","app","config","requestUrl","resolve","script","document","createElement","setAttribute","data","remove","resourceSets","resources","point","coordinates","body","appendChild","_document","StringExtensions","isNullOrEmpty","getElementById","currentWindowAPI","mapAPIReady","isMapApiLoaded","url","lang","market","reject","_document2","_document3","type","defer","src","addEventListener","createStoreSelectorStateInput","GenericInput","getGenericActionDataAction","getGenericAction","createAccordionStateInput","createAccordionStateInputInternal","GetTenderTypesInput","createTenderTyperInput","getTenderTypeAction","getTenderTypesAsync","getTenderTypeActionDataAction","GetCardPaymentAcceptPointInput","paymenTenderType","showBillingAddress","shouldEnableSinglePaymentAuthorizationCheckout","amountDue","shouldPassLocaleToiFrame","createCheckoutPaymentInstrumentInput","_inputData$config","getCardPaymentAcceptPointInput","showBillingAddres","getCardPaymentAcceptPointAction","_checkoutState$checko","telemetry","exception","checkoutState","getCheckoutState","catch","isEmptyOrNullObject","checkoutCart","cart","CartLines","URL","origin","cardPaymentAcceptSettings","_objectSpread","HostPageOrigin","AdaptorPath","CardPaymentEnabled","CardTokenizationEnabled","HideBillingAddress","TenderTypeId","PaymentAmount","AmountDue","Locale","getCardPaymentAcceptPointAsync","bypassCache","Id","cardPaymentAcceptPoint","AcceptPageUrl","AcceptPageContent","debug","getCardPaymentAcceptPointActionDataAction","GetOrderOriginatorsInput","transactionIds","salesIds","searchCriteria","TransactionIds","SalesIds","getOriginatorsAction","SalesOrdersDataActions","createSalesOrderOriginatorsInput","_inputData$requestCon","salesId","transactionId","getSalesOrderOriginatorsActionDataAction","AttributesForSelectedVariantInput","channelId","selectedProduct","createAttributesForSelectedVariantInput","getSelectedProductIdFromActionInput","getCatalogId","getAttributesForSelectedVariantAction","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","ProductsDataActions","attributeValues","channelInventoryConfiguration","StoreOperationsDataActions","getAttributeValuesByConfiguration","trace","message","createRatingsReviewsStateInput","createInternalRatingsReviewsStateInput","filterKey","GetBotFrameworkInput","Msdyn365","_msdyn365Commerce$sec","ISecretValue","msdyn365Commerce","secretManager","getSecretValue","baseUrl","apiToken","args","SearchOption","SortOption","GetProductsInProductComparisonInput","createGetProductsInProductComparisonInput","loadProductsSpecifications","products","productsSpecificationsPromises","map","product","index","ProductDetails","specificationsList","loadProductSpecifications","productsSpecifications","validValues","getProductsInProductComparisonAction","accountInformation","getCustomer","GetCustomerInput","instance","newInput","productsPromises","fullProductInput","FullProductInput","ProductDetailsCriteria","productsInfo","getFullProductsAction","loadFullProducts","ratingsPromises","GetRatingsSummaryInput","rnr","ratingInput","getRatingsSummary","ratings","loadRatings","productDimensions","productsDimensionPromises","_product$ProductDetai2","dimensionResult","Dimensions","_product$ProductDetai","ProductsDimensionAvailabilitiesInput","DimensionTypeValue","getDimensionAvailabilitiesForProductsAction","dimensions","masterId","productsDimensions","loadProductsDimensions","productData","price","ProductPrice","rating","specifications","productSpecifications","dimension","getActiveCheckoutCartProductsActionDataAction","GetProductsInPreviewProductComparisonInput","createGetProductsInPreviewProductComparisonInput","getProductsInPreviewProductComparisonAction","currentItems","productInputs","ProductInput","simpleProducts","getSimpleProducts","getProductsInPreviewProductComparisonDataAction","ActiveProductListInput","productListId","buildCacheKeyWithUrlTokens","shouldCacheOutput","getActiveProductList","fullProductListInput","GetFullProductListInput","getFullProductList","getActiveProductListDataAction","createInputForProductReviews","GetProductReviewsInput","getRnrPartnerId","getRnrEndpointId","getReviewsForGivenProduct","tenantId","localeListFilter","pageSize","inputIsValid","serviceEndpoint","orderBy","skipItems","starFilters","pageToken","sendRequest","response","isTakenDown","pagingInfo","getReviewsForGivenProductDataAction","getUserReviewDataAction","authorization","errorMessage","headers","Authorization","status","statusText","userInfo","isAuthenticated","GetUserReviewInput","token","getRnrAuthEndpointId","CategoryPageSummaryInput","currentCategoryResult","getCurrentCategory","createGetCurrentCategoryInput","includeRootCategory","CurrentCategoryInput","currentCategory","categoryUrl","localName","getFriendlyName","NameTranslations","neutralizedName","NeutralizedName","getCategoryUrl","canonicalDomain","toLocaleLowerCase","skipCount","skip","Url","urlParams","URLSearchParams","search","removeDomainQspFromUrl","_unused2","title","sharingImageUrl","OfflineImage","canonicalUrl","faviconUrl","sharingImage","PageSummaryInput","description","keywords","ListItemType","ListPageSummaryInput","getSubListItem","sitePathOfRequest","imageList","getImages","fields","content","images","sublistHref","listName","_name","Title","ShortDescription","shortDescription","BackgroundColor","backgroundColor","ForegroundColor","foregroundColor","Href","Images","getSitePath","resultImageList","forEach","image","href","imageItem","altText","width","height","createGetListInput","listData","pageData","list","_id","console","getInputListData","listItems","productList","parentImageList","itemsPerPage","Number","isNaN","getItemsPerPage","getSkipCount","productItems","sum","clonedList","productItem","CatalogId","ListInput","getList","ProductPageSummaryInput","generateCacheKey","simpleProductsData","_input$catalogId","getByIdsAsync","simpleProductData","productUrl","productBrand","getProductUrlSync","_input$catalogId2","productAttributes","getAttributeValuesAsync","productAttribute","TextValue","getProductBrand","_unused3","generateImageUrl","PrimaryImageUrl","AdjustedPrice","getStateProvincesAsync","ActiveCheckoutCartProductsInput","createInput","getActiveCheckoutCartProductsAction","hasInvoiceLine","Boolean","paymentTenderType","shouldShowBillingAddress","isInCartPage","cartState","getCartState","_get","RequireShippingAddress","getCartAmountDue","CartsDataActions","MapDistributorSelectorStateManager","hideDistributorWarningLocalStorageKey","showDistributorDetailsOnMap","hideDistributorWarning","distributorWarning","_distributorSelectorContext","_distributorDetailContext","distributorList","distributorId","selectedDistributorId","_actionContext$reques","_actionContext$reques2","createDistributorSelectorStateInput","GetSalesOrderDetailsByConfirmationInput","channelReferenceLookupCriteria","confirmationId","ChannelReferenceId","getSalesOrderDetailsByChannelReferenceIdAction","orderTypes","getSalesOrderDetailsByLookupCriteria","_context$requestConte","_getExtensibleEnumera","_getExtensibleEnumera2","propertyName","propertyValue","addtionalLookupParameter","queryArray","Object","entries","additionalFieldName","additionalFieldValue","orderStatusLookUpParameterTypeName","orderStatusLookUpParameterValue","getQueryStringParameters","orderLookupExtensibleEnum","TypeName","ExtensibleEnumerations","channelReferenceAdditionalLookupCriteria","retailProxyValue","retailProxyTypeValue","Value","OrderLookupAdditionalCriteriaTypeValue","OrderLookupAdditionalCriteriaTypeParameterValue","additionalItem","ChannelReferenceAdditionalLookupCriteria","getProductsWithCatalog","productCatalog","GetSalesOrderWithHydrationsInput","orderType","orderId","_this$orderType","_this$orderId","_this$confirmationId","getSalesOrderWithHydrationsAction","_context$requestConte3","_featureStates$find","salesOrder","_context$requestConte2","SearchLocation","All","getSalesOrder","SalesLines","saleline","IsVoided","TransactionTypeValue","TransactionType","SalesInvoice","isEnabled","ChannelId","channelInfo","getOnlineChannelAsync","OnlineStoreCustomerTypeValue","isChannelTypeB2B","log","productCatalogIds","salesLine","featureStates","getFeatureStatesAsync","featureState","IsEnabled","userCatalogIds","CatalogsDataActions","matchingProductCatalogIds","productCatalogId","userCatalogId","nonMatchingProductCatalogIds","matchingProducts","nonMatchingProducts","validProducts","ObjectExtensions","isNullOrUndefined","deliveryOptions","isSameSiteType","getSalesOrderWithHydrationsActionDataAction","transaction","GetDateRefinerOptionsInput","getDateRefinerOptionsAction","refinerOptions","LastSevenDays","LastThirtyDays","LastThreeMonths","LastSixMonths","Customized","getDateRefinerOptions","getDateRefinerOptionsActionDataAction","GetOrderStatusRefinerOptionsInput","getOrderStatusRefinerOptionsAction","Created","Invoiced","Canceled","getOrderStatusRefinerOptions","getOrderStatusRefinerOptionsActionDataAction","GetSearchOptionsInput","getSearchOptionsAction","searchOptions","OrderNumber","ConfirmationId","ChannelName","CustomerRequisition","getSearchOptions","getSearchOptionsActionDataAction","GetSortOptionsInput","allowSortingByConfirmedShipDate","getSortOptionsAction","sortOptions","CreatedDateTimeDescending","CreatedDateTimeAscending","ConfirmedShipDateDescending","ConfirmedShipDateAscending","getAllSortOptions","getSortOptionsWithoutConfirmedShipDate","getSortOptionsActionDataAction","showConfirmedShipDateSortingOptions","ActiveOrderTemplateLinesInput","_requestContext$query","orderTemplateId","fromModuleData","QueryResultSettings","count","getActiveOrderTemplateLines","getFullOrderTemplate","GetFullOrderTemplateInput","getActiveOrderTemplateLinesDataAction","createDataActionHook","actionId","postReaderHook","_inputs","_msdyn365","cartObject","isArray","addedCartLines","telemetryData","addedProducts","logEvent","TelemetryEvent","AddToCart","cartId","cartVersion","Version","preReaderHook","inputs","actionInput","queryParams","addCartLinesParams","e","cartLineProductUnits","CheckOut","ProductPageView","salesObject","saleLineProductUnits","Purchase","affiliation","revenue","NetAmountWithoutTax","tax","TaxAmount","activeCart","removeCartLineIds","removedCartLineIds","productTransaction","removedCartLines","removedProducts","indexOf","LineId","RemoveFromCart","removeCartLinesParams","cartLineIds","updatedCartLines","updatedProducts","UpdateInCart","updateCartLinesParams","ActiveImageInput","_cacheKey","activePoints","activePointData","getActiveImageproductAction","itemIds","ItemId","searchCriteriaInput","validateCatalogId","Context","IncludeAttributes","ItemIds","actionDataAction","ActiveCheckoutCartProductsDetailsInput","createCartInput","getActiveCheckoutCartProductsDetailsAction","getActiveCheckoutCartProductsDetailsActionDataAction","GetSalesOrderConfirmationWithHydrationsInput","getSalesOrderConfirmationWithHydrationsAction","getSalesOrderDetailsBySalesIdAsync","getSalesOrderDetailsByTransactionIdAsync","productIds","_salesLine$ProductId","getProducts","getDeliveryOptionsAsync","getSalesOrderConfirmationWithHydrationsActionDataAction","variantSet1","variantId","experimentId","variantSet2","variantSet3","variantSet4","getConfigForClientSideInit","initializeClientSide","getExperiments","name","experiments","friendlyName","State","Running","link","variations","Active","weight","Draft","createdDate","lastModifiedDate","lastModifiedBy","Paused","Archived","getVariantsForUser","attributes","match","activateExperiment","initialize","eventName","payload","dataSources"],"sourceRoot":""}