{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/js/src/utils/dom.js","webpack:///./assets/js/src/utils/form.js","webpack:///./assets/js/src/utils/index.js","webpack:///./assets/js/src/frontend/elements/index.js","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///external \"jQuery\"","webpack:///./assets/js/src/frontend/checkout/payment-methods.js","webpack:///./node_modules/@babel/runtime/helpers/typeof.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///./assets/js/src/frontend/checkout/payment.js","webpack:///./assets/js/src/frontend/checkout/index.js","webpack:///./assets/js/src/utils/api-request.js","webpack:///./node_modules/lodash.foreach/index.js","webpack:///./assets/js/src/utils/notice.js","webpack:///./assets/js/src/frontend/elements/intents.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///./assets/js/src/frontend/profile-editor/actions.js","webpack:///./assets/js/src/frontend/profile-editor/add-new.js","webpack:///./assets/js/src/frontend/profile-editor/index.js","webpack:///./assets/js/src/frontend/payment-receipt/update-payment-method.js","webpack:///./assets/js/src/frontend/payment-receipt/index.js","webpack:///./assets/js/src/frontend/index.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","domReady","forEach","arguments","callback","document","addEventListener","getNextSiblings","el","siblings","sibling","nextElementSibling","nodeType","push","hasValidInputs","form","plainInputsValid","querySelectorAll","input","checkValidity","triggerBrowserValidation","submit","createElement","type","style","display","appendChild","click","remove","fieldValueOrNull","field","mountCardElement","elementsInstance","toMount","elementsOptions","edd_stripe_vars","cardNameEl","querySelector","inputStyles","window","getComputedStyle","styleTag","innerHTML","getPropertyValue","body","base","color","fontFamily","fontSize","fontWeight","fontSmoothing","card","toMountEl","event","errorsContainer","error","append","generateNotice","message","handleElementError","mount","getPaymentMethod","billingDetailsForm","cardElement","selectedPaymentMethod","$","length","val","Promise","resolve","id","exists","eddStripe","createPaymentMethod","billing_details","getBillingDetails","then","result","paymentMethod","address","line1","line2","city","state","postal_code","country","jQuery","paymentMethods","getBillingFieldsToggle","toggleBillingFields","e","target","checked","existingPaymentMethods","existingPaymentMethod","paymentSource","isNew","newCardForm","billingAddressToggle","removeClass","closest","addClass","addressFieldMap","card_address","card_address_2","card_city","card_state","card_zip","billing_country","addressEl","addressField","getElementById","selected","addressString","billingDetailsEl","billingDetails","dataset","required","changeEvent","createEvent","initEvent","dispatchEvent","ajaxSuccess","xhr","options","data","includes","responseText","stateField","address_state","billingAddressPreview","innerText","join","onPaymentSourceChange","currentPaymentMethod","paymentMethodChangeEvent","isVisible","updateAddressWrapperEl","billingFieldWrappers","wrap","_typeof2","obj","iterator","constructor","_typeof","asyncGeneratorStep","gen","reject","_next","_throw","arg","info","done","fn","self","this","args","apply","err","undefined","configurable","writable","paymentForm","elements","off","onSubmit","on","watchInitialValidation","a","formData","serialize","paymentMethodId","paymentMethodExists","apiRequest","form_data","payment_method_id","payment_method_exists","checkoutForm","handleIntent","intent","handledIntent","eddPayment","captureIntent","finalIntent","status","cancellation_reason","completePayment","location","replace","successPageUri","failurePageUri","handleException","enableForm","trim","onSubmitDelay","preventDefault","trigger","edd_global_vars","complete_purchase","hide","attr","notice","generic_error","checkout_error_anchor","before","setup","edd_scripts","is_checkout","singleGateway","gateway","action","dataType","xhrFields","withCredentials","url","ajaxurl","deferred","Deferred","jqXHR","ajax","response","success","rejectWith","fail","promise","abort","MAX_SAFE_INTEGER","argsTag","funcTag","genTag","reIsUint","arrayEach","array","iteratee","index","func","transform","objectProto","objectToString","toString","propertyIsEnumerable","nativeKeys","keys","arrayLikeKeys","inherited","isArray","isObjectLike","isArrayLike","isArrayLikeObject","isArguments","Array","baseTimes","String","skipIndexes","isIndex","eachFunc","fromRight","baseEach","baseFor","collection","iterable","keysFunc","props","createBaseFor","baseKeys","Ctor","proto","test","isLength","tag","isObject","isFunction","identity","classList","add","clear","retrieve","intentId","intentType","intent_id","intent_type","confirm","capture","update","handle","confirmedIntent","updatedIntent","next_action","cardHandler","confirmation_method","client_secret","setupIntent","paymentIntent","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","context","Context","_invoke","GenStateSuspendedStart","method","GenStateExecuting","Error","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","GenStateSuspendedYield","makeInvokeMethod","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","AsyncIterator","previousPromise","callInvokeWithMethodAndArg","invoke","__await","unwrapped","TypeError","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","iter","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","paymentMethodAction","payment_method","nonce","handleNotice","setTimeout","reload","onToggleUpdateForm","source","cardActionsEl","isFormVisible","onUpdatePaymentMethod","fieldName","submitButton","disabled","loading","onDeletePaymentMethod","onSetDefaultPaymentMethod","alert","item","insertBefore","onToggleForm","formFields","cancelButton","submitEvent","onAddPaymentMethod","billingForm","addPaymentMethod","catch","updateButton","deleteButton","setDefaultButton","updatePaymentMethodForm","setPaymentMethods","onAuthorizePayment","disableForm","retrieveIntent","authorization","payment","container","Stripe","publishable_key","_plugin","confirmIntent","setupCheckout","setupProfile","setupPaymentHistory"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,E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IACR,IAAMrZ,EAAShB,SAAS0G,eAAgB,qCAExC1F,EAAOnC,MAAQmC,EAAO+F,QAAQkS,QAC9BjY,EAAOgY,UAAW,EAMnB,SAASrN,IACR,IAAM3K,EAAShB,SAAS0G,eAAgB,qCAExC1F,EAAOnC,MAAQmC,EAAO+F,QAAQ/F,OAC9BA,EAAOgY,UAAW,EAQZ,SAAStN,EAAiBxI,GAEhC,IAAMkJ,EAAShJ,YACZF,GAASA,EAAMG,QAAYH,EAAMG,QAAUvB,gBAAgBuK,cAC7D,SAGKoO,EAAYza,SAAS0G,eAAgB,qCAE3C+T,EAAUpY,UAAY,GACtBoY,EAAUpZ,YAAa+K,GCjIjB,SAASI,IACRxM,SAAS0G,eAAgB,+BAIhCwT,KCkBD,WACC,IACChY,OAAOiC,UAAY,IAAIuW,OAAQ5Y,gBAAgB6Y,iBAG/CzY,OAAOiC,UAAUyW,QAAU,CAC1Bhb,aACA4K,eACApH,mBACA1B,qBACA4C,sBACAd,qBACAqX,kBACAhQ,iBACAyP,mBACApV,oBAIDtF,YACCkb,IACAC,EACAC,GAEA,MAAQ9X,GACTkW,MAAOlW,EAAMG,UAzBf","file":"assets/js/build/app.min.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 = 19);\n","/**\n * Internal dependencies.\n */\n/**\n * External dependencies\n */\nimport { forEach } from 'utils';\n\n/**\n * forEach implementation that can handle anything.\n */\nexport { default as forEach } from 'lodash.foreach';\n\n/**\n * DOM ready.\n *\n * Handles multiple callbacks.\n *\n * @param {Function} Callback function to run.\n */\nexport function domReady() {\n\tforEach( arguments, ( callback ) => {\n\t\tdocument.addEventListener( 'DOMContentLoaded', callback );\n\t} );\n}\n\n/**\n * Retrieves all following siblings of an element.\n *\n * @param {HTMLElement} el Starting element.\n * @return {Array} siblings List of sibling elements.\n */\nexport function getNextSiblings( el ) {\n\tconst siblings = [];\n\tlet sibling = el.nextElementSibling;\n\n\twhile ( sibling ) {\n\t\tif ( sibling.nodeType === 1 ) {\n\t\t\tsiblings.push( sibling );\n\t\t}\n\n\t\tsibling = sibling.nextElementSibling;\n\t}\n\n\treturn siblings;\n}\n","/**\n * Internal dependencies.\n */\n/**\n * External dependencies\n */\nimport { forEach } from 'utils';\n\n/**\n * Checks is a form passes HTML5 validation.\n *\n * @param {HTMLElement} form Form to trigger validation on.\n * @return {Bool} If the form has valid inputs.\n */\nexport function hasValidInputs( form ) {\n\tlet plainInputsValid = true;\n\n\tforEach( form.querySelectorAll( 'input' ), function( input ) {\n\t\tif ( input.checkValidity && ! input.checkValidity() ) {\n\t\t\tplainInputsValid = false;\n\t\t}\n\t} );\n\n\treturn plainInputsValid;\n}\n\n/**\n * Triggers HTML5 browser validation.\n *\n * @param {HTMLElement} form Form to trigger validation on.\n */\nexport function triggerBrowserValidation( form ) {\n\tconst submit = document.createElement( 'input' );\n\tsubmit.type = 'submit';\n\tsubmit.style.display = 'none';\n\n\tform.appendChild( submit );\n\tsubmit.click();\n\tsubmit.remove();\n}\n\n/**\n * Returns an input's value, or null.\n *\n * @param {HTMLElement} field Field to retrieve value from.\n * @return {null|string} Value if the field has a value.\n */\nexport function fieldValueOrNull( field ) {\n\tif ( ! field ) {\n\t\treturn null;\n\t}\n\n\tif ( '' === field.value ) {\n\t\treturn null;\n\t}\n\n\treturn field.value;\n}\n","export * from './api-request.js';\nexport * from './dom.js';\nexport * from './notice.js';\nexport * from './form.js';\n","/* global $, edd_stripe_vars */\n\n/**\n * Internal dependencies.\n */\nimport { generateNotice, fieldValueOrNull } from 'utils'; // eslint-disable-line @wordpress/dependency-group\n\n// Intents.\nexport * from './intents.js';\n\n/**\n * Mounts an Elements Card to the DOM and adds event listeners to submission.\n *\n * @link https://stripe.com/docs/stripe-js/reference#the-elements-object\n *\n * @param {Elements} elementsInstance Stripe Elements instance.\n * @param {string} toMount Selector to mount Element on.\n * @return {Element} Stripe Element.\n */\nexport function mountCardElement( elementsInstance, toMount = '#edd-stripe-card-element' ) {\n\tconst elementsOptions = edd_stripe_vars.elementsOptions || {};\n\n\t// Try to mimick existing input styles.\n\tconst cardNameEl = document.querySelector( '.card-name.edd-input' );\n\n\tif ( cardNameEl ) {\n\t\tconst inputStyles = window.getComputedStyle( cardNameEl );\n\n\t\t// Inject inline CSS instead of applying to the Element so it can be overwritten.\n\t\tconst styleTag = document.createElement( 'style' );\n\t\tstyleTag.innerHTML = `.StripeElement {\n\t\t\tbackground-color: ${ inputStyles.getPropertyValue( 'background-color' ) };\n\t\t\tborder-color: ${ inputStyles.getPropertyValue( 'border-color' ) };\n\t\t\tborder-width: ${ inputStyles.getPropertyValue( 'border-width' ) };\n\t\t\tborder-style: ${ inputStyles.getPropertyValue( 'border-style' ) };\n\t\t\tborder-radius: ${ inputStyles.getPropertyValue( 'border-radius' ) };\n\t\t\tpadding: ${ inputStyles.getPropertyValue( 'padding' ) };\n\t\t}`;\n\t\tdocument.body.appendChild( styleTag );\n\n\t\t// Add default styles for the iframe input if none exist.\n\t\tif ( ! elementsOptions.style ) {\n\t\t\telementsOptions.style = {\n\t\t\t\tbase: {\n\t\t\t\t\tcolor: inputStyles.getPropertyValue( 'color' ),\n\t\t\t\t\tfontFamily: inputStyles.getPropertyValue( 'font-family' ),\n\t\t\t\t\tfontSize: inputStyles.getPropertyValue( 'font-size' ),\n\t\t\t\t\tfontWeight: inputStyles.getPropertyValue( 'font-weight' ),\n\t\t\t\t\tfontSmoothing: inputStyles.getPropertyValue( '-webkit-font-smoothing' ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tconst card = elementsInstance\n\t\t.create( 'card', elementsOptions );\n\n\tconst toMountEl = document.querySelector( toMount );\n\n\tcard\n\t\t.addEventListener( 'change', ( event ) => {\n\t\t\thandleElementError( event, toMountEl );\n\t\t} )\n\t\t.mount( toMountEl );\n\n\treturn card;\n}\n\n/**\n * Handles error output for Elements Card.\n *\n * @param {Event} event Change event on the Card Element.\n * @param {HTMLElement} toMountEl Element the card field is being mounted on.\n */\nfunction handleElementError( event, toMountEl ) {\n\tconst errorsContainer = toMountEl.nextElementSibling;\n\n\t// Only show one error at once.\n\terrorsContainer.innerHTML = '';\n\n\tif ( event.error ) {\n\t\terrorsContainer.append( generateNotice( event.error.message ) );\n\t}\n}\n\n/**\n * Retrieves (or creates) a PaymentMethod.\n *\n * @param {HTMLElement} billingDetailsForm Form to find data from.\n * @return {Object} PaymentMethod ID and if it previously existed.\n */\nexport function getPaymentMethod( billingDetailsForm, cardElement ) {\n\tconst selectedPaymentMethod = $( 'input[name=\"edd_stripe_existing_card\"]:checked' );\n\n\t// An existing PaymentMethod is selected.\n\tif ( selectedPaymentMethod.length > 0 && 'new' !== selectedPaymentMethod.val() ) {\n\t\treturn Promise.resolve( {\n\t\t\tid: selectedPaymentMethod.val(),\n\t\t\texists: true,\n\t\t} );\n\t}\n\n\t// Create a PaymentMethod using the Element data.\n\treturn window.eddStripe\n\t\t.createPaymentMethod(\n\t\t\t'card',\n\t\t\tcardElement,\n\t\t\t{\n\t\t\t\tbilling_details: getBillingDetails( billingDetailsForm ),\n\t\t\t}\n\t\t)\n\t\t.then( function( result ) {\n\t\t\tif ( result.error ) {\n\t\t\t\tthrow result.error;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: result.paymentMethod.id,\n\t\t\t\texists: false,\n\t\t\t};\n\t\t} );\n}\n\n/**\n * Retrieves billing details from the Billing Details sections of a form.\n *\n * @param {HTMLElement} form Form to find data from.\n * @return {Object} Billing details\n */\nexport function getBillingDetails( form ) {\n\treturn {\n\t\t// @todo add Phone\n\t\t// @todo add Email\n\t\tname: fieldValueOrNull( form.querySelector( '.card-name' ) ),\n\t\taddress: {\n\t\t\tline1: fieldValueOrNull( form.querySelector( '.card-address' ) ),\n\t\t\tline2: fieldValueOrNull( form.querySelector( '.card-address-2' ) ),\n\t\t\tcity: fieldValueOrNull( form.querySelector( '.card-city' ) ),\n\t\t\tstate: fieldValueOrNull( form.querySelector( '.card_state' ) ),\n\t\t\tpostal_code: fieldValueOrNull( form.querySelector( '.card-zip' ) ),\n\t\t\tcountry: fieldValueOrNull( form.querySelector( '#billing_country' ) ),\n\t\t},\n\t};\n}\n","module.exports = require(\"regenerator-runtime\");\n","module.exports = jQuery;","/* global $ */\n\n/**\n * Internal dependencies.\n */\nimport { forEach, getNextSiblings } from 'utils'; // eslint-disable-line @wordpress/dependency-group\n\n/**\n *\n */\nexport function paymentMethods() {\n\t// Toggle only shows if using Full Address (for some reason).\n\tif ( getBillingFieldsToggle() ) {\n\t\t// Hide fields initially.\n\t\ttoggleBillingFields( false );\n\n\t\t/**\n\t\t * Binds change event to \"Update billing address\" toggle to show/hide address fields.\n\t\t *\n\t\t * @param {Event} e Change event.\n\t\t */\n\t\tgetBillingFieldsToggle().addEventListener( 'change', function( e ) {\n\t\t\treturn toggleBillingFields( e.target.checked );\n\t\t} );\n\t}\n\n\t// Payment method toggles.\n\tconst existingPaymentMethods = document.querySelectorAll( '.edd-stripe-existing-card' );\n\n\tif ( 0 !== existingPaymentMethods.length ) {\n\t\tforEach( existingPaymentMethods, function( existingPaymentMethod ) {\n\t\t\t/**\n\t\t\t * Binds change event to credit card toggles.\n\t\t\t *\n\t\t\t * @param {Event} e Change event.\n\t\t\t */\n\t\t\treturn existingPaymentMethod.addEventListener( 'change', function( e ) {\n\t\t\t\treturn onPaymentSourceChange( e.target );\n\t\t\t} );\n\t\t} );\n\n\t\t// Simulate change of payment method to populate current fields.\n\t\tlet currentPaymentMethod = document.querySelector( '.edd-stripe-existing-card:checked' );\n\n\t\tif ( ! currentPaymentMethod ) {\n\t\t\tcurrentPaymentMethod = document.querySelector( '.edd-stripe-existing-card:first-of-type' );\n\t\t\tcurrentPaymentMethod.checked = true;\n\t\t}\n\n\t\tconst paymentMethodChangeEvent = document.createEvent( 'Event' );\n\t\tpaymentMethodChangeEvent.initEvent( 'change', true, false );\n\t\tcurrentPaymentMethod.dispatchEvent( paymentMethodChangeEvent );\n\t}\n}\n\n/**\n * Determines if the billing fields can be toggled.\n *\n * @return {Bool} True if the toggle exists.\n */\nfunction getBillingFieldsToggle() {\n\treturn document.getElementById( 'edd-stripe-update-billing-address' );\n}\n\n/**\n * Toggles billing fields visiblity.\n *\n * Assumes the toggle control is the first item in the \"Billing Details\" fieldset.\n *\n * @param {Bool} isVisible Billing item visibility.\n */\nfunction toggleBillingFields( isVisible ) {\n\tconst updateAddressWrapperEl = document.querySelector( '.edd-stripe-update-billing-address-wrapper' );\n\n\tif ( ! updateAddressWrapperEl ) {\n\t\treturn;\n\t}\n\n\t// Find all elements after the toggle.\n\tconst billingFieldWrappers = getNextSiblings( updateAddressWrapperEl );\n\tconst billingAddressPreview = document.querySelector( '.edd-stripe-update-billing-address-current' );\n\n\tbillingFieldWrappers.forEach( function( wrap ) {\n\t\twrap.style.display = isVisible ? 'block' : 'none';\n\t} );\n\n\t// Hide address preview.\n\tif ( billingAddressPreview ) {\n\t\tbillingAddressPreview.style.display = isVisible ? 'none' : 'block';\n\t}\n}\n\n/**\n * Manages UI state when the payment source changes.\n *\n * @param {HTMLElement} paymentSource Selected payment source. (Radio element with data).\n */\nfunction onPaymentSourceChange( paymentSource ) {\n\tconst isNew = 'new' === paymentSource.value;\n\tconst newCardForm = document.querySelector( '.edd-stripe-new-card' );\n\tconst billingAddressToggle = document.querySelector( '.edd-stripe-update-billing-address-wrapper' );\n\n\t// Toggle card details field.\n\tnewCardForm.style.display = isNew ? 'block' : 'none';\n\n\tif ( billingAddressToggle ) {\n\t\tbillingAddressToggle.style.display = isNew ? 'none' : 'block';\n\t}\n\n\t// @todo don't be lazy.\n\t$( '.edd-stripe-card-radio-item' ).removeClass( 'selected' );\n\t$( paymentSource ).closest( '.edd-stripe-card-radio-item' ).addClass( 'selected' );\n\n\tconst addressFieldMap = {\n\t\tcard_address: 'address_line1',\n\t\tcard_address_2: 'address_line2',\n\t\tcard_city: 'address_city',\n\t\tcard_state: 'address_state',\n\t\tcard_zip: 'address_zip',\n\t\tbilling_country: 'address_country',\n\t};\n\n\t// New card is being used, show fields and reset them.\n\tif ( isNew ) {\n\t\t// Reset all fields.\n\t\tfor ( const addressEl in addressFieldMap ) {\n\t\t\tif ( ! addressFieldMap.hasOwnProperty( addressEl ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst addressField = document.getElementById( addressEl );\n\n\t\t\tif ( addressField ) {\n\t\t\t\taddressField.value = '';\n\t\t\t\taddressField.selected = '';\n\t\t\t}\n\t\t}\n\n\t\t// Show billing fields.\n\t\ttoggleBillingFields( true );\n\n\t\t// Existing card is being used.\n\t\t// Ensure the billing fields are hidden, and update their values with saved information.\n\t} else {\n\t\tconst addressString = [];\n\t\tconst billingDetailsEl = document.getElementById( paymentSource.id + '-billing-details' );\n\n\t\tif ( ! billingDetailsEl ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Hide billing fields.\n\t\ttoggleBillingFields( false );\n\n\t\t// Uncheck \"Update billing address\"\n\t\tif ( getBillingFieldsToggle() ) {\n\t\t\tgetBillingFieldsToggle().checked = false;\n\t\t}\n\n\t\t// Update billing address fields with saved card values.\n\t\tconst billingDetails = billingDetailsEl.dataset;\n\n\t\tfor ( const addressEl in addressFieldMap ) {\n\t\t\tif ( ! addressFieldMap.hasOwnProperty( addressEl ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst addressField = document.getElementById( addressEl );\n\n\t\t\tif ( ! addressField ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst value = billingDetails[ addressFieldMap[ addressEl ] ];\n\n\t\t\t// Set field value.\n\t\t\taddressField.value = value;\n\n\t\t\t// Generate an address string from values.\n\t\t\tif ( '' !== value ) {\n\t\t\t\taddressString.push( value );\n\t\t\t}\n\n\t\t\t// This field is required but does not have a saved value, show all fields.\n\t\t\tif ( addressField.required && '' === value ) {\n\t\t\t\t// @todo DRY up some of this DOM usage.\n\t\t\t\ttoggleBillingFields( true );\n\n\t\t\t\tif ( getBillingFieldsToggle() ) {\n\t\t\t\t\tgetBillingFieldsToggle().checked = true;\n\t\t\t\t}\n\n\t\t\t\tif ( billingAddressToggle ) {\n\t\t\t\t\tbillingAddressToggle.style.display = 'none';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Trigger change event when the Country field is updated.\n\t\t\tif ( 'billing_country' === addressEl ) {\n\t\t\t\tconst changeEvent = document.createEvent( 'Event' );\n\t\t\t\tchangeEvent.initEvent( 'change', true, true );\n\t\t\t\taddressField.dispatchEvent( changeEvent );\n\t\t\t}\n\t\t}\n\n\t\t// SUPER ghetto way to watch for core form state because no consistent events are in place.\n\t\t// Core calls `edd_cart_billing_address_updated` but only on checkout. These methods\n\t\t// can be used anywhere.\n\t\t$( document ).ajaxSuccess( function( event, xhr, options ) {\n\t\t\tif ( ! options || ! options.data || ! xhr ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\toptions.data.includes( 'action=edd_get_shop_states' ) &&\n\t\t\t\toptions.data.includes( 'field_name=card_state' ) &&\n\t\t\t\t( xhr.responseText && xhr.responseText.includes( 'card_state' ) )\n\t\t\t) {\n\t\t\t\tconst stateField = document.getElementById( 'card_state' );\n\n\t\t\t\tif ( stateField ) {\n\t\t\t\t\tstateField.value = billingDetails.address_state;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\t// Update address string summary.\n\t\tconst billingAddressPreview = document.querySelector( '.edd-stripe-update-billing-address-current' );\n\n\t\tif ( billingAddressPreview ) {\n\t\t\tbillingAddressPreview.innerText = addressString.join( ', ' );\n\t\t}\n\t}\n}\n","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/* global $, edd_stripe_vars, edd_global_vars */\n\n/**\n * Internal dependencies\n */\n/**\n * External dependencies\n */\nimport {\n\tmountCardElement,\n\tgetPaymentMethod,\n\tcapture as captureIntent,\n\thandle as handleIntent,\n} from 'frontend/elements'; // eslint-disable-line @wordpress/dependency-group\n\nimport { apiRequest, generateNotice } from 'utils'; // eslint-disable-line @wordpress/dependency-group\n\n/**\n * Binds Payment submission functionality.\n *\n * Resets before rebinding to avoid duplicate events\n * during gateway switching.\n */\nexport function paymentForm() {\n\t// Mount Card Element.\n\twindow.eddStripe.cardElement = mountCardElement( window.eddStripe.elements() );\n\n\t// Bind form submission.\n\t// Needs to be jQuery since that is what core submits against.\n\t$( '#edd_purchase_form' ).off( 'submit', onSubmit );\n\t$( '#edd_purchase_form' ).on( 'submit', onSubmit );\n\n\t// SUPER ghetto way to watch for core form validation because no events are in place.\n\t// Called after the purchase form is submitted (via `click` or `submit`)\n\t$( document ).off( 'ajaxSuccess', watchInitialValidation );\n\t$( document ).on( 'ajaxSuccess', watchInitialValidation );\n}\n\n/**\n * Processes Stripe gateway-specific functionality after core AJAX validation has run.\n */\nasync function onSubmitDelay() {\n\ttry {\n\t\t// Form data to send to intent requests.\n\t\tconst formData = $( '#edd_purchase_form' ).serialize();\n\n\t\t// Retrieve or create a PaymentMethod.\n\t\tconst paymentMethod = await getPaymentMethod( document.getElementById( 'edd_purchase_form' ), window.eddStripe.cardElement );\n\n\t\t// Run the modified `_edds_process_purchase_form` and create an Intent.\n\t\tconst checkoutForm = await processForm( paymentMethod.id, paymentMethod.exists );\n\n\t\t// Handle any actions required by the Intent State Machine (3D Secure, etc).\n\t\tconst handledIntent = await handleIntent(\n\t\t\tcheckoutForm.intent,\n\t\t\t{\n\t\t\t\tform_data: formData,\n\t\t\t}\n\t\t);\n\n\t\t// Create an EDD payment record.\n\t\tconst eddPayment = await createPayment( handledIntent );\n\n\t\t// Capture any unpcaptured intents.\n\t\tconst finalIntent = await captureIntent(\n\t\t\teddPayment.intent,\n\t\t\t{\n\t\t\t\tform_data: formData,\n\t\t\t}\n\t\t);\n\n\t\t// Attempt to transition payment status and redirect.\n\t\t// @todo Maybe confirm payment status as well? Would need to generate a custom\n\t\t// response because the private EDD_Payment properties are not available.\n\t\tif (\n\t\t\t( 'succeeded' === finalIntent.status ) ||\n\t\t\t( 'canceled' === finalIntent.status && 'abandoned' === finalIntent.cancellation_reason )\n\t\t) {\n\t\t\tawait completePayment( finalIntent );\n\n\t\t\twindow.location.replace( edd_stripe_vars.successPageUri );\n\t\t} else {\n\t\t\twindow.location.replace( edd_stripe_vars.failurePageUri );\n\t\t}\n\t} catch ( error ) {\n\t\thandleException( error );\n\t\tenableForm();\n\t}\n}\n\n/**\n * Processes the purchase form.\n *\n * Generates purchase data for the current session and\n * uses the PaymentMethod to generate an Intent based on data.\n *\n * @param {string} paymentMethodId PaymentMethod ID.\n * @param {Bool} paymentMethodExists If the PaymentMethod has already been attached to a customer.\n * @return {Promise} jQuery Promise.\n */\nexport function processForm( paymentMethodId, paymentMethodExists ) {\n\treturn apiRequest( 'edds_process_purchase_form', {\n\t\t// Send available form data.\n\t\tform_data: $( '#edd_purchase_form' ).serialize(),\n\t\tpayment_method_id: paymentMethodId,\n\t\tpayment_method_exists: paymentMethodExists,\n\t} );\n}\n\n/**\n * Complete a Payment in EDD.\n *\n * @param {object} intent Intent.\n * @return {Promise} jQuery Promise.\n */\nexport function createPayment( intent ) {\n\treturn apiRequest( 'edds_create_payment', {\n\t\t// Send available form data.\n\t\tform_data: $( '#edd_purchase_form' ).serialize(),\n\t\tintent,\n\t} );\n}\n\n/**\n * Complete a Payment in EDD.\n *\n * @param {object} intent Intent.\n * @return {Promise} jQuery Promise.\n */\nexport function completePayment( intent ) {\n\treturn apiRequest( 'edds_complete_payment', {\n\t\tform_data: $( '#edd_purchase_form' ).serialize(),\n\t\tintent,\n\t} );\n}\n\n\n/**\n * Listen for initial EDD core validation.\n *\n * @param {Object} event Event.\n * @param {Object} xhr AJAX request.\n * @param {Object} options Request options.\n */\nfunction watchInitialValidation( event, xhr, options ) {\n\tif ( ! options || ! options.data || ! xhr ) {\n\t\treturn;\n\t}\n\n\tif (\n\t\toptions.data.includes( 'action=edd_process_checkout' ) &&\n\t\toptions.data.includes( 'edd-gateway=stripe' ) &&\n\t\t( xhr.responseText && 'success' === xhr.responseText.trim() )\n\t) {\n\t\treturn onSubmitDelay();\n\t}\n};\n\n/**\n * EDD core listens to a a `click` event on the Checkout form submit button.\n *\n * This submit event handler captures true submissions and triggers a `click`\n * event so EDD core can take over as normoal.\n *\n * @param {Object} event submit Event.\n */\nfunction onSubmit( event ) {\n\t// Ensure we are dealing with the Stripe gateway.\n\tif ( ! (\n\t\t// Stripe is selected gateway and total is larger than 0.\n\t\t$( 'input[name=\"edd-gateway\"]' ).val() === 'stripe'\t&&\n\t\t$( '.edd_cart_total .edd_cart_amount' ).data( 'total' ) > 0\n\t) ) {\n\t\treturn;\n\t}\n\n\t// While this function is tied to the submit event, block submission.\n\tevent.preventDefault();\n\n\t// Simulate a mouse click on the Submit button.\n\t//\n\t// If the form is submitted via the \"Enter\" key we need to ensure the core\n\t// validation is run.\n\t//\n\t// When that is run and then the form is resubmitted\n\t// the click event won't do anything because the button will be disabled.\n\t$( '#edd_purchase_form #edd_purchase_submit [type=submit]' ).trigger( 'click' );\n}\n\n/**\n * Enables the Checkout form for further submissions.\n */\nfunction enableForm() {\n\t// Update button text.\n\tdocument.querySelector( '#edd_purchase_form #edd_purchase_submit [type=submit]' ).value = edd_global_vars.complete_purchase;\n\n\t// Enable form.\n\t$( '.edd-loading-ajax' ).remove();\n\t$( '.edd_errors' ).remove();\n\t$( '.edd-error' ).hide();\n\t$( '#edd-purchase-button' ).attr( 'disabled', false );\n}\n\n/**\n * Handles error output for stripe.js promises, or jQuery AJAX promises.\n *\n * @link https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/assets/js/edd-ajax.js#L390\n *\n * @param {Object} error Error data.\n */\nfunction handleException( error ) {\n\tconst notice = generateNotice( ( error && error.message ) ? error.message : edd_stripe_vars.generic_error );\n\n\t// Hide previous messages.\n\t// @todo These should all be in a container, but that's not how core works.\n\t$( '.edd-stripe-alert' ).remove();\n\t$( edd_global_vars.checkout_error_anchor ).before( notice );\n\t$( document.body ).trigger( 'edd_checkout_error', [ error ] );\n}\n","/* global $, edd_scripts */\n\n/**\n * Internal dependencies\n */\nimport { paymentForm } from './payment.js';\nimport { paymentMethods } from './payment-methods.js';\n\nexport * from './payment.js';\nexport * from './payment-methods.js';\n\nexport function setup() {\n\tif ( '1' !== edd_scripts.is_checkout ) {\n\t\treturn;\n\t}\n\n\t// Initial load for single gateway.\n\tconst singleGateway = document.querySelector( 'input[name=\"edd-gateway\"]' );\n\n\tif ( singleGateway && 'stripe' === singleGateway.value ) {\n\t\tpaymentForm();\n\t\tpaymentMethods();\n\t}\n\n\t// Gateway switch.\n\t$( document.body ).on( 'edd_gateway_loaded', ( e, gateway ) => {\n\t\tif ( 'stripe' !== gateway ) {\n\t\t\treturn;\n\t\t}\n\n\t\tpaymentForm();\n\t\tpaymentMethods();\n\t} );\n}\n","/* global $, edd_scripts */\n\n/**\n * Sends an API request to admin-ajax.php\n *\n * @link https://github.com/WordPress/WordPress/blob/master/wp-includes/js/wp-util.js#L49\n *\n * @param {string} action AJAX action to send to admin-ajax.php\n * @param {Object} data Additional data to send to the action.\n * @return {Promise} jQuery Promise.\n */\nexport function apiRequest( action, data ) {\n\tconst options = {\n\t\ttype: 'POST',\n\t\tdataType: 'json',\n\t\txhrFields: {\n\t\t\twithCredentials: true,\n\t\t},\n\t\turl: edd_scripts.ajaxurl,\n\t\tdata: {\n\t\t\taction,\n\t\t\t...data,\n\t\t},\n\t};\n\n\tconst deferred = $.Deferred( function( deferred ) {\n\t\t// Use with PHP's wp_send_json_success() and wp_send_json_error()\n\t\tdeferred.jqXHR = $.ajax( options ).done( function( response ) {\n\t\t\t// Treat a response of 1 or 'success' as successful for backward compatibility with existing handlers.\n\t\t\tif ( response === '1' || response === 1 ) {\n\t\t\t\tresponse = { success: true };\n\t\t\t}\n\n\t\t\tif ( typeof response === 'object' && typeof response.success !== undefined ) {\n\t\t\t\tdeferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [ response.data ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( this, [ response ] );\n\t\t\t}\n\t\t} ).fail( function() {\n\t\t\tdeferred.rejectWith( this, arguments );\n\t\t} );\n\t} );\n\n\tconst promise = deferred.promise();\n\tpromise.abort = function() {\n\t\tdeferred.jqXHR.abort();\n\t\treturn this;\n\t};\n\n\treturn promise;\n}\n","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _([1, 2]).forEach(function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, typeof iteratee == 'function' ? iteratee : identity);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = forEach;\n","/* global $, edd_stripe_vars */\n\n/**\n * Generates a notice element.\n *\n * @param {string} message The notice text.\n * @param {string} type The type of notice. alert or success.\n * @return {Element} HTML element containing errors.\n */\nexport function generateNotice( message, type = 'error' ) {\n\tconst notice = document.createElement( 'p' );\n\tnotice.classList.add( 'edd-alert' );\n\tnotice.classList.add( 'edd-stripe-alert' );\n\tnotice.style.clear = 'both';\n\n\tif ( 'error' === type ) {\n\t\tnotice.classList.add( 'edd-alert-error' );\n\t} else {\n\t\tnotice.classList.add( 'edd-alert-success' );\n\t}\n\n\tnotice.innerText = message || edd_stripe_vars.generic_error;\n\n\treturn notice;\n}\n\n/**\n * Outputs a notice.\n */\nexport function outputNotice( {\n\terrorType,\n\terrorMessage,\n\terrorContainer,\n\terrorContainerReplace = true,\n} ) {\n\tconst $errorContainer = $( errorContainer );\n\tconst notice = generateNotice( errorMessage, errorType );\n\n\tif ( true === errorContainerReplace ) {\n\t\t$errorContainer.html( notice );\n\t} else {\n\t\t$errorContainer.before( notice );\n\t}\n}\n","/**\n * Internal dependencies\n */\nimport { apiRequest } from 'utils'; // eslint-disable-line @wordpress/dependency-group\n\n/**\n * Retrieve a PaymentIntent.\n *\n * @param {string} intentId Intent ID.\n * @param {string} intentType Intent type. payment_intent or setup_intent.\n * @return {Promise} jQuery Promise.\n */\nexport function retrieve( intentId, intentType = 'payment_intent' ) {\n\treturn apiRequest( 'edds_get_intent', {\n\t\tintent_id: intentId,\n\t\tintent_type: intentType,\n\t} )\n\t\t// Returns just the PaymentIntent object.\n\t\t.then( function( response ) {\n\t\t\treturn response.intent;\n\t\t} );\n}\n\n/**\n * Confirm a PaymentIntent.\n *\n * @param {Object} intent Stripe PaymentIntent or SetupIntent.\n * @return {Promise} jQuery Promise.\n */\nexport function confirm( intent ) {\n\treturn apiRequest( 'edds_confirm_intent', {\n\t\tintent_id: intent.id,\n\t\tintent_type: intent.object,\n\t} )\n\t\t// Returns just the PaymentIntent object for easier reprocessing.\n\t\t.then( function( response ) {\n\t\t\treturn response.intent;\n\t\t} );\n}\n\n/**\n * Capture a PaymentIntent.\n *\n * @param {Object} intent Stripe PaymentIntent or SetupIntent.\n * @param {Object} data Extra data to pass to the intent action.\n * @return {Promise} jQuery Promise.\n */\nexport function capture( intent, data ) {\n\tif ( 'requires_capture' !== intent.status ) {\n\t\treturn Promise.resolve( intent );\n\t}\n\n\treturn apiRequest( 'edds_capture_intent', {\n\t\tintent_id: intent.id,\n\t\tintent_type: intent.object,\n\t\t...data,\n\t} )\n\t\t// Returns just the PaymentIntent object for easier reprocessing.\n\t\t.then( function( response ) {\n\t\t\treturn response.intent;\n\t\t} );\n}\n\n/**\n * Update a PaymentIntent.\n *\n * @param {Object} intent Stripe PaymentIntent or SetupIntent.\n * @param {Object} data PaymentIntent data to update.\n * @return {Promise} jQuery Promise.\n */\nexport function update( intent, data ) {\n\treturn apiRequest( 'edds_update_intent', {\n\t\tintent_id: intent.id,\n\t\tintent_type: intent.object,\n\t\t...data,\n\t} )\n\t\t// Returns just the PaymentIntent object for easier reprocessing.\n\t\t.then( function( response ) {\n\t\t\treturn response.intent;\n\t\t} );\n}\n\n/**\n * Determines if the PaymentIntent requires further action.\n *\n * @link https://stripe.com/docs/stripe-js/reference\n *\n * @param {Object} intent Stripe PaymentIntent or SetupIntent.\n * @param {Object} data Extra data to pass to the intent action.\n */\nexport async function handle( intent, data ) {\n\t// requires_confirmation\n\tif ( 'requires_confirmation' === intent.status ) {\n\t\t// Attempt to capture.\n\t\tconst confirmedIntent = await confirm( intent );\n\n\t\t// Run through again.\n\t\treturn await handle( confirmedIntent );\n\t}\n\n\t// requires_payment_method\n\t// @link https://stripe.com/docs/payments/intents#intent-statuses\n\tif (\n\t\t'requires_payment_method' === intent.status ||\n\t\t'requires_source' === intent.status\n\t) {\n\t\t// Attempt to update.\n\t\tconst updatedIntent = await update( intent, data );\n\n\t\t// Run through again.\n\t\treturn await handle( updatedIntent, data );\n\t}\n\n\t// requires_action\n\t// @link https://stripe.com/docs/payments/intents#intent-statuses\n\tif (\n\t\t( 'requires_action' === intent.status && 'use_stripe_sdk' === intent.next_action.type ) ||\n\t\t( 'requires_source_action' === intent.status && 'use_stripe_sdk' === intent.next_action.type )\n\t) {\n\t\tlet cardHandler = 'setup_intent' === intent.object ? 'handleCardSetup' : 'handleCardAction';\n\n\t\tif ( 'automatic' === intent.confirmation_method ) {\n\t\t\tcardHandler = 'handleCardPayment';\n\t\t}\n\n\t\treturn window.eddStripe[ cardHandler ]( intent.client_secret )\n\t\t\t.then( async ( result ) => {\n\t\t\t\tif ( result.error ) {\n\t\t\t\t\tthrow result.error;\n\t\t\t\t}\n\n\t\t\t\tconst {\n\t\t\t\t\tsetupIntent,\n\t\t\t\t\tpaymentIntent,\n\t\t\t\t} = result;\n\n\t\t\t\t// Run through again.\n\t\t\t\treturn await handle( setupIntent || paymentIntent );\n\t\t\t} );\n\t}\n\n\t// Nothing done, return Intent.\n\treturn intent;\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","/* global edd_stripe_vars, location */\n\n/**\n * Internal dependencies\n */\nimport { apiRequest, generateNotice, fieldValueOrNull, forEach } from 'utils'; // eslint-disable-line @wordpress/dependency-group\n\n/**\n * Binds events for card actions.\n */\nexport function cardActions() {\n\t// Update.\n\tforEach( document.querySelectorAll( '.edd-stripe-update-card' ), function( updateButton ) {\n\t\tupdateButton.addEventListener( 'click', onToggleUpdateForm );\n\t} );\n\n\tforEach( document.querySelectorAll( '.edd-stripe-cancel-update' ), function( cancelButton ) {\n\t\tcancelButton.addEventListener( 'click', onToggleUpdateForm );\n\t} );\n\n\tforEach( document.querySelectorAll( '.card-update-form' ), function( updateButton ) {\n\t\tupdateButton.addEventListener( 'submit', onUpdatePaymentMethod );\n\t} );\n\n\t// Delete.\n\tforEach( document.querySelectorAll( '.edd-stripe-delete-card' ), function( deleteButton ) {\n\t\tdeleteButton.addEventListener( 'click', onDeletePaymentMethod );\n\t} );\n\n\t// Set Default.\n\tforEach( document.querySelectorAll( '.edd-stripe-default-card' ), function( setDefaultButton ) {\n\t\tsetDefaultButton.addEventListener( 'click', onSetDefaultPaymentMethod );\n\t} );\n}\n\n/**\n * Handle a generic Payment Method action (set default, update, delete).\n *\n * @param {string} action Payment action.\n * @param {string} paymentMethodId PaymentMethod ID.\n * @param {null|Object} data Additional AJAX data.\n * @return {Promise} jQuery Promise.\n */\nfunction paymentMethodAction( action, paymentMethodId, data = {} ) {\n\treturn apiRequest( action, {\n\t\tpayment_method: paymentMethodId,\n\t\tnonce: document.getElementById( 'card_update_nonce_' + paymentMethodId ).value,\n\t\t...data,\n\t} )\n\t\t/**\n\t\t * Shows an error when the API request fails.\n\t\t *\n\t\t * @param {Object} response API Request response.\n\t\t */\n\t\t.fail( function( response ) {\n\t\t\thandleNotice( paymentMethodId, response );\n\t\t} )\n\t\t/**\n\t\t * Shows a success notice and automatically redirect.\n\t\t *\n\t\t * @param {Object} response API Request response.\n\t\t */\n\t\t.done( function( response ) {\n\t\t\thandleNotice( paymentMethodId, response, 'success' );\n\n\t\t\t// Automatically redirect on success.\n\t\t\tsetTimeout( function() {\n\t\t\t\tlocation.reload();\n\t\t\t}, 1500 );\n\t\t} );\n}\n\n/**\n *\n * @param {Event} e\n */\nfunction onToggleUpdateForm( e ) {\n\te.preventDefault();\n\n\tconst source = e.target.dataset.source;\n\n\tconst form = document.getElementById( source + '-update-form' );\n\tconst cardActionsEl = document.getElementById( source + '-card-actions' );\n\tconst isFormVisible = 'block' === form.style.display;\n\n\tform.style.display = ! isFormVisible ? 'block' : 'none';\n\tcardActionsEl.style.display = ! isFormVisible ? 'none' : 'block';\n}\n\n/**\n *\n * @param {Event} e\n */\nfunction onUpdatePaymentMethod( e ) {\n\te.preventDefault();\n\n\tconst form = e.target;\n\tconst data = {};\n\n\t// Gather form data.\n\tconst updateFields = [\n\t\t'address_city',\n\t\t'address_country',\n\t\t'address_line1',\n\t\t'address_line2',\n\t\t'address_zip',\n\t\t'address_state',\n\t\t'exp_month',\n\t\t'exp_year',\n\t];\n\n\tupdateFields.forEach( function( fieldName ) {\n\t\tconst field = form.querySelector( '[name=\"' + fieldName + '\"]' );\n\t\tdata[ fieldName ] = fieldValueOrNull( field );\n\t} );\n\n\tconst submitButton = form.querySelector( 'input[type=\"submit\"]' );\n\n\tsubmitButton.disabled = true;\n\tsubmitButton.value = submitButton.dataset.loading;\n\n\tpaymentMethodAction( 'edds_update_payment_method', e.target.dataset.source, data )\n\t\t.fail( function( response ) {\n\t\t\tsubmitButton.disabled = false;\n\t\t\tsubmitButton.value = submitButton.dataset.submit;\n\t\t} );\n}\n\n/**\n *\n * @param {Event} e\n */\nfunction onDeletePaymentMethod( e ) {\n\te.preventDefault();\n\n\tpaymentMethodAction( 'edds_delete_payment_method', e.target.dataset.source );\n}\n\n/**\n *\n * @param {Event} e\n */\nfunction onSetDefaultPaymentMethod( e ) {\n\te.preventDefault();\n\n\tpaymentMethodAction( 'edds_set_payment_method_default', e.target.dataset.source );\n}\n\n/**\n * Handles a notice (success or error) for card actions.\n *\n * @param {string} paymentMethodId\n * @param {Object} error Error with message to output.\n * @param {string} type Notice type.\n */\nexport function handleNotice( paymentMethodId, error, type = 'error' ) {\n\t// Create the new notice.\n\tconst notice = generateNotice(\n\t\t( error && error.message ) ? error.message : edd_stripe_vars.generic_error,\n\t\ttype\n\t);\n\n\t// Hide previous notices.\n\tforEach( document.querySelectorAll( '.edd-stripe-alert' ), function( alert ) {\n\t\talert.remove();\n\t} );\n\n\tconst item = document.getElementById( paymentMethodId + '_card_item' );\n\n\t// Show new notice.\n\titem.insertBefore( notice, item.querySelector( '.card-details' ) );\n}\n","/* global edd_stripe_vars, location */\n\n/**\n * Internal dependencies.\n */\n/**\n * External dependencies\n */\nimport { mountCardElement, getBillingDetails } from 'frontend/elements';\nimport { apiRequest, hasValidInputs, triggerBrowserValidation, generateNotice, forEach } from 'utils';\n\n/**\n * Binds events and sets up \"Add New\" form.\n */\nexport function addNewForm() {\n\t// Mount Card Element.\n\twindow.eddStripe.cardElement = mountCardElement( window.eddStripe.elements() );\n\n\t// Toggles and submission.\n\tdocument.querySelector( '.edd-stripe-add-new' ).addEventListener( 'click', onToggleForm );\n\tdocument.getElementById( 'edd-stripe-add-new-cancel' ).addEventListener( 'click', onToggleForm );\n\tdocument.getElementById( 'edd-stripe-add-new-card' ).addEventListener( 'submit', onAddPaymentMethod );\n\n\t// Set \"Card Name\" field as required by HTML5\n\tdocument.getElementById( 'card_name' ).required = true;\n}\n\n/**\n * Handles toggling of \"Add New\" form button and submission.\n *\n * @param {Event} e click event.\n */\nfunction onToggleForm( e ) {\n\te.preventDefault();\n\n\tconst form = document.getElementById( 'edd-stripe-add-new-card' );\n\tconst formFields = form.querySelector( '.edd-stripe-add-new-card' );\n\tconst isFormVisible = 'block' === formFields.style.display;\n\n\tconst cancelButton = form.querySelector( '#edd-stripe-add-new-cancel' );\n\n\t// Trigger a `submit` event.\n\tif ( isFormVisible && cancelButton !== e.target ) {\n\t\tconst submitEvent = document.createEvent( 'Event' );\n\n\t\tsubmitEvent.initEvent( 'submit', true, true );\n\t\tform.dispatchEvent( submitEvent );\n\t// Toggle form.\n\t} else {\n\t\tformFields.style.display = ! isFormVisible ? 'block' : 'none';\n\t\tcancelButton.style.display = ! isFormVisible ? 'inline-block' : 'none';\n\t}\n}\n\n/**\n * Adds a new Source to the Customer.\n *\n * @param {Event} e submit event.\n */\nfunction onAddPaymentMethod( e ) {\n\te.preventDefault();\n\n\tconst form = e.target;\n\n\tif ( ! hasValidInputs( form ) ) {\n\t\ttriggerBrowserValidation( form );\n\t} else {\n\t\ttry {\n\t\t\tdisableForm();\n\n\t\t\tcreatePaymentMethod( form )\n\t\t\t\t.then( addPaymentMethod )\n\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\thandleNotice( error );\n\t\t\t\t\tenableForm();\n\t\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\thandleNotice( error );\n\t\t\tenableForm();\n\t\t}\n\t}\n}\n\n/**\n * Add a PaymentMethod.\n *\n * @param {Object} paymentMethod\n */\nexport function addPaymentMethod( paymentMethod ) {\n\tapiRequest( 'edds_add_payment_method', {\n\t\tpayment_method_id: paymentMethod.id,\n\t\tnonce: document.getElementById( 'edd-stripe-add-card-nonce' ).value,\n\t} )\n\t\t/**\n\t\t * Shows an error when the API request fails.\n\t\t *\n\t\t * @param {Object} response API Request response.\n\t\t */\n\t\t.fail( handleNotice )\n\t\t/**\n\t\t * Shows a success notice and automatically redirect.\n\t\t *\n\t\t * @param {Object} response API Request response.\n\t\t */\n\t\t.done( function( response ) {\n\t\t\thandleNotice( response, 'success' );\n\n\t\t\t// Automatically redirect on success.\n\t\t\tsetTimeout( function() {\n\t\t\t\tlocation.reload();\n\t\t\t}, 1500 );\n\t\t} );\n}\n\n/**\n * Creates a PaymentMethod from a card and billing form.\n *\n * @param {HTMLElement} billingForm Form with billing fields to retrieve data from.\n * @return {Object} Stripe PaymentMethod.\n */\nfunction createPaymentMethod( billingForm ) {\n\treturn window.eddStripe\n\t\t// Create a PaymentMethod with stripe.js\n\t\t.createPaymentMethod(\n\t\t\t'card',\n\t\t\twindow.eddStripe.cardElement,\n\t\t\t{\n\t\t\t\tbilling_details: getBillingDetails( billingForm ),\n\t\t\t}\n\t\t)\n\t\t/**\n\t\t * Handles PaymentMethod creation response.\n\t\t *\n\t\t * @param {Object} result PaymentMethod creation result.\n\t\t */\n\t\t.then( function( result ) {\n\t\t\tif ( result.error ) {\n\t\t\t\tthrow result.error;\n\t\t\t}\n\n\t\t\treturn result.paymentMethod;\n\t\t} );\n}\n\n/**\n * Disables \"Add New\" form.\n */\nfunction disableForm() {\n\tconst submit = document.querySelector( '.edd-stripe-add-new' );\n\n\tsubmit.value = submit.dataset.loading;\n\tsubmit.disabled = true;\n}\n\n/**\n * Enables \"Add New\" form.\n */\nfunction enableForm() {\n\tconst submit = document.querySelector( '.edd-stripe-add-new' );\n\n\tsubmit.value = submit.dataset.submit;\n\tsubmit.disabled = false;\n}\n\n/**\n * Handles a notice (success or error) for card actions.\n *\n * @param {Object} error Error with message to output.\n * @param {string} type Notice type.\n */\nexport function handleNotice( error, type = 'error' ) {\n\t// Create the new notice.\n\tconst notice = generateNotice(\n\t\t( error && error.message ) ? error.message : edd_stripe_vars.generic_error,\n\t\ttype\n\t);\n\n\t// Hide previous notices.\n\tforEach( document.querySelectorAll( '.edd-stripe-alert' ), function( alert ) {\n\t\talert.remove();\n\t} );\n\n\t// Show new notice.\n\tdocument.querySelector( '.edd-stripe-add-card-actions' )\n\t\t.insertBefore( notice, document.querySelector( '.edd-stripe-add-new' ) );\n}\n","/**\n * Internal dependencies\n */\nimport { cardActions } from './actions.js';\nimport { addNewForm } from './add-new.js';\n\nexport function setup() {\n\tif ( ! document.getElementById( 'edd-stripe-manage-cards' ) ) {\n\t\treturn;\n\t}\n\n\tcardActions();\n\taddNewForm();\n}\n","/* global edd_stripe_vars */\n\n/**\n * Internal dependencies\n */\n/* eslint-disable */\nimport {\n\tgetPaymentMethod,\n\tmountCardElement,\n\thandle as handleIntent,\n\tretrieve as retrieveIntent,\n} from 'frontend/elements';\n\nimport { paymentMethods } from 'frontend/checkout/payment-methods.js';\nimport { generateNotice, apiRequest } from 'utils';\n/* eslint-enable */\n\n/**\n * Binds events and sets up \"Update Payment Method\" form.\n */\nexport function updatePaymentMethodForm() {\n\t// Mount Card Element.\n\twindow.eddStripe.cardElement = mountCardElement( window.eddStripe.elements() );\n\n\t// Setup payment method selector.\n\tsetPaymentMethods();\n\n\tdocument.getElementById( 'edds-update-payment-method' ).addEventListener( 'submit', onAuthorizePayment );\n}\n\n/**\n * Setup PaymentMethods.\n *\n * Moves the active item to the currently authenticating PaymentMethod.\n */\nfunction setPaymentMethods() {\n\tpaymentMethods();\n\n\tconst form = document.getElementById( 'edds-update-payment-method' );\n\tconst input = document.getElementById( form.dataset.paymentMethod );\n\n\t// Select the correct PaymentMethod after load.\n\tif ( input ) {\n\t\tconst changeEvent = document.createEvent( 'Event' );\n\n\t\tchangeEvent.initEvent( 'change', true, true );\n\t\tinput.checked = true;\n\t\tinput.dispatchEvent( changeEvent );\n\t}\n}\n\n/**\n * Authorize a PaymentIntent.\n *\n * @param {Event} e submtit event.\n */\nasync function onAuthorizePayment( e ) {\n\te.preventDefault();\n\n\tconst form = document.getElementById( 'edds-update-payment-method' );\n\n\tdisableForm();\n\n\ttry {\n\t\tconst paymentMethod = await getPaymentMethod( form, window.eddStripe.cardElement );\n\n\t\t// Handle PaymentIntent.\n\t\tconst intent = await retrieveIntent( form.dataset.paymentIntent, 'payment_method' );\n\n\t\tconst handledIntent = await handleIntent( intent, {\n\t\t\tpayment_method: paymentMethod.id,\n\t\t} );\n\n\t\t// Attempt to transition payment status and redirect.\n\t\tconst authorization = await completeAuthorization( handledIntent.id );\n\n\t\tif ( authorization.payment ) {\n\t\t\twindow.location.reload();\n\t\t} else {\n\t\t\tthrow authorization;\n\t\t}\n\t} catch ( error ) {\n\t\thandleException( error );\n\t\tenableForm();\n\t}\n}\n\n/**\n * Complete a Payment after the Intent has been authorized.\n *\n * @param {string} intentId Intent ID.\n * @return {Promise} jQuery Promise.\n */\nexport function completeAuthorization( intentId ) {\n\treturn apiRequest( 'edds_complete_payment_authorization', {\n\t\tintent_id: intentId,\n\t} );\n}\n\n/**\n * Disables \"Add New\" form.\n */\nfunction disableForm() {\n\tconst submit = document.getElementById( 'edds-update-payment-method-submit' );\n\n\tsubmit.value = submit.dataset.loading;\n\tsubmit.disabled = true;\n}\n\n/**\n * Enables \"Add New\" form.\n */\nfunction enableForm() {\n\tconst submit = document.getElementById( 'edds-update-payment-method-submit' );\n\n\tsubmit.value = submit.dataset.submit;\n\tsubmit.disabled = false;\n}\n\n/**\n * Handles a notice (success or error) for authorizing a card.\n *\n * @param {Object} error Error with message to output.\n */\nexport function handleException( error ) {\n\t// Create the new notice.\n\tconst notice = generateNotice(\n\t\t( error && error.message ) ? error.message : edd_stripe_vars.generic_error,\n\t\t'error'\n\t);\n\n\tconst container = document.getElementById( 'edds-update-payment-method-errors' );\n\n\tcontainer.innerHTML = '';\n\tcontainer.appendChild( notice );\n}\n","/**\n * Internal dependencies\n */\nimport { updatePaymentMethodForm } from './update-payment-method';\n\nexport function setup() {\n\tif ( ! document.getElementById( 'edds-update-payment-method' ) ) {\n\t\treturn;\n\t}\n\n\tupdatePaymentMethodForm();\n}\n","/* global Stripe, edd_stripe_vars */\n\n/**\n * Internal dependencies\n */\n/**\n * External dependencies\n */\nimport { domReady, apiRequest, generateNotice } from 'utils';\n\nimport {\n\tsetup as setupCheckout,\n\tpaymentMethods,\n} from './checkout';\n\nimport { setup as setupProfile } from './profile-editor';\n\nimport { setup as setupPaymentHistory } from './payment-receipt';\n\nimport {\n\tmountCardElement,\n\tgetBillingDetails,\n\tgetPaymentMethod,\n\tconfirm as confirmIntent,\n\thandle as handleIntent,\n\tretrieve as retrieveIntent,\n} from 'frontend/elements';\n\n( () => {\n\ttry {\n\t\twindow.eddStripe = new Stripe( edd_stripe_vars.publishable_key );\n\n\t\t// Alias some functionality for external plugins.\n\t\twindow.eddStripe._plugin = {\n\t\t\tdomReady,\n\t\t\tapiRequest,\n\t\t\tgenerateNotice,\n\t\t\tmountCardElement,\n\t\t\tgetBillingDetails,\n\t\t\tgetPaymentMethod,\n\t\t\tconfirmIntent,\n\t\t\thandleIntent,\n\t\t\tretrieveIntent,\n\t\t\tpaymentMethods,\n\t\t};\n\n\t\t// Setup frontend components when DOM is ready.\n\t\tdomReady(\n\t\t\tsetupCheckout,\n\t\t\tsetupProfile,\n\t\t\tsetupPaymentHistory\n\t\t);\n\t} catch ( error ) {\n\t\talert( error.message );\n\t}\n} )();\n"],"sourceRoot":""}