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B,OAAST,EAAUX,eAAeoB,MAAMwhB,WAC1G,OAAOm7B,EAAAA,EAAAA,mCACHj9C,EAAAA,EAAyB2f,cAAc9f,GAAW+f,qBACjD/f,EAAUX,eAAehB,YAAYgH,UACtCrF,EAAUK,OAASS,OAAOd,EAAUK,OAAOiF,WAAa,GACvDtF,EAAUX,eAAeoB,MAAMwhB,WAC/BpiB,MAAMC,QAAQ66C,GAETA,EAAmBj5C,KAAK27C,GAA6CA,IADrE,IAKd,MAAM,IAAIn9C,MAAM,6JCvCkBnB,EAAAA,EAAAA,IAA2B,CAC7DC,GAAI,2DACJC,OAAwCia,EAAAA,aACxC/Z,MA5BG,SAAqCa,GACxC,MACIX,gBAAgB,MACZoB,EACApC,aAAa,UAAEgH,KAEnBrF,EAEE6K,EAASpK,GAASA,EAAM08B,EAE9B,IAAKtyB,EACD,MAAM,IAAI3K,MACN,qIAIR,MAAMo9C,EAAqBn9C,EAAAA,EAAyB2f,cAAc9f,GAClE,OAAOu9C,EAAAA,EAAAA,yBAAwBD,EAAmBv9B,oBAAqBjf,OAAOuE,GAAY,EAAGwF","sources":["webpack://Msdyn365.Commerce.Online/../../src/get-customer.ts?8319","webpack://Msdyn365.Commerce.Online/../../../src/utilities/QueryResultSettingsProxy.ts?5e44","webpack://Msdyn365.Commerce.Online/../../src/get-feature-state.ts?1a1d","webpack://Msdyn365.Commerce.Online/../../../src/utilities/utils.ts?fbc0","webpack://Msdyn365.Commerce.Online/../../src/get-channel-delivery-option-configuration.ts?a716","webpack://Msdyn365.Commerce.Online/../../src/get-selected-variant.ts?f0c0","webpack://Msdyn365.Commerce.Online/../../src/get-loyalty-card.ts?7213","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.typed-array.fill.js?08c7","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.typed-array.set.js?4cfc","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.typed-array.sort.js?7dcd","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.typed-array.to-locale-string.js?fac9","webpack://Msdyn365.Commerce.Online/../../src/get-cart-configuration.ts?4302","webpack://Msdyn365.Commerce.Online/../../../src/utilities/product-inventory-utils.ts?58b5","webpack://Msdyn365.Commerce.Online/../../src/get-catalogs.ts?7332","webpack://Msdyn365.Commerce.Online/../../src/get-customer-balance.ts?d165","webpack://Msdyn365.Commerce.Online/../../src/get-wishlist-by-customer-id.ts?e873","webpack://Msdyn365.Commerce.Online/../../src/get-full-products.ts?ba9a","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/array-buffer-view-core.js?3e45","webpack://Msdyn365.Commerce.Online/../../src/get-address.ts?20a3","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-order-templates-preview.ts?b8c3","webpack://Msdyn365.Commerce.Online/../../src/get-simple-products.ts?fed7","webpack://Msdyn365.Commerce.Online/../../src/add-address.ts?fb17","webpack://Msdyn365.Commerce.Online/../../src/get-current-category.ts?354d","webpack://Msdyn365.Commerce.Online/../../src/get-delivery-options-for-cartlines.ts?4dfe","webpack://Msdyn365.Commerce.Online/../../../src/utilities/product-inventory-information.ts?0ec6","webpack://Msdyn365.Commerce.Online/../../src/get-ratings-summary.ts?49bc","webpack://Msdyn365.Commerce.Online/../../src/get-categories-hierarchy.ts?acde","webpack://Msdyn365.Commerce.Online/../../src/get-media-locations-for-selected-variant.ts?fd54","webpack://Msdyn365.Commerce.Online/../../../src/invoices/get-invoices.ts?22cb","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-paginated-order-template-lines.ts?9b12","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/parameterize.ts?f5a5","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/category-url-builder.ts?e564","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/invoice-url-builder.ts?d542","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/Url-builder/product-url-builder.ts?baf1","webpack://Msdyn365.Commerce.Online/../../src/get-current-category-hierarchy.ts?d48e","webpack://Msdyn365.Commerce.Online/../../src/get-media-locations-by-id.ts?8462","webpack://Msdyn365.Commerce.Online/../../../src/utilities/order-templates.ts?d593","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/extensions/object-extensions.ts?6388","webpack://Msdyn365.Commerce.Online/../../src/get-dimensions-for-selected-variant.ts?6bf4","webpack://Msdyn365.Commerce.Online/../../../src/utilities/getRnrKeys.ts?700f","webpack://Msdyn365.Commerce.Online/../../src/get-availabilities-cartlines.ts?b8e8","webpack://Msdyn365.Commerce.Online/../../src/get-delivery-options-for-selected-variant.ts?3f6c","webpack://Msdyn365.Commerce.Online/../../src/get-dimension-availabilities-for-products.ts?f656","webpack://Msdyn365.Commerce.Online/../../src/get-full-available-inventory-nearby.ts?20be","webpack://Msdyn365.Commerce.Online/../../../src/utilities/quick-order-template-line.ts?56d5","webpack://Msdyn365.Commerce.Online/../../src/get-product-list-lines.ts?ae74","webpack://Msdyn365.Commerce.Online/../../src/get-price-for-selected-variant.ts?9e79","webpack://Msdyn365.Commerce.Online/../../src/get-product-availabilities-for-selected-variant.ts?0abd","webpack://Msdyn365.Commerce.Online/../../src/get-products-in-active-cart.ts?3376","webpack://Msdyn365.Commerce.Online/../../src/get-store-location-information.ts?1df0","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-order-templates.ts?a3b1","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/extensions/enum-extensions.ts?cf51","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/extensions/string-extensions.ts?ab9f","webpack://Msdyn365.Commerce.Online/../../../src/utilities/validate-cartlines-inventory.ts?8b82","webpack://Msdyn365.Commerce.Online/../../src/get-loyalty-transaction-estimation.ts?e254","webpack://Msdyn365.Commerce.Online/../../src/get-pickup-options-for-cartlines.ts?843b","webpack://Msdyn365.Commerce.Online/../../../src/utilities/input-data-parser.ts?027a","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/promise-queue/promise-queue.ts?e362","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/array-buffer-basic-detection.js?6815","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/array-fill.js?4640","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/to-big-int.js?236a","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/to-offset.js?e08c","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/to-positive-integer.js?0ae4","webpack://Msdyn365.Commerce.Online/../../src/get-attribute-definitions.ts?cc6b","webpack://Msdyn365.Commerce.Online/../../src/get-categories.ts?8dc6","webpack://Msdyn365.Commerce.Online/../../src/get-category-paths.ts?b007","webpack://Msdyn365.Commerce.Online/../../src/get-items-in-wishlist.ts?0d27","webpack://Msdyn365.Commerce.Online/../../src/get-organization-users.ts?b72e","webpack://Msdyn365.Commerce.Online/../../src/get-organization-users-count.ts?b5f7","webpack://Msdyn365.Commerce.Online/../../../src/invoices/get-invoice-details.ts?66a9","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-full-order-templates.ts?b553","webpack://Msdyn365.Commerce.Online/../../src/get-distributors.ts?216a","webpack://Msdyn365.Commerce.Online/../../src/get-product-dimensions-with-availabilities.ts?347b","webpack://Msdyn365.Commerce.Online/../../src/add-item-to-product-list.ts?580e","webpack://Msdyn365.Commerce.Online/../../src/add-organization-user.ts?ed86","webpack://Msdyn365.Commerce.Online/../../src/create-product-list.ts?7367","webpack://Msdyn365.Commerce.Online/../../src/delete-organization-user.ts?7f5d","webpack://Msdyn365.Commerce.Online/../../src/edit-organization-user.ts?d2ac","webpack://Msdyn365.Commerce.Online/../../src/generic-data-action.ts?f887","webpack://Msdyn365.Commerce.Online/../../src/get-attributes-for-selected-variant.ts?af00","webpack://Msdyn365.Commerce.Online/../../src/get-dimension-availabilities-for-product-search-result.ts?5259","webpack://Msdyn365.Commerce.Online/../../../src/utilities/quick-order-templates.ts?0ea6","webpack://Msdyn365.Commerce.Online/../../src/get-full-product-list.ts?ccfb","webpack://Msdyn365.Commerce.Online/../../src/get-list.ts?4fd5","webpack://Msdyn365.Commerce.Online/../../src/get-organization-wide-order-history.ts?92b8","webpack://Msdyn365.Commerce.Online/../../src/get-price-for-product-search-result.ts?36f8","webpack://Msdyn365.Commerce.Online/../../src/get-product-prices-for-selected-products.ts?227e","webpack://Msdyn365.Commerce.Online/../../src/get-promotion-options-for-cartlines.ts?1a35","webpack://Msdyn365.Commerce.Online/../../src/get-scan-results.ts?6b44","webpack://Msdyn365.Commerce.Online/../../../src/utilities/delivery-options-cartLine-address.ts?5ce0","webpack://Msdyn365.Commerce.Online/../../src/get-group-delivery-options.ts?1efa","webpack://Msdyn365.Commerce.Online/../../src/issue-loyalty.ts?f8fa","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/add-item-to-order-template.ts?fff3","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/add-order-template-to-cart.ts?6ee4","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/create-order-template.ts?03c1","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/get-full-order-template.ts?72c6","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/update-order-template-header.ts?1f77","webpack://Msdyn365.Commerce.Online/../../../src/order-templates/update-order-template-line.ts?527b","webpack://Msdyn365.Commerce.Online/../../src/update-customer-attributes.ts?8d49","webpack://Msdyn365.Commerce.Online/../../src/update-customer-personalization.ts?4aa9","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/data-structures/dictionary.ts?bab3","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/events/event.ts?15a9","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/promise-queue/finite-promise-queue.ts?77bf","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce-modules/retail-actions/node_modules/uuid/dist/esm-browser/rng.js?b47d","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce-modules/retail-actions/node_modules/uuid/dist/esm-browser/regex.js?08ba","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce-modules/retail-actions/node_modules/uuid/dist/esm-browser/validate.js?acea","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce-modules/retail-actions/node_modules/uuid/dist/esm-browser/stringify.js?6cb1","webpack://Msdyn365.Commerce.Online/./node_modules/@msdyn365-commerce-modules/retail-actions/node_modules/uuid/dist/esm-browser/v4.js?0101","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/random/guid.ts?1947","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/random/index.ts?1f9d","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/regex/email-regex.ts?6a6a","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/regex/password-regex.ts?456d","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/regex/phone-regex.ts?9ada","webpack://Msdyn365.Commerce.Online/../../src/update-address.ts?3e4d","webpack://Msdyn365.Commerce.Online/../../src/update-primary-address.ts?83fa","webpack://Msdyn365.Commerce.Online/../../../../src/utilities/extensions/array-extensions.ts?1a2a","webpack://Msdyn365.Commerce.Online/../../src/checkout.ts?57e0","webpack://Msdyn365.Commerce.Online/../../src/delete-address.ts?f9a3","webpack://Msdyn365.Commerce.Online/../../src/get-checkout-cart.ts?79bc","webpack://Msdyn365.Commerce.Online/../../src/get-customer-loyalty-cards.ts?2466","webpack://Msdyn365.Commerce.Online/../../src/get-product-list.ts?ef13","webpack://Msdyn365.Commerce.Online/../../src/get-full-products-by-refine-search-category.ts?30ab","webpack://Msdyn365.Commerce.Online/../../src/get-full-products-by-refine-search-text.ts?2ad7","webpack://Msdyn365.Commerce.Online/../../../src/utilities/refiner-utils.ts?1e61","webpack://Msdyn365.Commerce.Online/../../src/get-additional-media-locations-for-selected-variant.ts?fe77","webpack://Msdyn365.Commerce.Online/../../src/get-order-history.ts?76fd","webpack://Msdyn365.Commerce.Online/../../src/get-org-unit-configuration.ts?4793","webpack://Msdyn365.Commerce.Online/../../src/get-products-by-category.ts?accf","webpack://Msdyn365.Commerce.Online/../../src/get-ratings-summary-input.ts?3ccb","webpack://Msdyn365.Commerce.Online/../../src/get-refiners-by-category.ts?6d4e","webpack://Msdyn365.Commerce.Online/../../src/get-refiners-by-text.ts?c52a","webpack://Msdyn365.Commerce.Online/../../src/get-related-products.ts?6f93","webpack://Msdyn365.Commerce.Online/../../src/get-search-configuration.ts?acd1","webpack://Msdyn365.Commerce.Online/../../src/refine-search-by-category.ts?3e65","webpack://Msdyn365.Commerce.Online/../../src/search-by-text.ts?ebe1"],"sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { Customer, CustomersDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get customer data action.\n */\nexport class GetCustomerInput implements IActionInput {\n public customerAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly cacheType?: CacheType;\n\n public constructor(apiSettings: ICommerceApiSettings, accountNumber?: string, cacheType?: CacheType) {\n this.customerAccountNumber = accountNumber;\n this.apiSettings = apiSettings;\n this.cacheType = cacheType;\n }\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => buildCacheKey(`Customer-${this.customerAccountNumber}`, this.apiSettings);\n\n /**\n * GetCacheObjectType.\n * @returns - Cache Object Type string.\n */\n public getCacheObjectType = (): string => 'Customer';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => {\n return this.cacheType ? this.cacheType : 'request';\n };\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - ProductAvailabilitiesForSelectedVariant or error.\n */\nconst createInput = (inputData: ICreateActionContext>): GetCustomerInput => {\n const { user, apiSettings } = inputData.requestContext;\n if (!user.token || !user.isAuthenticated) {\n throw new Error('[getCustomer][createInput]: User is not Authenticated.');\n }\n\n return new GetCustomerInput(apiSettings);\n};\n\n/**\n * GetCustomerAction.\n * @param input - GetCustomerInput.\n * @param ctx - Action Context.\n * @returns - Customer information.\n */\nconst getCustomerAction = async (input: GetCustomerInput, ctx: IActionContext): Promise => {\n if (input && ctx.requestContext.user.isAuthenticated) {\n // TO-DO- Need to clean up this code once SDK releases new proxy that handles null.\n return CustomersDataActions.readAsync({ callerContext: ctx, bypassCache: 'get' }, input.customerAccountNumber || '').then(\n response => {\n return Array.isArray(response) ? response[0] : response;\n }\n );\n }\n\n ctx.trace('[getCustomer]Invalid input passed to action');\n return {};\n};\n\n/**\n * The customer data action.\n */\nexport const getCustomerActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer',\n action: >getCustomerAction,\n input: createInput\n});\n\nexport default getCustomerActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IAny, ICreateActionContext, IGeneric, IRequestContext } from '@msdyn365-commerce/core';\nimport { QueryResultSettings, SortColumn } from '@msdyn365-commerce/retail-proxy';\n\nimport { IQueryResultSettingsModuleConfig } from './IQueryResultSettingsModuleConfig';\n\n/**\n * Wrapper for query result settings, which guarantees some properties that are optional in the real subject\n * and includes some common utilities for data actions.\n */\nexport class QueryResultSettingsProxy {\n // Real subject\n private readonly queryResultSettings: QueryResultSettings;\n\n /**\n * Factory method for data actions.\n * @param inputData - Input data.\n * @returns - Returns query result settings proxy.\n */\n public static fromInputData(inputData: ICreateActionContext>): QueryResultSettingsProxy {\n const { requestContext, config } = inputData;\n return QueryResultSettingsProxy.fromModuleData(requestContext, config as IQueryResultSettingsModuleConfig);\n }\n\n /**\n * Factory method for modules.\n * @param requestContext - RequestContext.\n * @param config - Module config from props.\n * @returns - Returns query result settings proxy.\n */\n public static fromModuleData(requestContext: IRequestContext, config: IQueryResultSettingsModuleConfig): QueryResultSettingsProxy {\n const sortingCriteria = (config && config.sortingCriteria) || undefined;\n const query = requestContext && requestContext.query;\n const top = (query && query.top) || undefined;\n const skip = (query && query.skip) || undefined;\n\n const queryResultSettings = {\n Paging: {\n Skip: (skip && Number(skip)) || 0,\n Top: (top && Number(top)) || config?.itemsPerPage || 50\n },\n Sorting: sortingCriteria || {}\n };\n\n return new QueryResultSettingsProxy(queryResultSettings);\n }\n\n /**\n * Return the query result settings with default paging or with the passed value.\n * @param inputData - Input Data.\n * @returns - Query Result settings.\n */\n public static getPagingFromInputDataOrDefaultValue(inputData: ICreateActionContext>): QueryResultSettings {\n const config: IQueryResultSettingsModuleConfig | undefined = inputData.config;\n const defaultPageSize: number = 100;\n const queryResultSettings: QueryResultSettings = {\n Paging: {\n // eslint-disable-next-line max-len -- Disable max length for next line.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unnecessary-condition -- Reading from config.\n Top:\n config?.itemsPerPage ??\n Number.parseInt(inputData.requestContext?.app?.platform?.defaultPageSizeForAPI ?? defaultPageSize, 10)\n }\n };\n return queryResultSettings;\n }\n\n /**\n * Factory method.\n * @returns - Returns query result settings proxy.\n */\n public static getDefault(): QueryResultSettingsProxy {\n return new QueryResultSettingsProxy({ Paging: {}, Sorting: {} });\n }\n\n /**\n * Private constructor, expect instances to be created with the factory method.\n * @param queryResultSettings - Query result setting.\n */\n private constructor(queryResultSettings: QueryResultSettings) {\n this.queryResultSettings = queryResultSettings;\n }\n\n public get QueryResultSettings(): QueryResultSettings {\n return this.queryResultSettings;\n }\n\n /**\n * Gets the hints for the cache key based on query result settings.\n * @returns - Returns cache key hint.\n */\n public get cacheKeyHint(): string {\n // The factory method guarantees values are defined\n const topHint = `top-${this.queryResultSettings.Paging!.Top!}`;\n const skipHint = `skip-${this.queryResultSettings.Paging!.Skip!}`;\n const sortingHintData =\n (this.queryResultSettings.Sorting!.Columns || [])\n .map((column: SortColumn) => {\n return `${column.ColumnName}--${(column.IsDescending && 'desc') || 'asc'}`;\n })\n .join(',') || undefined;\n const sortingHint = `sortBy-${sortingHintData}`;\n return `${topHint}|${skipHint}|${sortingHint}`;\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} from '@msdyn365-commerce/core';\nimport { FeatureState, StoreOperationsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the getFeatureState data action.\n * The life time of the data action is 'application'.\n */\nexport class FeatureStateInput implements IActionInput {\n // Any additional feature names that needs to be checked in the code for enablement needs to be appended here:\n public readonly featureNames: string[] = [\n 'Dynamics.AX.Application.RetailAsyncAddressCreationFeature',\n 'Dynamics.AX.Application.RetailEnableAsyncCustomerEditFeature',\n 'Dynamics.AX.Application.RetailB2BEcommerceFeature',\n 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature',\n 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature',\n 'Dynamics.AX.Application.RetailSearchPriceRangeFeature',\n 'Dynamics.AX.Application.RetailSalesAgreementPriceSupportFeature',\n 'Dynamics.AX.Application.ChannelMultipleCatalogsFeature',\n 'Dynamics.AX.Application.EcommerceQuantityLimitConfigurationsFeature',\n 'RevertToSiteBuilderOrderQuantityLimitsSettings'\n ];\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'FeatureState';\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'FeatureState';\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput method for the getFeatureState method.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nexport const createGetFeatureStateInput = (inputData: ICreateActionContext>): IActionInput => {\n return new FeatureStateInput();\n};\n\n/**\n * The action method for the getFeatureState data action.\n * @param input -- The action input.\n * @param ctx -- The action context.\n * @returns -- Feature state.\n */\nexport async function getFeatureStateAction(input: FeatureStateInput, ctx: IActionContext): Promise {\n const featureState = await StoreOperationsDataActions.getFeatureStatesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n input.featureNames\n );\n return featureState;\n}\n\n/**\n * The getFeatureState data action.\n * Gets the feature state via the read RetailServer API.\n * @returns Address information associated with the retrieved customer.\n */\nexport const getFeatureStateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-feature-state',\n action: getFeatureStateAction as IAction,\n input: createGetFeatureStateInput\n});\n\nexport default getFeatureStateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport msdyn365Commerce, {\n IAny,\n ICommerceApiSettings,\n ICoreContext,\n ICreateActionContext,\n IGeneric,\n IRequestContext,\n generateImageUrl as generateImageUrlFromSdk\n} from '@msdyn365-commerce/core';\nimport {\n AsyncResult,\n AttributeValue,\n CartLine,\n ChannelDeliveryOptionConfiguration,\n ChannelInventoryConfiguration,\n CommerceListLine,\n ProductDimension,\n ProductDimensionType,\n ProductSearchResult,\n QueryResultSettings,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ProductDetailsCriteria } from '../get-full-products';\nimport { IKeyValuePair } from './data-structures';\nimport { ArrayExtensions, StringExtensions } from './extensions';\nimport { parseSearchData } from './input-data-parser';\nimport { InventoryLevels } from './product-inventory-information';\n\nexport const wrapInResolvedAsyncResult = (input: T | null | undefined): AsyncResult => {\n return >{\n status: 'SUCCESS',\n result: input,\n metadata: {}\n };\n};\n\nexport const wrapInRejectedAsyncResult = (input: T | null | undefined): AsyncResult => {\n return >{\n status: 'FAILED',\n result: input,\n metadata: {}\n };\n};\n\nexport const buildQueryResultSettings = (inputData: ICreateActionContext, IGeneric>): QueryResultSettings => {\n try {\n const searchInputData = parseSearchData(inputData);\n const search = searchInputData.q;\n if (!search) {\n throw new Error('Query string ?q={searchText} is needed for search actions.');\n }\n const top = (searchInputData.maxItems && Number(searchInputData.maxItems)) || searchInputData.top;\n return { Paging: { Top: top, Skip: searchInputData.skip } };\n } catch {\n return {};\n }\n};\n\n/**\n * Utility function to extract the active productId in the following priority:\n * First query param (productId), then UrlToken (itemId), then module config.\n * @param inputData - The Action Input data.\n * @returns Productid or undefined.\n */\nexport const getSelectedProductIdFromActionInput = (inputData: ICreateActionContext>): string | undefined => {\n const context = inputData.requestContext;\n if (context.query?.productId) {\n return context.query.productId;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Exsiting code.\n } else if (\n context.urlTokens &&\n inputData.requestContext.urlTokens.itemId &&\n inputData.requestContext.urlTokens.pageType === 'Product'\n ) {\n return context.urlTokens.itemId;\n } else if (inputData && inputData.config && inputData.config.productId) {\n return inputData.config.productId;\n }\n return undefined;\n};\n\n/**\n * Generates a Image URL based on data return from retail server.\n * @param imageUrl The image url returned by Retail Server.\n * @param ctx The request context.\n * @param apiSettings\n */\nexport const generateImageUrl = (imageUrl: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\n return generateImageUrlFromSdk(apiSettings, imageUrl);\n};\n\n/**\n * Represents app configuration for dimensions.\n */\nexport interface IDimensionsConfig {\n dimensionsAsSwatchType?: DimensionTypes[];\n dimensionsInProductCard?: DimensionTypes[];\n inventoryLevel?: InventoryLevels;\n dimensionToPreSelectInProductCard?: DimensionTypes;\n enableStockCheck?: boolean;\n warehouseAggregation?: string;\n maxQuantityForCartLineItem?: number;\n}\n\n/**\n * Represents app configuration for dimensions.\n */\nexport interface IDimensionsApp {\n config: IDimensionsConfig;\n}\n\n/**\n * Represents product dimension types.\n */\nexport enum DimensionTypes {\n none = 'none',\n color = 'color',\n configuration = 'configuration',\n size = 'size',\n style = 'style'\n}\n\n/**\n * Defines display configuration types.\n */\nexport enum DimensionSwatchDisplayTypes {\n default = 'default',\n productCard = 'productCard'\n}\n\n/**\n * Checks if rendering the particular dimensions is allowed.\n * @param dimensionType - Dimension to be displayed.\n * @param context - Core application context.\n * @param displayType - The swatch location, the component from which it comes from.\n * @returns Updates the state with new product page url.\n */\nexport const checkIfShouldDisplayAsSwatch = (\n dimensionType: DimensionTypes,\n context: ICoreContext,\n displayType: DimensionSwatchDisplayTypes = DimensionSwatchDisplayTypes.default\n): boolean => {\n // Additional checks for the product card since it has a separate config setting.\n if (displayType === DimensionSwatchDisplayTypes.productCard) {\n const dimensionsToDisplayOnProductCard = context.app.config.dimensionsInProductCard;\n if (\n !ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) ||\n dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) ||\n !dimensionsToDisplayOnProductCard.includes(dimensionType)\n ) {\n return false;\n }\n }\n\n const dimensionsToDisplayAsSwatch = context.app.config.dimensionsAsSwatchType;\n return (\n ArrayExtensions.hasElements(dimensionsToDisplayAsSwatch) &&\n !dimensionsToDisplayAsSwatch.includes(DimensionTypes.none) &&\n dimensionsToDisplayAsSwatch.includes(dimensionType)\n );\n};\n\n/**\n * Generates an image URL for a swatch.\n * @param imageUrl - The image url returned by Retail Server.\n * @param apiSettings - The request context.\n * @returns Full image url.\n */\nexport const generateSwatchImageUrl = (imageUrl: string, apiSettings: ICommerceApiSettings): string => {\n if (imageUrl.startsWith('http')) {\n return imageUrl;\n }\n\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\n};\n\n/**\n * Generates a Image URL for a product based on data return from retail server.\n * @param product The Product returned by Retail Server.\n * @param ctx The request context.\n * @param apiSettings\n */\nexport const generateProductImageUrl = (\n product: SimpleProduct | ProductSearchResult,\n apiSettings: ICommerceApiSettings\n): string | undefined => {\n return generateImageUrl(product.PrimaryImageUrl, apiSettings);\n};\n\n/**\n * Creates a CartLine object from the passed data.\n * @param product The product.\n * @param quantity The quantity.\n * @param catalogId The catalog.\n */\nexport const buildCartLine = (product: SimpleProduct, quantity?: number, catalogId?: number): CartLine => {\n return {\n CatalogId: catalogId || 0,\n Description: product.Description,\n\n // TODO: Investigate this value and what it represents\n EntryMethodTypeValue: 3,\n ItemId: product.ItemId,\n ProductId: product.RecordId,\n Quantity: quantity || 1,\n TrackingId: '',\n UnitOfMeasureSymbol: product.DefaultUnitOfMeasure\n };\n};\n\n/**\n * Creates a CommerceListLine (also know as WishlistLine) object from the passed data.\n * @param productId The RecordId of the Product to be added.\n * @param customerId The account number of the customer.\n * @param wishlistId The Id of the commerce list.\n */\nexport const buildWishlistLine = (productId: number, customerId: string, wishlistId: number): CommerceListLine => {\n return {\n CommerceListId: wishlistId,\n ProductId: productId,\n CustomerId: customerId\n };\n};\n\n/**\n * Utility function to prepare the product details criteria before getting full product:\n * @param inputData The Action Input data\n */\nexport const getProductDetailsCriteriaFromActionInput = (inputData: ICreateActionContext>): ProductDetailsCriteria => {\n if (inputData && inputData.config) {\n return {\n getPrice: !inputData.config.hidePrice,\n getRating: !inputData.config.hideRating\n };\n }\n return {\n getPrice: true,\n getRating: true\n };\n};\n\n/**\n * Transforms search text into the expected 'search terms' format, expected by refiner APIs.\n * @param searchText Free-form text used for searching for products or categories of products.\n */\nexport const ensureSearchTextIsFormedProperly = (searchText: string): string => {\n const prefix = searchText.startsWith(\"'\") ? '' : \"'\";\n const suffix = searchText.endsWith(\"'\") ? '' : \"'\";\n return `${prefix}${searchText}${suffix}`;\n};\n\nexport const ensureSafeSearchText = (searchText: string): string => {\n return searchText.replace(/[^\\d\\sA-Za-z]+/g, '');\n};\n\n/**\n * @deprecated Please use `generateCacheKey` instead.\n */\nexport const buildCacheKey = (base: string, apiSettings: ICommerceApiSettings, locale?: string): string => {\n return `${base}-chanId:${apiSettings.channelId}-catId:${apiSettings.catalogId}${locale ? `-${locale}` : ''}`;\n};\n\n/**\n * Represents a list of keys for general parameters used in the cache key.\n */\nenum DefaultCacheKeyParameterKeys {\n channelIdKey = 'CHANNELID',\n appSettingsCatalogIdKey = 'APPSETTINGSCATALOGID'\n}\n\n/**\n * Generates a key from set of arguments\n * @param apiSettings - Request context API settings.\n * @param entries - Cache key parameters.\n * @returns String which represents the cache key.\n */\nexport const generateCacheKey = (\n apiSettings?: ICommerceApiSettings,\n ...entries: IKeyValuePair[]\n): string => {\n const parsedEntries: IKeyValuePair[] = entries.map(pair => {\n return { key: pair.key.toLocaleUpperCase(), value: pair.value };\n });\n\n const cacheKeyArgumentsKeys = parsedEntries.map(pair => pair.key);\n\n if (apiSettings) {\n if (!cacheKeyArgumentsKeys.includes(DefaultCacheKeyParameterKeys.channelIdKey)) {\n parsedEntries.push({ key: DefaultCacheKeyParameterKeys.channelIdKey, value: apiSettings.channelId });\n }\n\n if (!cacheKeyArgumentsKeys.includes(DefaultCacheKeyParameterKeys.appSettingsCatalogIdKey) && apiSettings.catalogId) {\n parsedEntries.push({ key: DefaultCacheKeyParameterKeys.appSettingsCatalogIdKey, value: apiSettings.catalogId });\n }\n }\n\n return parsedEntries\n .sort((a, b) => a.key.localeCompare(b.key))\n .map(pair => `${pair.key}:{${pair.value}}`)\n .join('-');\n};\n\nexport const buildCacheKeyWithUrlTokens = (base: string, requestContext: IRequestContext): string => {\n const urlTokens = requestContext.urlTokens;\n const defaultCacheKey = buildCacheKey(base, requestContext.apiSettings, requestContext.locale);\n return urlTokens ? `${defaultCacheKey}-${urlTokens.itemId}-${urlTokens.recordId}-${urlTokens.pageType}` : defaultCacheKey;\n};\n\n/**\n * Generates a key from set of arguments as inputs.\n *\n * @param args Argument list of pivots to generate key from.\n * @param handler Handler function for null/undefined values.\n */\n\ntype TKeyTypes = string | number | boolean | null | undefined;\ninterface IGenerateKeyOptions {\n separator?: string;\n handler?(input: null | undefined): string;\n}\nexport const generateKey = (args: TKeyTypes[], options?: IGenerateKeyOptions): string => {\n const { handler, separator }: IGenerateKeyOptions = { ...{ separator: '-', handler: undefined }, ...(options || {}) };\n return args\n .map(arg => {\n if (arg === null || arg === undefined) {\n if (handler) {\n return handler(arg);\n }\n }\n return arg;\n })\n .join(separator);\n};\n\n/**\n * Gets the fall back image url for a variant image.\n * @param itemId Item id of a product.\n * @param apiSettings Api setting from request context.\n */\nexport const getFallbackImageUrl = (\n itemId: string | undefined,\n apiSettings: ICommerceApiSettings,\n isOmniFeatureEnabled?: boolean\n): string | undefined => {\n if (!itemId || isOmniFeatureEnabled) {\n return '';\n }\n\n const parsedItemId = itemId.trim().split(' ')[0];\n\n const productUrl = `Products/${parsedItemId}_000_001.png`;\n return generateImageUrl(productUrl, apiSettings);\n};\n\n/**\n * Converts retail proxy product dimension type to display dimension type.\n * @param productDimensionType - Product dimension type from retail proxy.\n * @returns Local dimension type.\n */\nexport const convertProductDimensionTypeToDimensionTypes = (productDimensionType: ProductDimensionType): DimensionTypes => {\n switch (productDimensionType) {\n case ProductDimensionType.Color:\n return DimensionTypes.color;\n case ProductDimensionType.Configuration:\n return DimensionTypes.configuration;\n case ProductDimensionType.Size:\n return DimensionTypes.size;\n case ProductDimensionType.Style:\n return DimensionTypes.style;\n default:\n return DimensionTypes.none;\n }\n};\n\n/**\n * Converts display dimension type to retail proxy product dimension type.\n * @param dimensionType - Local dimension type.\n * @returns Product dimension type from retail proxy.\n */\nexport const convertDimensionTypeToProductDimensionType = (dimensionType: DimensionTypes): ProductDimensionType => {\n switch (dimensionType) {\n case DimensionTypes.color:\n return ProductDimensionType.Color;\n case DimensionTypes.configuration:\n return ProductDimensionType.Configuration;\n case DimensionTypes.size:\n return ProductDimensionType.Size;\n case DimensionTypes.style:\n return ProductDimensionType.Style;\n default:\n return ProductDimensionType.None;\n }\n};\n\n/**\n * Sets dimensions to url.\n * @param inputUrl - Url to update.\n * @param productDimensions - Dimensions to set.\n */\nexport const setDimensionValuesToQuery = (inputUrl: URL, productDimensions: ProductDimension[]): void => {\n for (const dimension of productDimensions) {\n const dimensionValue = dimension.DimensionValue?.Value;\n if (!StringExtensions.isNullOrWhitespace(dimensionValue)) {\n inputUrl.searchParams.set(convertProductDimensionTypeToDimensionTypes(dimension.DimensionTypeValue), dimensionValue!);\n }\n }\n\n if (msdyn365Commerce.isBrowser) {\n window.history.replaceState(window.history.state, '', inputUrl.toString().replace(inputUrl.host, window.location.host));\n }\n};\n\n/**\n * Retrieves dimension value stored in url.\n * @param urlParameters - Url parameters.\n * @param productDimensionType - The dimension type to retrieve.\n * @returns Product dimension item.\n */\nconst parseDimensionFromUrl = (\n urlParameters: URLSearchParams,\n productDimensionType: ProductDimensionType\n): ProductDimension | undefined => {\n const localDimensionType = convertProductDimensionTypeToDimensionTypes(productDimensionType);\n const value = urlParameters.get(localDimensionType);\n if (!value) {\n return undefined;\n }\n return {\n DimensionTypeValue: productDimensionType,\n DimensionValue: {\n RecordId: 0,\n Value: value\n }\n };\n};\n\n/**\n * Retrieves all dimensions from URL.\n * @param urlParameters - Url parameters.\n * @returns Product dimensions stored in url.\n */\nconst parseDimensionsFromUrl = (urlParameters: URLSearchParams): ProductDimension[] => {\n const dimensionsToParse: ProductDimensionType[] = [\n ProductDimensionType.Color,\n ProductDimensionType.Configuration,\n ProductDimensionType.Size,\n ProductDimensionType.Style\n ];\n const parsedDimensions = dimensionsToParse.map(dimension => parseDimensionFromUrl(urlParameters, dimension));\n return ArrayExtensions.validValues(parsedDimensions);\n};\n\n/**\n * Utility function to extract the dimension values from input url querystring.\n * @param inputUrl - The request url.\n * @returns The selected dimension values.\n */\nexport const getDimensionValuesFromQuery = (inputUrl: URL): ProductDimension[] => {\n const urlWithIgnoredCase = new URL(inputUrl.toString().toLocaleLowerCase());\n const urlParameters = urlWithIgnoredCase.searchParams;\n const dimensions: ProductDimension[] = parseDimensionsFromUrl(urlParameters);\n return dimensions;\n};\n\n/**\n * Get attribute values by channel inventory configuration.\n * @param attributeValues - The attributeValues.\n * @param channelInventoryConfiguration - The channelInventoryConfiguration.\n * @returns The attributeValues filter by channel inventory configuration.\n */\nexport const getAttributeValuesByConfiguration = (\n attributeValues: AttributeValue[] | null,\n channelInventoryConfiguration: ChannelInventoryConfiguration | null\n): AttributeValue[] => {\n if (!attributeValues) {\n return [];\n }\n if (!channelInventoryConfiguration) {\n return attributeValues;\n }\n\n return attributeValues.filter(\n attribute =>\n attribute.RecordId !== channelInventoryConfiguration.InventoryProductAttributeRecordId &&\n attribute.RecordId !== channelInventoryConfiguration.ProductAvailabilitySortableAttributeRecordId\n );\n};\n\n/**\n * Utility function to remove domain querystring parameter from url.\n * @param inputUrl - The request url.\n * @returns The yrl after dropping domain querystring.\n */\nexport const removeDomainQspFromUrl = (inputUrl: string, requestContext: IRequestContext): string => {\n if (requestContext?.features && requestContext.features.remove_domain_qsp) {\n const Url = new URL(inputUrl);\n const urlParams: URLSearchParams = new URLSearchParams(Url.search);\n if (urlParams.has('domain')) {\n urlParams.delete('domain');\n }\n Url.search = urlParams.toString();\n return Url.toString();\n }\n return inputUrl;\n};\n\n/**\n * Utility function to validate catalog Id for B2B user .\n * @param catalogId - The catalog.\n */\nexport const validateCatalogId = (catalogId?: number | undefined) => {\n if (catalogId === -1) {\n throw new Error(\n 'Catalog id is -1. It means no valid catalogs were found for the user. Make sure the user has some valid catalogs assigned.'\n );\n }\n};\n\n/**\n * Utility function to check deliveryMode .\n * @param cartline - CartLine item.\n * @param retailMulitplePickupFeatureState - pickUp feature state, default to false.\n * @param channelDeliveryOptionConfig - Channel Delivery Option Configuration.\n * @param pickupDeliveryModeCode -pickUp delivery mode code string.\n * @returns true id cartline item is pickUp item else false.\n */\nexport const getDeliveryMode = (\n cartLine: CartLine,\n featureSate: boolean = false,\n channelDeliveryOptionConfig?: ChannelDeliveryOptionConfiguration,\n pickupDeliveryMode?: string\n) => {\n if (!featureSate) {\n return cartLine.DeliveryMode === pickupDeliveryMode;\n }\n return (\n cartLine.DeliveryMode ===\n channelDeliveryOptionConfig?.PickupDeliveryModeCodes?.find(deliveryMode => deliveryMode === cartLine.DeliveryMode)\n );\n};\n\n/**\n * Utility function to check if cartline item is pickupitem .\n * @param cartline - CartLine item.\n * @param retailMulitplePickupFeatureState - pickUp feature state.\n * @param channelDeliveryOptionConfig - Channel Delivery Option Configuration.\n * @param pickupDeliveryModeCode -pickUp delivery mode code string.\n * @returns true id cartline item is pickUp item else false.\n */\nexport const isCartLineItemPickUpType = (\n cartline: CartLine,\n retailMulitplePickupFeatureState: boolean = false,\n channelDeliveryOptionConfig?: ChannelDeliveryOptionConfiguration,\n pickupDeliveryModeCode?: string\n): boolean => {\n // check if cartlineitem is pickup item\n if (\n cartline.DeliveryMode &&\n cartline.DeliveryMode !== '' &&\n getDeliveryMode(cartline, retailMulitplePickupFeatureState, channelDeliveryOptionConfig, pickupDeliveryModeCode)\n ) {\n return true;\n }\n return false;\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 { ChannelDeliveryOptionConfiguration } from '@msdyn365-commerce/retail-proxy';\nimport { getChannelDeliveryOptionConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get channel delivery option configuration data action.\n */\nexport class GetChannelDeliveryConfigurationInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, accountNumber?: string) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ChannelDeliveryConfiguration', this.apiSettings);\n\n public getCacheObjectType = () => 'ChannelDeliveryConfiguration';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): GetChannelDeliveryConfigurationInput => {\n const { apiSettings } = inputData.requestContext;\n if (!apiSettings) {\n throw new Error('[getChannelDeliveryOptionConfiguration][createInput]: API setting not available.');\n }\n\n return new GetChannelDeliveryConfigurationInput(apiSettings);\n};\n\nconst getChannelDeliveryOptionConfigurationAction = async (\n input: GetChannelDeliveryConfigurationInput,\n ctx: IActionContext\n): Promise => {\n if (input) {\n return getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx }).then(response => {\n return response;\n });\n }\n\n ctx.trace('[get-channel-delivery-option-configuration]Invalid input passed to action');\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-channel-delivery-option-configuration',\n action: >getChannelDeliveryOptionConfigurationAction,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductDimensionsWithAvailabilitiesFull } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n BypassCache,\n ProductDimension,\n ProductDimensionAvailabilitySearchCriteria,\n ProductsDataActions,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateProductImageUrl, getDimensionValuesFromQuery, getSelectedProductIdFromActionInput } from './utilities/utils';\n\n/**\n * Stores data about the selected product.\n */\nexport interface ISelectedProduct extends SimpleProduct {\n productVariant?: SimpleProduct;\n}\n\n/**\n * Get selected variant action input class.\n */\nexport class SelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public matchingDimensionValues?: ProductDimension[];\n\n public bypassCache?: BypassCache;\n\n public catalogId?: number;\n\n public constructor(\n productId: number,\n channelId: number,\n matchingDimensionValues?: ProductDimension[],\n bypassCache?: BypassCache,\n requestContext?: IRequestContext\n ) {\n this.productId = productId;\n this.channelId = channelId;\n this.matchingDimensionValues = matchingDimensionValues;\n this.bypassCache = bypassCache;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => 'SelectedVariant';\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType: () => string = () => 'SimpleProduct';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns The input for the ata action getSelectedVariantNewAction.\n */\nconst createInput = (inputData: ICreateActionContext>): SelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new SelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n undefined,\n undefined,\n inputData.requestContext\n );\n }\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Checks if given product has any unmatched dimensions.\n * Modifies product entity to use matched dimension values.\n * @param product - The product to analyze and modify.\n * @param matchingDimensionValues - Matched dimensions.\n * @returns True if has any unmatched dimension, false if all dimensions are specified.\n */\nconst checkIfHasUnmatchedDimensions = (product: SimpleProduct, matchingDimensionValues: ProductDimension[]): boolean => {\n let hasUnmatchedDimension: boolean = false;\n if (product.Dimensions) {\n product.Dimensions = product.Dimensions.map(dimension => {\n return { ...dimension };\n });\n for (const dimension of product.Dimensions) {\n const matchedTargetDimension = matchingDimensionValues.find(\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\n );\n\n if (matchedTargetDimension) {\n dimension.DimensionValue = matchedTargetDimension.DimensionValue;\n } else {\n hasUnmatchedDimension = true;\n }\n }\n }\n return hasUnmatchedDimension;\n};\n\n/**\n * Retrieves product dimensions with availabilities.\n * @param product - Product for which the dimensions need to be retrieved.\n * @param matchingDimensionValues - Selected dimensions - filter criteria for the dimensions API.\n * @param context - Action context.\n * @param catalogId - Catalog id.\n * @returns Array of dimensions.\n */\nconst getFullDimensions = async (\n product: SimpleProduct,\n matchingDimensionValues: ProductDimension[],\n context: IActionContext,\n catalogId?: number\n) => {\n let fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = [];\n\n const dimensionTypeValues: number[] = [];\n (product.Dimensions ?? []).map(dimension => {\n dimensionTypeValues.push(dimension.DimensionTypeValue);\n });\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValues: dimensionTypeValues,\n MatchingDimensionValues: matchingDimensionValues,\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: catalogId\n };\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n product.MasterProductId ? product.MasterProductId : product.RecordId,\n searchCriteria\n );\n const fullDimensionPromises = (product.Dimensions ?? []).map(productDimension => {\n return dimensionValuesPromise.then(dimensionValuesWithAvailabilities => {\n const dimensionValueWithAvailability = dimensionValuesWithAvailabilities.filter(\n dimension => dimension.DimensionTypeValue === productDimension.DimensionTypeValue\n );\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\n ...productDimension,\n dimensionValuesWithInventory: dimensionValueWithAvailability\n };\n return fullDimension;\n });\n });\n fullDimensions = await Promise.all(fullDimensionPromises);\n return fullDimensions;\n};\n\n/**\n * Retrieves product variant for the given input or undefined if not found.\n * @param input - Action input.\n * @param context - Action context.\n * @param fullDimensions - Product dimensions with availabilities.\n * @returns A product variant that is available or undefined.\n */\nconst getProductVariant = async (\n input: SelectedVariantInput,\n context: IActionContext,\n fullDimensions: IProductDimensionsWithAvailabilitiesFull[]\n) => {\n let productVariant: SimpleProduct | undefined;\n if (\n ArrayExtensions.hasElements(fullDimensions) &&\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory) &&\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory[0].ProductIds)\n ) {\n const variantProductId = fullDimensions[0].dimensionValuesWithInventory[0].ProductIds[0];\n const result = await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context),\n bypassCache: input.bypassCache\n },\n input.channelId,\n [variantProductId],\n null,\n input.catalogId ?? 0\n );\n productVariant = result[0];\n productVariant = { ...productVariant };\n const variantImageUrl = generateProductImageUrl(productVariant, context.requestContext.apiSettings);\n\n if (variantImageUrl) {\n productVariant.PrimaryImageUrl = variantImageUrl;\n }\n }\n\n return productVariant;\n};\n\n/**\n * Action method for the getSelectedVariant data action.\n * @param input - The action input class.\n * @param context - The action context.\n * @returns Simple product.\n */\nasync function getSelectedVariantAction(input: SelectedVariantInput, context: IActionContext): Promise {\n const matchingDimensionValues = input.matchingDimensionValues ?? getDimensionValuesFromQuery(context.requestContext.url.requestUrl);\n\n const result = await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context),\n bypassCache: input.bypassCache\n },\n input.channelId,\n [input.productId],\n null,\n input.catalogId ?? 0\n );\n let product = result[0];\n\n // Need to dereference this before editing it. Otherwise we might not\n // properly get the mobx events because if things aren't properly observable\n // they won't fire when you set them, and then if you don't deref the value in\n // the cache will match the value when you try to save it, so it won't detect any\n // changes there either\n product = { ...product };\n const hasUnmatchedDimension = checkIfHasUnmatchedDimensions(product, matchingDimensionValues);\n\n const newImageUrl = generateProductImageUrl(product, context.requestContext.apiSettings);\n\n if (newImageUrl) {\n product.PrimaryImageUrl = newImageUrl;\n }\n\n // Retrieve product variants only if matching dimensions are provided.\n let productVariant: SimpleProduct | undefined;\n if (ArrayExtensions.hasElements(matchingDimensionValues)) {\n const fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = await getFullDimensions(\n product,\n matchingDimensionValues,\n context,\n input.catalogId\n );\n\n productVariant = await getProductVariant(input, context, fullDimensions);\n }\n\n // Update dimension value back to the one that comes from API since the URL query might have a different format for the dimension values.\n if (productVariant?.Dimensions && product.Dimensions) {\n for (const dimension of product.Dimensions) {\n const matchedTargetDimensionFromApi = productVariant.Dimensions.find(\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\n );\n const matchedTargetDimensionFromSearch = matchingDimensionValues.find(\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\n );\n\n if (matchedTargetDimensionFromSearch && matchedTargetDimensionFromApi) {\n dimension.DimensionValue = matchedTargetDimensionFromApi.DimensionValue;\n }\n }\n }\n\n if (!hasUnmatchedDimension && ArrayExtensions.hasElements(matchingDimensionValues) && productVariant) {\n return productVariant;\n }\n\n const selectedProduct: ISelectedProduct = product;\n selectedProduct.productVariant = productVariant;\n return selectedProduct;\n}\n\n/**\n * The complete getSelectedVariant data action.\n */\nexport const getSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-selected-variant',\n action: getSelectedVariantAction as IAction,\n input: createInput\n});\n\nexport default getSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { LoyaltyCard } from '@msdyn365-commerce/retail-proxy';\nimport {\n getCustomerLoyaltyCardsAsync,\n getLoyaltyCardAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey, QueryResultSettingsProxy } from '.';\n\n/**\n * Input class for the getLoyaltyCard data action.\n */\nexport class GetLoyaltyCardInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetLoyaltyCard-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetLoyaltyCard';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getLoyaltyCard method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetLoyaltyCardInput = (inputData: ICreateActionContext): GetLoyaltyCardInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get loyalty card input. User is not authenticated.');\n }\n\n return new GetLoyaltyCardInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getLoyaltyCard data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getLoyaltyAction(input: GetLoyaltyCardInput, ctx: IActionContext): Promise {\n return getCustomerLoyaltyCardsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n input.userAccountNumber || null\n )\n .then(cards => {\n const cardTenderTypeBlocked = 3;\n cards = cards?.filter(card => card.CardTenderTypeValue !== cardTenderTypeBlocked);\n\n if (!cards || cards.length === 0) {\n return {};\n }\n\n const firstCard = cards[0];\n\n return getLoyaltyCardAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n firstCard.CardNumber\n )\n .then(card => {\n card.LoyaltyEnrollmentDate = firstCard.LoyaltyEnrollmentDate;\n card.LoyaltyEnrollmentDateLocal = firstCard.LoyaltyEnrollmentDateLocal;\n return card;\n })\n\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to get loyalty card');\n throw new Error('Unable to get loyalty card');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error.message);\n ctx.telemetry.debug('Unable to get customers loyalty card');\n throw new Error('Unable to get customers loyalty card');\n });\n}\n\n/**\n * The getLoyaltyCard data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const getLoyaltyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-loyalty-card',\n action: >getLoyaltyAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetLoyaltyCardInput\n});\n\nexport default getLoyaltyActionDataAction;\n","'use strict';\nvar ArrayBufferViewCore = require('../internals/array-buffer-view-core');\nvar $fill = require('../internals/array-fill');\nvar toBigInt = require('../internals/to-big-int');\nvar classof = require('../internals/classof');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\n\nvar aTypedArray = ArrayBufferViewCore.aTypedArray;\nvar exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;\nvar slice = uncurryThis(''.slice);\n\n// V8 ~ Chrome < 59, Safari < 14.1, FF < 55, Edge <=18\nvar CONVERSION_BUG = fails(function () {\n var count = 0;\n // eslint-disable-next-line es/no-typed-arrays -- safe\n new Int8Array(2).fill({ valueOf: function () { return count++; } });\n return count !== 1;\n});\n\n// `%TypedArray%.prototype.fill` method\n// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill\nexportTypedArrayMethod('fill', function fill(value /* , start, end */) {\n var length = arguments.length;\n aTypedArray(this);\n var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;\n return call($fill, this, actualValue, length > 1 ? arguments[1] : undefined, length > 2 ? arguments[2] : undefined);\n}, CONVERSION_BUG);\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar call = require('../internals/function-call');\nvar ArrayBufferViewCore = require('../internals/array-buffer-view-core');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toOffset = require('../internals/to-offset');\nvar toIndexedObject = require('../internals/to-object');\nvar fails = require('../internals/fails');\n\nvar RangeError = globalThis.RangeError;\nvar Int8Array = globalThis.Int8Array;\nvar Int8ArrayPrototype = Int8Array && Int8Array.prototype;\nvar $set = Int8ArrayPrototype && Int8ArrayPrototype.set;\nvar aTypedArray = ArrayBufferViewCore.aTypedArray;\nvar exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;\n\nvar WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS = !fails(function () {\n // eslint-disable-next-line es/no-typed-arrays -- required for testing\n var array = new Uint8ClampedArray(2);\n call($set, array, { length: 1, 0: 3 }, 1);\n return array[1] !== 3;\n});\n\n// https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other\nvar TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () {\n var array = new Int8Array(2);\n array.set(1);\n array.set('2', 1);\n return array[0] !== 0 || array[1] !== 2;\n});\n\n// `%TypedArray%.prototype.set` method\n// https://tc39.es/ecma262/#sec-%typedarray%.prototype.set\nexportTypedArrayMethod('set', function set(arrayLike /* , offset */) {\n aTypedArray(this);\n var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);\n var src = toIndexedObject(arrayLike);\n if (WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS) return call($set, this, src, offset);\n var length = this.length;\n var len = lengthOfArrayLike(src);\n var index = 0;\n if (len + offset > length) throw new RangeError('Wrong length');\n while (index < len) this[offset + index] = src[index++];\n}, !WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar fails = require('../internals/fails');\nvar aCallable = require('../internals/a-callable');\nvar internalSort = require('../internals/array-sort');\nvar ArrayBufferViewCore = require('../internals/array-buffer-view-core');\nvar FF = require('../internals/environment-ff-version');\nvar IE_OR_EDGE = require('../internals/environment-is-ie-or-edge');\nvar V8 = require('../internals/environment-v8-version');\nvar WEBKIT = require('../internals/environment-webkit-version');\n\nvar aTypedArray = ArrayBufferViewCore.aTypedArray;\nvar exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;\nvar Uint16Array = globalThis.Uint16Array;\nvar nativeSort = Uint16Array && uncurryThis(Uint16Array.prototype.sort);\n\n// WebKit\nvar ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !(fails(function () {\n nativeSort(new Uint16Array(2), null);\n}) && fails(function () {\n nativeSort(new Uint16Array(2), {});\n}));\n\nvar STABLE_SORT = !!nativeSort && !fails(function () {\n // feature detection can be too slow, so check engines versions\n if (V8) return V8 < 74;\n if (FF) return FF < 67;\n if (IE_OR_EDGE) return true;\n if (WEBKIT) return WEBKIT < 602;\n\n var array = new Uint16Array(516);\n var expected = Array(516);\n var index, mod;\n\n for (index = 0; index < 516; index++) {\n mod = index % 4;\n array[index] = 515 - index;\n expected[index] = index - 2 * mod + 3;\n }\n\n nativeSort(array, function (a, b) {\n return (a / 4 | 0) - (b / 4 | 0);\n });\n\n for (index = 0; index < 516; index++) {\n if (array[index] !== expected[index]) return true;\n }\n});\n\nvar getSortCompare = function (comparefn) {\n return function (x, y) {\n if (comparefn !== undefined) return +comparefn(x, y) || 0;\n // eslint-disable-next-line no-self-compare -- NaN check\n if (y !== y) return -1;\n // eslint-disable-next-line no-self-compare -- NaN check\n if (x !== x) return 1;\n if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;\n return x > y;\n };\n};\n\n// `%TypedArray%.prototype.sort` method\n// https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort\nexportTypedArrayMethod('sort', function sort(comparefn) {\n if (comparefn !== undefined) aCallable(comparefn);\n if (STABLE_SORT) return nativeSort(this, comparefn);\n\n return internalSort(aTypedArray(this), getSortCompare(comparefn));\n}, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar apply = require('../internals/function-apply');\nvar ArrayBufferViewCore = require('../internals/array-buffer-view-core');\nvar fails = require('../internals/fails');\nvar arraySlice = require('../internals/array-slice');\n\nvar Int8Array = globalThis.Int8Array;\nvar aTypedArray = ArrayBufferViewCore.aTypedArray;\nvar exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;\nvar $toLocaleString = [].toLocaleString;\n\n// iOS Safari 6.x fails here\nvar TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {\n $toLocaleString.call(new Int8Array(1));\n});\n\nvar FORCED = fails(function () {\n return [1, 2].toLocaleString() !== new Int8Array([1, 2]).toLocaleString();\n}) || !fails(function () {\n Int8Array.prototype.toLocaleString.call([1, 2]);\n});\n\n// `%TypedArray%.prototype.toLocaleString` method\n// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring\nexportTypedArrayMethod('toLocaleString', function toLocaleString() {\n return apply(\n $toLocaleString,\n TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this),\n arraySlice(arguments)\n );\n}, FORCED);\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 { CartConfiguration, CartsDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for the getCartConfiguration data action.\n * The life time of the data action is 'application'.\n */\nexport class CartConfigurationInput implements IActionInput {\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'cartConfiguration';\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'cartConfiguration';\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput method for the getCartConfiguration method.\n * @param inputData -- The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nexport const createCartConfigurationInputInput = (inputData: ICreateActionContext>): IActionInput => {\n return new CartConfigurationInput();\n};\n\n/**\n * The action method for the getCartConfiguration data action.\n * @param input -- The action input.\n * @param ctx -- The action context.\n * @returns -- cart configuration.\n */\nexport async function getCartConfigurationAction(input: CartConfigurationInput, ctx: IActionContext): Promise {\n const cartConfiguration = await CartsDataActions.getConfigurationAsync({ callerContext: ctx });\n return cartConfiguration;\n}\n\n/**\n * The getCartConfiguration data action.\n * Gets the cart configuration state via the read RetailServer API.\n * @returns Address information associated with the retrieved customer.\n */\nexport const getCartConfigurationDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-cart-configuration',\n action: getCartConfigurationAction as IAction,\n input: createCartConfigurationInputInput\n});\n\nexport default getCartConfigurationDataAction;\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 {\n InventoryAvailabilitySearchCriteria,\n ProductAvailableQuantity,\n ProductWarehouseInventoryAvailability,\n ProductWarehouseInventoryInformation,\n SearchArea\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { DeliveryMode, InventoryLevels, InventoryLevelValues, IProductInventoryInformation } from './product-inventory-information';\n\n/**\n * The function defines whether the inventory label should be displayed or not.\n * @param context - The action context.\n * @param inventoryCode - The inventory code.\n * @returns Boolean.\n */\nexport function displayLabelEnabled(context: IActionContext, inventoryCode?: string): boolean {\n if (!inventoryCode) {\n return false;\n }\n\n // eslint-disable-next-line default-case\n switch (context.requestContext.app.config.inventoryRanges) {\n case 'lowAndOutofStock':\n if (inventoryCode !== InventoryLevelValues.available) {\n return true;\n }\n break;\n case 'outOfStock':\n if (inventoryCode === InventoryLevelValues.outOfStock) {\n return true;\n }\n break;\n case 'all':\n return true;\n }\n return false;\n}\n\n/**\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity.\n * @param context - The action context.\n * @param productsWarehouseInventory - The product warehouse inventory information.\n * @returns IProductInventoryInformation[].\n */\nexport function mapProductInventoryInformation(\n context: IActionContext,\n productsWarehouseInventory?: ProductWarehouseInventoryAvailability[]\n): IProductInventoryInformation[] {\n const productInventoryInformation: IProductInventoryInformation[] = [];\n\n if (context.requestContext.app.config.enableStockCheck === undefined || context.requestContext.app.config.enableStockCheck === false) {\n return productInventoryInformation;\n }\n\n if (productsWarehouseInventory && productsWarehouseInventory.length > 0) {\n for (const product of productsWarehouseInventory) {\n switch (context.requestContext.app.config.inventoryLevel) {\n case InventoryLevels.physicalAvailable:\n // Inventory level is enabled with Physical inventory\n const physicalProductMap = mapInventoryWithPhysicalBufferEnabled(context, product);\n if (physicalProductMap) {\n productInventoryInformation.push(physicalProductMap);\n }\n break;\n case InventoryLevels.totalAvailable:\n // Inventory level is enabled with Total available inventory\n const totalAvailableProductMap = mapInventoryWithTotalAvailableBufferEnabled(context, product);\n if (totalAvailableProductMap) {\n productInventoryInformation.push(totalAvailableProductMap);\n }\n break;\n default:\n // When inventory level is inventoryThreshold or not defined\n const productMap = mapInventoryWithThresholdEnabled(context, product);\n if (productMap) {\n productInventoryInformation.push(productMap);\n }\n break;\n }\n }\n }\n\n return productInventoryInformation;\n}\n\n/**\n * The function that maps inventory for when threshold is selected.\n * @param context - The action context.\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\n * @returns IProductInventoryInformation.\n */\nexport function mapInventoryWithThresholdEnabled(\n context: IActionContext,\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\n): IProductInventoryInformation | null {\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\n const productQty = productWarehouseInventoryAvailability.TotalAvailable - context.requestContext.app.config.outOfStockThreshold;\n const productAvailableQuantity: ProductAvailableQuantity = {\n ProductId: productWarehouseInventoryAvailability.ProductId,\n AvailableQuantity: productQty > 0 ? productQty : 0\n };\n\n return {\n ProductAvailableQuantity: productAvailableQuantity,\n IsProductAvailable: !!(productAvailableQuantity.AvailableQuantity && productAvailableQuantity.AvailableQuantity > 0),\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\n };\n }\n\n return null;\n}\n\n/**\n * The function that maps inventory for when physical available is selected.\n * @param context - The action context.\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\n * @returns IProductInventoryInformation.\n */\nexport function mapInventoryWithPhysicalBufferEnabled(\n context: IActionContext,\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\n): IProductInventoryInformation | null {\n const shouldRenderLabel = displayLabelEnabled(context, productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode);\n\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\n // As per the new buffer logic from RS,\n // if code is out of stock then we set the available quantity to 0 regardless of the actual value from API\n let productQuantity: number | undefined = 0;\n if (productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode !== InventoryLevelValues.outOfStock) {\n productQuantity =\n productWarehouseInventoryAvailability.MaximumPurchasablePhysicalAvailableQuantity ??\n productWarehouseInventoryAvailability.PhysicalAvailable;\n }\n\n const productAvailableQuantity: ProductAvailableQuantity = {\n ProductId: productWarehouseInventoryAvailability.ProductId,\n AvailableQuantity: productQuantity\n };\n return {\n ProductAvailableQuantity: productAvailableQuantity,\n StockLevelCode: shouldRenderLabel ? productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode : undefined,\n StockLevelLabel: shouldRenderLabel ? productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelLabel : undefined,\n IsProductAvailable: productAvailableQuantity.AvailableQuantity !== undefined && productAvailableQuantity.AvailableQuantity > 0,\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\n };\n }\n\n return null;\n}\n\n/**\n * The function that maps inventory for when total available is selected.\n * @param context - The action context.\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\n * @returns IProductInventoryInformation.\n */\nexport function mapInventoryWithTotalAvailableBufferEnabled(\n context: IActionContext,\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\n): IProductInventoryInformation | null {\n const shouldRenderLabel = displayLabelEnabled(context, productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode);\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\n // As per the new buffer logic from RS,\n // if code is out of stock then we set the available quantity to 0 regardless of the actual value from API\n let productQuantity: number | undefined = 0;\n if (productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode !== InventoryLevelValues.outOfStock) {\n productQuantity =\n productWarehouseInventoryAvailability.MaximumPurchasableTotalAvailableQuantity ??\n productWarehouseInventoryAvailability.TotalAvailable;\n }\n\n const productAvailableQuantity: ProductAvailableQuantity = {\n ProductId: productWarehouseInventoryAvailability.ProductId,\n AvailableQuantity: productQuantity\n };\n return {\n ProductAvailableQuantity: productAvailableQuantity,\n StockLevelCode: shouldRenderLabel ? productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode : undefined,\n StockLevelLabel: shouldRenderLabel ? productWarehouseInventoryAvailability.TotalAvailableInventoryLevelLabel : undefined,\n // eslint-disable-next-line eqeqeq\n IsProductAvailable: productAvailableQuantity.AvailableQuantity != undefined && productAvailableQuantity.AvailableQuantity > 0,\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\n };\n }\n\n return null;\n}\n\n/**\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\n * @param context - The action context.\n * @returns Boolean.\n */\nexport function isAggregatedInventory(context: IActionContext): boolean {\n // If warehouse aggregated is true then query inventory from multiple warehouses\n // else query from single warehouse\n return (\n (context.requestContext.app.config.inventoryLevel === InventoryLevels.totalAvailable ||\n context.requestContext.app.config.inventoryLevel === InventoryLevels.physicalAvailable) &&\n context.requestContext.app.config.warehouseAggregation === 'multiple'\n );\n}\n\n/**\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\n * @param context - The action context.\n * @param productWarehouseInventoryInformation - The product ware house inventory information.\n * @returns ProductWarehouseInventoryInformation.\n */\nexport function mapAggregatedProductInventoryInformation(\n context: IActionContext,\n productWarehouseInventoryInformation: ProductWarehouseInventoryInformation\n): IProductInventoryInformation[] {\n if (isAggregatedInventory(context)) {\n const productInventoryMapping:\n | ProductWarehouseInventoryAvailability[]\n | undefined = productWarehouseInventoryInformation.AggregatedProductInventoryAvailabilities?.map(product => {\n return {\n DataAreaId: product.DataAreaId,\n MaximumPurchasablePhysicalAvailableQuantity:\n product.MaximumPurchasablePhysicalAvailableQuantity ?? product.PhysicalAvailableQuantity,\n MaximumPurchasableTotalAvailableQuantity:\n product.MaximumPurchasableTotalAvailableQuantity ?? product.TotalAvailableQuantity,\n ProductId: product.ProductId,\n PhysicalAvailable: product.PhysicalAvailableQuantity,\n PhysicalAvailableInventoryLevelCode: product.PhysicalAvailableInventoryLevelCode,\n PhysicalAvailableInventoryLevelLabel: product.PhysicalAvailableInventoryLevelLabel,\n TotalAvailable: product.TotalAvailableQuantity,\n TotalAvailableInventoryLevelCode: product.TotalAvailableInventoryLevelCode,\n TotalAvailableInventoryLevelLabel: product.TotalAvailableInventoryLevelLabel\n };\n });\n return mapProductInventoryInformation(context, productInventoryMapping);\n }\n\n return mapProductInventoryInformation(context, productWarehouseInventoryInformation.ProductWarehouseInventoryAvailabilities);\n}\n\n/**\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\n * @param context - The action context.\n * @param productIds - The product id collection.\n * @param isDefaultWareHouse - Flag to define whether inventory is from default warehouse or not.\n * @param isFilterByChannelFulfillmentGroup - Filter by fulfillment group.\n * @param searchArea - The search area.\n * @param defaultDeliveryMode - The delivery mode.\n * @returns InventoryAvailabilitySearchCriteria.\n */\nexport function createInventoryAvailabilitySearchCriteria(\n context: IActionContext,\n productIds: number[],\n isDefaultWareHouse?: boolean,\n isFilterByChannelFulfillmentGroup?: boolean,\n searchArea?: SearchArea,\n defaultDeliveryMode?: DeliveryMode\n): InventoryAvailabilitySearchCriteria {\n const salesUnitType = 2;\n const deliveryMode = defaultDeliveryMode ? defaultDeliveryMode : DeliveryMode.shipping;\n\n const inventoryAvailabilitySearchCriteria: InventoryAvailabilitySearchCriteria = {\n ProductIds: productIds,\n QuantityUnitTypeValue: salesUnitType,\n SearchArea: searchArea\n };\n\n if (isAggregatedInventory(context)) {\n inventoryAvailabilitySearchCriteria.FilterByChannelFulfillmentGroup = true;\n inventoryAvailabilitySearchCriteria.DeliveryModeTypeFilterValue = deliveryMode;\n } else {\n inventoryAvailabilitySearchCriteria.DefaultWarehouseOnly = isDefaultWareHouse;\n inventoryAvailabilitySearchCriteria.FilterByChannelFulfillmentGroup = isFilterByChannelFulfillmentGroup;\n }\n\n return inventoryAvailabilitySearchCriteria;\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 IRequestContext,\n getCustomerAccountNumberForAllChannelType\n} from '@msdyn365-commerce/core';\nimport { CatalogsDataActions, ProductCatalog } from '@msdyn365-commerce/retail-proxy';\n\nimport { generateCacheKey } from './utilities';\n\n/**\n * Input for get-catalogs data action.\n */\nexport class CatalogsInput implements IActionInput {\n public readonly channelId: number;\n\n public readonly customerAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n public constructor(context: IRequestContext, customerAccountNumber?: string) {\n this.channelId = context.apiSettings.channelId ? Number(context.apiSettings.channelId) : 0;\n this.customerAccountNumber = customerAccountNumber ? customerAccountNumber : getCustomerAccountNumberForAllChannelType(context);\n\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string =>\n generateCacheKey(\n this.apiSettings,\n { key: 'CustomerAccountNumber', value: this.customerAccountNumber },\n { key: 'Locale', value: this.locale }\n );\n\n /**\n * Get Cache object type.\n * @returns - Cache object type.\n */\n public getCacheObjectType = (): string => 'productCatalogs';\n\n /**\n * Get data cache type.\n * @returns - Cache type enum.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData - The input data passed to the createInput method.\n * @param customerAccountNumber - Customer account number.\n * @returns - Catalogs input.\n */\nexport const createCatalogsInput = (inputData: ICreateActionContext>, customerAccountNumber?: string): IActionInput => {\n if (!inputData.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get product catalog. User is not authenticated.');\n }\n return new CatalogsInput(inputData.requestContext, customerAccountNumber);\n};\n\n/**\n * Calls the Retail API and returns the product catalog for an user.\n * @param input - Catalogs Input.\n * @param context - Current context.\n * @returns - Product catalog for the user.\n */\nexport async function getCatalogAction(input: CatalogsInput, context: IActionContext): Promise {\n const productCatalogs = await CatalogsDataActions.getCatalogsAsync(\n { callerContext: context, bypassCache: 'getAndPut' },\n input.channelId,\n true\n );\n return productCatalogs;\n}\n\n/**\n * The GetProductCatalogs Data Action\n * Returns product catalogs.\n */\nexport const getCatalogActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-catalogs',\n action: getCatalogAction as IAction,\n input: createCatalogsInput\n});\n\nexport default getCatalogActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { CustomerBalances } from '@msdyn365-commerce/retail-proxy';\nimport { getCustomerBalanceAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport getCustomer, { GetCustomerInput } from './get-customer';\n\n/**\n * Input class for the GetCustomerBalance data action.\n */\nexport class GetCustomerBalanceInput implements IActionInput {\n public customerAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, customerAccountNumber?: string) {\n this.customerAccountNumber = customerAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`CustomerBalance-${this.customerAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetCustomerBalance';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetCustomerBalance method.\n * @param inputData The input data passed to the createInput method.\n */\n\nexport const createGetCustomerBalanceInput = (inputData: ICreateActionContext): GetCustomerBalanceInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get customer balance input. User is not authenticated.');\n }\n\n return new GetCustomerBalanceInput(requestContext.apiSettings);\n};\n\n/**\n * The action method for the GetCustomerBalance data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getCustomerBalanceAction(input: GetCustomerBalanceInput, ctx: IActionContext): Promise {\n const customerInput = new GetCustomerInput(input.apiSettings, input.customerAccountNumber);\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n ctx.telemetry.error('Not able to get customer', new Error('Not able to get customer'));\n }\n\n return getCustomerBalanceAsync(\n {\n callerContext: ctx,\n queryResultSettings: {}\n },\n customer.AccountNumber,\n customer.InvoiceAccount\n );\n}\n\n/**\n * The GetCustomerBalance data action\n * Returns the customer's balance.\n */\nexport const getCustomerBalanceActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer-balance',\n action: >getCustomerBalanceAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetCustomerBalanceInput\n});\n\nexport default getCustomerBalanceActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetByCustomerInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CommerceListsDataActions.g';\nimport { CommerceList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nconst createWishlistInput = (inputData: ICreateActionContext) => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetByCustomerInput({}, null);\n }\n\n throw new Error('[get-wishlist-by-customer-id] Unable to create input for getWishlists');\n};\n\n/**\n * Get Org Unit Configuration Data Action.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-wishlist-by-customer-id',\n action: >retailAction,\n input: createWishlistInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCatalogId, IRequestContext, versionLt } from '@msdyn365-commerce/core-internal';\nimport { ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\nimport { getActivePricesAsync, getProductRatingsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getSimpleProducts, { ProductInput } from './get-simple-products';\nimport { ArrayExtensions, QueryResultSettingsProxy } from './utilities';\nimport { generateCacheKey, getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Full Product Input.\n */\nexport class FullProductInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public readonly catalogId?: number;\n\n public ProductDetailsCriteria: ProductDetailsCriteria;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n productId: number | string,\n apiSettings: ICommerceApiSettings,\n criteria: ProductDetailsCriteria,\n requestContext?: IRequestContext,\n catalogId?: number\n ) {\n this.productId = typeof productId === 'string' ? Number.parseInt(productId, 10) : productId;\n this.ProductDetailsCriteria = criteria;\n this.apiSettings = apiSettings;\n this.channelId = apiSettings.channelId;\n this.catalogId = catalogId;\n\n if (this.catalogId === undefined && requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () => {\n return generateCacheKey(\n this.apiSettings,\n { key: 'ProductId', value: this.productId },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'ShouldGetPrice', value: this.ProductDetailsCriteria.getPrice },\n { key: 'ShouldGetRating', value: this.ProductDetailsCriteria.getRating }\n );\n };\n\n public getCacheObjectType = () => 'FullProduct';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Class to define criteria to get full product like price, ratings etc.\n */\nexport class ProductDetailsCriteria {\n public getPrice: boolean;\n\n public getRating: boolean;\n\n constructor(getPrice?: boolean, getRating?: boolean) {\n this.getPrice = getPrice || false;\n this.getRating = getRating || false;\n }\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createInput = (inputData: ICreateActionContext>): IActionInput[] => {\n let productIds = inputData.config && inputData.config.productIds;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n if (typeof productIds === 'string') {\n productIds = productIds.split(',');\n }\n if (Array.isArray(productIds) && productIds.length > 0) {\n return productIds.map((productId: string) => {\n return new FullProductInput(+productId, inputData.requestContext.apiSettings, productDetailsCriteria, inputData.requestContext);\n });\n }\n return [];\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed ProductInput.\n * @param inputs\n * @param ctx\n */\nexport async function getFullProductsAction(inputs: FullProductInput[], ctx: IActionContext): Promise {\n if (!Array.isArray(inputs) || inputs.length === 0) {\n ctx.trace('[getFullProductsAction] Invalid or empty inputs passed.');\n return {};\n }\n\n const { apiSettings } = ctx.requestContext;\n const productInputs = inputs.map(\n (input: FullProductInput): ProductInput => {\n return new ProductInput(input.productId, apiSettings, undefined, undefined, ctx.requestContext, input.catalogId);\n }\n );\n\n return getSimpleProducts(productInputs, ctx)\n .then(result => {\n return result.map(product => {\n return { ProductDetails: product };\n });\n })\n .then((productCollection: FullProduct[]) => {\n const validProductIds = new Set(productCollection.map(input => input.ProductDetails && input.ProductDetails.RecordId));\n\n const ratingsAndPricePromises = [\n _getActivePrices(inputs, validProductIds, productCollection, ctx),\n _getProductRatings(inputs, validProductIds, productCollection, ctx)\n ];\n return Promise.all(ratingsAndPricePromises).then(() => {\n return productCollection;\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to get Simple products');\n return [];\n });\n}\n\nasync function _getActivePrices(\n inputs: FullProductInput[],\n validProductIds: Set,\n productCollection: FullProduct[],\n ctx: IActionContext\n): Promise {\n let catalogId = 0;\n if (ArrayExtensions.hasElements(inputs)) {\n catalogId = inputs[0].catalogId ?? 0;\n }\n\n const projectDomain: ProjectionDomain = { ChannelId: +ctx.requestContext.apiSettings.channelId, CatalogId: catalogId };\n const validInputs = inputs\n .filter(input => input.ProductDetailsCriteria.getPrice && validProductIds.has(input.productId))\n .map(input => input.productId)\n .filter(Boolean);\n\n if (validInputs.length === 0) {\n return Promise.resolve();\n }\n\n return getActivePricesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n projectDomain,\n validInputs,\n new Date(),\n null,\n undefined,\n true\n )\n .then(result => {\n result.forEach(productPrice => {\n const fullProduct: FullProduct | undefined = productCollection.find(x => {\n return x.ProductDetails && x.ProductDetails.RecordId === productPrice.ProductId;\n });\n if (fullProduct) {\n // If RS Version < 9.16.0 (aka 10.0.6), customer contextual price won't be\n // included so instead just use AdjustedPrice\n if (versionLt(ctx.requestContext.apiSettings.retailServerProxyVersion, '9.16.0')) {\n productPrice.CustomerContextualPrice = productPrice.AdjustedPrice;\n }\n fullProduct.ProductPrice = productPrice;\n }\n });\n })\n .catch((error: Error) => {\n const telemetry = ctx.telemetry;\n telemetry.debug('[getActivePricesAsync] Unable to get active price.');\n telemetry.exception(error);\n });\n}\n\nasync function _getProductRatings(\n inputs: FullProductInput[],\n validProductIds: Set,\n productCollection: FullProduct[],\n ctx: IActionContext\n): Promise {\n const validInputs = inputs\n .filter(input => input.ProductDetailsCriteria.getRating && validProductIds.has(input.productId))\n .map(input => input.productId)\n .filter(Boolean);\n\n if (validInputs.length === 0) {\n return Promise.resolve();\n }\n\n return getProductRatingsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n validInputs\n )\n .then(result => {\n result.forEach(productRating => {\n const fullProduct: FullProduct | undefined = productCollection.find(x => {\n return x.ProductDetails && x.ProductDetails.RecordId === productRating.ProductId;\n });\n if (fullProduct) {\n fullProduct.ProductRating = productRating;\n }\n });\n })\n .catch(error => {\n const telemetry = ctx.telemetry;\n telemetry.debug('[getProductRatingsAsync] Unable to get product ratings.');\n telemetry.exception(error);\n });\n}\n\nexport const getFullProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products',\n action: >getFullProductsAction,\n input: createInput,\n isBatched: true\n});\n\nexport default getFullProductsActionDataAction;\n","'use strict';\nvar NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-basic-detection');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar globalThis = require('../internals/global-this');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar classof = require('../internals/classof');\nvar tryToString = require('../internals/try-to-string');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar uid = require('../internals/uid');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar Int8Array = globalThis.Int8Array;\nvar Int8ArrayPrototype = Int8Array && Int8Array.prototype;\nvar Uint8ClampedArray = globalThis.Uint8ClampedArray;\nvar Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;\nvar TypedArray = Int8Array && getPrototypeOf(Int8Array);\nvar TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);\nvar ObjectPrototype = Object.prototype;\nvar TypeError = globalThis.TypeError;\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');\nvar TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';\n// Fixing native typed arrays in Opera Presto crashes the browser, see #595\nvar NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== 'Opera';\nvar TYPED_ARRAY_TAG_REQUIRED = false;\nvar NAME, Constructor, Prototype;\n\nvar TypedArrayConstructorsList = {\n Int8Array: 1,\n Uint8Array: 1,\n Uint8ClampedArray: 1,\n Int16Array: 2,\n Uint16Array: 2,\n Int32Array: 4,\n Uint32Array: 4,\n Float32Array: 4,\n Float64Array: 8\n};\n\nvar BigIntArrayConstructorsList = {\n BigInt64Array: 8,\n BigUint64Array: 8\n};\n\nvar isView = function isView(it) {\n if (!isObject(it)) return false;\n var klass = classof(it);\n return klass === 'DataView'\n || hasOwn(TypedArrayConstructorsList, klass)\n || hasOwn(BigIntArrayConstructorsList, klass);\n};\n\nvar getTypedArrayConstructor = function (it) {\n var proto = getPrototypeOf(it);\n if (!isObject(proto)) return;\n var state = getInternalState(proto);\n return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);\n};\n\nvar isTypedArray = function (it) {\n if (!isObject(it)) return false;\n var klass = classof(it);\n return hasOwn(TypedArrayConstructorsList, klass)\n || hasOwn(BigIntArrayConstructorsList, klass);\n};\n\nvar aTypedArray = function (it) {\n if (isTypedArray(it)) return it;\n throw new TypeError('Target is not a typed array');\n};\n\nvar aTypedArrayConstructor = function (C) {\n if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;\n throw new TypeError(tryToString(C) + ' is not a typed array constructor');\n};\n\nvar exportTypedArrayMethod = function (KEY, property, forced, options) {\n if (!DESCRIPTORS) return;\n if (forced) for (var ARRAY in TypedArrayConstructorsList) {\n var TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {\n delete TypedArrayConstructor.prototype[KEY];\n } catch (error) {\n // old WebKit bug - some methods are non-configurable\n try {\n TypedArrayConstructor.prototype[KEY] = property;\n } catch (error2) { /* empty */ }\n }\n }\n if (!TypedArrayPrototype[KEY] || forced) {\n defineBuiltIn(TypedArrayPrototype, KEY, forced ? property\n : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);\n }\n};\n\nvar exportTypedArrayStaticMethod = function (KEY, property, forced) {\n var ARRAY, TypedArrayConstructor;\n if (!DESCRIPTORS) return;\n if (setPrototypeOf) {\n if (forced) for (ARRAY in TypedArrayConstructorsList) {\n TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try {\n delete TypedArrayConstructor[KEY];\n } catch (error) { /* empty */ }\n }\n if (!TypedArray[KEY] || forced) {\n // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable\n try {\n return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);\n } catch (error) { /* empty */ }\n } else return;\n }\n for (ARRAY in TypedArrayConstructorsList) {\n TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {\n defineBuiltIn(TypedArrayConstructor, KEY, property);\n }\n }\n};\n\nfor (NAME in TypedArrayConstructorsList) {\n Constructor = globalThis[NAME];\n Prototype = Constructor && Constructor.prototype;\n if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n else NATIVE_ARRAY_BUFFER_VIEWS = false;\n}\n\nfor (NAME in BigIntArrayConstructorsList) {\n Constructor = globalThis[NAME];\n Prototype = Constructor && Constructor.prototype;\n if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n}\n\n// WebKit bug - typed arrays constructors prototype is Object.prototype\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {\n // eslint-disable-next-line no-shadow -- safe\n TypedArray = function TypedArray() {\n throw new TypeError('Incorrect invocation');\n };\n if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray);\n }\n}\n\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {\n TypedArrayPrototype = TypedArray.prototype;\n if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype);\n }\n}\n\n// WebKit bug - one more object in Uint8ClampedArray prototype chain\nif (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {\n setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);\n}\n\nif (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {\n TYPED_ARRAY_TAG_REQUIRED = true;\n defineBuiltInAccessor(TypedArrayPrototype, TO_STRING_TAG, {\n configurable: true,\n get: function () {\n return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;\n }\n });\n for (NAME in TypedArrayConstructorsList) if (globalThis[NAME]) {\n createNonEnumerableProperty(globalThis[NAME], TYPED_ARRAY_TAG, NAME);\n }\n}\n\nmodule.exports = {\n NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,\n TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,\n aTypedArray: aTypedArray,\n aTypedArrayConstructor: aTypedArrayConstructor,\n exportTypedArrayMethod: exportTypedArrayMethod,\n exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,\n getTypedArrayConstructor: getTypedArrayConstructor,\n isView: isView,\n isTypedArray: isTypedArray,\n TypedArray: TypedArray,\n TypedArrayPrototype: TypedArrayPrototype\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { Address } from '@msdyn365-commerce/retail-proxy';\n\nimport getCustomer, { GetCustomerInput } from './get-customer';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for the getAddress data action.\n */\nexport class AddressInput implements IActionInput {\n public userAccountNumber?: string;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetAddress-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetAddress';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getAddress method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetAddressInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create address input. User is not authenticated.');\n }\n\n return new AddressInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getAddress data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getAddressAction(input: AddressInput, ctx: IActionContext): Promise {\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, input.userAccountNumber);\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n throw new Error('Not able to get customer');\n }\n\n return customer.Addresses || [];\n}\n\n/**\n * The getAddress data action\n * Gets a customers information via the read RetailServer API\n * Returns address information associated with the retrieved customer.\n */\nexport const getAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-address',\n action: >getAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetAddressInput\n});\n\nexport default getAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\n\nimport { OrderTemplate } from '../utilities/order-templates';\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\nimport getFullOrderTemplates, { GetFullOrderTemplatesInput } from './get-full-order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetOrderTemplatesPreviewInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n\n constructor(queryResultSettings: IQueryResultSettings) {\n this.queryResultSettings = queryResultSettings;\n this.queryResultSettings.count = true;\n this.queryResultSettings.Paging!.Top = 4;\n }\n\n public getCacheKey = () => 'GetOrderTemplatesPreview';\n\n public getCacheObjectType = () => 'GetOrderTemplatesPreview';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetOrderTemplatesPreviewInput = (inputData: ICreateActionContext): GetOrderTemplatesPreviewInput => {\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return new GetOrderTemplatesPreviewInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetOrderTemplatesPreview data action.\n * @param input The action input.\n * @param context The action context.\n */\nexport async function getOrderTemplatesPreview(input: GetOrderTemplatesPreviewInput, context: IActionContext): Promise {\n const response: OrderTemplate[] = [];\n if (!context.requestContext.user.isAuthenticated) {\n context.trace('Unable to get order templates preview. User is not authenticated.');\n return Promise.resolve(response);\n }\n return getFullOrderTemplates(new GetFullOrderTemplatesInput(input.queryResultSettings, false, false), context);\n}\n\n/**\n * The GetOrderTemplatesPreview Data Action\n * Returns order templates.\n */\nexport const getOrderTemplatesPreviewDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-order-templates-preview',\n action: >getOrderTemplatesPreview,\n input: createGetOrderTemplatesPreviewInput\n});\n\nexport default getOrderTemplatesPreviewDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IDictionary,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ArrayExtensions, generateCacheKey } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateProductImageUrl } from './utilities/utils';\n\n/**\n * Product Input.\n */\nexport class ProductInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public warehouseId?: string;\n\n public catalogId?: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n productId: number | string,\n apiSettings: ICommerceApiSettings,\n channelId?: number,\n warehouseId?: string,\n requestContext?: IRequestContext,\n catalogId?: number\n ) {\n this.apiSettings = apiSettings;\n this.productId = +productId;\n this.channelId = channelId || apiSettings.channelId;\n this.warehouseId = warehouseId;\n this.catalogId = catalogId;\n\n if (requestContext && catalogId === undefined) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'ProductRecordId', value: this.productId },\n { key: 'ChannelId', value: this.channelId },\n { key: 'WarehouseId', value: this.warehouseId },\n { key: 'CatalogId', value: this.catalogId }\n );\n\n public getCacheObjectType = () => 'SimpleProduct';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createSimpleProductsInput = (inputData: ICreateActionContext>): IActionInput[] => {\n let productIds = inputData.config && inputData.config.productIds;\n if (!productIds) {\n return [];\n }\n\n productIds = typeof productIds === 'string' ? productIds.split(',') : productIds;\n return !Array.isArray(productIds)\n ? []\n : productIds.map((productId: string) => {\n return new ProductInput(productId, inputData.requestContext.apiSettings, undefined, undefined, inputData.requestContext);\n });\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed ProductInput.\n * @param inputs\n * @param ctx\n */\nexport async function getSimpleProductsAction(inputs: ProductInput[], ctx: IActionContext): Promise {\n if (!ArrayExtensions.hasElements(inputs)) {\n ctx.trace('[getSimpleProductsAction] Invalid or empty inputs passed.');\n return [];\n }\n\n const productIdMapping: IDictionary = {};\n\n for (let index = 0; index < inputs.length; ++index) {\n productIdMapping[inputs[index].productId] = index;\n }\n\n const getProductPromises: Promise[] = [];\n const catalogIds = ArrayExtensions.unique(inputs.map(input => input.catalogId));\n for (const catalogId of catalogIds) {\n const productInputs = inputs.filter(input => input.catalogId === catalogId);\n let queryResult = QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx);\n if (ArrayExtensions.hasElements(productInputs) && productInputs.length > ctx.requestContext?.app?.platform?.defaultPageSizeForAPI) {\n queryResult = {\n Paging: {\n Top: productInputs.length\n }\n };\n }\n getProductPromises.push(\n getByIdsAsync(\n { callerContext: ctx, queryResultSettings: queryResult },\n inputs[0].channelId,\n productInputs.map(input => input.productId),\n inputs[0].warehouseId ?? null,\n catalogId ?? 0\n )\n .then(response => {\n return response;\n })\n .catch(error => {\n ctx.telemetry.debug(`[getSimpleProductsAction] Error in getting response from server. ${error}`);\n return {};\n })\n );\n }\n\n const products = ArrayExtensions.flatten(await Promise.all(getProductPromises));\n const mappedProducts = products\n .map(product => {\n try {\n const newImageUrl = generateProductImageUrl(product, ctx.requestContext.apiSettings);\n\n if (newImageUrl) {\n product.PrimaryImageUrl = newImageUrl;\n }\n\n return product;\n } catch {\n ctx.trace('[getSimpleProductsAction] Unable to update ImageURL for Product');\n return undefined;\n }\n })\n .reduce((memo: SimpleProduct[], product: SimpleProduct | undefined) => {\n if (!product) {\n return memo;\n }\n const index = productIdMapping[product.RecordId];\n memo[index] = product;\n return memo;\n }, []);\n\n // NOTE: This is not an ideal fix, but will resolve all current issues\n return inputs.map(input => {\n const foundProduct = mappedProducts.find(product => product && product.RecordId === input.productId);\n return foundProduct || {};\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-simple-products',\n action: >getSimpleProductsAction,\n input: createSimpleProductsInput,\n isBatched: true\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy';\nimport { createReadAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport getCustomer, { GetCustomerInput } from './get-customer';\n\nexport interface IAddressManagementData {\n address: Address;\n}\nexport interface IAddressManagementInput extends IActionInput {\n address: Address;\n userAccountNumber?: string;\n}\n\n/**\n * The input class for the addAddress data action.\n */\nexport class AddressManagementInput implements IAddressManagementInput {\n public address: Address;\n\n public userAccountNumber?: string;\n\n constructor(address: Address, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.address = address;\n }\n\n public getCacheKey = () => 'AddAddress';\n\n public getCacheObjectType = () => 'AddAddress';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the addAddress data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createAddressManagementInput = (\n inputData: ICreateActionContext, IAddressManagementData>\n): IAddressManagementInput => {\n if (inputData.requestContext.user.isAuthenticated) {\n throw new Error('User is not authenticated. Cannot call UpdateAddress API');\n }\n\n const { address } = inputData.data || { address: undefined };\n\n if (!address) {\n throw new Error('address is not provided. Cannot call UpdateAddress API');\n }\n\n return new AddressManagementInput(address);\n};\n\nexport async function doAddressManagementOperation(\n input: IAddressManagementInput,\n ctx: IActionContext,\n operationHandler: (customer: Customer, address: Address) => Customer\n): Promise {\n const { userAccountNumber, address } = input;\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, userAccountNumber, 'none');\n const customer = await getCustomer(customerInput, ctx);\n\n if (!customer) {\n throw new Error('Not able to create customer');\n }\n\n const newCustomer = operationHandler({ ...customer }, address);\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n throw new Error('Not able to update customer');\n }\n\n ctx.update(createReadAsync(updatedCustomer.AccountNumber), updatedCustomer);\n\n return updatedCustomer.Addresses || [];\n}\n\nexport function addAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = [...(customer.Addresses || [])];\n customer.Addresses.push(address);\n return customer;\n}\n\nexport async function addAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, addAddressHandler);\n}\n\n/**\n * The addAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Adds the passed address information to the retireved customer, and\n * then updates that customer via the update RetailServer API.\n */\nexport const addAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-address',\n action: >addAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\n\nexport default addAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getParameterizeFeatureFlags,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IParameterizeFeatureFlags,\n IRequestContext\n} from '@msdyn365-commerce/core';\n\nimport { generateCacheKey } from './utilities';\nimport getCategoryHierarchy, { CategoriesInput } from './get-categories-hierarchy';\nimport { parameterize } from './utilities/Url-builder';\n\n/**\n * Input class for GetCurrentCategory data action.\n */\nexport class CurrentCategoryInput implements IActionInput {\n public categoryId?: number;\n\n public categorySlug?: string;\n\n public includeRootCategory?: boolean;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n constructor(context: IRequestContext, includeRootCategory?: boolean) {\n this.includeRootCategory = includeRootCategory;\n let categoryId;\n let categorySlug;\n if (context.query && context.query.categoryId) {\n categoryId = Number(context.query.categoryId);\n\n if (Number.isNaN(categoryId)) {\n throw new Error('Failed to cast category id into a number.');\n }\n } else if (context.urlTokens && context.urlTokens.recordId) {\n categoryId = Number(context.urlTokens.recordId);\n if (Number.isNaN(categoryId)) {\n throw new Error('Failed to cast category id into a number.');\n }\n } else if (context.urlTokens && context.urlTokens.categories && context.urlTokens.categories.length > 0) {\n const categories: string[] = (context.urlTokens.categories);\n\n if (categories.length === 0) {\n throw new Error('Failed to get category name from urlTokens');\n }\n\n // TODO: fix getParameterizeFeatureFlags to take requestContext as input.\n const tempActionContext = {\n requestContext: context\n };\n categorySlug = `/${categories\n .map(category => {\n // @ts-expect-error TODO: fix getParameterizeFeatureFlags to take requestContext as an input\n const parameterizeFeatureFlags: IParameterizeFeatureFlags = getParameterizeFeatureFlags(tempActionContext);\n return parameterize(category, undefined, parameterizeFeatureFlags);\n })\n .join('/')}`;\n }\n this.categoryId = categoryId;\n this.categorySlug = categorySlug;\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'CategoryId', value: this.categoryId },\n { key: 'CategorySlug', value: this.categorySlug },\n { key: 'IncludeRootCategory', value: this.includeRootCategory },\n { key: 'Locale', value: this.locale }\n );\n\n public getCacheObjectType = () => 'Current-Category';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates a current category input from an ICreateActionContext.\n * @param inputData\n */\nexport const createGetCurrentCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n return new CurrentCategoryInput(inputData.requestContext, true);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Recursive Search Method to find a given category among a complete CategoryHierarchy.\n * @param categories The current Category Hierarchy.\n * @param categorySlug The category slug being searched for.\n * @param categoryId The category Id being search for.\n */\nexport function searchCategory(categories: CategoryHierarchy[], categorySlug?: string, categoryId?: number): CategoryHierarchy | undefined {\n let foundCategory;\n for (const cat of categories) {\n if ((categoryId && cat.RecordId === categoryId) || (categorySlug && cat.Slug === categorySlug)) {\n foundCategory = cat;\n break;\n } else if (cat.Children && cat.Children.length > 0) {\n const matchingChild = searchCategory(cat.Children, categorySlug, categoryId);\n if (matchingChild) {\n foundCategory = matchingChild;\n }\n }\n }\n return foundCategory;\n}\n\n/**\n * Action method for the getCurrentCategory Data Action.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getCurrentCategoryAction(input: CurrentCategoryInput, ctx: IActionContext): Promise {\n if (input.categorySlug || input.categoryId) {\n const categoryInput = new CategoriesInput(ctx.requestContext, true, undefined, input.includeRootCategory);\n const categories = await getCategoryHierarchy(categoryInput, ctx);\n if (!categories) {\n ctx.trace('[getCurrentCategory] Unable to get categories from server');\n return;\n }\n\n const category = searchCategory(categories, input.categorySlug, input.categoryId);\n if (!category) {\n ctx.trace('[getCurrentCategory] Unable to find category');\n return;\n }\n return category;\n }\n return;\n}\n\n/**\n * The getCurrentCategory data action\n * First makes a call to the getCategories RetailServer API\n * to get a list of every available category, then returns a CategoryHierarchy\n * based on the categoryId query param set in the URL of the request.\n */\nexport const getCurrentCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-current-category',\n action: >getCurrentCategoryAction,\n input: createGetCurrentCategoryInput\n});\n\nexport default getCurrentCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { ProductAvailableQuantity, ProductDeliveryOptions, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for delivery options for items in cart.\n */\nexport class ProductDeliveryOptionsForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsDeliveryOptions', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsDeliveryOptions';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductDeliveryOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API to get the delivery options for items in the cart.\n * @param input\n * @param ctx\n */\nexport async function getDeliveryOptionsForCartLineItems(\n input: ProductDeliveryOptionsForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getDeliveryOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n if (!cart || !products || products.length === 0) {\n ctx.trace('[getDeliveryOptionsForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n return ProductsDataActions.getDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n products.map(x => x.RecordId),\n {},\n null\n )\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getDeliveryOptionsForCartLineItems]Error executing action');\n return {};\n });\n}\n\nexport const getDeliveryOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-delivery-options-for-cartlines',\n action: >getDeliveryOptionsForCartLineItems,\n input: createInput\n});\n\nexport default getDeliveryOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n ProductAvailableQuantity,\n ProductDimensionValueInventoryAvailability,\n ProductInventoryAvailability\n} from '@msdyn365-commerce/retail-proxy';\n\n/**\n * This setting defines the delivery modes supported.\n */\nexport enum DeliveryMode {\n allWareHouses = 0,\n shipping = 1,\n pickup = 2\n}\n\n/**\n * This setting defines the inventory levels supported.\n */\nexport enum InventoryLevels {\n physicalAvailable = 'physicalAvailable',\n totalAvailable = 'totalAvailable',\n threshold = 'inventoryThreshold'\n}\n\n/**\n * Product inventory information class.\n */\nexport interface IProductInventoryInformation {\n ProductAvailableQuantity: ProductAvailableQuantity;\n StockLevelCode?: string;\n StockLevelLabel?: string;\n IsProductAvailable: boolean;\n InventLocationId?: string;\n deliveryType?: DeliveryMode;\n}\n\n/**\n * This setting defines the inventory level values return by the API.\n */\nexport enum InventoryLevelValues {\n outOfStock = 'OOS',\n available = 'AVAIL'\n}\n\n/**\n * Retrieves inventory level code from the dimension based on the app config setting.\n * @param dimensionValuesWithInventory - The dimension info.\n * @param inventoryLevel - App config setting for inventory level.\n * @returns Inventory level code value.\n */\nexport const getInventoryLevelCodeFromDimensionValue = (\n dimensionValuesWithInventory: ProductDimensionValueInventoryAvailability,\n inventoryLevel?: InventoryLevels | undefined\n): InventoryLevelValues | undefined => {\n if (inventoryLevel === InventoryLevels.totalAvailable) {\n return dimensionValuesWithInventory.TotalAvailableInventoryLevelCode as InventoryLevelValues | undefined;\n }\n if (inventoryLevel === InventoryLevels.physicalAvailable) {\n return dimensionValuesWithInventory.PhysicalAvailableInventoryLevelCode as InventoryLevelValues | undefined;\n }\n return undefined;\n};\n\n/**\n * Retrieves inventory level code from the product availability based on the app config setting.\n * @param productAvailability - The product availability info.\n * @param inventoryLevel - App config setting for inventory level.\n * @returns Inventory level code value.\n */\nexport const getInventoryLevelCodeFromProductAvailability = (\n productAvailability: ProductInventoryAvailability,\n inventoryLevel?: InventoryLevels | undefined\n): InventoryLevelValues | undefined => {\n if (inventoryLevel === InventoryLevels.totalAvailable) {\n return productAvailability.TotalAvailableInventoryLevelCode as InventoryLevelValues | undefined;\n }\n if (inventoryLevel === InventoryLevels.physicalAvailable) {\n return productAvailability.PhysicalAvailableInventoryLevelCode as InventoryLevelValues | undefined;\n }\n return undefined;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { RatingsSummary } from '@msdyn365-commerce/commerce-entities';\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n sendRequest\n} from '@msdyn365-commerce/core';\n\nimport { GetRatingsSummaryInput, getSelectedProductIdFromActionInput } from '.';\nimport { getRnrEndpointId, getRnrPartnerId } from './utilities/getRnrKeys';\n\nexport const createInput = (input: ICreateActionContext>): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(input);\n if (productId) {\n return new GetRatingsSummaryInput(productId, getRnrPartnerId(input), getRnrEndpointId(input));\n }\n throw new Error('[GetRatingsSummary] Not all necessary parameters found while creating Input for getRatingsSummaryApi');\n};\n\n/**\n * This function gets the ratings summary.\n * @param input\n * @param ctx\n */\nexport async function getRatingsSummary(input: GetRatingsSummaryInput, ctx: IActionContext): Promise {\n if (!inputIsValid(input)) {\n ctx.trace('[GetRatingsSummary] Failed to get ratings summary for product');\n return {};\n }\n\n const requestUrl = `${input.serviceEndpoint}/v2.0/ratings/product/${input.productId}/summary?` + `tenantId=${input.tenantId}`;\n return sendRequest(requestUrl, 'get')\n .then(response => {\n return response.data;\n })\n .catch(error => {\n ctx.trace('[GetRatingsSummary] Failed to get ratings summary for product');\n throw error;\n });\n}\n\nfunction inputIsValid(input: GetRatingsSummaryInput): boolean {\n return input && input.productId.length > 0 && input.tenantId.length > 0;\n}\n\nexport const getRatingsSummaryDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-ratings-summary',\n action: >getRatingsSummary,\n input: createInput\n});\n\nexport default getRatingsSummaryDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { Category, TextValueTranslation } from '@msdyn365-commerce/retail-proxy';\n\nimport getCategoryAction, { CategoriesInput as RawCategoriesInput } from './get-categories';\nimport { getCategoryUrl } from './utilities/Url-builder';\nimport { generateCacheKey } from './utilities/utils';\n\n/**\n * Input for get-categories data action.\n */\nexport class CategoriesInput implements IActionInput {\n public readonly maxItems: number;\n\n public readonly channelId: number;\n\n public includeRootCategory?: boolean;\n\n private readonly catalogId: number;\n\n private readonly sitePath: string;\n\n private readonly _mappedToHierarchy: boolean;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale?: string;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number, includeRootCategory?: boolean) {\n this._mappedToHierarchy = mappedToHierarchy;\n this.includeRootCategory = includeRootCategory;\n this.maxItems = maxItems || 250;\n this.channelId = context && context.apiSettings && context.apiSettings.channelId ? +context.apiSettings.channelId : 0;\n this.sitePath = (context && context.sitePath) || '';\n this.apiSettings = context.apiSettings;\n this.locale = context.locale || '';\n this.catalogId = getCatalogId(context);\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'SitePath', value: this.sitePath },\n { key: 'IncludeRootCategory', value: this.includeRootCategory },\n { key: 'Top', value: this.maxItems },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'Locale', value: this.locale }\n );\n\n public getCacheObjectType = () => (this._mappedToHierarchy ? 'CategoryHierarchy' : 'Category');\n\n public dataCacheType = (): CacheType => 'request';\n\n public getLocale = (): string => this.locale || '';\n}\n\nconst getFriendlyName = (locale?: string, nameTranslations?: TextValueTranslation[]): string | undefined => {\n let nameTranslation: TextValueTranslation | undefined;\n if (locale && nameTranslations && nameTranslations.length > 0) {\n nameTranslation = nameTranslations.find(item => item.Language!.toLowerCase() === locale.toLowerCase());\n }\n\n return nameTranslation && nameTranslation.Text;\n};\n\nexport interface ICategoryMap {\n [RecordId: number]: CategoryHierarchy;\n}\n\n/**\n * Creates a hierarchy of categories based on the ParentCategory property.\n * @param categoryList Categories that will be converted into a hierarchy.\n * @param ctx\n * @param locale\n * @returns Hierarchy of categories in array.\n */\nexport const mapCategoryToHierarchy = (\n categoryList: Category[],\n ctx: IActionContext,\n locale?: string,\n includeRootCategory?: boolean\n): CategoryHierarchy[] => {\n if (!categoryList || categoryList.length === 0) {\n return [];\n }\n\n const categoryMap: ICategoryMap = {};\n\n for (const category of categoryList) {\n const localName = getFriendlyName(locale, category.NameTranslations);\n const categoryHierarchy = { ...category };\n categoryHierarchy.NeutralizedName = category.Name;\n categoryHierarchy.Name = localName || categoryHierarchy.NeutralizedName;\n categoryMap[category.RecordId] = categoryHierarchy;\n }\n\n let rootCategory: CategoryHierarchy | undefined;\n\n for (const category of Object.values(categoryMap)) {\n const parentId = category.ParentCategory;\n category.Url = getCategoryUrl(category, ctx, categoryMap);\n if (parentId === 0) {\n rootCategory = category;\n continue;\n }\n\n const parent = parentId && categoryMap[parentId];\n if (parent) {\n parent.Children = parent.Children || [];\n parent.Children.push(category);\n }\n }\n\n if (!rootCategory) {\n return [];\n }\n\n if (includeRootCategory) {\n const categoryHierarchy: CategoryHierarchy[] = [];\n categoryHierarchy.push(rootCategory);\n return categoryHierarchy;\n }\n\n return rootCategory.Children ?? [];\n};\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createCategoriesHierarchyInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config && inputData.config.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n return new CategoriesInput(inputData.requestContext, true, topItems);\n};\n\n/**\n * Calls the Retail API and returns all the categories as a hierarchy.\n * @param input\n * @param ctx\n */\nexport async function getCategoryHierarchyAction(input: CategoriesInput, ctx: IActionContext): Promise {\n const categories = await getCategoryAction(new RawCategoriesInput(ctx.requestContext, false, input.maxItems), ctx);\n return mapCategoryToHierarchy(categories, ctx, input.getLocale(), input.includeRootCategory);\n}\n\nexport const getCategoryHierarchyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-categories-hierarchy',\n action: >getCategoryHierarchyAction,\n input: createCategoriesHierarchyInput\n});\n\nexport default getCategoryHierarchyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n getMediaLocationsForProductAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n MediaLocationsInput\n} from '@msdyn365-commerce/core';\nimport { AsyncResult, MediaLocation, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getMediaLocationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getSelectedVariant, { SelectedVariantInput } from './get-selected-variant';\nimport { generateImageUrl, getSelectedProductIdFromActionInput } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * The action input class for the getMediaLocationsForSelectedVariant data action.\n */\nexport class MediaLocationsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.catalogId = catalogId || 0;\n this.selectedProduct = selectedProduct;\n }\n\n public getCacheKey = () => 'MediaLocationsForSelectedVariant';\n\n public getCacheObjectType = () => 'MediaLocations';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the getMediaLocationsForSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createMediaLocationsForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): MediaLocationsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new MediaLocationsForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined, catalogId);\n }\n throw new Error('Unable to create MediaLocationsForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The action method for the getMediaLocationsForSelectedVariant data action.\n * @param input\n * @param ctx\n */\nexport async function getMediaLocationsForSelectedVariantAction(\n input: MediaLocationsForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return AsyncResult.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then(productResult => {\n const activeProduct = productResult;\n\n if (activeProduct) {\n if (ctx.requestContext.app?.config?.OmniChannelMedia) {\n const mediaLocationsInput = new MediaLocationsInput(\n ctx.requestContext,\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n return getMediaLocationsForProductAction(mediaLocationsInput, ctx);\n }\n return getMediaLocationsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n ).then(response => {\n return response.map(\n (mediaLocation: MediaLocation): MediaLocation => {\n mediaLocation.Uri = generateImageUrl(mediaLocation.Uri, ctx.requestContext.apiSettings);\n mediaLocation.AltText = mediaLocation.AltText ? mediaLocation.AltText : activeProduct.Name;\n return mediaLocation;\n }\n );\n });\n }\n\n return [];\n })\n .catch(error => {\n ctx.trace(error);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[getMediaLocationsForSelectedVariantAction]Error executing action');\n throw new Error('[getMediaLocationsForSelectedVariantAction]Error executing action');\n });\n}\n\n/**\n * The getMediaLocationsForSelectedVariant data action\n * Gets the currently selected variant for the page via the getSelectedVariant data action,\n * and then gets the media location information for the variant via the MediaLocations RetailServer API.\n */\nexport const getMediaLocationsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-media-locations-for-selected-variant',\n action: >getMediaLocationsForSelectedVariantAction,\n input: createMediaLocationsForSelectedVariantInput\n});\n\nexport default getMediaLocationsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport {\n InvoicePaidStatus,\n InvoiceSearchCriteria,\n InvoiceType,\n IQueryResultSettings,\n OrderInvoice,\n SalesOrdersDataActions\n} from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\nimport getCustomer, { GetCustomerInput } from '../get-customer';\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\n\nconst getDefaultSearchCriteria = (): InvoiceSearchCriteria => {\n return {\n InvoicePaidStatusValues: [InvoicePaidStatus.None]\n };\n};\n\n/**\n * Input class for get invoice data action.\n */\nexport class GetInvoicesInput implements IActionInput {\n public readonly searchCriteria: InvoiceSearchCriteria;\n\n public readonly queryResultSettings: IQueryResultSettings;\n\n constructor(searchCriteria: InvoiceSearchCriteria, queryResultSettings: IQueryResultSettings) {\n this.searchCriteria = searchCriteria;\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => 'BusinessPartnerInvoices';\n\n public getCacheObjectType = () => 'OrderInvoice';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const CreateGetInvoicesInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n\n return new GetInvoicesInput(getDefaultSearchCriteria(), queryResultSettings);\n};\n\nexport async function getInvoices(input: GetInvoicesInput, context: IActionContext): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get list of invoices. User is not authenticated.');\n }\n\n input.searchCriteria.InvoiceTypeValues = [InvoiceType.SalesOrderInvoice];\n\n const businessPartner = await getCurrentAsync({ callerContext: context });\n input.searchCriteria.BusinessPartnerId = businessPartner?.BusinessPartnerId;\n\n const customer = await getCustomer(new GetCustomerInput(context.requestContext.apiSettings), context);\n input.searchCriteria.CustomerId = customer.AccountNumber;\n\n return SalesOrdersDataActions.getInvoicesAsync(\n { callerContext: context, queryResultSettings: input.queryResultSettings },\n input.searchCriteria\n );\n}\n\nexport const getInvoicesDataAction = createObservableDataAction({\n id: 'get-invoices',\n action: >getInvoices,\n input: CreateGetInvoicesInput\n});\n\nexport default getInvoicesDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { convertToString, IQueryResultSettings, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\nimport { getProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\n\nimport {\n createInventoryAvailabilitySearchCriteria,\n FullProductInput,\n getFullProducts,\n ProductDetailsCriteria,\n QueryResultSettingsProxy\n} from '..';\nimport { ArrayExtensions } from '../utilities';\nimport { IOrderTemplateLinesState, OrderTemplateLine } from '../utilities/order-templates';\nimport { mapAggregatedProductInventoryInformation } from '../utilities/product-inventory-utils';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetPaginatedOrderTemplateLinesInput implements IActionInput {\n public orderTemplateId: string;\n public queryResultSettings: IQueryResultSettings;\n public searchText: string;\n public getPrice: boolean = true;\n public getRating: boolean = true;\n\n constructor(\n orderTemplateId: string,\n queryResultSettings: IQueryResultSettings,\n searchText?: string,\n getPrice: boolean = true,\n getRating: boolean = true\n ) {\n this.orderTemplateId = orderTemplateId;\n this.queryResultSettings = queryResultSettings;\n this.searchText = searchText || '';\n this.getPrice = getPrice;\n this.getRating = getRating;\n }\n\n public getCacheKey = () =>\n `GetPaginatedOrderTemplateLines|${this.orderTemplateId}|${convertToString(this.queryResultSettings)}|${\n this.searchText\n }|${convertToString(this.getPrice)}|${convertToString(this.getRating)}`;\n\n public getCacheObjectType = () => 'GetPaginatedOrderTemplateLines';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param orderTemplateId\n * @param searchText\n */\nexport const createGetPaginatedOrderTemplateLinesInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n searchText?: string\n): GetPaginatedOrderTemplateLinesInput => {\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n return new GetPaginatedOrderTemplateLinesInput(orderTemplateId, queryResultSettings, searchText);\n};\n\nexport const getProductDetailsCriteriaFromActionInput = (inputData: GetPaginatedOrderTemplateLinesInput): ProductDetailsCriteria => {\n return {\n getPrice: inputData.getPrice ?? true,\n getRating: inputData.getRating ?? true\n };\n};\n\n/**\n * The action method for the GetPaginatedOrderTemplateLines data action.\n * @param input The action input.\n * @param context The action context.\n */\nexport async function getPaginatedOrderTemplateLinesAction(\n input: GetPaginatedOrderTemplateLinesInput,\n context: IActionContext\n): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const orderTemplateLinesState: IOrderTemplateLinesState = {\n lines: [],\n totalCount: 0\n };\n const promise = getProductListLinesAsync(\n {\n callerContext: context,\n queryResultSettings: input.queryResultSettings,\n bypassCache: 'get'\n },\n input.orderTemplateId,\n input.searchText\n );\n const productListLines = await promise;\n const productInputs: FullProductInput[] = [];\n if (ArrayExtensions.hasElements(productListLines)) {\n orderTemplateLinesState.totalCount = promise.metadata.count || productListLines.length;\n productListLines.forEach(listLine => {\n if (listLine.ProductId) {\n orderTemplateLinesState.lines.push(new OrderTemplateLine(listLine));\n productInputs.push(\n new FullProductInput(\n listLine.ProductId,\n context.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(input),\n context.requestContext,\n listLine.CatalogId\n )\n );\n }\n });\n if (ArrayExtensions.hasElements(productInputs)) {\n const fullProductsInfo = await getFullProducts(productInputs, context)\n .then((products: FullProduct[]) => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n context.trace(error);\n context.telemetry.error(error.message);\n context.telemetry.error('[getPaginatedOrderTemplateLinesAction] Unable to retrieve product info.');\n });\n if (fullProductsInfo) {\n for (const line of orderTemplateLinesState.lines) {\n const fullProduct = fullProductsInfo.find(\n product => product.ProductDetails.RecordId === line.productListLine.ProductId\n );\n if (!fullProduct) {\n context.telemetry.error(\n '[getPaginatedOrderTemplateLinesAction] Unable to find product info for an order template line.'\n );\n\n const unassortedProduct: FullProduct = {\n ProductDetails: {\n RecordId: line.productListLine.ProductId || 0,\n DefaultUnitOfMeasure: line.productListLine.UnitOfMeasure?.toString() ?? '',\n ProductTypeValue: 0,\n BasePrice: 0,\n Price: 0,\n AdjustedPrice: 0\n },\n ProductPrice: {},\n ProductRating: {}\n };\n line.fullProduct = unassortedProduct;\n\n line.error = 'UNASSORTED';\n line.shouldDisable = true;\n\n continue;\n }\n line.fullProduct = fullProduct;\n\n if (context.requestContext.app) {\n const searchCriteria = createInventoryAvailabilitySearchCriteria(\n context,\n [line.fullProduct.ProductDetails.RecordId],\n true\n );\n\n try {\n const shippingProductAvailabilities = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: context },\n searchCriteria\n );\n\n if (\n shippingProductAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities.length > 0\n ) {\n const productAvailabilities = mapAggregatedProductInventoryInformation(\n context,\n shippingProductAvailabilities\n );\n line.error =\n context.requestContext.app.config.enableStockCheck === false ||\n (productAvailabilities?.length > 0 && productAvailabilities[0].IsProductAvailable)\n ? 'NONE'\n : 'OOS';\n line.shouldDisable = line.error === 'OOS';\n }\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message;\n context.trace(errorMessage);\n context.telemetry.error(errorMessage);\n } else {\n context.trace(String(error));\n context.telemetry.error('An unknown error occurred.');\n }\n context.telemetry.error('[getPaginatedOrderTemplateLinesAction] Unable to retrieve product availability.');\n }\n }\n }\n }\n return orderTemplateLinesState;\n }\n context.trace(orderTemplateLinesState.lines.length.toString());\n return orderTemplateLinesState;\n }\n return orderTemplateLinesState;\n}\n\n/**\n * The GetPaginatedOrderTemplateLines Data Action\n * Returns order templates.\n */\nexport const getPaginatedOrderTemplateLinesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-paginated-order-template-lines',\n action: getPaginatedOrderTemplateLinesAction as IAction,\n input: createGetPaginatedOrderTemplateLinesInput\n});\n\nexport default getPaginatedOrderTemplateLinesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport msdyn365Commerce, { IParameterizeFeatureFlags } from '@msdyn365-commerce/core';\n\nexport function parameterize(\n name: string = '',\n sep = '-',\n parameterizeFeatureFlags: IParameterizeFeatureFlags = {},\n neutralizedName?: string\n) {\n // If neutralizedName flag enabled, we use neutralizedName to construct string\n const candidateName =\n (msdyn365Commerce.platformSettings && msdyn365Commerce.platformSettings.enableUrlLocalization) ||\n parameterizeFeatureFlags.enableUrlLocalization\n ? name\n : neutralizedName || name;\n\n /*\n 1\t‘ ‘ (space)\t-> (single dash)\n 3\tAny character disallowed in URLs -> URL-encode\n 5\t‘ & ‘ (space ampersand space) -> (single dash)\n 6\t‘ - ‘ (space dash space) -> (single dash)\n 7\t‘ ‘ (2+ spaces) -> (single dash)\n 10\t[A-Z] (capital letters) -> [a-z] (lower-case)\n 12\tAny non-ASCII character outside of the set of disallowed characters -> URL-encode\n */\n if (\n parameterizeFeatureFlags.enableUrlEncoding ||\n (msdyn365Commerce.platformSettings && msdyn365Commerce.platformSettings.enableUrlEncoding)\n ) {\n // Replace url reserved characters with dash, and remove front and end dash;\n // &*!() reserved characters that can not be encoded by encodeURIComponent()\n return encodeURIComponent(\n candidateName\n .toLowerCase()\n .replace(/[\\s!&'()*]+/g, '-')\n .trim()\n .replace(/-+/g, '-')\n .replace(/^-+|-+$/g, '')\n );\n }\n return name\n .toLowerCase()\n .replace(/[^\\d_a-z\\-]+/g, ' ')\n .trim()\n .replace(/\\s+/g, sep);\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport { getParameterizeFeatureFlags, getUrlSync, IActionContext, IParameterizeFeatureFlags } from '@msdyn365-commerce/core';\n\nimport { parameterize } from './parameterize';\n\ninterface ICategoryMap {\n [RecordId: number]: CategoryHierarchy;\n}\n\n/**\n * Builds slugs for category.\n * @param category\n * @param categoryMap\n * @param parameterizeFeatureFlags\n */\nexport function getCategorySlug(\n category: CategoryHierarchy,\n categoryMap: ICategoryMap,\n parameterizeFeatureFlags?: IParameterizeFeatureFlags\n): string {\n if (!category || !category.Name) {\n // Invalid category\n return '';\n }\n const categoryName = parameterize(category.Name, undefined, parameterizeFeatureFlags, category.NeutralizedName);\n if (!category.ParentCategory || category.ParentCategory === 0) {\n // Base case assign url\n category.Slug = category.Slug || `/${categoryName}`;\n } else if (category.ParentCategory) {\n category.Slug =\n category.Slug ||\n `${getCategorySlug(categoryMap[category.ParentCategory], categoryMap, parameterizeFeatureFlags)}/${categoryName}`;\n }\n\n return category.Slug || '';\n}\n\n/**\n * Gets Url for category hierarchy. Returns string and adds url to Url property of category hierarchy.\n * @param category Category to generate URL for.\n * @param ctx\n * @param categoryMap Dictionary of all categories.\n */\nexport function getCategoryUrl(category: CategoryHierarchy, ctx?: IActionContext, categoryMap?: ICategoryMap): string | undefined {\n if (!category.Url && ctx && categoryMap) {\n if (!category.Slug) {\n const parameterizeFeatureFlags: IParameterizeFeatureFlags = ctx.requestContext ? getParameterizeFeatureFlags(ctx) : {};\n category.Slug = getCategorySlug(category, categoryMap, parameterizeFeatureFlags);\n }\n category.Url = getUrlSync('category', ctx, { category });\n }\n return category.Url;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { getUrlSync, IActionContext } from '@msdyn365-commerce/core';\n\n/**\n * Syncronously creates an invoice detail page url.\n * @param invoiceId Invoice Id.\n * @param ctx\n */\nexport function getInvoiceDetailsPageUrlSync(invoiceId: string, ctx: IActionContext): string {\n let url = getUrlSync('invoice-details', ctx) || '';\n url = url.includes('?') ? url.substr(0, url.indexOf('?')) : url;\n return `${url}?invoiceId=${invoiceId}`;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport { getUrlSync, IActionContext } from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Syncronously creates a product url.\n * @param product Simple product to get url from.\n * @param ctx\n * @param category Category to add to product url.\n */\nexport function getProductUrlSync(product: SimpleProduct, ctx: IActionContext, category?: CategoryHierarchy): string {\n const selectedProduct = { ...product, RecordId: product.MasterProductId || product.RecordId };\n\n return getProductPageUrlSync(selectedProduct.Name || '', selectedProduct.RecordId, ctx, category)!;\n}\n\n/**\n * Syncronously creates a product detail page url.\n * @param name Simple product name.\n * @param recordId Record id of product.\n * @param ctx\n * @param category\n */\nexport function getProductPageUrlSync(name: string, recordId: number, ctx: IActionContext, category?: CategoryHierarchy): string {\n return getUrlSync('product', ctx, {\n product: { Name: name || '', RecordId: recordId },\n category\n })!;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\n\nimport getCategoriesHierarchy, { CategoriesInput } from './get-categories-hierarchy';\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Action Input Class for get-current-category-hierarchy.\n */\nexport class CurrentCategoryHierarchyInput extends CategoriesInput {\n public activeCategoryId: number;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number, activeCategoryId?: number) {\n super(context, mappedToHierarchy, maxItems);\n const defaultActiveCategoryId = 0;\n this.activeCategoryId = activeCategoryId ?? defaultActiveCategoryId;\n }\n\n // @ts-expect-error: Overriding cache object type\n public getCacheObjectType = () => 'CurrentCategoryHierarchy';\n\n public getCacheKey = () => `${this.activeCategoryId}-${this.channelId}`;\n}\n\n/**\n * Creates the input required for the data action.\n * @param inputData\n */\nexport const createCategoriesHierarchyInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config?.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n let activeCategoryId =\n inputData.requestContext.urlTokens.pageType === 'Category' ? inputData.requestContext.urlTokens.itemId : undefined;\n activeCategoryId = activeCategoryId ?? inputData.requestContext.query?.categoryId;\n const activeCategoryParsedId = activeCategoryId ? Number.parseInt(activeCategoryId, 10) : undefined;\n\n return new CurrentCategoryHierarchyInput(inputData.requestContext, true, topItems, activeCategoryParsedId);\n};\n\n/**\n * Finds the given category in the list of categories and returns an array with the info on where it's located.\n * @param categories - Categories list to search from.\n * @param categoryId - The category id to find.\n * @returns A list of categories starting from the given category id, ending up the root parent.\n */\nconst findCategoryHierarchy = (categories: CategoryHierarchy[], categoryId: number): CategoryHierarchy[] | null => {\n for (const category of categories) {\n if (category.RecordId === categoryId) {\n return [category];\n }\n\n if (ArrayExtensions.hasElements(category.Children)) {\n const innerCategoryHierarchy = findCategoryHierarchy(category.Children, categoryId);\n if (ArrayExtensions.hasElements(innerCategoryHierarchy)) {\n innerCategoryHierarchy.push(category);\n return innerCategoryHierarchy;\n }\n }\n }\n\n return null;\n};\n\n/**\n * Get the hierarchy of categories that are currently active as a parent -> child array.\n * Return will be as follows: [ParentCategory, Child, SubChild, SubSubChild].\n * @param input\n * @param ctx\n */\nexport async function getCurrentCategoryHierarchyAction(\n input: CurrentCategoryHierarchyInput,\n ctx: IActionContext\n): Promise {\n const fullCategoryHierarchy = await getCategoriesHierarchy(new CategoriesInput(ctx.requestContext, true, input.maxItems), ctx);\n const categoryArray = findCategoryHierarchy(fullCategoryHierarchy, input.activeCategoryId) ?? [];\n const sortedCategoryArray = categoryArray.reverse();\n return sortedCategoryArray;\n}\n\nexport const getCurrentCategoryHierarchyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-current-category-hierarchy',\n action: getCurrentCategoryHierarchyAction as IAction,\n input: createCategoriesHierarchyInput\n});\n\nexport default getCurrentCategoryHierarchyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n getMediaLocationsForProductAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n MediaLocationsInput\n} from '@msdyn365-commerce/core';\nimport { getMediaLocationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { MediaLocation } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateCacheKey, generateImageUrl } from './utilities/utils';\n\n/**\n * Product Input.\n */\nexport class MediaLocationsByIdInput implements IActionInput {\n public productId?: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, productId?: number, catalogId?: number) {\n this.productId = productId;\n this.channelId = +apiSettings.channelId;\n this.catalogId = catalogId || 0;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'Key', value: 'MediaLocationID' },\n { key: 'ProductId', value: this.productId },\n { key: 'CatalogId', value: this.catalogId }\n );\n\n public getCacheObjectType = () => 'MediaLocations';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createMediaLocationsByIdInput = (inputData: ICreateActionContext>): MediaLocationsByIdInput => {\n const productId = (inputData.config && +inputData.config.productId) || undefined;\n const catalogId = getCatalogId(inputData.requestContext);\n return new MediaLocationsByIdInput(inputData.requestContext.apiSettings, productId, catalogId);\n};\n\n/**\n * Calls the Retail API and returns the product based on the passed MediaLocationsByIdInput.\n * @param input\n * @param ctx\n */\nexport async function getMediaLocationsByIdAction(input: MediaLocationsByIdInput, ctx: IActionContext): Promise {\n if (input.productId) {\n if (ctx.requestContext.app?.config?.OmniChannelMedia) {\n const mediaLocationsInput = new MediaLocationsInput(ctx.requestContext, input.productId, input.channelId, input.catalogId);\n return getMediaLocationsForProductAction(mediaLocationsInput, ctx);\n }\n return getMediaLocationsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n input.productId,\n input.channelId,\n input.catalogId\n ).then(response => {\n return response.map(\n (mediaLocation: MediaLocation): MediaLocation => {\n mediaLocation.Uri = generateImageUrl(mediaLocation.Uri, ctx.requestContext.apiSettings);\n mediaLocation.AltText = mediaLocation.AltText ? mediaLocation.AltText : '';\n return mediaLocation;\n }\n );\n });\n }\n return [];\n}\n\nexport const getMediaLocationsByIdActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-media-locations-by-id',\n action: >getMediaLocationsByIdAction,\n input: createMediaLocationsByIdInput\n});\n\nexport default getMediaLocationsByIdActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { ProductList, ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * OrderTemplateLine state information.\n */\nexport class OrderTemplateLine {\n public productListLine: ProductListLine;\n\n public fullProduct?: FullProduct;\n\n public error?: string;\n\n public shouldDisable?: boolean;\n\n constructor(productListLine: ProductListLine, fullProduct?: FullProduct, error?: string, shouldDisable?: boolean) {\n this.productListLine = productListLine;\n this.fullProduct = fullProduct;\n this.error = error;\n this.shouldDisable = shouldDisable;\n }\n}\n\nexport interface IOrderTemplateLinesState {\n lines: OrderTemplateLine[];\n totalCount: number;\n}\n\n/**\n * Order template class.\n */\nexport class OrderTemplate {\n public productList: ProductList;\n\n public orderTemplateLines: OrderTemplateLine[];\n\n public totalLines: number;\n\n constructor(productList: ProductList, orderTemplateLines: OrderTemplateLine[], totalLines: number) {\n this.productList = productList;\n this.orderTemplateLines = orderTemplateLines;\n this.totalLines = totalLines;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Namespace which extends Object functionality.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport namespace ObjectExtensions {\n /**\n * @description Verifies whether the value is null or undefined.\n * @param {any} value The value to examine.\n * @returns {boolean} True if the value is null or undefined, false otherwise.\n */\n export function isNullOrUndefined(value: any): value is null | undefined {\n return value === null || value === undefined;\n }\n\n /**\n * @description Verifies whether the value is of type string.\n * @param {any} value The value to examine.\n * @returns {boolean} True if the value is a string, false otherwise.\n */\n export function isString(value: any): value is string {\n return typeof value === 'string';\n }\n\n /**\n * @description Verifies whether the value is of type number.\n * @param {any} value The value to examine.\n * @returns {boolean} True if the value is a number, false otherwise.\n */\n export function isNumber(value: any): value is number {\n return typeof value === 'number';\n }\n\n /**\n * Verifies whether the object is a function.\n * @param {any} object The object.\n * @param value\n * @returns {boolean} True if the object is a function, false otherwise.\n */\n export function isFunction(value: any): boolean {\n return typeof value === 'function';\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductDimensionsWithAvailabilitiesFull, ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n ProductDimension,\n ProductDimensionAvailabilitySearchCriteria,\n ProductDimensionValue,\n ProductDimensionValueInventoryAvailability,\n ProductsDataActions\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions, generateCacheKey } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getDimensionValuesFromQuery, getSelectedProductIdFromActionInput } from './utilities/utils';\n\n/**\n * Defines the dimension value type for get dimensions for selected variant data action.\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\n */\nexport interface IDimensionValueForSelectedVariant extends ProductDimensionValueInventoryAvailability, ProductDimensionValue {}\n\n/**\n * Defines the returned type for get dimensions for selected variant data action.\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\n */\nexport interface IDimensionForSelectedVariant extends ProductDimensionFull, IProductDimensionsWithAvailabilitiesFull {}\n\n/**\n * Input class for the getDimensionsForSelectedVariant data action.\n */\nexport class GetDimensionsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public matchingDimensionValues: ProductDimension[];\n\n public catalogId?: number;\n\n private _requestContext?: IRequestContext;\n\n public constructor(\n productId: number,\n channelId: number,\n matchingDimensionValues?: ProductDimension[],\n requestContext?: IRequestContext\n ) {\n this._requestContext = requestContext;\n this.productId = productId;\n this.channelId = channelId;\n this.matchingDimensionValues = matchingDimensionValues || [];\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () =>\n generateCacheKey(\n this._requestContext?.apiSettings,\n { key: 'Key', value: 'DimensionsForSelectedVariantInput' },\n { key: 'ProductId', value: this.productId },\n { key: 'ChannelId', value: this.channelId },\n { key: 'CatalogId', value: this.catalogId }\n );\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType: () => string = () => 'DimensionsForSelectedVariantInput';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create input method for the getDimensionsForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nconst createDimensionsForSelectedVariantInput = (inputData: ICreateActionContext>): GetDimensionsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new GetDimensionsForSelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n getDimensionValuesFromQuery(inputData.requestContext.url.requestUrl),\n inputData.requestContext\n );\n }\n throw new Error('Unable to create DimensionsForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Converts new API type with availabilities to old API type to preserve backward compatibility.\n * @param dimensions - Dimensions to convert.\n * @returns Dimensions in old API format.\n */\nconst prepareDimensionsDataResult = (dimensions: IProductDimensionsWithAvailabilitiesFull[]): IDimensionForSelectedVariant[] => {\n return dimensions.map(newDimension => {\n const oldDimension: IDimensionForSelectedVariant = { ...newDimension };\n oldDimension.DimensionValues = ArrayExtensions.validValues(\n newDimension.dimensionValuesWithInventory?.map(value => value.DimensionValue)\n );\n return oldDimension;\n });\n};\n\n/**\n * Action Method for the getDimensionsForSelectedVariant Data Action.\n * @param input - Input for the data action.\n * @param context - Action context.\n * @returns Product dimensions with availability.\n */\nexport async function getDimensionsForSelectedVariantAction(\n input: GetDimensionsForSelectedVariantInput,\n context: IActionContext\n): Promise {\n const activeProducts = ArrayExtensions.validValues(\n await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n input.channelId,\n [input.productId],\n null,\n input.catalogId ?? 0\n )\n );\n\n if (!ArrayExtensions.hasElements(activeProducts)) {\n return [];\n }\n\n const activeProduct = activeProducts[0];\n\n if (!ArrayExtensions.hasElements(activeProduct.Dimensions)) {\n return [];\n }\n\n const promises = activeProduct.Dimensions.map(dimension => {\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\n\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\n MatchingDimensionValues: input.matchingDimensionValues\n .filter(item => item.DimensionTypeValue !== dimension.DimensionTypeValue)\n .map(productDimension => {\n return {\n DimensionTypeValue: productDimension.DimensionTypeValue,\n DimensionValue: {\n RecordId: productDimension.DimensionValue?.RecordId!,\n Value: productDimension.DimensionValue?.Value\n }\n };\n }),\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n activeProduct.MasterProductId ? activeProduct.MasterProductId : activeProduct.RecordId,\n searchCriteria\n );\n const fullDimensionPromise = dimensionValuesPromise.then(dimensionValues => {\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\n ...dimension,\n dimensionValuesWithInventory: dimensionValues\n };\n return fullDimension;\n });\n\n return fullDimensionPromise;\n });\n\n const dimensionValuesResults = await Promise.all(promises);\n\n return prepareDimensionsDataResult(dimensionValuesResults);\n}\n\n/**\n * The GetDimensionsForSelectedVariantDataAction\n * Get the currently selected Variant via the getSelectedVariant data action, and the gets the\n * available product dimensions for the variant via the getDimensionValues RetailServer API.\n */\nexport const getDimensionsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimensions/for-selected-variant',\n action: getDimensionsForSelectedVariantAction as IAction,\n input: createDimensionsForSelectedVariantInput\n});\n\nexport default getDimensionsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\n\nexport const getRnrPartnerId = (args: ICreateActionContext> | IActionContext): string => {\n return args.requestContext.apiSettings.rnr.id || '';\n};\n\nexport const getRnrEndpointId = (args: ICreateActionContext> | IActionContext): string => {\n return args.requestContext.apiSettings.rnr.url || '';\n};\n\nexport const getRnrAuthEndpointId = (args: ICreateActionContext> | IActionContext): string => {\n const endpoint = args.requestContext.apiSettings.rnr.proxyUrl\n ? args.requestContext.apiSettings.rnr.proxyUrl\n : args.requestContext.apiSettings.rnr.url || '';\n if (endpoint.length > 0 && endpoint.endsWith('/')) {\n return endpoint.substring(0, endpoint.length - 1);\n }\n return endpoint;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartLine, ChannelDeliveryOptionConfiguration, FeatureState, ProductWarehouse } from '@msdyn365-commerce/retail-proxy';\nimport { getOrgUnitConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport {\n getEstimatedAvailabilityAsync,\n getEstimatedProductWarehouseAvailabilityAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { getChannelDeliveryOptionConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport {\n ActiveCartProductsInput,\n ArrayExtensions,\n buildCacheKey,\n createInventoryAvailabilitySearchCriteria,\n getActiveCartProductsAction,\n IProductInventoryInformation,\n mapAggregatedProductInventoryInformation,\n mapProductInventoryInformation\n} from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\n\n/**\n * Input class for availabilities for items in cart.\n */\nexport class ProductAvailabilitiesForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsAvailability', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsAvailability';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductAvailabilitiesForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param cartLine\n * @param featureSate\n * @param channelDeliveryOptionConfig\n * @param pickupDeliveryMode\n */\nconst getDeliveryMode = (\n cartLine: CartLine,\n featureSate: boolean = false,\n channelDeliveryOptionConfig: ChannelDeliveryOptionConfiguration,\n pickupDeliveryMode?: string\n) => {\n if (!featureSate) {\n return cartLine.DeliveryMode === pickupDeliveryMode;\n }\n return (\n cartLine.DeliveryMode ===\n channelDeliveryOptionConfig?.PickupDeliveryModeCodes?.find(deliveryMode => deliveryMode === cartLine.DeliveryMode)\n );\n};\n\n/**\n * Calls the Retail API to get the product availabilities for items in the cart.\n * @param input\n * @param ctx\n */\n// eslint-disable-next-line complexity\nexport async function getAvailabilitiesForCartLineItems(\n input: ProductAvailabilitiesForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getAvailabilitiesForCartLineItems]No valid Input was provided, failing');\n }\n\n const shippingItems: CartLine[] = [];\n const bopisItems = [];\n let productAvailabilities: IProductInventoryInformation[] = [];\n const multiplePickupStoreSwitchName = 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let channelDeliveryOptionConfig: any;\n\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n const channelConfiguration = await getOrgUnitConfigurationAsync({ callerContext: ctx });\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n /**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\n async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n }\n const featureState = await getFeatureState(ctx);\n const retailMultiplePickUpOptionEnabled = featureState?.find(item => item.Name === multiplePickupStoreSwitchName)?.IsEnabled;\n if (retailMultiplePickUpOptionEnabled) {\n channelDeliveryOptionConfig = await getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx });\n }\n const PickupDeliveryModeCode = channelConfiguration.PickupDeliveryModeCode;\n const EmailDeliveryModeCode = channelConfiguration.EmailDeliveryModeCode;\n\n if (!cart || !channelConfiguration || !products || products.length === 0) {\n ctx.trace('[getAvailabilitiesForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n if (cart && cart.Id && cart.CartLines && cart.CartLines.length > 0 && channelConfiguration) {\n for (const cartLine of cart.CartLines) {\n if (\n cartLine.DeliveryMode &&\n cartLine.DeliveryMode !== '' &&\n getDeliveryMode(cartLine, retailMultiplePickUpOptionEnabled, channelDeliveryOptionConfig, PickupDeliveryModeCode)\n ) {\n bopisItems.push(cartLine);\n } else if (EmailDeliveryModeCode === '' || cartLine.DeliveryMode !== EmailDeliveryModeCode) {\n shippingItems.push(cartLine);\n }\n }\n }\n\n if (shippingItems && shippingItems.length > 0) {\n let productIds = shippingItems.map(x => x.ProductId!);\n productIds = ArrayExtensions.unique(productIds);\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, productIds, true);\n const shippingProductAvailabilities = await getEstimatedAvailabilityAsync(\n { callerContext: ctx, bypassCache: 'get' },\n searchCriteria\n );\n\n if (\n shippingProductAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities &&\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities.length > 0\n ) {\n productAvailabilities = mapAggregatedProductInventoryInformation(ctx, shippingProductAvailabilities);\n }\n }\n\n if (bopisItems && bopisItems.length > 0) {\n const productWarehouses: ProductWarehouse[] = [];\n\n for (const bopisItem of bopisItems) {\n const productWarehouse: ProductWarehouse = {\n ProductId: bopisItem.ProductId,\n InventLocationId: bopisItem.WarehouseId\n };\n\n if (ctx.requestContext.channel && ctx.requestContext.channel.InventLocationDataAreaId) {\n productWarehouse.DataAreaId = ctx.requestContext.channel.InventLocationDataAreaId;\n }\n productWarehouses.push(productWarehouse);\n }\n const quantityUnitTypeSales: number = 2;\n const getProductWarehouseAvail = await getEstimatedProductWarehouseAvailabilityAsync(\n { callerContext: ctx, bypassCache: 'get', queryResultSettings: {} },\n productWarehouses,\n quantityUnitTypeSales\n );\n\n if (\n getProductWarehouseAvail &&\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities &&\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities.length > 0\n ) {\n const productWarehouseMapping = mapProductInventoryInformation(\n ctx,\n getProductWarehouseAvail?.ProductWarehouseInventoryAvailabilities\n );\n if (productWarehouseMapping && productWarehouseMapping.length > 0) {\n for (const item of productWarehouseMapping) {\n productAvailabilities.push(item);\n }\n }\n }\n }\n\n if (productAvailabilities && productAvailabilities.length > 0) {\n return productAvailabilities;\n }\n\n ctx.trace('[getAvailabilitiesForCartLineItems] unable to get availabilities for product');\n return [];\n}\n\nexport const getAvailabilitiesForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-availabilities-cartlines',\n action: >getAvailabilitiesForCartLineItems,\n input: createInput\n});\n\nexport default getAvailabilitiesForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { getDeliveryOptionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n FilterDeliveryModeOption,\n ProductDeliveryOptions,\n ReleasedProductType,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetDeliveryOptionsForSelectedVariant Data Action.\n */\nexport class GetDeliveryOptionsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n public customerId: string;\n\n public featureState?: boolean;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, customerId?: string, featureState?: boolean) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.customerId = customerId || '';\n this.featureState = featureState;\n }\n\n public getCacheKey = () => 'DeliveryOptionsForSelectedVariant';\n\n public getCacheObjectType = () => 'DeliveryOptions';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * The createInput method for the GetDeliveryOptionsForSelectedVariant Data Action.\n * @param inputData The input data for the createInput method.\n */\nexport const createDeliveryOptionsForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): GetDeliveryOptionsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new GetDeliveryOptionsForSelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n undefined,\n undefined\n );\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The Action Method for the GetDeliveryOptionsForSelectedVariant Data Action\n * Pulls the currently selected variant from the cache using the getSelectedVariant data action, and gets it's supported delivery options\n * via the getDeliveryOptionsAsync RetailServer API.\n * @param input\n * @param ctx\n */\nexport async function getDeliveryOptionsForSelectedVariantAction(\n input: GetDeliveryOptionsForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n if (input.featureState === undefined) {\n const featureState = await getFeatureState(ctx);\n input.featureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n }\n\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return getDeliveryOptionsAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n [activeProduct.RecordId],\n {},\n\n // For service item, should not apply the filter, otherwise there will be no electronic delivery mode\n input.featureState && productResult?.ItemTypeValue !== ReleasedProductType.Service\n ? FilterDeliveryModeOption.FilterOutNonPickupDeliveryMode\n : null\n ).then(response => {\n if (response && response.length > 0) {\n return response[0];\n }\n\n return undefined;\n });\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getDeliveryOptionsForSelectedVariantAction]Error executing action');\n throw new Error('[getDeliveryOptionsForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getDeliveryOptionsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-delivery-options-for-selected-variant',\n action: >getDeliveryOptionsForSelectedVariantAction,\n input: createDeliveryOptionsForSelectedVariantInput\n});\n\nexport default getDeliveryOptionsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport {\n InventoryAccuracy,\n ProductDimensionAvailabilitySearchCriteria,\n ProductDimensionType,\n ProductDimensionValueInventoryAvailability,\n ProductsDataActions\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions, generateCacheKey, IKeyValuePair } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Interface for IProductDimension.\n */\nexport interface IProductDimension {\n masterProductId: number;\n requestDimensionType?: ProductDimensionType;\n requestDimensionTypes?: ProductDimensionType[];\n}\n\n/**\n * Product Input.\n */\nexport class ProductsDimensionAvailabilitiesInput implements IActionInput {\n public masterProductId: number;\n\n public requestDimensionType: ProductDimensionType | undefined;\n\n public requestDimensionTypes: ProductDimensionType[] | undefined;\n\n public catalogId?: number;\n\n private _requestContext?: IRequestContext;\n\n public constructor(\n masterProductId: number,\n requestDimensionType?: ProductDimensionType,\n requestContext?: IRequestContext,\n requestDimensionTypes?: ProductDimensionType[]\n ) {\n this._requestContext = requestContext;\n this.masterProductId = masterProductId;\n this.requestDimensionType = requestDimensionType;\n this.requestDimensionTypes = requestDimensionTypes;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => {\n const keys: IKeyValuePair[] = [\n { key: 'MasterProductId', value: this.masterProductId },\n { key: 'CatalogId', value: this.catalogId }\n ];\n if (this.requestDimensionTypes) {\n keys.push({ key: 'DimensionTypes', value: this.requestDimensionTypes });\n } else {\n keys.push({ key: 'DimensionType', value: this.requestDimensionType });\n }\n return generateCacheKey(this._requestContext?.apiSettings, ...keys);\n };\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType = (): string => 'MasterProductDimensionAvailabilities';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Create input method for the getDimensionsForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nexport const createProductsDimensionAvailabilitiesInput = (\n inputData: ICreateActionContext>\n): ProductsDimensionAvailabilitiesInput[] => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- ignore type of config.\n const productsDimensions: IProductDimension[] = inputData.config?.productsDimensions;\n\n return productsDimensions.map((productDimension: IProductDimension) => {\n return new ProductsDimensionAvailabilitiesInput(\n productDimension.masterProductId,\n productDimension.requestDimensionType,\n inputData.requestContext,\n productDimension.requestDimensionTypes\n );\n });\n};\n\n/**\n * Action Method for the getDimensionsForSelectedVariant Data Action.\n * @param inputs - Input for the data action.\n * @param context - Action context.\n * @returns Master product dimensions with availabilities.\n */\nexport async function getDimensionAvailabilitiesForProductsAction(\n inputs: ProductsDimensionAvailabilitiesInput[],\n context: IActionContext\n): Promise {\n if (!Array.isArray(inputs) || !ArrayExtensions.hasElements(inputs)) {\n context.trace('[getDimensionAvailabilitiesForProductsAction] Invalid or empty inputs passed.');\n return [];\n }\n\n const promise = inputs.map(input => {\n // As per default PDP loads shipping inventory policies, so making swatch to pick the same configuration\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(\n context,\n [input.masterProductId],\n true,\n undefined,\n undefined\n );\n\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n MatchingDimensionValues: undefined,\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n if (input.requestDimensionTypes) {\n searchCriteria.RequestedDimensionTypeValues = input.requestDimensionTypes;\n searchCriteria.InventoryAccuracyValue = InventoryAccuracy.Low;\n } else {\n searchCriteria.RequestedDimensionTypeValue = input.requestDimensionType;\n }\n\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n input.masterProductId,\n searchCriteria\n );\n\n return dimensionValuesPromise;\n });\n\n // eslint-disable-next-line no-return-await -- existing code\n return await Promise.all(promise);\n}\n\n/**\n * The GetDimensionAvailabilitiesForProductsAction\n * Gets the available product dimensions for the master product via the getDimensionValues RetailServer API.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimension-availabilities-for-products',\n action: getDimensionAvailabilitiesForProductsAction as IAction,\n input: createProductsDimensionAvailabilitiesInput,\n isBatched: true\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ChannelDeliveryOption,\n DeliveryModeTypeFilter,\n FeatureState,\n ItemAvailability,\n OrgUnitAvailability,\n OrgUnitLocation,\n ProductWarehouseInventoryInformation,\n SearchArea,\n StoreHours\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n getChannelDeliveryOptionsAsync,\n getOrgUnitLocationsByAreaAsync,\n getStoreHoursAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport { getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { IFullOrgUnitAvailability } from './utilities/full-org-unit-availability';\nimport { DeliveryMode, IProductInventoryInformation } from './utilities/product-inventory-information';\nimport { createInventoryAvailabilitySearchCriteria, mapProductInventoryInformation } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Get selected variant action input class.\n */\nexport class GetFullAvailableInventoryNearbyInput implements IActionInput {\n public latitude?: number;\n\n public longitude?: number;\n\n public radius?: number;\n\n public productId?: number;\n\n public DistanceUnitValue?: number;\n\n public IgnoreLocation?: boolean;\n\n constructor(\n _productId?: number,\n _latitude?: number,\n _longitude?: number,\n _radius?: number,\n _DistanceUnitValue?: number,\n _IgnoreLocation?: boolean\n ) {\n this.productId = _productId;\n this.latitude = _latitude;\n this.longitude = _longitude;\n this.radius = _radius;\n this.DistanceUnitValue = _DistanceUnitValue;\n this.IgnoreLocation = _IgnoreLocation;\n }\n\n public getCacheKey = () => 'GetFullAvailableInventoryNearbyInputCache';\n\n public getCacheObjectType = () => 'GetFullAvailableInventoryNearbyInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns GetFullAvailableInventoryNearbyInput - The action input.\n */\nexport const createGetFullAvailableInventoryNearbyInput = (\n inputData: ICreateActionContext>\n): GetFullAvailableInventoryNearbyInput => {\n return new GetFullAvailableInventoryNearbyInput();\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context - The context.\n * @returns FeatureState - The feature state.\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * Action method for the getSelectedVariant data aciton.\n * @param input - The action input class.\n * @param ctx - The action context.\n * @returns IFullOrgUnitAvailability - The full org unit availability.\n */\nexport async function getFullAvailableInventoryNearbyAction(\n input: GetFullAvailableInventoryNearbyInput,\n ctx: IActionContext\n): Promise {\n // No valid product we want to return undefined so module knows there are no results yet\n if (!input.productId) {\n return undefined;\n }\n\n if (((!input.radius && input.radius !== 0) || !input.latitude || !input.longitude) && !input.IgnoreLocation) {\n // No valid location we want to return empty array so module can show no locations message\n return [];\n }\n\n const searchArea: SearchArea = {\n Latitude: input.latitude,\n Longitude: input.longitude,\n Radius: input.radius,\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\n };\n\n const featureState = await getFeatureState(ctx);\n const retailMulitplePickupMFeatureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, [input.productId], false, true, searchArea, DeliveryMode.pickup);\n return getEstimatedAvailabilityAsync({ callerContext: ctx }, searchCriteria)\n .then(async (productWarehouseInformation: ProductWarehouseInventoryInformation) => {\n // For store selector, inventory should always come from an individual store\n const productInventoryInformation = mapProductInventoryInformation(\n ctx,\n productWarehouseInformation.ProductWarehouseInventoryAvailabilities\n );\n return getOrgUnitLocationsByAreaAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n searchArea,\n DeliveryModeTypeFilter.Pickup\n )\n .then(async (stores: OrgUnitLocation[]) => {\n // Constructing a store mapping based on the InventoryId.\n const storeMap = new Map();\n stores.forEach(store => {\n if (store.InventoryLocationId) {\n storeMap.set(store.InventoryLocationId, store);\n }\n });\n\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\n\n // If multiple pickup mode is enable then call getchanneldeliveryoption\n if (retailMulitplePickupMFeatureState) {\n const orgUnitChannel = stores.map(store => store.ChannelId);\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\n }\n\n const availabilityPromiseList = stores.map(store => {\n const locationDeliveryOption = locationDeliveryOptions?.find(\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\n );\n return _getAvailabilityWithHours(store, productInventoryInformation, storeMap, ctx, locationDeliveryOption);\n });\n\n return Promise.all(availabilityPromiseList);\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\n return [];\n });\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\n );\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\n );\n return [];\n });\n}\n\n/**\n * Action method that obtains the store information along with store hours and product availability.\n * @param orgUnitLocation - The org unit location.\n * @param productInventoryInformation - The product inventory information.\n * @param storeMap - A map that contains store information group by the inventory location id.\n * @param ctx The action context.\n * @param channelDeleiveryOptions - The channel delivery options.\n * @returns IFullOrgUnitAvailability - The full org unit availability.\n */\nasync function _getAvailabilityWithHours(\n orgUnitLocation: OrgUnitLocation,\n productInventoryInformation: IProductInventoryInformation[],\n storeMap: Map,\n ctx: IActionContext,\n channelDeleiveryOptions: ChannelDeliveryOption | undefined\n): Promise {\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\n return { OrgUnitAvailability: undefined };\n }\n\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\n .then((hours: StoreHours) => {\n const itemAvailabilities: ItemAvailability[] = [];\n if (productInventoryInformation && storeMap) {\n productInventoryInformation.forEach(element => {\n if (\n element.InventLocationId &&\n storeMap.has(element.InventLocationId) &&\n element.InventLocationId === orgUnitLocation.InventoryLocationId\n ) {\n itemAvailabilities.push({ AvailableQuantity: element.ProductAvailableQuantity?.AvailableQuantity });\n }\n });\n }\n\n const availability: OrgUnitAvailability = {\n OrgUnitLocation: orgUnitLocation,\n ItemAvailabilities: itemAvailabilities\n };\n\n if (hours && !(hours instanceof Error)) {\n return {\n OrgUnitAvailability: availability,\n StoreHours: hours,\n ProductInventoryInformation: productInventoryInformation,\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\n };\n }\n\n return {\n OrgUnitAvailability: availability,\n ProductInventoryInformation: productInventoryInformation,\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\n };\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting availability with hours');\n return { OrgUnitAvailability: {} };\n });\n}\n\n/**\n * Action method that obtains the channel delivery option information.\n * @param channelCollection - The org unit channel Id list.\n * @param ctx - The action context.\n * @returns ChannelDeliveryOption - The channel delivery option collection.\n */\nasync function _getLocationPickUpDeliveryModes(\n channelCollection: (number | undefined)[],\n ctx: IActionContext\n): Promise {\n if (channelCollection?.length === 0 || channelCollection === undefined) {\n return undefined;\n }\n\n const channelIdList: number[] = [];\n channelCollection?.forEach(id => {\n if (id !== undefined) {\n channelIdList.push(id);\n }\n });\n\n // To get all channel pickup delivery mode filterOption should be 4\n return getChannelDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n channelIdList,\n 4\n )\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\n return channelDeliveryOptions;\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n return [];\n });\n}\n\n/**\n * The complete getFullAvailableInventoryNearby data action.\n */\nexport const getFullAvailableInventoryNearbyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-available-inventory-nearby',\n action: >getFullAvailableInventoryNearbyAction,\n input: createGetFullAvailableInventoryNearbyInput\n});\n\nexport default getFullAvailableInventoryNearbyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * QuickOrderTemplateLine state information.\n */\nexport class QuickOrderTemplateLine {\n public productListLine: ProductListLine;\n\n public fullProduct?: FullProduct;\n\n public constructor(productListLine: ProductListLine, fullProduct?: FullProduct) {\n this.productListLine = productListLine;\n this.fullProduct = fullProduct;\n }\n}\n\n/**\n * Quick Order template line state.\n */\nexport interface IQuickOrderTemplateLinesState {\n lines: QuickOrderTemplateLine[];\n totalCount: number;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport getFullProducts, { FullProductInput } from './get-full-products';\nimport { ArrayExtensions } from './utilities';\nimport { IQuickOrderTemplateLinesState, QuickOrderTemplateLine } from './utilities/quick-order-template-line';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Input class for the GetProductListLines data action.\n *\n */\nexport class GetProductListLinesInput implements IActionInput {\n public productListId: string;\n\n public searchText: string;\n\n public constructor(productListId: string, searchText?: string) {\n this.productListId = productListId;\n this.searchText = searchText ?? '';\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => `GetProductListLines|${this.productListId}|${this.searchText}`;\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'GetProductListLines';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetProductListLines method.\n * @param productListId - ProductList Id.\n * @param searchText - Search Text.\n * @returns - Input data for getproductlistlines.\n */\nexport const createGetProductListLinesInput = (productListId: string, searchText?: string): GetProductListLinesInput => {\n return new GetProductListLinesInput(productListId, searchText);\n};\n\n/**\n * The action method for the GetProductListLines data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Product list lines.\n */\nexport async function getProductListLinesAction(\n input: GetProductListLinesInput,\n context: IActionContext\n): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full product list lines. User is not authenticated.');\n }\n\n const quickOrderTemplateLinesState: IQuickOrderTemplateLinesState = {\n lines: [],\n totalCount: 0\n };\n\n const promise = ProductListsDataActions.getProductListLinesAsync(\n {\n callerContext: context\n },\n input.productListId,\n input.searchText\n );\n\n const productListLines = await promise;\n const productInputs: FullProductInput[] = [];\n\n if (ArrayExtensions.hasElements(productListLines)) {\n quickOrderTemplateLinesState.totalCount = promise.metadata.count ?? quickOrderTemplateLinesState.lines.length;\n productListLines.map(listLine => {\n if (listLine.ProductId) {\n quickOrderTemplateLinesState.lines.push(new QuickOrderTemplateLine(listLine));\n productInputs.push(\n new FullProductInput(\n listLine.ProductId,\n context.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(context),\n context.requestContext\n )\n );\n }\n return productInputs;\n });\n if (ArrayExtensions.hasElements(productInputs)) {\n const fullProductsInfo = await getFullProducts(productInputs, context)\n .then((products: FullProduct[]) => {\n return products;\n })\n .catch((error: Error) => {\n context.trace(error.message);\n context.telemetry.error('[getProductListLinesAction] Unable to retrieve product info.');\n });\n if (fullProductsInfo) {\n quickOrderTemplateLinesState.lines.map(line => {\n const fullProduct = fullProductsInfo.find(\n product => product.ProductDetails.RecordId === line.productListLine.ProductId\n );\n if (!fullProduct) {\n context.telemetry.error('[getProductListLinesAction] Unable to find product info for an product list line.');\n return null;\n }\n line.fullProduct = fullProduct;\n return null;\n });\n }\n return quickOrderTemplateLinesState;\n }\n context.trace(quickOrderTemplateLinesState.lines.length.toString());\n return quickOrderTemplateLinesState;\n }\n return quickOrderTemplateLinesState;\n}\n\n/**\n * The GetProductListLines Data Action\n * Returns order templates.\n */\nexport const getProductListLinesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-list-lines',\n action: getProductListLinesAction as IAction,\n input: createGetProductListLinesInput\n});\n\nexport default getProductListLinesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { getActivePricesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { ProductPrice, ProductType, ProjectionDomain, SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '.';\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetPriceForSelectedVariant Data Action.\n */\nexport class PriceForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n public customerId?: string;\n\n public constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, customerId?: string) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.customerId = customerId ?? '';\n }\n\n public getCacheKey = (): string => 'PriceForSelectedVariant';\n\n public getCacheObjectType = (): string => 'Price';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetPriceForSelectedVariantDataAction.\n * @param inputData - The input data for the createInput method.\n * @returns The PriceForSelectedVariantInput.\n */\nexport const createActivePriceForSelectedVariantInput = (inputData: ICreateActionContext>): PriceForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new PriceForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined);\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The Action Method for the GetPriceForSelectedVariant Data Action\n * Pulls the currently selected variant from the cache using the getSelectedVariant data action, and gets it's current contextual price\n * via the getActivePrice RetailServer API.\n * @param input - The input.\n * @param ctx - The ctx.\n * @returns The Promise.\n */\nexport async function getPriceForSelectedVariantAction(\n input: PriceForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then(async (productResult: SimpleProduct | null) => {\n const catalogId = getCatalogId(ctx.requestContext);\n const projectDomain: ProjectionDomain = {\n ChannelId: +ctx.requestContext.apiSettings.channelId,\n CatalogId: catalogId\n };\n\n const activeProduct: SimpleProduct | undefined = productResult as SimpleProduct | undefined;\n if (activeProduct) {\n const featureStates: FeatureState[] = await getFeatureStateActionDataAction(new FeatureStateInput(), ctx);\n return getActivePricesAsync(\n { callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) },\n projectDomain,\n [activeProduct.RecordId],\n new Date(),\n input.customerId,\n undefined,\n true,\n featureStates.find(featureState => featureState.Name === 'Dynamics.AX.Application.RetailSearchPriceRangeFeature')\n ?.IsEnabled &&\n (activeProduct.ProductTypeValue === ProductType.Master || activeProduct.ProductTypeValue === ProductType.KitMaster),\n featureStates.find(\n featureState => featureState.Name === 'Dynamics.AX.Application.RetailSalesAgreementPriceSupportFeature'\n )?.IsEnabled\n ).then((productPrices: ProductPrice[]) => {\n if (!ArrayExtensions.hasElements(productPrices)) {\n throw new Error('[getPriceForSelectedVariantAction]Invalid response recieved from getActivePricesAsync');\n }\n return productPrices[0];\n });\n }\n\n return null;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getPriceForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-price-for-selected-variant',\n action: getPriceForSelectedVariantAction as IAction,\n input: createActivePriceForSelectedVariantInput\n});\n\nexport default getPriceForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ProductAvailableQuantity,\n ProductsDataActions,\n ProductType,\n ProductWarehouseInventoryAvailability,\n ReleasedProductType,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\n\nimport getSelectedVariant, { SelectedVariantInput } from './get-selected-variant';\nimport { ArrayExtensions, getSelectedProductIdFromActionInput } from './utilities';\nimport { DeliveryMode, IProductInventoryInformation } from './utilities/product-inventory-information';\nimport { createInventoryAvailabilitySearchCriteria, mapAggregatedProductInventoryInformation } from './utilities/product-inventory-utils';\n\n/**\n * Input class for the getProductAvailabilitiesForSelectedVariant Data Action.\n */\nexport class ProductAvailabilitiesForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n public constructor(productId: number | string, channelId: number, selectedProduct?: SimpleProduct) {\n this.productId = typeof productId === 'string' ? +productId : productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n }\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => 'ProductAvailabilitiesForSelectedVariant';\n\n /**\n * GetCacheObjectType.\n * @returns - Cache Object Type string.\n */\n public getCacheObjectType = (): string => 'ProductAvailabilities';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getProductAvailabilitiesForSelectedVariant data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - ProductAvailabilitiesForSelectedVariant or error.\n */\nexport const createProductAvailabilitiesForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): ProductAvailabilitiesForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new ProductAvailabilitiesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId);\n }\n throw new Error('Unable to create ProductAvailabilitiesForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The action method for the getProductAvailabilitiesForSelectedVariant data action.\n * @param input - ProductAvailabilitiesForSelectedVariant.\n * @param ctx - Action Context.\n * @returns - Product inventory information.\n */\nexport async function getProductAvailabilitiesForSelectedVariantAction(\n input: ProductAvailabilitiesForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n const productInventoryInformation: IProductInventoryInformation[] = [];\n\n try {\n let productResult: SimpleProduct | null = input.selectedProduct ?? null;\n\n if (!productResult) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n productResult = await getSelectedVariant(selectedVariantInput, ctx);\n }\n\n // Don't get availability if it is service item && enableStockCheck is disbaled.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Reading config.\n if (\n ctx.requestContext.app.config.enableStockCheck &&\n productResult &&\n productResult.ItemTypeValue !== ReleasedProductType.Service &&\n productResult.ProductTypeValue !== ProductType.Master\n ) {\n const shippingSearchCriteria = createInventoryAvailabilitySearchCriteria(\n ctx,\n [productResult.RecordId],\n true,\n undefined,\n undefined,\n DeliveryMode.shipping\n );\n const pickupSearchCriteria = createInventoryAvailabilitySearchCriteria(\n ctx,\n [input.productId],\n false,\n true,\n undefined,\n DeliveryMode.pickup\n );\n const shippingAvailability = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: ctx },\n shippingSearchCriteria\n );\n if (shippingAvailability.ProductWarehouseInventoryAvailabilities) {\n const shippingInventory = mapAggregatedProductInventoryInformation(ctx, shippingAvailability);\n if (ArrayExtensions.hasElements(shippingInventory)) {\n shippingInventory[0].deliveryType = DeliveryMode.shipping;\n productInventoryInformation.push(shippingInventory[0]);\n }\n }\n const pickupAvailability = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: ctx },\n pickupSearchCriteria\n );\n if (pickupAvailability.ProductWarehouseInventoryAvailabilities) {\n const pickupInventory = mapAggregatedProductInventoryInformation(ctx, pickupAvailability);\n if (ArrayExtensions.hasElements(pickupInventory)) {\n pickupInventory[0].deliveryType = DeliveryMode.pickup;\n productInventoryInformation.push(pickupInventory[0]);\n }\n }\n return productInventoryInformation;\n }\n return undefined;\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- cann't assign type to the error variable.\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n return undefined;\n }\n}\n\n/**\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity.\n * @param productsWarehouseInventory - Product warehouse inventory.\n * @returns Product Available quantity.\n */\nexport function mergeProductWarehouseToProductAvailabities(\n productsWarehouseInventory: ProductWarehouseInventoryAvailability[]\n): ProductAvailableQuantity[] {\n const productAvailable: ProductAvailableQuantity[] = [];\n if (ArrayExtensions.hasElements(productsWarehouseInventory)) {\n for (const product of productsWarehouseInventory) {\n if (product.TotalAvailable !== undefined && product.ProductId !== undefined) {\n productAvailable.push({ ProductId: product.ProductId, AvailableQuantity: product.TotalAvailable });\n }\n }\n }\n return productAvailable;\n}\n\n/**\n * The complete getProductAvailabilitiesForSelectedVariant data action\n * Get the currently selected variant via the getSelectedVariant data action, and\n * then gets the availabilities for the variant via the getProductAvailabilities RetailServer API.\n */\nexport const getProductAvailabilitiesForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-availabilities-for-selected-variant',\n action: >getProductAvailabilitiesForSelectedVariantAction,\n input: createProductAvailabilitiesForSelectedVariantInput\n});\n\nexport default getProductAvailabilitiesForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport { Cart, CartLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport {\n createGetFeatureStateInput,\n CartConfigurationInput,\n getCartConfiguration,\n getCustomer,\n GetCustomerInput,\n getFeatureState,\n getSimpleProducts,\n ProductInput\n} from '.';\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Input class for activeCartWithProducts data action.\n */\nexport class ActiveCartProductsInput implements IActionInput {\n public getCacheKey = () => 'ActiveCartProducts';\n\n public getCacheObjectType = () => 'ActiveCartProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new ActiveCartProductsInput();\n};\n\n/**\n * Calls the Retail API and returns a cart object based on the passed GetCartInput.\n * @param input\n * @param ctx\n */\nexport async function getActiveCartProductsAction(input: ActiveCartProductsInput, ctx: IActionContext): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n throw new Error('[getActiveCartWithProducts]No valid Input was provided, failing');\n }\n\n const cartState = await getCartState(ctx);\n const cart = cartState.cart;\n\n const isQuantityLimitsFeatureIsOn: boolean = await isOrderQuantityLimitsFeatureEnabled(ctx);\n\n if (isQuantityLimitsFeatureIsOn) {\n return getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart, ctx);\n }\n\n // If there are cart lines, make call to get products\n if (!cartState.hasInvoiceLine && cart && cart.CartLines && cart.CartLines.length > 0) {\n ctx.trace('Getting cart product information...');\n return getSimpleProducts(\n cart.CartLines.map(cartLine => {\n if (cartLine.ProductId) {\n return new ProductInput(\n cartLine.ProductId,\n ctx.requestContext.apiSettings,\n undefined,\n undefined,\n ctx.requestContext,\n cartLine.CatalogId\n );\n }\n return undefined;\n }).filter(Boolean),\n ctx\n )\n .then((products: SimpleProduct[]) => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.toString());\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[getActiveCartWithProducts]Unable to hydrate cart with product information');\n throw new Error('[getActiveCartWithProducts]Unable to hydrate cart with product information');\n });\n }\n\n ctx.trace('[getActiveCartWithProducts]No Products Found in cart');\n return [];\n}\n\nexport const getActiveCartProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-products-in-active-cart',\n action: >getActiveCartProductsAction,\n input: createInput\n});\nexport default getActiveCartProductsActionDataAction;\n\nasync function getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart: Cart, ctx: IActionContext): Promise {\n const productIdsByWarehouseId: Map = new Map();\n let resultProducts: SimpleProduct[] = [];\n cart.CartLines?.forEach(cartLine =>\n productIdsByWarehouseId.has(cartLine.WarehouseId!)\n ? productIdsByWarehouseId.get(cartLine.WarehouseId!)?.push(cartLine)\n : productIdsByWarehouseId.set(cartLine.WarehouseId!, [cartLine])\n );\n return Promise.all(\n [...productIdsByWarehouseId].map(([entryWarehouseId, entryProductIds]) => {\n return getSimpleProducts(\n entryProductIds\n .map(cartLine => {\n if (cartLine.ProductId) {\n return new ProductInput(\n cartLine.ProductId,\n ctx.requestContext.apiSettings,\n undefined,\n entryWarehouseId,\n ctx.requestContext,\n cartLine.CatalogId\n );\n }\n return undefined;\n })\n .filter(Boolean),\n ctx\n ).then((products: SimpleProduct[]) => {\n if (products) {\n resultProducts = products.reduce((accum, product) => {\n if (product) {\n accum.push(product);\n }\n return accum;\n }, resultProducts);\n }\n });\n })\n ).then(() => resultProducts);\n}\n\nasync function isOrderQuantityLimitsFeatureEnabled(ctx: IActionContext): Promise {\n const featureStates = await getFeatureState(createGetFeatureStateInput(ctx), ctx);\n let isQuantityLimitsFeatureEnabledInHq = false;\n if (ArrayExtensions.hasElements(featureStates)) {\n isQuantityLimitsFeatureEnabledInHq =\n featureStates.find(featureState => featureState.Name === 'Dynamics.AX.Application.EcommerceQuantityLimitConfigurationsFeature')\n ?.IsEnabled || false;\n }\n\n if (isQuantityLimitsFeatureEnabledInHq) {\n return true;\n }\n\n if (ArrayExtensions.hasElements(featureStates)) {\n isQuantityLimitsFeatureEnabledInHq =\n featureStates.find(\n (featureState: FeatureState) => featureState.Name === 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature'\n )?.IsEnabled || false;\n }\n\n if (!isQuantityLimitsFeatureEnabledInHq) {\n return false;\n }\n\n const useSiteBuilderSettings = featureStates?.find(\n featureState => featureState.Name === 'RevertToSiteBuilderOrderQuantityLimitsSettings'\n )?.IsEnabled;\n\n if (useSiteBuilderSettings) {\n const defaultOrderQuantityLimitsFeatureConfig = ctx.requestContext.app?.platform?.enableDefaultOrderQuantityLimits;\n if (defaultOrderQuantityLimitsFeatureConfig === 'none') {\n return Promise.resolve(false);\n }\n if (defaultOrderQuantityLimitsFeatureConfig === 'all') {\n return Promise.resolve(true);\n }\n\n return getCustomer(new GetCustomerInput(ctx.requestContext.apiSettings), ctx)\n .then(customerInfo => {\n return (\n !!customerInfo &&\n ((defaultOrderQuantityLimitsFeatureConfig === 'b2b' && customerInfo.IsB2b) ||\n (defaultOrderQuantityLimitsFeatureConfig === 'b2c' && !customerInfo.IsB2b))\n );\n })\n .catch((error: Error) => {\n ctx.telemetry.warning(error.message);\n ctx.telemetry.debug('Unable to get customer info');\n return false;\n });\n } else {\n return getCartConfiguration(new CartConfigurationInput(), ctx)\n .then(cartConfiguration => {\n return !(cartConfiguration?.IgnoreOrderSettings ?? false);\n })\n .catch((error: Error) => {\n ctx.telemetry.warning(error.message);\n ctx.telemetry.debug('Unable to get cart configuration');\n return false;\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 {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport {\n ChannelDeliveryOption,\n FeatureState,\n OrgUnitAvailability,\n OrgUnitLocation,\n SearchArea,\n StoreHours\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n getChannelDeliveryOptionsAsync,\n getOrgUnitLocationsByAreaAsync,\n getStoreHoursAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\n\nimport { FeatureStateInput, getFeatureStateActionDataAction } from './get-feature-state';\nimport { IFullOrgUnitAvailability } from './utilities/full-org-unit-availability';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Get selected variant action input class.\n */\nexport class GetOrgUnitLocationsByAreaInput implements IActionInput {\n public Latitude?: number;\n\n public Longitude?: number;\n\n public Radius?: number;\n\n public DistanceUnitValue?: number;\n\n public IgnoreLocation?: boolean;\n\n constructor(_Latitude?: number, _Longitude?: number, _Radius?: number, _DistanceUnitValue?: number, _IgnoreLocation?: boolean) {\n this.Latitude = _Latitude;\n this.Longitude = _Longitude;\n this.Radius = _Radius;\n this.DistanceUnitValue = _DistanceUnitValue;\n this.IgnoreLocation = _IgnoreLocation;\n }\n\n public getCacheKey = () => 'GetOrgUnitLocationsByAreaInput';\n\n public getCacheObjectType = () => 'GetOrgUnitLocationsByAreaInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetOrgUnitLocationsByAreaInput = (inputData: ICreateActionContext>): GetOrgUnitLocationsByAreaInput => {\n return new GetOrgUnitLocationsByAreaInput();\n};\n\n/**\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\n * @param context\n */\nexport async function getFeatureState(context: IActionContext): Promise {\n return getFeatureStateActionDataAction(new FeatureStateInput(), context);\n}\n\n/**\n * Action method for the getSelectedVariant data action.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getOrgUnitLocationsByArea(\n input: GetOrgUnitLocationsByAreaInput,\n ctx: IActionContext\n): Promise {\n if ((input.Radius === undefined || !input.Latitude || !input.Longitude) && !input.IgnoreLocation) {\n // No valid location we want to return empty array so module can show no locations message\n return [];\n }\n\n const searchArea: SearchArea = {\n Latitude: input.Latitude,\n Longitude: input.Longitude,\n Radius: input.Radius,\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\n };\n\n const featureState = await getFeatureState(ctx);\n const retailMulitplePickupMFeatureState = featureState?.find(\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled;\n\n return getOrgUnitLocationsByAreaAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n searchArea\n )\n .then(async (stores: OrgUnitLocation[]) => {\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\n\n // If mulitple pickup mode is enable then call getchanneldeliveryoption\n if (retailMulitplePickupMFeatureState) {\n const orgUnitChannel = stores.map(store => store.ChannelId);\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\n }\n const locationPromiseList = stores.map(store => {\n const locationDeliveryOption = locationDeliveryOptions?.find(\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\n );\n return _getLocationWithHours(store, locationDeliveryOption, ctx);\n });\n return Promise.all(locationPromiseList);\n })\n .catch((error: Error) => {\n ctx.trace('[GetOrgUnitLocationsByArea] error getting Locations');\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[GetOrgUnitLocationsByArea] error getting Locations');\n return [];\n });\n}\n\n/**\n * Action method that obtains the store information.\n * @param orgUnitLocation The org unit location.\n * @param storeMap A map that contains store information group by the inventory location id.\n * @param channelDeleiveryOptions\n * @param ctx The action context.\n */\nasync function _getLocationWithHours(\n orgUnitLocation: OrgUnitLocation,\n channelDeleiveryOptions: ChannelDeliveryOption | undefined,\n ctx: IActionContext\n): Promise {\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\n return { OrgUnitAvailability: undefined };\n }\n\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\n .then((hours: StoreHours) => {\n const availability: OrgUnitAvailability = {\n OrgUnitLocation: orgUnitLocation\n };\n\n if (hours && !(hours instanceof Error)) {\n return { OrgUnitAvailability: availability, StoreHours: hours, OrgUnitPickUpDeliveryModes: channelDeleiveryOptions };\n }\n\n return { OrgUnitAvailability: availability, OrgUnitPickUpDeliveryModes: channelDeleiveryOptions };\n })\n .catch((error: Error) => {\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting availability with hours');\n return { OrgUnitAvailability: {} };\n });\n}\n\n/**\n * Action method that obtains the store information.\n * @param channelCollection The org unit channel Id list.\n * @param ctx The action context.\n */\nasync function _getLocationPickUpDeliveryModes(\n channelCollection: (number | undefined)[],\n ctx: IActionContext\n): Promise {\n if (channelCollection?.length === 0 || channelCollection === undefined) {\n return undefined;\n }\n\n const channelIdList: number[] = [];\n channelCollection?.forEach(id => {\n if (id !== undefined) {\n channelIdList.push(id);\n }\n });\n\n // To get all channel pickup delivery mode filterOption should be 4\n return getChannelDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n channelIdList,\n 4\n )\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\n return channelDeliveryOptions;\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace(\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\n '[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\n );\n return [];\n });\n}\n\n/**\n * The complete getOrgUnitLocationsByArea data action.\n */\nexport const getOrgUnitLocationsByAreaDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-store-location-information',\n action: >getOrgUnitLocationsByArea,\n input: createGetOrgUnitLocationsByAreaInput\n});\n\nexport default getOrgUnitLocationsByAreaDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { QueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { searchAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductList, ProductListSearchCriteria, ProductListType } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from '../utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetOrderTemplatesInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly queryResultSettings?: QueryResultSettings;\n\n constructor(productListId?: string, queryResultSettings?: QueryResultSettings) {\n this.productListId = productListId || '';\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = (): string =>\n `${this.productListId}|${this.queryResultSettings?.Paging?.Top}|${this.queryResultSettings?.Paging?.Skip}`;\n\n public getCacheObjectType = () => 'ProductList';\n\n public dataCacheType = (): CacheType => 'instance';\n\n public shouldCacheOutput = () => false;\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param productListId? The product list identifier.\n * @param queryResultSettings? The query result setting required for pagination/ordering.\n * @param productListId\n * @param queryResultSettings\n */\nexport const createGetOrderTemplatesInput = (\n inputData: ICreateActionContext,\n productListId?: string,\n queryResultSettings?: QueryResultSettings\n): GetOrderTemplatesInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get order template. User is not authenticated.');\n }\n\n return new GetOrderTemplatesInput(productListId || '', queryResultSettings);\n};\n\n/**\n * The action method for the GetOrderTemplates data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getOrderTemplatesAction(input: GetOrderTemplatesInput, ctx: IActionContext): Promise {\n try {\n const productListSearchCriteria: ProductListSearchCriteria = {\n ProductListId: input.productListId,\n ProductListType: `${ProductListType.OrderTemplate}`\n };\n return await searchAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n productListSearchCriteria\n );\n } catch (error) {\n ctx.telemetry.error('Not able to get order template(s)', error);\n throw error;\n }\n}\n\n/**\n * The GetOrderTemplates Data Action\n * Returns order templates.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-order-templates',\n action: >getOrderTemplatesAction,\n input: createGetOrderTemplatesInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ObjectExtensions } from './object-extensions';\n\n/**\n * Namespace which extends enum functionality.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport namespace EnumExtensions {\n /**\n * @description Returns a list of numeric values and enum names for the specified enum.\n * @param enumClass\n * @param {any} value The enum to examine.\n * @returns {(number | string)[]} An array of numeric values and enum names.\n */\n export function getValues(enumClass: any): (number | string)[] {\n if (ObjectExtensions.isNullOrUndefined(enumClass)) {\n return [];\n }\n\n return Object.keys(enumClass).map(item => enumClass[item]);\n }\n\n /**\n * @description Returns a list of enum names for the specified enum.\n * @param enumClass\n * @param {any} value The enum to examine.\n * @returns {(number | string)[]} An array of string values.\n */\n export function getNames(enumClass: any): string[] {\n return getValues(enumClass).filter(ObjectExtensions.isString);\n }\n\n /**\n * @description Returns a list of numeric values for the specified enum.\n * @param enumClass\n * @param {any} value The enum to examine.\n * @returns {number[]} An array of numeric values.\n */\n export function getNumericValues(enumClass: any): number[] {\n return getValues(enumClass).filter(ObjectExtensions.isNumber);\n }\n\n /**\n * @description Returns a list of enum values for the specified enum.\n * @param enumClass\n * @param {any} value The enum to examine.\n * @returns {number[]} An array of enum values.\n */\n export function getEnumValues(enumClass: any): T[] {\n return getNumericValues(enumClass).map(value => value);\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ObjectExtensions } from './object-extensions';\n\n/**\n * Namespace which extends string functionality.\n */\nexport namespace StringExtensions {\n /**\n * Checks if string is null, undefined, empty, or whitespace.\n * @param {string | null | undefined} value The string to examine.\n * @returns {boolean} True if it's null, undefined, empty, or whitespace; false otherwise.\n */\n export function isNullOrWhitespace(value: string | null | undefined): boolean {\n return isNullOrEmpty(value) || value!.trim() === '';\n }\n\n /**\n * Checks if string is null, undefined, or empty.\n * @param {string | null | undefined} value The string to examine.\n * @returns {boolean} True if it's null, undefined, empty, or whitespace; false otherwise.\n */\n export function isNullOrEmpty(value: string | null | undefined): boolean {\n if (ObjectExtensions.isNullOrUndefined(value)) {\n return true;\n }\n\n if (!ObjectExtensions.isString(value)) {\n throw new Error('StringExtensions has received a non-string input.');\n }\n\n return value === '';\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 { CartLine } from '@msdyn365-commerce/retail-proxy';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ArrayExtensions } from './extensions/array-extensions';\nimport { IProductInventoryInformation } from './product-inventory-information';\n\n/**\n * Cart line inventory validation result interface.\n */\nexport interface ICartLineInventoryValidationResult {\n /**\n * Define whether the cart lines inventory is valid across multiple cart lines.\n */\n readonly isValid: boolean;\n\n /**\n * Defines the list of product id with invalid inventory.\n */\n readonly productIdWithErrors: number[];\n}\n\n/**\n * Validates inventory across cart lines.\n * @param cartLines - The cart lines.\n * @param productAvailabilities - The product availability collection.\n * @param actionContext - The action context.\n * @param products - The products.\n * @param emailDeliveryModeCode - The emailDeliveryModeCode.\n * @returns True if all product quantity are available, false otherwise.\n */\n// eslint-disable-next-line complexity -- existing code.\nexport function validateCartLinesInventory(\n cartLines: CartLine[],\n productAvailabilities: IProductInventoryInformation[],\n actionContext: IActionContext,\n products?: SimpleProduct[],\n emailDeliveryModeCode?: string | undefined\n): ICartLineInventoryValidationResult {\n const cartLineMap = new Map();\n const defaultCartLineQuantity = 1;\n if (!actionContext.requestContext.app.config.enableStockCheck) {\n return {\n isValid: true,\n productIdWithErrors: []\n };\n }\n const productIdWithErrors = [];\n let isValid = true;\n\n if (ArrayExtensions.hasElements(cartLines) && ArrayExtensions.hasElements(productAvailabilities)) {\n // Consolidate products in different cart lines into single entry with the total cart quantity\n for (const cartLine of cartLines) {\n // Skip validation if is an invoice inline.\n if (cartLine.ProductId && !cartLine.IsInvoiceLine && !cartLine.IsGiftCardLine) {\n if (!cartLineMap.has(cartLine.ProductId)) {\n cartLineMap.set(cartLine.ProductId, cartLine.Quantity ?? defaultCartLineQuantity);\n } else {\n const cartLineTotal = cartLineMap.get(cartLine.ProductId) ?? 0;\n cartLineMap.delete(cartLine.ProductId);\n cartLineMap.set(cartLine.ProductId, cartLineTotal + (cartLine.Quantity ?? defaultCartLineQuantity));\n }\n }\n }\n\n // Hashing product availability object by product ID.\n const productAvailabilityMap = new Map();\n for (const productAvailability of productAvailabilities) {\n if (\n productAvailability.ProductAvailableQuantity.ProductId &&\n !productAvailabilityMap.has(productAvailability.ProductAvailableQuantity.ProductId)\n ) {\n productAvailabilityMap.set(productAvailability.ProductAvailableQuantity.ProductId, productAvailability);\n }\n }\n\n // Compare total quantity with the available quantity from the inventory API, also validate that the product is available.\n for (const productId of Array.from(cartLineMap.keys())) {\n const cartLineQty = cartLineMap.get(productId) ?? defaultCartLineQuantity;\n const productAvailability = productAvailabilityMap.get(productId);\n const availableQuantity = productAvailability?.ProductAvailableQuantity.AvailableQuantity ?? undefined;\n\n // If product is non-stocked or cartLine is electronic delivery, then no inventory check\n const cartLine = cartLines.find(line => line.ProductId === productId);\n const cartLineProduct = products?.find(product => product.RecordId === productId);\n let isStockedItem = true;\n if (cartLineProduct) {\n isStockedItem = !!cartLineProduct.Behavior?.IsStockedProduct;\n }\n const isEmailDelivery =\n cartLine?.DeliveryMode && cartLine.DeliveryMode !== '' ? cartLine.DeliveryMode === emailDeliveryModeCode : false;\n const shouldSkipInventoryCheck = !isStockedItem || isEmailDelivery;\n\n // If product is non-stocked or cartLine is electronic delivery, then no inventory check\n if (shouldSkipInventoryCheck) {\n continue;\n }\n if (!productAvailability?.IsProductAvailable || (availableQuantity && cartLineQty > availableQuantity)) {\n productIdWithErrors.push(productId);\n isValid = false;\n }\n }\n }\n return {\n isValid,\n productIdWithErrors\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 ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { Cart, ChannelConfiguration, LoyaltyCard, LoyaltyPointRedemptionEstimate } from '@msdyn365-commerce/retail-proxy';\nimport { getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { getOrgUnitConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\n\nimport { buildCacheKey, getLoyalty, GetLoyaltyCardInput } from '.';\n\n/**\n * Input class for the getLoyaltyCard data action.\n */\nexport class GetLoyaltyTransactionEstimationInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`GetLoyaltyCardTransactionEstimation-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetLoyaltyCardTransactionEstimation';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getLoyaltyCard method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetLoyaltyTransactionEstimationInput = (inputData: ICreateActionContext): GetLoyaltyTransactionEstimationInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n return new GetLoyaltyTransactionEstimationInput(inputData.requestContext.apiSettings);\n }\n\n return new GetLoyaltyTransactionEstimationInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the getLoyaltyCard data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getLoyaltyTransactionEstimationAction(\n input: GetLoyaltyTransactionEstimationInput,\n ctx: IActionContext\n): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n return {};\n }\n\n const promises: [Promise, Promise, Promise] = [\n _getCart(ctx),\n _getLoyalty(input, ctx),\n _getOrgUnits(ctx)\n ];\n return Promise.all(promises)\n .then(result => {\n if (result && result.length >= 2 && result[1].CardNumber) {\n return getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync(\n { callerContext: ctx },\n result[0].Id,\n result[1].CardNumber,\n result[2].Currency || ''\n )\n .then(points => {\n return points;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Error getting Loyalty Point Redemption Estimate');\n throw new Error('Error getting Loyalty Point Redemption Estimate');\n });\n }\n return {};\n })\n .catch(error => {\n return {};\n });\n}\n\nasync function _getCart(ctx: IActionContext): Promise {\n const cartState = await getCartState(ctx);\n\n return cartState.cart;\n}\n\nasync function _getLoyalty(input: GetLoyaltyTransactionEstimationInput, ctx: IActionContext): Promise {\n const loyaltyCardInput = new GetLoyaltyCardInput(input.apiSettings);\n return getLoyalty(loyaltyCardInput, ctx);\n}\n\nasync function _getOrgUnits(ctx: IActionContext): Promise {\n return getOrgUnitConfigurationAsync({ callerContext: ctx, queryResultSettings: {} });\n}\n\n/**\n * The getLoyaltyTransactionEstimation data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const getLoyaltyTransactionEstimationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-loyalty-transaction-estimation',\n action: >getLoyaltyTransactionEstimationAction,\n input: <(args: ICreateActionContext) => IActionInput>createGetLoyaltyTransactionEstimationInput\n});\n\nexport default getLoyaltyTransactionEstimationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { ProductDeliveryOptions, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for pickup delivery options for items in cart.\n */\nexport class ProductPickUpOptionsForCartLineItems implements IActionInput {\n public readonly apiSettings: ICommerceApiSettings;\n\n public constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => buildCacheKey('ActiveCartLineItemsPickUpOptions', this.apiSettings);\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'ActiveCartLineItemsPickUpOptions';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetPickUpOptionCartLineItems method.\n * @param inputData - The input data passed to the createInput method.\n * @returns - Input for data action.\n */\nconst createInput = (inputData: ICreateActionContext>) => {\n return new ProductPickUpOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the GetPickUpOptionCartLineItems data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Order Template object.\n */\nexport async function getPickUpOptionsForCartLineItems(\n input: ProductPickUpOptionsForCartLineItems,\n context: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input.apiSettings.channelId) {\n throw new Error('[getPickUpOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(context);\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), context);\n const filterOption = 4;\n const response: ProductDeliveryOptions[] = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- existing code.\n if (cart === undefined || !ArrayExtensions.hasElements(products)) {\n return Promise.resolve(response);\n }\n\n const pickupoptions = await ProductsDataActions.getDeliveryOptionsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n products.map(product => product.RecordId),\n {},\n filterOption\n );\n\n return pickupoptions;\n}\n\n/**\n * The GetPickupOptionCartLineItems Data Action\n * Returns pickup options.\n */\nexport const getPickUpOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-pickup-options-for-cartlines',\n action: getPickUpOptionsForCartLineItems as IAction,\n input: createInput\n});\n\nexport default getPickUpOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { QueryResultSettings } from '@msdyn365-commerce/retail-proxy';\n\nimport { QueryResultSettingsProxy } from './QueryResultSettingsProxy';\n\nexport interface ISearchData {\n q: string;\n skip: number;\n top: number;\n itemsPerPage: string;\n maxItems: string;\n channelId: number;\n queryResultSettings: QueryResultSettings;\n}\n\nexport const parseSearchData = (inputData: ICreateActionContext>): ISearchData => {\n // Query is of type 'IDictionary | undefined', so that q and skip are not recognized by tsc\n const {\n requestContext: {\n // @ts-expect-error:2339\n query: { q, top, skip },\n apiSettings: { channelId }\n },\n // @ts-expect-error:2339\n config: { maxItems, itemsPerPage }\n } = inputData;\n const queryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return {\n q,\n skip: (skip && Number(skip)) || 0,\n top: (top && Number(top)) || 50,\n itemsPerPage, // TODO BUGBUG 21667361\n maxItems, // TODO BUGBUG 21667361\n channelId,\n queryResultSettings\n };\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IPromiseQueue, PromiseBodyWrapper, PromiseRejectType, PromiseResolveType } from './base-promise-queue';\n\n/**\n * Represents an inner node which is stored in a promise queue.\n * Used internally in the PromiseQueue implementation.\n * @author Bohdan Yevchenko \n */\nclass PromiseQueueElement {\n /**\n * The body of a wrapper-function which contains a call to the promise which has to be executed in the queue.\n */\n public readonly body: PromiseBodyWrapper;\n\n /**\n * Method that resolves the promise after the promise from the body is resolved.\n */\n public readonly resolve: PromiseResolveType;\n\n /**\n * Method that rejects the promise after the promise from the body is rejected.\n */\n public readonly reject: PromiseRejectType;\n\n /**\n * Initializes queue element with the given data.\n * @param {PromiseBodyWrapper} body The body of a wrapper-function which contains a call to the promise which has to be executed in the queue.\n * @param {PromiseResolveType} resolve Method that resolves the promise after the promise from the body is resolved.\n * @param {PromiseRejectType} reject Method that rejects the promise after the promise from the body is rejected.\n */\n public constructor(\n body: PromiseBodyWrapper,\n resolve: PromiseResolveType,\n reject: PromiseRejectType\n ) {\n this.body = body;\n this.resolve = resolve;\n this.reject = reject;\n }\n}\n\n/**\n * Represents a FIFO basic queue over promises.\n * @author Bohdan Yevchenko \n */\nexport class PromiseQueue implements IPromiseQueue {\n /**\n * A list of promises waiting for execution.\n */\n protected readonly _queue: PromiseQueueElement[];\n\n /**\n * Defines whether the queue is processing some element.\n */\n protected _isBusy: boolean;\n\n /**\n * Defines whether the queue can start processing new element.\n */\n private get _canProcess(): boolean {\n return !this._isBusy && this._queue.length > 0;\n }\n\n /**\n * Creates a new instance of PromiseQueue.\n */\n public constructor() {\n this._queue = [];\n this._isBusy = false;\n }\n\n /**\n * Adds promise to the queue and automatically starts the queue execution.\n * @param {PromiseBodyWrapper} promiseBody\n * The body of a function which contains a call to the promise which has to be executed in the queue.\n */\n public async enqueue(promiseBody: PromiseBodyWrapper): Promise {\n return new Promise(async (resolve, reject) => {\n this._queue.push(new PromiseQueueElement(promiseBody, resolve, reject));\n await this._dequeue();\n });\n }\n\n /**\n * If the queue is free, starts processing the first element in the queue and waits until all the elements are processed.\n * Otherwise (if busy or has no elements to process), does nothing.\n */\n private async _dequeue(): Promise {\n // Skip if queue is not able to process any elements.\n if (!this._canProcess) {\n return;\n }\n\n // Lock queue to prevent parallel execution.\n this._isBusy = true;\n\n // Retrieve an element from the waiting queue and start processing.\n const element: PromiseQueueElement = this._queue.shift()!;\n await this._processElement(element);\n\n // Continue executing the subsequent queue elements.\n await this._processNext();\n }\n\n /**\n * Executes the given wrapper over the promise and calls initial resolve/reject correspondingly.\n * @param {PromiseQueueElement} element The queue element which should be processed now.\n */\n private async _processElement(element: PromiseQueueElement): Promise {\n try {\n await element\n .body()\n .then(element.resolve)\n .catch(element.reject);\n } catch (error) {\n element.reject(error);\n }\n }\n\n /**\n * Unlocks the queue and tries to process the next element in the queue.\n */\n private async _processNext(): Promise {\n this._isBusy = false;\n await this._dequeue();\n }\n}\n","'use strict';\n// eslint-disable-next-line es/no-typed-arrays -- safe\nmodule.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';\n","'use strict';\nvar toObject = require('../internals/to-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.fill` method implementation\n// https://tc39.es/ecma262/#sec-array.prototype.fill\nmodule.exports = function fill(value /* , start = 0, end = @length */) {\n var O = toObject(this);\n var length = lengthOfArrayLike(O);\n var argumentsLength = arguments.length;\n var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);\n var end = argumentsLength > 2 ? arguments[2] : undefined;\n var endPos = end === undefined ? length : toAbsoluteIndex(end, length);\n while (endPos > index) O[index++] = value;\n return O;\n};\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\n\nvar $TypeError = TypeError;\n\n// `ToBigInt` abstract operation\n// https://tc39.es/ecma262/#sec-tobigint\nmodule.exports = function (argument) {\n var prim = toPrimitive(argument, 'number');\n if (typeof prim == 'number') throw new $TypeError(\"Can't convert number to bigint\");\n // eslint-disable-next-line es/no-bigint -- safe\n return BigInt(prim);\n};\n","'use strict';\nvar toPositiveInteger = require('../internals/to-positive-integer');\n\nvar $RangeError = RangeError;\n\nmodule.exports = function (it, BYTES) {\n var offset = toPositiveInteger(it);\n if (offset % BYTES) throw new $RangeError('Wrong offset');\n return offset;\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar $RangeError = RangeError;\n\nmodule.exports = function (it) {\n var result = toIntegerOrInfinity(it);\n if (result < 0) throw new $RangeError(\"The argument can't be less than 0\");\n return result;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getAttributeDefinitionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport { AttributeDefinition, AttributeDefinitionCriteria } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get attribute definitions data action.\n */\nexport class GetAttributeDefinitionsInput implements IActionInput {\n public attributeDefinitionCriteria?: AttributeDefinitionCriteria;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, attributeDefinitionCriteria?: AttributeDefinitionCriteria) {\n this.attributeDefinitionCriteria = attributeDefinitionCriteria;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('AttributeDefinitions', this.apiSettings);\n\n public getCacheObjectType = () => 'CustomerAttribute';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): GetAttributeDefinitionsInput => {\n const { apiSettings, channel } = inputData.requestContext;\n if (!channel || !channel.CustomerAttributeGroupId) {\n throw new Error('[getAttributeDefinitions][createInput]: Customer attribute group id is not found.');\n }\n\n return new GetAttributeDefinitionsInput(apiSettings, { AttributeGroupIdentifier: channel.CustomerAttributeGroupId });\n};\n\nconst getAttributeDefinitionsAction = async (input: GetAttributeDefinitionsInput, ctx: IActionContext): Promise => {\n if (input && ctx.requestContext.channel && ctx.requestContext.channel.CustomerAttributeGroupId) {\n return getAttributeDefinitionsAsync({ callerContext: ctx }, input.attributeDefinitionCriteria || null).then(response => {\n return response;\n });\n }\n\n ctx.trace('[getAttributeDefinitions]Invalid input passed to action');\n return [];\n};\n\nexport const getAttributeDefinitionsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-custom-attributes',\n action: >getAttributeDefinitionsAction,\n input: createInput\n});\n\nexport default getAttributeDefinitionsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { CategoriesDataActions } from '@msdyn365-commerce/retail-proxy';\nimport { generateCacheKey } from './utilities';\n\n/**\n * Input for get-categories data action.\n */\nexport class CategoriesInput implements IActionInput {\n public readonly maxItems: number;\n\n public readonly channelId: number;\n\n public readonly catalogId?: number;\n\n private readonly _requestContext: IRequestContext;\n\n private readonly _mappedToHierarchy: boolean;\n\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number) {\n this._requestContext = context;\n this._mappedToHierarchy = mappedToHierarchy;\n this.maxItems = maxItems || 250;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Required.\n this.channelId = context?.apiSettings?.channelId ? Number(context.apiSettings.channelId) : 0;\n this.catalogId = getCatalogId(context);\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string =>\n generateCacheKey(\n this._requestContext.apiSettings,\n { key: 'Top', value: this.maxItems },\n { key: 'CatalogId', value: this.catalogId }\n );\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => (this._mappedToHierarchy ? 'CategoryHierarchy' : 'Category');\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData -- Input data.\n * @returns -- IActionInput.\n */\nexport const createCategoriesInput = (inputData: ICreateActionContext>): IActionInput => {\n const topItems = inputData.config?.topCategories && Number.parseInt(inputData.config.topCategories, 10);\n return new CategoriesInput(inputData.requestContext, false, topItems);\n};\n\n/**\n * Calls the Retail API and returns all the categories as a flat list.\n * @param input - Input.\n * @param ctx - Context.\n * @returns - CategoryHierarchy.\n */\nexport async function getCategoryAction(input: CategoriesInput, ctx: IActionContext): Promise {\n return ((await CategoriesDataActions.getCategoriesAsync(\n {\n callerContext: ctx\n },\n input.channelId,\n input.catalogId\n )) as unknown) as CategoryHierarchy[];\n}\n\n/**\n * The getCategory Data Action.\n */\nexport const getCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-categories',\n action: getCategoryAction as IAction,\n input: createCategoriesInput\n});\n\nexport default getCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n getCategoriesUrlSync,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { ICategoryPath, ICategoryUrl } from '@msdyn365-commerce/core-internal/dist/types/interfaces/ICategoryPathInterfaces';\nimport { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { CategoryPathLookup } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateCacheKey, getSelectedProductIdFromActionInput } from './utilities/utils';\n\n/**\n * Category path input.\n */\nexport class GetCategoryPathsInput implements IActionInput {\n public readonly ChannelId: number;\n\n public readonly CatalogId: number;\n\n public readonly categoryPathLooksups: CategoryPathLookup[];\n\n public readonly apiSettings: ICommerceApiSettings;\n\n private readonly locale: string;\n\n private _requestContext: IRequestContext;\n\n public constructor(context: IRequestContext, categoryPathLooksups: CategoryPathLookup[]) {\n this._requestContext = context;\n this.ChannelId = context.apiSettings.channelId;\n this.CatalogId = getCatalogId(context);\n this.categoryPathLooksups = categoryPathLooksups;\n this.apiSettings = context.apiSettings;\n this.locale = context.locale;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this._requestContext.apiSettings,\n { key: 'CategoryPathProductIds', value: this.categoryPathLooksups.map(categoryPath => categoryPath.ProductId) },\n { key: 'CatalogId', value: this.CatalogId },\n { key: 'locale', value: this.locale }\n );\n\n public getCacheObjectType = () => 'CategoryPath';\n\n public dataCacheType = (): CacheType => 'request';\n\n /**\n * Retrieves locale to use for the current API call.\n * @returns A string which represents locale.\n */\n public getLocale = (): string => this.locale;\n}\n\n/**\n * Creates the input required to make the getCategoryPath retail api call.\n * @param inputData\n */\nexport const createGetCategoryPathsInput = (inputData: ICreateActionContext>): IActionInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n if (productId) {\n return new GetCategoryPathsInput(inputData.requestContext, [{ ProductId: +productId }]);\n }\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Calls the Retail API and returns the category path for a product.\n * @param input\n * @param ctx\n */\nexport async function getCategoryPathsAction(input: GetCategoryPathsInput, ctx: IActionContext): Promise {\n const categoryPathResults = await getCategoryPathsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n input.ChannelId,\n input.CatalogId,\n input.categoryPathLooksups\n );\n const categoryPath = categoryPathResults[0].CategoryPath && categoryPathResults[0].CategoryPath[0];\n const categoryUrl = getCategoriesUrlSync(categoryPath, ctx);\n if (categoryUrl) {\n /* Do not return the root category of the product*/\n return categoryUrl.slice(1);\n }\n return [];\n}\n\nexport const getCategoryPathsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-category-paths',\n action: >getCategoryPathsAction,\n input: createGetCategoryPathsInput\n});\n\nexport default getCategoryPathsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { CommerceListLine } from '@msdyn365-commerce/retail-proxy';\nimport { getByCustomerAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CommerceListsDataActions.g';\n\nimport { FullProductInput, getFullProducts, getProductDetailsCriteriaFromActionInput } from '.';\n\n/**\n * Input class for getActiveWishlistItems data action.\n */\nexport class ActiveWishlistInput implements IActionInput {\n public getCacheKey = () => 'ActiveWishlistItems';\n\n public getCacheObjectType = () => 'ActiveWishlistItems';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new ActiveWishlistInput();\n};\n\n/**\n * Calls the Retail API and returns a CommerceList object based on the passed GetCartInput.\n * @param input\n * @param ctx\n */\nexport async function getActiveWishlistItems(input: ActiveWishlistInput, ctx: IActionContext): Promise {\n // If no cart ID is provided in input, we need to create a cart object\n if (!input) {\n throw new Error('[getActiveWishlistItems]No valid Input was provided, failing');\n }\n\n if (ctx.requestContext.user.isAuthenticated) {\n const wishlists = await getByCustomerAsync(\n {\n callerContext: ctx,\n queryResultSettings: {}\n },\n null\n );\n\n if (wishlists && wishlists.length > 0) {\n const productInputs: FullProductInput[] = [];\n if (wishlists[0].CommerceListLines) {\n wishlists[0].CommerceListLines.forEach((commerceListLine: CommerceListLine) => {\n if (commerceListLine.ProductId) {\n productInputs.push(\n new FullProductInput(\n commerceListLine.ProductId,\n ctx.requestContext.apiSettings,\n getProductDetailsCriteriaFromActionInput(ctx),\n ctx.requestContext\n )\n );\n }\n });\n }\n\n if (productInputs.length > 0) {\n return getFullProducts(productInputs, ctx)\n .then(products => {\n if (products) {\n return products;\n }\n return [];\n })\n .catch(error => {\n ctx.trace(error);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getActiveWishlistItems]Unable to hydrate cart with product information');\n throw new Error('[getActiveWishlistItems]Unable to hydrate cart with product information');\n });\n }\n ctx.trace('No productIds found for wishlist');\n } else {\n ctx.trace('[getActiveWishlistItems]Not able to get wishlists for the customer');\n return [];\n }\n }\n ctx.trace('[getActiveWishlistItems]User token not found for wishlists');\n return [];\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-items-in-wishlist',\n action: >getActiveWishlistItems,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync, getUsersAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for get customer data action.\n */\nexport class OrganizationUsersInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('OrganizationUsers', this.apiSettings);\n\n public getCacheObjectType = () => 'BusinessPartner';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nexport const createGetOrganizationUsersInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new OrganizationUsersInput(requestContext.apiSettings);\n};\n\nexport async function getOrganizationUsers(input: OrganizationUsersInput, ctx: IActionContext): Promise {\n return getCurrentAsync({ callerContext: ctx })\n .then(businessPartner => {\n return getUsersAsync({ callerContext: ctx }, businessPartner.BusinessPartnerId)\n .then(users => {\n return users;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.trace('[get-organization-users] Unable to load users');\n throw new Error('[get-organization-users] Unable to load users');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[get-organization-users] Unable to get BusinessPartner');\n throw new Error('[get-organization-users] Unable to get BusinessPartner');\n });\n}\nexport const getOrganizationUsersDataAction = createObservableDataAction({\n id: 'get-organization-users',\n action: >(getOrganizationUsers),\n input: createGetOrganizationUsersInput\n});\n\nexport default getOrganizationUsersDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCurrentAsync, getUsersAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\n\n/**\n * Input class for get customer data action.\n */\nexport class OrganizationUsersCountInput implements IActionInput {\n public getCacheKey = () => 'OrganizationUsersCount';\n\n public getCacheObjectType = () => 'BusinessPartner';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createGetOrganizationUsersCountInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new OrganizationUsersCountInput();\n};\n\nexport async function getOrganizationUsersCount(input: OrganizationUsersCountInput, ctx: IActionContext): Promise {\n return getCurrentAsync({ callerContext: ctx })\n .then(businessPartner => {\n if (!businessPartner) {\n return 0;\n }\n\n return getUsersAsync({ callerContext: ctx }, businessPartner.BusinessPartnerId)\n .then(users => {\n return users.length;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.trace('[get-organization-users-count] Unable to load users');\n throw new Error('[get-organization-users-count] Unable to load users');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[get-organization-users-count] Unable to get BusinessPartner');\n throw new Error('[get-organization-users-count] Unable to get BusinessPartner');\n });\n}\nexport default createObservableDataAction({\n id: 'get-organization-users-count',\n action: >(getOrganizationUsersCount),\n input: createGetOrganizationUsersCountInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { InvoiceDetailsSearchCriteria, SalesInvoice, SalesOrdersDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for get invoice details data action.\n */\nexport class GetInvoiceDetailsInput implements IActionInput {\n public invoiceId: string;\n\n constructor(invoiceId: string) {\n this.invoiceId = invoiceId;\n }\n\n public getCacheKey = () => `GetInvoiceDetails|${this.invoiceId}`;\n\n public getCacheObjectType = () => 'SalesInvoice';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nexport const CreateGetInvoiceDetailsInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get invoice details as User is not logged in.');\n }\n if (!inputData?.requestContext?.query?.invoiceId) {\n throw new Error('Unable to get invoice details as no valid invoice id found.');\n }\n\n return new GetInvoiceDetailsInput(inputData.requestContext.query.invoiceId);\n};\n\nexport async function getInvoiceDetails(input: GetInvoiceDetailsInput, context: IActionContext): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get details for the invoice. User is not authenticated.');\n }\n\n if (!input.invoiceId) {\n throw new Error('Unable to get invoice details as no valid invoice id found.');\n }\n\n const invoiceId = input.invoiceId;\n\n const searchCriteria: InvoiceDetailsSearchCriteria = {\n InvoiceId: invoiceId\n };\n\n return SalesOrdersDataActions.getInvoiceDetailsAsync({ callerContext: context }, searchCriteria);\n}\n\nexport const getInvoiceDetailsDataAction = createObservableDataAction({\n id: 'get-invoice-details',\n action: >getInvoiceDetails,\n input: CreateGetInvoiceDetailsInput\n});\n\nexport default getInvoiceDetailsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n AsyncResult,\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport {\n getOrderTemplates,\n GetOrderTemplatesInput,\n getPaginatedOrderTemplateLinesAction,\n GetPaginatedOrderTemplateLinesInput,\n QueryResultSettingsProxy\n} from '..';\nimport { IOrderTemplateLinesState, OrderTemplate } from '../utilities/order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetFullOrderTemplatesInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n public getPrice?: boolean;\n public getRating?: boolean;\n\n constructor(queryResultSettings: IQueryResultSettings, getPrices = true, getRatings = true) {\n this.queryResultSettings = queryResultSettings;\n this.getPrice = getPrices;\n this.getRating = getRatings;\n }\n\n public getCacheKey = () => 'GetFullOrderTemplates';\n\n public getCacheObjectType = () => 'GetFullOrderTemplates';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createGetFullOrderTemplatesInput = (inputData: ICreateActionContext): GetFullOrderTemplatesInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n\n return new GetFullOrderTemplatesInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetFullOrderTemplates data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getFullOrderTemplatesAction(input: GetFullOrderTemplatesInput, ctx: IActionContext): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n\n const orderTemplates: OrderTemplate[] = [];\n\n const inputParams = new GetOrderTemplatesInput();\n const productLists: ProductList[] = await getOrderTemplates(inputParams, ctx);\n\n if (!productLists || productLists.length === 0) {\n return orderTemplates;\n }\n\n const inputLinesRequests: AsyncResult[] = [];\n\n // Preparing requests for parallel queries.\n for (const list of productLists) {\n const inputLines = new GetPaginatedOrderTemplateLinesInput(\n list.Id,\n input.queryResultSettings,\n undefined,\n input.getPrice,\n input.getRating\n );\n\n inputLinesRequests.push(getPaginatedOrderTemplateLinesAction(inputLines, ctx));\n }\n\n const inputLinesResponses = await Promise.all(inputLinesRequests);\n\n for (const list of productLists) {\n const productLinesResponse = inputLinesResponses.filter(\n x => x.lines.length > 0 && x.lines[0].productListLine.ProductListId === list.Id\n );\n\n // Lines exist for this product\n if (productLinesResponse.length > 0) {\n orderTemplates.push(new OrderTemplate(list, productLinesResponse[0].lines, productLinesResponse[0].totalCount));\n } else {\n // Add empty order template\n orderTemplates.push(new OrderTemplate(list, [], 0));\n }\n }\n\n ctx.trace(orderTemplates.length.toString());\n return orderTemplates;\n}\n\n/**\n * The GetFullOrderTemplates Data Action\n * Returns order templates.\n */\nexport const getFullOrderTemplatesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-full-order-templates',\n action: >getFullOrderTemplatesAction,\n input: createGetFullOrderTemplatesInput\n});\n\nexport default getFullOrderTemplatesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext,\n IMarketSettings\n} from '@msdyn365-commerce/core';\nimport {\n OrgUnitsDataActions,\n OrgUnit,\n SearchStoreCriteria,\n IQueryResultSettings,\n ChannelDeliveryOption\n} from '@msdyn365-commerce/retail-proxy';\n\nimport { IDistributorInfo, QueryResultSettingsProxy } from './utilities';\n/**\n * Get distributor variant action input class.\n */\nexport class GetDistributorListInput implements IActionInput {\n public ChannelId?: number;\n\n public StoreNumber?: string;\n\n public InventoryLocationId?: string;\n\n public queryResultSettings: IQueryResultSettings | undefined;\n\n constructor(queryResultSettings?: IQueryResultSettings, _ChannelId?: number, _StoreNumber?: string, _InventoryLocationId?: string) {\n this.ChannelId = _ChannelId;\n this.StoreNumber = _StoreNumber;\n this.InventoryLocationId = _InventoryLocationId;\n this.queryResultSettings = queryResultSettings;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'GetDistributorListCache';\n\n /**\n * Get Cache type Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'GetDistributorListInput';\n\n /**\n * Get Cache type.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the getDistributor data action.\n * @param inputData - Action context info.\n * @returns GetDistributorInput - The action input.\n */\nexport const createGetDistributorListInput = (inputData: ICreateActionContext): GetDistributorListInput => {\n if (\n (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isSignedIn) ||\n inputData.requestContext.params.isEditor\n ) {\n const queryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return new GetDistributorListInput(queryResultSettings);\n }\n\n throw new Error('Unable to create get distributor list. User is not authenticated.');\n};\n\n/**\n * Action method for the getDistributor data action.\n * @param input - The action input class.\n * @param ctx - The action context.\n * @returns OrgUnit - The full org unit availability.\n */\nexport async function getDistributorListAction(input: GetDistributorListInput, ctx: IActionContext): Promise {\n const searchStoreCriteria: SearchStoreCriteria = {\n // Online\n ChannelTypeValue: 3,\n // B2B\n OnlineStoreCustomerTypeValue: 1,\n ChannelId: input.ChannelId,\n StoreNumber: input.StoreNumber,\n InventoryLocationId: input.InventoryLocationId\n };\n\n const marketSettings = ctx.requestContext.markets;\n\n return OrgUnitsDataActions.searchAsync(\n {\n callerContext: ctx,\n bypassCache: 'get'\n },\n searchStoreCriteria\n )\n .then(async (channels: OrgUnit[]) => {\n const filteredChannels = filterChannelsBasedUponMarketSettings(channels, marketSettings);\n const channelIdList: number[] = [];\n filteredChannels?.forEach(channel => {\n if (channel !== undefined) {\n channelIdList.push(channel.RecordId);\n }\n });\n const locationDeliveryOptions = await _getLocationPickUpDeliveryModes(channelIdList, ctx);\n\n const channelPromiseList = filteredChannels.map(async channel => {\n const channelMarketSettings = getMarketSettingsForChannel(marketSettings, channel.RecordId);\n const channelDeliveryOption = locationDeliveryOptions?.find(\n channelDeliveryOptions => channelDeliveryOptions.ChannelId === channel.RecordId\n );\n return _getDistributorInfo(channel, channelDeliveryOption, channelMarketSettings);\n });\n return Promise.all(channelPromiseList);\n })\n .catch((error: Error) => {\n ctx.trace('[GetDistributor] error getting distributors from searchAsync');\n ctx.trace(error.message);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[GetDistributor] error getting distributors from searchAsync');\n return [];\n });\n}\n\n/**\n * Action method that obtains the store information.\n * @param orgUnit The org unit location.\n * @param storeMap A map that contains store information group by the inventory location id.\n * @param channelDeliveryOptions\n * @param ctx The action context.\n */\nasync function _getDistributorInfo(\n orgUnit: OrgUnit,\n channelDeliveryOptions: ChannelDeliveryOption | undefined,\n marketSettings?: IMarketSettings\n): Promise {\n if (!orgUnit || !orgUnit.OrgUnitNumber) {\n return { OrgUnit: undefined, OrgUnitDeliveryOptions: undefined, MarketSettings: undefined };\n }\n\n return {\n OrgUnit: orgUnit,\n OrgUnitDeliveryOptions: channelDeliveryOptions,\n MarketSettings: marketSettings\n };\n}\n\nfunction filterChannelsBasedUponMarketSettings(channels: OrgUnit[], marketSettings: IMarketSettings[] | undefined) {\n const intersection = channels.filter(channel =>\n marketSettings?.some(market => market.channelItem?.retailServerChannelId === channel.RecordId)\n );\n return intersection;\n}\n\nfunction getMarketSettingsForChannel(marketSettings: IMarketSettings[] | undefined, channelId: number): IMarketSettings | undefined {\n return marketSettings?.find(market => market?.channelItem?.retailServerChannelId === channelId);\n}\n\n/**\n * Action method that obtains the store information.\n * @param channelCollection The org unit channel Id list.\n * @param ctx The action context.\n */\nasync function _getLocationPickUpDeliveryModes(\n channelCollection: (number | undefined)[],\n ctx: IActionContext\n): Promise {\n if (channelCollection?.length === 0 || channelCollection === undefined) {\n return undefined;\n }\n\n const channelIdList: number[] = [];\n channelCollection?.forEach(id => {\n if (id !== undefined) {\n channelIdList.push(id);\n }\n });\n\n // To get all channel pickup delivery mode filterOption should be 4\n return OrgUnitsDataActions.getChannelDeliveryOptionsAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n channelIdList,\n 4\n )\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\n return channelDeliveryOptions;\n }\n\n return undefined;\n })\n .catch((error: Error) => {\n ctx.trace('[getDistributorList][_getLocationPickUpDeliveryModes] error getting availability with channel delivery options');\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug(\n '[getDistributorList] [_getLocationPickUpDeliveryModes] error getting availability with channel delivery options'\n );\n return [];\n });\n}\n\n/**\n * The complete getDistributor data action.\n */\nexport const getDistributorDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-distributor',\n action: >getDistributorListAction,\n input: createGetDistributorListInput\n});\n\nexport default getDistributorDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductDimensionsWithAvailabilitiesFull } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { ProductDimensionAvailabilitySearchCriteria, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions, getSelectedProductIdFromActionInput } from './utilities';\nimport { createInventoryAvailabilitySearchCriteria } from './utilities/product-inventory-utils';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Product dimension with availability Input.\n */\nexport class ProductDimensionsWithAvailabilitiesInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId?: number;\n\n public constructor(productId: number, channelId: number, requestContext?: IRequestContext) {\n this.productId = productId;\n this.channelId = channelId;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n /**\n * Cache key.\n * @returns String.\n */\n public getCacheKey: () => string = () => 'ProductDimensionsWithAvailabilities';\n\n /**\n * Cache object type.\n * @returns String.\n */\n public getCacheObjectType: () => string = () => 'ProductDimensionsWithAvailabilities';\n\n /**\n * Cache type.\n * @returns String.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Create input method for the get-product-dimension-with-availability data action.\n * @param inputData - The input data passed to the createInput method.\n * @returns - The input for the data action.\n */\nexport const createProductDimensionsWithAvailabilitiesInput = (\n inputData: ICreateActionContext>\n): ProductDimensionsWithAvailabilitiesInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n\n if (productId) {\n return new ProductDimensionsWithAvailabilitiesInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n inputData.requestContext\n );\n }\n throw new Error('Unable to create ProductDimensionsWithAvailabilitiesInput, no productId found on module config or query');\n};\n\n/**\n * Action method for the getProductDimensionsWithAvailabilities Data Action.\n * @param input - Input for the data action.\n * @param context - Action context.\n * @returns Product dimensions with availabilities.\n */\nexport async function getProductDimensionsWithAvailabilitiesAction(\n input: ProductDimensionsWithAvailabilitiesInput,\n context: IActionContext\n): Promise {\n const activeProducts = ArrayExtensions.validValues(\n await ProductsDataActions.getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n input.channelId,\n [input.productId],\n null,\n input.catalogId ?? 0\n )\n );\n\n if (!ArrayExtensions.hasElements(activeProducts)) {\n return [];\n }\n\n const activeProduct = activeProducts[0];\n\n if (!ArrayExtensions.hasElements(activeProduct.Dimensions)) {\n return [];\n }\n\n let dimensionTypeValues: number[] = [];\n activeProduct.Dimensions.map(dimension => {\n dimensionTypeValues.push(dimension.DimensionTypeValue);\n });\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\n RequestedDimensionTypeValues: dimensionTypeValues,\n MatchingDimensionValues: [],\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\n CatalogId: input.catalogId\n };\n\n const dimensionValuesWithAvailabilitiesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n activeProduct.MasterProductId ? activeProduct.MasterProductId : activeProduct.RecordId,\n searchCriteria\n );\n\n const promises = activeProduct.Dimensions.map(productDimension => {\n return dimensionValuesWithAvailabilitiesPromise.then(dimensionValuesWithAvailabilities => {\n const dimensionValueWithAvailability = dimensionValuesWithAvailabilities.filter(\n dimension => dimension.DimensionTypeValue === productDimension.DimensionTypeValue\n );\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\n ...productDimension,\n dimensionValuesWithInventory: dimensionValueWithAvailability\n };\n return fullDimension;\n });\n });\n\n // eslint-disable-next-line no-return-await -- existing code\n return await Promise.all(promises);\n}\n\n/**\n * The GetProductDimensionsWithAvailabilitiesAction\n * Gets the available product dimensions for the product via the getDimensionValueswithEstimatedAvailibilities RetailServer API.\n */\nexport const getProductDimensionsWithAvailabilities = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-dimensions-with-availabilities',\n action: getProductDimensionsWithAvailabilitiesAction as IAction,\n input: createProductDimensionsWithAvailabilitiesInput\n});\n\nexport default getProductDimensionsWithAvailabilities;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductListLine, ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\n\n/**\n * Input class for the AddItemToProductList data action.\n */\nexport class AddItemToProductListInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n public readonly isMultipleCatalogFeatureEnabledInHq?: boolean;\n public readonly catalogId?: number | undefined;\n\n public constructor(\n productListId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number | undefined\n ) {\n this.productListId = productListId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n this.isMultipleCatalogFeatureEnabledInHq = isMultipleCatalogFeatureEnabledInHq;\n this.catalogId = catalogId;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'AddItemToProductListInput';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'AddItemToProductListInput';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddItemToProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - The id of product list to update.\n * @param productId - The id of a product to add.\n * @param quantity - How many items of this product to add.\n * @param unitOfMeasure - Product measuring unit.\n * @returns - Input data for productlist add api.\n */\nexport const addItemToProductListInput = (\n inputData: ICreateActionContext,\n productListId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number | undefined\n): AddItemToProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create product list. User is not authenticated.');\n }\n return new AddItemToProductListInput(\n productListId,\n productId,\n quantity,\n unitOfMeasure,\n isMultipleCatalogFeatureEnabledInHq || false,\n catalogId\n );\n};\n\n/**\n * The action method for the AddItemToProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList.\n */\n\n// Consider updating 'add-item-to-order-template.ts' if you update this function.\nexport async function addItemToProductListAction(input: AddItemToProductListInput, context: IActionContext): Promise {\n try {\n const catalogId = input.catalogId;\n const productListLineToAdd: ProductListLine = {\n ProductListId: input.productListId,\n ProductId: input.productId,\n Quantity: input.quantity,\n UnitOfMeasure: input.unitOfMeasure,\n ...(input.isMultipleCatalogFeatureEnabledInHq && { catalogId: catalogId })\n };\n\n const productListLine: ProductListLine[] = await ProductListsDataActions.addProductListLinesAsync(\n {\n callerContext: context\n },\n input.productListId,\n [productListLineToAdd]\n );\n\n if (ArrayExtensions.hasElements(productListLine) && productListLine[0].ProductListId) {\n return productListLine[0];\n }\n context.telemetry.error('Product list line was not returned when adding it to quick order bag');\n throw new Error('Product list line was not returned when adding it to quick order bag');\n } catch (error) {\n context.telemetry.error('Not able to add an item to quick order bag', error);\n throw error;\n }\n}\n\n/**\n * The AddItemToOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport const addItemToProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-item-to-product-list',\n action: addItemToProductListAction as IAction,\n input: addItemToProductListInput\n});\n\nexport default addItemToProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartner, BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\nimport { createBusinessPartnerUserAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for addOrganizationUser data action.\n */\nexport class AddOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'AddOrganizationUser';\n\n public getCacheObjectType = () => 'AddOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for addOrganizationUser data action.\n * @param inputData\n * @param newUser\n */\nexport const createAddOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new AddOrganizationUserInput(newUser);\n};\n\n/**\n * The addOrganizationUser data action\n * Calls getCurrent() to get a businessPartnerId from the user requesting the action.\n * It then maps the newUsers' businessPartnerId to the same as the above user.\n * Calls the createBusinessPartner to then create a new entitiy in the database with the\n * information passed into through newUser.\n * @param input\n * @param ctx\n */\nexport async function addOrganizationUser(input: AddOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n let errorMessage = '';\n\n return getCurrentAsync({ callerContext: ctx })\n .then((businessPartner: BusinessPartner) => {\n // Set the new accounts businessPartnerId from the admin account\n user.BusinessPartnerId = businessPartner.BusinessPartnerId;\n\n return createBusinessPartnerUserAsync({ callerContext: ctx }, user)\n .then(newUser => {\n return newUser;\n })\n .catch(error => {\n ctx.telemetry.debug('[add-organization-user] Unable to create BusinessPartnerUser account');\n if (error && error.name === 'Microsoft_Dynamics_Commerce_Runtime_EmailIdAlreadyRegistered') {\n errorMessage = error.message;\n }\n throw new Error('[add-organization-user] Unable to create BusinessPartnerUser account');\n });\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[add-organization-user] Unable to get BusinessPartner Admin account');\n throw errorMessage;\n });\n}\n\n/**\n * The addOrganizationUser data action\n * Calls the read RetailServer API to get the BusinessPartnerId from the admin\n * account and adds that businessPartner to the recieved input (new User)/\n * We then send this new User through the RetailServer API so that the database\n * is updated.\n */\nexport const addOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/add-organization-user',\n action: >addOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createAddOrganizationUserInput)\n});\n\nexport default addOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductList, ProductListsDataActions } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for the CreateProductList data action.\n */\nexport class CreateProductListInput implements IActionInput {\n public readonly templateName: string;\n\n public readonly templateType: number;\n\n public constructor(templateName: string, templateType: number) {\n this.templateName = templateName;\n this.templateType = templateType;\n }\n\n /**\n * GetCacheObjectType.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => 'CreateProductListInput';\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheObjectType = (): string => 'CreateProductListInput';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the CreateProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param templateName - The name of template.\n * @param templateType - The type of template.\n * @returns - The Action input.\n */\nexport const createProductListInput = (\n inputData: ICreateActionContext,\n templateName: string,\n templateType: number\n): CreateProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create product list. User is not authenticated.');\n }\n return new CreateProductListInput(templateName, templateType);\n};\n\n/**\n * The action method for the CreateProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList object.\n */\nexport async function createProductListAction(input: CreateProductListInput, context: IActionContext): Promise {\n try {\n const orderTemplate: ProductList = {\n Id: '',\n Name: input.templateName,\n ProductListTypeValue: input.templateType\n };\n const createdProductList = await ProductListsDataActions.createProductListAsync(\n {\n callerContext: context\n },\n orderTemplate\n );\n if (createdProductList.Id !== '') {\n return createdProductList;\n }\n context.telemetry.error('Created product list was null');\n throw new Error('Created product list was null');\n } catch (error) {\n context.telemetry.error('Not able to create product list', error);\n throw error;\n }\n}\n\n/**\n * The CreateProductList Data Action.\n * Returns created Product List.\n */\nexport const createProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/create-product-list',\n action: createProductListAction as IAction,\n input: createProductListInput\n});\n\nexport default createProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser, NullResult } from '@msdyn365-commerce/retail-proxy';\nimport { deleteAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for DeleteOrganizationUser data action.\n */\nexport class DeleteOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'DeleteOrganizationUser';\n\n public getCacheObjectType = () => 'DeleteOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for DeleteOrganizationUser data action.\n * @param inputData\n * @param newUser\n */\nexport const createDeleteOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new DeleteOrganizationUserInput(newUser);\n};\n\n/**\n * The DeleteOrganizationUser data action\n * Calls getCurrent() to get a businessPartnerId from the user requesting the action.\n * It then maps the newUsers' businessPartnerId to the same as the above user.\n * Calls the createBusinessPartner to then create a new entitiy in the database with the\n * information passed into through newUser.\n * @param input\n * @param ctx\n */\nexport async function deleteOrganizationUser(input: DeleteOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n\n return deleteAsync({ callerContext: ctx }, user).catch(error => {\n console.log(error);\n ctx.telemetry.debug('[Delete-organization-user] Unable to delete BusinessPartnerUser account');\n throw new Error('[Delete-organization-user] Unable to delete BusinessPartnerUser account');\n });\n}\n\n/**\n * The DeleteOrganizationUser data action\n * Calls the read RetailServer API to get the BusinessPartnerId from the admin\n * account and Deletes that businessPartner to the recieved input (new User)/\n * We then send this new User through the RetailServer API so that the database\n * is updated.\n */\nexport const deleteOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/delete-organization-user',\n action: >deleteOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createDeleteOrganizationUserInput)\n});\n\nexport default deleteOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { BusinessPartnerUser } from '@msdyn365-commerce/retail-proxy';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnerUsersDataActions.g';\n\n/**\n * Input class for edit organization user data action.\n */\nexport class EditOrganizationUserInput implements IActionInput {\n public user: BusinessPartnerUser;\n\n constructor(newUser: BusinessPartnerUser) {\n this.user = newUser;\n }\n\n public getCacheKey = () => 'EditOrganizationUser';\n\n public getCacheObjectType = () => 'EditOrganizationUser';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Input class for edit organization user data action.\n * @param inputData\n * @param newUser\n */\nexport const createEditOrganizationUserInput = (\n inputData: ICreateActionContext>,\n newUser: BusinessPartnerUser\n): IActionInput => {\n const { requestContext } = inputData;\n\n // Check if the user is authenticated.\n if (!requestContext.user.isAuthenticated) {\n throw new Error('User is not logged in.');\n }\n\n return new EditOrganizationUserInput(newUser);\n};\n\nexport async function editOrganizationUser(input: EditOrganizationUserInput, ctx: IActionContext): Promise {\n const { user } = input;\n\n return updateAsync({ callerContext: ctx }, user)\n .then(updatedUser => {\n return updatedUser;\n })\n .catch(() => {\n ctx.telemetry.debug('[Edit-organization-user] Unable to update BusinessPartnerUser account');\n throw new Error('[Edit-organization-user] Unable to update BusinessPartnerUser account');\n });\n}\n\n/**\n * The EditOrganizationUser data action\n * Takes in an instance of a BusinessPartnerUser and updates the\n * same user with the new information.\n */\nexport const editOrganizationUserDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/Edit-organization-user',\n action: >editOrganizationUser,\n input: <(args: ICreateActionContext) => IActionInput>(createEditOrganizationUserInput)\n});\n\nexport default editOrganizationUserDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, IActionContext, IActionInput } from '@msdyn365-commerce/core';\n\n/**\n * Generic input type for use with generic data actions.\n */\nexport class GenericInput implements IActionInput {\n public result: T;\n\n public cacheKey: string;\n\n public cacheObjectType: string;\n\n constructor(cacheKey: string, result: T, cacheObjectType: string) {\n this.cacheKey = cacheKey;\n this.cacheObjectType = cacheObjectType;\n this.result = result;\n }\n\n public getCacheKey = () => `Generic-${this.cacheKey}`;\n\n public getCacheObjectType = () => `${this.cacheObjectType}`;\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Generic data action that is just used for passing data around the app.\n *\n * Note that this doesn't actually expose a data action, its just a base action\n * that others can use to create a data action with their own input.\n * @param input\n * @param ctx\n */\nexport async function getGenericAction(input: GenericInput, ctx: IActionContext): Promise {\n return input.result;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { AttributeValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { getSelectedProductIdFromActionInput, SelectedVariantInput } from '.';\nimport { getSelectedVariantActionDataAction } from './get-selected-variant';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Chains getting the SelectedVariant with GetActivePrice.\n */\nexport class AttributesForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.catalogId = catalogId || 0;\n }\n\n public getCacheKey = () => 'AttributesForSelectedVariant';\n\n public getCacheObjectType = () => 'ProductAttributeValue';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createAttributesForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): AttributesForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new AttributesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined, catalogId);\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Calls the Retail API a get a list of dimension values for a given product.\n * @param input\n * @param ctx\n */\nexport async function getAttributesForSelectedVariantAction(\n input: AttributesForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n\n return getSelectedVariantActionDataAction(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return getAttributeValuesAsync(\n {\n callerContext: ctx,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\n },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n }\n\n return null;\n })\n .then((attributeValues: AttributeValue[] | null) => {\n const resultArray = attributeValues;\n if (resultArray) {\n return resultArray;\n }\n\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport const getAttributesForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-attributes-for-selected-variant',\n action: >getAttributesForSelectedVariantAction,\n input: createAttributesForSelectedVariantInput\n});\n\nexport default getAttributesForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput, ICoreContext } from '@msdyn365-commerce/core';\nimport { ProductDimensionType, ProductDimensionValueInventoryAvailability, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\n\nimport {\n getDimensionAvailabilitiesForProductsAction,\n ProductsDimensionAvailabilitiesInput\n} from './get-dimension-availabilities-for-products';\nimport {\n ArrayExtensions,\n checkIfShouldDisplayAsSwatch,\n DimensionTypes,\n DimensionSwatchDisplayTypes,\n getInventoryLevelCodeFromDimensionValue,\n IDimensionsApp,\n InventoryLevelValues\n} from './utilities';\n\n/**\n * Input class for the GetDimensionAvailabilitiesForProductSearchResult Data Action.\n */\nexport class DimensionAvailabilitiesForProductSearchResultInput implements IActionInput {\n public products: ProductSearchResult[];\n\n public dimensionContext: ICoreContext;\n\n public displayType: DimensionSwatchDisplayTypes | undefined;\n\n public constructor(\n products: ProductSearchResult[],\n dimensionContext: ICoreContext,\n displayType?: DimensionSwatchDisplayTypes\n ) {\n this.products = products;\n this.dimensionContext = dimensionContext;\n this.displayType = displayType;\n }\n\n /**\n * Get the cache key.\n * @returns The cache key.\n */\n public getCacheKey = (): string =>\n `DimensionAvailabilitiesForProductSearchResult:${this.products.map(product => product.RecordId).join('-')}`;\n\n /**\n * Get the cache object type.\n * @returns The cache object type.\n */\n public getCacheObjectType = (): string => 'ProductDimensionValueInventoryAvailability';\n\n /**\n * Define the data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetDimensionAvailabilitiesForProductSearchResultDataAction.\n * @param products -- The product search result.\n * @param dimensionContext -- The dimension app context.\n * @returns The input.\n */\nexport const createDimensionAvailabilitiesForProductSearchResultInput = (\n products: ProductSearchResult[],\n dimensionContext: ICoreContext\n): DimensionAvailabilitiesForProductSearchResultInput => {\n return new DimensionAvailabilitiesForProductSearchResultInput(products, dimensionContext);\n};\n\n/**\n * The Action Method for the GetDimensionAvailabilitiesForProductSearchResultInput Data Action\n * Gets the active price for product search result via the getDimensionAvailabilitiesForProduct API.\n * @param input -- The data input.\n * @param context -- The core context.\n * @returns The ProductsDimensionsAvailabilities.\n */\nexport async function getDimensionAvailabilitiesForProductSearchResultAction(\n input: DimensionAvailabilitiesForProductSearchResultInput,\n context: IActionContext\n): Promise {\n const products = input.products;\n const productsDimensionInputs: ProductsDimensionAvailabilitiesInput[] = [];\n const inventoryLevel = input.dimensionContext.app.config.inventoryLevel;\n const displayType = input.displayType;\n\n for (const product of products) {\n const filteredProductAttributes = product.AttributeValues?.filter(attributeValue => {\n return checkIfShouldDisplayAsSwatch(\n (attributeValue.Name?.toLocaleLowerCase() ?? '') as DimensionTypes,\n input.dimensionContext,\n displayType\n );\n });\n\n if (ArrayExtensions.hasElements(filteredProductAttributes)) {\n const productionDimensionTypes: ProductDimensionType[] = [];\n for (const attributeValue of filteredProductAttributes) {\n if (attributeValue.Name) {\n const productionDimensionType: ProductDimensionType =\n ProductDimensionType[attributeValue.Name as keyof typeof ProductDimensionType];\n productionDimensionTypes.push(productionDimensionType);\n }\n }\n if (ArrayExtensions.hasElements(productionDimensionTypes)) {\n productsDimensionInputs.push(\n new ProductsDimensionAvailabilitiesInput(\n product.MasterProductId ?? product.RecordId,\n undefined,\n context.requestContext,\n productionDimensionTypes\n )\n );\n }\n }\n }\n\n if (!ArrayExtensions.hasElements(productsDimensionInputs)) {\n return Promise.resolve([]);\n }\n\n try {\n const dimensionForProducts: ProductDimensionValueInventoryAvailability[][] = await getDimensionAvailabilitiesForProductsAction(\n productsDimensionInputs,\n context\n );\n const productsDimensionAvailabilities = productsDimensionInputs.map((dimensionInput, index) => {\n return dimensionForProducts[index].map(dimensionValuesWithInventory => {\n const inventoryLevelCode = getInventoryLevelCodeFromDimensionValue(dimensionValuesWithInventory, inventoryLevel);\n const dimensionValue = dimensionValuesWithInventory.DimensionValue!;\n return {\n value: dimensionValue.Value ?? '',\n isDisabled: inventoryLevelCode === InventoryLevelValues.outOfStock,\n masterProductId: dimensionInput.masterProductId\n };\n });\n });\n\n if (!ArrayExtensions.hasElements(productsDimensionAvailabilities)) {\n context.telemetry.warning('ProductsDimensionAvailabilities is empty');\n return Promise.resolve([]);\n }\n\n return Promise.resolve(productsDimensionAvailabilities);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error.\n context.telemetry.warning(error);\n }\n\n return Promise.resolve([]);\n}\n\n/**\n * The GetDimensionAvailabilitiesForProductSearchResult data action.\n */\nexport const getDimensionAvailabilitiesForProductSearchResultDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-dimension-availabilities-for-product-search-result',\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\n action: >getDimensionAvailabilitiesForProductSearchResultAction,\n input: createDimensionAvailabilitiesForProductSearchResultInput\n});\n\nexport default getDimensionAvailabilitiesForProductSearchResultDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ProductList } from '@msdyn365-commerce/retail-proxy';\n\nimport { QuickOrderTemplateLine } from './quick-order-template-line';\n\n/**\n * Quick Order template class.\n */\nexport class QuickOrderTemplate {\n public productList: ProductList;\n\n public quickOrderTemplateLines: QuickOrderTemplateLine[];\n\n public totalLines: number;\n\n public constructor(productList: ProductList, quickOrderTemplateLines: QuickOrderTemplateLine[], totalLines: number) {\n this.productList = productList;\n this.quickOrderTemplateLines = quickOrderTemplateLines;\n this.totalLines = totalLines;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\n\nimport getProductList, { GetProductListInput } from './get-product-list';\nimport getProductListLines, { GetProductListLinesInput } from './get-product-list-lines';\nimport { QuickOrderTemplate } from './utilities/quick-order-templates';\n\n/**\n * Input class for the GetProductList data action.\n */\nexport class GetFullProductListInput implements IActionInput {\n public productListId: string | undefined;\n\n public constructor(productListId?: string) {\n this.productListId = productListId;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'GetFullProductList';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'GetFullProductList';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - ProductListId.\n * @returns - Input for data action.\n */\nexport const createGetFullProductListInput = (inputData: ICreateActionContext, productListId?: string): GetFullProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full product list. User is not authenticated.');\n }\n\n return new GetFullProductListInput(productListId);\n};\n\n/**\n * The action method for the GetFullProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - Quick Order Template object.\n */\nexport async function getFullProductListAction(input: GetFullProductListInput, context: IActionContext): Promise {\n if (!context.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full quick order template. User is not authenticated.');\n }\n\n const inputParameters = new GetProductListInput(input.productListId);\n const quickorderTemplate = await getProductList(inputParameters, context).then(productLists => {\n const inputLines = new GetProductListLinesInput(productLists[0].Id);\n return getProductListLines(inputLines, context).then(linesState => {\n return new QuickOrderTemplate(productLists[0], linesState.lines, linesState.totalCount);\n });\n });\n return quickorderTemplate;\n}\n\n/**\n * The GetFullProductList Data Action\n * Returns order templates.\n */\nexport const getFullProductListActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-product-list',\n action: getFullProductListAction as IAction,\n input: createGetFullProductListInput\n});\n\nexport default getFullProductListActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { Image, ISubList, List } from '@msdyn365-commerce-modules/data-types';\n\nimport GetProducts, { ProductInput } from './get-simple-products';\n\n/**\n * List Input action.\n */\nexport class ListInput implements IActionInput {\n public DocumentId: string;\n\n public Title: string;\n\n public Description: string;\n\n public ShortDescription: string;\n\n public BackgroundColor: string;\n\n public ForegroundColor: string;\n\n public Images: Image[];\n\n public Items: (IProductItem[] | ISubList)[];\n\n public ProductItems: IProductItem[];\n\n public ItemsCount: number;\n\n public ItemsPerPage: number;\n\n public SkipCount: number;\n\n constructor(\n documentId: string,\n title: string,\n description: string,\n shortDescription: string,\n backgroundColor: string,\n foregroundColor: string,\n images: Image[],\n items: (IProductItem[] | ISubList)[],\n productItems: IProductItem[],\n itemsCount: number,\n itemsPerPage: number,\n skipCount: number\n ) {\n this.DocumentId = documentId;\n this.Title = title;\n this.Description = description;\n this.ShortDescription = shortDescription;\n this.BackgroundColor = backgroundColor;\n this.ForegroundColor = foregroundColor;\n this.Images = images;\n this.Items = items;\n this.ProductItems = productItems;\n this.ItemsCount = itemsCount;\n this.ItemsPerPage = itemsPerPage;\n this.SkipCount = skipCount;\n }\n\n public shouldCacheOutput = () => true;\n\n public getCacheObjectType = () => 'LIST';\n\n public getCacheKey = () => `${this.DocumentId}-${this.ItemsCount}-${this.ItemsPerPage}-${this.SkipCount}`;\n}\n\nexport interface IProductItem {\n RecordId: string;\n CatalogId: string;\n}\n\n/**\n * List item type enum.\n */\nenum ListItemType {\n list = 'list',\n product = 'product'\n}\n\n/**\n * Calls to getSimpleProducts to get product array by ID's in list.\n * @param input\n * @param ctx\n */\nexport async function getListData(input: ListInput, ctx: IActionContext): Promise {\n ctx.trace(`List Title: ${input.Title}`);\n\n const { apiSettings } = ctx.requestContext;\n\n const sublists: (SimpleProduct | ISubList)[] = [];\n const result: List = {\n Title: input.Title,\n Description: input.Description,\n ShortDescription: input.ShortDescription,\n BackgroundColor: input.BackgroundColor,\n ForegroundColor: input.ForegroundColor,\n Items: sublists,\n ItemsCount: input.ItemsCount\n };\n\n if (input && input.Items && input.Items.length > 0) {\n // Get all products\n let products: SimpleProduct[] = [];\n if (input.ProductItems && input.ProductItems.length > 0) {\n const inputArray = input.ProductItems.map(\n item => new ProductInput(+item.RecordId, apiSettings, undefined, undefined, ctx.requestContext)\n );\n products = await GetProducts(inputArray, ctx);\n }\n\n // Build map from recordId to product, which will be used later when build the output.\n const productMap: { [recordId: string]: SimpleProduct } = {};\n products.forEach(item => {\n if (item) {\n productMap[`${item.RecordId}`] = item;\n }\n });\n\n for (const listitem of input.Items) {\n if (isSublist(listitem)) {\n result.Items.push(listitem);\n } else {\n listitem.forEach(item => {\n if (productMap[item.RecordId]) {\n result.Items.push(productMap[item.RecordId]);\n }\n });\n }\n }\n }\n\n return result;\n}\n\n/**\n * Check if an item is sublist.\n * @param listItem\n */\nfunction isSublist(listItem: IProductItem[] | ISubList): listItem is ISubList {\n return (listItem).Images !== undefined;\n}\n\n/**\n * Get images.\n * @param images\n */\nfunction getImages(images: IGeneric[]): Image[] {\n const resultImageList: Image[] = [];\n\n if (!images) {\n return resultImageList;\n }\n\n images.forEach(item => {\n if (item && item.image && item.image.href) {\n // Add image item\n const imageItem: Image = {\n href: item.image.href,\n altText: item.image.altText,\n title: item.image.title,\n width: item.image.width,\n height: item.image.height\n };\n\n resultImageList.push(imageItem);\n }\n });\n\n return resultImageList;\n}\n\n/**\n * Get the url of sub list.\n * @param listName\n * @param sitePath\n */\nfunction getSubListUrl(listName: string, sitePath: string): string {\n if (!listName) {\n return '';\n }\n\n if (!sitePath) {\n return `/${listName}.l`;\n }\n\n // SitePath has a leading '/'\n return `${sitePath}/${listName}.l`;\n}\n\n/**\n * Get input list data.\n * @param inputData\n */\nfunction getInutListData(inputData: ICreateActionContext, IGeneric>): IGeneric {\n let listData =\n !inputData || !inputData.requestContext || !inputData.requestContext.pageData ? null : inputData.requestContext.pageData.list;\n if (\n !inputData ||\n !inputData.requestContext ||\n !inputData.requestContext.pageData ||\n !inputData.requestContext.pageData.list ||\n !inputData.requestContext.pageData.list.content ||\n !inputData.requestContext.pageData.list.content.items ||\n !inputData.requestContext.pageData.list.content.title ||\n !inputData.requestContext.pageData.list._id\n ) {\n if (\n !inputData ||\n !inputData.data ||\n !inputData.data.list ||\n !inputData.data.list.content ||\n !inputData.data.list.content.items ||\n !inputData.data.list.content.title ||\n !inputData.data.list._id\n ) {\n console.error('data is not well defined for list action input');\n throw new Error('data is not well defined for list action input');\n }\n\n listData = inputData.data.list;\n }\n return listData;\n}\n\n/**\n * Get sub list item.\n * @param item\n * @param sitePathOfRequest\n */\nfunction getSubListItem(item: IGeneric, sitePathOfRequest: string): ISubList {\n const imageList: Image[] = getImages(item.fields.content.images);\n\n const sublistHref = getSubListUrl(item.fields._name, sitePathOfRequest);\n return {\n Title: item.fields.content.title,\n Description: item.fields.content.description,\n ShortDescription: item.fields.content.shortDescription,\n BackgroundColor: item.fields.content.backgroundColor,\n ForegroundColor: item.fields.content.foregroundColor,\n Href: sublistHref,\n Images: imageList\n };\n}\n\n/**\n * Get site path.\n * @param inputData\n */\nfunction getSitePath(inputData: ICreateActionContext, IGeneric>): string {\n return inputData && inputData.requestContext && inputData.requestContext.sitePath ? inputData.requestContext.sitePath : '';\n}\n\n/**\n * Get items per page.\n * @param inputData\n */\nfunction getItemsPerPage(inputData: ICreateActionContext, IGeneric>): number {\n if (!inputData || !inputData.config || !inputData.config.itemsPerPage) {\n return 50;\n }\n\n const result = Number(inputData.config.itemsPerPage);\n if (isNaN(result)) {\n return 50;\n }\n\n return result;\n}\n\n/**\n * Get skip count.\n * @param inputData\n */\nfunction getSkipCount(inputData: ICreateActionContext, IGeneric>): number {\n return inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.skipCount\n ? Number(inputData.requestContext.query.skipCount)\n : 0;\n}\n\n/**\n * Creates the input required to make the list call to get products.\n * @param inputData\n */\nconst createListInput = (inputData: ICreateActionContext, IGeneric>): IActionInput => {\n const listData: IGeneric = getInutListData(inputData);\n const listItems: (IProductItem[] | ISubList)[] = [];\n let productList: IProductItem[] = [];\n\n const parentImageList: Image[] = getImages(listData.content.images);\n\n const itemsPerPage = getItemsPerPage(inputData);\n const skipCount = getSkipCount(inputData);\n\n // This is the list contains all product and will be used to call getSimpleProducts data action.\n const productItems: IProductItem[] = [];\n const sum = skipCount + itemsPerPage;\n for (let index = skipCount; index < listData.content.items.length && index < sum; index++) {\n const item = listData.content.items[index];\n if (item.type === ListItemType.list) {\n if (!item.fields || !item.fields.content || !item.fields.content.title) {\n console.error(`sublist item fields, content or title missing in list ${listData._id}`);\n continue;\n }\n\n // If any elements in product list, then copy it and add to list items\n if (productList.length > 0) {\n const clonedList = [...productList];\n listItems.push(clonedList);\n productList = [];\n }\n\n // Build and add sublist item\n listItems.push(getSubListItem(item, getSitePath(inputData)));\n }\n\n if (item.type === ListItemType.product) {\n if (!item.fields || !item.fields.recordId) {\n console.error(`product item missing recordId in list ${listData._id}`);\n continue;\n }\n\n // Add product item\n const productItem: IProductItem = {\n RecordId: item.fields.recordId,\n CatalogId: item.fields.catalogId || '0'\n };\n\n productList.push(productItem);\n productItems.push(productItem);\n }\n }\n\n // Save the last portion of product items.\n if (productList.length > 0) {\n listItems.push(productList);\n }\n\n return new ListInput(\n listData._id,\n listData.content.title,\n listData.content.description,\n listData.content.shortDescription,\n listData.content.backgroundColor,\n listData.content.foregroundColor,\n parentImageList,\n listItems,\n productItems,\n listData.content.items.length,\n itemsPerPage,\n skipCount\n );\n};\n\nexport const getListDataDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-list',\n action: >getListData,\n input: createListInput\n});\n\nexport default getListDataDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { convertToString, IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { getCurrentAsync, getOrderHistoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\nimport { OrderShipments } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetOrganizationWideOrderHistory data action.\n */\nexport class GetOrganizationWideOrderHistoryInput implements IActionInput {\n public queryResultSettings: IQueryResultSettings;\n\n constructor(queryResultSettings: IQueryResultSettings) {\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => `GetOrganizationWideOrderHistoryInput|${convertToString(this.queryResultSettings)}`;\n\n public getCacheObjectType = () => 'GetOrganizationWideOrderHistoryInput';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the GetOrganizationWideOrderHistory method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n */\nexport const getOrganizationWideOrderHistoryInput = (inputData: ICreateActionContext): GetOrganizationWideOrderHistoryInput => {\n if (!inputData?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get order history. User is not authenticated.');\n }\n\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n return new GetOrganizationWideOrderHistoryInput(queryResultSettings);\n};\n\n/**\n * The action method for the GetOrganizationWideOrderHistory data action.\n * @param {GetOrganizationWideOrderHistory} input The action input.\n * @param {IActionContext} ctx The action context.\n * @param context\n */\nexport async function getOrganizationWideOrderHistory(\n input: GetOrganizationWideOrderHistoryInput,\n context: IActionContext\n): Promise {\n if (!context?.requestContext?.user?.isAuthenticated) {\n throw new Error('Unable to get order history. User is not authenticated.');\n }\n\n const businessPartner = await getCurrentAsync({ callerContext: context });\n if (!businessPartner) {\n throw new Error('Unable to get order history. Failed to retrieve business partner id.');\n }\n\n return getOrderHistoryAsync(\n { callerContext: context, queryResultSettings: input.queryResultSettings },\n businessPartner.BusinessPartnerId\n );\n}\n\nexport const getOrganizationWideOrderHistoryDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-organization-wide-order-history',\n action: >getOrganizationWideOrderHistory,\n input: getOrganizationWideOrderHistoryInput\n});\n\nexport default getOrganizationWideOrderHistoryDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, createObservableDataAction, getCatalogId, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { ProductPrice, ProductsDataActions, ProductSearchResult, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetPriceForProductSearchResult Data Action.\n */\nexport class PriceForProductSearchResultInput implements IActionInput {\n public products: ProductSearchResult[];\n\n public constructor(products: ProductSearchResult[]) {\n this.products = products;\n }\n\n /**\n * Get the cache key.\n * @returns The cache key.\n */\n public getCacheKey = (): string => `PriceForProductSearchResult-${JSON.stringify(this.products)}`;\n\n /**\n * Get the cache object type.\n * @returns The cache object type.\n */\n public getCacheObjectType = (): string => 'ProductSearchResult';\n\n /**\n * Define the data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetPriceForProductSearchResultDataAction.\n * @param products -- The product search result.\n * @returns The input.\n */\nexport const createActivePriceForProductSearchResultInput = (products: ProductSearchResult[]): PriceForProductSearchResultInput => {\n return new PriceForProductSearchResultInput(products);\n};\n\n/**\n * The Action Method for the GetPriceForProductSearchResult Data Action\n * Gets the active price for product search result via the getActivePrice RetailServer API.\n * @param input -- The data input.\n * @param context -- The action context.\n * @returns The product search result updated with price.\n */\nexport async function getPriceForProductSearchResultAction(\n input: PriceForProductSearchResultInput,\n context: IActionContext\n): Promise {\n let productRecIds: number[];\n if (ArrayExtensions.hasElements(input.products)) {\n productRecIds = input.products.map(product => product.RecordId);\n } else {\n return Promise.resolve([]);\n }\n\n const catalogId = getCatalogId(context.requestContext);\n\n const projectDomain: ProjectionDomain = { ChannelId: +context.requestContext.apiSettings.channelId, CatalogId: catalogId };\n const priceZero = 0;\n\n try {\n const productPrices: ProductPrice[] = await ProductsDataActions.getActivePricesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n projectDomain,\n productRecIds,\n new Date(),\n null,\n undefined,\n true\n );\n\n const productResults: ProductSearchResult[] = input.products.map(product => {\n const activePrice = productPrices.find(price => price.ProductId === product.RecordId);\n if (activePrice) {\n product.Price = activePrice.CustomerContextualPrice ?? product.Price;\n product.BasePrice = Math.max(\n activePrice.BasePrice ?? priceZero,\n activePrice.TradeAgreementPrice ?? priceZero,\n activePrice.AdjustedPrice ?? priceZero\n );\n }\n return product;\n });\n\n return Promise.resolve(productResults);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error type.\n context.telemetry.exception(error);\n context.telemetry.debug('[getPriceForProductSearchResultAction]Error executing action');\n throw new Error('[getPriceForProductSearchResultAction]Error executing action');\n }\n}\n\n/**\n * The getPriceForProductSearchResult data action.\n */\nexport const getPriceForProductSearchResultDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-price-for-product-search-result',\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\n action: >getPriceForProductSearchResultAction,\n input: createActivePriceForProductSearchResultInput\n});\n\nexport default getPriceForProductSearchResultDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, createObservableDataAction, getCatalogId, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { ProductPrice, ProductsDataActions, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\n\nimport { ArrayExtensions } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Input class for the GetPriceForProductSearchResult Data Action.\n */\nexport class ProductPriceForSelectedProductsInput implements IActionInput {\n public productIds: number[];\n\n public constructor(products: number[]) {\n this.productIds = products;\n }\n\n /**\n * Get the cache key.\n * @returns The cache key.\n */\n public getCacheKey = (): string => `ProductPriceForSelectedProducts-${JSON.stringify(this.productIds)}`;\n\n /**\n * Get the cache object type.\n * @returns The cache object type.\n */\n public getCacheObjectType = (): string => 'ProductPrices';\n\n /**\n * Define the data cache type.\n * @returns The cache type.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the GetPriceForProductSearchResultDataAction.\n * @param products -- The product search result.\n * @returns The input.\n */\nexport const createProductPriceForSelectedProductsInput = (productIds: number[]): ProductPriceForSelectedProductsInput => {\n return new ProductPriceForSelectedProductsInput(productIds);\n};\n\n/**\n * The Action Method for the getProductPriceForSelectedProducts Data Action\n * Gets the active price for selected products via the getActivePrice RetailServer API.\n * @param input -- The data input.\n * @param context -- The action context.\n * @returns The Product Prices.\n */\nexport async function getProductPriceForSelectedProductsAction(\n input: ProductPriceForSelectedProductsInput,\n context: IActionContext\n): Promise {\n let productRecIds: number[];\n if (ArrayExtensions.hasElements(input.productIds)) {\n productRecIds = input.productIds;\n } else {\n return Promise.resolve([]);\n }\n\n const catalogId = getCatalogId(context.requestContext);\n\n const projectDomain: ProjectionDomain = { ChannelId: +context.requestContext.apiSettings.channelId, CatalogId: catalogId };\n\n try {\n const productPrices: ProductPrice[] = await ProductsDataActions.getActivePricesAsync(\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\n projectDomain,\n productRecIds,\n new Date(),\n null,\n undefined,\n true\n );\n\n return Promise.resolve(productPrices);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error type.\n context.telemetry.exception(error);\n context.telemetry.debug('[getProductPriceForSelectedProductsAction]Error executing action');\n throw new Error('[getProductPriceForSelectedProductsAction]Error executing action');\n }\n}\n\n/**\n * The getProductPriceForSelectedProducts data action.\n */\nexport const getProductPriceForSelectedProductsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-prices-for-selected-products',\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\n action: >getProductPriceForSelectedProductsAction,\n input: createProductPriceForSelectedProductsInput\n});\n\nexport default getProductPriceForSelectedProductsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartPromotionLine } from '@msdyn365-commerce/retail-proxy';\nimport { getAvailablePromotionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\n\nimport { ActiveCartProductsInput, buildCacheKey, getActiveCartProductsAction } from '.';\n\n/**\n * Input class for promotion options for items in cart.\n */\nexport class PromotionOptionsForCartLineItems implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCartLineItemsPromotionOptions', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCartLineItemsPromotionOptions';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext>) => {\n return new PromotionOptionsForCartLineItems(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API to get the promotion options for items in the cart.\n * @param input\n * @param ctx\n */\nexport async function getPromotionOptionsForCartLineItems(\n input: PromotionOptionsForCartLineItems,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getPromotionOptionsForCartLineItems]No valid Input was provided, failing');\n }\n const cartState = await getCartState(ctx);\n if (cartState.hasInvoiceLine) {\n ctx.trace('[getPromotionOptionsForCartLineItems] cart has invoice line');\n return [];\n }\n const cart = cartState.cart;\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\n\n if (!cart || !cart.CartLines || !products || products.length === 0) {\n ctx.trace('[getPromotionOptionsForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\n return [];\n }\n\n const cartLineIds = cart.CartLines.map(c => c.LineId || '');\n\n return getAvailablePromotionsAsync({ callerContext: ctx, queryResultSettings: {}, bypassCache: 'get' }, cart.Id, cartLineIds || null)\n .then(result => {\n return result;\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getPromotionOptionsForCartLineItems]Error executing action');\n throw new Error('[getPromotionOptionsForCartLineItems]Error executing action');\n });\n}\n\nexport const getPromotionOptionsForCartLineItemsDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-promotion-options-for-cartlines',\n action: >getPromotionOptionsForCartLineItems,\n input: createInput\n});\n\nexport default getPromotionOptionsForCartLineItemsDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { readAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ScanResultsDataActions.g';\nimport { ProductDimension } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { getDimensionsForSelectedVariant, GetDimensionsForSelectedVariantInput } from '.';\nimport { IScanResultWithProduct } from './utilities/scan-result-with-product';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class to get product from sku number.\n */\nexport class GetScanResultInput implements IActionInput {\n public skuNumber: string;\n\n public channelId: number;\n\n public matchingDimensionValues: ProductDimension[];\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, sku: string, channelId: number, matchingDimensionValues?: ProductDimension[]) {\n this.skuNumber = sku;\n this.channelId = channelId;\n this.matchingDimensionValues = matchingDimensionValues || [];\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`Product-${this.skuNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'ProductSKU';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the getSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n * @param skuuNumber SkuNumber to send ScanResult API.\n * @param skuNumber\n * @param channelId ChannelId required to get dimension for given product.\n * @param matchingDimensionValues\n */\nconst createInput = (\n inputData: ICreateActionContext,\n skuNumber: string,\n channelId: number,\n matchingDimensionValues?: ProductDimension[]\n) => {\n return new GetScanResultInput(inputData.requestContext.apiSettings, skuNumber, channelId, matchingDimensionValues);\n};\n\n/**\n * Action method for the product and dimension from scan result and dimension api.\n * @param input The action input class.\n * @param ctx The action context.\n */\nexport async function getScanResult(input: GetScanResultInput, ctx: IActionContext): Promise {\n return readAsync({ callerContext: ctx }, input.skuNumber)\n .then(scanResults => {\n if (scanResults && scanResults.Product) {\n return getDimensionsForSelectedVariant(\n new GetDimensionsForSelectedVariantInput(\n scanResults.Product.MasterProductId ? scanResults.Product.MasterProductId : scanResults.Product.RecordId,\n input.channelId,\n input.matchingDimensionValues,\n ctx.requestContext\n ),\n ctx\n )\n .then(response => {\n if (response && response.length > 0) {\n return { ScanResult: scanResults, Product: scanResults.Product, ProductDimensionFull: response };\n }\n return { ScanResult: scanResults, Product: scanResults.Product };\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getScanResult, getDimensionsForSelectedVariant]Error executing action');\n throw new Error('[getScanResult, getDimensionsForSelectedVariant]Error executing action');\n });\n }\n\n throw new Error('Unable to get result from scan result data action.');\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getScanResult]Error executing action');\n throw new Error('[getScanResult]Error executing action');\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-scan-results',\n action: >getScanResult,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { DeliveryOption } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * DeliveryOptionsCartLineAddress Class.\n */\nexport class DeliveryOptionsCartLineAddress {\n public cartLineIds?: string[];\n public deliveryOptions: DeliveryOption[];\n public hasError: boolean;\n public error?: string;\n\n public constructor(deliveryOptions: DeliveryOption[], hasError: boolean, error?: string, cartLineIds?: string[]) {\n this.cartLineIds = cartLineIds;\n this.deliveryOptions = deliveryOptions;\n this.hasError = hasError;\n this.error = error;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCheckoutState } from '@msdyn365-commerce/global-state';\nimport { CartLine, Address, FilterDeliveryModeOption } from '@msdyn365-commerce/retail-proxy';\n\nimport groupBy from 'lodash/groupBy';\nimport { getDeliveryOptionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { DeliveryOptionsCartLineAddress } from './utilities/delivery-options-cartLine-address';\n\n/**\n * Input class for delivery options for items in cart.\n */\nexport class GetDeliveryOptionsForCartLineAddressInput implements IActionInput {\n public deliveryModeOption: FilterDeliveryModeOption;\n public cartLines: CartLine[];\n\n public constructor(deliveryModeOption: FilterDeliveryModeOption, cartLines: CartLine[]) {\n this.deliveryModeOption = deliveryModeOption;\n this.cartLines = cartLines;\n }\n\n /**\n * GetCacheObjectType.\n * @returns - Returns string.\n */\n public getCacheKey = (): string => 'DeliveryOptionsForCartLineAddress';\n\n /**\n * GetCacheKey.\n * @returns - Returns string.\n */\n public getCacheObjectType = (): string => 'DeliveryOptionsForCartLineAddress';\n\n /**\n * DataCacheType.\n * @returns - CacheType string.\n */\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the CreateProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param cartLines - The list of cart line.\n * @returns - The Action input.\n */\nexport const createDeliveryOptionsForCartLineAddressInput = (\n inputData: ICreateActionContext,\n deliveryModeOption: FilterDeliveryModeOption,\n cartLines: CartLine[]\n): GetDeliveryOptionsForCartLineAddressInput => {\n console.log('CreateDeliveryOptionsForCartLineAddressInput', deliveryModeOption, cartLines, inputData);\n return new GetDeliveryOptionsForCartLineAddressInput(deliveryModeOption, cartLines);\n};\n\n/**\n * Calls the Retail API to get the delivery options for items in the cart.\n * @param input\n * @param ctx\n */\nexport async function getDeliveryOptionsForCartLineAddress(\n input: GetDeliveryOptionsForCartLineAddressInput,\n ctx: IActionContext\n): Promise {\n // If no input is provided fail out\n if (!input) {\n throw new Error('[getDeliveryOptionsForCartLineAddress]No valid Input was provided, failing');\n }\n\n const checkoutState = await getCheckoutState(ctx);\n const cart = checkoutState.checkoutCart.cart;\n\n if (cart && cart.CartLines && cart.CartLines.length === 0) {\n ctx.trace('[getDeliveryOptionsForCartLineItems] Not able to get cart');\n console.log('[getDeliveryOptionsForCartLineItems] Not able to get cart or cartlines are empty');\n return {};\n }\n const cartLinesForShipping = input.cartLines;\n if (cartLinesForShipping.length > 0) {\n const getGroupByDelivery = (items: CartLine[]) => groupBy(items, item => item.ShippingAddress?.RecordId);\n const groupDelivery = getGroupByDelivery(cartLinesForShipping);\n // const deliveryOptions: DeliveryOptionsCartLineAddress[] = [];\n console.log('Group Delivery', groupDelivery);\n const deliveryOptionsPromiseList = Object.keys(groupDelivery).map(async key => {\n // eslint-disable-next-line security/detect-object-injection\n const cartLines = groupDelivery[key];\n const cartLineIds = cartLines.map(cartLine => (cartLine.LineId !== undefined ? cartLine.LineId : ''));\n console.log('Cart Line IDs', cartLineIds);\n if (cartLines[0].ShippingAddress === undefined && cart.ShippingAddress === undefined) {\n return _getDeliveryOption(cart.Id, input.deliveryModeOption, false, ctx, checkoutState.shippingAddress, cartLineIds);\n } else if (cart.ShippingAddress !== undefined) {\n return _getDeliveryOption(cart.Id, input.deliveryModeOption, false, ctx, cart.ShippingAddress, cartLineIds);\n } else {\n return _getDeliveryOption(cart.Id, input.deliveryModeOption, false, ctx, cartLines[0].ShippingAddress, cartLineIds);\n }\n });\n console.log('Delivery Options Promise List', deliveryOptionsPromiseList);\n return Promise.all(deliveryOptionsPromiseList);\n }\n return {};\n}\n\n/**\n * Calls the Retail API to get the delivery options for items in the cart.\n * @param shippingAddress\n * @param cartLinesId\n * @param deliveryOptionFilter\n * @param ignoreLinesWithNoDeliveryOptions\n * @param ctx\n */\nasync function _getDeliveryOption(\n cartId: string,\n deliveryOptionFilter: number,\n ignoreLinesWithNoDeliveryOptions: boolean,\n ctx: IActionContext,\n shippingAddress?: Address,\n cartLinesId?: string[]\n): Promise {\n if (!shippingAddress || shippingAddress === undefined) {\n ctx.trace('[_getDeliveryOption] Not able to get delivery options for cart line');\n console.log('[_getDeliveryOption] Not able to get address for cart line');\n return {};\n }\n return getDeliveryOptionsAsync(\n { callerContext: ctx },\n cartId,\n shippingAddress,\n cartLinesId,\n deliveryOptionFilter,\n ignoreLinesWithNoDeliveryOptions\n )\n .then(result => {\n if (result && result.length > 0) {\n const deliveryOptions = new DeliveryOptionsCartLineAddress(result, false, undefined, cartLinesId);\n return deliveryOptions;\n } else {\n const deliveryOptions = new DeliveryOptionsCartLineAddress([], true, 'No delivery options available', cartLinesId);\n console.log('[_getDeliveryOption] No delivery options available');\n return deliveryOptions;\n }\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getDeliveryOptionsForCartLineItems]Error executing action');\n const deliveryOptions = new DeliveryOptionsCartLineAddress([], true, error.message, cartLinesId);\n console.log('[getDeliveryOptionsForCartLineItems]Error executing action');\n return deliveryOptions;\n });\n}\n\nexport const getDeliveryOptionsForCartLineAddressDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-delivery-options-for-cart-line-address',\n action: getDeliveryOptionsForCartLineAddress as IAction,\n input: createDeliveryOptionsForCartLineAddressInput\n});\n\nexport default getDeliveryOptionsForCartLineAddressDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState, ICartState } from '@msdyn365-commerce/global-state';\nimport { LoyaltyCard } from '@msdyn365-commerce/retail-proxy';\nimport { issueLoyaltyCardAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { getLoyaltyAction, GetLoyaltyCardInput } from './get-loyalty-card';\n\n/**\n * Input class for the issueLoyalty data action.\n */\nexport class IssueLoyaltyInput implements IActionInput {\n public userAccountNumber?: string;\n\n public apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey(`IssueLoyalty-${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'GetIssueLoyalty';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the issueLoyalty method.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createIssueLoyaltyInput = (inputData: ICreateActionContext): IActionInput => {\n const { requestContext } = inputData;\n\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create issue loyalty input. User is not authenticated.');\n }\n\n return new IssueLoyaltyInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * The action method for the issueLoyalty data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function issueLoyaltyAction(input: IssueLoyaltyInput, ctx: IActionContext): Promise {\n const promises: [Promise, Promise] = [getCartState(ctx), _getLoyalty(input, ctx)];\n return Promise.all(promises)\n .then(result => {\n const cartState = result[0];\n const card = result[1];\n if (card && card.CardNumber) {\n updateCart(cartState, card);\n return card;\n }\n\n // @ts-expect-error\n // TO-DO: Remove after SDK bug fix https://msdyneng.visualstudio.com/FinOps/_workitems/edit/473891\n return issueLoyaltyCardAsync({ callerContext: ctx }, { CustomerAccount: input.userAccountNumber || null })\n .then((issuedCard: LoyaltyCard) => {\n updateCart(cartState, issuedCard);\n return issuedCard;\n })\n .catch(error => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Issuing loyalty card failed');\n throw new Error('Issuing loyalty card failed');\n });\n })\n .catch((error: Error) => {\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('Unable to issue loyalty card');\n throw new Error('Unable to issue loyalty card');\n });\n}\n\nasync function _getLoyalty(input: IssueLoyaltyInput, ctx: IActionContext): Promise {\n const loyaltyCardInput = new GetLoyaltyCardInput(input.apiSettings);\n return getLoyaltyAction(loyaltyCardInput, ctx);\n}\n\nfunction updateCart(cartState: ICartState, card: LoyaltyCard): void {\n cartState.updateLoyaltyCardId({ loyaltyCardNumber: card.CardNumber });\n}\n\n/**\n * The getLoyaltyCard data action\n * Returns the loyalty card belonging to the customer.\n */\nexport const issueLoyaltyActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/issue-loyalty',\n action: >issueLoyaltyAction,\n input: <(args: ICreateActionContext) => IActionInput>createIssueLoyaltyInput\n});\n\nexport default issueLoyaltyActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { addProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { validateCatalogId } from '../utilities';\n\n/**\n * Input class for the AddItemToOrderTemplate data action.\n */\nexport class AddItemToOrderTemplateInput implements IActionInput {\n public readonly orderTemplateId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n public readonly isMultipleCatalogFeatureEnabledInHq?: boolean;\n public readonly catalogId?: number | undefined;\n\n constructor(\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number\n ) {\n this.orderTemplateId = orderTemplateId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n this.isMultipleCatalogFeatureEnabledInHq = isMultipleCatalogFeatureEnabledInHq;\n this.catalogId = catalogId;\n }\n\n public getCacheKey = () => 'AddItemToOrderTemplateInput';\n\n public getCacheObjectType = () => 'AddItemToOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddItemToOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of order template to update.\n * @param {number} productId The id of a product to add.\n * @param {number} quantity How many items of this product to add.\n * @param unitOfMeasure\n */\n\n// consider updating 'add-item-to-product-list.ts' if you update this function.\nexport const addItemToOrderTemplateInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number | undefined\n): AddItemToOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new AddItemToOrderTemplateInput(\n orderTemplateId,\n productId,\n quantity,\n unitOfMeasure,\n isMultipleCatalogFeatureEnabledInHq || false,\n catalogId\n );\n};\n\n/**\n * The action method for the AddItemToOrderTemplate data action.\n * @param {AddItemToOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function addItemToOrderTemplateAction(input: AddItemToOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n // Adding catalog from context if not passed from component\n const catalogId = input.catalogId ?? getCatalogId(ctx.requestContext);\n validateCatalogId(catalogId);\n const productListLineToAdd: ProductListLine = {\n ProductListId: input.orderTemplateId,\n ProductId: input.productId,\n Quantity: input.quantity,\n UnitOfMeasure: input.unitOfMeasure,\n ...(input.isMultipleCatalogFeatureEnabledInHq && { catalogId: catalogId })\n };\n\n const productListLine: ProductListLine[] = await addProductListLinesAsync(\n {\n callerContext: ctx\n },\n input.orderTemplateId,\n [productListLineToAdd]\n );\n\n if (productListLine && productListLine.length === 1 && productListLine[0] && productListLine[0].ProductListId) {\n return productListLine[0];\n }\n ctx.telemetry.error('Product list line was not returned when adding it to order template');\n throw new Error('Product list line was not returned when adding it to order template');\n } catch (error) {\n ctx.telemetry.error('Not able to add an item to order template', error);\n throw error;\n }\n}\n\n/**\n * The AddItemToOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport const addItemToOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/add-item-to-order-template',\n action: >addItemToOrderTemplateAction,\n input: addItemToOrderTemplateInput\n});\n\nexport default addItemToOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { CartLine, QueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { addCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\n\nimport { getPaginatedOrderTemplateLinesAction, GetPaginatedOrderTemplateLinesInput } from './get-paginated-order-template-lines';\n\n/**\n * Input class for the AddOrderTemplateToCart data action.\n */\nexport class AddOrderTemplateToCartInput implements IActionInput {\n public readonly orderTemplateId: string;\n public readonly isMultipleCatalogFeatureEnabledInHq?: boolean;\n constructor(orderTemplateId: string, isMultipleCatalogFeatureEnabledInHq?: boolean) {\n this.orderTemplateId = orderTemplateId;\n this.isMultipleCatalogFeatureEnabledInHq = isMultipleCatalogFeatureEnabledInHq;\n }\n\n public getCacheKey = () => 'AddOrderTemplateToCartInput';\n\n public getCacheObjectType = () => 'AddOrderTemplateToCartInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the AddOrderTemplateToCart method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of template.\n */\nexport const addOrderTemplateToCartInput = (inputData: ICreateActionContext, orderTemplateId: string): AddOrderTemplateToCartInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new AddOrderTemplateToCartInput(orderTemplateId);\n};\n\n/**\n * The action method for the AddOrderTemplateToCart data action.\n * @param {AddOrderTemplateToCartInput} input The action input.\n * @param {IActionContext} ctx The action context.\n * @param context\n */\nexport async function addOrderTemplateToCartAction(input: AddOrderTemplateToCartInput, context: IActionContext): Promise {\n const cartState = await getCartState(context);\n const chunkCount = 1000;\n const queryResultSettings: QueryResultSettings = {\n Paging: {\n Top: chunkCount,\n Skip: 0\n }\n };\n const getPaginatedOrderTemplateLinesInput = new GetPaginatedOrderTemplateLinesInput(input.orderTemplateId, queryResultSettings);\n let orderTemplateLines = await getPaginatedOrderTemplateLinesAction(getPaginatedOrderTemplateLinesInput, context);\n let addedCartLines: CartLine[] = [];\n for (let skip = chunkCount; orderTemplateLines.lines.length > 0; skip += chunkCount) {\n const cartLines: CartLine[] = orderTemplateLines.lines.map(productLine => {\n const cartLine: CartLine = {\n ItemId: productLine.fullProduct?.ProductDetails.ItemId,\n ProductId: productLine.productListLine.ProductId,\n Quantity: productLine.productListLine.Quantity,\n TrackingId: '',\n UnitOfMeasureSymbol: productLine.productListLine.UnitOfMeasure,\n ...(input.isMultipleCatalogFeatureEnabledInHq && { catalogId: productLine.productListLine.CatalogId })\n };\n return cartLine;\n });\n await addCartLinesAsync({ callerContext: context }, cartState.cart.Id, cartLines, cartState.cart.Version).catch(error => {\n context.telemetry.trace(error.data?.ValidationResults);\n context.telemetry.trace('Unable to add order template to cart.');\n throw error.data?.ValidationResults;\n });\n addedCartLines = addedCartLines.concat(cartLines);\n getPaginatedOrderTemplateLinesInput.queryResultSettings.Paging!.Skip = skip;\n orderTemplateLines = await getPaginatedOrderTemplateLinesAction(getPaginatedOrderTemplateLinesInput, context);\n }\n await cartState.refreshCart({});\n return addedCartLines;\n}\n\n/**\n * The AddOrderTemplateToCart Data Action.\n * Returns created order template.\n */\nexport const addOrderTemplateToCartActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/add-order-template-to-cart',\n action: >addOrderTemplateToCartAction,\n input: addOrderTemplateToCartInput\n});\nexport default addOrderTemplateToCartActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { ProductList, ProductListType } from '@msdyn365-commerce/retail-proxy';\nimport { createProductListAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\n\n/**\n * Input class for the CreateOrderTemplate data action.\n */\nexport class CreateOrderTemplateInput implements IActionInput {\n public readonly templateName: string;\n\n constructor(templateName: string) {\n this.templateName = templateName;\n }\n\n public getCacheKey = () => 'CreateOrderTemplateInput';\n\n public getCacheObjectType = () => 'CreateOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the CreateOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} templateName The name of template.\n */\nexport const createOrderTemplateInput = (inputData: ICreateActionContext, templateName: string): CreateOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new CreateOrderTemplateInput(templateName);\n};\n\n/**\n * The action method for the CreateOrderTemplate data action.\n * @param {CreateOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function createOrderTemplateAction(input: CreateOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n const orderTemplate: ProductList = {\n Id: '',\n Name: input.templateName,\n ProductListTypeValue: ProductListType.OrderTemplate\n };\n const createdProductList = await createProductListAsync(\n {\n callerContext: ctx\n },\n orderTemplate\n );\n if (createdProductList && createdProductList.Id !== '') {\n return createdProductList;\n }\n ctx.telemetry.error('Created product list was null');\n throw new Error('Created product list was null');\n } catch (error) {\n ctx.telemetry.error('Not able to create order template', error);\n throw error;\n }\n}\n\n/**\n * The CreateOrderTemplate Data Action.\n * Returns created order template.\n */\nexport const createOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/create-order-template',\n action: >createOrderTemplateAction,\n input: createOrderTemplateInput\n});\n\nexport default createOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { IQueryResultSettings } from '@msdyn365-commerce/retail-proxy';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport {\n getOrderTemplates,\n GetOrderTemplatesInput,\n getPaginatedOrderTemplateLinesAction,\n GetPaginatedOrderTemplateLinesInput,\n QueryResultSettingsProxy\n} from '..';\nimport { OrderTemplate } from '../utilities/order-templates';\n\n/**\n * Input class for the GetOrderTemplates data action.\n */\nexport class GetFullOrderTemplateInput implements IActionInput {\n public orderTemplateId: string;\n\n public queryResultSettings: IQueryResultSettings;\n\n constructor(orderTemplateId: string, queryResultSettings: IQueryResultSettings) {\n this.orderTemplateId = orderTemplateId;\n this.queryResultSettings = queryResultSettings;\n }\n\n public getCacheKey = () => `GetFullOrderTemplate|${this.orderTemplateId}`;\n\n public getCacheObjectType = () => 'GetFullOrderTemplate';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the GetOrderTemplate method.\n * @param inputData The input data passed to the createInput method.\n * @param orderTemplateId\n */\nexport const createGetFullOrderTemplateInput = (inputData: ICreateActionContext, orderTemplateId: string): GetFullOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order templates. User is not authenticated.');\n }\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\n queryResultSettings.count = true;\n\n return new GetFullOrderTemplateInput(orderTemplateId, queryResultSettings);\n};\n\n/**\n * The action method for the GetFullOrderTemplate data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function getFullOrderTemplateAction(input: GetFullOrderTemplateInput, ctx: IActionContext): Promise {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('Unable to get full order template. User is not authenticated.');\n }\n\n const inputParams = new GetOrderTemplatesInput(input.orderTemplateId);\n const productLists: ProductList[] = await getOrderTemplates(inputParams, ctx);\n\n if (!productLists || productLists.length !== 1) {\n throw new Error('Unable to get full order template. Order template was not found.');\n }\n\n const inputLines = new GetPaginatedOrderTemplateLinesInput(productLists[0].Id, input.queryResultSettings);\n const linesState = await getPaginatedOrderTemplateLinesAction(inputLines, ctx);\n return new OrderTemplate(productLists[0], linesState.lines, linesState.totalCount);\n}\n\n/**\n * The GetFullOrderTemplate Data Action\n * Returns order templates.\n */\nexport const getFullOrderTemplateActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/get-full-order-template',\n action: >getFullOrderTemplateAction,\n input: createGetFullOrderTemplateInput\n});\n\nexport default getFullOrderTemplateActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductList } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Input class for the UpdateOrderTemplate data action.\n */\nexport class UpdateOrderTemplateHeaderInput implements IActionInput {\n public readonly orderTemplate: ProductList;\n\n constructor(orderTemplate: ProductList) {\n this.orderTemplate = orderTemplate;\n }\n\n public getCacheKey = () => 'UpdateOrderTemplateHeaderInput';\n\n public getCacheObjectType = () => 'UpdateOrderTemplateHeaderInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the UpdateOrderTemplateHeader method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {ProductList} orderTemplate The template header.\n */\nexport const updateOrderTemplateHeaderInput = (\n inputData: ICreateActionContext,\n orderTemplate: ProductList\n): UpdateOrderTemplateHeaderInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to update order template. User is not authenticated.');\n }\n return new UpdateOrderTemplateHeaderInput(orderTemplate);\n};\n\n/**\n * The action method for the UpdateOrderTemplate data action.\n * @param {UpdateOrderTemplateHeaderInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function updateOrderTemplateHeaderAction(input: UpdateOrderTemplateHeaderInput, ctx: IActionContext): Promise {\n try {\n const { orderTemplate } = input;\n const updatedProductList = await updateAsync(\n {\n callerContext: ctx\n },\n orderTemplate\n );\n if (updatedProductList) {\n return updatedProductList;\n }\n ctx.telemetry.error(`Updated product list ${orderTemplate.Id} came back as null.`);\n throw new Error('Updated product list was null.');\n } catch (error) {\n ctx.telemetry.error('Not able to update order template', error);\n throw error;\n }\n}\n\n/**\n * The UpdateOrderTemplate Data Action.\n * Returns updated order template.\n */\nexport const updateOrderTemplateHeaderActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/update-order-template-header',\n action: >updateOrderTemplateHeaderAction,\n input: updateOrderTemplateHeaderInput\n});\n\nexport default updateOrderTemplateHeaderActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { updateProductListLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductListsDataActions.g';\nimport { ProductListLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport getPaginatedOrderTemplateLines, { GetPaginatedOrderTemplateLinesInput } from './get-paginated-order-template-lines';\nimport { validateCatalogId } from '../utilities';\n\n/**\n * Input class for the UpdateOrderTemplate data action.\n */\nexport class UpdateOrderTemplateInput implements IActionInput {\n public readonly orderTemplateId: string;\n\n public readonly productId: number;\n\n public readonly quantity: number;\n\n public readonly unitOfMeasure: string;\n\n public readonly isMultipleCatalogFeatureEnabledInHq?: boolean;\n\n public readonly catalogId?: number | undefined;\n constructor(\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number\n ) {\n this.orderTemplateId = orderTemplateId;\n this.productId = productId;\n this.quantity = quantity;\n this.unitOfMeasure = unitOfMeasure || 'ea';\n this.isMultipleCatalogFeatureEnabledInHq = isMultipleCatalogFeatureEnabledInHq;\n this.catalogId = catalogId;\n }\n\n public getCacheKey = () => 'UpdateOrderTemplateInput';\n\n public getCacheObjectType = () => 'UpdateOrderTemplateInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * CreateInput method for the UpdateOrderTemplate method.\n * @param {ICreateActionContext} inputData The input data passed to the createInput method.\n * @param {string} orderTemplateId The id of order template to update.\n * @param {number} productId The id of a product to add.\n * @param {number} quantity How many items of this product to add.\n * @param unitOfMeasure\n */\nexport const updateOrderTemplateInput = (\n inputData: ICreateActionContext,\n orderTemplateId: string,\n productId: number,\n quantity: number,\n unitOfMeasure: string,\n isMultipleCatalogFeatureEnabledInHq?: boolean,\n catalogId?: number | undefined\n): UpdateOrderTemplateInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create order template. User is not authenticated.');\n }\n return new UpdateOrderTemplateInput(\n orderTemplateId,\n productId,\n quantity,\n unitOfMeasure,\n isMultipleCatalogFeatureEnabledInHq || false,\n catalogId\n );\n};\n\n/**\n * The action method for the UpdateOrderTemplate data action.\n * @param {UpdateOrderTemplateInput} input The action input.\n * @param {IActionContext} ctx The action context.\n */\nexport async function updateOrderTemplateAction(input: UpdateOrderTemplateInput, ctx: IActionContext): Promise {\n try {\n if (!ctx.requestContext.user.isAuthenticated) {\n throw new Error('User token was not found when updating the order template');\n }\n const getLinesInput = new GetPaginatedOrderTemplateLinesInput(input.orderTemplateId, {}, input.productId.toString());\n const linesState = await getPaginatedOrderTemplateLines(getLinesInput, ctx);\n if (!linesState) {\n throw new Error('Order template was not found when updating the order template');\n }\n\n const linesToUpdate = linesState.lines.filter(line => line.productListLine.ProductId === input.productId);\n if (linesToUpdate.length !== 1) {\n throw new Error('Unable to find the line to update when updating the order template');\n }\n const catalogId = input.catalogId;\n validateCatalogId(catalogId);\n const lineToUpdate = linesToUpdate[0].productListLine;\n\n lineToUpdate.UnitOfMeasure = input.unitOfMeasure;\n lineToUpdate.Quantity = input.quantity;\n if (input.isMultipleCatalogFeatureEnabledInHq) {\n lineToUpdate.CatalogId = catalogId;\n }\n\n const updatedLines: ProductListLine[] = await updateProductListLinesAsync(\n {\n callerContext: ctx\n },\n input.orderTemplateId,\n [lineToUpdate]\n );\n\n if (!updatedLines || updatedLines.length !== 1) {\n throw new Error('Server returned invalid lines when updating order template');\n }\n const updatedLine = updatedLines.filter(line => line.ProductId === input.productId);\n if (\n updatedLine.length !== 1 ||\n updatedLine[0].Quantity !== input.quantity ||\n updatedLine[0].UnitOfMeasure !== input.unitOfMeasure\n ) {\n throw new Error('Server did not update the line when updating order template');\n }\n return updatedLine[0];\n } catch (error) {\n ctx.telemetry.error('Not able to add an item to order template', error);\n throw error;\n }\n}\n\n/**\n * The UpdateOrderTemplate Data Action.\n * Returns product list line that was added to the order template.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/order-templates/update-order-template-line',\n action: >updateOrderTemplateAction,\n input: updateOrderTemplateInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings\n} from '@msdyn365-commerce/core';\nimport { Customer, CustomerAttribute } from '@msdyn365-commerce/retail-proxy';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { GetCustomerInput } from './get-customer';\n\nexport interface IUpdateCustomerAttributesInput extends IActionInput {\n phone?: string;\n vatNumber?: string;\n customerAttributes: CustomerAttribute[];\n userAccountNumber: string;\n apiSettings: ICommerceApiSettings;\n}\n\nexport enum ContactInfoType {\n None = 0,\n Phone = 1,\n Email = 2,\n Url = 3,\n Telex = 4,\n Fax = 5\n}\n\n/**\n * Input class for the updateCustomerAttributes.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class updateCustomerAttributesInput implements IUpdateCustomerAttributesInput {\n public userAccountNumber: string;\n\n public customerAttributes: CustomerAttribute[];\n\n public apiSettings: ICommerceApiSettings;\n\n public phone?: string;\n\n public vatNumber?: string;\n\n constructor(\n userAccountNumber: string,\n customerAttributes: CustomerAttribute[],\n apiSettings: ICommerceApiSettings,\n phone?: string,\n vatNumber?: string\n ) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n this.customerAttributes = customerAttributes;\n this.phone = phone;\n this.vatNumber = vatNumber;\n }\n\n public getCacheKey = (): string => buildCacheKey(`${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'Customer';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The action method for the updateCustomerAttributes data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function updateCustomerAttributesAction(input: IUpdateCustomerAttributesInput, ctx: IActionContext): Promise {\n const { customerAttributes, phone, vatNumber, userAccountNumber } = input;\n\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, userAccountNumber);\n\n if (!customer) {\n ctx.telemetry.debug('[update-customer-attributes] Unable to find customer');\n throw new Error('Unable to find customer');\n }\n\n // The customer level phone (customer.phone) is the primary phone number. We need to update the primary phone in customer.Contacts as well.\n const primaryContact = customer.Contacts?.filter(\n contact => contact && contact.IsPrimary && contact.AddressTypeValue === ContactInfoType.Phone\n )?.[0];\n\n if (primaryContact) {\n primaryContact.Value = phone;\n }\n\n const newCustomer = { ...customer };\n newCustomer.Phone = phone;\n newCustomer.PhoneRecordId = primaryContact?.RecordId ? primaryContact?.RecordId : 0;\n newCustomer.VatNumber = vatNumber;\n newCustomer.Attributes = customerAttributes;\n\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n ctx.telemetry.debug('[update-customer-attributes] Unable to update customer attributes');\n throw new Error('Unable to update customer attributes');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer;\n}\n\n/**\n * The updateCustomerAttributes data action\n * Returns the updated customer.\n */\nexport const updateCustomerAttributesActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-customer-attributes',\n action: >updateCustomerAttributesAction\n});\n\nexport default updateCustomerAttributesActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings\n} from '@msdyn365-commerce/core';\nimport { Customer } from '@msdyn365-commerce/retail-proxy';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\n\nimport { buildCacheKey } from '.';\nimport { GetCustomerInput } from './get-customer';\n\nexport interface IUpdateCustomerPersonalizationInput extends IActionInput {\n isOptOut: boolean;\n userAccountNumber: string;\n apiSettings: ICommerceApiSettings;\n preferenceType?: string;\n}\n\n/**\n * Input class for the updateCustomerPersonalization.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class updateCustomerPersonalizationInput implements IUpdateCustomerPersonalizationInput {\n public userAccountNumber: string;\n\n public isOptOut: boolean;\n\n public apiSettings: ICommerceApiSettings;\n\n public preferenceType: string | undefined;\n\n constructor(userAccountNumber: string, isOptOut: boolean, apiSettings: ICommerceApiSettings, preferenceType?: string) {\n this.userAccountNumber = userAccountNumber;\n this.apiSettings = apiSettings;\n this.isOptOut = isOptOut;\n this.preferenceType = preferenceType;\n }\n\n public getCacheKey = (): string => buildCacheKey(`${this.userAccountNumber}`, this.apiSettings);\n\n public getCacheObjectType = () => 'Customer';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The action method for the updateCustomerPersonalization data action.\n * @param input The action input.\n * @param ctx The action context.\n */\nexport async function updateCustomerPersonalizationAction(\n input: IUpdateCustomerPersonalizationInput,\n ctx: IActionContext\n): Promise {\n const { userAccountNumber, isOptOut, preferenceType } = input;\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, userAccountNumber);\n if (!customer) {\n throw new Error('Unable to find customer');\n }\n\n const newCustomer = { ...customer };\n\n switch (preferenceType) {\n case 'web-tracking':\n newCustomer.OptOutWebActivityTracking = isOptOut;\n break;\n case undefined:\n case 'personalization':\n default:\n newCustomer.OptOutPersonalization = isOptOut;\n }\n\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\n\n if (!updatedCustomer) {\n throw new Error('Unable to update customer');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer;\n}\n\n/**\n * The updateCustomerPersonalization data action\n * Returns the updated customer.\n */\nexport const updateCustomerPersonalizationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-customer-personalization',\n action: >updateCustomerPersonalizationAction\n});\n\nexport default updateCustomerPersonalizationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Represents a pair of two fields: key and value.\n * Used to initialize a dictionary.\n */\nexport interface IKeyValuePair {\n readonly key: Key;\n readonly value: Value;\n}\n\n/**\n * Represents a dictionary in memory storage.\n */\nexport class Dictionary {\n /**\n * Values stored in the dictionary.\n */\n private _values: { [eventName: string]: Value };\n\n /**\n * The number of values stored in the dictionary (does not include keys).\n */\n private _length: number;\n\n /**\n * Initializes an empty dictionary or a dictionary with the given key value pairs.\n * @param {IKeyValuePair[]} entries The key value pairs which should be stored in the dictionary initially.\n */\n public constructor(...entries: IKeyValuePair[]) {\n this._values = {};\n this._length = 0;\n entries.forEach(keyValuePair => {\n this.setValue(keyValuePair.key, keyValuePair.value);\n });\n }\n\n /**\n * Removes value from the dictionary for the given key.\n * @param {Key} key The key to retrieve the value.\n * @remark Does nothing in case the key is not present in the dictionary.\n */\n public removeValue(key: Key): void {\n if (!this.hasValue(key)) {\n return;\n }\n\n --this._length;\n delete this._values[key];\n }\n\n /**\n * Retrieves a value from the dictionary or returns undefined in case it's not found.\n * @param {Key} key The key to retrieve the value.\n * @returns {Value | undefined} The value stored in the dictionary or undefined in case it's not found.\n */\n public getValue(key: Key): Value | undefined {\n return this._values[key];\n }\n\n /**\n * Retrieves a value from the dictionary.\n * In case it's not found, adds the default value to the dictionary and returns it.\n * @param {Key} key The key to retrieve the value.\n * @param defaultValue\n * @returns {Value} The value stored in the dictionary or the default value in case it's not found.\n */\n public getValueWithDefaultValue(key: Key, defaultValue: Value): Value {\n if (!this.hasValue(key)) {\n this.setValue(key, defaultValue);\n }\n return this.getValue(key)!;\n }\n\n /**\n * Sets the value to the dictionary for the given key.\n * @remarks In case undefined was passed, removes the value from the dictionary instead.\n * @param {Key} key The key under which the value should be stored.\n * @param {Value} value The value which should be stored in the dictionary.\n */\n public setValue(key: Key, value: Value): void {\n if (value === undefined) {\n this.removeValue(key);\n return;\n }\n\n if (!this.hasValue(key)) {\n ++this._length;\n }\n\n this._values[key] = value;\n }\n\n /**\n * Checks if the dictionary stores some value (except undefined) for the given key.\n * @param {Key} key The key to retrieve the value.\n * @returns {boolean} True in case the value is present, false otherwise or if it's undefined.\n */\n public hasValue(key: Key): boolean {\n return this._values[key] !== undefined;\n }\n\n /**\n * Checks if the dictionary is empty.\n * @returns {boolean} True if the dictionary is empty, false otherwise.\n */\n public isEmpty(): boolean {\n return this.length === 0;\n }\n\n /**\n * Retrieves the number of values stored in the dictionary.\n * @remark Use `isEmpty` to check if the dictionary has any elements.\n * @returns {number} The number of values stored.\n */\n public get length(): number {\n return this._length;\n }\n\n /**\n * Clears the dictionary by removing all elements from the storage.\n */\n public clear(): void {\n this._values = {};\n this._length = 0;\n }\n\n /**\n * Returns all values stored in the dictionary.\n * @returns {Value[]} List of values.\n */\n public getValues(): Value[] {\n return this.getKeys().map(key => this._values[key]);\n }\n\n /**\n * Returns all keys stored in the dictionary.\n * @returns {string[]} List of keys.\n */\n public getKeys(): Key[] {\n return Object.keys(this._values);\n }\n\n /**\n * Returns all key value pairs stored in the dictionary.\n * @returns {IKeyValuePair[]} List of key value pairs.\n */\n public getKeyValuePairs(): IKeyValuePair[] {\n return this.getKeys().map(key => {\n return { key, value: this._values[key] };\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 { IEventSubscriber } from './event-subscriber';\n\n/**\n * Represents a simple event with subscribers. Notifies the subscribers once the event is triggered.\n */\nexport class Event {\n /**\n * The list of subscribers.\n */\n private _subscribers: IEventSubscriber[];\n\n /**\n * Initializes the event with a empty subscribers list.\n */\n public constructor() {\n this._subscribers = [];\n }\n\n /**\n * Subscribes given instance to the event.\n * @param {IEventSubscriber} instance The info about the subscriber.\n */\n public subscribe(instance: IEventSubscriber): void {\n this._subscribers.push(instance);\n }\n\n /**\n * Removes the subscriber from the list of subscribers watching the event.\n * @param {string} instanceId The unique identifier of the subscriber which was earlier passed in `subscribe` method in `IEventSubscriber`.\n */\n public unsubscribe(instanceId: string): void {\n this._subscribers = this._subscribers.filter(element => element.instanceId !== instanceId);\n }\n\n /**\n * Clears the list of subscriber removing all instances watching the event.\n */\n public unsubscribeAll(): void {\n this._subscribers = [];\n }\n\n /**\n * Triggers the event.\n * Notifies the subscribers that the event is triggered by calling `handler` method.\n */\n public trigger(): void {\n this._subscribers.forEach(subscriber => {\n subscriber.handler();\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 { PromiseBodyWrapper } from './base-promise-queue';\nimport { PromiseQueue } from './promise-queue';\n\nexport enum FinitePromiseQueueError {\n InvalidMaxQueueLengthPassed = 'Invalid maxQueueLength value passed to FinitePromiseQueue. maxQueueLength should be more or equal to 2.',\n ProcessWasDiscardedFromTheQueue = 'The process was discarded from FinitePromiseQueue.'\n}\n\n/**\n * Represents a FIFO queue over promises with a limited number of elements waiting for execution.\n * @remark\n * In case the queue reaches the limit,\n * before adding a new element the queue discards the oldest added element which is waiting to be processed.\n * Does not discard elements which are in progress under execution.\n * The discarded element will not be processed and executed.\n * @author Bohdan Yevchenko \n */\nexport class FinitePromiseQueue extends PromiseQueue {\n /**\n * @see constructor\n */\n private readonly _maxQueueLength: number;\n\n /**\n * Initializes the queue with the given limit.\n * @param {number} maxQueueLength\n * Defines the limit of maximum number of elements in the queue.\n * @remarks Includes both the number of elements waiting for the execution\n * and the element processed by the queue at the moment (in case there is some).\n * Value can't be less than 2.\n */\n public constructor(maxQueueLength: number) {\n if (maxQueueLength < 2) {\n throw new Error(FinitePromiseQueueError.InvalidMaxQueueLengthPassed);\n }\n\n super();\n this._maxQueueLength = maxQueueLength;\n }\n\n /**\n * Adds promise to the queue and automatically starts the queue execution.\n * @remarks In case the queue has reached the limit, also discards the oldest added element.\n * @param {PromiseBodyWrapper} promiseBody\n * The body of a function which contains a call to the promise which has to be executed in the queue.\n */\n public async enqueue(promiseBody: PromiseBodyWrapper): Promise {\n let totalElementsCount = this._queue.length;\n\n // If queue hasn't finished processing an element,\n // consider this element as pending.\n if (this._isBusy) {\n ++totalElementsCount;\n }\n\n // Discards the oldest added element from the queue to meet the given limitations.\n // The very first element in the queue is considered as oldest added.\n // Can't discard the element which is under execution as the promise can't be cancelled.\n if (totalElementsCount === this._maxQueueLength) {\n const element = this._queue.shift();\n if (element) {\n element.reject(FinitePromiseQueueError.ProcessWasDiscardedFromTheQueue);\n }\n }\n\n return super.enqueue(promiseBody);\n }\n}\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Namespace which provides functionality for GUID.\n */\nexport namespace Guid {\n export function generateGuid(): string {\n return uuidv4();\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { Guid as _guid } from './guid';\n\nexport namespace Random {\n export import Guid = _guid;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Regular expressions to validate emails.\n */\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport abstract class EmailRegex {\n /**\n * Represents a HTML5 Validation Regex.\n *\n * A valid email address is a string that matches the email production of the following ABNF, the character set for which is Unicode.\n * This ABNF implements the extensions described in RFC 1123.\n *\n * For more info: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address.\n */\n public static readonly html5EmailRegex = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n\n /**\n * Returns a default regex which should be used for most email validation cases.\n *\n * As of now, the default regex is HTML5 email regex standard.\n * @see EmailRegex.html5EmailRegex - The regex which is set to be default right now.\n *\n * @returns Regular expression for email validation.\n */\n public static get defaultRegex(): RegExp {\n return EmailRegex.html5EmailRegex;\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 * Regular expressions to validate passwords.\n */\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport abstract class PasswordRegex {\n // eslint-disable-next-line max-len\n public static readonly defaultRegex = /^((?=.*[a-z])(?=.*[A-Z])(?=.*\\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]))([A-Za-z\\d@#$%^&*\\-_+=[\\]{}|\\\\:',?/`~'();!]|\\.(?!@)){8,16}$/;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Regular expressions to validate phone number.\n */\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport abstract class PhoneRegex {\n public static readonly defaultRegex = '^$|^[- +()]*[0-9][- +()0-9]*$';\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, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { createAddressManagementInput, doAddressManagementOperation, IAddressManagementInput } from './add-address';\n\n// TODO: Centralize this logic in a common utility area\nexport function updateAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = customer.Addresses || [];\n if (address.IsPrimary) {\n customer.Addresses.forEach(cur => (cur.IsPrimary = false));\n }\n customer.Addresses = [...customer.Addresses.filter(cur => cur.RecordId !== address.RecordId), address];\n return customer;\n}\n\nexport async function updateAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, updateAddressHandler);\n}\n\n/**\n * The updateAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Merge the passed address information with the address information from\n * the retireved customer, and then updates that customer via the update RetailServer API.\n */\nexport const updateAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-address',\n action: >updateAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput)\n});\n\nexport default updateAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { createAddressManagementInput, IAddressManagementInput } from './add-address';\nimport { GetCustomerInput } from './get-customer';\n\nexport function updatePrimaryAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses || [])]);\n return customer;\n}\n\nexport async function updatePrimaryAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n const { address } = input;\n\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, '');\n\n if (!customer) {\n throw new Error('Unable to find customer');\n }\n\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses ?? [])]);\n const updatedCustomer = await updateAsync({ callerContext: ctx }, customer);\n\n if (!updatedCustomer) {\n throw new Error('Unable to update customer');\n }\n\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\n\n return updatedCustomer.Addresses || [];\n}\n\n/**\n * The updatePrimaryAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Merge the passed address information with the address information from\n * the retireved customer, and then updates that customer via the update RetailServer API.\n */\nexport const updatePrimaryAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/update-primary-address',\n action: >updatePrimaryAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\nexport default updatePrimaryAddressActionDataAction;\n\nconst setPrimaryAddress = (primaryAddresses: Address, addresses: Address[]): Address[] => {\n return addresses.map(addr => {\n if (addr.RecordId === primaryAddresses.RecordId) {\n addr.IsPrimary = true;\n } else {\n addr.IsPrimary = false;\n }\n return addr;\n });\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { ObjectExtensions } from './object-extensions';\n\n/**\n * Represents an array which is defined with at least one value.\n */\nexport type NonEmptyArray = [T, ...T[]];\n\n/**\n * Namespace which extends Array functionality.\n */\nexport namespace ArrayExtensions {\n /**\n * Verifies whether the object array has elements.\n * @param value - The array to examine.\n * @returns True if the object has at least one element in the array, false otherwise (if array is not defined or empty).\n */\n export function hasElements(value: NonEmptyArray | T[] | null | undefined): value is NonEmptyArray {\n const emptyArrayLength = 0;\n return !ObjectExtensions.isNullOrUndefined(value) && value.length > emptyArrayLength;\n }\n\n /**\n * Retrieves the first element in the array or default value if the array is empty.\n * @param values - The array with values.\n * @param defaultValue - Optional parameter to specify default value. If not specified, undefined will be used.\n * @returns First element or default value.\n */\n export function firstOrDefault(values: NonEmptyArray | T[] | null | undefined, defaultValue?: T): T | undefined {\n if (hasElements(values)) {\n return values[0];\n }\n return defaultValue;\n }\n\n /**\n * Remove duplicate elements in the array.\n * @param value - The array to examine.\n * @returns An array with only unique elements.\n */\n export function unique(value: T[]): T[] {\n if (!hasElements(value)) {\n return [];\n }\n\n return Array.from(new Set(value));\n }\n\n /**\n * Checks if all elements satisfy given condition.\n * @param value - The array to examine.\n * @param predicate - The function which checks an element.\n * @returns True if the array is empty or all the inner elements satisfy given condition,\n * false if at least one element does not pass the condition.\n */\n export function all(value: T[] | null | undefined, predicate: (value: T, index: number, array: T[]) => boolean): boolean {\n if (!hasElements(value)) {\n return true;\n }\n\n return value.filter(predicate).length === value.length;\n }\n\n /**\n * Filters out null and undefined values from the given array.\n * @param value - The array with possibly undefined/null items.\n * @returns All items which are not null or undefined.\n */\n export function validValues(value: (T | undefined | null)[] | undefined | null): T[] {\n if (!hasElements(value)) {\n return [];\n }\n\n return value.filter(item => !ObjectExtensions.isNullOrUndefined(item)) as T[];\n }\n\n /**\n * Merges items from 2-dimensional array into one array with all items.\n * @param value - The 2-dimensional array with the items.\n * @returns All items retrieved from all inner arrays.\n */\n export function flatten(value: ((T | undefined | null)[] | undefined | null)[]): T[] {\n let result: T[] = [];\n\n if (!hasElements(value)) {\n return result;\n }\n\n for (const arrayLine of value) {\n if (!ObjectExtensions.isNullOrUndefined(arrayLine)) {\n result = result.concat(validValues(arrayLine));\n }\n }\n\n return result;\n }\n\n /**\n * Check if two arrays are equal.\n * @param firstArray - The array with the items.\n * @param secondArray - Another array with the items.\n * @param comparator - The comparator which compares the values and returns true if two objects are equal, false otherwise.\n * @returns True if arrays have the same items, false otherwise.\n */\n export function equals(\n firstArray: T[],\n secondArray: T[],\n comparator?: (valueFromFirstArray: T, valueFromSecondArray: T) => boolean\n ): boolean {\n if (firstArray.length !== secondArray.length) {\n return false;\n }\n\n if (comparator === undefined) {\n return JSON.stringify(firstArray) === JSON.stringify(secondArray);\n }\n\n for (let index = 0; index < firstArray.length; ++index) {\n if (!comparator(firstArray[index], secondArray[index])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Check if two arrays have the same elements irrespective of the order.\n * @param firstArray - The array with the items.\n * @param secondArray - Another array with the items.\n * @param comparator - The comparator which compares the values and returns true if two objects are equal, false otherwise.\n * @returns True if arrays have the same items, false otherwise.\n */\n export function haveSameItems(\n firstArray: T[],\n secondArray: T[],\n comparator: (valueFromFirstArray: T, valueFromSecondArray: T) => boolean = (valueFromFirstArray: T, valueFromSecondArray: T) =>\n valueFromFirstArray === valueFromSecondArray\n ): boolean {\n if (firstArray.length !== secondArray.length) {\n return false;\n }\n\n for (const item of firstArray) {\n if (!secondArray.some(otherItem => comparator(item, otherItem))) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Calculates a sum of elements in the given array.\n * @param data - List of items.\n * @returns Sum of elements.\n */\n export function calculateSum(data: NonEmptyArray): number {\n let result = data[0];\n for (let index = 1; index < data.length; ++index) {\n result += data[index];\n }\n\n return result;\n }\n\n /**\n * Reverses the elements in the array without modifying the original one.\n * @param array - The array with the items.\n * @returns A new array with reversed order.\n */\n export function reverse(array: T[]): T[] {\n const newArray: T[] = [];\n\n for (let index = array.length - 1; index >= 0; --index) {\n newArray.push(array[index]);\n }\n\n return newArray;\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 IHTTPRequestOptions,\n IHTTPResponse,\n sendCommerceRequest\n} from '@msdyn365-commerce/core';\nimport { Address, CartTenderLine, SalesOrder } from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Check Out action Input.\n */\nexport class CheckOutInput implements IActionInput {\n public cartId: string;\n\n public cartVersion: number;\n\n public receiptEmail?: string;\n\n public cartTenderLines?: CartTenderLine[];\n\n public billingAddress?: Address;\n\n constructor(cartId: string, cartVersion: number, receiptEmail?: string, cartTenderLines?: CartTenderLine[], billingAddress?: Address) {\n this.cartId = cartId;\n this.cartVersion = cartVersion;\n this.receiptEmail = receiptEmail;\n this.cartTenderLines = cartTenderLines;\n this.billingAddress = billingAddress;\n }\n\n public getCacheKey = () => `${this.cartId}-${this.cartVersion}`;\n\n public getCacheObjectType = () => 'CheckOut';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Calls the Retail API to check out and returns sales order.\n * @param input\n * @param ctx\n */\nexport async function checkOutAction(input: CheckOutInput, ctx: IActionContext): Promise {\n const { apiSettings } = ctx.requestContext;\n const requestUrl = `${apiSettings.baseUrl}Commerce/Carts('${input.cartId}')/Checkout?api-version=7.3`;\n const requestOptions: IHTTPRequestOptions = {\n headers: {\n oun: apiSettings.oun,\n 'Content-Type': 'application/json'\n }\n };\n\n if (requestOptions.headers && ctx.requestContext.user.token) {\n requestOptions.headers.Authorization = `id_token ${ctx.requestContext.user.token}`;\n }\n\n if (input.cartTenderLines && input.cartTenderLines.length > 0) {\n input.cartTenderLines = input.cartTenderLines.map((cartTenderLineItem: CartTenderLine) => {\n cartTenderLineItem['@odata.type'] = '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CartTenderLine';\n\n cartTenderLineItem['Amount@odata.type'] = '#Decimal';\n\n if (cartTenderLineItem.TokenizedPaymentCard) {\n cartTenderLineItem.TokenizedPaymentCard['@odata.type'] =\n '#Microsoft.Dynamics.Commerce.Runtime.DataModel.TokenizedPaymentCard';\n\n // Force the House prop to be set, so that call succeeds\n if (!cartTenderLineItem.TokenizedPaymentCard.House) {\n cartTenderLineItem.TokenizedPaymentCard.House = 'N/A';\n }\n\n if (cartTenderLineItem.TokenizedPaymentCard.CardTokenInfo) {\n cartTenderLineItem.TokenizedPaymentCard.CardTokenInfo['@odata.type'] =\n '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardTokenInfo';\n }\n\n if (input.billingAddress) {\n const { Phone, ThreeLetterISORegionName = '', Street, City, State, ZipCode } = input.billingAddress;\n cartTenderLineItem.TokenizedPaymentCard = {\n ...cartTenderLineItem.TokenizedPaymentCard,\n Phone,\n Country: ThreeLetterISORegionName.toUpperCase(),\n Address1: Street,\n City,\n State,\n Zip: ZipCode\n };\n }\n }\n\n return cartTenderLineItem;\n });\n }\n\n const requestBody = {\n receiptEmail: input.receiptEmail,\n cartVersion: input.cartVersion || null,\n ...(input.cartTenderLines && { cartTenderLines: input.cartTenderLines })\n };\n\n // Perform check-out operation\n return sendCommerceRequest(requestUrl, 'post', requestBody, requestOptions).then((response: IHTTPResponse) => {\n if (response.status >= 200 && response.status < 300 && response.data) {\n return response.data;\n } else if (response.data) {\n throw response.data;\n }\n throw new Error('[checkOutAction] Invalid response recieved from RetailServer');\n });\n}\n\nexport const checkOutActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/checkout',\n action: >checkOutAction\n});\nexport default checkOutActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy';\n\nimport { createAddressManagementInput, doAddressManagementOperation, IAddressManagementInput } from './add-address';\n\nexport function deleteAddressHandler(customer: Customer, address: Address): Customer {\n customer.Addresses = customer.Addresses || [];\n customer.Addresses = [...customer.Addresses.filter(cur => cur.RecordId !== address.RecordId)];\n return customer;\n}\n\nexport async function deleteAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\n return doAddressManagementOperation(input, ctx, deleteAddressHandler);\n}\n\n/**\n * The deleteAddress data action\n * Calls the read RetailServer API to get information about a customer\n * Removes all address information from the retireved customer, and\n * then updates that customer via the update RetailServer API.\n */\nexport const deleteAddressActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/delete-address',\n action: >deleteAddressAction,\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\n isBatched: false\n});\n\nexport default deleteAddressActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n msdyn365Commerce\n} from '@msdyn365-commerce/core';\nimport { getCartState } from '@msdyn365-commerce/global-state';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\nimport { copyAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport Cookie from 'js-cookie';\n\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Input class for getCheckoutCart data action.\n */\nexport class GetCheckoutCartInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('ActiveCheckoutCart', this.apiSettings);\n\n public getCacheObjectType = () => 'ActiveCheckoutCart';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new GetCheckoutCartInput(inputData.requestContext.apiSettings);\n};\n\nconst CartCookieName: string = msdyn365Commerce.CartCookie || 'cart';\n\n/**\n * Data action to copy the cart for checkout actions.\n * @param input\n * @param ctx\n */\nexport async function getCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\n const cartId = Cookie.get(CartCookieName) || '';\n if (cartId) {\n const currentCartState = await getCartState(ctx);\n const activeCart = currentCartState.cart;\n\n // Check if there is an active cart and it isn't empty\n if (activeCart && Object.keys(activeCart).length > 0) {\n const checkoutCart = await copyAsync({ callerContext: ctx }, activeCart.Id, 2);\n\n if (checkoutCart) {\n return Array.isArray(checkoutCart) ? checkoutCart[0] : checkoutCart;\n }\n } else {\n ctx.trace(\"[get-checkout-cart] Can't create a checkout cart since active cart is empty\");\n }\n }\n\n return {};\n}\n\nexport const getCheckoutCartDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-checkout-cart',\n action: >getCheckoutCart,\n input: createInput\n});\n\nexport default getCheckoutCartDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionInput, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { LoyaltyCard, retailAction } from '@msdyn365-commerce/retail-proxy';\nimport { createGetCustomerLoyaltyCardsInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createCustomerLoyaltyCardsInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetCustomerLoyaltyCardsInput({}, null);\n }\n\n throw new Error('Unable to create order history input. User is not authenticated.');\n};\n\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-customer-loyalty-cards',\n action: >retailAction,\n input: createCustomerLoyaltyCardsInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport {\n ProductList,\n ProductListsDataActions,\n ProductListSearchCriteria,\n ProductListType,\n QueryResultSettings\n} from '@msdyn365-commerce/retail-proxy';\n\n/**\n * Input class for the GetProductList data action.\n */\nexport class GetProductListInput implements IActionInput {\n public readonly productListId: string;\n\n public readonly queryResultSettings?: QueryResultSettings;\n\n public constructor(productListId?: string, queryResultSettings?: QueryResultSettings) {\n this.productListId = productListId ? productListId : '';\n this.queryResultSettings = queryResultSettings;\n }\n\n /**\n * Get Cache Key.\n * @returns - Cache key string.\n */\n public getCacheKey = (): string => 'ProductList';\n\n /**\n * Get Cachetype Name.\n * @returns - Cache name string.\n */\n public getCacheObjectType = (): string => 'ProductList';\n\n /**\n * Get Cachetype.\n * @returns - CacheType enum.\n */\n public dataCacheType = (): CacheType => 'none';\n\n /**\n * Set Cache output.\n * @returns - Flag for cache output.\n */\n public shouldCacheOutput = (): boolean => false;\n}\n\n/**\n * CreateInput method for the GetProductList method.\n * @param inputData - The input data passed to the createInput method.\n * @param productListId - The product list identifier.\n * @param queryResultSettings - The query result setting required for pagination/ordering.\n * @returns - Product List input.\n */\nexport const createGetProductListInput = (\n inputData: ICreateActionContext,\n productListId?: string,\n queryResultSettings?: QueryResultSettings\n): GetProductListInput => {\n const { requestContext } = inputData;\n if (!requestContext.user.isAuthenticated) {\n throw new Error('Unable to create get product list. User is not authenticated.');\n }\n\n return new GetProductListInput(productListId ? productListId : '', queryResultSettings);\n};\n\n/**\n * The action method for the GetProductList data action.\n * @param input - The action input.\n * @param context - The action context.\n * @returns - ProductList array.\n */\nexport async function getProductListAction(input: GetProductListInput, context: IActionContext): Promise {\n const productListType = ProductListType.QuickOrder.toString();\n const productListSearchCriteria: ProductListSearchCriteria = {\n ProductListType: productListType\n };\n const productLists = await ProductListsDataActions.searchAsync(\n {\n callerContext: context,\n queryResultSettings: input.queryResultSettings\n },\n productListSearchCriteria\n ).then(result => {\n return result;\n });\n\n return productLists;\n}\n\n/**\n * The GetProductList Data Action\n * Returns product list.\n */\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-product-list',\n action: getProductListAction as IAction,\n input: createGetProductListInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct, IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport { refineSearchByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from './get-full-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Refine search for full products input.\n */\nexport class FullProductsRefineSearchByCategoryInput implements IActionInput {\n public readonly categoryId?: number;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly catalogId: number;\n\n public ProductDetailsCriteria?: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n categoryId?: number,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number,\n criteria?: ProductDetailsCriteria\n ) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.categoryId = categoryId;\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.catalogId = catalogId ?? 0;\n this.ProductDetailsCriteria = criteria;\n }\n\n public getCacheKey = () => 'FullProductsRefineSearchByCategoryInputCache';\n\n public getCacheObjectType = () => 'FullProductsRefineSearchByCategoryInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the core action calls.\n * @param inputData\n */\nexport const createFullProductsRefineSearchByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n if (!Array.isArray(refinementCriteria)) {\n return new FullProductsRefineSearchByCategoryInput(queryResultSettingsProxy);\n }\n\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.categoryId) {\n const categoryId = Number(inputData.requestContext.query.categoryId);\n const channelId = inputData.requestContext.apiSettings.channelId;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n return new FullProductsRefineSearchByCategoryInput(\n queryResultSettingsProxy,\n categoryId,\n +channelId,\n refinementCriteria,\n undefined,\n productDetailsCriteria\n );\n }\n\n throw new Error('Please specify categoryId, refinerId, and refinerSourceValue query string in request.');\n};\n\n/**\n * Calls the refine-search-by-category action.\n * Based on search result calls get-full-products to get all the product details.\n * @param input\n * @param ctx\n */\nexport async function getFullProductsByRefineSearchCategoryAction(\n input: FullProductsRefineSearchByCategoryInput,\n ctx: IActionContext\n): Promise {\n if (!input || !input.refinementCriteria) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] Invalid input.');\n return {};\n }\n\n const hasSortingColumn =\n input.queryResultSettingsProxy.QueryResultSettings &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting.Columns &&\n input.queryResultSettingsProxy.QueryResultSettings.Sorting.Columns.length > 0;\n if (input.refinementCriteria.length === 0 && !hasSortingColumn) {\n ctx.telemetry.trace('[getFullProductsByRefineSearchCategoryAction] No refiners or sorting specified.');\n return {};\n }\n const { apiSettings } = ctx.requestContext;\n\n const catalogId = getCatalogId(ctx.requestContext);\n\n let refinementCriteria: ProductRefinerValue[] = [];\n const fullProductInputs = await refineSearchByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.channelId || 0,\n input.catalogId || catalogId,\n input.categoryId || 0,\n input.refinementCriteria\n ).then(searchResults => {\n refinementCriteria = input.refinementCriteria;\n return searchResults.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(\n product.RecordId,\n apiSettings,\n input.ProductDetailsCriteria || new ProductDetailsCriteria(),\n ctx.requestContext\n );\n }\n );\n });\n\n if (fullProductInputs.length > 0) {\n const productResult = await (>getFullProducts(fullProductInputs, ctx));\n return {\n productSearchResult: productResult,\n refinementCriteria\n };\n }\n return {\n productSearchResult: [],\n refinementCriteria\n };\n}\n\nexport const getFullProductsByRefineSearchCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products-by-refine-search-category',\n action: >getFullProductsByRefineSearchCategoryAction,\n input: createFullProductsRefineSearchByCategoryInput,\n isBatched: false\n});\n\nexport default getFullProductsByRefineSearchCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\nimport { refineSearchByTextAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { ProductDetailsCriteria } from './get-full-products';\nimport { parseSearchData } from './utilities/input-data-parser';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { getRefinedFullProducts, IRefinableProductsInput } from './utilities/refiner-utils';\nimport { getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * Input for refining products returned by the search text.\n */\nexport class FullProductsRefineSearchByTextInput implements IActionInput, IRefinableProductsInput {\n public readonly searchText: string;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly itemsPerPage?: number;\n\n public readonly skipCount?: number;\n\n public readonly catalogId: number;\n\n public productDetailsCriteria?: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n public constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n searchText?: string,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number,\n criteria?: ProductDetailsCriteria\n ) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.searchText = searchText || '';\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.catalogId = catalogId ?? 0;\n this.productDetailsCriteria = criteria;\n }\n\n public getCacheKey = () => 'FullProductsRefineSearchByTextInputCache';\n\n public getCacheObjectType = () => 'FullProductsRefineSearchByTextInput';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make the core action calls.\n * @param inputData\n */\nexport const createFullProductsRefineSearchByTextInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n if (!Array.isArray(refinementCriteria)) {\n return new FullProductsRefineSearchByTextInput(queryResultSettingsProxy);\n }\n\n const searchInputData = parseSearchData(inputData);\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n\n return new FullProductsRefineSearchByTextInput(\n queryResultSettingsProxy,\n searchInputData.q,\n searchInputData.channelId,\n refinementCriteria,\n undefined,\n productDetailsCriteria\n );\n};\n\n/**\n * Calls the refine-search-by-text action.\n * Based on search result calls get-full-products to get all the product details.\n * @param input\n * @param ctx\n */\nexport function getFullProductsByRefineSearchTextAction(\n input: FullProductsRefineSearchByTextInput,\n ctx: IActionContext\n): Promise {\n const catalogId = getCatalogId(ctx.requestContext);\n\n return getRefinedFullProducts(input, ctx, () => {\n return refineSearchByTextAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.channelId || 0,\n input.catalogId || catalogId,\n input.searchText,\n input.refinementCriteria\n );\n });\n}\n\nexport const getFullProductsByRefineSearchTextActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-full-products-by-refine-search-text',\n action: >getFullProductsByRefineSearchTextAction,\n input: createFullProductsRefineSearchByTextInput,\n isBatched: false\n});\n\nexport default getFullProductsByRefineSearchTextActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IRefineFullProductSearchOutput } from '@msdyn365-commerce/commerce-entities';\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from '../get-full-products';\n\n/**\n * Common refinable products input includes both product detail criteria and refinement criteria.\n */\nexport interface IRefinableProductsInput {\n refinementCriteria: ProductRefinerValue[];\n productDetailsCriteria?: ProductDetailsCriteria;\n}\n\n/**\n * If refinement criteria is set, then gets refined products.\n * @param input Refinable products input.\n * @param ctx Action context.\n * @param getRefinedProducts Callback function to get a promise (e.g. RefineSearchByCategoryAsync, refineSearchByTextAsync)\n * that is executed to get refined products or full set of products.\n */\nexport async function getRefinedFullProducts(\n input: IRefinableProductsInput,\n ctx: IActionContext,\n getRefinedProducts: () => Promise\n): Promise {\n if (!input || !input.refinementCriteria) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] Invalid input.');\n return {};\n }\n\n if (input.refinementCriteria.length === 0) {\n ctx.trace('[getFullProductsByRefineSearchCategoryAction] No refiners specified.');\n return {};\n }\n const { apiSettings } = ctx.requestContext;\n\n let fullProductInputs: FullProductInput[] = [];\n\n const searchResults = await getRefinedProducts();\n if (!searchResults) {\n ctx.telemetry.error('[getFullProductsByRefineSearchCategoryAction] no searchResults returned');\n } else {\n fullProductInputs = searchResults.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(\n product.RecordId,\n apiSettings,\n input.productDetailsCriteria || new ProductDetailsCriteria(),\n ctx.requestContext\n );\n }\n );\n }\n\n if (fullProductInputs.length > 0) {\n const productResult = await getFullProducts(fullProductInputs, ctx);\n return {\n productSearchResult: productResult,\n refinementCriteria: input.refinementCriteria\n };\n }\n return {\n productSearchResult: [],\n refinementCriteria: input.refinementCriteria\n };\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n getAdditionalMediaLocationsForProductAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { AdditionalMediaLocationsInput } from '@msdyn365-commerce/action-internal';\nimport { AsyncResult, MediaLocation, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\n\nimport getSelectedVariant, { SelectedVariantInput } from './get-selected-variant';\nimport { getSelectedProductIdFromActionInput } from './utilities';\n\n/**\n * The action input class for the getAdditionalMediaLocationsForSelectedVariant data action.\n */\nexport class AdditionalMediaLocationsForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.catalogId = catalogId || 0;\n this.selectedProduct = selectedProduct;\n }\n\n public getCacheKey = () => 'AdditionalMediaLocationsForSelectedVariant';\n\n public getCacheObjectType = () => 'MediaLocations';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * The createInput method for the getAdditionalMediaLocationsForSelectedVariant data action.\n * @param inputData The input data passed to the createInput method.\n */\nexport const createMediaLocationsForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): AdditionalMediaLocationsForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new AdditionalMediaLocationsForSelectedVariantInput(\n +productId,\n +inputData.requestContext.apiSettings.channelId,\n undefined,\n catalogId\n );\n }\n throw new Error('Unable to create AdditionalMediaLocationsForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * The action method for the getAdditionalMediaLocationsForSelectedVariant data action.\n * @param input\n * @param ctx\n */\nexport async function getAdditionalMediaLocationsForSelectedVariantAction(\n input: AdditionalMediaLocationsForSelectedVariantInput,\n ctx: IActionContext\n): Promise {\n return AsyncResult.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n ctx.requestContext\n );\n return getSelectedVariant(selectedVariantInput, ctx);\n }\n\n return activeProduct;\n })\n .then(productResult => {\n const activeProduct = productResult;\n\n if (activeProduct) {\n if (ctx.requestContext.app?.config?.OmniChannelMedia) {\n const mediaLocationsInput = new AdditionalMediaLocationsInput(\n ctx.requestContext,\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n return getAdditionalMediaLocationsForProductAction(mediaLocationsInput, ctx);\n }\n }\n\n return [];\n })\n .catch(error => {\n ctx.trace(error);\n ctx.telemetry.error(error.message);\n ctx.telemetry.debug('[getAdditionalMediaLocationsForSelectedVariantAction]Error executing action');\n throw new Error('[getAdditionalMediaLocationsForSelectedVariantAction]Error executing action');\n });\n}\n\n/**\n * The getAdditionalMediaLocationsForSelectedVariant data action\n * Gets the currently selected variant for the page via the getSelectedVariant data action,\n * and then gets the media location information for the variant via the MediaLocations RetailServer API.\n */\nexport const getAdditionalMediaLocationsForSelectedVariantActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-additional-media-locations-for-selected-variant',\n action: >getAdditionalMediaLocationsForSelectedVariantAction,\n input: createMediaLocationsForSelectedVariantInput\n});\n\nexport default getAdditionalMediaLocationsForSelectedVariantActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { IDataServiceRequest, retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetOrderShipmentsHistoryInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\nimport { OrderShipments } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nconst createInput = (inputData: ICreateActionContext>): IDataServiceRequest => {\n if (inputData.requestContext && inputData.requestContext.user && inputData.requestContext.user.isAuthenticated) {\n return createGetOrderShipmentsHistoryInput(\n {\n Paging: {\n Top: 100,\n Skip: 0\n }\n },\n\n // @ts-expect-error\n null\n );\n }\n\n throw new Error('Unable to create order history input. User is not authenticated.');\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-order-history',\n action: >retailAction,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction } from '@msdyn365-commerce/core';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createGetOrgUnitConfigurationInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\nimport { ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\n/**\n * Get Org Unit Configuration Data Action.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-org-unit-configuration',\n action: >retailAction,\n input: () => {\n return createGetOrgUnitConfigurationInput();\n }\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductSearchResult, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { searchByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getCurrentCategory, { CurrentCategoryInput } from './get-current-category';\nimport getProducts, { ProductInput } from './get-simple-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateCacheKey } from './utilities/utils';\n\n/**\n * Product by category ID Input action.\n * @deprecated\n */\nexport class ProductsByCategoryInput implements IActionInput {\n public categoryId?: number;\n\n public categorySlug?: string;\n\n public categoryName?: string;\n\n public catalogId: number;\n\n public currentCategory: CurrentCategoryInput;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(category: CurrentCategoryInput, apiSettings: ICommerceApiSettings, queryResultSettingsProxy: QueryResultSettingsProxy) {\n this.apiSettings = apiSettings;\n this.currentCategory = category;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = apiSettings.catalogId;\n this.categoryId = category.categoryId;\n this.categorySlug = category.categorySlug;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'CategoryId', value: this.categoryId || this.categorySlug },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'QueryResultSettingsCacheKeyHint', value: this.queryResultSettingsProxy.cacheKeyHint }\n );\n\n public getCacheObjectType = () => 'Products-From-Search';\n\n public dataCacheType = (): CacheType => 'application';\n}\n\n/**\n * CreateInput method for the getProductsByCategory data aciton.\n * @param inputData\n * @deprecated\n */\nexport const createGetProductsByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n const currentCategory = new CurrentCategoryInput(inputData.requestContext);\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return new ProductsByCategoryInput(currentCategory, inputData.requestContext.apiSettings, queryResultSettingsProxy);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Action method for the getProductsByCategory data action.\n * @param input\n * @param ctx\n * @deprecated\n */\nexport async function getProductsByCategoryAction(input: ProductsByCategoryInput, ctx: IActionContext): Promise {\n const { apiSettings } = ctx.requestContext;\n let categoryId = input.currentCategory.categoryId;\n if (input.currentCategory.categorySlug && !categoryId) {\n const category = await getCurrentCategory(input.currentCategory, ctx);\n if (!category) {\n ctx.trace('[getProductsByCategoryAction] Unable to find category');\n return [];\n }\n categoryId = category.RecordId;\n }\n\n const productInputs = await searchByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n +apiSettings.channelId,\n input.catalogId,\n categoryId || 0\n ).then(productSearchResults => {\n return productSearchResults.map(\n (product: ProductSearchResult): ProductInput => {\n return new ProductInput(product.RecordId, apiSettings, undefined, undefined, ctx.requestContext);\n }\n );\n });\n\n if (productInputs.length > 0) {\n // eslint-disable-next-line no-return-await -- existing code\n return await getProducts(productInputs, ctx);\n }\n return [];\n}\n\n/**\n * The getProductsByCategory data action\n * Retrieves the current category of the request via the getCurrentCategory data action\n * Then calls the searchByCategory RetailServer API to get a list of products associated with\n * the current category, and finally fully hydrates the data for those prodcuts via the\n * getProducts data action, returning a list of SimpleProducts within the current category.\n * @deprecated\n */\nexport const getProductsByCategoryActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-products-by-category',\n action: >getProductsByCategoryAction,\n input: createGetProductsByCategoryInput\n});\n\n/**\n * @deprecated\n */\nexport default getProductsByCategoryActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, IActionInput } from '@msdyn365-commerce/core';\n\n/**\n * ReviewsGetRatingsSummary Input Action.\n */\nexport class GetRatingsSummaryInput implements IActionInput {\n /**\n * The Id representing the product to get the ratings for.\n */\n public productId: string;\n\n /**\n * The ID representing the tenant.\n */\n public tenantId: string;\n\n /**\n * The ratings and reviews service endpoint.\n */\n public serviceEndpoint: string;\n\n constructor(productId: string, tenantId: string, serviceEndpoint: string) {\n this.productId = productId;\n this.tenantId = tenantId;\n this.serviceEndpoint = serviceEndpoint;\n }\n\n // RnR does not use RS endpoint, so shouldn't use buildCacheKey\n public getCacheKey = () => `${this.productId}-${this.tenantId}`;\n\n public getCacheObjectType = () => 'RatingsSummary';\n\n public dataCacheType = (): CacheType => 'application';\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefiner } from '@msdyn365-commerce/retail-proxy';\nimport { getRefinersByCategoryAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport getCurrentCategory, { CurrentCategoryInput } from './get-current-category';\nimport { generateCacheKey } from './utilities';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * Action Input class for the getRefinersByCategory data action.\n */\nexport class RefinersByCategoryInput implements IActionInput {\n public readonly catalogId: number;\n\n public readonly currentCategory: CurrentCategoryInput;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n constructor(category: CurrentCategoryInput, queryResultSettingsProxy: QueryResultSettingsProxy, catalogId?: number) {\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = catalogId || 0;\n this.currentCategory = category;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n undefined,\n { key: 'CategoryKey', value: this.currentCategory.getCacheKey() },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'QueryResultSettingsCacheKeyHint', value: this.queryResultSettingsProxy.cacheKeyHint }\n );\n\n public getCacheObjectType = () => 'ProductRefiner';\n\n public shouldCacheOutput = () => true;\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createRefinersByCategoryInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext) {\n const catalogId = getCatalogId(inputData.requestContext);\n const currentCategory = new CurrentCategoryInput(inputData.requestContext);\n\n return new RefinersByCategoryInput(currentCategory, QueryResultSettingsProxy.fromInputData(inputData), catalogId);\n }\n\n throw new Error('Please specify categoryId query string in request.');\n};\n\n/**\n * Calls the Retail API and returns all refiners by category.\n * @param input\n * @param ctx\n */\nexport async function getRefinersByCategoryAction(input: RefinersByCategoryInput, ctx: IActionContext): Promise {\n let categoryId = input.currentCategory.categoryId;\n if (input.currentCategory.categorySlug && !categoryId) {\n const category = await getCurrentCategory(input.currentCategory, ctx);\n if (!category) {\n ctx.trace('[getRefinersByCategoryAction] Unable to find category');\n return [];\n }\n categoryId = category.RecordId;\n }\n\n return getRefinersByCategoryAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.catalogId,\n categoryId || 0\n );\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-refiners-by-category',\n action: >getRefinersByCategoryAction,\n input: createRefinersByCategoryInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefiner } from '@msdyn365-commerce/retail-proxy';\nimport { getRefinersByTextAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\n\nimport { parseSearchData } from './utilities/input-data-parser';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateCacheKey } from './utilities/utils';\n\n/**\n * Action Input class for the getRefinersByText data action.\n */\nexport class RefinersByTextInput implements IActionInput {\n public readonly catalogId: number;\n\n public readonly searchText: string;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(\n searchText: string,\n catalogId: number,\n queryResultSettingsProxy: QueryResultSettingsProxy,\n apiSettings: ICommerceApiSettings\n ) {\n this.catalogId = catalogId;\n this.searchText = searchText;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n this.apiSettings,\n { key: 'SearchText', value: this.searchText },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'QueryResultSettingsCacheKeyHint', value: this.queryResultSettingsProxy.cacheKeyHint }\n );\n\n public getCacheObjectType = () => 'ProductRefiner';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createRefinersByTextInput = (inputData: ICreateActionContext>): IActionInput => {\n const searchInputData = parseSearchData(inputData);\n const catalogId = inputData.config ? Number(inputData.config.catalogId) : 0;\n\n return new RefinersByTextInput(\n searchInputData.q,\n Number.isNaN(catalogId) ? 0 : catalogId,\n QueryResultSettingsProxy.fromInputData(inputData),\n inputData.requestContext.apiSettings\n );\n};\n\n/**\n * Calls the Retail API and returns all refiners by text.\n * @param input\n * @param ctx\n */\nexport async function getRefinersByTextAction(input: RefinersByTextInput, ctx: IActionContext): Promise {\n return getRefinersByTextAsync(\n { callerContext: ctx, queryResultSettings: input.queryResultSettingsProxy.QueryResultSettings },\n input.catalogId,\n input.searchText\n );\n}\n\nexport const getRefinersByTextActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-refiners-by-text',\n action: >getRefinersByTextAction,\n input: createRefinersByTextInput\n});\n\nexport default getRefinersByTextActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { FullProduct } from '@msdyn365-commerce/commerce-entities';\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { getRelatedProductsAsync, getRelationTypesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { ProductRelationType, ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport getFullProducts, { FullProductInput, ProductDetailsCriteria } from './get-full-products';\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { generateCacheKey, getProductDetailsCriteriaFromActionInput } from './utilities/utils';\n\n/**\n * GetRelatedProducts Input Action.\n */\nexport class GetRelatedProductsInput implements IActionInput {\n public readonly productId: number;\n\n public readonly catalogId: number;\n\n public readonly relationType: string;\n\n public ProductDetailsCriteria: ProductDetailsCriteria;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n public constructor(\n productId: number,\n catalogId: number,\n relationType: string,\n queryResultSettingsProxy: QueryResultSettingsProxy,\n criteria: ProductDetailsCriteria\n ) {\n this.productId = productId;\n this.catalogId = catalogId;\n this.relationType = relationType;\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.ProductDetailsCriteria = criteria;\n }\n\n public getCacheKey = () =>\n generateCacheKey(\n undefined,\n { key: 'ProductId', value: this.productId },\n { key: 'CatalogId', value: this.catalogId },\n { key: 'RelationType', value: this.relationType.toLowerCase() },\n { key: 'QueryResultSettingsCacheKeyHint', value: this.queryResultSettingsProxy.cacheKeyHint },\n { key: 'ShouldGetPrice', value: this.ProductDetailsCriteria.getPrice }\n );\n\n public getCacheObjectType = () => 'GetRelatedProducts';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\n/**\n * Creates the input required to make GetRelatedProducts retail api call.\n * @param inputData\n */\nexport const createGetRelatedProductsInput = (inputData: ICreateActionContext>): IActionInput => {\n if (inputData && inputData.requestContext && inputData.config) {\n const catalogId = getCatalogId(inputData.requestContext);\n const relationType = inputData.config.relationType;\n\n let productId = inputData.requestContext.urlTokens ? Number(inputData.requestContext.urlTokens.recordId) : 0;\n const productDetailsCriteria = getProductDetailsCriteriaFromActionInput(inputData);\n if (!relationType) {\n throw new Error('Input relation type is invalid.');\n }\n\n // Query string may override the product id from url\n if (inputData.requestContext.query && inputData.requestContext.query.productId) {\n productId = Number(inputData.requestContext.query.productId);\n }\n\n if (Number.isNaN(productId) || productId <= 0) {\n throw new Error('No valid product id available in url or query string.');\n }\n\n const queryResultSettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return new GetRelatedProductsInput(productId, catalogId, relationType, queryResultSettingsProxy, productDetailsCriteria);\n }\n\n throw new Error('Invalid input data or request context');\n};\n\nexport function searchProductRelationType(productRelationTypes: ProductRelationType[], _productRelationType: string): number | undefined {\n let foundProductRelationTypeId;\n _productRelationType = _productRelationType.toLowerCase();\n productRelationTypes.forEach((productRelationType: ProductRelationType) => {\n if (productRelationType.Name && productRelationType.Name.toLowerCase() === _productRelationType) {\n foundProductRelationTypeId = productRelationType.RecordId;\n }\n });\n\n return foundProductRelationTypeId;\n}\n\nasync function getRelatedProductsAction(input: GetRelatedProductsInput, ctx: IActionContext): Promise {\n const apiSettings = ctx.requestContext.apiSettings;\n const querySettings = input.queryResultSettingsProxy.QueryResultSettings;\n\n const productRelationTypes = await getRelationTypesAsync(\n { callerContext: ctx, queryResultSettings: querySettings },\n input.productId,\n +apiSettings.channelId,\n input.catalogId\n );\n if (!productRelationTypes) {\n ctx.trace(`[getProductRelationType] Unable to get product relation types for product ${input.productId}`);\n return [];\n }\n const productRelationTypeId = searchProductRelationType(productRelationTypes, input.relationType);\n if (!productRelationTypeId) {\n ctx.trace(`[getRelatedProducts] Unable to find relation type ${input.relationType} for product ${input.productId}`);\n return [];\n }\n\n const productInputs = await getRelatedProductsAsync(\n { callerContext: ctx, queryResultSettings: querySettings },\n input.productId,\n +apiSettings.channelId,\n input.catalogId,\n productRelationTypeId\n )\n .then(response => {\n if (response && response.length > 0) {\n return response.map(\n (product: ProductSearchResult): FullProductInput => {\n return new FullProductInput(product.RecordId, apiSettings, input.ProductDetailsCriteria, ctx.requestContext);\n }\n );\n }\n\n ctx.trace('[getRelatedProductsAction] Invalid response from server');\n return [];\n })\n .catch((error: Error) => {\n ctx.trace(error.message);\n ctx.trace(error.stack || '');\n ctx.telemetry.exception(error);\n ctx.telemetry.debug('[getRelatedProductsAction] Unable to Fetch Products.');\n ctx.trace('[getRelatedProductsAction] Unable to Fetch Products.');\n return [];\n });\n\n if (productInputs.length > 0) {\n return getFullProducts(productInputs, ctx);\n }\n return [];\n}\n\n/**\n * The getRelatedProducts data action\n * Uses a productId URL Token and finds the relation types for said product\n * using the getRelationTypes RetailServer API, and then finds and retusn all products that\n * share that relation type via the getRelatedProducts RetailServer API.\n */\nexport const getRelatedProductsActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-related-products',\n action: >getRelatedProductsAction,\n input: createGetRelatedProductsInput\n});\n\nexport default getRelatedProductsActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { SortColumn } from '@msdyn365-commerce/retail-proxy';\nimport { getSearchConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\n\nimport { buildCacheKey } from '.';\n\n// TODO: import from commerce entities when available\n// eslint-disable-next-line @typescript-eslint/naming-convention\ninterface SearchConfiguration {\n ProductSortColumns?: SortColumn[];\n}\n\n/**\n * Action Input class for the getSearchConfiguration data action.\n */\nexport class SearchConfigurationInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('SearchConfig', this.apiSettings);\n\n public getCacheObjectType = () => 'SearchConfiguration';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * Creates the input required to make the retail api call.\n * @param inputData\n */\nexport const createSearchConfigurationInput = (inputData: ICreateActionContext>): IActionInput => {\n return new SearchConfigurationInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * Calls the Retail API.\n * @param input\n * @param ctx\n */\nexport async function getSearchConfigurationAction(input: SearchConfigurationInput, ctx: IActionContext): Promise {\n return getSearchConfigurationAsync({ callerContext: ctx });\n}\n\nexport const getSearchConfigurationActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/get-search-configurations',\n action: >getSearchConfigurationAction,\n input: createSearchConfigurationInput\n});\n\nexport default getSearchConfigurationActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionInput,\n IAny,\n ICommerceApiSettings,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { ProductRefinerValue, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport { createRefineSearchByCategoryInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { retailAction } from '@msdyn365-commerce/retail-proxy/dist/retail-action';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\nimport { buildCacheKey } from './utilities/utils';\n\n/**\n * Action Input class for the refineSearchByCategory data action.\n */\nexport class RefineSearchByCriteriaInput implements IActionInput {\n public readonly categoryId?: number;\n\n public readonly channelId?: number;\n\n public readonly refinementCriteria: ProductRefinerValue[];\n\n public readonly catalogId: number;\n\n public readonly queryResultSettingsProxy: QueryResultSettingsProxy;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(\n queryResultSettingsProxy: QueryResultSettingsProxy,\n apiSettings: ICommerceApiSettings,\n categoryId?: number,\n channelId?: number,\n refinementCriteria?: ProductRefinerValue[],\n catalogId?: number\n ) {\n this.categoryId = categoryId;\n this.channelId = channelId;\n this.refinementCriteria = refinementCriteria || [];\n this.queryResultSettingsProxy = queryResultSettingsProxy;\n this.catalogId = catalogId || 0;\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => buildCacheKey('RefineSearchByCriteriaInputCache', this.apiSettings);\n\n public getCacheObjectType = () => 'RefineSearchByCriteriaInput';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\n/**\n * CreateInput method for the refineSearchByCategory data action.\n * @param inputData\n */\nexport const createInput = (inputData: ICreateActionContext>): IActionInput => {\n const refinementCriteria = inputData.config && inputData.config.refinementCriteria;\n\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.categoryId) {\n return createRefineSearchByCategoryInput(\n QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings,\n +inputData.requestContext.apiSettings.channelId,\n inputData.config ? Number(inputData.config.catalogId) : 0,\n +inputData.requestContext.query.categoryId,\n !Array.isArray(refinementCriteria)\n ? []\n : refinementCriteria.map((refinementCriterion: ProductRefinerValue) => refinementCriterion)\n );\n }\n\n throw new Error('Please specify categoryId, refinerId, and refinerSourceValue query string in request.');\n};\n\n/**\n * The RefineSearchByCategory data action\n * Uses categoryId query string parameter to call the RefinerSearchByCategory\n * RetailServer API to get information about products.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/regin-search-by-category',\n action: >retailAction,\n input: createInput\n});\n\nexport default retailActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { IDataServiceRequest, retailAction } from '@msdyn365-commerce/retail-proxy/dist';\nimport { createSearchByTextInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { ProductSearchResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { QueryResultSettingsProxy } from './utilities/QueryResultSettingsProxy';\n\n/**\n * CreateInput method for the searchByText data action.\n * @param inputData\n */\nexport function createSearchByTextInputFunc(inputData: ICreateActionContext, IGeneric>): IDataServiceRequest {\n const {\n requestContext: {\n query,\n apiSettings: { channelId }\n }\n } = inputData;\n\n const search = query && query.q;\n\n if (!search) {\n throw new Error(\n 'Unable to preform search without search text. Query string ?q={searchText} must be present or should be configued in module data.'\n );\n }\n\n const querySettingsProxy = QueryResultSettingsProxy.fromInputData(inputData);\n return createSearchByTextInput(querySettingsProxy.QueryResultSettings, Number(channelId), 0, search);\n}\n\n/**\n * The searchByText data action\n * Queries RetailServers product searchByText API using a\n * query string parameter and returns a list of ProductSearchResults.\n */\nexport const retailActionDataAction = createObservableDataAction({\n id: '@msdyn365-commerce-modules/retail-actions/search-by-text',\n action: >retailAction,\n input: createSearchByTextInputFunc\n});\n\nexport default retailActionDataAction;\n"],"names":["GetCustomerInput","constructor","apiSettings","accountNumber","cacheType","getCacheKey","buildCacheKey","this","customerAccountNumber","getCacheObjectType","dataCacheType","getCustomerActionDataAction","createObservableDataAction","id","action","async","input","ctx","requestContext","user","isAuthenticated","CustomersDataActions","callerContext","bypassCache","then","response","Array","isArray","trace","inputData","token","Error","QueryResultSettingsProxy","queryResultSettings","config","fromModuleData","sortingCriteria","undefined","query","top","skip","Paging","Skip","Number","Top","itemsPerPage","Sorting","_config$itemsPerPage","_inputData$requestCon","_inputData$requestCon2","parseInt","app","platform","defaultPageSizeForAPI","Columns","map","column","ColumnName","IsDescending","join","FeatureStateInput","featureNames","createGetFeatureStateInput","getFeatureStateAction","StoreOperationsDataActions","getPagingFromInputDataOrDefaultValue","getFeatureStateActionDataAction","getSelectedProductIdFromActionInput","_context$query","context","productId","urlTokens","itemId","pageType","generateImageUrl","imageUrl","generateImageUrlFromSdk","DimensionTypes","DimensionSwatchDisplayTypes","checkIfShouldDisplayAsSwatch","dimensionType","displayType","arguments","length","default","productCard","dimensionsToDisplayOnProductCard","dimensionsInProductCard","ArrayExtensions","hasElements","includes","none","dimensionsToDisplayAsSwatch","dimensionsAsSwatchType","generateSwatchImageUrl","startsWith","baseImageUrl","encodeURIComponent","generateProductImageUrl","product","PrimaryImageUrl","buildWishlistLine","customerId","wishlistId","CommerceListId","ProductId","CustomerId","getProductDetailsCriteriaFromActionInput","getPrice","hidePrice","getRating","hideRating","base","locale","channelId","catalogId","DefaultCacheKeyParameterKeys","generateCacheKey","_len","entries","_key","parsedEntries","pair","key","toLocaleUpperCase","value","cacheKeyArgumentsKeys","channelIdKey","push","appSettingsCatalogIdKey","sort","a","b","localeCompare","buildCacheKeyWithUrlTokens","defaultCacheKey","recordId","getFallbackImageUrl","isOmniFeatureEnabled","parsedItemId","trim","split","convertProductDimensionTypeToDimensionTypes","productDimensionType","ProductDimensionType","Color","color","Configuration","configuration","Size","size","Style","style","convertDimensionTypeToProductDimensionType","None","setDimensionValuesToQuery","inputUrl","productDimensions","dimension","_dimension$DimensionV","dimensionValue","DimensionValue","Value","StringExtensions","isNullOrWhitespace","searchParams","set","DimensionTypeValue","msdyn365Commerce","isBrowser","window","history","replaceState","state","toString","replace","host","location","parseDimensionsFromUrl","urlParameters","parsedDimensions","parseDimensionFromUrl","localDimensionType","get","RecordId","validValues","getDimensionValuesFromQuery","URL","toLocaleLowerCase","getAttributeValuesByConfiguration","attributeValues","channelInventoryConfiguration","filter","attribute","InventoryProductAttributeRecordId","ProductAvailabilitySortableAttributeRecordId","removeDomainQspFromUrl","features","remove_domain_qsp","Url","urlParams","URLSearchParams","search","has","delete","validateCatalogId","getDeliveryMode","cartLine","_channelDeliveryOptio","featureSate","channelDeliveryOptionConfig","pickupDeliveryMode","DeliveryMode","PickupDeliveryModeCodes","find","deliveryMode","isCartLineItemPickUpType","cartline","retailMulitplePickupFeatureState","pickupDeliveryModeCode","GetChannelDeliveryConfigurationInput","getChannelDeliveryOptionConfigurationAsync","SelectedVariantInput","matchingDimensionValues","getCatalogId","getSelectedVariantActionDataAction","_input$matchingDimens","_input$catalogId2","_productVariant","url","requestUrl","ProductsDataActions","_objectSpread","hasUnmatchedDimension","checkIfHasUnmatchedDimensions","Dimensions","matchedTargetDimension","targetDimension","newImageUrl","productVariant","fullDimensions","_product$Dimensions","_product$Dimensions2","dimensionTypeValues","shippingInventoryConfiguration","createInventoryAvailabilitySearchCriteria","searchCriteria","RequestedDimensionTypeValues","MatchingDimensionValues","DefaultWarehouseOnly","FilterByChannelFulfillmentGroup","DeliveryModeTypeFilterValue","CatalogId","dimensionValuesPromise","MasterProductId","fullDimensionPromises","productDimension","dimensionValuesWithAvailabilities","dimensionValueWithAvailability","dimensionValuesWithInventory","Promise","all","getFullDimensions","ProductIds","_input$catalogId","variantProductId","variantImageUrl","getProductVariant","matchedTargetDimensionFromApi","selectedProduct","GetLoyaltyCardInput","userAccountNumber","createGetLoyaltyCardInput","getLoyaltyAction","getCustomerLoyaltyCardsAsync","cards","_cards","card","CardTenderTypeValue","firstCard","getLoyaltyCardAsync","CardNumber","LoyaltyEnrollmentDate","LoyaltyEnrollmentDateLocal","catch","error","telemetry","exception","debug","message","getLoyaltyActionDataAction","ArrayBufferViewCore","$fill","toBigInt","classof","call","uncurryThis","fails","aTypedArray","exportTypedArrayMethod","slice","actualValue","count","Int8Array","fill","valueOf","globalThis","lengthOfArrayLike","toOffset","toIndexedObject","RangeError","Int8ArrayPrototype","prototype","$set","WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS","array","Uint8ClampedArray","0","TO_OBJECT_BUG","NATIVE_ARRAY_BUFFER_VIEWS","arrayLike","offset","src","len","index","aCallable","internalSort","FF","IE_OR_EDGE","V8","WEBKIT","Uint16Array","nativeSort","ACCEPT_INCORRECT_ARGUMENTS","STABLE_SORT","mod","expected","comparefn","x","y","getSortCompare","apply","arraySlice","$toLocaleString","toLocaleString","TO_LOCALE_STRING_BUG","CartConfigurationInput","createCartConfigurationInputInput","getCartConfigurationAction","CartsDataActions","getCartConfigurationDataAction","displayLabelEnabled","inventoryCode","inventoryRanges","InventoryLevelValues","available","outOfStock","mapProductInventoryInformation","productsWarehouseInventory","productInventoryInformation","enableStockCheck","inventoryLevel","InventoryLevels","physicalAvailable","physicalProductMap","mapInventoryWithPhysicalBufferEnabled","totalAvailable","totalAvailableProductMap","mapInventoryWithTotalAvailableBufferEnabled","productMap","mapInventoryWithThresholdEnabled","productWarehouseInventoryAvailability","TotalAvailable","productQty","outOfStockThreshold","productAvailableQuantity","AvailableQuantity","ProductAvailableQuantity","IsProductAvailable","InventLocationId","shouldRenderLabel","PhysicalAvailableInventoryLevelCode","productQuantity","_productWarehouseInve","MaximumPurchasablePhysicalAvailableQuantity","PhysicalAvailable","StockLevelCode","StockLevelLabel","PhysicalAvailableInventoryLevelLabel","TotalAvailableInventoryLevelCode","_productWarehouseInve2","MaximumPurchasableTotalAvailableQuantity","TotalAvailableInventoryLevelLabel","isAggregatedInventory","warehouseAggregation","mapAggregatedProductInventoryInformation","productWarehouseInventoryInformation","_productWarehouseInve3","AggregatedProductInventoryAvailabilities","_product$MaximumPurch","_product$MaximumPurch2","DataAreaId","PhysicalAvailableQuantity","TotalAvailableQuantity","ProductWarehouseInventoryAvailabilities","productIds","isDefaultWareHouse","isFilterByChannelFulfillmentGroup","searchArea","defaultDeliveryMode","shipping","inventoryAvailabilitySearchCriteria","QuantityUnitTypeValue","SearchArea","CatalogsInput","getCustomerAccountNumberForAllChannelType","createCatalogsInput","getCatalogAction","CatalogsDataActions","getCatalogActionDataAction","GetCustomerBalanceInput","createGetCustomerBalanceInput","getCustomerBalanceAction","customerInput","customer","getCustomer","getCustomerBalanceAsync","AccountNumber","InvoiceAccount","getCustomerBalanceActionDataAction","retailActionDataAction","retailAction","createGetByCustomerInput","FullProductInput","criteria","ProductDetailsCriteria","getFullProductsAction","inputs","productInputs","ProductInput","getSimpleProducts","result","ProductDetails","productCollection","validProductIds","Set","ratingsAndPricePromises","_getActivePrices","_getProductRatings","_inputs$0$catalogId","projectDomain","ChannelId","validInputs","Boolean","resolve","getActivePricesAsync","Date","forEach","productPrice","fullProduct","versionLt","retailServerProxyVersion","CustomerContextualPrice","AdjustedPrice","ProductPrice","getProductRatingsAsync","productRating","ProductRating","productDetailsCriteria","isBatched","NAME","Constructor","Prototype","NATIVE_ARRAY_BUFFER","DESCRIPTORS","isCallable","isObject","hasOwn","tryToString","createNonEnumerableProperty","defineBuiltIn","defineBuiltInAccessor","isPrototypeOf","getPrototypeOf","setPrototypeOf","wellKnownSymbol","uid","InternalStateModule","enforceInternalState","enforce","getInternalState","Uint8ClampedArrayPrototype","TypedArray","TypedArrayPrototype","ObjectPrototype","Object","TypeError","TO_STRING_TAG","TYPED_ARRAY_TAG","TYPED_ARRAY_CONSTRUCTOR","opera","TYPED_ARRAY_TAG_REQUIRED","TypedArrayConstructorsList","Uint8Array","Int16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigIntArrayConstructorsList","BigInt64Array","BigUint64Array","getTypedArrayConstructor","it","proto","isTypedArray","klass","Function","configurable","module","exports","aTypedArrayConstructor","C","KEY","property","forced","options","ARRAY","TypedArrayConstructor","error2","exportTypedArrayStaticMethod","isView","AddressInput","createGetAddressInput","getAddressAction","Addresses","getAddressActionDataAction","GetOrderTemplatesPreviewInput","createGetOrderTemplatesPreviewInput","fromInputData","QueryResultSettings","getOrderTemplatesPreview","getFullOrderTemplates","GetFullOrderTemplatesInput","getOrderTemplatesPreviewDataAction","warehouseId","getSimpleProductsAction","productIdMapping","getProductPromises","catalogIds","unique","_ctx$requestContext","_inputs$0$warehouseId","queryResult","getByIdsAsync","mappedProducts","flatten","_unused","reduce","memo","AddressManagementInput","address","createAddressManagementInput","data","doAddressManagementOperation","operationHandler","newCustomer","updatedCustomer","updateAsync","update","createReadAsync","addAddressHandler","CurrentCategoryInput","includeRootCategory","categoryId","categorySlug","isNaN","categories","tempActionContext","category","parameterizeFeatureFlags","getParameterizeFeatureFlags","parameterize","createGetCurrentCategoryInput","searchCategory","foundCategory","cat","Slug","Children","matchingChild","getCurrentCategoryAction","categoryInput","CategoriesInput","getCategoryHierarchy","getCurrentCategoryActionDataAction","ProductDeliveryOptionsForCartLineItems","getDeliveryOptionsForCartLineItems","cart","getCartState","products","getActiveCartProductsAction","ActiveCartProductsInput","getDeliveryOptionsForCartLineItemsDataAction","getInventoryLevelCodeFromDimensionValue","getInventoryLevelCodeFromProductAvailability","productAvailability","createInput","GetRatingsSummaryInput","getRnrPartnerId","getRnrEndpointId","getRatingsSummary","tenantId","inputIsValid","serviceEndpoint","sendRequest","getRatingsSummaryDataAction","mappedToHierarchy","maxItems","sitePath","_mappedToHierarchy","getLocale","getFriendlyName","nameTranslations","nameTranslation","item","Language","toLowerCase","Text","mapCategoryToHierarchy","categoryList","_rootCategory$Childre","categoryMap","localName","NameTranslations","categoryHierarchy","NeutralizedName","Name","rootCategory","values","parentId","ParentCategory","getCategoryUrl","parent","createCategoriesHierarchyInput","topItems","topCategories","getCategoryHierarchyAction","getCategoryAction","RawCategoriesInput","getCategoryHierarchyActionDataAction","MediaLocationsForSelectedVariantInput","createMediaLocationsForSelectedVariantInput","getMediaLocationsForSelectedVariantAction","AsyncResult","activeProduct","selectedVariantInput","getSelectedVariant","productResult","_ctx$requestContext$a","OmniChannelMedia","mediaLocationsInput","MediaLocationsInput","getMediaLocationsForProductAction","getMediaLocationsAsync","mediaLocation","Uri","AltText","getMediaLocationsForSelectedVariantActionDataAction","GetInvoicesInput","CreateGetInvoicesInput","InvoicePaidStatusValues","InvoicePaidStatus","getInvoices","_context$requestConte","InvoiceTypeValues","InvoiceType","SalesOrderInvoice","businessPartner","getCurrentAsync","BusinessPartnerId","SalesOrdersDataActions","getInvoicesDataAction","GetPaginatedOrderTemplateLinesInput","orderTemplateId","searchText","convertToString","getPaginatedOrderTemplateLinesAction","orderTemplateLinesState","lines","totalCount","promise","getProductListLinesAsync","productListLines","metadata","listLine","_inputData$getPrice","_inputData$getRating","OrderTemplateLine","fullProductsInfo","getFullProducts","line","productListLine","shippingProductAvailabilities","productAvailabilities","shouldDisable","errorMessage","String","_line$productListLine","_line$productListLine2","unassortedProduct","DefaultUnitOfMeasure","UnitOfMeasure","ProductTypeValue","BasePrice","Price","createGetPaginatedOrderTemplateLinesInput","name","sep","neutralizedName","candidateName","platformSettings","enableUrlLocalization","enableUrlEncoding","getCategorySlug","categoryName","getUrlSync","getInvoiceDetailsPageUrlSync","invoiceId","substr","indexOf","getProductUrlSync","getProductPageUrlSync","CurrentCategoryHierarchyInput","activeCategoryId","super","_inputData$config","activeCategoryParsedId","findCategoryHierarchy","innerCategoryHierarchy","getCurrentCategoryHierarchyAction","_findCategoryHierarch","fullCategoryHierarchy","getCategoriesHierarchy","reverse","getCurrentCategoryHierarchyActionDataAction","MediaLocationsByIdInput","createMediaLocationsByIdInput","getMediaLocationsByIdAction","getMediaLocationsByIdActionDataAction","OrderTemplate","productList","orderTemplateLines","totalLines","ObjectExtensions","isNullOrUndefined","isString","isNumber","isFunction","GetDimensionsForSelectedVariantInput","_this$_requestContext","_requestContext","getDimensionsForSelectedVariantAction","activeProducts","promises","RequestedDimensionTypeValue","_productDimension$Dim","_productDimension$Dim2","dimensionValues","dimensionValuesResults","newDimension","_newDimension$dimensi","oldDimension","DimensionValues","getDimensionsForSelectedVariantActionDataAction","args","rnr","getRnrAuthEndpointId","endpoint","proxyUrl","endsWith","substring","ProductAvailabilitiesForCartLineItems","getAvailabilitiesForCartLineItems","_featureState$find","shippingItems","bopisItems","channelConfiguration","getOrgUnitConfigurationAsync","featureState","getFeatureState","retailMultiplePickUpOptionEnabled","IsEnabled","PickupDeliveryModeCode","EmailDeliveryModeCode","Id","CartLines","getEstimatedAvailabilityAsync","productWarehouses","bopisItem","productWarehouse","WarehouseId","channel","InventLocationDataAreaId","quantityUnitTypeSales","getProductWarehouseAvail","getEstimatedProductWarehouseAvailabilityAsync","productWarehouseMapping","getAvailabilitiesForCartLineItemsDataAction","GetDeliveryOptionsForSelectedVariantInput","createDeliveryOptionsForSelectedVariantInput","getDeliveryOptionsForSelectedVariantAction","getDeliveryOptionsAsync","ItemTypeValue","ReleasedProductType","Service","FilterDeliveryModeOption","FilterOutNonPickupDeliveryMode","getDeliveryOptionsForSelectedVariantActionDataAction","ProductsDimensionAvailabilitiesInput","masterProductId","requestDimensionType","requestDimensionTypes","keys","getDimensionAvailabilitiesForProductsAction","InventoryAccuracyValue","InventoryAccuracy","Low","productsDimensions","GetFullAvailableInventoryNearbyInput","_productId","_latitude","_longitude","_radius","_DistanceUnitValue","_IgnoreLocation","latitude","longitude","radius","DistanceUnitValue","IgnoreLocation","createGetFullAvailableInventoryNearbyInput","getFullAvailableInventoryNearbyAction","Latitude","Longitude","Radius","retailMulitplePickupMFeatureState","pickup","productWarehouseInformation","getOrgUnitLocationsByAreaAsync","DeliveryModeTypeFilter","Pickup","storeMap","Map","stores","store","InventoryLocationId","locationDeliveryOptions","orgUnitChannel","channelCollection","channelIdList","getChannelDeliveryOptionsAsync","channelDeliveryOptions","_getLocationPickUpDeliveryModes","availabilityPromiseList","_locationDeliveryOpti","locationDeliveryOption","_channeldeliveryoption","orgUnitLocation","channelDeleiveryOptions","OrgUnitNumber","OrgUnitAvailability","getStoreHoursAsync","hours","itemAvailabilities","element","_element$ProductAvail","availability","OrgUnitLocation","ItemAvailabilities","ProductInventoryInformation","OrgUnitPickUpDeliveryModes","StoreHours","_getAvailabilityWithHours","getFullAvailableInventoryNearbyActionDataAction","QuickOrderTemplateLine","GetProductListLinesInput","productListId","quickOrderTemplateLinesState","ProductListsDataActions","_promise$metadata$cou","createGetProductListLinesInput","PriceForSelectedVariantInput","createActivePriceForSelectedVariantInput","getPriceForSelectedVariantAction","_featureStates$find","_featureStates$find2","featureStates","ProductType","Master","KitMaster","productPrices","getPriceForSelectedVariantActionDataAction","ProductAvailabilitiesForSelectedVariantInput","createProductAvailabilitiesForSelectedVariantInput","getProductAvailabilitiesForSelectedVariantAction","_input$selectedProduc","shippingSearchCriteria","pickupSearchCriteria","shippingAvailability","shippingInventory","deliveryType","pickupAvailability","pickupInventory","mergeProductWarehouseToProductAvailabities","productAvailable","getProductAvailabilitiesForSelectedVariantActionDataAction","cartState","_featureStates$find3","isQuantityLimitsFeatureEnabledInHq","defaultOrderQuantityLimitsFeatureConfig","enableDefaultOrderQuantityLimits","customerInfo","IsB2b","warning","getCartConfiguration","cartConfiguration","_cartConfiguration$Ig","IgnoreOrderSettings","isOrderQuantityLimitsFeatureEnabled","_cart$CartLines","productIdsByWarehouseId","resultProducts","_productIdsByWarehous","_ref","entryWarehouseId","entryProductIds","accum","getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn","hasInvoiceLine","getActiveCartProductsActionDataAction","GetOrgUnitLocationsByAreaInput","_Latitude","_Longitude","_Radius","createGetOrgUnitLocationsByAreaInput","getOrgUnitLocationsByArea","locationPromiseList","_getLocationWithHours","getOrgUnitLocationsByAreaDataAction","GetOrderTemplatesInput","_this$queryResultSett","_this$queryResultSett2","shouldCacheOutput","createGetOrderTemplatesInput","getOrderTemplatesAction","productListSearchCriteria","ProductListId","ProductListType","searchAsync","EnumExtensions","getValues","enumClass","getNumericValues","getNames","getEnumValues","isNullOrEmpty","validateCartLinesInventory","cartLines","actionContext","emailDeliveryModeCode","cartLineMap","isValid","productIdWithErrors","IsInvoiceLine","IsGiftCardLine","_cartLineMap$get","_cartLine$Quantity2","cartLineTotal","Quantity","_cartLine$Quantity","productAvailabilityMap","from","_cartLineMap$get2","_productAvailability$","cartLineQty","availableQuantity","cartLineProduct","isStockedItem","_cartLineProduct$Beha","Behavior","IsStockedProduct","isEmailDelivery","GetLoyaltyTransactionEstimationInput","createGetLoyaltyTransactionEstimationInput","getLoyaltyTransactionEstimationAction","_getCart","_getLoyalty","_getOrgUnits","getMaxLoyaltyPointsToRedeemForTransactionBalanceAsync","Currency","points","loyaltyCardInput","getLoyalty","getLoyaltyTransactionEstimationActionDataAction","ProductPickUpOptionsForCartLineItems","getPickUpOptionsForCartLineItems","getPickUpOptionsForCartLineItemsDataAction","parseSearchData","q","PromiseQueueElement","body","reject","PromiseQueue","_queue","_isBusy","promiseBody","_dequeue","_canProcess","shift","_processElement","_processNext","ArrayBuffer","DataView","toObject","toAbsoluteIndex","O","argumentsLength","end","endPos","toPrimitive","$TypeError","argument","prim","BigInt","toPositiveInteger","$RangeError","BYTES","toIntegerOrInfinity","GetAttributeDefinitionsInput","attributeDefinitionCriteria","getAttributeDefinitionsActionDataAction","CustomerAttributeGroupId","getAttributeDefinitionsAsync","AttributeGroupIdentifier","_context$apiSettings","CategoriesDataActions","GetCategoryPathsInput","categoryPathLooksups","categoryPath","createGetCategoryPathsInput","getCategoryPathsAction","categoryPathResults","getCategoryPathsAsync","CategoryPath","categoryUrl","getCategoriesUrlSync","getCategoryPathsActionDataAction","ActiveWishlistInput","getActiveWishlistItems","wishlists","getByCustomerAsync","CommerceListLines","commerceListLine","OrganizationUsersInput","createGetOrganizationUsersInput","getOrganizationUsers","getUsersAsync","users","getOrganizationUsersDataAction","OrganizationUsersCountInput","createGetOrganizationUsersCountInput","getOrganizationUsersCount","GetInvoiceDetailsInput","CreateGetInvoiceDetailsInput","getInvoiceDetails","InvoiceId","getInvoiceDetailsDataAction","getPrices","getRatings","orderTemplates","inputParams","productLists","getOrderTemplates","inputLinesRequests","list","inputLines","inputLinesResponses","productLinesResponse","GetDistributorListInput","_ChannelId","_StoreNumber","_InventoryLocationId","StoreNumber","createGetDistributorListInput","isSignedIn","params","isEditor","getDistributorListAction","searchStoreCriteria","ChannelTypeValue","OnlineStoreCustomerTypeValue","marketSettings","markets","OrgUnitsDataActions","filteredChannels","channels","some","market","_market$channelItem","channelItem","retailServerChannelId","filterChannelsBasedUponMarketSettings","channelPromiseList","channelMarketSettings","_market$channelItem2","getMarketSettingsForChannel","channelDeliveryOption","orgUnit","OrgUnit","OrgUnitDeliveryOptions","MarketSettings","_getDistributorInfo","getDistributorDataAction","ProductDimensionsWithAvailabilitiesInput","createProductDimensionsWithAvailabilitiesInput","getProductDimensionsWithAvailabilitiesAction","dimensionValuesWithAvailabilitiesPromise","getProductDimensionsWithAvailabilities","AddItemToProductListInput","quantity","unitOfMeasure","isMultipleCatalogFeatureEnabledInHq","productListLineToAdd","addItemToProductListInput","AddOrganizationUserInput","newUser","createBusinessPartnerUserAsync","createAddOrganizationUserInput","CreateProductListInput","templateName","templateType","orderTemplate","ProductListTypeValue","createdProductList","createProductListInput","DeleteOrganizationUserInput","deleteAsync","console","log","createDeleteOrganizationUserInput","EditOrganizationUserInput","updatedUser","createEditOrganizationUserInput","GenericInput","cacheKey","cacheObjectType","getGenericAction","AttributesForSelectedVariantInput","getAttributesForSelectedVariantAction","getAttributeValuesAsync","DimensionAvailabilitiesForProductSearchResultInput","dimensionContext","productsDimensionInputs","_product$AttributeVal","filteredProductAttributes","AttributeValues","attributeValue","_attributeValue$Name$","_attributeValue$Name","productionDimensionTypes","productionDimensionType","_product$MasterProduc","dimensionForProducts","productsDimensionAvailabilities","dimensionInput","_dimensionValue$Value","inventoryLevelCode","isDisabled","createDimensionAvailabilitiesForProductSearchResultInput","QuickOrderTemplate","quickOrderTemplateLines","GetFullProductListInput","inputParameters","GetProductListInput","getProductList","getProductListLines","linesState","createGetFullProductListInput","ListItemType","ListInput","documentId","title","description","shortDescription","backgroundColor","foregroundColor","images","items","productItems","itemsCount","skipCount","DocumentId","ItemsCount","ItemsPerPage","SkipCount","Title","Description","ShortDescription","BackgroundColor","ForegroundColor","Images","Items","ProductItems","getImages","resultImageList","image","href","imageItem","altText","width","height","getSubListItem","sitePathOfRequest","imageList","fields","content","sublistHref","listName","_name","Href","getSitePath","inputArray","GetProducts","listitem","listData","pageData","_id","getInutListData","listItems","parentImageList","getItemsPerPage","getSkipCount","sum","type","clonedList","productItem","GetOrganizationWideOrderHistoryInput","getOrderHistoryAsync","PriceForProductSearchResultInput","JSON","stringify","getPriceForProductSearchResultDataAction","productRecIds","productResults","activePrice","price","_activePrice$Customer","_activePrice$BasePric","_activePrice$TradeAgr","_activePrice$Adjusted","Math","max","TradeAgreementPrice","ProductPriceForSelectedProductsInput","getProductPriceForSelectedProductsDataAction","PromotionOptionsForCartLineItems","cartLineIds","c","LineId","getAvailablePromotionsAsync","GetScanResultInput","sku","skuNumber","readAsync","scanResults","Product","getDimensionsForSelectedVariant","ScanResult","ProductDimensionFull","DeliveryOptionsCartLineAddress","deliveryOptions","hasError","GetDeliveryOptionsForCartLineAddressInput","deliveryModeOption","_getDeliveryOption","cartId","deliveryOptionFilter","ignoreLinesWithNoDeliveryOptions","shippingAddress","cartLinesId","checkoutState","getCheckoutState","checkoutCart","cartLinesForShipping","groupDelivery","groupBy","_item$ShippingAddress","ShippingAddress","getGroupByDelivery","deliveryOptionsPromiseList","createDeliveryOptionsForCartLineAddressInput","IssueLoyaltyInput","updateCart","updateLoyaltyCardId","loyaltyCardNumber","issueLoyaltyCardAsync","CustomerAccount","issuedCard","AddItemToOrderTemplateInput","addProductListLinesAsync","addItemToOrderTemplateInput","AddOrderTemplateToCartInput","chunkCount","getPaginatedOrderTemplateLinesInput","addedCartLines","productLine","_productLine$fullProd","ItemId","TrackingId","UnitOfMeasureSymbol","addCartLinesAsync","Version","_error$data","_error$data2","ValidationResults","concat","refreshCart","addOrderTemplateToCartInput","CreateOrderTemplateInput","createProductListAsync","createOrderTemplateInput","GetFullOrderTemplateInput","createGetFullOrderTemplateInput","UpdateOrderTemplateHeaderInput","updatedProductList","updateOrderTemplateHeaderInput","UpdateOrderTemplateInput","getLinesInput","getPaginatedOrderTemplateLines","linesToUpdate","lineToUpdate","updatedLines","updateProductListLinesAsync","updatedLine","updateOrderTemplateInput","ContactInfoType","updateCustomerAttributesInput","customerAttributes","phone","vatNumber","_customer$Contacts","primaryContact","Contacts","contact","IsPrimary","AddressTypeValue","Phone","PhoneRecordId","VatNumber","Attributes","updateCustomerPersonalizationInput","isOptOut","preferenceType","OptOutWebActivityTracking","OptOutPersonalization","Dictionary","_values","_length","keyValuePair","setValue","removeValue","hasValue","getValue","getValueWithDefaultValue","defaultValue","isEmpty","clear","getKeys","getKeyValuePairs","Event","_subscribers","subscribe","instance","unsubscribe","instanceId","unsubscribeAll","trigger","subscriber","handler","FinitePromiseQueueError","FinitePromiseQueue","maxQueueLength","InvalidMaxQueueLengthPassed","_maxQueueLength","totalElementsCount","ProcessWasDiscardedFromTheQueue","enqueue","getRandomValues","rnds8","rng","crypto","bind","msCrypto","uuid","REGEX","test","byteToHex","i","arr","validate","buf","rnds","random","Guid","Random","generateGuid","uuidv4","_guid","EmailRegex","html5EmailRegex","PasswordRegex","defaultRegex","PhoneRegex","updateAddressHandler","cur","_customer$Addresses","setPrimaryAddress","primaryAddresses","addresses","addr","firstOrDefault","predicate","arrayLine","equals","firstArray","secondArray","comparator","haveSameItems","valueFromFirstArray","valueFromSecondArray","otherItem","calculateSum","newArray","baseUrl","requestOptions","headers","oun","Authorization","cartTenderLines","cartTenderLineItem","TokenizedPaymentCard","House","CardTokenInfo","billingAddress","ThreeLetterISORegionName","Street","City","State","ZipCode","Country","toUpperCase","Address1","Zip","requestBody","receiptEmail","cartVersion","sendCommerceRequest","status","deleteAddressHandler","GetCheckoutCartInput","CartCookieName","CartCookie","Cookie","activeCart","copyAsync","createGetCustomerLoyaltyCardsInput","QuickOrder","createGetProductListInput","FullProductsRefineSearchByCategoryInput","queryResultSettingsProxy","refinementCriteria","hasSortingColumn","fullProductInputs","refineSearchByCategoryAsync","searchResults","productSearchResult","FullProductsRefineSearchByTextInput","getRefinedProducts","getRefinedFullProducts","refineSearchByTextAsync","searchInputData","AdditionalMediaLocationsForSelectedVariantInput","AdditionalMediaLocationsInput","getAdditionalMediaLocationsForProductAction","createGetOrderShipmentsHistoryInput","createGetOrgUnitConfigurationInput","ProductsByCategoryInput","cacheKeyHint","currentCategory","getCurrentCategory","searchByCategoryAsync","productSearchResults","getProducts","RefinersByCategoryInput","getRefinersByCategoryAsync","RefinersByTextInput","getRefinersByTextAsync","GetRelatedProductsInput","relationType","querySettings","productRelationTypes","getRelationTypesAsync","productRelationTypeId","_productRelationType","foundProductRelationTypeId","productRelationType","searchProductRelationType","getRelatedProductsAsync","stack","SearchConfigurationInput","getSearchConfigurationAsync","createRefineSearchByCategoryInput","refinementCriterion","querySettingsProxy","createSearchByTextInput"],"sourceRoot":""}