{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../hbc_core/cartridges/app_hbc_core/cartridge/client/default/js/checkout/paybright.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/miraklProductDetails.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/addOffer.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/detail.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/loadMiraklOffers.js","webpack:///./cartridges/custom_mirakl_thebay/cartridge/client/default/js/product/miraklQuantityForm.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;AACA,WAAW,OAAO;AAClB;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,aAAa;AACb,SAAS;;AAET;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC7Ea;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B;AAC3B,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,mBAAO,CAAC,yGAAkB;AAC7C,mBAAmB,mBAAO,CAAC,6HAA4B;AACvD,mBAAmB,mBAAO,CAAC,iIAA8B;AACzD,mBAAmB,mBAAO,CAAC,6GAAoB;AAC/C;AACA;AACA;AACA,CAAC;;;;;;;;;;;;;;;ACvCY;;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,uBAAuB,mBAAO,CAAC,qHAAoB;AACnD,gBAAgB,mBAAO,CAAC,sHAAyB;;AAEjD;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;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;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;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,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;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,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;;;AAIL;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC3ba;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,cAAc;AACrC;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC7Ea;;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","file":"default/js/miraklProductDetails.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/miraklProductDetails.js\");\n","/**\n * @param {string} amount\n */\nfunction togglePaybright(amount, hasGiftCardInCart) {\n var paybrightPrice = document.getElementById('paybrightprices');\n // Checking the mulitple iframes is intialized or not\n // if mulitple are there we are removing next all the div except one\n var pbModalLength = document.querySelectorAll('[id=pbModal]').length;\n if (pbModalLength > 1) {\n $('#pbModal').nextAll().remove();\n }\n\n // skip if price is not found or there is any gift card in the cart\n if (!paybrightPrice || hasGiftCardInCart) {\n if (!$('#paybright_prequalify_div').hasClass('d-none')) {\n $('#paybright_prequalify_div').addClass('d-none');\n $('#svg-svg-paybright-prequalify').addClass('d-none');\n }\n return;\n }\n\n var min = convertToFloat(paybrightPrice.getAttribute('data-paybrightMin'));\n var max = convertToFloat(paybrightPrice.getAttribute('data-paybrightMax'));\n if (convertToFloat(amount) >= min && convertToFloat(amount) <= max) {\n $(' #paybright_prequalify_div').removeClass('d-none');\n $('#svg-svg-paybright-prequalify').removeClass('d-none');\n document.getElementById('paybright_prequalify_div').setAttribute('data-pb_financedamount', amount);\n try {\n window.pb_prequalify_init({\n triggerElement: 'Link',\n triggerClass: 'paybright-widget-container',\n noFiguresInModal: false,\n showDecimals: true,\n triggerText: window.globalData.site.locale === 'fr_CA' ? 'En savoir plus' : 'Learn More',\n hideTriggerLeadText: false\n });\n } catch (err) {\n\n }\n } else {\n $(' #paybright_prequalify_div').addClass('d-none');\n $('.svg-svg-paybright').addClass('d-none');\n }\n}\n\n/**\n * To convert string to float\n */\nfunction convertToFloat(val) {\n if (val !== '') {\n val = parseFloat(val);\n }\n return val;\n}\n\n/**\n * To disable paybright payment option\n */\nfunction disablePaybrightOption() {\n // diable Paybright payment option\n $('li.nav-item.paybright-payment-item').addClass('paypal-disable');\n $('#paybrightPaymentspay_over_timeRadioButton').attr('disabled', true);\n}\n\n/**\n * To enable paybright payment option\n */\nfunction enablePaybrightOption() {\n // diable Paybright payment option\n $('li.nav-item.paybright-payment-item').removeClass('paypal-disable');\n $('#paybrightPaymentspay_over_timeRadioButton').removeAttr('disabled');\n}\n\nmodule.exports = {\n togglePaybright: togglePaybright,\n disablePaybrightOption: disablePaybrightOption,\n enablePaybrightOption: enablePaybrightOption\n};\n","'use strict';\n\nvar processInclude = window._hbcProcessInclude;\n// To hide 'Other ways to Pay' label when there is no option on PDP\nfunction toggleOtherWaysToPay(){\n var pbPreQualifyDiv = document.getElementById('paybright_prequalify_div')? true : false;\n var neoPDPDiv = document.getElementById('neopdpshow') ? true : false;\n if(!pbPreQualifyDiv && !neoPDPDiv){\n $('#other-payments-label').addClass('d-none');\n }else{\n if((pbPreQualifyDiv && $('#paybright_prequalify_div').hasClass('d-none')) || !pbPreQualifyDiv){\n if((neoPDPDiv && $('#neopdpshow').hasClass('d-none')) || !neoPDPDiv){\n $('#other-payments-label').addClass('d-none');\n }\n }\n }\n}\n\nfunction togglePDPMobile(){// to toggle PDP product name section for mobile view, on the top of image container\n var isMobile = false; //initiate as false\n // device detection\n isMobile = window.matchMedia(\"only screen and (max-width: 543px)\").matches;\n if(isMobile){\n $(\".mobile-toggle-main-div\").appendTo(\".mobile-toggle-div\");\n }\n else{\n $(\".mobile-toggle-main-div\").prependTo(\".pdp-right-section\");\n }\n $(\".primary-images-container\").css(\"visibility\", \"visible\");\n}\n\n$(document).ready(function () {\n processInclude(require('./product/detail'));\n processInclude(require('./product/loadMiraklOffers'));\n processInclude(require('./product/miraklQuantityForm'));\n processInclude(require('./product/addOffer'));\n toggleOtherWaysToPay();\n togglePDPMobile();\n window.addEventListener('resize', togglePDPMobile);\n});\n\n \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\nvar loadMiraklOffers = require('./loadMiraklOffers');\nvar paybright = require('core/checkout/paybright');\n\n/**\n * Compute the product price and duties for display purpose\n * @param {Object} Duties Object.\n */\nfunction updatePriceWithDuties(dutiesHtml) {\n var miraklProductData = $('#miraklbuybox').find('button.offer-add-to-cart').data('mirakl');\n if(miraklProductData && miraklProductData.price && miraklProductData.price.sales && miraklProductData.price.sales.value){\n updateMiraklPrice(miraklProductData.price.sales.value, dutiesHtml);\n }\n}\n\n$(document).on('mirakl:price:updated', function(e, dutiesHtml) {\n var miraklProductData = $('#miraklbuybox').find('button.offer-add-to-cart').data('mirakl');\n var isPriceRange = $('.product-secondary-section .prod-price .range');\n\n if ((isPriceRange.length < 0 || isPriceRange.data('is-price-range') !== true) && miraklProductData) {\n var productPrice = parseFloat($('.product-secondary-section .prod-price .js-final-sale-price').attr('data-unformatted-price'), 10);\n var duties = null, newProductPrice, dutiesMsg;\n var productDiscountPrice = miraklProductData && miraklProductData.price && miraklProductData.price.list && miraklProductData.price.list.value ? miraklProductData.price.list.value : '';\n var productDiscountPriceStr = productDiscountPrice ? $('body').hasClass('fr_CA') ? productDiscountPrice + ' $' : '$'+productDiscountPrice.toFixed(2) : '';\n if (dutiesHtml && $(dutiesHtml).filter('.duties-content') && $(dutiesHtml).filter('.duties-content').data('value')) {\n duties = parseFloat($(dutiesHtml).filter('.duties-content').attr('data-value'), 10);\n dutiesMsg = $(dutiesHtml).filter('.duties-content').attr('data-duties-msg')\n } else if ( $('#miraklbuybox').length > 0) {\n duties = parseFloat($('#miraklbuybox').find('.duties-content').attr('data-value'), 10);\n dutiesMsg = $('#miraklbuybox').find('.duties-content').attr('data-duties-msg');\n }\n var $listPrice = $('.product-secondary-section .prices .prod-price .list');\n if (productDiscountPrice === ''){\n $listPrice.addClass('d-none');\n }else{\n $listPrice.removeClass('d-none');\n if ($listPrice.length) {\n $listPrice.addClass('strike-through');\n $listPrice.find('.value').attr('content', productDiscountPrice);\n }\n }\n if (duties) {\n newProductPrice = productPrice - duties;\n var newProductPriceStr = $('body').hasClass('fr_CA') ? newProductPrice + ' $' : '$'+newProductPrice.toFixed(2);\n $('.product-secondary-section .prod-price .js-final-sale-price').text(newProductPriceStr);\n $('.product-secondary-section .prod-price .js-final-sale-price').data('unformatted-price', newProductPrice);\n\n var parentElement = $('div.prices');\n parentElement.find('span.duties').remove();\n parentElement.append('' + dutiesMsg + '');\n } else {\n var productPriceStr = $('body').hasClass('fr_CA') ? productPrice + ' $' : '$'+productPrice.toFixed(2);\n $('div.prices .duties').remove();\n $('.product-secondary-section .prod-price .js-final-sale-price').text(productPriceStr);\n $('.product-secondary-section .prod-price .js-final-sale-price').data('unformatted-price', productPrice);\n }\n }\n});\n\n/**\n * Updates the free shipping element\n */\nfunction updateFreeShipping() {\n const freeShippingTextPDP = $(\".mp-free-shipping-text-pdp\");\n const freeShippingTextLink = $(\".free-shipping-mp-link\");\n const freeShippingMessage = $(\".mp-dynamic-free-shipping-text\").data(\"freeshippingmsg\");\n const isFreeShippingAvailable = $(\".mp-dynamic-free-shipping-text\").data(\"isfreeshippingavailable\");\n const freeShippingMPElementEffect = $(\".shimmerBG-pdp-MP\");\n const freeShippingLable = $(\".free-shipping-mp-label\");\n const dnone = 'd-none';\n if (freeShippingMPElementEffect.length > 0) freeShippingMPElementEffect.addClass(dnone);\n if (freeShippingLable.length > 0) {\n freeShippingLable.addClass('d-inline-flex');\n freeShippingLable.removeClass(dnone);\n }\n if(!freeShippingMessage || !freeShippingMessage.length) return;\n if (isFreeShippingAvailable) {\n if(freeShippingTextPDP) freeShippingTextPDP.text(freeShippingMessage);\n if(freeShippingTextLink) freeShippingTextLink.removeClass(dnone);\n } else {\n if(freeShippingTextPDP) freeShippingTextPDP.text(freeShippingMessage);\n if(freeShippingTextLink) freeShippingTextLink.addClass(dnone);\n }\n}\n\n/**\n * Updates the buybox and load offers when a variant is changed\n * @param {Object} response - The response from the ajax call(Product-Variant)\n */\nfunction updateBuyBox(response) {\n var pdpPostalCodeSection = $(\".shipping-option-postal-code\");\n var freeShippingText = $(\".free-ship-text-mp\");\n var dnone=\"d-none\";\n if (response.data && response.data.isMiraklEnabled && response.data.product && response.data.product.available) {\n if (pdpPostalCodeSection && pdpPostalCodeSection.length > 0 && pdpPostalCodeSection.hasClass(dnone)){\n pdpPostalCodeSection.removeClass(dnone);\n }\n if (freeShippingText && freeShippingText.length > 0 && freeShippingText.hasClass(dnone)) {\n freeShippingText.removeClass(dnone);\n }\n var miraklBuyBox = $('#miraklbuybox');\n var normalBuyBox = $('.buybox');\n if (response.data.callP11) {\n var buyBoxUrl = miraklBuyBox.data('buybox-url');\n buyBoxUrl += \"?pid=\" + response.data.product.id;\n $.ajax({\n url: buyBoxUrl,\n type: 'get',\n success: function (data) {\n miraklBuyBox.empty();\n miraklBuyBox.html(data);\n var atcButton = miraklBuyBox.find('button.offer-add-to-cart');\n var miraklData = atcButton.data('mirakl');\n var miraklHudsonPoint = atcButton.data('hudson-point');\n if (miraklHudsonPoint && !isNaN(miraklHudsonPoint)) {\n $('.rewards-message-section .reward-est-point').text(parseInt(miraklHudsonPoint));\n }\n updatePriceWithDuties(data);\n miraklBuyBox.removeClass(dnone);\n normalBuyBox.addClass(dnone);\n updateFreeShipping();\n $.spinner().stop();\n },\n error: function (err) {\n miraklBuyBox.addClass(dnone);\n normalBuyBox.removeClass(dnone);\n $.spinner().stop();\n }\n });\n miraklBuyBox.addClass(dnone);\n normalBuyBox.removeClass(dnone);\n } else {\n miraklBuyBox.addClass(dnone);\n normalBuyBox.removeClass(dnone);\n }\n }\n else {\n if (pdpPostalCodeSection && pdpPostalCodeSection.length > 0) {\n pdpPostalCodeSection && pdpPostalCodeSection.addClass(dnone);\n }\n if (freeShippingText && freeShippingText.length > 0) {\n freeShippingText && freeShippingText.addClass(dnone);\n }\n }\n}\nfunction fillAllOffersModalElement(selectedValueUrl, miraklOffersJson, productData) {\n if (typeof miraklOffersJson !== 'undefined' && miraklOffersJson.length) {\n $.ajax({\n url: selectedValueUrl,\n type: 'POST',\n data: {\n miraklOffersJson: JSON.stringify(miraklOffersJson),\n productDataJSON: JSON.stringify(productData)\n },\n success: function (data) {\n if (data.offersHtml !== '') {\n $('.alloffers-modal-body').empty();\n $('.alloffers-modal-body').html(data.offersHtml);\n $('#allOffersModal').modal('show');\n $.spinner().stop();\n }\n },\n error: function (err) {\n $.spinner().stop();\n }\n });\n }\n $.spinner().stop();\n}\nfunction fillSellerModalElement(selectedValueUrl, sellerId) {\n $.ajax({\n url: selectedValueUrl,\n method: 'POST',\n data: {\n sellerId: sellerId\n },\n success: function (data) {\n $('#sellerShippingReturnPolicyModal .seller-shipping-return-policy-modal-content').empty();\n $('#sellerShippingReturnPolicyModal .seller-shipping-return-policy-modal-content').html(data);\n $('#sellerShippingReturnPolicyModal').modal('show');\n $.spinner().stop();\n },\n error: function (err) {\n $.spinner().stop();\n }\n });\n}\n\nfunction updateMiraklHudsonPoint() {\n var atcButton = $('#miraklbuybox').find('button.offer-add-to-cart');\n if (atcButton.length > 0)\n {\n var miraklHudsonPoint = atcButton.data('hudson-point');\n if (miraklHudsonPoint && !isNaN(miraklHudsonPoint)) {\n $('.rewards-message-section .reward-est-point').text(parseInt(miraklHudsonPoint));\n }\n }\n}\n/**\n * Update attributes when the variant was changed + updateBuyBox function call\n */\nfunction updateAttribute() {\n $('body').on('product:afterAttributeSelect', function (e, response) {\n if ($('.product-set-detail').eq(0)) {\n if(response.container && response.container.prevObject.length > 0 && response.container.prevObject[0].classList.contains('quantity-select')) {\n $.spinner().stop();\n return;\n }\n updateBuyBox(response);\n }\n if(response && response.data && response.data.product && response.data.product.offerState) {\n var state = response.data.product.offerState;\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 if (response.data.product.price.sales && (!('isMarketplaceProduct' in response.data.product) || !response.data.product.isMarketplaceProduct)) {\n paybright.togglePaybright(response.data.product.price.sales.value);\n }\n\n });\n $(document).on('click', '.seller-shipping-return-policy', function (e) {\n e.preventDefault();\n $.spinner().start();\n var selectedValueUrl = $(this).data('modalurl');\n var sellerId = $(this).data('sellerid');\n fillSellerModalElement(selectedValueUrl, sellerId);\n });\n $(document).on('click', '.open-all-offers-modal', function(e) {\n e.preventDefault();\n $.spinner().start();\n var selectedValueUrl = $(this).data('modalurl');\n var miraklOffersJson = $(this).data('mirakloffers');\n var productData = $(this).data('productdata');\n fillAllOffersModalElement(selectedValueUrl, miraklOffersJson, productData);\n });\n $(document).on('click', '.seller-tooltip-btn', function (e) {\n $('body').click();\n });\n var miraklData = $('#miraklbuybox').find('button.offer-add-to-cart').data('mirakl');\n if(miraklData){\n $('.product-secondary-section .prod-price .js-final-sale-price').html(miraklData.price.sales.formatAmount);\n $('.product-secondary-section .prod-price .js-final-sale-price').attr('data-unformatted-price', miraklData.price.sales.value);\n }\n\n updatePriceWithDuties();\n updateMiraklHudsonPoint();\n}\n\nfunction handleOfferState() {\n var offerStateDiv = $('.bestoffer-state');\n if(offerStateDiv.length > 0){\n var offerState = offerStateDiv.detach();\n offerState.removeClass('d-none');\n var state;\n if ('innerText' in offerState && offerState.innerText !== null) {\n state = offerState.innerText.toLocaleLowerCase()\n } else {\n state = '';\n }\n // We want to hide the state when is one of these.\n if(state.includes('new') || state.includes('neuf') || state.includes('nouveauté')) return;\n $('.attributes').before(offerState);\n }\n}\n\nfunction updateMiraklPrice(priceValue, dutiesHtml) {\n var prodPrice = $('.product-secondary-section .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 $(document).trigger('mirakl:price:updated', dutiesHtml);\n paybright.togglePaybright(priceValue);\n }\n $(document).trigger('mirakl:price:updated', dutiesHtml);\n}\n\n$(document).on('click', '.shipping-returns a', function (e) {\n e.preventDefault();\n $.spinner().start();\n $.ajax({\n url: this.href,\n method: 'GET',\n success: function (data) {\n const $shippingReturnsEl = $(data).find('.m-shop-page');\n $shippingReturnsEl.find('.mkp-shop-upper-content-left').remove();\n $shippingReturnsEl.append($('
' + data + '
').find('link[href*=\"/css/shopPage.css\"]'));\n $shippingReturnsEl.find('.shipping-return-title').removeClass('d-none').addClass('mb-1');\n $shippingReturnsEl.find('.m-shop-page__name-row .shop-name').addClass('m-auto text-center');\n $shippingReturnsEl.find('.m-shop-page__name-row .shop-name').removeClass('pt-4 pt-lg-5');\n $('#sellerShippingReturnPolicyModal .seller-shipping-return-policy-modal-content').empty().html($shippingReturnsEl.html());\n $('#sellerShippingReturnPolicyModal').modal('show');\n $.spinner().stop();\n }\n });\n});\n\n/**\n * Handling click event to load the postal code input modal\n */\n$(document).on('click', '.seller-ship-to', (function (e) {\n e.preventDefault();\n var actionUrl = $(this).data('url');\n getModalHtmlElement();\n fillModalElement(actionUrl);\n}));\n\n/**\n * Submit the postal code modal form\n */\n$('body').on('submit', '.pdp-postalCode-form', function (e) {\n e.preventDefault();\n $('body').spinner().start();\n var shopId = $('#bestOffer-shop-id').val();\n var offerId = $('#bestOffer-id').val();\n var postalCode = $('#postal-code-input').val();\n\n $.ajax({\n url: $(this).attr('action'),\n data: {\n postalCode:postalCode,\n shopId: shopId,\n offerId: offerId\n },\n method: 'GET',\n success: function (response) {\n $('body').spinner().stop();\n if (!response.error) {\n // hide the modal and stop the loading spinner\n $('#inStoreInventoryModal').modal('hide');\n $('#inStoreInventoryModal').spinner().stop();\n\n // set the entered postal code on pdp\n $('.seller-ship-to').text(response.postalCode);\n\n // hide the existing shipping messages\n if(!$('.free-ship-text-mp').hasClass('d-none')){\n $('.free-ship-text-mp').addClass('d-none');\n }\n if(!$('#ship-to-delivery-date').hasClass('d-none')){\n $('#ship-to-delivery-date').addClass('d-none');\n }\n\n\n // show free shipping cost only if valid response from server\n if('sellerShippingCost' in response && response.sellerShippingCost !== '' && response.sellerShippingCost !== null) {\n $('.free-ship-text-mp').removeClass('d-none');\n $('#free-shipping-mp-seller').text(response.sellerShippingCost);\n }\n\n // show estimated delivery dates only if valid response from server\n if('stdDelivery' in response && response.stdDelivery !== '' && response.stdDelivery !== null) {\n $('#ship-to-delivery-date').removeClass('d-none');\n $('#ship-to-delivery-date').text(response.stdDelivery);\n }\n\n } else {\n $('.invalid-feedback').html(response.error);\n $('.btn-shipping-on-postalcode').parents('.form-group').find('label, input').addClass('is-invalid');\n }\n },\n error: function () {\n $('#inStoreInventoryModal').spinner().stop();\n }\n });\n return false;\n});\n/**\n * Generates the modal window on the first call.\n */\nfunction getModalHtmlElement() {\n if ($('#inStoreInventoryModal').length !== 0) {\n $('#inStoreInventoryModal').remove();\n }\n var htmlString = '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n ' POSTAL CODE ' +\n ' ' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
';\n $('body').append(htmlString);\n $('#inStoreInventoryModal').modal('show');\n}\n\n/**\n * Replaces the content in the modal window with find postal code components\n */\nfunction fillModalElement(targetUrl) {\n $('#inStoreInventoryModal').spinner().start();\n $.ajax({\n url: targetUrl,\n data: {},\n method: 'GET',\n success: function (response) {\n\n $('.inStoreInventoryModal .modal-header .modal-header-title').empty();\n $('.inStoreInventoryModal .modal-header .modal-header-title').html(response.postalCodeModalHeader);\n\n $('.inStoreInventoryModal .modal-body').empty();\n $('.inStoreInventoryModal .modal-body').html(response.postalCodeHtmlResponse);\n\n $('#inStoreInventoryModal').modal('show');\n $('#inStoreInventoryModal').spinner().stop();\n $\n $('.form-control-label').addClass('input-focus');\n $('#inStoreInventoryModal').find('#postal-code-input').focus();\n if(response.postalCode){\n $('#postal-code-input').val(response.postalCode);\n }\n },\n error: function () {\n $('#inStoreInventoryModal').spinner().stop();\n }\n });\n\n\n\n}\nmodule.exports = {\n updateAttribute: updateAttribute,\n handleOfferState: handleOfferState\n};\n","'use strict';\n\n/**\n * Populates the mirakl offers section on pdp\n */\nfunction loadMiraklOffers() {\n var miraklOffersJson = $('.js-mirakl-offers-json').data('mirakloffers');\n var productData = $('.js-mirakl-offers-json').data('productdata');\n var hideVariantBuyBoxQuantity = $('.js-hide-variant-quantity').data('hide');\n var url = $('.js-mirakl-offers-json').data('url');\n\n if (hideVariantBuyBoxQuantity === true) {\n $('.attribute.quantity').addClass('d-none');\n }\n\n if (typeof miraklOffersJson !== 'undefined' && miraklOffersJson.length) {\n $.ajax({\n url: url,\n type: 'post',\n data: {\n miraklOffersJson: JSON.stringify(miraklOffersJson),\n productDataJSON: JSON.stringify(productData)\n },\n success: function (data) {\n if (data.offersHtml !== '') {\n $('.mirakl-offer-list').html(data.offersHtml);\n $('.mirakl-offer-list').removeClass('d-none');\n } else {\n $('.mirakl-offer-list').addClass('d-none');\n }\n }\n });\n if (miraklOffersJson.length > 0) {\n $('.get-offer-list').removeClass('d-none');\n } else {\n $('.get-offer-list').addClass('d-none');\n }\n } else {\n $('.mirakl-offer-list').addClass('d-none');\n }\n}\n\n/**\n * Functionality for show more button - offer list\n */\nfunction showMoreOffers() {\n $(document).on('click', '.show-more-offers', function () {\n var pagesize = parseInt($(this).data('pagesize'), 10);\n var hiddenOffers = $('.offer-list-tile.d-none');\n var listSize = pagesize > hiddenOffers.length ? hiddenOffers.length : pagesize;\n\n for (var i = 0; i < listSize; i += 1) {\n $(hiddenOffers[i]).removeClass('d-none');\n }\n\n hiddenOffers = $('.offer-list-tile.d-none');\n\n if (!hiddenOffers.length) {\n $('.show-more-offers').addClass('d-none');\n }\n });\n}\n\n/**\n * Functionality for show offer list\n */\nfunction showOffers() {\n $(document).on('click', '.get-offer-list', function () {\n document.getElementById('mirakl-offer-list').scrollIntoView();\n return false;\n });\n}\n\nmodule.exports = {\n loadMiraklOffers: loadMiraklOffers,\n showMoreOffers: showMoreOffers,\n showOffers: showOffers\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"],"sourceRoot":""}