{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_pacsun_sfra/cartridge/client/default/js/product/afterpayContent.js","webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./cartridges/app_pacsun_sfra/cartridge/client/default/js/afterpay.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","afterpay","init","$","on","openAfterpayModal","remove","removeClass","jsInstanceType","document","URL","indexOf","jsScript","createElement","window","utag_data","page_name","page_type","type","src","append","e","preventDefault","url","this","prop","data","length","marginTop","topAdj","htmlString","addClass","css","parseInt","isNaN","innerHeight","outerHeight","height","show","popupVerticalCenter","include","keys","forEach","processInclude","require","getWidget","updatedProductID","updatedProductPrice","className","$productContainer","getUpdatedWidgetUrl","val","queryString","ajax","method","success","updatedWidget","find","html","ready","cartTotal","ajaxStart","hasClass","text","ajaxComplete","newCartTotal"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAA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,CACH9B,IAAK2B,EAAsBE,EAC3BE,OAAQ,MACRC,QAAS,SAAU7B,GACXA,EAAK8B,qBAC4B,IAAtBP,GACPA,EAAkBQ,KAAK,oBAAoBC,KAAKhC,EAAK8B,eACrDP,EAAkBQ,KAAK,oBAAoBnB,aACP,IAAtBW,IACd9C,EAAE,oBAAoBuD,KAAKhC,EAAK8B,eAChCrD,EAAE,oBAAoBmC,YAO1CnC,EAAEM,UAAUkD,OAAM,WAGd,IAAIC,EAFJjB,EAAeC,EAAQ,KAIvBzC,EAAEM,UAAUoD,WAAU,WACb1D,EAAE,oBAAoB2D,SAAS,aAChC3D,EAAE,oBAAoB4B,SAAS,WAE3B5B,EAAE,2CAA2CwB,SAC7CiC,EAAYzD,EAAE,gBAAgB4D,YAK1C5D,EAAEM,UAAUuD,cAAa,WACrB,IAAIC,EAAe9D,EAAE,gBAAgB4D,OAEjC5D,EAAE,oBAAoB2D,SAAS,aAC/B3D,EAAE,oBAAoBI,YAAY,WAE9BJ,EAAE,2CAA2CwB,QAAUiC,IAAcK,GACrEpB,EAAU,KAAM,KAAM,yBAGtB1C,EAAE,0CAA0CwB,QAK5CkB,EAJgB1C,EAAE,eAAe4D,OACd5D,EAAE,mBAAmBuB,KAAK,SAGV,uBAFZvB,EAAE","file":"default/js/afterpay.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 = 49);\n","'use strict';\r\n\r\n/**\r\n * popupVerticalCenter - function open modal\r\n */\r\nfunction popupVerticalCenter() {\r\n var marginTop = $('.modal-dialog').css('margin-top');\r\n var topAdj = parseInt(marginTop, 10);\r\n\r\n topAdj = isNaN(topAdj) ? 0 : topAdj;\r\n\r\n if (window.innerHeight > $('.modal-dialog').outerHeight()) {\r\n $('.modal-dialog').css('top', ((window.innerHeight - $('.modal-dialog').height() - (topAdj * 2)) / 2) + 'px');\r\n } else {\r\n $('.modal-dialog').css('top', -(topAdj) + 'px');\r\n }\r\n\r\n $('#afterpayModal').show();\r\n}\r\n\r\nvar afterpay = {\r\n\r\n init: function () {\r\n $('div[itemid=\"#product\"], .product-detail, .cart-page, .tab-content').on('click', '.afterpay-link a', openAfterpayModal); // eslint-disable-line\r\n\r\n $('body').on('click', '#afterpayModal .modal-header button', function () {\r\n $('#afterpayModal').remove();\r\n $('body').removeClass('modal-open');\r\n });\r\n\r\n // Dynamic Afterpay\r\n var jsInstanceType = document.URL.indexOf('www.pacsun.com') > 0 ? '.afterpay' : '.sandbox.afterpay';\r\n var jsScript = document.createElement('script');\r\n if (window.utag_data && (window.utag_data.page_name === 'basket' || window.utag_data.page_type === 'product')) {\r\n jsScript.type = 'text/javascript';\r\n jsScript.src = 'https://js' + jsInstanceType + '.com/afterpay-1.x.js';\r\n $('footer').append(jsScript);\r\n } else if (window.utag_data && window.utag_data.page_name === 'checkout') {\r\n jsScript.type = 'text/javascript';\r\n jsScript.src = 'https://portal' + jsInstanceType + '.com/afterpay.js';\r\n $('footer').append(jsScript);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * openAfterpayModal - function open modal\r\n * @param {Object} e - element\r\n */\r\nfunction openAfterpayModal(e) {\r\n e.preventDefault();\r\n\r\n var url = $(this).prop('href');\r\n\r\n $.get(url, function (data) {\r\n if ($('#afterpayModal').length) {\r\n $('#afterpayModal').remove();\r\n }\r\n var htmlString = ''\r\n + '
'\r\n + '
'\r\n + ''\r\n + '
'\r\n + '
'\r\n + ' '\r\n + '
'\r\n + '
' + data + '
'\r\n + '
'\r\n + '
'\r\n + '
';\r\n $('body').append(htmlString);\r\n $('body').addClass('modal-open');\r\n $('#afterpayModal').addClass('show');\r\n\r\n popupVerticalCenter();\r\n\r\n $('#overview-container-circles img').on('load', function () {\r\n afterpay.popupVerticalCenter();\r\n });\r\n });\r\n}\r\n\r\nmodule.exports = afterpay;\r\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","'use strict';\n/* global $ */\nvar processInclude = require('base/util');\n/**\n * Gets Widget HTML from AfterPay API\n * @param {string} updatedProductID - product ID\n * @param {number} updatedProductPrice - product price\n * @param {string} className - HTML class name\n * @param {jquery} $productContainer - DOM container for product\n */\nfunction getWidget(updatedProductID, updatedProductPrice, className, $productContainer) {\n var getUpdatedWidgetUrl = $('.updated-widget').val();\n var queryString = '?productID=' + updatedProductID + '&updatedProductPrice=' + updatedProductPrice + '&className=' + className;\n $.ajax({\n url: getUpdatedWidgetUrl + queryString,\n method: 'GET',\n success: function (data) {\n if (data.updatedWidget) {\n if (typeof $productContainer !== 'undefined') {\n $productContainer.find('.afterpay-widget').html(data.updatedWidget);\n $productContainer.find('.afterpay-widget').show();\n } else if (typeof $productContainer === 'undefined') {\n $('.afterpay-widget').html(data.updatedWidget);\n $('.afterpay-widget').show();\n }\n }\n }\n });\n}\n\n$(document).ready(function () {\n processInclude(require('./product/afterpayContent'));\n\n var cartTotal;\n\n $(document).ajaxStart(function () {\n if (!$('.afterpay-widget').hasClass('loading')) {\n $('.afterpay-widget').addClass('loading');\n\n if ($('.afterpay-widget .cart-afterpay-message').length) {\n cartTotal = $('.grand-total').text();\n }\n }\n });\n\n $(document).ajaxComplete(function () {\n var newCartTotal = $('.grand-total').text();\n\n if ($('.afterpay-widget').hasClass('loading')) {\n $('.afterpay-widget').removeClass('loading');\n\n if ($('.afterpay-widget .cart-afterpay-message').length && cartTotal !== newCartTotal) {\n getWidget(null, null, 'cart-afterpay-message');\n }\n\n if ($('.afterpay-widget .pdp-afterpay-message').length) {\n var productID = $('.product-id').text();\n var productPrice = $('.js-add-to-cart').data('price');\n var productContainer = $('.product-detail');\n\n getWidget(productID, productPrice, 'pdp-afterpay-message', productContainer);\n }\n }\n });\n});\n"],"sourceRoot":""}