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/dobbies-category-page-summary/dobbies-category-page-summary.action.ts?c3db","webpack://Dobbies.Commerce/./src/modules/dobbies-product-page-summary/dobbies-product-page-summary.action.ts?fc19","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/utilities/arrayExtensions.ts?e01e","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-availabilities-cartlines.override.action.ts?b758","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-customer-address.action.ts?75be","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-feature-state.override.action.ts?6984","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-full-available-inventory-nearby.override.action.ts?8735","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-loyalty-card.override.action.ts?a600","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-product-availabilities-for-selected-variant.override.action.ts?3e5e","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-products-in-active-cart.override.action.ts?d217","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/utilities/get-image-url.ts?c93b","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-selected-variant.override.action.ts?eca5","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/get-store-location-information.override.action.ts?6d2a","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/update-primary-address.override.action.ts?61d8","webpack://Dobbies.Commerce/./src/themes/dobbies/actions/utilities/product-inventory-information.ts?064d","webpack://Dobbies.Commerce/./src/themes/dobbies/utilities/inventory/product-inventory-utils.ts?3772","webpack://Dobbies.Commerce/./src/themes/dobbies/utilities/post-code-restriction/get-restricted-products.tsx?5e6d","webpack://Dobbies.Commerce/./lib/__local__/module-registration.js?8a42","webpack://Dobbies.Commerce/external var \"React\"?0d3b","webpack://Dobbies.Commerce/external var \"ReactDOM\"?853b"],"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/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getFriendlyName,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport {\r\n buildCacheKeyWithUrlTokens,\r\n CurrentCategoryInput,\r\n getCategoryUrl,\r\n getCurrentCategory,\r\n removeDomainQspFromUrl\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport { IDefaultPageSummaryConfig } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\n/**\r\n * Category Page Summary Input\r\n */\r\nexport class CategoryPageSummaryInput implements IActionInput {\r\n public requestContext: IRequestContext;\r\n public config: IDefaultPageSummaryConfig;\r\n constructor(config: IDefaultPageSummaryConfig, requestContext: IRequestContext) {\r\n this.config = config || {};\r\n this.requestContext = requestContext;\r\n }\r\n public getCacheObjectType = (): string => 'CategoryPageSummary';\r\n public getCacheKey = (): string => buildCacheKeyWithUrlTokens('CategoryPageSummary', this.requestContext);\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\nconst createGetCurrentCategoryInput = (inputData: IActionContext): CurrentCategoryInput => {\r\n if (inputData && inputData.requestContext) {\r\n return new CurrentCategoryInput(inputData.requestContext);\r\n }\r\n throw new Error('Please specify categoryId query string in request.');\r\n};\r\n/**\r\n * Get skip count.\r\n * @param inputData\r\n */\r\nfunction getSkipCount(inputData: ICreateActionContext, IGeneric>): string | undefined {\r\n return inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.skip;\r\n}\r\nconst action = async (input: CategoryPageSummaryInput, context: IActionContext): Promise => {\r\n const { config } = input;\r\n // const jsonUrl =\r\n // context.requestContext.app.config.plpSeoJsonUrl ||\r\n // 'https://files-eu-prod.cms.commerce.dynamics.com/cms/api/ctdwmwnctb/binary/MD4Pav';\r\n const excelUrl =\r\n context.requestContext.app.config.plpSeoTSVUrl ||\r\n 'https://files-eu-prod.cms.commerce.dynamics.com/cms/api/ctdwmwnctb/binary/MD8w5X';\r\n // const res = await Msdyn365.sendRequest(jsonUrl, 'get');\r\n const excelRes = await Msdyn365.sendRequest(excelUrl, 'get');\r\n let currentCategoryResult;\r\n try {\r\n currentCategoryResult = await getCurrentCategory(createGetCurrentCategoryInput(context), context);\r\n } catch {\r\n // Do nothing, if the action fails fallback to values defined in data\r\n }\r\n const currCatUrl = context.requestContext.url.requestUrl.href;\r\n let configCategoryUrl = '';\r\n let configCategoryName = '';\r\n let configCategoryDesc = '';\r\n if (\r\n context.requestContext.app.config.canonicalUrlForCategories &&\r\n Array.isArray(context.requestContext.app.config.canonicalUrlForCategories)\r\n ) {\r\n for (const canonicalUrlCatConfig of context.requestContext.app.config.canonicalUrlForCategories) {\r\n if (currCatUrl.includes(canonicalUrlCatConfig.categoryIDOrUrl) || currCatUrl === canonicalUrlCatConfig.categoryIDOrUrl) {\r\n configCategoryUrl = canonicalUrlCatConfig.canonicalUrl;\r\n configCategoryName = canonicalUrlCatConfig.canonicalName;\r\n configCategoryDesc = canonicalUrlCatConfig.canonicalDescription;\r\n }\r\n }\r\n }\r\n if (currentCategoryResult) {\r\n const currentCategory = { ...currentCategoryResult };\r\n let categoryUrl: string | undefined;\r\n try {\r\n // Reset category's name neutralizedName\r\n const localName = getFriendlyName(context.requestContext.locale, currentCategory.NameTranslations);\r\n const neutralizedName = currentCategory.NeutralizedName || currentCategory.Name;\r\n currentCategory.Name = localName;\r\n currentCategory.NeutralizedName = neutralizedName;\r\n categoryUrl = getCategoryUrl(currentCategory);\r\n const canonicalDomain = context.requestContext.canonicalDomain;\r\n if (categoryUrl && canonicalDomain) {\r\n categoryUrl = `https://${canonicalDomain}${categoryUrl}`.toLocaleLowerCase();\r\n const skipCount = getSkipCount(context);\r\n const Url = new URL(categoryUrl);\r\n const urlParams: URLSearchParams = new URLSearchParams(Url.search);\r\n if (skipCount) {\r\n urlParams.set('skip', skipCount);\r\n }\r\n Url.search = urlParams.toString();\r\n categoryUrl = Url.toString();\r\n categoryUrl = removeDomainQspFromUrl(categoryUrl, context.requestContext);\r\n } else {\r\n categoryUrl = undefined;\r\n }\r\n } catch {\r\n categoryUrl = undefined;\r\n }\r\n const catUrl = getCategoryUrl(currentCategory);\r\n const excelDataStr = excelRes.data as string;\r\n const splittedExcelData = excelDataStr.split('\\n');\r\n let title = currentCategory.Name;\r\n let desc;\r\n let canonical = categoryUrl;\r\n for (const dataRow of splittedExcelData) {\r\n if (!dataRow || !dataRow.trim()) {\r\n continue;\r\n }\r\n const rowSplitted = dataRow.trim().split('\\t');\r\n const curl = rowSplitted[0];\r\n if (catUrl && (catUrl === curl || catUrl?.includes(curl) || curl.includes(catUrl))) {\r\n title = rowSplitted.length > 1 ? rowSplitted[1] : currentCategory.Name;\r\n desc = rowSplitted.length > 2 ? rowSplitted[2] : undefined;\r\n canonical = rowSplitted.length > 3 ? rowSplitted[3] : categoryUrl;\r\n return {\r\n title: title,\r\n description: desc,\r\n sharingImageUrl: currentCategory.OfflineImage,\r\n canonicalUrl: canonical,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n }\r\n return {\r\n title: title,\r\n description: desc,\r\n sharingImageUrl: currentCategory.OfflineImage,\r\n canonicalUrl: canonical,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n // const plpSeoData = res.data && catUrl && res.data[catUrl];\r\n // return {\r\n // title: plpSeoData ? plpSeoData.title : currentCategory.Name,\r\n // description: plpSeoData && plpSeoData.description,\r\n // sharingImageUrl: currentCategory.OfflineImage,\r\n // canonicalUrl: plpSeoData ? plpSeoData.canonicalUrl : categoryUrl,\r\n // faviconUrl: config && config.faviconUrl\r\n // };\r\n // If the action fails fallback to values defined from data\r\n } else if (configCategoryUrl && configCategoryName) {\r\n return {\r\n title: configCategoryName,\r\n description: configCategoryDesc,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n canonicalUrl: configCategoryUrl,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/category-page-summary',\r\n action: >action,\r\n input: (args: ICreateActionContext) => {\r\n return new CategoryPageSummaryInput(args.config, args.requestContext);\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\n/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getCatalogId,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { getAttributeValuesAsync, getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n ArrayExtensions,\r\n buildCacheKey,\r\n generateImageUrl,\r\n getProductUrlSync,\r\n getSelectedProductIdFromActionInput,\r\n QueryResultSettingsProxy,\r\n removeDomainQspFromUrl\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IDobbiesProductPageSummaryConfig } from './dobbies-product-page-summary.props.autogenerated';\r\n\r\n/**\r\n * Product Page Summary Input.\r\n */\r\nexport class ProductPageSummaryInput implements IActionInput {\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public config: IDobbiesProductPageSummaryConfig;\r\n\r\n public productId: number;\r\n\r\n public catalogId?: number;\r\n\r\n public constructor(\r\n config: IDobbiesProductPageSummaryConfig,\r\n apiSettings: ICommerceApiSettings,\r\n productId: number,\r\n requestContext?: IRequestContext\r\n ) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.productId = productId;\r\n\r\n if (requestContext) {\r\n this.catalogId = getCatalogId(requestContext);\r\n }\r\n }\r\n\r\n public getCacheObjectType = (): string => 'ProductPageSummary';\r\n\r\n public getCacheKey = (): string =>\r\n `${buildCacheKey('ProductPageSummary', this.apiSettings)}-${this.config.title}-${this.productId}-${this.catalogId ?? 0}`;\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IProductPageSummary extends IPageSummaryData {\r\n price?: number;\r\n productId?: number;\r\n productBrand?: string;\r\n}\r\n\r\nconst createInput = (args: ICreateActionContext) => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n\r\n if (productId) {\r\n return new ProductPageSummaryInput(\r\n args.config,\r\n args.requestContext.apiSettings,\r\n +productId,\r\n args.requestContext\r\n );\r\n }\r\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\r\n};\r\n\r\n// Checks product attributes for the presence of brand attribute to extract the brand name for product metadata\r\nconst getProductBrand = async (\r\n context: IActionContext,\r\n recordId: number,\r\n channelId: number,\r\n catalogId: number\r\n): Promise => {\r\n const productAttributes = await getAttributeValuesAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n recordId,\r\n channelId,\r\n catalogId\r\n );\r\n for (const productAttribute of productAttributes) {\r\n if (productAttribute.Name === 'Brand') {\r\n return productAttribute.TextValue;\r\n }\r\n }\r\n return;\r\n};\r\n\r\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\r\n const { config, productId, apiSettings } = input;\r\n // const jsonUrl =\r\n // context.requestContext.app.config.pdpSeoJsonUrl ||\r\n // 'https://files-eu-prod.cms.commerce.dynamics.com/cms/api/ctdwmwnctb/binary/MD4Pas';\r\n // const res = await Msdyn365.sendRequest(jsonUrl, 'get');\r\n const excelUrl =\r\n context.requestContext.app.config.pdpSeoTSVUrl ||\r\n 'https://files-eu-prod.cms.commerce.dynamics.com/cms/api/ctdwmwnctb/binary/MD8qTr';\r\n const excelRes = await Msdyn365.sendRequest(excelUrl, 'get');\r\n const prodID = productId.toString();\r\n // const pdpSeoData = res.data && res.data[prodID];\r\n\r\n let simpleProductsData: SimpleProduct[] | undefined;\r\n try {\r\n simpleProductsData = ArrayExtensions.validValues(\r\n await getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n apiSettings.channelId,\r\n [productId],\r\n null,\r\n input.catalogId ?? 0\r\n )\r\n );\r\n } catch {\r\n // Do nothing, if there's an error we fall back to values defined from config\r\n }\r\n if (ArrayExtensions.hasElements(simpleProductsData)) {\r\n const simpleProductData = simpleProductsData[0];\r\n let productUrl: string | undefined;\r\n try {\r\n productUrl = getProductUrlSync(simpleProductData, context);\r\n const canonicalDomain = context.requestContext.canonicalDomain;\r\n if (productUrl && canonicalDomain) {\r\n productUrl = `https://${canonicalDomain}${productUrl}`.toLocaleLowerCase();\r\n productUrl = removeDomainQspFromUrl(productUrl, context.requestContext);\r\n } else {\r\n productUrl = undefined;\r\n }\r\n } catch {\r\n productUrl = undefined;\r\n }\r\n let productBrand: string | undefined;\r\n try {\r\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, input.catalogId ?? 0);\r\n } catch {\r\n productBrand = undefined;\r\n }\r\n const excelDataStr = excelRes.data as string;\r\n const splittedExcelData = excelDataStr.split('\\n');\r\n let title = simpleProductData.Name;\r\n let desc = simpleProductData.Name;\r\n let canonical = productUrl;\r\n for (const dataRow of splittedExcelData) {\r\n if (!dataRow || !dataRow.trim()) {\r\n continue;\r\n }\r\n const rowSplitted = dataRow.trim().split('\\t');\r\n const curl = rowSplitted[0];\r\n if (prodID && (prodID === curl || curl.includes(prodID))) {\r\n title = rowSplitted.length > 1 ? rowSplitted[1] : simpleProductData.Name;\r\n desc = rowSplitted.length > 2 ? rowSplitted[2] : simpleProductData.Description;\r\n canonical = rowSplitted.length > 3 ? rowSplitted[3] : productUrl;\r\n return {\r\n title: title,\r\n description: desc,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n canonicalUrl: canonical,\r\n faviconUrl: config && config.faviconUrl,\r\n productId: simpleProductData.RecordId,\r\n price: simpleProductData.AdjustedPrice,\r\n productBrand\r\n };\r\n }\r\n }\r\n return {\r\n title: title,\r\n description: desc,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n canonicalUrl: canonical,\r\n faviconUrl: config && config.faviconUrl,\r\n productId: simpleProductData.RecordId,\r\n price: simpleProductData.AdjustedPrice,\r\n productBrand\r\n };\r\n // return {\r\n // title: pdpSeoData ? pdpSeoData.title : simpleProductData.Name,\r\n // description: pdpSeoData ? pdpSeoData.description : simpleProductData.Description,\r\n // sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n // canonicalUrl: pdpSeoData ? pdpSeoData.canonicalUrl : productUrl,\r\n // faviconUrl: config && config.faviconUrl,\r\n // productId: simpleProductData.RecordId,\r\n // price: simpleProductData.AdjustedPrice,\r\n // productBrand\r\n // };\r\n\r\n // If the action fails fallback to values defined from config\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n description: config.description,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/product-page-summary',\r\n action: >action,\r\n input: createInput\r\n});\r\n","/*\r\n * @name - unique\r\n * @description - Remove duplicate elements in the array.\r\n * @export\r\n * @public\r\n * @param {array} value - The array to examine.\r\n * @returns {array} - An array with only unique elements.\r\n */\r\nexport function unique(value: T[]): T[] {\r\n return Array.from(new Set(value));\r\n}\r\n","import {\r\n ActiveCartProductsInput,\r\n buildCacheKey,\r\n getActiveCartProductsAction,\r\n IProductInventoryInformation\r\n // mapProductInventoryInformation\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport { mapProductInventoryInformation } from '../utilities/inventory/product-inventory-utils';\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { getCartState } from '@msdyn365-commerce/global-state';\r\nimport {\r\n CartLine,\r\n ChannelDeliveryOptionConfiguration,\r\n FeatureState,\r\n ProductSearchCriteria,\r\n ProductWarehouse,\r\n ProductWarehouseInventoryInformation,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { getOrgUnitConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\r\nimport {\r\n getEstimatedAvailabilityAsync,\r\n getEstimatedProductWarehouseAvailabilityAsync,\r\n searchByCriteriaAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { getChannelDeliveryOptionConfigurationAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { ProductSearchResult, ProductWarehouseInventoryAvailability } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { FeatureStateInput, getFeatureStateAction } from './get-feature-state.override.action';\r\nimport { unique } from './utilities';\r\nimport { getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n ArrayExtensions,\r\n QueryResultSettingsProxy\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for availabilites for items in cart\r\n */\r\nexport class ProductAvailabilitiesForCartLineItems implements IActionInput {\r\n private apiSettings: ICommerceApiSettings;\r\n\r\n constructor(apiSettings: ICommerceApiSettings) {\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey(`ActiveCartLineItemsAvailability`, this.apiSettings);\r\n public getCacheObjectType = () => 'ActiveCartLineItemsAvailability';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nconst createInput = (inputData: ICreateActionContext>) => {\r\n return new ProductAvailabilitiesForCartLineItems(inputData.requestContext.apiSettings);\r\n};\r\n\r\n/**\r\n * Calls the Retail API to get the product availabilites for items in the cart\r\n */\r\n/* Upgraded to 10.0.20 - START */\r\n/**\r\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\r\n */\r\nconst getDeliveryMode = (\r\n cartLine: CartLine,\r\n featureSate: boolean = false,\r\n channelDeliveryOptionConfig: ChannelDeliveryOptionConfiguration,\r\n pickupDeliveryMode?: string\r\n) => {\r\n if (!featureSate) {\r\n return cartLine.DeliveryMode === pickupDeliveryMode;\r\n }\r\n return (\r\n cartLine.DeliveryMode ===\r\n channelDeliveryOptionConfig?.PickupDeliveryModeCodes?.find(deliveryMode => deliveryMode === cartLine.DeliveryMode)\r\n );\r\n};\r\n\r\nasync function getSimpleProducts(prodIds:number[], input: ProductAvailabilitiesForCartLineItems, ctx: IActionContext): Promise {\r\n const simpleProductsData = ArrayExtensions.validValues(\r\n await getByIdsAsync(\r\n {\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n },\r\n ctx.requestContext.apiSettings.channelId,\r\n prodIds,\r\n null,\r\n ctx.requestContext.apiSettings.catalogId ?? 0\r\n )\r\n );\r\n return simpleProductsData;\r\n}\r\n\r\n/* Upgraded to 10.0.20 - END */\r\nexport async function getAvailabilitiesForCartLineItems(\r\n input: ProductAvailabilitiesForCartLineItems,\r\n ctx: IActionContext\r\n): Promise {\r\n // If no input is provided fail out\r\n if (!input) {\r\n throw new Error('[getAvailabilitiesForCartLineItems]No valid Input was provided, failing');\r\n }\r\n const shippingItems: CartLine[] = [];\r\n const bopisItems: CartLine[] = [];\r\n\r\n let productAvailabilities: IProductInventoryInformation[] = [];\r\n const multiplePickupStoreSwitchName = 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature';\r\n let channelDeliveryOptionConfig: any;\r\n\r\n const cartState = await getCartState(ctx);\r\n const cart = cartState.cart;\r\n const channelConfiguration = await getOrgUnitConfigurationAsync({ callerContext: ctx });\r\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\r\n /* Upgraded to 10.0.20 - START */\r\n /**\r\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\r\n */\r\n async function getFeatureState(context: IActionContext): Promise {\r\n return getFeatureStateAction(new FeatureStateInput(), context);\r\n }\r\n const featureState = await getFeatureState(ctx);\r\n const retailMultiplePickUpOptionEnabled = featureState?.find(item => item.Name === multiplePickupStoreSwitchName)?.IsEnabled;\r\n if (retailMultiplePickUpOptionEnabled) {\r\n channelDeliveryOptionConfig = await getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx });\r\n }\r\n /* Upgraded to 10.0.20 - END */\r\n const PickupDeliveryModeCode = channelConfiguration.PickupDeliveryModeCode;\r\n const EmailDeliveryModeCode = channelConfiguration.EmailDeliveryModeCode; // Upgraded to 10.0.16\r\n if (!cart || !channelConfiguration || !products || products.length === 0) {\r\n ctx.trace('[getAvailabilitiesForCartLineItems] Not able to get cart OR channelConfiguration or no products in cart');\r\n return [];\r\n }\r\n\r\n if (cart && cart.Id && cart.CartLines && cart.CartLines.length > 0 && channelConfiguration) {\r\n for (const cartLine of cart.CartLines) {\r\n if (\r\n cartLine.DeliveryMode &&\r\n cartLine.DeliveryMode !== '' &&\r\n getDeliveryMode(cartLine, retailMultiplePickUpOptionEnabled, channelDeliveryOptionConfig, PickupDeliveryModeCode)\r\n ) {\r\n bopisItems.push(cartLine);\r\n } else if (cartLine.DeliveryMode !== EmailDeliveryModeCode) {\r\n shippingItems.push(cartLine);\r\n }\r\n }\r\n }\r\n\r\n if (shippingItems && shippingItems.length > 0) {\r\n const masterProductIds: number[][] = [];\r\n \r\n let productIds = shippingItems.map(x => x.ProductId!);\r\n productIds = unique(productIds);\r\n const simpleProductData = await getSimpleProducts(productIds, input, ctx);\r\n productIds = simpleProductData.map(sp => {\r\n if(sp.MasterProductId && sp.MasterProductId !== sp.RecordId) {\r\n masterProductIds.push([sp.MasterProductId, sp.RecordId]);\r\n return sp.MasterProductId;\r\n } else {\r\n return sp.RecordId;\r\n }\r\n });\r\n\r\n /* VSI Customization - START - 21/12/20 */\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { maxQuantityForCartLineItem, inStockCode, inStockLabel }\r\n }\r\n }\r\n } = ctx;\r\n\r\n let vendorShippedProducts: number[] = []; // List of vendorShip products\r\n let dobbiesPlantsProducts: number[] = []; // List of Dobbies plants products\r\n let dobbiesOtherProducts: number[] = []; // List of Dobbies all products except plants\r\n let dobbiesProductsData: ProductSearchResult[] = [];\r\n\r\n if (productIds.length > 0) {\r\n // First divide products into 2 categories to not call getEstimatedAvailabilityAsync for vendorShip items but just for dobbies products\r\n const productsByVendor = await _getProductsByTypes(ctx, productIds, masterProductIds);\r\n vendorShippedProducts = productsByVendor.vendorShippedProducts;\r\n dobbiesPlantsProducts = productsByVendor.plantsProducts;\r\n dobbiesOtherProducts = productsByVendor.dobbiesOtherProducts;\r\n dobbiesProductsData = productsByVendor.productsData;\r\n }\r\n\r\n const shippingProductAvailabilites = await getShippingProductAvailabilities(ctx, dobbiesOtherProducts, dobbiesPlantsProducts);\r\n\r\n if (\r\n shippingProductAvailabilites &&\r\n shippingProductAvailabilites.ProductWarehouseInventoryAvailabilities &&\r\n shippingProductAvailabilites.ProductWarehouseInventoryAvailabilities.length > 0\r\n ) {\r\n productAvailabilities = mapProductInventoryInformation(\r\n ctx,\r\n shippingProductAvailabilites.ProductWarehouseInventoryAvailabilities,\r\n undefined,\r\n dobbiesProductsData\r\n );\r\n }\r\n\r\n // Set maxQuantityForCartLineItem as limit for vendorShip items\r\n vendorShippedProducts.map(productId => {\r\n // Now map it into IProductInventoryInformation type\r\n productAvailabilities.push({\r\n IsProductAvailable: true,\r\n ProductAvailableQuantity: { ProductId: productId, AvailableQuantity: maxQuantityForCartLineItem },\r\n StockLevelCode: inStockCode,\r\n StockLevelLabel: inStockLabel,\r\n InventLocationId: channelConfiguration.InventLocation\r\n });\r\n });\r\n /* VSI Customization - END */\r\n }\r\n // Add bopis item availability\r\n const allProductAvailabilities = await _getBopisItemAvailability(ctx, productAvailabilities, bopisItems);\r\n\r\n if (allProductAvailabilities && allProductAvailabilities.length > 0) {\r\n return allProductAvailabilities;\r\n }\r\n\r\n ctx.trace('[getAvailabilitiesForCartLineItems] unable to get availabilites for product');\r\n return [];\r\n}\r\n\r\n/**\r\n * The function that returns the sum of all warehousees' PhysicalAvailable for plants Category\r\n */\r\nconst getAccumulatedTotalAvailable = (\r\n ctx: IActionContext,\r\n ProductWarehouseInventoryAvailabilities: ProductWarehouseInventoryAvailability[],\r\n productId: number\r\n) => {\r\n // Just check inventory in warehouseIdsForFulfillment\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { warehouseIdsForFulfillment }\r\n }\r\n }\r\n } = ctx;\r\n\r\n let accumulatedProductPhysicalAvailable = 0;\r\n const fulfillmentStores: string[] | undefined = warehouseIdsForFulfillment; // ['S011', 'S040']\r\n\r\n // First find product's warehouse Info in ProductWarehouseInventoryAvailabilities and then calculates their inventory's sum\r\n ProductWarehouseInventoryAvailabilities.filter(availability => {\r\n // First check if it is one of the warehouseIdsForFulfillment, only then add inventory\r\n const isFulfillmentStore =\r\n fulfillmentStores &&\r\n fulfillmentStores.find(store => {\r\n return availability.InventLocationId && availability.InventLocationId.toLowerCase() === store.toLowerCase();\r\n });\r\n\r\n return isFulfillmentStore && availability && availability.ProductId === productId;\r\n }).map(availability => {\r\n if (availability.PhysicalAvailable) {\r\n accumulatedProductPhysicalAvailable += availability.PhysicalAvailable;\r\n }\r\n });\r\n\r\n // Now just create an object with this product availability info and returns it\r\n return accumulatedProductPhysicalAvailable;\r\n};\r\n\r\n/* Following function checks inventory for bopis items */\r\nconst _getBopisItemAvailability = async (\r\n ctx: IActionContext,\r\n productAvailabilities: IProductInventoryInformation[],\r\n bopisItems: CartLine[]\r\n): Promise => {\r\n if (bopisItems && bopisItems.length > 0) {\r\n for (const bopisItem of bopisItems) {\r\n const productWarehouse: ProductWarehouse = {\r\n ProductId: bopisItem.ProductId,\r\n InventLocationId: bopisItem.WarehouseId\r\n };\r\n\r\n if (ctx.requestContext.channel && ctx.requestContext.channel.InventLocationDataAreaId) {\r\n productWarehouse.DataAreaId = ctx.requestContext.channel.InventLocationDataAreaId;\r\n }\r\n const getProductWarehouseAvail = await getEstimatedProductWarehouseAvailabilityAsync(\r\n { callerContext: ctx, bypassCache: 'get', queryResultSettings: {} },\r\n [productWarehouse]\r\n );\r\n if (\r\n getProductWarehouseAvail &&\r\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities &&\r\n getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities.length > 0\r\n ) {\r\n const productWarehouseMapping = mapProductInventoryInformation(\r\n ctx,\r\n getProductWarehouseAvail && getProductWarehouseAvail.ProductWarehouseInventoryAvailabilities\r\n );\r\n if (productWarehouseMapping && productWarehouseMapping.length) {\r\n for (const item of productWarehouseMapping) {\r\n productAvailabilities.push(item);\r\n }\r\n }\r\n }\r\n }\r\n return productAvailabilities;\r\n }\r\n return productAvailabilities;\r\n};\r\n\r\n/* Following function divides products into 3 categories 1. VendorShipProducts 2. DobbiesPlantProducts 3. DobbiesAllOtherProducts */\r\nconst _getProductsByTypes = async (\r\n ctx: IActionContext,\r\n productIds: number[],\r\n masterProductIds?: number[][]\r\n): Promise<{\r\n vendorShippedProducts: number[];\r\n plantsProducts: number[];\r\n dobbiesOtherProducts: number[];\r\n productsData: ProductSearchResult[]\r\n}> => {\r\n const vendorShippedProducts: number[] = [];\r\n const plantsProducts: number[] = [];\r\n const dobbiesOtherProducts: number[] = [];\r\n\r\n const callerContext = ctx;\r\n const {\r\n requestContext: {\r\n apiSettings: { channelId, catalogId },\r\n app: {\r\n config: { fulfillmentAttributeName, fulfillmentAttributeTextValue }\r\n }\r\n }\r\n } = ctx;\r\n const searchCriteriaInput: ProductSearchCriteria = {};\r\n searchCriteriaInput.Context = { ChannelId: channelId, CatalogId: catalogId };\r\n searchCriteriaInput.Ids = productIds;\r\n searchCriteriaInput.IncludeAttributes = true;\r\n // store product IDs in vendorShippedProducts array if product is vendor shipped\r\n const productsData = await searchByCriteriaAsync({ callerContext, queryResultSettings: {} }, searchCriteriaInput);\r\n productsData.map(product => {\r\n let { RecordId, AttributeValues } = product;\r\n if (masterProductIds) {\r\n for(const mp of masterProductIds) {\r\n if (mp[0] === RecordId) {\r\n RecordId = mp[1];\r\n product.RecordId = mp[1];\r\n }\r\n }\r\n }\r\n const attributes = AttributeValues;\r\n const isvendorShippedAttribute =\r\n attributes &&\r\n attributes.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'isvendershipproduct';\r\n });\r\n const isVendorShipped =\r\n isvendorShippedAttribute &&\r\n isvendorShippedAttribute.TextValue &&\r\n isvendorShippedAttribute.TextValue.trim().toLowerCase() === 'yes';\r\n if (isVendorShipped) {\r\n vendorShippedProducts.push(RecordId);\r\n } else {\r\n const attributeName = fulfillmentAttributeName\r\n ? fulfillmentAttributeName\r\n .toString()\r\n .toLowerCase()\r\n .trim()\r\n : 'fulfillmenttype';\r\n const attributeTextValue = fulfillmentAttributeTextValue\r\n ? fulfillmentAttributeTextValue\r\n .toString()\r\n .toLowerCase()\r\n .trim()\r\n : 'plants';\r\n\r\n const fulfillmentTypeAttribute = attributes && attributes.find(attribute => attribute?.Name?.toLowerCase() === attributeName);\r\n const isPlantFulfillment = fulfillmentTypeAttribute && fulfillmentTypeAttribute.TextValue?.toLowerCase() === attributeTextValue;\r\n if (isPlantFulfillment) {\r\n plantsProducts.push(RecordId);\r\n } else {\r\n dobbiesOtherProducts.push(RecordId);\r\n }\r\n }\r\n });\r\n\r\n return {\r\n vendorShippedProducts: vendorShippedProducts,\r\n plantsProducts: plantsProducts,\r\n dobbiesOtherProducts: dobbiesOtherProducts,\r\n productsData: productsData\r\n };\r\n};\r\n\r\n/* Following function uses 2 separate call to check availability\r\n * For plants products (fulfillment category), get availability from all warehouses with filtered by FilterByChannelFulfillmentGroup\r\n * For all other products of dobbies, check inventory from default warehouse only */\r\nconst getShippingProductAvailabilities = async (\r\n ctx: IActionContext,\r\n dobbiesOtherProducts: number[],\r\n dobbiesPlantsProducts: number[]\r\n): Promise => {\r\n try {\r\n let shippingProductAvailabilites: ProductWarehouseInventoryInformation = {\r\n ProductWarehouseInventoryAvailabilities: [],\r\n ExtensionProperties: []\r\n };\r\n\r\n if (dobbiesOtherProducts && dobbiesOtherProducts.length && dobbiesOtherProducts.length > 0) {\r\n const uniqueProductList = unique(dobbiesOtherProducts);\r\n const otherProductAvailablities = await getEstimatedAvailabilityAsync(\r\n { callerContext: ctx, bypassCache: 'get' },\r\n { ProductIds: uniqueProductList, DefaultWarehouseOnly: true }\r\n );\r\n\r\n if (\r\n otherProductAvailablities.ProductWarehouseInventoryAvailabilities &&\r\n otherProductAvailablities.ProductWarehouseInventoryAvailabilities.length > 0\r\n ) {\r\n shippingProductAvailabilites = otherProductAvailablities;\r\n }\r\n }\r\n if (dobbiesPlantsProducts && dobbiesPlantsProducts.length && dobbiesPlantsProducts.length > 0) {\r\n // Now call for plants products\r\n const uniqueProductList = unique(dobbiesPlantsProducts);\r\n const plantsProductAvailablities = await getEstimatedAvailabilityAsync(\r\n { callerContext: ctx, bypassCache: 'get' },\r\n { ProductIds: uniqueProductList, DefaultWarehouseOnly: false, FilterByChannelFulfillmentGroup: true }\r\n );\r\n\r\n if (\r\n plantsProductAvailablities.ProductWarehouseInventoryAvailabilities &&\r\n plantsProductAvailablities.ProductWarehouseInventoryAvailabilities.length > 0\r\n ) {\r\n // Get ProductWarehouseInventoryAvailabilities as a sum of all warehouse inventory for this product and use it\r\n uniqueProductList.map(plantProduct => {\r\n // Get accumulated inventory for each of product and map into an object of ProductWarehouseInventoryAvailability type\r\n const accumulatedInventorySum = plantsProductAvailablities.ProductWarehouseInventoryAvailabilities\r\n ? getAccumulatedTotalAvailable(\r\n ctx,\r\n plantsProductAvailablities.ProductWarehouseInventoryAvailabilities,\r\n plantProduct\r\n )\r\n : 0;\r\n\r\n // Now map it into ProductWarehouseInventoryAvailability type\r\n const productInventoryAvailability = _mapToWarehouseInventoryAvailability(ctx, plantProduct, accumulatedInventorySum);\r\n\r\n // Now add it into shippingProductAvailabilites\r\n shippingProductAvailabilites.ProductWarehouseInventoryAvailabilities?.push(productInventoryAvailability);\r\n });\r\n }\r\n }\r\n\r\n return shippingProductAvailabilites;\r\n } catch (error) {\r\n ctx.telemetry.trace(error);\r\n }\r\n return {};\r\n};\r\n\r\n/**\r\n * The function returns an object of ProductWarehouseInventoryAvailability using\r\n */\r\nconst _mapToWarehouseInventoryAvailability = (\r\n ctx: IActionContext,\r\n productId: number,\r\n totalAvailable: number\r\n): ProductWarehouseInventoryAvailability => {\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { inStockCode, inStockLabel, outOfStockCode, outOfStockLabel }\r\n }\r\n }\r\n } = ctx;\r\n\r\n return {\r\n InventLocationId: 'ECOM',\r\n ProductId: productId,\r\n PhysicalInventory: 0,\r\n TotalAvailable: totalAvailable,\r\n TotalAvailableInventoryLevelLabel: totalAvailable > 0 ? inStockLabel : outOfStockLabel,\r\n TotalAvailableInventoryLevelCode: totalAvailable > 0 ? inStockCode : outOfStockCode,\r\n PhysicalAvailable: totalAvailable,\r\n PhysicalAvailableInventoryLevelLabel: totalAvailable > 0 ? inStockLabel : outOfStockLabel,\r\n PhysicalAvailableInventoryLevelCode: totalAvailable > 0 ? inStockCode : outOfStockCode\r\n };\r\n};\r\n/* VSI Customization - END */\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-availabilities-cartlines',\r\n action: >getAvailabilitiesForCartLineItems,\r\n input: createInput\r\n});\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * GetCustomerAddress Input Action\r\n */\r\n\r\nexport class GetCustomerAddressInput implements Msdyn365.IActionInput {\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `customerAddress`;\r\n public getCacheObjectType = () => 'customerAddress';\r\n public dataCacheType = (): Msdyn365.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 IGetCustomerAddressData {\r\n addresses: Address[] | undefined;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new GetCustomerAddressInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: GetCustomerAddressInput, ctx: Msdyn365.IActionContext): Promise {\r\n return { addresses: undefined };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n id: 'GetCustomerAddress',\r\n input: createInput\r\n});\r\n","import {\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 { FeatureState } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { getFeatureStatesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\n\r\n/**\r\n * Input class for the getFeatureState data action\r\n */\r\nexport class FeatureStateInput implements IActionInput {\r\n public readonly featureNames: string[] = [\r\n 'Dynamics.AX.Application.RetailB2BEcommerceFeature',\r\n 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature',\r\n 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature',\r\n 'Dynamics.AX.Application.RetailSearchPriceRangeFeature'\r\n ];\r\n\r\n public getCacheKey = () => `FeatureState`;\r\n public getCacheObjectType = () => 'FeatureState';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * createInput method for the getFeatureState method\r\n * @param inputData The input data passed to the createInput method\r\n */\r\nexport const createGetFeatureStateInput = (inputData: ICreateActionContext>): IActionInput => {\r\n return new FeatureStateInput();\r\n};\r\n\r\n/**\r\n * The action method for the getFeatureState data action\r\n * @param input The action input\r\n * @param ctx The action context\r\n */\r\nexport async function getFeatureStateAction(input: FeatureStateInput, ctx: IActionContext): Promise {\r\n const featureState = await getFeatureStatesAsync({ callerContext: ctx }, input.featureNames);\r\n return featureState;\r\n}\r\n\r\n/**\r\n * The getFeatureState data action\r\n * Gets the feature state via the read RetailServer API\r\n * Returns address information associated with the retrieved customer\r\n */\r\nexport const getFeatureStateActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-feature-state',\r\n action: >getFeatureStateAction,\r\n input: createGetFeatureStateInput\r\n});\r\nexport default getFeatureStateActionDataAction;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt 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 {\r\n ChannelDeliveryOption,\r\n FeatureState,\r\n DeliveryModeTypeFilter,\r\n ItemAvailability,\r\n OrgUnitAvailability,\r\n OrgUnitLocation,\r\n ProductWarehouseInventoryInformation,\r\n SearchArea,\r\n StoreHours\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getChannelDeliveryOptionsAsync,\r\n getOrgUnitLocationsByAreaAsync,\r\n getStoreHoursAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\r\nimport { getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { IFullOrgUnitAvailability } from './utilities/full-org-unit-availability';\r\nimport { DeliveryMode, IProductInventoryInformation } from './utilities/product-inventory-information';\r\nimport { FeatureStateInput, getFeatureStateAction } from './get-feature-state.override.action';\r\nimport { createInventoryAvailabilitySearchCriteria, mapProductInventoryInformation } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Get selected variant action input class.\r\n */\r\nexport class GetFullAvailableInventoryNearbyInput implements IActionInput {\r\n public latitude?: number;\r\n\r\n public longitude?: number;\r\n\r\n public radius?: number;\r\n\r\n public productId?: number;\r\n\r\n public DistanceUnitValue?: number;\r\n\r\n public IgnoreLocation?: boolean;\r\n\r\n public ExcludeLocations?: (number | undefined)[];\r\n\r\n constructor(\r\n _productId?: number,\r\n _latitude?: number,\r\n _longitude?: number,\r\n _radius?: number,\r\n _DistanceUnitValue?: number,\r\n _IgnoreLocation?: boolean,\r\n _ExcludeLocations?: (number | undefined)[]\r\n ) {\r\n this.productId = _productId;\r\n this.latitude = _latitude;\r\n this.longitude = _longitude;\r\n this.radius = _radius;\r\n this.DistanceUnitValue = _DistanceUnitValue;\r\n this.IgnoreLocation = _IgnoreLocation;\r\n this.ExcludeLocations = _ExcludeLocations;\r\n }\r\n\r\n public getCacheKey = () => 'GetFullAvailableInventoryNearbyInputCache';\r\n\r\n public getCacheObjectType = () => 'GetFullAvailableInventoryNearbyInput';\r\n\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getSelectedVariant data action.\r\n * @param inputData - The input data passed to the createInput method.\r\n * @returns GetFullAvailableInventoryNearbyInput - The action input.\r\n */\r\nexport const createGetFullAvailableInventoryNearbyInput = (\r\n inputData: ICreateActionContext>\r\n): GetFullAvailableInventoryNearbyInput => {\r\n return new GetFullAvailableInventoryNearbyInput();\r\n};\r\n\r\n/**\r\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\r\n * @param context - The context.\r\n * @returns FeatureState - The feature state.\r\n */\r\nexport async function getFeatureState(context: IActionContext): Promise {\r\n return getFeatureStateAction(new FeatureStateInput(), context);\r\n}\r\n\r\n/**\r\n * Action method for the getSelectedVariant data aciton.\r\n * @param input - The action input class.\r\n * @param ctx - The action context.\r\n * @returns IFullOrgUnitAvailability - The full org unit availability.\r\n */\r\nexport async function getFullAvailableInventoryNearbyAction(\r\n input: GetFullAvailableInventoryNearbyInput,\r\n ctx: IActionContext\r\n): Promise {\r\n // No valid product we want to return undefined so module knows there are no results yet\r\n if (!input.productId) {\r\n return undefined;\r\n }\r\n\r\n if (((!input.radius && input.radius !== 0) || !input.latitude || !input.longitude) && !input.IgnoreLocation) {\r\n // No valid location we want to return empty array so module can show no locations message\r\n return [];\r\n }\r\n\r\n const searchArea: SearchArea = {\r\n Latitude: input.latitude,\r\n Longitude: input.longitude,\r\n Radius: input.radius,\r\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\r\n };\r\n\r\n const featureState = await getFeatureState(ctx);\r\n const retailMulitplePickupMFeatureState = featureState?.find(\r\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\r\n )?.IsEnabled;\r\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, [input.productId], false, true, searchArea, DeliveryMode.pickup);\r\n return getEstimatedAvailabilityAsync({ callerContext: ctx }, searchCriteria)\r\n .then(async (productWarehouseInformation: ProductWarehouseInventoryInformation) => {\r\n // For store selector, inventory should always come from an individual store\r\n const productInventoryInformation = mapProductInventoryInformation(\r\n ctx,\r\n productWarehouseInformation.ProductWarehouseInventoryAvailabilities\r\n );\r\n return getOrgUnitLocationsByAreaAsync({ callerContext: ctx }, searchArea, DeliveryModeTypeFilter.None)\r\n .then(async (stores: OrgUnitLocation[]) => {\r\n // Constructing a store mapping based on the InventoryId.\r\n const storeMap = new Map();\r\n stores.forEach(store => {\r\n if (store.InventoryLocationId) {\r\n storeMap.set(store.InventoryLocationId, store);\r\n }\r\n });\r\n\r\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\r\n\r\n // If multiple pickup mode is enable then call getchanneldeliveryoption\r\n if (retailMulitplePickupMFeatureState) {\r\n const orgUnitChannel = stores.map(store => store.ChannelId);\r\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\r\n }\r\n\r\n const excludedStores = input.ExcludeLocations ?? [];\r\n const filteredStores = stores\r\n .filter(store => !excludedStores.includes(store.ChannelId))\r\n .sort((a, b) => a.OrgUnitName!.localeCompare(b.OrgUnitName!));\r\n const availabilityPromiseList = filteredStores.map(store => {\r\n const locationDeliveryOption = locationDeliveryOptions?.find(\r\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\r\n );\r\n return _getAvailabilityWithHours(store, productInventoryInformation, storeMap, ctx, locationDeliveryOption);\r\n });\r\n\r\n return Promise.all(availabilityPromiseList);\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\r\n ctx.trace(error.message);\r\n ctx.telemetry.error(error.message);\r\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting Available Inventory Nearby');\r\n return [];\r\n });\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(\r\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\r\n );\r\n ctx.trace(error.message);\r\n ctx.telemetry.error(error.message);\r\n ctx.telemetry.debug(\r\n '[GetFullAvailableInventoryNearby][getEstimatedAvailabilityAsync] error getting availability product warehouse information.'\r\n );\r\n return [];\r\n });\r\n}\r\n\r\n/**\r\n * Action method that obtains the store information along with store hours and product availability.\r\n * @param orgUnitLocation - The org unit location.\r\n * @param productInventoryInformation - The product inventory information.\r\n * @param storeMap - A map that contains store information group by the inventory location id.\r\n * @param ctx The action context.\r\n * @param channelDeleiveryOptions - The channel delivery options.\r\n * @returns IFullOrgUnitAvailability - The full org unit availability.\r\n */\r\nasync function _getAvailabilityWithHours(\r\n orgUnitLocation: OrgUnitLocation,\r\n productInventoryInformation: IProductInventoryInformation[],\r\n storeMap: Map,\r\n ctx: IActionContext,\r\n channelDeleiveryOptions: ChannelDeliveryOption | undefined\r\n): Promise {\r\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\r\n return { OrgUnitAvailability: undefined };\r\n }\r\n\r\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\r\n .then((hours: StoreHours) => {\r\n const itemAvailabilities: ItemAvailability[] = [];\r\n if (productInventoryInformation && storeMap) {\r\n productInventoryInformation.forEach(element => {\r\n if (\r\n element.InventLocationId &&\r\n storeMap.has(element.InventLocationId) &&\r\n element.InventLocationId === orgUnitLocation.InventoryLocationId\r\n ) {\r\n itemAvailabilities.push({ AvailableQuantity: element.ProductAvailableQuantity?.AvailableQuantity });\r\n }\r\n });\r\n }\r\n\r\n const availability: OrgUnitAvailability = {\r\n OrgUnitLocation: orgUnitLocation,\r\n ItemAvailabilities: itemAvailabilities\r\n };\r\n\r\n if (hours && !(hours instanceof Error)) {\r\n return {\r\n OrgUnitAvailability: availability,\r\n StoreHours: hours,\r\n ProductInventoryInformation: productInventoryInformation,\r\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\r\n };\r\n }\r\n\r\n return {\r\n OrgUnitAvailability: availability,\r\n ProductInventoryInformation: productInventoryInformation,\r\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions\r\n };\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\r\n ctx.trace(error.message);\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug('[GetFullAvailableInventoryNearby] error getting availability with hours');\r\n return { OrgUnitAvailability: {} };\r\n });\r\n}\r\n\r\n/**\r\n * Action method that obtains the channel delivery option information.\r\n * @param channelCollection - The org unit channel Id list.\r\n * @param ctx - The action context.\r\n * @returns ChannelDeliveryOption - The channel delivery option collection.\r\n */\r\nasync function _getLocationPickUpDeliveryModes(\r\n channelCollection: (number | undefined)[],\r\n ctx: IActionContext\r\n): Promise {\r\n if (channelCollection?.length === 0 || channelCollection === undefined) {\r\n return undefined;\r\n }\r\n\r\n const channelIdList: number[] = [];\r\n channelCollection?.map(id => {\r\n if (id !== undefined) {\r\n channelIdList.push(id);\r\n }\r\n });\r\n\r\n // To get all channel pickup delivery mode filterOption should be 4\r\n return getChannelDeliveryOptionsAsync({ callerContext: ctx }, channelIdList, 4)\r\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\r\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\r\n return channelDeliveryOptions;\r\n }\r\n\r\n return undefined;\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(\r\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\r\n );\r\n ctx.trace(error.message);\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug(\r\n '[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\r\n );\r\n return [];\r\n });\r\n}\r\n\r\n/**\r\n * The complete getFullAvailableInventoryNearby data action.\r\n */\r\nexport const getFullAvailableInventoryNearbyActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-full-available-inventory-nearby',\r\n action: >getFullAvailableInventoryNearbyAction,\r\n input: createGetFullAvailableInventoryNearbyInput\r\n});\r\n\r\nexport default getFullAvailableInventoryNearbyActionDataAction;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt 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 ICommerceApiSettings,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport { LoyaltyCard } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getCustomerLoyaltyCardsAsync,\r\n getLoyaltyCardAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\r\n/**\r\n * Input class for the getLoyaltyCard data action.\r\n */\r\nexport class GetLoyaltyCardInput implements IActionInput {\r\n public userAccountNumber?: string;\r\n\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string) {\r\n this.userAccountNumber = userAccountNumber;\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey(`GetLoyaltyCard-${this.userAccountNumber}`, this.apiSettings);\r\n\r\n public getCacheObjectType = () => 'GetLoyaltyCard';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getLoyaltyCard method.\r\n * @param inputData The input data passed to the createInput method.\r\n */\r\nexport const createGetLoyaltyCardInput = (inputData: ICreateActionContext): GetLoyaltyCardInput => {\r\n const { requestContext } = inputData;\r\n if (!requestContext.user.isAuthenticated) {\r\n throw new Error('Unable to create get loyalty card input. User is not authenticated.');\r\n }\r\n\r\n return new GetLoyaltyCardInput(inputData.requestContext.apiSettings, inputData.requestContext.user.customerAccountNumber);\r\n};\r\n\r\n/**\r\n * The action method for the getLoyaltyCard data action.\r\n * @param input The action input.\r\n * @param ctx The action context.\r\n */\r\nexport async function getLoyaltyAction(input: GetLoyaltyCardInput, ctx: IActionContext): Promise {\r\n return getCustomerLoyaltyCardsAsync({ callerContext: ctx, queryResultSettings: {} }, input.userAccountNumber || null)\r\n .then(cards => {\r\n if (!cards || cards.length === 0) {\r\n return {};\r\n }\r\n\r\n const tempCard = cards.find(card => card.CardTenderTypeValue !== 3);\r\n if (!tempCard) throw new Error('Unable to find a non-blocked card');\r\n const firstCard = tempCard;\r\n // const firstCard = cards[0];\r\n\r\n return getLoyaltyCardAsync({ callerContext: ctx }, firstCard.CardNumber)\r\n .then(card => {\r\n card.LoyaltyEnrollmentDate = firstCard.LoyaltyEnrollmentDate;\r\n card.LoyaltyEnrollmentDateLocal = firstCard.LoyaltyEnrollmentDateLocal;\r\n return card;\r\n })\r\n\r\n .catch(error => {\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug('Unable to get loyalty card');\r\n throw new Error('Unable to get loyalty card');\r\n });\r\n })\r\n .catch(error => {\r\n ctx.telemetry.exception(error.message);\r\n ctx.telemetry.debug('Unable to get customers loyalty card');\r\n throw new Error('Unable to get customers loyalty card');\r\n });\r\n}\r\n\r\n/**\r\n * The getLoyaltyCard data action\r\n * Returns the loyalty card belonging to the customer.\r\n */\r\nexport const getLoyaltyActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-loyalty-card',\r\n action: >getLoyaltyAction,\r\n input: <(args: ICreateActionContext) => IActionInput>createGetLoyaltyCardInput\r\n});\r\n\r\nexport default getLoyaltyActionDataAction;\r\n","import {\r\n getSelectedProductIdFromActionInput,\r\n getSelectedVariant,\r\n IProductInventoryInformation,\r\n // mapProductInventoryInformation,\r\n SelectedVariantInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport { mapProductInventoryInformation } from '../utilities/inventory/product-inventory-utils';\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 { ProductWarehouseInventoryAvailability, ReleasedProductType } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getAttributeValuesAsync,\r\n getEstimatedAvailabilityAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { ProductAvailableQuantity } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n/**\r\n * Input class for the getProductAvailabilitiesForSelectedVariant Data Action\r\n */\r\nexport class ProductAvailabilitiesForSelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n public channelId: number;\r\n\r\n constructor(productId: number | string, channelId: number) {\r\n this.productId = typeof productId === 'string' ? +productId : productId;\r\n this.channelId = channelId;\r\n }\r\n\r\n public getCacheKey = () => `ProductAvailabilitiesForSelectedVariant`;\r\n public getCacheObjectType = () => 'ProductAvailabilities';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * createInput method for the getProductAvailabilitiesForSelectedVariant data action.\r\n * @param inputData The input data passed to the createInput method\r\n */\r\nexport const createProductAvailabilitiesForSelectedVariantInput = (\r\n inputData: ICreateActionContext>\r\n): ProductAvailabilitiesForSelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n\r\n if (productId) {\r\n return new ProductAvailabilitiesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId);\r\n } else {\r\n throw new Error('Unable to create ProductAvailabilitiesForSelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * The action method for the getProductAvailabilitiesForSelectedVariant data action\r\n */\r\n// tslint:disable-next-line: max-func-body-length\r\nexport async function getProductAvailabilitiesForSelectedVariantAction(\r\n input: ProductAvailabilitiesForSelectedVariantInput,\r\n ctx: IActionContext\r\n): Promise {\r\n const selectedVariantInput = new SelectedVariantInput(input.productId, input.channelId);\r\n /* Upgraded to 10.0.16 - START */\r\n // tslint:disable-next-line:prefer-type-cast\r\n const PRODUCTASSERVICE = 2 as ReleasedProductType.Service;\r\n /* Upgraded to 10.0.16 - END */\r\n return getSelectedVariant(selectedVariantInput, ctx)\r\n .then(async productResult => {\r\n if (\r\n productResult &&\r\n /* Upgraded to 10.0.16 - START - Add following condition */\r\n // As we just have master products only so will comment this condition\r\n productResult.ItemTypeValue !== PRODUCTASSERVICE /* && productResult.ProductTypeValue !== ProductType.Master */\r\n /* Upgraded to 10.0.16 - END */\r\n ) {\r\n try {\r\n /* VSI Customization - START - 09/04/21 */\r\n // Check if product is vendorShipped we dont need getEstimatedAvailabilityAsync call as we'll just display instock with maxCartLineQty limit\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { maxQuantityForCartLineItem, fulfillmentAttributeName, fulfillmentAttributeTextValue }\r\n }\r\n }\r\n } = ctx;\r\n\r\n let productInventoryInformation: IProductInventoryInformation[];\r\n\r\n // Make vendorShip products in stock by default\r\n const productAttributes = await getAttributeValuesAsync(\r\n { callerContext: ctx },\r\n input.productId,\r\n input.channelId,\r\n ctx.requestContext.apiSettings.catalogId\r\n );\r\n const isVendorShipAttribute = productAttributes.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'isvendershipproduct';\r\n });\r\n\r\n /* VSI Customization - START - Check PreSale product attribute for TotalAvailable */\r\n const isPreSale = productAttributes.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'presale' && attribute.TextValue === \"Yes\";\r\n });\r\n /* VSI-Customization -- END */\r\n\r\n if (\r\n isVendorShipAttribute &&\r\n isVendorShipAttribute.TextValue &&\r\n isVendorShipAttribute.TextValue.toLowerCase() === 'yes'\r\n ) {\r\n const vendorShipProductInventory: IProductInventoryInformation[] = [];\r\n\r\n vendorShipProductInventory.push({\r\n IsProductAvailable: true,\r\n ProductAvailableQuantity: {\r\n AvailableQuantity: maxQuantityForCartLineItem,\r\n ProductId: productResult.RecordId\r\n }\r\n });\r\n\r\n return vendorShipProductInventory;\r\n } else {\r\n const attributeName = fulfillmentAttributeName\r\n ? fulfillmentAttributeName\r\n .toString()\r\n .toLowerCase()\r\n .trim()\r\n : 'fulfillmenttype';\r\n const attributeTextValue = fulfillmentAttributeTextValue\r\n ? fulfillmentAttributeTextValue\r\n .toString()\r\n .toLowerCase()\r\n .trim()\r\n : 'plants';\r\n\r\n const fulfillmentTypeAttribute =\r\n productAttributes &&\r\n productAttributes.find(attribute => {\r\n return attribute?.Name?.toLowerCase() === attributeName;\r\n });\r\n const isPlantFulfillment =\r\n fulfillmentTypeAttribute && fulfillmentTypeAttribute.TextValue?.toLowerCase() === attributeTextValue;\r\n const isPlantCategory = isPlantFulfillment ? true : false;\r\n /* VSI Customization - END - 09/04/21 */\r\n return getEstimatedAvailabilityAsync(\r\n { callerContext: ctx },\r\n {\r\n ProductIds: [productResult.RecordId],\r\n DefaultWarehouseOnly: !isPlantCategory,\r\n FilterByChannelFulfillmentGroup: isPlantCategory\r\n }\r\n ).then(async response => {\r\n if (\r\n response &&\r\n response.ProductWarehouseInventoryAvailabilities &&\r\n response.ProductWarehouseInventoryAvailabilities.length\r\n ) {\r\n if (isPlantCategory) {\r\n // Get ProductWarehouseInventoryAvailabilities as a sum of all warehouse inventory and use it\r\n const accumulatedAvailability = getAccumulatedAvailability(\r\n ctx,\r\n response.ProductWarehouseInventoryAvailabilities\r\n );\r\n\r\n productInventoryInformation = mapProductInventoryInformation(ctx, accumulatedAvailability);\r\n } else {\r\n productInventoryInformation = mapProductInventoryInformation(\r\n ctx,\r\n response.ProductWarehouseInventoryAvailabilities,\r\n isPreSale ? \"totalAvailable\" : \"\"\r\n );\r\n }\r\n }\r\n /* VSI Customization - END */\r\n return productInventoryInformation;\r\n });\r\n }\r\n } catch (error) {\r\n ctx.trace((error as Error).message);\r\n ctx.telemetry.exception(error as Error);\r\n ctx.telemetry.debug(`[getEstimatedAvailabilityAsync]Error executing action`);\r\n throw new Error('[getEstimatedAvailabilityAsync]Error executing action');\r\n }\r\n }\r\n return [];\r\n })\r\n .catch((error: Error) => {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- can't assign type to the error variable.\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug('[getPriceForSelectedVariantAction]Error executing action');\r\n return undefined;\r\n });\r\n}\r\n\r\n/**\r\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity\r\n */\r\nexport function mergeProductWarehouseToProductAvailabities(\r\n productsWarehouseInventory: ProductWarehouseInventoryAvailability[]\r\n): ProductAvailableQuantity[] {\r\n const productAvailable: ProductAvailableQuantity[] = [];\r\n if (productsWarehouseInventory && productsWarehouseInventory.length > 0) {\r\n for (const product of productsWarehouseInventory) {\r\n if (product.TotalAvailable !== undefined && product.ProductId !== undefined) {\r\n productAvailable.push({ ProductId: product.ProductId, AvailableQuantity: product.TotalAvailable });\r\n }\r\n }\r\n }\r\n return productAvailable;\r\n}\r\n\r\n/**\r\n * The function that adds all warehouse's PhysicalAvailable for plants Category and return that ProductWarehouseInventoryAvailabilities\r\n */\r\nconst getAccumulatedAvailability = (\r\n ctx: IActionContext,\r\n ProductWarehouseInventoryAvailabilities: ProductWarehouseInventoryAvailability[]\r\n) => {\r\n // Just check inventory in warehouseIdsForFulfillment\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { warehouseIdsForFulfillment }\r\n }\r\n }\r\n } = ctx;\r\n\r\n let accumulatedProductCount = 0;\r\n const fulfillmentStores: string[] | undefined = warehouseIdsForFulfillment; // ['S011', 'S040']\r\n // We'll just check the PhysicalAvailable for plants fulfillment\r\n ProductWarehouseInventoryAvailabilities.filter(availability => {\r\n // First check if it is one of the warehouseIdsForFulfillment, only then add inventory\r\n return (\r\n fulfillmentStores &&\r\n fulfillmentStores.find(store => {\r\n return availability.InventLocationId && availability.InventLocationId.toLowerCase() === store.toLowerCase();\r\n })\r\n );\r\n }).map(availability => {\r\n if (availability.PhysicalAvailable) {\r\n accumulatedProductCount += availability.PhysicalAvailable;\r\n }\r\n });\r\n // Now just create an object with this product availability info and returns it\r\n return mapWarehouseAvailabilityForAccumulatedCount(ctx, ProductWarehouseInventoryAvailabilities, accumulatedProductCount);\r\n};\r\n\r\n/**\r\n * The function that creates an object of type ProductWarehouseInventoryAvailability with new provided accumulatedProductCount\r\n * and return it as an array of type\r\n */\r\nconst mapWarehouseAvailabilityForAccumulatedCount = (\r\n ctx: IActionContext,\r\n ProductWarehouseInventoryAvailabilities: ProductWarehouseInventoryAvailability[],\r\n accumulatedProductCount: number\r\n): ProductWarehouseInventoryAvailability[] => {\r\n // Use labels from app.settings for both in stock & out of stock cases\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { inStockCode, inStockLabel, outOfStockCode, outOfStockLabel }\r\n }\r\n }\r\n } = ctx;\r\n\r\n const productAvailability = ProductWarehouseInventoryAvailabilities[0];\r\n\r\n return [\r\n {\r\n ProductId: productAvailability.ProductId,\r\n DataAreaId: productAvailability.DataAreaId,\r\n PhysicalInventory: 0,\r\n TotalAvailable: accumulatedProductCount,\r\n TotalAvailableInventoryLevelLabel: accumulatedProductCount > 0 ? inStockLabel : outOfStockCode,\r\n TotalAvailableInventoryLevelCode: accumulatedProductCount > 0 ? inStockCode : outOfStockLabel,\r\n PhysicalAvailable: accumulatedProductCount,\r\n PhysicalAvailableInventoryLevelLabel: accumulatedProductCount > 0 ? inStockLabel : outOfStockLabel,\r\n PhysicalAvailableInventoryLevelCode: accumulatedProductCount > 0 ? inStockCode : outOfStockCode\r\n }\r\n ];\r\n};\r\n/*** The complete getProductAvailabilitiesForSelectedVariant data action\r\n * Get the currently selected variant via the getSelectedVariant data action, and\r\n * then gets the availabilities for the variant via the getProductAvailabilities RetailServer API\r\n ****/\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-product-availabilities-for-selected-variant',\r\n action: >getProductAvailabilitiesForSelectedVariantAction,\r\n input: createProductAvailabilitiesForSelectedVariantInput\r\n});\r\n","import {\r\n getSimpleProducts,\r\n ProductInput,\r\n createGetFeatureStateInput,\r\n getCustomer,\r\n GetCustomerInput,\r\n getFeatureState,\r\n ArrayExtensions\r\n} from '@msdyn365-commerce-modules/retail-actions';\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 { getCartState } from '@msdyn365-commerce/global-state';\r\nimport { CommerceProperty, CommercePropertyValue, ProductSearchCriteria, FeatureState } from '@msdyn365-commerce/retail-proxy';\r\nimport { searchByCriteriaAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { Cart, SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { getRestrictedProducts } from '../utilities/post-code-restriction/get-restricted-products';\r\n/**\r\n * Input class for activeCartWithProducts data action\r\n */\r\nexport class ActiveCartProductsInput implements IActionInput {\r\n public getCacheKey = () => `ActiveCartProducts`;\r\n public getCacheObjectType = () => 'ActiveCartProducts';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nconst createInput = (inputData: ICreateActionContext) => {\r\n return new ActiveCartProductsInput();\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns a cart object based on the passed GetCartInput\r\n * @param input\r\n * @param ctx\r\n */\r\nexport async function getActiveCartProductsAction(input: ActiveCartProductsInput, ctx: IActionContext): Promise {\r\n // If no cart ID is provided in input, we need to create a cart object\r\n if (!input) {\r\n throw new Error('[getActiveCartWithProducts]No valid Input was provided, failing');\r\n }\r\n\r\n const cartState = await getCartState(ctx);\r\n const cart = cartState.cart;\r\n\r\n const isQuantityLimitsFeatureIsOn: boolean = await isOrderQuantityLimitsFeatureEnabled(ctx);\r\n\r\n if (isQuantityLimitsFeatureIsOn) {\r\n return getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart, ctx);\r\n }\r\n\r\n // If there are cart lines, make call to get products\r\n if (!cartState.hasInvoiceLine && cart && cart.CartLines && cart.CartLines.length > 0) {\r\n ctx.trace('Getting cart product information...');\r\n return getSimpleProducts(\r\n cart.CartLines.map(cartLine => {\r\n if (cartLine.ProductId) {\r\n return new ProductInput(cartLine.ProductId, ctx.requestContext.apiSettings);\r\n }\r\n return undefined;\r\n }).filter(Boolean),\r\n ctx\r\n )\r\n .then((products: SimpleProduct[]) => {\r\n if (products) {\r\n /* VSI Customization - START - 15/12/20 */\r\n const productWithVendorInfo = _getProductsVendorInfo(ctx, products);\r\n if (productWithVendorInfo) {\r\n return productWithVendorInfo;\r\n }\r\n return products;\r\n /* VSI Customization - END */\r\n } else {\r\n return [];\r\n }\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(error.toString());\r\n ctx.telemetry.error(error.message);\r\n ctx.telemetry.debug(`[getActiveCartWithProducts]Unable to hydrate cart with product information`);\r\n throw new Error('[getActiveCartWithProducts]Unable to hydrate cart with product information');\r\n });\r\n }\r\n\r\n ctx.trace('[getActiveCartWithProducts]No Products Found in cart');\r\n return [];\r\n}\r\n/* VSI Customization - START - 15/12/20 */\r\nconst _getProductsVendorInfo = async (actionContext: IActionContext, products: SimpleProduct[]) => {\r\n const callerContext = actionContext;\r\n const {\r\n requestContext: {\r\n apiSettings: { channelId, catalogId }\r\n }\r\n } = actionContext;\r\n if (products) {\r\n const searchCriteriaInput: ProductSearchCriteria = {};\r\n searchCriteriaInput.Context = { ChannelId: channelId, CatalogId: catalogId };\r\n const productIds: number[] = [];\r\n const masterProductIds: number[][] = [];\r\n products.map(product => {\r\n if (product.MasterProductId && product.RecordId !== product.MasterProductId) {\r\n masterProductIds.push([product.MasterProductId, product.RecordId]);\r\n productIds.push(product.MasterProductId);\r\n } else {\r\n productIds.push(product.RecordId);\r\n }\r\n });\r\n searchCriteriaInput.Ids = productIds;\r\n searchCriteriaInput.IncludeAttributes = true;\r\n const productsData = await searchByCriteriaAsync({ callerContext, queryResultSettings: {} }, searchCriteriaInput);\r\n \r\n \r\n // Get restricted products list\r\n const restrictedProducts = await getRestrictedProducts(productsData, actionContext.requestContext.apiSettings.baseUrl);\r\n productsData.map(product => {\r\n for (const mp of masterProductIds) {\r\n if (mp[0] === product.RecordId) {\r\n product.RecordId = mp[1];\r\n }\r\n }\r\n // Check if it is restricted product, add it in its ExtensionProperties\r\n const isRestrictedProduct = restrictedProducts.find(productId => productId === product.RecordId);\r\n const restrictedInfo: CommerceProperty = { Key: 'isRestrictedProduct', Value: { BooleanValue: !!isRestrictedProduct } };\r\n\r\n const attributes = product.AttributeValues;\r\n const isvendorShippedAttribute =\r\n attributes &&\r\n attributes.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'isvendershipproduct'; // \"IsVendershipProduct\"\r\n });\r\n const isVendorShiped =\r\n isvendorShippedAttribute &&\r\n isvendorShippedAttribute.TextValue &&\r\n isvendorShippedAttribute.TextValue.trim().toLowerCase() === 'yes';\r\n const extensionProperties: CommerceProperty[] = [];\r\n if (isVendorShiped) {\r\n const selectedAttributes =\r\n attributes &&\r\n attributes.filter(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n const isVendorNameAvailable = attribute.TextValue; // if vendor name is not undefined\r\n return (\r\n attributeName &&\r\n isVendorNameAvailable &&\r\n (attributeName === 'vendorname' || attributeName === 'estimatedshippingtime')\r\n );\r\n });\r\n if (selectedAttributes && selectedAttributes.length > 0) {\r\n selectedAttributes &&\r\n selectedAttributes.map(selectedAttribute => {\r\n const commercePropertyValue: CommercePropertyValue = { StringValue: selectedAttribute.TextValue };\r\n const commerceProperty: CommerceProperty = { Key: selectedAttribute.Name, Value: commercePropertyValue };\r\n extensionProperties.push(commerceProperty);\r\n });\r\n } else {\r\n const vendorname: CommerceProperty = { Key: 'vendorname', Value: { StringValue: 'Not Available' } };\r\n const estimatedShippingTime: CommerceProperty = {\r\n Key: 'estimatedshippingtime',\r\n Value: { StringValue: 'Not Available' }\r\n };\r\n extensionProperties.push(vendorname);\r\n extensionProperties.push(estimatedShippingTime);\r\n }\r\n } else {\r\n const vendorname: CommerceProperty = { Key: 'vendorname', Value: { StringValue: undefined } };\r\n const estimatedShippingTime: CommerceProperty = { Key: 'estimatedshippingtime', Value: { StringValue: undefined } };\r\n extensionProperties.push(vendorname);\r\n extensionProperties.push(estimatedShippingTime);\r\n }\r\n // Add restricted info against each cartLine\r\n extensionProperties.push(restrictedInfo);\r\n product.ExtensionProperties = extensionProperties;\r\n });\r\n return productsData;\r\n }\r\n return [];\r\n};\r\n/* VSI Customizatoin - END */\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-products-in-active-cart',\r\n action: >getActiveCartProductsAction,\r\n input: createInput\r\n});\r\n\r\nasync function getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn(cart: Cart, ctx: IActionContext): Promise {\r\n const productIdsByWarehouseId: Map = new Map();\r\n let resultProducts: SimpleProduct[] = [];\r\n cart.CartLines?.forEach(cartLine =>\r\n productIdsByWarehouseId.has(cartLine.WarehouseId!)\r\n ? productIdsByWarehouseId.get(cartLine.WarehouseId!)?.push(cartLine.ProductId!)\r\n : productIdsByWarehouseId.set(cartLine.WarehouseId!, [cartLine.ProductId!])\r\n );\r\n return Promise.all(\r\n [...productIdsByWarehouseId].map(([entryWarehouseId, entryProductIds]) => {\r\n return getSimpleProducts(\r\n entryProductIds\r\n .map(productId => {\r\n if (productId) {\r\n return new ProductInput(productId, ctx.requestContext.apiSettings, undefined, entryWarehouseId);\r\n }\r\n return undefined;\r\n })\r\n .filter(Boolean),\r\n ctx\r\n ).then((products: SimpleProduct[]) => {\r\n if (products) {\r\n resultProducts = products.reduce((accum, product) => {\r\n if (product) {\r\n accum.push(product);\r\n }\r\n return accum;\r\n }, resultProducts);\r\n }\r\n });\r\n })\r\n ).then(() => resultProducts);\r\n}\r\n\r\nasync function isOrderQuantityLimitsFeatureEnabled(ctx: IActionContext): Promise {\r\n const defaultOrderQuantityLimitsFeatureConfig = ctx.requestContext.app?.platform?.enableDefaultOrderQuantityLimits;\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'none') {\r\n return Promise.resolve(false);\r\n }\r\n\r\n const featureStates = await getFeatureState(createGetFeatureStateInput(ctx), ctx);\r\n let isQuantityLimitsFeatureEnabledInHq = false;\r\n if (ArrayExtensions.hasElements(featureStates)) {\r\n isQuantityLimitsFeatureEnabledInHq =\r\n featureStates.find(\r\n (featureState: FeatureState) => featureState.Name === 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature'\r\n )?.IsEnabled || false;\r\n }\r\n\r\n if (!isQuantityLimitsFeatureEnabledInHq) {\r\n return false;\r\n }\r\n\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'all') {\r\n return Promise.resolve(true);\r\n }\r\n\r\n return getCustomer(new GetCustomerInput(ctx.requestContext.apiSettings), ctx)\r\n .then(customerInfo => {\r\n return (\r\n !!customerInfo &&\r\n ((defaultOrderQuantityLimitsFeatureConfig === 'b2b' && customerInfo.IsB2b) ||\r\n (defaultOrderQuantityLimitsFeatureConfig === 'b2c' && !customerInfo.IsB2b))\r\n );\r\n })\r\n .catch((error: Error) => {\r\n ctx.telemetry.warning(error.message);\r\n ctx.telemetry.debug('Unable to get customer info');\r\n return false;\r\n });\r\n}\r\n","import { ICommerceApiSettings } from '@msdyn365-commerce/core';\r\nimport { ProductSearchResult, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * Generates a Image URL based on data return from retail server\r\n * @param imageUrl The image url returned by Retail Server\r\n * @param ctx The request context\r\n */\r\nexport const generateImageUrl = (imageUrl: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\r\n if (imageUrl) {\r\n // Images hosted in CMS include schema\r\n if (imageUrl.startsWith('http')) {\r\n return imageUrl;\r\n }\r\n\r\n // Images hosted in Retail Server must be encoded and joined with the base image url\r\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\r\n } else {\r\n // d365Commerce.telemetry.warning(`Unable to generate a proper Image URL for Product: ${product.RecordId}`);\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * Generates a Image URL for a product based on data return from retail server\r\n * @param product The Product returned by Retail Server\r\n * @param ctx The request context\r\n */\r\nexport const generateProductImageUrl = (\r\n product: SimpleProduct | ProductSearchResult,\r\n apiSettings: ICommerceApiSettings\r\n): string | undefined => {\r\n return generateImageUrl(product.PrimaryImageUrl, apiSettings);\r\n};\r\n","import { getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\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\n\r\nimport {\r\n getByIdAsync,\r\n getDefaultComponentsAsync,\r\n getVariantsByComponentsInSlotsAsync,\r\n getVariantsByDimensionValuesAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { ProductDimension, SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { generateProductImageUrl } from './utilities/get-image-url';\r\n/**\r\n * Get selected variant action input class\r\n */\r\nexport class SelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n public channelId: number;\r\n public matchingDimensionValues: ProductDimension[];\r\n\r\n constructor(productId: number, channelId: number, matchingDimensionValues?: ProductDimension[]) {\r\n this.productId = productId;\r\n this.channelId = channelId;\r\n this.matchingDimensionValues = matchingDimensionValues || [];\r\n }\r\n\r\n public getCacheKey = () => `SelectedVariant`;\r\n public getCacheObjectType = () => 'SimpleProduct';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getSelectedVariant data action\r\n * @param inputData The input data passed to the createInput method\r\n */\r\nconst createInput = (inputData: ICreateActionContext>): SelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n\r\n if (productId) {\r\n return new SelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, []);\r\n } else {\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/**\r\n * Action method for the getSelectedVariant data aciton\r\n * @param input The action input class\r\n * @param ctx The action context\r\n */\r\nasync function getSelectedVariantAction(input: SelectedVariantInput, ctx: IActionContext): Promise {\r\n let product: SimpleProduct | null = null;\r\n\r\n const response = await getByIdAsync({ callerContext: ctx }, input.productId, input.channelId);\r\n const baseProduct: SimpleProduct = Array.isArray(response) ? response[0] : response;\r\n\r\n // Need to dereference this before editing it. Otherwise we might not\r\n // properly get the mobx events because if things aren't properly observable\r\n // they won't fire when you set them, and then if you don't deref the value in\r\n // the cache will match the value when you try to save it, so it won't detect any\r\n // changes there either\r\n product = baseProduct && { ...baseProduct };\r\n\r\n if (product) {\r\n let baseProductHadUnmatchedDimension: boolean = false;\r\n if (product.Dimensions) {\r\n product.Dimensions.map(dimension => {\r\n const matchedTargetDimension = input.matchingDimensionValues?.find(\r\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\r\n );\r\n\r\n if (matchedTargetDimension) {\r\n dimension.DimensionValue = matchedTargetDimension.DimensionValue;\r\n } else {\r\n baseProductHadUnmatchedDimension = true;\r\n }\r\n });\r\n }\r\n\r\n if (!baseProductHadUnmatchedDimension && input.matchingDimensionValues?.length > 0) {\r\n const variants = await getVariantsByDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n baseProduct?.RecordId,\r\n input.channelId,\r\n input.matchingDimensionValues || []\r\n );\r\n\r\n if (variants && variants.length > 0) {\r\n product = variants[0];\r\n }\r\n }\r\n\r\n /**\r\n * VSI Customization -- STARTS\r\n * Check if the product is Kit through getDefaultComponentsAsync\r\n * If it is kit product then fetch and load it's variant instead of master product.\r\n * Assuming there will be only one vaiant of kit product.\r\n */\r\n\r\n const defaultComponent = await getDefaultComponentsAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n baseProduct?.RecordId,\r\n input.channelId\r\n );\r\n\r\n if (defaultComponent && defaultComponent.length > 0) {\r\n const variantsByComponent = await getVariantsByComponentsInSlotsAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n baseProduct?.RecordId,\r\n input.channelId,\r\n []\r\n );\r\n\r\n if (variantsByComponent.length && variantsByComponent.length > 0) {\r\n const variantId = variantsByComponent[0]?.RecordId;\r\n const simpleProduct = await getByIdAsync({ callerContext: ctx }, variantId, input.channelId);\r\n const kitProduct: SimpleProduct = Array.isArray(simpleProduct) ? simpleProduct[0] : simpleProduct;\r\n // Will use master product's details as that would be up-to-date\r\n /* As description & title doesn't get updated for variants but for master products so using master product's details */\r\n const updatedKitProduct = kitProduct;\r\n updatedKitProduct.Name = baseProduct.Name;\r\n updatedKitProduct.Description = baseProduct.Description;\r\n\r\n product = { ...updatedKitProduct };\r\n }\r\n }\r\n\r\n /**\r\n * VSI Customization -- ENDS\r\n */\r\n\r\n const newImageUrl = generateProductImageUrl(product, ctx.requestContext.apiSettings);\r\n\r\n if (newImageUrl) {\r\n product.PrimaryImageUrl = newImageUrl;\r\n }\r\n }\r\n\r\n return product || null;\r\n}\r\n\r\n/**\r\n * The complete getSelectedVariant data action\r\n */\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-selected-variant',\r\n action: >getSelectedVariantAction,\r\n input: createInput\r\n});\r\n","import { IFullOrgUnitAvailability } from '@msdyn365-commerce-modules/retail-actions';\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 {\r\n ChannelDeliveryOption,\r\n FeatureState,\r\n OrgUnitAvailability,\r\n OrgUnitLocation,\r\n SearchArea,\r\n StoreHours\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getChannelDeliveryOptionsAsync,\r\n getOrgUnitLocationsByAreaAsync,\r\n getStoreHoursAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/OrgUnitsDataActions.g';\r\nimport { FeatureStateInput, getFeatureStateAction } from './get-feature-state.override.action';\r\n\r\n/**\r\n * Get selected variant action input class\r\n */\r\nexport class GetOrgUnitLocationsByAreaInput implements IActionInput {\r\n public Latitude?: number;\r\n public Longitude?: number;\r\n public Radius?: number;\r\n public DistanceUnitValue?: number;\r\n public IgnoreLocation?: boolean;\r\n\r\n constructor(_Latitude?: number, _Longitude?: number, _Radius?: number, _DistanceUnitValue?: number, _IgnoreLocation?: boolean) {\r\n this.Latitude = _Latitude;\r\n this.Longitude = _Longitude;\r\n this.Radius = _Radius;\r\n this.DistanceUnitValue = _DistanceUnitValue;\r\n this.IgnoreLocation = _IgnoreLocation;\r\n }\r\n\r\n public getCacheKey = () => `GetOrgUnitLocationsByAreaInput`;\r\n public getCacheObjectType = () => 'GetOrgUnitLocationsByAreaInput';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getSelectedVariant data action\r\n * @param inputData The input data passed to the createInput method\r\n */\r\nexport const createGetOrgUnitLocationsByAreaInput = (inputData: ICreateActionContext>): GetOrgUnitLocationsByAreaInput => {\r\n return new GetOrgUnitLocationsByAreaInput();\r\n};\r\n/* Upgraded to 10.0.16 - START */\r\n/**\r\n * Calls the Retail Feature State API and returns a list of feature with isEnabled flag.\r\n */\r\nexport async function getFeatureState(context: IActionContext): Promise {\r\n return getFeatureStateAction(new FeatureStateInput(), context);\r\n}\r\n/* Upgraded to 10.0.16 - END */\r\n/**\r\n * Action method for the getSelectedVariant data action\r\n * @param input The action input class\r\n * @param ctx The action context\r\n */\r\nexport async function getOrgUnitLocationsByArea(\r\n input: GetOrgUnitLocationsByAreaInput,\r\n ctx: IActionContext\r\n): Promise {\r\n if ((input.Radius === undefined || !input.Latitude || !input.Longitude) && !input.IgnoreLocation) {\r\n // No valid location we want to return empty array so module can show no locations message\r\n return [];\r\n }\r\n\r\n const searchArea: SearchArea = {\r\n Latitude: input.Latitude,\r\n Longitude: input.Longitude,\r\n Radius: input.Radius,\r\n DistanceUnitValue: input.DistanceUnitValue || 0 // 0 is miles\r\n };\r\n /* Upgraded to 10.0.16 - START */\r\n const featureState = await getFeatureState(ctx);\r\n const retailMulitplePickupMFeatureState = featureState?.find(\r\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\r\n )?.IsEnabled;\r\n /* Upgraded to 10.0.16 - END */\r\n return getOrgUnitLocationsByAreaAsync({ callerContext: ctx }, searchArea)\r\n .then(async (stores: OrgUnitLocation[]) => {\r\n // VSI-Customization START - stores sorted in alphabetically order.\r\n const alphabeticallySortedStores = stores?.sort((a, b) => a.OrgUnitName!.localeCompare(b.OrgUnitName!));\r\n // VSI-Customization END\r\n /* Upgraded to 10.0.16 - START */\r\n /* const locationPromiseList = alphabeticallySortedStores.map(store => _getLocationWithHours(store, ctx)); */\r\n let locationDeliveryOptions: ChannelDeliveryOption[] | undefined = [];\r\n // if mulitple pickup mode is enable then call getchanneldeliveryoption\r\n if (retailMulitplePickupMFeatureState) {\r\n const orgUnitChannel = alphabeticallySortedStores.map(store => store.ChannelId);\r\n locationDeliveryOptions = await _getLocationPickUpDeliveryModes(orgUnitChannel, ctx);\r\n }\r\n const locationPromiseList = alphabeticallySortedStores.map(store => {\r\n const locationDeliveryOption = locationDeliveryOptions?.find(\r\n _channeldeliveryoption => _channeldeliveryoption.ChannelId === store.ChannelId\r\n );\r\n return _getLocationWithHours(store, locationDeliveryOption, ctx);\r\n });\r\n /* Upgraded to 10.0.16 - END */\r\n return Promise.all(locationPromiseList);\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace('[GetOrgUnitLocationsByArea] error getting Locations');\r\n ctx.trace(error.message);\r\n ctx.telemetry.error(error.message);\r\n ctx.telemetry.debug(`[GetOrgUnitLocationsByArea] error getting Locations`);\r\n return [];\r\n });\r\n}\r\n\r\n/**\r\n * Action method that obtains the store information\r\n * @param orgUnitLocation The org unit location\r\n * @param storeMap a map that contains store information group by the inventory location id\r\n * @param ctx The action context\r\n */\r\nasync function _getLocationWithHours(\r\n orgUnitLocation: OrgUnitLocation,\r\n channelDeleiveryOptions: ChannelDeliveryOption | undefined, // Upgraded to 10.0.16\r\n ctx: IActionContext\r\n): Promise {\r\n if (!orgUnitLocation || !orgUnitLocation.OrgUnitNumber) {\r\n return { OrgUnitAvailability: undefined };\r\n }\r\n\r\n return getStoreHoursAsync({ callerContext: ctx }, orgUnitLocation.OrgUnitNumber)\r\n .then((hours: StoreHours) => {\r\n const availability: OrgUnitAvailability = {\r\n OrgUnitLocation: orgUnitLocation\r\n };\r\n\r\n if (hours && !(hours instanceof Error)) {\r\n return {\r\n OrgUnitAvailability: availability,\r\n StoreHours: hours,\r\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions /* Upgraded to 10.0.16 */\r\n };\r\n }\r\n\r\n return {\r\n OrgUnitAvailability: availability,\r\n OrgUnitPickUpDeliveryModes: channelDeleiveryOptions /* Upgraded to 10.0.16 */\r\n };\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace('[GetFullAvailableInventoryNearby] error getting availability with hours');\r\n ctx.trace(error.message);\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug(`[GetFullAvailableInventoryNearby] error getting availability with hours`);\r\n return { OrgUnitAvailability: {} };\r\n });\r\n}\r\n/* Upgraded to 10.0.16 - START */\r\n/**\r\n * Action method that obtains the store information\r\n * @param channelCollection The org unit channel Id list\r\n * @param ctx The action context\r\n */\r\nasync function _getLocationPickUpDeliveryModes(\r\n channelCollection: (number | undefined)[],\r\n ctx: IActionContext\r\n): Promise {\r\n if (channelCollection?.length === 0 || channelCollection === undefined) {\r\n return undefined;\r\n }\r\n const channelIdList: number[] = [];\r\n channelCollection?.map(id => {\r\n if (id !== undefined) {\r\n channelIdList.push(id);\r\n }\r\n });\r\n // to get all channel pickup delivery mode filterOption should be 4\r\n return getChannelDeliveryOptionsAsync({ callerContext: ctx }, channelIdList, 4)\r\n .then((channelDeliveryOptions: ChannelDeliveryOption[]) => {\r\n if (channelDeliveryOptions && !(channelDeliveryOptions instanceof Error)) {\r\n return channelDeliveryOptions;\r\n }\r\n return undefined;\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(\r\n '[GetFullAvailableInventoryNearby][getChannelDeliveryOptionsAsync] error getting availability with channel delivery options'\r\n );\r\n ctx.trace(error.message);\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug(\r\n `[GetFullAvailableInventoryNearby] [getChannelDeliveryOptionsAsync] error getting availability with channel delivery options`\r\n );\r\n return [];\r\n });\r\n}\r\n/* Upgraded to 10.0.16 - END */\r\n/**\r\n * The complete getOrgUnitLocationsByArea data action\r\n */\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-store-location-information',\r\n action: >getOrgUnitLocationsByArea,\r\n input: createGetOrgUnitLocationsByAreaInput\r\n});\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { createObservableDataAction, IAction, IActionContext, IActionInput, IAny, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { readAsync, updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CustomersDataActions.g';\r\nimport { Address, Customer } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\nimport { IAddressManagementInput } from '@msdyn365-commerce-modules/retail-actions/dist/types/add-address';\r\n\r\n// @ts-ignore\r\nimport { GetCustomerInput } from '@msdyn365-commerce-modules/retail-actions/dist/lib/get-customer';\r\n\r\n// @ts-ignore\r\nimport { createAddressManagementInput } from '@msdyn365-commerce-modules/retail-actions/dist/lib/add-address';\r\n\r\nexport function updatePrimaryAddressHandler(customer: Customer, address: Address): Customer {\r\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses || [])]);\r\n return customer;\r\n}\r\n\r\nexport async function updatePrimaryAddressAction(input: IAddressManagementInput, ctx: IActionContext): Promise {\r\n const { address } = input;\r\n\r\n const customer = await readAsync({ callerContext: ctx, bypassCache: 'get' }, '');\r\n\r\n if (!customer) {\r\n throw new Error('Unable to find customer');\r\n }\r\n\r\n customer.Addresses = setPrimaryAddress({ ...address }, [...(customer.Addresses ?? [])]);\r\n const updatedCustomer = await updateAsync({ callerContext: ctx }, customer);\r\n\r\n if (!updatedCustomer) {\r\n throw new Error('Unable to update customer');\r\n }\r\n\r\n ctx.update(new GetCustomerInput(ctx.requestContext.apiSettings), updatedCustomer);\r\n\r\n return updatedCustomer.Addresses || [];\r\n}\r\n\r\n/**\r\n * The updatePrimaryAddress data action\r\n * Calls the read RetailServer API to get information about a customer\r\n * Merge the passed address information with the address information from\r\n * the retireved customer, and then updates that customer via the update RetailServer API.\r\n */\r\nexport const updatePrimaryAddressActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/update-primary-address',\r\n action: >updatePrimaryAddressAction,\r\n input: <(args: ICreateActionContext) => IActionInput>(createAddressManagementInput),\r\n isBatched: false\r\n});\r\nexport default updatePrimaryAddressActionDataAction;\r\n\r\nconst setPrimaryAddress = (primaryAddresses: Address, addresses: Address[]): Address[] => {\r\n return addresses.map(addr => {\r\n if (addr.RecordId === primaryAddresses.RecordId) {\r\n addr.IsPrimary = true;\r\n } else {\r\n addr.IsPrimary = false;\r\n }\r\n return addr;\r\n });\r\n};\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { ProductAvailableQuantity } from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * This setting defines the delivery modes supported.\r\n */\r\nexport enum DeliveryMode {\r\n allWareHouses = 0,\r\n shipping = 1,\r\n pickup = 2\r\n}\r\n\r\n/**\r\n * This setting defines the inventory levels supported.\r\n */\r\nexport enum InventoryLevels {\r\n physicalAvailable = 'physicalAvailable',\r\n totalAvailable = 'totalAvailable',\r\n threshold = 'threshold'\r\n}\r\n\r\n/**\r\n * Product inventory information class.\r\n */\r\nexport interface IProductInventoryInformation {\r\n ProductAvailableQuantity: ProductAvailableQuantity;\r\n StockLevelCode?: string;\r\n StockLevelLabel?: string;\r\n IsProductAvailable: boolean;\r\n InventLocationId?: string;\r\n deliveryType?: DeliveryMode;\r\n}\r\n","import { IActionContext } from '@msdyn365-commerce/core';\r\nimport { ProductAvailableQuantity, ProductSearchResult, ProductWarehouseInventoryAvailability } from '@msdyn365-commerce/retail-proxy';\r\n/**\r\n * Product inventory information class\r\n */\r\nexport interface IProductInventoryInformation {\r\n ProductAvailableQuantity: ProductAvailableQuantity;\r\n StockLevelCode?: string;\r\n StockLevelLabel?: string;\r\n IsProductAvailable: boolean;\r\n InventLocationId?: string;\r\n}\r\n/**\r\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity\r\n */\r\nexport const mapProductInventoryInformation = (\r\n ctx: IActionContext,\r\n productsWarehouseInventory: ProductWarehouseInventoryAvailability[],\r\n isPreSale?: string,\r\n dobbiesProductsData?: ProductSearchResult[]\r\n): IProductInventoryInformation[] => {\r\n const {\r\n requestContext: {\r\n app: {\r\n config: { enableStockCheck, inventoryLevel }\r\n }\r\n }\r\n } = ctx;\r\n\r\n const productInventoryInformation: IProductInventoryInformation[] = [];\r\n\r\n if (enableStockCheck === undefined || enableStockCheck === false) {\r\n return productInventoryInformation;\r\n }\r\n\r\n if (productsWarehouseInventory && productsWarehouseInventory.length > 0) {\r\n for (const product of productsWarehouseInventory) {\r\n const filteredProduct = dobbiesProductsData?.find(prod => prod.RecordId === product.ProductId);\r\n const presell = filteredProduct?.AttributeValues?.find(proAttr => proAttr.Name === \"PreSale\" && proAttr.TextValue === \"Yes\")\r\n const IsVendershipProduct = filteredProduct?.AttributeValues?.find(proAttr => proAttr.Name === \"IsVendershipProduct\" && proAttr.TextValue === \"No\")\r\n const FulfillmentType = filteredProduct?.AttributeValues?.find(proAttr => proAttr.Name === \"FulfillmentType\" && proAttr.TextValue !== \"Plants\")\r\n switch (isPreSale ? \"totalAvailable\" : (presell && IsVendershipProduct && FulfillmentType) ? \"totalAvailable\" : inventoryLevel) {\r\n case 'physicalAvailable':\r\n // Inventory level is enabled with Physical inventory\r\n const physicalProductMap = mapInventoryWithPhysicalBufferEnabled(ctx, product);\r\n if (physicalProductMap) {\r\n productInventoryInformation.push(physicalProductMap);\r\n }\r\n break;\r\n case 'totalAvailable':\r\n // Inventory level is enabled with Total available inventory\r\n const totalAvailableProductMap = mapInventoryWithTotalAvailableBufferEnabled(ctx, product);\r\n if (totalAvailableProductMap) {\r\n productInventoryInformation.push(totalAvailableProductMap);\r\n }\r\n break;\r\n default:\r\n // when inventory level is inventoryThreshold or not defined\r\n const productMap = mapInventoryWithThresholdEnabled(ctx, product);\r\n if (productMap) {\r\n productInventoryInformation.push(productMap);\r\n }\r\n }\r\n }\r\n }\r\n return productInventoryInformation;\r\n};\r\n\r\nexport const mapInventoryWithThresholdEnabled = (\r\n ctx: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n) => {\r\n if (\r\n productWarehouseInventoryAvailability &&\r\n productWarehouseInventoryAvailability.ProductId &&\r\n productWarehouseInventoryAvailability.TotalAvailable !== undefined\r\n ) {\r\n const productQty = productWarehouseInventoryAvailability.TotalAvailable - ctx.requestContext.app.config.outOfStockThreshold;\r\n const productAvailableQuantity = {\r\n ProductId: productWarehouseInventoryAvailability.ProductId,\r\n AvailableQuantity: productQty > 0 ? productQty : 0\r\n };\r\n return {\r\n ProductAvailableQuantity: productAvailableQuantity,\r\n IsProductAvailable: productAvailableQuantity.AvailableQuantity && productAvailableQuantity.AvailableQuantity > 0 ? true : false,\r\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\r\n };\r\n }\r\n return null;\r\n};\r\n\r\nexport const mapInventoryWithPhysicalBufferEnabled = (\r\n ctx: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n) => {\r\n const shouldRenderLabel = displayLabelEnabled(ctx, productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode);\r\n if (\r\n productWarehouseInventoryAvailability &&\r\n productWarehouseInventoryAvailability.ProductId &&\r\n productWarehouseInventoryAvailability.TotalAvailable !== undefined\r\n ) {\r\n // As per the new buffer logic from RS,\r\n // if code is out of stock then we set the available quantity to 0 regardless of the actual value from API\r\n const productQuantity =\r\n productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode === 'OOS'\r\n ? 0\r\n : productWarehouseInventoryAvailability.PhysicalAvailable;\r\n const productAvailableQuantity = {\r\n ProductId: productWarehouseInventoryAvailability.ProductId,\r\n AvailableQuantity: productQuantity\r\n };\r\n return {\r\n ProductAvailableQuantity: productAvailableQuantity,\r\n StockLevelCode: shouldRenderLabel ? productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode : undefined,\r\n StockLevelLabel: shouldRenderLabel ? productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelLabel : undefined,\r\n IsProductAvailable: productAvailableQuantity.AvailableQuantity !== undefined && productAvailableQuantity.AvailableQuantity > 0,\r\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\r\n };\r\n }\r\n return null;\r\n};\r\n\r\nexport const mapInventoryWithTotalAvailableBufferEnabled = (\r\n ctx: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n) => {\r\n const shouldRenderLabel = displayLabelEnabled(ctx, productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode);\r\n if (\r\n productWarehouseInventoryAvailability &&\r\n productWarehouseInventoryAvailability.ProductId &&\r\n productWarehouseInventoryAvailability.TotalAvailable !== undefined\r\n ) {\r\n // As per the new buffer logic from RS,\r\n // if code is out of stock then we set the available quantity to 0 regardless of the actual value from API\r\n const productQuantity =\r\n productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode === 'OOS'\r\n ? 0\r\n : productWarehouseInventoryAvailability.TotalAvailable;\r\n const productAvailableQuantity = {\r\n ProductId: productWarehouseInventoryAvailability.ProductId,\r\n AvailableQuantity: productQuantity\r\n };\r\n return {\r\n ProductAvailableQuantity: productAvailableQuantity,\r\n StockLevelCode: shouldRenderLabel ? productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode : undefined,\r\n StockLevelLabel: shouldRenderLabel ? productWarehouseInventoryAvailability.TotalAvailableInventoryLevelLabel : undefined,\r\n IsProductAvailable: productAvailableQuantity.AvailableQuantity !== undefined && productAvailableQuantity.AvailableQuantity > 0,\r\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\r\n };\r\n }\r\n return null;\r\n};\r\n\r\nexport const displayLabelEnabled = (ctx: IActionContext, inventoryCode: string | undefined) => {\r\n if (!inventoryCode) {\r\n return false;\r\n }\r\n switch (ctx.requestContext.app.config.inventoryRanges) {\r\n case 'lowAndOutofStock':\r\n if (inventoryCode !== 'AVAIL') {\r\n return true;\r\n }\r\n break;\r\n case 'outOfStock':\r\n if (inventoryCode === 'OOS') {\r\n return true;\r\n }\r\n break;\r\n case 'all':\r\n return true;\r\n default:\r\n return false;\r\n }\r\n return false;\r\n};\r\n","import { ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\r\nvar axios = require('axios');\r\n\r\nexport const getRestrictedProducts = async (productsData: ProductSearchResult[], attributesBaseUrl?: string): Promise => {\r\n const restrictedProducts: number[] = [];\r\n for (const product of productsData) {\r\n const attributes = await _getRestrictedPostCodes(product.RecordId, attributesBaseUrl);\r\n attributes &&\r\n attributes.map((attr: any) => {\r\n if (attr?.Name && attr.Name === 'RestrictedPostCode' && attr.TextValue) {\r\n // @ts-ignore\r\n const postcodesTemp = JSON.parse(attr?.TextValue).RestrictedPostCode;\r\n if (postcodesTemp.length > 0) {\r\n restrictedProducts.push(product.RecordId);\r\n }\r\n }\r\n });\r\n }\r\n\r\n return restrictedProducts;\r\n};\r\n\r\nexport const _getRestrictedPostCodes = async (productId: number, attributesBaseUrl?: string): Promise => {\r\n let url = attributesBaseUrl ? `${attributesBaseUrl}Commerce/Products(${productId})/GetAttributeValues(channelId=5637147577,catalogId=0)?$top=1000&api-version=7.3`: `https://scu40oznal298244666-rs.su.retail.dynamics.com/Commerce/Products(${productId})/GetAttributeValues(channelId=5637147577,catalogId=0)?$top=1000&api-version=7.3`;\r\n var config = {\r\n method: 'get',\r\n url: url,\r\n headers: {\r\n authority: attributesBaseUrl ? attributesBaseUrl.split('://')[1] : 'scu40oznal298244666-rs.su.retail.dynamics.com',\r\n accept: 'application/json',\r\n 'accept-language': 'en-GB',\r\n appsessionid: 'OtVVxv4TZOd4WbCSDTkvYH',\r\n 'cache-control': 'no-cache',\r\n 'content-type': 'application/json',\r\n contenttype: 'application/json',\r\n 'from-keystone': 'true',\r\n 'odata-maxversion': '4.0',\r\n 'odata-version': '4.0',\r\n oun: 'Y100',\r\n pragma: 'no-cache',\r\n prefer: 'return=representation',\r\n requestid: 'e42018722d257bb82e53ad56d5d963fc/2',\r\n usersessionid: 'ADCehL+M8YWP9iwro4TOSA'\r\n }\r\n };\r\n\r\n try {\r\n const response = await axios(config);\r\n return response.data.value;\r\n } catch (error) {\r\n console.log('err', error);\r\n throw error; // rethrow the error if needed\r\n }\r\n};\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 = 'modules/dobbies-category-page-summary/dobbies-category-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/dobbies-category-page-summary/dobbies-category-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/dobbies-product-page-summary/dobbies-product-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/dobbies-product-page-summary/dobbies-product-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-availabilities-cartlines.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-availabilities-cartlines.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-customer-address.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-customer-address.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-feature-state.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-feature-state.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-full-available-inventory-nearby.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-full-available-inventory-nearby.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-loyalty-card.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-loyalty-card.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-product-availabilities-for-selected-variant.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-product-availabilities-for-selected-variant.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-products-in-active-cart.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-products-in-active-cart.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-selected-variant.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-selected-variant.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/get-store-location-information.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/get-store-location-information.override.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'themes/dobbies/actions/update-primary-address.override.action';\n binding.dataActions[actionPath] = require('partner/themes/dobbies/actions/update-primary-address.override.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;"],"names":["CategoryPageSummaryInput","constructor","config","requestContext","getCacheObjectType","getCacheKey","buildCacheKeyWithUrlTokens","this","dataCacheType","createObservableDataAction","id","action","async","input","context","excelUrl","app","plpSeoTSVUrl","excelRes","Msdyn365","currentCategoryResult","getCurrentCategory","inputData","CurrentCategoryInput","Error","createGetCurrentCategoryInput","_unused","currCatUrl","url","requestUrl","href","configCategoryUrl","configCategoryName","configCategoryDesc","canonicalUrlForCategories","Array","isArray","canonicalUrlCatConfig","includes","categoryIDOrUrl","canonicalUrl","canonicalName","canonicalDescription","currentCategory","_objectSpread","categoryUrl","localName","getFriendlyName","locale","NameTranslations","neutralizedName","NeutralizedName","Name","getCategoryUrl","canonicalDomain","toLocaleLowerCase","skipCount","query","skip","Url","URL","urlParams","URLSearchParams","search","set","toString","removeDomainQspFromUrl","undefined","_unused2","catUrl","splittedExcelData","data","split","desc","title","canonical","dataRow","trim","rowSplitted","curl","length","description","sharingImageUrl","OfflineImage","faviconUrl","sharingImage","src","args","ProductPageSummaryInput","apiSettings","productId","_this$catalogId","buildCacheKey","catalogId","getCatalogId","pdpSeoTSVUrl","prodID","simpleProductsData","_input$catalogId","ArrayExtensions","validValues","getByIdsAsync","callerContext","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","channelId","hasElements","simpleProductData","productUrl","productBrand","getProductUrlSync","_input$catalogId2","recordId","productAttributes","getAttributeValuesAsync","productAttribute","TextValue","getProductBrand","_unused3","Description","generateImageUrl","PrimaryImageUrl","RecordId","price","AdjustedPrice","getSelectedProductIdFromActionInput","unique","value","from","Set","ProductAvailabilitiesForCartLineItems","getDeliveryMode","cartLine","_channelDeliveryOptio","featureSate","arguments","channelDeliveryOptionConfig","pickupDeliveryMode","DeliveryMode","PickupDeliveryModeCodes","find","deliveryMode","getAvailabilitiesForCartLineItems","ctx","_featureState$find","shippingItems","bopisItems","productAvailabilities","cart","getCartState","channelConfiguration","getOrgUnitConfigurationAsync","products","getActiveCartProductsAction","ActiveCartProductsInput","featureState","getFeatureStateAction","FeatureStateInput","getFeatureState","retailMultiplePickUpOptionEnabled","item","IsEnabled","getChannelDeliveryOptionConfigurationAsync","PickupDeliveryModeCode","EmailDeliveryModeCode","trace","Id","CartLines","push","masterProductIds","productIds","map","x","ProductId","prodIds","_ctx$requestContext$a","getSimpleProducts","sp","MasterProductId","maxQuantityForCartLineItem","inStockCode","inStockLabel","vendorShippedProducts","dobbiesPlantsProducts","dobbiesOtherProducts","dobbiesProductsData","productsByVendor","_getProductsByTypes","plantsProducts","productsData","shippingProductAvailabilites","getShippingProductAvailabilities","ProductWarehouseInventoryAvailabilities","mapProductInventoryInformation","IsProductAvailable","ProductAvailableQuantity","AvailableQuantity","StockLevelCode","StockLevelLabel","InventLocationId","InventLocation","allProductAvailabilities","_getBopisItemAvailability","bopisItem","productWarehouse","WarehouseId","channel","InventLocationDataAreaId","DataAreaId","getProductWarehouseAvail","getEstimatedProductWarehouseAvailabilityAsync","bypassCache","productWarehouseMapping","fulfillmentAttributeName","fulfillmentAttributeTextValue","searchCriteriaInput","Context","ChannelId","CatalogId","Ids","IncludeAttributes","searchByCriteriaAsync","product","AttributeValues","mp","attributes","isvendorShippedAttribute","attribute","toLowerCase","_fulfillmentTypeAttri","attributeName","attributeTextValue","fulfillmentTypeAttribute","_attribute$Name","ExtensionProperties","uniqueProductList","otherProductAvailablities","getEstimatedAvailabilityAsync","ProductIds","DefaultWarehouseOnly","plantsProductAvailablities","FilterByChannelFulfillmentGroup","plantProduct","_shippingProductAvail","accumulatedInventorySum","getAccumulatedTotalAvailable","warehouseIdsForFulfillment","accumulatedProductPhysicalAvailable","fulfillmentStores","filter","availability","store","PhysicalAvailable","productInventoryAvailability","_mapToWarehouseInventoryAvailability","error","telemetry","totalAvailable","outOfStockCode","outOfStockLabel","PhysicalInventory","TotalAvailable","TotalAvailableInventoryLevelLabel","TotalAvailableInventoryLevelCode","PhysicalAvailableInventoryLevelLabel","PhysicalAvailableInventoryLevelCode","GetCustomerAddressInput","addresses","featureNames","createGetFeatureStateInput","getFeatureStatesAsync","getFeatureStateActionDataAction","GetFullAvailableInventoryNearbyInput","_productId","_latitude","_longitude","_radius","_DistanceUnitValue","_IgnoreLocation","_ExcludeLocations","latitude","longitude","radius","DistanceUnitValue","IgnoreLocation","ExcludeLocations","createGetFullAvailableInventoryNearbyInput","getFullAvailableInventoryNearbyAction","searchArea","Latitude","Longitude","Radius","retailMulitplePickupMFeatureState","searchCriteria","createInventoryAvailabilitySearchCriteria","pickup","then","productInventoryInformation","productWarehouseInformation","getOrgUnitLocationsByAreaAsync","DeliveryModeTypeFilter","None","_input$ExcludeLocatio","storeMap","Map","stores","forEach","InventoryLocationId","locationDeliveryOptions","orgUnitChannel","channelCollection","channelIdList","getChannelDeliveryOptionsAsync","channelDeliveryOptions","catch","message","exception","debug","_getLocationPickUpDeliveryModes","excludedStores","availabilityPromiseList","sort","a","b","OrgUnitName","localeCompare","_locationDeliveryOpti","locationDeliveryOption","_channeldeliveryoption","orgUnitLocation","channelDeleiveryOptions","OrgUnitNumber","OrgUnitAvailability","getStoreHoursAsync","hours","itemAvailabilities","element","_element$ProductAvail","has","OrgUnitLocation","ItemAvailabilities","ProductInventoryInformation","OrgUnitPickUpDeliveryModes","StoreHours","_getAvailabilityWithHours","Promise","all","getFullAvailableInventoryNearbyActionDataAction","GetLoyaltyCardInput","userAccountNumber","createGetLoyaltyCardInput","user","isAuthenticated","customerAccountNumber","getLoyaltyAction","getCustomerLoyaltyCardsAsync","cards","tempCard","card","CardTenderTypeValue","firstCard","getLoyaltyCardAsync","CardNumber","LoyaltyEnrollmentDate","LoyaltyEnrollmentDateLocal","getLoyaltyActionDataAction","ProductAvailabilitiesForSelectedVariantInput","createProductAvailabilitiesForSelectedVariantInput","getProductAvailabilitiesForSelectedVariantAction","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","ItemTypeValue","isVendorShipAttribute","isPreSale","vendorShipProductInventory","isPlantCategory","response","accumulatedAvailability","getAccumulatedAvailability","mergeProductWarehouseToProductAvailabities","productsWarehouseInventory","productAvailable","accumulatedProductCount","mapWarehouseAvailabilityForAccumulatedCount","productAvailability","cartState","defaultOrderQuantityLimitsFeatureConfig","platform","enableDefaultOrderQuantityLimits","resolve","featureStates","isQuantityLimitsFeatureEnabledInHq","_featureStates$find","getCustomer","GetCustomerInput","customerInfo","IsB2b","warning","isOrderQuantityLimitsFeatureEnabled","_cart$CartLines","productIdsByWarehouseId","resultProducts","_productIdsByWarehous","get","_ref","entryWarehouseId","entryProductIds","ProductInput","Boolean","reduce","accum","getActiveCartProductsActionWhenQuantityLimitsFeatureIsOn","hasInvoiceLine","productWithVendorInfo","_getProductsVendorInfo","actionContext","restrictedProducts","getRestrictedProducts","baseUrl","restrictedInfo","Key","Value","BooleanValue","isVendorShiped","extensionProperties","selectedAttributes","isVendorNameAvailable","selectedAttribute","commercePropertyValue","StringValue","commerceProperty","vendorname","estimatedShippingTime","generateProductImageUrl","imageUrl","startsWith","baseImageUrl","encodeURIComponent","matchingDimensionValues","getByIdAsync","baseProduct","_input$matchingDimens2","baseProductHadUnmatchedDimension","Dimensions","dimension","_input$matchingDimens","matchedTargetDimension","targetDimension","DimensionTypeValue","DimensionValue","variants","getVariantsByDimensionValuesAsync","defaultComponent","getDefaultComponentsAsync","variantsByComponent","getVariantsByComponentsInSlotsAsync","_variantsByComponent$","variantId","simpleProduct","updatedKitProduct","newImageUrl","GetOrgUnitLocationsByAreaInput","_Latitude","_Longitude","_Radius","createGetOrgUnitLocationsByAreaInput","getOrgUnitLocationsByArea","alphabeticallySortedStores","locationPromiseList","_getLocationWithHours","updatePrimaryAddressHandler","customer","address","Addresses","setPrimaryAddress","updatePrimaryAddressAction","_customer$Addresses","readAsync","updatedCustomer","updateAsync","update","updatePrimaryAddressActionDataAction","createAddressManagementInput","isBatched","primaryAddresses","addr","IsPrimary","InventoryLevels","enableStockCheck","inventoryLevel","_filteredProduct$Attr","_filteredProduct$Attr2","_filteredProduct$Attr3","filteredProduct","prod","presell","proAttr","IsVendershipProduct","FulfillmentType","physicalProductMap","mapInventoryWithPhysicalBufferEnabled","totalAvailableProductMap","mapInventoryWithTotalAvailableBufferEnabled","productMap","mapInventoryWithThresholdEnabled","productWarehouseInventoryAvailability","productQty","outOfStockThreshold","productAvailableQuantity","shouldRenderLabel","displayLabelEnabled","productQuantity","inventoryCode","inventoryRanges","axios","require","attributesBaseUrl","_getRestrictedPostCodes","attr","JSON","parse","RestrictedPostCode","method","headers","authority","accept","appsessionid","contenttype","oun","pragma","prefer","requestid","usersessionid","console","log","binding","modules","dataActions","registerActionId","actionPath","default","prototype","Object","keys","exportName","Action","window","__bindings__","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}