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tBlV,EAAwC,GAE5C,MAAMmV,EAAgB9U,MAAAA,GAEpB,QAFkC2U,EAAd3U,EAAgBW,MAAK5B,GAChCA,EAAKc,SAAWA,WACzB,IAAA8U,OAAA,EAFoBA,EAElBG,cAEEC,EAEJ,QAFgBH,EAAGF,EAAgB/T,MAAK5B,GAC/BA,EAAKc,SAAWA,WACzB,IAAA+U,OAAA,EAFmBA,EAEjB3U,eAUJ,OAR+C,QAA3B4U,EAAGE,MAAAA,OAAY,EAAZA,EAAcC,MAAM,YAAI,IAAAH,EAAAA,EAAI,IACpC1P,SAAQ8P,IACnBtV,EAAYuV,KAAK,CACbC,cAAetH,OAAOiH,GACtBM,cAAevH,OAAOoH,QAIvBtV,kCChCJ,MAAM0V,EAAoB,WAIrB,IAAAC,EAAA,IAHRC,EAAAvR,UAAAC,OAAA,QAAAzB,IAAAwB,UAAA,GAAAA,UAAA,GAA+B,GAC/BwR,EAAAxR,UAAAC,OAAA,QAAAzB,IAAAwB,UAAA,GAAAA,UAAA,GAAsB,GACtByR,EAAAzR,UAAAC,OAAA,QAAAzB,IAAAwB,UAAA,GAAAA,UAAA,GAAuC,sBAEvC,IAAI0R,EAAYH,EAAW5U,MAAKgV,GAAKA,EAAE/H,OAAS6H,IAC5CG,EAAyC,QAA7BN,EAAGE,MAAAA,OAAW,EAAXA,EAAaR,MAAM,KAAK,UAAE,IAAAM,EAAAA,EAAI,GACjD,OAAII,MAAAA,GAAAA,EAAWG,UACJ,GAAGD,KAAgBF,MAAAA,OAAS,EAATA,EAAWG,YAGlCL","sources":["webpack://bestseller.commerce.online/./src/actions/get-price-for-product-search-result.ts?fd24","webpack://bestseller.commerce.online/./src/components/common/Show/show.tsx?db40","webpack://bestseller.commerce.online/./src/shared/components/price.component.tsx?0789","webpack://bestseller.commerce.online/./src/shared/components/product.component.tsx?7636","webpack://bestseller.commerce.online/./src/shared/functions/get-affiliation.ts?82a6","webpack://bestseller.commerce.online/./src/shared/functions/get-commercial-name.ts?6aba"],"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 { CacheType, createObservableDataAction, getCatalogId, IAction, IActionContext, IActionInput } from '@msdyn365-commerce/core';\r\nimport {\r\n ProductPrice,\r\n ProductsDataActions,\r\n ProductSearchResult,\r\n ProjectionDomain,\r\n AffiliationLoyaltyTier\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { ArrayExtensions, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { ProductSearchResultExpanded } from '../shared/classes/ProductSearchResultExpanded';\r\nimport { getAffiliation } from '../shared/functions/get-affiliation';\r\nimport { ProductResultWithSwatchLimit } from '../modules/ext-search-result-container/actions/get-full-products-by-collection';\r\n\r\n/**\r\n * Input class for the GetPriceForProductSearchResult Data Action.\r\n */\r\nexport class PriceForProductSearchResultInput implements IActionInput {\r\n public products: ProductSearchResultExpanded[];\r\n\r\n public constructor(products: ProductSearchResult[]) {\r\n this.products = products;\r\n }\r\n\r\n /**\r\n * Get the cache key.\r\n * @returns The cache key.\r\n */\r\n public getCacheKey = (): string => `PriceForProductSearchResult-${JSON.stringify(this.products)}`;\r\n\r\n /**\r\n * Get the cache object type.\r\n * @returns The cache object type.\r\n */\r\n public getCacheObjectType = (): string => 'ProductSearchResult';\r\n\r\n /**\r\n * Define the data cache type.\r\n * @returns The cache type.\r\n */\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * The createInput method for the GetPriceForProductSearchResultDataAction.\r\n * @param products -- The product search result.\r\n * @returns The input.\r\n */\r\nexport const createActivePriceForProductSearchResultInput = (products: ProductSearchResultExpanded[]): PriceForProductSearchResultInput => {\r\n return new PriceForProductSearchResultInput(products);\r\n};\r\n\r\n/**\r\n * The Action Method for the GetPriceForProductSearchResult Data Action\r\n * Gets the active price for product search result via the getActivePrice RetailServer API.\r\n * @param input -- The data input.\r\n * @param context -- The action context.\r\n * @returns The product search result updated with price.\r\n */\r\nexport async function getPriceForProductSearchResultAction(\r\n input: PriceForProductSearchResultInput,\r\n context: IActionContext\r\n): Promise {\r\n let productRecIds: number[];\r\n if (ArrayExtensions.hasElements(input.products)) {\r\n productRecIds = input.products.map(product => product.RecordId);\r\n //Remove duplicate ids from variant splitting\r\n productRecIds = productRecIds.filter((item, index, array) => array.indexOf(item) === index);\r\n } else {\r\n return Promise.resolve([]);\r\n }\r\n\r\n const catalogId = getCatalogId(context.requestContext);\r\n\r\n const projectDomain: ProjectionDomain = { ChannelId: +context.requestContext.apiSettings.channelId, CatalogId: catalogId };\r\n const priceZero = 0;\r\n\r\n var affiliation: AffiliationLoyaltyTier[] = getAffiliation(\r\n context.requestContext.locale,\r\n context.requestContext.app.config.affiliationIds,\r\n context.requestContext.app.config.loyaltyTierIds\r\n );\r\n\r\n try {\r\n const productPrices: ProductPrice[] = await ProductsDataActions.getActivePricesAsync(\r\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\r\n projectDomain,\r\n productRecIds,\r\n new Date(),\r\n null,\r\n affiliation,\r\n true,\r\n false,\r\n true\r\n );\r\n\r\n const productResults: ProductSearchResultExpanded[] = input.products.map(product => {\r\n const activePrice = productPrices.find(price => price.ProductId === product.RecordId);\r\n if (activePrice) {\r\n product.Price = activePrice.CustomerContextualPrice ?? product.Price;\r\n product.BasePrice = Math.max(\r\n activePrice.BasePrice ?? priceZero,\r\n activePrice.TradeAgreementPrice ?? priceZero,\r\n activePrice.AdjustedPrice ?? priceZero\r\n );\r\n product.ProductPrice = activePrice;\r\n }\r\n return product;\r\n });\r\n\r\n return Promise.resolve(productResults);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error type.\r\n if (error instanceof Error) {\r\n context.telemetry.exception(error);\r\n context.telemetry.debug('[getPriceForProductSearchResultAction]Error executing action');\r\n context.telemetry.debug(error.message);\r\n }\r\n throw new Error('[getPriceForProductSearchResultAction]Error executing action');\r\n }\r\n}\r\n\r\n/**\r\n * The getPriceForProductSearchResult data action.\r\n */\r\nexport const getPriceForProductSearchResultDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-price-for-product-search-result',\r\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- existing pattern.\r\n action: >getPriceForProductSearchResultAction,\r\n input: createActivePriceForProductSearchResultInput\r\n});\r\n\r\nexport default getPriceForProductSearchResultDataAction;\r\n","import React, { FC, PropsWithChildren } from 'react';\r\n\r\ntype ShowProps = {\r\n condition: boolean;\r\n Otherwise?: FC | JSX.Element;\r\n};\r\nexport const Show = ({ children, condition, Otherwise }: PropsWithChildren): JSX.Element => (\r\n <>{condition ? children : Otherwise !== undefined ? Otherwise : <>}\r\n);\r\n\r\nexport default Show;\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 { IComponent, IComponentProps, msdyn365Commerce } from '@msdyn365-commerce/core';\r\nimport { ProductPrice, ProductType, SalesAgreementPriceLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { Button, format, ICollapseProps } from '@msdyn365-commerce-modules/utilities';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\n\r\nconst defaultPrice: number = 0;\r\nconst freePrice: number = 0;\r\n\r\n/**\r\n * Interface for price component resources.\r\n * @param {string} priceRangeSeparator - The price range separator.\r\n */\r\nexport interface IPriceComponentResources {\r\n priceRangeSeparator?: string;\r\n salesAgreementPricePrompt?: string;\r\n salesAgreementExpirationDatePrompt?: string;\r\n salesAgreementCommittedQuantityPrompt?: string;\r\n salesAgreementRemainingQuantityPrompt?: string;\r\n memberPriceMessage?: string;\r\n saleMessage?: string;\r\n}\r\n\r\n/**\r\n * Interface for price component props.\r\n * @param {boolean} isPriceMinMaxEnabled - Whether the price range feature is enabled or not.\r\n * @param {IPriceComponentResources} priceResources - The price range resources.\r\n */\r\nexport interface IPriceComponentProps extends IComponentProps<{ price: ProductPrice }> {\r\n className?: string;\r\n product?: SimpleProduct;\r\n savingsText?: string;\r\n freePriceText?: string;\r\n originalPriceText?: string;\r\n currentPriceText?: string;\r\n isPriceMinMaxEnabled?: boolean;\r\n isSalesAgreementPriceFeatureEnabled?: boolean;\r\n salesAgreementLineId?: number;\r\n priceResources?: IPriceComponentResources;\r\n salesAgreementDetailCollapseProps?: ICollapseProps;\r\n currencyCode?: string;\r\n showDiscountBox?: boolean;\r\n salesAgreementDetailOnClick?(event: React.MouseEvent | React.KeyboardEvent): void;\r\n}\r\n\r\n/**\r\n * The interface of price component.\r\n */\r\nexport interface IPriceComponent extends IComponent {}\r\n\r\nconst priceComponentActions = {};\r\n\r\n/**\r\n * Get the original price from price component props.\r\n * @param props - The IPriceComponentProps.\r\n * @returns The original price.\r\n */\r\nconst getOriginalPrice = (props: IPriceComponentProps): number => {\r\n return Math.max(\r\n props.data.price.BasePrice || defaultPrice,\r\n props.data.price.TradeAgreementPrice || defaultPrice,\r\n props.data.price.AdjustedPrice || defaultPrice\r\n );\r\n};\r\n\r\nconst getActivePrice = (props: IPriceComponentProps): number => {\r\n if (showPriceRangeForMasterProduct(props) && props.data.price.MinVariantPrice !== undefined) {\r\n return props.data.price.MinVariantPrice;\r\n }\r\n\r\n if (props.data.price.CustomerContextualPrice !== undefined) {\r\n return props.data.price.CustomerContextualPrice;\r\n }\r\n\r\n return getOriginalPrice(props);\r\n};\r\n\r\n/**\r\n * Get the formatted currency.\r\n * @param props - The props.\r\n * @param price - The price.\r\n * @param shouldUseFreePriceText - The shouldUseFreePriceText.\r\n * @returns The formatted currency.\r\n */\r\nconst formatCurrency = (\r\n props: IPriceComponentProps,\r\n price: number | undefined,\r\n shouldUseFreePriceText: boolean | undefined,\r\n currencyCode?: string | undefined\r\n): string => {\r\n if (price === undefined) {\r\n return '';\r\n }\r\n\r\n if (shouldUseFreePriceText && price === freePrice && props.freePriceText) {\r\n return props.freePriceText;\r\n }\r\n\r\n return props.context.cultureFormatter.formatCurrency(price, currencyCode);\r\n};\r\n\r\nconst showPriceRangeForMasterProduct = (props: IPriceComponentProps): boolean => {\r\n return (\r\n (props.isPriceMinMaxEnabled ?? false) &&\r\n (props.product?.ProductTypeValue === ProductType.Master || props.product?.ProductTypeValue === ProductType.KitMaster) &&\r\n props.data.price.MinVariantPrice !== undefined &&\r\n props.data.price.MaxVariantPrice !== undefined\r\n );\r\n};\r\n\r\n/**\r\n * ShowStrikethroughPricing.\r\n * @param props - The props.\r\n * @returns True if showStrikethroughPricing, false otherwise.\r\n */\r\nconst showStrikethroughPricing = (props: IPriceComponentProps): boolean => {\r\n const originalSalesPrice = getOriginalPrice(props);\r\n const activeSalesPrice = showPriceRangeForMasterProduct(props)\r\n ? props.data.price.MinVariantPrice\r\n : props.data.price.CustomerContextualPrice;\r\n\r\n if (activeSalesPrice && originalSalesPrice) {\r\n return activeSalesPrice < originalSalesPrice;\r\n }\r\n\r\n return false;\r\n};\r\n\r\n/**\r\n * Render current price.\r\n * @param props - The props.\r\n * @returns The JSX.Element.\r\n */\r\nconst renderCurrentPrice = (\r\n props: IPriceComponentProps,\r\n priceClass: string = 'msc-price__actual',\r\n isMemberDiscount: boolean = false\r\n): JSX.Element => {\r\n const maxVariantPrice: string = formatCurrency(props, props.data.price.MaxVariantPrice, false, props.currencyCode);\r\n const minVariantPrice: string = formatCurrency(props, props.data.price.MinVariantPrice, false, props.currencyCode);\r\n if (\r\n props.isPriceMinMaxEnabled &&\r\n props.data.price.MaxVariantPrice &&\r\n props.data.price.MinVariantPrice &&\r\n props.data.price.MaxVariantPrice > props.data.price.MinVariantPrice\r\n ) {\r\n return (\r\n \r\n \r\n {minVariantPrice}\r\n \r\n \r\n {props.priceResources?.priceRangeSeparator}\r\n \r\n \r\n {maxVariantPrice}\r\n \r\n \r\n );\r\n }\r\n\r\n return (\r\n \r\n {isMemberDiscount && !props.showDiscountBox && `${props.priceResources?.memberPriceMessage} `}\r\n {formatCurrency(props, getActivePrice(props), true, props.currencyCode)}\r\n \r\n );\r\n};\r\n\r\n/**\r\n * Render active sales price with original sales price.\r\n * @param props - The props.\r\n * @returns The JSX.Element.\r\n */\r\nconst renderCurrentPriceWithOriginalPrice = (props: IPriceComponentProps): JSX.Element => {\r\n const initialPrice: string = formatCurrency(props, getOriginalPrice(props), true);\r\n return (\r\n <>\r\n \r\n {` `}\r\n {props.originalPriceText}\r\n {` `}\r\n {initialPrice}\r\n {` `}\r\n {props.currentPriceText}\r\n {` `}\r\n {renderCurrentPrice(props, 'msc-price__discount')}\r\n \r\n \r\n \r\n {props.savingsText && {props.savingsText}}\r\n \r\n );\r\n};\r\n\r\nconst renderSalesAgreementDetail = (props: IPriceComponentProps): JSX.Element => {\r\n // In most cases there should be only one sales agreement line.\r\n // If there are more than one, only the first one will be shown.\r\n const firstPriceLine: SalesAgreementPriceLine = (props.data.price.AttainablePriceLines ?? [])[0] as SalesAgreementPriceLine;\r\n return (\r\n

