{"version":3,"sources":["webpack:///./src/modules/dobbies-recently-viewed/dobbies-recently-viewed.view.tsx?6bf3","webpack:///./src/modules/dobbies-recently-viewed/dobbies-recently-viewed.props.autogenerated.ts?b0fc","webpack:///./src/modules/dobbies-recently-viewed/dobbies-recently-viewed.tsx?a7c5","webpack:///./lib/dobbies-recently-viewed/module-registration.js?31bd","webpack:///external \"React\"?c481","webpack:///external \"ReactDOM\"?4b2d"],"names":["_renderCarousel","carouselContainer","items","React","Node","Object","map","_renderProduct","_renderGrid","gridContainer","product","ProductContainer","productComponent","ProductCollectionView","props","heading","ProductCollectionContainer","products","SingleSlideCarouselComponentProps","GridComponentProps","isCarousel","context","request","query","isQuickView","length","Module","telemetry","error","layout","HeadingTag","ProductCollection","constructor","super","getDeliveries","async","plantProducts","nonPlantProducts","fulfillmentTypeAttribute","AttributeValues","find","attribute","Name","toLowerCase","TextValue","push","prodIds","prod","RecordId","deliveryOptions","getDeliveryOptionsAsync","callerContext","this","actionContext","queryResultSettings","productAvailabilitesPlants","getEstimatedAvailabilityAsync","ProductIds","DefaultWarehouseOnly","FilterByChannelFulfillmentGroup","productsWithPlantsDelivery","Promise","all","idx","isCnC","isHomeDelivery","ProductWarehouseInventoryAvailabilities","item","InventLocationId","PhysicalAvailableInventoryLevelCode","DeliveryOptions","option","Code","isVendorShipAttribute","trim","productAvailabilitesNonPlantsHD","productAvailabilitesNonPlantsCNC","totalProducts","AggregatedProductInventoryAvailabilities","stores","ProductId","allProducts","console","log","setState","handleHeadingChange","event","config","text","target","value","_getProduct","index","trace","telemetryContent","getTelemetryObject","telemetryPageName","friendlyName","imageSettings","allowBackNavigation","resources","breaCrumbType","app","breadcrumbType","allowBack","quickviewSlot","slots","quickview","reviewCountAriaLabelValue","Number","TotalRatings","ratingCountAriaLabel","ratingCountAriaLabelSingleUser","isPriceMinMaxEnabled","data","featureState","result","priceResources","priceRangeSeparator","tag","className","role","key","ProductComponent","freePriceText","priceFree","originalPriceText","currentPriceText","ratingAriaLabel","id","typeName","quickViewButton","IsEnabled","_getActivePrice","state","productRecIds","projectDomain","ChannelId","apiSettings","channelId","CatalogId","catalogId","cart","getCartFromCustomer","affliations","AffiliationLines","getActivePricesAsync","Date","then","activePricesResponse","productPrices","activePrice","price","Price","CustomerContextualPrice","BasePrice","Math","max","TradeAgreementPrice","AdjustedPrice","catch","message","exception","debug","Error","componentDidMount","recentlyViewedProdIdsCookie","cookies","get","searchCriteriaInput","Context","Ids","IncludeAttributes","searchByCriteriaAsync","productData","enableAffiliationBasedPricing","requestContext","user","isAuthenticated","render","carousel","headingLabel","headingComponent","Msdyn365","editProps","onEdit","productCollectionViewProps","SingleSlideCarousel","flipperPrevLabel","flipperPrevious","flipperNextLabel","flipperNext","parentId","useTabList","moduleProps","classnames","renderView","binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","sanitizedActionPath","dataAction","default","prototype","RegistrationId","registerSanitizedActionPath","window","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"mappings":"4IAWA,MAkBMA,EAAkB,CAACC,EAA+BC,IAC7CC,gBAACC,OAAIC,iBAAKJ,GAAoBC,GAASA,EAAMI,IAAIC,IAGtDC,EAAc,CAACC,EAA2BP,IACrCC,gBAACC,OAAIC,iBAAKI,GAAgBP,GAASA,EAAMI,IAAIC,IAGlDA,EAAkBG,IACpB,MAAM,iBAAEC,EAAF,iBAAoBC,GAAqBF,EAE/C,OAAOP,gBAACC,OAAIC,iBAAKM,GAAmBC,IAGzBC,UAhCsDC,IAAQ,UACzE,MAAM,QAAEC,EAAF,2BAAWC,EAAX,SAAuCC,EAAvC,kCAAiDC,EAAjD,mBAAoFC,EAApF,WAAwGC,GAAeN,EAG7H,OAFiB,YAAI,UAACA,EAAMO,QAAQC,eAAf,iBAAC,EAAuBC,aAAxB,QAAC,EAA8BC,oBAAnC,SAEO,KAEpBP,GAAYA,EAASQ,OAAS,EAE1BtB,gBAACuB,SAAMrB,iBAAKW,GACPD,EACAK,EAAapB,E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QE,YAAYc,GAAqBE,QAAQC,UAAUvF,KAC3DoE,EAAQE,YAAYF,EAAQE,YAAYc,GAAqBE,QAAQC,UAAUvF,IAAMoF,IA0BzFK,CAF4B,uEACXjB,EAAQ,SAMjCkB,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAatB,QAApB,OACOqB,OAAOC,aAAatB,SAAW,IAC/BD,EAAQC,SAGXqB,OAAOC,aAAarB,YAApB,OACGoB,OAAOC,aAAarB,aAAe,IACnCF,EAAQE,aAEY,MAAMsB,EAAiB,GAC9BA,EAAe,+EAAiF,CACxGrB,EAAG,IAAMC,EAAQ,QACjBqB,GAAI,+CAEpBH,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaC,eAApB,OAC2BF,OAAOC,aAAaC,gBAAkB,IACtCA,I,mBCnF3BE,EAAOC,QAAU7N,O,mBCAjB4N,EAAOC,QAAUC,W","file":"static/js/115.0cadbcfb7669e4a4d57f.chunk.js","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\n/* eslint-disable no-duplicate-imports */\r\nimport { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nimport { IProductCollectionViewProps, IProductComponentViewProps } from './dobbies-recently-viewed';\r\n\r\nconst ProductCollectionView: React.FC = props => {\r\n const { heading, ProductCollectionContainer, products, SingleSlideCarouselComponentProps, GridComponentProps, isCarousel } = props;\r\n const isQuickView = !!props.context.request?.query?.isQuickView ?? false;\r\n\r\n if (isQuickView) return null;\r\n\r\n if (products && products.length > 0) {\r\n return (\r\n \r\n {heading}\r\n {isCarousel ? _renderCarousel(SingleSlideCarouselComponentProps, products) : _renderGrid(GridComponentProps, products)}\r\n \r\n );\r\n }\r\n props.context.telemetry.error('Product collection content is empty, module wont render.');\r\n return null;\r\n};\r\n\r\nconst _renderCarousel = (carouselContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\r\n return {items && items.map(_renderProduct)};\r\n};\r\n\r\nconst _renderGrid = (gridContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\r\n return {items && items.map(_renderProduct)};\r\n};\r\n\r\nconst _renderProduct = (product: IProductComponentViewProps): JSX.Element => {\r\n const { ProductContainer, productComponent } = product;\r\n\r\n return {productComponent};\r\n};\r\n\r\nexport default ProductCollectionView;\r\n","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. See License.txt in the project root for license information.\r\n * IDobbiesRecentlyViewed containerModule Interface Properties\r\n * THIS FILE IS AUTO-GENERATED - MANUAL MODIFICATIONS WILL BE LOST\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\n\r\nexport const enum layout {\r\n carousel = 'carousel',\r\n grid = 'grid'\r\n}\r\n\r\nexport interface IDobbiesRecentlyViewedConfig extends Msdyn365.IModuleConfig {\r\n productCollection: Msdyn365.IProductList;\r\n heading?: IHeadingData;\r\n layout?: layout;\r\n allowBackNavigation?: boolean;\r\n imageSettings?: Msdyn365.IImageSettings;\r\n clientRender?: boolean;\r\n enableAffiliationBasedPricing?: boolean;\r\n className?: string;\r\n}\r\n\r\nexport interface IDobbiesRecentlyViewedResources {\r\n priceFree: string;\r\n priceRangeSeparator: string;\r\n ratingAriaLabel: string;\r\n flipperNext: string;\r\n flipperPrevious: string;\r\n originalPriceText: string;\r\n currentPriceText: string;\r\n ratingCountAriaLabel: string;\r\n ratingCountAriaLabelSingleUser: string;\r\n}\r\n\r\nexport const enum HeadingTag {\r\n h1 = 'h1',\r\n h2 = 'h2',\r\n h3 = 'h3',\r\n h4 = 'h4',\r\n h5 = 'h5',\r\n h6 = 'h6'\r\n}\r\n\r\nexport interface IHeadingData {\r\n text: string;\r\n tag?: HeadingTag;\r\n}\r\n\r\nexport interface IDobbiesRecentlyViewedProps extends Msdyn365.IModule {\r\n resources: IDobbiesRecentlyViewedResources;\r\n config: IDobbiesRecentlyViewedConfig;\r\n slots: {\r\n quickview: React.ReactNode[];\r\n };\r\n}\r\n","/*--------------------------------------------------------------\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\n/* eslint-disable no-duplicate-imports */\r\n/* eslint-disable no-duplicate-imports */\r\n\r\n\r\nimport { IPriceComponentResources, ProductComponent } from '@msdyn365-commerce/components';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { getCartFromCustomer } from '@msdyn365-commerce/global-state';\r\nimport {\r\n ProductPrice,\r\n ProductSearchCriteria,\r\n ProductSearchResult,\r\n ProductWarehouseInventoryAvailability,\r\n ProjectionDomain\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getActivePricesAsync,\r\n getDeliveryOptionsAsync,\r\n getEstimatedAvailabilityAsync,\r\n searchByCriteriaAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n getTelemetryObject,\r\n IComponentNodeProps,\r\n IModuleProps,\r\n INodeProps,\r\n ISingleSlideCarouselProps,\r\n ITelemetryContent,\r\n NodeTag,\r\n SingleSlideCarousel\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\n\r\nimport { IDobbiesRecentlyViewedData } from './dobbies-recently-viewed.data';\r\nimport { IDobbiesRecentlyViewedProps, layout } from './dobbies-recently-viewed.props.autogenerated';\r\nimport { IProductWithModes } from '../dobbies-search-result-container/components';\r\n\r\nexport interface IProductCollectionViewProps extends IDobbiesRecentlyViewedProps {\r\n heading?: React.ReactNode;\r\n ProductCollectionContainer: IModuleProps;\r\n SingleSlideCarouselComponentProps: INodeProps;\r\n GridComponentProps: INodeProps;\r\n products: IProductComponentViewProps[];\r\n isCarousel: boolean;\r\n productPrices?: ProductPrice[];\r\n}\r\n\r\nexport interface IProductComponentViewProps {\r\n ProductContainer: INodeProps;\r\n productComponent: React.ReactNode;\r\n}\r\nexport interface IProductComponentState {\r\n products: ProductSearchResult[];\r\n}\r\n\r\n/**\r\n * ProductCollection component.\r\n */\r\nclass ProductCollection extends React.PureComponent, IProductComponentState> {\r\n private readonly telemetryContent: ITelemetryContent;\r\n\r\n private productPrices: ProductPrice[];\r\n\r\n constructor(props: IDobbiesRecentlyViewedProps) {\r\n super(props);\r\n this.productPrices = [];\r\n this.state = {\r\n products: []\r\n };\r\n // this.state = {\r\n // products: this.props.config.productCollection && this.props.config.productCollection.products\r\n // };\r\n this.telemetryContent = getTelemetryObject(\r\n this.props.context.request.telemetryPageName!,\r\n this.props.friendlyName,\r\n this.props.telemetry\r\n );\r\n }\r\n\r\n public componentDidMount(): void {\r\n const recentlyViewedProdIdsCookie = this.props.context.request.cookies.get('recently-viewed');\r\n\r\n if (!recentlyViewedProdIdsCookie.value) return;\r\n\r\n const searchCriteriaInput: ProductSearchCriteria = {\r\n Context: {\r\n ChannelId: this.props.context.request.apiSettings.channelId,\r\n CatalogId: this.props.context.request.apiSettings.catalogId\r\n },\r\n // @ts-ignore\r\n Ids: recentlyViewedProdIdsCookie.value,\r\n IncludeAttributes: true\r\n };\r\n\r\n const callerContext = this.props.context.actionContext;\r\n searchByCriteriaAsync({ callerContext, queryResultSettings: {} }, searchCriteriaInput).then(productData => {\r\n this.getDeliveries(productData);\r\n });\r\n\r\n if (this.props.config.enableAffiliationBasedPricing && this.props.context.actionContext.requestContext?.user?.isAuthenticated) {\r\n this._getActivePrice();\r\n }\r\n }\r\n\r\n public getDeliveries = async (products: ProductSearchResult[]) => {\r\n const attributeName = 'fulfillmenttype';\r\n const attributeTextValue = 'plants';\r\n\r\n const plantProducts: ProductSearchResult[] = [];\r\n const nonPlantProducts: ProductSearchResult[] = [];\r\n\r\n products.map(product => {\r\n const fulfillmentTypeAttribute =\r\n product.AttributeValues &&\r\n product.AttributeValues.find(attribute => {\r\n return attribute?.Name?.toLowerCase() === attributeName;\r\n });\r\n const isPlantFulfillment = fulfillmentTypeAttribute && fulfillmentTypeAttribute.TextValue?.toLowerCase() === attributeTextValue;\r\n const isPlantCategory = isPlantFulfillment ? true : false;\r\n\r\n if (isPlantCategory) {\r\n plantProducts.push(product);\r\n } else {\r\n nonPlantProducts.push(product);\r\n }\r\n });\r\n\r\n const prodIds = products.map(prod => prod.RecordId);\r\n\r\n // If there are no products, do not make any api calls\r\n if (prodIds.length <= 0) return;\r\n\r\n const deliveryOptions = await getDeliveryOptionsAsync(\r\n { callerContext: this.props.context.actionContext, queryResultSettings: {} },\r\n prodIds\r\n );\r\n\r\n // Plants API since the warehouse storage is different\r\n const productAvailabilitesPlants = await getEstimatedAvailabilityAsync(\r\n { callerContext: this.props.context.actionContext },\r\n { ProductIds: prodIds, DefaultWarehouseOnly: false, FilterByChannelFulfillmentGroup: true }\r\n );\r\n\r\n const productsWithPlantsDelivery: IProductWithModes[] = await Promise.all(\r\n plantProducts.map(async (prod, idx) => {\r\n let isCnC = false;\r\n let isHomeDelivery = false;\r\n\r\n if (productAvailabilitesPlants && productAvailabilitesPlants.ProductWarehouseInventoryAvailabilities) {\r\n productAvailabilitesPlants.ProductWarehouseInventoryAvailabilities?.map(\r\n (item: ProductWarehouseInventoryAvailability) => {\r\n if (item.InventLocationId === 'P001') {\r\n if (item.PhysicalAvailableInventoryLevelCode !== 'OOS') {\r\n isHomeDelivery = true;\r\n }\r\n } else {\r\n if (item.PhysicalAvailableInventoryLevelCode !== 'OOS') {\r\n deliveryOptions[idx].DeliveryOptions?.map(option => {\r\n if (option.Code === 'ClickCol') {\r\n isCnC = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n );\r\n }\r\n\r\n // If product has vendorship === \"yes\" then show it as available\r\n const isVendorShipAttribute = prod.AttributeValues?.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'isvendershipproduct';\r\n });\r\n\r\n if (isVendorShipAttribute && isVendorShipAttribute.TextValue && isVendorShipAttribute.TextValue.toLowerCase() === 'yes') {\r\n isHomeDelivery = true;\r\n isCnC = false;\r\n }\r\n\r\n return { ...prod, isHomeDelivery, isCnC };\r\n })\r\n );\r\n\r\n // Not Plants API since the warehouse storage is different\r\n const productAvailabilitesNonPlantsHD = await getEstimatedAvailabilityAsync(\r\n { callerContext: this.props.context.actionContext },\r\n { ProductIds: prodIds, DefaultWarehouseOnly: true, FilterByChannelFulfillmentGroup: false }\r\n );\r\n const productAvailabilitesNonPlantsCNC = await getEstimatedAvailabilityAsync(\r\n { callerContext: this.props.context.actionContext },\r\n { ProductIds: prodIds, DefaultWarehouseOnly: false, FilterByChannelFulfillmentGroup: true }\r\n );\r\n\r\n const productsWithNonPlantsDelivery: IProductWithModes[] = await Promise.all(\r\n nonPlantProducts.map(async (prod, idx) => {\r\n let isCnC = false;\r\n let isHomeDelivery = false;\r\n\r\n if (productAvailabilitesNonPlantsHD && productAvailabilitesNonPlantsHD.AggregatedProductInventoryAvailabilities) {\r\n productAvailabilitesNonPlantsHD.AggregatedProductInventoryAvailabilities.map(stores => {\r\n if (stores.ProductId === prod.RecordId && stores.PhysicalAvailableInventoryLevelCode !== 'OOS') {\r\n isHomeDelivery = true;\r\n }\r\n });\r\n }\r\n\r\n if (productAvailabilitesNonPlantsCNC && productAvailabilitesNonPlantsCNC.AggregatedProductInventoryAvailabilities) {\r\n productAvailabilitesNonPlantsCNC.AggregatedProductInventoryAvailabilities.map(stores => {\r\n if (stores.ProductId === prod.RecordId && stores.PhysicalAvailableInventoryLevelCode !== 'OOS') {\r\n deliveryOptions[idx].DeliveryOptions?.map(option => {\r\n if (option.Code === 'ClickCol') {\r\n isCnC = true;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n // If product has vendorship === \"yes\" then show it as available\r\n const isVendorShipAttribute = prod.AttributeValues?.find(attribute => {\r\n const attributeName = attribute.Name && attribute.Name.trim().toLowerCase();\r\n return attributeName === 'isvendershipproduct';\r\n });\r\n\r\n if (isVendorShipAttribute && isVendorShipAttribute.TextValue && isVendorShipAttribute.TextValue.toLowerCase() === 'yes') {\r\n isHomeDelivery = true;\r\n isCnC = false;\r\n }\r\n\r\n return { ...prod, isHomeDelivery, isCnC };\r\n })\r\n );\r\n\r\n const totalProducts = [...productsWithPlantsDelivery, ...productsWithNonPlantsDelivery];\r\n const allProducts: any = [];\r\n products.map(prod => {\r\n totalProducts.find(item => {\r\n if (item.RecordId === prod.RecordId) {\r\n allProducts.push(item);\r\n }\r\n });\r\n });\r\n console.log('allProducts', allProducts);\r\n this.setState({\r\n products: allProducts\r\n });\r\n };\r\n\r\n public render(): JSX.Element | null {\r\n const { heading, className } = this.props.config;\r\n const { resources } = this.props;\r\n const products = this.state.products;\r\n const isCarousel = this.props.config.layout === layout.carousel;\r\n const headingLabel = heading ? heading.text : '';\r\n const headingComponent = heading && (\r\n \r\n );\r\n\r\n const productCollectionViewProps = {\r\n ...this.props,\r\n heading: headingComponent,\r\n SingleSlideCarouselComponentProps: {\r\n tag: SingleSlideCarousel,\r\n className: '',\r\n flipperPrevLabel: `${headingLabel} ${resources.flipperPrevious}`,\r\n flipperNextLabel: `${headingLabel} ${resources.flipperNext}`,\r\n parentId: this.props.id,\r\n useTabList: true,\r\n telemetryContent: this.telemetryContent\r\n } as IComponentNodeProps,\r\n ProductCollectionContainer: {\r\n moduleProps: this.props,\r\n className: classnames('ms-product-collection ms-product-collection-related', className)\r\n },\r\n GridComponentProps: {\r\n tag: 'ul' as NodeTag,\r\n className: 'ms-product-collection__items'\r\n },\r\n isCarousel,\r\n products:\r\n products &&\r\n products.length > 0 &&\r\n products.map((item: ProductSearchResult, index: number) => this._getProduct(item, index)),\r\n productPrices: this.productPrices\r\n };\r\n return this.props.renderView(productCollectionViewProps) as React.ReactElement;\r\n }\r\n\r\n public handleHeadingChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.heading!.text = event.target.value);\r\n\r\n private readonly _getProduct = (product: ProductSearchResult, index: number): IProductComponentViewProps | null => {\r\n if (!product || !product.Name) {\r\n this.props.telemetry.trace('[product-collection] Product or product name is null');\r\n return null;\r\n }\r\n const telemetryContent = getTelemetryObject(\r\n this.props.context.request.telemetryPageName!,\r\n this.props.friendlyName,\r\n this.props.telemetry\r\n );\r\n const { imageSettings, allowBackNavigation } = this.props.config;\r\n const resources = this.props.resources;\r\n const breaCrumbType = this.props.context.app.config.breadcrumbType;\r\n const allowBack = allowBackNavigation && (breaCrumbType === 'back' || breaCrumbType === 'categoryAndBack');\r\n const quickviewSlot =\r\n this.props.slots && this.props.slots.quickview && this.props.slots.quickview.length > 0 ? this.props.slots.quickview[0] : null;\r\n const reviewCount = 1;\r\n const reviewTotalRatings = Number(product.TotalRatings);\r\n const reviewCountAriaLabelValue =\r\n reviewTotalRatings > reviewCount ? resources.ratingCountAriaLabel : resources.ratingCountAriaLabelSingleUser;\r\n const isPriceMinMaxEnabled = this.props.data.featureState.result?.find(\r\n featureState => featureState.Name === 'Dynamics.AX.Application.RetailSearchPriceRangeFeature'\r\n );\r\n const priceResources: IPriceComponentResources = {\r\n priceRangeSeparator: resources.priceRangeSeparator\r\n };\r\n return {\r\n ProductContainer: {\r\n tag: 'li' as NodeTag,\r\n className: 'ms-product-collection__item',\r\n role: 'listitem',\r\n key: index\r\n },\r\n productComponent: (\r\n \r\n )\r\n };\r\n };\r\n\r\n private readonly _getActivePrice = async (): Promise => {\r\n let products = this.state.products || [];\r\n const productRecIds = products && products.length > 0 ? products.map(prod => prod.RecordId) : [];\r\n const projectDomain: ProjectionDomain = {\r\n ChannelId: this.props.context.request.apiSettings.channelId,\r\n CatalogId: this.props.context.request.apiSettings.catalogId\r\n };\r\n const cart = await getCartFromCustomer(this.props.context.actionContext);\r\n const affliations = cart?.AffiliationLines;\r\n\r\n await getActivePricesAsync(\r\n { callerContext: this.props.context.actionContext, queryResultSettings: {} },\r\n projectDomain,\r\n productRecIds,\r\n new Date(),\r\n null,\r\n affliations,\r\n true\r\n )\r\n .then((activePricesResponse: ProductPrice[]) => {\r\n this.productPrices = activePricesResponse;\r\n products = products.map(prod => {\r\n const activePrice = activePricesResponse.find(price => price.ProductId === prod.RecordId);\r\n if (activePrice) {\r\n prod.Price = activePrice.CustomerContextualPrice ?? prod.Price;\r\n prod.BasePrice = Math.max(\r\n activePrice.BasePrice || 0,\r\n activePrice.TradeAgreementPrice || 0,\r\n activePrice.AdjustedPrice || 0\r\n );\r\n }\r\n return prod;\r\n });\r\n this.setState({\r\n products\r\n });\r\n })\r\n .catch((error: Error) => {\r\n this.props.context.actionContext.trace(error.message);\r\n this.props.context.actionContext.telemetry.exception(error);\r\n this.props.context.actionContext.telemetry.debug(\r\n '[get Affiliation based price on Product Collection]Error executing action'\r\n );\r\n throw new Error('[get Affiliation based price on Product Collection]Error executing action');\r\n });\r\n };\r\n}\r\n\r\nexport default ProductCollection;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['dobbies-recently-viewed'] = {\n c: () => require('partner/modules/dobbies-recently-viewed/dobbies-recently-viewed.tsx'),\n $type: 'containerModule',\n da: [{name:'featureState', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'dobbies-recently-viewed',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/dobbies-recently-viewed'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-feature-state');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|dobbies-recently-viewed|dobbies-recently-viewed'] = {\n c: () => require('partner/modules/dobbies-recently-viewed/dobbies-recently-viewed.view.tsx'),\n cn: '__local__-__local__-dobbies-recently-viewed'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"sourceRoot":""}