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CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;EAC7F;AACJ;AAEA4B,MAAM,CAACC,OAAO,GAAG;EACbhC,mBAAmB,EAAEA,mBAAmB;EACxCQ,cAAc,EAAEA,cAAc;EAC9BuC,YAAY,EAAEA,YAAY;EAC1BnF,kBAAkB,EAAEA,kBAAkB;EACtCyD,mBAAmB,EAAEA,mBAAmB;EACxC3D,wBAAwB,EAAEA,wBAAwB;EAClDiC,WAAW,EAAEA,WAAW;EACxB9B,kBAAkB,EAAEA,kBAAkB;EACtCmD,mBAAmB,EAAEA,mBAAmB;EACxCd,uBAAuB,EAAEA,uBAAuB;EAChDrB,uBAAuB,EAAEA;AAC7B,CAAC;;;;;;UCviBD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://shop-pay-sfcc-connector/./cartridges/int_shoppay_sfra/cartridge/client/default/js/cart/initShopPayCart.js","webpack://shop-pay-sfcc-connector/./cartridges/int_shoppay_sfra/cartridge/client/default/js/helpers/shoppayHelper.js","webpack://shop-pay-sfcc-connector/webpack/bootstrap","webpack://shop-pay-sfcc-connector/webpack/before-startup","webpack://shop-pay-sfcc-connector/webpack/startup","webpack://shop-pay-sfcc-connector/webpack/after-startup"],"sourcesContent":["/* Global Variables */\nconst helper = require('../helpers/shoppayHelper');\nconst isBuyNow = window.shoppayClientRefs.constants.isBuyNow;\nconst isAATest = window.shoppayClientRefs.preferences.shoppayAATest ? window.shoppayClientRefs.preferences.shoppayAATest : false;\nlet session;\n\n$(document).ready(function () {\n if(window.ShopPay) {\n initShopPayConfig();\n\n if (!isAATest) {\n if(window.shoppayClientRefs.constants.isCheckout && $('#email-guest').length) {\n initShopPayEmailRecognition();\n }\n\n initShopPayButton();\n }\n\n let readyOnPageLoad = helper.isReadyToOrderOnPageLoad();\n if (readyOnPageLoad) {\n let pageLoadData = helper.getInitProductData();\n helper.setInitProductData(pageLoadData); // updates global prod data.\n }\n\n /* The below code triggers if a product is a Buy Now item, but is not ready to order on page load\n (ex: required product attributes like color or size are not yet chosen). Here, a watcher is set\n to capture user interactions when product attributes are selected. Helper scripts will be triggered\n by these interactions to determine if the item is ready to order when all required attributes are\n selected.\n */\n if (isBuyNow && !readyOnPageLoad) {\n $('body').on('product:afterAttributeSelect', initBuyNow); // receives the Event & Response\n } else {\n session = initShopPaySession();\n }\n }\n});\n\nfunction initShopPayConfig() {\n window.ShopPay.PaymentRequest.configure({\n shopId: window.shoppayClientRefs.preferences.shoppayStoreId,\n clientId: window.shoppayClientRefs.preferences.shoppayClientId,\n debug: window.shoppayClientRefs.preferences.shoppayModalDebugEnabled\n });\n}\n\nfunction initShopPayButton() {\n let paymentSelector = '#shop-pay-button-container';\n window.ShopPay.PaymentRequest.createButton({buyWith: isBuyNow}).render(paymentSelector);\n helper.shoppayMutationObserver(paymentSelector);\n}\n\n\nfunction initBuyNow(e, response) {\n let responseProduct = response.data.product;\n const { buyNow, readyToOrder, id, selectedQuantity, options, childProducts } = responseProduct;\n\n if (responseProduct && buyNow) {\n if (readyToOrder) {\n initShopPaySession(buyNow, readyToOrder);\n helper.setInitProductData({\n pid: id,\n quantity: selectedQuantity,\n options: options\n });\n if (childProducts) {\n helper.productData.childProducts = childProducts;\n }\n }\n }\n}\n\nfunction initShopPayEmailRecognition() {\n /* If your checkout is not built with SFRA or you have customized and removed the 'email-guest'\n id on the email input you will need to update the id value for emailInputId\n\n Note: A 1.5 second delay has been added before attaching to the email trigger to the email field to\n accommodate users who may have incorporated browser autofills. The pop-up will appear if the field\n is autofilled with a recognized email address\n */\n setTimeout(function() {\n window.ShopPay.PaymentRequest.createLogin({emailInputId: 'email-guest'})\n .render('#shop-pay-login-container');\n }, 1500);\n}\n\n$('body').on('cart:update product:afterAddToCart promotion:success', function () {\n /* Only interested in cart updates on Cart page (cart updates are not triggered in checkout). Buy Now already\n has a separate event handler for changes to attribute selections\n */\n if (window.ShopPay && !isBuyNow) {\n if (!session) {\n session = initShopPaySession();\n } else {\n const paymentRequestResponse = helper.buildPaymentRequest(session);\n const responseJSON = paymentRequestResponse ? paymentRequestResponse.responseJSON : null;\n\n if (responseJSON) {\n helper.shoppayBtnDisabledStyle(document.getElementById(\"shop-pay-button-container\"));\n }\n\n if (responseJSON && !responseJSON.error && responseJSON.paymentRequest !== null) {\n session.close();\n session = initShopPaySession();\n }\n }\n }\n});\n\n\nfunction initShopPaySession(paymentRequestInput, readyToOrder) {\n let paymentRequest;\n let paymentRequestResponse;\n let responseJSON;\n\n if (isBuyNow && paymentRequestInput) {\n paymentRequest = paymentRequestInput;\n } else if (isBuyNow && !paymentRequestInput) {\n let productData = helper.getInitProductData();\n if (productData) {\n paymentRequestResponse = helper.createResponse(productData, window.shoppayClientRefs.urls.BuyNowData);\n if (paymentRequestResponse.exception || paymentRequestResponse.error){\n /* No need to close any session because a session does not exist at this point (has not yet been\n initiated). Return to exit function - don't reload the page in case there is a page rendering\n issue (will result in infinite reload loop).\n */\n return;\n }\n paymentRequest = paymentRequestResponse.paymentRequest;\n responseJSON = paymentRequestResponse ? paymentRequestResponse : null;\n }\n } else {\n paymentRequestResponse = helper.buildPaymentRequest(session);\n responseJSON = paymentRequestResponse ? paymentRequestResponse.responseJSON : null;\n }\n\n if (paymentRequest || (responseJSON && !responseJSON.error)) {\n const initialPaymentRequest = responseJSON && responseJSON.paymentRequest ? window.ShopPay.PaymentRequest.build(responseJSON.paymentRequest) : window.ShopPay.PaymentRequest.build(paymentRequest);\n // Enable BuyNow Button Click on PDP if Product is Ready To Order\n helper.shoppayBtnDisabledStyle(document.getElementById(\"shop-pay-button-container\"), readyToOrder);\n\n let shoppaySession = window.ShopPay.PaymentRequest.createSession({\n paymentRequest: initialPaymentRequest\n });\n\n if (shoppaySession) {\n helper.setSessionListeners(shoppaySession);\n $('body').off('product:afterAttributeSelect', initBuyNow);\n\n $('body').on('product:afterAttributeSelect', function(e, response) {\n let responseProduct = response.data.product;\n if (isBuyNow && responseProduct.buyNow) {\n helper.setInitProductData({\n pid: responseProduct.id,\n quantity: responseProduct.selectedQuantity,\n options: responseProduct.options\n });\n if (shoppaySession) {\n shoppaySession.close();\n let updatedPaymentRequest = window.ShopPay.PaymentRequest.build(responseProduct.buyNow);\n shoppaySession = window.ShopPay.PaymentRequest.createSession({\n paymentRequest: updatedPaymentRequest\n });\n\n helper.setSessionListeners(shoppaySession);\n }\n\n } else {\n $.ajax({\n url: helper.getUrlWithCsrfToken(window.shoppayClientRefs.urls.GetCartSummary),\n type: 'GET',\n contentType: 'application/json',\n async: false,\n success: function (data) {\n if (!data.error) {\n if (shoppaySession) {\n shoppaySession.close();\n }\n let paymentRequest = window.ShopPay.PaymentRequest.build(response.product.buyNow);\n shoppaySession = window.ShopPay.PaymentRequest.createSession({\n paymentRequest: paymentRequest\n });\n helper.setSessionListeners(shoppaySession);\n }\n },\n error: function (err) {\n if (err.responseJSON || err.status !== 200) {\n session.close();\n // modal hasn't opened yet so \"windowclosed\" listener won't fire\n window.location.reload();\n return;\n }\n }\n });\n }\n });\n }\n\n return shoppaySession;\n }\n}\n\n\nmodule.exports = {\n initShopPaySession: initShopPaySession\n};\n","/* eslint-disable no-unused-vars */\n/* Global Variables */\nlet checkoutUrl = null;\nlet observer;\nlet orderConfirmationData;\nlet productData = {};\nlet reloadOnClose = true;\nlet sourceIdentifier = null;\nconst technicalErrorMsg = window.shoppayClientRefs.constants.technicalError;\nlet token = null;\n\n/**\n * Add csrf token param to url\n * @param {string} url - source url\n * @param {string} basketId - UUID of the temporary basket in the session, if applicable\n * @returns {string} - url with csrf_token param\n */\nfunction getUrlWithCsrfToken(url, basketId) {\n const urlInstance = new URL(url, location.origin);\n\n urlInstance.searchParams.append('csrf_token', getCsrfToken());\n\n if (basketId) {\n urlInstance.searchParams.append('basketId', basketId);\n }\n\n return urlInstance.toString();\n}\n\n/**\n * Get CSRF Token\n * @returns {string} - csrf token value\n */\nfunction getCsrfToken() {\n let $element = document.querySelector('[data-csrf-token]');\n\n if ($element && $element.attributes['data-csrf-token'] && $element.attributes['data-csrf-token'].value) {\n return $element.attributes['data-csrf-token'].value;\n }\n\n return '';\n}\n\n/**\n * Get Init Product Data (page load and captures data available on page load)\n * @returns {Object} - productData with the following structure: { pid: prodId, quantity: selectedQuantity, options: selectedOptions }\n */\nfunction getInitProductData() {\n let productData = null;\n let $element = document.querySelector('[data-buy-now-init]');\n if ($element && $element.attributes['data-buy-now-init'] && $element.attributes['data-buy-now-init'].value) {\n productData = JSON.parse($element.attributes['data-buy-now-init'].value);\n }\n return productData;\n}\n\n/**\n * Set Init Product Data\n * @param {Object} data - accepts product data obj & updates global productData variable: { pid: prodId, quantity: selectedQuantity, options: selectedOptions }\n */\nfunction setInitProductData(data) {\n productData = data;\n}\n\n/**\n * Sets Up ShopPay listener Events\n * @param {Object} session - Accepts the Shop Pay session object and establishes necessary event listeners on the session.\n */\nfunction setSessionListeners(session) {\n session.addEventListener(\"sessionrequested\", function (ev) {\n let sessionPaymentRequest;\n\n if (window.shoppayClientRefs.constants.isBuyNow) {\n $.ajax({\n url: getUrlWithCsrfToken(window.shoppayClientRefs.urls.PrepareBasket),\n method: 'POST',\n async: false,\n data: JSON.stringify(productData),\n contentType: 'application/json',\n success: function (data) {\n if (!data.error) {\n sessionPaymentRequest = data.paymentRequest;\n sourceIdentifier = data.basketId;\n } else {\n /* session.completeSessionRequest() does not take an errors array as input so just return\n and use default modal error handling.\n */\n return;\n }\n },\n error: function (err) {\n /* session.completeSessionRequest() does not take an errors array as input so just\n destroy the session and return.\n */\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n }\n });\n } else {\n sessionPaymentRequest = session.paymentRequest;\n }\n\n let requestData = {\n paymentRequest: sessionPaymentRequest\n };\n if (window.shoppayClientRefs.constants.isBuyNow) {\n requestData.basketId = sourceIdentifier;\n }\n\n $.ajax({\n url: getUrlWithCsrfToken(window.shoppayClientRefs.urls.BeginSession),\n method: 'POST',\n async: false,\n data: JSON.stringify(requestData),\n contentType: 'application/json',\n success: function (data) {\n if (!data.error) {\n token = data.token;\n checkoutUrl = data.checkoutUrl;\n sourceIdentifier = data.sourceIdentifier;\n session.completeSessionRequest({token, checkoutUrl, sourceIdentifier});\n } else {\n let errorMsg = technicalErrorMsg;\n if (data.errorMsg) {\n errorMsg = data.errorMsg;\n }\n /* session.completeSessionRequest() does not take an errors array as input so just return\n and use default modal error handling.\n */\n return;\n }\n },\n error: function (err) {\n /* session.completeSessionRequest() does not take an errors array as input so just\n destroy the session and return.\n */\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n }\n\n });\n });\n\n session.addEventListener(\"discountcodechanged\", function(ev) {\n const currentPaymentRequest = session.paymentRequest;\n let requestData = {\n discountCodes: ev.discountCodes\n };\n if (window.shoppayClientRefs.constants.isBuyNow) {\n requestData.basketId = sourceIdentifier;\n }\n\n let responseJSON = createResponse(requestData, window.shoppayClientRefs.urls.DiscountCodeChanged);\n if (responseJSON.exception){\n session.completeDiscountCodeChange({\n errors: [\n {\n type: \"discountCodeError\",\n message: technicalErrorMsg\n }\n ]\n });\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n } else if (responseJSON.error) {\n let errorMsg = technicalErrorMsg;\n if (responseJSON.errorMsg) {\n errorMsg = responseJSON.errorMsg;\n }\n session.completeDiscountCodeChange({\n errors: [\n {\n type: \"discountCodeError\",\n message: errorMsg\n }\n ]\n });\n return;\n }\n const { deliveryMethods, discountCodes, lineItems, shippingLines, subtotal, discounts, totalShippingPrice, totalTax, total } = responseJSON.paymentRequest;\n\n let updatedPaymentRequest = window.ShopPay.PaymentRequest.build({\n ...currentPaymentRequest,\n discountCodes: discountCodes,\n lineItems: lineItems,\n shippingLines: shippingLines,\n deliveryMethods: deliveryMethods,\n subtotal: subtotal,\n discounts: discounts,\n totalTax: totalTax,\n total: total\n });\n if (totalShippingPrice) {\n updatedPaymentRequest = window.ShopPay.PaymentRequest.build({\n ...updatedPaymentRequest,\n totalShippingPrice: totalShippingPrice\n });\n }\n\n session.completeDiscountCodeChange({ updatedPaymentRequest: updatedPaymentRequest });\n });\n\n session.addEventListener(\"deliverymethodchanged\", function(ev) {\n const currentPaymentRequest = session.paymentRequest;\n let requestData = {\n deliveryMethod: ev.deliveryMethod,\n paymentRequest: currentPaymentRequest,\n };\n\n if (window.shoppayClientRefs.constants.isBuyNow) {\n requestData.basketId = sourceIdentifier;\n }\n\n let responseJSON = createResponse(requestData, window.shoppayClientRefs.urls.DeliveryMethodChanged);\n if (responseJSON.exception) {\n session.completeDeliveryMethodChange({\n errors: [\n {\n type: \"shippingAddressError\",\n message: technicalErrorMsg\n }\n ]\n });\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n } else if (responseJSON.error) {\n let errorMsg = technicalErrorMsg;\n if (responseJSON.errorMsg) {\n errorMsg = responseJSON.errorMsg;\n }\n const { shippingLines, totalShippingPrice, totalTax, total } = responseJSON.paymentRequest;\n const updatedPaymentRequest = window.ShopPay.PaymentRequest.build({\n ...currentPaymentRequest,\n shippingLines: shippingLines,\n totalShippingPrice: totalShippingPrice,\n totalTax: totalTax,\n total: total\n });\n\n session.completeDeliveryMethodChange({\n errors: [\n {\n type: \"shippingAddressError\",\n message: errorMsg\n }\n ],\n updatedPaymentRequest: updatedPaymentRequest\n });\n return;\n }\n const { shippingLines, totalShippingPrice, totalTax, total } = responseJSON.paymentRequest;\n\n // Update the payment request based on the delivery method change and update the total accordingly\n const updatedPaymentRequest = window.ShopPay.PaymentRequest.build({\n ...currentPaymentRequest,\n shippingLines: shippingLines,\n totalShippingPrice: totalShippingPrice,\n totalTax: totalTax,\n total: total\n });\n\n session.completeDeliveryMethodChange({ updatedPaymentRequest: updatedPaymentRequest });\n });\n\n session.addEventListener(\"shippingaddresschanged\", function(ev) {\n const currentPaymentRequest = session.paymentRequest;\n if (!ev.shippingAddress) {\n /* This event is triggered with no shipping address when a customer clicks \"change\"\n to choose an alternate email address in the modal\n */\n session.completeShippingAddressChange({ updatedPaymentRequest: currentPaymentRequest });\n return;\n }\n let requestData = {\n shippingAddress: ev.shippingAddress,\n paymentRequest: currentPaymentRequest,\n };\n\n if (window.shoppayClientRefs.constants.isBuyNow) {\n requestData.basketId = sourceIdentifier;\n }\n\n let responseJSON = createResponse(requestData, window.shoppayClientRefs.urls.ShippingAddressChanged);\n if (responseJSON.exception) {\n session.completeShippingAddressChange({\n errors: [\n {\n type: \"shippingAddressError\",\n message: technicalErrorMsg\n }\n ]\n });\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n } else if (responseJSON.error) {\n let errorMsg = technicalErrorMsg;\n if (responseJSON.errorMsg) {\n errorMsg = responseJSON.errorMsg;\n }\n session.completeShippingAddressChange({\n errors: [\n {\n type: \"shippingAddressError\",\n message: errorMsg\n }\n ]\n });\n return;\n }\n const { deliveryMethods, shippingLines, totalShippingPrice, totalTax, total } = responseJSON.paymentRequest;\n\n // Update the payment request based on the shipping address change\n const updatedPaymentRequest = window.ShopPay.PaymentRequest.build({\n ...currentPaymentRequest,\n deliveryMethods: deliveryMethods,\n shippingLines: shippingLines,\n totalShippingPrice: totalShippingPrice,\n totalTax: totalTax,\n total: total\n });\n\n session.completeShippingAddressChange({ updatedPaymentRequest: updatedPaymentRequest });\n });\n\n session.addEventListener(\"paymentconfirmationrequested\", function(ev) {\n const requestData = {\n token: session.token,\n paymentRequest: session.paymentRequest,\n };\n\n if (window.shoppayClientRefs.constants.isBuyNow) {\n requestData.basketId = sourceIdentifier;\n }\n\n let responseJSON = createResponse(requestData, window.shoppayClientRefs.urls.SubmitPayment);\n if (responseJSON.exception) {\n session.completePaymentConfirmationRequest({\n errors: [\n {\n type: \"generalError\",\n message: technicalErrorMsg\n }\n ]\n });\n setTimeout(function() {\n session.close();\n // Event listeners have loaded so window.location.reload() will be called in windowclosed\n }, 2000);\n return;\n } else if (responseJSON.error) {\n let errorMsg = technicalErrorMsg;\n if (responseJSON.errorMsg) {\n errorMsg = responseJSON.errorMsg;\n }\n session.completePaymentConfirmationRequest({\n errors: [\n {\n type: \"generalError\",\n message: errorMsg\n }\n ]\n });\n return;\n }\n\n orderConfirmationData = {\n orderID: responseJSON.orderID,\n orderToken: responseJSON.orderToken,\n continueUrl: responseJSON.continueUrl\n };\n session.completePaymentConfirmationRequest();\n });\n\n session.addEventListener(\"paymentcomplete\", function(ev) {\n reloadOnClose = false;\n session.close();\n let data = orderConfirmationData;\n let redirect = $('<form>').appendTo(document.body).attr({\n method: 'POST',\n action: data.continueUrl\n });\n $('<input>').appendTo(redirect).attr({\n name: 'orderID',\n value: data.orderID\n });\n $('<input>').appendTo(redirect).attr({\n name: 'orderToken',\n value: data.orderToken\n });\n redirect.submit();\n });\n\n session.addEventListener(\"windowclosed\", function(ev) {\n // Reset global value to default\n if (!reloadOnClose) {\n reloadOnClose = true;\n } else {\n window.location.reload();\n }\n });\n}\n\n/**\n * Enables & Disables Shop Pay's Buy Now button click based on whether the product is ready to order on the PDP\n */\nfunction shoppayBtnDisabledStyle(elem, isReadyToOrder, forceDisable) {\n let readyToOrderPageLoad = isReadyToOrderOnPageLoad();\n let isBuyNow = window.shoppayClientRefs.constants.isBuyNow;\n\n if (elem) {\n // An error occurred, disable the button\n if (!isBuyNow && forceDisable) {\n elem.style.pointerEvents = 'none';\n if (observer) {\n observer.disconnect();\n }\n return;\n }\n if (!isBuyNow || (isBuyNow && (isReadyToOrder || readyToOrderPageLoad))) {\n elem.style.pointerEvents = 'auto';\n } else {\n elem.style.pointerEvents = 'none';\n }\n }\n}\n\n/**\n * Watches for when ShopPay button is first rendered to the page to then apply correct button styling depending on whether the basket is empty or not\n */\nfunction shoppayMutationObserver(elemSelector) {\n observer = new MutationObserver((mutationsList, observer) => {\n const renderedShopPayElem = document.querySelector(elemSelector);\n if (renderedShopPayElem) {\n shoppayBtnDisabledStyle(renderedShopPayElem);\n observer.disconnect();\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\n/**\n * Checks whether a Buy Now product is ready on page load or not (ex: simple products vs. variants with multiple options to choose from, etc.)\n */\nfunction isReadyToOrderOnPageLoad() {\n let readyToOrder = false;\n let $element = document.querySelector('[data-ready-to-order]');\n if ($element && $element.attributes['data-ready-to-order'] && $element.attributes['data-ready-to-order'].value) {\n readyToOrder = $element.attributes['data-ready-to-order'].value === \"true\";\n }\n return readyToOrder;\n}\n\n/**\n * Handles AJAX call to create / update the payment response needed for the ShopPay.PaymentRequest.build() method.\n * @param {Object} requestObj - a request object that contains relevant event data & session data.\n * @param {string} controllerURL - String url of the targeted controller (based on the urls Obj set in shoppayGlobalRefs.js)\n * @returns {Object} responseJSON - an updated response object to be used in the build & on the ShopPay.PaymentRequest object.\n */\nfunction createResponse (requestObj, controllerURL) {\n let responseJSON;\n $.ajax({\n url: getUrlWithCsrfToken(controllerURL),\n method: 'POST',\n async: false,\n data: JSON.stringify(requestObj),\n contentType: 'application/json',\n success: function(data) {\n responseJSON = data;\n responseJSON.exception = false;\n },\n error: function (err) {\n responseJSON = err.responseJSON ? err.responseJSON : {};\n responseJSON.exception = true;\n }\n });\n\n return responseJSON;\n}\n\n/**\n * Handles AJAX call to get the payment response.\n * @returns {Object} paymentResponse - an response object.\n */\nfunction buildPaymentRequest(session) {\n let token = document.querySelector('[data-csrf-token]');\n let response;\n if (token) {\n const paymentResponse = $.ajax({\n url: getUrlWithCsrfToken(window.shoppayClientRefs.urls.GetCartSummary),\n type: 'GET',\n contentType: 'application/json',\n async: false,\n success: function(data) {\n if (!data.error) {\n response = {\n responseJSON: data\n };\n } else {\n shoppayBtnDisabledStyle(document.getElementById(\"shop-pay-button-container\"), null, true);\n }\n },\n error: function(err) {\n if (session) {\n /* Return to exit function - don't reload the page in case there is a page rendering\n issue (will result in infinite reload loop).\n */\n session.close();\n }\n shoppayBtnDisabledStyle(document.getElementById(\"shop-pay-button-container\"), null, true);\n }\n });\n return response;\n } else {\n /* Return to exit function - don't reload the page in case there is a page rendering\n issue (will result in infinite reload loop).\n */\n if (session) {\n session.close();\n }\n shoppayBtnDisabledStyle(document.getElementById(\"shop-pay-button-container\"), null, true);\n }\n}\n\nmodule.exports = {\n buildPaymentRequest: buildPaymentRequest,\n createResponse: createResponse,\n getCsrfToken: getCsrfToken,\n getInitProductData: getInitProductData,\n getUrlWithCsrfToken: getUrlWithCsrfToken,\n isReadyToOrderOnPageLoad: isReadyToOrderOnPageLoad,\n productData: productData,\n setInitProductData: setInitProductData,\n setSessionListeners: setSessionListeners,\n shoppayBtnDisabledStyle: shoppayBtnDisabledStyle,\n shoppayMutationObserver: shoppayMutationObserver,\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./cartridges/int_shoppay_sfra/cartridge/client/default/js/cart/initShopPayCart.js\");\n",""],"names":["helper","require","isBuyNow","window","shoppayClientRefs","constants","isAATest","preferences","shoppayAATest","session","$","document","ready","ShopPay","initShopPayConfig","isCheckout","length","initShopPayEmailRecognition","initShopPayButton","readyOnPageLoad","isReadyToOrderOnPageLoad","pageLoadData","getInitProductData","setInitProductData","on","initBuyNow","initShopPaySession","PaymentRequest","configure","shopId","shoppayStoreId","clientId","shoppayClientId","debug","shoppayModalDebugEnabled","paymentSelector","createButton","buyWith","render","shoppayMutationObserver","e","response","responseProduct","data","product","buyNow","readyToOrder","id","selectedQuantity","options","childProducts","pid","quantity","productData","setTimeout","createLogin","emailInputId","paymentRequestResponse","buildPaymentRequest","responseJSON","shoppayBtnDisabledStyle","getElementById","error","paymentRequest","close","paymentRequestInput","createResponse","urls","BuyNowData","exception","initialPaymentRequest","build","shoppaySession","createSession","setSessionListeners","off","updatedPaymentRequest","ajax","url","getUrlWithCsrfToken","GetCartSummary","type","contentType","async","success","err","status","location","reload","module","exports","checkoutUrl","observer","orderConfirmationData","reloadOnClose","sourceIdentifier","technicalErrorMsg","technicalError","token","basketId","urlInstance","URL","origin","searchParams","append","getCsrfToken","toString","$element","querySelector","attributes","value","JSON","parse","addEventListener","ev","sessionPaymentRequest","PrepareBasket","method","stringify","requestData","BeginSession","completeSessionRequest","errorMsg","currentPaymentRequest","discountCodes","DiscountCodeChanged","completeDiscountCodeChange","errors","message","_responseJSON$payment","deliveryMethods","lineItems","shippingLines","subtotal","discounts","totalShippingPrice","totalTax","total","_objectSpread","deliveryMethod","DeliveryMethodChanged","completeDeliveryMethodChange","_responseJSON$payment2","_responseJSON$payment3","shippingAddress","completeShippingAddressChange","ShippingAddressChanged","_responseJSON$payment4","SubmitPayment","completePaymentConfirmationRequest","orderID","orderToken","continueUrl","redirect","appendTo","body","attr","action","name","submit","elem","isReadyToOrder","forceDisable","readyToOrderPageLoad","style","pointerEvents","disconnect","elemSelector","MutationObserver","mutationsList","renderedShopPayElem","observe","childList","subtree","requestObj","controllerURL","paymentResponse"],"sourceRoot":""}