{"version":3,"sources":["webpack:///./cartridges/app_accelerator_core/cartridge/client/default/js/product/bonusProducts.js","webpack:///./cartridges/app_accelerator_core/cartridge/client/default/js/product/caseRefills.js","webpack:///./cartridges/app_rna_core/cartridge/client/default/js/product/addToCart.js"],"names":["parseHtml","html","$html","$","append","parseHTML","body","find","footer","children","chooseBonusProducts","data","bonusUrl","bonusChoiceRuleBased","showProductsUrlRuleBased","showProductsUrlListBased","dialog","url","options","modalID","selectBonusProduct","document","on","$choiceOfBonusProduct","parents","pid","maxPids","submittedQty","parseInt","val","totalQty","optionID","valueId","each","selectedBonusProductHtml","removeClass","addClass","removeBonusProduct","$selected","count","remove","length","enableBonusProductSelection","e","response","$productContainer","attr","product","readyToOrder","available","id","showMoreBonusProducts","spinner","start","ajax","method","success","parsedHtml","stop","error","addBonusProductsToCart","$readyToOrderBonusProducts","queryString","pidsObject","bonusProducts","qtyOption","option","optionId","productId","selectedValueId","push","qty","JSON","stringify","progress","errorMessage","modal","msgSuccess","setTimeout","location","reload","_modalCreatedCallback","selRefills","refillSels","querySelectorAll","refillOpts","forEach","call","refill","dataset","selRefillid","refillOpt","indexOf","value","checked","_addRefillElementBlock","container","querySelector","refillTemplate","firstElementChild","cloneNode","productContainer","src","productThumbnail","textContent","productName","reference","appendChild","currentItem","addEventListener","parentNode","_handleAddToCartButtonStatus","_recalculateBundlePrice","addToCartBtn","hidden","disabled","classList","contains","add","productData","formData","getAttribute","pidsArr","_updatePrice","bundlePrice","priceObj","priceContainer","titleSpan","priceOriginalSpan","priceSalesSpan","priceSalesSpanContent","showStartingFrom","sales","setAttribute","decimalPrice","innerHTML","formatted","_showSelectedRefills","selectedRefills","parse","selRefill","refillsSetup","addRefillBtn","subscribe","type","callback","modalClass","keepAlive","_getOptionValueID","optionsArray","isProductSellable","sellable","hasOwnProperty","web","_handleApplePay","applePayButton","addToCartContainer","createElWithAttrs","class","sku","handlePostCartUpdate","miniCart","quantityTotal","isProductUpdate","trigger","test","navigator","userAgent","window","innerWidth","configuratorType","URLSearchParams","search","get","modules","tracking","init","trackEvent","trackObject","asyncURL","SFRA","Urls","GTMEventView","asyncParams","setProductData","pidsObj","quantity","pliUUID","text","concat","cart","items","prop","newBonusDiscountLineItem","Object","keys","updateCart","textNone","messageNone","handleCartAdd","currentContext","arguments","undefined","productUtils","productType","childProducts","addToCartUrl","cartAddProduct","uuid","allowAddToCart","selectedOptionValueId","bind","hideLoader","updateAddToCart","isDisabled","isMercury","currentEl","size","variationAttributes","selectedValue","defaultStrapOption","i","values","unavailable","availability","totalStock","isPriceUnderThreshold","requestPrice","isPlpStockAvailabilityStatus","applepayBtn","isCaseProduct","price","closest","isDiableSizeSelector","setupAddToCart","addToCartButtons","addToCartButtonsSizeSelected","currentBtn","getQueryStringParams","selectSizeEle","animate","scrollTop","offset","top","height"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAa;;AAEkC;AACI;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAASA,CAACC,IAAI,EAAE;EACrB,IAAIC,KAAK,GAAGC,CAAC,CAAC,OAAO,CAAC,CAACC,MAAM,CAACD,CAAC,CAACE,SAAS,CAACJ,IAAI,CAAC,CAAC;EAEhD,OAAO;IACHK,IAAI,EAAEJ,KAAK,CAACK,IAAI,CAAC,0BAA0B,CAAC;IAC5CC,MAAM,EAAEN,KAAK,CAACK,IAAI,CAAC,eAAe,CAAC,CAACE,QAAQ,CAAC;EACjD,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,IAAI,EAAE;EACtC,IAAIC,QAAQ,GAAGD,IAAI,CAACE,oBAAoB,GAAGF,IAAI,CAACG,wBAAwB,GAAGH,IAAI,CAACI,wBAAwB;EAExGC,uDAAW,CAAC;IACRC,GAAG,EAAEL,QAAQ;IACbM,OAAO,EAAE;MACLC,OAAO,EAAE;IACb;EACJ,CAAC,CAAC;AACN;AAEO,SAASC,k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C6F,MAAM,CAAC;MAC3D2B,aAAa,CAAC,IAAI,EAAE/E,QAAQ,CAAC;IACjC,CAAC,CAAC;EACN,CAAC,CAAC;EACF,EAAE,CAAClC,OAAO,CAACC,IAAI,CAACqJ,4BAA4B,EAAE,UAASC,UAAU,EAAE;IAC/DA,UAAU,CAAChI,gBAAgB,CAAC,OAAO,EAAE,YAAW;MAC5C,IAAIkI,aAAa,GAAG5O,CAAC,CAAC,2CAA2C,CAAC;MAClEA,CAAC,CAAC,YAAY,CAAC,CAAC6O,OAAO,CAAC;QACpBC,SAAS,EAAEF,aAAa,CAACG,MAAM,CAAC,CAAC,CAACC,GAAG,IAAKJ,aAAa,CAACK,MAAM,CAAC,CAAC,GAAGjP,CAAC,CAAC,mBAAmB,CAAC,CAACiP,MAAM,CAAC,CAAC;MACtG,CAAC,EAAE,IAAI,CAAC;IACZ,CAAC,CAAC;EACN,CAAC,CAAC;AACN,C","file":"module-line-item~module-product-tile~module-quick-add~module-quick-view~module-saveforlater-trigger~~1c15e46c.js","sourcesContent":["'use strict';\n\nimport * as dialog from '../components/dialog';\nimport * as progress from '../components/progress';\n\n/**\n * Parses the html for a modal window\n * @param {string} html - representing the body and footer of the modal window\n *\n * @return {Object} - Object with properties body and footer.\n */\nfunction parseHtml(html) {\n let $html = $('
').append($.parseHTML(html));\n\n return {\n body: $html.find('.choice-of-bonus-product'),\n footer: $html.find('.modal-footer').children()\n };\n}\n\n/**\n * Retrieves url to use when adding a product to the cart\n *\n * @param {Object} data - data object used to fill in dynamic portions of the html\n */\nexport function chooseBonusProducts(data) {\n let bonusUrl = data.bonusChoiceRuleBased ? data.showProductsUrlRuleBased : data.showProductsUrlListBased;\n\n dialog.open({\n url: bonusUrl,\n options: {\n modalID: 'bonusProducts'\n }\n });\n}\n\nexport function selectBonusProduct() {\n $(document).on('click', '.select-bonus-product', function() {\n let $choiceOfBonusProduct = $(this).parents('.choice-of-bonus-product'),\n pid = $(this).data('pid'),\n maxPids = $('.choose-bonus-product-dialog').data('total-qty'),\n submittedQty = parseInt($(this).parents('.choice-of-bonus-product').find('.bonus-quantity-select').val(), 10),\n totalQty = 0,\n optionID = $(this).parents('.choice-of-bonus-product').find('.product-option').data('option-id'),\n valueId = $(this).parents('.choice-of-bonus-product').find('.options-select option:selected').data('valueId');\n\n $.each($('#chooseBonusProductModal .selected-bonus-products .selected-pid'), function() {\n totalQty += $(this).data('qty');\n });\n\n totalQty += submittedQty;\n\n if (totalQty <= maxPids) {\n let selectedBonusProductHtml = ''\n + '
'\n + '
'\n + $choiceOfBonusProduct.find('.product-name').html()\n + '
'\n + '
'\n + '
'\n ;\n $('#chooseBonusProductModal .selected-bonus-products').append(selectedBonusProductHtml);\n $('.pre-cart-products').html(totalQty);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n } else {\n $('.selected-bonus-products .bonus-summary').addClass('alert-danger');\n }\n });\n}\n\nexport function removeBonusProduct() {\n $(document).on('click', '.selected-pid', function() {\n let $selected = $('#chooseBonusProductModal .selected-bonus-products .selected-pid'),\n count = 0;\n\n $(this).remove();\n\n if ($selected.length) {\n $selected.each(function() {\n count += parseInt($(this).data('qty'), 10);\n });\n }\n\n $('.pre-cart-products').html(count);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n });\n}\n\nexport function enableBonusProductSelection() {\n $('body').on('bonusproduct:updateSelectButton', function(e, response) {\n $('button.select-bonus-product', response.$productContainer).attr('disabled', (!response.product.readyToOrder || !response.product.available));\n $('button.select-bonus-product').data('pid', response.product.id);\n });\n}\n\nexport function showMoreBonusProducts() {\n $(document).on('click', '.show-more-bonus-products', function() {\n var url = $(this).data('url');\n\n $('.modal-content').spinner().start();\n\n $.ajax({\n url: url,\n method: 'GET',\n success: function(html) {\n var parsedHtml = parseHtml(html);\n $('.modal-body').append(parsedHtml.body);\n $('.show-more-bonus-products:first').remove();\n $('.modal-content').spinner().stop();\n },\n error: function() {\n $('.modal-content').spinner().stop();\n }\n });\n });\n}\n\nexport function addBonusProductsToCart() {\n $(document).on('click', '.add-bonus-products', function() {\n let $readyToOrderBonusProducts = $('.choose-bonus-product-dialog .selected-pid'),\n queryString = '?pids=',\n url = $('.choose-bonus-product-dialog').data('addtocarturl'),\n pidsObject = {\n bonusProducts: []\n };\n\n $.each($readyToOrderBonusProducts, function() {\n let qtyOption = parseInt($(this).data('qty'), 10),\n option = null;\n\n if (qtyOption > 0) {\n if ($(this).data('optionid') && $(this).data('option-selected-value')) {\n option = {};\n option.optionId = $(this).data('optionid');\n option.productId = $(this).data('pid');\n option.selectedValueId = $(this).data('option-selected-value');\n }\n pidsObject.bonusProducts.push({\n pid: $(this).data('pid'),\n qty: qtyOption,\n options: [ option ]\n });\n pidsObject.totalQty = parseInt($('.pre-cart-products').html(), 10);\n }\n });\n\n queryString += JSON.stringify(pidsObject);\n queryString = queryString + '&uuid=' + $('.choose-bonus-product-dialog').data('uuid');\n queryString = queryString + '&pliuuid=' + $('.choose-bonus-product-dialog').data('pliuuid');\n\n $.spinner().start();\n\n $.ajax({\n url: url + queryString,\n method: 'POST',\n success: function(data) {\n progress.hideLoader();\n\n if (data.error) {\n $('.error-choice-of-bonus-products').html(data.errorMessage);\n } else {\n $('.configure-bonus-product-attributes').html(data);\n $('.bonus-products-step2').removeClass('hidden-xl-down');\n $('#chooseBonusProductModal').modal('hide');\n\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append('
');\n }\n\n $('.minicart-quantity').html(data.totalQty);\n\n $('.add-to-cart-messages').append(\n '
'\n + data.msgSuccess + '
'\n );\n\n setTimeout(function() {\n $('.add-to-basket-alert').remove();\n if ($('.cart-page').length) {\n location.reload();\n }\n }, 3000);\n }\n },\n error: function() {\n progress.hideLoader();\n }\n });\n });\n}\n","import * as dialog from '../components/dialog';\r\nimport {subscribe} from '../helpers/pubSub';\r\n\r\n//Runs after modal instance is rendered.\r\nfunction _modalCreatedCallback() {\r\n var selRefills = [],\r\n refillSels = document.querySelectorAll('[data-sel-refillid]'),\r\n refillOpts = document.querySelectorAll('[data-opts-refillid]');\r\n\r\n if (refillSels.length > 0 && refillOpts.length > 0) {\r\n [].forEach.call(refillSels, refill => selRefills.push(refill.dataset.selRefillid));\r\n\r\n [].forEach.call(refillOpts, refillOpt => selRefills.indexOf(refillOpt.value) > -1 ? refillOpt.checked = true : refillOpt.checked = false);\r\n }\r\n}\r\n\r\nfunction _addRefillElementBlock(data) {\r\n let container = document.querySelector('[data-product-component=\"selected-refills\"]'),\r\n refillTemplate = document.querySelector('[data-refill-template]').firstElementChild.cloneNode(true);\r\n\r\n refillTemplate.dataset.selRefillid = refillTemplate.dataset.pid = data.id;\r\n refillTemplate.dataset.productContainer = 'set-item';\r\n refillTemplate.querySelector('img').src = data.productThumbnail && data.productThumbnail.url ? data.productThumbnail.url : '';\r\n refillTemplate.querySelector('[data-refill-name]').textContent = data.productName ? data.productName : '';\r\n refillTemplate.querySelector('[data-refill-ref]').textContent = data.reference ? data.reference : '';\r\n //refillTemplate.querySelector('[data-refill-price]').textContent = data.formattedSalesPrice ? data.formattedSalesPrice : '';\r\n\r\n container.appendChild(refillTemplate);\r\n\r\n [].forEach.call(document.querySelectorAll('[data-refill-remove]'), currentItem => currentItem.addEventListener('click', function() {\r\n this.parentNode.remove();\r\n _handleAddToCartButtonStatus();\r\n _recalculateBundlePrice();\r\n }));\r\n}\r\n\r\nexport function _handleAddToCartButtonStatus() {\r\n var addToCartBtn = document.querySelector('.case-refill-req'),\r\n container = document.querySelector('[data-product-component=\"selected-refills\"]'),\r\n refillSels = container.querySelectorAll('[data-sel-refillid]');\r\n\r\n if (addToCartBtn && !addToCartBtn.hidden && refillSels && refillSels.length > 0) {\r\n addToCartBtn.disabled = false;\r\n if (addToCartBtn.classList.contains('hide-select-size')) {\r\n addToCartBtn.classList.remove('hide-select-size');\r\n } else {\r\n addToCartBtn.classList.add('hide-select-size');\r\n }\r\n } else {\r\n addToCartBtn.disabled = true;\r\n addToCartBtn.classList.add('hide-select-size');\r\n }\r\n}\r\n\r\nfunction _recalculateBundlePrice() {\r\n var container = document.querySelector('[data-product-component=\"selected-refills\"]'),\r\n refillSels = container.querySelectorAll('[data-sel-refillid]'),\r\n productData = [],\r\n formData = {};\r\n\r\n [].forEach.call(refillSels, function(currentItem) {\r\n let pid = currentItem.getAttribute('data-pid');\r\n productData.push(pid);\r\n });\r\n\r\n formData.pidsArr = JSON.stringify(productData);\r\n\r\n $.ajax({\r\n url: container.dataset.url || '',\r\n method: 'POST',\r\n data: formData,\r\n success: function(data) {\r\n _updatePrice(data.bundlePrice);\r\n }\r\n });\r\n}\r\n\r\nfunction _updatePrice(priceObj) {\r\n var priceContainer = document.querySelector('[data-product-component=\"price\"]');\r\n\r\n if (priceContainer) {\r\n let titleSpan = priceContainer.querySelector('span.tile-label'),\r\n priceOriginalSpan = priceContainer.querySelector('span.price__original'),\r\n priceSalesSpan = priceContainer.querySelector('span.price__sales > span.value'),\r\n priceSalesSpanContent = priceSalesSpan.getAttribute('content');\r\n if (titleSpan) {\r\n if ('showStartingFrom' in priceObj && priceObj.showStartingFrom && titleSpan.classList.contains('hidden')) {\r\n titleSpan.classList.remove('hidden');\r\n } else {\r\n titleSpan.classList.add('hidden');\r\n }\r\n }\r\n\r\n if (priceOriginalSpan != null) {\r\n priceOriginalSpan.classList.add('hidden');\r\n }\r\n\r\n if (priceSalesSpan && 'sales' in priceObj && priceObj.sales) {\r\n if (priceSalesSpanContent) {\r\n priceSalesSpan.setAttribute('content', priceObj.sales.decimalPrice);\r\n }\r\n\r\n priceSalesSpan.innerHTML = priceObj.sales.formatted;\r\n }\r\n }\r\n}\r\n\r\nfunction _showSelectedRefills(data) {\r\n var container = document.querySelector('[data-product-component=\"selected-refills\"]');\r\n\r\n if (data.response && data.response.selectedRefills) {\r\n container.innerHTML = '';\r\n\r\n let selRefills = JSON.parse(data.response.selectedRefills);\r\n\r\n [].forEach.call(selRefills, selRefill => _addRefillElementBlock(selRefill));\r\n\r\n _handleAddToCartButtonStatus();\r\n _updatePrice(data.response.bundlePrice);\r\n }\r\n}\r\n\r\nexport function refillsSetup() {\r\n let addRefillBtn = document.querySelector('.product-addrefill__button');\r\n\r\n subscribe('validateRefills:success', data => _showSelectedRefills(data));\r\n\r\n subscribe('validateRefills:error', () => {\r\n let refillOpts = document.querySelectorAll('[data-opts-refillid]');\r\n\r\n [].forEach.call(refillOpts, currentItem => currentItem.addEventListener('change', function() {\r\n document.querySelector('[data-refill-error]').classList.remove('set--visible');\r\n }));\r\n });\r\n\r\n if (addRefillBtn) {\r\n addRefillBtn.addEventListener('click', function() {\r\n dialog.open({\r\n url: this.dataset.url || '',\r\n type: 'html',\r\n callback: _modalCreatedCallback,\r\n options: {\r\n modalID: 'fragrances-' + this.dataset.pid,\r\n modalClass: 'modal--refill',\r\n keepAlive: false\r\n }\r\n });\r\n });\r\n }\r\n}\r\n\r\n","'use strict';\n\nimport {chooseBonusProducts} from './bonusProducts';\nimport * as progress from '../components/progress';\nimport * as productUtils from './productUtils';\nimport * as miniCart from '../components/miniCart';\nimport modules from '../helpers/modules';\nimport {createElWithAttrs} from '@borngroup/born-utilities';\nimport {getQueryStringParams} from '../helpers/urlUtilities';\nimport {_handleAddToCartButtonStatus} from '../product/caseRefills';\n\n/**\n * Returns the first option value ID available.\n * @param {[type]} options [description]\n * @return {[type]} [description]\n */\nfunction _getOptionValueID(options) {\n let optionsArray = options && options.length ? JSON.parse(options) : null;\n\n return optionsArray && optionsArray[0] ? optionsArray[0].selectedValueId : null;\n}\n\n/**\n * Compatibility between NEMER & US/CA\n * @param {*} productData\n */\nfunction isProductSellable(productData) {\n if (productData.sellable.hasOwnProperty('web')) {\n return productData.sellable.web;\n }\n\n return (productData.available && productData.sellable) ? true : false;\n}\n\n/**\n * Render the ApplePay button if the item is ready to be added to cart,\n * otherwise enable/disable as needed.\n */\nfunction _handleApplePay(productData, productContainer) {\n let applePayButton = productContainer.querySelector('.js--apple-pay'),\n sellable = isProductSellable(productData);\n\n if (productData.readyToOrder && productData.available && sellable) {\n if (applePayButton) {\n applePayButton.setAttribute('sku', productData.id);\n applePayButton.disabled = false;\n } else {\n let addToCartContainer = productContainer.querySelector('[data-product-component=\"add-container\"]');\n\n createElWithAttrs(addToCartContainer, {class: 'product-add__button apple-pay-pdp button button--apple-pay set--w-100 js--apple-pay', sku: productData.id}, 'isapplepay');\n }\n } else if (applePayButton) {\n applePayButton.disabled = true;\n }\n}\n\n/**\n * Updates the Mini-Cart quantity value after the customer has pressed the \"Add to Cart\" button\n * @param {string} response - ajax response from clicking the add to cart button\n */\nexport function handlePostCartUpdate(formData, response) {\n miniCart.updateMinicartCount(response.quantityTotal);\n if (response.isProductUpdate) {\n $('body').trigger('product:afterUpdate', {formData, response});\n } else {\n miniCart.openMinicart(true);\n if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) && window.innerWidth <= 1024) {\n $('.product-tile__quickshop-options-close-btn').trigger('click');\n }\n\n const configuratorType = new URLSearchParams(window. location. search).get('ref');\n modules.tracking.init(null, {\n trackEvent: 'addToCart',\n trackObject: {\n asyncURL: window.SFRA.Urls.GTMEventView,\n asyncParams: {\n configuratorType: configuratorType,\n pid: formData.pid,\n setProductData: formData.pidsObj,\n qty: formData.quantity,\n pliUUID: response.pliUUID\n }\n }\n });\n }\n $('body').trigger('product:afterAddToCart', {formData, response});\n $('#itemAdd-' + response.pliUUID).text(`Another ${response.cart.items[0].productName} has been added successfully`);\n $('#addItemAlert-' + response.pliUUID).prop('role', 'alert');\n // show add to cart toast\n if (response.newBonusDiscountLineItem && Object.keys(response.newBonusDiscountLineItem).length) {\n chooseBonusProducts(response.newBonusDiscountLineItem);\n }\n\n progress.hideLoader();\n if (this.dataset.updateCart && document.querySelector('[data-action=\"Cart-Show\"]')) {\n window.location.reload();\n }\n\n if (document.querySelector('[data-product-personalisation=\"VASDescAddStrap\"]') != null) {\n let textNone = document.querySelector('[data-product-personalisation=\"VASDescAddStrap\"]').dataset.messageNone;\n $('[data-product-personalisation=\"VASDescAddStrap\"]').text(textNone);\n $('[data-product-personalisation-addstrap=\"remove\"]').addClass('hidden');\n }\n}\n\nexport function handleCartAdd(currentContext, formData = {}) {\n let productContainer = productUtils.getProductContainer(currentContext),\n productType = productUtils.getProductType(productContainer),\n childProducts = productUtils.getChildProducts(productContainer),\n addToCartUrl = formData.addToCartUrl || currentContext.getAttribute('data-url') || window.SFRA.Urls.cartAddProduct;\n\n $('body').trigger('product:beforeAddToCart', currentContext);\n\n formData.pid = formData.pid || formData.id || productUtils.getPidValue(currentContext);\n formData.uuid = formData.uuid || currentContext.getAttribute('data-uuid');\n formData.quantity = productUtils.getQuantitySelected(currentContext);\n formData.options = productUtils.getOptions(currentContext, true);\n\n //Use this property to stop an action from adding to cart by passing it on `formData` or through the `product:updateAddToCartFormData` event.\n formData.allowAddToCart = formData.hasOwnProperty('allowAddToCart') ? formData.allowAddToCart : true;\n\n //SFCC has separate endpoint property names for when it's a Set (pidsObj) vs a Bundle (childProducts)...\n if (productType === 'set') {\n formData.pidsObj = childProducts.data;\n } else if (productType === 'bundle') {\n formData.childProducts = childProducts.data;\n }\n\n //The `Cart-EditProductLineItem` route expects this property for some reason.\n //The problem is, it was developed to only work with a single option value ID.\n //Hopefully this is corrected on the next update. Issue raised: https://github.com/SalesforceCommerceCloud/storefront-reference-architecture/issues/830\n formData.selectedOptionValueId = _getOptionValueID(formData.options);\n\n $(currentContext).trigger('product:updateAddToCartFormData', {\n formData,\n childProducts,\n container: productContainer\n });\n\n if (addToCartUrl && formData.allowAddToCart) {\n progress.showLoader(currentContext);\n\n $.ajax({\n url: addToCartUrl,\n method: 'POST',\n data: formData,\n success: handlePostCartUpdate.bind(currentContext, formData),\n error: progress.hideLoader\n });\n }\n}\n\n/**\n * Handle status for the different product CTAs/messages as the user select their variations.\n */\nexport function updateAddToCart(productData, productContainer) {\n let isDisabled = !productData.readyToOrder || !productData.available,\n sellable = isProductSellable(productData);\n let isMercury = $('#isMercury').val();\n var addToCartBtn = document.querySelector('.case-refill-req');\n if (addToCartBtn) {\n _handleAddToCartButtonStatus();\n }\n\n [].forEach.call(productContainer.querySelectorAll('[data-product-component=\"add-button\"]'), function(currentEl) {\n currentEl.disabled = isDisabled;\n if (!currentEl.disabled && productData.size != '') {\n var container = document.querySelector('[data-product-component=\"selected-refills\"]');\n if (container) {\n let refillSels = container.querySelectorAll('[data-sel-refillid]');\n if (refillSels == null || refillSels.length == 0) {\n currentEl.classList.add('hide-select-size');\n currentEl.disabled = true;\n }\n }\n } else if (productData.size == '' && currentEl.classList.contains('hide-select-size')) {\n currentEl.classList.remove('hide-select-size');\n }\n\n if (productData.variationAttributes && productData.variationAttributes[0] && productData.variationAttributes[0].selectedValue == null) {\n currentEl.classList.remove('hidden');\n } else if (productData.options && productData.options[0] && productData.defaultStrapOption == productData.options[0].selectedValueId) {\n for (var i = 0; i < productData.options[0].values.length; i++) {\n if (productData.options[0].values[i].id == productData.options[0].selectedValueId) {\n if (!sellable || !productData.available || productData.unavailable || productData.options[0].values[i].availability.totalStock == null) {\n currentEl.classList.add('hidden');\n } else {\n currentEl.classList.remove('hidden');\n }\n break;\n }\n }\n } else {\n if (productData.available && sellable && productData.isPriceUnderThreshold && productData.readyToOrder) {\n currentEl.classList.remove('hidden');\n if (productData.productType !== 'master' && !productData.requestPrice) {\n currentEl.classList.remove('disabled');\n }\n } else {\n currentEl.classList.add('hidden');\n }\n }\n if (productData.productType === 'master' && !productData.requestPrice) {\n currentEl.classList.remove('hidden');\n currentEl.classList.add('disabled');\n } else if (productData.productType === 'master' && productData.requestPrice) {\n currentEl.classList.add('hidden');\n }\n });\n\n [].forEach.call(productContainer.querySelectorAll('[data-product-component=\"request-price\"]'), function(currentEl) {\n if (productData.requestPrice || productData.isPriceUnderThreshold === false) {\n currentEl.classList.remove('hidden');\n $('[data-product-component=\"availability-status\"]').addClass('hidden');\n } else {\n currentEl.classList.add('hidden');\n }\n });\n\n [].forEach.call(productContainer.querySelectorAll('[data-product-component=\"stock-availability-status\"]'), function(currentEl) {\n var isPlpStockAvailabilityStatus = $(currentEl).data('is-plp-stock-availability-status');\n if (productData.variationAttributes != null) {\n if ((!sellable || !productData.available || productData.unavailable) && !(productData.variationAttributes[0].selectedValue === null && productData.available)) {\n currentEl.classList.remove('hidden');\n } else {\n currentEl.classList.add('hidden');\n }\n if ((!sellable && (!productData.available || productData.unavailable)) && !isPlpStockAvailabilityStatus) {\n currentEl.classList.add('hidden');\n $('[data-product-component=\"availability-status\"]').removeClass('hidden');\n } else {\n $('[data-product-component=\"availability-status\"]').addClass('hidden');\n }\n } else if (productData.options && productData.options[0] && productData.defaultStrapOption == productData.options[0].selectedValueId) {\n for (var i = 0; i < productData.options[0].values.length; i++) {\n if (productData.options[0].values[i].id == productData.options[0].selectedValueId) {\n if (!sellable || !productData.available || productData.unavailable || productData.options[0].values[i].availability.totalStock == null) {\n currentEl.classList.remove('hidden');\n } else {\n currentEl.classList.add('hidden');\n }\n break;\n }\n }\n } else {\n if ((!sellable || !productData.available || productData.unavailable) ) {\n currentEl.classList.remove('hidden');\n } else {\n currentEl.classList.add('hidden');\n }\n }\n if (productData.productType === 'master') {\n currentEl.classList.add('hidden');\n $('[data-product-component=\"availability-status\"]').addClass('hidden');\n }\n if (productData.requestPrice || productData.isPriceUnderThreshold === false) {\n currentEl.classList.add('hidden');\n }\n });\n\n [].forEach.call(productContainer.querySelectorAll('[data-applepay-instant-checkout=\"container\"]'), function(currentEl) {\n currentEl.disabled = isDisabled;\n var applepayBtn = $(currentEl).find('.button--apple-pay');\n if (applepayBtn) {\n applepayBtn.attr('sku', productData.id);\n }\n\n if (productData.productType !== 'master' && productData.available && sellable && productData.readyToOrder && !productData.isCaseProduct && !productData.requestPrice && productData.price.type != 'range') {\n currentEl.classList.remove('hidden');\n $(currentEl).closest('.flex').addClass('flex-flow-wrap');\n } else {\n currentEl.classList.add('hidden');\n $(currentEl).closest('.flex').removeClass('flex-flow-wrap');\n }\n });\n\n [].forEach.call(productContainer.querySelectorAll('[data-product-component=\"availability-status\"]'), function(currentEl) {\n if ((!sellable || !productData.available || productData.isPriceUnderThreshold === false || productData.unavailable) && !isMercury) {\n currentEl.classList.remove('hidden');\n } else {\n currentEl.classList.add('hidden');\n }\n if (productData.productType === 'master') {\n currentEl.classList.add('hidden');\n }\n if (productData.variationAttributes != null) {\n if (sellable && (!productData.available || productData.unavailable)) {\n currentEl.classList.add('hidden');\n }\n }\n if (productData.requestPrice || productData.isPriceUnderThreshold === false) {\n $('[data-product-component=\"availability-status\"]').addClass('hidden');\n }\n });\n [].forEach.call(productContainer.querySelectorAll('[data-product-component=\"availability-status-message\"]'), function(currentEl) {\n if (productData.productType === 'master' && productData.isDiableSizeSelector) {\n currentEl.classList.add('hidden');\n } else {\n if (productData.productType === 'master' && !productData.isDiableSizeSelector) {\n currentEl.classList.remove('hidden');\n }\n }\n });\n _handleApplePay(productData, productContainer);\n}\n\nexport function setupAddToCart(container) {\n let addToCartButtons = (container || document).querySelectorAll('[data-product-component=\"add-button\"]:not([data-add-ready])');\n let addToCartButtonsSizeSelected = (container || document).querySelectorAll('[data-product-component=\"size-select-warning\"]');\n\n [].forEach.call(addToCartButtons, function(currentBtn) {\n currentBtn.setAttribute('data-add-ready', '');\n\n currentBtn.addEventListener('click', function() {\n let formData = getQueryStringParams(window.location.search);\n handleCartAdd(this, formData);\n })\n });\n [].forEach.call(addToCartButtonsSizeSelected, function(currentBtn) {\n currentBtn.addEventListener('click', function() {\n let selectSizeEle = $('.pdp-select-size .product-attribute__size');\n $('html, body').animate({\n scrollTop: selectSizeEle.offset().top - ( selectSizeEle.height() + $('.header-container').height() )\n }, 1000);\n })\n });\n}\n"],"sourceRoot":""}