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AmE,eAAA,CAAAC,KAAA,MAAAxC,UAAA,MAAAE,cAAA,OAAAA,cAAA,MAAAF,UAAA,CAAAe,MAAA,OAAAb,cAAA,qBAAA7B,EAAAsC,MAAA,CAAAC,WAAA,OAAAd,QAAA,CAAAiB,MAAA,IAAA3C,CAAAA,EAAAmE,eAAA,CAAAE,aAAA,MAAA3C,QAAA,MAAAC,YAAA,OAAAA,YAAA,MAAAD,QAAA,CAAAiB,MAAA,OAAAhB,YAAA,IAAA3B,CAAA,KAAAA,CAAA,aAAAM,EAAAN,CAAA,MAAAC,EAAAD,EAAAmE,eAAA,KAAAjE,EAAAD,EAAAqE,MAAA,CAAA/D,EAAA,IAAAgB,EAAA,CAAAyB,SAAAhD,EAAAgD,QAAA,CAAAvB,QAAAvB,CAAA,GAAAqE,iBAAA,EAAAJ,gBAAAlE,CAAA,EAAAD,EAAAmD,eAAA,CAAAnD,EAAAoD,WAAA,WAAAtC,EAAA4C,GAAA,SAAAT,UAAA,0BAAAuB,MAAA,CAAAxE,EAAAiD,SAAA,CAAAjD,EAAAiD,SAAA,KAAAW,SAAArD,CAAA","sources":["webpack://_N_E/./adapters/helpers/ProductLegacyBlock.js","webpack://_N_E/./components/ProductLegacyBody/ProductLegacyBody.js","webpack://_N_E/<anon>"],"sourcesContent":["import React, {Fragment} from 'react'\nimport componentFactory from '../../components/ComponentFactory';\nimport { customSuperJsonParse, customSuperJsonStringify } from './Utils';\n\nclass ProductLegacyBlock {\n\n    constructor(props) {\n        this.props = props;\n        this.product = props.product;\n        this.contents = props.contents || this.product?.contents || [];\n        this.contentIndex = props.contentIndex || 0;\n        this.promotions = props.promotions || this.product?.relatedPromotions || [];\n        this.promotionIndex = props.promotionIndex || 0;\n    }\n\n    renderBlock(moduleClass, attributes, moduleBody) {\n        const moduleDefinition = componentFactory.getModule(moduleClass);\n        if (moduleDefinition) {\n            const module = React.createElement(moduleDefinition, attributes, moduleBody);\n            return module;\n        } else {\n            console.info('Unsupported module type : ' + moduleClass);\n        }\n    }\n\n    renderBlockFromDocument(extraAttributes, onClickCallback, customEvent, index) {\n        const document = this.getDocument();\n        if (document && document.fields && document.fields.contentType) {\n            let contentType = document.fields.contentType;\n            let blockName = document.fields.name;\n            let className = document.fields.classNames;\n\n            let attributes = {\n                name: blockName,\n                document: document,\n                className: className,\n                onClickCallback,\n                customEvent,\n                key: blockName,\n                index,\n                ...extraAttributes\n            };\n\n            return this.renderBlock(contentType, attributes, null);\n\n        } else {\n            console.error('Unsupported block is currently assign to page:' + this.props.page.fields.name);\n        }\n    }\n\n    /**\n     * Render the modules assigned to the page.\n     * @returns {*}\n     */\n    renderChildBlocks(extraAttributes, onClickCallback, customEvent) {\n        const doc = this.getDocument();\n        return ((doc. fields && doc.fields.blocks) ?\n                <Fragment>\n                    { doc.fields.blocks.map((child, index) => {\n                        if(this.isRenderable(child)) {\n                            let extraAttributesClone = customSuperJsonParse(customSuperJsonStringify(extraAttributes));\n                            let currentExtraAttributes = this.reassignExtraAttributes(extraAttributesClone, child);\n\n                            const props = {\n                                document: child,\n                                product: this.product,\n                                contents:this.contents,\n                                contentIndex: this.contentIndex,\n                                promotions:this.promotions,\n                                promotionIndex: this.promotionIndex\n                            };\n\n                            return new ProductLegacyBlock(props)\n                                .renderBlockFromDocument(currentExtraAttributes, onClickCallback, customEvent, index)\n                        }\n                    })}\n                </Fragment>\n                :\n                null\n        );\n    }\n\n    getDocument() {\n        let doc = this.props.document;\n\n        if (doc == null) {\n            doc = this.props;\n        }\n\n        if (!doc) {\n            doc = {};\n        }\n\n        return doc;\n    }\n\n    isRenderable(document) {\n        if(document.fields.contentType == 'promoBlock' ){\n            return (this.promotionIndex < this.promotions.length);\n        } else if(document.fields.contentType == 'richTextBlock') {\n            return (this.contentIndex < this.contents.length);\n        } else {\n            return true;\n        }\n    }\n\n    reassignExtraAttributes(extraAttributes, document) {\n        if(document.fields.contentType == 'promoBlock' && this.promotions.length > 0){\n            extraAttributes['extraAttributes']['promo'] = this.promotions[this.promotionIndex];\n            if(this.promotionIndex < this.promotions.length) {\n                this.promotionIndex++;\n            }\n        }\n\n        if(document.fields.contentType == 'richTextBlock' && this.contents.length > 0){\n            extraAttributes['extraAttributes']['richTextBlock'] = this.contents[this.contentIndex];\n            if(this.contentIndex < this.contents.length) {\n                this.contentIndex++;\n            }\n        }\n        return extraAttributes;\n    }\n}\n\nexport default ProductLegacyBlock","import React from 'react';\nimport PropTypes from 'prop-types';\nimport ProductLegacyBlock from '../../adapters/helpers/ProductLegacyBlock';\n\nexport default function ProductLegacyBody(props) {\n    const extraAttributes = props.extraAttributes || {};\n    const product = extraAttributes.entity;\n\n    const productLegacyBlock = new ProductLegacyBlock({document: props.document, product });\n\n    const children = productLegacyBlock.renderChildBlocks({ extraAttributes }, props.onClickCallback, props.customEvent);\n\n    return (\n        <div className={`ob-product-legacy-body ${props.className ? props.className : ''}`}>\n            {children}\n        </div>\n    );\n}\n\nProductLegacyBody.propTypes = {\n    className: PropTypes.string,\n    extraAttributes: PropTypes.object,\n    document: PropTypes.object,\n    onClickCallback:  PropTypes.func,\n    customEvent: PropTypes.object\n};\n","\"use strict\";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6632],{6632:function(t,e,n){n.r(e),n.d(e,{default:function(){return f}});var o=n(67294),r=n(930),s=n.n(r),i=n(33227),c=n.n(i),l=n(88361),u=n.n(l),d=n(93613),p=n(8996),a=n(85893);function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}var m=function(){function t(e){var n,o;c()(this,t),this.props=e,this.product=e.product,this.contents=e.contents||(null==(n=this.product)?void 0:n.contents)||[],this.contentIndex=e.contentIndex||0,this.promotions=e.promotions||(null==(o=this.product)?void 0:o.relatedPromotions)||[],this.promotionIndex=e.promotionIndex||0}return u()(t,[{key:\"renderBlock\",value:function(t,e,n){var r=d.Z.getModule(t);if(r)return o.createElement(r,e,n);console.info(\"Unsupported module type : \"+t)}},{key:\"renderBlockFromDocument\",value:function(t,e,n,o){var r=this.getDocument();if(r&&r.fields&&r.fields.contentType){var i=r.fields.contentType,c=r.fields.name,l=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){s()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({name:c,document:r,className:r.fields.classNames,onClickCallback:e,customEvent:n,key:c,index:o},t);return this.renderBlock(i,l,null)}console.error(\"Unsupported block is currently assign to page:\"+this.props.page.fields.name)}},{key:\"renderChildBlocks\",value:function(e,n,r){var s=this,i=this.getDocument();return i.fields&&i.fields.blocks?(0,a.jsx)(o.Fragment,{children:i.fields.blocks.map((function(o,i){if(s.isRenderable(o)){var c=(0,p.Cp)((0,p.hD)(e)),l=s.reassignExtraAttributes(c,o);return new t({document:o,product:s.product,contents:s.contents,contentIndex:s.contentIndex,promotions:s.promotions,promotionIndex:s.promotionIndex}).renderBlockFromDocument(l,n,r,i)}}))}):null}},{key:\"getDocument\",value:function(){var t=this.props.document;return null==t&&(t=this.props),t||(t={}),t}},{key:\"isRenderable\",value:function(t){return\"promoBlock\"==t.fields.contentType?this.promotionIndex<this.promotions.length:\"richTextBlock\"!=t.fields.contentType||this.contentIndex<this.contents.length}},{key:\"reassignExtraAttributes\",value:function(t,e){return\"promoBlock\"==e.fields.contentType&&this.promotions.length>0&&(t.extraAttributes.promo=this.promotions[this.promotionIndex],this.promotionIndex<this.promotions.length&&this.promotionIndex++),\"richTextBlock\"==e.fields.contentType&&this.contents.length>0&&(t.extraAttributes.richTextBlock=this.contents[this.contentIndex],this.contentIndex<this.contents.length&&this.contentIndex++),t}}]),t}();function f(t){var e=t.extraAttributes||{},n=e.entity,o=new m({document:t.document,product:n}).renderChildBlocks({extraAttributes:e},t.onClickCallback,t.customEvent);return(0,a.jsx)(\"div\",{className:\"ob-product-legacy-body \".concat(t.className?t.className:\"\"),children:o})}}}]);"],"names":["self","webpackChunk_N_E","push","t","e","n","r","d","default","f","o","s","i","c","l","u","p","a","h","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","apply","m","props","product","contents","contentIndex","promotions","relatedPromotions","promotionIndex","key","value","Z","getModule","createElement","console","info","getDocument","fields","contentType","name","arguments","length","forEach","getOwnPropertyDescriptors","defineProperties","defineProperty","document","className","classNames","onClickCallback","customEvent","index","renderBlock","error","page","blocks","jsx","Fragment","children","map","isRenderable","Cp","hD","reassignExtraAttributes","renderBlockFromDocument","extraAttributes","promo","richTextBlock","entity","renderChildBlocks","concat"],"sourceRoot":""}