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AI,IAAAuN,OAAA,EAAjBA,EAAmBb,kBAMxH,OALIU,GAAa,EACbF,EAAkBE,GAAaD,EAE/BD,EAAkBM,KAAKL,GAEpBD,GAIEO,EAAiBA,CAACC,EAAuB7M,KAC7B,CAEjB,cAAe,oEACfb,KAAM0N,EACN7N,UAAWgB,EACX8M,sBAAuB,KAIlBC,EAAyBA,CAAC7F,EAAarE,IACnB,CACzB,CACImK,IAAK9F,EACLwC,MAAO,CAAEuD,YAAapK,KAuCrBqK,EAAgCA,CAACrK,EAAgBsK,KAC1D,IAAIC,EAA2C,GAC/C,OAAQD,GACJ,IAAK,KAGDC,EADI,6HACgCvO,MAAM,KAC1C,MACJ,IAAK,KAGDuO,EADI,qIACgCvO,MAAM,KAC1C,MACJ,QACI,MAAMwO,EACF,mHACJD,EAAiCvK,EAAQA,EAAMhE,MAAM,KAAOwO,EAAGxO,MAAM,KAG7E,MAAO,CACHyO,gBAAiBF,EAA+B,GAChDG,iBAAkBH,EAA+B,GACjDI,iBAAkBJ,EAA+B,KAI5CK,EAAwBA,CAAC5D,EAAkCnE,KACpE,IAAImE,MAAAA,OAAU,EAAVA,EAAY6D,QAAS,EAAG,CACxB,MAAMC,EAAoB9D,EAAW9J,MAAK6N,GAC/BA,EAAazO,OAASuG,IAGjC,OAAOiI,MAAAA,OAAiB,EAAjBA,EAAmB3O,UAE1B,OAAO,GAIF6O,EAAuBA,CAACC,EAAcC,IACrBD,GAAM,GAAKA,GAAMC","sources":["webpack://suedwolle/./src/themes/suedwolle/views/components/product.component.tsx?f179","webpack://suedwolle/./src/utilities/helpers.ts?b4a4"],"sourcesContent":["/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\r\nimport {\r\n IComponent,\r\n IComponentProps,\r\n ICoreContext,\r\n IGridSettings,\r\n IImageData,\r\n IImageProps,\r\n IImageSettings,\r\n Image,\r\n IRequestContext,\r\n msdyn365Commerce\r\n} from '@msdyn365-commerce/core';\r\nimport { generateImageUrl } from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n AttributeSwatch,\r\n ProductDimension,\r\n ProductPrice,\r\n ProductSearchResult,\r\n ProductType,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n ArrayExtensions,\r\n checkIfShouldDisplayAsSwatch,\r\n convertDimensionTypeToProductDimensionType,\r\n Dictionary,\r\n DimensionSwatchDisplayTypes,\r\n DimensionTypes,\r\n // generateImageUrl,\r\n getProductPageUrlSync,\r\n IDimensionsApp\r\n // StringExtensions\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\n\r\nimport { IPriceComponentResources, PriceComponent } from '@msdyn365-commerce/components';\r\nimport { ISwatchItem } from '@msdyn365-commerce/components';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\n// import { ProductComponentSwatchComponent } from '@msdyn365-commerce/components';\r\nimport { findProductAttributes, IProductAttributeRecordIds, itemCodeRegex } from '../../../../utilities/helpers';\r\n\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 inventoryLabel?: string;\r\n isPriceMinMaxEnabled?: boolean;\r\n priceResources?: IPriceComponentResources;\r\n dimensionAvailabilities?: IProductsDimensionsAvailabilities[];\r\n}\r\n\r\nexport interface IProductComponent extends IComponent {}\r\n\r\nconst PriceComponentActions = {};\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 inventoryLabel,\r\n isPriceMinMaxEnabled,\r\n priceResources,\r\n dimensionAvailabilities\r\n}) => {\r\n const product = data.product;\r\n const productPrice = data.productPrice; // upgrade to 10.0.40\r\n const {\r\n treatmentAttributeRecordId,\r\n spinningTechAttributeRecordId,\r\n micronAttributeRecordId,\r\n compositionAttributeRecordId,\r\n certificatesAttributeRecordId,\r\n nominalCountAttributeRecordId,\r\n colorTypeAttributeRecordId,\r\n businessModeAttributeRecordId\r\n } = context.app.config;\r\n\r\n // const [treatmentAttributeValue, setTreatmentAttributeValue] = React.useState([]);\r\n // const [spinningTechAttributeValue, setSpinningTechAttributeValue] = React.useState('');\r\n // const [micronAttributeValue, setMicronAttributeValue] = React.useState('');\r\n // const [compositionAttributeValue, setCompositionTechAttributeValue] = React.useState([]);\r\n // const [nominalCountAttributeValue, setNominalCountAttributeValue] = React.useState('');\r\n // const [colorTypeAttributeValue, setColorTypeAttributeValue] = React.useState('');\r\n // const [businessModeAttributeValue, setbusinessModeAttributeValue] = React.useState('');\r\n const [productDescription, setProductDescription] = React.useState('');\r\n // const [certificateAttributeValue, setCertificateAttributeValue] = React.useState('');\r\n React.useEffect(() => {\r\n const attributeRecordIds: IProductAttributeRecordIds = {\r\n treatmentAttributeRecordId,\r\n spinningTechAttributeRecordId,\r\n compositionAttributeRecordId,\r\n micronAttributeRecordId,\r\n certificatesAttributeRecordId,\r\n nominalCountAttributeRecordId,\r\n colorTypeAttributeRecordId,\r\n businessModeAttributeRecordId\r\n };\r\n const {\r\n // treatmentAttribute,\r\n // spinningTechAttribute,\r\n // compositionAttribute,\r\n //micronAttribute,\r\n //nominalCountAttribute,\r\n colorTypeAttribute\r\n //businessModeAttribute\r\n // certificatesAttribute,\r\n } = findProductAttributes(attributeRecordIds, product?.AttributeValues);\r\n\r\n //const compositionValue = compositionAttribute && compositionAttribute.TextValue && compositionAttribute.TextValue.split('|');\r\n // treatmentAttribute && setTreatmentAttributeValue(treatmentAttribute.TextValue?.split('|') || []);\r\n // spinningTechAttribute && setSpinningTechAttributeValue(spinningTechAttribute.TextValue || '');\r\n // micronAttribute && setMicronAttributeValue(micronAttribute.TextValue || '');\r\n // compositionValue && setCompositionTechAttributeValue(compositionValue);\r\n // nominalCountAttribute && setNominalCountAttributeValue(nominalCountAttribute.TextValue || '');\r\n // colorTypeAttribute && setColorTypeAttributeValue(colorTypeAttribute.TextValue || '');\r\n // businessModeAttribute && setbusinessModeAttributeValue(businessModeAttribute.TextValue || '');\r\n // certificatesAttribute && setCertificateAttributeValue(certificatesAttribute.TextValue || '');\r\n\r\n const descriptionSplit = product?.Description?.split(',');\r\n if (descriptionSplit) {\r\n const productName = descriptionSplit[0];\r\n const nominalCount = descriptionSplit[1];\r\n setProductDescription(`${productName}, ${nominalCount}, ${colorTypeAttribute?.TextValue || ''}`);\r\n }\r\n }, [product]);\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\n function 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 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\n function getDefaultColorSwatchSelected(productData?: ProductSearchResult): AttributeSwatch | null {\r\n if (!productData || !productData.AttributeValues) {\r\n return null;\r\n }\r\n\r\n const colorAttribute = productData.AttributeValues.find(\r\n attributeValue => attributeValue.KeyName?.toLocaleLowerCase() === DimensionTypes.color\r\n );\r\n if (!ArrayExtensions.hasElements(colorAttribute?.Swatches)) {\r\n return null;\r\n }\r\n\r\n const defaultSwatch = colorAttribute!.Swatches.find(item => item.IsDefault === true) ?? colorAttribute!.Swatches[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\n // function getProductImageUrlFromDefaultColorSwatch(coreContext: ICoreContext, productData?: ProductSearchResult): string | undefined {\r\n // const siteContext = coreContext as ICoreContext;\r\n // const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n // if (dimensionToPreSelectInProductCard === DimensionTypes.none) {\r\n // return productData?.PrimaryImageUrl;\r\n // }\r\n // const defaultSwatch = getDefaultColorSwatchSelected(productData);\r\n // return defaultSwatch && ArrayExtensions.hasElements(defaultSwatch.ProductImageUrls)\r\n // ? generateImageUrl(defaultSwatch.ProductImageUrls[0], coreContext.request.apiSettings)\r\n // : productData?.PrimaryImageUrl;\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\n function getProductPageUrlFromDefaultSwatch(\r\n coreContext: ICoreContext,\r\n productUrl: string,\r\n productData?: ProductSearchResult\r\n ): string | undefined {\r\n const siteContext = coreContext as ICoreContext;\r\n const dimensionToPreSelectInProductCard = siteContext.app.config.dimensionToPreSelectInProductCard;\r\n if (dimensionToPreSelectInProductCard === DimensionTypes.none) {\r\n return productUrl;\r\n }\r\n const defaultSwatch = getDefaultColorSwatchSelected(productData);\r\n if (!defaultSwatch || !defaultSwatch.SwatchValue) {\r\n return productUrl;\r\n }\r\n\r\n const queryString = `color=${defaultSwatch.SwatchValue}`;\r\n return updateProductUrl(productUrl, coreContext, queryString);\r\n }\r\n\r\n let productUrl = product ? getProductPageUrlSync(product.Name ?? '', product.RecordId, context.actionContext, undefined) : '';\r\n if (allowBack && productUrl) {\r\n productUrl = updateProductUrl(productUrl, context, 'back=true');\r\n }\r\n // const productImageUrlFromSwatch = getProductImageUrlFromDefaultColorSwatch(context, product) ?? product?.PrimaryImageUrl;\r\n const productPageUrlFromSwatch = getProductPageUrlFromDefaultSwatch(context, productUrl, product) ?? productUrl;\r\n\r\n const [productPageUrl, setProductPageUrl] = useState(productPageUrlFromSwatch);\r\n // const [productImageUrl] = useState(product?.PrimaryImageUrl);\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 React.useEffect(() => {\r\n setProductPageUrl(productPageUrlFromSwatch);\r\n }, [productPageUrlFromSwatch]);\r\n const productItemCode = product?.ItemId && product?.ItemId.replace(itemCodeRegex, '-');\r\n const productImage =\r\n product?.ItemId && generateImageUrl(`Products/${productItemCode}_000_001.png`, context.actionContext.requestContext.apiSettings);\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 === DimensionTypes.color) {\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 const swatchItems = ArrayExtensions.validValues(\r\n product.AttributeValues?.map(item => {\r\n const dimensionTypeValue = item.KeyName?.toLocaleLowerCase() ?? '';\r\n const shouldDisplayAsSwatch = checkIfShouldDisplayAsSwatch(\r\n dimensionTypeValue as DimensionTypes,\r\n context as ICoreContext,\r\n DimensionSwatchDisplayTypes.productCard\r\n );\r\n if (!shouldDisplayAsSwatch) {\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 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 dimensionToPreSelectInProductCard !== DimensionTypes.none &&\r\n ArrayExtensions.hasElements(swatches) &&\r\n !swatches.some(swatch => swatch.isDefault) &&\r\n dimensionType === DimensionTypes.color\r\n ) {\r\n swatches[0].isDefault = true;\r\n }\r\n return { recordId: item.RecordId, swatches };\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\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\n function 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\n function 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 * Gets the react node for product dimension as swatch.\r\n * @returns The node representing markup for unit of measure component.\r\n */\r\n function renderProductDimensions(): JSX.Element | null {\r\n if (!ArrayExtensions.hasElements(swatchItems)) {\r\n return null;\r\n }\r\n\r\n return (\r\n
\r\n {/* {swatchItems.map(item => {\r\n return (\r\n \r\n );\r\n })} */}\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Gets the react node for product description.\r\n * @param quickview - Quick view node.\r\n * @param item - Product id to de displayed in quickview.\r\n * @returns The product quickview component.\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 /**\r\n * Gets the aria label for rating.\r\n * @param rating - Product rating.\r\n * @param ratingAriaLabelText - Aria label format for rating.\r\n * @returns The product rating aria label string.\r\n */\r\n function getRatingAriaLabel(rating?: number, ratingAriaLabelText?: string): string {\r\n if (rating && ratingAriaLabelText) {\r\n const roundedRating = rating.toFixed(2);\r\n return format(ratingAriaLabelText || '', roundedRating, '5');\r\n }\r\n return '';\r\n }\r\n\r\n /**\r\n * Gets the aria label for review count.\r\n * @param reviewCount - Product review count.\r\n * @param ratingCountAriaLabelText - Aria label format for review.\r\n * @returns The product review count aria label string.\r\n */\r\n function 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\n /**\r\n * Gets the aria label string for product that includes product name with its price and rating.\r\n * @param name - Product name.\r\n * @param price - Product price.\r\n * @param rating - Product rating.\r\n * @param ratingAriaLabelText - Rating aria label text.\r\n * @param reviewCount - Product review count.\r\n * @param ratingCountAriaLabelText - Number of ratings.\r\n * @returns The aria label string for the product card.\r\n */\r\n function 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\n /**\r\n * Gets the react component for product rating.\r\n * @param productCardimageSettings - Module image settings for product card.\r\n * @param gridSettings - Grid settings defined in theme.\r\n * @param imageUrl - Image url.\r\n * @param fallbackImageUrl - Fallback url for imge.\r\n * @param altText - Image Alt text.\r\n * @param requestContext - Request context using the component.\r\n * @returns React component for product image.\r\n */\r\n function renderProductPlacementImage(\r\n productCardimageSettings?: IImageSettings,\r\n gridSettings?: IGridSettings,\r\n imageUrl?: string,\r\n fallbackImageUrl?: string,\r\n altText?: string,\r\n requestContext?: IRequestContext\r\n ): JSX.Element | null {\r\n if (!imageUrl || !gridSettings || !productCardimageSettings) {\r\n return null;\r\n }\r\n const image: IImageData = {\r\n src: imageUrl,\r\n altText: altText ? altText : '',\r\n fallBackSrc: fallbackImageUrl\r\n };\r\n const imageProps: IImageProps = { gridSettings };\r\n imageProps.gridSettings = gridSettings;\r\n imageProps.imageSettings = productCardimageSettings;\r\n imageProps.imageSettings.cropFocalRegion = true;\r\n return ;\r\n }\r\n\r\n /**\r\n * Gets the react component for product rating.\r\n * @param coreContext - Context of the module using the component.\r\n * @param moduleTypeName - Module type name.\r\n * @param moduleId - Module id using the component.\r\n // * @param basePrice - Product base price.\r\n // * @param adjustedPrice - Product adjusted price.\r\n // * @param maxVariantPrice - Product variant max price.\r\n // * @param minVariantPrice - Product variant min price.\r\n * @param productSearchResult - Product search result.\r\n * @param savingsPriceResourceText - Product price saving text.\r\n * @param freePriceResourceText - Product price free text.\r\n * @param originalPriceResourceText - Product price original text.\r\n * @param currentPriceResourceText - Product price current text.\r\n * @param productPrice - Product Price.\r\n * @returns React component for Product price.\r\n */\r\n function renderPrice(\r\n coreContext: ICoreContext,\r\n moduleTypeName: string,\r\n moduleId: string,\r\n // basePrice?: number,\r\n // adjustedPrice?: number,\r\n // maxVariantPrice?: number,\r\n // minVariantPrice?: number,\r\n productSearchResult: ProductSearchResult,\r\n savingsPriceResourceText?: string,\r\n freePriceResourceText?: string,\r\n originalPriceResourceText?: string,\r\n currentPriceResourceText?: string,\r\n productPrice?: ProductPrice\r\n ): JSX.Element {\r\n //upgrade to 10.0.40\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 =\r\n productPrice ??\r\n ({\r\n BasePrice: productSearchResult.BasePrice,\r\n AdjustedPrice: productSearchResult.Price,\r\n CustomerContextualPrice: productSearchResult.Price,\r\n // TODO from [gaweiche]: We should not put productSearchResult.Price into min/max price.\r\n // To minimize the change in a backport PR, I'll keep it as is for now.\r\n MaxVariantPrice: productSearchResult.MaxVariantPrice ? productSearchResult.MaxVariantPrice : productSearchResult.Price,\r\n MinVariantPrice: productSearchResult.MinVariantPrice ? productSearchResult.MinVariantPrice : productSearchResult.Price\r\n } as ProductPrice);\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n /**\r\n * Gets the react node for product description.\r\n * @param description - Product description.\r\n * @returns The product description component.\r\n */\r\n function renderDescription(description?: string): JSX.Element | null {\r\n return

{description}

;\r\n }\r\n\r\n /**\r\n * Gets the react component for product rating.\r\n * @param coreContext - Context of the module using the component.\r\n * @param moduleTypeName - Module type name.\r\n * @param moduleId - Module id using the component.\r\n * @param avgRating - Average rating.\r\n * @param totalRatings - Total rating.\r\n * @param ariaLabel - Aria label for rating.\r\n * @returns React component for Product rating.\r\n */\r\n function 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 ): 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 const attributeRecordIds: IProductAttributeRecordIds = {\r\n treatmentAttributeRecordId,\r\n spinningTechAttributeRecordId,\r\n compositionAttributeRecordId,\r\n micronAttributeRecordId,\r\n certificatesAttributeRecordId,\r\n nominalCountAttributeRecordId,\r\n colorTypeAttributeRecordId,\r\n businessModeAttributeRecordId\r\n };\r\n const {\r\n treatmentAttribute,\r\n // spinningTechAttribute,\r\n compositionAttribute,\r\n micronAttribute,\r\n nominalCountAttribute,\r\n colorTypeAttribute,\r\n businessModeAttribute\r\n // certificatesAttribute,\r\n } = findProductAttributes(attributeRecordIds, product?.AttributeValues);\r\n const getCompositionValue = (compositionAttribute && compositionAttribute.TextValue && compositionAttribute.TextValue.split('|')) || [];\r\n const getNominalCountAttribute = nominalCountAttribute?.TextValue?.split('|');\r\n const getTreatmentAttribute = treatmentAttribute?.TextValue?.split('|');\r\n const getMicronAttribute = micronAttribute?.TextValue ?? '';\r\n const getColorTypeAttribute = colorTypeAttribute?.TextValue ?? '';\r\n const getBusinessModeAttribute = businessModeAttribute?.TextValue ?? '';\r\n // certificatesAttribute && setCertificateAttributeValue(certificatesAttribute.TextValue || '');\r\n\r\n return (\r\n <>\r\n \r\n
\r\n {renderProductPlacementImage(\r\n imageSettings,\r\n context.request.gridSettings,\r\n productImage,\r\n product.PrimaryImageUrl,\r\n product.Name,\r\n context.actionContext.requestContext\r\n )}\r\n
\r\n

{product.Description}

\r\n \r\n \r\n {productDescription}\r\n \r\n \r\n {getNominalCountAttribute}\r\n \r\n \r\n {getCompositionValue?.map((item, i) => {\r\n return (\r\n
\r\n {item}{' '}\r\n {i === 0 && getMicronAttribute !== '' && (\r\n ‐{getMicronAttribute}µ\r\n )}\r\n
\r\n );\r\n })}\r\n \r\n {/* \r\n {spinningTechAttributeValue}\r\n */}\r\n \r\n {getTreatmentAttribute?.map((item, i) => {\r\n return (\r\n
\r\n {item}\r\n
\r\n );\r\n })}\r\n \r\n \r\n {getColorTypeAttribute}\r\n \r\n \r\n {getBusinessModeAttribute}\r\n \r\n\r\n {/* \r\n {certificateAttributeValue}\r\n */}\r\n\r\n
\r\n {renderPrice(context, typeName, id, product, savingsText, freePriceText, originalPriceText, currentPriceText, productPrice)}\r\n {isUnitOfMeasureEnabled && renderProductUnitOfMeasure(product.DefaultUnitOfMeasure)}\r\n {renderDescription(product.Description)}\r\n {!context.app.config.hideRating &&\r\n renderRating(context, typeName, id, product.AverageRating, product.TotalRatings, ratingAriaLabel)}\r\n {renderProductAvailability(inventoryLabel)}\r\n
\r\n {quickViewButton && renderQuickView(quickViewButton, product.RecordId)}\r\n {renderProductDimensions()}\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","/* eslint-disable security/detect-object-injection */\r\nimport { AttributeValue, AttributeValueBase } from '@msdyn365-commerce/retail-proxy';\r\n\r\nexport interface IBtachAttribute {\r\n InventBatchId: string | undefined;\r\n ConsumedQuantity: string | undefined;\r\n}\r\nexport interface IBatchCache {\r\n originalQuantity: number;\r\n productID: number | undefined;\r\n batchAttribute: IBtachAttribute[] | null | undefined;\r\n}\r\nexport interface IProductAttributeRecordIds {\r\n segmentAttributeRecordId?: number;\r\n collectionAttributeRecordId?: number;\r\n colourCardAttributeRecordId?: number;\r\n treatmentAttributeRecordId?: number;\r\n spinningTechAttributeRecordId?: number;\r\n countAttributeRecordId?: number;\r\n twistAttributeRecordId?: number;\r\n turnAttributeRecordId?: number;\r\n guageAttributeRecordId?: number;\r\n compositionAttributeRecordId?: number;\r\n micronAttributeRecordId?: number;\r\n stockSupportedAttributeRecordId?: number;\r\n availabilityAttributeRecordId?: number;\r\n certificatesAttributeRecordId?: number;\r\n careLabelAttributeRecordId?: number;\r\n waxedAttributeRecordId?: number;\r\n nominalCountAttributeRecordId?: number;\r\n colorTypeAttributeRecordId?: number;\r\n businessModeAttributeRecordId?: number;\r\n bobbinAttributeRecordId?: number;\r\n}\r\nexport const findProductAttributes = (attributeRecordIds: IProductAttributeRecordIds, attributes?: AttributeValue[]) => {\r\n const segmentAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.segmentAttributeRecordId);\r\n const collectionAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.collectionAttributeRecordId);\r\n const colourCardAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.colourCardAttributeRecordId);\r\n const treatmentAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.treatmentAttributeRecordId);\r\n const spinningTechAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.spinningTechAttributeRecordId);\r\n const countAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.countAttributeRecordId);\r\n const twistAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.twistAttributeRecordId);\r\n const turnAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.turnAttributeRecordId);\r\n const guageAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.guageAttributeRecordId);\r\n const compositionAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.compositionAttributeRecordId);\r\n const micronAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.micronAttributeRecordId);\r\n const stockSupportedAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.stockSupportedAttributeRecordId);\r\n const availabilityAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.availabilityAttributeRecordId);\r\n const waxedAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.waxedAttributeRecordId);\r\n const certificatesAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.certificatesAttributeRecordId);\r\n const careLabelAttribute = attributes?.find((attr: AttributeValue) => attr.RecordId === attributeRecordIds.careLabelAttributeRecordId);\r\n const colorTypeAttribute = attributes?.find((attr: AttributeValue) => attr.RecordId === attributeRecordIds.colorTypeAttributeRecordId);\r\n const businessModeAttribute = attributes?.find(\r\n (attr: AttributeValue) => attr.RecordId === attributeRecordIds.businessModeAttributeRecordId\r\n );\r\n const nominalCountAttribute = attributes?.find(\r\n (attr: AttributeValue) => attr.RecordId === attributeRecordIds.nominalCountAttributeRecordId\r\n );\r\n const bobbianAttribute = attributes?.find(attr => attr.RecordId === attributeRecordIds.bobbinAttributeRecordId);\r\n\r\n \r\n return {\r\n segmentAttribute,\r\n collectionAttribute,\r\n colourCardAttribute,\r\n treatmentAttribute,\r\n spinningTechAttribute,\r\n countAttribute,\r\n twistAttribute,\r\n turnAttribute,\r\n guageAttribute,\r\n compositionAttribute,\r\n micronAttribute,\r\n stockSupportedAttribute,\r\n availabilityAttribute,\r\n certificatesAttribute,\r\n careLabelAttribute,\r\n waxedAttribute,\r\n nominalCountAttribute,\r\n colorTypeAttribute,\r\n businessModeAttribute,\r\n bobbianAttribute\r\n };\r\n};\r\n\r\n// List of customer fields to hide from my profile page\r\nexport const additionalCustomerFields = [\r\n 'ID',\r\n 'ExtensionProperties',\r\n 'PartyRecId',\r\n 'AddressRecId',\r\n 'DeliveryPhoneRecId',\r\n 'PrimaryContactFaxRecId',\r\n 'OrgPrimaryFaxRecId',\r\n 'OrgPrimaryPhoneRecId',\r\n 'OrgPrimaryURLRecId',\r\n 'PrimaryContactPhoneRecId',\r\n 'Salutation',\r\n 'FirstName',\r\n 'Status',\r\n 'DeliveryName',\r\n 'DeliveryStreet',\r\n 'DeliveryCountry',\r\n 'DeliveryZip',\r\n 'DeliveryCity',\r\n 'DilveryContactNumber'\r\n];\r\n\r\n//function to convertFirstLetterToLowerCase of a string.\r\nexport function convertFirstLetterToLowerCase(text: string) {\r\n return text.charAt(0).toLowerCase() + text.slice(1);\r\n}\r\n\r\n// Regex to remove all special characters from Product Item Code (e.g. VICTORIA,NM 30/2,S,W)\r\nexport const itemCodeRegex = /[^\\w\\s]/gi;\r\n\r\n// Function to calculate % value of a number (e.g 20% of 10 = 2)\r\nexport const percentageValue = (total: number, percentage: number) => Math.ceil((total / 100) * percentage);\r\n\r\n// Function to check if attribute exists then update value else add new attribute\r\nexport const addAttribute = (currentAttributes: AttributeValue[], attributeObj: AttributeValue): AttributeValue[] => {\r\n const attrIndex = currentAttributes.findIndex((attr: AttributeValue) => attr.Name?.toLowerCase() === attributeObj.Name?.toLowerCase());\r\n if (attrIndex > -1) {\r\n currentAttributes[attrIndex] = attributeObj;\r\n } else {\r\n currentAttributes.push(attributeObj);\r\n }\r\n return currentAttributes;\r\n};\r\n\r\n// Function to create attribute object\r\nexport const _makeAttribute = (AttributeName: string, attributeValue: string | undefined) => {\r\n const attributeObj = {\r\n // @ts-ignore\r\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.AttributeTextValue',\r\n Name: AttributeName,\r\n TextValue: attributeValue,\r\n TextValueTranslations: []\r\n };\r\n return attributeObj;\r\n};\r\nexport const _makeExtentionProperty = (key: string, value: string) => {\r\n const extentionPropertyObj = [\r\n {\r\n Key: key,\r\n Value: { StringValue: value }\r\n }\r\n ];\r\n return extentionPropertyObj;\r\n};\r\n\r\nexport const getBatchRecordUtility = (): IBatchCache[] | undefined => {\r\n const result = localStorage.getItem('sw_BatchRecord');\r\n return JSON.parse(result!);\r\n};\r\n\r\nexport const setBatchRecordUtility = (obj: IBatchCache) => {\r\n const oldBatchRecord = getBatchRecordUtility();\r\n if (oldBatchRecord) {\r\n // console.log('oldBatchRecord',oldBatchRecord);\r\n const newBatchRecord =\r\n oldBatchRecord &&\r\n oldBatchRecord?.map(item => {\r\n if (item.productID === obj.productID) {\r\n return {\r\n ...item,\r\n originalQuantity: item.originalQuantity + obj.originalQuantity,\r\n batchAttribute: obj.batchAttribute\r\n };\r\n } else {\r\n return item;\r\n }\r\n });\r\n // console.log('after 2nd update BatchRecord',newBatchRecord);\r\n return localStorage.setItem('sw_BatchRecord', JSON.stringify(newBatchRecord));\r\n } else {\r\n // console.log('first update BatchRecord',JSON.stringify([obj]));\r\n return localStorage.setItem('sw_BatchRecord', JSON.stringify([obj]));\r\n }\r\n};\r\nexport const removeBatchRecordUtility = () => {\r\n return localStorage.removeItem('sw_BatchRecord');\r\n};\r\n\r\nexport const splitQuantityThresholdMessage = (value?: string, locale?: string) => {\r\n let quantityThresholdMessagesArray: string[] = [];\r\n switch (locale) {\r\n case 'it':\r\n const it =\r\n 'Hai ordinato _ kg e noi aggiungeremo _ ulteriori kg a scopo di pagamento. Non ti verrà addebitato in fase di fatturazione.';\r\n quantityThresholdMessagesArray = it.split('_');\r\n break;\r\n case 'de':\r\n const de =\r\n 'Du hast _ kg bestellt und wir fügen _ zusätzliches kg zu Zahlungszwecken hinzu. Diese wird bei Rechnungsstellung nicht verrechnet.';\r\n quantityThresholdMessagesArray = de.split('_');\r\n break;\r\n default:\r\n const en =\r\n 'You ordered _ kg and we’ll add _ additional kg for payment purposes. It will not be charged to you at invoicing.';\r\n quantityThresholdMessagesArray = value ? value.split('_') : en.split('_');\r\n break;\r\n }\r\n return {\r\n thresholdPrefix: quantityThresholdMessagesArray[0],\r\n thresholdContent: quantityThresholdMessagesArray[1],\r\n thresholdPostfix: quantityThresholdMessagesArray[2]\r\n };\r\n};\r\n\r\nexport const getAttributeTextValue = (attributes: AttributeValueBase[], name: string) => {\r\n if (attributes?.length > 0) {\r\n const quantityThreshold = attributes.find(cartLineData => {\r\n return cartLineData.Name === name;\r\n });\r\n // @ts-ignore\r\n return quantityThreshold?.TextValue!;\r\n } else {\r\n return 0;\r\n }\r\n};\r\n\r\nexport const getQuantityThreshold = (qty : number, upperWeightThresholdKG : number) => {\r\n const quantityThreshold = qty >=0 && qty <=upperWeightThresholdKG ? true : false;\r\n return quantityThreshold;\r\n}\r\n"],"names":["ProductComponent","msdyn365Commerce","createComponentOverride","_objectSpread","component","_ref","_product$Name","_getProductPageUrlFro","_product$AttributeVal","_nominalCountAttribut","_treatmentAttribute$T","_micronAttribute$Text","_colorTypeAttribute$T","_businessModeAttribut","data","context","imageSettings","savingsText","freePriceText","originalPriceText","currentPriceText","ratingAriaLabel","ratingCountAriaLabel","allowBack","typeName","id","telemetryContent","quickViewButton","inventoryLabel","isPriceMinMaxEnabled","priceResources","dimensionAvailabilities","product","productPrice","treatmentAttributeRecordId","spinningTechAttributeRecordId","micronAttributeRecordId","compositionAttributeRecordId","certificatesAttributeRecordId","nominalCountAttributeRecordId","colorTypeAttributeRecordId","businessModeAttributeRecordId","app","config","productDescription","setProductDescription","React","updateProductUrl","productDetailsPageUrl","coreContext","queryString","sourceUrl","URL","request","apiSettings","baseUrl","search","href","pathname","_product$Description","attributeRecordIds","colorTypeAttribute","findProductAttributes","AttributeValues","descriptionSplit","Description","split","productName","nominalCount","TextValue","productUrl","getProductPageUrlSync","Name","RecordId","actionContext","undefined","productPageUrlFromSwatch","productData","dimensionToPreSelectInProductCard","DimensionTypes","none","defaultSwatch","_colorAttribute$Swatc","colorAttribute","find","attributeValue","_attributeValue$KeyNa","KeyName","toLocaleLowerCase","color","ArrayExtensions","hasElements","Swatches","item","IsDefault","getDefaultColorSwatchSelected","SwatchValue","getProductPageUrlFromDefaultSwatch","productPageUrl","setProductPageUrl","useState","selectedSwatchItems","Dictionary","enableStockCheck","productItemCode","ItemId","replace","itemCodeRegex","productImage","generateImageUrl","requestContext","swatchItems","validValues","map","_item$KeyName$toLocal","_item$KeyName","_item$Swatches$map","_item$Swatches","dimensionTypeValue","checkIfShouldDisplayAsSwatch","DimensionSwatchDisplayTypes","productCard","dimensionType","swatches","swatchItem","_item$RecordId","_swatchItem$SwatchVal","_swatchItem$SwatchVal2","_dimensionAvailabilit","itemId","value","colorHexCode","SwatchColorHexCode","imageUrl","SwatchImageUrl","productImageUrls","ProductImageUrls","isDefault","isDisabled","dimensionAvailability","_swatchItem$SwatchVal3","some","swatch","recordId","payLoad","getPayloadObject","toString","attribute","getTelemetryAttributes","isUnitOfMeasureEnabled","unitOfMeasureDisplayType","getRatingAriaLabel","rating","ratingAriaLabelText","roundedRating","toFixed","format","getReviewAriaLabel","reviewCount","ratingCountAriaLabelText","treatmentAttribute","compositionAttribute","micronAttribute","nominalCountAttribute","businessModeAttribute","getCompositionValue","getNominalCountAttribute","getTreatmentAttribute","getMicronAttribute","getColorTypeAttribute","getBusinessModeAttribute","Object","assign","onClick","onTelemetryClick","name","price","reviewCountArialableText","renderLabel","cultureFormatter","formatCurrency","Price","AverageRating","TotalRatings","className","productCardimageSettings","gridSettings","fallbackImageUrl","altText","image","src","fallBackSrc","imageProps","cropFocalRegion","Image","loadFailureBehavior","renderProductPlacementImage","PrimaryImageUrl","i","key","moduleTypeName","moduleId","productSearchResult","savingsPriceResourceText","freePriceResourceText","originalPriceResourceText","currentPriceResourceText","ProductTypeValue","IsMasterProduct","ProductType","Master","Standalone","BasePrice","AdjustedPrice","CustomerContextualPrice","MaxVariantPrice","MinVariantPrice","PriceComponent","renderPrice","unitOfMeasure","DefaultUnitOfMeasure","description","hideRating","avgRating","totalRatings","ariaLabel","numberRatings","Number","RatingComponent","ratingCount","readOnly","renderRating","inventoryAvailabilityLabel","quickview","selectedDimensions","getValues","DimensionTypeValue","convertDimensionTypeToProductDimensionType","DimensionValue","Value","selectedProductId","renderQuickView","attributes","segmentAttribute","attr","segmentAttributeRecordId","collectionAttribute","collectionAttributeRecordId","colourCardAttribute","colourCardAttributeRecordId","spinningTechAttribute","countAttribute","countAttributeRecordId","twistAttribute","twistAttributeRecordId","turnAttribute","turnAttributeRecordId","guageAttribute","guageAttributeRecordId","stockSupportedAttribute","stockSupportedAttributeRecordId","availabilityAttribute","availabilityAttributeRecordId","waxedAttribute","waxedAttributeRecordId","certificatesAttribute","careLabelAttribute","careLabelAttributeRecordId","bobbianAttribute","bobbinAttributeRecordId","additionalCustomerFields","convertFirstLetterToLowerCase","text","charAt","toLowerCase","slice","percentageValue","total","percentage","Math","ceil","addAttribute","currentAttributes","attributeObj","attrIndex","findIndex","_attr$Name","_attributeObj$Name","push","_makeAttribute","AttributeName","TextValueTranslations","_makeExtentionProperty","Key","StringValue","splitQuantityThresholdMessage","locale","quantityThresholdMessagesArray","en","thresholdPrefix","thresholdContent","thresholdPostfix","getAttributeTextValue","length","quantityThreshold","cartLineData","getQuantityThreshold","qty","upperWeightThresholdKG"],"sourceRoot":""}