{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../hbc_core/cartridges/app_hbc_core/cartridge/client/default/js/product/persistentWishlist.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/miraklSearch.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/addOffer.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/miraklQuantityForm.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/quickView.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/search/searchAddToCart.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,mCAAmC,iBAAiB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE;AACxE;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,+BAA+B;AAC/B;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,uCAAuC;AACvC;AACA;AACA,aAAa;AACb;AACA;AACA;;;;;;;;;;;;;AChIa;AACb;;AAEA;AACA,mBAAmB,mBAAO,CAAC,+GAAqB;AAChD,mBAAmB,mBAAO,CAAC,yHAA0B;AACrD,CAAC,E;;;;;;;;;;;;ACNY;;AAEb;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,eAAe;AACxD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,cAAc;AAC/D;AACA;AACA,KAAK;;AAEL;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,OAAO;AACpB;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;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;;;;;;;;;;;;;ACnNa;;AAEb;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;;;;;;;;;;;;;ACxDa;AACb;AACA;AACA,yBAAyB,mBAAO,CAAC,sIAAiC;;AAElE,eAAe,mBAAO,CAAC,qGAAY;AACnC,yBAAyB,mBAAO,CAAC,yHAAsB;;AAEvD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;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,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,cAAc;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,aAAa;AACtC;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,iBAAiB,EAAE,iDAAiD,UAAU,oBAAoB,UAAU,EAAE;AAChJ;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC/ca;;AAEb;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,sEAAsE;AACtE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA","file":"default/js/miraklSearch.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/custom_mirakl_thebay/cartridge/client/default/js/miraklSearch.js\");\n","'use strict';\n\n// eslint-disable-next-line require-jsdoc\nfunction addWishlistedClass(tile) {\n $('.product-tile', tile).find('.image-container').addClass('wishlist_checked');\n // If product tile belongs to Everyday, skip adding the blue heart icon\n const isEverydayTile = $('.everyDayTile', tile).length > 0;\n const isZellersTile = $('.zellersTile', tile).length > 0;\n if (!isEverydayTile && !isZellersTile) {\n $('.wishlistTile', tile).find('span').addClass('svg-svg-96-heart-blue svg-svg-96-heart-blue-dims');\n }\n $('.wishlistTile', tile).removeClass('select-wishlist').addClass('deselect-wishlist');\n}\n\n// eslint-disable-next-line require-jsdoc\nfunction removeWishlistedClass(tile) {\n $('.product-tile', tile).find('.image-container').removeClass('wishlist_checked').addClass('select-wishlist');\n const isEverydayTile = $('.everyDayTile', tile).length > 0;\n const isZellersTile = $('.zellersTile', tile).length > 0;\n if (!isEverydayTile && !isZellersTile) {\n $('.wishlistTile', tile).find('span').removeClass('svg-svg-96-heart-blue svg-svg-96-heart-blue-dims');\n $('.wishlistTile', tile).find('span').addClass('svg-svg-105-heart-o-22-19-dims svg-svg-105-heart-o-22-19');\n }\n $('.wishlistTile', tile).removeClass('deselect-wishlist').addClass('select-wishlist');\n $('.wishlistTile', tile).find('span').show();\n $('.customer-content', tile).addClass('d-none');\n $('.image-container', tile).removeClass('wishlist_checked');\n}\n\n// eslint-disable-next-line require-jsdoc\nwindow.markProductArrWishListedCache = function (wishlistProducts) {\n var remainingWlItems = [];\n wishlistProducts.forEach(function (product) {\n var tile = $('div[data-tile-pid=' + product.id + ']');\n if (tile.length > 0) {\n addWishlistedClass(tile);\n } else {\n remainingWlItems.push({ id: product.id });\n }\n var productDetail = $('.product-detail');\n const everydayProductDetail = $('.product-detail.everyday-product,.zellers-product').length > 0;\n if (productDetail != null) {\n productDetail.each(function () {\n var item = $(this);\n if (item.length > 0 && item.data('pid') == product.id) { // eslint-disable-line\n if (everydayProductDetail) {\n $('.wishlistTile', item.find('.pdpWishListCont')).removeClass('pdpdeselect-wishlist').removeClass('pdpselect-wishlist').addClass('pdpdeselect-wishlist');\n } else {\n $('.wishlistTile', item.find('.primary-images-container')).removeClass('pdpdeselect-wishlist').removeClass('pdpselect-wishlist').addClass('pdpdeselect-wishlist');\n }\n }\n });\n }\n });\n if (remainingWlItems.length) {\n $('body').attr('data-remaining-wl-items', JSON.stringify(remainingWlItems));\n }\n}\n\nfunction loadWishlist(wishlistURL) {\n $.ajax({\n url: wishlistURL,\n success: function (response) {\n if (response) {\n window.wishlistProducts = response.wishlistProducts;\n window.markProductArrWishListedCache(response.wishlistProducts);\n }\n },\n error: function (err) { // eslint-disable-line\n // do nothing\n }\n });\n}\n\nmodule.exports = {\n markProductArrWishlisted: function () {\n setTimeout(function(){\n var wishlistURL = $('body').data('wishlisturl');\n var isCustomerNoIcons = $('#cart-carousels').data('carousel-favorites-enabled');\n if (window.wishlistAutoLoad === true) {\n if (window.wishlistProducts === undefined || window.wishlistProducts === null) {\n // On cart page, we wait until user has scrolled down to the Wishlist before loading it\n if (window.location.pathname.toLowerCase().includes('/cart') && isCustomerNoIcons === false) {\n loadWishlist(wishlistURL);\n } else if (window.location.pathname.toLowerCase().includes('/cart') && isCustomerNoIcons === true) {\n return;\n } else {\n loadWishlist(wishlistURL);\n }\n } else {\n window.markProductArrWishListedCache(window.wishlistProducts);\n }\n }\n }, 1000);\n },\n makrSingleProductWishlisted: function (pid, $productContainer) {\n var singlewishlisturl = $('body').data('singlewishlisturl');\n const everydayProductDetail = $('.product-detail.everyday-product,.zellers-product').length > 0;\n if (pid && singlewishlisturl && $productContainer) {\n $.ajax({\n url: singlewishlisturl + '?pid=' + pid,\n success: function (response) {\n // if qv\n if ($productContainer.hasClass('product-quickview') || $productContainer.hasClass('primary-images-container')) {\n if(everydayProductDetail && $productContainer.hasClass('primary-images-container')) {\n $('.wishlistTile', $($productContainer).closest('.product-detail')).removeClass('pdpdeselect-wishlist').addClass('pdpselect-wishlist');\n if (response.wishlisted) {\n $('.wishlistTile', $($productContainer).closest('.product-detail')).removeClass('pdpselect-wishlist').addClass('pdpdeselect-wishlist');\n }\n } else {\n $('.wishlistTile', $productContainer).removeClass('pdpdeselect-wishlist').addClass('pdpselect-wishlist');\n if (response.wishlisted) {\n $('.wishlistTile', $productContainer).removeClass('pdpselect-wishlist').addClass('pdpdeselect-wishlist');\n }\n }\n } else if ($productContainer.hasClass('product-tile') || $productContainer.hasClass('product')) {\n removeWishlistedClass($productContainer);\n if (response.wishlisted) {\n addWishlistedClass($productContainer);\n }\n }\n },\n error: function (err) { // eslint-disable-line\n // do nothing\n }\n });\n }\n }\n};\n","'use strict';\nvar processInclude = window._hbcProcessInclude;\n\n$(document).ready(function () {\n processInclude(require('./product/quickView'));\n processInclude(require('./search/searchAddToCart'));\n});","'use strict';\n\n/**\n * Dynamically replace the returned WAInclude element by the isslot from Salesforce\n * to a direct request to their internal system call of Slot-Request followed by\n * a direct call to CQRecomm-Start to populate the recommendations\n * @param {Object} addToCartConfirmationModal popup after product added to cart\n */\nfunction addDynamicAddToCartRecommendations(addToCartConfirmationModal) {\n const appendSlotHTMLElements = function (el) {\n if (el.nodeName === 'SCRIPT') {\n var script = document.createElement('script');\n script.innerHTML = el.innerHTML;\n document.querySelector('#productAddedToCartModal .modal-body .items-like').appendChild(script);\n } else {\n document.querySelector('#productAddedToCartModal .modal-body .items-like').append(el);\n }\n };\n\n const $modalHtml = $(addToCartConfirmationModal);\n const $recsDynamicInclude = $modalHtml.find('.add-to-bag-confirm-recs');\n if ($recsDynamicInclude.length && $recsDynamicInclude.data('einstein-request')) {\n fetch($recsDynamicInclude.data('einstein-request'))\n .then((response) => response.text())\n .then((htmlEl) => {\n $(htmlEl).get().forEach((el) => appendSlotHTMLElements(el));\n window._hbcSlider.einsteinRecommendationListener();\n });\n }\n}\n\n/**\n * @param {Object} addToCartConfirmationModal popup after product added to cart\n */\nfunction showAddToCartConfirmation(addToCartConfirmationModal) {\n var htmlString = '' +\n '
' +\n '' +\n '
' +\n '' +\n '
' +\n '
' +\n ' ' +\n ' ' +\n ' ' + addedToBagLabel + '' + // eslint-disable-line no-undef\n ' ' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n $('body')\n .append(htmlString);\n\n $('#productAddedToCartModal').modal({ focus: false });\n $('.quick-view-dialog .modal-content')\n .spinner()\n .start();\n\n $('#productAddedToCartModal .modal-body').empty();\n $('#productAddedToCartModal .modal-body').html(addToCartConfirmationModal);\n addDynamicAddToCartRecommendations(addToCartConfirmationModal);\n}\n /**\n * PDP Add to cart model actions.\n *\n **/\n $('body').on('shown.bs.modal', '#productAddedToCartModal', function () {\n if($('.confirm-container').length){\n $('#productAddedToCartModal').modal({ focus: true });\n $('#productAddedToCartModal .quick-view-dialog .close').focus();\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 */\nfunction handlePostCartAdd(response) {\n if (response) {\n $('.minicart')\n .trigger('count:update', response);\n if (!response.error && response.addToCartConfirmationModal) {\n if (($('.pg-name').length > 0 && $('.pg-name').val() === 'wishlist')) {\n $('body').trigger('adobeTagManager:moveFavToBag', response);\n } else {\n $('body').trigger('adobeTagManager:addToBag', response);\n }\n\n showAddToCartConfirmation(response.addToCartConfirmationModal);\n }\n\n // don't show the error message in PLP (Product array)-SFDEV-7748\n if (response.sourcepage && response.sourcepage === 'pdp') {\n if ($('.add-to-cart-messages').length === 0) {\n $('.shipping-section-PDP').append(\n '
'\n );\n }\n if (response.message !== '') {\n $('.add-to-cart-messages')\n .html(\n // eslint-disable-next-line no-undef\n '
' +\n response.message +\n '
'\n );\n }\n\n setTimeout(function () {\n $('.add-to-cart-messages .error')\n .remove();\n }, 5000);\n }\n }\n}\n\n/**\n * Returns price value\n * @param {models.price.default.DefaultPrice} priceModel - The price model\n * @returns {number} The price value\n */\nfunction getPrice(priceModel) {\n return !priceModel.sales ? priceModel.list.value : priceModel.sales.value;\n}\n\n/**\n * Returns list price value\n * @param {models.price.default.DefaultPrice} priceModel - The price model\n * @returns {number} The list price value\n */\nfunction getListPrice(priceModel) {\n return priceModel.list ? priceModel.list.value : '';\n}\n\n/**\n * Add an offer to the cart\n */\nfunction addOfferToCart() {\n $(document).on('click', 'button.offer-add-to-cart:not(.prdt_cartwl_btn)', function () {\n var addToCartObject = $(this).data('mirakl')\n ? $(this).data('mirakl')\n : null;\n if (addToCartObject) {\n $('.quick-view-dialog .modal-content').spinner().start() || $.spinner().start();\n var addToCartUrl = addToCartObject.url;\n var pid = addToCartObject.pid;\n var priceInfo = addToCartObject.priceInfo;\n var productName = addToCartObject.productName;\n var channels = addToCartObject.channels;\n var price = getPrice(addToCartObject.price);\n var listPrice = getListPrice(addToCartObject.price);\n var operatorProductId = $(this).data('pid');\n var shopName = addToCartObject.shopName;\n var offerState = addToCartObject.offerState;\n var shopId = addToCartObject.shopId;\n var quantity = $('.quantity')\n .find('.quantity-select')\n .val();\n var form = {\n pid: pid,\n price: price,\n channels: channels,\n listPrice: listPrice,\n productName: productName,\n quantity: quantity,\n operatorProductId: operatorProductId,\n shopName: shopName,\n offerState: offerState,\n shopId: shopId,\n priceInfo: priceInfo,\n addToCartInfo: JSON.stringify(addToCartObject)\n };\n\n $(this).trigger('updateAddToCartFormData', form);\n var $productContainer = $(this).closest('.product-detail');\n\n if (addToCartUrl) {\n $.ajax({\n url: addToCartUrl,\n method: 'POST',\n data: form,\n success: function (data) {\n if ($productContainer.length && $productContainer.parents('.cart-page').length && $productContainer.hasClass('product-rec-quickview')) {\n window.location.reload();\n }\n else {\n $('body').trigger('triggerHandlePostCartAdd', data);\n $('body').trigger('product:afterAddToCart', data);\n $.spinner().stop();\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }\n }\n $('#allOffersModal').modal('hide');\n });\n}\n\n$('body').on('triggerHandlePostCartAdd', function (e, data) {\n handlePostCartAdd(data);\n});\n\nmodule.exports = {\n addOfferToCart: addOfferToCart\n};\n","'use strict';\n\n/**\n * Updates availability messages for buybox\n * @param {Object} data - The result of the controller call\n * @param {jQuery} $addToCartButton - The add to cart button\n * @param {jQuery} $availabilityMessage - The availability messages field\n */\nfunction updateAvailability(data, $addToCartButton, $availabilityMessage) {\n var availabilityValue = '';\n var availabilityMessages = data.messages;\n\n availabilityMessages.forEach(function (message) {\n availabilityValue += '
  • ' + message + '
  • ';\n });\n\n $availabilityMessage.empty().html(availabilityValue);\n\n $addToCartButton.attr('disabled', !data.success);\n}\n\n/**\n * Updates availability for offers when quantity is changed\n */\nfunction offerAvailability() {\n $(document).on('change', '.offer-quantity-select', function (e) {\n e.preventDefault();\n var url = $(this)\n .children('option:selected')\n .data('url');\n var $addToCartButton;\n var $availabilityMessage;\n\n $addToCartButton = $(this)\n .closest('.offer-details')\n .find('.offer-add-to-cart');\n $availabilityMessage = $(this)\n .closest('.offer-details')\n .find('.offer-availability-msg');\n\n $.ajax({\n url: url,\n method: 'get',\n success: function (data) {\n updateAvailability(\n data.result,\n $addToCartButton,\n $availabilityMessage\n );\n }\n });\n });\n}\n\nmodule.exports = {\n offerAvailability: offerAvailability\n};\n","'use strict';\nvar base = window._hbcProductBase;\nvar formFields = window._hbcFormFields;\nvar persistentWishlist = require('core/product/persistentWishlist');\n\nvar addOffer = require('./addOffer').addOfferToCart;\nvar miraklQuantityForm = require('./miraklQuantityForm').offerAvailability;\n\nfunction updateSellerData(isCartRec) {\n var useBuyBox = $('.sold-by-section');\n\n if (useBuyBox.length !== 0) {\n var url = $('.sold-by-section').data('url');\n $.ajax({\n url: url,\n method: 'GET',\n success: function (data) {\n $('.sold-by-section')\n .empty()\n .html(data);\n if (isCartRec) {\n $('.sold-by-section .pt-4.d-flex').removeClass('pt-4');\n }\n }\n });\n }\n}\n/**\n * Update Buy Box with the offer information\n */\nfunction updateBuyBox() {\n var useBuyBox = $('.miraklQuickViewBuyBox');\n\n if (useBuyBox.length !== 0) {\n var url = $('.miraklQuickViewBuyBox').data('url');\n $.ajax({\n url: url,\n method: 'GET',\n success: function (data) {\n $('.miraklQuickViewBuyBox')\n .empty()\n .html(data);\n if (data.indexOf('offer-add-to-cart') !== -1) {\n $('.product-option').addClass('d-none');\n }\n updateMiraklPrice();\n updateDuitesPrice();\n var offerState = $('#updated-offer-state');\n if(offerState.length > 0) {\n var state = offerState[0].value;\n updateMiraklOfferState(state);\n }\n $.spinner().stop();\n },\n error: function(err) {\n $.spinner().stop();\n }\n });\n }\n}\n\n/**\n * Updates the buybox and load offers when a variant is changed\n * @param {Object} data - The response data from the ajax call(Product-Variant)\n */\nfunction updateVariationBuyBox(data) {\n if (data && data.isMiraklEnabled) {\n $('.miraklQuickViewBuyBox')\n .empty()\n .html(data.quickViewBuyboxHtml);\n $.spinner().stop();\n }\n}\n\n/**\n * Generates the modal window on the first call.\n *\n */\nfunction getModalHtmlElement(isCartRec) {\n if ($('#quickViewModal').length !== 0) {\n $('#quickViewModal').remove();\n }\n if ($('#consent-tracking').length !== 0) {\n $('#consent-tracking').remove();\n }\n\n var htmlString = '' +\n '
    ' +\n '' +\n '
    ' +\n '' +\n '
    ';\n if (isCartRec) {\n htmlString = htmlString + '
    ' +\n ' ' +\n ' ' +\n ' ' +\n '
    ';\n }\n htmlString = htmlString +\n '
    ' +\n '
    ' +\n '
    ' +\n '
    ';\n $('body')\n .append(htmlString);\n}\n\n/**\n * Parse HTML code in Ajax response\n *\n * @param {string} html - Rendered HTML from quickview template\n * @return {QuickViewHtml} - QuickView content components\n */\nfunction parseHtml(html) {\n var $html = $('
    ')\n .append($.parseHTML(html));\n\n var body = $html.find('.product-quickview');\n var footer = $html.find('.modal-footer')\n .children();\n\n return {\n body: body,\n footer: footer\n };\n}\n\n/**\n * QV activate primary selected image zoom\n *\n * @param {this} $this - current element\n **/\nfunction activateQVPrimaryImageZoom($this) {\n var zoomer = $('.enableQVZoomer');\n if (zoomer.length > 0) {\n var $element = $this.closest('.product-quickview');\n var serverUrl = $element.find('div.pdp-carousel')\n .data('scene7hosturl');\n var asset;\n var image;\n var params = {};\n image = $this.attr('src')\n .split('image/'); // eslint-disable-line\n asset = image[image.length - 1];\n params.asset = asset;\n params.serverurl = serverUrl;\n var containerId = $this.closest('.primary-image')\n .find('.s7-viewer-qv')\n .attr('id');\n var locale = zoomer[0].dataset.locale.split('_')[0];\n var zoomViewer = new s7viewers.FlyoutViewer({ // eslint-disable-line\n 'containerId': containerId, // eslint-disable-line\n 'params': params, // eslint-disable-line\n \"localizedTexts\":{\n \"en\":{\n \"FlyoutZoomView.TIP_BUBBLE_OVER\": \"Mouse over image for a closer look\"\n },\n \"fr\":{\n \"FlyoutZoomView.TIP_BUBBLE_OVER\": \"Passez la souris sur l’image pour la voir de plus près\"\n },\n defaultLocale: locale\n }\n }).init();\n $this.addClass('hide');\n }\n}\n\n/**\n * replaces the content in the modal window on for the selected product variation.\n * @param {string} selectedValueUrl - url to be used to retrieve a new product model\n */\nfunction fillModalElement(selectedValueUrl, isCartRec) {\n $.spinner()\n .start();\n $.ajax({\n url: selectedValueUrl,\n method: 'GET',\n dataType: 'json',\n success: function (data) {\n var parsedHtml = parseHtml(data.renderedTemplate);\n\n $('#quickViewModal .modal-body')\n .empty();\n $('#quickViewModal .modal-body')\n .html(parsedHtml.body);\n $('#quickViewModal .modal-footer')\n .html(parsedHtml.footer);\n $('#quickViewModal .size-chart')\n .attr('href', data.productUrl);\n if (data.fullPdpUrl) {\n $('#quickViewModal .view-full-product-info')\n .attr('href', data.fullPdpUrl);\n } else {\n $('#quickViewModal .view-full-product-info')\n .attr('href', data.productUrl);\n }\n $('#quickViewModal .enter-message')\n .text(data.enterDialogMessage);\n $('#quickViewModal')\n .css({\n visibility: 'hidden'\n });\n $('#quickViewModal')\n .modal('show');\n\n if (isCartRec && data.product.brand.name) {\n parsedHtml.body.parents('.modal-content').find('.pdt-name-edit').text(data.product.brand.name);\n }\n\n isCartRec ? $('body').trigger('remoteTooltipInit') : $('body').trigger('adobeTagManager:showQuickView', data.product);\n\n $('body .quantity-val').on('input', function () {\n var element = $(this);\n var maxValue = parseInt($(this)\n .attr('max'), 10);\n if (element.val() >= maxValue) {\n $(this).val(maxValue);\n $(this)\n .closest('div')\n .find('select[class*=\"quantity-select\"]')\n .val(maxValue)\n .trigger('change');\n }\n });\n setTimeout(function () {\n base.activatePrimarySlick();\n base.activateVideoPlayer();\n $('body').trigger('remoteTooltipInit');\n formFields.updateSelect();\n formFields.quantityHoverBorder();\n updateBuyBox();\n updateSellerData(isCartRec);\n\n $('.quickview-close, .view-full-product-info')\n .on('click', function (e) {\n try {\n persistentWishlist.makrSingleProductWishlisted($(this).closest('.product-quickview').data('pid'), $('#' + $(this).closest('.product-quickview').data('pid')));\n // refresh the page on wishlist upon close of QV. This is to remove the tile on Wishlist landing page\n if (e.currentTarget.className.indexOf('quickview-close') > -1 && $('.page').data('action') == 'Wishlist-Show') {\n window.location.reload();\n }\n } catch (ex) { //eslint-disable-line\n // do nothing\n }\n $('#quickViewModal')\n .modal('hide');\n });\n $('.product-quickview')\n .on('click', '.primary-image img', function () {\n if ($(this).parents('.product-rec-quickview').length) {\n var pdpUrl = $(this).parents('.product-rec-quickview').find('.view-full-product-info').attr('href');\n if (pdpUrl) {\n window.location.href = pdpUrl;\n }\n } else {\n activateQVPrimaryImageZoom($(this));\n }\n });\n $.spinner()\n .stop();\n $('#quickViewModal')\n .css({\n visibility: 'visible'\n });\n $('#quickViewModal .quickview_container').focus();\n try {\n persistentWishlist.makrSingleProductWishlisted(data.product.id, $('.product-quickview'));\n base.checkProductAvailability(data, $('.product-quickview'));\n } catch (e) { //eslint-disable-line\n // do nothing\n }\n }, 300);\n },\n error: function () {\n $.spinner()\n .stop();\n }\n });\n}\n\nfunction showQuickview() {\n $('body')\n .on('click', '.quickview, .recommendation-products .product-is-rec .rec-quick-add', function (e) {\n e.preventDefault();\n var selectedValueUrl = $(this)\n .closest('a.quickview, .rec-quick-add')\n .data('quickviewUrl');\n $(e.target)\n .trigger('quickview:show');\n var isCartRec = $(this).hasClass('rec-quick-add');\n selectedValueUrl = `${selectedValueUrl}${selectedValueUrl.includes('?') ? `&recCheckout=${isCartRec}` : `?recCheckout=${isCartRec}`}`;\n getModalHtmlElement(isCartRec);\n fillModalElement(selectedValueUrl, isCartRec);\n });\n};\n\nfunction updateAttribute() {\n $('body')\n .on('product:afterAttributeSelect', function (e, response) {\n if(response && response.data && response.data.product && response.data.product.offerState) {\n var state = response.data.product.offerState;\n updateMiraklOfferState(state);\n }\n if ($('.modal.show .product-quickview>.bundle-items')\n .length) {\n $('.modal.show')\n .find(response.container)\n .data('pid', response.data.product.id);\n $('.modal.show')\n .find(response.container)\n .find('.product-id')\n .text(response.data.product.id);\n $('.modal.show')\n .find(response.container)\n .find('.bf-product-id')\n .text(response.data.product.id);\n } else if ($('.set-items')\n .length) {\n response.container.find('.product-id')\n .text(response.data.product.id);\n response.container.find('.bf-product-id')\n .text(response.data.product.id);\n } else {\n $('.modal.show .product-quickview')\n .data('pid', response.data.product.id);\n $('.modal.show .full-pdp-link')\n .attr('href', response.data.product.selectedProductUrl);\n updateVariationBuyBox(response.data);\n }\n });\n};\nfunction updateAddToCart() {\n $('body')\n .on('product:updateAddToCart', function (e, response) {\n // update local add to cart (for sets)\n $('button.add-to-cart, button.offer-add-to-cart', response.$productContainer)\n .attr('disabled',\n (!response.product.readyToOrder || !response.product.available));\n $('button.add-to-cart-global', response.$productContainer)\n .attr('disabled', (!response.product.available));\n // update global add to cart (single products, bundles)\n var dialog = $(response.$productContainer)\n .closest('.quick-view-dialog');\n $('.add-to-cart-global, .offer-add-to-cart', dialog)\n .data('readytoorder', (response.product.readyToOrder && response.product.available));\n $('.add-to-cart-global, .offer-add-to-cart', dialog)\n .data('readytoordertext', (response.product.readyToOrderMsg));\n\n $('button.add-to-cart-global,button.offer-add-to-cart')\n .text(response.product.availability.buttonName);\n });\n};\nfunction updateAvailability() {\n $('body')\n .on('product:updateAvailability', function (e, response) {\n // bundle individual products\n $('.product-availability', response.$productContainer)\n .data('ready-to-order', response.product.readyToOrder)\n .data('available', response.product.available)\n .find('.availability-msg')\n .empty()\n .html(response.message);\n\n var btn = $('.quickview-productdetails button[class*=\"add-to-cart\"]');\n if(btn.lenght > 0) {\n var available = response.product.readyToOrder && response.product.available;\n btn.toggleClass('disabled', !available);\n response.product.availability && !available ? btn.html(response.product.availability.soldout) : btn.html(response.product.availability.buttonName);\n }\n\n var dialog = $(response.$productContainer)\n .closest('.quick-view-dialog');\n\n if ($('.product-availability', dialog)\n .length) {\n // bundle all products\n var allAvailable = $('.product-availability', dialog)\n .toArray()\n .every(function (item) {\n return $(item)\n .data('available');\n });\n\n var allReady = $('.product-availability', dialog)\n .toArray()\n .every(function (item) {\n return $(item)\n .data('ready-to-order');\n });\n\n $('.global-availability', dialog)\n .data('ready-to-order', allReady)\n .data('available', allAvailable);\n\n $('.global-availability .availability-msg', dialog)\n .empty()\n .html(allReady ? response.message : response.resources.info_selectforstock);\n } else {\n // single product\n $('.global-availability', dialog)\n .data('ready-to-order', response.product.readyToOrder)\n .data('available', response.product.available)\n .find('.availability-msg')\n .empty()\n .html(response.message);\n }\n });\n};\n\nfunction updateMiraklPrice() {\n var prodPrice = $('.quickview-productdetails .prod-price');\n var newPrice = $('.mirakl-updated-price');\n if (prodPrice.length > 0 && newPrice.length > 0) {\n newPrice.detach();\n newPrice.removeClass('d-none');\n prodPrice.replaceWith(newPrice.html());\n }\n}\n\nfunction updateDuitesPrice() {\n var dutiesPrice = document.getElementsByClassName('qv_duties')[0].innerHTML;\n var offerPrice = document.getElementsByClassName('qv_formatted_sale_price')[0].innerHTML;\n var offerPriceSpan = $('.price-value-section .formatted_sale_price');\n var dutiesDiv = $('.product-edit-price .duties');\n if (dutiesDiv.length > 0) {\n if (dutiesPrice) {\n var offerPriceSpan = $('.price-value-section .formatted_sale_price');\n if (offerPriceSpan.length > 0 && offerPrice && dutiesPrice) {\n dutiesDiv.empty().html(dutiesPrice);\n offerPriceSpan.empty().html(offerPrice);\n }\n } else {\n dutiesDiv.empty();\n }\n }\n}\n\nfunction updateMiraklOfferState(state) {\n if(state) {\n var stateDiv = $('.product-state');\n var newState = $('#offer-state-new');\n var newStateFr = $('#offer-state-new-fr');\n if (stateDiv.length === 0) return;\n if (newState.length === 0 || state === newState[0].value) {\n stateDiv[0].innerText = '';\n } else if (newStateFr.length === 0 || state === newStateFr[0].value) {\n stateDiv[0].innerText = '';\n } else {\n stateDiv[0].innerText = state;\n }\n }\n}\n\nmodule.exports = {\n showQuickview: showQuickview,\n updateAttribute: updateAttribute,\n updateAddToCart: updateAddToCart,\n updateAvailability: updateAvailability,\n miraklQuantityForm: miraklQuantityForm,\n addOffer: addOffer\n};\n","'use strict';\n\n/**\n * Returns price value\n * @param {models.price.default.DefaultPrice} priceModel - The price model\n * @returns {number} The price value\n */\nfunction getPrice(priceModel) {\n if(priceModel){\n if(priceModel.sales && priceModel.sales.value){\n return priceModel.sales.value;\n }else if(priceModel.list && priceModel.list.value){\n return priceModel.list.value\n }else{\n return '';\n }\n }else{\n return '';\n }\n}\n\n/**\n * Returns list price value\n * @param {models.price.default.DefaultPrice} priceModel - The price model\n * @returns {number} The list price value\n */\nfunction getListPrice(priceModel) {\n if(priceModel){\n if(priceModel.list && priceModel.list.value){\n return priceModel.list.value\n }else{\n return '';\n }\n }else{\n return '';\n }\n}\n\n/**\n * Add Mirakl product to cart from search page\n */\nfunction searchMiraklAddToCart() {\n $(document).on('click', 'button.offer-add-to-cart-plp', function () {\n var bestOfferUrl = $(this).attr('data-bestofferurl');\n var operatorProductId = $(this).attr('data-pid');\n var atcOnTile = $(this).data('view');\n var $productTile = $(this).closest('.product-tile');\n var productType = $productTile.find('.offer-add-to-cart-plp').attr('data-producttype');\n if (atcOnTile === 'tile' && productType === 'master') {\n var selectASize = $(this).data('selectsizemsg');\n var addToCarLabel = $(this).data('add-to-cart-label');\n var button = $productTile.find('button.offer-add-to-cart-plp');\n button.text(selectASize);\n button.addClass('soldout').addClass('disabled');\n setTimeout(function () {\n button.text(addToCarLabel); // eslint-disable-line\n button.removeClass('soldout').removeClass('disabled'); // eslint-disable-line\n }, 3000);\n return;\n }\n $.spinner().start();\n $.ajax({\n url: bestOfferUrl,\n method: 'GET',\n success: function (data) {\n if(data){\n var addToCartObject = data.addToCartInfo;\n if (addToCartObject) {\n var addToCartUrl = addToCartObject.url;\n var pid = addToCartObject.pid;\n var priceInfo = addToCartObject.priceInfo;\n var productName = addToCartObject.productName;\n var channels = addToCartObject.channels;\n var price = getPrice(addToCartObject.price);\n var listPrice = getListPrice(addToCartObject.price);\n var shopName = addToCartObject.shopName;\n var offerState = addToCartObject.offerState;\n var shopId = addToCartObject.shopId;\n var quantity = 1;\n var form = {\n pid: pid,\n price: price,\n channels: channels,\n listPrice: listPrice,\n productName: productName,\n quantity: quantity,\n operatorProductId: operatorProductId,\n shopName: shopName,\n offerState: offerState,\n shopId: shopId,\n priceInfo: priceInfo,\n addToCartInfo: JSON.stringify(addToCartObject)\n };\n \n $(this).trigger('updateAddToCartFormData', form);\n \n if (addToCartUrl) {\n $.ajax({\n url: addToCartUrl,\n method: 'POST',\n data: form,\n success: function (data) {\n if(data){\n $('body').trigger('triggerHandlePostCartAdd', data);\n $('body').trigger('product:afterAddToCart', data);\n }\n $.spinner().stop();\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }else{\n $.spinner().stop();\n }\n }else{\n $.spinner().stop();\n }\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n });\n}\n\nmodule.exports = {\n searchMiraklAddToCart: searchMiraklAddToCart\n};\n"],"sourceRoot":""}