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B,GAC9BC,EAAIJ,EAAmBG,EAAG,GAE9B,OADAC,EAAE9T,OAAS0S,EAAiBoB,EAAGD,EAAGA,EAAGf,EAAW,OAAgB7W,IAAb2X,EAAyB,EAAIH,EAAoBG,IAC7FE,iCCdY,EAAQ,IAG/BC,CAAiB","sources":["webpack://bju-press/./src/action-overrides/add-address.action.ts?82fb","webpack://bju-press/./src/action-overrides/get-categories-hierarchy.action.ts?9e9a","webpack://bju-press/./src/action-overrides/get-category-paths.action.ts?d3b3","webpack://bju-press/./src/action-overrides/get-checkout-cart.action.ts?9cde","webpack://bju-press/./src/action-overrides/get-invoice.action.ts?b253","webpack://bju-press/./src/action-overrides/get-invoices.action.ts?ef98","webpack://bju-press/./src/action-overrides/plp-actions/url-utils.ts?de8b","webpack://bju-press/./src/action-overrides/plp-actions/base-collection-action.ts?20cd","webpack://bju-press/./src/action-overrides/plp-actions/get-product-refiner-hierarchy.ts?f588","webpack://bju-press/./src/action-overrides/plp-actions/get-inventory-refiners.ts?996f","webpack://bju-press/./src/action-overrides/plp-actions/get-full-products-by-collection.ts?6356","webpack://bju-press/./src/action-overrides/plp-actions/get-refiners-for-collection.action.ts?5bc0","webpack://bju-press/./lib/__local__/module-registration.js?8a42","webpack://bju-press/external var \"React\"?0d3b","webpack://bju-press/external var \"ReactDOM\"?853b","webpack://bju-press/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/does-not-exceed-safe-integer.js?683b","webpack://bju-press/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/flatten-into-array.js?04fb","webpack://bju-press/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.array.flat.js?58b6","webpack://bju-press/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.array.unscopables.flat.js?62f8"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy';\r\nimport { createReadAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\r\n\r\nimport { GetCustomerInput, getCustomer } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { getAddressPurposesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\n\r\nexport interface IAddressManagementData {\r\n address: Address;\r\n}\r\nexport interface IAddressManagementInput extends IActionInput {\r\n address: Address;\r\n userAccountNumber?: string;\r\n}\r\n\r\n/**\r\n * The input class for the addAddress data action.\r\n */\r\nexport class AddressManagementInput implements IAddressManagementInput {\r\n public address: Address;\r\n\r\n public userAccountNumber?: string;\r\n\r\n constructor(address: Address, userAccountNumber?: string) {\r\n this.userAccountNumber = userAccountNumber;\r\n this.address = address;\r\n }\r\n\r\n public getCacheKey = () => 'AddAddress';\r\n\r\n public getCacheObjectType = () => 'AddAddress';\r\n\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * The createInput method for the addAddress data action.\r\n * @param inputData The input data passed to the createInput method.\r\n */\r\nexport const createAddressManagementInput = (\r\n inputData: ICreateActionContext, IAddressManagementData>\r\n): IAddressManagementInput => {\r\n if (inputData.requestContext.user.isAuthenticated) {\r\n throw new Error('User is not authenticated. Cannot call UpdateAddress API');\r\n }\r\n\r\n const { address } = inputData.data || { address: undefined };\r\n\r\n if (!address) {\r\n throw new Error('address is not provided. Cannot call UpdateAddress API');\r\n }\r\n\r\n return new AddressManagementInput(address);\r\n};\r\n\r\nexport async function doAddressManagementOperation(\r\n input: IAddressManagementInput,\r\n ctx: IActionContext,\r\n operationHandler: (customer: Customer, address: Address) => Customer\r\n): Promise {\r\n const { userAccountNumber, address } = input;\r\n\r\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, userAccountNumber, 'none');\r\n const customer = await getCustomer(customerInput, ctx);\r\n\r\n if (!customer) {\r\n throw new Error('Not able to create customer');\r\n }\r\n\r\n const newCustomer = operationHandler({ ...customer }, address);\r\n const updatedCustomer = await updateAsync({ callerContext: ctx }, newCustomer);\r\n\r\n if (!updatedCustomer) {\r\n throw new Error('Not able to update customer');\r\n }\r\n\r\n ctx.update(createReadAsync(updatedCustomer.AccountNumber), updatedCustomer);\r\n\r\n return updatedCustomer.Addresses || [];\r\n}\r\n\r\nexport function addAddressHandler(customer: Customer, address: Address): Customer {\r\n customer.Addresses = [...(customer.Addresses || [])];\r\n customer.Addresses.push(address);\r\n return customer;\r\n}\r\n\r\nexport async function addAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\r\n\r\n // @CUSTOM: default address type to delivery\r\n const addressPurposes = await getAddressPurposesAsync({callerContext: ctx}) || [];\r\n const defaultAddressType = addressPurposes.find(p => {\r\n return p.Name === 'Delivery';\r\n });\r\n input.address.LogisticsLocationRoleRecordId = defaultAddressType?.RecordId;\r\n input.address.AddressTypeValue = defaultAddressType?.AddressType;\r\n //-------------------------------------------------------------------------------------\r\n\r\n return doAddressManagementOperation(input, ctx, addAddressHandler);\r\n}\r\n\r\n/**\r\n * The addAddress data action\r\n * Calls the read RetailServer API to get information about a customer\r\n * Adds the passed address information to the retireved customer, and\r\n * then updates that customer via the update RetailServer API.\r\n */\r\nexport const addAddressActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/add-address',\r\n action: >addAddressAction,\r\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\r\n isBatched: false\r\n});\r\n\r\nexport default addAddressActionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getCatalogId,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { Category, TextValueTranslation } from '@msdyn365-commerce/retail-proxy';\r\n\r\n//----------------------------------------------------------\r\n// @CUSTOM: Fix imports (absolute references)\r\n//----------------------------------------------------------\r\nimport { CategoriesInput as RawCategoriesInput, getCategoryUrl, generateCacheKey, getCategories } from '@msdyn365-commerce-modules/retail-actions';\r\n//----------------------------------------------------------\r\n\r\n/**\r\n * Input for get-categories data action.\r\n */\r\nexport class CategoriesInput implements IActionInput {\r\n public readonly maxItems: number;\r\n\r\n public readonly channelId: number;\r\n\r\n public includeRootCategory?: boolean;\r\n\r\n private readonly catalogId: number;\r\n\r\n private readonly sitePath: string;\r\n\r\n private readonly _mappedToHierarchy: boolean;\r\n\r\n private readonly apiSettings: ICommerceApiSettings;\r\n\r\n private readonly locale?: string;\r\n\r\n public constructor(context: IRequestContext, mappedToHierarchy: boolean, maxItems?: number, includeRootCategory?: boolean) {\r\n this._mappedToHierarchy = mappedToHierarchy;\r\n this.includeRootCategory = includeRootCategory;\r\n this.maxItems = maxItems || 250;\r\n this.channelId = context && context.apiSettings && context.apiSettings.channelId ? +context.apiSettings.channelId : 0;\r\n this.sitePath = (context && context.sitePath) || '';\r\n this.apiSettings = context.apiSettings;\r\n this.locale = context.locale || '';\r\n this.catalogId = this.getCatalog(context); // @CUSTOM: Attempt to get the ID from the cookie if appropriate\r\n }\r\n\r\n public getCacheKey = () =>\r\n generateCacheKey(\r\n this.apiSettings,\r\n { key: 'SitePath', value: this.sitePath },\r\n { key: 'IncludeRootCategory', value: this.includeRootCategory },\r\n { key: 'Top', value: this.maxItems },\r\n { key: 'CatalogId', value: this.catalogId },\r\n { key: 'Locale', value: this.locale }\r\n );\r\n\r\n public getCacheObjectType = () => (this._mappedToHierarchy ? 'CategoryHierarchy' : 'Category');\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n\r\n public getLocale = (): string => this.locale || '';\r\n\r\n //----------------------------------------------------------\r\n // @CUSTOM\r\n //----------------------------------------------------------\r\n private getCatalog(context: IRequestContext) {\r\n const COOKIE_NAME = 'd365_catalog';\r\n\r\n // Only do something if the user is logged in\r\n if (context.user && (context.user.isB2b || context.user.isOBORequest)) {\r\n\r\n // Attempt to get catalog values from both the cookie and URL\r\n const cookieId = context.cookies.get(COOKIE_NAME); // This may even work on the server\r\n const urlId = context.query && context.query.catalogid; // This should work on the server\r\n\r\n // If catalog is in the URL, that takes precedence. Update the cookie.\r\n if (!urlId && cookieId?.value) {\r\n return +cookieId.value;\r\n }\r\n }\r\n\r\n return getCatalogId(context);\r\n }\r\n}\r\n\r\nconst getFriendlyName = (locale?: string, nameTranslations?: TextValueTranslation[]): string | undefined => {\r\n let nameTranslation: TextValueTranslation | undefined;\r\n if (locale && nameTranslations && nameTranslations.length > 0) {\r\n nameTranslation = nameTranslations.find(item => item.Language!.toLowerCase() === locale.toLowerCase());\r\n }\r\n\r\n return nameTranslation && nameTranslation.Text;\r\n};\r\n\r\nexport interface ICategoryMap {\r\n [RecordId: number]: CategoryHierarchy;\r\n}\r\n\r\n/**\r\n * Creates a hierarchy of categories based on the ParentCategory property.\r\n * @param categoryList Categories that will be converted into a hierarchy.\r\n * @param ctx\r\n * @param locale\r\n * @returns Hierarchy of categories in array.\r\n */\r\nexport const mapCategoryToHierarchy = (\r\n categoryList: Category[],\r\n ctx: IActionContext,\r\n locale?: string,\r\n includeRootCategory?: boolean\r\n): CategoryHierarchy[] => {\r\n if (!categoryList || categoryList.length === 0) {\r\n return [];\r\n }\r\n\r\n const categoryMap: ICategoryMap = {};\r\n\r\n for (const category of categoryList) {\r\n const localName = getFriendlyName(locale, category.NameTranslations);\r\n const categoryHierarchy = { ...category };\r\n categoryHierarchy.NeutralizedName = category.Name;\r\n categoryHierarchy.Name = localName || categoryHierarchy.NeutralizedName;\r\n categoryMap[category.RecordId] = categoryHierarchy;\r\n }\r\n\r\n let rootCategory: CategoryHierarchy | undefined;\r\n\r\n for (const category of Object.values(categoryMap)) {\r\n const parentId = category.ParentCategory;\r\n category.Url = getCategoryUrl(category, ctx, categoryMap);\r\n if (parentId === 0) {\r\n rootCategory = category;\r\n continue;\r\n }\r\n\r\n const parent = parentId && categoryMap[parentId];\r\n if (parent) {\r\n parent.Children = parent.Children || [];\r\n parent.Children.push(category);\r\n }\r\n }\r\n\r\n if (!rootCategory) {\r\n return [];\r\n }\r\n\r\n if (includeRootCategory) {\r\n const categoryHierarchy: CategoryHierarchy[] = [];\r\n categoryHierarchy.push(rootCategory);\r\n return categoryHierarchy;\r\n }\r\n\r\n return rootCategory.Children ?? [];\r\n};\r\n\r\n/**\r\n * Creates the input required to make the retail api call.\r\n * @param inputData\r\n */\r\nexport const createCategoriesHierarchyInput = (inputData: ICreateActionContext>): IActionInput => {\r\n const topItems = inputData.config && inputData.config.topCategories && Number.parseInt(inputData.config.topCategories, 10);\r\n return new CategoriesInput(inputData.requestContext, true, topItems);\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns all the categories as a hierarchy.\r\n * @param input\r\n * @param ctx\r\n */\r\nexport async function getCategoryHierarchyAction(input: CategoriesInput, ctx: IActionContext): Promise {\r\n const categories = await getCategories(new RawCategoriesInput(ctx.requestContext, false, input.maxItems), ctx); // @CUSTOM: Renamed data action for external access\r\n return mapCategoryToHierarchy(categories, ctx, input.getLocale(), input.includeRootCategory);\r\n}\r\n\r\nexport const getCategoryHierarchyActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-categories-hierarchy',\r\n action: >getCategoryHierarchyAction,\r\n input: createCategoriesHierarchyInput\r\n});\r\n\r\nexport default getCategoryHierarchyActionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getCatalogId,\r\n getCategoriesUrlSync,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { ICategoryPath, ICategoryUrl } from '@msdyn365-commerce/core-internal/dist/types/interfaces/ICategoryPathInterfaces';\r\nimport { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { CategoryPathLookup } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\n//----------------------------------------------------------\r\n// @CUSTOM: Fix imports (absolute references)\r\n//----------------------------------------------------------\r\nimport { QueryResultSettingsProxy, generateCacheKey, getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\r\n//----------------------------------------------------------\r\n\r\n/**\r\n * Category path input.\r\n */\r\nexport class GetCategoryPathsInput implements IActionInput {\r\n public readonly ChannelId: number;\r\n\r\n public readonly CatalogId: number;\r\n\r\n public readonly categoryPathLooksups: CategoryPathLookup[];\r\n\r\n public readonly apiSettings: ICommerceApiSettings;\r\n\r\n private readonly locale: string;\r\n\r\n private _requestContext: IRequestContext;\r\n\r\n public constructor(context: IRequestContext, categoryPathLooksups: CategoryPathLookup[]) {\r\n this._requestContext = context;\r\n this.ChannelId = context.apiSettings.channelId;\r\n this.CatalogId = this.getCatalog(context); // @CUSTOM: Attempt to get the ID from the cookie if appropriate\r\n this.categoryPathLooksups = categoryPathLooksups;\r\n this.apiSettings = context.apiSettings;\r\n this.locale = context.locale;\r\n }\r\n\r\n public getCacheKey = () =>\r\n generateCacheKey(\r\n this._requestContext.apiSettings,\r\n { key: 'CategoryPathProductIds', value: this.categoryPathLooksups.map(categoryPath => categoryPath.ProductId) },\r\n { key: 'CatalogId', value: this.CatalogId },\r\n { key: 'locale', value: this.locale }\r\n );\r\n\r\n public getCacheObjectType = () => 'CategoryPath';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n\r\n /**\r\n * Retrieves locale to use for the current API call.\r\n * @returns A string which represents locale.\r\n */\r\n public getLocale = (): string => this.locale;\r\n\r\n //----------------------------------------------------------\r\n // @CUSTOM\r\n //----------------------------------------------------------\r\n private getCatalog(context: IRequestContext) {\r\n const COOKIE_NAME = 'd365_catalog';\r\n\r\n // Only do something if the user is logged in\r\n if (context.user && (context.user.isB2b || context.user.isOBORequest)) {\r\n\r\n // Attempt to get catalog values from both the cookie and URL\r\n const cookieId = context.cookies.get(COOKIE_NAME); // This may even work on the server\r\n const urlId = context.query && context.query.catalogid; // This should work on the server\r\n\r\n // If catalog is in the URL, that takes precedence. Update the cookie.\r\n if (!urlId && cookieId?.value) {\r\n return +cookieId.value;\r\n }\r\n }\r\n\r\n return getCatalogId(context);\r\n }\r\n}\r\n\r\n/**\r\n * Creates the input required to make the getCategoryPath retail api call.\r\n * @param inputData\r\n */\r\nexport const createGetCategoryPathsInput = (inputData: ICreateActionContext>): IActionInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n if (productId) {\r\n return new GetCategoryPathsInput(inputData.requestContext, [{ ProductId: +productId }]);\r\n }\r\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns the category path for a product.\r\n * @param input\r\n * @param ctx\r\n */\r\nexport async function getCategoryPathsAction(input: GetCategoryPathsInput, ctx: IActionContext): Promise {\r\n const categoryPathResults = await getCategoryPathsAsync(\r\n {\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n },\r\n input.ChannelId,\r\n input.CatalogId,\r\n input.categoryPathLooksups\r\n );\r\n const categoryPath = categoryPathResults[0].CategoryPath && categoryPathResults[0].CategoryPath[0];\r\n const categoryUrl = getCategoriesUrlSync(categoryPath, ctx);\r\n if (categoryUrl) {\r\n /* Do not return the root category of the product*/\r\n return categoryUrl.slice(1);\r\n }\r\n return [];\r\n}\r\n\r\nexport const getCategoryPathsActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-category-paths',\r\n action: >getCategoryPathsAction,\r\n input: createGetCategoryPathsInput\r\n});\r\n\r\nexport default getCategoryPathsActionDataAction;\r\n","//==============================================================================\r\n// Extended version of global state's get-cart-state action\r\n//\r\n// The base version will check for the checkout cart cookie. If it exists, that\r\n// cart will be loaded. Otherwise, it will copy the regular cart to a new cart.\r\n//\r\n// This version will maintain standard functionality unless a specific query\r\n// parameter exists in the URL.\r\n// If the query parameter exists, a new cart will be constructed with products\r\n// from the query string.\r\n// It would be better to return an empty cart and leave cart population to\r\n// external code, but an empty cart will cause checkout to redirect.\r\n// Intercepting and adding contents before the redirect would be messier than\r\n// adding cart construction to this data action.\r\n//\r\n// NOTES:\r\n// This assumes all products are available in the current catalog. Catalog isn't included in the URL.\r\n// If we add discounts or catalogs, consider encoding the URL for light-weight protection\r\n//==============================================================================\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n getCatalogId,\r\n} from '@msdyn365-commerce/core';\r\nimport { Cart, CartType } from '@msdyn365-commerce/retail-proxy';\r\nimport { getCartState } from '@msdyn365-commerce/global-state';\r\nimport { copyAsync, readAsync, createCartAsync, addCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\n\r\n//==============================================================================\r\n// INTERFACES\r\n//==============================================================================\r\ninterface ProductAddRequest {\r\n recId: number\r\n quantity: number\r\n}\r\n\r\n//==============================================================================\r\n// INPUT\r\n//==============================================================================\r\n\r\n//==========================================================\r\n// Input class for getCheckoutCart data action.\r\n//==========================================================\r\nexport class GetCheckoutCartInput implements IActionInput {\r\n private readonly apiSettings: ICommerceApiSettings;\r\n public readonly catalogId: number;\r\n\r\n constructor(apiSettings: ICommerceApiSettings, catalogId?: number) {\r\n this.apiSettings = apiSettings;\r\n this.catalogId = catalogId || 0;\r\n }\r\n\r\n public getCacheKey = () => `CheckoutCart-chanId:${this.apiSettings.channelId}-catId:${this.catalogId}`;\r\n public getCacheObjectType = () => 'CheckoutCart';\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\n//==========================================================\r\n//==========================================================\r\nconst createInput = (inputData: ICreateActionContext) => {\r\n const catalogId = getCatalogId(inputData.requestContext);\r\n return new GetCheckoutCartInput(inputData.requestContext.apiSettings, catalogId);\r\n};\r\n\r\n//==============================================================================\r\n// ACTION\r\n//==============================================================================\r\nenum CartTokenPrefix {\r\n Auth = 't',\r\n Anon = 'p'\r\n}\r\n\r\n//==========================================================\r\n//==========================================================\r\nexport async function getCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\r\n\r\n // Determine whether to use the standard version, or the self-populating version\r\n // @TODO/dg: Make the query param case-insensitive\r\n const useSelfPopulating = !!(ctx.requestContext.query?.cart);\r\n\r\n return useSelfPopulating ? getPopulatedCheckoutCart(input, ctx) : standardGetCheckoutCart(input, ctx);\r\n}\r\n\r\n//==========================================================\r\n// Stand-alone Version\r\n//==========================================================\r\nasync function getPopulatedCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\r\n\r\n // Parse the request\r\n const cartRequest = parseCartRequest(ctx.requestContext.query!.cart);\r\n\r\n // Ensure there's at least a single product in the request\r\n if (cartRequest.length > 0) {\r\n\r\n // Create an empty checkout cart\r\n let cart = await createCartAsync({ callerContext: ctx, bypassCache: 'none' }, {CartTypeValue: CartType.Checkout} as Cart);\r\n\r\n // Add items to the cart\r\n cart = await addCartLinesAsync({ callerContext: ctx}, cart.Id, cartRequest.map(entry => ({\r\n CatalogId: input.catalogId,\r\n EntryMethodTypeValue: 3, // @FIXME/dg: Set this by name (which name??)\r\n ProductId: entry.recId,\r\n Quantity: entry.quantity,\r\n })));\r\n\r\n return cart;\r\n }\r\n return undefined;\r\n}\r\n\r\n//==========================================================\r\n// Parse requests passed in via query parameter\r\n//\r\n// Format: recId:qty,recId:qty,...\r\n//==========================================================\r\nfunction parseCartRequest(request: string): ProductAddRequest[] {\r\n\r\n // Split the string into a series of item/quantity pairs and process each one\r\n return request.split(',').reduce(\r\n (output: ProductAddRequest[], entry) => {\r\n\r\n // Split item record ID and quantity\r\n const [recId, qty] = entry.split(':');\r\n\r\n // Add to the list if the rec ID and quantity are valid\r\n if (+recId && +qty) {\r\n output.push({\r\n recId: +recId,\r\n quantity: +qty,\r\n });\r\n }\r\n return output;\r\n },\r\n []\r\n );\r\n}\r\n\r\n//==========================================================\r\n// LEGACY VERSION: Data action to copy the cart for checkout actions.\r\n//==========================================================\r\nasync function standardGetCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\r\n const savedCheckoutCartId = ctx.requestContext.cookies.getCheckoutCartCookie();\r\n const cartCookieParts: string[] = savedCheckoutCartId.split(':');\r\n\r\n let checkoutCartId = null;\r\n const isAuthenticated = ctx.requestContext.user.isAuthenticated;\r\n if (\r\n (isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Auth) ||\r\n (!isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Anon)\r\n ) {\r\n checkoutCartId = cartCookieParts[1];\r\n }\r\n\r\n let checkoutCart: Cart | undefined;\r\n if (checkoutCartId) {\r\n try {\r\n checkoutCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, checkoutCartId);\r\n } catch (error) {\r\n ctx.telemetry.error('Error getting checkout cart based on saved checkout card id');\r\n ctx.telemetry.exception(error as Error);\r\n }\r\n }\r\n\r\n const cartState = await getCartState(ctx);\r\n if (cartState && cartState.cart.Id !== undefined) {\r\n if (checkoutCart && checkoutCart.Version && cartState.cart.Version && checkoutCart.Version > cartState.cart.Version) {\r\n // @CUSTOM - fix for pickup\r\n if (checkoutCart.DeliveryMode === 'Pickup-PDC') {\r\n checkoutCart.ShippingAddress = {};\r\n }\r\n return Promise.resolve(checkoutCart);\r\n }\r\n return copyAsync({ callerContext: ctx }, cartState.cart.Id, 2)\r\n .then(cart => {\r\n ctx.requestContext.cookies.setCheckoutCartCookie(cart, isAuthenticated);\r\n return cart;\r\n })\r\n .catch(error => {\r\n ctx.telemetry.error('Error copying cart');\r\n ctx.telemetry.exception(error);\r\n return undefined;\r\n });\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n//==============================================================================\r\n// DEFINITION\r\n//==============================================================================\r\nexport const getCheckoutCartDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce/global-state/get-checkout-cart',\r\n action: >getCheckoutCart,\r\n input: createInput\r\n});\r\n\r\nexport default getCheckoutCartDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n InvoicePaidStatus,\r\n InvoiceSearchCriteria,\r\n InvoiceType,\r\n OrderInvoice,\r\n SalesOrdersDataActions\r\n} from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * Input class for get invoice data action.\r\n */\r\nexport class GetInvoiceInput implements IActionInput {\r\n public invoiceId: string;\r\n\r\n constructor(invoiceId: string) {\r\n this.invoiceId = invoiceId;\r\n }\r\n\r\n public getCacheKey = () => `GetInvoice|${this.invoiceId}`;\r\n\r\n public getCacheObjectType = () => 'OrderInvoice';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nexport const CreateGetInvoiceInput = (inputData: ICreateActionContext): IActionInput => {\r\n const { requestContext } = inputData;\r\n\r\n // Check if the user is authenticated.\r\n if (!requestContext.user.isAuthenticated) {\r\n throw new Error('Unable to get invoice as User is not logged in.');\r\n }\r\n if (!inputData?.requestContext?.query?.invoiceId) {\r\n throw new Error('Unable to get invoice as no valid invoice id found.');\r\n }\r\n\r\n return new GetInvoiceInput(inputData.requestContext.query.invoiceId);\r\n};\r\n\r\nexport async function getInvoice(input: GetInvoiceInput, context: IActionContext): Promise {\r\n if (!context?.requestContext?.user?.isAuthenticated) {\r\n throw new Error('Unable to get invoice. User is not authenticated.');\r\n }\r\n\r\n if (!input.invoiceId) {\r\n throw new Error('Unable to get invoice as no valid invoice id found.');\r\n }\r\n\r\n const invoiceId = input.invoiceId;\r\n const isB2C = context.requestContext.apiSettings.channelCustomerType === 'B2C';\r\n\r\n const searchCriteria: InvoiceSearchCriteria = {\r\n CustomerId: isB2C ? context?.requestContext?.user.customerAccountNumber : undefined, // @CUSTOM: We need to include the Customer ID for B2C mode since there's no organization\r\n InvoiceIds: [invoiceId],\r\n InvoiceTypeValues: [InvoiceType.SalesOrderInvoice],\r\n InvoicePaidStatusValues: [InvoicePaidStatus.None]\r\n };\r\n\r\n const invoices = await SalesOrdersDataActions.getInvoicesAsync({ callerContext: context }, searchCriteria);\r\n if (!invoices || invoices.length !== 1) {\r\n throw new Error('Unable to get invoice from the server.');\r\n }\r\n\r\n return invoices[0];\r\n}\r\n\r\nexport default createObservableDataAction({\r\n id: 'get-invoice',\r\n action: >getInvoice,\r\n input: CreateGetInvoiceInput\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n InvoicePaidStatus,\r\n InvoiceSearchCriteria,\r\n InvoiceType,\r\n IQueryResultSettings,\r\n OrderInvoice,\r\n SalesOrdersDataActions\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { getCurrentAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/BusinessPartnersDataActions.g';\r\n\r\n//----------------------------------------------------------\r\n//----------------------------------------------------------\r\n// @CUSTOM: Fix imports (absolute references)\r\nimport { getCustomer, GetCustomerInput, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\n//----------------------------------------------------------\r\n\r\nconst getDefaultSearchCriteria = (): InvoiceSearchCriteria => {\r\n return {\r\n InvoicePaidStatusValues: [InvoicePaidStatus.None]\r\n };\r\n};\r\n\r\n/**\r\n * Input class for get invoice data action.\r\n */\r\nexport class GetInvoicesInput implements IActionInput {\r\n public readonly searchCriteria: InvoiceSearchCriteria;\r\n\r\n public readonly queryResultSettings: IQueryResultSettings;\r\n\r\n constructor(searchCriteria: InvoiceSearchCriteria, queryResultSettings: IQueryResultSettings) {\r\n this.searchCriteria = searchCriteria;\r\n this.queryResultSettings = queryResultSettings;\r\n }\r\n\r\n public getCacheKey = () => 'BusinessPartnerInvoices';\r\n\r\n public getCacheObjectType = () => 'OrderInvoice';\r\n\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nexport const CreateGetInvoicesInput = (inputData: ICreateActionContext): IActionInput => {\r\n const { requestContext } = inputData;\r\n\r\n // Check if the user is authenticated.\r\n if (!requestContext.user.isAuthenticated) {\r\n throw new Error('User is not logged in.');\r\n }\r\n\r\n const queryResultSettings: IQueryResultSettings = QueryResultSettingsProxy.fromInputData(inputData).QueryResultSettings;\r\n\r\n return new GetInvoicesInput(getDefaultSearchCriteria(), queryResultSettings);\r\n};\r\n\r\nexport async function getInvoices(input: GetInvoicesInput, context: IActionContext): Promise {\r\n if (!context?.requestContext?.user?.isAuthenticated) {\r\n throw new Error('Unable to get list of invoices. User is not authenticated.');\r\n }\r\n\r\n input.searchCriteria.InvoiceTypeValues = [InvoiceType.SalesOrderInvoice];\r\n\r\n const businessPartner = await getCurrentAsync({ callerContext: context });\r\n input.searchCriteria.BusinessPartnerId = businessPartner?.BusinessPartnerId; // @CUSTOM: Added \"?\" for safety. There's no business partner in B2C mode.\r\n\r\n const customer = await getCustomer(new GetCustomerInput(context.requestContext.apiSettings), context);\r\n input.searchCriteria.CustomerId = customer.AccountNumber;\r\n\r\n return SalesOrdersDataActions.getInvoicesAsync(\r\n { callerContext: context, queryResultSettings: input.queryResultSettings },\r\n input.searchCriteria\r\n );\r\n}\r\n\r\nexport const getInvoicesDataAction = createObservableDataAction({\r\n id: 'get-invoices',\r\n action: >getInvoices,\r\n input: CreateGetInvoicesInput\r\n});\r\n\r\nexport default getInvoicesDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport MsDyn365, { IRequestContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue, SortColumn } from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * Refiner Compression:\r\n * Refiners contains a non-trivial amount of data that is required to successfully make\r\n * a refiner-based API call. To allow for deep-linking of refiners in the URL, refiner data\r\n * must be compressed so that URL max length is not exceeded. Refiners will be compressed into\r\n * the following array style index-based format:\r\n * [DataTypeValue, LeftValueBoundString, RefinerRecordId, RefinerSourceValue, RightValueBoundString, UnitText].\r\n */\r\nconst compressedRefinerKeys = [\r\n 'DataTypeValue',\r\n 'LeftValueBoundString',\r\n 'RefinerRecordId',\r\n 'RefinerSourceValue',\r\n 'RightValueBoundString',\r\n 'UnitText'\r\n];\r\n\r\n/**\r\n * Hydrates compressed refiner data from URL.\r\n * @param fullUrl The full URL of the page.\r\n * @param requestContext\r\n */\r\nexport const hydrateRefinersFromUrl = (requestContext: IRequestContext): ProductRefinerValue[] => {\r\n const compressedRefinerArray = parseQueryParam<(string | number)[][]>('refiners', requestContext);\r\n if (!compressedRefinerArray || compressedRefinerArray.length === 0) {\r\n return [];\r\n }\r\n\r\n return compressedRefinerArray\r\n .map(compressedRefiner => {\r\n try {\r\n const parsedRefiner: ProductRefinerValue = {};\r\n compressedRefinerKeys.forEach((refinerKey, index) => {\r\n parsedRefiner[refinerKey] = compressedRefiner[index];\r\n });\r\n return parsedRefiner;\r\n } catch {\r\n return undefined;\r\n }\r\n })\r\n .filter(Boolean);\r\n};\r\n\r\n/**\r\n * Compressed a list of refiners for use in URLs.\r\n * @param refiners The uncompressed refiners.\r\n */\r\nexport const compressRefiners = (refiners: ProductRefinerValue[]) => {\r\n const compressedRefiners: (string | number)[][] = [];\r\n\r\n refiners.forEach(refiner => {\r\n const compressedRefiner: (string | number)[] = [];\r\n compressedRefinerKeys.forEach(refinerKey => {\r\n compressedRefiner.push(refiner[refinerKey]);\r\n });\r\n compressedRefiners.push(compressedRefiner);\r\n });\r\n\r\n return compressedRefiners;\r\n};\r\n\r\n/**\r\n * Method which creates a URL contiaining serialized active refiners.\r\n * @param fullUrl The Current URL of the page.\r\n * @param refiners The refiners which should be added to the URL.\r\n * @param sortingColumns\r\n * @param skipCount\r\n */\r\nexport const buildListPageUrl = (fullUrl: URL, refiners?: ProductRefinerValue[], sortingColumns?: SortColumn[], skipCount?: number) => {\r\n // Refiner Change flow\r\n if (refiners !== undefined) {\r\n if (refiners.length === 0) {\r\n fullUrl.searchParams.delete('refiners');\r\n } else {\r\n const sortedRefiners = refiners.sort((first, second) =>\r\n first.RefinerRecordId && second.RefinerRecordId && first.RefinerRecordId > second.RefinerRecordId ? 1 : -1\r\n );\r\n fullUrl.searchParams.set('refiners', JSON.stringify(compressRefiners(sortedRefiners)));\r\n }\r\n\r\n // Adding or removing a refiner means we want to always load page 1\r\n fullUrl.searchParams.delete('skip');\r\n return fullUrl.href;\r\n }\r\n\r\n if (sortingColumns !== undefined) {\r\n if (sortingColumns.length === 0) {\r\n fullUrl.searchParams.delete('sorting');\r\n } else {\r\n fullUrl.searchParams.set('sorting', JSON.stringify(sortingColumns));\r\n }\r\n\r\n // Changing the sort means always load page 1\r\n fullUrl.searchParams.delete('skip');\r\n return fullUrl.href;\r\n }\r\n\r\n if (skipCount) {\r\n fullUrl.searchParams.set('skip', skipCount.toString());\r\n }\r\n\r\n return fullUrl.href;\r\n};\r\n\r\n/**\r\n * Parses a query param from the query object of the request context.\r\n * @param key The query parameter key.\r\n * @param requestContext The request context.\r\n */\r\nexport const parseQueryParam = (key: string, requestContext: IRequestContext): T | null => {\r\n if (requestContext.query && requestContext.query[key]) {\r\n return JSON.parse(decodeURIComponent(requestContext.query[key]));\r\n }\r\n return null;\r\n};\r\n\r\n/**\r\n * Gets the current URL of the page from the request context.\r\n * @param requestContext The request context.\r\n */\r\nexport const getCurrentUrl = (requestContext: IRequestContext): URL => {\r\n if (MsDyn365.isBrowser) {\r\n return new URL(window.location.href);\r\n }\r\n\r\n // NOTE: Typing on requestURL is incorrect\r\n if (requestContext.url.requestUrl.href) {\r\n return new URL(requestContext.url.requestUrl.href);\r\n }\r\n return new URL((requestContext.url.requestUrl));\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { CacheType, getCatalogId, IActionInput, IAny, ICommerceApiSettings, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport {\r\n convertToString,\r\n ChannelInventoryConfiguration,\r\n IQueryResultSettings,\r\n ProductRefinerValue,\r\n SortColumn\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { generateCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { toJS } from 'mobx';\r\n\r\nimport { hydrateRefinersFromUrl } from './url-utils';\r\n\r\n/**\r\n * Export listPageType.\r\n */\r\nexport type listPageType = 'Category' | 'Search' | 'Unknown';\r\n\r\n/**\r\n * Get include attributes from config.\r\n * @param inputData - ICreateActionContext.\r\n * @returns Boolean.\r\n */\r\nfunction getIncludeAttributes(inputData: ICreateActionContext, IGeneric>): boolean {\r\n if (inputData && inputData.config && inputData.config.includeAttributes !== undefined && inputData.config.includeAttributes === true) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Get updateRefinerPanel from config.\r\n * @param inputData - ICreateActionContext.\r\n * @returns Boolean.\r\n */\r\nfunction getUpdateRefinerPanel(inputData: ICreateActionContext, IGeneric>): boolean {\r\n return !!inputData.config?.updateRefinerPanel;\r\n}\r\n\r\n/**\r\n * BaseCollection Action Input.\r\n */\r\nexport class BaseCollectionInput implements IActionInput {\r\n public pageType: listPageType;\r\n\r\n public category: number | undefined;\r\n\r\n public searchText: string | undefined;\r\n\r\n public refiners: ProductRefinerValue[];\r\n\r\n public queryResultSettings: IQueryResultSettings;\r\n\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public includeAttributes: boolean | undefined;\r\n\r\n public locale?: string;\r\n\r\n public isUpdateRefinerPanel?: boolean;\r\n\r\n public catalogId?: number;\r\n\r\n public channelInventoryConfiguration?: ChannelInventoryConfiguration;\r\n\r\n public inventoryRefiner?: IProductRefinerHierarchy;\r\n\r\n public constructor(\r\n pageType: listPageType,\r\n apiSettings: ICommerceApiSettings,\r\n queryResultSettings: IQueryResultSettings,\r\n refiners: ProductRefinerValue[],\r\n category: number | undefined,\r\n searchText: string | undefined,\r\n includeAttributes: boolean | undefined,\r\n isUpdateRefinerPanel?: boolean | undefined,\r\n locale?: string,\r\n catalogId?: number,\r\n channelInventoryConfiguration?: ChannelInventoryConfiguration,\r\n inventoryRefiner?: IProductRefinerHierarchy\r\n ) {\r\n this.pageType = pageType;\r\n this.apiSettings = apiSettings;\r\n this.category = category;\r\n this.searchText = searchText;\r\n this.queryResultSettings = queryResultSettings;\r\n this.refiners = refiners;\r\n this.includeAttributes = includeAttributes;\r\n this.isUpdateRefinerPanel = isUpdateRefinerPanel;\r\n this.locale = locale;\r\n this.catalogId = catalogId ?? 0;\r\n this.channelInventoryConfiguration = channelInventoryConfiguration;\r\n this.inventoryRefiner = inventoryRefiner;\r\n }\r\n\r\n public getCacheKey = () => {\r\n const queryResultSettings = {\r\n ...this.queryResultSettings.Paging,\r\n ...toJS(this.queryResultSettings.Sorting)\r\n };\r\n\r\n const cacheKey = generateCacheKey(\r\n this.apiSettings,\r\n { key: 'PageType', value: this.pageType },\r\n { key: 'Category', value: this.category },\r\n { key: 'SearchText', value: this.searchText },\r\n { key: 'CatalogId', value: this.catalogId },\r\n {\r\n key: 'Refiners',\r\n value: this.refiners.map(\r\n refiner =>\r\n `RefinerRecordId:${refiner.RefinerRecordId}-LeftValueBoundString:${refiner.LeftValueBoundString ||\r\n ''}-RightValueBoundString:${refiner.RightValueBoundString || ''}`\r\n )\r\n },\r\n { key: 'QueryResultSettings', value: convertToString(queryResultSettings) },\r\n { key: 'Locale', value: this.locale }\r\n );\r\n return cacheKey;\r\n };\r\n\r\n public getCacheObjectType = () => 'CollectionActionResult';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetFullProductsByCollectionData {\r\n text: string;\r\n}\r\n\r\nexport type CollectionClassConstructor = new (\r\n pageType: listPageType,\r\n apiSettings: ICommerceApiSettings,\r\n queryResultSettings: IQueryResultSettings,\r\n refiners: ProductRefinerValue[],\r\n category: number | undefined,\r\n searchText: string | undefined,\r\n includeAttributes: boolean | undefined,\r\n isUpdateRefinerPanel?: boolean | undefined,\r\n locale?: string,\r\n catalogId?: number,\r\n channelInventoryConfiguration?: ChannelInventoryConfiguration,\r\n inventoryRefiner?: IProductRefinerHierarchy\r\n) => BaseCollectionInput;\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call.\r\n * @param args\r\n * @param inputClassConstuctor\r\n */\r\nexport const createBaseCollectionInput = (\r\n args: ICreateActionContext,\r\n inputClassConstuctor: CollectionClassConstructor\r\n): BaseCollectionInput => {\r\n const pageType =\r\n args.requestContext.urlTokens.pageType === 'Category' || (args.requestContext.query && args.requestContext.query.categoryId)\r\n ? 'Category'\r\n : 'Search';\r\n\r\n const queryResultSettings = QueryResultSettingsProxy.fromInputData(args).QueryResultSettings;\r\n const queryRefiners = hydrateRefinersFromUrl(args.requestContext);\r\n const includeAttributes = getIncludeAttributes(args);\r\n const isUpdateRefinerPanel = getUpdateRefinerPanel(args);\r\n const catalogId = getCatalogId(args.requestContext);\r\n\r\n if (args.requestContext.query && args.requestContext.query.sorting) {\r\n queryResultSettings.Sorting = { Columns: JSON.parse(decodeURIComponent(args.requestContext.query.sorting)) };\r\n }\r\n\r\n if (pageType === 'Category') {\r\n return new inputClassConstuctor(\r\n pageType,\r\n args.requestContext.apiSettings,\r\n queryResultSettings,\r\n queryRefiners,\r\n +(args.requestContext.urlTokens.itemId || (args.requestContext.query && args.requestContext.query.categoryId) || 0),\r\n undefined,\r\n includeAttributes,\r\n isUpdateRefinerPanel,\r\n args.requestContext.locale,\r\n catalogId\r\n );\r\n } else if (pageType === 'Search' && args.requestContext.query && args.requestContext.query.q) {\r\n return new inputClassConstuctor(\r\n pageType,\r\n args.requestContext.apiSettings,\r\n queryResultSettings,\r\n queryRefiners,\r\n undefined,\r\n args.requestContext.query.q,\r\n includeAttributes,\r\n isUpdateRefinerPanel,\r\n args.requestContext.locale,\r\n catalogId\r\n );\r\n } else if (pageType === 'Search' && args.requestContext.query && args.requestContext.query.recommendation) {\r\n let searchText = '';\r\n if (args.requestContext.query.productId) {\r\n searchText = JSON.stringify({\r\n ProductId: args.requestContext.query.productId,\r\n Recommendation: args.requestContext.query.recommendation\r\n });\r\n } else {\r\n searchText = JSON.stringify({ Recommendation: args.requestContext.query.recommendation });\r\n }\r\n return new inputClassConstuctor(\r\n pageType,\r\n args.requestContext.apiSettings,\r\n queryResultSettings,\r\n queryRefiners,\r\n undefined,\r\n searchText,\r\n includeAttributes,\r\n isUpdateRefinerPanel,\r\n args.requestContext.locale,\r\n catalogId\r\n );\r\n }\r\n\r\n throw new Error('[getFullProductsForCollection]Unable to create input');\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { IActionContext } from '@msdyn365-commerce/core';\r\nimport { IQueryResultSettings, ProductRefiner, ProductSearchCriteria } from '@msdyn365-commerce/retail-proxy';\r\nimport { getProductSearchRefinersAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\n/**\r\n * Uses Bulk refiner API to get refiners and child refiner values.\r\n * @param searchCriteria Product search criteria.\r\n * @param maxItems Max items.\r\n * @param queryResultSettings\r\n * @param ctx Action context.\r\n */\r\nexport async function getProductRefinerHierarchy(\r\n searchCriteria: ProductSearchCriteria,\r\n queryResultSettings: IQueryResultSettings,\r\n ctx: IActionContext\r\n): Promise {\r\n return getProductSearchRefinersAsync({ callerContext: ctx, queryResultSettings }, searchCriteria).then(\r\n (productRefiners: ProductRefiner[]) => {\r\n if (!productRefiners) {\r\n ctx.trace('[getRefinersByCriteriaAction] returned no refiners');\r\n return [];\r\n }\r\n\r\n const result = (productRefiners || []).map((productRefiner: ProductRefiner) => productRefiner);\r\n\r\n if (result.length === 0) {\r\n ctx.trace('[getRefinersByCriteriaAction] returned no IProductRefinerHierarchy objects');\r\n return [];\r\n }\r\n\r\n // @CUSTOM sort refiners\r\n result.forEach(refiner => {\r\n // Sort the \"Values\" array based on the \"LeftValueBoundString\" field\r\n refiner.Values = refiner.Values.flat().sort((a, b) => {\r\n const leftValueA = (a.LeftValueBoundString || '').toLowerCase();\r\n const leftValueB = (b.LeftValueBoundString || '').toLowerCase();\r\n\r\n if (leftValueA < leftValueB) {\r\n return -1;\r\n }\r\n if (leftValueA > leftValueB) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n });\r\n\r\n return result;\r\n }\r\n );\r\n}\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\r\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { BaseCollectionInput } from './base-collection-action';\r\nimport { getProductRefinerHierarchy } from './get-product-refiner-hierarchy';\r\n\r\n/**\r\n * InventoryInStockRefinerValue Input action.\r\n */\r\nexport class InventoryInStockRefinerValueInput extends BaseCollectionInput implements IActionInput {\r\n public inventoryProductAttributeRecordId: number;\r\n\r\n public constructor(input: BaseCollectionInput, inventoryProductAttributeRecordId: number = 0) {\r\n super(\r\n input.pageType,\r\n input.apiSettings,\r\n {\r\n count: true\r\n },\r\n\r\n // Parameter - refiners\r\n [],\r\n\r\n // Parameter - category\r\n undefined,\r\n\r\n // Parameter - searchText\r\n '',\r\n\r\n // Parameter - includeAttributes\r\n false,\r\n\r\n // Parameter - isUpdateRefinerPanel\r\n false,\r\n\r\n // Parameter - locale\r\n undefined,\r\n input.catalogId,\r\n input.channelInventoryConfiguration,\r\n input.inventoryRefiner\r\n );\r\n\r\n this.inventoryProductAttributeRecordId =\r\n inventoryProductAttributeRecordId || input.channelInventoryConfiguration?.InventoryProductAttributeRecordId || 0;\r\n }\r\n\r\n /**\r\n * GetCacheKey.\r\n * @returns - Returns string.\r\n */\r\n public getCacheKey = (): string => buildCacheKey('RefinerList', this.apiSettings);\r\n\r\n /**\r\n * GetCacheObjectType.\r\n * @returns - Returns string.\r\n */\r\n public getCacheObjectType = (): string => 'RefinerList';\r\n\r\n /**\r\n * DataCacheType.\r\n * @returns - CacheType string.\r\n */\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * Action method returns inventory in stock refiners.\r\n * @param input - InventoryInStockRefinerValueInput.\r\n * @param context - IActionContext.\r\n * @returns - Promise.\r\n */\r\nasync function action(input: InventoryInStockRefinerValueInput, context: IActionContext): Promise {\r\n const refiners = await getProductRefinerHierarchy(\r\n {\r\n Context: {\r\n ChannelId: input.apiSettings.channelId,\r\n CatalogId: input.catalogId\r\n }\r\n },\r\n input.queryResultSettings,\r\n context\r\n );\r\n\r\n // InventoryProductAttributeRecordId may be 0, and recId of default refiner Category/Price/Rating is always 0 by design. In this case, we should not return refiner\r\n // Why recId of default refiner Category/Price/Rating is 0: see GetChannelProductRefiners.sql\r\n return (\r\n (input.channelInventoryConfiguration?.InventoryProductAttributeRecordId !== 0 &&\r\n refiners.find(refiner => refiner.RecordId === input.channelInventoryConfiguration?.InventoryProductAttributeRecordId)) ||\r\n // keep legacy logic to avoid break existing customers usage from this file\r\n (input.inventoryProductAttributeRecordId !== 0 &&\r\n refiners.find(refiner => refiner.RecordId === input.inventoryProductAttributeRecordId)) ||\r\n null\r\n );\r\n}\r\n\r\n/**\r\n * Action.\r\n * @param id - Id.\r\n * @param action - Action.\r\n * @returns - Results.\r\n */\r\nexport const actionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/search-result-container/get-inventory-refiners',\r\n action: action as IAction\r\n});\r\n\r\nexport default actionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n AsyncResult,\r\n ChannelInventoryConfiguration,\r\n ProductRefinerValue,\r\n ProductSearchCriteria,\r\n ProductSearchResult\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { searchByCriteriaAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { getInventoryConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { ArrayExtensions, generateProductImageUrl, InventoryLevels } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { BaseCollectionInput, createBaseCollectionInput } from './base-collection-action';\r\nimport getInventoryRefinerAction, { InventoryInStockRefinerValueInput } from './get-inventory-refiners';\r\n\r\n/**\r\n * GetFullProductsByCollection Action Input.\r\n */\r\nexport class GetFullProductsByCollectionInput extends BaseCollectionInput implements IActionInput {\r\n /**\r\n * The cache object type.\r\n * @returns The cache object type.\r\n */\r\n public getCacheObjectType = (): string => 'FullProductSearchResult';\r\n\r\n /**\r\n * The data cache type.\r\n * @returns The data cache type.\r\n */\r\n public dataCacheType = (): CacheType => {\r\n if (\r\n this.pageType !== 'Category' ||\r\n (this.refiners && this.refiners.length > 0) ||\r\n (this.queryResultSettings &&\r\n this.queryResultSettings.Sorting &&\r\n this.queryResultSettings.Sorting.Columns &&\r\n this.queryResultSettings.Sorting.Columns.length > 0)\r\n ) {\r\n return 'request';\r\n }\r\n return 'application';\r\n };\r\n}\r\n\r\n/**\r\n * This setting defines inventory filtering options.\r\n */\r\nexport enum ProductListInventoryFilteringOptions {\r\n /**\r\n * Filter out all products out of stock.\r\n */\r\n HideOOS = 'hideOOS',\r\n\r\n /**\r\n * Sort products by availability, OOS goes last.\r\n */\r\n SortOOS = 'sortOOS',\r\n\r\n /**\r\n * No filtering selected.\r\n */\r\n Default = 'default'\r\n}\r\n\r\n/**\r\n * The full product search result with count interface.\r\n */\r\nexport interface IFullProductsSearchResultsWithCount {\r\n products: ProductSearchResult[];\r\n count: number;\r\n channelInventoryConfigurationId?: number;\r\n inventoryAwareSortableAttributeId?: number;\r\n}\r\n\r\n/**\r\n * CreateInput function which creates and actionInput used to fetch products for a list page.\r\n * @param args - The API arguments.\r\n * @returns IActionInput - The action input.\r\n */\r\nconst createInput = (args: ICreateActionContext<{ itemsPerPage: number; includedAttributes: boolean | undefined }>): IActionInput => {\r\n const input = createBaseCollectionInput(args, GetFullProductsByCollectionInput);\r\n\r\n // Set Top\r\n if (input.queryResultSettings.Paging && args.config) {\r\n input.queryResultSettings.Paging.Top = args.config.itemsPerPage || 1;\r\n }\r\n\r\n // Set Skip\r\n if (input.queryResultSettings.Paging && args.requestContext.query && args.requestContext.query.skip) {\r\n input.queryResultSettings.Paging.Skip = +args.requestContext.query.skip;\r\n }\r\n\r\n input.queryResultSettings.count = true;\r\n\r\n return input;\r\n};\r\n\r\n/**\r\n * Returns inventory in stock refiner value.\r\n * @param input - The inventory refiner input.\r\n * @param context - The request context.\r\n * @param channelInventoryConfiguration - The channelInventoryConfiguration.\r\n * @returns Refiners.\r\n */\r\nasync function getInventoryInStockRefinerValueAsync(\r\n input: GetFullProductsByCollectionInput,\r\n context: IActionContext,\r\n channelInventoryConfiguration: ChannelInventoryConfiguration\r\n): Promise {\r\n let inventoryRefiner = input.inventoryRefiner;\r\n // For hydrate, the inventory refiner is not added on input parameter, need to query the inventory refiner\r\n // For reaction in browser, the inventory refiner is added in componentDidMount of search-result-container\r\n if (!inventoryRefiner) {\r\n const refinerInput = new InventoryInStockRefinerValueInput(input, channelInventoryConfiguration.InventoryProductAttributeRecordId);\r\n inventoryRefiner = await getInventoryRefinerAction(refinerInput, context);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- inventoryRefiner may be null\r\n return (\r\n inventoryRefiner?.Values.find(\r\n value =>\r\n value.LeftValueBoundString !== channelInventoryConfiguration.InventoryOutOfStockAttributeValueText &&\r\n value.RightValueBoundString !== channelInventoryConfiguration.InventoryOutOfStockAttributeValueText\r\n ) ?? null\r\n );\r\n}\r\n\r\n/**\r\n * Returns list of products based on inventory information.\r\n * @param productSearchResults - The products.\r\n * @param context - The context.\r\n * @param metadataCount - The metadata count.\r\n * @param channelInventoryConfiguration - The channel inventory configuration.\r\n * @returns List of product based on the inventory information.\r\n */\r\nexport async function returnProducts(\r\n productSearchResults: ProductSearchResult[],\r\n context: IActionContext,\r\n metadataCount: number | undefined,\r\n channelInventoryConfiguration?: ChannelInventoryConfiguration\r\n): Promise {\r\n const defaultProductCount: number = 0;\r\n\r\n const productSearchResultsWithImages = productSearchResults.map(productSearchResult => {\r\n const newImageUrl = generateProductImageUrl(productSearchResult, context.requestContext.apiSettings);\r\n\r\n if (newImageUrl) {\r\n productSearchResult.PrimaryImageUrl = newImageUrl;\r\n }\r\n\r\n return productSearchResult;\r\n });\r\n\r\n // If inventory level is threshold or inventory check is disabled then return the list of products without the inventory configuration\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- read config file.\r\n if (\r\n context.requestContext.app.config.inventoryLevel === InventoryLevels.threshold ||\r\n context.requestContext.app.config.enableStockCheck === false\r\n ) {\r\n return {\r\n products: productSearchResultsWithImages,\r\n count: metadataCount ?? defaultProductCount\r\n };\r\n }\r\n\r\n const mappedProducts = productSearchResultsWithImages.map(productSearchResult => {\r\n if (ArrayExtensions.hasElements(productSearchResult.AttributeValues)) {\r\n for (const element of productSearchResult.AttributeValues) {\r\n if (\r\n channelInventoryConfiguration &&\r\n element.RecordId !== undefined &&\r\n element.RecordId === channelInventoryConfiguration.InventoryProductAttributeRecordId &&\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- read config file.\r\n context.requestContext.app.config.inventoryRanges !== 'all' &&\r\n element.TextValue !== channelInventoryConfiguration.InventoryOutOfStockAttributeValueText\r\n ) {\r\n // If same RecordId then it means that is the Inventory attribute\r\n // Based on the inventory range (and filtering options), the inventory label will be displayed\r\n // If Inventory range is 'All' then in stock and out of stock labels are shown, else only OOS\r\n // if the text value is different that the channelInventoryConfiguration.InventoryOutOfStockAttributeValueText then is in stock\r\n element.TextValue = '';\r\n }\r\n }\r\n }\r\n\r\n return productSearchResult;\r\n });\r\n\r\n return {\r\n products: mappedProducts,\r\n count: metadataCount ?? defaultProductCount,\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- check config.\r\n channelInventoryConfigurationId: channelInventoryConfiguration\r\n ? channelInventoryConfiguration.InventoryProductAttributeRecordId\r\n : undefined,\r\n inventoryAwareSortableAttributeId: channelInventoryConfiguration\r\n ? channelInventoryConfiguration.ProductAvailabilitySortableAttributeRecordId\r\n : undefined\r\n };\r\n}\r\n\r\n/**\r\n * Action function to fetch products for a list page.\r\n * @param input - The input.\r\n * @param context - The context.\r\n * @returns IFullProductsSearchResultsWithCount - The full product search result with count.\r\n */\r\n// eslint-disable-next-line complexity -- ignore the complexity.\r\nasync function action(input: GetFullProductsByCollectionInput, context: IActionContext): Promise {\r\n let promise: AsyncResult;\r\n let channelInventoryConfigurationPromise: AsyncResult;\r\n let searchProductId;\r\n const searchCriteriaInput: ProductSearchCriteria = {};\r\n searchCriteriaInput.Context = { ChannelId: context.requestContext.apiSettings.channelId, CatalogId: input.catalogId };\r\n searchCriteriaInput.Refinement = input.refiners;\r\n searchCriteriaInput.IncludeAttributes = input.includeAttributes;\r\n searchCriteriaInput.SkipVariantExpansion = true;\r\n const defaultNumber: number = 0;\r\n\r\n if (input.channelInventoryConfiguration) {\r\n channelInventoryConfigurationPromise = AsyncResult.resolve(input.channelInventoryConfiguration);\r\n } else {\r\n channelInventoryConfigurationPromise = getInventoryConfigurationAsync({ callerContext: context });\r\n }\r\n const channelInventoryConfiguration = await channelInventoryConfigurationPromise;\r\n\r\n if (context.requestContext.app.config?.productListInventoryDisplay === ProductListInventoryFilteringOptions.HideOOS) {\r\n const inventoryInStockRefinerValue = await getInventoryInStockRefinerValueAsync(input, context, channelInventoryConfiguration);\r\n\r\n const isInventoryInStockRefinerValueExist = searchCriteriaInput.Refinement.some(\r\n refiner => refiner.RefinerRecordId === inventoryInStockRefinerValue?.RefinerRecordId\r\n );\r\n if (!isInventoryInStockRefinerValueExist && inventoryInStockRefinerValue) {\r\n searchCriteriaInput.Refinement.push(inventoryInStockRefinerValue);\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- app configs are of generic type\r\n if (\r\n context.requestContext.app.config?.productListInventoryDisplay === ProductListInventoryFilteringOptions.SortOOS &&\r\n channelInventoryConfiguration.ProductAvailabilitySortableAttributeRecordId\r\n ) {\r\n input.queryResultSettings.Sorting = input.queryResultSettings.Sorting ?? {};\r\n input.queryResultSettings.Sorting.Columns = input.queryResultSettings.Sorting.Columns ?? [];\r\n const sortColumnName = `Attr_${channelInventoryConfiguration.ProductAvailabilitySortableAttributeRecordId}`;\r\n const isSortAttributeExist = input.queryResultSettings.Sorting.Columns.some(column => column.ColumnName === sortColumnName);\r\n if (!isSortAttributeExist) {\r\n input.queryResultSettings.Sorting.Columns.push({\r\n ColumnName: sortColumnName,\r\n IsDescending: true\r\n });\r\n }\r\n }\r\n\r\n if (input.pageType === 'Category' || context.requestContext.query?.categoryId) {\r\n if (input.category) {\r\n searchCriteriaInput.CategoryIds = [input.category || defaultNumber];\r\n promise = searchByCriteriaAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: input.queryResultSettings\r\n },\r\n searchCriteriaInput\r\n );\r\n } else {\r\n throw new Error('[GetFullProductsForCollection]Category Page Detected, but no global categoryId found');\r\n }\r\n } else if (input.searchText && context.requestContext.query?.q) {\r\n searchCriteriaInput.SearchCondition = input.searchText;\r\n promise = searchByCriteriaAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: input.queryResultSettings\r\n },\r\n searchCriteriaInput\r\n );\r\n } else if (input.searchText && context.requestContext.query && context.requestContext.query.recommendation) {\r\n const searchObject = JSON.parse(input.searchText);\r\n if (context.requestContext.query.productId) {\r\n searchProductId = Number(searchObject.ProductId);\r\n }\r\n if (Number.isNaN(searchProductId)) {\r\n throw new Error('Failed to cast search product id into a number.');\r\n } else if (\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Existing code\r\n !searchObject.Recommendation\r\n ) {\r\n throw new Error('Failed to retrieve the Recommendation.');\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- Existing code\r\n searchCriteriaInput.RecommendationListId = searchObject.Recommendation;\r\n if (searchProductId) {\r\n searchCriteriaInput.Ids = [searchProductId || defaultNumber];\r\n }\r\n promise = searchByCriteriaAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: input.queryResultSettings\r\n },\r\n searchCriteriaInput\r\n );\r\n }\r\n } else {\r\n throw new Error('[GetFullProductsForCollection]Search Page Detected, but no q= or productId= query parameter found');\r\n }\r\n\r\n const productSearchResults = await promise;\r\n return returnProducts(productSearchResults, context, promise.metadata.count, channelInventoryConfiguration);\r\n}\r\n\r\nexport const actionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/search-result-container/get-full-products-by-collection',\r\n action: action as IAction,\r\n input: createInput\r\n});\r\n\r\nexport default actionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { AsyncResult, ChannelInventoryConfiguration, ProductRefinerValue, ProductSearchCriteria } from '@msdyn365-commerce/retail-proxy';\r\nimport { getInventoryConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\n\r\nimport { BaseCollectionInput, createBaseCollectionInput } from './base-collection-action';\r\nimport { getProductRefinerHierarchy } from './get-product-refiner-hierarchy';\r\nimport { ProductListInventoryFilteringOptions } from './get-full-products-by-collection';\r\nimport getInventoryRefinerAction, { InventoryInStockRefinerValueInput } from './get-inventory-refiners';\r\n\r\n/**\r\n * Default Category/Product Id Values.\r\n */\r\nenum DefaultValues {\r\n defaultCategoryIdValue = 0,\r\n defaultProductIdValue = 0\r\n}\r\n\r\n/**\r\n * Refiners-by-Collection Input action.\r\n */\r\nexport class RefinersByCollectionInput extends BaseCollectionInput implements IActionInput {\r\n public getCacheObjectType = () => 'ProductRefiner';\r\n\r\n public dataCacheType = () => {\r\n if (\r\n this.pageType !== 'Category' ||\r\n (this.refiners && this.refiners.length > 0) ||\r\n (this.queryResultSettings &&\r\n this.queryResultSettings.Sorting &&\r\n this.queryResultSettings.Sorting.Columns &&\r\n this.queryResultSettings.Sorting.Columns.length > 0)\r\n ) {\r\n return 'request';\r\n }\r\n return 'application';\r\n };\r\n}\r\n\r\n/**\r\n * Create input method which creates an ActionInput for fetching list page refiners.\r\n * @param args\r\n */\r\nconst createInput = (args: ICreateActionContext): IActionInput => {\r\n return createBaseCollectionInput(args, RefinersByCollectionInput);\r\n};\r\n\r\n/**\r\n * Returns inventory in stock refiner value.\r\n * @param input - The inventory refiner input.\r\n * @param context - The request context.\r\n * @param channelInventoryConfiguration - The channelInventoryConfiguration.\r\n * @returns Refiners.\r\n */\r\nasync function getInventoryInStockRefinerValueAsync(\r\n input: RefinersByCollectionInput,\r\n context: IActionContext,\r\n channelInventoryConfiguration: ChannelInventoryConfiguration\r\n): Promise {\r\n let inventoryRefiner = input.inventoryRefiner;\r\n // For hydrate, the inventory refiner is not added on input parameter, need to query the inventory refiner\r\n // For reaction in browser, the inventory refiner is added in componentDidMount of search-result-container\r\n if (!inventoryRefiner) {\r\n const refinerInput = new InventoryInStockRefinerValueInput(input, channelInventoryConfiguration.InventoryProductAttributeRecordId);\r\n inventoryRefiner = await getInventoryRefinerAction(refinerInput, context);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- inventoryRefiner may be null\r\n return (\r\n inventoryRefiner?.Values.find(\r\n value =>\r\n value.LeftValueBoundString !== channelInventoryConfiguration.InventoryOutOfStockAttributeValueText &&\r\n value.RightValueBoundString !== channelInventoryConfiguration.InventoryOutOfStockAttributeValueText\r\n ) ?? null\r\n );\r\n}\r\n\r\n/**\r\n * Action method which fetches refiners for the given list page.\r\n * @param input\r\n * @param context\r\n */\r\nasync function action(input: RefinersByCollectionInput, context: IActionContext): Promise {\r\n let searchProductId;\r\n const refiners: ProductRefinerValue[] = input.refiners || [];\r\n\r\n if (context.requestContext.app.config?.productListInventoryDisplay === ProductListInventoryFilteringOptions.HideOOS) {\r\n let channelInventoryConfigurationPromise: AsyncResult;\r\n if (input.channelInventoryConfiguration) {\r\n channelInventoryConfigurationPromise = AsyncResult.resolve(input.channelInventoryConfiguration);\r\n } else {\r\n channelInventoryConfigurationPromise = getInventoryConfigurationAsync({ callerContext: context });\r\n }\r\n const channelInventoryConfiguration = await channelInventoryConfigurationPromise;\r\n const inventoryInStockRefinerValue = await getInventoryInStockRefinerValueAsync(input, context, channelInventoryConfiguration);\r\n\r\n const isInventoryInStockRefinerValueExist = refiners.some(\r\n refiner => refiner.RefinerRecordId === inventoryInStockRefinerValue?.RefinerRecordId\r\n );\r\n if (!isInventoryInStockRefinerValueExist && inventoryInStockRefinerValue) {\r\n refiners.push(inventoryInStockRefinerValue);\r\n }\r\n }\r\n\r\n if (input.pageType === 'Category') {\r\n if (input.category) {\r\n return getProductRefinerHierarchy(\r\n {\r\n CategoryIds: [input.category || DefaultValues.defaultCategoryIdValue],\r\n Context: {\r\n ChannelId: input.apiSettings.channelId,\r\n CatalogId: input.catalogId\r\n },\r\n Refinement: input.isUpdateRefinerPanel ? refiners : []\r\n },\r\n input.queryResultSettings,\r\n context\r\n );\r\n }\r\n throw new Error('[GetRefinersForCollection]Category Page Detected, but no global categoryId found');\r\n } else {\r\n if (input.searchText && context.requestContext.query && context.requestContext.query.q) {\r\n return getProductRefinerHierarchy(\r\n {\r\n SearchCondition: input.searchText,\r\n Context: {\r\n ChannelId: input.apiSettings.channelId,\r\n CatalogId: input.catalogId\r\n },\r\n Refinement: input.isUpdateRefinerPanel ? refiners : []\r\n },\r\n input.queryResultSettings,\r\n context\r\n );\r\n }\r\n if (input.searchText && context.requestContext.query && context.requestContext.query.recommendation) {\r\n const searchObject = JSON.parse(input.searchText);\r\n if (context.requestContext.query.productId) {\r\n searchProductId = Number(searchObject.ProductId);\r\n }\r\n if (Number.isNaN(searchProductId)) {\r\n throw new Error('Failed to cast search product id into a number.');\r\n } else if (!searchObject.Recommendation) {\r\n throw new Error('Failed to retrieve the Recommendation.');\r\n } else {\r\n const searchCriteriaInput: ProductSearchCriteria = {};\r\n searchCriteriaInput.Context = {\r\n ChannelId: input.apiSettings.channelId,\r\n CatalogId: input.catalogId\r\n };\r\n searchCriteriaInput.Refinement = input.isUpdateRefinerPanel ? refiners : [];\r\n searchCriteriaInput.RecommendationListId = searchObject.Recommendation;\r\n if (searchProductId) {\r\n searchCriteriaInput.Ids = [searchProductId || DefaultValues.defaultProductIdValue];\r\n }\r\n return getProductRefinerHierarchy(searchCriteriaInput, input.queryResultSettings, context);\r\n }\r\n } else {\r\n throw new Error('[GetFullProductsForCollection]Search Page Detected, but no q= or productId= query parameter found');\r\n }\r\n }\r\n}\r\n\r\nexport const actionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/search-result-container/get-refiners-for-collection',\r\n action: >action,\r\n input: createInput\r\n});\r\n\r\nexport default actionDataAction;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n { \n const actionPath = 'action-overrides/add-address.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/add-address.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/get-categories-hierarchy.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/get-categories-hierarchy.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/get-category-paths.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/get-category-paths.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/get-checkout-cart.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/get-checkout-cart.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/get-invoice.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/get-invoice.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/get-invoices.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/get-invoices.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'action-overrides/plp-actions/get-refiners-for-collection.action';\n binding.dataActions[actionPath] = require('partner/action-overrides/plp-actions/get-refiners-for-collection.action');\n registerActionId(actionPath);\n }\n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.packageDataActions = {};\n window.__bindings__.packageDataActions['__local__'] = {\n ...binding.dataActions\n };","module.exports = React;","module.exports = ReactDOM;","'use strict';\nvar $TypeError = TypeError;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991\n\nmodule.exports = function (it) {\n if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');\n return it;\n};\n","'use strict';\nvar isArray = require('../internals/is-array');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');\nvar bind = require('../internals/function-bind-context');\n\n// `FlattenIntoArray` abstract operation\n// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray\nvar flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {\n var targetIndex = start;\n var sourceIndex = 0;\n var mapFn = mapper ? bind(mapper, thisArg) : false;\n var element, elementLen;\n\n while (sourceIndex < sourceLen) {\n if (sourceIndex in source) {\n element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];\n\n if (depth > 0 && isArray(element)) {\n elementLen = lengthOfArrayLike(element);\n targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;\n } else {\n doesNotExceedSafeInteger(targetIndex + 1);\n target[targetIndex] = element;\n }\n\n targetIndex++;\n }\n sourceIndex++;\n }\n return targetIndex;\n};\n\nmodule.exports = flattenIntoArray;\n","'use strict';\nvar $ = require('../internals/export');\nvar flattenIntoArray = require('../internals/flatten-into-array');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\n// `Array.prototype.flat` method\n// https://tc39.es/ecma262/#sec-array.prototype.flat\n$({ target: 'Array', proto: true }, {\n flat: function flat(/* depthArg = 1 */) {\n var depthArg = arguments.length ? arguments[0] : undefined;\n var O = toObject(this);\n var sourceLen = lengthOfArrayLike(O);\n var A = arraySpeciesCreate(O, 0);\n A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));\n return A;\n }\n});\n","'use strict';\n// this method was added to unscopables after implementation\n// in popular engines, so it's moved to a separate module\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('flat');\n"],"names":["AddressManagementInput","constructor","address","userAccountNumber","getCacheKey","getCacheObjectType","dataCacheType","this","createAddressManagementInput","inputData","requestContext","user","isAuthenticated","Error","data","undefined","async","doAddressManagementOperation","input","ctx","operationHandler","customerInput","GetCustomerInput","apiSettings","customer","getCustomer","newCustomer","_objectSpread","updatedCustomer","updateAsync","callerContext","update","createReadAsync","AccountNumber","Addresses","addAddressHandler","push","addAddressAction","defaultAddressType","getAddressPurposesAsync","find","p","Name","LogisticsLocationRoleRecordId","RecordId","AddressTypeValue","AddressType","addAddressActionDataAction","createObservableDataAction","id","action","isBatched","CategoriesInput","context","mappedToHierarchy","maxItems","includeRootCategory","generateCacheKey","key","value","sitePath","catalogId","locale","_mappedToHierarchy","getLocale","channelId","getCatalog","isB2b","isOBORequest","cookieId","cookies","get","query","catalogid","getCatalogId","getFriendlyName","nameTranslations","nameTranslation","length","item","Language","toLowerCase","Text","mapCategoryToHierarchy","categoryList","_rootCategory$Childre","categoryMap","category","localName","NameTranslations","categoryHierarchy","NeutralizedName","rootCategory","Object","values","parentId","ParentCategory","Url","getCategoryUrl","parent","Children","createCategoriesHierarchyInput","topItems","config","topCategories","Number","parseInt","getCategoryHierarchyAction","categories","getCategories","RawCategoriesInput","getCategoryHierarchyActionDataAction","GetCategoryPathsInput","categoryPathLooksups","_requestContext","map","categoryPath","ProductId","CatalogId","ChannelId","createGetCategoryPathsInput","productId","getSelectedProductIdFromActionInput","getCategoryPathsAction","categoryPathResults","getCategoryPathsAsync","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","CategoryPath","categoryUrl","getCategoriesUrlSync","slice","getCategoryPathsActionDataAction","GetCheckoutCartInput","CartTokenPrefix","getCheckoutCart","_ctx$requestContext$q","cart","cartRequest","request","split","reduce","output","entry","recId","qty","quantity","createCartAsync","bypassCache","CartTypeValue","CartType","Checkout","addCartLinesAsync","Id","EntryMethodTypeValue","Quantity","getPopulatedCheckoutCart","cartCookieParts","getCheckoutCartCookie","checkoutCartId","Auth","Anon","checkoutCart","readAsync","error","telemetry","exception","cartState","getCartState","Version","DeliveryMode","ShippingAddress","Promise","resolve","copyAsync","then","setCheckoutCartCookie","catch","standardGetCheckoutCart","getCheckoutCartDataAction","GetInvoiceInput","invoiceId","CreateGetInvoiceInput","_inputData$requestCon","getInvoice","_context$requestConte","_context$requestConte2","searchCriteria","CustomerId","channelCustomerType","customerAccountNumber","InvoiceIds","InvoiceTypeValues","InvoiceType","SalesOrderInvoice","InvoicePaidStatusValues","InvoicePaidStatus","None","invoices","SalesOrdersDataActions","GetInvoicesInput","CreateGetInvoicesInput","fromInputData","QueryResultSettings","getInvoices","businessPartner","getCurrentAsync","BusinessPartnerId","getInvoicesDataAction","compressedRefinerKeys","parseQueryParam","JSON","parse","decodeURIComponent","BaseCollectionInput","pageType","refiners","searchText","includeAttributes","isUpdateRefinerPanel","channelInventoryConfiguration","inventoryRefiner","Paging","toJS","Sorting","refiner","RefinerRecordId","LeftValueBoundString","RightValueBoundString","convertToString","createBaseCollectionInput","args","inputClassConstuctor","urlTokens","categoryId","queryRefiners","compressedRefinerArray","compressedRefiner","parsedRefiner","forEach","refinerKey","index","_unused","filter","Boolean","hydrateRefinersFromUrl","_inputData$config","updateRefinerPanel","getUpdateRefinerPanel","sorting","Columns","itemId","q","recommendation","stringify","Recommendation","getProductRefinerHierarchy","getProductSearchRefinersAsync","productRefiners","trace","result","productRefiner","Values","flat","sort","a","b","leftValueA","leftValueB","InventoryInStockRefinerValueInput","_input$channelInvento","inventoryProductAttributeRecordId","arguments","super","count","buildCacheKey","InventoryProductAttributeRecordId","_input$channelInvento2","Context","_input$channelInvento3","GetFullProductsByCollectionInput","ProductListInventoryFilteringOptions","_context$requestConte3","_context$requestConte4","promise","channelInventoryConfigurationPromise","searchProductId","searchCriteriaInput","Refinement","IncludeAttributes","SkipVariantExpansion","AsyncResult","getInventoryConfigurationAsync","app","productListInventoryDisplay","HideOOS","inventoryInStockRefinerValue","_inventoryRefiner$Val","_inventoryRefiner","refinerInput","getInventoryRefinerAction","InventoryOutOfStockAttributeValueText","getInventoryInStockRefinerValueAsync","some","SortOOS","ProductAvailabilitySortableAttributeRecordId","_input$queryResultSet","_input$queryResultSet2","sortColumnName","column","ColumnName","IsDescending","CategoryIds","searchByCriteriaAsync","SearchCondition","searchObject","isNaN","RecommendationListId","Ids","productSearchResults","metadataCount","productSearchResultsWithImages","productSearchResult","newImageUrl","generateProductImageUrl","PrimaryImageUrl","inventoryLevel","InventoryLevels","threshold","enableStockCheck","products","ArrayExtensions","hasElements","AttributeValues","element","inventoryRanges","TextValue","channelInventoryConfigurationId","inventoryAwareSortableAttributeId","returnProducts","metadata","Top","itemsPerPage","skip","Skip","DefaultValues","RefinersByCollectionInput","actionDataAction","defaultCategoryIdValue","defaultProductIdValue","binding","modules","dataActions","registerActionId","actionPath","default","prototype","keys","exportName","Action","require","window","__bindings__","packageDataActions","module","exports","React","ReactDOM","$TypeError","TypeError","it","isArray","lengthOfArrayLike","doesNotExceedSafeInteger","bind","flattenIntoArray","target","original","source","sourceLen","start","depth","mapper","thisArg","elementLen","targetIndex","sourceIndex","mapFn","$","toObject","toIntegerOrInfinity","arraySpeciesCreate","proto","depthArg","O","A","addToUnscopables"],"sourceRoot":""}