{"version":3,"file":"default/js/byob.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./cartridges/org_arlo/cartridge/client/default/js/byob.js","webpack:///./cartridges/org_arlo/cartridge/client/default/js/byob/byobProductPage.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/org_arlo/cartridge/client/default/js/byob.js\");\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./byob/byobProductPage'));\n});\n","'use strict';\n\n/**\n * Function to get promotion price by adding tier based discount on bundle total\n * @param {number} totalSalePrice Total sale price of Bundle\n * @returns {Object} returnData Object containing discount percentage and amount\n */\nfunction getOverrideDiscountData(totalSalePrice) {\n var promotionPercent = $('.js-bundle-promo-override-percentage').val();\n var isPromotionActive = $('.js-is-bundle-overridepromo-active').val();\n var returnData = {\n discountedTotal: 0,\n discountPercentage: 0,\n discountAmt: 0\n };\n var maxThresholdObj = JSON.parse($('.js-promooverride-maxthresholdobj').val());\n if (maxThresholdObj) {\n var orderThreshold = 9999;\n var discountPercentage;\n var dicountedTotal;\n var discountAmt;\n if (maxThresholdObj.threshold) {\n orderThreshold = maxThresholdObj.threshold;\n }\n if (totalSalePrice > orderThreshold) {\n dicountedTotal = totalSalePrice - maxThresholdObj.amountOff;\n discountAmt = maxThresholdObj.amountOff;\n discountPercentage = 0;\n returnData.discountPercentage = discountPercentage;\n returnData.discountedTotal = dicountedTotal;\n returnData.discountAmt = discountAmt;\n } else {\n if (isPromotionActive === 'true' && promotionPercent > 0) { // eslint-disable-line no-lonely-if\n discountPercentage = Number(promotionPercent);\n discountAmt = totalSalePrice * (discountPercentage / 100);\n dicountedTotal = totalSalePrice - discountAmt;\n returnData.discountPercentage = discountPercentage;\n returnData.discountedTotal = dicountedTotal;\n returnData.discountAmt = discountAmt;\n }\n }\n }\n return returnData;\n}\n\n/**\n * Function to get promotion price by adding tier based discount on bundle total\n * @param {number} totalSalePrice Total sale price of Bundle\n * @returns {Object} returnData Object containing discount percentage and amount\n */\nfunction getDiscountData(totalSalePrice) {\n var promotionDataObj = JSON.parse($('.js-bundle-promo-data').val());\n var isPromotionActive = $('.js-is-bundle-promo-active').val();\n var returnData = {\n discountedTotal: 0,\n discountPercentage: 0,\n discountAmt: 0\n };\n if (isPromotionActive === 'true' && promotionDataObj) {\n var thresholdValArr = Object.keys(promotionDataObj);\n thresholdValArr.forEach(function (threshold) {\n var orderThreshold;\n var discountPercentage;\n var dicountedTotal;\n var discountAmt;\n if (threshold === 'max') {\n orderThreshold = promotionDataObj[threshold].threshold;\n if (totalSalePrice > orderThreshold) {\n dicountedTotal = totalSalePrice - promotionDataObj[threshold].amountOff;\n discountAmt = promotionDataObj[threshold].amountOff;\n discountPercentage = 0;\n returnData.discountPercentage = discountPercentage;\n returnData.discountedTotal = dicountedTotal;\n returnData.discountAmt = discountAmt;\n }\n } else {\n orderThreshold = Number(threshold);\n if (!isNaN(orderThreshold)) {\n if (totalSalePrice > orderThreshold) {\n discountPercentage = promotionDataObj[threshold];\n discountAmt = totalSalePrice * (discountPercentage / 100);\n dicountedTotal = totalSalePrice - discountAmt;\n returnData.discountPercentage = discountPercentage;\n returnData.discountedTotal = dicountedTotal;\n returnData.discountAmt = discountAmt;\n }\n }\n }\n });\n }\n return returnData;\n}\n\n/**\n * Function to get selected Items array for add to cart event\n * @returns {Array} pidArr array of product:qty strings\n */\nfunction getSelectedItemsArrCart() {\n var pidArr = [];\n $('.js-default-item').each(function () {\n pidArr.push($(this).data('pid') + ':' + 1);\n });\n\n if ($('.js-selected-qty').length > 0) {\n $('.js-selected-qty').each(function () {\n var selectedQty = Number($(this).val());\n if (selectedQty > 0) {\n pidArr.push($(this).data('pid') + ':' + selectedQty);\n }\n });\n }\n\n return pidArr;\n}\n\n/**\n * Function to get selected Items array\n * @returns {Array} pidArr array of product:qty strings\n */\nfunction getSelectedItemsArr() {\n var pidArr = [];\n if ($('.js-selected-qty').length > 0) {\n $('.js-selected-qty').each(function () {\n var selectedQty = Number($(this).val());\n if (selectedQty > 0) {\n pidArr.push($(this).data('pid') + ':' + selectedQty);\n }\n });\n if (pidArr.length) {\n $('.js-default-item').each(function () {\n pidArr.push($(this).data('pid') + ':' + 1);\n });\n }\n }\n return pidArr;\n}\n\n/**\n * Function to determine list and sale price of an item and return them with qty multiplied\n * @param {Object} priceObj Item price object\n * @param {number} selectedQty Item qty\n * @returns {Object} itemPrices Object with item prices\n */\nfunction getListAndSalePrice(priceObj, selectedQty) {\n var itemPrices = {\n itemSalePrice: 0,\n itemListPrice: 0\n };\n if (priceObj.promotionPrice) {\n if (priceObj.salesPrice && priceObj.promotionPrice < priceObj.salesPrice) {\n itemPrices.itemSalePrice = priceObj.promotionPrice * selectedQty;\n }\n } else if (priceObj.salesPrice) {\n itemPrices.itemSalePrice = priceObj.salesPrice * selectedQty;\n }\n if (priceObj.listPrice) {\n itemPrices.itemListPrice = priceObj.listPrice * selectedQty;\n }\n return itemPrices;\n}\n\n/**\n * Function to update totals after item selection\n */\nfunction updateTotals() {\n var totalSalePrice = 0;\n var totalListPrice = 0;\n var itemCount = 0;\n var hasDiscountOverrideItem = false;\n var dicountOverridePID = $('.js-bundle-promo-override-pid').val();\n var dicountOverridePIDArr = [];\n if (dicountOverridePID.length > 0) {\n dicountOverridePIDArr = dicountOverridePID.split(',');\n }\n if ($('.js-selected-qty').length > 0) {\n var priceObj;\n var itemPrices = {\n itemSalePrice: 0,\n itemListPrice: 0\n };\n $('.js-byob-add-all').prop('disabled', false);\n $('.js-selected-qty').each(function () {\n var selectedQty = Number($(this).val());\n if (selectedQty > 0) {\n if (dicountOverridePIDArr.indexOf($(this).data('pid')) >= 0) {\n hasDiscountOverrideItem = true;\n }\n priceObj = $(this).data('priceobj');\n itemPrices = {\n itemSalePrice: 0,\n itemListPrice: 0\n };\n itemPrices = getListAndSalePrice(priceObj, selectedQty);\n $(this).closest('.price-qty').find('.js-selected-price-tag').text($('.js-site-currency').val() + itemPrices.itemSalePrice.toFixed(2));\n if (itemPrices.itemSalePrice < itemPrices.itemListPrice) {\n $(this).closest('.price-qty').find('.js-selected-listprice-tag').text($('.js-site-currency').val() + itemPrices.itemListPrice.toFixed(2));\n }\n totalSalePrice += itemPrices.itemSalePrice;\n totalListPrice += itemPrices.itemListPrice;\n itemCount++;\n } else {\n $(this).closest('.price-qty').find('.js-selected-price-tag').text($('.js-site-currency').val() + 0);\n $(this).closest('.price-qty').find('.js-selected-listprice-tag').text('');\n }\n });\n }\n $('.js-defaultitem-price').each(function () {\n var defaultPriceObj = $(this).data('priceobj');\n var defaultItemPrices = {\n itemSalePrice: 0,\n itemListPrice: 0\n };\n defaultItemPrices = getListAndSalePrice(defaultPriceObj, 1);\n totalSalePrice += defaultItemPrices.itemSalePrice;\n totalListPrice += defaultItemPrices.itemListPrice;\n itemCount++;\n });\n var discountData = {};\n var isOverridePromotionActive = $('.js-is-bundle-overridepromo-active').val();\n if (isOverridePromotionActive === 'true' && hasDiscountOverrideItem === true) {\n discountData = getOverrideDiscountData(totalSalePrice);\n } else {\n discountData = getDiscountData(totalSalePrice);\n }\n\n if (totalListPrice > totalSalePrice) {\n $('.js-total-list-price').each(function () {\n $(this).text($('.js-site-currency').val() + totalListPrice.toLocaleString('en-US', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2\n }));\n $(this).removeClass('d-none');\n });\n } else {\n $('.js-total-list-price').each(function () {\n $(this).addClass('d-none');\n });\n }\n if (discountData.discountedTotal !== 0 && discountData.discountedTotal < totalSalePrice) {\n $('.js-total-sale-price').each(function () {\n $(this).text($('.js-site-currency').val() + discountData.discountedTotal.toLocaleString('en-US', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2\n }));\n });\n var discountMsg = '-' + $('.js-site-currency').val() + discountData.discountAmt.toFixed(2);\n if (discountData.discountPercentage > 0) {\n discountMsg += ' (' + discountData.discountPercentage.toFixed() + '% off)';\n }\n $('.js-bundle-discount-amt').text(discountMsg);\n $('.byb-discount').removeClass('d-none');\n $('.js-total-list-price').each(function () {\n $(this).text($('.js-site-currency').val() + totalListPrice.toLocaleString('en-US', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2\n }));\n $(this).removeClass('d-none');\n });\n } else {\n $('.byb-discount').addClass('d-none');\n $('.js-total-sale-price').each(function () {\n $(this).text($('.js-site-currency').val() + totalSalePrice.toLocaleString('en-US', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2\n }));\n });\n }\n\n $('.js-hybrid-itemcount').text('(' + itemCount + ' items)');\n\n // Update affirm with new totals\n if ($('.js-byob-affirmpromo-min').length) {\n var affirmMinTotal = Number($('.js-byob-affirmpromo-min').val());\n if (totalSalePrice < affirmMinTotal) {\n $('.js-affirm-cart-total').addClass('d-none');\n } else {\n if ($('.js-affirm-cart-total').length > 0) {\n $('.js-affirm-cart-total').removeClass('d-none');\n $('.js-affirm-cart-total').attr('data-amount', totalSalePrice * 100);\n }\n if (typeof affirm !== 'undefined') { // eslint-disable-line\n affirm.ui.ready(function() { // eslint-disable-line\n affirm.ui.refresh(); // eslint-disable-line\n });\n }\n }\n }\n\n // Update sticky nav\n $('.product-nav.BYB').find('.js-view-bundle-button').hide();\n $('.product-nav.BYB').find('.js-view-bundle-button').fadeOut();\n $('.product-nav.BYB').addClass('active');\n $('.product-nav.BYB').find('.js-bundle-updated').show();\n\n setTimeout(() => {\n $('.product-nav.BYB').removeClass('active');\n $('.product-nav.BYB').find('.js-bundle-updated').hide();\n $('.product-nav.BYB').find('.js-view-bundle-button').fadeIn(500);\n }, 1000);\n}\n\n/**\n * Initialize selected section input events\n */\nfunction initializeSelectedQtyControls() {\n // Event Handlers for Quantity Controls in selected items section\n $('body').on('click', '.js-selected-liq-minus', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n var selectedInput = $(this).parent().find('input[type=number]');\n var prodid = $(selectedInput).data('pid');\n if (Number($(selectedInput).val()) !== 0) {\n this.parentNode.querySelector('input[type=number]').stepDown();\n $(selectedInput).trigger('change');\n var quantity = Number($(selectedInput).val());\n if (quantity === 0) {\n $('.js-selected-products').find('.selected-' + prodid).remove();\n }\n $('.js-segment-qty[data-pid=' + prodid + ']').val(quantity);\n $('.js-segment-qty[data-pid=' + prodid + ']').trigger('change');\n updateTotals();\n }\n });\n\n $('body').on('click', '.js-selected-liq-plus', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n var selectedInput = $(this).parent().find('input[type=number]');\n var ats = $(selectedInput).data('ats');\n ats = parseInt(ats, 10);\n var maxValue = parseInt($(selectedInput).prop('max'), 10);\n if (Number($(selectedInput).val()) < ats && Number($(selectedInput).val()) < maxValue) {\n this.parentNode.querySelector('input[type=number]').stepUp();\n $(selectedInput).trigger('change');\n var quantity = Number($(selectedInput).val());\n var prodid = $(selectedInput).data('pid');\n $('.js-segment-qty[data-pid=' + prodid + ']').val(quantity);\n $('.js-segment-qty[data-pid=' + prodid + ']').trigger('change');\n updateTotals();\n } else {\n $(this).prop('disabled', true);\n $('
' + $('.js-qty-exceed-error-msg').eq(0).text() + '
').insertAfter($(this).closest('.js-selected-item-parent'));\n $('.js-selecteditem-qty-exceed-error-msg').slideDown();\n $(this).closest('.js-item-price-col').find('.js-qty-exceed-error-msg').slideDown();\n setTimeout(() => {\n $('.js-selecteditem-qty-exceed-error-msg').slideUp();\n $(this).closest('.js-item-price-col').find('.js-qty-exceed-error-msg').slideUp();\n }, 3000);\n setTimeout(() => {\n $('.js-selecteditem-qty-exceed-error-msg').remove();\n $(this).prop('disabled', false);\n }, 4500);\n }\n });\n}\n\nvar exports = {\n initialize: function () {\n // enable add to cart button if dfault items exist\n if ($('.js-defaultitem-price').length > 0) {\n $('.js-byob-add-all').prop('disabled', false);\n }\n // Trigger Modals on hover\n $('.byb-info-icon').on('mouseover', function () {\n if ($(this).data('toggle') === 'modal') {\n $($(this).data('target')).modal('show');\n }\n });\n var urlParams = new URLSearchParams(window.location.search);\n var pidstr = urlParams.get('pidstr');\n var $byobPids = [];\n if (pidstr) {\n var pairs = pidstr.split(',');\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(':');\n $byobPids.push(pair[0]);\n }\n $byobPids.reverse();\n } else {\n $byobPids = JSON.parse($('.byob-segments').attr('data-hybridbundledata')).reverse();\n }\n\n // Update pre-selection on edit and email landing\n $byobPids.forEach(function (productID) {\n $('.js-segment-qty').each(function () {\n if ($(this).val() > 0) {\n var prodID = $(this).data('pid');\n if (productID === prodID) {\n var selectedQty = Number($(this).val());\n if ($('.js-selected-products').find('.selected-' + prodID).length > 0) {\n $('.selected-' + prodID).find('.js-selected-qty').val(selectedQty);\n $('.selected-' + prodID).find('.js-selected-qty').trigger('change');\n } else {\n var prodName = $(this).data('pname');\n var priceObjStr = $(this).data('priceobj');\n var ats = $(this).data('ats');\n priceObjStr = JSON.stringify(priceObjStr);\n var selectedItemString = `
\n

${prodName}

\n
\n
\n \n \n \n
\n
\n

\n

\n
\n
\n
`;\n $(selectedItemString).insertAfter('.js-a2c-default');\n }\n initializeSelectedQtyControls();\n updateTotals();\n }\n }\n });\n });\n // Event Handlers for Quantity Controls\n $('body').on('click', '.js-liq-minus', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n var productInputField = $(this).parent().find('input[type=number]');\n var minusValue = Number($(productInputField).val());\n var prodID = $(productInputField).data('pid');\n if (minusValue === 1) {\n $('.js-selected-products').find('.selected-' + prodID).remove();\n this.parentNode.querySelector('input[type=number]').stepDown();\n }\n if (minusValue > 1) {\n this.parentNode.querySelector('input[type=number]').stepDown();\n $(this).parent().find('input[type=number]').trigger('change');\n var selectedQty = Number($(productInputField).val());\n if ($('.js-selected-products').find('.selected-' + prodID).length > 0) {\n $('.selected-' + prodID).find('.js-selected-qty').val(selectedQty);\n $('.selected-' + prodID).find('.js-selected-qty').trigger('change');\n }\n }\n updateTotals();\n });\n\n $('body').on('click', '.js-liq-plus', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n var productInputField = $(this).parent().find('input[type=number]');\n var ats2 = $(productInputField).data('ats');\n ats2 = parseInt(ats2, 10);\n var maxValue = parseInt($(productInputField).prop('max'), 10);\n var plusValue = Number($(productInputField).val());\n if (plusValue < ats2 && plusValue < maxValue) {\n this.parentNode.querySelector('input[type=number]').stepUp();\n $(this).parent().find('input[type=number]').trigger('change');\n if ($(productInputField).val() > 0) {\n var prodID = $(productInputField).data('pid');\n var selectedQty = Number($(productInputField).val());\n if ($('.js-selected-products').find('.selected-' + prodID).length > 0) {\n $('.selected-' + prodID).find('.js-selected-qty').val(selectedQty);\n $('.selected-' + prodID).find('.js-selected-qty').trigger('change');\n } else {\n var prodName = $(productInputField).data('pname');\n var priceObjStr = $(productInputField).data('priceobj');\n priceObjStr = JSON.stringify(priceObjStr);\n var selectedItemString = `
\n

${prodName}

\n
\n
\n \n \n \n
\n
\n

\n

\n
\n
\n
`;\n $(selectedItemString).insertBefore('.byob-added-seperator');\n }\n initializeSelectedQtyControls();\n updateTotals();\n }\n } else {\n $(this).closest('.js-item-price-col').find('.js-qty-exceed-error-msg').slideDown();\n setTimeout(() => {\n $(this).closest('.js-item-price-col').find('.js-qty-exceed-error-msg').slideUp();\n }, 3000);\n }\n });\n\n $('body').on('click', '.js-byob-add-all', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n $(this).prop('disabled', true);\n var pidArr = getSelectedItemsArrCart();\n if (pidArr.length) {\n var pidStr = pidArr.join(',');\n var addToCartUrl = $(this).data('addurl');\n var add2CUrl = addToCartUrl + pidStr;\n if ($('.js-byob-src-code').val().length) {\n add2CUrl += '&src=' + $('.js-byob-src-code').val();\n }\n $('body').spinner().start();\n $.ajax({\n url: add2CUrl,\n type: 'get'\n }).done(function (data) {\n $('body').spinner().stop();\n if (data.error === true) {\n // Display a popup with error msgs and show go to cart button\n }\n if (data.errorMsgs && data.errorMsgs.length) {\n data.errorMsgs.forEach(function (error) {\n $('.js-a2c-product-errors').html('
  • ' + error + '
  • ');\n });\n $('#byobA2Cerrormodal').modal('show');\n $('.js-byob-add-all').prop('disabled', false);\n } else if (!!data.atsBundleRemoved && data.atsBundleRemoved === true) {\n $('.js-ats-bundle-removed').removeClass('d-none');\n $('.js-ats-bundle-removed').addClass('d-block');\n $('#atsRemovedModal').modal('show');\n } else {\n window.location.href = $('.js-cart-page-url').val();\n }\n });\n } else {\n $(this).prop('disabled', false);\n // Show no-items selected error message\n }\n });\n\n $('body').on('click', '.js-a2c-error-goto-cart', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n $('body').spinner().start();\n window.location.href = $('.js-cart-page-url').val();\n });\n\n $(document).on('click', '.js-Back-to-Top', function () {\n $('html,body').animate({\n scrollTop: 0\n }, 1000);\n });\n\n $(document).on('click', '.js-view-bundle-button', function () {\n $('html,body').animate({\n scrollTop: $('.BYB-order-summary').offset().top - 150\n }, 1000);\n });\n },\n initializeEmailModalEvents: function () {\n // Clear old values from Email modal on show\n $('#emailMyBundleModal').on('show.bs.modal', function () {\n $('input.js-byob-email').val('');\n $('button.js-byob-email-submit').prop('disabled', true);\n $('.js-email-invalid-msg').addClass('d-none');\n $('.js-email-modal-content').removeClass('d-none');\n $('.js-email-response-content').addClass('d-none');\n $('.js-no-items-modal-msg').addClass('d-none');\n $('input.js-byob-email').removeClass('emailError');\n });\n\n $('body').on('blur', 'input.js-byob-email', function () {\n var useremail = $(this).val();\n if (useremail.trim().length) {\n var pattern = /^[\\w.%+-]+@[\\w.-]+\\.[\\w]{2,6}$/gi;\n if (pattern.test(useremail)) {\n $('button.js-byob-email-submit').prop('disabled', false);\n $('.js-email-invalid-msg').addClass('d-none');\n } else {\n $('button.js-byob-email-submit').prop('disabled', true);\n $('.js-email-invalid-msg').removeClass('d-none');\n $('input.js-byob-email').addClass('emailError');\n }\n } else {\n $('button.js-byob-email-submit').prop('disabled', true);\n $('.js-email-invalid-msg').addClass('d-none');\n }\n });\n\n $('body').on('click', '.js-byob-email-submit', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n var useremail = $('input.js-byob-email').val();\n if (useremail.trim().length) {\n if ($('.js-selected-qty').length > 0) {\n var pidArr = getSelectedItemsArr();\n if (pidArr.length) {\n $('.js-no-items-modal-msg').addClass('d-none');\n var pidStr = pidArr.join(',');\n var emailUrl = $('.js-email-trigger-url').val();\n var defaultItemPid = $('.js-default-item').eq(0).data('pid');\n var mainBuilderPid = $('.product-detail.product-wrapper.buildYourOwnBundle').data('pid');\n $('.modal-body').spinner().start();\n $.ajax({\n url: emailUrl,\n type: 'post',\n dataType: 'json',\n data: {\n pidStr: pidStr,\n useremail: useremail,\n defaultItemPid: defaultItemPid,\n mainBuilderPid: mainBuilderPid\n }\n }).done(function (data) {\n $('.modal-body').spinner().stop();\n $('.js-email-modal-content').addClass('d-none');\n $('.js-email-response-content').removeClass('d-none');\n if (data.error) {\n $('.js-modal-response-msg').text(data.errorMsg);\n } else {\n $('.js-byobemail-modal-title').text('Your bundle is in your inbox.');\n $('.js-modal-response-msg').html(data.successMsg);\n $('.emailMyBundleModalBody').addClass('emailSuccModal');\n }\n });\n } else {\n $('.js-no-items-modal-msg').removeClass('d-none');\n $('input.js-byob-email').addClass('emailError');\n }\n } else {\n $('.js-no-items-modal-msg').removeClass('d-none');\n $('input.js-byob-email').addClass('emailError');\n }\n } else {\n $('button.js-byob-email-submit').prop('disabled', true);\n $('.js-email-invalid-msg').removeClass('d-none');\n $('input.js-byob-email').addClass('emailError');\n }\n });\n }\n};\n\nmodule.exports = exports;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AACA;AADA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACZA;AACA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;A","sourceRoot":""}