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BAGZ,OAAO4H,EAAAA,EAAAA,oBAAmBF,EAAsBhK,GAGpD,OAAO+J,KAEVD,MAA+BK,IAC5B,MAAMJ,EAAsEI,EAE5E,OAAIJ,EACOK,EAAAA,oBAAAA,wBACH,CACIC,cAAerK,GAEnB+J,EAAcO,SACdX,EAAMZ,UACNY,EAAMV,WAIP,QAEVa,MAAKL,MAAAA,IAKK,CAAEc,gBAAAA,EAAiBC,oCAJkBC,EAAAA,2BAAAA,+BAA0D,CAClGJ,cAAerK,QAKtB8J,MAAK9H,IACK0I,EAAAA,EAAAA,mCAAkC1I,EAAOuI,gBAAiBvI,EAAOwI,iCAE3EG,OAAOC,IAEJ,MADA5K,EAAQ6K,MAAMD,EAAME,SACd,IAAInD,MAAM,+DAI5B,SAAeoD,EAAAA,EAAAA,IAA2B,CACtCjD,GAAI,8EACJkD,OAAmCtB,EACnCC,MAAON,WC7HX4B,EAAOC,QAAUrK,cCAjBoK,EAAOC,QAAUC","sources":["webpack://mattressfirm/./src/Utilities/get-view-port.tsx?4210","webpack://mattressfirm/./src/modules/mfrm-product-description/mfrm-product-description.tsx?30da","webpack://mattressfirm/./src/modules/mfrm-product-description/mfrm-product-description.view.tsx?c044","webpack://mattressfirm/./lib/mfrm-product-description/module-registration.js?a3dc","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\n\r\nimport * as React from 'react';\r\n\r\nimport { getFallbackImageUrl } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { IImageSettings, Image } from '@msdyn365-commerce/core';\r\nimport _getViewPort from '../../Utilities/get-view-port';\r\nimport { IMfrmProductDescriptionData } from './mfrm-product-description.data';\r\nimport { IMfrmProductDescriptionProps } from './mfrm-product-description.props.autogenerated';\r\n\r\nexport interface IMfrmProductDescriptionViewProps extends IMfrmProductDescriptionProps {\r\n state: IMfrmProductDescriptionState;\r\n toggle: React.MouseEventHandler;\r\n mediaContent: string;\r\n customText: string;\r\n spotlightTitle: IMfrmProductDescriptionContent[];\r\n noContent: boolean;\r\n forceDisplay: boolean;\r\n}\r\n\r\nexport interface IMfrmProductDescriptionContent {\r\n label: string;\r\n icon: string;\r\n}\r\n\r\nexport interface IMfrmProductDescriptionState {\r\n isOpen: boolean;\r\n isMobileTablet: boolean;\r\n isDesktop: boolean;\r\n}\r\n/**\r\n *\r\n * MfrmProductDescriptionFeatureSpotight component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass MfrmProductDescription extends React.PureComponent<\r\n IMfrmProductDescriptionProps,\r\n IMfrmProductDescriptionState\r\n > {\r\n constructor(props: IMfrmProductDescriptionProps) {\r\n super(props);\r\n this.state = {\r\n isDesktop: false,\r\n isMobileTablet: false,\r\n isOpen: false\r\n };\r\n }\r\n\r\n public componentDidMount(): void {\r\n const viewPort = _getViewPort(this.props.context);\r\n (viewPort === 'xs' || viewPort === 'sm' || viewPort === 'md') ? this.setState({ isMobileTablet: true }) : this.setState({ isDesktop: true });\r\n (viewPort === 'lg' || viewPort === 'xl') ? this.setState({ isDesktop: true }) : this.setState({ isMobileTablet: true });\r\n }\r\n\r\n public _toggle = () => {\r\n this.setState({ isOpen: !this.state.isOpen });\r\n };\r\n\r\n public _renderImageHost = (url: string) => {\r\n let fallbackImageUrl;\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=95&h=76&m=6`, w: 0, h: 0 }\r\n },\r\n disableLazyLoad: true\r\n };\r\n if (this.props.data.product.result && this.props.data.productSpecificationData.result !== undefined) {\r\n fallbackImageUrl = getFallbackImageUrl(\r\n this.props.data.product.result.ItemId,\r\n this.props.context.actionContext.requestContext.apiSettings\r\n );\r\n }\r\n return (\r\n <>\r\n \r\n \r\n );\r\n };\r\n\r\n public _renderVideoPlayer = (name: string) => {\r\n return (\r\n <>\r\n {/* \r\n \r\n */}\r\n {name}\r\n \r\n );\r\n };\r\n\r\n // tslint:disable-next-line: cyclomatic-complexity\r\n public render(): JSX.Element | null {\r\n const SpotlightText = this.props.config.spotlightKey;\r\n const features: IMfrmProductDescriptionContent[] = [];\r\n let mediaContent;\r\n let customDescription;\r\n let noContent = true;\r\n let forceDisplay = false;\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 === SpotlightText)];\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 && features.length < 8) {\r\n const iconText = item?.replace(/ /g, '_').toLowerCase();\r\n const obj = {\r\n label: item,\r\n icon: iconText\r\n };\r\n features.push(obj);\r\n noContent = false;\r\n }\r\n });\r\n }\r\n\r\n const attributeKey = attributes[attributes.findIndex(obj => obj.Name === 'enhanced_content')];\r\n const enhancedContent = attributeKey?.TextValue ? attributeKey?.TextValue : undefined;\r\n if (enhancedContent !== undefined) {\r\n const enhancedContentSplit = enhancedContent && enhancedContent.split(' | ');\r\n if (enhancedContentSplit && enhancedContentSplit.length > 0) {\r\n if (enhancedContentSplit[0] === 'interactable') {\r\n mediaContent = enhancedContentSplit[1];\r\n } else if (enhancedContentSplit[0] === 'image') {\r\n if (enhancedContentSplit[1].includes('url=') === true) {\r\n const explodeUrl = enhancedContentSplit[1].split('=');\r\n mediaContent = this._renderImageHost(\r\n `${this.props.context.request.apiSettings.baseImageUrl}Products/${explodeUrl[1]}`\r\n );\r\n forceDisplay = true;\r\n } else {\r\n mediaContent = enhancedContentSplit[1];\r\n }\r\n } else if (enhancedContentSplit[0] === 'video') {\r\n if (enhancedContentSplit[1].includes('url=') === true) {\r\n // when cms hosted video will be available we need to add logic here\r\n // const explodeUrl = enhancedContentSplit[1].split('=');\r\n } else {\r\n mediaContent = enhancedContentSplit[1];\r\n }\r\n }\r\n }\r\n }\r\n\r\n const customDescriptionAttributeKey = attributes[attributes.findIndex(obj => obj.Name === 'customDescription')];\r\n customDescription = customDescriptionAttributeKey?.TextValue ? customDescriptionAttributeKey?.TextValue : undefined;\r\n if (mediaContent !== undefined || customDescription !== undefined) {\r\n noContent = false;\r\n const enhancedContentSplit = customDescription && customDescription.split(' | ');\r\n if (enhancedContentSplit && enhancedContentSplit.length > 0) {\r\n customDescription = enhancedContentSplit[0];\r\n mediaContent = enhancedContentSplit[1] !== undefined ? enhancedContentSplit[1] : mediaContent;\r\n }\r\n }\r\n }\r\n\r\n const viewProps = {\r\n ...this.props,\r\n spotlightTitle: features,\r\n mediaContent: mediaContent,\r\n customText: customDescription,\r\n state: this.state,\r\n toggle: this._toggle,\r\n noContent: noContent,\r\n forceDisplay: forceDisplay\r\n };\r\n return this.props.renderView(viewProps);\r\n }\r\n}\r\n\r\nexport default MfrmProductDescription;\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 MsDyn365, { IImageSettings, Image, RichTextComponent } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport { IMfrmProductDescriptionViewProps } from './mfrm-product-description';\r\n\r\n// tslint:disable-next-line: cyclomatic-complexity\r\nexport default (props: IMfrmProductDescriptionViewProps) => {\r\n const imageURL = props.context.request.apiSettings.baseImageUrl;\r\n const slashExist = imageURL.endsWith('/');\r\n const ImageBaseUrl = slashExist ? imageURL.slice(0, -1) : imageURL;\r\n const spotlightIconSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=48&h=48&m=1`, w: 48, h: 48 },\r\n lg: { q: `w=48&h=48&m=1`, w: 48, h: 48 },\r\n xl: { q: `w=48&h=48&m=1`, w: 48, h: 48 }\r\n },\r\n lazyload: false\r\n };\r\n return (\r\n
\r\n {props.spotlightTitle && props.spotlightTitle.length > 0 && (\r\n
\r\n

{props.config.heading && props.config.heading.text}

\r\n
    \r\n {props.spotlightTitle.map(i => {\r\n const fallbackImageUrl = `${ImageBaseUrl}default_spotlight.png`;\r\n return (\r\n
  • \r\n {i.icon && (\r\n \r\n )}\r\n {i.label}\r\n
  • \r\n );\r\n })}\r\n
\r\n
\r\n )}\r\n {props.noContent ? (\r\n props.resources.noDataText\r\n ) : (\r\n
\r\n {props.mediaContent && props.forceDisplay ? (\r\n
{props.mediaContent}
\r\n ) : (\r\n \r\n )}\r\n\r\n {props.customText && (\r\n
\r\n {MsDyn365.isBrowser && props.state.isMobileTablet &&\r\n 350 ? `${props.customText.slice(0, 350)}... ` : props.customText} />\r\n }\r\n {MsDyn365.isBrowser && props.state.isMobileTablet && props.customText && props.customText.length > 350 ?\r\n \r\n {props.state.isOpen ? props.resources.seeLessText : props.resources.seeMoreText}\r\n : <>\r\n }\r\n {(!MsDyn365.isBrowser || props.state.isDesktop) &&\r\n \r\n }\r\n
\r\n )}\r\n
\r\n )}\r\n
\r\n );\r\n};\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-description'] = {\n c: () => require('partner/modules/mfrm-product-description/mfrm-product-description.tsx'),\n $type: 'contentModule',\n da: [{name:'product', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant', 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-description',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-product-description'\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 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-description|mfrm-product-description'] = {\n c: () => require('partner/modules/mfrm-product-description/mfrm-product-description.view.tsx'),\n cn: '__local__-__local__-mfrm-product-description'\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","MfrmProductDescription","React","constructor","props","super","_toggle","this","setState","isOpen","state","_renderImageHost","url","fallbackImageUrl","defaultImageSettings","viewports","q","h","disableLazyLoad","data","product","result","undefined","productSpecificationData","getFallbackImageUrl","ItemId","actionContext","requestContext","apiSettings","Image","src","imageSettings","altText","loadFailureBehavior","fallBackSrc","_renderVideoPlayer","name","isDesktop","isMobileTablet","componentDidMount","viewPort","_getViewPort","render","SpotlightText","config","spotlightKey","features","mediaContent","customDescription","noContent","forceDisplay","attributes","spotlightAttributeKey","findIndex","obj","Name","spotlightValues","TextValue","spotlightValuesArr","split","length","map","item","index","attribute","BooleanValue","iconText","replace","toLowerCase","label","icon","push","attributeKey","enhancedContent","enhancedContentSplit","includes","explodeUrl","baseImageUrl","customDescriptionAttributeKey","viewProps","_objectSpread","spotlightTitle","customText","toggle","renderView","imageURL","ImageBaseUrl","endsWith","slice","spotlightIconSettings","xl","lazyload","className","heading","text","i","key","resources","noDataText","RichTextComponent","onClick","role","href","seeLessText","seeMoreText","binding","modules","dataActions","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","c","require","$type","da","path","runOn","iNM","ns","n","p","pdp","__bindings__","viewDictionary","cn","AttributesForSelectedVariantInput","productId","channelId","selectedProduct","catalogId","getCacheKey","getCacheObjectType","dataCacheType","createAttributesForSelectedVariantInput","inputData","getSelectedProductIdFromActionInput","getCatalogId","async","getAttributesForSelectedVariantAction","input","Promise","resolve","then","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","ProductsDataActions","callerContext","RecordId","attributeValues","channelInventoryConfiguration","StoreOperationsDataActions","getAttributeValuesByConfiguration","catch","error","trace","message","createObservableDataAction","action","module","exports","ReactDOM"],"sourceRoot":""}