{"version":3,"sources":["component/ProductInformation/ProductInformation.component.js","../node_modules/@scandipwa/scandipwa/src/component/ProductInformation/index.js","../node_modules/@scandipwa/scandipwa/src/component/ProductInformation/ProductInformation.component.js"],"names":["html","this","props","product","short_description","mix","block","elem","content","heading","areDetailsLoaded","__","renderShortDescription","description","short_description_html","isHTMLWhiteSpaceOrUndefined","label","wrapperMix","renderContent","SourceProductInformation","ProductInformation","length","cleanDescription","replace","itemProp","renderDescription","htmlString","trim","document","DOMParser","parseFromString","body","children","Array","from","filter","element","innerText","nodeName","PureComponent"],"mappings":"2MAOO,iIAAP,OAAO,mDACH,WACI,IAE6BA,EAEzBC,KAAKC,MAHLC,QACIC,kBAAqBJ,KAI7B,kBACSK,IAAK,CAAEC,MAAO,qBAAsBC,KAAM,qBADnD,IAES,IAFT,CAEcC,QAASR,OAV/B,2BAeI,WACI,IACMS,EADuBR,KAAKC,MAA1BQ,iBAC2BC,EAAG,iBAAmB,GAEzD,kBACSF,QAASA,EAASJ,IAAK,CAAEC,MAAO,qBAAsBC,KAAM,YADrE,UAEYD,MAAM,qBAAqBC,KAAK,UAC/BE,GAEJR,KAAKW,4BAxBtB,oBA6BI,WACI,MAMIX,KAAKC,MALLQ,EADJ,EACIA,iBADJ,IAEIP,QAFJ,IAGQU,YAAeb,GAHvB,aAGgC,GAHhC,GAGuBA,KACYc,EAJnC,EAIQV,kBAAqBJ,KAI7B,OACIC,KAAKc,4BAA4Bf,IACjCC,KAAKc,4BAA4BD,IACjCJ,EAEO,KAGX,IACK,IADL,CAEQM,MAAM,sBACNX,IAAK,CAAEC,MAAO,sBACdW,WAAY,CAAEX,MAAO,qBAAsBC,KAAM,YAEhDN,KAAKiB,qBApDtB,EAAO,CAAP,aAAwCC,MAAxC,iEA0DeC,Q,8ECjEf,gE,qMCuBO,iIAAP,OAAO,8CAMH,WACI,MAAoDnB,KAAKC,MAAjDC,QAAWU,YAAeb,GAAlC,aAA2C,GAA3C,GAAkCA,KAElC,IAAKA,EACD,WACK,IADL,CACqBqB,OAAO,SAIhC,IAAMC,EAAmBtB,EAAKuB,QAAQ,kBAAmB,IAEzD,kBACSjB,MAAM,qBAAqBC,KAAK,eADzC,YAEciB,SAAS,cAAchB,QAAUc,IAF/C,IAGS,IAHT,CAGcd,QAAUR,OApBhC,2BAyBI,WACI,IACMS,EADuBR,KAAKC,MAA1BQ,iBAC2BC,EAAG,SAAW,GAEjD,WACK,UADL,CAGMF,QAAUA,EACVJ,IAAM,CAAEC,MAAO,qBAAsBC,KAAM,YAEvCN,KAAKwB,uBAnCvB,yCAwCI,SAA4BC,GACxB,IAAKA,GAAoC,KAAtBA,EAAWC,OAC1B,OAAO,EAIX,IACMC,GADS,IAAIC,WACKC,gBAAgBJ,EAAWC,OAAQ,aAG3D,OAAsC,IAAlCC,EAASG,KAAKC,SAASX,QASW,IAJVY,MAAMC,KAAKN,EAASG,KAAKC,UAAUG,QAC3D,SAACC,GAAD,MAAmC,KAAtBA,EAAQC,WAAyC,QAArBD,EAAQE,YAG1BjB,SA3DnC,oBA8DI,WACI,MAKIpB,KAAKC,MAJLQ,EADJ,EACIA,iBADJ,IAEIP,QACIU,YAAeb,GAHvB,aAGgC,GAHhC,GAGuBA,KAIvB,OAAIC,KAAKc,4BAA4Bf,IAASU,EACnC,KAGX,IACK,IADL,CAEMM,MAAM,sBACNX,IAAM,CAAEC,MAAO,sBACfW,WAAa,CAAEX,MAAO,qBAAsBC,KAAM,YAE9CN,KAAKiB,qBAhFvB,EAAO,CAAP,aAAwCqB,kBAAxC,4C","file":"static/js/product-info.c0ac74d7.chunk.js","sourcesContent":["import ContentWrapper from 'Component/ContentWrapper';\nimport Html from 'Component/Html';\nimport { ProductInformation as SourceProductInformation } from 'SourceComponent/ProductInformation/ProductInformation.component';\n\nimport './ProductInformation.override.style';\n\n/** @namespace Pwa/Component/ProductInformation/Component/ProductInformation */\nexport class ProductInformation extends SourceProductInformation {\n renderShortDescription() {\n const {\n product: {\n short_description: { html },\n },\n } = this.props;\n\n return (\n
\n \n
\n );\n }\n\n renderContent() {\n const { areDetailsLoaded } = this.props;\n const heading = areDetailsLoaded ? __('About Product') : '';\n\n return (\n
\n

\n {heading}\n

\n {this.renderShortDescription()}\n
\n );\n }\n\n render() {\n const {\n areDetailsLoaded,\n product: {\n description: { html } = {},\n short_description: { html: short_description_html },\n },\n } = this.props;\n\n if (\n this.isHTMLWhiteSpaceOrUndefined(html) &&\n this.isHTMLWhiteSpaceOrUndefined(short_description_html) &&\n areDetailsLoaded\n ) {\n return null;\n }\n\n return (\n \n {this.renderContent()}\n \n );\n }\n}\n\nexport default ProductInformation;\n","/**\n * ScandiPWA - Progressive Web App for Magento\n *\n * Copyright © Scandiweb, Inc. All rights reserved.\n * See LICENSE for license details.\n *\n * @license OSL-3.0 (Open Software License (\"OSL\") v. 3.0)\n * @package scandipwa/base-theme\n * @link https://github.com/scandipwa/base-theme\n */\n\nexport { default } from './ProductInformation.component';\n","/**\n * ScandiPWA - Progressive Web App for Magento\n *\n * Copyright © Scandiweb, Inc. All rights reserved.\n * See LICENSE for license details.\n *\n * @license OSL-3.0 (Open Software License (\"OSL\") v. 3.0)\n * @package scandipwa/base-theme\n * @link https://github.com/scandipwa/base-theme\n */\n\nimport PropTypes from 'prop-types';\nimport { PureComponent } from 'react';\n\nimport ContentWrapper from 'Component/ContentWrapper';\nimport ExpandableContent from 'Component/ExpandableContent';\nimport Html from 'Component/Html';\nimport TextPlaceholder from 'Component/TextPlaceholder';\nimport { ProductType } from 'Type/ProductList.type';\n\nimport './ProductInformation.style';\n\n/** @namespace Component/ProductInformation/Component */\nexport class ProductInformation extends PureComponent {\n static propTypes = {\n product: ProductType.isRequired,\n areDetailsLoaded: PropTypes.bool.isRequired\n };\n\n renderDescription() {\n const { product: { description: { html } = {} } } = this.props;\n\n if (!html) {\n return (\n \n );\n }\n\n const cleanDescription = html.replace(/<\\/?[^>]+(>|$)/g, '');\n\n return (\n
\n \n \n
\n );\n }\n\n renderContent() {\n const { areDetailsLoaded } = this.props;\n const heading = areDetailsLoaded ? __('About') : '';\n\n return (\n \n { this.renderDescription() }\n \n );\n }\n\n isHTMLWhiteSpaceOrUndefined(htmlString) {\n if (!htmlString || htmlString.trim() === '') {\n return true;\n }\n\n // creates a DOM object from string\n const parser = new DOMParser();\n const document = parser.parseFromString(htmlString.trim(), 'text/html');\n\n // handles the case of plain text\n if (document.body.children.length === 0) {\n return false;\n }\n\n // check if at least one HTML element has content\n const elementsWithContent = Array.from(document.body.children).filter(\n (element) => element.innerText !== '' || element.nodeName === 'IMG'\n );\n\n return elementsWithContent.length === 0;\n }\n\n render() {\n const {\n areDetailsLoaded,\n product: {\n description: { html } = {}\n }\n } = this.props;\n\n if (this.isHTMLWhiteSpaceOrUndefined(html) && areDetailsLoaded) {\n return null;\n }\n\n return (\n \n { this.renderContent() }\n \n );\n }\n}\n\nexport default ProductInformation;\n"],"sourceRoot":""}