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,UAAWA,EACXK,YAAaF,EACbG,UAAQ,EACRJ,UAAWzS,EACXqE,qBAAsBnE,EACtBgC,KAAM,KApEF4Q,CAAanS,EAASC,EAAUxD,EAAIiE,EAAQ6N,cAAe7N,EAAQ8N,aAAc7O,EAAiB+D,IArU/E0O,GAsUIpO,IArU+B,KAA/BoO,GAK/BrT,IAAAA,cAAA,OAAKC,UAAU,6BACXD,IAAAA,cAAA,YAAOqT,KALJ,KAqUFvO,GAtHT,SAAyBwO,EAA4BpU,GACjD,GAAkB,OAAdoU,EACA,OAEJ,MAAMC,EAAyC3I,EAAoB4I,YAAYrJ,KAAsBsH,IAC1F,CACHgC,oBAAoBC,EAAAA,EAAAA,4CAA2CjC,EAASxG,eACxE0I,eAAgB,CACZlO,SAAU,EACV2C,MAAOqJ,EAASpG,WAI5B,OAAOrL,IAAAA,aAAmBsT,EAAiC,CAAEM,kBAAmB1U,EAAMqU,mBAAAA,IAyG9DM,CAAgB/O,EAAiBnD,EAAQ8D,UAC5DV,GArTb,SACIA,EACApD,EACA6H,GAGA,OADAsK,EAAAA,EAAAA,mBAAkBtK,GACXxJ,IAAAA,aAAmB+E,EAA+C,CAAEpD,QAAAA,EAAS6H,UAAAA,IA+ShDuK,CAA8BhP,EAAyBpD,GAASqS,EAAAA,EAAAA,IAAa/S,EAAQjE,WAxU7H,IAAmCqW,GA2JEvC,GAgMVb,KA9aG,KAsjB9B","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/getactiveprices.action.ts?5586","webpack://Msdyn365.Commerce.Online/./src/actions/getproductunitsofmeasure.action.ts?b2cf","webpack://Msdyn365.Commerce.Online/./src/themes/sysco-b2b/views/components/product.component.tsx?857f","webpack://Msdyn365.Commerce.Online/./src/modules/adventureworks/views/components/product.component.tsx?fd23"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { AffiliationLoyaltyTier, PriceLookupContext, ProductPrice, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\r\nimport { getActivePricesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\n/**\r\n * Getaddresses Input Action\r\n */\r\n\r\nexport interface IITSGetActivePricesInput extends Msdyn365.IActionInput {\r\n projectDomain: ProjectionDomain | null;\r\n productIds?: number[];\r\n activeDate?: Date;\r\n customerId?: string | null;\r\n affiliationLoyaltyTiers?: AffiliationLoyaltyTier[] | null;\r\n includeSimpleDiscountsInContextualPrice?: boolean | null;\r\n includeVariantPriceRange?: boolean | null;\r\n includeAttainablePricesAndDiscounts?: boolean | null;\r\n priceLookupContext?: PriceLookupContext | null;\r\n}\r\nexport class GetActivePricesInput implements Msdyn365.IActionInput {\r\n public projectDomain: ProjectionDomain | null;\r\n public productIds?: number[];\r\n public activeDate?: Date;\r\n public customerId?: string | null;\r\n public affiliationLoyaltyTiers?: AffiliationLoyaltyTier[] | null;\r\n public includeSimpleDiscountsInContextualPrice?: boolean | null;\r\n public includeVariantPriceRange?: boolean | null;\r\n public includeAttainablePricesAndDiscounts?: boolean | null;\r\n public priceLookupContext?: PriceLookupContext | null;\r\n // TODO: Construct the input needed to run the action\r\n constructor(\r\n projectDomain: ProjectionDomain | null,\r\n productIds?: number[],\r\n activeDate?: Date,\r\n customerId?: string | null,\r\n affiliationLoyaltyTiers?: AffiliationLoyaltyTier[] | null,\r\n includeSimpleDiscountsInContextualPrice?: boolean | null,\r\n includeVariantPriceRange?: boolean | null,\r\n includeAttainablePricesAndDiscounts?: boolean | null,\r\n priceLookupContext?: PriceLookupContext | null\r\n ) {\r\n this.projectDomain = projectDomain;\r\n this.productIds = productIds;\r\n this.activeDate = activeDate;\r\n this.customerId = customerId;\r\n this.affiliationLoyaltyTiers = affiliationLoyaltyTiers;\r\n this.includeSimpleDiscountsInContextualPrice = includeSimpleDiscountsInContextualPrice;\r\n this.includeVariantPriceRange = includeVariantPriceRange;\r\n this.includeAttainablePricesAndDiscounts = includeAttainablePricesAndDiscounts;\r\n this.priceLookupContext = priceLookupContext;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `getActivePrices`;\r\n public getCacheObjectType = () => 'getActivePrices';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nexport async function getActivePricesAction(\r\n request: IITSGetActivePricesInput,\r\n ctx: Msdyn365.IActionContext\r\n): Promise {\r\n if (request) {\r\n try {\r\n const result = await getActivePricesAsync(\r\n { callerContext: ctx },\r\n request.projectDomain,\r\n request.productIds,\r\n request.activeDate,\r\n request.customerId,\r\n request.affiliationLoyaltyTiers,\r\n request.includeSimpleDiscountsInContextualPrice,\r\n request.includeVariantPriceRange,\r\n request.includeAttainablePricesAndDiscounts,\r\n request.priceLookupContext\r\n ); //calling getActivePricesAsync API\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getActivePricesAction,\r\n // TODO: Give your data action a unique id\r\n id: `getActivePrices`\r\n // input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { ProductUnitOfMeasure, UnitOfMeasureSearchCriteria } from '@msdyn365-commerce/retail-proxy';\r\nimport { getProductUnitsOfMeasureAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\n/**\r\n * Getaddresses Input Action\r\n */\r\n\r\nexport interface IITSProductUnitOfMeasureInput extends Msdyn365.IActionInput {\r\n productId: number | undefined;\r\n unitOfMeasureSearchCriteria?: UnitOfMeasureSearchCriteria | null;\r\n}\r\nexport class GetProductUnitOfMeasureInput implements Msdyn365.IActionInput {\r\n public productId: number | undefined;\r\n public unitOfMeasureSearchCriteria: UnitOfMeasureSearchCriteria | null;\r\n // TODO: Construct the input needed to run the action\r\n constructor(productId: number | undefined, unitOfMeasureSearchCriteria: UnitOfMeasureSearchCriteria | null) {\r\n this.productId = productId;\r\n this.unitOfMeasureSearchCriteria = unitOfMeasureSearchCriteria;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `getProductUnitOfMeasure`;\r\n public getCacheObjectType = () => 'getProductUnitOfMeasure';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nexport async function getProductUnitsOfMeasureAction(\r\n request: IITSProductUnitOfMeasureInput,\r\n ctx: Msdyn365.IActionContext\r\n): Promise {\r\n if (request.productId) {\r\n try {\r\n const result = await getProductUnitsOfMeasureAsync(\r\n { callerContext: ctx },\r\n request.productId,\r\n request.unitOfMeasureSearchCriteria\r\n ); //calling getProductUnitOfMeasureAsync API\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getProductUnitsOfMeasureAction,\r\n // TODO: Give your data action a unique id\r\n id: `getProductUnitOfMeasure`\r\n // input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n ArrayExtensions,\r\n convertDimensionTypeToProductDimensionType,\r\n Dictionary,\r\n DimensionTypes,\r\n generateImageUrl,\r\n getProductPageUrlSync,\r\n IDimensionsApp,\r\n StringExtensions,\r\n validateCatalogId\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n format,\r\n getPayloadObject,\r\n getTelemetryAttributes,\r\n IncrementalQuantity,\r\n ITelemetryContent,\r\n onTelemetryClick\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\r\nimport {\r\n IPriceComponentResources,\r\n ISwatchItem,\r\n PriceComponent,\r\n ProductComponentSwatchComponent,\r\n RatingComponent\r\n} from '@msdyn365-commerce/components';\r\nimport {\r\n getCatalogId,\r\n IAny,\r\n IComponent,\r\n IComponentProps,\r\n ICoreContext,\r\n IGeneric,\r\n IGridSettings,\r\n IImageData,\r\n IImageSettings,\r\n Image,\r\n msdyn365Commerce\r\n} from '@msdyn365-commerce/core';\r\nimport { getCartState } from '@msdyn365-commerce/global-state';\r\nimport {\r\n AttributeSwatch,\r\n AttributeValue,\r\n CartLine,\r\n PriceLookupContext,\r\n ProductDimension,\r\n ProductPrice,\r\n ProductSearchResult,\r\n ProductType,\r\n ProjectionDomain,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { addCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport React, { useState } from 'react';\r\nimport { getActivePricesAction, GetActivePricesInput } from '../../../../actions/getactiveprices.action';\r\nimport { GetProductUnitOfMeasureInput, getProductUnitsOfMeasureAction } from '../../../../actions/getproductunitsofmeasure.action';\r\nimport { ISearchResultContainerResources } from '../../definition-extensions/search-result-container.ext.props.autogenerated';\r\nimport MsDyn365 from '@msdyn365-commerce/core';\r\nexport interface IProductComponentProps extends IComponentProps<{ product?: ProductSearchResult; productPrice?: ProductPrice }> {\r\n className?: string;\r\n imageSettings?: IImageSettings;\r\n savingsText?: string;\r\n freePriceText?: string;\r\n originalPriceText?: string;\r\n currentPriceText?: string;\r\n ratingAriaLabel?: string;\r\n ratingCountAriaLabel?: string;\r\n allowBack?: boolean;\r\n telemetryContent?: ITelemetryContent;\r\n quickViewButton?: React.ReactNode;\r\n productComparisonButton?: React.ReactNode;\r\n isEnabledProductDescription?: boolean;\r\n isPriceMinMaxEnabled?: boolean;\r\n priceResources?: IPriceComponentResources;\r\n inventoryLabel?: string;\r\n dimensionAvailabilities?: IProductsDimensionsAvailabilities[];\r\n swatchItemAriaLabel?: string;\r\n resources?: ISearchResultContainerResources;\r\n isStoreSelected?: boolean | undefined;\r\n storeId?: string;\r\n}\r\n\r\nexport interface IStoreDataCustom {\r\n Latitude?: number;\r\n Longitude?: number;\r\n StoreId?: string;\r\n StoreName?: string;\r\n}\r\n\r\nexport interface IProductComponent extends IComponent {}\r\n\r\nconst PriceComponentActions = {};\r\n\r\n/**\r\n * Gets the product page url from the default swatch selected.\r\n * @param productData - Product card to be rendered.\r\n * @returns The default color swatch selected if any.\r\n */\r\nfunction getDefaultSwatchSelected(coreContext: ICoreContext, productData?: ProductSearchResult): AttributeSwatch | null {\r\n if (!productData || !productData.AttributeValues) {\r\n return null;\r\n }\r\n\r\n const siteContext = coreContext as ICoreContext;\r\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n\r\n const attributeSwatches = productData.AttributeValues.find(\r\n attributeValue => attributeValue.KeyName?.toLocaleLowerCase() === dimensionToPreSelectInProductCard\r\n )?.Swatches;\r\n\r\n if (!ArrayExtensions.hasElements(attributeSwatches)) {\r\n return null;\r\n }\r\n\r\n const defaultSwatch = attributeSwatches.find(item => item.IsDefault === true) ?? attributeSwatches[0];\r\n return defaultSwatch;\r\n}\r\n\r\n/**\r\n * Gets the product image from the default swatch selected.\r\n * @param coreContext - Context of the module using the component.\r\n * @param productData - Product card to be rendered.\r\n * @returns The product card image url.\r\n */\r\nfunction getProductImageUrlFromDefaultSwatch(coreContext: ICoreContext, productData?: ProductSearchResult): string | undefined {\r\n const defaultSwatch = getDefaultSwatchSelected(coreContext, productData);\r\n const swatchProductImageUrls = defaultSwatch?.ProductImageUrls;\r\n if (!ArrayExtensions.hasElements(swatchProductImageUrls)) {\r\n return productData?.PrimaryImageUrl;\r\n }\r\n\r\n return generateImageUrl(swatchProductImageUrls[0], coreContext.request.apiSettings);\r\n}\r\n\r\n/**\r\n * Updates the product url link to product details page.\r\n * @param productDetailsPageUrl - Product page url.\r\n * @param coreContext - Context of the module using the component.\r\n * @param queryString - Querystring to be added to the URL.\r\n * @returns The update product page url.\r\n */\r\nfunction updateProductUrl(productDetailsPageUrl: string, coreContext: ICoreContext, queryString: string): string {\r\n const sourceUrl = new URL(productDetailsPageUrl, coreContext.request.apiSettings.baseUrl);\r\n if (sourceUrl.search) {\r\n sourceUrl.search += `&${queryString}`;\r\n } else {\r\n sourceUrl.search += queryString;\r\n }\r\n\r\n const updatedUrl = new URL(sourceUrl.href);\r\n return updatedUrl.pathname + sourceUrl.search;\r\n}\r\n\r\n/**\r\n * Gets the react node for product unit of measure display.\r\n * @param unitOfMeasure - DefaultUnitOfMeasure property from product.\r\n * @returns The node representing markup for unit of measure component.\r\n */\r\nfunction renderProductUnitOfMeasure(unitOfMeasure?: string): JSX.Element | null {\r\n if (!unitOfMeasure) {\r\n return null;\r\n }\r\n return (\r\n
\r\n {unitOfMeasure}\r\n
\r\n );\r\n}\r\n\r\n/**\r\n * Gets the react node for product availability.\r\n * @param inventoryAvailabilityLabel - The product information.\r\n * @returns The node representing markup for product availability.\r\n */\r\nfunction renderProductAvailability(inventoryAvailabilityLabel: string | undefined): JSX.Element | null {\r\n if (!inventoryAvailabilityLabel || inventoryAvailabilityLabel === '') {\r\n return null;\r\n }\r\n\r\n return (\r\n
\r\n {inventoryAvailabilityLabel}\r\n
\r\n );\r\n}\r\n\r\n/**\r\n * Renders product comparison button similar to the quick view button.\r\n * @param productComparisonButton - React element of the button.\r\n * @param product - Current product info.\r\n * @param catalogId - Current catalog.\r\n * @returns React element for the specific product.\r\n */\r\nfunction renderProductComparisonButton(\r\n productComparisonButton: React.ReactNode,\r\n product: ProductSearchResult,\r\n catalogId: number\r\n): JSX.Element | undefined {\r\n validateCatalogId(catalogId);\r\n return React.cloneElement(productComparisonButton as React.ReactElement, { product, catalogId });\r\n}\r\n\r\n/**\r\n * Gets the product page url from the default swatch selected.\r\n * @param coreContext - Context of the module using the component.\r\n * @param productUrl - Product page url for the product card.\r\n * @param productData - Product card to be rendered.\r\n * @returns The product card image url.\r\n */\r\nfunction getProductPageUrlFromDefaultSwatch(\r\n coreContext: ICoreContext,\r\n productUrl: string,\r\n productData?: ProductSearchResult\r\n): string | undefined {\r\n const defaultSwatch = getDefaultSwatchSelected(coreContext, productData);\r\n if (!defaultSwatch?.SwatchValue) {\r\n return productUrl;\r\n }\r\n\r\n const siteContext = coreContext as ICoreContext;\r\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n\r\n const queryStringEncoded = encodeURIComponent(defaultSwatch.SwatchValue);\r\n const queryString = `${dimensionToPreSelectInProductCard}=${queryStringEncoded}`;\r\n return updateProductUrl(productUrl, coreContext, queryString);\r\n}\r\n\r\nconst ProductCard: React.FC = ({\r\n data,\r\n context,\r\n imageSettings,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n ratingAriaLabel,\r\n ratingCountAriaLabel,\r\n allowBack,\r\n typeName,\r\n id,\r\n telemetryContent,\r\n quickViewButton,\r\n productComparisonButton,\r\n isEnabledProductDescription,\r\n isPriceMinMaxEnabled,\r\n priceResources,\r\n inventoryLabel,\r\n dimensionAvailabilities,\r\n swatchItemAriaLabel,\r\n resources\r\n}) => {\r\n const product = data.product;\r\n\r\n const counterRef = React.useRef(null);\r\n\r\n let productUrl = getProductPageUrlSync(product?.Name ?? '', product?.RecordId ?? Number.MIN_VALUE, context.actionContext, undefined);\r\n if (allowBack) {\r\n productUrl = updateProductUrl(productUrl, context, 'back=true');\r\n }\r\n const productImageUrlFromSwatch = getProductImageUrlFromDefaultSwatch(context, product) ?? product?.PrimaryImageUrl;\r\n const productPageUrlFromSwatch = getProductPageUrlFromDefaultSwatch(context, productUrl, product) ?? productUrl;\r\n const [productPageUrl, setProductPageUrl] = useState(productPageUrlFromSwatch);\r\n const [productImageUrl, setProductImageUrl] = useState(productImageUrlFromSwatch);\r\n const [unitOfMeasureData, setUnitOfMeasureData] = React.useState<\r\n { unitOfMeasureDropDownName: string; unitOfMeasureDropDownValue: string }[] | undefined\r\n >([]);\r\n const [selectedUnit, setSelectedUnit] = React.useState('ea');\r\n const [newUpdatedPrice, setNewUpdatedPrice] = React.useState({});\r\n const productPrice = newUpdatedPrice;\r\n const [isStoreSelected, setStoreSelected] = React.useState(false);\r\n const [storeId, setStoreId] = React.useState('');\r\n\r\n const [cwUnitValue] = React.useState(getAttributeValue('CWUnit') as string);\r\n const [ConversionFactorValue] = React.useState(getAttributeValue('ConversionFactor') as number | null);\r\n\r\n function getAttributeValue(key: string): boolean | string | number | null {\r\n const values = product?.ExtensionProperties ?? [];\r\n\r\n const attribute = values.find(attribute => attribute.Key === key)?.Value;\r\n\r\n if (!attribute) {\r\n return false;\r\n }\r\n\r\n const valueMap: Record = {\r\n DualUOMEnabled: attribute.BooleanValue ?? false,\r\n CWUnit: attribute.StringValue ?? '',\r\n ConversionFactor: attribute.DecimalValue ?? null\r\n };\r\n\r\n return valueMap[key] ?? false;\r\n }\r\n\r\n React.useEffect(() => {\r\n if (MsDyn365.isBrowser && typeof window !== 'undefined' && localStorage.getItem('_msdyn365__preferredStore_') !== null) {\r\n const storedValue = localStorage.getItem('_msdyn365__preferredStore_');\r\n if (storedValue) {\r\n const parsedValue: IStoreDataCustom = JSON.parse(storedValue);\r\n if (parsedValue.StoreId) {\r\n setStoreSelected(true);\r\n setStoreId(parsedValue.StoreId);\r\n }\r\n }\r\n }\r\n }, []);\r\n\r\n const getProductUnitOfMeasureFunc = async () => {\r\n const getProductUnitOfMeasureInput = new GetProductUnitOfMeasureInput(product?.RecordId, {\r\n IncludeQuantityLimitRules: true\r\n });\r\n const result = await getProductUnitsOfMeasureAction(getProductUnitOfMeasureInput, context.actionContext);\r\n if (result) {\r\n const filteredData = result\r\n ?.filter((item: any) => item.Description === 'Case' || item.Description === 'Each') // Filter condition\r\n .map((item: any) => ({\r\n unitOfMeasureDropDownName: item.Description,\r\n unitOfMeasureDropDownValue: item.Symbol\r\n }));\r\n\r\n setUnitOfMeasureData(prevState => {\r\n const newState = filteredData;\r\n return newState;\r\n });\r\n if (filteredData && filteredData.length && filteredData.length === 1) {\r\n setSelectedUnit(filteredData[0].unitOfMeasureDropDownValue);\r\n }\r\n }\r\n };\r\n\r\n const projectDomain: ProjectionDomain = {\r\n ChannelId: context.request.apiSettings.channelId,\r\n CatalogId: context.request.apiSettings.catalogId\r\n };\r\n\r\n const getActivePricesInputMeasure: PriceLookupContext | null = {\r\n HeaderContext: undefined,\r\n LineContexts: [\r\n {\r\n ProductRecordId: product?.RecordId,\r\n UnitOfMeasureSymbol: selectedUnit\r\n }\r\n ]\r\n };\r\n\r\n const getActivePricesFunc = async () => {\r\n const getActivePricesInput = new GetActivePricesInput(\r\n projectDomain,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n true,\r\n false,\r\n false,\r\n getActivePricesInputMeasure\r\n );\r\n const result = await getActivePricesAction(getActivePricesInput, context.actionContext);\r\n if (result) {\r\n setNewUpdatedPrice(result[0]);\r\n }\r\n };\r\n\r\n React.useEffect(() => {\r\n getProductUnitOfMeasureFunc();\r\n getActivePricesFunc();\r\n }, [selectedUnit]);\r\n React.useEffect(() => {\r\n setProductPageUrl(productPageUrlFromSwatch);\r\n setProductImageUrl(productImageUrlFromSwatch);\r\n }, [productUrl, productPageUrlFromSwatch, productImageUrlFromSwatch]);\r\n const [selectedSwatchItems] = useState(new Dictionary());\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access -- app context is generic\r\n const enableStockCheck = context.app.config.enableStockCheck;\r\n\r\n const siteContext = context as ICoreContext;\r\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n\r\n /**\r\n * Updates the product page and Image url based on swatch selected.\r\n * @param coreContext - Context of the caller.\r\n * @param swatchItem - Dimension swatch selected.\r\n */\r\n const updatePageAndImageUrl = React.useCallback(\r\n (coreContext: ICoreContext, swatchItem: ISwatchItem) => {\r\n const dimensionType = swatchItem.dimensionType;\r\n selectedSwatchItems.setValue(dimensionType, swatchItem);\r\n if (StringExtensions.isNullOrWhitespace(swatchItem.value)) {\r\n return;\r\n }\r\n const queryString = `${dimensionType}=${swatchItem.value}`;\r\n let productPageUrlWithSwatch = '';\r\n if (productPageUrl.includes(dimensionType)) {\r\n const newUrl = new URL(productPageUrl, coreContext.request.apiSettings.baseUrl);\r\n newUrl.searchParams.delete(dimensionType);\r\n productPageUrlWithSwatch = updateProductUrl(newUrl.toString(), context, queryString);\r\n } else {\r\n productPageUrlWithSwatch = updateProductUrl(productPageUrl, context, queryString);\r\n }\r\n setProductPageUrl(productPageUrlWithSwatch);\r\n if (dimensionType === dimensionToPreSelectInProductCard) {\r\n const swatchProductImageUrl = ArrayExtensions.hasElements(swatchItem.productImageUrls)\r\n ? swatchItem.productImageUrls[0]\r\n : undefined;\r\n const newImageUrl = generateImageUrl(swatchProductImageUrl, coreContext.request.apiSettings);\r\n setProductImageUrl(newImageUrl);\r\n }\r\n },\r\n [selectedSwatchItems, context, productPageUrl]\r\n );\r\n\r\n if (!product) {\r\n return null;\r\n }\r\n\r\n /**\r\n * Checks if rendering the particular dimensions is allowed for product card.\r\n * @param dimensionType - Dimension to be displayed.\r\n * @returns Updates the state with new product page url.\r\n */\r\n function shouldDisplayDimension(dimensionType: string): boolean {\r\n const dimensionsContext = context as ICoreContext;\r\n const dimensionsToDisplayOnProductCard = dimensionsContext.app.config.dimensionsInProductCard;\r\n return (\r\n ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) &&\r\n !dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) &&\r\n dimensionsToDisplayOnProductCard.includes(dimensionType.toLocaleLowerCase() as DimensionTypes)\r\n );\r\n }\r\n\r\n /**\r\n * Gets the react node for product dimension as swatch.\r\n * @param attributeValues - Attribute value property from product.\r\n * @returns The node representing markup for unit of measure component.\r\n */\r\n function renderProductDimensions(attributeValues?: AttributeValue[]): JSX.Element | null {\r\n if (!attributeValues) {\r\n return null;\r\n }\r\n\r\n return (\r\n
\r\n {attributeValues.map((item: AttributeValue) => {\r\n const dimensionTypeValue = item.KeyName?.toLocaleLowerCase() ?? '';\r\n if (!shouldDisplayDimension(dimensionTypeValue)) {\r\n return null;\r\n }\r\n\r\n const siteContext = context as ICoreContext;\r\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n const dimensionType = dimensionTypeValue as DimensionTypes;\r\n const swatches =\r\n item.Swatches?.map(swatchItem => {\r\n return {\r\n itemId: `${item.RecordId ?? ''}-${dimensionTypeValue}-${swatchItem.SwatchValue ?? ''}`,\r\n value: swatchItem.SwatchValue ?? '',\r\n dimensionType,\r\n colorHexCode: swatchItem.SwatchColorHexCode,\r\n imageUrl: swatchItem.SwatchImageUrl,\r\n productImageUrls: swatchItem.ProductImageUrls,\r\n isDefault: swatchItem.IsDefault,\r\n swatchItemAriaLabel: swatchItemAriaLabel ? format(swatchItemAriaLabel, dimensionType) : '',\r\n isDisabled:\r\n enableStockCheck &&\r\n dimensionAvailabilities?.find(\r\n dimensionAvailability => dimensionAvailability.value === (swatchItem.SwatchValue ?? '')\r\n )?.isDisabled\r\n };\r\n }) ?? [];\r\n if (\r\n dimensionType === dimensionToPreSelectInProductCard &&\r\n ArrayExtensions.hasElements(swatches) &&\r\n !swatches.some(swatch => swatch.isDefault)\r\n ) {\r\n swatches[0].isDefault = true;\r\n }\r\n return (\r\n \r\n );\r\n })}\r\n
\r\n );\r\n }\r\n\r\n function renderQuickView(quickview: React.ReactNode, item?: number): JSX.Element | undefined {\r\n if (quickview === null) {\r\n return undefined;\r\n }\r\n const selectedDimensions: ProductDimension[] = selectedSwatchItems.getValues().map(swatches => {\r\n return {\r\n DimensionTypeValue: convertDimensionTypeToProductDimensionType(swatches.dimensionType),\r\n DimensionValue: {\r\n RecordId: 0,\r\n Value: swatches.value\r\n }\r\n };\r\n });\r\n return React.cloneElement(quickview as React.ReactElement, { selectedProductId: item, selectedDimensions });\r\n }\r\n\r\n const addToCartCustom = async (\r\n selectedUnit: string,\r\n currentQuantity: number,\r\n cwUnitValue: string,\r\n ConversionFactorValue: number | null\r\n ) => {\r\n const cartState = await getCartState(context.actionContext);\r\n // const cartId = result?.cart?.Id!;\r\n const addProductToCart: CartLine[] = [];\r\n if (product) {\r\n addProductToCart.push({\r\n CatalogId: context.request.apiSettings.catalogId,\r\n DeliveryMode: 'BOPIS',\r\n FulfillmentStoreId: storeId,\r\n Quantity: ConversionFactorValue ? ConversionFactorValue : currentQuantity,\r\n ItemId: (await product).ItemId,\r\n ProductId: (await product).RecordId,\r\n UnitOfMeasureSymbol: cwUnitValue ? (await product).DefaultUnitOfMeasure : selectedUnit,\r\n WarehouseId: storeId,\r\n IsGiftCardLine: false,\r\n Price: (await product).Price,\r\n EntryMethodTypeValue: 3,\r\n TrackingId: ''\r\n });\r\n }\r\n\r\n await addCartLinesAsync({ callerContext: context.actionContext }, cartState.cart.Id, addProductToCart).then(async newCart => {\r\n await cartState.updateCart({ newCartObject: newCart });\r\n });\r\n };\r\n\r\n // Construct telemetry attribute to render\r\n const payLoad = getPayloadObject('click', telemetryContent!, '', product.RecordId.toString());\r\n\r\n const attribute = getTelemetryAttributes(telemetryContent!, payLoad);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- -- Do not need type check for appsettings\r\n const isUnitOfMeasureEnabled = context.app.config && context.app.config.unitOfMeasureDisplayType === 'buyboxAndBrowse';\r\n const user = context?.request?.user;\r\n const handleDropdownChange = (event: React.ChangeEvent) => {\r\n event.stopPropagation();\r\n setSelectedUnit(event.target.value);\r\n };\r\n const maxQuantity = context.app.config.maxQuantityForCartLineItem;\r\n const [currentQuantity, setCurrentQuantity] = React.useState(1);\r\n const maxQuantityText = 'The maximum quantity to purchase for this product is {max}.'.replace('{max}', maxQuantity.toString());\r\n\r\n const onQuantityChange = (value: number) => {\r\n setCurrentQuantity(value);\r\n return true;\r\n };\r\n const handleClickAddTocart = (event: React.MouseEvent) => {\r\n event.preventDefault();\r\n addToCartCustom(selectedUnit, currentQuantity, cwUnitValue, ConversionFactorValue);\r\n };\r\n\r\n React.useEffect(() => {\r\n const interval = setInterval(() => {\r\n if (counterRef?.current) {\r\n const currentValue = counterRef?.current?.inputRef?.current?.value;\r\n if (currentQuantity && currentValue !== currentQuantity.toString()) {\r\n if (currentValue === '') {\r\n setCurrentQuantity(1);\r\n }\r\n }\r\n }\r\n }, 300);\r\n\r\n return () => clearInterval(interval);\r\n }, [currentQuantity]);\r\n\r\n const getCurrentCountValue = (): number | string | null => {\r\n if (ConversionFactorValue && currentQuantity) {\r\n return ConversionFactorValue * currentQuantity;\r\n } else {\r\n return ConversionFactorValue;\r\n }\r\n };\r\n const stockAvailabilityCode = product.ExtensionProperties\r\n ? product.ExtensionProperties.find(prop => prop.Key === 'stockCheckCode')?.Value?.StringValue\r\n : '';\r\n\r\n console.log(\r\n cwUnitValue,\r\n product.Name,\r\n ConversionFactorValue,\r\n !cwUnitValue && !ConversionFactorValue,\r\n context.app.config.enableStockCheck\r\n );\r\n\r\n const showOutOfStock = (enableStockCheck: boolean, stockAvailabilityCode?: string): string => {\r\n if (!enableStockCheck) return 'Add to cart';\r\n if (stockAvailabilityCode?.toLowerCase() === 'oos') return 'Out of Stock';\r\n return 'Add to cart';\r\n };\r\n\r\n return (\r\n <>\r\n {isEnabledProductDescription ? (\r\n <>\r\n \r\n
\r\n
\r\n {renderProductPlacementImage(\r\n imageSettings,\r\n context.request.gridSettings,\r\n productImageUrl,\r\n product.PrimaryImageUrl,\r\n product.Name,\r\n context\r\n )}\r\n
\r\n
\r\n \r\n \r\n
\r\n

{product.Name}

\r\n {/* */}\r\n {!cwUnitValue && !ConversionFactorValue && (\r\n event.stopPropagation()}\r\n onChange={handleDropdownChange}\r\n style={{ padding: '8px', margin: '8px 0', width: '100%' }}\r\n >\r\n {/* */}\r\n {unitOfMeasureData?.map(unit => (\r\n \r\n ))}\r\n \r\n )}\r\n {cwUnitValue && ConversionFactorValue && (\r\n
\r\n
\r\n
Catch Weight Unit
\r\n
{cwUnitValue}
\r\n
\r\n
\r\n
Catch Weight lbs
\r\n
{getCurrentCountValue()}
\r\n
\r\n
\r\n )}\r\n {user?.isAuthenticated ? (\r\n <>\r\n {renderPrice(\r\n context,\r\n typeName,\r\n id,\r\n product,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n isPriceMinMaxEnabled,\r\n priceResources,\r\n productPrice\r\n )}\r\n {/* {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)} */}\r\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(selectedUnit)}\r\n {renderDescription(product.Description)}\r\n
\r\n {!cwUnitValue && !ConversionFactorValue && (\r\n
\r\n \r\n
\r\n )}\r\n \r\n
\r\n \r\n {showOutOfStock(context.app.config.enableStockCheck, stockAvailabilityCode)}\r\n \r\n
\r\n
\r\n
\r\n \r\n ) : (\r\n
\r\n {'Sign in to see price'}\r\n \r\n )}\r\n
\r\n \r\n \r\n ) : (\r\n <>\r\n \r\n
\r\n {renderProductPlacementImage(\r\n imageSettings,\r\n context.request.gridSettings,\r\n productImageUrl,\r\n product.PrimaryImageUrl,\r\n product.Name,\r\n context\r\n )}\r\n
\r\n \r\n \r\n
\r\n

{product.Name}

\r\n {user?.isAuthenticated ? (\r\n <>\r\n {/* */}\r\n {!cwUnitValue && !ConversionFactorValue && (\r\n event.stopPropagation()}\r\n onChange={handleDropdownChange}\r\n style={{ padding: '8px', margin: '8px 0', width: '100%' }}\r\n >\r\n {unitOfMeasureData?.map(unit => (\r\n \r\n ))}\r\n \r\n )}\r\n\r\n {cwUnitValue && ConversionFactorValue && (\r\n
\r\n
\r\n
Catch Weight Unit
\r\n
{cwUnitValue}
\r\n
\r\n
\r\n
Catch Weight lbs
\r\n
{getCurrentCountValue()}
\r\n
\r\n
\r\n )}\r\n\r\n {renderPrice(\r\n context,\r\n typeName,\r\n id,\r\n product,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n isPriceMinMaxEnabled,\r\n priceResources,\r\n productPrice\r\n )}\r\n {/* {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)} */}\r\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(selectedUnit)}\r\n
\r\n {!cwUnitValue && !ConversionFactorValue && (\r\n
\r\n \r\n
\r\n )}\r\n\r\n \r\n
\r\n \r\n {showOutOfStock(context.app.config.enableStockCheck, stockAvailabilityCode)}\r\n \r\n
\r\n
\r\n
\r\n \r\n ) : (\r\n
\r\n {'Sign in to see price'}\r\n \r\n )}\r\n
\r\n \r\n \r\n )}\r\n {renderProductDimensions(product.AttributeValues)}\r\n {!context.app.config.hideRating &&\r\n renderRating(context, typeName, id, product.AverageRating, product.TotalRatings, ratingAriaLabel, ratingCountAriaLabel)}\r\n {renderProductAvailability(inventoryLabel)}\r\n {quickViewButton && renderQuickView(quickViewButton, product.RecordId)}\r\n {productComparisonButton && renderProductComparisonButton(productComparisonButton, product, getCatalogId(context.request))}\r\n \r\n );\r\n};\r\n\r\nfunction renderLabel(\r\n name?: string,\r\n price?: string,\r\n rating?: number,\r\n ratingAriaLabelText?: string,\r\n reviewCount?: number,\r\n ratingCountAriaLabelText?: string\r\n): string {\r\n const reviewCountArialableText = getReviewAriaLabel(reviewCount, ratingCountAriaLabelText ?? '');\r\n return `${name ?? ''} ${price ?? ''} ${getRatingAriaLabel(rating, ratingAriaLabelText)}${\r\n reviewCountArialableText ? ` ${reviewCountArialableText}` : ''\r\n }`;\r\n}\r\n\r\nfunction renderDescription(description?: string): JSX.Element | null {\r\n return

{description}

;\r\n}\r\n\r\nfunction getRatingAriaLabel(rating?: number, ratingAriaLabel?: string): string {\r\n if (rating && ratingAriaLabel) {\r\n const roundedRating = rating.toFixed(2);\r\n return format(ratingAriaLabel || '', roundedRating, '5');\r\n }\r\n return '';\r\n}\r\n\r\nfunction getReviewAriaLabel(reviewCount?: number, ratingCountAriaLabelText?: string): string {\r\n if (reviewCount && ratingCountAriaLabelText) {\r\n return format(ratingCountAriaLabelText || '', reviewCount);\r\n }\r\n return '';\r\n}\r\n\r\nfunction renderRating(\r\n coreContext: ICoreContext,\r\n moduleTypeName: string,\r\n moduleId: string,\r\n avgRating?: number,\r\n totalRatings?: number,\r\n ariaLabel?: string,\r\n ratingCountAriaLabel?: string\r\n): JSX.Element | null {\r\n if (!avgRating) {\r\n return null;\r\n }\r\n\r\n const numberRatings = totalRatings?.toString() || undefined;\r\n const ratingAriaLabelText = getRatingAriaLabel(avgRating, ariaLabel);\r\n const ratingCountAriaLabelText = getReviewAriaLabel(Number(numberRatings), ratingCountAriaLabel);\r\n\r\n return (\r\n \r\n );\r\n}\r\n\r\nfunction renderPrice(\r\n context: ICoreContext,\r\n typeName: string,\r\n id: string,\r\n productSearchResult: ProductSearchResult,\r\n savingsText?: string,\r\n freePriceText?: string,\r\n originalPriceText?: string,\r\n currentPriceText?: string,\r\n isPriceMinMaxEnabled?: boolean,\r\n priceResources?: IPriceComponentResources,\r\n productPrice?: ProductPrice\r\n): JSX.Element | null {\r\n const product: SimpleProduct = {\r\n // This is a fake product. The product type is only used for price component to determine if it should show price range or not.\r\n ProductTypeValue: productSearchResult.IsMasterProduct ? ProductType.Master : ProductType.Standalone\r\n } as SimpleProduct;\r\n\r\n const price: ProductPrice = productPrice ?? {\r\n BasePrice: productSearchResult.BasePrice,\r\n AdjustedPrice: productSearchResult.Price,\r\n CustomerContextualPrice: productSearchResult.Price,\r\n MaxVariantPrice: productSearchResult.MaxVariantPrice ? productSearchResult.MaxVariantPrice : productSearchResult.Price,\r\n MinVariantPrice: productSearchResult.MinVariantPrice ? productSearchResult.MinVariantPrice : productSearchResult.Price\r\n };\r\n\r\n return (\r\n \r\n );\r\n}\r\n\r\nfunction renderProductPlacementImage(\r\n imageSettings?: IImageSettings,\r\n gridSettings?: IGridSettings,\r\n imageUrl?: string,\r\n fallbackImageUrl?: string,\r\n altText?: string,\r\n context?: ICoreContext>\r\n): JSX.Element | null {\r\n if (!imageUrl || !gridSettings || !imageSettings) {\r\n return null;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment -- Site level config can be of any type.\r\n const contextConfig = context?.app.config?.placeholderImageName;\r\n const emptyPlaceHolderImage = contextConfig as string;\r\n let fallbackImageSource = fallbackImageUrl;\r\n if (emptyPlaceHolderImage && fallbackImageUrl) {\r\n fallbackImageSource = `${fallbackImageUrl},${emptyPlaceHolderImage}`;\r\n }\r\n const img: IImageData = {\r\n src: imageUrl,\r\n altText: altText ? altText : '',\r\n fallBackSrc: fallbackImageSource\r\n };\r\n const imageProps = {\r\n gridSettings,\r\n imageSettings\r\n };\r\n imageProps.imageSettings.cropFocalRegion = true;\r\n return (\r\n \r\n );\r\n}\r\n\r\nexport const ProductComponent: React.FunctionComponent = msdyn365Commerce.createComponentOverride<\r\n IProductComponent\r\n>('Product', { component: ProductCard, ...PriceComponentActions });\r\n\r\nexport default ProductComponent;\r\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 {\n IPriceComponentResources,\n ISwatchItem,\n PriceComponent,\n ProductComponentSwatchComponent,\n RatingComponent\n} from '@msdyn365-commerce/components';\nimport {\n getCatalogId,\n IAny,\n IComponent,\n IComponentProps,\n ICoreContext,\n IGeneric,\n IGridSettings,\n IImageData,\n IImageSettings,\n Image,\n msdyn365Commerce\n} from '@msdyn365-commerce/core';\nimport {\n AttributeSwatch,\n AttributeValue,\n ProductDimension,\n ProductPrice,\n ProductSearchResult,\n ProductType,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n convertDimensionTypeToProductDimensionType,\n Dictionary,\n DimensionTypes,\n generateImageUrl,\n getProductPageUrlSync,\n IDimensionsApp,\n StringExtensions,\n validateCatalogId\n} from '@msdyn365-commerce-modules/retail-actions';\nimport {\n format,\n getPayloadObject,\n getTelemetryAttributes,\n ITelemetryContent,\n onTelemetryClick\n} from '@msdyn365-commerce-modules/utilities';\nimport React, { useState } from 'react';\n\nexport interface IProductComponentProps extends IComponentProps<{ product?: ProductSearchResult; productPrice?: ProductPrice }> {\n className?: string;\n imageSettings?: IImageSettings;\n savingsText?: string;\n freePriceText?: string;\n originalPriceText?: string;\n currentPriceText?: string;\n ratingAriaLabel?: string;\n ratingCountAriaLabel?: string;\n allowBack?: boolean;\n telemetryContent?: ITelemetryContent;\n quickViewButton?: React.ReactNode;\n productComparisonButton?: React.ReactNode;\n isEnabledProductDescription?: boolean;\n isPriceMinMaxEnabled?: boolean;\n priceResources?: IPriceComponentResources;\n inventoryLabel?: string;\n dimensionAvailabilities?: IProductsDimensionsAvailabilities[];\n swatchItemAriaLabel?: string;\n}\n\nexport interface IProductComponent extends IComponent {}\n\nconst PriceComponentActions = {};\n\n/**\n * Gets the product page url from the default swatch selected.\n * @param productData - Product card to be rendered.\n * @returns The default color swatch selected if any.\n */\nfunction getDefaultSwatchSelected(coreContext: ICoreContext, productData?: ProductSearchResult): AttributeSwatch | null {\n if (!productData || !productData.AttributeValues) {\n return null;\n }\n\n const siteContext = coreContext as ICoreContext;\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\n\n const attributeSwatches = productData.AttributeValues.find(\n attributeValue => attributeValue.KeyName?.toLocaleLowerCase() === dimensionToPreSelectInProductCard\n )?.Swatches;\n\n if (!ArrayExtensions.hasElements(attributeSwatches)) {\n return null;\n }\n\n const defaultSwatch = attributeSwatches.find(item => item.IsDefault === true) ?? attributeSwatches[0];\n return defaultSwatch;\n}\n\n/**\n * Gets the product image from the default swatch selected.\n * @param coreContext - Context of the module using the component.\n * @param productData - Product card to be rendered.\n * @returns The product card image url.\n */\nfunction getProductImageUrlFromDefaultSwatch(coreContext: ICoreContext, productData?: ProductSearchResult): string | undefined {\n const defaultSwatch = getDefaultSwatchSelected(coreContext, productData);\n const swatchProductImageUrls = defaultSwatch?.ProductImageUrls;\n if (!ArrayExtensions.hasElements(swatchProductImageUrls)) {\n return productData?.PrimaryImageUrl;\n }\n\n return generateImageUrl(swatchProductImageUrls[0], coreContext.request.apiSettings);\n}\n\n/**\n * Updates the product url link to product details page.\n * @param productDetailsPageUrl - Product page url.\n * @param coreContext - Context of the module using the component.\n * @param queryString - Querystring to be added to the URL.\n * @returns The update product page url.\n */\nfunction updateProductUrl(productDetailsPageUrl: string, coreContext: ICoreContext, queryString: string): string {\n const sourceUrl = new URL(productDetailsPageUrl, coreContext.request.apiSettings.baseUrl);\n if (sourceUrl.search) {\n sourceUrl.search += `&${queryString}`;\n } else {\n sourceUrl.search += queryString;\n }\n\n const updatedUrl = new URL(sourceUrl.href);\n return updatedUrl.pathname + sourceUrl.search;\n}\n\n/**\n * Gets the react node for product unit of measure display.\n * @param unitOfMeasure - DefaultUnitOfMeasure property from product.\n * @returns The node representing markup for unit of measure component.\n */\nfunction renderProductUnitOfMeasure(unitOfMeasure?: string): JSX.Element | null {\n if (!unitOfMeasure) {\n return null;\n }\n return (\n
\n {unitOfMeasure}\n
\n );\n}\n\n/**\n * Gets the react node for product availability.\n * @param inventoryAvailabilityLabel - The product information.\n * @returns The node representing markup for product availability.\n */\nfunction renderProductAvailability(inventoryAvailabilityLabel: string | undefined): JSX.Element | null {\n if (!inventoryAvailabilityLabel || inventoryAvailabilityLabel === '') {\n return null;\n }\n\n return (\n
\n {inventoryAvailabilityLabel}\n
\n );\n}\n\n/**\n * Renders product comparison button similar to the quick view button.\n * @param productComparisonButton - React element of the button.\n * @param product - Current product info.\n * @param catalogId - Current catalog.\n * @returns React element for the specific product.\n */\nfunction renderProductComparisonButton(\n productComparisonButton: React.ReactNode,\n product: ProductSearchResult,\n catalogId: number\n): JSX.Element | undefined {\n validateCatalogId(catalogId);\n return React.cloneElement(productComparisonButton as React.ReactElement, { product, catalogId });\n}\n\n/**\n * Gets the product page url from the default swatch selected.\n * @param coreContext - Context of the module using the component.\n * @param productUrl - Product page url for the product card.\n * @param productData - Product card to be rendered.\n * @returns The product card image url.\n */\nfunction getProductPageUrlFromDefaultSwatch(\n coreContext: ICoreContext,\n productUrl: string,\n productData?: ProductSearchResult\n): string | undefined {\n const defaultSwatch = getDefaultSwatchSelected(coreContext, productData);\n if (!defaultSwatch?.SwatchValue) {\n return productUrl;\n }\n\n const siteContext = coreContext as ICoreContext;\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\n\n const queryStringEncoded = encodeURIComponent(defaultSwatch.SwatchValue);\n const queryString = `${dimensionToPreSelectInProductCard}=${queryStringEncoded}`;\n return updateProductUrl(productUrl, coreContext, queryString);\n}\n\nconst ProductCard: React.FC = ({\n data,\n context,\n imageSettings,\n savingsText,\n freePriceText,\n originalPriceText,\n currentPriceText,\n ratingAriaLabel,\n ratingCountAriaLabel,\n allowBack,\n typeName,\n id,\n telemetryContent,\n quickViewButton,\n productComparisonButton,\n isEnabledProductDescription,\n isPriceMinMaxEnabled,\n priceResources,\n inventoryLabel,\n dimensionAvailabilities,\n swatchItemAriaLabel\n}) => {\n const product = data.product;\n const productPrice = data.productPrice;\n\n let productUrl = getProductPageUrlSync(product?.Name ?? '', product?.RecordId ?? Number.MIN_VALUE, context.actionContext, undefined);\n if (allowBack) {\n productUrl = updateProductUrl(productUrl, context, 'back=true');\n }\n const productImageUrlFromSwatch = getProductImageUrlFromDefaultSwatch(context, product) ?? product?.PrimaryImageUrl;\n const productPageUrlFromSwatch = getProductPageUrlFromDefaultSwatch(context, productUrl, product) ?? productUrl;\n const [productPageUrl, setProductPageUrl] = useState(productPageUrlFromSwatch);\n const [productImageUrl, setProductImageUrl] = useState(productImageUrlFromSwatch);\n React.useEffect(() => {\n setProductPageUrl(productPageUrlFromSwatch);\n setProductImageUrl(productImageUrlFromSwatch);\n }, [productUrl, productPageUrlFromSwatch, productImageUrlFromSwatch]);\n const [selectedSwatchItems] = useState(new Dictionary());\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access -- app context is generic\n const enableStockCheck = context.app.config.enableStockCheck;\n\n const siteContext = context as ICoreContext;\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\n\n /**\n * Updates the product page and Image url based on swatch selected.\n * @param coreContext - Context of the caller.\n * @param swatchItem - Dimension swatch selected.\n */\n const updatePageAndImageUrl = React.useCallback(\n (coreContext: ICoreContext, swatchItem: ISwatchItem) => {\n const dimensionType = swatchItem.dimensionType;\n selectedSwatchItems.setValue(dimensionType, swatchItem);\n if (StringExtensions.isNullOrWhitespace(swatchItem.value)) {\n return;\n }\n const queryString = `${dimensionType}=${swatchItem.value}`;\n let productPageUrlWithSwatch = '';\n if (productPageUrl.includes(dimensionType)) {\n const newUrl = new URL(productPageUrl, coreContext.request.apiSettings.baseUrl);\n newUrl.searchParams.delete(dimensionType);\n productPageUrlWithSwatch = updateProductUrl(newUrl.toString(), context, queryString);\n } else {\n productPageUrlWithSwatch = updateProductUrl(productPageUrl, context, queryString);\n }\n setProductPageUrl(productPageUrlWithSwatch);\n if (dimensionType === dimensionToPreSelectInProductCard) {\n const swatchProductImageUrl = ArrayExtensions.hasElements(swatchItem.productImageUrls)\n ? swatchItem.productImageUrls[0]\n : undefined;\n const newImageUrl = generateImageUrl(swatchProductImageUrl, coreContext.request.apiSettings);\n setProductImageUrl(newImageUrl);\n }\n },\n [selectedSwatchItems, context, productPageUrl]\n );\n\n if (!product) {\n return null;\n }\n\n /**\n * Checks if rendering the particular dimensions is allowed for product card.\n * @param dimensionType - Dimension to be displayed.\n * @returns Updates the state with new product page url.\n */\n function shouldDisplayDimension(dimensionType: string): boolean {\n const dimensionsContext = context as ICoreContext;\n const dimensionsToDisplayOnProductCard = dimensionsContext.app.config.dimensionsInProductCard;\n return (\n ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) &&\n !dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) &&\n dimensionsToDisplayOnProductCard.includes(dimensionType.toLocaleLowerCase() as DimensionTypes)\n );\n }\n\n /**\n * Gets the react node for product dimension as swatch.\n * @param attributeValues - Attribute value property from product.\n * @returns The node representing markup for unit of measure component.\n */\n function renderProductDimensions(attributeValues?: AttributeValue[]): JSX.Element | null {\n if (!attributeValues) {\n return null;\n }\n\n return (\n
\n {attributeValues.map((item: AttributeValue) => {\n const dimensionTypeValue = item.KeyName?.toLocaleLowerCase() ?? '';\n if (!shouldDisplayDimension(dimensionTypeValue)) {\n return null;\n }\n\n const siteContext = context as ICoreContext;\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\n const dimensionType = dimensionTypeValue as DimensionTypes;\n const swatches =\n item.Swatches?.map(swatchItem => {\n return {\n itemId: `${item.RecordId ?? ''}-${dimensionTypeValue}-${swatchItem.SwatchValue ?? ''}`,\n value: swatchItem.SwatchValue ?? '',\n dimensionType,\n colorHexCode: swatchItem.SwatchColorHexCode,\n imageUrl: swatchItem.SwatchImageUrl,\n productImageUrls: swatchItem.ProductImageUrls,\n isDefault: swatchItem.IsDefault,\n swatchItemAriaLabel: swatchItemAriaLabel ? format(swatchItemAriaLabel, dimensionType) : '',\n isDisabled:\n enableStockCheck &&\n dimensionAvailabilities?.find(\n dimensionAvailability => dimensionAvailability.value === (swatchItem.SwatchValue ?? '')\n )?.isDisabled\n };\n }) ?? [];\n if (\n dimensionType === dimensionToPreSelectInProductCard &&\n ArrayExtensions.hasElements(swatches) &&\n !swatches.some(swatch => swatch.isDefault)\n ) {\n swatches[0].isDefault = true;\n }\n return (\n \n );\n })}\n
\n );\n }\n\n function renderQuickView(quickview: React.ReactNode, item?: number): JSX.Element | undefined {\n if (quickview === null) {\n return undefined;\n }\n const selectedDimensions: ProductDimension[] = selectedSwatchItems.getValues().map(swatches => {\n return {\n DimensionTypeValue: convertDimensionTypeToProductDimensionType(swatches.dimensionType),\n DimensionValue: {\n RecordId: 0,\n Value: swatches.value\n }\n };\n });\n return React.cloneElement(quickview as React.ReactElement, { selectedProductId: item, selectedDimensions });\n }\n\n // Construct telemetry attribute to render\n const payLoad = getPayloadObject('click', telemetryContent!, '', product.RecordId.toString());\n\n const attribute = getTelemetryAttributes(telemetryContent!, payLoad);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- -- Do not need type check for appsettings\n const isUnitOfMeasureEnabled = context.app.config && context.app.config.unitOfMeasureDisplayType === 'buyboxAndBrowse';\n\n return (\n <>\n {isEnabledProductDescription ? (\n \n
\n
\n {renderProductPlacementImage(\n imageSettings,\n context.request.gridSettings,\n productImageUrl,\n product.PrimaryImageUrl,\n product.Name,\n context\n )}\n
\n
\n

