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ADAtC,EAAQiM,MAAM3J,EAAM4J,SACd,IAAI7C,MAAM,+DAI5B,SAAe8C,EAAAA,EAAAA,IAA2B,CACtC3K,GAAI,8EACJC,OAAmCuJ,EACnCrJ,MAAOiJ,WC7HXwB,EAAOC,QAAUvJ,cCAjBsJ,EAAOC,QAAUC","sources":["webpack://mattressfirm/./src/Utilities/get-view-port.tsx?4210","webpack://mattressfirm/./src/data-actions/get-product-benefit-enhanced-content.action.ts?85e9","webpack://mattressfirm/./src/data-actions/get-product-benefits-data.action.ts?1d43","webpack://mattressfirm/./src/modules/mfrm-product-benefits/mfrm-product-benefits.tsx?faf3","webpack://mattressfirm/./src/modules/mfrm-product-benefits/mfrm-product-benefits.view.tsx?05a2","webpack://mattressfirm/./lib/mfrm-product-benefits/module-registration.js?7d53","webpack://mattressfirm/./src/dataActions/get-attributes-for-selected-variant.ts?e4b6","webpack://mattressfirm/external var \"React\"?0d3b","webpack://mattressfirm/external var \"ReactDOM\"?853b"],"sourcesContent":["import MsDyn365, { ICoreContext } from '@msdyn365-commerce/core';\r\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nconst _getViewPort = (context: ICoreContext): GridSize => {\r\n if (MsDyn365.isBrowser && window.innerWidth) {\r\n const gridSettings = context.request.gridSettings;\r\n if (gridSettings) {\r\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\r\n return 'xs';\r\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\r\n return 'sm';\r\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\r\n return 'md';\r\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\r\n return 'lg';\r\n } else {\r\n return 'xl';\r\n }\r\n }\r\n }\r\n return 'xs';\r\n};\r\n\r\nexport default _getViewPort;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nexport class GetProductBenefitsEnhancedContentInput extends Msdyn365.CommerceEntityInput implements Msdyn365.IActionInput {\r\n public masterProductID: string = '';\r\n constructor( masterProductID:string) {\r\n super({ shouldCacheOutput: true, cacheObjectType: 'productBenefitsEnhancedContentCache', cacheKey: 'productBenefitsEnhancedContentCache' });\r\n this.masterProductID = masterProductID;\r\n }\r\n public getCacheKey = () => `productBenefitsEnhancedContentCache`;\r\n public getCacheObjectType = () => 'productBenefitsEnhancedContentCache';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\r\n}\r\n// tslint:disable: no-any\r\nasync function getEnhancedContentAction(input: GetProductBenefitsEnhancedContentInput, ctx: Msdyn365.IActionContext): Promise {\r\n const jsonUrlFromGlobals = ctx.requestContext.app.config.productBenefitsEnhancedContentUrl;\r\n const masterProductid = input.masterProductID;\r\n const jsonUrl = jsonUrlFromGlobals || '';\r\n try {\r\n const res = await Msdyn365.sendRequest(jsonUrl, 'get');\r\n if (res && masterProductid) {\r\n const productBenefitData = res.data && res.data[masterProductid];\r\n return productBenefitData;\r\n }\r\n }\r\n catch (error) {\r\n console.log('error', error);\r\n }\r\n return null;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n id: 'productBenefitsEnhancedContent',\r\n action: >getEnhancedContentAction\r\n});","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nexport class GetProductBenefitsData extends Msdyn365.CommerceEntityInput implements Msdyn365.IActionInput {\r\n private productBenefitsDataUrl: string = '';\r\n constructor(productBenefitsDataUrl: string) {\r\n super({ shouldCacheOutput: true, cacheObjectType: 'productBenefitsDataCache', cacheKey: 'productBenefitsDataCache' });\r\n this.productBenefitsDataUrl = productBenefitsDataUrl;\r\n }\r\n public getProductBenefitsDataUrl = () => this.productBenefitsDataUrl;\r\n public getCacheKey = () => `productBenefitsDataCache`;\r\n public getCacheObjectType = () => 'productBenefitsDataCache';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\r\n}\r\nconst createInput = (inputData: Msdyn365.ICreateActionContext>): Msdyn365.IActionInput => {\r\n if (inputData.config && inputData.config.productBenefitsDataUrl) {\r\n return new GetProductBenefitsData(inputData.config.productBenefitsDataUrl);\r\n }\r\n return new GetProductBenefitsData('');\r\n};\r\nasync function action(input: GetProductBenefitsData, ctx: Msdyn365.IActionContext): Promise {\r\n const productBenefitsDataJsonUrl = ctx.requestContext.app.config.productBenefitsDataUrl;\r\n const jsonUrl = productBenefitsDataJsonUrl || '';\r\n const res = await Msdyn365.sendRequest(jsonUrl, 'get');\r\n const productBenefitsData = res.data && res.data;\r\n return productBenefitsData;\r\n}\r\nexport default Msdyn365.createObservableDataAction({\r\n id: 'productBenefitsData',\r\n action: >action,\r\n input: createInput\r\n});","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as React from 'react';\r\nimport MsDyn365,{ ICoreContext } from '@msdyn365-commerce/core';\r\nimport AccordionItem from 'mfcl/AccordionItem';\r\nimport { Node ,addThrottledEvent } from '@msdyn365-commerce-modules/utilities';\r\nimport _getViewPort from '../../Utilities/get-view-port';\r\nimport { IMfrmProductBenefitsData } from './mfrm-product-benefits.data';\r\nimport { IMfrmProductBenefitsProps } from './mfrm-product-benefits.props.autogenerated';\r\nimport getEnhancedContentAction, { GetProductBenefitsEnhancedContentInput } from '../../data-actions/get-product-benefit-enhanced-content.action';\r\n\r\nexport interface IMfrmProductBenefitsViewProps extends IMfrmProductBenefitsProps {\r\n renderProductBenefitsAccordion: React.ReactNode;\r\n}\r\n\r\n\r\nexport interface IMfrmProductBenefitsContent {\r\n label: string;\r\n icon: string;\r\n text: string;\r\n benefitContent:string | undefined;\r\n badge: JSX.Element | undefined;\r\n}\r\nexport interface IMfrmProductBenefitsState {\r\n productBenefitEnhancedContent: any;\r\n isMobile: boolean;\r\n isTabletDesktop:boolean,\r\n}\r\n/**\r\n *\r\n * MfrmProductBenefits component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass MfrmProductBenefits extends React.PureComponent, IMfrmProductBenefitsState> {\r\n private resizeThrottledEventHandler?: (event: Event) => void;\r\n constructor(props: IMfrmProductBenefitsProps) {\r\n super(props);\r\n this.state = {\r\n productBenefitEnhancedContent: {},\r\n isMobile:false,\r\n isTabletDesktop:false\r\n };\r\n}\r\n public render(): JSX.Element | null {\r\n const viewProps = {\r\n ...(this.props as IMfrmProductBenefitsProps),\r\n renderProductBenefitsAccordion: this._renderProductBenefitsAccordion()\r\n };\r\n return this.props.renderView(viewProps);\r\n }\r\n private updateViewPort = (context: ICoreContext): void => {\r\n const viewport = _getViewPort(context);\r\n if (viewport === 'xs' || viewport === 'sm') {\r\n this.setState({\r\n isTabletDesktop: false,\r\n isMobile: true\r\n });\r\n } else {\r\n this.setState({\r\n isTabletDesktop: true,\r\n isMobile: false\r\n });\r\n }\r\n };\r\n public async componentDidMount(): Promise {\r\n const masterProductId =this.props.data.product.result?.MasterProductId;\r\n if(masterProductId){\r\n await this._getEnhancedContent(masterProductId);\r\n }\r\n if (MsDyn365.isBrowser) {\r\n this.updateViewPort(this.props.context);\r\n }\r\n }\r\n public async componentDidUpdate(): Promise {\r\n const masterProductId =this.props.data.product.result?.MasterProductId;\r\n if (masterProductId) {\r\n await this._getEnhancedContent(masterProductId);\r\n }\r\n if (MsDyn365.isBrowser) {\r\n this.resizeThrottledEventHandler = addThrottledEvent(window, 'resize', () => this.updateViewPort(this.props.context));\r\n }\r\n }\r\n public componentWillUnmount(): void {\r\n MsDyn365.isBrowser && window.removeEventListener('resize', this.resizeThrottledEventHandler!, false);\r\n }\r\n private _renderTitleBadge = (title: string, scoreBadge?: JSX.Element): JSX.Element | undefined => {\r\n return (\r\n <>\r\n {title || ''}\r\n {scoreBadge && scoreBadge}\r\n \r\n );\r\n };\r\n\r\n private _getBadges = (scoreValue: string | undefined): JSX.Element | undefined => {\r\n try {\r\n if (!scoreValue || scoreValue === '0') {\r\n return;\r\n }\r\n const { scoreBadges } = this.props.config;\r\n const badgeText = scoreBadges && scoreBadges.length > 0 && scoreBadges?.find((item) => (Number(scoreValue) >= item.minValue && Number(scoreValue) <= item.maxValue))?.text;\r\n if (!badgeText) {\r\n return;\r\n }\r\n return (\r\n \r\n \r\n {scoreValue}/10 {badgeText}\r\n \r\n \r\n );\r\n } catch (error) {\r\n console.log('error[_getBadges]', error);\r\n return;\r\n }\r\n };\r\n private _getEnhancedContent = async (masterProductId:number | undefined) => {\r\n const productBenefitInput = new GetProductBenefitsEnhancedContentInput(masterProductId ? masterProductId.toString() :'');\r\n const productBenefitData = await getEnhancedContentAction(productBenefitInput, this.props.context.actionContext);\r\n if(productBenefitData){\r\n this.setState({\r\n productBenefitEnhancedContent:productBenefitData\r\n });\r\n }\r\n };\r\n\r\n private _renderEnhancedContent = (description: string, enhancedContent?: string): JSX.Element | undefined => {\r\n return (\r\n <>\r\n {description || ''}\r\n \r\n \r\n );\r\n };\r\n\r\n private _renderProductBenefitsAccordion = (): JSX.Element | undefined => {\r\n const productBenefitsData =this.props.data.productBenefitsData.result;\r\n const enhancedContentData=this.state.productBenefitEnhancedContent;\r\n const productBenefitsAccordionContent: IMfrmProductBenefitsContent[] = [];\r\n\r\n if (this.props.data.productSpecificationData.result && this.props.data.productSpecificationData.result !== undefined) {\r\n const attributes = this.props.data.productSpecificationData.result;\r\n const spotlightAttributeKey = attributes[attributes.findIndex(obj => obj.Name === 'PDP_Feature Spotlight_Sequence')];\r\n const spotlightValues = spotlightAttributeKey?.TextValue ? spotlightAttributeKey?.TextValue : undefined;\r\n if (spotlightValues !== undefined) {\r\n const spotlightValuesArr = spotlightValues && spotlightValues.split(',');\r\n spotlightValuesArr &&\r\n spotlightValuesArr.length > 0 &&\r\n spotlightValuesArr.map((item, index) => {\r\n const attribute = attributes && attributes[attributes.findIndex(obj => obj.Name === item)];\r\n if (attribute !== undefined && attribute.BooleanValue === true && productBenefitsAccordionContent.length < 13) {\r\n const scoreAttribute = attributes && attributes[attributes.findIndex(obj => obj.Name?.toLowerCase() === `${attribute.Name} score`?.toLowerCase())];\r\n const badge = scoreAttribute ? this._getBadges(scoreAttribute?.TextValue) : undefined;\r\n const obj = {\r\n label: item,\r\n icon: productBenefitsData && productBenefitsData[item]?.icon ? productBenefitsData[item].icon : '' ,\r\n text: productBenefitsData && productBenefitsData[item]?.description ? productBenefitsData[item].description : '' ,\r\n benefitContent: enhancedContentData && enhancedContentData[item]?.htmlBlob ? enhancedContentData[item].htmlBlob :'',\r\n badge\r\n };\r\n productBenefitsAccordionContent.push(obj);\r\n }\r\n });\r\n }\r\n }\r\n return (\r\n <>\r\n {productBenefitsAccordionContent && productBenefitsAccordionContent.length > 0 ? (\r\n \r\n \r\n {this.props.resources.productBenefitsHeading}\r\n \r\n \r\n \r\n {\r\n productBenefitsAccordionContent.map((item: IMfrmProductBenefitsContent, index: number) => (\r\n }\r\n preview={item.text}\r\n id={item.label || ''}\r\n content={this._renderEnhancedContent(item.text,item.benefitContent)}\r\n focused={0}\r\n />\r\n ))}\r\n \r\n \r\n \r\n ) : null}\r\n \r\n );\r\n };\r\n}\r\n\r\nexport default MfrmProductBenefits;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as React from 'react';\r\nimport { IMfrmProductBenefitsViewProps } from './mfrm-product-benefits';\r\n\r\nexport default (props: IMfrmProductBenefitsViewProps) => {\r\n const { renderProductBenefitsAccordion } = props;\r\n return (<>{renderProductBenefitsAccordion});\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['mfrm-product-benefits'] = {\n c: () => require('partner/modules/mfrm-product-benefits/mfrm-product-benefits.tsx'),\n $type: 'contentModule',\n da: [{name:'product', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant', runOn: 0},{name:'productBenefitsData', path:'data-actions/get-product-benefits-data.action', runOn: 0},{name:'productBenefitsEnhancedContent', path:'data-actions/get-product-benefit-enhanced-content.action', runOn: 0},{name:'productSpecificationData', path:'@msdyn365-commerce-modules/product-specification/dist/lib/dataActions/get-attributes-for-selected-variant', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'mfrm-product-benefits',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-product-benefits'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/product-specification/dist/lib/dataActions/get-attributes-for-selected-variant';\n let dataAction = require('@msdyn365-commerce-modules/product-specification/dist/lib/dataActions/get-attributes-for-selected-variant');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = 'data-actions/get-product-benefit-enhanced-content.action';\n let dataAction = require('partner/data-actions/get-product-benefit-enhanced-content.action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = 'data-actions/get-product-benefits-data.action';\n let dataAction = require('partner/data-actions/get-product-benefits-data.action');\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|mfrm-product-benefits|mfrm-product-benefits'] = {\n c: () => require('partner/modules/mfrm-product-benefits/mfrm-product-benefits.view.tsx'),\n cn: '__local__-__local__-mfrm-product-benefits'\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 {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n IAny,\n ICreateActionContext,\n IGeneric\n} from '@msdyn365-commerce/core';\nimport { AttributeValue, ProductsDataActions, SimpleProduct, StoreOperationsDataActions } from '@msdyn365-commerce/retail-proxy';\nimport {\n getAttributeValuesByConfiguration,\n getSelectedProductIdFromActionInput,\n getSelectedVariant,\n SelectedVariantInput\n} from '@msdyn365-commerce-modules/retail-actions';\n\n/**\n * Chains getting the SelectedVariant with GetActivePrice.\n */\nexport class AttributesForSelectedVariantInput implements IActionInput {\n public productId: number;\n\n public channelId: number;\n\n public catalogId: number;\n\n public selectedProduct: SimpleProduct | undefined;\n\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\n this.productId = productId;\n this.channelId = channelId;\n this.selectedProduct = selectedProduct;\n this.catalogId = catalogId || 0;\n }\n\n public getCacheKey = () => 'AttributesForSelectedVariant';\n\n public getCacheObjectType = () => 'ProductAttributeValue';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport const createAttributesForSelectedVariantInput = (\n inputData: ICreateActionContext>\n): AttributesForSelectedVariantInput => {\n const productId = getSelectedProductIdFromActionInput(inputData);\n const catalogId = getCatalogId(inputData.requestContext);\n\n if (productId) {\n return new AttributesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, undefined, catalogId);\n }\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\n};\n\n/**\n * Calls the Retail API a get a list of dimension values for a given product.\n * @param input - The input.\n * @param context - The context.\n * @returns The attribute values.\n */\nexport async function getAttributesForSelectedVariantAction(\n input: AttributesForSelectedVariantInput,\n context: IActionContext\n): Promise {\n return Promise.resolve()\n .then(() => {\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\n\n if (!activeProduct) {\n const selectedVariantInput = new SelectedVariantInput(\n input.productId,\n input.channelId,\n undefined,\n undefined,\n context.requestContext\n );\n\n return getSelectedVariant(selectedVariantInput, context);\n }\n\n return activeProduct;\n })\n .then((productResult: SimpleProduct | null) => {\n const activeProduct: SimpleProduct | undefined = productResult;\n\n if (activeProduct) {\n return ProductsDataActions.getAttributeValuesAsync(\n {\n callerContext: context\n },\n activeProduct.RecordId,\n input.channelId,\n input.catalogId\n );\n }\n\n return null;\n })\n .then(async (attributeValues: AttributeValue[] | null) => {\n const channelInventoryConfiguration = await StoreOperationsDataActions.getInventoryConfigurationAsync({\n callerContext: context\n });\n\n return { attributeValues, channelInventoryConfiguration };\n })\n .then(result => {\n return getAttributeValuesByConfiguration(result.attributeValues, result.channelInventoryConfiguration);\n })\n .catch((error: Error) => {\n context.trace(error.message);\n throw new Error('[getPriceForSelectedVariantAction]Error executing action');\n });\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/product-info/get-attributes-for-selected-variant',\n action: >getAttributesForSelectedVariantAction,\n input: createAttributesForSelectedVariantInput\n});\n","module.exports = React;","module.exports = ReactDOM;"],"names":["context","MsDyn365","isBrowser","window","innerWidth","gridSettings","request","xs","w","sm","md","lg","GetProductBenefitsEnhancedContentInput","Msdyn365","constructor","masterProductID","super","shouldCacheOutput","cacheObjectType","cacheKey","getCacheKey","getCacheObjectType","dataCacheType","this","id","action","async","input","ctx","jsonUrlFromGlobals","requestContext","app","config","productBenefitsEnhancedContentUrl","masterProductid","jsonUrl","res","data","error","console","log","GetProductBenefitsData","productBenefitsDataUrl","getProductBenefitsDataUrl","inputData","MfrmProductBenefits","React","props","updateViewPort","viewport","_getViewPort","setState","isTabletDesktop","isMobile","_renderTitleBadge","title","scoreBadge","Node","className","_getBadges","scoreValue","_scoreBadges$find","scoreBadges","badgeText","length","find","item","Number","minValue","maxValue","text","tag","_getEnhancedContent","productBenefitInput","masterProductId","toString","productBenefitData","getEnhancedContentAction","actionContext","productBenefitEnhancedContent","_renderEnhancedContent","description","enhancedContent","dangerouslySetInnerHTML","__html","_renderProductBenefitsAccordion","productBenefitsData","result","enhancedContentData","state","productBenefitsAccordionContent","productSpecificationData","undefined","attributes","spotlightAttributeKey","findIndex","obj","Name","spotlightValues","TextValue","spotlightValuesArr","split","map","index","attribute","BooleanValue","_productBenefitsData$","_productBenefitsData$2","_enhancedContentData$","scoreAttribute","_obj$Name","_ref","toLowerCase","badge","label","icon","benefitContent","htmlBlob","push","resources","productBenefitsHeading","AccordionItem","initialOpen","key","src","alt","preview","content","focused","render","viewProps","_objectSpread","renderProductBenefitsAccordion","renderView","_this$props$data$prod","product","MasterProductId","_this$props$data$prod2","resizeThrottledEventHandler","addThrottledEvent","componentWillUnmount","removeEventListener","binding","modules","dataActions","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","__bindings__","viewDictionary","cn","AttributesForSelectedVariantInput","productId","channelId","selectedProduct","catalogId","createAttributesForSelectedVariantInput","getSelectedProductIdFromActionInput","getCatalogId","apiSettings","getAttributesForSelectedVariantAction","Promise","resolve","then","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","ProductsDataActions","callerContext","RecordId","attributeValues","channelInventoryConfiguration","StoreOperationsDataActions","getAttributeValuesByConfiguration","catch","trace","message","createObservableDataAction","module","exports","ReactDOM"],"sourceRoot":""}