{"version":3,"file":"productDetail.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/plugin_ditto/cartridge/client/default/js/components/carousel.js","webpack:///./cartridges/plugin_ditto/cartridge/client/default/js/product/base.js","webpack:///./cartridges/plugin_ditto/cartridge/client/default/js/product/detail.js","webpack:///./cartridges/plugin_ditto/cartridge/client/default/js/product/pdpInstoreInventory.js","webpack:///./cartridges/plugin_ditto/cartridge/client/default/js/productDetail.js","webpack:///./dependencies/plugin_commercepayments/cartridges/plugin_commercepayments/cartridge/client/default/js/product/detail.js","webpack:///./dependencies/plugin_commercepayments/cartridges/plugin_commercepayments/cartridge/client/default/js/product/payments.js","webpack:///./dependencies/plugin_giftregistry/cartridges/plugin_giftregistry/cartridge/client/default/js/product/giftRegistry.js","webpack:///./dependencies/plugin_wishlists/cartridges/plugin_wishlists/cartridge/client/default/js/product/wishlist.js","webpack:///./dependencies/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/focus.js","webpack:///./dependencies/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/product/base.js","webpack:///./dependencies/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/product/detail.js","webpack:///./dependencies/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/storeLocator/storeLocator.js","webpack:///./dependencies/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./node_modules/core-js/internals/a-function.js","webpack:///./node_modules/core-js/internals/a-possible-prototype.js","webpack:///./node_modules/core-js/internals/add-to-unscopables.js","webpack:///./node_modules/core-js/internals/an-instance.js","webpack:///./node_modules/core-js/internals/an-object.js","webpack:///./node_modules/core-js/internals/array-for-each.js","webpack:///./node_modules/core-js/internals/array-includes.js","webpack:///./node_modules/core-js/internals/array-iteration.js","webpack:///./node_modules/core-js/internals/array-method-has-species-support.js","webpack:///./node_modules/core-js/internals/array-method-is-strict.js","webpack:///./node_modules/core-js/internals/array-method-uses-to-length.js","webpack:///./node_modules/core-js/internals/array-species-create.js","webpack:///./node_modules/core-js/internals/check-correctness-of-iteration.js","webpack:///./node_modules/core-js/internals/classof-raw.js","webpack:///./node_modules/core-js/internals/classof.js","webpack:///./node_modules/core-js/internals/copy-constructor-properties.js","webpack:///./node_modules/core-js/internals/correct-prototype-getter.js","webpack:///./node_modules/core-js/internals/create-iterator-constructor.js","webpack:///./node_modules/core-js/internals/create-non-enumerable-property.js","webpack:///./node_modules/core-js/internals/create-property-descriptor.js","webpack:///./node_modules/core-js/internals/define-iterator.js","webpack:///./node_modules/core-js/internals/define-well-known-symbol.js","webpack:///./node_modules/core-js/internals/descriptors.js","webpack:///./node_modules/core-js/internals/document-create-element.js","webpack:///./node_modules/core-js/internals/dom-iterables.js","webpack:///./node_modules/core-js/internals/engine-is-ios.js","webpack:///./node_modules/core-js/internals/engine-is-node.js","webpack:///./node_modules/core-js/internals/engine-user-agent.js","webpack:///./node_modules/core-js/internals/engine-v8-version.js","webpack:///./node_modules/core-js/internals/enum-bug-keys.js","webpack:///./node_modules/core-js/internals/export.js","webpack:///./node_modules/core-js/internals/fails.js","webpack:///./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js","webpack:///./node_modules/core-js/internals/function-bind-context.js","webpack:///./node_modules/core-js/internals/get-built-in.js","webpack:///./node_modules/core-js/internals/get-iterator-method.js","webpack:///./node_modules/core-js/internals/global.js","webpack:///./node_modules/core-js/internals/has.js","webpack:///./node_modules/core-js/internals/hidden-keys.js","webpack:///./node_modules/core-js/internals/host-report-errors.js","webpack:///./node_modules/core-js/internals/html.js","webpack:///./node_modules/core-js/internals/ie8-dom-define.js","webpack:///./node_modules/core-js/internals/indexed-object.js","webpack:///./node_modules/core-js/internals/inspect-source.js","webpack:///./node_modules/core-js/internals/internal-state.js","webpack:///./node_modules/core-js/internals/is-array-iterator-method.js","webpack:///./node_modules/core-js/internals/is-array.js","webpack:///./node_modules/core-js/internals/is-forced.js","webpack:///./node_modules/core-js/internals/is-object.js","webpack:///./node_modules/core-js/internals/is-pure.js","webpack:///./node_modules/core-js/internals/iterate.js","webpack:///./node_modules/core-js/internals/iterator-close.js","webpack:///./node_modules/core-js/internals/iterators-core.js","webpack:///./node_modules/core-js/internals/iterators.js","webpack:///./node_modules/core-js/internals/microtask.js","webpack:///./node_modules/core-js/internals/native-promise-constructor.js","webpack:///./node_modules/core-js/internals/native-symbol.js","webpack:///./node_modules/core-js/internals/native-weak-map.js","webpack:///./node_modules/core-js/internals/new-promise-capability.js","webpack:///./node_modules/core-js/internals/object-create.js","webpack:///./node_modules/core-js/internals/object-define-properties.js","webpack:///./node_modules/core-js/internals/object-define-property.js","webpack:///./node_modules/core-js/internals/object-get-own-property-descriptor.js","webpack:///./node_modules/core-js/internals/object-get-own-property-names-external.js","webpack:///./node_modules/core-js/internals/object-get-own-property-names.js","webpack:///./node_modules/core-js/internals/object-get-own-property-symbols.js","webpack:///./node_modules/core-js/internals/object-get-prototype-of.js","webpack:///./node_modules/core-js/internals/object-keys-internal.js","webpack:///./node_modules/core-js/internals/object-keys.js","webpack:///./node_modules/core-js/internals/object-property-is-enumerable.js","webpack:///./node_modules/core-js/internals/object-set-prototype-of.js","webpack:///./node_modules/core-js/internals/object-to-string.js","webpack:///./node_modules/core-js/internals/own-keys.js","webpack:///./node_modules/core-js/internals/path.js","webpack:///./node_modules/core-js/internals/perform.js","webpack:///./node_modules/core-js/internals/promise-resolve.js","webpack:///./node_modules/core-js/internals/redefine-all.js","webpack:///./node_modules/core-js/internals/redefine.js","webpack:///./node_modules/core-js/internals/regexp-exec-abstract.js","webpack:///./node_modules/core-js/internals/regexp-exec.js","webpack:///./node_modules/core-js/internals/regexp-flags.js","webpack:///./node_modules/core-js/internals/regexp-sticky-helpers.js","webpack:///./node_modules/core-js/internals/require-object-coercible.js","webpack:///./node_modules/core-js/internals/same-value.js","webpack:///./node_modules/core-js/internals/set-global.js","webpack:///./node_modules/core-js/internals/set-species.js","webpack:///./node_modules/core-js/internals/set-to-string-tag.js","webpack:///./node_modules/core-js/internals/shared-key.js","webpack:///./node_modules/core-js/internals/shared-store.js","webpack:///./node_modules/core-js/internals/shared.js","webpack:///./node_modules/core-js/internals/species-constructor.js","webpack:///./node_modules/core-js/internals/string-multibyte.js","webpack:///./node_modules/core-js/internals/task.js","webpack:///./node_modules/core-js/internals/to-absolute-index.js","webpack:///./node_modules/core-js/internals/to-indexed-object.js","webpack:///./node_modules/core-js/internals/to-integer.js","webpack:///./node_modules/core-js/internals/to-length.js","webpack:///./node_modules/core-js/internals/to-object.js","webpack:///./node_modules/core-js/internals/to-primitive.js","webpack:///./node_modules/core-js/internals/to-string-tag-support.js","webpack:///./node_modules/core-js/internals/uid.js","webpack:///./node_modules/core-js/internals/use-symbol-as-uid.js","webpack:///./node_modules/core-js/internals/well-known-symbol-wrapped.js","webpack:///./node_modules/core-js/internals/well-known-symbol.js","webpack:///./node_modules/core-js/modules/es.array.find.js","webpack:///./node_modules/core-js/modules/es.array.iterator.js","webpack:///./node_modules/core-js/modules/es.array.join.js","webpack:///./node_modules/core-js/modules/es.array.map.js","webpack:///./node_modules/core-js/modules/es.function.name.js","webpack:///./node_modules/core-js/modules/es.object.keys.js","webpack:///./node_modules/core-js/modules/es.object.to-string.js","webpack:///./node_modules/core-js/modules/es.promise.js","webpack:///./node_modules/core-js/modules/es.regexp.exec.js","webpack:///./node_modules/core-js/modules/es.regexp.to-string.js","webpack:///./node_modules/core-js/modules/es.string.iterator.js","webpack:///./node_modules/core-js/modules/es.string.search.js","webpack:///./node_modules/core-js/modules/es.symbol.description.js","webpack:///./node_modules/core-js/modules/es.symbol.iterator.js","webpack:///./node_modules/core-js/modules/es.symbol.js","webpack:///./node_modules/core-js/modules/web.dom-collections.for-each.js","webpack:///./node_modules/core-js/modules/web.dom-collections.iterator.js","webpack:///(webpack)/buildin/global.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/plugin_ditto/cartridge/client/default/js/productDetail.js\");\n","const defaultConfig = {\n rows: 0,\n dots: true,\n infinite: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n responsive: [\n {\n breakpoint: 1024,\n settings: {\n dots: true,\n infinite: true,\n rows: 0,\n slidesToShow: 3,\n slidesToScroll: 3\n\n }\n }, {\n breakpoint: 600,\n settings: {\n dots: true,\n infinite: true,\n rows: 0,\n slidesToShow: 2,\n slidesToScroll: 2\n }\n }, {\n breakpoint: 480,\n settings: {\n dots: true,\n infinite: true,\n rows: 0,\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }\n ]\n};\n\n/**\n * Dynamically creates Bootstrap carousel from response containing images\n * @param {string} html - The carousel html\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nconst createProductCarousel = (html, $productContainer) => {\n const $carouselContainer = $productContainer.find('.carousel-container');\n const $oldCarousel = $($carouselContainer).find('.product-carousel');\n\n $carouselContainer.off('touchstart click', '.slick-paging-btn');\n $oldCarousel.off('beforeChange');\n $oldCarousel.find('.product-carousel').slick('unslick');\n\n $($carouselContainer)\n .empty()\n .append(html);\n\n const $carousel = $($carouselContainer).find('.product-carousel');\n initProductCarousel($carousel);\n};\n\n/**\n * Initializes the carousel with all the necessary events\n * @param {jQuery} $carousel The jQuery object for the carousel\n */\nconst initProductCarousel = ($carousel) => {\n const $carouselContainer = $carousel.parents('.carousel-container');\n\n $carousel.slick({\n rows: 0\n });\n\n $carousel.on('beforeChange', function (event, slick, currentSlide, nextSlide) {\n var $slickPaging = $carouselContainer.find('.slick-paging');\n $slickPaging.find('.slick-paging-btn').removeClass('active');\n $slickPaging.find(`.slick-paging-btn:nth-child(${nextSlide + 1})`).addClass('active');\n });\n\n $carouselContainer.on('touchstart click', '.slick-paging-btn', function () {\n $carousel.slick('slickGoTo', $(this).index());\n });\n};\n\nconst initCarousel = ($carousel) => {\n if (!$carousel.data('slick')) {\n $carousel.slick(defaultConfig);\n } else {\n $carousel.slick();\n }\n};\n\nconst init = () => {\n $('.carousel').each(function () {\n initCarousel($(this));\n });\n\n $('.product-carousel').each(function () {\n initProductCarousel($(this));\n });\n\n $('body').on('shown.bs.modal', '.modal', function () {\n $(this).find('.product-carousel').each(function () {\n initProductCarousel($(this));\n });\n });\n\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach((mutation) => {\n if (mutation.addedNodes && mutation.addedNodes.length > 0) {\n const carousels = $(mutation.addedNodes).find('.slot-carousel');\n for (let i = 0, len = carousels.length; i < len; i++) {\n initCarousel($(carousels[i]));\n }\n }\n });\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n};\n\nmodule.exports = {\n init,\n methods: {\n createProductCarousel\n }\n};\n","'use strict';\n\nvar carouselHelper = require('../components/carousel');\nvar focusHelper = require('base/components/focus');\n\n/**\n * Retrieves the relevant pid value\n * @param {jquery} $el - DOM container for a given add to cart button\n * @return {string} - value to be used when adding product to cart\n */\nfunction getPidValue($el) {\n var pid;\n\n if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) {\n pid = $($el)\n .closest('.modal-content')\n .find('.product-quickview')\n .data('pid');\n } else if ($('.product-set-detail').length || $('.product-set').length) {\n pid = $($el)\n .closest('.product-detail')\n .data(\"pid\")\n } else {\n pid = $('.product-detail:not(\".bundle-item\")').data('pid');\n }\n\n return pid;\n}\n\n/**\n * Retrieve contextual quantity selector\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {jquery} - quantity selector DOM container\n */\nfunction getQuantitySelector($el) {\n return $el && $('.set-items').length\n ? $($el)\n .closest('.product-detail')\n .find('.quantity-select')\n : $('.quantity-select');\n}\n\n/**\n * Retrieves the value associated with the Quantity pull-down menu\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {string} - value found in the quantity input\n */\nfunction getQuantitySelected($el) {\n return getQuantitySelector($el).val();\n}\n\n/**\n * Process the attribute values for an attribute that has image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n * @param {Object} msgs - object containing resource messages\n */\nfunction processSwatchValues(attr, $productContainer, msgs) {\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer.find(\n '[data-attr=\"' + attr.id + '\"] [data-attr-value=\"' + attrValue.value + '\"]'\n );\n var $swatchButton = $attrValue.parent();\n\n if (attrValue.selected) {\n $attrValue.addClass('selected');\n $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText);\n } else {\n $attrValue.removeClass('selected');\n $attrValue.siblings('.selected-assistive-text').empty();\n }\n\n if (attrValue.url) {\n $swatchButton.attr('data-url', attrValue.url);\n } else {\n $swatchButton.removeAttr('data-url');\n }\n\n // Disable if not selectable\n $attrValue.removeClass('selectable unselectable');\n\n $attrValue.addClass(attrValue.selectable ? 'selectable' : 'unselectable');\n });\n}\n\n/**\n * Process the attribute values for an attribute that has image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction processSizeValues(attr, $productContainer) {\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer.find(\n '[data-attr=\"' + attr.id + '\"] [data-attr-value=\"' + attrValue.value + '\"]'\n );\n var $swatchButton = $attrValue.parent();\n\n if (attrValue.selected) {\n $swatchButton.addClass('selected');\n } else {\n $swatchButton.removeClass('selected');\n }\n\n if (attrValue.url) {\n $swatchButton.attr('data-url', attrValue.url);\n } else {\n $swatchButton.removeAttr('data-url');\n }\n\n // Disable if not selectable\n $swatchButton.removeAttr('disabled');\n\n if (!attrValue.selectable) {\n $swatchButton.attr('disabled', true);\n }\n });\n}\n\n/**\n * Process attribute values associated with an attribute that does not have image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction processNonSwatchValues(attr, $productContainer) {\n var $attr = '[data-attr=\"' + attr.id + '\"]';\n var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first');\n $defaultOption.attr('value', attr.resetUrl);\n\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer.find($attr + ' [data-attr-value=\"' + attrValue.value + '\"]');\n $attrValue.attr('value', attrValue.url).removeAttr('disabled');\n\n if (!attrValue.selectable) {\n $attrValue.attr('disabled', true);\n }\n });\n}\n\n/**\n * Routes the handling of attribute processing depending on whether the attribute has image\n * swatches or not\n *\n * @param {Object} attrs - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {jQuery} $productContainer - DOM element for a given product\n * @param {Object} msgs - object containing resource messages\n */\nfunction updateAttrs(attrs, $productContainer, msgs) {\n // Currently, the only attribute type that has image swatches is Color.\n var attrsWithSwatches = ['color'];\n\n attrs.forEach(function (attr) {\n if (attrsWithSwatches.indexOf(attr.id) > -1) {\n processSwatchValues(attr, $productContainer, msgs);\n } else if (attr.id === 'size') {\n processSizeValues(attr, $productContainer);\n } else {\n processNonSwatchValues(attr, $productContainer);\n }\n });\n}\n\n/**\n * Updates the availability status in the Product Detail Page\n *\n * @param {Object} response - Ajax response object after an\n * attribute value has been [de]selected\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nfunction updateAvailability(response, $productContainer) {\n var availabilityValue = '';\n var availabilityMessages = response.product.availability.messages;\n if (!response.product.readyToOrder) {\n availabilityValue = '