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,UAAWuD,GAAAA,CAAW,wBAAyBvD,IAEnDxJ,mBAAoB,CAChBuJ,IAAK,KACLC,UAAW,gCAEfvJ,WAAAA,EAEAH,SACIoB,EAAAA,gBAAgBC,YAAY+K,IAC5BA,EAAgB7P,QAAO8P,QACHxW,IAATwW,IAEfV,cAAezF,KAAKyF,cACpBvL,aACIwK,GAAkBkB,GAA6B1K,EAAAA,gBAAgBC,YAAY+K,GACrElG,KAAKyE,iBAAiBC,EAAgBC,QACtChV,IAEd,OAAOqQ,KAAKrK,MAAMqR,WAAWT,IAoLrC,+EC3TA,MAwBM/R,EAAkBA,CAACC,EAA+BC,IAC7CS,EAAAA,cAACC,EAAAA,KAAIC,OAAAC,OAAA,GAAKb,GAAoBC,GAASA,EAAMpC,IAAIkD,IAGtDO,EAAcA,CAACC,EAA2BtB,IACrCS,EAAAA,cAACC,EAAAA,KAAIC,OAAAC,OAAA,GAAKU,GAAgBtB,GAASA,EAAMpC,IAAIkD,IAGlDA,EAAkB1F,IACpB,MAAM,iBAAEqG,EAAgB,iBAAET,GAAqB5F,EAE/C,OAAOqF,EAAAA,cAACC,EAAAA,KAAIC,OAAAC,OAAA,GAAKa,GAAmBT,IAGxC,EAtCqEC,IACjE,MAAM,QACFiE,EAAO,2BACPC,EAA0B,SAC1BC,EAAQ,kCACRC,EAAiC,mBACjCC,EAAkB,WAClBC,EAAU,aACVC,GACAvE,EAEJ,OAAImE,EAEI3E,EAAAA,cAACwI,EAAAA,OAAMtI,OAAAC,OAAA,GAAKuE,GACPD,EACAM,EACAD,EAAazF,EAAgBuF,EAAmCD,GAAY/D,EAAYiE,EAAoBF,KAIzHnE,EAAMlH,QAAQoP,UAAUC,MAAM,4DACvB,cC/BXmJ,EAAOC,QAAU/R,cCAjB8R,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/get-product-unit-of-measure-options.action.ts?bc1e","webpack://Msdyn365.Commerce.Online/./src/components/common/product-inventory-utils.ts?8daa","webpack://Msdyn365.Commerce.Online/./src/shared-utils/attributes/on-buy-access-validator.ts?4b31","webpack://Msdyn365.Commerce.Online/./src/themes/dlvry-adventureworks/views/product-collection.view.tsx?17ff","webpack://Msdyn365.Commerce.Online/./lib/product-collection/module-registration.js?36d3","webpack://Msdyn365.Commerce.Online/./src/modules/product-collection/product-collection.tsx?4008","webpack://Msdyn365.Commerce.Online/./src/modules/product-collection/product-collection.view.tsx?5d36","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["import { callActionOrExecute, DataServiceQuery, IContext, IDataServiceRequest, IQueryResultSettings } from \"@msdyn365-commerce/retail-proxy\";\r\nimport * as Entities from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g';\r\nimport * as Types from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\nfunction getProductUnitOfMeasureOptionsQuery(): DataServiceQuery {\r\n return new DataServiceQuery();\r\n}\r\n\r\n\r\nexport function getProductUnitOfMeasureOptionsInput(\r\n queryResultSettings: IQueryResultSettings, productIds:\r\n number[]\r\n): IDataServiceRequest {\r\n const query = getProductUnitOfMeasureOptionsQuery().resultSettings(queryResultSettings);\r\n query.top(10000);\r\n return query.createDataServiceRequestForOperation(\r\n 'GetProductUnitOfMeasureOptions',\r\n true, Entities.UnitOfMeasureConversionClass,\r\n 'true',\r\n { bypassCache: 'none', returnEntity: 'Entities.UnitOfMeasureConversion' },\r\n {\r\n productIds: productIds\r\n }\r\n );\r\n}\r\n\r\nexport async function getProductUnitOfMeasureOptionsAsync(context: IContext, productIds: number[]): Promise {\r\n const request = getProductUnitOfMeasureOptionsInput(\r\n context.queryResultSettings || {}, productIds);\r\n const conversions = await callActionOrExecute(request, context.callerContext);\r\n return conversions;\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 { IActionContext } from '@msdyn365-commerce/core';\r\nimport {\r\n InventoryAvailabilitySearchCriteria,\r\n ProductAvailableQuantity,\r\n ProductWarehouseInventoryAvailability,\r\n ProductWarehouseInventoryInformation,\r\n SearchArea\r\n} from '@msdyn365-commerce/retail-proxy';\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 = 'inventoryThreshold'\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\r\n/**\r\n * This setting defines the inventory level values return by the API.\r\n */\r\nexport enum InventoryLevelValues {\r\n outOfStock = 'OOS',\r\n available = 'AVAIL'\r\n}\r\n/**\r\n * The function defines whether the inventory label should be displayed or not.\r\n * @param context - The action context.\r\n * @param inventoryCode - The inventory code.\r\n * @returns Boolean.\r\n */\r\nexport function displayLabelEnabled(context: IActionContext, inventoryCode?: string): boolean {\r\n if (!inventoryCode) {\r\n return false;\r\n }\r\n\r\n // eslint-disable-next-line default-case\r\n switch (context.requestContext.app.config.inventoryRanges) {\r\n case 'lowAndOutofStock':\r\n if (inventoryCode !== InventoryLevelValues.available) {\r\n return true;\r\n }\r\n break;\r\n case 'outOfStock':\r\n if (inventoryCode === InventoryLevelValues.outOfStock) {\r\n return true;\r\n }\r\n break;\r\n case 'all':\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * The function that maps a ProductWareHouse object into a ProductAvailabilityQuantity.\r\n * @param context - The action context.\r\n * @param productsWarehouseInventory - The product warehouse inventory information.\r\n * @returns IProductInventoryInformation[].\r\n */\r\nexport function mapProductInventoryInformation(\r\n context: IActionContext,\r\n productsWarehouseInventory?: ProductWarehouseInventoryAvailability[]\r\n): IProductInventoryInformation[] {\r\n const productInventoryInformation: IProductInventoryInformation[] = [];\r\n\r\n if (context.requestContext.app.config.enableStockCheck === undefined || context.requestContext.app.config.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 switch (context.requestContext.app.config.inventoryLevel) {\r\n case InventoryLevels.physicalAvailable:\r\n // Inventory level is enabled with Physical inventory\r\n const physicalProductMap = mapInventoryWithPhysicalBufferEnabled(context, product);\r\n if (physicalProductMap) {\r\n productInventoryInformation.push(physicalProductMap);\r\n }\r\n break;\r\n case InventoryLevels.totalAvailable:\r\n // Inventory level is enabled with Total available inventory\r\n const totalAvailableProductMap = mapInventoryWithTotalAvailableBufferEnabled(context, 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(context, product);\r\n if (productMap) {\r\n productInventoryInformation.push(productMap);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return productInventoryInformation;\r\n}\r\n\r\n/**\r\n * The function that maps inventory for when threshold is selected.\r\n * @param context - The action context.\r\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\r\n * @returns IProductInventoryInformation.\r\n */\r\nexport function mapInventoryWithThresholdEnabled(\r\n context: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n): IProductInventoryInformation | null {\r\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\r\n const productQty = productWarehouseInventoryAvailability.TotalAvailable - context.requestContext.app.config.outOfStockThreshold;\r\n const productAvailableQuantity: ProductAvailableQuantity = {\r\n ProductId: productWarehouseInventoryAvailability.ProductId,\r\n AvailableQuantity: productQty > 0 ? productQty : 0\r\n };\r\n\r\n return {\r\n ProductAvailableQuantity: productAvailableQuantity,\r\n IsProductAvailable: !!(productAvailableQuantity.AvailableQuantity && productAvailableQuantity.AvailableQuantity > 0),\r\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\r\n };\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * The function that maps inventory for when physical available is selected.\r\n * @param context - The action context.\r\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\r\n * @returns IProductInventoryInformation.\r\n */\r\nexport function mapInventoryWithPhysicalBufferEnabled(\r\n context: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n): IProductInventoryInformation | null {\r\n const shouldRenderLabel = displayLabelEnabled(context, productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode);\r\n\r\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\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 let productQuantity: number | undefined = 0;\r\n if (productWarehouseInventoryAvailability.PhysicalAvailableInventoryLevelCode !== InventoryLevelValues.outOfStock) {\r\n productQuantity =\r\n productWarehouseInventoryAvailability.MaximumPurchasablePhysicalAvailableQuantity ??\r\n productWarehouseInventoryAvailability.PhysicalAvailable;\r\n }\r\n\r\n const productAvailableQuantity: 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\r\n return null;\r\n}\r\n\r\n/**\r\n * The function that maps inventory for when total available is selected.\r\n * @param context - The action context.\r\n * @param productWarehouseInventoryAvailability - The product warehouse inventory information.\r\n * @returns IProductInventoryInformation.\r\n */\r\nexport function mapInventoryWithTotalAvailableBufferEnabled(\r\n context: IActionContext,\r\n productWarehouseInventoryAvailability: ProductWarehouseInventoryAvailability\r\n): IProductInventoryInformation | null {\r\n const shouldRenderLabel = displayLabelEnabled(context, productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode);\r\n if (productWarehouseInventoryAvailability.ProductId && productWarehouseInventoryAvailability.TotalAvailable !== undefined) {\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 let productQuantity: number | undefined = 0;\r\n if (productWarehouseInventoryAvailability.TotalAvailableInventoryLevelCode !== InventoryLevelValues.outOfStock) {\r\n productQuantity =\r\n productWarehouseInventoryAvailability.MaximumPurchasableTotalAvailableQuantity ??\r\n productWarehouseInventoryAvailability.TotalAvailable;\r\n }\r\n\r\n const productAvailableQuantity: 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 // eslint-disable-next-line eqeqeq\r\n IsProductAvailable: productAvailableQuantity.AvailableQuantity != undefined && productAvailableQuantity.AvailableQuantity > 0,\r\n InventLocationId: productWarehouseInventoryAvailability.InventLocationId\r\n };\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\r\n * @param context - The action context.\r\n * @returns Boolean.\r\n */\r\nexport function isAggregatedInventory(context: IActionContext): boolean {\r\n // If warehouse aggregated is true then query inventory from multiple warehouses\r\n // else query from single warehouse\r\n return (\r\n (context.requestContext.app.config.inventoryLevel === InventoryLevels.totalAvailable ||\r\n context.requestContext.app.config.inventoryLevel === InventoryLevels.physicalAvailable) &&\r\n context.requestContext.app.config.warehouseAggregation === 'multiple'\r\n );\r\n}\r\n\r\n/**\r\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\r\n * @param context - The action context.\r\n * @param productWarehouseInventoryInformation - The product ware house inventory information.\r\n * @returns ProductWarehouseInventoryInformation.\r\n */\r\nexport function mapAggregatedProductInventoryInformation(\r\n context: IActionContext,\r\n productWarehouseInventoryInformation: ProductWarehouseInventoryInformation\r\n): IProductInventoryInformation[] {\r\n if (isAggregatedInventory(context)) {\r\n const productInventoryMapping:\r\n | ProductWarehouseInventoryAvailability[]\r\n | undefined = productWarehouseInventoryInformation.AggregatedProductInventoryAvailabilities?.map(product => {\r\n return {\r\n DataAreaId: product.DataAreaId,\r\n MaximumPurchasablePhysicalAvailableQuantity:\r\n product.MaximumPurchasablePhysicalAvailableQuantity ?? product.PhysicalAvailableQuantity,\r\n MaximumPurchasableTotalAvailableQuantity:\r\n product.MaximumPurchasableTotalAvailableQuantity ?? product.TotalAvailableQuantity,\r\n ProductId: product.ProductId,\r\n PhysicalAvailable: product.PhysicalAvailableQuantity,\r\n PhysicalAvailableInventoryLevelCode: product.PhysicalAvailableInventoryLevelCode,\r\n PhysicalAvailableInventoryLevelLabel: product.PhysicalAvailableInventoryLevelLabel,\r\n TotalAvailable: product.TotalAvailableQuantity,\r\n TotalAvailableInventoryLevelCode: product.TotalAvailableInventoryLevelCode,\r\n TotalAvailableInventoryLevelLabel: product.TotalAvailableInventoryLevelLabel\r\n };\r\n });\r\n return mapProductInventoryInformation(context, productInventoryMapping);\r\n }\r\n\r\n return mapProductInventoryInformation(context, productWarehouseInventoryInformation.ProductWarehouseInventoryAvailabilities);\r\n}\r\n\r\n/**\r\n * The function created a InventoryAvailabilitySearchCriteria object for getEstimatedAvailability API.\r\n * @param context - The action context.\r\n * @param productIds - The product id collection.\r\n * @param isDefaultWareHouse - Flag to define whether inventory is from default warehouse or not.\r\n * @param isFilterByChannelFulfillmentGroup - Filter by fulfillment group.\r\n * @param searchArea - The search area.\r\n * @param defaultDeliveryMode - The delivery mode.\r\n * @returns InventoryAvailabilitySearchCriteria.\r\n */\r\nexport function createInventoryAvailabilitySearchCriteria(\r\n context: IActionContext,\r\n productIds: number[],\r\n isDefaultWareHouse?: boolean,\r\n isFilterByChannelFulfillmentGroup?: boolean,\r\n searchArea?: SearchArea,\r\n defaultDeliveryMode?: DeliveryMode\r\n): InventoryAvailabilitySearchCriteria {\r\n const salesUnitType = 2;\r\n const deliveryMode = defaultDeliveryMode ? defaultDeliveryMode : DeliveryMode.shipping;\r\n\r\n const inventoryAvailabilitySearchCriteria: InventoryAvailabilitySearchCriteria = {\r\n ProductIds: productIds,\r\n QuantityUnitTypeValue: salesUnitType,\r\n SearchArea: searchArea\r\n };\r\n\r\n if (isAggregatedInventory(context)) {\r\n inventoryAvailabilitySearchCriteria.FilterByChannelFulfillmentGroup = true;\r\n inventoryAvailabilitySearchCriteria.DeliveryModeTypeFilterValue = deliveryMode;\r\n } else {\r\n inventoryAvailabilitySearchCriteria.DefaultWarehouseOnly = isDefaultWareHouse;\r\n inventoryAvailabilitySearchCriteria.FilterByChannelFulfillmentGroup = isFilterByChannelFulfillmentGroup;\r\n }\r\n\r\n return inventoryAvailabilitySearchCriteria;\r\n}\r\n","import { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductSearchResultExt } from \"../../modules/dlvry-search-result-container/components\";\r\nimport { Customer } from '@msdyn365-commerce/retail-proxy';\r\nimport { hasAccessToBuy } from '.';\r\n\r\nexport interface OnBuyHasAccessValidatorResult {\r\n isValid: boolean;\r\n message?: string;\r\n}\r\n\r\nexport async function onBuyHasAccessValidator(\r\n context: ICoreContext,\r\n customer: Customer | undefined,\r\n product: ProductSearchResultExt,\r\n validationMessage: string | undefined\r\n): Promise {\r\n if (!product || !product.AttributeValues) {\r\n return { isValid: true };\r\n }\r\n\r\n const hasAccess = hasAccessToBuy(context, customer, product.AttributeValues);\r\n\r\n return {\r\n isValid: hasAccess,\r\n message: hasAccess ? undefined : validationMessage\r\n };\r\n}\r\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport { ICartState } from '@msdyn365-commerce/global-state';\nimport * as React from 'react';\n\nimport { IProductCollectionViewProps, IProductComponentViewProps } from '@msdyn365-commerce-modules/product-collection/src/modules/product-collection/./product-collection';\nimport { IProductCollectionData } from './product-collection.data';\nimport { IProductCollectionProps, IProductCollectionResources } from '../definition-extensions/product-collection.ext.props.autogenerated';\nimport { Customer, ProductList, ProductSearchResult, ProductsDataActions, SimpleProduct, UnitOfMeasureConversion } from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n OrderTemplate,\n QueryResultSettingsProxy,\n GetOrderTemplatesInput,\n getOrderTemplates\n} from '@msdyn365-commerce-modules/retail-actions';\nimport ProductComponent, { IAddToOrderTemplateResources, IProductComponentProps } from './components/product.component';\nimport PQueue from 'p-queue';\nimport { getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport { getProductUnitOfMeasureOptionsAsync } from '../../../actions/get-product-unit-of-measure-options.action';\nimport { DeliveryMode, IProductInventoryInformation, createInventoryAvailabilitySearchCriteria, mapAggregatedProductInventoryInformation } from '../../../components/common/product-inventory-utils';\nimport { onBuyHasAccessValidator } from '../../../shared-utils/attributes/on-buy-access-validator';\n\nfunction getInventoryLabel(productRecordId: number, productInventoryStatus: IProductInventoryInformation[] | undefined): string | undefined {\n if(productInventoryStatus){\n const shippingInventory = productInventoryStatus.find(shipping => shipping.ProductAvailableQuantity.ProductId === productRecordId);\n if(shippingInventory && shippingInventory.StockLevelLabel){\n return shippingInventory.StockLevelLabel;\n }\n }\n\n return undefined;\n}\n\nconst useGetInventoryStatus = (props: IProductCollectionViewProps & IProductCollectionProps) => {\n const { config, context } = props;\n const [productInventoryStatus, setProductInventoryStatus] = React.useState();\n\n React.useEffect(() => {\n if (!config.productCollection?.products || config.productCollection.products.length === 0) {\n return;\n }\n\n const work = async () => {\n const shippingSearchCriteria = createInventoryAvailabilitySearchCriteria(\n context.actionContext,\n config.productCollection.products.map(x => x.RecordId),\n true,\n undefined,\n undefined,\n DeliveryMode.shipping\n );\n\n const shippingAvailability = await ProductsDataActions.getEstimatedAvailabilityAsync(\n { callerContext: context.actionContext },\n shippingSearchCriteria\n );\n\n if (shippingAvailability.ProductWarehouseInventoryAvailabilities) {\n const shippingInventory = mapAggregatedProductInventoryInformation(context.actionContext, shippingAvailability);\n\n if (ArrayExtensions.hasElements(shippingInventory)) {\n shippingInventory[0].deliveryType = DeliveryMode.shipping;\n setProductInventoryStatus(shippingInventory);\n }\n }\n };\n void work();\n }, [config.productCollection]);\n\n return productInventoryStatus;\n};\n\nconst ProductCollectionView: React.FC> = props => {\n const {\n heading,\n ProductCollectionContainer,\n products,\n SingleSlideCarouselComponentProps,\n GridComponentProps,\n isCarousel,\n seeAllButton,\n resources,\n data: { cart, customerInformation }\n } = props;\n const [updates, setUpdates] = React.useState(0);\n const [orderTemplates, setOrderTemplates] = React.useState(undefined);\n const cartQueue = React.useMemo(() => new PQueue({ concurrency: 1 }), []);\n const [simpleProducts, setSimpleProducts] = React.useState(undefined);\n const [unitConversions, setConversions] = React.useState([]);\n const productInventoryStatus = useGetInventoryStatus(props);\n\n // Keep track of updates to products cause we wan't to hide the price on the first and second iteration\n React.useEffect(() => setUpdates((current) => current + 1), [products]);\n\n React.useEffect(() => {\n const ids = props.config.productCollection?.products?.map(x => x.RecordId) as number[] | undefined;\n\n if (ids?.some(x => !simpleProducts?.find(y => y.RecordId === x))) {\n const work = async () => {\n const { channelId, catalogId } = props.context.request.apiSettings;\n const simpleProducts = await getByIdsAsync(\n { callerContext: props.context.actionContext },\n channelId,\n ids,\n null,\n catalogId);\n setSimpleProducts(simpleProducts);\n };\n void work();\n }\n\n const work = async () => {\n const { actionContext, request, app } = props.context;\n\n if (!request.user.isAuthenticated || app.config.unitOfMeasureConversions !== true) {\n return;\n }\n \n if (!ids || ids.length === 0) {\n return;\n }\n \n const conversions = await getProductUnitOfMeasureOptionsAsync({ callerContext: actionContext }, ids);\n \n setConversions(conversions);\n };\n void work();\n }, [props.config.productCollection]);\n\n // First and second iteration of products will have base price and 0 price respectively. Hide the prices for these iterations.\n if (updates <= 1 && Array.isArray(products)) {\n products?.forEach((product) => {\n product.productComponent = React.cloneElement(product.productComponent as React.ReactElement, {\n showPrice: false\n });\n\n const typedProduct = ((product.productComponent as React.ReactElement).props.data.product as ProductSearchResult);\n typedProduct.Price = 0;\n typedProduct.BasePrice = 0;\n typedProduct.MaxVariantPrice = 0;\n typedProduct.MinVariantPrice = 0;\n });\n }\n\n const updateOrderTemplatesAsync = async (newOrderTemplate?: ProductList) => {\n let newOrderTemplates;\n\n if (newOrderTemplate) {\n newOrderTemplates = [...(orderTemplates ? orderTemplates : [])];\n\n // Add new order template if it doesn't exist\n if (newOrderTemplates.every(x => x.productList.Id !== newOrderTemplate.Id)) {\n newOrderTemplates.splice(0, 0, new OrderTemplate(newOrderTemplate, [], 0));\n }\n } else {\n // Refresh order templates incase new order template was created\n const queryResultSettings = QueryResultSettingsProxy.fromInputData({\n requestContext: props.context.request,\n config: props.config\n }).QueryResultSettings;\n const input = new GetOrderTemplatesInput('', queryResultSettings);\n newOrderTemplates = (await getOrderTemplates(input, props.context.actionContext)).map(x => new OrderTemplate(x, [], 0));\n }\n\n setOrderTemplates(newOrderTemplates);\n return newOrderTemplates;\n };\n\n const retrieveOrderTemplates = async () => {\n return orderTemplates ? orderTemplates : await updateOrderTemplatesAsync();\n };\n\n if (products) {\n return (\n \n {heading}\n {seeAllButton}\n {isCarousel\n ? _renderCarousel(SingleSlideCarouselComponentProps,\n products,\n cart.result,\n customerInformation.result,\n unitConversions,\n cartQueue,\n retrieveOrderTemplates,\n updateOrderTemplatesAsync,\n resources,\n simpleProducts,\n productInventoryStatus)\n : _renderGrid(GridComponentProps,\n products,\n cart.result,\n customerInformation.result,\n unitConversions,\n cartQueue,\n retrieveOrderTemplates,\n updateOrderTemplatesAsync,\n resources,\n simpleProducts,\n productInventoryStatus)}\n \n );\n }\n props.context.telemetry.error('Product collection content is empty, module wont render.');\n return null;\n};\n\nconst _renderCarousel = (\n carouselContainer: INodeProps,\n items: IProductComponentViewProps[],\n cart: ICartState | undefined,\n customerInformation: Customer | undefined,\n unitConversions: UnitOfMeasureConversion[],\n cartQueue: PQueue,\n retrieveOrderTemplates: () => Promise,\n onUpdateOrderTemplates: ((orderTemplate?: ProductList | undefined) => Promise) | undefined,\n resources: IProductCollectionResources,\n simpleProducts: SimpleProduct[] | undefined,\n productInventoryStatus: IProductInventoryInformation[] | undefined\n): JSX.Element => {\n return (\n \n {items && items.map(x => _renderProduct(\n x,\n simpleProducts?.find(sp => (x.productComponent as React.ReactElement).props.data.product.RecordId === sp.RecordId),\n cart,\n customerInformation,\n unitConversions,\n productInventoryStatus?.find(pi => pi.ProductAvailableQuantity.ProductId === (x.productComponent as React.ReactElement).props.data.product.RecordId),\n cartQueue,\n retrieveOrderTemplates,\n onUpdateOrderTemplates,\n resources))}\n \n );\n};\n\nconst _renderGrid = (\n gridContainer: INodeProps,\n items: IProductComponentViewProps[],\n cart: ICartState | undefined,\n customerInformation: Customer | undefined,\n unitConversions: UnitOfMeasureConversion[],\n cartQueue: PQueue,\n retrieveOrderTemplates: () => Promise,\n onUpdateOrderTemplates: ((orderTemplate?: ProductList | undefined) => Promise) | undefined,\n resources: IProductCollectionResources,\n simpleProducts: SimpleProduct[] | undefined,\n productInventoryStatus: IProductInventoryInformation[] | undefined\n): JSX.Element => {\n return (\n \n {items && items.map(x => _renderProduct(\n x,\n simpleProducts?.find(sp => (x.productComponent as React.ReactElement).props.data.product.RecordId === sp.RecordId),\n cart,\n customerInformation,\n unitConversions,\n productInventoryStatus?.find(pi => pi.ProductAvailableQuantity.ProductId === (x.productComponent as React.ReactElement).props.data.product.RecordId),\n cartQueue,\n retrieveOrderTemplates,\n onUpdateOrderTemplates,\n resources))}\n \n );\n};\n\nconst _renderProduct = (\n product: IProductComponentViewProps,\n simpleProduct: SimpleProduct | undefined,\n cart: ICartState | undefined,\n customerInformation: Customer | undefined,\n unitConversions: UnitOfMeasureConversion[],\n productInventoryStatus: IProductInventoryInformation | undefined,\n cartQueue: PQueue,\n retrieveOrderTemplates: () => Promise,\n onUpdateOrderTemplates: ((orderTemplate?: ProductList | undefined) => Promise) | undefined,\n resources: IProductCollectionResources\n): JSX.Element => {\n const { ProductContainer, productComponent } = product;\n\n const data = {\n ...(productComponent as React.ReactElement).props.data,\n cart,\n customerInformation,\n simpleProduct,\n unitConversions: unitConversions.filter(x => x.ProductRecordId === (productComponent as React.ReactElement).props.data.product?.RecordId)\n };\n\n const props: Partial = {\n data,\n cartQueue,\n buyAlwaysAdd: true,\n inventoryLabel: getInventoryLabel((productComponent as React.ReactElement).props.data.product?.RecordId, productInventoryStatus ? [productInventoryStatus] : undefined),\n inventoryStatus: productInventoryStatus,\n retrieveOrderTemplates: retrieveOrderTemplates,\n onUpdateOrderTemplates: onUpdateOrderTemplates,\n addToCartText: resources.addToCartText,\n updateCartText: resources.updateCartText,\n removeFromCartText: resources.removeFromCartText,\n priceErrorText: resources.priceErrorText,\n toastStrings: {\n errorHeader: resources.toastErrorHeader,\n productsAddedToCart: resources.productsAddedToCart,\n productsRemovedFromCart: resources.productsRemovedFromCart,\n productsUpdatedInCart: resources.productsUpdatedInCart,\n goToCart: resources.toastGoToCart,\n noAccessToProduct: resources.toastNoAccessToProduct\n },\n addToOrderTemplateResources: {\n addToOrderTemplateHeader: resources.addToOrderTemplateHeader,\n noOrderTemplatesMessage: resources.noOrderTemplatesMessage,\n noOrderTemplatesDescription: resources.noOrderTemplatesDescription,\n createAnOrderTemplateButtonText: resources.createAnOrderTemplateButtonText,\n createNewOrderTemplateButtonText: resources.createNewOrderTemplateButtonText,\n cancelOrderTemplateCreationButtonText: resources.cancelOrderTemplateCreationButtonText,\n selectTemplatesText: resources.selectTemplatesText,\n addToTemplateButtonText: resources.addToTemplateButtonText,\n lineItemsText: resources.lineItemsText,\n createOrderTemplateHeader: resources.createOrderTemplateHeader,\n orderTemplateTitle: resources.orderTemplateTitle,\n orderTemplateNameAriaLabel: resources.orderTemplateNameAriaLabel,\n createOrderTemplateDescription: resources.createOrderTemplateDescription,\n defaultOrderTemplateName: resources.defaultOrderTemplateName,\n createOrderTemplateButtonText: resources.createOrderTemplateButtonText,\n cancelNewOrderTemplateCreationButtonText: resources.cancelNewOrderTemplateCreationButtonText,\n viewOrderTemplateButtonText: resources.viewOrderTemplateButtonText,\n continueShoppingButtonText: resources.continueShoppingButtonText,\n itemAddedToOrderTemplateHeaderItemOneText: resources.itemAddedToOrderTemplateHeaderItemOneText,\n itemAddedToOrderTemplateHeaderItemFormatText: resources.itemAddedToOrderTemplateHeaderItemFormatText,\n itemAddedToOrderTemplateHeaderMessageText: resources.itemAddedToOrderTemplateHeaderMessageText,\n priceFree: resources.priceFree,\n originalPriceText: resources.originalPriceText,\n currentPriceText: resources.currentPriceText,\n duplicatedProductsHeader: resources.duplicatedProductsHeader,\n duplicatedProductsDescription: resources.duplicatedProductsDescription,\n updateQuantityButtonText: resources.updateQuantityButtonText,\n cancelDuplicateItemsButtonText: resources.cancelDuplicateItemsButtonText,\n addToOrderTemplateButtonText: resources.addToOrderTemplateButtonText,\n addToOrderTemplateButtonTooltip: resources.addToOrderTemplateButtonTooltip\n } as IAddToOrderTemplateResources,\n onBuyValidate: (product) => onBuyHasAccessValidator(\n props.context!,\n customerInformation,\n product,\n resources.toastNoAccessToProduct\n )\n }\n\n // TODO: Hopefully go back to this\n // const extendedProductComponent = React.cloneElement(productComponent as React.ReactElement, props);\n\n // Force the component to use our override since overrides are not always working automatically atm.\n // Directly references our ProductComponent instead of the one passed in.\n const forcedComponentProps = {\n ...(productComponent as React.ReactElement).props,\n ...props\n };\n const forcedComponent = ;\n\n return {forcedComponent};\n};\n\nexport default ProductCollectionView;\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 (binding.modules['product-collection'] = {\n c: () => require('@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection/product-collection'),\n $type: 'containerModule',\n da: [{name:'featureState', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state', runOn: 0}],\n \n iNM: true,\n ns: '@msdyn365-commerce-modules',\n n: 'product-collection',\n p: 'product-collection',\n \n pdp: '',\n \n \n md: 'node_modules/@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|themes|dlvry-adventureworks|views|product-collection'] = {\n c: () => require('partner/themes/dlvry-adventureworks/views/product-collection.view.tsx'),\n cn: '__local__-__local__-product-collection'\n };\nviewDictionary['@msdyn365-commerce-modules|product-collection|modules|product-collection|product-collection'] = {\n c: () => require('@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection/product-collection.view.js'),\n cn: '@msdyn365-commerce-modules-product-collection-product-collection'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\nimport { IPriceComponentResources, ProductComponent } from '@msdyn365-commerce/components';\nimport * as Msdyn365 from '@msdyn365-commerce/core';\nimport { getCatalogId, getUrlSync, ICoreContext } from '@msdyn365-commerce/core';\nimport { ProductPrice, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n DimensionAvailabilitiesForProductSearchResultInput,\n DimensionTypes,\n DimensionSwatchDisplayTypes,\n getDimensionAvailabilitiesForProductSearchResultAction,\n getPriceForProductSearchResult,\n IDimensionsApp,\n ObjectExtensions,\n PriceForProductSearchResultInput,\n validateCatalogId\n} from '@msdyn365-commerce-modules/retail-actions';\nimport {\n Button,\n getTelemetryObject,\n IComponentNodeProps,\n IModuleProps,\n INodeProps,\n ISingleSlideCarouselProps,\n ITelemetryContent,\n NodeTag,\n SingleSlideCarousel\n} from '@msdyn365-commerce-modules/utilities';\nimport classnames from 'classnames';\nimport * as React from 'react';\n\nimport { IProductCollectionData } from './product-collection.data';\nimport { IProductCollectionProps, layout } from './product-collection.props.autogenerated';\n\nexport interface IProductCollectionViewProps extends IProductCollectionProps {\n heading?: React.ReactNode;\n ProductCollectionContainer: IModuleProps;\n SingleSlideCarouselComponentProps: INodeProps;\n GridComponentProps: INodeProps;\n products: IProductComponentViewProps[];\n isCarousel: boolean;\n productPrices?: ProductPrice[];\n seeAllButton?: React.ReactNode;\n}\n\nexport interface IProductComponentViewProps {\n ProductContainer: INodeProps;\n productComponent: React.ReactNode;\n}\nexport interface IProductComponentState {\n products: ProductSearchResult[];\n productsDimensionAvailabilities?: IProductsDimensionsAvailabilities[][];\n}\n\n/**\n * ProductCollection component.\n */\nclass ProductCollection extends React.PureComponent, IProductComponentState> {\n private readonly telemetryContent: ITelemetryContent;\n\n private readonly productPrices: ProductPrice[];\n\n constructor(props: IProductCollectionProps) {\n super(props);\n this.productPrices = [];\n this.state = {\n products: this.props.config.productCollection.products || []\n };\n this.telemetryContent = getTelemetryObject(\n this.props.context.request.telemetryPageName!,\n this.props.friendlyName,\n this.props.telemetry\n );\n }\n\n public async componentDidMount(): Promise {\n if (this.props.config.enableAffiliationBasedPricing && this.props.context.actionContext.requestContext.user.isAuthenticated) {\n await this._getActivePrice();\n }\n }\n\n public render(): JSX.Element | null {\n const { heading, className, shouldDisplaySeeAllButton } = this.props.config;\n const { resources } = this.props;\n const recommendation = this.props.config.productCollection.recommendationListId;\n\n // Initialize state in case if the products were not found during initial module render\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- Initialize data if not there.\n this.initProductState(this.props.config.productCollection);\n\n const products = this.state.products;\n const isCarousel = this.props.config.layout === layout.carousel;\n const headingLabel = heading ? heading.text : '';\n const headingComponent = heading && (\n \n );\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- product check for safety.\n const updatedProducts = products?.map((item: ProductSearchResult, index: number) => {\n const getProductData = this._getProduct(item, index);\n return !ObjectExtensions.isNullOrUndefined(getProductData) ? getProductData : undefined;\n });\n\n const productCollectionViewProps = {\n ...this.props,\n heading: headingComponent,\n SingleSlideCarouselComponentProps: {\n tag: SingleSlideCarousel,\n className: '',\n flipperPrevLabel: `${headingLabel} ${resources.flipperPrevious}`,\n flipperNextLabel: `${headingLabel} ${resources.flipperNext}`,\n parentId: this.props.id,\n telemetryContent: this.telemetryContent\n } as IComponentNodeProps,\n ProductCollectionContainer: {\n moduleProps: this.props,\n className: classnames('ms-product-collection', className)\n },\n GridComponentProps: {\n tag: 'ul' as NodeTag,\n className: 'ms-product-collection__items'\n },\n isCarousel,\n\n products:\n ArrayExtensions.hasElements(updatedProducts) &&\n updatedProducts.filter(item => {\n return item !== undefined;\n }),\n productPrices: this.productPrices,\n seeAllButton:\n recommendation && shouldDisplaySeeAllButton && ArrayExtensions.hasElements(updatedProducts)\n ? this._getSeeAllButton(recommendation, headingLabel)\n : undefined\n };\n return this.props.renderView(productCollectionViewProps) as React.ReactElement;\n }\n\n public handleHeadingChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.heading!.text = event.target.value);\n\n /**\n * Get products dimension availabilities.\n * @param products - Products.\n * @returns Promise.\n */\n private readonly _getProductsDimensionsAvailabilities = async (products: ProductSearchResult[]): Promise => {\n const context = this.props.context as ICoreContext;\n const dimensionsToDisplayOnProductCard = context.app.config.dimensionsInProductCard;\n const dimensionsToDisplayAsSwatch = context.app.config.dimensionsAsSwatchType;\n const validProducts = ArrayExtensions.validValues(products);\n if (\n ArrayExtensions.hasElements(validProducts) &&\n ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) &&\n !dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) &&\n ArrayExtensions.hasElements(dimensionsToDisplayAsSwatch) &&\n !dimensionsToDisplayAsSwatch.includes(DimensionTypes.none)\n ) {\n const productsDimensionAvailabilities = await getDimensionAvailabilitiesForProductSearchResultAction(\n new DimensionAvailabilitiesForProductSearchResultInput(\n validProducts,\n this.props.context as ICoreContext,\n DimensionSwatchDisplayTypes.productCard\n ),\n this.props.context.actionContext\n );\n\n if (ArrayExtensions.hasElements(productsDimensionAvailabilities)) {\n this.setState({ productsDimensionAvailabilities });\n }\n }\n };\n\n /**\n * Helper method to initialize products state.\n * @param productCollection - List of products.\n */\n private readonly initProductState = async (productCollection: Msdyn365.IProductList) => {\n let products = this.state.products;\n const productCollectionProducts = productCollection.products;\n if (!ArrayExtensions.hasElements(products) && ArrayExtensions.hasElements(productCollectionProducts)) {\n products = productCollectionProducts;\n this.setState({ products });\n } else if (\n ArrayExtensions.hasElements(products) &&\n ArrayExtensions.hasElements(productCollectionProducts) &&\n !ArrayExtensions.equals(products, productCollectionProducts)\n ) {\n products = productCollectionProducts;\n this.setState({ products });\n } else if (productCollectionProducts === undefined && ArrayExtensions.hasElements(this.state.products)) {\n products = [];\n this.setState({ products: products });\n }\n\n if (Msdyn365.msdyn365Commerce.isBrowser && !ArrayExtensions.hasElements(this.state.productsDimensionAvailabilities)) {\n await this._getProductsDimensionsAvailabilities(products);\n }\n };\n\n private readonly _getProduct = (product: ProductSearchResult, index: number): IProductComponentViewProps | null => {\n if (!product || !product.Name) {\n this.props.telemetry.trace('[product-collection] Product or product name is null');\n return null;\n }\n const telemetryContent = getTelemetryObject(\n this.props.context.request.telemetryPageName!,\n this.props.friendlyName,\n this.props.telemetry\n );\n const { imageSettings, allowBackNavigation } = this.props.config;\n const resources = this.props.resources;\n const breaCrumbType = this.props.context.app.config.breadcrumbType;\n const allowBack = allowBackNavigation && (breaCrumbType === 'back' || breaCrumbType === 'categoryAndBack');\n const quickviewSlot =\n this.props.slots && this.props.slots.quickview && this.props.slots.quickview.length > 0 ? this.props.slots.quickview[0] : null;\n const productComparisonButtonSlot = ArrayExtensions.hasElements(this.props.slots.productComparisonButton)\n ? this.props.slots.productComparisonButton[0]\n : null;\n\n const reviewCount = 1;\n const reviewTotalRatings = Number(product.TotalRatings);\n const reviewCountAriaLabelValue =\n reviewTotalRatings > reviewCount ? resources.ratingCountAriaLabel : resources.ratingCountAriaLabelSingleUser;\n const isPriceMinMaxEnabled = this.props.data.featureState.result?.find(\n featureState => featureState.Name === 'Dynamics.AX.Application.RetailSearchPriceRangeFeature'\n );\n const priceResources: IPriceComponentResources = {\n priceRangeSeparator: resources.priceRangeSeparator\n };\n return {\n ProductContainer: {\n tag: 'li' as NodeTag,\n className: 'ms-product-collection__item',\n role: 'listitem',\n key: index\n },\n productComponent: (\n \n ArrayExtensions.hasElements(dimensionAvailability) &&\n dimensionAvailability[0].masterProductId === (product.MasterProductId ?? product.RecordId)\n )}\n />\n )\n };\n };\n\n /**\n * Get the active price for products.\n */\n private readonly _getActivePrice = async (): Promise => {\n const productsList = this.state.products;\n const products = await getPriceForProductSearchResult(\n new PriceForProductSearchResultInput(productsList),\n this.props.context.actionContext\n );\n if (Msdyn365.msdyn365Commerce.isBrowser) {\n await this._getProductsDimensionsAvailabilities(products);\n }\n\n this.setState({ products });\n };\n\n /**\n * Get the see all button.\n * @param recommendation - Recommendation.\n * @param headingLabel - Heading label.\n * @returns IProductComponentSeeAllViewProps - Product component see all view props.\n */\n private readonly _getSeeAllButton = (recommendation: string, headingLabel: string): React.ReactNode => {\n if (!Msdyn365.msdyn365Commerce.isBrowser) {\n return null;\n }\n\n const catalogId = getCatalogId(this.props.context.request);\n validateCatalogId(catalogId);\n const searchPageLink = getUrlSync('search', this.props.context.actionContext);\n if (!searchPageLink) {\n return null;\n }\n\n const url = new URL(searchPageLink, window.location.href);\n url.searchParams.set('recommendation', recommendation);\n url.searchParams.set('title', headingLabel);\n url.searchParams.set('catalogid', `${catalogId}`);\n\n return (\n \n {this.props.resources.seeAllButtonText}\n \n );\n };\n}\n\nexport default ProductCollection;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport * as React from 'react';\n\nimport { IProductCollectionViewProps, IProductComponentViewProps } from './product-collection';\n\nconst ProductCollectionView: React.FC = props => {\n const {\n heading,\n ProductCollectionContainer,\n products,\n SingleSlideCarouselComponentProps,\n GridComponentProps,\n isCarousel,\n seeAllButton\n } = props;\n\n if (products) {\n return (\n \n {heading}\n {seeAllButton}\n {isCarousel ? _renderCarousel(SingleSlideCarouselComponentProps, products) : _renderGrid(GridComponentProps, products)}\n \n );\n }\n props.context.telemetry.error('Product collection content is empty, module wont render.');\n return null;\n};\n\nconst _renderCarousel = (carouselContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\n return {items && items.map(_renderProduct)};\n};\n\nconst _renderGrid = (gridContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\n return {items && items.map(_renderProduct)};\n};\n\nconst _renderProduct = (product: IProductComponentViewProps): JSX.Element => {\n const { ProductContainer, productComponent } = product;\n\n return {productComponent};\n};\n\nexport default ProductCollectionView;\n","module.exports = React;","module.exports = ReactDOM;"],"names":["getProductUnitOfMeasureOptionsInput","queryResultSettings","productIds","query","DataServiceQuery","resultSettings","top","createDataServiceRequestForOperation","Entities","bypassCache","returnEntity","async","getProductUnitOfMeasureOptionsAsync","context","request","callActionOrExecute","callerContext","DeliveryMode","InventoryLevels","InventoryLevelValues","displayLabelEnabled","inventoryCode","requestContext","app","config","inventoryRanges","available","outOfStock","mapProductInventoryInformation","productsWarehouseInventory","productInventoryInformation","undefined","enableStockCheck","length","product","inventoryLevel","physicalAvailable","physicalProductMap","mapInventoryWithPhysicalBufferEnabled","push","totalAvailable","totalAvailableProductMap","mapInventoryWithTotalAvailableBufferEnabled","productMap","mapInventoryWithThresholdEnabled","productWarehouseInventoryAvailability","ProductId","TotalAvailable","productQty","outOfStockThreshold","productAvailableQuantity","AvailableQuantity","ProductAvailableQuantity","IsProductAvailable","InventLocationId","shouldRenderLabel","PhysicalAvailableInventoryLevelCode","productQuantity","_productWarehouseInve","MaximumPurchasablePhysicalAvailableQuantity","PhysicalAvailable","StockLevelCode","StockLevelLabel","PhysicalAvailableInventoryLevelLabel","TotalAvailableInventoryLevelCode","_productWarehouseInve2","MaximumPurchasableTotalAvailableQuantity","TotalAvailableInventoryLevelLabel","isAggregatedInventory","warehouseAggregation","mapAggregatedProductInventoryInformation","productWarehouseInventoryInformation","_productWarehouseInve3","AggregatedProductInventoryAvailabilities","map","_product$MaximumPurch","_product$MaximumPurch2","DataAreaId","PhysicalAvailableQuantity","TotalAvailableQuantity","ProductWarehouseInventoryAvailabilities","createInventoryAvailabilitySearchCriteria","isDefaultWareHouse","isFilterByChannelFulfillmentGroup","searchArea","defaultDeliveryMode","deliveryMode","shipping","inventoryAvailabilitySearchCriteria","ProductIds","QuantityUnitTypeValue","SearchArea","FilterByChannelFulfillmentGroup","DeliveryModeTypeFilterValue","DefaultWarehouseOnly","onBuyHasAccessValidator","customer","validationMessage","AttributeValues","isValid","hasAccess","hasAccessToBuy","message","getInventoryLabel","productRecordId","productInventoryStatus","shippingInventory","find","_renderCarousel","carouselContainer","items","cart","customerInformation","unitConversions","cartQueue","retrieveOrderTemplates","onUpdateOrderTemplates","resources","simpleProducts","React","Node","Object","assign","x","_renderProduct","sp","productComponent","props","data","RecordId","pi","_renderGrid","gridContainer","simpleProduct","_productComponent$pro2","ProductContainer","_objectSpread","filter","_productComponent$pro","ProductRecordId","buyAlwaysAdd","inventoryLabel","inventoryStatus","addToCartText","updateCartText","removeFromCartText","priceErrorText","toastStrings","errorHeader","toastErrorHeader","productsAddedToCart","productsRemovedFromCart","productsUpdatedInCart","goToCart","toastGoToCart","noAccessToProduct","toastNoAccessToProduct","addToOrderTemplateResources","addToOrderTemplateHeader","noOrderTemplatesMessage","noOrderTemplatesDescription","createAnOrderTemplateButtonText","createNewOrderTemplateButtonText","cancelOrderTemplateCreationButtonText","selectTemplatesText","addToTemplateButtonText","lineItemsText","createOrderTemplateHeader","orderTemplateTitle","orderTemplateNameAriaLabel","createOrderTemplateDescription","defaultOrderTemplateName","createOrderTemplateButtonText","cancelNewOrderTemplateCreationButtonText","viewOrderTemplateButtonText","continueShoppingButtonText","itemAddedToOrderTemplateHeaderItemOneText","itemAddedToOrderTemplateHeaderItemFormatText","itemAddedToOrderTemplateHeaderMessageText","priceFree","originalPriceText","currentPriceText","duplicatedProductsHeader","duplicatedProductsDescription","updateQuantityButtonText","cancelDuplicateItemsButtonText","addToOrderTemplateButtonText","addToOrderTemplateButtonTooltip","onBuyValidate","forcedComponentProps","forcedComponent","ProductComponent","heading","ProductCollectionContainer","products","SingleSlideCarouselComponentProps","GridComponentProps","isCarousel","seeAllButton","updates","setUpdates","orderTemplates","setOrderTemplates","PQueue","concurrency","setSimpleProducts","setConversions","setProductInventoryStatus","_config$productCollec","productCollection","shippingSearchCriteria","actionContext","shippingAvailability","ProductsDataActions","ArrayExtensions","hasElements","deliveryType","work","useGetInventoryStatus","current","_props$config$product","ids","some","y","channelId","catalogId","apiSettings","getByIdsAsync","user","isAuthenticated","unitOfMeasureConversions","conversions","Array","isArray","forEach","showPrice","typedProduct","Price","BasePrice","MaxVariantPrice","MinVariantPrice","updateOrderTemplatesAsync","newOrderTemplates","newOrderTemplate","every","productList","Id","splice","OrderTemplate","QueryResultSettingsProxy","fromInputData","QueryResultSettings","input","GetOrderTemplatesInput","getOrderTemplates","Module","result","telemetry","error","binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","window","__bindings__","viewDictionary","cn","ProductCollection","constructor","super","handleHeadingChange","event","this","text","target","value","_getProductsDimensionsAvailabilities","dimensionsToDisplayOnProductCard","dimensionsInProductCard","dimensionsToDisplayAsSwatch","dimensionsAsSwatchType","validProducts","validValues","includes","DimensionTypes","none","productsDimensionAvailabilities","getDimensionAvailabilitiesForProductSearchResultAction","DimensionAvailabilitiesForProductSearchResultInput","DimensionSwatchDisplayTypes","productCard","setState","initProductState","state","productCollectionProducts","equals","Msdyn365","isBrowser","_getProduct","index","_this$props$data$feat","_this$state$productsD","Name","trace","telemetryContent","getTelemetryObject","telemetryPageName","friendlyName","imageSettings","allowBackNavigation","breaCrumbType","breadcrumbType","allowBack","quickviewSlot","slots","quickview","productComparisonButtonSlot","productComparisonButton","reviewCountAriaLabelValue","Number","TotalRatings","ratingCountAriaLabel","ratingCountAriaLabelSingleUser","isPriceMinMaxEnabled","featureState","priceResources","priceRangeSeparator","tag","className","role","key","freePriceText","ratingAriaLabel","typeName","quickViewButton","IsEnabled","dimensionAvailabilities","dimensionAvailability","_product$MasterProduc","masterProductId","MasterProductId","_getActivePrice","productsList","getPriceForProductSearchResult","PriceForProductSearchResultInput","_getSeeAllButton","recommendation","headingLabel","getCatalogId","validateCatalogId","searchPageLink","getUrlSync","url","URL","location","href","searchParams","set","Button","title","seeAllButtonText","productPrices","enableAffiliationBasedPricing","render","shouldDisplaySeeAllButton","recommendationListId","layout","headingComponent","editProps","onEdit","updatedProducts","item","getProductData","ObjectExtensions","isNullOrUndefined","productCollectionViewProps","SingleSlideCarousel","flipperPrevLabel","flipperPrevious","flipperNextLabel","flipperNext","parentId","moduleProps","classnames","renderView","module","exports","ReactDOM"],"sourceRoot":""}