\r\n

\r\n {/* Available date */}\r\n {` · ${format(\r\n props.priceResources?.salesAgreementExpirationDatePrompt ?? '',\r\n props.context.cultureFormatter.formatDate(firstPriceLine.EffectiveDate as Date),\r\n props.context.cultureFormatter.formatDate(firstPriceLine.ExpirationDate as Date)\r\n )}`}\r\n

\r\n

\r\n {/* Quantity commitment */}\r\n {` · ${format(props.priceResources?.salesAgreementCommittedQuantityPrompt ?? '', firstPriceLine.CommittedQuantity)}`}\r\n

\r\n

\r\n {/* Remaining quantity to qualify */}\r\n {` · ${format(props.priceResources?.salesAgreementRemainingQuantityPrompt ?? '', firstPriceLine.RemainingQuantity)}`}\r\n

\r\n

\r\n );\r\n};\r\n\r\n/**\r\n * Render member price.\r\n * @param props - The props.\r\n * @returns The JSX.Element.\r\n */\r\nconst renderMemberPrice = (props: IPriceComponentProps): JSX.Element => {\r\n const initialPrice: string = formatCurrency(props, getOriginalPrice(props), true);\r\n //No strikethrough in member price\r\n return (\r\n <>\r\n \r\n {` `}\r\n {props.originalPriceText}\r\n {` `}\r\n {initialPrice}\r\n {` `}\r\n {props.currentPriceText}\r\n {` `}\r\n {renderCurrentPrice(props, 'msc-price__discount__member', true)}\r\n \r\n \r\n \r\n {props.savingsText && {props.savingsText}}\r\n \r\n );\r\n};\r\n\r\nfunction renderDiscountBox(props: IPriceComponentProps, isMemberDiscount: boolean) {\r\n var discount = 0;\r\n if (props.data.price.CustomerContextualPrice !== undefined && props.data.price.BasePrice !== undefined) {\r\n var diff = props.data.price.CustomerContextualPrice - props.data.price.BasePrice;\r\n discount = (diff / props.data.price.BasePrice) * 100;\r\n }\r\n if (props.data.price?.BasePrice !== props.data.price?.CustomerContextualPrice) {\r\n if (isMemberDiscount) {\r\n return (\r\n
\r\n

{`${props.priceResources?.memberPriceMessage} `}

\r\n
\r\n );\r\n } else {\r\n return (\r\n
\r\n

{`${props.priceResources?.saleMessage} ${Math.abs(discount).toFixed(0)}%`}

\r\n
\r\n );\r\n }\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Price.\r\n * @param props - The props.\r\n * @returns The JSX.Element.\r\n */\r\nconst Price: React.FC = (props: IPriceComponentProps): JSX.Element | null => {\r\n // CustomerContextualPrice could be zero\r\n if (props.data.price.CustomerContextualPrice === undefined) {\r\n return null;\r\n }\r\n\r\n //TODO: Not a priority - but should be fixed\r\n var isMemberDiscount = false;\r\n props.data.price.DiscountLines?.forEach(discount => {\r\n if (discount.OfferName?.toLowerCase().includes(props.context.request.app.config.loyaltyDiscountIdentifier)) {\r\n isMemberDiscount = true;\r\n }\r\n });\r\n\r\n // Determine if contract price is avaiable/applied by:\r\n // isFeatureEnabled and SA price != 0, for PDP.\r\n // SA line id != 0, for cart line.\r\n if (props.isSalesAgreementPriceFeatureEnabled && props.data.price.SalesAgreementPrice !== 0) {\r\n const [isExpanded, setIsExpanded] = React.useState(false);\r\n const toggle = () => {\r\n setIsExpanded(!isExpanded);\r\n };\r\n return (\r\n \r\n \r\n

\r\n {formatCurrency(props, props.data.price.SalesAgreementPrice ?? props.data.price.CustomerContextualPrice, true)}\r\n

\r\n \r\n {props.priceResources?.salesAgreementPricePrompt}\r\n \r\n {isExpanded && renderSalesAgreementDetail(props)}\r\n
\r\n
\r\n );\r\n }\r\n\r\n return (\r\n
\r\n {isMemberDiscount ? (\r\n {renderMemberPrice(props)}\r\n ) : (\r\n \r\n {showStrikethroughPricing(props) ? renderCurrentPriceWithOriginalPrice(props) : renderCurrentPrice(props)}\r\n \r\n )}\r\n {props.showDiscountBox && renderDiscountBox(props, isMemberDiscount)}\r\n
\r\n );\r\n};\r\n\r\n/**\r\n * The PriceComponent.\r\n */\r\nexport const PriceComponent: React.FunctionComponent = msdyn365Commerce.createComponentOverride(\r\n 'Price',\r\n { component: Price, ...priceComponentActions }\r\n);\r\n\r\nexport default PriceComponent;\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 { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\r\nimport { ISwatchItem, ProductComponentSwatchComponent, RatingComponent, AddToWishlistComponent } from '@msdyn365-commerce/components';\r\nimport { PriceComponent, IPriceComponentResources } from './price.component';\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 {\r\n AttributeSwatch,\r\n AttributeValue,\r\n CommerceList,\r\n ProductDimension,\r\n ProductPrice,\r\n ProductSearchResult\r\n} from '@msdyn365-commerce/retail-proxy';\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 ITelemetryContent,\r\n onTelemetryClick\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport React, { useState } from 'react';\r\nimport { ProductSearchResultExpanded } from '../classes/ProductSearchResultExpanded';\r\nimport { isValidImage } from '../functions/is-valid-image';\r\nimport Show from '../../components/common/Show/show';\r\n\r\nexport interface IProductComponentProps extends IComponentProps<{ product?: ProductSearchResultExpanded }> {\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 wishlist?: CommerceList[];\r\n wishlistInProductCard?: boolean;\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 if (coreContext.request.app.config.filterLegacyImageUrls) {\r\n const imageUrl = swatchProductImageUrls.find(item => {\r\n return isValidImage(item);\r\n });\r\n if (imageUrl) {\r\n return generateImageUrl(imageUrl, coreContext.request.apiSettings);\r\n }\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 wishlist,\r\n wishlistInProductCard\r\n}) => {\r\n const product = data.product;\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 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\r\n return (\r\n \r\n \r\n \r\n

+{product?.additionalSwatches}

\r\n
\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 // 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\r\n return (\r\n <>\r\n {isEnabledProductDescription ? (\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
{product.Name}
\r\n {renderPrice(\r\n context,\r\n typeName,\r\n id,\r\n product.BasePrice,\r\n product.Price,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n isPriceMinMaxEnabled,\r\n priceResources,\r\n product.ProductPrice\r\n )}\r\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)}\r\n {renderDescription(product.Description)}\r\n
\r\n {wishlistInProductCard && (\r\n
\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
{product.Name}
\r\n {renderPrice(\r\n context,\r\n typeName,\r\n id,\r\n product.BasePrice,\r\n product.Price,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n undefined,\r\n priceResources,\r\n product.ProductPrice\r\n )}\r\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)}\r\n
\r\n \r\n {wishlistInProductCard && (\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 basePrice?: number,\r\n adjustedPrice?: number,\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 price: ProductPrice =\r\n productPrice !== undefined\r\n ? productPrice\r\n : {\r\n BasePrice: basePrice,\r\n AdjustedPrice: adjustedPrice,\r\n CustomerContextualPrice: adjustedPrice\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","/**\r\n * Centralised location for checkout generic data updates\r\n */\r\nimport { AffiliationLoyaltyTier } from '@msdyn365-commerce/retail-proxy';\r\n\r\ninterface AffiliationId {\r\n locale: string;\r\n affiliationId: number;\r\n}\r\ninterface LoyaltyTierIds {\r\n locale: string;\r\n loyaltyTierIds: string;\r\n}\r\n\r\n/**\r\n * Generates the affiliationloyaltytiers for the current locale\r\n * @param locale\r\n * @param affiliationId\r\n * @param loyaltyTierIds\r\n * @returns AffiliationLoyaltyTier[]\r\n */\r\nexport const getAffiliation = (\r\n locale: string,\r\n affiliationIds: AffiliationId[],\r\n loyaltyTiersIds: LoyaltyTierIds[]\r\n): AffiliationLoyaltyTier[] => {\r\n var affiliation: AffiliationLoyaltyTier[] = [];\r\n\r\n const affiliationId = affiliationIds?.find(item => {\r\n return item.locale === locale;\r\n })?.affiliationId;\r\n\r\n const loyaltyTiers = loyaltyTiersIds.find(item => {\r\n return item.locale === locale;\r\n })?.loyaltyTierIds;\r\n\r\n const loyaltyTierIds = loyaltyTiers?.split('|') ?? [];\r\n loyaltyTierIds.forEach(tier => {\r\n affiliation.push({\r\n AffiliationId: Number(affiliationId),\r\n LoyaltyTierId: Number(tier)\r\n });\r\n });\r\n\r\n return affiliation;\r\n};\r\n","/**\r\n * Centralised location for checkout generic data updates\r\n */\r\nimport { AttributeValue } from '@msdyn365-commerce/retail-proxy';\r\n\r\n/**\r\n * Gets the CommercialName from a list of attributes - returns the product name if no commercial name attribute is present\r\n * @param attributes\r\n * @param productName\r\n * @param commercialStyleNameAttribute\r\n * @returns\r\n */\r\nexport const getCommercialName = (\r\n attributes: AttributeValue[] = [],\r\n productName: string = '',\r\n commercialStyleNameAttribute: string = 'CommercialStyleName'\r\n): string => {\r\n var styleName = attributes.find(x => x.Name === commercialStyleNameAttribute);\r\n var productBrand = productName?.split(' ')[0] ?? '';\r\n if (styleName?.TextValue) {\r\n return `${productBrand} ${styleName?.TextValue}`;\r\n }\r\n\r\n return productName;\r\n};\r\n"],"names":["PriceForProductSearchResultInput","constructor","products","getCacheKey","JSON","stringify","this","getCacheObjectType","dataCacheType","async","getPriceForProductSearchResultAction","input","context","productRecIds","ArrayExtensions","hasElements","Promise","resolve","map","product","RecordId","filter","item","index","array","indexOf","catalogId","getCatalogId","requestContext","projectDomain","ChannelId","apiSettings","channelId","CatalogId","affiliation","getAffiliation","locale","app","config","affiliationIds","loyaltyTierIds","productPrices","ProductsDataActions","callerContext","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","Date","productResults","activePrice","find","price","ProductId","_activePrice$Customer","_activePrice$BasePric","_activePrice$TradeAgr","_activePrice$Adjusted","Price","CustomerContextualPrice","BasePrice","Math","max","TradeAgreementPrice","AdjustedPrice","ProductPrice","error","Error","telemetry","exception","debug","message","createObservableDataAction","id","action","_ref","children","condition","Otherwise","React","undefined","getOriginalPrice","props","data","getActivePrice","showPriceRangeForMasterProduct","MinVariantPrice","formatCurrency","shouldUseFreePriceText","currencyCode","freePriceText","cultureFormatter","_props$isPriceMinMaxE","_props$product","_props$product2","isPriceMinMaxEnabled","ProductTypeValue","ProductType","Master","KitMaster","MaxVariantPrice","renderCurrentPrice","_props$priceResources2","priceClass","arguments","length","isMemberDiscount","maxVariantPrice","minVariantPrice","_props$priceResources","className","itemProp","priceResources","priceRangeSeparator","showDiscountBox","memberPriceMessage","PriceComponent","msdyn365Commerce","createComponentOverride","_objectSpread","component","_props$data$price$Dis","DiscountLines","forEach","discount","_discount$OfferName","OfferName","toLowerCase","includes","request","loyaltyDiscountIdentifier","isSalesAgreementPriceFeatureEnabled","SalesAgreementPrice","_props$data$price$Sal","_props$priceResources11","_props$priceResources12","isExpanded","setIsExpanded","toggle","classnames","Button","salesAgreementPricePrompt","onClick","tabIndex","_props$data$price$Att","_props$priceResources3","_props$priceResources4","_props$priceResources5","_props$priceResources6","_props$priceResources7","_props$priceResources8","firstPriceLine","AttainablePriceLines","format","salesAgreementExpirationDatePrompt","formatDate","EffectiveDate","ExpirationDate","salesAgreementCommittedQuantityPrompt","CommittedQuantity","salesAgreementRemainingQuantityPrompt","RemainingQuantity","renderSalesAgreementDetail","initialPrice","originalPriceText","currentPriceText","savingsText","renderMemberPrice","originalSalesPrice","activeSalesPrice","showStrikethroughPricing","renderCurrentPriceWithOriginalPrice","_props$data$price","_props$data$price2","_props$priceResources9","_props$priceResources10","saleMessage","abs","toFixed","renderDiscountBox","getDefaultSwatchSelected","coreContext","productData","_productData$Attribut","_attributeSwatches$fi","AttributeValues","dimensionToPreSelectInProductCard","attributeSwatches","attributeValue","_attributeValue$KeyNa","KeyName","toLocaleLowerCase","Swatches","IsDefault","updateProductUrl","productDetailsPageUrl","queryString","sourceUrl","URL","baseUrl","search","href","pathname","renderProductUnitOfMeasure","unitOfMeasure","renderLabel","name","rating","ratingAriaLabelText","reviewCount","ratingCountAriaLabelText","reviewCountArialableText","getReviewAriaLabel","getRatingAriaLabel","ratingAriaLabel","roundedRating","renderPrice","typeName","basePrice","adjustedPrice","productPrice","renderProductPlacementImage","imageSettings","gridSettings","imageUrl","fallbackImageUrl","altText","_context$app$config","contextConfig","placeholderImageName","fallbackImageSource","img","src","fallBackSrc","imageProps","cropFocalRegion","Image","Object","assign","actionContext","loadFailureBehavior","bypassHideOnFailure","ProductComponent","_product$Name","_product$RecordId","_getProductImageUrlFr","_getProductPageUrlFro","ratingCountAriaLabel","allowBack","telemetryContent","quickViewButton","productComparisonButton","isEnabledProductDescription","inventoryLabel","dimensionAvailabilities","swatchItemAriaLabel","wishlist","wishlistInProductCard","productUrl","getProductPageUrlSync","Name","Number","MIN_VALUE","productImageUrlFromSwatch","defaultSwatch","swatchProductImageUrls","ProductImageUrls","PrimaryImageUrl","filterLegacyImageUrls","isValidImage","generateImageUrl","getProductImageUrlFromDefaultSwatch","productPageUrlFromSwatch","SwatchValue","encodeURIComponent","getProductPageUrlFromDefaultSwatch","productPageUrl","setProductPageUrl","useState","productImageUrl","setProductImageUrl","selectedSwatchItems","Dictionary","enableStockCheck","updatePageAndImageUrl","swatchItem","dimensionType","setValue","StringExtensions","isNullOrWhitespace","value","productPageUrlWithSwatch","newUrl","searchParams","delete","toString","swatchProductImageUrl","productImageUrls","newImageUrl","payLoad","getPayloadObject","attribute","getTelemetryAttributes","isUnitOfMeasureEnabled","unitOfMeasureDisplayType","onTelemetryClick","AverageRating","TotalRatings","DefaultUnitOfMeasure","description","Description","AddToWishlistComponent","nameOfWishlist","addToWishlistButtonText","removeFromWishlistButtonText","wishlists","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","key","ProductComponentSwatchComponent","onSelectDimension","Show","additionalSwatches","hideRating","moduleTypeName","moduleId","avgRating","totalRatings","ariaLabel","numberRatings","RatingComponent","ratingCount","readOnly","renderRating","inventoryAvailabilityLabel","quickview","selectedDimensions","getValues","DimensionTypeValue","convertDimensionTypeToProductDimensionType","DimensionValue","Value","selectedProductId","renderQuickView","validateCatalogId","renderProductComparisonButton","loyaltyTiersIds","_affiliationIds$find","_loyaltyTiersIds$find","_loyaltyTiers$split","affiliationId","loyaltyTiers","split","tier","push","AffiliationId","LoyaltyTierId","getCommercialName","_productName$split$","attributes","productName","commercialStyleNameAttribute","styleName","x","productBrand","TextValue"],"sourceRoot":""}