{"version":3,"sources":["webpack:///./cartridges/app_harmony/cartridge/client/default/js/widgets/product/HarmonyProductDetail.js"],"names":["ProductDetail","HarmonyProductDetail","init","scrollToBundledItems","bundledProductsSection","ref","get","focus","scrollWindowTo","updateProductView","product","Number","prefs","selectedQuantity","eventBus","emit","setPref","id","readyToOrder","renderRatingBadgeLong","renderBrandLabel","renderShipToErrorMsg","updateAddToCartButton","renderAddToCartButton","handleBackInStockNotification","renderQuantities","inputQuanity","getById","quantity","quantities","isQtyDisabled","availability","isOutOfStock","isEmptyPrice","render","value","minOrderQuantity","maxOrderQuantity","qtyStep","url","variationUrl","qtyUrl","quantityUrl","shipToRestrictedStates","productId","then","ratingBadgeLong","renderPrice","price","html","eachChild","widget","config","undefined","brandLabel","brand","shiptoerror","JSON","stringify","addToCart","pid","childProducts","productType","disableBtn","available","inStock","stock","isPreorder","disabledBtn","changeAttribute","selectWidget","selectedOptions","getSelectedOptions","selectedVariationElement","afterChangeAttribute","response","gtmData","gtmInfo","attr","position","data","itemAlreadyExistsInWishList","renderAvailability","alert","alerts","join","availabilityAlert","key","enableBackInStockNotification","show","hide","memberOnly"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;;;;;;AAKe,yEAAUA,aAAV,EAAyB;AACpC;;;;AAIA,QAAMC,oBAAN,SAAmCD,aAAnC,CAAiD;AAC7CE,QAAI,GAAG;AACH,YAAMA,IAAN;AACH;AAED;;;;;;AAKAC,wBAAoB,GAAG;AACnB,UAAIC,sBAAsB,GAAG,KAAKC,GAAL,CAAS,wBAAT,EAAmCC,GAAnC,CAAuC,CAAvC,CAA7B;AACAF,4BAAsB,CAACG,KAAvB;AACAC,mFAAc,CAACJ,sBAAD,CAAd;AACH;AAED;;;;;;;AAKAK,qBAAiB,CAACC,OAAD,EAAU;AACvB,YAAMD,iBAAN,CAAwBC,OAAxB;;AAEA,UAAIC,MAAM,CAAC,KAAKC,KAAL,GAAaC,gBAAd,CAAN,KAA0CH,OAAO,C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,IAAjC;AACA,aAAKrF,GAAL,CAAS,yBAAT,EAAoCoF,IAApC;AACH;AACJ;;AA3P4C;;AA8PjD,SAAOxF,oBAAP;AACH,C","file":"2.bundle.js","sourcesContent":["import { scrollWindowTo } from 'widgets/toolbox/scroll';\nimport { getCookie } from 'widgets/toolbox/cookie';\n\n/**\n * @description Base HarmonyProductDetail implementation\n * @param {ProductDetail} ProductDetail widget for extending\n * @returns {typeof HarmonyProductDetail} HarmonyProductDetail class\n */\nexport default function (ProductDetail) {\n /**\n * @class HarmonyProductDetail\n * @augments ProductDetail\n */\n class HarmonyProductDetail extends ProductDetail {\n init() {\n super.init();\n }\n\n /**\n * @description Scroll to bundled product section on PDP\n * @returns {void}\n */\n\n scrollToBundledItems() {\n var bundledProductsSection = this.ref('bundledProductsSection').get(0);\n bundledProductsSection.focus();\n scrollWindowTo(bundledProductsSection);\n }\n\n /**\n * @description Update Product View\n * @param {any} product productModel\n * @returns {void}\n */\n updateProductView(product) {\n super.updateProductView(product);\n\n if (Number(this.prefs().selectedQuantity) === product.selectedQuantity) {\n this.eventBus().emit('monetate.variation.select', product);\n }\n\n this.setPref('selectedQuantity', product.selectedQuantity);\n this.setPref('currentProductID', product.id);\n this.setPref('readyToOrder', product.readyToOrder);\n\n this.renderRatingBadgeLong(product);\n this.renderBrandLabel(product);\n this.renderShipToErrorMsg(product);\n this.updateAddToCartButton(product);\n this.renderAddToCartButton(product);\n this.handleBackInStockNotification(product);\n }\n\n // /**\n // * @description Update social links. The function was overloaded. It is empty, because the social links aren't used.\n // * @param {object} product Product object\n // * @returns {void}\n // */\n // updateSocialLinks() { }\n\n /**\n * @description Render Quantities\n * @param {object} product\n */\n renderQuantities(product) {\n const inputQuanity = this.getById('input-quantity', (quantity) => quantity);\n\n if (inputQuanity && product.quantities) {\n var isQtyDisabled = ((product.availability && product.availability.isOutOfStock) || product.isEmptyPrice);\n\n inputQuanity.render('template', {\n value: product.selectedQuantity,\n minOrderQuantity: product.minOrderQuantity,\n maxOrderQuantity: product.maxOrderQuantity,\n qtyStep: product.qtyStep,\n url: product.variationUrl,\n qtyUrl: product.quantityUrl,\n isQtyDisabled: isQtyDisabled,\n shipToRestrictedStates: product.shipToRestrictedStates,\n productId: product.id\n }).then(() => this.eventBus().emit('shipto.restrictions.updated.quantity'));\n\n // trigger event if 'isQtyDisabled' equals 'true'\n if (isQtyDisabled) {\n this.eventBus().emit('product.qty.disabled', isQtyDisabled);\n }\n } else {\n super.renderQuantities(product);\n }\n }\n\n /**\n * @description Render Rating Badge Long\n * @param {object} product\n */\n renderRatingBadgeLong(product) {\n this.getById('ratingBadgeLong', (ratingBadgeLong) => {\n ratingBadgeLong.render('template', { ratingBadgeLong: product.ratingBadgeLong });\n });\n }\n\n /**\n * @description Render product price\n * @param {object} product Product object\n * @returns {void}\n */\n renderPrice(product) {\n if (product.price && product.price.html) {\n this.eachChild(widget => {\n if (widget.config && widget.config.id === 'priceBlock') {\n widget.render('template', [], undefined, product.price.html);\n }\n });\n }\n }\n\n /**\n * @description Render Brand Label\n * @param {object} product\n */\n renderBrandLabel(product) {\n this.getById('brandLabel', (brandLabel) => {\n brandLabel.render('template', {\n brand: product.brand,\n brandLabel: product.brandLabel\n });\n });\n }\n\n /**\n * @description Render Ship To Error Msg\n * @param {object} product\n */\n renderShipToErrorMsg(product) {\n this.getById('shiptoerror', (shiptoerror) => {\n shiptoerror.render('template', { shipToRestrictedStates: JSON.stringify(product.shipToRestrictedStates) })\n .then(() => this.eventBus().emit('shipto.restrictions.updated.error.msg'));\n });\n }\n\n /**\n * @description Render Add to cart button\n * @param {object} product\n */\n renderAddToCartButton(product) {\n this.getById('addToCart', (addToCart) => {\n addToCart.render('template', {\n pid: product.id,\n childProducts: (product.productType === 'bundle' ? JSON.stringify(product.childProducts) : null),\n shipToRestrictedStates: JSON.stringify(product.shipToRestrictedStates),\n disableBtn: ((!product.available && product.availability\n && product.availability.isOutOfStock) || product.isEmptyPrice),\n inStock: (product.availability && product.availability.stock ? product.availability.stock : null),\n isOutOfStock: (!product.available && product.availability && product.availability.isOutOfStock),\n isPreorder: product.availability && product.availability.isPreorder\n })\n .then(() => {\n this.getById('product_disabledbtn', (disabledBtn) => {\n disabledBtn.render('template', { pid: product.id })\n .then(() => this.eventBus().emit('shipto.restrictions.updated.addtocart'));\n });\n });\n });\n }\n\n /**\n * @description widget triggered event\n * Saves `selectWidget.id` into a property for further global notifications etc.\n * Later, when triggering event, `selectWidget.id` will be analised in order to send with event correct data.\n * @param {inputSelect} selectWidget widget\n * @returns {void}\n */\n changeAttribute(selectWidget) {\n super.changeAttribute(selectWidget);\n const selectedOptions = selectWidget.getSelectedOptions();\n this.selectedVariationElement = selectedOptions;\n }\n\n /**\n * @description After change attrigute handler\n * @param {object} response response object\n * @returns {void}\n */\n afterChangeAttribute(response) {\n super.afterChangeAttribute(response);\n const gtmData = response.product.gtmInfo;\n if (this.selectedVariationElement.attr('name') !== 'quantity') {\n if (gtmData) {\n gtmData.position = this.selectedVariationElement.data('productpreviousposition');\n this.eventBus().emit('product.variation.click', gtmData, this.selectedVariationElement);\n }\n }\n\n this.eventBus().emit('update.wishlist.state', response.product.itemAlreadyExistsInWishList);\n }\n\n /**\n * @description Render product availability\n * @param {object} product Product object\n * @returns {void}\n */\n renderAvailability(product) {\n super.renderAvailability(product);\n\n let alert = '';\n\n if (product.availability && product.availability.alerts) {\n alert = product.availability.alerts.join('');\n }\n\n this.getById('availabilityAlert', (availabilityAlert) => {\n availabilityAlert.render('template', {\n alert: alert\n }, availabilityAlert.ref('container'));\n });\n }\n\n /**\n * @description Sets preference to the data-attribute properties and widget properties\n * to store widget preference state.\n * @param {string} key - preference key\n * @param {any} value - preference value to set\n */\n setPref(key, value) {\n this.ref('self').data(key, value);\n\n this.config[key] = value;\n }\n\n /**\n * @description Handle back in stock notification\n * @param {object} product - product\n * @returns {void}\n */\n handleBackInStockNotification(product) {\n if (!product.enableBackInStockNotification) {\n this.ref('inStockActions').show();\n this.ref('outOfStockActions').hide();\n\n return;\n }\n\n if (product.availability && product.availability.isOutOfStock) {\n this.ref('inStockActions').hide();\n this.ref('outOfStockActions').show();\n } else {\n this.ref('inStockActions').show();\n this.ref('outOfStockActions').hide();\n }\n }\n\n /**\n * @description Update Add To Cart CTA for member products\n * @param {object} product - product\n * @returns {void}\n */\n updateAddToCartButton(product) {\n if (product.memberOnly) {\n this.ref('nonMemberProductActions').hide();\n this.ref('memberProductActions').show();\n } else {\n this.ref('memberProductActions').hide();\n this.ref('nonMemberProductActions').show();\n }\n }\n }\n\n return HarmonyProductDetail;\n}\n"],"sourceRoot":""}