{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/src/frontend.js","webpack:///./js/src/payment-element/request.js","webpack:///./js/src/payment-element/stripe-payments-handler.js","webpack:///./node_modules/whatwg-fetch/fetch.js"],"names":["window","GFStripe","gform","extensions","styles","gravityformsstripe","$","args","prop","hasOwnProperty","form","activeFeed","GFCCField","stripeResponse","hasPaymentIntent","stripePaymentHandler","cardStyle","formId","componentStyles","Object","keys","length","JSON","parse","stringify","pageInstance","setComponentStyleValue","key","value","themeFrameworkStyles","manualElement","resolvedValue","indexOf","computedValue","getPropertyValue","selector","getComputedStyle","resolvedKey","replace","toLowerCase","trim","setComponentStyles","obj","objKey","parentKey","document","getElementById","firstFormControl","querySelector","forEach","objPath","init","isCreditCardOnPage","stripe_payment","GFStripeObj","feedActivated","hidePostalCode","apiKey","ccFieldId","addAction","feeds","i","addonSlug","isActivated","j","feedId","gformCalculateTotalPrice","StripePaymentsHandler","stripe","Stripe","elements","address_zip","card","_destroyed","destroy","next","remove","create","classes","cardClasses","style","hide","html","gforms_stripe_frontend_strings","requires_action","jQuery","append","gf_global","spinnerUrl","$iconSpan","isThemeFrameWork","console","log","removeClass","addClass","scaActionHandler","mount","attr","on","event","displayStripeCardError","setPublishableKey","getElement","after","no_active_frontend_feed","wp","a11y","speak","resetStripeStatus","isLastPage","addFilter","total","getOrderData","paymentAmount","paymentAmountInfo","getProductFieldPrice","price","qty","setupFeeInfo","setupFee","stripe_connect_enabled","updatePaymentAmount","order","skipElementsHandler","val","sourcePage","parseInt","targetPage","data","gformIsHidden","maybeHitRateLimits","invisibleCaptchaPending","preventDefault","maybeAddSpinner","injectHoneypot","validate","submit","type","createPaymentMethod","createToken","ccInputPrefix","cc","number","find","exp_month","exp_year","cvc","name","status","response","responseHandler","payment_element_intent_failure","validationMessage","prepend","fieldId","GFMergeTag","getMergeTagValue","getBillingAddressMergeTag","field","ccInputSuffixes","input","ccNumber","cardType","gformFindCardType","cardLabels","slice","toJSON","elementsResponseHandler","currency","applyFilters","amount","gf_currency_config","decimals","gformRoundPrice","error","paymentMethod","last4","brand","ajax","async","url","ajaxurl","dataType","method","action","nonce","create_payment_intent_nonce","payment_method","feed_id","success","token","payment_intent","id","currentResponse","updatedToken","retrievePaymentIntent","client_secret","then","result","paymentIntent","handleCardAction","scaSuccess","handleCardPayment","targetPageInput","isConversationalForm","convoForm","currentPage","getCurrentPageNumber","ccPage","currentPageInput","isAjax","gformAddSpinner","$spinnerTarget","cardErrors","message","cardholderName","tokenData","address_line1","replaceMergeTags","address_line2","address_city","address_state","address_country","country","countryFieldValue","code","line1","line2","city","state","postal_code","billing_details","address","cardErrorCount","reCaptcha","reCaptchaResponse","target","shouldInjectHoneypot","isFormSubmission","isSaveContinue","isHeadlessBrowser","hashInput","version_hash","insertAdjacentHTML","dataset","formid","nodes","getNodes","targetEl","_phantom","callPhantom","__phantomas","Buffer","emit","spawn","webdriver","_selenium","_Selenium_IDE_Recorder","callSelenium","__nightmare","domAutomation","domAutomationController","__webdriver_evaluate","__selenium_evaluate","__webdriver_script_function","__webdriver_script_func","__webdriver_script_fn","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__driver_evaluate","__selenium_unwrapped","__fxdriver_unwrapped","documentElement","getAttribute","convert","node","custom","selectorString","querySelectorAll","convertElements","converted","unshift","request","isJson","delete","options","credentials","body","headers","URL","searchParams","set","toString","fetch","json","constructor","draftId","validateForm","bind","handlelinkEmailFieldChange","reInitiateLinkWithEmailAddress","clearErrors","initStripe","link","link_email_field_id","mountLink","mountCard","bindEvents","emailField","getStripeCoupon","coupons","stripeCoupons","getStripeCouponCode","getStripeCouponInput","coupon","couponInput","bindStripeCoupon","addEventListener","handleCouponChange","setAttribute","updateStripeCoupon","coupon_code","get_stripe_coupon_nonce","initialPaymentInformation","initial_payment_information","appearance","payment_method_types","values","linkDiv","createElement","classList","add","before","String","match","emailAddress","undefined","defaultValues","email","complete","failWithMessage","payment_incomplete","getFormData","failed_to_confirm_intent","intent","redirect_url","location","href","resume_token","is_valid","resetFormValidationErrors","hasTrial","isValidCoupon","coupon_invalid","confirm","payment_amount","formData","FormData","appendParams","validate_form_nonce","newAmount","mode","Math","round","update","applyStripeCoupon","percentage_off","amount_off","clientSecret","isAjaxEmbed","submitError","paymentData","confirmParams","return_url","payment_method_data","redirect","paymentResult","confirmSetup","e","confirmPayment","handlePayment","handleFailedPayment","errorMessage","delete_draft_nonce","rate_limiting_nonce","error_count","linkContainer","el","failed_to_process_payment","_gformPriceFields","setUpFieldId","productTotal","isTrial","recurringAmount","gformCalculateProductPrice"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;;;;AAIA;;AAEAA,OAAOC,QAAP,GAAkB,IAAlB;;AAEAC,MAAMC,UAAN,GAAmBD,MAAMC,UAAN,IAAoB,EAAvC;AACAD,MAAMC,UAAN,CAAiBC,MAAjB,GAA0BF,MAAMC,UAAN,CAAiBC,MAAjB,IAA2B,EAArD;AACAF,MAAMC,UAAN,CAAiBC,MAAjB,CAAwBC,kBAAxB,GAA6CH,MAAMC,UAAN,CAAiBC,MAAjB,CAAwBC,kBAAxB,IAA8C,EAA3F;;AAEA,CAAC,UAA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AWT,aAAX,GAA2BM,QAA3B;AACA,GAFD,MAEO;AACN,QAAKG,KAAL,CAAWT,aAAX,GAA2B,KAAKS,KAAL,CAAWgR,eAAX,GAA6BnR,QAAxD;AACA;;AAED,SAAO,KAAKG,KAAZ;AACA;;AAED;;;;;;;;AAQAwP,aAAajW,MAAb,EAAsB;AACrB,SAAOoE,OAAQ,uBAAuBpE,MAA/B,EAAwCI,MAAxC,IAAkD,CAAzD;AACA;AAhtByC,C;;;;;;;;;;;;ACD3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEO;AACP;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,qDAAqD;AACrD,OAAO;AACP;AACA,OAAO;AACP,4EAA4E;AAC5E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,qBAAqB;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,qCAAqC,0BAA0B;AAC/D;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,0BAA0B,eAAe;AACtE;;AAEO;AACP;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA","file":"./js/frontend.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 = 0);\n","/**\n * Front-end Script\n */\n\nimport StripePaymentsHandler from \"./payment-element/stripe-payments-handler\";\n\nwindow.GFStripe = null;\n\ngform.extensions = gform.extensions || {};\ngform.extensions.styles = gform.extensions.styles || {};\ngform.extensions.styles.gravityformsstripe = gform.extensions.styles.gravityformsstripe || {};\n\n(function ($) {\n\n\tGFStripe = function (args) {\n\n\t\tfor ( var prop in args ) {\n\t\t\tif ( args.hasOwnProperty( prop ) )\n\t\t\t\tthis[ prop ] = args[ prop ];\n\t\t}\n\n\t\tthis.form = null;\n\n\t\tthis.activeFeed = null;\n\n\t\tthis.GFCCField = null;\n\n\t\tthis.stripeResponse = null;\n\n\t\tthis.hasPaymentIntent = false;\n\n\t\tthis.stripePaymentHandler = null;\n\n\t\tthis.cardStyle = this.cardStyle || {};\n\n\t\tgform.extensions.styles.gravityformsstripe[ this.formId ] = gform.extensions.styles.gravityformsstripe[ this.formId ] || {};\n\n\t\tconst componentStyles = Object.keys( this.cardStyle ).length > 0 ? JSON.parse( JSON.stringify( this.cardStyle ) ) : gform.extensions.styles.gravityformsstripe[ this.formId ][ this.pageInstance ] || {};\n\n\t\tthis.setComponentStyleValue = function ( key, value, themeFrameworkStyles, manualElement ) {\n\t\t\tlet resolvedValue = '';\n\n\t\t\t// If the value provided is a custom property let's begin\n\t\t\tif ( value.indexOf( '--' ) === 0 ) {\n\t\t\t\tconst computedValue = themeFrameworkStyles.getPropertyValue( value );\n\n\t\t\t\t// If we have a computed end value from the custom property, let's use that\n\t\t\t\tif ( computedValue ) {\n\t\t\t\t\tresolvedValue = computedValue;\n\t\t\t\t}\n\t\t\t\t\t// Otherwise, let's use a provided element or the form wrapper\n\t\t\t\t// along with the key to nab the computed end value for the CSS property\n\t\t\t\telse {\n\t\t\t\t\tconst selector = manualElement ? getComputedStyle( manualElement ) : themeFrameworkStyles;\n\t\t\t\t\tconst resolvedKey = key === 'fontSmoothing' ? '-webkit-font-smoothing' : key;\n\t\t\t\t\tresolvedValue = selector.getPropertyValue( resolvedKey.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase() );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Otherwise let's treat the provided value as the actual CSS value wanted\n\t\t\telse {\n\t\t\t\tresolvedValue = value;\n\t\t\t}\n\n\t\t\treturn resolvedValue.trim();\n\t\t};\n\n\t\tthis.setComponentStyles = function ( obj, objKey, parentKey ) {\n\t\t\t// If our object doesn't have any styles specified, let's bail here\n\t\t\tif ( Object.keys( obj ).length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Grab the computed styles for the form, which the global CSS API and theme framework are scoped to\n\t\t\tconst form = document.getElementById( 'gform_' + this.formId );\n\t\t\tconst themeFrameworkStyles = getComputedStyle( form );\n\n\t\t\t// Grab the first form control in the form for fallback CSS property value computation\n\t\t\tconst firstFormControl = form.querySelector( '.gfield input' )\n\n\t\t\t// Note, this currently only supports three levels deep of object nesting.\n\t\t\tObject.keys( obj ).forEach( ( key ) => {\n\t\t\t\t// Handling of keys that are objects with additional key/value pairs\n\t\t\t\tif ( typeof obj[ key ] === 'object' ) {\n\n\t\t\t\t\t// Create object for top level key\n\t\t\t\t\tif ( !parentKey ) {\n\t\t\t\t\t\tthis.cardStyle[ key ] = {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create object for second level key\n\t\t\t\t\tif ( parentKey ) {\n\t\t\t\t\t\tthis.cardStyle[ parentKey ][ key ] = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst objPath = parentKey ? parentKey : key;\n\n\t\t\t\t\t// Recursively pass each key's object through our method for continued processing\n\t\t\t\t\tthis.setComponentStyles( obj[ key ], key, objPath );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Handling of keys that are not objects and need their value to be set\n\t\t\t\tif ( typeof obj[ key ] !== 'object' ) {\n\t\t\t\t\tlet value = '';\n\t\t\t\t\t// Handling of nested keys\n\t\t\t\t\tif ( parentKey ) {\n\t\t\t\t\t\tif ( objKey && objKey !== parentKey ) {\n\t\t\t\t\t\t\t// Setting value for a key three levels into the object\n\t\t\t\t\t\t\tvalue = this.setComponentStyleValue( key, componentStyles[ parentKey ][ objKey ][ key ], themeFrameworkStyles, firstFormControl );\n\t\t\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\t\t\tthis.cardStyle[ parentKey ][ objKey ][ key ] = value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Setting value for a key two levels into the object\n\t\t\t\t\t\t\tvalue = this.setComponentStyleValue( key, componentStyles[ parentKey ][ key ], themeFrameworkStyles, firstFormControl );\n\t\t\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\t\t\tthis.cardStyle[ parentKey ][ key ] = value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Setting value for a key one level into the object\n\t\t\t\t\t\tvalue = this.setComponentStyleValue( key, componentStyles[ key ], themeFrameworkStyles, firstFormControl );\n\t\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\t\tthis.cardStyle[ key ] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\n\t\tthis.init = async function () {\n\n\t\t\tthis.setComponentStyles( componentStyles );\n\n\t\t\tif ( !this.isCreditCardOnPage() ) {\n\t\t\t\tif ( this.stripe_payment === 'stripe.js' || ( this.stripe_payment === 'elements' && !$( '#gf_stripe_response' ).length ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar GFStripeObj = this, activeFeed = null, feedActivated = false,\n\t\t\t\thidePostalCode = false, apiKey = this.apiKey;\n\n\t\t\tthis.form = $( '#gform_' + this.formId );\n\t\t\tthis.GFCCField = $( '#input_' + this.formId + '_' + this.ccFieldId + '_1' );\n\n\t\t\tgform.addAction( 'gform_frontend_feeds_evaluated', async function ( feeds, formId ) {\n\t\t\t\tif ( formId !== GFStripeObj.formId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tactiveFeed = null;\n\t\t\t\tfeedActivated = false;\n\t\t\t\thidePostalCode = false;\n\n\t\t\t\tfor ( var i = 0; i < Object.keys( feeds ).length; i++ ) {\n\t\t\t\t\tif ( feeds[ i ].addonSlug === 'gravityformsstripe' && feeds[ i ].isActivated ) {\n\t\t\t\t\t\tfeedActivated = true;\n\n\t\t\t\t\t\tfor ( var j = 0; j < Object.keys( GFStripeObj.feeds ).length; j++ ) {\n\t\t\t\t\t\t\tif ( GFStripeObj.feeds[ j ].feedId === feeds[ i ].feedId ) {\n\t\t\t\t\t\t\t\tactiveFeed = GFStripeObj.feeds[ j ];\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapiKey = activeFeed.hasOwnProperty( 'apiKey' ) ? activeFeed.apiKey : GFStripeObj.apiKey;\n\t\t\t\t\t\tGFStripeObj.activeFeed = activeFeed;\n\n\t\t\t\t\t\tgformCalculateTotalPrice( formId );\n\n\t\t\t\t\t\tif ( GFStripeObj.stripe_payment == 'payment_element' ) {\n\t\t\t\t\t\t\tGFStripeObj.stripePaymentHandler = new StripePaymentsHandler( apiKey, GFStripeObj );\n\t\t\t\t\t\t} else if ( GFStripeObj.stripe_payment === 'elements' ) {\n\t\t\t\t\t\t\tstripe = Stripe( apiKey );\n\t\t\t\t\t\t\telements = stripe.elements();\n\n\t\t\t\t\t\t\thidePostalCode = activeFeed.address_zip !== '';\n\n\t\t\t\t\t\t\t// If Stripe Card is already on the page (AJAX failed validation, or switch frontend feeds),\n\t\t\t\t\t\t\t// Destroy the card field so we can re-initiate it.\n\t\t\t\t\t\t\tif ( card != null && card.hasOwnProperty( '_destroyed' ) && card._destroyed === false ) {\n\t\t\t\t\t\t\t\tcard.destroy();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Clear card field errors before initiate it.\n\t\t\t\t\t\t\tif ( GFStripeObj.GFCCField.next( '.validation_message' ).length ) {\n\t\t\t\t\t\t\t\tGFStripeObj.GFCCField.next( '.validation_message' ).remove();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcard = elements.create(\n\t\t\t\t\t\t\t\t'card',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tclasses: GFStripeObj.cardClasses,\n\t\t\t\t\t\t\t\t\tstyle: GFStripeObj.cardStyle,\n\t\t\t\t\t\t\t\t\thidePostalCode: hidePostalCode\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( $( '.gform_stripe_requires_action' ).length ) {\n\t\t\t\t\t\t\t\tif ( $( '.ginput_container_creditcard > div' ).length === 2 ) {\n\t\t\t\t\t\t\t\t\t// Cardholder name enabled.\n\t\t\t\t\t\t\t\t\t$( '.ginput_container_creditcard > div:last' ).hide();\n\t\t\t\t\t\t\t\t\t$( '.ginput_container_creditcard > div:first' ).html( '

' + gforms_stripe_frontend_strings.requires_action + '

' );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$( '.ginput_container_creditcard' ).html( '

' + gforms_stripe_frontend_strings.requires_action + '

' );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Add a spinner next to the validation message and disable the submit button until we are over with 3D Secure.\n\t\t\t\t\t\t\t\tif ( jQuery( '#gform_' + formId + '_validation_container h2 .gform_ajax_spinner').length <= 0 ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#gform_' + formId + '_validation_container h2' ).append( '\"\"');\n\t\t\t\t\t\t\t\t\tjQuery( '#gform_submit_button_' + formId ).prop( 'disabled' , true );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Update legacy close icon to an info icon.\n\t\t\t\t\t\t\t\tconst $iconSpan = jQuery( '#gform_' + formId + '_validation_container h2 .gform-icon.gform-icon--close' );\n\t\t\t\t\t\t\t\tconst isThemeFrameWork = jQuery( '.gform-theme--framework' ).length;\n\t\t\t\t\t\t\t\tconsole.log( isThemeFrameWork );\n\t\t\t\t\t\t\t\tconsole.log( $iconSpan );\n\t\t\t\t\t\t\t\tif ( $iconSpan.length && ! isThemeFrameWork ) {\n\t\t\t\t\t\t\t\t\t$iconSpan.removeClass( 'gform-icon--close' ).addClass( 'gform-icon--info' );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tGFStripeObj.scaActionHandler( stripe, formId );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcard.mount( '#' + GFStripeObj.GFCCField.attr( 'id' ) );\n\n\t\t\t\t\t\t\t\tcard.on( 'change', function ( event ) {\n\t\t\t\t\t\t\t\t\tGFStripeObj.displayStripeCardError( event );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( GFStripeObj.stripe_payment == 'stripe.js' ) {\n\t\t\t\t\t\t\tStripe.setPublishableKey( apiKey );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak; // allow only one active feed.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( !feedActivated ) {\n\t\t\t\t\tif ( GFStripeObj.stripe_payment === 'elements' || GFStripeObj.stripe_payment === 'payment_element' ) {\n\t\t\t\t\t\tif ( elements != null && card === elements.getElement( 'card' ) ) {\n\t\t\t\t\t\t\tcard.destroy();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( GFStripeObj.stripePaymentHandler !== null ) {\n\t\t\t\t\t\t\tGFStripeObj.stripePaymentHandler.destroy();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( !GFStripeObj.GFCCField.next( '.validation_message' ).length ) {\n\t\t\t\t\t\t\tGFStripeObj.GFCCField.after( '
' + gforms_stripe_frontend_strings.no_active_frontend_feed + '
' );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twp.a11y.speak( gforms_stripe_frontend_strings.no_active_frontend_feed );\n\t\t\t\t\t}\n\n\t\t\t\t\t// remove Stripe fields and form status when Stripe feed deactivated\n\t\t\t\t\tGFStripeObj.resetStripeStatus( GFStripeObj.form, formId, GFStripeObj.isLastPage() );\n\t\t\t\t\tapiKey = GFStripeObj.apiKey;\n\t\t\t\t\tGFStripeObj.activeFeed = null;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\t// Set priority to 51 so it will be triggered after the coupons add-on\n\t\t\tgform.addFilter( 'gform_product_total', function ( total, formId ) {\n\n\t\t\t\tif ( GFStripeObj.stripe_payment == 'payment_element' && GFStripeObj.stripePaymentHandler !== null ) {\n\t\t\t\t\tGFStripeObj.stripePaymentHandler.getOrderData( total, formId );\n\t\t\t\t}\n\n\t\t\t\tif ( ! GFStripeObj.activeFeed ) {\n\t\t\t\t\twindow['gform_stripe_amount_' + formId] = 0;\n\t\t\t\t\treturn total;\n\t\t\t\t}\n\n\t\t\t\tif ( GFStripeObj.activeFeed.paymentAmount !== 'form_total' ) {\n\n\t\t\t\t\tconst paymentAmountInfo = GFStripeObj.getProductFieldPrice( formId, GFStripeObj.activeFeed.paymentAmount );\n\t\t\t\t\twindow[ 'gform_stripe_amount_' + formId ] = paymentAmountInfo.price * paymentAmountInfo.qty;\n\n\t\t\t\t\tif ( GFStripeObj.activeFeed.hasOwnProperty('setupFee') ) {\n\t\t\t\t\t\tconst setupFeeInfo = GFStripeObj.getProductFieldPrice( formId, GFStripeObj.activeFeed.setupFee );\n\t\t\t\t\t\twindow['gform_stripe_amount_' + formId] += setupFeeInfo.price * setupFeeInfo.qty;\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\twindow[ 'gform_stripe_amount_' + formId ] = total;\n\t\t\t\t}\n\n\t\t\t\t// Update elements payment amount if payment element is enabled.\n\t\t\t\tif (\n\t\t\t\t\tGFStripeObj.stripe_payment == 'payment_element'\n\t\t\t\t\t&& GFStripeObj.stripePaymentHandler !== null &&\n\t\t\t\t\tGFStripeObj.stripePaymentHandler.elements !== null &&\n\t\t\t\t\tgforms_stripe_frontend_strings.stripe_connect_enabled === \"1\"\n\t\t\t\t) {\n\t\t\t\t\tGFStripeObj.stripePaymentHandler.updatePaymentAmount( GFStripeObj.stripePaymentHandler.order.paymentAmount )\n\t\t\t\t}\n\n\t\t\t\treturn total;\n\n\t\t\t}, 51 );\n\n\t\t\tswitch ( this.stripe_payment ) {\n\t\t\t\tcase 'elements':\n\t\t\t\t\tvar stripe = null,\n\t\t\t\t\t\telements = null,\n\t\t\t\t\t\tcard = null,\n\t\t\t\t\t\tskipElementsHandler = false;\n\n\t\t\t\t\tif ( $( '#gf_stripe_response' ).length ) {\n\t\t\t\t\t\tthis.stripeResponse = JSON.parse( $( '#gf_stripe_response' ).val() );\n\n\t\t\t\t\t\tif ( this.stripeResponse.hasOwnProperty( 'client_secret' ) ) {\n\t\t\t\t\t\t\tthis.hasPaymentIntent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// bind Stripe functionality to submit event\n\t\t\t$( '#gform_' + this.formId ).on( 'submit', function ( event ) {\n\n\t\t\t\t// Don't proceed with payment logic if clicking on the Previous button.\n\t\t\t\tlet skipElementsHandler = false;\n\t\t\t\tconst sourcePage = parseInt( $( '#gform_source_page_number_' + GFStripeObj.formId ).val(), 10 )\n\t\t\t\tconst targetPage = parseInt( $( '#gform_target_page_number_' + GFStripeObj.formId ).val(), 10 );\n\t\t\t\tif ( ( sourcePage > targetPage && targetPage !== 0 ) ) {\n\t\t\t\t\tskipElementsHandler = true;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tskipElementsHandler\n\t\t\t\t\t|| !feedActivated\n\t\t\t\t\t|| $( this ).data( 'gfstripesubmitting' )\n\t\t\t\t\t|| $( '#gform_save_' + GFStripeObj.formId ).val() == 1\n\t\t\t\t\t|| ( !GFStripeObj.isLastPage() && 'elements' !== GFStripeObj.stripe_payment )\n\t\t\t\t\t|| gformIsHidden( GFStripeObj.GFCCField )\n\t\t\t\t\t|| GFStripeObj.maybeHitRateLimits()\n\t\t\t\t\t|| GFStripeObj.invisibleCaptchaPending()\n\t\t\t\t\t|| 'payment_element' === GFStripeObj.stripe_payment && window[ 'gform_stripe_amount_' + formId ] === 0\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t$( this ).data( 'gfstripesubmitting', true );\n\t\t\t\t\tGFStripeObj.maybeAddSpinner();\n\t\t\t\t}\n\n\n\t\t\t\tswitch ( GFStripeObj.stripe_payment ) {\n\t\t\t\t\tcase 'payment_element':\n\t\t\t\t\t\tGFStripeObj.injectHoneypot( event );\n\t\t\t\t\t\tGFStripeObj.stripePaymentHandler.validate( event );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'elements':\n\t\t\t\t\t\tGFStripeObj.form = $( this );\n\n\t\t\t\t\t\tif ( ( GFStripeObj.isLastPage() && !GFStripeObj.isCreditCardOnPage() ) || gformIsHidden( GFStripeObj.GFCCField ) || skipElementsHandler ) {\n\t\t\t\t\t\t\t$( this ).submit();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( activeFeed.type === 'product' ) {\n\t\t\t\t\t\t\t// Create a new payment method when every time the Stripe Elements is resubmitted.\n\t\t\t\t\t\t\tGFStripeObj.createPaymentMethod( stripe, card );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tGFStripeObj.createToken( stripe, card );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'stripe.js':\n\t\t\t\t\t\tvar form = $( this ),\n\t\t\t\t\t\t\tccInputPrefix = 'input_' + GFStripeObj.formId + '_' + GFStripeObj.ccFieldId + '_',\n\t\t\t\t\t\t\tcc = {\n\t\t\t\t\t\t\t\tnumber: form.find( '#' + ccInputPrefix + '1' ).val(),\n\t\t\t\t\t\t\t\texp_month: form.find( '#' + ccInputPrefix + '2_month' ).val(),\n\t\t\t\t\t\t\t\texp_year: form.find( '#' + ccInputPrefix + '2_year' ).val(),\n\t\t\t\t\t\t\t\tcvc: form.find( '#' + ccInputPrefix + '3' ).val(),\n\t\t\t\t\t\t\t\tname: form.find( '#' + ccInputPrefix + '5' ).val()\n\t\t\t\t\t\t\t};\n\n\n\t\t\t\t\t\tGFStripeObj.form = form;\n\n\t\t\t\t\t\tStripe.card.createToken( cc, function ( status, response ) {\n\t\t\t\t\t\t\tGFStripeObj.responseHandler( status, response );\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\t// Show validation message if a payment element payment intent failed and we coulnd't tell until the page has been reloaded\n\t\t\tif ( 'payment_element_intent_failure' in GFStripeObj && GFStripeObj.payment_element_intent_failure ) {\n\t\t\t\tconst validationMessage = jQuery( '

' + gforms_stripe_frontend_strings.payment_element_intent_failure + '

' );\n\t\t\t\tjQuery( '#gform_wrapper_' + GFStripeObj.formId ).prepend( validationMessage );\n\t\t\t}\n\t\t};\n\n\t\tthis.getProductFieldPrice = function ( formId, fieldId ) {\n\n\t\t\tvar price = GFMergeTag.getMergeTagValue( formId, fieldId, ':price' ),\n\t\t\t\tqty = GFMergeTag.getMergeTagValue( formId, fieldId, ':qty' );\n\n\t\t\tif ( typeof price === 'string' ) {\n\t\t\t\tprice = GFMergeTag.getMergeTagValue( formId, fieldId + '.2', ':price' );\n\t\t\t\tqty = GFMergeTag.getMergeTagValue( formId, fieldId + '.3', ':qty' );\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprice: price,\n\t\t\t\tqty: qty\n\t\t\t};\n\t\t}\n\n\t\tthis.getBillingAddressMergeTag = function (field) {\n\t\t\tif (field === '') {\n\t\t\t\treturn '';\n\t\t\t} else {\n\t\t\t\treturn '{:' + field + ':value}';\n\t\t\t}\n\t\t};\n\n\t\tthis.responseHandler = function (status, response) {\n\n\t\t\tvar form = this.form,\n\t\t\t\tccInputPrefix = 'input_' + this.formId + '_' + this.ccFieldId + '_',\n\t\t\t\tccInputSuffixes = ['1', '2_month', '2_year', '3', '5'];\n\n\t\t\t// remove \"name\" attribute from credit card inputs\n\t\t\tfor (var i = 0; i < ccInputSuffixes.length; i++) {\n\n\t\t\t\tvar input = form.find('#' + ccInputPrefix + ccInputSuffixes[i]);\n\n\t\t\t\tif (ccInputSuffixes[i] == '1') {\n\n\t\t\t\t\tvar ccNumber = $.trim(input.val()),\n\t\t\t\t\t\tcardType = gformFindCardType(ccNumber);\n\n\t\t\t\t\tif (typeof this.cardLabels[cardType] != 'undefined')\n\t\t\t\t\t\tcardType = this.cardLabels[cardType];\n\n\t\t\t\t\tform.append($('').val(ccNumber.slice(-4)));\n\t\t\t\t\tform.append($('').val(cardType));\n\n\t\t\t\t}\n\n\t\t\t\t// name attribute is now removed from markup in GFStripe::add_stripe_inputs()\n\t\t\t\t//input.attr( 'name', null );\n\n\t\t\t}\n\n\t\t\t// append stripe.js response\n\t\t\tform.append($('').val($.toJSON(response)));\n\n\t\t\t// submit the form\n\t\t\tform.submit();\n\n\t\t};\n\n\t\tthis.elementsResponseHandler = function (response) {\n\n\t\t\tvar form = this.form,\n\t\t\t\tGFStripeObj = this,\n\t\t\t\tactiveFeed = this.activeFeed,\n\t\t\t currency = gform.applyFilters( 'gform_stripe_currency', this.currency, this.formId ),\n\t\t\t\tamount = (0 === gf_global.gf_currency_config.decimals) ? window['gform_stripe_amount_' + this.formId] : gformRoundPrice( window['gform_stripe_amount_' + this.formId] * 100 );\n\n\t\t\tif (response.error) {\n\t\t\t\t// display error below the card field.\n\t\t\t\tthis.displayStripeCardError(response);\n\t\t\t\t// when Stripe response contains errors, stay on page\n\t\t\t\t// but remove some elements so the form can be submitted again\n\t\t\t\t// also remove last_4 and card type if that already exists (this happens when people navigate back to previous page and submit an empty CC field)\n\t\t\t\tthis.resetStripeStatus(form, this.formId, this.isLastPage());\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this.hasPaymentIntent) {\n\t\t\t\t// append stripe.js response\n\t\t\t\tif (!$('#gf_stripe_response').length) {\n\t\t\t\t\tform.append($('').val($.toJSON(response)));\n\t\t\t\t} else {\n\t\t\t\t\t$('#gf_stripe_response').val($.toJSON(response));\n\t\t\t\t}\n\n\t\t\t\tif (activeFeed.type === 'product') {\n\t\t\t\t\t//set last 4\n\t\t\t\t\tform.append($('').val(response.paymentMethod.card.last4));\n\n\t\t\t\t\t// set card type\n\t\t\t\t\tform.append($('').val(response.paymentMethod.card.brand));\n\t\t\t\t\t// Create server side payment intent.\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\turl: gforms_stripe_frontend_strings.ajaxurl,\n\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\taction: \"gfstripe_create_payment_intent\",\n\t\t\t\t\t\t\tnonce: gforms_stripe_frontend_strings.create_payment_intent_nonce,\n\t\t\t\t\t\t\tpayment_method: response.paymentMethod,\n\t\t\t\t\t\t\tcurrency: currency,\n\t\t\t\t\t\t\tamount: amount,\n\t\t\t\t\t\t\tfeed_id: activeFeed.feedId\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\t\tif (response.success) {\n\t\t\t\t\t\t\t\t// populate the stripe_response field again.\n\t\t\t\t\t\t\t\tif (!$('#gf_stripe_response').length) {\n\t\t\t\t\t\t\t\t\tform.append($('').val($.toJSON(response.data)));\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$('#gf_stripe_response').val($.toJSON(response.data));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// submit the form\n\t\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresponse.error = response.data;\n\t\t\t\t\t\t\t\tdelete response.data;\n\t\t\t\t\t\t\t\tGFStripeObj.displayStripeCardError(response);\n\t\t\t\t\t\t\t\tGFStripeObj.resetStripeStatus(form, GFStripeObj.formId, GFStripeObj.isLastPage());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tform.append($('').val(response.token.card.last4));\n\t\t\t\t\tform.append($('').val(response.token.card.brand));\n\t\t\t\t\tform.submit();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (activeFeed.type === 'product') {\n\t\t\t\t\tif (response.hasOwnProperty('paymentMethod')) {\n\t\t\t\t\t\t$('#gf_stripe_credit_card_last_four').val(response.paymentMethod.card.last4);\n\t\t\t\t\t\t$('#stripe_credit_card_type').val(response.paymentMethod.card.brand);\n\n\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\turl: gforms_stripe_frontend_strings.ajaxurl,\n\t\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\taction: \"gfstripe_update_payment_intent\",\n\t\t\t\t\t\t\t\tnonce: gforms_stripe_frontend_strings.create_payment_intent_nonce,\n\t\t\t\t\t\t\t\tpayment_intent: response.id,\n\t\t\t\t\t\t\t\tpayment_method: response.paymentMethod,\n\t\t\t\t\t\t\t\tcurrency: currency,\n\t\t\t\t\t\t\t\tamount: amount,\n\t\t\t\t\t\t\t\tfeed_id: activeFeed.feedId\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\t\t\tif (response.success) {\n\t\t\t\t\t\t\t\t\t$('#gf_stripe_response').val($.toJSON(response.data));\n\t\t\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tresponse.error = response.data;\n\t\t\t\t\t\t\t\t\tdelete response.data;\n\t\t\t\t\t\t\t\t\tGFStripeObj.displayStripeCardError(response);\n\t\t\t\t\t\t\t\t\tGFStripeObj.resetStripeStatus(form, GFStripeObj.formId, GFStripeObj.isLastPage());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (response.hasOwnProperty('amount')) {\n\t\t\t\t\t\tform.submit();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar currentResponse = JSON.parse($('#gf_stripe_response').val());\n\t\t\t\t\tcurrentResponse.updatedToken = response.token.id;\n\n\t\t\t\t\t$('#gf_stripe_response').val($.toJSON(currentResponse));\n\n\t\t\t\t\tform.append($('').val(response.token.card.last4));\n\t\t\t\t\tform.append($('').val(response.token.card.brand));\n\t\t\t\t\tform.submit();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.scaActionHandler = function (stripe, formId) {\n\t\t\tif ( ! $('#gform_' + formId).data('gfstripescaauth') ) {\n\t\t\t\t$('#gform_' + formId).data('gfstripescaauth', true);\n\n\t\t\t\tvar GFStripeObj = this, response = JSON.parse($('#gf_stripe_response').val());\n\t\t\t\tif (this.activeFeed.type === 'product') {\n\t\t\t\t\t// Prevent the 3D secure auth from appearing twice, so we need to check if the intent status first.\n\t\t\t\t\tstripe.retrievePaymentIntent(\n\t\t\t\t\t\tresponse.client_secret\n\t\t\t\t\t).then(function(result) {\n\t\t\t\t\t\tif ( result.paymentIntent.status === 'requires_action' ) {\n\t\t\t\t\t\t\tstripe.handleCardAction(\n\t\t\t\t\t\t\t\tresponse.client_secret\n\t\t\t\t\t\t\t).then(function(result) {\n\t\t\t\t\t\t\t\tvar currentResponse = JSON.parse($('#gf_stripe_response').val());\n\t\t\t\t\t\t\t\tcurrentResponse.scaSuccess = true;\n\n\t\t\t\t\t\t\t\t$('#gf_stripe_response').val($.toJSON(currentResponse));\n\n\t\t\t\t\t\t\t\tGFStripeObj.maybeAddSpinner();\n\t\t\t\t\t\t\t\t// Enable the submit button, which was disabled before displaying the SCA warning message, so we can submit the form.\n\t\t\t\t\t\t\t\tjQuery( '#gform_submit_button_' + formId ).prop( 'disabled' , false );\n\t\t\t\t\t\t\t\t$('#gform_' + formId).data('gfstripescaauth', false);\n\t\t\t\t\t\t\t\t$('#gform_' + formId).data('gfstripesubmitting', true).submit();\n\t\t\t\t\t\t\t\t// There are a couple of seconds delay where the button is available for clicking before the thank you page is displayed,\n\t\t\t\t\t\t\t\t// Disable the button so the user will not think it needs to be clicked again.\n\t\t\t\t\t\t\t\tjQuery( '#gform_submit_button_' + formId ).prop( 'disabled' , true );\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tstripe.retrievePaymentIntent(\n\t\t\t\t\t\tresponse.client_secret\n\t\t\t\t\t).then(function(result) {\n\t\t\t\t\t\tif ( result.paymentIntent.status === 'requires_action' ) {\n\t\t\t\t\t\t\tstripe.handleCardPayment(\n\t\t\t\t\t\t\t\tresponse.client_secret\n\t\t\t\t\t\t\t).then(function(result) {\n\t\t\t\t\t\t\t\tGFStripeObj.maybeAddSpinner();\n\t\t\t\t\t\t\t\t$('#gform_' + formId).data('gfstripescaauth', false);\n\t\t\t\t\t\t\t\t$('#gform_' + formId).data('gfstripesubmitting', true).submit();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.isLastPage = function () {\n\n\t\t\tvar targetPageInput = $('#gform_target_page_number_' + this.formId);\n\t\t\tif (targetPageInput.length > 0)\n\t\t\t\treturn targetPageInput.val() == 0;\n\n\t\t\treturn true;\n\t\t};\n\n\t\t/**\n\t\t * @function isConversationalForm\n\t\t * @description Determines if we are on conversational form mode\n\t\t *\n\t\t * @since 5.1.0\n\t\t *\n\t\t * @returns {boolean}\n\t\t */\n\t\tthis.isConversationalForm = function () {\n\t\t\tconst convoForm = $('[data-js=\"gform-conversational-form\"]');\n\n\t\t\treturn convoForm.length > 0;\n\t\t}\n\n\t\t/**\n\t\t * @function isCreditCardOnPage\n\t\t * @description Determines if the credit card field is on the current page\n\t\t *\n\t\t * @since 5.1.0\n\t\t *\n\t\t * @returns {boolean}\n\t\t */\n\t\tthis.isCreditCardOnPage = function () {\n\n\t\t\tvar currentPage = this.getCurrentPageNumber();\n\n\t\t\t// if current page is false or no credit card page number or this is a convo form, assume this is not a multi-page form\n\t\t\tif ( ! this.ccPage || ! currentPage || this.isConversationalForm() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn this.ccPage == currentPage;\n\t\t};\n\n\t\tthis.getCurrentPageNumber = function () {\n\t\t\tvar currentPageInput = $('#gform_source_page_number_' + this.formId);\n\t\t\treturn currentPageInput.length > 0 ? currentPageInput.val() : false;\n\t\t};\n\n\t\tthis.maybeAddSpinner = function () {\n\t\t\tif (this.isAjax)\n\t\t\t\treturn;\n\n\t\t\tif (typeof gformAddSpinner === 'function') {\n\t\t\t\tgformAddSpinner(this.formId);\n\t\t\t} else {\n\t\t\t\t// Can be removed after min Gravity Forms version passes 2.1.3.2.\n\t\t\t\tvar formId = this.formId;\n\n\t\t\t\tif (jQuery('#gform_ajax_spinner_' + formId).length == 0) {\n\t\t\t\t\tvar spinnerUrl = gform.applyFilters('gform_spinner_url', gf_global.spinnerUrl, formId),\n\t\t\t\t\t\t$spinnerTarget = gform.applyFilters('gform_spinner_target_elem', jQuery('#gform_submit_button_' + formId + ', #gform_wrapper_' + formId + ' .gform_next_button, #gform_send_resume_link_button_' + formId), formId);\n\t\t\t\t\t$spinnerTarget.after('\"\"');\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resetStripeStatus = function(form, formId, isLastPage) {\n\t\t\t$('#gf_stripe_response, #gf_stripe_credit_card_last_four, #stripe_credit_card_type').remove();\n\t\t\tform.data('gfstripesubmitting', false);\n $('#gform_ajax_spinner_' + formId).remove();\n\t\t\t// must do this or the form cannot be submitted again\n\t\t\tif (isLastPage) {\n\t\t\t\twindow[\"gf_submitting_\" + formId] = false;\n\t\t\t}\n\t\t};\n\n\t\tthis.displayStripeCardError = function (event) {\n\t\t\tif (event.error && !this.GFCCField.next('.validation_message').length) {\n\t\t\t\tthis.GFCCField.after('
');\n\t\t\t}\n\n\t\t\tvar cardErrors = this.GFCCField.next('.validation_message');\n\n\t\t\tif (event.error) {\n\t\t\t\tcardErrors.html(event.error.message);\n\n\t\t\t\twp.a11y.speak( event.error.message, 'assertive' );\n\t\t\t\t// Hide spinner.\n\t\t\t\tif ( $('#gform_ajax_spinner_' + this.formId).length > 0 ) {\n\t\t\t\t\t$('#gform_ajax_spinner_' + this.formId).remove();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcardErrors.remove();\n\t\t\t}\n\t\t};\n\n\t\tthis.createToken = function (stripe, card) {\n\n\t\t\tconst GFStripeObj = this;\n\t\t\tconst activeFeed = this.activeFeed;\n\t\t\tconst cardholderName = $( '#input_' + GFStripeObj.formId + '_' + GFStripeObj.ccFieldId + '_5' ).val();\n\t\t\tconst tokenData = {\n\t\t\t\t\tname: cardholderName,\n\t\t\t\t\taddress_line1: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_line1)),\n\t\t\t\t\taddress_line2: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_line2)),\n\t\t\t\t\taddress_city: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_city)),\n\t\t\t\t\taddress_state: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_state)),\n\t\t\t\t\taddress_zip: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_zip)),\n\t\t\t\t\taddress_country: GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_country)),\n\t\t\t\t\tcurrency: gform.applyFilters( 'gform_stripe_currency', this.currency, this.formId )\n\t\t\t\t};\n\t\t\tstripe.createToken(card, tokenData).then(function (response) {\n\t\t\t\tGFStripeObj.elementsResponseHandler(response);\n\t\t\t});\n\t\t}\n\n\t\tthis.createPaymentMethod = function (stripe, card, country) {\n\t\t\tvar GFStripeObj = this, activeFeed = this.activeFeed, countryFieldValue = '';\n\n\t\t\tif ( activeFeed.address_country !== '' ) {\n\t\t\t\tcountryFieldValue = GFMergeTag.replaceMergeTags(GFStripeObj.formId, GFStripeObj.getBillingAddressMergeTag(activeFeed.address_country));\n\t\t\t}\n\n\t\t\tif (countryFieldValue !== '' && ( typeof country === 'undefined' || country === '' )) {\n $.ajax({\n async: false,\n url: gforms_stripe_frontend_strings.ajaxurl,\n dataType: 'json',\n method: 'POST',\n data: {\n action: \"gfstripe_get_country_code\",\n nonce: gforms_stripe_frontend_strings.create_payment_intent_nonce,\n country: countryFieldValue,\n feed_id: activeFeed.feedId\n },\n success: function (response) {\n if (response.success) {\n GFStripeObj.createPaymentMethod(stripe, card, response.data.code);\n }\n }\n });\n } else {\n var cardholderName = $('#input_' + this.formId + '_' + this.ccFieldId + '_5').val(),\n\t\t\t\t\tline1 = GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_line1)),\n\t\t\t\t\tline2 = GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_line2)),\n\t\t\t\t\tcity = GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_city)),\n\t\t\t\t\tstate = GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_state)),\n\t\t\t\t\tpostal_code = GFMergeTag.replaceMergeTags(this.formId, this.getBillingAddressMergeTag(activeFeed.address_zip)),\n data = { billing_details: { name: null, address: {} } };\n\n if (cardholderName !== '') {\n \tdata.billing_details.name = cardholderName;\n\t\t\t\t}\n\t\t\t\tif (line1 !== '') {\n\t\t\t\t\tdata.billing_details.address.line1 = line1;\n\t\t\t\t}\n\t\t\t\tif (line2 !== '') {\n\t\t\t\t\tdata.billing_details.address.line2 = line2;\n\t\t\t\t}\n\t\t\t\tif (city !== '') {\n\t\t\t\t\tdata.billing_details.address.city = city;\n\t\t\t\t}\n\t\t\t\tif (state !== '') {\n\t\t\t\t\tdata.billing_details.address.state = state;\n\t\t\t\t}\n\t\t\t\tif (postal_code !== '') {\n\t\t\t\t\tdata.billing_details.address.postal_code = postal_code;\n\t\t\t\t}\n\t\t\t\tif (country !== '') {\n\t\t\t\t\tdata.billing_details.address.country = country;\n\t\t\t\t}\n\n\t\t\t\tif (data.billing_details.name === null) {\n\t\t\t\t\tdelete data.billing_details.name;\n\t\t\t\t}\n\t\t\t\tif (data.billing_details.address === {}) {\n\t\t\t\t\tdelete data.billing_details.address;\n\t\t\t\t}\n\n\t\t\t\tstripe.createPaymentMethod('card', card, data).then(function (response) {\n\t\t\t\t\tif (GFStripeObj.stripeResponse !== null) {\n\t\t\t\t\t\tresponse.id = GFStripeObj.stripeResponse.id;\n\t\t\t\t\t\tresponse.client_secret = GFStripeObj.stripeResponse.client_secret;\n\t\t\t\t\t}\n\n\t\t\t\t\tGFStripeObj.elementsResponseHandler(response);\n\t\t\t\t});\n }\n\t\t};\n\n\t\tthis.maybeHitRateLimits = function() {\n\t\t\tif (this.hasOwnProperty('cardErrorCount')) {\n\t\t\t\tif (this.cardErrorCount >= 5) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\tthis.invisibleCaptchaPending = function () {\n\t\t\tvar form = this.form,\n\t\t\t\treCaptcha = form.find('.ginput_recaptcha');\n\n\t\t\tif (!reCaptcha.length || reCaptcha.data('size') !== 'invisible') {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar reCaptchaResponse = reCaptcha.find('.g-recaptcha-response');\n\n\t\t\treturn !(reCaptchaResponse.length && reCaptchaResponse.val());\n\t\t}\n\n\t\t/**\n\t\t * This is duplicated honeypot logic from core that can be removed once Stripe can consume the core honeypot js.\n\t\t */\n\n\n\t\t/**\n\t\t * @function injectHoneypot\n\t\t * @description Duplicated from core. Injects the honeypot field when appropriate.\n\t\t *\n\t\t * @since 5.0\n\t\t *\n\t\t * @param {jQuery.Event} event Form submission event.\n\t\t */\n\t\tthis.injectHoneypot = ( event ) => {\n\t\t\tconst form = event.target;\n\t\t\tconst shouldInjectHoneypot = ( this.isFormSubmission( form ) || this.isSaveContinue( form ) ) && ! this.isHeadlessBrowser();\n\n\t\t\tif ( shouldInjectHoneypot ) {\n\t\t\t\tconst hashInput = ``;\n\t\t\t\tform.insertAdjacentHTML( 'beforeend', hashInput );\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * @function isSaveContinue\n\t\t * @description Duplicated from core. Determines if this submission is from a Save and Continue click.\n\t\t *\n\t\t * @since 5.0\n\t\t *\n\t\t * @param {HTMLFormElement} form The form that was submitted.\n\t\t *\n\t\t * @return {boolean} Returns true if this submission was initiated via a Save a Continue button click. Returns false otherwise.\n\t\t */\n\t\tthis.isSaveContinue = ( form ) => {\n\t\t\tconst formId = form.dataset.formid;\n\t\t\tconst nodes = this.getNodes( `#gform_save_${ formId }`, true, form, true );\n\t\t\treturn nodes.length > 0 && nodes[ 0 ].value === '1';\n\t\t};\n\n\t\t/**\n\t\t * @function isFormSubmission\n\t\t * @description Duplicated from core. Determines if this is a standard form submission (ie. not a next or previous page submission, and not a save and continue submission).\n\t\t *\n\t\t * @since 5.0\n\t\t *\n\t\t * @param {HTMLFormElement} form The form that was submitted.\n\t\t *\n\t\t * @return {boolean} Returns true if this is a standard form submission. Returns false otherwise.\n\t\t */\n\t\tthis.isFormSubmission = ( form ) => {\n\t\t\tconst formId = form.dataset.formid;\n\t\t\tconst targetEl = this.getNodes( `input[name = \"gform_target_page_number_${ formId }\"]`, true, form, true )[ 0 ];\n\t\t\tif ( 'undefined' === typeof targetEl ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst targetPage = parseInt( targetEl.value );\n\t\t\treturn targetPage === 0;\n\t\t};\n\n\t\t/**\n\t\t * @function isHeadlessBrowser.\n\t\t * @description Determines if the currently browser is headless.\n\t\t *\n\t\t * @since 5.0\n\t\t *\n\t\t * @return {boolean} Returns true for headless browsers. Returns false otherwise.\n\t\t */\n\t\tthis.isHeadlessBrowser = () => {\n\t\t\treturn window._phantom || window.callPhantom || // phantomjs.\n\t\t\t\twindow.__phantomas || // PhantomJS-based web perf metrics + monitoring tool.\n\t\t\t\twindow.Buffer || // nodejs.\n\t\t\t\twindow.emit || // couchjs.\n\t\t\t\twindow.spawn || // rhino.\n\t\t\t\twindow.webdriver || window._selenium || window._Selenium_IDE_Recorder || window.callSelenium || // selenium.\n\t\t\t\twindow.__nightmare ||\n\t\t\t\twindow.domAutomation ||\n\t\t\t\twindow.domAutomationController || // chromium based automation driver.\n\t\t\t\twindow.document.__webdriver_evaluate || window.document.__selenium_evaluate ||\n\t\t\t\twindow.document.__webdriver_script_function || window.document.__webdriver_script_func || window.document.__webdriver_script_fn ||\n\t\t\t\twindow.document.__fxdriver_evaluate ||\n\t\t\t\twindow.document.__driver_unwrapped ||\n\t\t\t\twindow.document.__webdriver_unwrapped ||\n\t\t\t\twindow.document.__driver_evaluate ||\n\t\t\t\twindow.document.__selenium_unwrapped ||\n\t\t\t\twindow.document.__fxdriver_unwrapped ||\n\t\t\t\twindow.document.documentElement.getAttribute( 'selenium' ) ||\n\t\t\t\twindow.document.documentElement.getAttribute( 'webdriver' ) ||\n\t\t\t\twindow.document.documentElement.getAttribute( 'driver' );\n\t\t};\n\n\t\t/**\n\t\t * @function getNodes.\n\t\t * @description Duplicated from core until the build system can use Gravity Forms utilities.\n\t\t *\n\t\t * @since 5.\n\t\t */\n\t\tthis.getNodes = (\n\t\tselector = '',\n\t\tconvert = false,\n\t\tnode = document,\n\t\tcustom = false\n\t\t) => {\n\t\t\tconst selectorString = custom ? selector : `[data-js=\"${ selector }\"]`;\n\t\t\tlet nodes = node.querySelectorAll( selectorString );\n\t\t\tif ( convert ) {\n\t\t\t\tnodes = this.convertElements( nodes );\n\t\t\t}\n\t\t\treturn nodes;\n\t\t}\n\n\t\t/**\n\t\t * @function convertElements.\n\t\t * @description Duplicated from core until the build system can use Gravity Forms utilities.\n\t\t *\n\t\t * @since 5.0\n\t\t */\n\t\tthis.convertElements = ( elements = [] ) => {\n\t\t\tconst converted = [];\n\t\t\tlet i = elements.length;\n\t\t\tfor ( i; i--; converted.unshift( elements[ i ] ) ); // eslint-disable-line\n\n\t\t\treturn converted;\n\t\t}\n\n\t\t/**\n\t\t * End duplicated honeypot logic.\n\t\t */\n\n\t\tthis.init();\n\n\t}\n\n})(jQuery);\n","const request = async ( data, isJson = false, action = false, nonce = false ) => {\n\t// Remove the ajax input to prevent Gravity Forms ajax submission handler from handling the submission in the backend.\n\tdata.delete( 'gform_ajax' );\n\tconst options = {\n\t\tmethod: 'POST',\n\t\tcredentials: 'same-origin',\n\t\tbody: data,\n\t};\n\n\tif ( isJson ) {\n\t\toptions.headers = { 'Accept': 'application/json', 'content-type': 'application/json' }\n\t}\n\n\tconst url = new URL( gforms_stripe_frontend_strings.ajaxurl )\n\n\tif ( action ) {\n\t\turl.searchParams.set( 'action', action )\n\t}\n\n\tif ( nonce ) {\n\t\turl.searchParams.set( 'nonce', nonce )\n\t}\n\n\tconsole.log( url.toString() );\n\treturn await fetch(\n\t\turl.toString(),\n\t\toptions\n\t).then(\n\t\tresponse => response.json()\n\t);\n}\n\nexport default request;\n","import request from './request';\nexport default class StripePaymentsHandler {\n\n\t/**\n\t * StripePaymentsHandler constructor\n\t *\n\t * @since 5.0\n\t *\n\t * @param {String} apiKey The stripe API key.\n\t * @param {Object} GFStripeObj The stripe addon JS object.\n\t */\n\tconstructor( apiKey, GFStripeObj ) {\n\t\tthis.GFStripeObj = GFStripeObj;\n\t\tthis.apiKey = apiKey;\n\t\tthis.stripe = null;\n\t\tthis.elements = null;\n\t\tthis.card = null;\n\t\tthis.paymentMethod = null;\n\t\tthis.draftId = null;\n\t\t// A workaround so we can call validate method from outside this class while still accessing the correct scope.\n\t\tthis.validateForm = this.validate.bind( this );\n\t\tthis.handlelinkEmailFieldChange = this.reInitiateLinkWithEmailAddress.bind( this );\n\t\tthis.order = {\n\t\t\t'recurringAmount': 0,\n\t\t\t'paymentAmount': 0,\n\t\t};\n\t\t// The object gets initialized everytime frontend feeds are evaluated so we need to clear any previous errors.\n\t\tthis.clearErrors();\n\n\t\tif ( ! this.initStripe() || gforms_stripe_frontend_strings.stripe_connect_enabled !== \"1\" ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Create the elements and mount them.\n\t\tthis.link = this.elements.create( \"linkAuthentication\" );\n\t\tthis.card = this.elements.create( 'payment' );\n\n\n\t\tif ( GFStripeObj.activeFeed.link_email_field_id ) {\n\t\t\tthis.mountLink();\n\t\t} else {\n\t\t\tthis.link = null;\n\t\t}\n\n\t\tthis.mountCard();\n\t\tthis.bindEvents();\n\n\t\t// Trigger link if the email was filled before the payment element was mounted.\n\t\tconst emailField = document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.link_email_field_id );\n\t\tif( emailField && emailField.value ) {\n\t\t\tthis.handlelinkEmailFieldChange( { target: { value: emailField.value } } );\n\t\t}\n\n\t}\n\n\t/**\n\t * @function getStripeCoupon\n\t * @description Retrieves the cached coupon associated with the entered coupon code.\n\t *\n\t * @since 5.1\n\t * @returns {object} Returns the cached coupon object or null if the coupon is not found.\n\t */\n\tgetStripeCoupon\t() {\n\t\tvar coupons = window.stripeCoupons || {};\n\t\treturn coupons[ this.getStripeCouponCode() ];\n\t}\n\n\t/**\n\t * @function getStripeCouponInput\n\t * @description Retrieves the coupon input associated with the active feed.\n\t *\n\t * @since 5.1\n\t *\n\t * @returns {HTMLInputElement} Returns the coupon input or null if the coupon input is not found.\n\t */\n\tgetStripeCouponInput() {\n\t\treturn document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.coupon );\n\t}\n\n\t/**\n\t * @function getStripeCouponCode\n\t * @description Retrieves the coupon code from the coupon input associated with the active feed.\n\t *\n\t * @since 5.1\n\t *\n\t * @returns {string} Returns the coupon code or an empty string if the coupon input is not found.\n\t */\n\tgetStripeCouponCode() {\n\t\tconst couponInput = this.getStripeCouponInput();\n\n\t\treturn couponInput ? couponInput.value : '';\n\t}\n\n\t/**\n\t * @function bindStripeCoupon\n\t * @description Binds the coupon input change event.\n\t *\n\t * @since 5.1\n\t *\n\t * @returns {void}\n\t */\n\tbindStripeCoupon() {\n\n\t\t// Binding coupon input event if it has not been bound before.\n\t\tconst couponInput = this.getStripeCouponInput();\n\t\tif ( couponInput && ! couponInput.getAttribute( 'data-listener-added' ) ) {\n\t\t\tcouponInput.addEventListener( 'blur', this.handleCouponChange.bind( this ) );\n\t\t\tcouponInput.setAttribute( 'data-listener-added', true );\n\t\t}\n\t}\n\n\t/**\n\t * @function handleCouponChange\n\t * @description Handles the coupon input change event.\n\t *\n\t * @since 5.1\n\t *\n\t * @param event The event object.\n\t * @returns {Promise}\n\t */\n\tasync handleCouponChange( event ) {\n\n\t\tif( this.getStripeCouponInput() !== event.target ) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.updateStripeCoupon( event.target.value );\n\n\t\tgformCalculateTotalPrice( this.GFStripeObj.formId );\n\t}\n\n\t/**\n\t * @function updateStripeCoupon\n\t * @description Retrieves a coupon from Stripe based on the coupon_code specified and caches it in the window object.\n\t *\n\t * @since 5.1\n\t *\n\t * @param {string} coupon_code The coupon code\n\t * @returns {Promise}\n\t */\n\tasync updateStripeCoupon( coupon_code ) {\n\n\t\t// If the coupon code is empty, we don't need to do anything.\n\t\tif ( ! coupon_code ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initializing stripeCoupons object if it doesn't exist.\n\t\tif( ! window.stripeCoupons ){\n\t\t\twindow.stripeCoupons = {};\n\t\t}\n\n\t\t// If coupon has already been retrieved from Stripe, abort.\n\t\tif ( window.stripeCoupons[ coupon_code ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Retreive coupon from Stripe and store it in the window object.\n\t\tconst response = await request(\n\t\t\tJSON.stringify( {\n\t\t\t\t'coupon' : coupon_code,\n\t\t\t\t'feed_id' : this.GFStripeObj.activeFeed.feedId,\n\t\t\t} ),\n\t\t\ttrue,\n\t\t\t'gfstripe_get_stripe_coupon',\n\t\t\tgforms_stripe_frontend_strings.get_stripe_coupon_nonce,\n\t\t);\n\n\t\twindow.stripeCoupons[ coupon_code ] = response.data;\n\t}\n\n\t/**\n\t * Creates the Stripe object with the given API key.\n\t *\n\t * @since 5.0\n\t *\n\t * @return {boolean}\n\t */\n\tasync initStripe() {\n\t\tthis.stripe = Stripe( this.apiKey );\n\n\t\tconst initialPaymentInformation = this.GFStripeObj.activeFeed.initial_payment_information;\n\t\tconst appearance = this.GFStripeObj.cardStyle;\n\n\t\tif ( 'payment_method_types' in initialPaymentInformation ) {\n\t\t\tinitialPaymentInformation.payment_method_types = Object.values( initialPaymentInformation.payment_method_types );\n\t\t}\n\n\t\tthis.elements = this.stripe.elements( { ...initialPaymentInformation, appearance } );\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Mounts the card element to the field node.\n\t *\n\t * @since 5.0\n\t */\n\tmountCard() {\n\t\tthis.card.mount( '#' + this.GFStripeObj.GFCCField.attr('id') );\n\t}\n\n\t/**\n\t * Creates a container node for the link element and mounts it.\n\t *\n\t * @since 5.0\n\t */\n\tmountLink() {\n\t\tif ( this.link === null ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( document.querySelectorAll( '.stripe-payment-link' ).length <= 0 ) {\n\t\t\tconst linkDiv = document.createElement( 'div' );\n\t\t\tlinkDiv.setAttribute( 'id', 'stripe-payment-link' );\n\t\t\tlinkDiv.classList.add( 'StripeElement--link' );\n\t\t\tthis.GFStripeObj.GFCCField.before( jQuery( linkDiv ) );\n\t\t}\n\n\t\tthis.link.mount( '#stripe-payment-link' );\n\t}\n\n\t/**\n\t * Binds event listeners.\n\t *\n\t * @since 5.0\n\t */\n\tasync bindEvents() {\n\t\tif ( this.card ) {\n\t\t\tthis.card.on( 'change', ( event ) => {\n\t\t\t\t\tthis.paymentMethod = event;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Binding events for Stripe Coupon.\n\t\tthis.bindStripeCoupon();\n\n\t\tconst emailField = document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.link_email_field_id );\n\n\t\tif ( emailField === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\temailField.addEventListener( 'blur', this.handlelinkEmailFieldChange );\n\n\t\twindow.addEventListener( 'load', async function () {\n\t\tconst emailField = document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.link_email_field_id );\n\t\t\tif (\n\t\t\t\t(\n\t\t\t\t\tString( emailField.value )\n\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t.match(\n\t\t\t\t\t\t\t/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t&& this.GFStripeObj.isLastPage()\n\t\t\t) {\n\t\t\t\tthis.handlelinkEmailFieldChange( { target: { value: emailField.value } } );\n\t\t\t}\n\n\t\t}.bind( this ) );\n\n\t}\n\n\t/**\n\t * Destroys the current instance of link and creates a new one with value extracted from the passed event.\n\t *\n\t * @since 5\n\t *\n\t * @param {Object} event an object that contains information about the email input.\n\t * @return {Promise}\n\t */\n\tasync reInitiateLinkWithEmailAddress( event ) {\n\n\t\tif ( this.GFStripeObj.isCreditCardOnPage() === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emailAddress = event.target.value;\n\t\tif ( this.link !== undefined && this.link !== null && 'destroy' in this.link ) {\n\t\t\tthis.link.destroy();\n\t\t\tjQuery( '.gfield #stripe-payment-link' ).remove()\n\t\t}\n\t\tthis.link = await this.elements.create( \"linkAuthentication\", { defaultValues: { email: emailAddress } } );\n\t\tthis.mountLink();\n\t\tif ( ! emailAddress ) {\n\t\t\tjQuery( '.gfield #stripe-payment-link' ).removeClass( 'visible' );\n\t\t} else {\n\t\t\tjQuery( '.gfield #stripe-payment-link' ).addClass( 'visible' );\n\t\t}\n\t}\n\t/**\n\t * Validates the form.\n\t *\n\t * @since 5.0\n\t *\n\t * @param {Object} event The form event object.\n\t *\n\t * @return {Promise}\n\t */\n\tasync validate( event ) {\n\t\t// If this is an ajax form submission, we just need to submit the form as everything has already been handled.\n\t\tconst form = jQuery( '#gform_' + this.GFStripeObj.formId );\n\t\tif ( form.data( 'isAjaxSubmitting' ) ) {\n\t\t\tform.submit();\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure the required information are entered.\n\t\t// Link stays incomplete even when email is entered, and it will fail with a friendly message when the confirmation request fails, so skip its frontend validation.\n\t\tif ( ! this.paymentMethod.complete && this.paymentMethod.value.type !== 'link' ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.payment_incomplete, this.GFStripeObj.formId )\n\t\t\treturn false;\n\t\t}\n\n\t\tgformAddSpinner( this.GFStripeObj.formId );\n\t\tconst response = await request( this.getFormData( event.target ) );\n\n\t\tif ( 'success' in response && response.success === false ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\n\t\t\treturn false;\n\t\t}\n\n\t\t// Invoice for trials are automatically paid.\n\t\tif ( response.data.intent === null ) {\n\t\t\tconst redirect_url = new URL( window.location.href );\n\t\t\tredirect_url.searchParams.append( 'resume_token', response.data.resume_token );\n\t\t\twindow.location.href = redirect_url.href;\n\t\t}\n\n\t\tif (\n\t\t\t'data' in response\n\t\t\t&& 'is_valid' in response.data\n\t\t\t&& response.data.is_valid\n\t\t\t&& 'resume_token' in response.data\n\t\t\t&& 'intent' in response.data\n\t\t\t&& 'client_secret' in response.data.intent\n\t\t) {\n\t\t\t// Reset any errors.\n\t\t\tthis.resetFormValidationErrors();\n\t\t\tthis.draftId = response.data.resume_token;\n\t\t\t// Validate Stripe coupon, if there is a setup fee or trial, the coupon won't be applied to the current payment, so pass validation as it is all handled in the backend.\n\t\t\tif (\n\t\t\t\tthis.GFStripeObj.activeFeed.hasTrial !== '1' &&\n\t\t\t\t! this.GFStripeObj.activeFeed.setupFee &&\n\t\t\t\t! this.isValidCoupon( response.data.total )\n\t\t\t) {\n\t\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.coupon_invalid, this.GFStripeObj.formId )\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Confirm payment.\n\t\t\tthis.confirm( response.data.resume_token, response.data.intent.client_secret );\n\n\t\t} else {\n\t\t\t// Form is not valid, do a normal submit to render the validation errors markup in backend.\n\t\t\tevent.target.submit();\n\t\t}\n\t}\n\n\n\t/**\n\t * @function isValidCoupon\n\t * @description Validates the coupon code.\n\t *\n\t * @since 5.1\n\t *\n\t * @param {number} payment_amount Payment amount calculated by Stripe.\n\t *\n\t * @returns {boolean} Returns true if the coupon is valid, returns false otherwise.\n\t */\n\tisValidCoupon( payment_amount ) {\n\t\tconst coupon = this.getStripeCoupon();\n\t\tif ( ! coupon ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn coupon.is_valid && payment_amount == this.order.paymentAmount;\n\t}\n\n\t/**\n\t * Creates a FormData object containing the information required to validate the form and start the checkout process on the backend.\n\t *\n\t * @since 5.0\n\t *\n\t * @param {Object} form The form object.\n\t *\n\t * @return {FormData}\n\t */\n\tgetFormData( form ) {\n\t\tconst formData = new FormData( form );\n\t\t// if gform_submit exist in the request, GFFormDisplay::process_form() will be called even before the AJAX handler.\n\t\tformData.delete( 'gform_submit' );\n\t\t// Append the payment data to the form.\n\t\tconst appendParams = {\n\t\t\t'action': 'gfstripe_validate_form',\n\t\t\t'feed_id': this.GFStripeObj.activeFeed.feedId,\n\t\t\t'form_id': this.GFStripeObj.formId,\n\t\t\t'payment_method': this.paymentMethod.value.type,\n\t\t\t'nonce': gforms_stripe_frontend_strings.validate_form_nonce\n\t\t}\n\n\t\tObject.keys( appendParams ).forEach( ( key ) => {\n\t\t\tformData.append( key, appendParams[ key ] );\n\t\t} );\n\n\t\treturn formData;\n\t}\n\n\t/**\n\t * Updates the payment information amount.\n\t *\n\t * @since 5.1\n\t *\n\t * @param {Double} newAmount The updated amount.\n\t */\n\tupdatePaymentAmount( newAmount ) {\n\t\tif ( newAmount <= 0 || this.GFStripeObj.activeFeed.initial_payment_information.mode === 'setup' ) {\n\t\t\treturn;\n\t\t}\n\t\t// Get amount in cents (or the equivalent subunit for other currencies)\n\t\tlet total = newAmount * 100;\n\t\t// Round total to two decimal places.\n\t\ttotal = Math.round( total * 100 ) / 100;\n\n\t\tthis.elements.update( { amount: total } );\n\t}\n\n\t/**\n\t * @function applyStripeCoupon\n\t * @description Applies the coupon discount to the total.\n\t *\n\t * @since 5.1\n\t *\n\t * @param {number} total The payment amount.\n\t * @returns {number} Returns the updated total.\n\t */\n\tapplyStripeCoupon( total ) {\n\n\t\tconst coupon = this.getStripeCoupon();\n\t\tif ( ! coupon || ! coupon.is_valid ) {\n\t\t\treturn total;\n\t\t}\n\n\t\tif( coupon.percentage_off ) {\n\t\t\ttotal = total - ( total * ( coupon.percentage_off / 100 ) );\n\t\t} else if ( coupon.amount_off ) {\n\t\t\ttotal = total - coupon.amount_off;\n\t\t}\n\n\t\treturn total;\n\t}\n\n\t/**\n\t * Calls stripe confirm payment or confirm setup to attempt capturing the payment after form validation passed.\n\t *\n\t * @since 5.0\n\t *\n\t * @param {String} resume_token The draft resume token.\n\t * @param {String} clientSecret The payment intent client secret.\n\t *\n\t * @return {Promise}\n\t */\n\tasync confirm( resume_token, clientSecret, paymentMethod ) {\n\n\t\t// Prepare the return URL.\n\t\tconst redirect_url = new URL( window.location.href );\n\t\tredirect_url.searchParams.append( 'resume_token', resume_token );\n\t\tconst isAjaxEmbed = this.isAjaxEmbed( this.GFStripeObj.formId );\n\t\tconst { error: submitError } = await this.elements.submit();\n\t\tif ( submitError ) {\n\t\t\tthis.failWithMessage( submitError.message , this.GFStripeObj.formId )\n\t\t\treturn;\n\t\t}\n\t\t// Gather the payment data.\n\t\tconst paymentData = {\n\t\t\telements: this.elements,\n\t\t\tclientSecret,\n\t\t\tconfirmParams: {\n\t\t\t\treturn_url: redirect_url.toString(),\n\t\t\t\tpayment_method_data: {\n\t\t\t\t\tbilling_details: {\n\t\t\t\t\t\taddress: {\n\t\t\t\t\t\t\tline1: GFMergeTag.replaceMergeTags( this.GFStripeObj.formId, this.getBillingAddressMergeTag( this.GFStripeObj.activeFeed.address_line1 ) ),\n\t\t\t\t\t\t\tline2: GFMergeTag.replaceMergeTags( this.GFStripeObj.formId, this.getBillingAddressMergeTag( this.GFStripeObj.activeFeed.address_line2 ) ),\n\t\t\t\t\t\t\tcity: GFMergeTag.replaceMergeTags( this.GFStripeObj.formId, this.getBillingAddressMergeTag( this.GFStripeObj.activeFeed.address_city ) ),\n\t\t\t\t\t\t\tstate: GFMergeTag.replaceMergeTags( this.GFStripeObj.formId, this.getBillingAddressMergeTag( this.GFStripeObj.activeFeed.address_state ) ),\n\t\t\t\t\t\t\tpostal_code: GFMergeTag.replaceMergeTags( this.GFStripeObj.formId, this.getBillingAddressMergeTag( this.GFStripeObj.activeFeed.address_zip ) ),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tredirect: isAjaxEmbed ? 'if_required' : 'always'\n\t\t};\n\n\t\t// Confirm payment or setup.\n\t\tlet paymentResult = {};\n\t\tif ( this.GFStripeObj.activeFeed.initial_payment_information.amount === 0 ) {\n\t\t\ttry {\n\t\t\t\tpaymentResult = await this.stripe.confirmSetup( paymentData );\n\t\t\t} catch ( e ) {\n\t\t\t\tconsole.log( e );\n\t\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t\t}\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tpaymentResult = await this.stripe.confirmPayment( paymentData );\n\t\t\t} catch ( e ) {\n\t\t\t\tconsole.log( e );\n\t\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t\t}\n\t\t}\n\n\t\t// If we have a paymentIntent in the result, the process was successful.\n\t\tif ( 'paymentIntent' in paymentResult ) {\n\t\t\tthis.handlePayment( paymentResult, redirect_url );\n\t\t} else {\n\t\t\tawait this.handleFailedPayment( paymentResult );\n\t\t}\n\t}\n\n\t/**\n\t * Perform any required actions before redirecting the user to the redirect URL after a successful payment.\n\t *\n\t * @since 5.0\n\t * @since 5.2 Added the redirect_url parameter.\n\t *\n\t * @param {Object} paymentResult The result of confirming a payment intent or a setup intent.\n\t * @param {null|string} redirect_url If provided, The redirect URL the user will be taken to after confirmation, currently used only to be submitted in the AJAX IFrame.\n\t */\n\thandlePayment( paymentResult, redirect_url ) {\n\n\t\t// If redirect_url is null, this means the user will be redirected to confirmation page as provided while calling confirmPayment().\n\t\t// Halt redirect and do anything required before it here.\n\n\t\t// If this is not an AJAX form, nothing to do here.\n\t\tif ( ! this.isAjaxEmbed( this.GFStripeObj.formId ) || ! redirect_url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If this is an AJAX form, update its action and add the redirect args to the url that will be submitted in the AJAX IFrame.\n\t\tredirect_url.searchParams.append( 'payment_intent', paymentResult.paymentIntent.id );\n\t\tredirect_url.searchParams.append( 'payment_intent_client_secret', paymentResult.paymentIntent.client_secret );\n\t\tredirect_url.searchParams.append( 'redirect_status', paymentResult.paymentIntent.status ? 'succeeded' : 'pending' );\n\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).attr( 'action' , redirect_url.toString() );\n\t\t// Prevent running same logic again after submitting the form.\n\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).data( 'isAjaxSubmitting' , true );\n\t\t// Keeping this input makes the backend thinks it is not an ajax form.\n\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).find( '[name=\"gform_submit\"]' ).remove();\n\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).submit();\n\t}\n\n\t/**\n\t * Handles a failed payment attempt.\n\t *\n\t * @since 5.0\n\t *\n\t * @param {Object} paymentResult The result of confirming a payment intent or a setup intent.\n\t */\n\tasync handleFailedPayment( paymentResult ) {\n\t\tlet errorMessage = '';\n\t\tif ( 'error' in paymentResult && 'message' in paymentResult.error ) {\n\t\t\terrorMessage = paymentResult.error.message;\n\t\t}\n\t\tthis.failWithMessage( errorMessage, this.GFStripeObj.formId );\n\t\t// Delete the draft entry created.\n\t\tlet response = request(\n\t\t\tJSON.stringify( { 'draft_id': this.draftId } ),\n\t\t\ttrue,\n\t\t\t'gfstripe_delete_draft_entry',\n\t\t\tgforms_stripe_frontend_strings.delete_draft_nonce\n\t\t);\n\t\t// If rate limiting is enabled, increase the errors number at the backend side, and set the new count here.\n\t\tif ( this.GFStripeObj.hasOwnProperty( 'cardErrorCount' ) ) {\n\t\t\tresponse = await request(\n\t\t\t\tJSON.stringify( { 'increase_count': true } ),\n\t\t\t\ttrue ,\n\t\t\t\t'gfstripe_payment_element_check_rate_limiting',\n\t\t\t\tgforms_stripe_frontend_strings.rate_limiting_nonce\n\t\t\t);\n\t\t\tthis.GFStripeObj.cardErrorCount = response.data.error_count;\n\t\t}\n\t}\n\n\t/**\n\t * Destroys the stripe objects and removes any DOM nodes created while initializing them.\n\t *\n\t * @since 5.0\n\t */\n\tdestroy() {\n\t\tif ( this.card ) {\n\t\t\tthis.card.destroy();\n\t\t}\n\n\t\tif ( this.link ) {\n\t\t\tthis.link.destroy();\n\t\t\tconst linkContainer = document.querySelectorAll( '.stripe-payment-link' )[ 0 ];\n\t\t\tif ( linkContainer ) {\n\t\t\t\tlinkContainer.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clears the error messages around the Stripe card field.\n\t *\n\t * @since 5.0\n\t */\n\tclearErrors() {\n\t\t// Clear card field errors before initiate it.\n\t\tif ( this.GFStripeObj.GFCCField.next('.validation_message').length ) {\n\t\t\tthis.GFStripeObj.GFCCField.next('.validation_message').remove();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the validation error messages from the form fields.\n\t *\n\t * @since 5.0\n\t */\n\tresetFormValidationErrors() {\n\t\tdocument.querySelectorAll( '.gform_validation_errors, .validation_message' ).forEach( ( el ) => { el.remove() } );\n\t\tdocument.querySelectorAll( '.gfield_error' ).forEach( ( el ) => { el.classList.remove( 'gfield_error' ) } );\n\t}\n\n\t/**\n\t * Displays an error message if the flow failed at any point, also clears the loading indicator and resets the form data attributes.\n\t *\n\t * @since 5.0\n\t *\n\t * @param {String} message The error message to display.\n\t * @param {int} formId The form ID.\n\t */\n\tfailWithMessage( message, formId ) {\n\t\tmessage = message ? message : gforms_stripe_frontend_strings.failed_to_process_payment;\n\t\tthis.GFStripeObj.displayStripeCardError( { error : { message : message } } );\n\t\tthis.GFStripeObj.resetStripeStatus( jQuery( '#gform_' + formId ), formId, true );\n\t\tjQuery( '#gform_ajax_spinner_' + formId ).remove();\n\t}\n\n\t/**\n\t * Returns the merge tag for the billing address.\n\t *\n\t * @since 5.0\n\t *\n\t * @param field The billing address field.\n\t *\n\t * @return {string} The merge tag for the billing address.\n\t */\n\tgetBillingAddressMergeTag( field ) {\n\n\t\tif ( field === '' ) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn '{:' + field + ':value}';\n\t}\n\n\t/**\n\t * Gets the order data.\n\t *\n\t * The order contains the following properties\n\t * \tpaymentAmount: The amount of the payment that will be charged after form submission.\n\t * \trecurringAmount: If this is a subscription, this is the recurring amount.\n\t *\n\t * @since 5.1\n\t *\n\t * @param total The form total.\n\t * @param formId The current form id.\n\t *\n\t * @return {Object} The order data.\n\t */\n\tgetOrderData( total, formId ) {\n\n\t\tif ( ! _gformPriceFields[ formId ] ) {\n\t\t\treturn this.order;\n\t\t}\n\n\t\tconst setUpFieldId = this.GFStripeObj.activeFeed.setupFee;\n\t\tlet setupFee = 0;\n\t\tlet productTotal = 0;\n\t\tconst isTrial = this.GFStripeObj.activeFeed.hasTrial;\n\n\n\t\t// If this is the setup fee field, or the shipping field, don't add to total.\n\t\tif ( setUpFieldId ) {\n\t\t\tconst setupFeeInfo = this.GFStripeObj.getProductFieldPrice( formId, this.GFStripeObj.activeFeed.setupFee );\n\t\t\tsetupFee = setupFeeInfo.price * setupFeeInfo.qty;\n\t\t\t// If this field is a setup fee, subtract it from total, so it is not added to the recurring amount.\n\t\t\ttotal -= setupFee;\n\t\t}\n\n\t\tif ( this.GFStripeObj.activeFeed.paymentAmount === 'form_total' ) {\n\t\t\tthis.order.recurringAmount = total;\n\t\t} else {\n\t\t\tthis.order.recurringAmount = gformCalculateProductPrice( formId, this.GFStripeObj.activeFeed.paymentAmount );\n\t\t}\n\n\t\tthis.order.recurringAmount = this.applyStripeCoupon( this.order.recurringAmount )\n\n\t\tif ( isTrial === '1' ) {\n\t\t\tthis.order.paymentAmount = setupFee;\n\t\t} else {\n\t\t\tthis.order.paymentAmount = this.order.recurringAmount + setupFee;\n\t\t}\n\n\t\treturn this.order;\n\t}\n\n\t/**\n\t * Decides whether the form is embedded with the AJAX option on or not.\n\t *\n\t * Since 5.2\n\t *\n\t * @param {integer} formId The form ID.\n\t * @returns {boolean}\n\t */\n\tisAjaxEmbed( formId ) {\n\t\treturn jQuery( '#gform_ajax_frame_' + formId ).length >= 1;\n\t}\n}\n","var global =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n (typeof global !== 'undefined' && global)\n\nvar support = {\n searchParams: 'URLSearchParams' in global,\n iterable: 'Symbol' in global && 'iterator' in Symbol,\n blob:\n 'FileReader' in global &&\n 'Blob' in global &&\n (function() {\n try {\n new Blob()\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in global,\n arrayBuffer: 'ArrayBuffer' in global\n}\n\nfunction isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n}\n\nif (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n}\n\nfunction normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n}\n\nfunction normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n}\n\n// Build a destructive iterator for the value list\nfunction iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n}\n\nexport function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n}\n\nHeaders.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue + ', ' + value : value\n}\n\nHeaders.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n}\n\nHeaders.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n}\n\nHeaders.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n}\n\nHeaders.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n}\n\nHeaders.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n}\n\nHeaders.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push(name)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.values = function() {\n var items = []\n this.forEach(function(value) {\n items.push(value)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push([name, value])\n })\n return iteratorFor(items)\n}\n\nif (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n}\n\nfunction consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n}\n\nfunction fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n}\n\nfunction readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n}\n\nfunction readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n}\n\nfunction readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n}\n\nfunction bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n}\n\nfunction Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n this.bodyUsed = this.bodyUsed\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n this._bodyText = body = Object.prototype.toString.call(body)\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this)\n if (isConsumed) {\n return isConsumed\n }\n if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n}\n\n// HTTP methods whose capitalization should be normalized\nvar methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\nfunction normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return methods.indexOf(upcased) > -1 ? upcased : method\n}\n\nexport function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n this.signal = input.signal\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.signal = options.signal || this.signal\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime())\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime()\n }\n }\n }\n}\n\nRequest.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n}\n\nfunction decode(body) {\n var form = new FormData()\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n}\n\nfunction parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n}\n\nBody.call(Request.prototype)\n\nexport function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n}\n\nBody.call(Response.prototype)\n\nResponse.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n}\n\nResponse.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n}\n\nvar redirectStatuses = [301, 302, 303, 307, 308]\n\nResponse.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n}\n\nexport var DOMException = global.DOMException\ntry {\n new DOMException()\n} catch (err) {\n DOMException = function(message, name) {\n this.message = message\n this.name = name\n var error = Error(message)\n this.stack = error.stack\n }\n DOMException.prototype = Object.create(Error.prototype)\n DOMException.prototype.constructor = DOMException\n}\n\nexport function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n\n if (request.signal && request.signal.aborted) {\n return reject(new DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest()\n\n function abortXhr() {\n xhr.abort()\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n setTimeout(function() {\n resolve(new Response(body, options))\n }, 0)\n }\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'))\n }, 0)\n }\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'))\n }, 0)\n }\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new DOMException('Aborted', 'AbortError'))\n }, 0)\n }\n\n function fixUrl(url) {\n try {\n return url === '' && global.location.href ? global.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob'\n } else if (\n support.arrayBuffer &&\n request.headers.get('Content-Type') &&\n request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1\n ) {\n xhr.responseType = 'arraybuffer'\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]))\n })\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr)\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr)\n }\n }\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n}\n\nfetch.polyfill = true\n\nif (!global.fetch) {\n global.fetch = fetch\n global.Headers = Headers\n global.Request = Request\n global.Response = Response\n}\n"],"sourceRoot":""}