{"version":3,"file":"default/js/productDetail.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_ua_core/cartridge/client/default/js/components/scrollAnimate.js","webpack:///./cartridges/app_ua_core/cartridge/client/default/js/product/wishlist.js","webpack:///./cartridges/app_ua_emea/cartridge/client/default/js/product/wishlist.js","webpack:///./cartridges/app_ua_emea/cartridge/client/default/js/productDetail.js","webpack:///./cartridges/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.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/app_ua_emea/cartridge/client/default/js/productDetail.js\");\n","'use strict';\n\nmodule.exports = function (element) {\n var position = element && element.length ? (element.offset().top - $('.l-header-section_bottom').outerHeight()) : 0;\n if ($(window).width() < 1024) {\n position = element && element.length ? (element.offset().top - $('.l-header-section_bottom').outerHeight() - ($('.b-checkout_sticky-applypromo').length > 0 ? $('.b-checkout_sticky-applypromo').outerHeight() : 0)) : 0;\n }\n $('html, body').animate({\n scrollTop: position - 30\n }, 500);\n if (!element) {\n $('.logo-home').focus();\n }\n};\n","'use strict';\n\n\n/**\n * appends params to a url\n * @param {string} data - data returned from the server's ajax call\n * @param {Object} button - button that was clicked to add a product to the wishlist\n */\nfunction displayMessage(data, button) {\n if (button.hasClass('product-added')) {\n button.removeClass('b-product_name-fav_button').addClass('b-product_name-fav_selectButton');\n } else {\n button.removeClass('b-product_name-fav_selectButton').addClass('b-product_name-fav_button');\n }\n}\n\nmodule.exports = {\n addToWishlist: function () {\n $('body').on('click', '.add-to-wish-list', function (e) {\n e.preventDefault();\n var url = $(this).attr('href');\n var button = $(this).find('.js-whislist-icon');\n var style = $(this).attr('data-analytics-style');\n var sku = $(this).attr('data-analytics-sku');\n var color = $(this).attr('data-analytics-color');\n var pidUrl = $('.b-quantity-select').find(':selected').attr('data-url');\n var result = {};\n if (pidUrl !== null && pidUrl !== undefined) {\n pidUrl.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) {\n result[key] = value;\n });\n }\n var pid = $(this).attr('data-pid');\n var optionId = $(this).closest('.product-detail').find('.product-option').attr('data-option-id');\n var optionVal = $(this).closest('.product-detail').find('.options-select option:selected').attr('data-value-id');\n optionId = optionId || null;\n optionVal = optionVal || null;\n if (!url || !pid) {\n return;\n }\n\n if ($(this).find('.js-whislist-icon').hasClass('product-added')) {\n url = $(this).attr('remove-href');\n $(this).find('.js-whislist-icon').removeClass('product-added');\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n data: {\n pid: pid,\n optionId: optionId,\n optionVal: optionVal\n },\n success: function (data) {\n displayMessage(data, button);\n $('body').trigger('wishlist:removeItemSuccess', {\n style: style,\n sku: sku,\n color: color\n });\n },\n error: function (err) {\n displayMessage(err, button);\n }\n });\n } else {\n $(this).find('.js-whislist-icon').addClass('product-added');\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: {\n pid: pid,\n optionId: optionId,\n optionVal: optionVal\n },\n success: function (data) {\n displayMessage(data, button);\n $('body').trigger('wishlist:addItemSuccess', {\n style: style,\n sku: sku,\n color: color\n });\n },\n error: function (err) {\n displayMessage(err, button);\n }\n });\n }\n });\n }\n};\n","'use strict';\n\nvar base = require('org/product/wishlist');\n\n/**\n * appends params to a url\n * @param {string} data - data returned from the server's ajax call\n * @param {Object} button - button that was clicked to add a product to the wishlist\n */\nfunction displayMessage(data, button) {\n if (button.hasClass('product-added')) {\n button.removeClass('b-product_name-fav_button').addClass('b-product_name-fav_selectButton');\n } else {\n button.removeClass('b-product_name-fav_selectButton').addClass('b-product_name-fav_button');\n }\n}\n\n/**\n * Checks if a size is selected for the product.\n * If no size is chosen, an error message is displayed to prompt the user,\n * guiding them to select a size before adding the item to the wishlist.\n * @param {jQuery} $el - jQuery object containing the element to search for the product attribute.\n * @param {boolean} isProductAddedToWishlist - Indicates whether the product is already added to the wishlist.\n * @returns {boolean} - True if size is selected, false otherwise.\n */\nfunction checkSizeSelection($el, isProductAddedToWishlist) {\n const scrollAnimate = require('org/components/scrollAnimate');\n\n const attributeKey = 'size';\n\n if (isProductAddedToWishlist) {\n return true;\n }\n\n let attribute = $el.find('.b-product_attrs-item[data-attr=\"' + attributeKey + '\"]');\n\n if (!attribute.length) {\n return true;\n }\n\n const isSizeSelected = attribute.find('.m-active').length !== 0 || attribute.find('.selected').length !== 0;\n\n if (isSizeSelected) {\n attribute.removeClass('has-error');\n attribute.find('.invalid-feedback').hide();\n return isSizeSelected;\n }\n\n attribute.addClass('has-error');\n\n if (attribute.find('.invalid-feedback').length) {\n attribute.find('.invalid-feedback').show();\n } else {\n attribute.append(\n '