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,EAAQE,YAAYE,GAAYG,GAAYD,WAC5CN,EAAQE,YAAYE,GAAYG,GAAYD,UAAUE,SACtDR,EAAQE,YAAYF,EAAQE,YAAYE,GAAYG,GAAYD,UAAUhP,IAAM0O,EAAQE,YAAYE,GAAYG,QA2B5H,CACI,MAAMH,EAAa,2CACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,8CACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,qDACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,wCACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,6DACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,2DACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAGrB,CACI,MAAMA,EAAa,2DACnBJ,EAAQE,YAAYE,GAAcK,EAAQ,KAC1CN,EAAiBC,GAIzBM,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaV,QAAO1S,EAAAA,EAAA,GACpBmT,OAAOC,aAAaV,SAAW,IAC/BD,EAAQC,SAGXS,OAAOC,aAAaC,mBAAqB,GACzCF,OAAOC,aAAaC,mBAA8B,UAACrT,EAAA,GAC5CyS,EAAQE,iCC3FvBW,EAAOC,QAAUC,2BCAjBF,EAAOC,QAAUE","sources":["webpack://henrys-ecommerce/./src/actions/getProductVariantOrMaster.ts?9116","webpack://henrys-ecommerce/./src/actions/get-applicable-warranties.action.ts?6ef5","webpack://henrys-ecommerce/./src/actions/get-availabilities-cartlines.action.ts?de39","webpack://henrys-ecommerce/./src/actions/get-full-available-inventory-nearby.action.ts?562c","webpack://henrys-ecommerce/./src/actions/get-product-promotions.action.ts?ea24","webpack://henrys-ecommerce/./src/common/utilities/createCanonicalUrl.ts?7ccf","webpack://henrys-ecommerce/./src/modules/category-page-summary/category-page-summary.action.ts?ff83","webpack://henrys-ecommerce/./src/modules/default-page-summary/default-page-summary.action.ts?c630","webpack://henrys-ecommerce/./src/modules/product-page-summary/product-page-summary.action.ts?e077","webpack://henrys-ecommerce/./lib/__local__/module-registration.js?8a42","webpack://henrys-ecommerce/external var \"React\"?0d3b","webpack://henrys-ecommerce/external var \"ReactDOM\"?853b"],"sourcesContent":["import * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport {\r\n QueryResultSettingsProxy,\r\n generateProductImageUrl,\r\n createInventoryAvailabilitySearchCriteria,\r\n ArrayExtensions\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n ProductDimension,\r\n ProductDimensionAvailabilitySearchCriteria,\r\n ProductsDataActions,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { IProductDimensionsWithAvailabilitiesFull } from '@msdyn365-commerce/commerce-entities';\r\n\r\n/**\r\n * Retrieves product dimensions with availabilities.\r\n * @param product - Product for which the dimensions need to be retrieved.\r\n * @param matchingDimensionValues - Selected dimensions - filter criteria for the dimensions API.\r\n * @param context - Action context.\r\n * @param catalogId - Catalog id.\r\n * @returns Array of dimensions.\r\n */\r\nconst getFullDimensions = async (\r\n product: SimpleProduct,\r\n matchingDimensionValues: ProductDimension[],\r\n context: Msdyn365.IActionContext,\r\n catalogId?: number\r\n) => {\r\n let fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = [];\r\n const fullDimensionPromises = (product.Dimensions ?? []).map(dimension => {\r\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\r\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\r\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\r\n MatchingDimensionValues: matchingDimensionValues,\r\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\r\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\r\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\r\n CatalogId: catalogId\r\n };\r\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\r\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\r\n product.MasterProductId ? product.MasterProductId : product.RecordId,\r\n searchCriteria\r\n );\r\n\r\n return dimensionValuesPromise.then(dimensionValues => {\r\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\r\n ...dimension,\r\n dimensionValuesWithInventory: dimensionValues\r\n };\r\n return fullDimension;\r\n });\r\n });\r\n fullDimensions = await Promise.all(fullDimensionPromises);\r\n return fullDimensions;\r\n};\r\n\r\n/**\r\n * Retrieves product variant for the given input or undefined if not found.\r\n * @param input - Action input.\r\n * @param context - Action context.\r\n * @param fullDimensions - Product dimensions with availabilities.\r\n * @returns A product variant that is available or undefined.\r\n */\r\nconst getProductVariant = async (context: Msdyn365.IActionContext, fullDimensions: IProductDimensionsWithAvailabilitiesFull[]) => {\r\n let productVariant: SimpleProduct | undefined;\r\n if (\r\n ArrayExtensions.hasElements(fullDimensions) &&\r\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory) &&\r\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory[0].ProductIds)\r\n ) {\r\n const variantProductId = fullDimensions[0].dimensionValuesWithInventory[0].ProductIds[0];\r\n const result = await ProductsDataActions.getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n //bypassCache: input.bypassCache\r\n },\r\n context.requestContext.apiSettings.channelId,\r\n [variantProductId],\r\n null,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n productVariant = result[0];\r\n productVariant = { ...productVariant };\r\n const variantImageUrl = generateProductImageUrl(productVariant, context.requestContext.apiSettings);\r\n\r\n if (variantImageUrl) {\r\n productVariant.PrimaryImageUrl = variantImageUrl;\r\n }\r\n }\r\n\r\n return productVariant;\r\n};\r\n\r\n/**\r\n * Checks if given product has any unmatched dimensions.\r\n * Modifies product entity to use matched dimension values.\r\n * @param product - The product to analyze and modify.\r\n * @param matchingDimensionValues - Matched dimensions.\r\n * @returns True if has any unmatched dimension, false if all dimensions are specified.\r\n */\r\nconst checkIfHasUnmatchedDimensions = (product: SimpleProduct, matchingDimensionValues: ProductDimension[]): boolean => {\r\n let hasUnmatchedDimension: boolean = false;\r\n if (product.Dimensions) {\r\n product.Dimensions = product.Dimensions.map(dimension => {\r\n return { ...dimension };\r\n });\r\n for (const dimension of product.Dimensions) {\r\n const matchedTargetDimension = 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 hasUnmatchedDimension = true;\r\n }\r\n }\r\n }\r\n return hasUnmatchedDimension;\r\n};\r\n\r\nconst getProductVariantOrMaster = async (\r\n productId: number,\r\n matchingDimensionValues: ProductDimension[],\r\n context: Msdyn365.IActionContext\r\n) => {\r\n const result = await ProductsDataActions.getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n // bypassCache: input.bypassCache\r\n },\r\n context.requestContext.apiSettings.channelId,\r\n [productId],\r\n null,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n\r\n let product = result[0];\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 = { ...product };\r\n\r\n // Not all dimensions are selected\r\n if (matchingDimensionValues.find(dv => !dv.DimensionValue)) {\r\n return product;\r\n }\r\n\r\n const hasUnmatchedDimension = checkIfHasUnmatchedDimensions(product, matchingDimensionValues);\r\n\r\n if (hasUnmatchedDimension) {\r\n return product;\r\n }\r\n\r\n const fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = await getFullDimensions(\r\n product,\r\n matchingDimensionValues,\r\n context,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n\r\n // Retrieve product variants only if matching dimensions are provided.\r\n const productVariant: SimpleProduct | undefined = ArrayExtensions.hasElements(matchingDimensionValues)\r\n ? await getProductVariant(context, fullDimensions)\r\n : undefined;\r\n\r\n return productVariant ?? product;\r\n};\r\n\r\nexport { getProductVariantOrMaster };\r\n","import * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { createObservableDataAction, IAction, IActionContext } from '@msdyn365-commerce/core';\r\nimport { ProductsDataActions, WarrantyGroup, ProductDimension } from '@msdyn365-commerce/retail-proxy';\r\nimport { getSelectedProductIdFromActionInput, getDimensionValuesFromQuery } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { getProductVariantOrMaster } from './getProductVariantOrMaster';\r\n\r\nexport class getApplicableWarrantiesInput implements Msdyn365.IActionInput {\r\n public readonly recordId: number;\r\n public readonly dimensionValues: ProductDimension[];\r\n\r\n constructor(recordId: number, dimensionValues: ProductDimension[]) {\r\n this.recordId = recordId;\r\n this.dimensionValues = dimensionValues;\r\n }\r\n\r\n public getCacheKey = () => `${this.recordId}-${this.dimensionValues.map(v => v.DimensionValue?.Value ?? '').join('|')}`;\r\n public getCacheObjectType = () => 'HEI-ApplicableWarranties';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\nconst createInput = (context: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n const matchingDimensionValues = getDimensionValuesFromQuery(context.requestContext.url.requestUrl);\r\n const productId = getSelectedProductIdFromActionInput(context);\r\n if (productId) {\r\n return new getApplicableWarrantiesInput(+productId, matchingDimensionValues);\r\n } else {\r\n throw new Error('Unable to create GetProductInfoInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\nexport async function getApplicableWarrantiesAction(\r\n input: getApplicableWarrantiesInput,\r\n context: IActionContext\r\n): Promise {\r\n const matchingDimensionValues = input.dimensionValues;\r\n const productVariantOrMaster = await getProductVariantOrMaster(input.recordId, matchingDimensionValues, context);\r\n\r\n const applicableWarranties = await ProductsDataActions.getApplicableWarrantiesAsync(\r\n { callerContext: context },\r\n context.requestContext.apiSettings.catalogId,\r\n [productVariantOrMaster.RecordId]\r\n );\r\n\r\n const warrantyGroup = applicableWarranties.find(aw => aw.WarrantableProductId === productVariantOrMaster.RecordId);\r\n return warrantyGroup?.WarrantyGroups;\r\n}\r\n\r\n/**\r\n * The complete createGetApplicableWarrantiesInput data action.\r\n */\r\nexport const getApplicableWarrantiesActionDataAction = createObservableDataAction({\r\n id: 'hei-get-applicable-warranties',\r\n action: >getApplicableWarrantiesAction,\r\n input: createInput\r\n});\r\n\r\nexport default getApplicableWarrantiesActionDataAction;\r\n","// base on @msdyn365-commerce-modules/retail-actions/get-availabilities-cartlines\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 OrgUnitsDataActions,\r\n ProductsDataActions,\r\n ProductWarehouse,\r\n StoreOperationsDataActions\r\n} from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport {\r\n ActiveCartProductsInput,\r\n ArrayExtensions,\r\n buildCacheKey,\r\n createInventoryAvailabilitySearchCriteria,\r\n getActiveCartProductsAction,\r\n IProductInventoryInformation,\r\n mapAggregatedProductInventoryInformation,\r\n mapProductInventoryInformation,\r\n getFeatureState,\r\n createGetFeatureStateInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for availabilities for items in cart.\r\n */\r\nexport class ProductAvailabilitiesForCartLineItems implements IActionInput {\r\n private readonly 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\r\n public getCacheObjectType = () => 'ActiveCartLineItemsAvailability';\r\n\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 Feature State API and returns a list of feature with isEnabled flag.\r\n * @param cartLine\r\n * @param featureSate\r\n * @param channelDeliveryOptionConfig\r\n * @param pickupDeliveryMode\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\n/**\r\n * Calls the Retail API to get the product availabilities for items in the cart.\r\n * @param input\r\n * @param ctx\r\n */\r\n// eslint-disable-next-line complexity\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\r\n const shippingItems: CartLine[] = [];\r\n const bopisItemsDict: { [key: string]: CartLine } = {};\r\n let productAvailabilities: IProductInventoryInformation[] = [];\r\n const multiplePickupStoreSwitchName = 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature';\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 OrgUnitsDataActions.getOrgUnitConfigurationAsync({ callerContext: ctx });\r\n const products = await getActiveCartProductsAction(new ActiveCartProductsInput(), ctx);\r\n\r\n const featureState = await getFeatureState(createGetFeatureStateInput({ requestContext: ctx.requestContext }), ctx);\r\n const retailMultiplePickUpOptionEnabled = featureState?.find(item => item.Name === multiplePickupStoreSwitchName)?.IsEnabled;\r\n if (retailMultiplePickUpOptionEnabled) {\r\n channelDeliveryOptionConfig = await StoreOperationsDataActions.getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx });\r\n }\r\n const PickupDeliveryModeCode = channelConfiguration.PickupDeliveryModeCode;\r\n const EmailDeliveryModeCode = channelConfiguration.EmailDeliveryModeCode;\r\n\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 bopisItemsDict[`${cartLine.ProductId}-${cartLine.WarehouseId}`] = cartLine;\r\n } else if (EmailDeliveryModeCode === '' || 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 let productIds = shippingItems.map(x => x.ProductId!);\r\n productIds = ArrayExtensions.unique(productIds);\r\n const searchCriteria = createInventoryAvailabilitySearchCriteria(ctx, productIds, true);\r\n const shippingProductAvailabilities = await ProductsDataActions.getEstimatedAvailabilityAsync(\r\n { callerContext: ctx, bypassCache: 'get' },\r\n searchCriteria\r\n );\r\n\r\n if (\r\n shippingProductAvailabilities &&\r\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities &&\r\n shippingProductAvailabilities.ProductWarehouseInventoryAvailabilities.length > 0\r\n ) {\r\n productAvailabilities = mapAggregatedProductInventoryInformation(ctx, shippingProductAvailabilities);\r\n }\r\n }\r\n\r\n const bopisItems = Object.keys(bopisItemsDict).map(k => bopisItemsDict[k]);\r\n process.env.NODE_ENV === 'development' && console.log('get-availabilities-cartlines.action', bopisItems);\r\n if (bopisItems && bopisItems.length > 0) {\r\n const productWarehouses: ProductWarehouse[] = [];\r\n\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 productWarehouses.push(productWarehouse);\r\n }\r\n\r\n const quantityUnitTypeSales: number = 2;\r\n const getProductWarehouseAvail = await ProductsDataActions.getEstimatedProductWarehouseAvailabilityAsync(\r\n { callerContext: ctx, bypassCache: 'get', queryResultSettings: {} },\r\n productWarehouses,\r\n quantityUnitTypeSales\r\n );\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?.ProductWarehouseInventoryAvailabilities\r\n );\r\n if (productWarehouseMapping && productWarehouseMapping.length > 0) {\r\n for (const item of productWarehouseMapping) {\r\n productAvailabilities.push(item);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (productAvailabilities && productAvailabilities.length > 0) {\r\n return productAvailabilities;\r\n }\r\n\r\n ctx.trace('[getAvailabilitiesForCartLineItems] unable to get availabilities for product');\r\n return [];\r\n}\r\n\r\nexport const getAvailabilitiesForCartLineItemsDataAction = 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\nexport default getAvailabilitiesForCartLineItemsDataAction;\r\n","// base on @msdyn365-commerce-modules/retail-actions/get-full-available-inventory-nearby\r\n\r\nimport { createObservableDataAction, IAction, ICreateActionContext, IGeneric, IAny, IActionContext } from '@msdyn365-commerce/core';\r\nimport {\r\n ChannelDeliveryOption,\r\n DeliveryModeTypeFilter,\r\n ItemAvailability,\r\n OrgUnitAvailability,\r\n OrgUnitLocation,\r\n ProductWarehouseInventoryInformation,\r\n SearchArea,\r\n StoreHours,\r\n ProductsDataActions,\r\n OrgUnitsDataActions\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getDimensionValuesFromQuery,\r\n IFullOrgUnitAvailability,\r\n DeliveryMode,\r\n IProductInventoryInformation,\r\n QueryResultSettingsProxy,\r\n createInventoryAvailabilitySearchCriteria,\r\n mapProductInventoryInformation,\r\n GetFullAvailableInventoryNearbyInput,\r\n getFeatureState,\r\n createGetFeatureStateInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport { GetProductPromotionsInput, getProductPromotionsAction } from './get-product-promotions.action';\r\n\r\nexport const mergeBonusProductInventoryInformation = (\r\n productInventoryInformation: IProductInventoryInformation[],\r\n productId: number,\r\n bonusItemIds: number[]\r\n) => {\r\n // Merge availabilities with bonus items\r\n if (bonusItemIds.length > 0) {\r\n const mergedProductInventoryInformation = productInventoryInformation\r\n .filter(p => p.ProductAvailableQuantity.ProductId === productId)\r\n .map(p => {\r\n productInventoryInformation\r\n .filter(\r\n bonusItemInv =>\r\n bonusItemInv.InventLocationId === p.InventLocationId &&\r\n bonusItemInv.ProductAvailableQuantity.ProductId !== productId\r\n )\r\n .forEach(bonusItemInv => {\r\n if (\r\n (bonusItemInv.ProductAvailableQuantity.AvailableQuantity ?? 0) === 0 &&\r\n (p.ProductAvailableQuantity.AvailableQuantity ?? 0) > 0\r\n ) {\r\n process.env.NODE_ENV === 'development' &&\r\n console.log('getFullAvailableInventoryNearbyAction', 'missing bonus item', p, bonusItemInv);\r\n\r\n p.ProductAvailableQuantity.AvailableQuantity = bonusItemInv.ProductAvailableQuantity.AvailableQuantity;\r\n p.IsProductAvailable = false;\r\n p.StockLevelCode = bonusItemInv.StockLevelCode;\r\n p.StockLevelLabel = bonusItemInv.StockLevelLabel;\r\n }\r\n });\r\n return p;\r\n });\r\n\r\n process.env.NODE_ENV === 'development' && console.log('getFullAvailableInventoryNearbyAction', mergedProductInventoryInformation);\r\n return mergedProductInventoryInformation;\r\n }\r\n\r\n return productInventoryInformation;\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 * 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(createGetFeatureStateInput({ requestContext: ctx.requestContext }), ctx);\r\n const retailMulitplePickupMFeatureState = featureState?.find(\r\n item => item.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\r\n )?.IsEnabled;\r\n\r\n const matchingDimensionValues = getDimensionValuesFromQuery(ctx.requestContext.url.requestUrl);\r\n const getProductPromotionsInput = new GetProductPromotionsInput(input.productId, matchingDimensionValues);\r\n const promotions = await getProductPromotionsAction(getProductPromotionsInput, ctx);\r\n const bonusItemIds = promotions.FreeItemProductIds ?? [];\r\n\r\n process.env.NODE_ENV === 'development' && console.log('getFullAvailableInventoryNearbyAction', bonusItemIds);\r\n\r\n const searchCriteria = createInventoryAvailabilitySearchCriteria(\r\n ctx,\r\n [input.productId, ...bonusItemIds],\r\n false,\r\n true,\r\n searchArea,\r\n DeliveryMode.pickup\r\n );\r\n return ProductsDataActions.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 let productInventoryInformation = mapProductInventoryInformation(\r\n ctx,\r\n productWarehouseInformation.ProductWarehouseInventoryAvailabilities\r\n );\r\n\r\n process.env.NODE_ENV === 'development' && console.log('getFullAvailableInventoryNearbyAction', productInventoryInformation);\r\n\r\n productInventoryInformation = mergeBonusProductInventoryInformation(\r\n productInventoryInformation,\r\n input.productId!,\r\n bonusItemIds\r\n );\r\n\r\n return OrgUnitsDataActions.getOrgUnitLocationsByAreaAsync(\r\n {\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n },\r\n searchArea,\r\n DeliveryModeTypeFilter.Pickup\r\n )\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 availabilityPromiseList = stores.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 OrgUnitsDataActions.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?.forEach(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 OrgUnitsDataActions.getChannelDeliveryOptionsAsync(\r\n {\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n },\r\n channelIdList,\r\n 4\r\n )\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: 'hei-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.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport {\r\n getSelectedProductIdFromActionInput,\r\n getDimensionValuesFromQuery,\r\n QueryResultSettingsProxy,\r\n generateProductImageUrl,\r\n createInventoryAvailabilitySearchCriteria,\r\n ArrayExtensions\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n ProductDimension,\r\n ProductDimensionAvailabilitySearchCriteria,\r\n ProductsDataActions,\r\n SimpleProduct,\r\n retailAction\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { IGetProductPromotionResponse } from './DataServiceEntities.g';\r\nimport { getProductPromotionsV2Input } from './DataActionExtension.g';\r\nimport { IProductDimensionsWithAvailabilitiesFull } from '@msdyn365-commerce/commerce-entities';\r\n/**\r\n * GetProductPromotions Input Action\r\n */\r\nexport class GetProductPromotionsInput implements Msdyn365.IActionInput {\r\n public readonly recordId: number;\r\n public readonly dimensionValues: ProductDimension[];\r\n\r\n constructor(recordId: number, dimensionValues: ProductDimension[]) {\r\n this.recordId = recordId;\r\n this.dimensionValues = dimensionValues;\r\n }\r\n\r\n public getCacheKey = () => `${this.recordId}-${this.dimensionValues.map(v => v.DimensionValue?.Value ?? '').join('|')}`;\r\n public getCacheObjectType = () => 'HEI-ProductPromotions';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\nconst createInput = (context: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n const matchingDimensionValues = getDimensionValuesFromQuery(context.requestContext.url.requestUrl);\r\n const productId = getSelectedProductIdFromActionInput(context);\r\n if (productId) {\r\n return new GetProductPromotionsInput(+productId, matchingDimensionValues);\r\n } else {\r\n throw new Error('Unable to create GetProductInfoInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * Checks if given product has any unmatched dimensions.\r\n * Modifies product entity to use matched dimension values.\r\n * @param product - The product to analyze and modify.\r\n * @param matchingDimensionValues - Matched dimensions.\r\n * @returns True if has any unmatched dimension, false if all dimensions are specified.\r\n */\r\nconst checkIfHasUnmatchedDimensions = (product: SimpleProduct, matchingDimensionValues: ProductDimension[]): boolean => {\r\n let hasUnmatchedDimension: boolean = false;\r\n if (product.Dimensions) {\r\n product.Dimensions = product.Dimensions.map(dimension => {\r\n return { ...dimension };\r\n });\r\n for (const dimension of product.Dimensions) {\r\n const matchedTargetDimension = 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 hasUnmatchedDimension = true;\r\n }\r\n }\r\n }\r\n return hasUnmatchedDimension;\r\n};\r\n\r\n/**\r\n * Retrieves product dimensions with availabilities.\r\n * @param product - Product for which the dimensions need to be retrieved.\r\n * @param matchingDimensionValues - Selected dimensions - filter criteria for the dimensions API.\r\n * @param context - Action context.\r\n * @param catalogId - Catalog id.\r\n * @returns Array of dimensions.\r\n */\r\nconst getFullDimensions = async (\r\n product: SimpleProduct,\r\n matchingDimensionValues: ProductDimension[],\r\n context: Msdyn365.IActionContext,\r\n catalogId?: number\r\n) => {\r\n let fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = [];\r\n const fullDimensionPromises = (product.Dimensions ?? []).map(dimension => {\r\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\r\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\r\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\r\n MatchingDimensionValues: matchingDimensionValues,\r\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\r\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\r\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\r\n CatalogId: catalogId\r\n };\r\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\r\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\r\n product.MasterProductId ? product.MasterProductId : product.RecordId,\r\n searchCriteria\r\n );\r\n\r\n return dimensionValuesPromise.then(dimensionValues => {\r\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\r\n ...dimension,\r\n dimensionValuesWithInventory: dimensionValues\r\n };\r\n return fullDimension;\r\n });\r\n });\r\n fullDimensions = await Promise.all(fullDimensionPromises);\r\n return fullDimensions;\r\n};\r\n\r\n/**\r\n * Retrieves product variant for the given input or undefined if not found.\r\n * @param input - Action input.\r\n * @param context - Action context.\r\n * @param fullDimensions - Product dimensions with availabilities.\r\n * @returns A product variant that is available or undefined.\r\n */\r\nconst getProductVariant = async (context: Msdyn365.IActionContext, fullDimensions: IProductDimensionsWithAvailabilitiesFull[]) => {\r\n let productVariant: SimpleProduct | undefined;\r\n if (\r\n ArrayExtensions.hasElements(fullDimensions) &&\r\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory) &&\r\n ArrayExtensions.hasElements(fullDimensions[0].dimensionValuesWithInventory[0].ProductIds)\r\n ) {\r\n const variantProductId = fullDimensions[0].dimensionValuesWithInventory[0].ProductIds[0];\r\n const result = await ProductsDataActions.getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n //bypassCache: input.bypassCache\r\n },\r\n context.requestContext.apiSettings.channelId,\r\n [variantProductId],\r\n null,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n productVariant = result[0];\r\n productVariant = { ...productVariant };\r\n const variantImageUrl = generateProductImageUrl(productVariant, context.requestContext.apiSettings);\r\n\r\n if (variantImageUrl) {\r\n productVariant.PrimaryImageUrl = variantImageUrl;\r\n }\r\n }\r\n\r\n return productVariant;\r\n};\r\n\r\nexport async function getProductPromotionsAction(\r\n input: GetProductPromotionsInput,\r\n context: Msdyn365.IActionContext\r\n): Promise {\r\n const matchingDimensionValues = input.dimensionValues;\r\n\r\n const result = await ProductsDataActions.getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n // bypassCache: input.bypassCache\r\n },\r\n context.requestContext.apiSettings.channelId,\r\n [input.recordId],\r\n null,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n let product = result[0];\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 = { ...product };\r\n const hasUnmatchedDimension = checkIfHasUnmatchedDimensions(product, matchingDimensionValues);\r\n\r\n const newImageUrl = generateProductImageUrl(product, context.requestContext.apiSettings);\r\n\r\n if (newImageUrl) {\r\n product.PrimaryImageUrl = newImageUrl;\r\n }\r\n\r\n const fullDimensions: IProductDimensionsWithAvailabilitiesFull[] = await getFullDimensions(\r\n product,\r\n matchingDimensionValues,\r\n context,\r\n context.requestContext.apiSettings.catalogId\r\n );\r\n\r\n // Retrieve product variants only if matching dimensions are provided.\r\n const productVariant: SimpleProduct | undefined = ArrayExtensions.hasElements(matchingDimensionValues)\r\n ? await getProductVariant(context, fullDimensions)\r\n : undefined;\r\n\r\n // Update dimension value back to the one that comes from API since the URL query might have a different format for the dimension values.\r\n if (productVariant?.Dimensions && product.Dimensions) {\r\n for (const dimension of product.Dimensions) {\r\n const matchedTargetDimensionFromApi = productVariant.Dimensions.find(\r\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\r\n );\r\n const matchedTargetDimensionFromSearch = matchingDimensionValues.find(\r\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\r\n );\r\n\r\n if (matchedTargetDimensionFromSearch && matchedTargetDimensionFromApi) {\r\n dimension.DimensionValue = matchedTargetDimensionFromApi.DimensionValue;\r\n }\r\n }\r\n }\r\n\r\n let distinctProductVariantId = input.recordId;\r\n if (!hasUnmatchedDimension && ArrayExtensions.hasElements(matchingDimensionValues) && productVariant) {\r\n distinctProductVariantId = productVariant.RecordId;\r\n }\r\n\r\n var productPromotionsInput = getProductPromotionsV2Input(input.recordId, distinctProductVariantId);\r\n return retailAction(productPromotionsInput, context);\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getProductPromotionsAction,\r\n id: 'hei-get-product-promotions',\r\n input: createInput\r\n // isBatched: true\r\n});\r\n","import { IActionContext } from '@msdyn365-commerce/core';\r\n\r\nexport const createCanonicalUrl = (context: IActionContext, paths: string[], page: string) => {\r\n let canonicalDomainHost = `https://${context.requestContext.canonicalDomain}`;\r\n if (process.env.NODE_ENV === 'development') {\r\n canonicalDomainHost = '';\r\n }\r\n\r\n const sitePath = context.requestContext.sitePath ?? '';\r\n\r\n const url = `${canonicalDomainHost}${sitePath}/${paths\r\n .map(p => toSlug(p))\r\n .filter(s => s.length > 0)\r\n .join('/')}/${page}`;\r\n return url;\r\n};\r\n\r\nconst toSlug = (text: string) => {\r\n const slug = text\r\n .toLowerCase()\r\n .replace(/[^A-Za-z\\u00C0-\\u017F0-9]/g, '-')\r\n .replace(/--+/g, '-')\r\n .replace(/^-/, '')\r\n .replace(/-$/, '');\r\n\r\n return slug;\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 getFriendlyName,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n ArrayExtensions,\r\n buildCacheKeyWithUrlTokens,\r\n CategoriesInput,\r\n CurrentCategoryInput,\r\n getCategoriesHierarchy\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { ICategoryPageSummaryConfig } from './category-page-summary.props.autogenerated';\r\nimport { IDefaultPageSummaryConfig } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { createCanonicalUrl } from '../../common/utilities/createCanonicalUrl';\r\n\r\n/**\r\n * Category Page Summary Input\r\n */\r\nexport class CategoryPageSummaryInput implements IActionInput {\r\n public requestContext: IRequestContext;\r\n\r\n public config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig;\r\n\r\n constructor(config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig, requestContext: IRequestContext) {\r\n this.config = config || {};\r\n this.requestContext = requestContext;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'CategoryPageSummary';\r\n\r\n public getCacheKey = (): string =>\r\n `${buildCacheKeyWithUrlTokens(`CategoryPageSummary-${this.requestContext.locale}`, this.requestContext)}-${this.requestContext\r\n .locale ?? ''}`;\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nconst createGetCurrentCategoryInput = (\r\n inputData: IActionContext,\r\n config?: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig\r\n): CurrentCategoryInput => {\r\n if (inputData && inputData.requestContext) {\r\n let includeRootCategory: boolean | undefined;\r\n if (config) {\r\n includeRootCategory = (config as ICategoryPageSummaryConfig).includeRootCategory;\r\n }\r\n return new CurrentCategoryInput(inputData.requestContext, includeRootCategory);\r\n }\r\n\r\n throw new Error('Please specify categoryId query string in request.');\r\n};\r\n\r\nconst action = async (input: CategoryPageSummaryInput, context: IActionContext): Promise => {\r\n const { config } = input;\r\n let categoryHierarchy: CategoryHierarchy[] | null = null;\r\n try {\r\n const getCurrentCategoryInput = createGetCurrentCategoryInput(context, input.config);\r\n const fullCategoryHierarchy = await getCategoriesHierarchy(new CategoriesInput(context.requestContext, true, 1000), context);\r\n categoryHierarchy = findCategoryHierarchy(fullCategoryHierarchy, getCurrentCategoryInput.categoryId!);\r\n } catch {\r\n // Do nothing, if the action fails fallback to values defined in data\r\n }\r\n if (ArrayExtensions.hasElements(categoryHierarchy)) {\r\n const currentCategory = categoryHierarchy[0];\r\n\r\n const locale = context.requestContext.locale;\r\n let names = categoryHierarchy.map(c => getFriendlyName(locale, c.NameTranslations) ?? '').reverse();\r\n\r\n if (locale === 'fr-CA') {\r\n names = ['catégories', ...names];\r\n } else {\r\n names = ['categories', ...names];\r\n }\r\n\r\n let canonicalUrl = createCanonicalUrl(context, names, `${currentCategory.RecordId}.c`);\r\n\r\n const page = context.requestContext.url.requestUrl.searchParams?.get('page');\r\n if (page) {\r\n canonicalUrl = `${canonicalUrl}?page=${page}`;\r\n }\r\n\r\n const title = currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nKeyword')?.Value?.StringValue ?? currentCategory.Name;\r\n\r\n return {\r\n title: `${title} | Henry\\'s`,\r\n description: currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nDesc')?.Value?.StringValue,\r\n // keywords: currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nKeyword')?.Value?.StringValue,\r\n sharingImageUrl: currentCategory.OfflineImage,\r\n canonicalUrl,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n\r\n // If the action fails fallback to values defined from data\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\n\r\n/**\r\n * Finds the given category in the list of categories and returns an array with the info on where it's located.\r\n * @param categories - Categories list to search from.\r\n * @param categoryId - The category id to find.\r\n * @returns A list of categories starting from the given category id, ending up the root parent.\r\n */\r\nconst findCategoryHierarchy = (categories: CategoryHierarchy[], categoryId: number): CategoryHierarchy[] | null => {\r\n for (const category of categories) {\r\n if (category.RecordId === categoryId) {\r\n return [category];\r\n }\r\n\r\n if (ArrayExtensions.hasElements(category.Children)) {\r\n const innerCategoryHierarchy = findCategoryHierarchy(category.Children, categoryId);\r\n if (ArrayExtensions.hasElements(innerCategoryHierarchy)) {\r\n innerCategoryHierarchy.push(category);\r\n return innerCategoryHierarchy;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\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 IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { buildCacheKeyWithUrlTokens, removeDomainQspFromUrl } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IDefaultPageSummaryConfig } from './default-page-summary.props.autogenerated';\r\n\r\nexport interface IPageSummaryData {\r\n title?: string;\r\n description?: string;\r\n keywords?: string;\r\n sharingImageUrl?: string;\r\n canonicalUrl?: string;\r\n faviconUrl?: string;\r\n}\r\n\r\n/**\r\n * Page Summary Input\r\n */\r\nexport class PageSummaryInput implements IActionInput {\r\n public requestContext: IRequestContext;\r\n\r\n public config: IDefaultPageSummaryConfig;\r\n\r\n constructor(config: IDefaultPageSummaryConfig, requestContext: IRequestContext) {\r\n this.config = config || {};\r\n this.requestContext = requestContext;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'PageSummary';\r\n\r\n public getCacheKey = (): string => `${buildCacheKeyWithUrlTokens('PageSummary', this.requestContext)}-${this.config.title}`;\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nconst action = async (input: PageSummaryInput, context: IActionContext): Promise => {\r\n const { config } = input;\r\n return {\r\n title: config && config.title,\r\n description: config && config.description,\r\n keywords: config && config.keywords,\r\n sharingImageUrl: config && config.sharingImage && config.sharingImage.src,\r\n canonicalUrl:\r\n context.requestContext && context.requestContext.canonicalUrl\r\n ? removeDomainQspFromUrl(context.requestContext.canonicalUrl, context.requestContext)\r\n : undefined,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/default-page-summary',\r\n action: >action,\r\n input: (args: ICreateActionContext) => {\r\n return new PageSummaryInput(args.config, args.requestContext);\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\n/* eslint-disable no-duplicate-imports */\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 { getAttributeValuesAsync, getByIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n buildCacheKey,\r\n generateImageUrl,\r\n getProductUrlSync,\r\n getSelectedProductIdFromActionInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IProductPageSummaryConfig } from './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: IProductPageSummaryConfig;\r\n\r\n public productId: number;\r\n\r\n public locale: string;\r\n\r\n constructor(config: IProductPageSummaryConfig, apiSettings: ICommerceApiSettings, productId: number, locale: string) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.productId = productId;\r\n this.locale = locale;\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.locale}`;\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.locale\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 { callerContext: context, queryResultSettings: {} },\r\n recordId,\r\n channelId,\r\n catalogId\r\n );\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 let simpleProductData;\r\n try {\r\n simpleProductData = await getByIdAsync({ callerContext: context }, productId, apiSettings.channelId);\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 (simpleProductData) {\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 } else {\r\n productUrl = undefined;\r\n }\r\n } catch {\r\n productUrl = undefined;\r\n }\r\n\r\n let productBrand = simpleProductData?.ExtensionProperties?.find(ep => ep.Key === 'Brand')?.Value?.StringValue;\r\n if (!productBrand) {\r\n try {\r\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, apiSettings.catalogId);\r\n } catch {\r\n productBrand = undefined;\r\n }\r\n }\r\n\r\n return {\r\n title: simpleProductData.Name,\r\n description: simpleProductData.Description,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n 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","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 = 'actions/get-applicable-warranties.action';\n binding.dataActions[actionPath] = require('partner/actions/get-applicable-warranties.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-availabilities-cartlines.action';\n binding.dataActions[actionPath] = require('partner/actions/get-availabilities-cartlines.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-full-available-inventory-nearby.action';\n binding.dataActions[actionPath] = require('partner/actions/get-full-available-inventory-nearby.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-product-promotions.action';\n binding.dataActions[actionPath] = require('partner/actions/get-product-promotions.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/category-page-summary/category-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/category-page-summary/category-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/default-page-summary/default-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/default-page-summary/default-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/product-page-summary/product-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/product-page-summary/product-page-summary.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":["getProductVariantOrMaster","async","productId","matchingDimensionValues","context","product","ProductsDataActions","callerContext","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","requestContext","apiSettings","channelId","catalogId","_objectSpread","find","dv","DimensionValue","checkIfHasUnmatchedDimensions","hasUnmatchedDimension","Dimensions","map","dimension","matchedTargetDimension","targetDimension","DimensionTypeValue","fullDimensions","_product$Dimensions","fullDimensionPromises","shippingInventoryConfiguration","createInventoryAvailabilitySearchCriteria","undefined","searchCriteria","RequestedDimensionTypeValue","MatchingDimensionValues","DefaultWarehouseOnly","FilterByChannelFulfillmentGroup","DeliveryModeTypeFilterValue","CatalogId","MasterProductId","RecordId","then","dimensionValues","dimensionValuesWithInventory","Promise","all","getFullDimensions","productVariant","ArrayExtensions","hasElements","ProductIds","variantProductId","variantImageUrl","generateProductImageUrl","PrimaryImageUrl","getProductVariant","getApplicableWarrantiesInput","constructor","recordId","getCacheKey","this","v","_v$DimensionValue$Val","_v$DimensionValue","Value","join","getCacheObjectType","dataCacheType","getApplicableWarrantiesAction","input","productVariantOrMaster","warrantyGroup","aw","WarrantableProductId","WarrantyGroups","getApplicableWarrantiesActionDataAction","createObservableDataAction","id","action","getDimensionValuesFromQuery","url","requestUrl","getSelectedProductIdFromActionInput","Error","ProductAvailabilitiesForCartLineItems","buildCacheKey","getDeliveryMode","cartLine","_channelDeliveryOptio","featureSate","arguments","length","channelDeliveryOptionConfig","pickupDeliveryMode","DeliveryMode","PickupDeliveryModeCodes","deliveryMode","getAvailabilitiesForCartLineItems","ctx","_featureState$find","shippingItems","bopisItemsDict","productAvailabilities","cart","getCartState","channelConfiguration","OrgUnitsDataActions","products","getActiveCartProductsAction","ActiveCartProductsInput","featureState","getFeatureState","createGetFeatureStateInput","retailMultiplePickUpOptionEnabled","item","Name","IsEnabled","StoreOperationsDataActions","PickupDeliveryModeCode","EmailDeliveryModeCode","trace","Id","CartLines","ProductId","WarehouseId","push","productIds","x","unique","shippingProductAvailabilities","bypassCache","ProductWarehouseInventoryAvailabilities","mapAggregatedProductInventoryInformation","bopisItems","Object","keys","k","productWarehouses","bopisItem","productWarehouse","InventLocationId","channel","InventLocationDataAreaId","DataAreaId","quantityUnitTypeSales","getProductWarehouseAvail","productWarehouseMapping","mapProductInventoryInformation","getAvailabilitiesForCartLineItemsDataAction","inputData","mergeBonusProductInventoryInformation","productInventoryInformation","bonusItemIds","filter","p","ProductAvailableQuantity","bonusItemInv","forEach","_bonusItemInv$Product","_p$ProductAvailableQu","AvailableQuantity","IsProductAvailable","StockLevelCode","StockLevelLabel","createGetFullAvailableInventoryNearbyInput","GetFullAvailableInventoryNearbyInput","getFullAvailableInventoryNearbyAction","_promotions$FreeItemP","radius","latitude","longitude","IgnoreLocation","searchArea","Latitude","Longitude","Radius","DistanceUnitValue","retailMulitplePickupMFeatureState","getProductPromotionsInput","GetProductPromotionsInput","getProductPromotionsAction","FreeItemProductIds","pickup","productWarehouseInformation","DeliveryModeTypeFilter","Pickup","storeMap","Map","stores","store","InventoryLocationId","set","locationDeliveryOptions","orgUnitChannel","ChannelId","channelCollection","channelIdList","channelDeliveryOptions","catch","error","message","telemetry","exception","debug","_getLocationPickUpDeliveryModes","availabilityPromiseList","_locationDeliveryOpti","locationDeliveryOption","_channeldeliveryoption","orgUnitLocation","channelDeleiveryOptions","OrgUnitNumber","OrgUnitAvailability","hours","itemAvailabilities","element","_element$ProductAvail","has","availability","OrgUnitLocation","ItemAvailabilities","ProductInventoryInformation","OrgUnitPickUpDeliveryModes","StoreHours","_getAvailabilityWithHours","getFullAvailableInventoryNearbyActionDataAction","newImageUrl","matchedTargetDimensionFromApi","distinctProductVariantId","productPromotionsInput","getProductPromotionsV2Input","retailAction","Msdyn365","createCanonicalUrl","paths","page","_context$requestConte","canonicalDomain","sitePath","toSlug","s","text","toLowerCase","replace","CategoryPageSummaryInput","config","_this$requestContext$","buildCacheKeyWithUrlTokens","locale","findCategoryHierarchy","categories","categoryId","category","Children","innerCategoryHierarchy","categoryHierarchy","getCurrentCategoryInput","createGetCurrentCategoryInput","includeRootCategory","CurrentCategoryInput","fullCategoryHierarchy","getCategoriesHierarchy","CategoriesInput","_unused","_currentCategory$Exte","_currentCategory$Exte2","_currentCategory$Exte3","currentCategory","names","c","_getFriendlyName","getFriendlyName","NameTranslations","reverse","canonicalUrl","searchParams","get","title","ExtensionProperties","ep","Key","StringValue","description","sharingImageUrl","OfflineImage","faviconUrl","sharingImage","src","args","PageSummaryInput","keywords","removeDomainQspFromUrl","ProductPageSummaryInput","simpleProductData","getByIdAsync","_simpleProductData","productUrl","getProductUrlSync","toLocaleLowerCase","_unused2","productBrand","productAttributes","getAttributeValuesAsync","productAttribute","TextValue","getProductBrand","_unused3","Description","generateImageUrl","price","AdjustedPrice","binding","modules","dataActions","registerActionId","actionPath","default","prototype","exportName","Action","require","window","__bindings__","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}