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C,QACtChE,IAEd,OAAOlC,KAAKJ,MAAM8I,WAAWd,IAsKrC,+EC5SA,MAwBMe,EAAkB,CAACC,EAA+BC,IAC7CnJ,EAAAA,cAACoJ,EAAAA,KAAI,iBAAKF,GAAoBC,GAASA,EAAMtB,IAAIwB,IAGtDC,EAAc,CAACC,EAA2BJ,IACrCnJ,EAAAA,cAACoJ,EAAAA,KAAI,iBAAKG,GAAgBJ,GAASA,EAAMtB,IAAIwB,IAGlDA,EAAkBzG,IACpB,MAAM,iBAAEkC,EAAgB,iBAAEK,GAAqBvC,EAE/C,OAAO5C,EAAAA,cAACoJ,EAAAA,KAAI,iBAAKtE,GAAmBK,IAGxC,EAtCqEjF,IACjE,MAAM,QACFM,EAAO,2BACPkI,EAA0B,SAC1BnH,EAAQ,kCACR4G,EAAiC,mBACjCU,EAAkB,WAClBtB,EAAU,aACVwB,GACA7I,EAEJ,OAAIqB,EAEIvB,EAAAA,cAACwJ,EAAAA,OAAM,iBAAKd,GACPlI,EACAuI,EACAxB,EAAa0B,EAAgBd,EAAmC5G,GAAY+H,EAAYT,EAAoBtH,KAIzHrB,EAAMY,QAAQiC,UAAU0G,MAAM,4DACvB,cC/BXC,EAAOC,QAAU3J,cCAjB0J,EAAOC,QAAUC","sources":["webpack://msdyn365.commerce.online/./lib/product-collection/module-registration.js?36d3","webpack://msdyn365.commerce.online/./src/modules/product-collection/product-collection.tsx?4008","webpack://msdyn365.commerce.online/./src/modules/product-collection/product-collection.view.tsx?5d36","webpack://msdyn365.commerce.online/external var \"React\"?0d3b","webpack://msdyn365.commerce.online/external var \"ReactDOM\"?853b"],"sourcesContent":["const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['product-collection'] = {\n c: () => require('@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection/product-collection'),\n $type: 'containerModule',\n da: [{name:'featureState', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state', runOn: 0}],\n \n iNM: true,\n ns: '@msdyn365-commerce-modules',\n n: 'product-collection',\n p: 'product-collection',\n \n pdp: '',\n \n \n md: 'node_modules/@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['@msdyn365-commerce-modules|product-collection|modules|product-collection|product-collection'] = {\n c: () => require('@msdyn365-commerce-modules/product-collection/dist/lib/modules/product-collection/product-collection.view.js'),\n cn: '@msdyn365-commerce-modules-product-collection-product-collection'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IProductsDimensionsAvailabilities } from '@msdyn365-commerce/commerce-entities';\nimport { IPriceComponentResources, ProductComponent } from '@msdyn365-commerce/components';\nimport * as Msdyn365 from '@msdyn365-commerce/core';\nimport { getCatalogId, ICoreContext } from '@msdyn365-commerce/core';\nimport { ProductPrice, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\nimport {\n ArrayExtensions,\n DimensionAvailabilitiesForProductSearchResultInput,\n DimensionTypes,\n DimensionSwatchDisplayTypes,\n getDimensionAvailabilitiesForProductSearchResultAction,\n getPriceForProductSearchResult,\n IDimensionsApp,\n ObjectExtensions,\n PriceForProductSearchResultInput\n} from '@msdyn365-commerce-modules/retail-actions';\nimport {\n Button,\n getTelemetryObject,\n IComponentNodeProps,\n IModuleProps,\n INodeProps,\n ISingleSlideCarouselProps,\n ITelemetryContent,\n NodeTag,\n SingleSlideCarousel\n} from '@msdyn365-commerce-modules/utilities';\nimport classnames from 'classnames';\nimport * as React from 'react';\n\nimport { IProductCollectionData } from './product-collection.data';\nimport { IProductCollectionProps, layout } from './product-collection.props.autogenerated';\n\nexport interface IProductCollectionViewProps extends IProductCollectionProps {\n heading?: React.ReactNode;\n ProductCollectionContainer: IModuleProps;\n SingleSlideCarouselComponentProps: INodeProps;\n GridComponentProps: INodeProps;\n products: IProductComponentViewProps[];\n isCarousel: boolean;\n productPrices?: ProductPrice[];\n seeAllButton?: React.ReactNode;\n}\n\nexport interface IProductComponentViewProps {\n ProductContainer: INodeProps;\n productComponent: React.ReactNode;\n}\nexport interface IProductComponentState {\n products: ProductSearchResult[];\n productsDimensionAvailabilities?: IProductsDimensionsAvailabilities[][];\n}\n\n/**\n * ProductCollection component.\n */\nclass ProductCollection extends React.PureComponent, IProductComponentState> {\n private readonly telemetryContent: ITelemetryContent;\n\n private readonly productPrices: ProductPrice[];\n\n constructor(props: IProductCollectionProps) {\n super(props);\n this.productPrices = [];\n this.state = {\n products: this.props.config.productCollection.products || []\n };\n this.telemetryContent = getTelemetryObject(\n this.props.context.request.telemetryPageName!,\n this.props.friendlyName,\n this.props.telemetry\n );\n }\n\n public async componentDidMount(): Promise {\n if (this.props.config.enableAffiliationBasedPricing && this.props.context.actionContext.requestContext.user.isAuthenticated) {\n await this._getActivePrice();\n }\n }\n\n public render(): JSX.Element | null {\n const { heading, className, shouldDisplaySeeAllButton } = this.props.config;\n const { resources } = this.props;\n const recommendation = this.props.config.productCollection.recommendationListId;\n\n // Initialize state in case if the products were not found during initial module render\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- Initialize data if not there.\n this.initProductState(this.props.config.productCollection);\n\n const products = this.state.products;\n const isCarousel = this.props.config.layout === layout.carousel;\n const headingLabel = heading ? heading.text : '';\n const headingComponent = heading && (\n \n );\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- product check for safety.\n const updatedProducts = products?.map((item: ProductSearchResult, index: number) => {\n const getProductData = this._getProduct(item, index);\n return !ObjectExtensions.isNullOrUndefined(getProductData) ? getProductData : undefined;\n });\n\n const productCollectionViewProps = {\n ...this.props,\n heading: headingComponent,\n SingleSlideCarouselComponentProps: {\n tag: SingleSlideCarousel,\n className: '',\n flipperPrevLabel: `${headingLabel} ${resources.flipperPrevious}`,\n flipperNextLabel: `${headingLabel} ${resources.flipperNext}`,\n parentId: this.props.id,\n telemetryContent: this.telemetryContent\n } as IComponentNodeProps,\n ProductCollectionContainer: {\n moduleProps: this.props,\n className: classnames('ms-product-collection', className)\n },\n GridComponentProps: {\n tag: 'ul' as NodeTag,\n className: 'ms-product-collection__items'\n },\n isCarousel,\n\n products:\n ArrayExtensions.hasElements(updatedProducts) &&\n updatedProducts.filter(item => {\n return item !== undefined;\n }),\n productPrices: this.productPrices,\n seeAllButton:\n recommendation && shouldDisplaySeeAllButton && ArrayExtensions.hasElements(updatedProducts)\n ? this._getSeeAllButton(recommendation, headingLabel)\n : undefined\n };\n return this.props.renderView(productCollectionViewProps) as React.ReactElement;\n }\n\n public handleHeadingChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.heading!.text = event.target.value);\n\n /**\n * Get products dimension availabilities.\n * @param products - Products.\n * @returns Promise.\n */\n private readonly _getProductsDimensionsAvailabilities = async (products: ProductSearchResult[]): Promise => {\n const context = this.props.context as ICoreContext;\n const dimensionsToDisplayOnProductCard = context.app.config.dimensionsInProductCard;\n const dimensionsToDisplayAsSwatch = context.app.config.dimensionsAsSwatchType;\n const validProducts = ArrayExtensions.validValues(products);\n if (\n ArrayExtensions.hasElements(validProducts) &&\n ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) &&\n !dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) &&\n ArrayExtensions.hasElements(dimensionsToDisplayAsSwatch) &&\n !dimensionsToDisplayAsSwatch.includes(DimensionTypes.none)\n ) {\n const productsDimensionAvailabilities = await getDimensionAvailabilitiesForProductSearchResultAction(\n new DimensionAvailabilitiesForProductSearchResultInput(\n validProducts,\n this.props.context as ICoreContext,\n DimensionSwatchDisplayTypes.productCard\n ),\n this.props.context.actionContext\n );\n\n if (ArrayExtensions.hasElements(productsDimensionAvailabilities)) {\n this.setState({ productsDimensionAvailabilities });\n }\n }\n };\n\n /**\n * Helper method to initialize products state.\n * @param productCollection - List of products.\n */\n private readonly initProductState = async (productCollection: Msdyn365.IProductList) => {\n let products = this.state.products;\n const productCollectionProducts = productCollection.products;\n if (!ArrayExtensions.hasElements(products) && ArrayExtensions.hasElements(productCollectionProducts)) {\n products = productCollectionProducts;\n this.setState({ products });\n } else if (\n ArrayExtensions.hasElements(products) &&\n ArrayExtensions.hasElements(productCollectionProducts) &&\n !ArrayExtensions.equals(products, productCollectionProducts)\n ) {\n products = productCollectionProducts;\n this.setState({ products });\n } else if (productCollectionProducts === undefined && ArrayExtensions.hasElements(this.state.products)) {\n products = [];\n this.setState({ products: products });\n }\n\n if (Msdyn365.msdyn365Commerce.isBrowser && !ArrayExtensions.hasElements(this.state.productsDimensionAvailabilities)) {\n await this._getProductsDimensionsAvailabilities(products);\n }\n };\n\n private readonly _getProduct = (product: ProductSearchResult, index: number): IProductComponentViewProps | null => {\n if (!product || !product.Name) {\n this.props.telemetry.trace('[product-collection] Product or product name is null');\n return null;\n }\n const telemetryContent = getTelemetryObject(\n this.props.context.request.telemetryPageName!,\n this.props.friendlyName,\n this.props.telemetry\n );\n const { imageSettings, allowBackNavigation } = this.props.config;\n const resources = this.props.resources;\n const breaCrumbType = this.props.context.app.config.breadcrumbType;\n const allowBack = allowBackNavigation && (breaCrumbType === 'back' || breaCrumbType === 'categoryAndBack');\n const quickviewSlot =\n this.props.slots && this.props.slots.quickview && this.props.slots.quickview.length > 0 ? this.props.slots.quickview[0] : null;\n const productComparisonButtonSlot = ArrayExtensions.hasElements(this.props.slots.productComparisonButton)\n ? this.props.slots.productComparisonButton[0]\n : null;\n\n const reviewCount = 1;\n const reviewTotalRatings = Number(product.TotalRatings);\n const reviewCountAriaLabelValue =\n reviewTotalRatings > reviewCount ? resources.ratingCountAriaLabel : resources.ratingCountAriaLabelSingleUser;\n const isPriceMinMaxEnabled = this.props.data.featureState.result?.find(\n featureState => featureState.Name === 'Dynamics.AX.Application.RetailSearchPriceRangeFeature'\n );\n const priceResources: IPriceComponentResources = {\n priceRangeSeparator: resources.priceRangeSeparator\n };\n return {\n ProductContainer: {\n tag: 'li' as NodeTag,\n className: 'ms-product-collection__item',\n role: 'listitem',\n key: index\n },\n productComponent: (\n \n ArrayExtensions.hasElements(dimensionAvailability) &&\n dimensionAvailability[0].masterProductId === (product.MasterProductId ?? product.RecordId)\n )}\n />\n )\n };\n };\n\n /**\n * Get the active price for products.\n */\n private readonly _getActivePrice = async (): Promise => {\n const productsList = this.state.products;\n const products = await getPriceForProductSearchResult(\n new PriceForProductSearchResultInput(productsList),\n this.props.context.actionContext\n );\n if (Msdyn365.msdyn365Commerce.isBrowser) {\n await this._getProductsDimensionsAvailabilities(products);\n }\n\n this.setState({ products });\n };\n\n /**\n * Get the see all button.\n * @param recommendation - Recommendation.\n * @param headingLabel - Heading label.\n * @returns IProductComponentSeeAllViewProps - Product component see all view props.\n */\n private readonly _getSeeAllButton = (recommendation: string, headingLabel: string): React.ReactNode => {\n const catalogId = getCatalogId(this.props.context.request);\n const seeAllLink = `/search?recommendation=${recommendation}&title=${headingLabel}&catalogid=${catalogId}`;\n return (\n \n {this.props.resources.seeAllButtonText}\n \n );\n };\n}\n\nexport default ProductCollection;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport * as React from 'react';\n\nimport { IProductCollectionViewProps, IProductComponentViewProps } from './product-collection';\n\nconst ProductCollectionView: React.FC = props => {\n const {\n heading,\n ProductCollectionContainer,\n products,\n SingleSlideCarouselComponentProps,\n GridComponentProps,\n isCarousel,\n seeAllButton\n } = props;\n\n if (products) {\n return (\n \n {heading}\n {seeAllButton}\n {isCarousel ? _renderCarousel(SingleSlideCarouselComponentProps, products) : _renderGrid(GridComponentProps, products)}\n \n );\n }\n props.context.telemetry.error('Product collection content is empty, module wont render.');\n return null;\n};\n\nconst _renderCarousel = (carouselContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\n return {items && items.map(_renderProduct)};\n};\n\nconst _renderGrid = (gridContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\n return {items && items.map(_renderProduct)};\n};\n\nconst _renderProduct = (product: IProductComponentViewProps): JSX.Element => {\n const { ProductContainer, productComponent } = product;\n\n return {productComponent};\n};\n\nexport default ProductCollectionView;\n","module.exports = React;","module.exports = ReactDOM;"],"names":["binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","registerSanitizedActionPath","window","__bindings__","viewDictionary","cn","ProductCollection","React","constructor","props","super","handleHeadingChange","event","this","config","heading","text","target","value","_getProductsDimensionsAvailabilities","async","context","dimensionsToDisplayOnProductCard","app","dimensionsInProductCard","dimensionsToDisplayAsSwatch","dimensionsAsSwatchType","validProducts","ArrayExtensions","validValues","products","hasElements","includes","DimensionTypes","none","productsDimensionAvailabilities","getDimensionAvailabilitiesForProductSearchResultAction","DimensionAvailabilitiesForProductSearchResultInput","DimensionSwatchDisplayTypes","productCard","actionContext","setState","initProductState","state","productCollectionProducts","productCollection","equals","undefined","Msdyn365","isBrowser","_getProduct","product","index","Name","telemetry","trace","telemetryContent","getTelemetryObject","request","telemetryPageName","friendlyName","imageSettings","allowBackNavigation","resources","breaCrumbType","breadcrumbType","allowBack","quickviewSlot","slots","quickview","length","productComparisonButtonSlot","productComparisonButton","reviewCountAriaLabelValue","Number","TotalRatings","ratingCountAriaLabel","ratingCountAriaLabelSingleUser","isPriceMinMaxEnabled","data","featureState","result","find","priceResources","priceRangeSeparator","ProductContainer","tag","className","role","key","productComponent","ProductComponent","freePriceText","priceFree","originalPriceText","currentPriceText","ratingAriaLabel","typeName","quickViewButton","IsEnabled","dimensionAvailabilities","dimensionAvailability","masterProductId","MasterProductId","RecordId","_getActivePrice","productsList","getPriceForProductSearchResult","PriceForProductSearchResultInput","_getSeeAllButton","recommendation","headingLabel","seeAllLink","getCatalogId","Button","title","seeAllButtonText","href","productPrices","enableAffiliationBasedPricing","requestContext","user","isAuthenticated","render","shouldDisplaySeeAllButton","recommendationListId","isCarousel","layout","headingComponent","editProps","onEdit","updatedProducts","map","item","getProductData","ObjectExtensions","isNullOrUndefined","productCollectionViewProps","SingleSlideCarouselComponentProps","SingleSlideCarousel","flipperPrevLabel","flipperPrevious","flipperNextLabel","flipperNext","parentId","ProductCollectionContainer","moduleProps","classnames","GridComponentProps","filter","seeAllButton","renderView","_renderCarousel","carouselContainer","items","Node","_renderProduct","_renderGrid","gridContainer","Module","error","module","exports","ReactDOM"],"sourceRoot":""}