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["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 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 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 QueryResultSettingsProxy,\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 queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(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","window","innerWidth","gridSettings","request","xs","w","sm","md","lg","GetProductBenefitsEnhancedContentInput","Msdyn365","constructor","masterProductID","super","shouldCacheOutput","cacheObjectType","cacheKey","getCacheKey","getCacheObjectType","dataCacheType","this","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","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","scoreAttribute","toLowerCase","badge","label","icon","benefitContent","htmlBlob","push","resources","productBenefitsHeading","AccordionItem","initialOpen","key","src","alt","preview","id","content","focused","render","viewProps","renderProductBenefitsAccordion","renderView","product","MasterProductId","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","queryResultSettings","QueryResultSettingsProxy","RecordId","attributeValues","channelInventoryConfiguration","StoreOperationsDataActions","getAttributeValuesByConfiguration","catch","trace","message","createObservableDataAction","module","exports","ReactDOM"],"sourceRoot":""}