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vF,EAAMyF,WAIP,QAEVY,MAAK5I,MAAAA,IAKK,CAAEqJ,gBAAAA,EAAiBC,oCAJkBC,EAAAA,2BAAAA,+BAA0D,CAClGJ,cAAelJ,QAKtB2I,MAAKxI,IACKoJ,EAAAA,EAAAA,mCAAkCpJ,EAAOiJ,gBAAiBjJ,EAAOkJ,iCAE3EG,OAAOrH,IAEJ,MADAnC,EAAQyJ,MAAMtH,EAAMuH,SACd,IAAItC,MAAM,+DAI5B,SAAeuC,EAAAA,EAAAA,IAA2B,CACtCpC,GAAI,8EACJqC,OAAmCpB,EACnClG,MAAO6F,WC7HX0B,EAAOC,QAAUpK,cCAjBmK,EAAOC,QAAUC","sources":["webpack://mattressfirm/./src/modules/mfrm-warranty/mfrm-warranty.tsx?3ee0","webpack://mattressfirm/./src/modules/mfrm-warranty/mfrm-warranty.view.tsx?21d4","webpack://mattressfirm/./lib/mfrm-warranty/module-registration.js?c9ab","webpack://mattressfirm/./src/dataActions/get-attributes-for-selected-variant.ts?e4b6","webpack://mattressfirm/external var \"React\"?0d3b","webpack://mattressfirm/external var \"ReactDOM\"?853b"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\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 { Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport MsDyn365, { RichTextComponent, Text } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport { IMfrmWarrantyData } from './mfrm-warranty.data';\r\nimport { IMfrmWarrantyProps } from './mfrm-warranty.props.autogenerated';\r\n\r\nexport interface IMfrmWarrantyViewProps extends IMfrmWarrantyProps {\r\n warrantyData: React.ReactNode;\r\n}\r\n\r\nexport interface IState {\r\n showSeeMore: boolean;\r\n isCollapsed: boolean;\r\n warrantyText: string;\r\n}\r\n\r\nexport interface IResultData {\r\n AttributeValueId?: number;\r\n DataTypeValue?: number;\r\n Name?: string;\r\n RecordId?: number;\r\n TextValue?: string;\r\n}\r\n\r\n/**\r\n *\r\n * MfrmWarranty component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass MfrmWarranty extends React.PureComponent, IState> {\r\n private focusDiv: React.RefObject;\r\n constructor(props: IMfrmWarrantyProps) {\r\n super(props);\r\n this.state = {\r\n showSeeMore: false,\r\n isCollapsed: true,\r\n warrantyText: ''\r\n };\r\n this.focusDiv = React.createRef();\r\n }\r\n public render(): JSX.Element | null {\r\n const viewProps = {\r\n ...this.props,\r\n warrantyData: this._getWarrantyData()\r\n };\r\n return this.props.renderView(viewProps);\r\n }\r\n\r\n public componentDidMount() {\r\n if (this.props.config.getWarrantyFromPages) {\r\n void this._getWarrantyContent();\r\n }\r\n }\r\n\r\n private _getWarrantyContent = async () => {\r\n const { context, data: {\r\n productSpecificationData: { result }\r\n },\r\n config: { backendAttribute }\r\n } = this.props;\r\n const requestContext = context && context.request;\r\n const params = MsDyn365.isBrowser && window.location;\r\n const origin = params && params.origin === 'https://localhost:4000' ? params.origin : requestContext.url.requestUrl.origin;\r\n const resultWarrantyData = result\r\n ? result.find(obj => obj.Name && obj.Name.toLowerCase().trim() === backendAttribute.toLowerCase().trim())\r\n : undefined;\r\n const pageName = this._removeSpecialCharsAndDoubleSpaces(resultWarrantyData?.TextValue);\r\n try {\r\n const res = await Msdyn365.sendRequest(\r\n `${origin}/${pageName}`,\r\n 'get',\r\n null,\r\n { headers: {} }\r\n );\r\n // extracting only html data between main tag\r\n let warrantyHtml = res.data.split('
')[1].split('
')[0];\r\n // replacing title class with tab class\r\n warrantyHtml = warrantyHtml?.replace('ms-content-block__title', 'mfrm-tab-accordion__title');\r\n this.setState({\r\n warrantyText: warrantyHtml\r\n });\r\n } catch (error) {\r\n console.log('warrantyHtml error ==>', error);\r\n }\r\n };\r\n\r\n private _removeSpecialCharsAndDoubleSpaces = (input: String | undefined): String => {\r\n if (!input) { return \"\"; }\r\n return input?.replace(/[^\\w\\s]/gi, '').trim()?.replace(/\\s+/g, ' ')?.replace(/\\s/g, '-').toLowerCase();\r\n };\r\n private _getWarrantyData(): JSX.Element {\r\n const tabAccordionBaseClass = 'mfrm-tab-accordion';\r\n const warrantyTabClassName = this.state.showSeeMore\r\n ? `mfrm-tab-accordion__warranty-tab content-expanded`\r\n : 'mfrm-tab-accordion__warranty-tab';\r\n // if getWarrantyFromPages on, we will get warranty-content from pages\r\n if (this.props.config.getWarrantyFromPages) {\r\n if (this.state.warrantyText) {\r\n return (\r\n \r\n {this._getSeeMore(this.state.warrantyText)}\r\n \r\n );\r\n }\r\n return {this.props.resources.defaultContent};\r\n }\r\n\r\n const {\r\n data: {\r\n productSpecificationData: { result }\r\n },\r\n config: { backendAttribute, warrantyValues }\r\n } = this.props;\r\n const resultWarrantyData = result\r\n ? result.find(obj => obj.Name && obj.Name.toLowerCase().trim() === backendAttribute.toLowerCase().trim())\r\n : undefined;\r\n const selectedWarranty =\r\n (warrantyValues &&\r\n resultWarrantyData &&\r\n warrantyValues.find(\r\n warranty => warranty.warrantyName?.toLowerCase().trim() === resultWarrantyData.TextValue?.toLowerCase().trim()\r\n )) ||\r\n undefined;\r\n if (selectedWarranty) {\r\n const { warrantyTitle } = selectedWarranty;\r\n return (\r\n \r\n {warrantyTitle && warrantyTitle.text && (\r\n \r\n )}\r\n {this._getSeeMore(selectedWarranty.warrantyInformation as string)}\r\n \r\n );\r\n }\r\n return {this.props.resources.defaultContent};\r\n }\r\n\r\n private _toggleSeeMore = (): void => {\r\n this.setState({\r\n showSeeMore: !this.state.showSeeMore,\r\n isCollapsed: !this.state.isCollapsed\r\n });\r\n this.focusDiv.current?.scrollIntoView();\r\n MsDyn365.isBrowser && window.scroll(0, window.scrollY - 80);\r\n };\r\n\r\n private _getSeeMore(warrantyText: string): JSX.Element {\r\n const { showSeeMore, isCollapsed } = this.state;\r\n const {\r\n config: { seeMoreText, seeLessText, charactersCount }\r\n } = this.props;\r\n const text = warrantyText;\r\n const tabAccordionBaseClass = 'mfrm-tab-accordion';\r\n const regex = /(<([^>]+)>)/gi;\r\n const informationLength = text?.replace(regex, '').length;\r\n const entitiesSymbols = [\r\n '©',\r\n '®',\r\n '€',\r\n '™',\r\n '∅',\r\n '£',\r\n '°',\r\n '·',\r\n '–',\r\n '“',\r\n '”',\r\n '<',\r\n ' >',\r\n '‘',\r\n '’'\r\n ];\r\n\r\n if (charactersCount && informationLength > charactersCount) {\r\n let charactersLength = 0;\r\n let htmlStart = false;\r\n let lastIndex = 0;\r\n let entityStarted = false;\r\n let totalEntities = 0;\r\n\r\n for (let index = 0; index <= text.length; index++) {\r\n if (text[index] === '<' || htmlStart) {\r\n htmlStart = true;\r\n htmlStart = text[index] === '>' ? false : true;\r\n } else if (\r\n (text[index] === '&' && entitiesSymbols.find(entity => entity.includes(text[index] + text[index + 1]))) ||\r\n entityStarted\r\n ) {\r\n entityStarted = true;\r\n if (text[index] === ';') {\r\n totalEntities = totalEntities + 1;\r\n entityStarted = false;\r\n }\r\n } else if (text[index].charCodeAt(0) !== 9 && text[index].charCodeAt(0) !== 10) {\r\n charactersLength = charactersLength + 1;\r\n if (charactersLength === charactersCount) {\r\n lastIndex = index + 1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const totalText = lastIndex - totalEntities;\r\n\r\n return (\r\n \r\n {isCollapsed && (\r\n \r\n )}\r\n {!isCollapsed && }\r\n {\r\n \r\n {showSeeMore ? seeLessText : seeMoreText}\r\n \r\n }\r\n \r\n );\r\n } else {\r\n return ;\r\n }\r\n }\r\n}\r\n\r\nexport default MfrmWarranty;\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\nimport * as React from 'react';\r\nimport { IMfrmWarrantyViewProps } from './mfrm-warranty';\r\n\r\nexport default (props: IMfrmWarrantyViewProps) => {\r\n const { warrantyData } = props;\r\n return <>{warrantyData};\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-warranty'] = {\n c: () => require('partner/modules/mfrm-warranty/mfrm-warranty.tsx'),\n $type: 'contentModule',\n da: [{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-warranty',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-warranty'\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 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-warranty|mfrm-warranty'] = {\n c: () => require('partner/modules/mfrm-warranty/mfrm-warranty.view.tsx'),\n cn: '__local__-__local__-mfrm-warranty'\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":["MfrmWarranty","React","constructor","props","super","_getWarrantyContent","async","context","data","productSpecificationData","result","config","backendAttribute","this","requestContext","request","params","MsDyn365","isBrowser","window","location","origin","url","requestUrl","resultWarrantyData","find","obj","Name","toLowerCase","trim","undefined","pageName","_removeSpecialCharsAndDoubleSpaces","TextValue","_warrantyHtml","warrantyHtml","Msdyn365","headers","split","replace","setState","warrantyText","error","console","log","input","_input$replace$trim","_toggleSeeMore","_this$focusDiv$curren","showSeeMore","state","isCollapsed","focusDiv","current","scrollIntoView","scroll","scrollY","render","viewProps","_objectSpread","warrantyData","_getWarrantyData","renderView","componentDidMount","getWarrantyFromPages","warrantyTabClassName","Node","className","ref","_getSeeMore","resources","defaultContent","warrantyValues","selectedWarranty","warranty","_warranty$warrantyNam","_resultWarrantyData$T","warrantyName","warrantyTitle","text","Text","tag","warrantyInformation","seeMoreText","seeLessText","charactersCount","informationLength","length","entitiesSymbols","charactersLength","htmlStart","lastIndex","entityStarted","totalEntities","index","entity","includes","charCodeAt","totalText","RichTextComponent","substring","role","onClick","binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","__bindings__","viewDictionary","cn","AttributesForSelectedVariantInput","productId","channelId","selectedProduct","catalogId","getCacheKey","getCacheObjectType","dataCacheType","createAttributesForSelectedVariantInput","inputData","getSelectedProductIdFromActionInput","getCatalogId","apiSettings","getAttributesForSelectedVariantAction","Promise","resolve","then","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","ProductsDataActions","callerContext","RecordId","attributeValues","channelInventoryConfiguration","StoreOperationsDataActions","getAttributeValuesByConfiguration","catch","trace","message","createObservableDataAction","action","module","exports","ReactDOM"],"sourceRoot":""}