{"version":3,"sources":["webpack:///js/give-stripe-payment-request.js","webpack:///webpack/bootstrap 2b1ef9f3274198a44a19","webpack:///./assets/src/js/frontend/give-stripe-payment-request.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","10","11","_asyncToGenerator","fn","gen","apply","this","arguments","Promise","resolve","reject","step","key","arg","info","value","error","done","then","err","stripe","Stripe","give_stripe_vars","publishable_key","stripe_account_id","stripeAccount","document","addEventListener","formWraps","querySelectorAll","prButton","paymentRequest","isPRButtonExists","defaultGateway","preferredLocale","preferred_locale","Array","forEach","formWrap","prepareStripeCCTabs","tabElements","form_element","tabElement","purchaseSubmit","querySelector","paymentRequestSubmit","errorElement","idPrefix","style","display","e","currentParentTag","parentElement","currentElementID","getAttribute","tab","className","innerHTML","isPaymentRequestFlag","createElement","setAttribute","appendChild","remove","classList","contains","preventDefault","preparePaymentRequestButton","elements","_this","formName","donationAmount","Give","unFormatCurrency","dataset","total","decimal_separator","country","base_country","currency","toLowerCase","label","amount","Math","round","requestShipping","requestPayerName","create","paymentRequestButton","type","theme","payment_request_button_style","height","canMakePayment","result","getElementById","mount","on","_ref","regeneratorRuntime","mark","_callee","ev","wrap","_context","prev","next","source","id","owner","address","line1","line2","city","postal_code","autoSelectCountry","autoSelectState","state","setTimeout","submit","complete","stop","_x","evt","verifyPayment","XMLHttpRequest","formData","FormData","append","update","onreadystatechange","readyState","status","responseText","response","open","give_global_vars","ajaxurl","send","element","option","getElementsByTagName","length","selected","removeAttribute","updateStates","JSON","parse","selectElementWrap","data","textContent","locale","gateway_element","checked","jQuery","event","xhr","settings"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,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AgB5H,iBAAkB,SAAU,SAAUuB,GAChDqG,EAAgBC,UACpBvH,EAAiBsH,EAAgBxI,WAMpC0I,OAAQ/H,UAAWsE,GAAI,sBAAuB,SAAU0D,EAAOC,EAAKC,GAC3C,WAAnB3H,IACJM,IACA2B,EAA6BnB,EAAUoB,MAyLpC,WAAalC,IACjBM,IACA2B,EAA6BnB,EAAUoB","file":"js/give-stripe-payment-request.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \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, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\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/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 10);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 10:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(11);\n\n\n/***/ }),\n\n/***/ 11:\n/***/ (function(module, exports) {\n\nfunction _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\"next\", value); }, function (err) { step(\"throw\", err); }); } } return step(\"next\"); }); }; }\n\n/**\n * Give - Stripe Gateway Payment Request JS\n */\n\nvar stripe = Stripe(give_stripe_vars.publishable_key);\nif (give_stripe_vars.stripe_account_id) {\n\tstripe = Stripe(give_stripe_vars.publishable_key, { stripeAccount: give_stripe_vars.stripe_account_id });\n}\n\ndocument.addEventListener('DOMContentLoaded', function () {\n\n\t// Get all the donation forms on a single page.\n\tvar formWraps = document.querySelectorAll('.give-form-wrap');\n\tvar prButton = [];\n\tvar paymentRequest = [];\n\tvar isPRButtonExists = [];\n\tvar defaultGateway = '';\n\tvar preferredLocale = give_stripe_vars.preferred_locale;\n\n\t// Loop through each donation form.\n\tArray.prototype.forEach.call(formWraps, function (formWrap) {\n\n\t\tvar form_element = formWrap.querySelector('.give-form');\n\n\t\tvar elements = stripe.elements({\n\t\t\tlocale: preferredLocale\n\t\t});\n\n\t\tif (null !== form_element.querySelector('.give-gateway-option-selected .give-gateway').value) {\n\t\t\tdefaultGateway = form_element.querySelector('.give-gateway-option-selected .give-gateway').value;\n\t\t}\n\n\t\tvar idPrefix = form_element.getAttribute('data-id');\n\n\t\t// Set default value for payment request button exists flag.\n\t\tisPRButtonExists[idPrefix] = false;\n\n\t\t// Set default gateway value on changing gateway.\n\t\tArray.prototype.forEach.call(form_element.querySelectorAll('.give-gateway'), function (gateway_element) {\n\t\t\tgateway_element.addEventListener('change', function (e) {\n\t\t\t\tif (gateway_element.checked) {\n\t\t\t\t\tdefaultGateway = gateway_element.value;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t// Prepare tabs and payment request button on gateway load.\n\t\tjQuery(document).on('give_gateway_loaded', function (event, xhr, settings) {\n\t\t\tif (defaultGateway === 'stripe') {\n\t\t\t\tprepareStripeCCTabs();\n\t\t\t\tpreparePaymentRequestButton(idPrefix, elements);\n\t\t\t}\n\t\t});\n\n\t\t// Trigger build tabs custom event when required.\n\t\tfunction prepareStripeCCTabs() {\n\t\t\tvar tabElements = form_element.querySelectorAll('ul.give-stripe-payment-tabs li a');\n\n\t\t\t// Bailout, if tabElements doesn't exists.\n\t\t\tif (null === tabElements) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Payment Tabs to support Google/Apple Pay.\n\t\t\tArray.prototype.forEach.call(tabElements, function (tabElement) {\n\t\t\t\tvar purchaseSubmit = form_element.querySelector('.give-submit-button-wrap');\n\t\t\t\tvar paymentRequestSubmit = form_element.querySelector('.give-stripe-payment-request-content');\n\t\t\t\tvar errorElement = form_element.querySelector('#give-stripe-payment-errors-' + idPrefix);\n\n\t\t\t\tpurchaseSubmit.style.display = 'block';\n\t\t\t\tpaymentRequestSubmit.style.display = 'none';\n\n\t\t\t\ttabElement.addEventListener('click', function (e) {\n\t\t\t\t\tvar currentParentTag = this.parentElement;\n\t\t\t\t\tvar currentElementID = form_element.querySelector(this.getAttribute('href'));\n\n\t\t\t\t\tArray.prototype.forEach.call(tabElements, function (tab) {\n\t\t\t\t\t\tvar currentTab = form_element.querySelector(tab.getAttribute('href'));\n\n\t\t\t\t\t\t// Reset tabs and its content.\n\t\t\t\t\t\tcurrentTab.style.display = 'none';\n\t\t\t\t\t\ttab.parentElement.className = '';\n\t\t\t\t\t});\n\n\t\t\t\t\t// Reset error on switching tabs.\n\t\t\t\t\terrorElement.innerHTML = '';\n\n\t\t\t\t\t// Hide standard donate button when Google or Apple Pay is displayed.\n\t\t\t\t\tif ('#give-stripe-payment-request-content' === this.getAttribute('href')) {\n\t\t\t\t\t\tpurchaseSubmit.style.display = 'none';\n\t\t\t\t\t\tpaymentRequestSubmit.style.display = 'block';\n\n\t\t\t\t\t\t// Create a new hidden field is_payment_request, if if it doesn't exist.\n\t\t\t\t\t\tif (!form_element.querySelector('input[name=\"is_payment_request\"]')) {\n\t\t\t\t\t\t\tvar isPaymentRequestFlag = document.createElement('input');\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute('type', 'hidden');\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute('name', 'is_payment_request');\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute('value', true);\n\t\t\t\t\t\t\tform_element.appendChild(isPaymentRequestFlag);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if ('#give-stripe-credit-card-content' === this.getAttribute('href')) {\n\t\t\t\t\t\tpaymentRequestSubmit.style.display = 'none';\n\t\t\t\t\t\tpurchaseSubmit.style.display = 'block';\n\n\t\t\t\t\t\t// Remove the hidden field \"is_payment_request\" used as flag.\n\t\t\t\t\t\tform_element.querySelector('input[name=\"is_payment_request\"]').remove();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Display active tab content.\n\t\t\t\t\tcurrentElementID.style.display = 'block';\n\n\t\t\t\t\t// Add active class to clicked tab.\n\t\t\t\t\tcurrentParentTag.className = !currentParentTag.classList.contains('active') ? currentParentTag.classList + 'active' : currentParentTag.classList;\n\n\t\t\t\t\t// Prevent user from redirection.\n\t\t\t\t\te.preventDefault();\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Prepare Payment Request Button.\n *\n * @param {string} idPrefix ID Prefix.\n * @param {object} elements Stripe Elements Object.\n *\n * @since 1.6\n */\n\t\tfunction preparePaymentRequestButton(idPrefix, elements) {\n\t\t\tvar _this = this;\n\n\t\t\tvar formName = form_element.querySelector('input[name=\"give-form-title\"]');\n\t\t\tvar donationAmount = Give.fn.unFormatCurrency(form_element.querySelector('.give-final-total-amount').dataset.total, form_element.dataset.decimal_separator);\n\n\t\t\tpaymentRequest[idPrefix] = stripe.paymentRequest({\n\t\t\t\tcountry: give_stripe_vars.base_country,\n\t\t\t\tcurrency: form_element.getAttribute('data-currency_code').toLowerCase(),\n\t\t\t\ttotal: {\n\t\t\t\t\tlabel: formName.value,\n\t\t\t\t\tamount: Math.round(donationAmount * 100)\n\t\t\t\t},\n\t\t\t\trequestShipping: false,\n\t\t\t\trequestPayerName: true\n\t\t\t});\n\n\t\t\tif (false === isPRButtonExists[idPrefix]) {\n\n\t\t\t\tprButton[idPrefix] = elements.create('paymentRequestButton', {\n\t\t\t\t\tpaymentRequest: paymentRequest[idPrefix],\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tpaymentRequestButton: {\n\t\t\t\t\t\t\ttype: 'donate',\n\t\t\t\t\t\t\ttheme: give_stripe_vars.payment_request_button_style,\n\t\t\t\t\t\t\theight: '64px'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tisPRButtonExists[idPrefix] = true;\n\t\t\t}\n\n\t\t\t// Check the availability of the Payment Request API first.\n\t\t\tpaymentRequest[idPrefix].canMakePayment().then(function (result) {\n\t\t\t\tvar paymentRequestButton = document.getElementById('give-stripe-payment-request-button-' + idPrefix);\n\n\t\t\t\tif (paymentRequestButton) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tprButton[idPrefix].mount('#give-stripe-payment-request-button-' + idPrefix);\n\t\t\t\t\t\tisPRButtonExists[idPrefix] = true;\n\t\t\t\t\t}\n\t\t\t\t\tpaymentRequestButton.style.display = 'block';\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tpaymentRequest[idPrefix].on('source', function () {\n\t\t\t\tvar _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ev) {\n\t\t\t\t\treturn regeneratorRuntime.wrap(function _callee$(_context) {\n\t\t\t\t\t\twhile (1) {\n\t\t\t\t\t\t\tswitch (_context.prev = _context.next) {\n\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\tform_element.querySelector('input[name=\"give_stripe_source\"]').value = ev.source.id;\n\t\t\t\t\t\t\t\t\tform_element.querySelector('input[name=\"card_address\"]').value = ev.source.owner.address.line1;\n\t\t\t\t\t\t\t\t\tform_element.querySelector('input[name=\"card_address_2\"]').value = ev.source.owner.address.line2;\n\t\t\t\t\t\t\t\t\tform_element.querySelector('input[name=\"card_city\"]').value = ev.source.owner.address.city;\n\t\t\t\t\t\t\t\t\tform_element.querySelector('input[name=\"card_zip\"]').value = ev.source.owner.address.postal_code;\n\n\t\t\t\t\t\t\t\t\tautoSelectCountry(ev.source.owner.address.country);\n\t\t\t\t\t\t\t\t\tautoSelectState(ev.source.owner.address.country, ev.source.owner.address.state);\n\n\t\t\t\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\t\t\t\tform_element.submit();\n\t\t\t\t\t\t\t\t\t\tev.complete('success');\n\t\t\t\t\t\t\t\t\t}, 2000);\n\n\t\t\t\t\t\t\t\tcase 8:\n\t\t\t\t\t\t\t\tcase 'end':\n\t\t\t\t\t\t\t\t\treturn _context.stop();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, _callee, _this);\n\t\t\t\t}));\n\n\t\t\t\treturn function (_x) {\n\t\t\t\t\treturn _ref.apply(this, arguments);\n\t\t\t\t};\n\t\t\t}());\n\n\t\t\tprButton[idPrefix].on('click', function (evt) {\n\n\t\t\t\tvar verifyPayment = new XMLHttpRequest();\n\t\t\t\tvar formData = new FormData(form_element);\n\t\t\t\tvar errorElement = form_element.querySelector('#give-stripe-payment-errors-' + idPrefix);\n\t\t\t\tdonationAmount = Give.fn.unFormatCurrency(form_element.querySelector('.give-final-total-amount').dataset.total, form_element.dataset.decimal_separator);\n\n\t\t\t\tformData.append('action', 'give_process_donation');\n\t\t\t\tformData.append('give_ajax', true);\n\n\t\t\t\tpaymentRequest[idPrefix].update({\n\t\t\t\t\tcurrency: form_element.getAttribute('data-currency_code').toLowerCase(),\n\t\t\t\t\ttotal: {\n\t\t\t\t\t\tlabel: formName.value,\n\t\t\t\t\t\tamount: Math.round(donationAmount * 100)\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Do something on Ajax on state change.\n\t\t\t\tverifyPayment.onreadystatechange = function () {\n\n\t\t\t\t\tif (4 === this.readyState && 200 === this.status && 'success' !== this.responseText) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\terrorElement.innerHTML = this.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorElement.innerHTML = '';\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tverifyPayment.open('POST', give_global_vars.ajaxurl, false);\n\t\t\t\tverifyPayment.send(formData);\n\t\t\t});\n\t\t}\n\n\t\t// Load custom events when default gateway is stripe on load.\n\t\tif ('stripe' === defaultGateway) {\n\t\t\tprepareStripeCCTabs();\n\t\t\tpreparePaymentRequestButton(idPrefix, elements);\n\t\t}\n\n\t\t/**\n * This function is used to dynamically select the country.\n *\n * @param {string} country Name of the country.\n *\n * @since 2.2.0\n */\n\t\tfunction autoSelectCountry(country) {\n\n\t\t\tvar element = form_element.querySelector('select[name=\"billing_country\"]');\n\t\t\tvar option = element.getElementsByTagName('option');\n\n\t\t\tfor (var i = 0; i < option.length; i++) {\n\t\t\t\toption[i].selected = false;\n\t\t\t\toption[i].removeAttribute('selected');\n\t\t\t\tif (option[i].value === country) {\n\t\t\t\t\toption[i].selected = true;\n\t\t\t\t\toption[i].setAttribute('selected', 'selected');\n\t\t\t\t}\n\t\t\t}\n\t\t\t// return null;\n\t\t}\n\n\t\t/**\n * This function is used to dynamically select the states based on country.\n *\n * @param {string} country Name of the Country.\n * @param {string} state Name of the State.\n *\n * @since 2.2.0\n \t */\n\t\tfunction autoSelectState(country, state) {\n\n\t\t\tvar updateStates = new XMLHttpRequest();\n\t\t\tvar formData = new FormData();\n\n\t\t\tformData.append('action', 'give_get_states');\n\t\t\tformData.append('country', country);\n\t\t\tformData.append('field_name', 'card_state');\n\n\t\t\t// Do something on Ajax on state change.\n\t\t\tupdateStates.onreadystatechange = function () {\n\n\t\t\t\tif (4 === this.readyState && 200 === this.status && 'success' !== this.responseText) {\n\t\t\t\t\tvar response = JSON.parse(this.response);\n\t\t\t\t\tvar selectElementWrap = form_element.querySelector('#give-card-state-wrap');\n\t\t\t\t\tselectElementWrap.querySelector('select[name=\"card_state\"]').remove();\n\n\t\t\t\t\tselectElementWrap.innerHTML = selectElementWrap.innerHTML + response.data;\n\n\t\t\t\t\tvar element = form_element.querySelector('select[name=\"card_state\"]');\n\t\t\t\t\tvar option = element.getElementsByTagName('option');\n\n\t\t\t\t\tfor (var i = 0; i < option.length; i++) {\n\t\t\t\t\t\toption[i].selected = false;\n\t\t\t\t\t\toption[i].removeAttribute('selected');\n\n\t\t\t\t\t\tif (option[i].value === state || option[i].textContent === state) {\n\t\t\t\t\t\t\toption[i].selected = true;\n\t\t\t\t\t\t\toption[i].setAttribute('selected', 'selected');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tupdateStates.open('POST', give_global_vars.ajaxurl, false);\n\t\t\tupdateStates.send(formData);\n\t\t}\n\t});\n});\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// js/give-stripe-payment-request.js"," \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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b1ef9f3274198a44a19","/**\n * Give - Stripe Gateway Payment Request JS\n */\n\nlet stripe = Stripe( give_stripe_vars.publishable_key );\nif ( give_stripe_vars.stripe_account_id ) {\n\tstripe = Stripe( give_stripe_vars.publishable_key, { stripeAccount: give_stripe_vars.stripe_account_id } );\n}\n\ndocument.addEventListener( 'DOMContentLoaded', function() {\n\n\t// Get all the donation forms on a single page.\n\tconst formWraps = document.querySelectorAll( '.give-form-wrap' );\n\tlet prButton = [];\n\tlet paymentRequest = [];\n\tlet isPRButtonExists = [];\n\tlet defaultGateway = '';\n\tconst preferredLocale = give_stripe_vars.preferred_locale;\n\n\t// Loop through each donation form.\n\tArray.prototype.forEach.call( formWraps, function( formWrap ) {\n\n\t\tlet form_element = formWrap.querySelector( '.give-form' );\n\n\t\tlet elements = stripe.elements({\n\t\t\tlocale: preferredLocale,\n\t\t});\n\n\t\tif ( null !== form_element.querySelector( '.give-gateway-option-selected .give-gateway').value ) {\n\t\t\tdefaultGateway = form_element.querySelector( '.give-gateway-option-selected .give-gateway').value;\n\t\t}\n\n\t\tlet idPrefix = form_element.getAttribute('data-id');\n\n\t\t// Set default value for payment request button exists flag.\n\t\tisPRButtonExists[idPrefix] = false;\n\n\t\t// Set default gateway value on changing gateway.\n\t\tArray.prototype.forEach.call( form_element.querySelectorAll( '.give-gateway' ), function( gateway_element ) {\n\t\t\tgateway_element.addEventListener( 'change', function( e ) {\n\t\t\t\tif ( gateway_element.checked ) {\n\t\t\t\t\tdefaultGateway = gateway_element.value;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t// Prepare tabs and payment request button on gateway load.\n\t\tjQuery( document ).on( 'give_gateway_loaded', function( event, xhr, settings ) {\n\t\t\tif ( defaultGateway === 'stripe' ) {\n\t\t\t\tprepareStripeCCTabs();\n\t\t\t\tpreparePaymentRequestButton( idPrefix, elements );\n\t\t\t}\n\t\t});\n\n\t\t// Trigger build tabs custom event when required.\n\t\tfunction prepareStripeCCTabs() {\n\t\t\tconst tabElements = form_element.querySelectorAll( 'ul.give-stripe-payment-tabs li a' );\n\n\t\t\t// Bailout, if tabElements doesn't exists.\n\t\t\tif ( null === tabElements ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Payment Tabs to support Google/Apple Pay.\n\t\t\tArray.prototype.forEach.call( tabElements, function( tabElement ) {\n\t\t\t\tconst purchaseSubmit = form_element.querySelector( '.give-submit-button-wrap' );\n\t\t\t\tconst paymentRequestSubmit = form_element.querySelector( '.give-stripe-payment-request-content' );\n\t\t\t\tconst errorElement = form_element.querySelector( '#give-stripe-payment-errors-' + idPrefix );\n\n\t\t\t\tpurchaseSubmit.style.display = 'block';\n\t\t\t\tpaymentRequestSubmit.style.display = 'none';\n\n\t\t\t\ttabElement.addEventListener( 'click', function( e ) {\n\t\t\t\t\tconst currentParentTag = this.parentElement;\n\t\t\t\t\tconst currentElementID = form_element.querySelector( this.getAttribute( 'href' ) );\n\n\t\t\t\t\tArray.prototype.forEach.call( tabElements, function( tab ) {\n\t\t\t\t\t\tconst currentTab = form_element.querySelector( tab.getAttribute( 'href' ) );\n\n\t\t\t\t\t\t// Reset tabs and its content.\n\t\t\t\t\t\tcurrentTab.style.display = 'none';\n\t\t\t\t\t\ttab.parentElement.className = '';\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Reset error on switching tabs.\n\t\t\t\t\terrorElement.innerHTML = '';\n\n\t\t\t\t\t// Hide standard donate button when Google or Apple Pay is displayed.\n\t\t\t\t\tif ( '#give-stripe-payment-request-content' === this.getAttribute( 'href' ) ) {\n\t\t\t\t\t\tpurchaseSubmit.style.display = 'none';\n\t\t\t\t\t\tpaymentRequestSubmit.style.display = 'block';\n\n\t\t\t\t\t\t// Create a new hidden field is_payment_request, if if it doesn't exist.\n\t\t\t\t\t\tif ( ! form_element.querySelector( 'input[name=\"is_payment_request\"]') ) {\n\t\t\t\t\t\t\tconst isPaymentRequestFlag = document.createElement( 'input' );\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute( 'type', 'hidden' );\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute( 'name', 'is_payment_request' );\n\t\t\t\t\t\t\tisPaymentRequestFlag.setAttribute( 'value', true );\n\t\t\t\t\t\t\tform_element.appendChild( isPaymentRequestFlag );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( '#give-stripe-credit-card-content' === this.getAttribute( 'href' ) ) {\n\t\t\t\t\t\tpaymentRequestSubmit.style.display = 'none';\n\t\t\t\t\t\tpurchaseSubmit.style.display = 'block';\n\n\t\t\t\t\t\t// Remove the hidden field \"is_payment_request\" used as flag.\n\t\t\t\t\t\tform_element.querySelector( 'input[name=\"is_payment_request\"]').remove();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Display active tab content.\n\t\t\t\t\tcurrentElementID.style.display = 'block';\n\n\t\t\t\t\t// Add active class to clicked tab.\n\t\t\t\t\tcurrentParentTag.className = ( ! currentParentTag.classList.contains( 'active' ) ) ? currentParentTag.classList + 'active' : currentParentTag.classList;\n\n\t\t\t\t\t// Prevent user from redirection.\n\t\t\t\t\te.preventDefault();\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Prepare Payment Request Button.\n\t\t *\n\t\t * @param {string} idPrefix ID Prefix.\n\t\t * @param {object} elements Stripe Elements Object.\n\t\t *\n\t\t * @since 1.6\n\t\t */\n\t\tfunction preparePaymentRequestButton( idPrefix, elements ) {\n\n\t\t\tlet formName = form_element.querySelector( 'input[name=\"give-form-title\"]' );\n\t\t\tlet donationAmount = Give.fn.unFormatCurrency( form_element.querySelector( '.give-final-total-amount' ).dataset.total, form_element.dataset.decimal_separator );\n\n\t\t\tpaymentRequest[ idPrefix ] = stripe.paymentRequest( {\n\t\t\t\tcountry: give_stripe_vars.base_country,\n\t\t\t\tcurrency: form_element.getAttribute('data-currency_code').toLowerCase(),\n\t\t\t\ttotal: {\n\t\t\t\t\tlabel: formName.value,\n\t\t\t\t\tamount: Math.round( donationAmount * 100 ),\n\t\t\t\t},\n\t\t\t\trequestShipping: false,\n\t\t\t\trequestPayerName: true,\n\t\t\t} );\n\n\t\t\tif ( false === isPRButtonExists[idPrefix] ) {\n\n\t\t\t\tprButton[ idPrefix ] = elements.create(\n\t\t\t\t\t'paymentRequestButton',\n\t\t\t\t\t{\n\t\t\t\t\t\tpaymentRequest: paymentRequest[ idPrefix ],\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tpaymentRequestButton: {\n\t\t\t\t\t\t\t\ttype: 'donate',\n\t\t\t\t\t\t\t\ttheme: give_stripe_vars.payment_request_button_style,\n\t\t\t\t\t\t\t\theight: '64px',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tisPRButtonExists[ idPrefix ] = true;\n\t\t\t}\n\n\t\t\t// Check the availability of the Payment Request API first.\n\t\t\tpaymentRequest[ idPrefix ]\n\t\t\t\t.canMakePayment()\n\t\t\t\t.then( function( result ) {\n\t\t\t\t\tlet paymentRequestButton = document.getElementById( 'give-stripe-payment-request-button-' + idPrefix);\n\n\t\t\t\t\tif ( paymentRequestButton ) {\n\t\t\t\t\t\tif ( result ) {\n\t\t\t\t\t\t\tprButton[ idPrefix ].mount( '#give-stripe-payment-request-button-' + idPrefix );\n\t\t\t\t\t\t\tisPRButtonExists[ idPrefix ] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpaymentRequestButton.style.display = 'block';\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\tpaymentRequest[ idPrefix ].on( 'source', async( ev ) => {\n\t\t\t\tform_element.querySelector( 'input[name=\"give_stripe_source\"]' ).value = ev.source.id;\n\t\t\t\tform_element.querySelector( 'input[name=\"card_address\"]' ).value = ev.source.owner.address.line1;\n\t\t\t\tform_element.querySelector( 'input[name=\"card_address_2\"]' ).value = ev.source.owner.address.line2;\n\t\t\t\tform_element.querySelector( 'input[name=\"card_city\"]' ).value = ev.source.owner.address.city;\n\t\t\t\tform_element.querySelector( 'input[name=\"card_zip\"]' ).value = ev.source.owner.address.postal_code;\n\n\t\t\t\tautoSelectCountry( ev.source.owner.address.country );\n\t\t\t\tautoSelectState( ev.source.owner.address.country, ev.source.owner.address.state );\n\n setTimeout(() => {\n form_element.submit();\n ev.complete( 'success' );\n }, 2000 );\n\n\t\t\t} );\n\n\t\t\tprButton[ idPrefix ].on( 'click', function( evt ) {\n\n\t\t\t\tlet verifyPayment = new XMLHttpRequest();\n\t\t\t\tlet formData = new FormData( form_element );\n\t\t\t\tlet errorElement = form_element.querySelector( '#give-stripe-payment-errors-' + idPrefix );\n\t\t\t\tdonationAmount = Give.fn.unFormatCurrency( form_element.querySelector( '.give-final-total-amount' ).dataset.total, form_element.dataset.decimal_separator );\n\n\t\t\t\tformData.append( 'action', 'give_process_donation' );\n\t\t\t\tformData.append( 'give_ajax', true );\n\n\t\t\t\tpaymentRequest[ idPrefix ].update( {\n\t\t\t\t\tcurrency: form_element.getAttribute( 'data-currency_code' ).toLowerCase(),\n\t\t\t\t\ttotal: {\n\t\t\t\t\t\tlabel: formName.value,\n\t\t\t\t\t\tamount: Math.round( donationAmount * 100 ),\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\t// Do something on Ajax on state change.\n\t\t\t\tverifyPayment.onreadystatechange = function() {\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t4 === this.readyState &&\n\t\t\t\t\t\t200 === this.status &&\n\t\t\t\t\t\t'success' !== this.responseText\n\t\t\t\t\t) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\terrorElement.innerHTML = this.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorElement.innerHTML = '';\n\t\t\t\t\t}\n\n\t\t\t\t};\n\t\t\t\tverifyPayment.open( 'POST', give_global_vars.ajaxurl, false );\n\t\t\t\tverifyPayment.send( formData );\n\t\t\t} );\n\t\t}\n\n\t\t// Load custom events when default gateway is stripe on load.\n\t\tif ( 'stripe' === defaultGateway ) {\n\t\t\tprepareStripeCCTabs();\n\t\t\tpreparePaymentRequestButton( idPrefix, elements );\n\t\t}\n\n\t\t/**\n\t\t * This function is used to dynamically select the country.\n\t\t *\n\t\t * @param {string} country Name of the country.\n\t\t *\n\t\t * @since 2.2.0\n\t\t */\n\t\tfunction autoSelectCountry( country ) {\n\n\t\t\tconst element = form_element.querySelector( 'select[name=\"billing_country\"]' );\n\t\t\tconst option = element.getElementsByTagName( 'option' );\n\n\t\t\tfor ( let i = 0; i < option.length; i++ ) {\n\t\t\t\toption[i].selected = false;\n\t\t\t\toption[i].removeAttribute( 'selected' );\n\t\t\t\tif ( option[i].value === country){\n\t\t\t\t\toption[i].selected = true;\n\t\t\t\t\toption[i].setAttribute( 'selected', 'selected' );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// return null;\n\t\t}\n\n\t\t/**\n\t\t * This function is used to dynamically select the states based on country.\n\t\t *\n\t\t * @param {string} country Name of the Country.\n\t\t * @param {string} state Name of the State.\n\t\t *\n\t\t * @since 2.2.0\n \t\t */\n\t\tfunction autoSelectState( country, state ) {\n\n const updateStates = new XMLHttpRequest();\n let formData = new FormData();\n\n formData.append( 'action', 'give_get_states' );\n formData.append( 'country', country );\n formData.append( 'field_name', 'card_state' );\n\n // Do something on Ajax on state change.\n updateStates.onreadystatechange = function() {\n\n if (\n 4 === this.readyState &&\n 200 === this.status &&\n 'success' !== this.responseText\n ) {\n const response = JSON.parse( this.response );\n const selectElementWrap = form_element.querySelector( '#give-card-state-wrap' );\n selectElementWrap.querySelector( 'select[name=\"card_state\"]' ).remove();\n\n selectElementWrap.innerHTML = selectElementWrap.innerHTML + response.data;\n\n\t\t\t\t\tconst element = form_element.querySelector( 'select[name=\"card_state\"]' );\n\t\t\t\t\tconst option = element.getElementsByTagName( 'option' );\n\n\t\t\t\t\tfor ( let i = 0; i < option.length; i++ ) {\n\t\t\t\t\t\toption[i].selected = false;\n\t\t\t\t\t\toption[i].removeAttribute( 'selected' );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( option[i].value === state || option[i].textContent === state ){\n\t\t\t\t\t\t\toption[i].selected = true;\n\t\t\t\t\t\t\toption[i].setAttribute( 'selected', 'selected' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n }\n\n };\n updateStates.open( 'POST', give_global_vars.ajaxurl, false );\n updateStates.send( formData );\n\n\t\t}\n\n\n\t} );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/src/js/frontend/give-stripe-payment-request.js"],"sourceRoot":""}