{product.Name}

\n {renderPrice(\n context,\n typeName,\n id,\n product,\n savingsText,\n freePriceText,\n originalPriceText,\n currentPriceText,\n isPriceMinMaxEnabled,\n priceResources,\n productPrice\n )}\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)}\n {renderDescription(product.Description)}\n
\n
\n \n ) : (\n \n
\n {renderProductPlacementImage(\n imageSettings,\n context.request.gridSettings,\n productImageUrl,\n product.PrimaryImageUrl,\n product.Name,\n context\n )}\n
\n
\n

{product.Name}

\n {renderPrice(\n context,\n typeName,\n id,\n product,\n savingsText,\n freePriceText,\n originalPriceText,\n currentPriceText,\n isPriceMinMaxEnabled,\n priceResources,\n productPrice\n )}\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)}\n
\n \n )}\n {renderProductDimensions(product.AttributeValues)}\n {!context.app.config.hideRating &&\n renderRating(context, typeName, id, product.AverageRating, product.TotalRatings, ratingAriaLabel, ratingCountAriaLabel)}\n {renderProductAvailability(inventoryLabel)}\n {quickViewButton && renderQuickView(quickViewButton, product.RecordId)}\n {productComparisonButton && renderProductComparisonButton(productComparisonButton, product, getCatalogId(context.request))}\n \n );\n};\n\nfunction renderLabel(\n name?: string,\n price?: string,\n rating?: number,\n ratingAriaLabelText?: string,\n reviewCount?: number,\n ratingCountAriaLabelText?: string\n): string {\n const reviewCountArialableText = getReviewAriaLabel(reviewCount, ratingCountAriaLabelText ?? '');\n return `${name ?? ''} ${price ?? ''} ${getRatingAriaLabel(rating, ratingAriaLabelText)}${\n reviewCountArialableText ? ` ${reviewCountArialableText}` : ''\n }`;\n}\n\nfunction renderDescription(description?: string): JSX.Element | null {\n return

{description}

;\n}\n\nfunction getRatingAriaLabel(rating?: number, ratingAriaLabel?: string): string {\n if (rating && ratingAriaLabel) {\n const roundedRating = rating.toFixed(2);\n return format(ratingAriaLabel || '', roundedRating, '5');\n }\n return '';\n}\n\nfunction getReviewAriaLabel(reviewCount?: number, ratingCountAriaLabelText?: string): string {\n if (reviewCount && ratingCountAriaLabelText) {\n return format(ratingCountAriaLabelText || '', reviewCount);\n }\n return '';\n}\n\nfunction renderRating(\n coreContext: ICoreContext,\n moduleTypeName: string,\n moduleId: string,\n avgRating?: number,\n totalRatings?: number,\n ariaLabel?: string,\n ratingCountAriaLabel?: string\n): JSX.Element | null {\n if (!avgRating) {\n return null;\n }\n\n const numberRatings = totalRatings?.toString() || undefined;\n const ratingAriaLabelText = getRatingAriaLabel(avgRating, ariaLabel);\n const ratingCountAriaLabelText = getReviewAriaLabel(Number(numberRatings), ratingCountAriaLabel);\n\n return (\n \n );\n}\n\nfunction renderPrice(\n context: ICoreContext,\n typeName: string,\n id: string,\n productSearchResult: ProductSearchResult,\n savingsText?: string,\n freePriceText?: string,\n originalPriceText?: string,\n currentPriceText?: string,\n isPriceMinMaxEnabled?: boolean,\n priceResources?: IPriceComponentResources,\n productPrice?: ProductPrice\n): JSX.Element | null {\n const product: SimpleProduct = {\n // This is a fake product. The product type is only used for price component to determine if it should show price range or not.\n ProductTypeValue: productSearchResult.IsMasterProduct ? ProductType.Master : ProductType.Standalone\n } as SimpleProduct;\n\n const price: ProductPrice = productPrice ?? {\n BasePrice: productSearchResult.BasePrice,\n AdjustedPrice: productSearchResult.Price,\n CustomerContextualPrice: productSearchResult.Price,\n MaxVariantPrice: productSearchResult.MaxVariantPrice ? productSearchResult.MaxVariantPrice : productSearchResult.Price,\n MinVariantPrice: productSearchResult.MinVariantPrice ? productSearchResult.MinVariantPrice : productSearchResult.Price\n };\n\n return (\n \n );\n}\n\nfunction renderProductPlacementImage(\n imageSettings?: IImageSettings,\n gridSettings?: IGridSettings,\n imageUrl?: string,\n fallbackImageUrl?: string,\n altText?: string,\n context?: ICoreContext>\n): JSX.Element | null {\n if (!imageUrl || !gridSettings || !imageSettings) {\n return null;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment -- Site level config can be of any type.\n const contextConfig = context?.app.config?.placeholderImageName;\n const emptyPlaceHolderImage = contextConfig as string;\n let fallbackImageSource = fallbackImageUrl;\n if (emptyPlaceHolderImage && fallbackImageUrl) {\n fallbackImageSource = `${fallbackImageUrl},${emptyPlaceHolderImage}`;\n }\n const img: IImageData = {\n src: imageUrl,\n altText: altText ? altText : '',\n fallBackSrc: fallbackImageSource\n };\n const imageProps = {\n gridSettings,\n imageSettings\n };\n imageProps.imageSettings.cropFocalRegion = true;\n return (\n \n );\n}\n\nexport const ProductComponent: React.FunctionComponent = msdyn365Commerce.createComponentOverride<\n IProductComponent\n>('Product', { component: ProductCard, ...PriceComponentActions });\n\nexport default ProductComponent;\n"],"names":["GetActivePricesInput","constructor","projectDomain","productIds","activeDate","customerId","affiliationLoyaltyTiers","includeSimpleDiscountsInContextualPrice","includeVariantPriceRange","includeAttainablePricesAndDiscounts","priceLookupContext","getCacheKey","getCacheObjectType","dataCacheType","this","async","getActivePricesAction","request","ctx","result","getActivePricesAsync","callerContext","error","console","log","Msdyn365","action","id","GetProductUnitOfMeasureInput","productId","unitOfMeasureSearchCriteria","getProductUnitsOfMeasureAction","getProductUnitsOfMeasureAsync","getDefaultSwatchSelected","coreContext","productData","_productData$Attribut","_attributeSwatches$fi","AttributeValues","dimensionToPreSelectInProductCard","app","config","attributeSwatches","find","attributeValue","_attributeValue$KeyNa","KeyName","toLocaleLowerCase","Swatches","ArrayExtensions","hasElements","item","IsDefault","updateProductUrl","productDetailsPageUrl","queryString","sourceUrl","URL","apiSettings","baseUrl","search","href","pathname","renderProductUnitOfMeasure","unitOfMeasure","React","className","renderLabel","name","price","rating","ratingAriaLabelText","reviewCount","ratingCountAriaLabelText","reviewCountArialableText","getReviewAriaLabel","getRatingAriaLabel","ratingAriaLabel","roundedRating","toFixed","format","renderPrice","context","typeName","productSearchResult","savingsText","freePriceText","originalPriceText","currentPriceText","isPriceMinMaxEnabled","priceResources","productPrice","product","ProductTypeValue","IsMasterProduct","ProductType","Master","Standalone","BasePrice","AdjustedPrice","Price","CustomerContextualPrice","MaxVariantPrice","MinVariantPrice","PriceComponent","data","renderProductPlacementImage","imageSettings","gridSettings","imageUrl","fallbackImageUrl","altText","_context$app$config","contextConfig","placeholderImageName","fallbackImageSource","img","src","fallBackSrc","imageProps","cropFocalRegion","Image","Object","assign","requestContext","actionContext","loadFailureBehavior","bypassHideOnFailure","ProductComponent","msdyn365Commerce","createComponentOverride","_objectSpread","component","_ref","_product$Name","_product$RecordId","_getProductImageUrlFr","_getProductPageUrlFro","_context$request","_product$ExtensionPro2","ratingCountAriaLabel","allowBack","telemetryContent","quickViewButton","productComparisonButton","isEnabledProductDescription","inventoryLabel","dimensionAvailabilities","swatchItemAriaLabel","resources","counterRef","productUrl","getProductPageUrlSync","Name","RecordId","Number","MIN_VALUE","undefined","productImageUrlFromSwatch","defaultSwatch","swatchProductImageUrls","ProductImageUrls","generateImageUrl","PrimaryImageUrl","getProductImageUrlFromDefaultSwatch","productPageUrlFromSwatch","SwatchValue","encodeURIComponent","getProductPageUrlFromDefaultSwatch","productPageUrl","setProductPageUrl","useState","productImageUrl","setProductImageUrl","unitOfMeasureData","setUnitOfMeasureData","selectedUnit","setSelectedUnit","newUpdatedPrice","setNewUpdatedPrice","isStoreSelected","setStoreSelected","storeId","setStoreId","cwUnitValue","getAttributeValue","ConversionFactorValue","key","_product$ExtensionPro","_values$find","_attribute$BooleanVal","_attribute$StringValu","_attribute$DecimalVal","_valueMap$key","attribute","ExtensionProperties","Key","Value","DualUOMEnabled","BooleanValue","CWUnit","StringValue","ConversionFactor","DecimalValue","MsDyn365","isBrowser","window","localStorage","getItem","storedValue","parsedValue","JSON","parse","StoreId","ChannelId","channelId","CatalogId","catalogId","getActivePricesInputMeasure","HeaderContext","LineContexts","ProductRecordId","UnitOfMeasureSymbol","getProductUnitOfMeasureInput","IncludeQuantityLimitRules","filteredData","filter","Description","map","unitOfMeasureDropDownName","unitOfMeasureDropDownValue","Symbol","prevState","length","getProductUnitOfMeasureFunc","getActivePricesInput","getActivePricesFunc","selectedSwatchItems","Dictionary","enableStockCheck","updatePageAndImageUrl","swatchItem","dimensionType","setValue","StringExtensions","isNullOrWhitespace","value","productPageUrlWithSwatch","includes","newUrl","searchParams","delete","toString","swatchProductImageUrl","productImageUrls","newImageUrl","payLoad","getPayloadObject","getTelemetryAttributes","isUnitOfMeasureEnabled","unitOfMeasureDisplayType","user","handleDropdownChange","event","stopPropagation","target","maxQuantity","maxQuantityForCartLineItem","currentQuantity","setCurrentQuantity","maxQuantityText","replace","onQuantityChange","handleClickAddTocart","preventDefault","cartState","getCartState","addProductToCart","push","DeliveryMode","FulfillmentStoreId","Quantity","ItemId","ProductId","DefaultUnitOfMeasure","WarehouseId","IsGiftCardLine","EntryMethodTypeValue","TrackingId","addCartLinesAsync","cart","Id","then","updateCart","newCartObject","newCart","addToCartCustom","interval","setInterval","current","_counterRef$current","currentValue","inputRef","clearInterval","getCurrentCountValue","stockAvailabilityCode","prop","showOutOfStock","toLowerCase","onClick","onTelemetryClick","cultureFormatter","formatCurrency","AverageRating","TotalRatings","onChange","style","padding","margin","width","unit","isAuthenticated","description","IncrementalQuantity","ref","max","currentCount","inputQuantityAriaLabel","decrementButtonAriaLabel","incrementButtonAriaLabel","minQuantityText","disabled","title","cursor","signInUrl","attributeValues","_item$KeyName$toLocal","_item$KeyName","_item$Swatches$map","_item$Swatches","dimensionTypeValue","dimensionsToDisplayOnProductCard","dimensionsInProductCard","DimensionTypes","none","shouldDisplayDimension","swatches","_item$RecordId","_swatchItem$SwatchVal","_swatchItem$SwatchVal2","_dimensionAvailabilit","itemId","colorHexCode","SwatchColorHexCode","SwatchImageUrl","isDefault","isDisabled","dimensionAvailability","_swatchItem$SwatchVal3","some","swatch","ProductComponentSwatchComponent","onSelectDimension","hideRating","moduleTypeName","moduleId","avgRating","totalRatings","ariaLabel","numberRatings","RatingComponent","ratingCount","readOnly","renderRating","inventoryAvailabilityLabel","quickview","selectedDimensions","getValues","DimensionTypeValue","convertDimensionTypeToProductDimensionType","DimensionValue","selectedProductId","renderQuickView","validateCatalogId","renderProductComparisonButton","getCatalogId"],"sourceRoot":""}