{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/regenerator/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/stripe-checkout/cart/line-item.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/stripe-checkout/cart/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payments/session.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/stripe-checkout/submit.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/stripe-checkout/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/stripe-checkout/setup.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payment-forms/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/defineProperty.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/form-serialize/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/utils/src/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/classCallCheck.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/createClass.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/cart/src/line-item.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/cart/src/cart.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/cart/src/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/getPrototypeOf.js","webpack:///external \"jQuery\"","webpack:///./js/frontend/payment-forms/stripe-elements/cart/line-item.js","webpack:///./js/frontend/payment-forms/stripe-elements/cart/index.js","webpack:///./js/frontend/payment-forms/stripe-elements/utils.js","webpack:///./js/frontend/payment-forms/stripe-elements/index.js","webpack:///./js/frontend/payment-forms/stripe-elements/setup.js","webpack:///./js/frontend/payment-forms/stripe-elements/submit.js","webpack:///./js/frontend/payment-forms/index.js","webpack:///./js/frontend/payment-methods/card/submit.js","webpack:///./js/frontend/payment-methods/card/index.js","webpack:///./js/frontend/payment-methods/card/setup.js","webpack:///./js/frontend/payments/charge.js","webpack:///./js/frontend/payment-methods/ach-debit/submit.js","webpack:///./js/frontend/payment-methods/ach-debit/index.js","webpack:///./js/frontend/payment-methods/ideal/submit.js","webpack:///./js/frontend/payment-methods/ideal/index.js","webpack:///./js/frontend/payment-methods/ideal/setup.js","webpack:///./js/frontend/payment-methods/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/inherits.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/frontend/payments/customer.js","webpack:///./js/frontend/payments/subscription.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/typeof.js","webpack:///./js/frontend/payments/paymentintent.js","webpack:///./js/frontend/components/total-amount-labels.js","webpack:///./js/frontend/components/custom-amount.js","webpack:///./js/frontend/components/payment-request-button.js","webpack:///./js/frontend/payment-methods/ach-debit/setup.js","webpack:///./js/frontend/components/coupon.js","webpack:///./js/frontend/payments/source.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/qs/lib/index.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/regenerator-runtime/runtime.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/utils/src/number.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/includes/core/assets/js/packages/utils/src/api-request.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/qs/lib/utils.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/qs/lib/formats.js","webpack:///./js/frontend/components/multi-sub.js","webpack:///./js/frontend/components/address.js","webpack:///./js/frontend/components/date.js","webpack:///./js/frontend/payment-forms/stripe-elements/overlays.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/qs/lib/stringify.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/qs/lib/parse.js","webpack:///./js/frontend/components/amount.js","webpack:////Users/spencerfinnell/dev/wpsimplepay/wp-content/plugins/wp-simple-pay-pro/node_modules/@wordpress/url/build-module/add-query-args.js","webpack:///./js/frontend/components/quantity.js","webpack:///./js/frontend/compat.js","webpack:///./js/frontend/index.js","webpack:///./js/frontend/components/tabs.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","LineItem","subtotal","taxDecimal","this","cart","getTaxDecimal","getQuantity","unitPrice","getUnitPrice","Math","round","getSubtotal","BaseLineItem","Cart","args","getLineItems","forEach","item","coupon","getCoupon","percentOff","percent_off","amountOff","amount_off","discount","tax","getDiscount","BaseCart","data","spFormElem","formData","apiRequest","form_values","serialize","hash","form_data","form_id","formId","a","window","simpayApp","enableForm","disableForm","triggerBrowserValidation","checkValidity","trigger","isValid","customer_id","hasCustomerFields","createCustomer","id","createSession","session","stripeInstance","redirectToCheckout","sessionId","then","error","onPaymentFormError","setup","e","submitBtn","find","spShared","debugLog","getPaymentFormType","convertFormDataToCartData","items","currency","taxPercent","isNonDecimalCurrency","length","addLineItem","addEventListener","preventDefault","simpayGoogleRecaptcha","siteKey","i18n","grecaptcha","ready","execute","action","token","append","getPaymentForms","submit","catch","onError","undefined","formDisplayType","stripeCheckout","showError","stripeErrorMessages","message","code","obj","configurable","writable","asyncGeneratorStep","gen","resolve","reject","_next","_throw","arg","info","done","Promise","fn","self","arguments","apply","err","k_r_submitter","k_r_success_contrls","brackets","hash_serializer","result","match","hash_assign","keys","shift","between","Array","isArray","push","_values","string","index","isNaN","children","RegExp","exec","parse_keys","existing","str_serialize","replace","encodeURIComponent","form","options","serializer","elements","radio_store","element","disabled","test","nodeName","type","val","checked","empty","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","slice","instance","Constructor","TypeError","_defineProperties","target","props","descriptor","protoProps","staticProps","title","amount","quantity","subscription","update","Number","isSafeInteger","remainingItems","filter","parseFloat","filteredItems","lineitem","convertToCents","spGeneral","booleans","isZeroDecimal","stripeParams","isSubscription","isTrial","planInterval","planIntervalCount","feePercent","feeAmount","setupFee","interval","intervalCount","singleAmount","_getPrototypeOf","setPrototypeOf","getPrototypeOf","__proto__","jQuery","getTax","lineItems","lineItemDiscount","lineItemSubtotal","cartSubtotal","ELEMENTS_DEFAULT_STYLE","base","color","fontFamily","fontSize","fontSmoothing","fontWeight","invalid","iconColor","realFormElem","formPaymentMethods","paymentMethods","paymentMethod","_","each","querySelectorAll","paymentMethodToggle","dataset","getPaymentMethod","config","findWhere","getElementStyle","cardEl","document","getElementById","input","styleTag","createElement","querySelector","innerHTML","body","appendChild","inputStyles","getComputedStyle","trbl","map","dir","getPropertyValue","corners","corner","join","getOwnerData","billingAddressContainer","email","phone","address","line1","city","state","postal_code","country","corePaymentForms","stripeElements","stripe","owner","createSource","card","source","handleSource","hidePostalCode","showPostalCode","style","mount","on","achDebitEl","publicToken","accountId","plaidHandler","open","public_token","account_id","stripe_bank_account_token","source_id","customer","successUrl","addQueryArgs","success_url","isRecurring","createSubscription","handleSubscriptionServerResponse","location","href","createCharge","iDEAL","ideal","_complete","createPaymentIntent","payment_method_type","paymentIntent","handlePaymentIntentServerResponse","payment_intent","confirmIdealPayment","payment_intent_client_secret","payment_method","billing_details","return_url","idealEl","padding","achDebit","subClass","superClass","constructor","_typeof","assertThisInitialized","updatePaymentMethod","customerId","subscriptionId","handleServerResponse","status","latest_invoice","setupIntent","pending_setup_intent","errorUrl","error_url","paymentIntentStatus","paymentIntentClientSecret","client_secret","paymentIntentError","last_payment_error","handleCardPayment","setupIntentStatus","setupIntentClientSecret","handleCardSetup","iterator","confirm","requires_action","handleCardAction","paymentIntentAction","payment_intent_id","paymentIntentConfirmation","convertToDollars","formatCurrency","total","getTotal","formatted","setCoreFinalAmount","text","totalAmount","getLineItem","recurringAmountFinal","recurringAmountFormatted","cartTotal","recurringAmount","taxAmount","_isDirty","triggerTotalsChanged","isDirty","customAmountInput","errorEl","minAmount","unformatCurrency","unformattedAmount","customAmount","subMinAmount","planAmount","customPlanAmount","customAmountVal","removeClass","html","subMinCustomAmountError","minCustomAmountError","addClass","updateTotalAmountLabels","enableCustomPlanAmount","customOption","prop","useCustomPlan","formInstance","hasPaymentRequestButton","requestPayerName","requestPayerEmail","requestShipping","shippingOptions","theme","paymentRequestButtons","simpayAppPro","paymentRequest","toLowerCase","label","totalLabel","displayItems","getDisplayItems","prButton","paymentRequestButton","canMakePayment","toMount","buttons","paymentRequestIsValid","updateCustomAmount","containers","container","display","updateWith","payerEmail","payerName","complete","$","attr","appendTo","requiredFieldsValid","control","classicFields","classList","is","className","indexOf","isClassicField","inputs","required","validity","valid","plan","planLabel","setupFeeAmount","setupFeeLabel","taxLabel","getTaxPercent","couponLabel","wpsp","hooks","isTestMode","companyName","checkoutButtonEl","tabs","maybeHideCheckoutButton","tab","fetchLinkToken","linkToken","link_token","configs","env","clientName","product","selectAccount","onSuccess","removeEventListener","onExit","metadata","destroy","Plaid","submitEl","keyCode","couponField","responseContainer","loadingImage","removeCoupon","hiddenCouponElem","couponMessage","couponCode","couponNonce","hide","show","ajax","url","strings","ajaxurl","method","dataType","success","response","stripeCoupon","couponPercentOffText","couponAmountOffText","remove","class","errorMessage","responseText","handle","paymentIntentRequiresAction","payment_method_id","stringify","parse","formats","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","define","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","context","Context","_invoke","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","makeInvokeMethod","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","invoke","__await","unwrapped","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","displayName","isGeneratorFunction","genFun","ctor","mark","awrap","async","iter","toString","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","loc","caught","hasCatch","hasFinally","finallyEntry","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","isInteger","isFinite","floor","abs","MAX_SAFE_INTEGER","route","wpApiSettings","root","beforeSend","xhr","setRequestHeader","nonce","responseJSON","has","hexTable","array","toUpperCase","arrayToObject","plainObjects","assign","reduce","acc","compact","queue","refs","compacted","compactQueue","decode","str","decodeURIComponent","encode","String","out","charCodeAt","isBuffer","isRegExp","merge","allowPrototypes","concat","mergeTarget","percentTwenties","formatters","RFC1738","RFC3986","wrapperElem","planId","planName","planSetupFee","planTrial","planMaxCharges","selectedOption","first","hasClass","focus","toggleShippingAddressFields","shippingAddressContainer","isChecked","toggle","datepicker","dateFormat","beforeShow","css","modal","opacity","height","spFormElems","spFormData","setupPaymentRequestButton","SELECTOR","firstModalField","parentElement","add","focusFirstField","OVERLAYS_SETUP","inputControls","controls","_setPrototypeOf","ReferenceError","utils","arrayPrefixGenerators","prefix","indices","repeat","toISO","Date","toISOString","defaults","delimiter","encoder","encodeValuesOnly","serializeDate","date","skipNulls","strictNullHandling","generateArrayPrefix","sort","allowDots","formatter","objKeys","opts","format","arrayFormat","joined","addQueryPrefix","arrayLimit","decoder","depth","parameterLimit","parseKeys","givenKey","child","segment","parent","chain","leaf","cleanRoot","parseInt","parseArrays","parseObject","ignoreQueryPrefix","tempObj","cleanStr","limit","Infinity","parts","split","part","bracketEqualsPos","pos","parseValues","newObj","baseUrl","queryStringIndex","substr","extend","memo","func","isCustomAmountFieldValid","initDateField","setupDateField","handleCustomAmountFocusIn","processCustomAmount","updateAmountSelect","updateAmountField","updateQuantitySelect","updateQuantityField","updateTotalAmountLabel","updateRecurringAmountLabel","updateTaxAmountLabel","changeMultiSubAmount","updateMultiSubSelection","enablePaymentRequestButton","bindProFormEventsAndTriggers","bindEvents","handleFieldFocus","setOnFieldFocus","setSubmitButtonAsLoading","setProFinalAmount","updateAmounts","calculateTaxAmount","percent","accounting","toFixed","integers","decimalPlaces","updatePaymentRequestButton","getPaymentRequestDisplayItems","applyCoupon","toggleOverlayForm","init","setupPaymentForm","setupOverlayModals","setupPaymentRequestButtons","_removeCoupon","updatePaymentRequestButtons","isCustomAmountValid","amountSelect","which","el","field","$el","setTimeout","finalAmount","simpayAppProCompat","changeTabs","parentNode","grandparent","setAttribute","panels","panelId","getAttribute","removeAttribute","tabList","tabFocus"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAA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AkB,qBAE7CrB,EAAOoB,KAAM2hB,GAAQ,SAAEtxB,EAAG4wB,GACzBA,EAAGS,aAAc,UAAU,MAG5B,IAAME,EAAUplB,EAAOqlB,aAAc,iBAGrCJ,EAAYD,WACV1gB,cADF,WACsB8gB,IACpBE,gBAAiB,UA7FpBltB,OAAOkC,iBAAkB,oBAAoB,WAC5C,IAAMmW,EAAOxM,SAASR,iBAAkB,iDAGnCgN,GACJlN,EAAEC,KAAMiN,GAAM,SAAEE,GACfA,EAAIrW,iBAAkB,QAASyqB,MAKjC,IAAMQ,EAAUthB,SAASK,cAAe,6CAExC,GAAOihB,EAAP,CAIA,IAAIC,EAAW,EASfD,EAAQjrB,iBAAkB,WAAW,SAAEb,GAAO,IACrCkY,EAAYlY,EAAZkY,QAGS,KAAZA,GAA8B,KAAZA,IACtBlB,EAAM+U,GAAWN,aAAc,YAAa,GAE3B,KAAZvT,IACJ6T,GAGiB/U,EAAKrW,SACrBorB,EAAW,GAIW,KAAZ7T,KACX6T,EAGgB,IACfA,EAAW/U,EAAKrW,OAAS,GAI3BqW,EAAM+U,GAAWN,aAAc,WAAY,GAC3CzU,EAAM+U,GAAW5I,kB","file":"simpay-public-pro.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 = 59);\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Internal dependencies\n */\nimport { LineItem as BaseLineItem } from '@wpsimplepay/cart';\n\n/**\n * LineItem\n */\nclass LineItem extends BaseLineItem {\n\t/**\n\t * Retrieves a cart line item's subtotal.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item subtotal.\n\t */\n\tgetSubtotal() {\n\t\tlet subtotal = 0;\n\t\tlet i = 0;\n\n\t\tconst taxDecimal = this.cart.getTaxDecimal();\n\n\t\t// Calculate tax for each unit and create a sum.\n\t\tfor ( i = 0; i < this.getQuantity(); i++ ) {\n\t\t\tconst unitPrice = this.getUnitPrice();\n\t\t\tconst unitPriceTaxAmount = Math.round( unitPrice * taxDecimal );\n\n\t\t\tsubtotal += unitPrice + unitPriceTaxAmount;\n\t\t}\n\n\t\treturn subtotal;\n\t}\n\n\t/**\n\t * Retrieves a cart line item's total.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item total.\n\t */\n\tgetTotal() {\n\t\treturn Math.round( this.getSubtotal() );\n\t}\n}\n\nexport default LineItem;\n","/**\n * Internal dependencies\n */\nimport { Cart as BaseCart } from '@wpsimplepay/cart';\nimport LineItem from './line-item.js';\n\n/**\n * Cart for Stripe Checkout form types.\n *\n * @since 3.7.0\n */\nexport const Cart = class Cart extends BaseCart {\n\t/**\n\t * @since 3.7.0\n\t *\n\t * @param {Object} args Cart arguments.\n\t */\n\tconstructor( args ) {\n\t\tsuper( args );\n\n\t\t// Define the type of line item to use.\n\t\tthis.LineItem = LineItem;\n\t}\n\n\t/**\n\t * Retrieves subtotal.\n\t *\n\t * Taxes are added to each line item amount to create a subtotal.\n\t * This is done because Stripe Checkout Sessions do not support\n\t * `tax_percent` or `tax_rates`.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart subtotal.\n\t */\n\tgetSubtotal() {\n\t\tlet subtotal = 0;\n\n\t\tthis.getLineItems().forEach( ( item ) => {\n\t\t\tsubtotal += item.getSubtotal();\n\t\t} );\n\n\t\treturn subtotal;\n\t}\n\n\t/**\n\t * Retrieves the total discount amount.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart discount amount.\n\t */\n\tgetDiscount() {\n\t\tconst coupon = this.getCoupon();\n\n\t\tconst {\n\t\t\tpercent_off: percentOff,\n\t\t\tamount_off: amountOff,\n\t\t} = coupon;\n\n\t\tlet discount = 0;\n\n\t\tif ( false === coupon ) {\n\t\t\treturn discount;\n\t\t}\n\n\t\tif ( percentOff ) {\n\t\t\tdiscount += Math.round( this.getSubtotal() * ( percentOff / 100 ) );\n\t\t} else if ( amountOff ) {\n\t\t\tdiscount += amountOff;\n\t\t}\n\n\t\treturn discount;\n\t}\n\n\t/**\n\t * Retrieves the total tax amount.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart tax.\n\t */\n\tgetTax() {\n\t\tlet tax = 0;\n\t\tlet i = 0;\n\n\t\tconst taxDecimal = this.getTaxDecimal();\n\t\tconst lineItems = this.getLineItems();\n\n\t\tlineItems.forEach( ( item ) => {\n\t\t\tfor ( i = 0; i < item.getQuantity(); i++ ) {\n\t\t\t\ttax += Math.round( item.getUnitPrice() * taxDecimal );\n\t\t\t}\n\t\t} );\n\n\t\treturn tax;\n\t}\n\n\t/**\n\t * Retrieves the total.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart total.\n\t */\n\tgetTotal() {\n\t\tconst subtotal = this.getSubtotal();\n\t\tconst discount = this.getDiscount();\n\n\t\treturn Math.round( subtotal - discount );\n\t}\n};\n","/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { apiRequest } from '@wpsimplepay/utils';\n\n/**\n * Create a Customer object based on current formData.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function create( data = {}, spFormElem, formData ) {\n\treturn apiRequest( 'v2/checkout-session', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n","/* global _ */\n\n/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\nimport { create as createCustomer } from '@wpsimplepay/core/frontend/payments/customer.js';\nimport { create as createSession } from '@wpsimplepay/core/frontend/payments/session.js';\n\n/**\n * Submit Stripe Checkout Payment Form.\n *\n * @todo DRY presubmission validation checks?\n *\n * @since 3.8.0\n *\n * @param {Element} cardElementInstance Stripe Elements card.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport async function submit( spFormElem, formData ) {\n\tconst {\n\t\tenableForm,\n\t\tdisableForm,\n\t\ttriggerBrowserValidation,\n\t} = window.simpayApp;\n\n\t// Disable form while processing.\n\tdisableForm( spFormElem, formData, true );\n\n\t// HTML5 validation check.\n\tif ( ! spFormElem[ 0 ].checkValidity() ) {\n\t\ttriggerBrowserValidation( spFormElem, formData );\n\t\tenableForm( spFormElem, formData );\n\n\t\treturn;\n\t}\n\n\t// Allow further validation.\n\t//\n\t// jQuery( document.body ).on( 'simpayBeforeStripePayment', function( e, spFormElem, formData ) {\n\t// formData.isValid = false;\n\t// } );\n\tspFormElem.trigger( 'simpayBeforeStripePayment', [ spFormElem, formData ] );\n\n\tif ( ! formData.isValid ) {\n\t\tenableForm( spFormElem, formData );\n\n\t\treturn;\n\t}\n\n\ttry {\n\n\t\t// @todo Implement as a \"Stripe Checkout\" Payment Method?\n\n\t\tlet customer_id = null;\n\t\tconst { hasCustomerFields } = formData;\n\n\t\t// Only generate a custom Customer if we need to map on-page form fields.\n\t\tif ( hasCustomerFields ) {\n\t\t\tconst { id } = await createCustomer( {}, spFormElem, formData );\n\t\t\tcustomer_id = id;\n\t\t}\n\n\t\t// Generate a Checkout Session.\n\t\tconst session = await createSession(\n\t\t\t{\n\t\t\t\tcustomer_id,\n\t\t\t},\n\t\t\tspFormElem,\n\t\t\tformData\n\t\t);\n\n\t\t// Redirect to Stripe.\n\t\tspFormElem.stripeInstance\n\t\t\t.redirectToCheckout( {\n\t\t\t\tsessionId: session.sessionId,\n\t\t\t} )\n\t\t\t.then( ( { error } ) => {\n\t\t\t\tif ( error ) {\n\t\t\t\t\tonPaymentFormError( error, spFormElem, formData );\n\t\t\t\t}\n\t\t\t} );\n\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies\n */\nimport { setup } from './setup.js';\nimport { submit } from './submit.js';\nimport { onPaymentFormError as onError } from '@wpsimplepay/core/frontend/payment-forms';\n\nexport default {\n\tsetup,\n\tsubmit,\n\tonError,\n};\n","/**\n * Internal dependencies\n */\nimport { convertFormDataToCartData } from '@wpsimplepay/cart';\nimport { Cart } from '@wpsimplepay/core/frontend/payment-forms/stripe-checkout/cart';\nimport { onPaymentFormError, getPaymentFormType, getPaymentForms } from '@wpsimplepay/core/frontend/payment-forms';\n\n/**\n * Bind events for Stripe Checkout.\n *\n * @param {Event} e simpayBindCoreFormEventsAndTriggers Event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( e, spFormElem, formData ) {\n\tconst submitBtn = spFormElem.find( '.simpay-payment-btn' )[0];\n\n\tconst { enableForm, disableForm } = window.simpayApp;\n\tconst { debugLog } = window.spShared;\n\n\t// Don't continue if this form is not using Stripe Checkout.\n\t// We need to check here due to legacy implementation of form setups.\n\tif ( 'stripe-checkout' !== getPaymentFormType( spFormElem, formData ) ) {\n\t\treturn;\n\t}\n\n\t// Disable Payment Form during setup.\n\tdisableForm( spFormElem, formData, true );\n\n\ttry {\n\t\t// Convert legacay data in to Cart data.\n\t\tconst {\n\t\t\titems,\n\t\t\tcurrency,\n\t\t\ttaxPercent,\n\t\t\tisNonDecimalCurrency,\n\t\t} = convertFormDataToCartData( formData );\n\n\t\t// Create a cart.\n\t\tconst cart = new Cart( {\n\t\t\tcurrency,\n\t\t\ttaxPercent,\n\t\t\tisNonDecimalCurrency,\n\t\t} );\n\n\t\t// Add items to the Cart.\n\t\tif ( items.length > 0 ) {\n\t\t\titems.forEach( ( item ) => {\n\t\t\t\tcart.addLineItem( item );\n\t\t\t} );\n\t\t}\n\n\t\t// Attach cart to the Payment Form instance.\n\t\tspFormElem.cart = cart;\n\n\t\t// Reenable form.\n\t\tenableForm( spFormElem, formData );\n\n\t\t// Attach submission handler.\n\t\tsubmitBtn.addEventListener( 'click', ( e ) => {\n\t\t\te.preventDefault();\n\n\t\t\tif ( window.simpayGoogleRecaptcha ) {\n\t\t\t\tconst { siteKey, i18n } = simpayGoogleRecaptcha;\n\n\t\t\t\t// @todo Complete syncronously inside of separate reCAPTCHA script.\n\t\t\t\t//\n\t\t\t\t// This is a temporary measure to ensure reCAPTCHA tokens are generated\n\t\t\t\t// at the time of submission to avoid them being invalidated after 120 seconds.\n\t\t\t\tgrecaptcha.ready( () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_customer`,\n\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_customer\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_payment`,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_payment\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\t\t\t\t\t// Find and submit the Payment Form.\n\t\t\t\t\t\t\t\t\t\tgetPaymentForms()[ getPaymentFormType( spFormElem, formData ) ]\n\t\t\t\t\t\t\t\t\t\t\t.submit( spFormElem, formData );\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t\t\t\tonPaymentFormError( i18n.error, spFormElem, formData );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\tonPaymentFormError( i18n.error, spFormElem, formData );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tgetPaymentForms()[ getPaymentFormType( spFormElem, formData ) ]\n\t\t\t\t\t.submit( spFormElem, formData );\n\t\t\t}\n\t\t} );\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/* global _ */\n\n/**\n * Internal dependencies\n */\nimport { default as stripeCheckout } from './stripe-checkout';\n\n/**\n * Returns the current form type.\n *\n * @since 3.8.0\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {string} Form type. Currently supports `stripe-checkout` or `stripe-elements`.\n */\nexport function getPaymentFormType( spFormElem, formData ) {\n\tif (\n\t\tundefined === formData.formDisplayType ||\n\t\t'stripe_checkout' === formData.formDisplayType\n\t) {\n\t\treturn 'stripe-checkout';\n\t} else {\n\t\treturn 'stripe-elements';\n\t}\n};\n\n/**\n * Returns available Payment Forms.\n *\n * @todo Create a registry/datastore.\n *\n * @since 3.8.0\n *\n * @return {Object} List of available Payment Forms.\n */\nexport const getPaymentForms = () => ( {\n\t'stripe-checkout': stripeCheckout,\n} );\n\n/**\n * Handles an error on submission.\n *\n * @since 3.8.0\n *\n * @param {Object} error Error data.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function onPaymentFormError( error = {}, spFormElem, formData ) {\n\tconst { showError, enableForm } = window.simpayApp;\n\tconst { debugLog } = window.spShared;\n\n\tconst { stripeErrorMessages } = formData;\n\tlet message = error.message || '';\n\n\t// Use localized message if code exists.\n\tif ( error.code && stripeErrorMessages[ error.code ] ) {\n\t\tmessage = stripeErrorMessages[ error.code ];\n\t}\n\n\tshowError( spFormElem, formData, message );\n\tenableForm( spFormElem, formData );\n}\n","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;","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;","// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n //Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i<elements.length ; ++i) {\n var element = elements[i];\n\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n // for checkbox\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j<selectOptions.length ; ++j) {\n var option = selectOptions[j];\n var allowedEmpty = options.empty && !option.value;\n var hasValue = (option.value || allowedEmpty);\n if (option.selected && hasValue) {\n isSelectedOptions = true;\n\n // If using a hash serializer be sure to add the\n // correct notation for an array in the multi-select\n // context. Here the name attribute on the select element\n // might be missing the trailing bracket pair. Both names\n // \"foo\" and \"foo[]\" should be arrays.\n if (options.hash && key.slice(key.length - 2) !== '[]') {\n result = serializer(result, key + '[]', option.value);\n }\n else {\n result = serializer(result, key, option.value);\n }\n }\n }\n\n // Serialize if no selected options and options.empty is true\n if (!isSelectedOptions && options.empty) {\n result = serializer(result, key, '');\n }\n\n continue;\n }\n\n result = serializer(result, key, val);\n }\n\n // Check for all empty radio buttons and serialize them with key=\"\"\n if (options.empty) {\n for (var key in radio_store) {\n if (!radio_store[key]) {\n result = serializer(result, key, '');\n }\n }\n }\n\n return result;\n}\n\nfunction parse_keys(string) {\n var keys = [];\n var prefix = /^([^\\[\\]]*)/;\n var children = new RegExp(brackets);\n var match = prefix.exec(string);\n\n if (match[1]) {\n keys.push(match[1]);\n }\n\n while ((match = children.exec(string)) !== null) {\n keys.push(match[1]);\n }\n\n return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n if (keys.length === 0) {\n result = value;\n return result;\n }\n\n var key = keys.shift();\n var between = key.match(/^\\[(.+?)\\]$/);\n\n if (key === '[]') {\n result = result || [];\n\n if (Array.isArray(result)) {\n result.push(hash_assign(null, keys, value));\n }\n else {\n // This might be the result of bad name attributes like \"[][foo]\",\n // in this case the original `result` object will already be\n // assigned to an object literal. Rather than coerce the object to\n // an array, or cause an exception the attribute \"_values\" is\n // assigned as an array.\n result._values = result._values || [];\n result._values.push(hash_assign(null, keys, value));\n }\n\n return result;\n }\n\n // Key is an attribute name and can be assigned directly.\n if (!between) {\n result[key] = hash_assign(result[key], keys, value);\n }\n else {\n var string = between[1];\n // +var converts the variable into a number\n // better than parseInt because it doesn't truncate away trailing\n // letters and actually fails if whole thing is not a number\n var index = +string;\n\n // If the characters between the brackets is not a number it is an\n // attribute name and can be assigned directly.\n if (isNaN(index)) {\n result = result || {};\n result[string] = hash_assign(result[string], keys, value);\n }\n else {\n result = result || [];\n result[index] = hash_assign(result[index], keys, value);\n }\n }\n\n return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n var matches = key.match(brackets);\n\n // Has brackets? Use the recursive assignment function to walk the keys,\n // construct any missing objects in the result tree and make the assignment\n // at the end of the chain.\n if (matches) {\n var keys = parse_keys(key);\n hash_assign(result, keys, value);\n }\n else {\n // Non bracket notation can make assignments directly.\n var existing = result[key];\n\n // If the value has been assigned already (for instance when a radio and\n // a checkbox have the same name attribute) convert the previous value\n // into an array before pushing into it.\n //\n // NOTE: If this requirement were removed all hash creation and\n // assignment could go through `hash_assign`.\n if (existing) {\n if (!Array.isArray(existing)) {\n result[key] = [ existing ];\n }\n\n result[key].push(value);\n }\n else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n // encode newlines as \\r\\n cause the html spec says so\n value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n value = encodeURIComponent(value);\n\n // spaces should be '+' rather than '%20'.\n value = value.replace(/%20/g, '+');\n return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n","export * from './number.js';\nexport * from './api-request.js';\n","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Internal dependencies\n */\nimport { Cart } from './cart.js';\n\n/**\n * LineItem\n */\nexport const LineItem = class LineItem {\n\t/**\n\t * Create a line item.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param {Object} args Line item arguments.\n\t * @param {string} args.id Cart line item ID.\n\t * @param {string} args.title Cart line item title.\n\t * @param {number} args.amount Cart line item amount.\n\t * @param {number} args.quantity Cart line item quantity.\n\t * @param {boolean|Object} args.subscription Cart line item subscription data.\n\t * @param {boolean} args.subscription.isTrial Cart line item subscription trial designation.\n\t * @param {number} args.subscription.intervalCount Cart line item subscription interval count.\n\t * @param {number} args.subscription.interval Cart line item subscription interval.\n\t * @param {Cart} cart Cart this line item is attached to.\n\t * @return {LineItem} LineItem\n\t */\n\tconstructor( args, cart ) {\n\t\t// Set defaults.\n\t\t// @todo add support for classProperties.\n\t\tthis.cart = null;\n\t\tthis.id = null;\n\t\tthis.title = null;\n\t\tthis.amount = 0;\n\t\tthis.quantity = 1;\n\t\tthis.subscription = false;\n\n\t\tif ( 'object' !== typeof cart ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-cart',\n\t\t\t\tmessage: 'Item must have an cart.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.cart = cart;\n\t\t}\n\n\t\tthis.update( args );\n\t}\n\n\t/**\n\t * Updates a line item.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param {Object} args Cart line item arguments.\n\t * @param {string} args.id Cart line item ID.\n\t * @param {string} args.title Cart line item title.\n\t * @param {number} args.amount Cart line item amount.\n\t * @param {number} args.quantity Cart line item quantity.\n\t * @param {boolean|Object} args.subscription Cart line item subscription data.\n\t * @param {boolean} args.subscription.isTrial Cart line item subscription trial designation.\n\t * @param {number} args.subscription.intervalCount Cart line item subscription interval count.\n\t * @param {number} args.subscription.interval Cart line item subscription interval.\n\t * @return {LineItem} Line item.\n\t */\n\tupdate( args ) {\n\t\t// Parse and retrieve specific arguments.\n\t\tconst {\n\t\t\tid,\n\t\t\ttitle,\n\t\t\tamount,\n\t\t\tquantity,\n\t\t\tsubscription,\n\t\t} = {\n\t\t\t...this,\n\t\t\t...args,\n\t\t};\n\n\t\t// ID must be a string.\n\t\tif ( 'string' !== typeof id ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-id',\n\t\t\t\tmessage: 'Item ID must be a string.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.id = id;\n\t\t}\n\n\t\t// Title must be a string.\n\t\t// Not currently shown in any UI, but may be in the future.\n\t\tif ( 'string' !== typeof title ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-title',\n\t\t\t\tmessage: 'Item title must be a string.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.title = title;\n\t\t}\n\n\t\t// Amount must be a number.\n\t\tif ( ! Number.isSafeInteger( amount ) ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-amount',\n\t\t\t\tmessage: 'Item amount must be an integer.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.amount = amount;\n\t\t}\n\n\t\t// Quantity must be a number.\n\t\tif ( ! Number.isSafeInteger( quantity ) ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-quantity',\n\t\t\t\tmessage: 'Item quantity must be an integer.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.quantity = quantity;\n\t\t}\n\n\t\t// Subscription must be false or contain subscription data.\n\t\t// @todo Validate subscription data.\n\t\tif ( ! ( false === subscription || 'object' === typeof subscription ) ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item-subscription',\n\t\t\t\tmessage: 'Item subscription data must be a false or contain subscription data.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.subscription = subscription;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes the line item from the cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {LineItem} Removed line item.\n\t */\n\tremove() {\n\t\tconst allItems = this.cart.getLineItems();\n\t\tconst remainingItems = allItems.filter( ( { id } ) => ( this.id !== id ) );\n\n\t\tthis.cart.items = remainingItems;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves a cart line item's unit price.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item unit price.\n\t */\n\tgetUnitPrice() {\n\t\treturn this.amount;\n\t}\n\n\t/**\n\t * Retrieves the cart line item's quantity.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item quantity.\n\t */\n\tgetQuantity() {\n\t\treturn this.quantity;\n\t}\n\t\n\t/**\n\t * Retrieves a cart line item's tax.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item tax.\n\t */\n\tgetTax() {\n\t\tlet tax = 0;\n\t\tlet i = 0;\n\n\t\tconst taxDecimal = this.cart.getTaxDecimal();\n\t\tconst quantity = this.getQuantity();\n\t\tconst subtotal = this.getSubtotal();\n\n\t\tfor ( i = 0; i < quantity; i++ ) {\n\t\t\ttax += Math.round( subtotal * taxDecimal );\n\t\t}\n\n\t\treturn tax;\n\t}\n};\n\nexport default LineItem;\n","/**\n * Internal dependencies\n */\nimport LineItem from './line-item.js';\n\n/**\n * Cart\n */\nexport const Cart = class Cart {\n\t/**\n\t * Creates a cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @see `update()`\n\t *\n\t * @param {Object} args Cart arguments.\n\t * @return {Cart} Cart.\n\t */\n\tconstructor( args ) {\n\t\t// Set defaults.\n\t\t// @todo add support for classProperties.\n\t\tthis.items = [];\n\t\tthis.currency = 'usd';\n\t\tthis.taxPercent = 0;\n\t\tthis.coupon = false;\n\t\tthis.isNonDecimalCurrency = false;\n\n\t\tthis.update( args );\n\t}\n\n\t/**\n\t * Updates the cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param {Object} args Cart arguments.\n\t * @param {number} args.taxPercent Tax percentage.\n\t * @param {false|Object} args.coupon Stripe Coupon.\n\t * @param {boolean} args.isNonDecimalCurrency If the currency is non-decimal based.\n\t * @return {Cart} Cart.\n\t */\n\tupdate( args ) {\n\t\t// Parse and retrieve specific arguments.\n\t\tconst {\n\t\t\tcurrency,\n\t\t\ttaxPercent,\n\t\t\tcoupon,\n\t\t\tisNonDecimalCurrency,\n\t\t} = {\n\t\t\t...this,\n\t\t\t...args,\n\t\t};\n\n\t\t// Set currency.\n\t\tif ( 'string' !== typeof currency ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-currency',\n\t\t\t\tmessage: 'Currency must be a string.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.currency = currency;\n\t\t}\n\n\t\t// Set fees.\n\t\tif ( isNaN( taxPercent ) ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-tax-percent',\n\t\t\t\tmessage: 'Tax percentage must be a number.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.taxPercent = parseFloat( taxPercent );\n\t\t}\n\n\t\t// Set coupon.\n\t\t// @todo Validate coupon data.\n\t\tif ( ! ( false === coupon || 'object' === typeof coupon ) ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-coupon',\n\t\t\t\tmessage: 'Coupon must be a false or contain coupon data.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.coupon = coupon;\n\t\t}\n\n\t\tif ( 'boolean' !== typeof isNonDecimalCurrency ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-non-decimal-currency',\n\t\t\t\tmessage: 'Declaring a non-decimal currency must be a boolean.',\n\t\t\t};\n\t\t} else {\n\t\t\tthis.isNonDecimalCurrency = isNonDecimalCurrency;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Resets the cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {Cart} Cart.\n\t */\n\treset() {\n\t\treturn new Cart;\n\t}\n\n\t/**\n\t * Retrieves coupon information.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {Object} Stripe Coupon.\n\t */\n\tgetCoupon() {\n\t\treturn this.coupon;\n\t}\n\n\t/**\n\t * Retrieves the cart's tax percent amount.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number}\n\t */\n\tgetTaxPercent() {\n\t\treturn this.taxPercent;\n\t}\n\n\t/**\n\t * Retrieves the cart's tax decimal amount for calculations.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number}\n\t */\n\tgetTaxDecimal() {\n\t\treturn ( this.taxPercent / 100 );\n\t}\n\n\t/**\n\t * Retrieves the items in the cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {Array} List of cart items.\n\t */\n\tgetLineItems() {\n\t\treturn this.items;\n\t}\n\n\t/**\n\t * Retrieves an item.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param {string} id Cart line item ID.\n\t * @return {LineItem} Cart line item.\n\t */\n\tgetLineItem( id ) {\n\t\tconst items = this.getLineItems();\n\n\t\t// Can't use `find` because it is not supported in IE.\n\t\tconst filteredItems = items.filter( ( { id: itemId } ) => ( itemId === id ) );\n\n\t\tif ( 0 === filteredItems.length ) {\n\t\t\tthrow {\n\t\t\t\tid: 'invalid-line-item',\n\t\t\t\tmessage: `Unable to retrieve line item \"${ id }\"`,\n\t\t\t};\n\t\t}\n\n\t\treturn filteredItems[ 0 ];\n\t}\n\n\t/**\n\t * Adds a line item to the cart.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param {Object|LineItem} item Cart line item or arguments to create one.\n\t * @return {LineItem} Added line item.\n\t */\n\taddLineItem( item ) {\n\t\tlet lineitem;\n\n\t\tif ( true === item instanceof LineItem ) {\n\t\t\tlineitem = item;\n\t\t} else {\n\t\t\tlineitem = new this.LineItem( item, this );\n\t\t}\n\n\t\tthis.items.push( lineitem );\n\n\t\treturn lineitem;\n\t}\n};\n","export * from './cart.js';\nexport * from './line-item.js';\n\n/**\n * Converts current `formData` to a structured cart.\n *\n * @since 3.7.0\n *\n * @param {Object} formData Legacy form data.\n * @return {Object} data Cart data.\n */\nexport function convertFormDataToCartData( formData ) {\n\tconst {\n\t\tdebugLog,\n\t\tconvertToCents,\n\t} = window.spShared;\n\n\tconst {\n\t\tbooleans: {\n\t\t\tisZeroDecimal: isNonDecimalCurrency,\n\t\t},\n\t} = window.spGeneral;\n\n\tconst {\n\t\tstripeParams: {\n\t\t\tcurrency,\n\t\t},\n\n\t\t// Items.\n\t\tamount,\n\t\tisSubscription,\n\t\tquantity,\n\t\tisTrial,\n\t\tplanInterval,\n\t\tplanIntervalCount,\n\n\t\t// Fees.\n\t\tfeePercent,\n\t\tfeeAmount,\n\t\ttaxPercent,\n\t\tsetupFee,\n\t} = formData;\n\n\tconst data = {\n\t\tcurrency,\n\t\titems: [],\n\t\ttaxPercent: 0,\n\t\tisNonDecimalCurrency,\n\t};\n\n\t//\n\t// Add items.\n\t//\n\n\t// Initial Setup Fee.\n\tif ( ! isNaN( setupFee ) ) {\n\t\tdata.items.push( {\n\t\t\tid: 'setup-fee',\n\t\t\ttitle: 'Initial Setup Fee',\n\t\t\tamount: convertToCents( setupFee ),\n\t\t\tquantity: 1,\n\t\t\tsubscription: false,\n\t\t} );\n\t}\n\n\t// Plan Setup Fee.\n\tdata.items.push( {\n\t\tid: 'plan-setup-fee',\n\t\ttitle: 'Plan Setup Fee',\n\t\tamount: 0,\n\t\tquantity: 1,\n\t\tsubscription: false,\n\t} );\n\n\t// Base item.\n\tif ( isSubscription ) {\n\t\tdata.items.push( {\n\t\t\tid: 'base',\n\t\t\ttitle: 'Subscription',\n\t\t\tamount: convertToCents( amount ),\n\t\t\tquantity,\n\t\t\tsubscription: {\n\t\t\t\tisTrial,\n\t\t\t\tinterval: planInterval,\n\t\t\t\tintervalCount: planIntervalCount,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tlet singleAmount = amount;\n\n\t\tif ( ! isNaN( feeAmount ) && feeAmount > 0 ) {\n\t\t\tsingleAmount += feeAmount;\n\n\t\t\tdebugLog( 'feeAmount:', 'Arbitrary fee amounts should be added to the base amount directly.' );\n\t\t}\n\n\t\tdata.items.push( {\n\t\t\tid: 'base',\n\t\t\ttitle: 'One-time amount',\n\t\t\tamount: convertToCents( singleAmount ),\n\t\t\tquantity,\n\t\t\tsubscription: false,\n\t\t} );\n\t}\n\n\t// Tax.\n\tif ( ! isNaN( taxPercent ) ) {\n\t\tdata.taxPercent = taxPercent;\n\t}\n\n\t// Add any arbitrary fee percentage to tax percentage.\n\t// @link https://github.com/wpsimplepay/wp-simple-pay-pro/issues/1161\n\tif ( ! isNaN( feePercent ) && feePercent > 0 ) {\n\t\tdata.taxPercent = data.taxPercent + feePercent;\n\t\tdebugLog( 'feePercent:', 'Arbitrary fee percentages should be added to the taxPercent directly.' );\n\t};\n\n\treturn data;\n}\n","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","module.exports = jQuery;","/**\n * Internal dependencies\n */\nimport { LineItem as BaseLineItem } from '@wpsimplepay/cart';\n\n/**\n * LineItem\n */\nclass LineItem extends BaseLineItem {\n\t/**\n\t * Retrieves a cart line item's subtotal.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item subtotal.\n\t */\n\tgetSubtotal() {\n\t\treturn Math.round( this.getUnitPrice() * this.getQuantity() );\n\t}\n\n\t/**\n\t * Retrieves a cart line item's total.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart line item total.\n\t */\n\tgetTotal() {\n\t\treturn Math.round( this.getSubtotal() + this.getTax() );\n\t}\n}\n\nexport default LineItem;\n","/**\n * Internal dependencies\n */\nimport { Cart as BaseCart } from '@wpsimplepay/cart';\nimport LineItem from './line-item.js';\n\n/**\n * Cart for Embedded/Overlay form types.\n *\n * @todo Move to /pro\n *\n * @since 3.7.0\n */\nexport const Cart = class Cart extends BaseCart {\n\t/**\n\t * @since 3.7.0\n\t *\n\t * @param {Object} args Cart arguments.\n\t */\n\tconstructor( args ) {\n\t\tsuper( args );\n\n\t\t// Define the type of line item to use.\n\t\tthis.LineItem = LineItem;\n\t}\n\n\t/**\n\t * Retrieves subtotal.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart subtotal.\n\t */\n\tgetSubtotal() {\n\t\tlet subtotal = 0;\n\n\t\tthis.getLineItems().forEach( ( item ) => {\n\t\t\tsubtotal += item.getSubtotal();\n\t\t} );\n\n\t\treturn subtotal;\n\t}\n\n\t/**\n\t * Retrieves the total discount amount.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart discount amount.\n\t */\n\tgetDiscount() {\n\t\tconst coupon = this.getCoupon();\n\t\tlet discount = 0;\n\n\t\tif ( false === coupon ) {\n\t\t\treturn discount;\n\t\t}\n\n\t\tconst {\n\t\t\tamount_off: amountOff,\n\t\t\tpercent_off: percentOff,\n\t\t} = coupon;\n\n\t\tif ( percentOff ) {\n\t\t\tthis.getLineItems().forEach( ( item ) => {\n\t\t\t\tdiscount += Math.round( item.getSubtotal() * ( percentOff / 100 ) );\n\t\t\t} );\n\t\t}\n\n\t\tif ( amountOff ) {\n\t\t\tdiscount += amountOff;\n\t\t}\n\n\t\treturn discount;\n\t}\n\n\t/**\n\t * Retrieves total tax amount.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart tax.\n\t */\n\tgetTax() {\n\t\tlet tax = 0;\n\n\t\tconst coupon = this.getCoupon();\n\t\tconst taxDecimal = this.getTaxDecimal();\n\t\tconst lineItems = this.getLineItems();\n\n\t\t// Calculate taxes with no coupon applied.\n\t\tif ( false === coupon ) {\n\t\t\tlineItems.forEach( ( item ) => {\n\t\t\t\ttax += Math.round( item.getSubtotal() * taxDecimal );\n\t\t\t} );\n\n\t\t\treturn tax;\n\t\t}\n\n\t\tconst {\n\t\t\tpercent_off: percentOff,\n\t\t\tamount_off: amountOff,\n\t\t} = coupon;\n\n\t\t// Calculate taxes with a %-based coupon applied.\n\t\t//\n\t\t// Stripe applies the discount percent to each line item before\n\t\t// calculating the tax amount of each and summing.\n\t\tif ( percentOff ) {\n\t\t\tlineItems.forEach( ( item ) => {\n\t\t\t\tconst lineItemDiscount = item.getSubtotal() * ( percentOff / 100 );\n\t\t\t\tconst lineItemSubtotal = item.getSubtotal() - lineItemDiscount;\n\n\t\t\t\ttax += Math.round( lineItemSubtotal * taxDecimal );\n\t\t\t} );\n\n\t\t\treturn tax;\n\t\t}\n\n\t\tconst subtotal = this.getSubtotal();\n\n\t\t// Calculate taxes with a fixed-amount coupon applied.\n\t\t//\n\t\t// Stripe applies the discount amount to the cart subtotal before\n\t\t// calculating the tax amount for the whole cart.\n\t\tif ( amountOff ) {\n\t\t\tconst cartSubtotal = subtotal - amountOff;\n\n\t\t\ttax += Math.round( cartSubtotal * taxDecimal );\n\n\t\t\treturn tax;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the total.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return {number} Cart total.\n\t */\n\tgetTotal() {\n\t\tconst subtotal = this.getSubtotal();\n\t\tconst tax = this.getTax();\n\t\tconst discount = this.getDiscount();\n\n\t\treturn Math.round( ( subtotal - discount ) + tax );\n\t}\n};\n","const ELEMENTS_DEFAULT_STYLE = {\n\tbase: {\n\t\tcolor: '#32325d',\n\t\tfontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',\n\t\tfontSize: '15px',\n\t\tfontSmoothing: 'antialiased',\n\t\tfontWeight: 500,\n\n\t\t'::placeholder': {\n\t\t\tcolor: '#aab7c4',\n\t\t},\n\t},\n\tinvalid: {\n\t\tcolor: '#fa755a',\n\t\ticonColor: '#fa755a',\n\t},\n};\n\n/**\n * Gets Element styles based on an existing form input.\n *\n * Injects supplementary styles for the wrapper element.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param cardEl\n * @return {Object} Element style information.\n */\nexport function getElementStyle( spFormElem, cardEl ) {\n\t// Do nothing if an Element has already been styled;\n\tif ( document.getElementById( 'simpay-stripe-element-styles' ) ) {\n\t\treturn ELEMENTS_DEFAULT_STYLE;\n\t}\n\n\t// Inject inline CSS instead of applying to the Element so it can be overwritten.\n\tconst styleTag = document.createElement( 'style' );\n\tstyleTag.id = 'simpay-stripe-element-styles';\n\n\t// Try to mimick existing input styles.\n\tlet input;\n\n\tinput = document.querySelector( 'input.simpay-email' );\n\n\t// Try one more input in the main page content.\n\tif ( ! input ) {\n\t\tinput = document.querySelector(\n\t\t\t'body [role=\"main\"] input:not([type=\"hidden\"])'\n\t\t);\n\t}\n\n\t// Use default styles if no other input exists.\n\tif ( ! input ) {\n\t\tstyleTag.innerHTML = `.StripeElement.simpay-field-wrap {\n\t\t\tbackground: #fff;\n\t\t\tborder: 1px solid #d1d1d1;\n\t\t\tborder-radius: 4px;\n\t\t\tpadding: 0.4375em;\n\t\t\theight: 36px;\n\t\t\tmin-height: 36px;\n\t\t}`;\n\n\t\tdocument.body.appendChild( styleTag );\n\n\t\treturn ELEMENTS_DEFAULT_STYLE;\n\t}\n\tconst inputStyles = window.getComputedStyle( input );\n\tconst placeholderStyles = window.getComputedStyle( input, '::placeholder' );\n\n\tconst trbl = [ 'top', 'right', 'bottom', 'left' ].map(\n\t\t( dir ) =>\n\t\t\t`border-${ dir }-color: ${ inputStyles.getPropertyValue(\n\t\t\t\t`border-${ dir }-color`\n\t\t\t) };\n\t\t\tborder-${ dir }-width: ${ inputStyles.getPropertyValue(\n\t\t\t\t`border-${ dir }-width`\n\t\t\t) };\n\t\t\tborder-${ dir }-style: ${ inputStyles.getPropertyValue(\n\t\t\t\t`border-${ dir }-style`\n\t\t\t) };\n\t\t\tpadding-${ dir }: ${ inputStyles.getPropertyValue( `padding-${ dir }` ) };`\n\t);\n\n\tconst corners = [\n\t\t'top-right',\n\t\t'bottom-right',\n\t\t'bottom-left',\n\t\t'top-left',\n\t].map(\n\t\t( corner ) =>\n\t\t\t`border-${ corner }-radius: ${ inputStyles.getPropertyValue(\n\t\t\t\t`border-${ corner }-radius`\n\t\t\t) };`\n\t);\n\n\t// Generate longhand properties.\n\tstyleTag.innerHTML = `.StripeElement.simpay-field-wrap {\n\t\t\tbackground-color: ${ inputStyles.getPropertyValue( 'background-color' ) };\n\t\t\t${ trbl.join( '' ) }\n\t\t\t${ corners.join( '' ) }\n\t\t}`;\n\n\tdocument.body.appendChild( styleTag );\n\n\treturn {\n\t\tbase: {\n\t\t\tcolor: inputStyles.getPropertyValue( 'color' ),\n\t\t\tfontFamily: inputStyles.getPropertyValue( 'font-family' ),\n\t\t\tfontSize: inputStyles.getPropertyValue( 'font-size' ),\n\t\t\tfontWeight: inputStyles.getPropertyValue( 'font-weight' ),\n\t\t\tfontSmoothing: inputStyles.getPropertyValue(\n\t\t\t\t'-webkit-font-smoothing'\n\t\t\t),\n\t\t\t// This can't be fetched dynamically, unfortunately.\n\t\t\t'::placeholder': {\n\t\t\t\tcolor: '#c7c7c7',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Finds the Payment Method's owner data in the Payment Form.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function getOwnerData( spFormElem, formData ) {\n\tconst billingAddressContainer = spFormElem.find(\n\t\t'.simpay-billing-address-container'\n\t);\n\n\tconst name = spFormElem.find( '.simpay-customer-name' ).val() || null;\n\tconst email = spFormElem.find( '.simpay-email' ).val() || null;\n\tconst phone = spFormElem.find( '.simpay-telephone' ).val() || null;\n\tconst address =\n\t\t0 !== billingAddressContainer.length\n\t\t\t? {\n\t\t\t\t\tline1:\n\t\t\t\t\t\tbillingAddressContainer\n\t\t\t\t\t\t\t.find( '.simpay-address-street' )\n\t\t\t\t\t\t\t.val() || null,\n\t\t\t\t\tcity:\n\t\t\t\t\t\tbillingAddressContainer\n\t\t\t\t\t\t\t.find( '.simpay-address-city' )\n\t\t\t\t\t\t\t.val() || null,\n\t\t\t\t\tstate:\n\t\t\t\t\t\tbillingAddressContainer\n\t\t\t\t\t\t\t.find( '.simpay-address-state' )\n\t\t\t\t\t\t\t.val() || null,\n\t\t\t\t\tpostal_code:\n\t\t\t\t\t\tbillingAddressContainer\n\t\t\t\t\t\t\t.find( '.simpay-address-zip' )\n\t\t\t\t\t\t\t.val() || null,\n\t\t\t\t\tcountry:\n\t\t\t\t\t\tbillingAddressContainer\n\t\t\t\t\t\t\t.find( '.simpay-address-country' )\n\t\t\t\t\t\t\t.val() || null,\n\t\t\t }\n\t\t\t: null;\n\n\treturn {\n\t\tname,\n\t\temail,\n\t\tphone,\n\t\taddress,\n\t};\n}\n","/**\n * Internal dependencies\n */\nimport { setup } from './setup.js';\nimport { submit } from './submit.js';\nimport { getElementStyle, getOwnerData } from './utils.js';\nimport { onPaymentFormError as onError } from '@wpsimplepay/core/frontend/payment-forms';\n\nexport default {\n\tsetup,\n\tsubmit,\n\tonError,\n\tgetElementStyle,\n\tgetOwnerData,\n};\n","/**\n * Internal dependencies\n */\nimport { convertFormDataToCartData } from '@wpsimplepay/cart';\nimport { Cart } from '@wpsimplepay/pro/frontend/payment-forms/stripe-elements/cart';\nimport { getPaymentMethod } from '@wpsimplepay/pro/frontend/payment-methods';\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\nimport { onPaymentFormError, getPaymentFormType } from '@wpsimplepay/core/frontend/payment-forms';\n\n/**\n * Setup Stripe Elements payment form.\n *\n * @param {Event} e simpayBindCoreFormEventsAndTriggers Event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( e, spFormElem, formData ) {\n\tconst realFormElem = spFormElem[ 0 ];\n\n\tconst { enableForm, disableForm } = window.simpayApp;\n\tconst { debugLog } = window.spShared;\n\n\t// Don't continue if this form is using Stripe Checkout.\n\t// Checking again here due to legacy structure/setup.\n\tif ( 'stripe-checkout' === getPaymentFormType( spFormElem, formData ) ) {\n\t\treturn;\n\t}\n\n\t// Disable Payment Form during setup.\n\tdisableForm( spFormElem, formData, true );\n\n\ttry {\n\t\t// Convert legacay data in to something usable.\n\t\tconst {\n\t\t\titems,\n\t\t\tcurrency,\n\t\t\ttaxPercent,\n\t\t\tisNonDecimalCurrency,\n\t\t} = convertFormDataToCartData( formData );\n\n\t\tconst cart = new Cart( {\n\t\t\tcurrency,\n\t\t\ttaxPercent,\n\t\t\tisNonDecimalCurrency,\n\t\t} );\n\n\t\tif ( items.length > 0 ) {\n\t\t\titems.forEach( ( item ) => {\n\t\t\t\tcart.addLineItem( item );\n\t\t\t} );\n\t\t}\n\n\t\t// Attach cart.\n\t\tspFormElem.cart = cart;\n\n\t\t// Handle Payment Method change.\n\t\t// @todo Setup elsewhere.\n\t\tconst { paymentMethods: formPaymentMethods } = formData;\n\t\tspFormElem.paymentMethod = formPaymentMethods[0].id;\n\n\t\t_.each( realFormElem.querySelectorAll( '.simpay-payment-method-toggle' ), ( paymentMethodToggle ) => {\n\t\t\tpaymentMethodToggle.addEventListener( 'click', ( e ) => {\n\t\t\t\tspFormElem.paymentMethod = e.target.dataset.paymentMethod;\n\t\t\t} );\n\t\t} );\n\n\t\t// Setup the form's Payment Methods.\n\t\tformPaymentMethods.forEach( ( { id } ) => {\n\t\t\tgetPaymentMethod( id ).config = _.findWhere( formPaymentMethods, {\n\t\t\t\tid,\n\t\t\t} );\n\t\t\tgetPaymentMethod( id ).setup( spFormElem, formData );\n\t\t} );\n\n\t\t// Reenable form.\n\t\tenableForm( spFormElem, formData );\n\n\t\t// Attach submission handler.\n\t\trealFormElem.addEventListener( 'submit', ( e ) => {\n\t\t\te.preventDefault();\n\n\t\t\tif ( window.simpayGoogleRecaptcha ) {\n\t\t\t\tconst { siteKey, i18n } = simpayGoogleRecaptcha;\n\n\t\t\t\t// @todo Complete syncronously inside of separate reCAPTCHA script.\n\t\t\t\t//\n\t\t\t\t// This is a temporary measure to ensure reCAPTCHA tokens are generated\n\t\t\t\t// at the time of submission to avoid them being invalidated after 120 seconds.\n\t\t\t\tgrecaptcha.ready( () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_customer`,\n\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_customer\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_payment`,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_payment\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\t\t\t\t\t// Find and submit the Payment Form.\n\t\t\t\t\t\t\t\t\t\tgetPaymentForms()[ getPaymentFormType( spFormElem, formData ) ]\n\t\t\t\t\t\t\t\t\t\t\t.submit( spFormElem, formData );\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t\t\t\tonPaymentFormError( i18n.error, spFormElem, formData );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\tonPaymentFormError( i18n.error, spFormElem, formData );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tgetPaymentForms()[ getPaymentFormType( spFormElem, formData ) ]\n\t\t\t\t\t.submit( spFormElem, formData );\n\t\t\t}\n\t\t} );\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies\n */\nimport { getPaymentMethod } from '@wpsimplepay/pro/frontend/payment-methods';\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\n\n/**\n * Submits a Stripe Elements payment form.\n *\n * @todo DRY presubmission validation checks?\n *\n * @since 3.8.0\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function submit( spFormElem, formData ) {\n\tconst {\n\t\tdisableForm,\n\t\tenableForm,\n\t\ttriggerBrowserValidation,\n\t} = window.simpayApp;\n\n\t// Disable form while processing.\n\tdisableForm( spFormElem, formData, true );\n\n\t// HTML5 validation check.\n\tif ( ! spFormElem[ 0 ].checkValidity() ) {\n\t\ttriggerBrowserValidation( spFormElem, formData );\n\t\tenableForm( spFormElem, formData );\n\n\t\treturn;\n\t}\n\n\t// Allow further validation.\n\t//\n\t// jQuery( document.body ).on( 'simpayBeforeStripePayment', function( e, spFormElem, formData ) {\n\t// formData.isValid = false;\n\t// } );\n\tspFormElem.trigger( 'simpayBeforeStripePayment', [ spFormElem, formData ] );\n\n\tif ( ! formData.isValid ) {\n\t\tenableForm( spFormElem, formData );\n\n\t\treturn;\n\t}\n\n\ttry {\n\t\tgetPaymentMethod( spFormElem.paymentMethod )\n\t\t\t.submit( spFormElem, formData );\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies\n */\nimport { getPaymentForms as corePaymentForms } from '@wpsimplepay/core/frontend/payment-forms';\nimport { default as stripeElements } from './stripe-elements';\n\n/**\n * Returns available Payment Forms.\n *\n * @since 3.8.0\n *\n * @return {Object} List of available Payment Forms.\n */\nexport const getPaymentForms = () => ( {\n\t...corePaymentForms(),\n\t'stripe-elements': stripeElements,\n} );\n","/**\n * Internal dependencies.\n */\n\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\nimport { handle as handleSource } from '@wpsimplepay/pro/frontend/payments/source.js';\n\n/**\n * Submit `card` Payment Method.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport async function submit( spFormElem, formData ) {\n\tconst {\n\t\tstripeInstance: stripe,\n\t\tstripeInstance: { elements },\n\t} = spFormElem;\n\n\t// General Elements helpers.\n\tconst { 'stripe-elements': stripeElements } = getPaymentForms();\n\tconst { getOwnerData, onError } = stripeElements;\n\n\t// Create a Source.\n\tconst { currency } = formData;\n\tconst owner = getOwnerData( spFormElem, formData );\n\n\tconst { error, source } = await stripe.createSource( elements.card, {\n\t\ttype: 'card',\n\t\tcurrency,\n\t\towner,\n\t} );\n\n\ttry {\n\t\t// Bail if Source cannot be created.\n\t\tif ( error ) {\n\t\t\tthrow error;\n\t\t}\n\n\t\t// Create records with Source.\n\t\thandleSource( source, spFormElem, formData );\n\t} catch ( error ) {\n\t\tonError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies.\n */\nimport { setup } from './setup.js';\nimport { submit } from './submit.js';\n\nexport default {\n\tsetup,\n\tsubmit,\n};\n","/**\n * Internal dependencies\n */\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\n\n/**\n * Sets up a Stripe Elements Card field and binds events.\n *\n * @link https://stripe.com/docs/stripe-js/reference#elements-create\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( spFormElem, formData ) {\n\tconst cardEl = spFormElem[ 0 ].querySelector( '.simpay-card-wrap' );\n\n\tif ( ! cardEl ) {\n\t\treturn;\n\t}\n\n\tconst { enableForm } = window.simpayApp;\n\n\t// General Elements helpers from the Payment Form.\n\tconst { 'stripe-elements': stripeElements } = getPaymentForms();\n\tconst { getElementStyle } = stripeElements;\n\n\t// Access Elements instance.\n\tconst { stripeInstance: { elements } } = spFormElem;\n\n\t// If a billing address field exists (overrides Card field setting).\n\tconst hidePostalCode =\n\t\t!! spFormElem[ 0 ].querySelector( '.simpay-address-zip' ) ||\n\t\t'no' === cardEl.dataset.showPostalCode;\n\n\t// Create Element Card instance.\n\telements.card = elements().create( 'card', {\n\t\tstyle: getElementStyle( spFormElem, cardEl ),\n\t\thidePostalCode,\n\t} );\n\n\t// Mount and setup Element card instance.\n\telements.card.mount( cardEl );\n\n\t// Live feedback when card updates.\n\telements.card.on( 'change', ( { error } ) => {\n\t\tif ( error ) {\n\t\t\tonPaymentFormError( error, spFormElem, formData );\n\t\t} else {\n\t\t\tonPaymentFormError( {}, spFormElem, formData );\n\t\t}\n\t} );\n}\n","/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { apiRequest } from '@wpsimplepay/utils';\n\n/**\n * Create a Charge object based on current formData.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function create( data = {}, spFormElem, formData ) {\n\treturn apiRequest( 'v2/charge', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n","/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * WordPress dependencies.\n */\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies.\n */\nimport { plaidHandler } from './setup.js';\n\nimport { apiRequest } from '@wpsimplepay/utils';\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\nimport { create as createCustomer } from '@wpsimplepay/core/frontend/payments/customer.js';\nimport { create as createCharge } from '@wpsimplepay/pro/frontend/payments/charge.js';\nimport {\n\tcreate as createSubscription,\n\thandleServerResponse as handleSubscriptionServerResponse,\n} from '@wpsimplepay/pro/frontend/payments/subscription.js';\n\nconst { enableForm } = window.simpayApp;\n\n/**\n * Submit `ach-debit` Payment Method.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport async function submit( spFormElem, formData ) {\n\ttry {\n\t\tconst achDebitEl = spFormElem[ 0 ].querySelector( '.simpay-ach-debit-wrap' );\n\t\tconst { publicToken, accountId } = achDebitEl.dataset;\n\n\t\t// Do nothing if a Public Token has not been created.\n\t\tif ( ! publicToken ) {\n\t\t\tenableForm( spFormElem, formData );\n\t\t\treturn plaidHandler.open();\n\t\t}\n\n\t\tconst { stripe_bank_account_token: source } = await apiRequest( 'v2/plaid-token', {\n\t\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\t\tform_data: formData,\n\t\t\tform_id: formData.formId,\n\t\t\tpublic_token: publicToken,\n\t\t\taccount_id: accountId,\n\t\t} );\n\n\t\t// Create a Customer (and attach Source).\n\t\tconst customer = await createCustomer(\n\t\t\t{\n\t\t\t\tsource_id: source,\n\t\t\t},\n\t\t\tspFormElem,\n\t\t\tformData\n\t\t);\n\n\t\t// Define a Return URL.\n\t\tconst successUrl = addQueryArgs( formData.stripeParams.success_url, {\n\t\t\tcustomer_id: customer.id,\n\t\t} );\n\n\t\t// Handle Subscriptions.\n\t\tif ( formData.isSubscription || formData.isRecurring ) {\n\t\t\tconst subscription = await createSubscription(\n\t\t\t\t{\n\t\t\t\t\tcustomer_id: customer.id,\n\t\t\t\t},\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\t// Handle next actions on Subscription's PaymentIntent.\n\t\t\tconst paymentIntentRequiresAction = await handleSubscriptionServerResponse(\n\t\t\t\tsubscription,\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\t// Nothing else is needed, redirect.\n\t\t\tif ( false === paymentIntentRequiresAction ) {\n\t\t\t\treturn ( window.location.href = successUrl );\n\t\t\t}\n\n\t\t// Handle one-time payments.\n\t\t} else {\n\t\t\tconst charge = await createCharge(\n\t\t\t\t{\n\t\t\t\t\tcustomer_id: customer.id,\n\t\t\t\t},\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\treturn ( window.location.href = successUrl );\n\t\t}\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies.\n */\nimport { setup } from './setup.js';\nimport { submit } from './submit.js';\n\nexport default {\n\tsetup,\n\tsubmit,\n};\n","/**\n * WordPress dependencies.\n */\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies.\n */\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\nimport { getPaymentMethod } from '@wpsimplepay/pro/frontend/payment-methods';\nimport { create as createCustomer } from '@wpsimplepay/core/frontend/payments/customer.js';\nimport {\n\tcreate as createPaymentIntent,\n\thandleServerResponse as handlePaymentIntentServerResponse,\n} from '@wpsimplepay/pro/frontend/payments/paymentintent.js';\nimport {\n\tcreate as createSubscription,\n\thandleServerResponse as handleSubscriptionServerResponse,\n} from '@wpsimplepay/pro/frontend/payments/subscription.js';\n\n/**\n * Handle iDEAL Payment Method.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport async function submit( spFormElem, formData ) {\n\t// General Elements helpers.\n\tconst { 'stripe-elements': stripeElements } = getPaymentForms();\n\tconst { getOwnerData, onError } = stripeElements;\n\n\ttry {\n\t\tconst iDEAL = getPaymentMethod( 'ideal' );\n\n\t\t// Access Stripe and Elements instance.\n\t\tconst { stripeInstance: stripe, stripeInstance: { elements } } = spFormElem;\n\n\t\t// Bail if no Bank has been chosen.\n\t\tif ( false === elements.ideal._complete ) {\n\t\t\tconst { config: { i18n } } = iDEAL;\n\n\t\t\tthrow {\n\t\t\t\tmessage: i18n.empty,\n\t\t\t};\n\t\t}\n\n\t\t// Create a Customer.\n\t\tconst customer = await createCustomer( {}, spFormElem, formData );\n\n\t\tconst successUrl = addQueryArgs( formData.stripeParams.success_url, {\n\t\t\tcustomer_id: customer.id,\n\t\t} );\n\n\t\t// Create a PaymentIntent.\n\t\tconst paymentIntent = await createPaymentIntent(\n\t\t\t{\n\t\t\t\tcustomer_id: customer.id,\n\t\t\t\tpayment_method_type: 'ideal',\n\t\t\t},\n\t\t\tspFormElem,\n\t\t\tformData\n\t\t);\n\n\t\t// Handle next actions on PaymentIntent.\n\t\tconst paymentIntentRequiresAction = await handlePaymentIntentServerResponse(\n\t\t\t{\n\t\t\t\tcustomer_id: customer.id,\n\t\t\t\tpayment_intent: paymentIntent,\n\t\t\t},\n\t\t\tspFormElem,\n\t\t\tformData\n\t\t);\n\n\t\t// Nothing else is needed, create the iDEAL Source.\n\t\tif ( false === paymentIntentRequiresAction ) {\n\t\t\tstripe\n\t\t\t\t.confirmIdealPayment( paymentIntent.payment_intent_client_secret, {\n\t\t\t\t\tpayment_method: {\n\t\t\t\t\t\tideal: elements.ideal,\n\t\t\t\t\t\tbilling_details: getOwnerData( spFormElem, formData ),\n\t\t\t\t\t},\n\t\t\t\t\treturn_url: successUrl,\n\t\t\t\t} )\n\t\t\t\t.then( ( { error } ) => {\n\t\t\t\t\tif ( error ) {\n\t\t\t\t\t\tonError( error, spFormElem, formData );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t}\n\t} catch ( error ) {\n\t\tonError( error, spFormElem, formData );\n\t}\n}\n","/**\n * Internal dependencies.\n */\nimport { setup } from './setup.js';\nimport { submit } from './submit.js';\n\nexport default {\n\tsetup,\n\tsubmit,\n};\n","/**\n * Internal dependencies\n */\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\n\n/**\n * Sets up a Stripe Elements iDEAL field and binds events.\n *\n * @link https://stripe.com/docs/stripe-js/reference#elements-create\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( spFormElem, formData ) {\n\tconst idealEl = spFormElem[ 0 ].querySelector( '.simpay-ideal-wrap' );\n\n\tif ( ! idealEl ) {\n\t\treturn;\n\t}\n\n\t// General Elements helpers.\n\tconst { 'stripe-elements': stripeElements } = getPaymentForms();\n\tconst { getElementStyle } = stripeElements;\n\n\t// Access Stripe and Elements instance.\n\tconst { stripeInstance: { elements } } = spFormElem;\n\n\t// Create Element iDEAL instance.\n\telements.ideal = elements().create( 'idealBank', {\n\t\tstyle: {\n\t\t\t...getElementStyle( spFormElem, idealEl ),\n\t\t\tbase: {\n\t\t\t\t// Add extra padding for dropdown.\n\t\t\t\tpadding: '10px',\n\t\t\t\t...getElementStyle( spFormElem, idealEl ).base,\n\t\t\t},\n\t\t},\n\t} );\n\n\t// Mount and setup Element iDEAL instance.\n\telements.ideal.mount( idealEl );\n}\n","/**\n * Internal dependencies\n */\nimport { default as card } from './card';\nimport { default as achDebit } from './ach-debit';\nimport { default as ideal } from './ideal';\n\n/**\n * Returns available Payment Methods.\n *\n * @since 3.8.0\n *\n * @return {Object} List of available Payment Methods.\n */\nexport const getPaymentMethods = () => ( {\n\tcard,\n\t'ach-debit': achDebit,\n\tideal,\n} );\n\n/**\n * Returns a Payment Method.\n *\n * @since 3.8.0\n *\n * @param {string} paymentMethod Payment Method ID.\n * @return {false|Object} Payment Method object if available, otherwise false.\n */\nexport const getPaymentMethod = ( paymentMethod ) => {\n\tconst paymentMethods = getPaymentMethods();\n\n\tif ( false === paymentMethods.hasOwnProperty( paymentMethod ) ) {\n\t\treturn false;\n\t}\n\n\treturn paymentMethods[ paymentMethod ];\n};\n","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","var _typeof = require(\"@babel/runtime/helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { apiRequest } from '@wpsimplepay/utils';\n\n/**\n * Create a Customer object based on current formData.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function create( data = {}, spFormElem, formData ) {\n\treturn apiRequest( 'v2/customer', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n","/* global wpApiSettings */\n\n/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { apiRequest } from '@wpsimplepay/utils';\n\n/**\n * Create a Subscription object based on current formData.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function create( data = {}, spFormElem, formData ) {\n\treturn apiRequest( 'v2/subscription', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n\n/**\n * Update a Subscription's payment method.\n *\n * Requires a Subscription's key and linked Customer for verification.\n * Takes direct arguments vs. spFormElem and full form data.\n *\n * @param {Number} customerId ID of the Customer.\n * @param {string} subscriptionId ID of the Subscription.\n * @param {Number} formId ID of the Payment Form.\n * @param {Object} form_values {\n *\n * @type {string} nonce Form nonce.\n * @type {string} subscription_key Subscription secret key.\n * @type {string} source_id ID of the Source.\n * @type {string} customer_id ID of the Customer.\n * }\n * @return {Promise} AJAX promise.\n */\nexport function updatePaymentMethod( customerId, subscriptionId, formId, args ) {\n\treturn apiRequest( `v2/subscription/payment_method/${ subscriptionId }/${ customerId }`, {\n\t\tform_values: args,\n\t\tform_id: formId,\n\t} );\n}\n\n/**\n * Handle server response/next actions for a PaymentIntent.\n *\n * Use the Subscription's invoice to determine if action needs ot be taken.\n *\n * @param {Object} subscription \\Stripe\\Subscription.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function handleServerResponse( subscription, spFormElem, formData ) {\n\tconst {\n\t\tstatus,\n\t\tlatest_invoice: {\n\t\t\tpayment_intent: paymentIntent,\n\t\t},\n\t\tpending_setup_intent: setupIntent,\n\t} = subscription;\n\n\tconst {\n\t\tstripeParams: {\n\t\t\tsuccess_url: successUrl,\n\t\t\terror_url: errorUrl,\n\t\t},\n\t} = formData;\n\n\tif ( ! ( paymentIntent || setupIntent ) ) {\n\t\treturn false;\n\t}\n\n\t// Initial charge is required.\n\tif ( paymentIntent ) {\n\t\tconst {\n\t\t\tstatus: paymentIntentStatus,\n\t\t\tclient_secret: paymentIntentClientSecret,\n\t\t\tlast_payment_error: paymentIntentError,\n\t\t} = paymentIntent;\n\n\t\t// Subscription is active, and intent needs no further action.\n\t\t// Subscription is trialing, and intent needs no further action.\n\t\tif (\n\t\t\t( 'active' === status && 'succeeded' === paymentIntentStatus ) ||\n\t\t\t( 'trialing' === status && 'succeeded' === paymentIntentStatus )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Could not complete with current payment method, allow client to try again.\n\t\tif ( 'incomplete' === status && 'requires_payment_method' === paymentIntentStatus ) {\n\t\t\tif ( paymentIntentError.message ) {\n\t\t\t\tthrow {\n\t\t\t\t\tmessage: paymentIntentError.message,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Handle 3D Secure.\n\t\tif ( 'incomplete' === status && 'requires_action' === paymentIntentStatus ) {\n\t\t\treturn spFormElem.stripeInstance.handleCardPayment(\n\t\t\t\tpaymentIntentClientSecret\n\t\t\t)\n\t\t\t\t.then( ( result ) => {\n\t\t\t\t\tif ( result.error ) {\n\t\t\t\t\t\tthrow result.error;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\t\t\t\t} );\n\t\t}\n\t}\n\n\t// No initial charge needed, setup for future.\n\tif ( setupIntent ) {\n\t\tconst {\n\t\t\tstatus: setupIntentStatus,\n\t\t\tclient_secret: setupIntentClientSecret,\n\t\t} = setupIntent;\n\n\t\t// Handle 3D Secure.\n\t\tif ( 'requires_action' === setupIntentStatus ) {\n\t\t\treturn spFormElem.stripeInstance.handleCardSetup(\n\t\t\t\tsetupIntentClientSecret\n\t\t\t)\n\t\t\t\t.then( ( result ) => {\n\t\t\t\t\tif ( result.error ) {\n\t\t\t\t\t\tthrow result.error;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\t\t\t\t} );\n\t\t// Could not complete with current payment method, allow client to try again.\n\t\t} else if ( 'requires_payment_method' === setupIntentStatus ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Unhandled status. Direct to error page.\n\treturn window.location.href = errorUrl;\n}\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","/* global wpApiSettings */\n\n/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies.\n */\nimport { apiRequest } from '@wpsimplepay/utils';\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\n\n/**\n * Create a Stripe\\PaymentIntent object based on current formData.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function create( data, spFormElem, formData ) {\n\treturn apiRequest( 'v2/paymentintent/create', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n\n/**\n * Verify a PaymentIntent after any required actions.\n *\n * @param {Object} data Data to pass to REST endpoint.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @return {Promise} AJAX promise.\n */\nexport function confirm( data = {}, spFormElem, formData ) {\n\treturn apiRequest( 'v2/paymentintent/confirm', {\n\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\tform_data: formData,\n\t\tform_id: formData.formId,\n\t\t...data,\n\t} );\n}\n\n/**\n * Handle server response/next actions for a PaymentIntent.\n *\n * @param {Object} response Server response object.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function handleServerResponse( data, spFormElem, formData ) {\n\tconst {\n\t\tpayment_intent: paymentIntent,\n\t\tcustomer_id,\n\t} = data;\n\n\tif ( ! paymentIntent.requires_action ) {\n\t\treturn false;\n\t}\n\n\t// Handle a PaymentIntent that requires action.\n\treturn spFormElem.stripeInstance\n\t\t.handleCardAction( paymentIntent.payment_intent_client_secret )\n\t\t.then( async ( result ) => {\n\t\t\ttry {\n\t\t\t\tconst { error, paymentIntent: paymentIntentAction } = result;\n\n\t\t\t\tif ( error ) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\tconst paymentIntentConfirmation = await confirm(\n\t\t\t\t\t{\n\t\t\t\t\t\tpayment_intent_id: paymentIntentAction.id,\n\t\t\t\t\t\tcustomer_id,\n\t\t\t\t\t},\n\t\t\t\t\tspFormElem,\n\t\t\t\t\tformData\n\t\t\t\t);\n\n\t\t\t\treturn handleServerResponse(\n\t\t\t\t\t{\n\t\t\t\t\t\tpayment_intent: paymentIntentConfirmation,\n\t\t\t\t\t\tcustomer_id,\n\t\t\t\t\t},\n\t\t\t\t\tspFormElem,\n\t\t\t\t\tformData\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tonPaymentFormError( error, spFormElem, formData );\n\t\t\t}\n\t\t} );\n}\n","/**\n * Update all labels.\n *\n * @param {Event} e Change event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function update( e, spFormElem, formData ) {\n\ttotalAmount( spFormElem, formData );\n\trecurringAmount( spFormElem, formData );\n\ttaxAmount( spFormElem, formData );\n}\n\n/**\n * Update \"Total Amount\" label, and Submit Button label.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nfunction totalAmount( spFormElem, formData ) {\n\tconst {\n\t\tconvertToDollars,\n\t\tformatCurrency,\n\t} = window.spShared;\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\tconst total = convertToDollars( cart.getTotal() );\n\tconst formatted = formatCurrency( total, true );\n\n\t// @todo Remove and run elsewhere.\n\twindow.simpayApp.setCoreFinalAmount( spFormElem, formData );\n\n\tspFormElem.find( '.simpay-total-amount-value' ).text( formatted );\n}\n\n/**\n * Update \"Recurring Amount\" label.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nfunction recurringAmount( spFormElem, formData ) {\n\tconst {\n\t\tconvertToDollars,\n\t\tformatCurrency,\n\t} = window.spShared;\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\ttry {\n\t\tconst item = cart.getLineItem( 'base' );\n\n\t\tconst {\n\t\t\tsubscription: {\n\t\t\t\tinterval,\n\t\t\t\tintervalCount,\n\t\t\t},\n\t\t} = item;\n\n\t\tconst recurringAmountFinal = convertToDollars( item.getTotal() );\n\n\t\tlet recurringAmountFormatted = formatCurrency( recurringAmountFinal, true );\n\n\t\tif ( intervalCount > 1 ) {\n\t\t\trecurringAmountFormatted += ' every ' + intervalCount + ' ' + interval + 's';\n\t\t} else {\n\t\t\trecurringAmountFormatted += '/' + interval;\n\t\t}\n\n\t\tspFormElem.find( '.simpay-total-amount-recurring-value' ).text( recurringAmountFormatted );\n\t} catch ( error ) {\n\t\t// Fallback to cart total.\n\t\tconst cartTotal = formatCurrency( convertToDollars( cart.getTotal() ), true );\n\n\t\treturn spFormElem.find( '.simpay-total-amount-recurring-value' ).text( cartTotal );\n\t}\n}\n\n/**\n * Update \"Tax Amount\" label.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nfunction taxAmount( spFormElem, formData ) {\n\tconst {\n\t\tconvertToDollars,\n\t\tformatCurrency,\n\t} = window.spShared;\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\tconst taxAmount = convertToDollars( cart.getTax() );\n\tconst formatted = formatCurrency( taxAmount, true );\n\n\tspFormElem.find( '.simpay-tax-amount-value' ).text( formatted );\n}\n","/**\n * Internal dependencies.\n */\nimport { update as updateTotalAmountLabels } from './total-amount-labels.js';\n\nlet _isDirty = false;\n\n/**\n * @param {Event} e Focusout event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n * @param {Bool} triggerTotalsChanged Determines if totalsChanged event should fire.\n */\nexport function update( e, spFormElem, formData, triggerTotalsChanged = true, isDirty = false ) {\n\tif ( true === isDirty ) {\n\t\t_isDirty = true;\n\t}\n\n\tconst customAmountInput = spFormElem.find( '.simpay-custom-amount-input' );\n\tconst errorEl = spFormElem.find( '.simpay-errors' );\n\n\t// Exit if no custom amount field.\n\tif ( 0 === customAmountInput.length ) {\n\t\treturn true;\n\t}\n\n\tconst {\n\t\tconvertToCents,\n\t\tformatCurrency,\n\t\tunformatCurrency,\n\t} = window.spShared;\n\n\t// Update internal traacking.\n\tconst unformattedAmount = customAmountInput.val();\n\n\tif ( formData.isSubscription ) {\n\t\tformData.customAmount = unformatCurrency( '' !== unformattedAmount ? unformattedAmount : formData.subMinAmount );\n\t\tformData.planAmount = formData.customAmount;\n\t\tformData.customPlanAmount = formData.planAmount;\n\t} else {\n\t\tformData.customAmount = unformatCurrency( '' !== unformattedAmount ? unformattedAmount : formData.minAmount );\n\t}\n\n\tlet minAmount;\n\tlet isValid;\n\n\t// Compare amount in cents.\n\tconst customAmountVal = unformatCurrency( customAmountInput.val() );\n\n\t// Subscriptions minimum amount requirement is separate from one-time minimum amount requirement.\n\tif ( formData.isSubscription ) {\n\t\tminAmount = unformatCurrency( formData.subMinAmount );\n\t} else {\n\t\tminAmount = unformatCurrency( formData.minAmount );\n\t}\n\n\t// Make sure custom amount meets minimum value.\n\t// Give does: ( ( -1 < amount ) && ( amount >= min_amount ) )\n\tisValid = ( ( -1 < customAmountVal ) && ( customAmountVal >= minAmount ) );\n\n\tif ( false === _isDirty ) {\n\t\tisValid = true;\n\t}\n\n\tif ( isValid ) {\n\t\terrorEl.empty();\n\t\tcustomAmountInput.removeClass( 'simpay-input-error' );\n\t} else {\n\t\t// Set error message.\n\t\tif ( formData.isSubscription ) {\n\t\t\terrorEl.html( formData.subMinCustomAmountError );\n\t\t} else {\n\t\t\terrorEl.html( formData.minCustomAmountError );\n\t\t}\n\n\t\t// Change amount input border color w/ CSS class.\n\t\tcustomAmountInput.addClass( 'simpay-input-error' );\n\t}\n\n\ttry {\n\t\tconst item = spFormElem.cart.getLineItem( 'base' );\n\n\t\titem.update( {\n\t\t\tamount: convertToCents( customAmountVal ),\n\t\t} );\n\n\t\t// Backwards compatibility.\n\t\tcustomAmountInput.val( formatCurrency( customAmountVal, false ) );\n\n\t\t// Call this directly in case the trigger is not run.\n\t\tupdateTotalAmountLabels( e, spFormElem, formData );\n\n\t\tif ( true === triggerTotalsChanged ) {\n\t\t\t// Alert the rest of the components they need to update.\n\t\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData ] );\n\t\t}\n\n\t\treturn isValid;\n\t} catch {\n\t\t// Error is logged, UI does not need updating.\n\t\treturn false;\n\t}\n}\n\n/**\n * Mark the form as using a custom amount.\n *\n * @param {Event} e Focus event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function enableCustomPlanAmount( e, spFormElem, formData ) {\n\tconst customOption = spFormElem.find( '.simpay-custom-plan-option[value=\"simpay_custom_plan\"]' );\n\n\tconst {\n\t\tconvertToCents,\n\t} = window.spShared;\n\n\tcustomOption\n\t\t.prop( 'checked', true )\n\t\t.trigger( 'change' );\n\n\tformData.useCustomPlan = true;\n\tformData.customPlanAmount = convertToCents( customOption.val() );\n\n\tspFormElem.find( '.simpay-has-custom-plan' ).val( 'true' );\n}\n","/* global _, $ */\n\n/**\n * Internal dependencies.\n */\nimport { update as updateCustomAmount } from '@wpsimplepay/pro/frontend/components/custom-amount.js';\nimport { handle as handleSource } from '@wpsimplepay/pro/frontend/payments/source.js';\n\n/**\n * Setup and enable Payment Request Button if needed.\n *\n * @param {Object} spFormElem Form element.\n * @param {Object} formData Payment form data.\n */\nexport function setup( e, spFormElem, formData ) {\n\tconst {\n\t\tformId,\n\t\tformInstance,\n\t\tformDisplayType,\n\t\tstripeParams: {\n\t\t\tcountry,\n\t\t\tcurrency,\n\t\t},\n\t\thasPaymentRequestButton,\n\t} = formData;\n\n\tif ( ! hasPaymentRequestButton ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\tid,\n\t\ti18n,\n\t\trequestPayerName,\n\t\trequestPayerEmail,\n\t\trequestShipping,\n\t\tshippingOptions,\n\t\ttype,\n\t\ttheme,\n\t} = hasPaymentRequestButton;\n\n\tconst {\n\t\ttriggerBrowserValidation,\n\t\tdisableForm,\n\t} = window.simpayApp;\n\n\tconst {\n\t\tpaymentRequestButtons,\n\t} = window.simpayAppPro;\n\n\tconst {\n\t\tconvertToCents,\n\t} = window.spShared;\n\n\tconst {\n\t\tstripeInstance: stripe,\n\t\tcart,\n\t} = spFormElem;\n\n\tconst stripeElements = stripe.elements();\n\n\tconst key = `${ formInstance }-${ formId }`;\n\n\t// Generate initial state of button. Eventually used to generate a request.\n\tpaymentRequestButtons[ key ] = stripe.paymentRequest( {\n\t\tcountry,\n\t\tcurrency: currency.toLowerCase(),\n\t\ttotal: {\n\t\t\tlabel: i18n.totalLabel,\n\t\t\tamount: cart.getTotal(),\n\t\t},\n\t\tdisplayItems: getDisplayItems( spFormElem, formData ),\n\t\trequestPayerName,\n\t\trequestPayerEmail,\n\t\trequestShipping,\n\t} );\n\n\t// Create the button element to render.\n\tconst prButton = stripeElements.create( 'paymentRequestButton', {\n\t\tpaymentRequest: paymentRequestButtons[ key ],\n\t\tstyle: {\n\t\t\tpaymentRequestButton: {\n\t\t\t\ttype,\n\t\t\t\ttheme,\n\t\t\t},\n\t\t},\n\t} );\n\n\t// Check the availability of the Payment Request API.\n\t// @todo Remove anonymous function usage.\n\tpaymentRequestButtons[ key ]\n\t\t.canMakePayment()\n\t\t.then( ( result ) => {\n\t\t\t// Hide container if no payment can be made.\n\t\t\tif ( null === result ) {\n\t\t\t\tconst containers = document.querySelectorAll( `form[data-simpay-form-id=\"${ formId }\"] #${ id }` );\n\n\t\t\t\tif ( containers.length > 0 ) {\n\t\t\t\t\t_.each( containers, ( container ) => ( container.style.display = 'none' ) );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet toMount;\n\n\t\t\t/**\n\t\t\t * Due to lack of formInstance context during Overlay toggles we can reference\n\t\t\t * the last instance of the NodeList for PRB containers (based on formId) instead.\n\t\t\t *\n\t\t\t * This ensures the PRB that appears in the overlays (which is always the last\n\t\t\t * in the NodeList) is always the one being mounted (or remounted).\n\t\t\t *\n\t\t\t * @link https://github.com/wpsimplepay/wp-simple-pay-pro/issues/1002\n\t\t\t * @link https://github.com/wpsimplepay/wp-simple-pay-pro/issues/610\n\t\t\t * @link https://github.com/wpsimplepay/wp-simple-pay-pro/issues/645\n\t\t\t *\n\t\t\t * @see {overlays.js:setup}\n\t\t\t */\n\t\t\tif ( 'overlay' === formDisplayType ) {\n\t\t\t\tconst buttons = document.querySelectorAll( `form[data-simpay-form-id=\"${ formData.formId }\"] #${ formData.hasPaymentRequestButton.id } .simpay-payment-request-button-container__button` );\n\n\t\t\t\ttoMount = buttons[ buttons.length - 1 ];\n\t\t\t} else {\n\t\t\t\ttoMount = document.querySelector( `form[data-simpay-form-instance=\"${ formData.formInstance }\"] #${ formData.hasPaymentRequestButton.id } .simpay-payment-request-button-container__button` );\n\t\t\t}\n\n\t\t\tif ( toMount ) {\n\t\t\t\ttoMount.innerHTML = '';\n\t\t\t\tprButton.mount( toMount );\n\t\t\t}\n\n\t\t\t// Ensure form is valid before continuing.\n\t\t\tprButton.on( 'click', function( e ) {\n\t\t\t\tif ( ! paymentRequestIsValid( spFormElem, formData ) ) {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t// Show browser validation.\n\t\t\t\t\ttriggerBrowserValidation( spFormElem, formData );\n\t\t\t\t}\n\n\t\t\t\t// Update custom amount and recalculate, but do not attempt to update PRB.\n\t\t\t\tconst isCustomAmountValid = updateCustomAmount( null, spFormElem, formData, false );\n\n\t\t\t\tif ( ! isCustomAmountValid ) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}\n\n\t\t\t\t// Update items for a final time.\n\t\t\t\tupdate( spFormElem, formData );\n\t\t\t} );\n\t\t} );\n\n\t/**\n\t * Update shipping options for request.\n\t * There are no defined shipping methods, so this is merely to satisfy the API requirements.\n\t *\n\t * @todo Remove anonymous function usage.\n\t * @todo Populate hidden fields so the values are sent through?\n\t *\n\t * @param {Object} e Payment Request Button event.\n\t */\n\tpaymentRequestButtons[ key ].on( 'shippingaddresschange', function( e ) {\n\t\te.updateWith( {\n\t\t\tstatus: 'success',\n\t\t\tshippingOptions: shippingOptions,\n\t\t} );\n\t} );\n\n\t/**\n\t * Handle token once created.\n\t *\n\t * @param {Object} e Payment Request Button event.\n\t */\n\tpaymentRequestButtons[ key ].on( 'source', function( e ) {\n\t\tconst {\n\t\t\tpayerEmail,\n\t\t\tpayerName,\n\t\t\tcomplete,\n\t\t\tsource,\n\t\t} = e;\n\n\t\tdisableForm( spFormElem, formData, true );\n\n\t\tcomplete( 'success' );\n\n\t\tif ( payerEmail && '' !== payerEmail ) {\n\t\t\t$( '<input>' ).attr( {\n\t\t\t\ttype: 'hidden',\n\t\t\t\tname: 'simpay_email',\n\t\t\t\tvalue: payerEmail,\n\t\t\t} ).appendTo( spFormElem );\n\t\t}\n\n\t\tif ( payerName && '' !== payerName ) {\n\t\t\t$( '<input>' ).attr( {\n\t\t\t\ttype: 'hidden',\n\t\t\t\tname: 'simpay_customer_name',\n\t\t\t\tvalue: payerName,\n\t\t\t} ).appendTo( spFormElem );\n\t\t}\n\n\t\tif ( window.simpayGoogleRecaptcha ) {\n\t\t\tconst { siteKey } = simpayGoogleRecaptcha;\n\n\t\t\t// @todo Complete syncronously inside of separate reCAPTCHA script.\n\t\t\t//\n\t\t\t// This is a temporary measure to ensure reCAPTCHA tokens are generated\n\t\t\t// at the time of submission to avoid them being invalidated after 120 seconds.\n\t\t\tgrecaptcha.ready( () => {\n\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_customer`,\n\t\t\t\t} )\n\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_customer\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\tgrecaptcha.execute( siteKey, {\n\t\t\t\t\t\t\taction: `simple_pay_form_${ formData.formId }_payment`,\n\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.then( ( token ) => {\n\t\t\t\t\t\t\t\tspFormElem.append( '<input type=\"hidden\" name=\"grecaptcha_payment\" value=\"' + token + '\" />' );\n\n\t\t\t\t\t\t\t\treturn handleSource( source, spFormElem, formData );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t} );\n\t\t} else {\n\t\t\treturn handleSource( source, spFormElem, formData );\n\t\t}\n\t} );\n}\n\n/**\n * Update Payment Request Button when data changes.\n *\n * @todo Separate out total and item generators.\n *\n * @param {Object} spFormElem Form element.\n * @param {Object} formData Payment form data.\n */\nexport function update( spFormElem, formData ) {\n\tconst {\n\t\tformId,\n\t\tformInstance,\n\t\thasPaymentRequestButton,\n\t} = formData;\n\n\tif ( ! hasPaymentRequestButton ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\ti18n,\n\t} = hasPaymentRequestButton;\n\n\tconst {\n\t\tpaymentRequestButtons,\n\t} = window.simpayAppPro;\n\n\tconst {\n\t\tconvertToCents,\n\t} = window.spShared;\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\tconst key = `${ formInstance }-${ formId }`;\n\n\t// Enable if not previously setup.\n\tif ( ! paymentRequestButtons.hasOwnProperty( key ) ) {\n\t\tsetup( null, spFormElem, formData );\n\t}\n\n\tpaymentRequestButtons[ key ].update( {\n\t\ttotal: {\n\t\t\tlabel: i18n.totalLabel,\n\t\t\tamount: cart.getTotal(),\n\t\t},\n\t\tdisplayItems: getDisplayItems( spFormElem, formData ),\n\t} );\n}\n\n/**\n * Custom check to see if relevant custom fields are valid before allowing Payment Button Request.\n *\n * @param {Object} spFormElem Form element.\n * @param {Object} formData Payment form data.\n */\nexport function paymentRequestIsValid( spFormElem, formData ) {\n\t/**\n\t * Determine if a form control is a \"classic\" field, meaning it is needed\n\t * to submit a standard payment form instead of using the Payment Request API.\n\t *\n\t * @param {HTMLElement} control Form control.\n\t * @return {bool} If the field is classic.\n\t */\n\tfunction isClassicField( control ) {\n\t\tconst classicFields = [\n\t\t\t'simpay-customer-name-container',\n\t\t\t'simpay-email-container',\n\t\t\t'simpay-card-container',\n\t\t\t'simpay-address-container',\n\t\t\t'simpay-address-street-container',\n\t\t\t'simpay-address-city-container',\n\t\t\t'simpay-address-state-container',\n\t\t\t'simpay-address-zip-container',\n\t\t\t'simpay-address-country-container',\n\t\t\t'simpay-telephone-container',\n\t\t];\n\n\t\tconst classList = control.classList;\n\t\tlet is = false;\n\n\t\tclassList.forEach( function( className ) {\n\t\t\tif ( -1 !== classicFields.indexOf( className ) ) {\n\t\t\t\tis = true;\n\t\t\t}\n\t\t} );\n\n\t\treturn is;\n\t}\n\n\tlet requiredFieldsValid = true;\n\n\t_.each( spFormElem[0].querySelectorAll( '.simpay-form-control' ), function( control ) {\n\t\tconst classicField = isClassicField( control );\n\n\t\tif ( classicField ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst inputs = control.querySelectorAll( 'input' );\n\n\t\t_.each( inputs, function( input ) {\n\t\t\tif ( ! input.required ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! input.validity.valid ) {\n\t\t\t\trequiredFieldsValid = false;\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn requiredFieldsValid;\n}\n\n/**\n * Generate Payment Request API displayItems from form data.\n *\n * @param {Object} spFormElem Form element.\n * @param {Object} formData Form data.\n * @return {Array}\n */\nexport function getDisplayItems( spFormElem, formData ) {\n\tconst displayItems = [];\n\n\tconst {\n\t\tconvertToCents,\n\t} = window.spShared;\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\tconst {\n\t\thasPaymentRequestButton: {\n\t\t\ti18n,\n\t\t}\n\t} = formData;\n\n\t// Add subscription plan to list.\n\ttry {\n\t\tconst plan = cart.getLineItem( 'base' );\n\n\t\tdisplayItems.push( {\n\t\t\tlabel: plan.title ? plan.title : i18n.planLabel,\n\t\t\tamount: plan.getSubtotal(),\n\t\t} );\n\t} catch ( error ) {\n\t\t// Item couldn't be found, do not add it.\n\t}\n\n\t// Combine setup fees to a single line.\n\tlet setupFeeAmount = 0;\n\n\ttry {\n\t\tconst planSetupFee = cart.getLineItem( 'plan-setup-fee' );\n\t\tsetupFeeAmount += planSetupFee.getSubtotal();\n\t} catch ( error ) {\n\t\t// Item couldn't be found, do not add it.\n\t}\n\n\ttry {\n\t\tconst setupFee = cart.getLineItem( 'setup-fee' );\n\t\tsetupFeeAmount += setupFee.getSubtotal();\n\t} catch ( error ) {\n\t\t// Item couldn't be found, do not add it.\n\t}\n\n\tif ( setupFeeAmount > 0 ) {\n\t\tdisplayItems.push( {\n\t\t\tlabel: i18n.setupFeeLabel,\n\t\t\tamount: setupFeeAmount,\n\t\t} );\n\t}\n\n\t// Add tax to list.\n\tif ( cart.taxPercent > 0 ) {\n\t\tdisplayItems.push( {\n\t\t\tlabel: i18n.taxLabel.replace( '%s', cart.getTaxPercent() ),\n\t\t\tamount: cart.getTax(),\n\t\t} );\n\t}\n\n\t// Add tax to list.\n\tif ( cart.getDiscount() > 0 ) {\n\t\tdisplayItems.push( {\n\t\t\tlabel: i18n.couponLabel.replace( '%s', cart.getCoupon().name ),\n\t\t\tamount: cart.getDiscount() * -1,\n\t\t} );\n\t}\n\n\treturn displayItems;\n}\n","/* global _ */\n\n/**\n * External dependencies.\n */\nimport serialize from 'form-serialize';\n\n/**\n * Internal dependencies\n */\nimport { apiRequest } from '@wpsimplepay/utils';\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\nimport { getPaymentMethod } from '@wpsimplepay/pro/frontend/payment-methods';\n\nconst { hooks } = window.wpsp;\nconst { convertToDollars, formatCurrency } = window.spShared;\n\nexport let plaidHandler;\n\n/**\n * Sets up a Stripe Elements iDEAL field and binds events.\n *\n * @link https://stripe.com/docs/stripe-js/reference#elements-create\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( spFormElem, formData ) {\n\tconst { cart } = spFormElem;\n\tconst achDebit = getPaymentMethod( 'ach-debit' );\n\tconst achDebitEl = spFormElem[ 0 ].querySelector( '.simpay-ach-debit-wrap' );\n\n\tif ( ! achDebitEl ) {\n\t\treturn;\n\t}\n\n\tconst { isTestMode, companyName } = formData;\n\tconst checkoutButtonEl = spFormElem[ 0 ].querySelector( '.simpay-checkout-btn-container' );\n\n\t// Handle toggling Checkout and ACH buttons.\n\tconst tabs = spFormElem[ 0 ].querySelectorAll( '.simpay-form-tabs-toggles__toggle' );\n\n\t/**\n\t * @param {Object} e Tab toggle click event.\n\t */\n\tconst maybeHideCheckoutButton = ( { target } ) => {\n\t\tcheckoutButtonEl.style.display = 'simpay-payment-method-toggle-ach-debit' === target.id\n\t\t\t? 'none'\n\t\t\t: 'block';\n\t}\n\n\tif ( tabs ) {\n\t\t// Add a click event handler to each tab.\n\t\t_.each( tabs, ( tab ) => tab.addEventListener( 'click', maybeHideCheckoutButton ) );\n\n\t\t// On load.\n\t\tmaybeHideCheckoutButton( {\n\t\t\ttarget: tabs[ 0 ],\n\t\t} );\n\t}\n\n\ttry {\n\t\t// Update ACH Debit button with amount.\n\t\t$( document.body ).on( 'simpayFinalizeCoreAmount', function() {\n\t\t\tconst total = formatCurrency( convertToDollars( cart.getTotal() ), true );\n\t\t\tachDebitEl.querySelector( 'button span' ).innerHTML = total;\n\t\t} );\n\n\t\t/**\n\t\t * Creates a Plaid Link token.\n\t\t *\n\t\t * @return {Object}\n\t\t */\n\t\tconst fetchLinkToken = async () => {\n\t\t\tconst { link_token: linkToken } = await apiRequest( 'v2/plaid-token/create-link-token', {\n\t\t\t\tform_values: serialize( spFormElem[ 0 ], { hash: true } ),\n\t\t\t\tform_data: formData,\n\t\t\t\tform_id: formData.formId,\n\t\t\t} );\n\n\t\t\treturn linkToken;\n\t\t}\n\n\t\t/**\n\t\t * Handles successful bank account authorization via Plaid Link.\n\t\t *\n\t\t * @param {String} publicToken Public token.\n\t\t * @param {Object} metadata Metadata.\n\t\t */\n\t\tconst onSuccess = ( publicToken, { account_id: accountId } ) => {\n\t\t\t// Toggle buttons.\n\t\t\tachDebitEl.style.display = 'none';\n\t\t\tcheckoutButtonEl.style.display = 'block';\n\n\t\t\t// Stop hiding Checkout button\n\t\t\t_.each( tabs, ( tab ) => tab.removeEventListener( 'click', maybeHideCheckoutButton ) );\n\n\t\t\t// Attach data.\n\t\t\tachDebitEl.dataset.publicToken = publicToken;\n\t\t\tachDebitEl.dataset.accountId = accountId;\n\t\t};\n\n\t\t/**\n\t\t * Handles closure of Plaid Link.\n\t\t *\n\t\t * @param {String} publicToken Public token.\n\t\t * @param {Object} metadata Metadata.\n\t\t */\n\t\tconst onExit = ( error, metadata ) => {\n\t\t\tplaidHandler.destroy();\n\n\t\t\t// The user exited the Link flow.\n\t\t\tif ( error !== null ) {\n\t\t\t\tonPaymentFormError( error, spFormElem, formData );\n\t\t\t}\n\t\t}\n\n\t\tconst configs = {\n\t\t\tenv: true === isTestMode ? 'sandbox' : 'production',\n\t\t\tclientName: companyName,\n\t\t\tproduct: [\n\t\t\t\t'auth',\n\t\t\t],\n\t\t\tselectAccount: true,\n\t\t\tonSuccess,\n\t\t\tonExit,\n\t\t};\n\n\t\t/**\n\t\t * \"Select Bank\" button click handler.\n\t\t *\n\t\t * @param {Object} e Click event.\n\t\t */\n\t\tachDebitEl.addEventListener( 'click', async ( e ) => {\n\t\t\te.preventDefault();\n\n\t\t\ttry {\n\t\t\t\t// Setup handler.\n\t\t\t\t// Created on the fly to avoid issues with multiple on the same page.\n\t\t\t\tplaidHandler = Plaid.create( {\n\t\t\t\t\ttoken: await fetchLinkToken(),\n\t\t\t\t\t...configs,\n\t\t\t\t} );\n\n\t\t\t\tplaidHandler.open();\n\t\t\t} catch ( error ) {\n\t\t\t\tonPaymentFormError( error, spFormElem, formData );\n\t\t\t}\n\t\t} );\n\n\t\tconst submitEl = achDebitEl.querySelector( 'button' );\n\n\t\tif ( ! submitEl ) {\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * \"Select Bank\" button keypress handler.\n\t\t *\n\t\t * @param {Object} e Keyup event.\n\t\t */\n\t\tsubmitEl.addEventListener( 'keyup', ( e ) => {\n\t\t\tif ( 13 !== e.keyCode ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\te.preventDefault();\n\t\t\tplaidHandler.open();\n\t\t} );\n\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","/* global jQuery */\n\n/**\n * Internal dependencies.\n */\nimport { update as updateTotalAmountLabels } from './total-amount-labels.js';\n\n/**\n * Apply a coupon.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function apply( spFormElem, formData ) {\n\tconst $ = jQuery;\n\tconst couponField = spFormElem.find( '.simpay-coupon-field' );\n\tconst responseContainer = spFormElem.find( '.simpay-coupon-message' );\n\tconst loadingImage = spFormElem.find( '.simpay-coupon-loading' );\n\tconst removeCoupon = spFormElem.find( '.simpay-remove-coupon' );\n\tconst hiddenCouponElem = spFormElem.find( '.simpay-coupon' );\n\n\tconst {\n\t\tconvertToCents,\n\t\tdebugLog,\n\t} = window.spShared;\n\n\tlet coupon = '';\n\tlet couponMessage = '';\n\n\tif ( ! couponField.val() && ! formData.couponCode ) {\n\t\treturn;\n\t} else if ( formData.couponCode ) {\n\t\tcoupon = formData.couponCode;\n\t} else {\n\t\tcoupon = couponField.val();\n\t}\n\n\t// AJAX params\n\tconst data = {\n\t\tcoupon,\n\t\tamount: spFormElem.cart.getSubtotal(),\n\t\taction: 'simpay_get_coupon',\n\t\tform_id: formData.formId,\n\t\tcouponNonce: spFormElem.find( '#simpay_coupon_nonce' ).val(),\n\t};\n\n\t// Clear the response container and hide the remove coupon link\n\tresponseContainer.text( '' );\n\tremoveCoupon.hide();\n\n\t// Clear textbox\n\tcouponField.val( '' );\n\n\t// Show the loading image\n\tloadingImage.show();\n\n\t$.ajax( {\n\t\turl: window.spGeneral.strings.ajaxurl,\n\t\tmethod: 'POST',\n\t\tdata,\n\t\tdataType: 'json',\n\t\tsuccess( response ) {\n\t\t\tif ( response.success ) {\n\t\t\t\t// Backwards compatibility.\n\t\t\t\tformData.couponCode = coupon;\n\n\t\t\t\t// Backwards compatibility.\n\t\t\t\tformData.discount = response.discount;\n\n\t\t\t\t// Update the cart.\n\t\t\t\ttry {\n\t\t\t\t\tspFormElem.cart.update( {\n\t\t\t\t\t\tcoupon: response.stripeCoupon,\n\t\t\t\t\t} );\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tdebugLog( error );\n\t\t\t\t}\n\n\t\t\t\tconst {\n\t\t\t\t\tformatCurrency,\n\t\t\t\t} = window.spShared;\n\n\t\t\t\t// Coupon message for frontend\n\t\t\t\tcouponMessage = response.coupon.code + ': ';\n\n\t\t\t\t// Output different text based on the type of coupon it is - amount off or a percentage\n\t\t\t\tif ( 'percent' === response.coupon.type ) {\n\t\t\t\t\tcouponMessage += response.coupon.amountOff + spGeneral.i18n.couponPercentOffText;\n\t\t\t\t} else if ( 'amount' === response.coupon.type ) {\n\t\t\t\t\tcouponMessage += formatCurrency( response.coupon.amountOff, true ) + ' ' + spGeneral.i18n.couponAmountOffText;\n\t\t\t\t}\n\n\t\t\t\t$( '.coupon-details' ).remove();\n\n\t\t\t\t// Update the coupon message text\n\t\t\t\tresponseContainer\n\t\t\t\t\t.append( couponMessage )\n\t\t\t\t\t.show();\n\n\t\t\t\t// Create a hidden input to send our coupon details for Stripe metadata purposes\n\t\t\t\t$( '<input />', {\n\t\t\t\t\tname: 'simpay_coupon_details',\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tvalue: couponMessage,\n\t\t\t\t\tclass: 'simpay-coupon-details',\n\t\t\t\t} ).appendTo( responseContainer );\n\n\t\t\t\t// Show remove coupon link\n\t\t\t\tremoveCoupon.show();\n\n\t\t\t\t// Add the coupon to our hidden element for processing\n\t\t\t\thiddenCouponElem.val( coupon );\n\n\t\t\t\t// Hide the loading image\n\t\t\t\tloadingImage.hide();\n\n\t\t\t\t// Trigger custom event when coupon apply done.\n\t\t\t\tspFormElem.trigger( 'simpayCouponApplied' );\n\t\t\t} else {\n\t\t\t\t// Show invalid coupon message\n\t\t\t\tresponseContainer\n\t\t\t\t\t.show()\n\t\t\t\t\t.append( $( '<p />' )\n\t\t\t\t\t\t.addClass( 'simpay-field-error' )\n\t\t\t\t\t\t.text( response.data.error ) );\n\n\t\t\t\t// Hide loading image\n\t\t\t\tloadingImage.hide();\n\t\t\t}\n\t\t},\n\t\terror( response ) {\n\t\t\tlet errorMessage = '';\n\n\t\t\tconst {\n\t\t\t\tdebugLog,\n\t\t\t} = window.spShared;\n\n\t\t\tdebugLog( 'Coupon error', response.responseText );\n\n\t\t\tif ( response.responseText ) {\n\t\t\t\terrorMessage = response.responseText;\n\t\t\t}\n\n\t\t\t// Show invalid coupon message\n\t\t\tresponseContainer\n\t\t\t\t.show()\n\t\t\t\t.append( $( '<p />' )\n\t\t\t\t\t.addClass( 'simpay-field-error' )\n\t\t\t\t\t.text( errorMessage ) );\n\n\t\t\t// Hide loading image\n\t\t\tloadingImage.hide();\n\t\t},\n\t\tcomplete( response ) {\n\t\t\t// Alert the rest of the components they need to update.\n\t\t\t// Tell main totalChanged handler not to do anything with coupons.\n\t\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData, false ] );\n\t\t},\n\t} );\n}\n\n/**\n * Remove a coupon.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function remove( spFormElem, formData ) {\n\tconst {\n\t\tdebugLog,\n\t} = window.spShared;\n\n\ttry {\n\t\tspFormElem.cart.update( {\n\t\t\tcoupon: false,\n\t\t} );\n\n\t\t// Trigger custom event when coupon apply done.\n\t\tspFormElem.trigger( 'simpayCouponRemoved' );\n\n\t\t// Alert the rest of the components they need to update.\n\t\t// Tell main totalChanged handler not to do anything with coupons.\n\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData, false ] );\n\t} catch ( error ) {\n\t\tdebugLog( error );\n\t}\n\n\t// Backwards compatibility.\n\tspFormElem.find( '.simpay-coupon-loading' ).hide();\n\tspFormElem.find( '.simpay-remove-coupon' ).hide();\n\tspFormElem.find( '.simpay-coupon-message' )\n\t\t.text( '' )\n\t\t.hide();\n\tspFormElem.find( '.simpay-coupon' ).val( '' );\n\n\tformData.couponCode = '';\n\tformData.discount = 0;\n}\n","/**\n * WordPress dependencies.\n */\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies.\n */\nimport { onPaymentFormError } from '@wpsimplepay/core/frontend/payment-forms';\nimport { create as createCustomer } from '@wpsimplepay/core/frontend/payments/customer.js';\nimport {\n\tcreate as createPaymentIntent,\n\thandleServerResponse as handlePaymentIntentServerResponse,\n} from '@wpsimplepay/pro/frontend/payments/paymentintent.js';\nimport {\n\tcreate as createSubscription,\n\thandleServerResponse as handleSubscriptionServerResponse,\n} from '@wpsimplepay/pro/frontend/payments/subscription.js';\n\n/**\n * Handle a Source.\n *\n * @since 3.8.0\n *\n * @param {Object} source Stripe Source object.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport async function handle( source, spFormElem, formData ) {\n\ttry {\n\t\t// Create a Customer (and attach Source).\n\t\tconst customer = await createCustomer(\n\t\t\t{\n\t\t\t\tsource_id: source.id,\n\t\t\t},\n\t\t\tspFormElem,\n\t\t\tformData\n\t\t);\n\n\t\t// Define a Return URL.\n\t\tconst successUrl = addQueryArgs( formData.stripeParams.success_url, {\n\t\t\tcustomer_id: customer.id,\n\t\t} );\n\n\t\tlet paymentIntentRequiresAction;\n\n\t\t// Handle Subscriptions.\n\t\tif ( formData.isSubscription || formData.isRecurring ) {\n\t\t\tconst subscription = await createSubscription(\n\t\t\t\t{\n\t\t\t\t\tcustomer_id: customer.id,\n\t\t\t\t},\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\t// Handle next actions on Subscription's PaymentIntent.\n\t\t\tpaymentIntentRequiresAction = await handleSubscriptionServerResponse(\n\t\t\t\tsubscription,\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\t// Handle one-time payments.\n\t\t} else {\n\t\t\tconst paymentIntent = await createPaymentIntent(\n\t\t\t\t{\n\t\t\t\t\tcustomer_id: customer.id,\n\t\t\t\t\tpayment_method_id: source.id,\n\t\t\t\t\tpayment_method_type: 'card',\n\t\t\t\t},\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\n\t\t\t// No SCA needed, redirect.\n\t\t\tif ( ! paymentIntent.requires_action ) {\n\t\t\t\treturn ( window.location.href = successUrl );\n\t\t\t}\n\n\t\t\t// Handle next actions on PaymentIntent.\n\t\t\tpaymentIntentRequiresAction = await handlePaymentIntentServerResponse(\n\t\t\t\t{\n\t\t\t\t\tcustomer_id: customer.id,\n\t\t\t\t\tpayment_intent: paymentIntent,\n\t\t\t\t},\n\t\t\t\tspFormElem,\n\t\t\t\tformData\n\t\t\t);\n\t\t}\n\n\t\t// Nothing else is needed, redirect.\n\t\tif ( false === paymentIntentRequiresAction ) {\n\t\t\treturn ( window.location.href = successUrl );\n\t\t}\n\t} catch ( error ) {\n\t\tonPaymentFormError( error, spFormElem, formData );\n\t}\n}\n","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\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 define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\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 GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\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 define(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 define(genFun, toStringTagSymbol, \"GeneratorFunction\");\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, PromiseImpl) {\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 PromiseImpl.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 PromiseImpl.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 PromiseImpl(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, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\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 define(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","// @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger#Polyfill\nNumber.isInteger = Number.isInteger || function( value ) {\n\treturn typeof value === 'number' &&\n\t\tisFinite( value ) &&\n\t\tMath.floor( value ) === value;\n};\n\n// @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger#Polyfill\nNumber.isSafeInteger = Number.isSafeInteger || function( value ) {\n\treturn Number.isInteger( value ) && Math.abs( value ) <= Number.MAX_SAFE_INTEGER;\n};\n\n// @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER#Polyfill\nif ( ! Number.MAX_SAFE_INTEGER ) {\n\tNumber.MAX_SAFE_INTEGER = 9007199254740991; // Math.pow(2, 53) - 1;\n}\n","/* global jQuery, wpApiSettings */\n\n/**\n * Make an API request to the REST API.\n *\n * @param {string} route REST route.\n * @param {Object} data Data to send to the request.\n * @return {Promise} jQuery promise.\n */\nexport async function apiRequest( route, data ) {\n\ttry {\n\t\treturn await jQuery.ajax( {\n\t\t\tdata,\n\t\t\tmethod: 'POST',\n\t\t\turl: `${ wpApiSettings.root }wpsp/${ route }`,\n\t\t\tbeforeSend: ( xhr ) => {\n\t\t\t\txhr.setRequestHeader( 'X-WP-Nonce', wpApiSettings.nonce );\n\t\t\t},\n\t\t} );\n\t} catch ( { responseJSON } ) {\n\t\tthrow responseJSON;\n\t}\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nvar compactQueue = function compactQueue(queue) {\n var obj;\n\n while (queue.length) {\n var item = queue.pop();\n obj = item.obj[item.prop];\n\n if (Array.isArray(obj)) {\n var compacted = [];\n\n for (var j = 0; j < obj.length; ++j) {\n if (typeof obj[j] !== 'undefined') {\n compacted.push(obj[j]);\n }\n }\n\n item.obj[item.prop] = compacted;\n }\n }\n\n return obj;\n};\n\nvar arrayToObject = function arrayToObject(source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nvar merge = function merge(target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (Array.isArray(target)) {\n target.push(source);\n } else if (typeof target === 'object') {\n if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (Array.isArray(target) && !Array.isArray(source)) {\n mergeTarget = arrayToObject(target, options);\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n if (target[i] && typeof target[i] === 'object') {\n target[i] = merge(target[i], item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (has.call(acc, key)) {\n acc[key] = merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nvar assign = function assignSingleSource(target, source) {\n return Object.keys(source).reduce(function (acc, key) {\n acc[key] = source[key];\n return acc;\n }, target);\n};\n\nvar decode = function (str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n};\n\nvar encode = function encode(str) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D // -\n || c === 0x2E // .\n || c === 0x5F // _\n || c === 0x7E // ~\n || (c >= 0x30 && c <= 0x39) // 0-9\n || (c >= 0x41 && c <= 0x5A) // a-z\n || (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += hexTable[0xF0 | (c >> 18)]\n + hexTable[0x80 | ((c >> 12) & 0x3F)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n }\n\n return out;\n};\n\nvar compact = function compact(value) {\n var queue = [{ obj: { o: value }, prop: 'o' }];\n var refs = [];\n\n for (var i = 0; i < queue.length; ++i) {\n var item = queue[i];\n var obj = item.obj[item.prop];\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n var val = obj[key];\n if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {\n queue.push({ obj: obj, prop: key });\n refs.push(val);\n }\n }\n }\n\n return compactQueue(queue);\n};\n\nvar isRegExp = function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nvar isBuffer = function isBuffer(obj) {\n if (obj === null || typeof obj === 'undefined') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\nmodule.exports = {\n arrayToObject: arrayToObject,\n assign: assign,\n compact: compact,\n decode: decode,\n encode: encode,\n isBuffer: isBuffer,\n isRegExp: isRegExp,\n merge: merge\n};\n","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nmodule.exports = {\n 'default': 'RFC3986',\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return value;\n }\n },\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n","/**\n * Update form data when a plan changes.\n *\n * @param {Event} e Change event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function update( e, spFormElem, formData ) {\n\tconst {\n\t\tconvertToCents,\n\t\tformatCurrency,\n\t\tunformatCurrency,\n\t} = window.spShared;\n\n\tconst wrapperElem = spFormElem.find( '.simpay-plan-wrapper' );\n\n\tif ( 0 === wrapperElem.length ) {\n\t\treturn;\n\t}\n\n\tconst errorEl = spFormElem.find( '.simpay-errors' );\n\tconst customAmountInput = spFormElem.find( '.simpay-custom-amount-input' );\n\tconst options = wrapperElem.find( '.simpay-multi-sub' );\n\n\tlet selectedOption = '';\n\n\tlet\n\t\tplanId,\n\t\tplanName,\n\t\tplanSetupFee,\n\t\tplanAmount,\n\t\tplanInterval,\n\t\tplanIntervalCount,\n\t\tplanTrial,\n\t\tplanMaxCharges;\n\n\t// Check if it is a dropdown or a radio button setup and act accordingly\n\tif ( options.first().is( 'option' ) ) {\n\t\tselectedOption = options.filter( ':selected' );\n\t} else {\n\t\tselectedOption = options.filter( ':checked' );\n\t}\n\n\tplanId = selectedOption.data( 'plan-id' ) || '';\n\tplanName = selectedOption.text();\n\tplanSetupFee = selectedOption.data( 'plan-setup-fee' ) || 0;\n\tplanAmount = selectedOption.data( 'plan-amount' ) || 0;\n\tplanInterval = selectedOption.data( 'plan-interval' ) || '';\n\tplanIntervalCount = selectedOption.data( 'plan-interval-count' ) || 1;\n\tplanTrial = ( undefined !== selectedOption.data( 'plan-trial' ) );\n\tplanMaxCharges = selectedOption.data( 'plan-max-charges' ) || 0;\n\n\tif ( planTrial ) {\n\t\tformData.amount = 0;\n\t}\n\n\t// Backwards compatibility.\n\tformData = {\n\t\t...formData,\n\t\tplanId,\n\t\tplanSetupFee,\n\t\tplanAmount,\n\t\tplanInterval,\n\t\tplanIntervalCount,\n\t\tisTrial: planTrial,\n\t};\n\n\t// Update custom amount checker\n\tif ( selectedOption.hasClass( 'simpay-custom-plan-option' ) ) {\n\t\tspFormElem.find( '.simpay-has-custom-plan' ).val( 'true' );\n\t} else {\n\t\tspFormElem.find( '.simpay-has-custom-plan' ).val( '' );\n\t}\n\n\t// Backwards compatibility.\n\tformData.useCustomPlan = ( 'simpay_custom_plan' === selectedOption.val() );\n\n\t// Reset custom amount validation.\n\terrorEl.empty();\n\tcustomAmountInput.removeClass( 'simpay-input-error' );\n\n\t// If the custom amount plan is selected, focus input & blank out value.\n\t// If an existing plan is selected, don't focus input & set input to plan value.\n\tif ( formData.useCustomPlan ) {\n\t\tcustomAmountInput.val( '' );\n\t\tformData.amount = 0;\n\n\t\tif ( ! customAmountInput.is( ':focus' ) ) {\n\t\t\tcustomAmountInput.focus();\n\t\t}\n\t} else {\n\t\tcustomAmountInput.val( formatCurrency( planAmount ) );\n\t}\n\n\tconst {\n\t\tcart,\n\t} = spFormElem;\n\n\ttry {\n\t\t// Update cart's setup fee.\n\t\tconst setupFeeItem = cart.getLineItem( 'plan-setup-fee' );\n\n\t\tsetupFeeItem.update( {\n\t\t\tamount: convertToCents( unformatCurrency( planSetupFee ) ),\n\t\t} );\n\n\t\t// Update cart's base amount.\n\t\tconst item = cart.getLineItem( 'base' );\n\n\t\titem.update( {\n\t\t\ttitle: planName || item.title,\n\t\t\tamount: convertToCents( planAmount ),\n\t\t\tsubscription: {\n\t\t\t\tisTrial: planTrial,\n\t\t\t\tinterval: planInterval,\n\t\t\t\tintervalCount: planIntervalCount,\n\t\t\t},\n\t\t} );\n\n\t\t// Backwards compatibility.\n\t\tspFormElem.find( '.simpay-multi-plan-id' ).val( planId );\n\t\tspFormElem.find( '.simpay-multi-plan-setup-fee' ).val( planSetupFee );\n\t\tspFormElem.find( '.simpay-max-charges' ).val( planMaxCharges );\n\n\t\t// Custom trigger after completed.\n\t\tspFormElem.trigger( 'simpayMultiPlanChanged' );\n\n\t\t// Alert the rest of the components they need to update.\n\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData ] );\n\t} catch ( error ) {\n\t\t// Error is logged, UI does not need updating.\n\t}\n}\n","/**\n * Toggle shipping address fields.\n *\n * When hiding, disable fields so the values are not sent.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function toggleShippingAddressFields( spFormElem, formData ) {\n\tconst shippingAddressContainer = spFormElem.find( '.simpay-shipping-address-container' );\n\tconst isChecked = spFormElem.find( '.simpay-same-address-toggle' ).is( ':checked' );\n\n\tshippingAddressContainer\n\t\t.toggle( ! isChecked )\n\t\t.find( 'input, select' )\n\t\t.prop( 'disabled', isChecked );\n}\n","/* global jQuery, datepicker */\n\n/**\n * Initailize jQuery UI datepicker.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function setup( e, spFormElem, formData ) {\n\tif ( ! $.datepicker ) {\n\t\treturn;\n\t}\n\n\tconst dateInputEl = spFormElem.find( '.simpay-date-input' );\n\n\tdateInputEl.datepicker( {\n\t\tdateFormat: formData.dateFormat,\n\t\tbeforeShow() {\n\t\t\tjQuery( '.ui-datepicker' ).css( 'font-size', 14 );\n\t\t},\n\t} );\n}\n","/* global simpayAppPro, _ */\n\n/**\n * Internal dependencies.\n */\nimport { setup as setupPaymentRequestButton } from '@wpsimplepay/pro/frontend/components/payment-request-button.js';\n\n/**\n * Toggle an overlay form's visibility.\n *\n * Attach to any type of link. Useful when the form number is known.\n *\n * document.querySelector( '.my-link' ).addEventListener( 'click', function( e ) {\n * e.preventDefault();\n * simpayAppPro.toggleOverlayForm( 13 );\n * } );\n *\n * Attach to a button that has an associated form ID. Useful when the form number is dynamic.\n * This functionality is added by default to [simpay id=\"13\"] shortcode usage.\n *\n * <button data-form-id=\"13\">Launch</button>\n * document.querySelector( '.my-button' ).addEventListener( 'click', simpayAppPro.toggleOverlayForm );\n *\n * @param {mixed} Click or change event, or an ID of a form.\n */\nexport function toggle( e, spFormElem, formData ) {\n\tlet formId = false;\n\n\tif ( 'object' === typeof e ) {\n\t\te.preventDefault();\n\t\tformId = e.target.dataset.formId;\n\t} else {\n\t\tformId = e;\n\t}\n\n\t// Find the modal.\n\tlet modal = document.querySelectorAll( '.simpay-modal[data-form-id=\"' + formId + '\"]' );\n\n\tif ( 0 === modal.length ) {\n\t\treturn;\n\t}\n\n\t// Always get the last instance of the modal markup since the markup\n\t// is moved to the end of the DOM.\n\t//\n\t// @link https://github.com/wpsimplepay/WP-Simple-Pay-Pro-3/issues/738\n\tmodal = modal[ modal.length - 1 ];\n\n\t// Move Modal markup to end of the document.\n\tdocument.body.appendChild( modal );\n\n\tconst modalStyles = getComputedStyle( modal );\n\tconst isVisible = '0' !== modalStyles.getPropertyValue( 'opacity' );\n\n\tif ( isVisible ) {\n\t\tmodal.style.opacity = 0;\n\t\tmodal.style.height = 0;\n\t} else {\n\t\tmodal.style.opacity = 1;\n\t\tmodal.style.height = '100%';\n\n\t\t// Find spFormElem and formData which lose context in global event binding.\n\t\t// The formData.formInstance will still be incorrect, but handled further\n\t\t// down for PRB.\n\t\tconst spFormElem = window.simpayApp.spFormElems[ formId ];\n\t\tconst formData = window.simpayApp.spFormData[ formId ];\n\n\t\tsetupPaymentRequestButton( e, spFormElem, formData );\n\n\t\t// Focus first field.\n\t\tfocusFirstField( modal );\n\t}\n}\n\n/**\n * Focus first field in an overlay form's modal.\n *\n * @param {HTMLElement} modal Modal being shown.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {HTMLElement} cardEl Card element to mount to.\n */\nfunction focusFirstField( modal ) {\n\t/**\n\t * Selectable elements.\n\t */\n\tconst SELECTOR = [\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([aria-hidden]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t].join( ',' );\n\n\tconst firstModalField = modal.querySelector( SELECTOR );\n\n\tif ( firstModalField ) {\n\t\tfirstModalField.focus();\n\t\tfirstModalField.parentElement.classList.add( 'is-focused' );\n\t}\n}\n\nlet OVERLAYS_SETUP = false;\n\n/**\n * Manage modal toggling for \"Overlay\" form display types.\n *\n * Initial HTML markup for the modal is output as a sibling to the toggle\n * control but is moved to the end of the document to combat issues with z-index.\n *\n * @link https://github.com/wpsimplepay/WP-Simple-Pay-Pro-3/issues/610\n * @link https://github.com/wpsimplepay/WP-Simple-Pay-Pro-3/issues/645\n *\n * @param {Event} e Event.\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {HTMLElement} cardEl Card element to mount to.\n */\nexport function setup( e, spFormElem, formData ) {\n\t// This function can be called multiple times with the\n\t// `simpayBindCoreFormEventsAndTriggers` trigger.\n\t//\n\t// Because we need to allow custom controls outside of the form context\n\t// we must query from the document level, not the <form>.\n\t//\n\t// Anonymous functions or functions created in this scope will stack\n\t// when attached to an element. To avoid keep access to the initial\n\t// form context we ensure nothing continues after this function is run once.\n\t//\n\t// @link https://github.com/wpsimplepay/WP-Simple-Pay-Pro-3/issues/958\n\tif ( true === OVERLAYS_SETUP ) {\n\t\treturn;\n\t}\n\n\tOVERLAYS_SETUP = true;\n\n\tconst inputControls = document.querySelectorAll( 'input.simpay-modal-control' );\n\tconst controls = document.querySelectorAll( '*:not(input).simpay-modal-control' );\n\n\t// Bind each control to toggle a modal.\n\t_.each( inputControls, function( control ) {\n\t\tcontrol.addEventListener( 'change', toggle );\n\t} );\n\n\t_.each( controls, function( control ) {\n\t\tcontrol.addEventListener( 'click', toggle );\n\t} );\n}\n","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","'use strict';\n\nvar utils = require('./utils');\nvar formats = require('./formats');\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n return prefix + '[]';\n },\n indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n return prefix;\n }\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaults = {\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar stringify = function stringify( // eslint-disable-line func-name-matching\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder);\n return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (Array.isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (Array.isArray(obj)) {\n values = values.concat(stringify(\n obj[key],\n generateArrayPrefix(prefix, key),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n } else {\n values = values.concat(stringify(\n obj[key],\n prefix + (allowDots ? '.' + key : '[' + key + ']'),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n }\n\n return values;\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = opts ? utils.assign({}, opts) : {};\n\n if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;\n var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;\n var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;\n var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;\n var sort = typeof options.sort === 'function' ? options.sort : null;\n var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;\n var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;\n if (typeof options.format === 'undefined') {\n options.format = formats['default'];\n } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n var formatter = formats.formatters[options.format];\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (Array.isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (options.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = options.arrayFormat;\n } else if ('indices' in options) {\n arrayFormat = options.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (sort) {\n objKeys.sort(sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n keys = keys.concat(stringify(\n obj[key],\n key,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encode ? encoder : null,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly\n ));\n }\n\n var joined = keys.join(delimiter);\n var prefix = options.addQueryPrefix === true ? '?' : '';\n\n return joined.length > 0 ? prefix + joined : '';\n};\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n parameterLimit: 1000,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n\n for (var i = 0; i < parts.length; ++i) {\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder);\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder);\n val = options.decoder(part.slice(pos + 1), defaults.decoder);\n }\n if (has.call(obj, key)) {\n obj[key] = [].concat(obj[key]).concat(val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options) {\n var leaf = val;\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]') {\n obj = [];\n obj = obj.concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (\n !isNaN(index)\n && root !== cleanRoot\n && String(index) === cleanRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else {\n obj[cleanRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys\n // that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options);\n};\n\nmodule.exports = function (str, opts) {\n var options = opts ? utils.assign({}, opts) : {};\n\n if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;\n options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;\n options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;\n options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;\n options.parseArrays = options.parseArrays !== false;\n options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;\n options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;\n options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;\n options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;\n options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;\n options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options);\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n","/**\n * Update the form amount based on \"Amount\" field selected value.\n *\n * @param {jQuery} spFormElem Form element jQuery object.\n * @param {Object} formData Configured form data.\n */\nexport function update( e, spFormElem, formData ) {\n\tlet amount;\n\n\tconst {\n\t\tconvertToCents,\n\t\tformatCurrency,\n\t} = window.spShared;\n\n\t// Update the amount to the selected dropdown amount\n\tif ( 0 !== spFormElem.find( '.simpay-amount-dropdown' ).length ) {\n\t\tamount = spFormElem.find( '.simpay-amount-dropdown' ).find( 'option:selected' ).data( 'amount' );\n\n\t\tspFormElem.trigger( 'simpayDropdownAmountChange' );\n\t// Update the amount to the selected radio button\n\t} else if ( 0 !== spFormElem.find( '.simpay-amount-radio' ).length ) {\n\t\tamount = spFormElem.find( '.simpay-amount-radio' ).find( 'input[type=\"radio\"]:checked' ).data( 'amount' );\n\n\t\tspFormElem.trigger( 'simpayRadioAmountChange' );\n\t}\n\n\tconst customAmountInput = spFormElem.find( '.simpay-custom-amount-input' );\n\tconst errorEl = spFormElem.find( '.simpay-errors' );\n\n\tif ( customAmountInput.length ) {\n\t\tcustomAmountInput.val( formatCurrency( amount, false ) );\n\t\tcustomAmountInput.removeClass( 'simpay-input-error' );\n\t\terrorEl.empty();\n\t}\n\n\tif ( amount > 0 ) {\n\t\ttry {\n\t\t\tconst item = spFormElem.cart.getLineItem( 'base' );\n\n\t\t\titem.update( {\n\t\t\t\tamount: convertToCents( amount ),\n\t\t\t} );\n\n\t\t\t// Backwards compatibility.\n\t\t\tformData.amount = amount;\n\n\t\t\t// Alert the rest of the components they need to update.\n\t\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData ] );\n\t\t} catch ( error ) {\n\t\t\t// Error is logged, UI does not need updating.\n\t\t}\n\t}\n}\n\n/**\n * DOM ready.\n *\n * @param {jQuery} $ jQuery.\n */\n( function( $ ) {\n\t/**\n\t * Bind when Payment Form is ready.\n\t *\n\t * @param {Object} e Event\n\t * @param {Object} spFormElem Form element.\n\t * @param {Object} formData Form data.\n\t */\n\t$( document.body ).on( 'simpayBindCoreFormEventsAndTriggers', ( e, spFormElem, formData ) => {\n\t\t// Update amounts on load.\n\t\tupdate( e, spFormElem, formData );\n\n\t\t/**\n\t\t * Update amounts when a \"Quantity\" input changes.\n\t\t *\n\t\t * @param {Event} e Change event.\n\t\t */\n\t\tspFormElem\n\t\t\t.find( '.simpay-amount-dropdown, .simpay-amount-radio' )\n\t\t\t.on( 'change', ( e ) => update( e, spFormElem, formData ) );\n\t} );\n} ) ( jQuery );\n","/**\n * External dependencies\n */\nimport { parse, stringify } from 'qs';\n/**\n * Appends arguments as querystring to the provided URL. If the URL already\n * includes query arguments, the arguments are merged with (and take precedent\n * over) the existing set.\n *\n * @param {string} [url=''] URL to which arguments should be appended. If omitted,\n * only the resulting querystring is returned.\n * @param {Object} args Query arguments to apply to URL.\n *\n * @example\n * ```js\n * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test\n * ```\n *\n * @return {string} URL with arguments applied.\n */\n\nexport function addQueryArgs() {\n var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var args = arguments.length > 1 ? arguments[1] : undefined;\n\n // If no arguments are to be appended, return original URL.\n if (!args || !Object.keys(args).length) {\n return url;\n }\n\n var baseUrl = url; // Determine whether URL already had query arguments.\n\n var queryStringIndex = url.indexOf('?');\n\n if (queryStringIndex !== -1) {\n // Merge into existing query arguments.\n args = Object.assign(parse(url.substr(queryStringIndex + 1)), args); // Change working base URL to omit previous query arguments.\n\n baseUrl = baseUrl.substr(0, queryStringIndex);\n }\n\n return baseUrl + '?' + stringify(args);\n}\n//# sourceMappingURL=add-query-args.js.map","/**\n * Internal dependencies.\n */\nimport { apply as applyCoupon } from './coupon.js';\nimport { update as updateTotalAmountLabels } from './total-amount-labels.js';\n\nexport function update( e, spFormElem, formData ) {\n\tlet quantity = 1;\n\n\t// Backwards compatibility.\n\tformData.quantity = quantity;\n\n\tconst cart = spFormElem.cart;\n\n\tif ( 0 !== spFormElem.find( '.simpay-quantity-dropdown' ).length ) {\n\t\tquantity = parseFloat( spFormElem.find( '.simpay-quantity-dropdown' ).find( 'option:selected' ).data( 'quantity' ) );\n\n\t\tspFormElem.trigger( 'simpayDropdownQuantityChange' );\n\t} else if ( 0 !== spFormElem.find( '.simpay-quantity-radio' ).length ) {\n\t\tquantity = parseFloat( spFormElem.find( '.simpay-quantity-radio' ).find( 'input[type=\"radio\"]:checked' ).data( 'quantity' ) );\n\n\t\tspFormElem.trigger( 'simpayRadioQuantityChange' );\n\t} else if ( 0 !== spFormElem.find( '.simpay-quantity-input' ).length ) {\n\t\tquantity = parseFloat( spFormElem.find( '.simpay-quantity-input' ).val() );\n\n\t\tspFormElem.trigger( 'simpayNumberQuantityChange' );\n\t}\n\n\tif ( quantity < 1 ) {\n\t\tquantity = 1;\n\t}\n\n\t// Set cart base item quantity.\n\ttry {\n\t\tconst item = spFormElem.cart.getLineItem( 'base' );\n\n\t\titem.update( {\n\t\t\tquantity,\n\t\t} );\n\n\t\t// Backwards compatibility.\n\t\tformData.quantity = quantity;\n\n\t\t// Update hidden quantity field.\n\t\tspFormElem.find( '.simpay-quantity' ).val( quantity );\n\n\t\t// Alert the rest of the components they need to update.\n\t\tspFormElem.trigger( 'totalChanged', [ spFormElem, formData ] );\n\t} catch ( error ) {\n\t\t// Error is logged, UI does not need updating.\n\t}\n}\n\n/**\n * DOM ready.\n *\n * @param {jQuery} $ jQuery.\n */\n( function( $ ) {\n\t/**\n\t * Bind when Payment Form is ready.\n\t *\n\t * @param {Object} e Event\n\t * @param {Object} spFormElem Form element.\n\t * @param {Object} formData Form data.\n\t */\n\t$( document.body ).on( 'simpayBindCoreFormEventsAndTriggers', ( e, spFormElem, formData ) => {\n\t\t// Update amounts on load.\n\t\tupdate( e, spFormElem, formData );\n\n\t\t/**\n\t\t * Update amounts when a \"Quantity\" input changes.\n\t\t *\n\t\t * @param {Event} e Change event.\n\t\t */\n\t\tspFormElem\n\t\t\t.find( '.simpay-quantity-radio input, .simpay-quantity-dropdown, .simpay-quantity-input' )\n\t\t\t.on( 'change', ( e ) => update( e, spFormElem, formData ) );\n\t} );\n} ) ( jQuery );\n","/* globals _ */\n\n/**\n * Internal dependencies.\n */\nimport { setup as setupDateField } from './components/date.js';\nimport { apply as applyCoupon, remove as removeCoupon } from './components/coupon.js';\nimport { update as updateAmountField } from './components/amount.js';\nimport { update as updateQuantiyField } from './components/quantity.js';\nimport { update as updateTotalAmountLabels } from './components/total-amount-labels.js';\nimport { update as updateMultiSubSelection } from './components/multi-sub.js';\nimport { toggleShippingAddressFields } from './components/address.js';\nimport { toggle as toggleOverlayForm } from './payment-forms/stripe-elements/overlays.js';\nimport {\n\tupdate as updateCustomAmount,\n\tenableCustomPlanAmount\n} from './components/custom-amount.js';\nimport { \n\tsetup as enablePaymentRequestButton,\n\tupdate as updatePaymentRequestButton,\n\tgetDisplayItems as getPaymentRequestDisplayItems,\n\tpaymentRequestIsValid\n} from './components/payment-request-button.js';\n\nconst doNothingFuncs = [\n\t'setupStripeElementsForm',\n\t'createCard',\n\t'getCardConfig',\n\t'handleCardFocus',\n\t'focusFirstField',\n\t'beforeSubmitPayment',\n];\n\n/**\n * Shim object properties for backwards compatibility.\n *\n * Some of these will do nothing, but it will help diagnose\n * issues for customers who have improperly referenced them in the past.\n */\nexport default _.extend(\n\t_.reduce( doNothingFuncs, ( memo, func ) => {\n\t\tmemo[ func ] = ( func ) => {\n\t\t\treturn window.spShared.debugLog( 'Deprecated:', `${ func } is no longer used.` );\n\t\t};\n\n\t\treturn memo;\n\t}, {} ),\n\t{\n\t\tisCustomAmountFieldValid: ( spFormElem, formData ) => {\n\t\t\treturn updateCustomAmount( null, spFormElem, formData );\n\t\t},\n\n\t\tinitDateField: ( spFormElem ) => {\n\t\t\treturn setupDateField( null, spFormElem, null );\n\t\t},\n\n\t\thandleCustomAmountFocusIn: ( spFormElem, formData ) => {\n\t\t\treturn enableCustomPlanAmount( null, spFormElem, formData );\n\t\t},\n\n\t\tprocessCustomAmount: ( spFormElem, formData ) => {\n\t\t\treturn updateCustomAmount( null, spFormElem, formData );\n\t\t},\n\n\t\tupdateAmountSelect: ( spFormElem, formData ) => {\n\t\t\treturn updateAmountField( null, spFormElem, formData );\n\t\t},\n\n\t\tupdateQuantitySelect: ( spFormElem, formData ) => {\n\t\t\treturn updateQuantityField( null, spFormElem, formData );\n\t\t},\n\n\t\tupdateTotalAmountLabel: ( spFormElem, formData ) => {\n\t\t\treturn updateTotalAmountLabels( null, spFormElem, formData );\n\t\t},\n\n\t\tupdateRecurringAmountLabel: ( spFormElem, formData ) => {\n\t\t\treturn updateTotalAmountLabels( null, spFormElem, formData );\n\t\t},\n\n\t\tupdateTaxAmountLabel: ( spFormElem, formData ) => {\n\t\t\treturn updateTotalAmountLabels( null, spFormElem, formData );\n\t\t},\n\n\t\tchangeMultiSubAmount: ( spFormElem, formData ) => {\n\t\t\treturn updateMultiSubSelection( null, spFormElem, formData );\n\t\t},\n\n\t\tenablePaymentRequestButton: ( spFormElem, formData ) => {\n\t\t\treturn enablePaymentRequestButton( null, spFormElem, formData );\n\t\t},\n\n\t\tbindProFormEventsAndTriggers: ( e, spFormElem, formData ) => {\n\t\t\treturn window.simpayAppPro.bindEvents( e, spFormElem, formData );\n\t\t},\n\n\t\thandleFieldFocus: ( spFormElem ) => {\n\t\t\treturn window.simpayAppPro.setOnFieldFocus( spFormElem );\n\t\t},\n\n\t\tenableForm: ( spFormElem, formData ) => {\n\t\t\treturn window.simpayApp.enableForm( spFormElem, formData );\n\t\t},\n\n\t\tdisableForm: ( spFormElem, formData, setSubmitButtonAsLoading = false ) => {\n\t\t\treturn window.simpayApp.disableForm( spFormElem, formData, setSubmitButtonAsLoading );\n\t\t},\n\n\t\ttriggerBrowserValidation: ( spFormElem, formData ) => {\n\t\t\treturn window.simpayApp.triggerBrowserValidation( spFormElem, formData );\n\t\t},\n\n\t\tsetProFinalAmount: ( e, spFormElem, formData ) => {\n\t\t\treturn window.simpayAppPro.updateAmounts( e, spFormElem, formData );\n\t\t},\n\n\t\t/**\n\t\t * Calculate the amount of tax given an amount and percentage.\n\t\t *\n\t\t * @since 3.0\n\t\t * @since 3.7.0 Deprecated.\n\t\t *\n\t\t * @param {number} amount Base amount.\n\t\t * @param {number} percent Tax percent.\n\t\t */\n\t\tcalculateTaxAmount( amount, percent ) {\n\t\t\tconst {\n\t\t\t\tdebugLog,\n\t\t\t} = window.spShared;\n\n\t\t\tdebugLog( 'calculateTaxAmount', 'Use spFormElem.cart to access cart tax calculations' );\n\n\t\t\treturn Math.abs( accounting.toFixed( amount * ( percent / 100 ), window.spGeneral.integers.decimalPlaces ) );\n\t\t},\n\n\t\tupdatePaymentRequestButton,\n\t\tpaymentRequestIsValid,\n\t\tgetPaymentRequestDisplayItems,\n\t\ttoggleShippingAddressFields,\n\t\tapplyCoupon,\n\t\tremoveCoupon,\n\t\ttoggleOverlayForm,\n\t}\n);\n","/* global simplePayForms, spGeneral, jQuery, Stripe */\n\n/**\n * Internal dependencies.\n */\nimport { default as simpayAppProCompat } from './compat.js';\n\nimport { getPaymentForms } from '@wpsimplepay/pro/frontend/payment-forms';\n\nimport { setup as setupOverlayModals } from './payment-forms/stripe-elements/overlays.js';\nimport { setup as setupDateField } from './components/date.js';\n\nimport { update as updateTotalAmountLabels } from './components/total-amount-labels.js';\nimport { update as updateMultiSubSelection } from './components/multi-sub.js';\nimport './components/quantity.js';\nimport './components/amount.js';\n\nimport { toggleShippingAddressFields } from './components/address.js';\n\nimport {\n\tsetup as setupPaymentRequestButtons,\n\tupdate as updatePaymentRequestButtons,\n} from './components/payment-request-button.js';\n\nimport {\n\tupdate as updateCustomAmount,\n\tenableCustomPlanAmount,\n} from './components/custom-amount.js';\n\nimport {\n\tapply as applyCoupon,\n\tremove as removeCoupon,\n} from './components/coupon.js';\n\nimport './components/tabs.js';\n\nlet simpayAppPro = {};\n\n( function( $ ) {\n\t'use strict';\n\n\tconst body = $( document.body );\n\n\t/**\n\t * Manage additional \"Pro\" functionality.\n\t *\n\t * This object mainly serves as a backwards compatibility shim.\n\t */\n\tsimpayAppPro = {\n\t\t// Manage multiple payment request buttons.\n\t\tpaymentRequestButtons: {},\n\n\t\t/**\n\t\t * Setup Payment Forms.\n\t\t */\n\t\tinit() {\n\t\t\t// Let `bindEvents` access other object property functions via `this`.\n\t\t\tthis.bindEvents = this.bindEvents.bind( this );\n\n\t\t\tconst stripeElements = getPaymentForms()['stripe-elements'];\n\t\t\tconst { setup: setupPaymentForm } = stripeElements;\n\n\t\t\t// Setup the payment form.\n\t\t\tbody.on( 'simpayCoreFormVarsInitialized', setupPaymentForm );\n\n\t\t\tbody.on( 'simpayBindCoreFormEventsAndTriggers', ( e, spFormElem, formData ) => {\n\t\t\t\tconst { cart } = spFormElem;\n\n\t\t\t\t// Do nothing if Cart is unavailable.\n\t\t\t\tif ( undefined === cart ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetupOverlayModals( e, spFormElem, formData );\n\t\t\t\tsetupDateField( e, spFormElem, formData );\n\n\t\t\t\tthis.bindEvents( e, spFormElem, formData );\n\n\t\t\t\tupdateCustomAmount( e, spFormElem, formData );\n\t\t\t\tupdateMultiSubSelection( e, spFormElem, formData );\n\n\t\t\t\tsetupPaymentRequestButtons( e, spFormElem, formData );\n\n\t\t\t\t//\n\t\t\t\t// This is a very important binding, as it eventually comes full circle calling\n\t\t\t\t// the `simpayFinalizeCoreAmount` trigger, which updates the final amount.\n\t\t\t\t//\n\t\t\t\t// This updateTotalAmountLabels also includes the submit button label.\n\t\t\t\t//\n\t\t\t\t// 1. updateTotalAmountLabels\n\t\t\t\t// 2. simpayApp.setCoreFinalAmount\n\t\t\t\t// trigger:simpayFinalizeCoreAmount\n\t\t\t\t// 3. this.updateAmounts\n\t\t\t\t//\n\t\t\t\t// To alert of a form value change, `totalChanged` trigger should be fired.\n\t\t\t\t// This will call `updateTotalAmountLabels` and start the steps above again.\n\t\t\t\t//\n\t\t\t\t// The current circular logic remains for backwards compatibility.\n\t\t\t\t//\n\t\t\t\tupdateTotalAmountLabels( e, spFormElem, formData );\n\t\t\t} );\n\n\t\t\tbody.on( 'simpayFinalizeCoreAmount', this.updateAmounts );\n\t\t},\n\n\t\tbindEvents( e, spFormElem, formData ) {\n\t\t\t// Toggle focus class for easier styling with CSS.\n\t\t\tthis.setOnFieldFocus( spFormElem );\n\n\t\t\t// Update any components that need to use new total values after change.\n\t\t\tspFormElem.on(\n\t\t\t\t'totalChanged',\n\t\t\t\t/**\n\t\t\t\t * Runs when the total amount has changed.\n\t\t\t\t *\n\t\t\t\t * @param {Event} e Event.\n\t\t\t\t * @param {jQuery} spFormElem Form element jQuery object.\n\t\t\t\t * @param {Object} formData Configured form data.\n\t\t\t\t * @param {Bool} _removeCoupon Determines if the coupon should be removed or not. Defaults false.\n\t\t\t\t */\n\t\t\t\t( e, spFormElem, formData, _removeCoupon = true ) => {\n\t\t\t\t\tif ( true === _removeCoupon ) {\n\t\t\t\t\t\tremoveCoupon( spFormElem, formData );\n\t\t\t\t\t}\n\n\t\t\t\t\tupdateTotalAmountLabels( e, spFormElem, formData );\n\t\t\t\t\tupdatePaymentRequestButtons( spFormElem, formData );\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Validate custom field amount before a form is submitted.\n\t\t\t *\n\t\t\t * @param {Event} e Event.\n\t\t\t * @param {jQuery} spFormElem Form element jQuery object.\n\t\t\t * @param {Object} formData Configured form data.\n\t\t\t */\n\t\t\tspFormElem.on( 'simpayBeforeStripePayment', ( e, spFormElem, formData ) => {\n\t\t\t\t// Backwards compatibility.\n\t\t\t\t// `simpayBeforeStripePayment` should be used directly.\n\t\t\t\tspFormElem.trigger( 'simpayFormValidationInitialized' );\n\n\t\t\t\tconst isCustomAmountValid = updateCustomAmount( e, spFormElem, formData, false, true );\n\n\t\t\t\tformData.isValid = isCustomAmountValid;\n\t\t\t} );\n\n\t\t\t/**\n\t\t\t * Validate and update amounts when the \"Custom Amount\" field loses focus.\n\t\t\t *\n\t\t\t * @param {Event} e Focusout event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-custom-amount-input' ).on( 'focusout', ( e ) => {\n\t\t\t\tupdateCustomAmount( e, spFormElem, formData, true, true );\n\n\t\t\t\tconst amountSelect = spFormElem.find( '.simpay-amount-dropdown' );\n\n\t\t\t\tif ( amountSelect.length ) {\n\t\t\t\t\tamountSelect.find( 'option:first-child' ).prop( 'selected', true );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tspFormElem.find( '.simpay-custom-amount-input' ).on( 'focus', ( e ) => {\n\t\t\t\tspFormElem.find( '.simpay-amount-radio' ).find( 'input[type=\"radio\"]' )\n\t\t\t\t\t.attr( 'checked', false );\n\t\t\t} );\n\n\t\t\t/**\n\t\t\t * Toggle the internal flags that a custom amount is being used for Subscriptions.\n\t\t\t *\n\t\t\t * @param {Event} e Focusin event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-custom-amount-input' ).on( 'focusin', ( e ) => enableCustomPlanAmount( e, spFormElem, formData ) );\n\n\t\t\t/**\n\t\t\t * Apply a coupon when the \"Apply\" button is clicked.\n\t\t\t *\n\t\t\t * @param {Event} e Click event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-apply-coupon' ).on( 'click', ( e ) => {\n\t\t\t\te.preventDefault();\n\n\t\t\t\treturn applyCoupon( spFormElem, formData );\n\t\t\t} );\n\n\t\t\t/**\n\t\t\t * Apply a coupon when the \"Enter\" key is pressed while focusing on the input field.\n\t\t\t *\n\t\t\t * @param {Event} e Click event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-coupon-field' ).on( 'keypress', ( e ) => {\n\t\t\t\tif ( 13 !== e.which ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\n\t\t\t\treturn applyCoupon( spFormElem, formData );\n\t\t\t} );\n\n\t\t\t/**\n\t\t\t * Remove a coupon when the \"Remove\" button is clicked.\n\t\t\t *\n\t\t\t * @param {Event} e Click event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-remove-coupon' ).on( 'click', ( e ) => {\n\t\t\t\te.preventDefault();\n\n\t\t\t\treturn removeCoupon( spFormElem, formData );\n\t\t\t} );\n\n\t\t\t/**\n\t\t\t * Update amounts when a multi-plan subscription form updates.\n\t\t\t *\n\t\t\t * @param {Event} e Change event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-multi-sub, .simpay-plan-wrapper select' ).on( 'change', ( e ) => updateMultiSubSelection( e, spFormElem, formData ) );\n\n\t\t\t/**\n\t\t\t * Toggle shipping fields when \"Same billing & shipping info\" is toggled.\n\t\t\t *\n\t\t\t * @param {Event} e Change event.\n\t\t\t */\n\t\t\tspFormElem.find( '.simpay-same-address-toggle' ).on( 'change', ( e ) => toggleShippingAddressFields( spFormElem, formData ) );\n\t\t\ttoggleShippingAddressFields( spFormElem, formData );\n\n\t\t\t/**\n\t\t\t * Toggle a recurring charge (generates a Subscription).\n\t\t\t *\n\t\t\t * @param {Event} e Change event.\n\t\t\t */\n\t\t\tspFormElem.find( 'input[name=\"recurring_amount_toggle\"]' ).on( 'change', ( e ) => {\n\t\t\t\tformData.isRecurring = e.target.checked;\n\t\t\t} );\n\n\t\t\t// Allow further processing.\n\t\t\tbody.trigger( 'simpayBindProFormEventsAndTriggers', [ spFormElem, formData ] );\n\t\t},\n\n\t\t/**\n\t\t * Toggle `is-focused` class on fields to allow for extra CSS styling.\n\t\t *\n\t\t * @param {jQuery} spFormElem Form element jQuery object.\n\t\t * @param {Object} formData Configured form data.\n\t\t */\n\t\tsetOnFieldFocus( spFormElem, formData ) {\n\t\t\tconst fields = spFormElem.find( '.simpay-form-control' );\n\n\t\t\tfields.each( function( i, el ) {\n\t\t\t\tconst field = $( el );\n\n\t\t\t\tfield.on( 'focusin', setFocus );\n\t\t\t\tfield.on( 'focusout', removeFocus );\n\n\t\t\t\t/**\n\t\t\t\t * Add `is-focused` class.\n\t\t\t\t *\n\t\t\t\t * @param {Event} e Event focusin event.\n\t\t\t\t */\n\t\t\t\tfunction setFocus( e ) {\n\t\t\t\t\t$( e.target ).addClass( 'is-focused' );\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Remove `is-focused` class.\n\t\t\t\t *\n\t\t\t\t * @param {Event} e Event focusout event.\n\t\t\t\t */\n\t\t\t\tfunction removeFocus( e ) {\n\t\t\t\t\tconst $el = $( e.target );\n\n\t\t\t\t\t// Wait for DatePicker plugin\n\t\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t\t$el.removeClass( 'is-focused' );\n\n\t\t\t\t\t\tif ( field.val() ) {\n\t\t\t\t\t\t\t$el.addClass( 'is-filled' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$el.removeClass( 'is-filled' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 300 );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Calculate payment amounts.\n\t\t *\n\t\t * @param {Event} e Mixed events. Not used.\n\t\t * @param {jQuery} spFormElem Form element jQuery object.\n\t\t * @param {Object} formData Configured form data.\n\t\t */\n\t\tupdateAmounts( e, spFormElem, formData ) {\n\t\t\tconst {\n\t\t\t\tconvertToDollars,\n\t\t\t\tdebugLog,\n\t\t\t} = window.spShared;\n\n\t\t\ttry {\n\t\t\t\tconst {\n\t\t\t\t\tcart,\n\t\t\t\t} = spFormElem;\n\n\t\t\t\tconst total = cart.getTotal();\n\n\t\t\t\t// Backwards compat.\n\t\t\t\tformData.finalAmount = convertToDollars( total );\n\t\t\t\tformData.stripeParams.amount = total;\n\n\t\t\t\t// Set the same cents value to hidden input for later form submission.\n\t\t\t\tspFormElem.find( '.simpay-amount' ).val( total );\n\n\t\t\t\t// Convert amount to dollars, as the server still expects this.\n\t\t\t\tspFormElem.find( '.simpay-tax-amount' ).val( convertToDollars( cart.getTax() ) );\n\t\t\t} catch ( error ) {\n\t\t\t\tdebugLog( error );\n\t\t\t}\n\t\t},\n\n\t\t...simpayAppProCompat,\n\t};\n\n\tsimpayAppPro.init();\n}( jQuery ) );\n\nwindow.simpayAppPro = simpayAppPro;\n\nexport default simpayAppPro;\n","/* global jQuery, _ */\n\n/**\n * Internal dependencies\n */\nconst { hooks } = window.wpsp;\n\n/**\n * DOM loaded.\n */\nwindow.addEventListener( 'DOMContentLoaded', () => {\n\tconst tabs = document.querySelectorAll( '.simpay-form-tabs-toggles__toggle[role=\"tab\"]' );\n\n\t// Add a click event handler to each tab.\n\tif ( tabs ) {\n\t\t_.each( tabs, ( tab ) => {\n\t\t\ttab.addEventListener( 'click', changeTabs );\n\t\t} );\n\t}\n\n\t// Enable arrow navigation between tabs in the tab list\n\tconst tabList = document.querySelector( '.simpay-form-tabs-toggles[role=\"tablist\"]' );\n\n\tif ( ! tabList ) {\n\t\treturn;\n\t}\n\n\tlet tabFocus = 0;\n\n\t/**\n\t * Move focus with arrow keys.\n\t *\n\t * @since 3.8.0\n\t *\n\t * @param {Event} e Keydown event.\n\t */\n\ttabList.addEventListener( 'keydown', ( e ) => {\n\t\tconst { keyCode } = e;\n\n\t\t// Move right.\n\t\tif ( keyCode === 39 || keyCode === 37 ) {\n\t\t\ttabs[ tabFocus ].setAttribute( 'tabindex', -1 );\n\t\t\t\n\t\t\tif ( keyCode === 39 ) {\n\t\t\t\ttabFocus++;\n\n\t\t\t\t// If we're at the end, go to the start.\n\t\t\t\tif ( tabFocus >= tabs.length ) {\n\t\t\t\t\ttabFocus = 0;\n\t\t\t\t}\n\n\t\t\t\t// Move left.\n\t\t\t} else if ( keyCode === 37 ) {\n\t\t\t\ttabFocus--;\n\n\t\t\t\t// If we're at the start, move to the end.\n\t\t\t\tif ( tabFocus < 0 ) {\n\t\t\t\t\ttabFocus = tabs.length - 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttabs[ tabFocus ].setAttribute( 'tabindex', 0 );\n\t\t\ttabs[ tabFocus ].focus();\n\t\t}\n\t} );\n} );\n\n/**\n * Change a tab.\n *\n * @param {Event} click Event.\n */\nfunction changeTabs( e ) {\n\te.preventDefault();\n\n\tconst target = e.target;\n\tconst parent = target.parentNode;\n\tconst grandparent = parent.parentNode;\n\n\t// Remove all current selected tabs.\n\tconst tabs = parent.querySelectorAll( '[aria-selected=\"true\"]' );\n\n\tjQuery.each( tabs, ( i, el ) => {\n\t\tel.classList.remove( 'is-active' );\n\t\tel.setAttribute( 'aria-selected', false );\n\t} );\n\n\t// Set this tab as selected.\n\ttarget.setAttribute( 'aria-selected', true );\n\ttarget.classList.add( 'is-active' );\n\n\t// Hide all tab panels.\n\tconst panels = grandparent.querySelectorAll( '[role=\"tabpanel\"]' )\n\n\tjQuery.each( panels, ( i, el ) => {\n\t\tel.setAttribute( 'hidden', true );\n\t} );\n\n\tconst panelId = target.getAttribute( 'aria-controls' );\n\n\t// Show the selected panel.\n\tgrandparent.parentNode\n\t\t.querySelector( `#${ panelId }`)\n\t\t.removeAttribute( 'hidden' );\n}\n"],"sourceRoot":""}