diff --git a/change_log.txt b/change_log.txt index e75856f..1b30f02 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,13 @@ +### 5.6.0 | 2024-04-29 +- Added a new [`gform_stripe_payment_element_updated_payment_information`](https://docs.gravityforms.com/gform_stripe_payment_element_updated_payment_information/) JavaScript filter to allow modifying the payment element payment information when the form total changes. +- Updated logging to decrease the log file size and make it easier to track issues. +- Fixed a fatal error that occurs when the customer is redirected back after a no-cost checkout order payment. +- Fixed PHP 8.1+ deprecation notices displaying on the settings page. +- Fixed a fatal error that occurs when the webhooks signing secret is invalid. +- Fixed an issue where the loading spinner is not hidden after the form fails validation. +- Fixed a fatal error that can occur when the Stripe field is hidden by conditional logic. +- Fixed an issue where the Link option for the Stripe Payment Element can not be disabled once an email field is selected. + ### 5.5.0 | 2024-02-22 - Added a Stripe API wrapper and deprecated the use of the Stripe PHP SDK. - Added new notification events for pending and authorized payment states. diff --git a/class-gf-stripe.php b/class-gf-stripe.php index fad3edf..af89394 100644 --- a/class-gf-stripe.php +++ b/class-gf-stripe.php @@ -434,6 +434,7 @@ public function scripts() { 'stripe_connect_enabled' => $this->is_stripe_connect_enabled() === true, 'payment_element_supported' => $this->is_payment_element_supported(), 'payment_element_disabled_message' => wp_strip_all_tags( __( 'To enable additional payment methods, you must update Gravity Forms to the latest version.', 'gravityformsstripe' ) ), + 'email_field_id_text' => wp_strip_all_tags( __( 'Field ID', 'gravityformsstripe' ) ), ), ), ); @@ -1177,18 +1178,9 @@ public function add_payment_method_setting( $placement, $form_id ) {
get_stripe_card_field( $form ); + if ( $field && GFFormsModel::is_field_hidden( $form, $field, rgpost( 'gform_field_values' ) ) ) { + $this->log_debug( __METHOD__ . '(): Stripe card field is hidden. No payment will be attempted.' ); + + return false; + } + } + + return parent::get_payment_feed( $entry, $form ); + } + /** * Add update authentication message. * @@ -3772,6 +3787,7 @@ public function authorize( $feed, $submission_data, $form, $entry ) { // If Payment element is enabled, then this is called by submitting a form with 0 total or a hidden stripe field. if ( $this->is_payment_element_enabled( $form ) ) { + $this->log_debug( __METHOD__ . '(): Authorizing product for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id:' . rgget( 'tracking_id' ) ); return $this->authorize_product( $feed, $submission_data, $form, $entry ); } @@ -3834,6 +3850,12 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { $stripe_response = $this->get_stripe_js_response(); } + if ( ! $stripe_response ) { + $this->log_error( __METHOD__ . '(): Stripe.js response is empty.' ); + + return $this->authorization_error( esc_html__( 'Your payment attempt has failed. Please enter your card details and try again.', 'gravityformsstripe' ) ); + } + if ( ! is_wp_error( $stripe_response ) && ( $payment_element_enabled || $this->is_payment_intent( $stripe_response->id ) ) @@ -3844,7 +3866,7 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { $expected_amount = $this->get_amount_export( $submission_data['payment_amount'], $currency ); if ( $result->amount !== $expected_amount ) { - $this->log_debug( __METHOD__ . sprintf( '(): Amount mismatch. PaymentIntent: %s. Expected: %s. Cancelling PaymentIntent.', GFCommon::to_money( $this->get_amount_import( $result->amount, $currency ), $currency ), GFCommon::to_money( $submission_data['payment_amount'], $currency ) ) ); + $this->log_debug( __METHOD__ . sprintf( '(): Amount mismatch. PaymentIntent: %s. Expected: %s. Cancelling PaymentIntent, tracking id: %s', GFCommon::to_money( $this->get_amount_import( $result->amount, $currency ), $currency ), GFCommon::to_money( $submission_data['payment_amount'], $currency ), rgget( 'tracking_id' ) ) ); $result = $this->api->cancel_payment_intent( $result->id, 'fraudulent' ); if ( is_wp_error( $result ) ) { @@ -3860,7 +3882,6 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { // Add customer, receipt_email and metadata. // Change data before sending to Stripe. $data = $this->get_product_payment_data( $data, $feed, $submission_data, $form, $entry ); - $this->log_debug( __METHOD__ . '(): payment intent data to be updated => ' . print_r( $data, 1 ) ); // Compare the properties of the intent and the properties retrieved from the filter. // If they are the same, then no need to update. $intentArray = $result->toArray(); @@ -3872,6 +3893,7 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { } // Update only if we have properties that are different from the intent's properties. if ( ! empty( $data ) ) { + $this->log_debug( __METHOD__ . '(): payment intent data to be updated => ' . print_r( $data, true ) ); $result = $this->api->update_payment_intent( $result->id, $data ); } @@ -3900,7 +3922,7 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { } elseif ( $result->status === 'canceled' ) { return $this->authorization_error( esc_html__( 'The payment has been canceled', 'gravityformsstripe' ) ); } else { - $this->log_debug( __METHOD__ . '(): PaymentIntent status: ' . $result->status ); + $this->log_debug( __METHOD__ . '(): PaymentIntent status: ' . $result->status . ', tracking id:' . rgget( 'tracking_id' ) ); return array( 'is_authorized' => true, 'transaction_id' => $stripe_response->id, @@ -3929,7 +3951,7 @@ public function authorize_product( $feed, $submission_data, $form, $entry ) { $charge_meta = array_merge( $charge_meta, $data ); $charge_meta = $this->get_product_payment_data( $charge_meta, $feed, $submission_data, $form, $entry ); // Log the charge we're about to process. - $this->log_debug( __METHOD__ . '(): Charge meta to be created => ' . print_r( $charge_meta, 1 ) ); + $this->log_debug( __METHOD__ . '(): Charge meta to be created => ' . print_r( $charge_meta, true ) ); // Charge customer. $charge = $this->api->create_charge( $charge_meta ); @@ -4187,7 +4209,7 @@ public function create_checkout_session( $feed, $submission_data, $form, $entry unset( $session_data['customer_creation'] ); } - $this->log_debug( __METHOD__ . '(): Session to be created => ' . print_r( $session_data, true ) ); + $this->log_debug( __METHOD__ . '(): Checkout Session to be created for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ') => ' . print_r( $session_data, true ) ); $session = $this->api->create_checkout_session( $session_data ); if ( ! is_wp_error( $session ) ) { @@ -4238,7 +4260,6 @@ public function complete_authorization( &$entry, $action ) { $feed = $this->get_feed( $this->get_feeds_by_entry( $entry['id'] )[0] ); if ( $this->is_payment_element_enabled( $form ) && ( $this->get_payment_element_capture_method( $form, $feed ) !== 'manual' ) || $this->get_payment_element_handler()->get_subscription_id() ) { - $this->log_debug( __METHOD__ . '(): Stripe payment element still processing the payment.' ); GFAPI::update_entry_property( $entry['id'], 'payment_status', 'Processing' ); GFAPI::update_entry_property( $entry['id'], 'transaction_id', $this->get_payment_element_handler()->get_subscription_id() ); @@ -4580,11 +4601,20 @@ public function capture( $auth, $feed, $submission_data, $form, $entry ) { } else { $response = $this->get_stripe_js_response(); } + if ( $payment_element_enabled || $this->is_payment_intent( $response->id ) ) { + if ( ! $response ) { + $this->log_error( __METHOD__ . '(): There is no Stripe response from which to get a payment intent.' ); + + return array( + 'is_success' => false, + 'error_message' => esc_html__( 'Cannot get payment intent.', 'gravityformsstripe' ), + ); + } $intent = $this->api->get_payment_intent( $response->id ); if ( is_wp_error( $intent ) ) { - $this->log_error( __METHOD__ . '(): Cannot get payment intent data; ' . $intent->get_error_message() ); + $this->log_error( __METHOD__ . '(): Cannot get payment intent data; ' . $intent->get_error_message() . ', tracking id:' . rgget( 'tracking_id' ) ); return array( 'is_success' => false, @@ -4612,7 +4642,7 @@ public function capture( $auth, $feed, $submission_data, $form, $entry ) { if ( $payment_element_enabled && $intent->status === 'processing' ) { - $this->log_debug( __METHOD__ . '(): Can not capture payment while it is still in pending status.' ); + $this->log_debug( __METHOD__ . '(): Can not capture payment while it is still in pending status, payment will be captured via webhook, aborting tracking id: ' . rgget( 'tracking_id' ) ); // Mark the payment status as Pending. GFAPI::update_entry_property( $entry['id'], 'payment_status', 'Pending' ); @@ -4986,7 +5016,7 @@ public function subscribe( $feed, $submission_data, $form, $entry ) { $customer = $this->get_customer( '', $feed, $entry, $form ); if ( $customer ) { - $this->log_debug( __METHOD__ . '(): Updating existing customer.' ); + $this->log_debug( __METHOD__ . '(): Updating existing customer, tracking id:' . rgget( 'tracking_id' ) ); // Update the customer source with the Stripe token. $customer->source = ( ! empty( $stripe_response->updatedToken ) ) ? $stripe_response->updatedToken : $stripe_response->id; @@ -5104,10 +5134,10 @@ public function maybe_thankyou_page() { $entry = $entries[0]; if ( $this->should_complete_checkout_session( $session, $entry ) ) { - $this->log_debug( __METHOD__ . '(): Stripe Checkout session will be completed by the thank you page.' ); + $this->log_debug( __METHOD__ . '(): Stripe Checkout session ' . $session['id'] . ' will be completed by the thank you page.' ); $this->complete_checkout_session( $session, $entry, $feed, $form ); } else { - $this->log_debug( __METHOD__ . '(): Not completing the Stripe Checkout session on the thank you page.' ); + $this->log_debug( __METHOD__ . '(): Stripe Checkout session ' . $session['id'] . ' will be completed by webhooks.' ); } if ( ! class_exists( 'GFFormDisplay' ) ) { @@ -5148,7 +5178,6 @@ private function should_complete_checkout_session( $session, $entry ) { // Payment is complete in Stripe, but entry is not marked as complete. if ( $is_payment_complete && ! $is_entry_marked_as_complete ) { - $this->log_debug( __METHOD__ . '(): Stripe checkout session should be completed.' ); return true; } @@ -5156,19 +5185,17 @@ private function should_complete_checkout_session( $session, $entry ) { $intent = $this->api->get_payment_intent( $session['payment_intent'] ); if ( is_wp_error( $intent ) ) { - $this->log_error( __METHOD__ . '(): Could not retrieve intent from Stripe checkout session, Session should not be completed' ); + $this->log_error( __METHOD__ . '(): Could not retrieve intent from Stripe checkout session ' . $session['id'] . ', Session should not be completed' ); return false; } $is_authorize_only = $intent->capture_method == 'manual' && $intent->status == 'requires_capture'; if ( $is_authorize_only && $entry['payment_status'] !== 'Authorized' ) { - $this->log_debug( __METHOD__ . '(): Stripe checkout session should be completed. Authorization only' ); + $this->log_debug( __METHOD__ . '(): Stripe checkout session ' . $session['id'] . ' should be completed. Authorization only' ); return true; } } - $this->log_debug( __METHOD__ . '(): Stripe checkout session should NOT be completed.' ); - return false; } @@ -5186,10 +5213,11 @@ private function should_complete_checkout_session( $session, $entry ) { * @return array $action */ public function complete_checkout_session( $session, $entry, $feed, $form ) { - + // Set the tracking ID to the session ID so when logging tries to get it from POST, it will be available. + $_POST['tracking_id'] = $session['id']; // If checkout session is locked by another process, abort. if ( ! $this->get_checkout_session_lock( $session['id'] ) ) { - $this->log_debug( __METHOD__ . '(): Checkout session locked. Aborting to avoid duplication' ); + $this->log_debug( __METHOD__ . '(): Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ') locked. Aborting to avoid duplication' ); $action['abort_callback'] = true; return $action; @@ -5199,9 +5227,10 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { $payment_status = rgar( $entry, 'payment_status' ); if ( $subscription_id = rgar( $session, 'subscription' ) ) { + $this->log_debug( __METHOD__ . '(): Processing subscription for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ')' ); $subscription = $this->api->get_subscription( $subscription_id ); if ( is_wp_error( $subscription ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $subscription->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $subscription->get_error_message() ); $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5223,7 +5252,7 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { // Update the subscription data if `gform_stripe_subscription_params_pre_update_customer` filter is used. $customer = $this->api->get_customer( rgar( $session, 'customer' ) ); if ( is_wp_error( $customer ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $customer->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $customer->get_error_message() ); $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5231,7 +5260,7 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { $plan = $this->get_plan( rgars( $subscription, 'items/data/0/plan/id' ) ); if ( is_wp_error( $subscription ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $subscription->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $subscription->get_error_message() ); $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5251,7 +5280,7 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { $subscription = $this->api->update_subscription( $subscription_id, $subscription_params ); if ( is_wp_error( $subscription ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $subscription->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $subscription->get_error_message() ); $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5262,7 +5291,7 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { $action['subscription_id'] = $subscription_id; $invoice = $this->api->get_invoice( rgar( $subscription, 'latest_invoice' ) ); if ( is_wp_error( $invoice ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $invoice->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $invoice->get_error_message() ); $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5294,19 +5323,25 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { if ( $payment_status !== 'Paid' ) { $submission_data = gform_get_meta( $entry['id'], 'submission_data' ); $payment_intent = rgar( $session, 'payment_intent' ); - $payment_intent_object = $this->api->get_payment_intent( $payment_intent, array( 'expand' => array( 'latest_charge' ) ) ); + $payment_intent_object = false; + $amount_total = rgar( $session, 'amount_total' ); - if ( is_wp_error( $payment_intent_object ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $payment_intent_object->get_error_message() ); - $this->release_checkout_session_lock( $session['id'] ); + if ( $amount_total === 0 && ! $payment_intent ) { + $this->log_debug( __METHOD__ . '(): Order total is 0, skip payment intent retrieval as there is none' ); + } else { + $payment_intent_object = $this->api->get_payment_intent( $payment_intent, array( 'expand' => array( 'latest_charge' ) ) ); + if ( is_wp_error( $payment_intent_object ) ) { + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for Checkout session ' . $session['id'] . ' for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '); ' . $payment_intent_object->get_error_message() ); + $this->release_checkout_session_lock( $session['id'] ); - return $action; + return $action; + } } $authorization = array( 'is_authorized' => true, 'transaction_id' => $payment_intent, - 'amount' => $this->get_amount_import( rgars( $payment_intent_object, 'amount_received' ), $entry['currency'] ), + 'amount' => $payment_intent_object ? $this->get_amount_import( rgars( $payment_intent_object, 'amount_received' ), $entry['currency'] ) : 0, ); // complete authorization. @@ -5316,8 +5351,8 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { // if authorization_only = true, status will be 'requires_capture', // so if the payment intent status is succeeded, we can mark the entry as Paid. - if ( rgars( $payment_intent_object, 'status' ) === 'succeeded' ) { - $payment_method = rgars( $payment_intent_object, 'latest_charge/payment_method_details/card/brand' ); + if ( rgars( $payment_intent_object, 'status' ) === 'succeeded' || $amount_total === 0 ) { + $payment_method = $payment_intent_object ? rgars( $payment_intent_object, 'latest_charge/payment_method_details/card/brand' ) : esc_html__( '100% Off Discount Coupon', 'graivtyformsstripe' ); $authorization['captured_payment'] = array( 'is_success' => true, @@ -5334,11 +5369,12 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { // Update payment intent for description to add Entry ID. // Because the entry ID wasn't available when checkout session was created. - if ( ! empty( $submission_data ) ) { + if ( ! empty( $submission_data ) && $payment_intent_object !== false ) { $metadata = $this->get_stripe_meta_data( $feed, $entry, $form ); if ( ! empty( $metadata ) ) { $payment_intent_object->metadata = $metadata; } + $payment_intent_object->description = $this->get_payment_description( $entry, $submission_data, $feed ); $this->api->save_payment_intent( $payment_intent_object ); @@ -5346,6 +5382,7 @@ public function complete_checkout_session( $session, $entry, $feed, $form ) { } } } + $this->release_checkout_session_lock( $session['id'] ); return $action; @@ -5501,7 +5538,7 @@ public function get_customer( $customer_id, $feed = array(), $entry = array(), $ } if ( $customer_id ) { - $this->log_debug( __METHOD__ . '(): Retrieving customer id => ' . print_r( $customer_id, 1 ) ); + $this->log_debug( __METHOD__ . '(): Retrieving customer id => ' . print_r( $customer_id, true ) ); $customer = $this->api->get_customer( $customer_id ); if ( ! is_wp_error( $customer ) ) { @@ -5531,9 +5568,14 @@ public function get_customer( $customer_id, $feed = array(), $entry = array(), $ * @return WP_Error|\Stripe\Customer The Stripe customer object. */ public function create_customer( $customer_meta, $feed, $entry, $form ) { - // Log the customer to be created. - $this->log_debug( __METHOD__ . '(): Customer meta to be created => ' . print_r( $customer_meta, 1 ) ); + $tracking_id = rgpost( 'tracking_id' ); + if ( $tracking_id ) { + $tracking = 'for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id; + $this->log_debug( __METHOD__ . '(): Creating Customer ' . $tracking ); + } + + $this->log_debug( __METHOD__ . '(): Customer meta to be created => ' . print_r( $customer_meta, true ) ); $customer = $this->api->create_customer( $customer_meta ); if ( is_wp_error( $customer ) ) { @@ -5698,7 +5740,13 @@ public function create_plan( $plan_id, $feed, $payment_amount, $trial_period_day ); // Log the plan to be created. - $this->log_debug( __METHOD__ . '(): Plan to be created => ' . print_r( $plan_meta, 1 ) ); + $tracking_id = rgpost( 'tracking_id' ); + if ( $tracking_id ) { + $form = GFAPI::get_form( rgar( $feed, 'form_id' ) ); + $tracking = 'for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id; + $this->log_debug( __METHOD__ . '(): Creating Plan ' . $tracking ); + } + $this->log_debug( __METHOD__ . '(): Plan to be created => ' . print_r( $plan_meta, true ) ); // Create Stripe plan. $plan = $this->api->create_plan( $plan_meta ); @@ -5825,7 +5873,7 @@ public function handle_subscription_payment( $subscription, $invoice = null ) { } elseif ( rgar( $payment_intent, 'status' ) === 'requires_action' ) { $_POST['stripe_response'] = json_encode( array( - 'id' => $stripe_response->id, + 'id' => rgobj( $stripe_response, 'id' ), 'client_secret' => $payment_intent->client_secret, 'amount' => $payment_intent->amount, 'subscription' => rgar( $subscription, 'id' ), @@ -6200,7 +6248,24 @@ public function callback() { 'webhook api_version' => $event->api_version, ); - $this->log_debug( __METHOD__ . '() Webhook event details => ' . print_r( $log_details, 1 ) ); + $supported_event_types = array( + 'charge.expired', + 'charge.refunded', + 'charge.captured', + 'customer.subscription.deleted', + 'invoice.payment_succeeded', + 'invoice.payment_failed', + 'payment_intent.succeeded', + 'payment_intent.payment_failed', + 'checkout.session.completed', + 'checkout.session.async_payment_succeeded', + 'checkout.session.async_payment_failed', + ); + + + if ( in_array( $type, $supported_event_types ) ) { + $this->log_debug( __METHOD__ . '() Webhook event details => ' . print_r( $log_details, true ) ); + } switch ( $type ) { @@ -6421,9 +6486,9 @@ public function callback() { $form = GFAPI::get_form( $entry['form_id'] ); $feed = $this->get_payment_feed( $entry, $form ); $action = array_merge( $action, $this->complete_checkout_session( $session, $entry, $feed, $form ) ); - $this->log_debug( __METHOD__ . "(): Stripe Checkout session will be completed by the webhook event {$type}." ); + $this->log_debug( __METHOD__ . "(): Stripe Checkout session " . $session_id . " will be completed by the webhook event {$type}." ); } else { - $this->log_debug( __METHOD__ . "(): Not completing the Stripe Checkout Session during the webhook event {$type}." ); + $this->log_debug( __METHOD__ . "(): Not completing the Stripe Checkout Session " . $session_id . " during the webhook event {$type}." ); } break; @@ -6431,14 +6496,14 @@ public function callback() { $session_id = rgars( $event, 'data/object/id' ); $session = $this->api->get_checkout_session( $session_id ); if ( is_wp_error( $session ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $session->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for session ' . $session_id . ' ' . $session->get_error_message() ); return new WP_Error( 'invalid_stripe_session', esc_html__( 'Invalid Checkout Session', 'gravityformsstripe' ) . ': ' . $session->get_error_message() ); } $entry = $this->get_entry_by_session_id( $session_id, $action, $event ); if ( is_wp_error( $entry ) ) { - $this->log_error( __METHOD__ . '(): A Stripe API error occurs; ' . $entry->get_error_message() ); + $this->log_error( __METHOD__ . '(): A Stripe API error occurs for session ' . $session_id . ' ' . $entry->get_error_message() ); return $entry; } @@ -6447,7 +6512,7 @@ public function callback() { $action['amount'] = $this->get_amount_import( rgars( $event, 'data/object/amount_total' ), $entry['currency'] ); $action['entry_id'] = $entry['id']; - $this->log_debug( __METHOD__ . "(): Stripe Checkout async payment has failed. Webhook: {$type}." ); + $this->log_debug( __METHOD__ . "(): Stripe Checkout session ' . $session_id . ' async payment has failed. Webhook: {$type}." ); break; @@ -6466,7 +6531,6 @@ public function callback() { ); if ( empty( $entries ) ) { - $this->log_debug( __METHOD__ . '(): Entry associated with Payment Element Payment Intent ID: ' . $payment_intent_id . ' not found. Bypassing webhook.' ); $action['abort_callback'] = true; } elseif ( rgar( $entries[0], 'payment_status' ) !== 'Processing' ) { @@ -6498,9 +6562,7 @@ public function callback() { ); if ( empty( $entries ) ) { - $this->log_debug( __METHOD__ . '(): Entry associated with Payment Element Payment Intent ID: ' . $payment_intent_id . ' not found. Bypassing webhook.' ); $action['abort_callback'] = true; - } else { $entry = $entries[0]; @@ -6527,8 +6589,6 @@ public function callback() { } if ( rgempty( 'entry_id', $action ) ) { - $this->log_debug( __METHOD__ . '() entry_id not set for callback action; no further processing required.' ); - return false; } @@ -6660,7 +6720,7 @@ public function get_webhook_event() { // If the webhook event has already been retrieved, return it. if ( ! empty( self::$webhook_event ) ) { - $this->log_debug( __METHOD__ . '(): Returning cached webhook event.'); + $this->log_debug( __METHOD__ . '(): Returning cached webhook event.' ); return self::$webhook_event; @@ -7139,7 +7199,7 @@ public function get_payment_element_capture_method( $form, $feed ) { $authorization_only = apply_filters( 'gform_stripe_payment_element_authorization_only', false, $form, $feed ); if ( $authorization_only ) { - $this->log_debug( __METHOD__ . '(): The gform_stripe_payment_element_authorization_only filter was used to prevent capture.' ); + $this->log_debug( __METHOD__ . '(): The gform_stripe_payment_element_authorization_only filter was used to prevent capture tracking id:' . md5( rggpost( 'state_' . rgar( $form, 'id' ) ) ) ); return 'manual'; } @@ -8308,7 +8368,7 @@ public function get_subscription_params( $subscription_params, $customer, $plan, $this->log_debug( __METHOD__ . '(): Change subscription parameters "plan" to "items[\'plan\']"' ); } - $this->log_debug( __METHOD__ . '(): Subscription parameters => ' . print_r( $subscription_params, 1 ) ); + $this->log_debug( __METHOD__ . '(): Subscription parameters for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) . ' => ' . print_r( $subscription_params, true ) ); } return $subscription_params; @@ -8546,7 +8606,7 @@ private function include_stripe_api_for_entry( $entry_id ) { * @param array $entry The entry we're viewing. */ public function maybe_display_refund_button( $form_id, $entry ) { - if ( $entry['payment_status'] !== 'Paid' || ! $this->is_payment_gateway( $entry['id'] ) ) { + if ( $entry['payment_status'] !== 'Paid' || ! $this->is_payment_gateway( $entry['id'] ) || empty( $entry['transaction_id'] ) ) { return; } diff --git a/includes/api/model/class-account.php b/includes/api/model/class-account.php index 9991e4a..7fbcb6b 100644 --- a/includes/api/model/class-account.php +++ b/includes/api/model/class-account.php @@ -10,6 +10,31 @@ */ class Account extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $capabilities; + public $company; + public $controller; + public $country; + public $email; + public $individual; + public $metadata; + public $requirements; + public $settings; + public $type; + public $business_type; + public $business_profile; + public $charges_enabled; + public $default_currency; + public $details_submitted; + public $external_accounts; + public $future_requirements; + public $payouts_enabled; + public $tos_acceptance; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-base.php b/includes/api/model/class-base.php index d70e6c4..4541f29 100644 --- a/includes/api/model/class-base.php +++ b/includes/api/model/class-base.php @@ -27,6 +27,15 @@ class Base implements \ArrayAccess { */ private $original_values = array(); + /** + * Initialize properties that will be used throughout this class, all subclasses, and link to the Stripe API. + * + * @since 5.5.2 + */ + public $id; + public $object; + public $created; + /** * Instantiates the object. * @@ -178,6 +187,7 @@ protected function serialize_parameters( $supported_params ) { * * @return void */ + #[\ReturnTypeWillChange] public function offsetSet( $offset, $value ) { $this->{$offset} = $value; } @@ -191,6 +201,7 @@ public function offsetSet( $offset, $value ) { * * @return bool Returns true if the offset exists, false otherwise. */ + #[\ReturnTypeWillChange] public function offsetExists( $offset ) { return isset( $this->{$offset} ); } @@ -204,6 +215,7 @@ public function offsetExists( $offset ) { * * @return void */ + #[\ReturnTypeWillChange] public function offsetUnset( $offset ) { unset( $this->{$offset} ); } @@ -217,6 +229,7 @@ public function offsetUnset( $offset ) { * * @return mixed Returns the value at the specified offset, or null if it doesn't exist. */ + #[\ReturnTypeWillChange] public function offsetGet( $offset ) { return isset( $this->{$offset} ) ? $this->{$offset} : null; } diff --git a/includes/api/model/class-charge.php b/includes/api/model/class-charge.php index ba06bc1..87f6ffe 100644 --- a/includes/api/model/class-charge.php +++ b/includes/api/model/class-charge.php @@ -14,6 +14,51 @@ */ class Charge extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount; + public $application; + public $balance_transaction; + public $captured; + public $currency; + public $customer; + public $description; + public $disputed; + public $livemode; + public $metadata; + public $outcome; + public $paid; + public $payment_intent; + public $payment_method; + public $receipt_number; + public $refunded; + public $review; + public $shipping; + public $statement_descriptor; + public $status; + public $transfer; + public $amount_captured; + public $amount_refunded; + public $application_fee; + public $application_fee_amount; + public $billing_details; + public $calculated_statement_descriptor; + public $failure_balance_transaction; + public $failure_code; + public $failure_message; + public $fraud_details; + public $on_behalf_of; + public $payment_method_details; + public $receipt_email; + public $reciept_url; + public $source_transfer; + public $statement_descriptor_suffix; + public $transfer_data; + public $transfer_group; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-coupon.php b/includes/api/model/class-coupon.php index 3d34e58..f740ee6 100644 --- a/includes/api/model/class-coupon.php +++ b/includes/api/model/class-coupon.php @@ -11,6 +11,26 @@ */ class Coupon extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount_off; + public $currency; + public $duration; + public $livemode; + public $metadata; + public $name; + public $percent_off; + public $valid; + public $applies_to; + public $currency_options; + public $duration_in_months; + public $max_redemptions; + public $redeem_by; + public $times_redeemed; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-customer.php b/includes/api/model/class-customer.php index 8978a94..b432cfa 100644 --- a/includes/api/model/class-customer.php +++ b/includes/api/model/class-customer.php @@ -11,6 +11,37 @@ */ class Customer extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $address; + public $balance; + public $currency; + public $description; + public $discount; + public $email; + public $livemode; + public $metadata; + public $name; + public $phone; + public $shipping; + public $sources; + public $subscriptions; + public $tax; + public $tax_ids; + public $cash_balance; + public $default_source; + public $delinquent; + public $invoice_credit_balance; + public $invoice_prefix; + public $invoice_settings; + public $next_invoice_sequence; + public $preferred_locales; + public $tax_exempt; + public $test_clock; + /** * Gets the supported parameters for the update endpoint. * diff --git a/includes/api/model/class-customerbalancetransaction.php b/includes/api/model/class-customerbalancetransaction.php index 55d17c9..e7e60a5 100644 --- a/includes/api/model/class-customerbalancetransaction.php +++ b/includes/api/model/class-customerbalancetransaction.php @@ -11,6 +11,23 @@ */ class CustomerBalanceTransaction extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount; + public $currency; + public $customer; + public $description; + public $invoice; + public $livemode; + public $metadata; + public $type; + public $credit_note; + public $ending_balance; + + /** * This method is not supported by this object * diff --git a/includes/api/model/class-event.php b/includes/api/model/class-event.php index 6507f65..a3a9c0e 100644 --- a/includes/api/model/class-event.php +++ b/includes/api/model/class-event.php @@ -12,6 +12,19 @@ */ class Event extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $account; + public $api_version; + public $data; + public $livemode; + public $request; + public $type; + public $pending_webhooks; + /** * This method is not supported by this object * @@ -58,8 +71,8 @@ public static function construct_event( $payload, $sig_header, $secret, $api, $t try { self::verify_header( $payload, $sig_header, $secret, $tolerance ); - } catch ( Exception $e ) { - return new WP_Error( $e->getMessage() ); + } catch ( \Exception $e ) { + return new \WP_Error( $e->getMessage() ); } $data = \json_decode( $payload, true ); @@ -67,7 +80,7 @@ public static function construct_event( $payload, $sig_header, $secret, $api, $t if ( null === $data && \JSON_ERROR_NONE !== $json_error ) { $msg = "Invalid payload: {$payload} " . "(json_last_error() was {$json_error})"; - return new WP_Error( $msg ); + return new \WP_Error( $msg ); } return new Event( $data, $api ); @@ -82,7 +95,7 @@ public static function construct_event( $payload, $sig_header, $secret, $api, $t * @param string $secret secret used to generate the signature * @param int $tolerance maximum difference allowed between the header's timestamp and the current time * - * @throws Exception if the verification fails + * @throws \Exception if the verification fails * * @return bool */ @@ -91,10 +104,10 @@ public static function verify_header( $payload, $header, $secret, $tolerance = n $timestamp = self::get_timestamp( $header ); $signatures = self::get_signatures( $header, self::EXPECTED_SCHEME ); if ( -1 === $timestamp ) { - throw \Exception( 'Unable to extract timestamp and signatures from header' ); + throw new \Exception( 'Unable to extract timestamp and signatures from header' ); } if ( empty( $signatures ) ) { - throw \Exception( 'No signatures found with expected scheme' ); + throw new \Exception( 'No signatures found with expected scheme' ); } // Check if expected signature is found in list of signatures from diff --git a/includes/api/model/class-invoice.php b/includes/api/model/class-invoice.php index 6ae6189..b5c1de6 100644 --- a/includes/api/model/class-invoice.php +++ b/includes/api/model/class-invoice.php @@ -12,6 +12,94 @@ */ class Invoice extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $application; + public $attempted; + public $charge; + public $currency; + public $custom_fields; + public $customer; + public $description; + public $discount; + public $discounts; + public $due_date; + public $footer; + public $lines; + public $livemode; + public $metadata; + public $number; + public $paid; + public $payment_intent; + public $quote; + public $receipt_number; + public $rendering; + public $statement_descriptor; + public $status; + public $subscription; + public $subtotal; + public $tax; + public $total; + public $account_country; + public $account_name; + public $account_tax_ids; + public $amount_due; + public $amount_paid; + public $amount_remaining; + public $amount_shipping; + public $application_fee_amount; + public $attempt_count; + public $auto_advance; + public $automatic_tax; + public $billing_reason; + public $collection_method; + public $customer_address; + public $customer_email; + public $customer_name; + public $customer_phone; + public $customer_shipping; + public $customer_tax_exempt; + public $customer_tax_ids; + public $default_payment_method; + public $default_source; + public $default_tax_rates; + public $effective_at; + public $ending_balance; + public $from_invoice; + public $hosted_invoice_url; + public $invoice_pdf; + public $issuer; + public $last_finalization_error; + public $latest_revision; + public $next_payment_attempt; + public $on_behalf_of; + public $paid_out_of_band; + public $payment_settings; + public $period_end; + public $period_start; + public $post_payment_credit_notes_amount; + public $pre_payment_credit_notes_amount; + public $rendering_options; + public $shipping_cost; + public $shipping_details; + public $starting_balance; + public $status_transitions; + public $subscription_details; + public $subscription_proration_date; + public $subtotal_excluding_tax; + public $test_clock; + public $threshold_reason; + public $total_discount_amounts; + public $total_excluding_tax; + public $total_tax_amounts; + public $transfer_data; + public $webhooks_delivered_at; + + + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-invoiceitem.php b/includes/api/model/class-invoiceitem.php index eb68fb9..6edbaea 100644 --- a/includes/api/model/class-invoiceitem.php +++ b/includes/api/model/class-invoiceitem.php @@ -11,6 +11,35 @@ */ class InvoiceItem extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount; + public $currency; + public $customer; + public $date; + public $description; + public $discounts; + public $invoice; + public $livemode; + public $metadata; + public $period; + public $plan; + public $price; + public $quantity; + public $subscription; + public $unit_amount; + public $discountable; + public $proration; + public $subscription_item; + public $tax_rates; + public $test_clock; + public $unit_amount_decimal; + + + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-paymentintent.php b/includes/api/model/class-paymentintent.php index 7965d8f..74ab3a9 100644 --- a/includes/api/model/class-paymentintent.php +++ b/includes/api/model/class-paymentintent.php @@ -15,6 +15,50 @@ class PaymentIntent extends Base { const OBJECT_NAME = 'payment_intent'; + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount; + public $application; + public $capture_method; + public $client_secret; + public $currency; + public $customer; + public $description; + public $invoice; + public $livemode; + public $metadata; + public $payment_method; + public $payment_method_types; + public $processing; + public $review; + public $shipping; + public $source; + public $statement_descriptor; + public $status; + public $amount_capturable; + public $amount_details; + public $amount_received; + public $application_fee_amount; + public $automatic_payment_methods; + public $canceled_at; + public $cancellation_reason; + public $confirmation_method; + public $last_payment_error; + public $latest_charge; + public $next_action; + public $on_behalf_of; + public $payment_method_configuration_details; + public $payment_method_options; + public $receipt_email; + public $setup_future_usage; + public $statement_descriptor_suffix; + public $transfer_data; + public $transfer_group; + + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-paymentmethod.php b/includes/api/model/class-paymentmethod.php index 5de019b..bd416d0 100644 --- a/includes/api/model/class-paymentmethod.php +++ b/includes/api/model/class-paymentmethod.php @@ -11,6 +11,18 @@ */ class PaymentMethod extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $card; + public $customer; + public $livemode; + public $metadata; + public $type; + public $billing_details; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-plan.php b/includes/api/model/class-plan.php index 19bd302..c2795e3 100644 --- a/includes/api/model/class-plan.php +++ b/includes/api/model/class-plan.php @@ -12,6 +12,29 @@ */ class Plan extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $active; + public $amount; + public $currency; + public $interval; + public $livemode; + public $metadata; + public $nickname; + public $product; + public $aggregate_usage; + public $amount_decimal; + public $billing_scheme; + public $interval_count; + public $tiers; + public $tiers_mode; + public $transform_usage; + public $trial_period_days; + public $usage_type; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-product.php b/includes/api/model/class-product.php index 71f7ef2..bc55860 100644 --- a/includes/api/model/class-product.php +++ b/includes/api/model/class-product.php @@ -11,6 +11,27 @@ */ class Product extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $active; + public $description; + public $features; + public $images; + public $livemode; + public $metadata; + public $name; + public $statement_descriptor; + public $updated; + public $url; + public $default_price; + public $package_dimensions; + public $shippable; + public $tax_code; + public $unit_label; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-refund.php b/includes/api/model/class-refund.php index ebd9768..f21344b 100644 --- a/includes/api/model/class-refund.php +++ b/includes/api/model/class-refund.php @@ -11,6 +11,29 @@ */ class Refund extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $amount; + public $balance_transaction; + public $charge; + public $currency; + public $description; + public $metadata; + public $payment_intent; + public $reason; + public $receipt_number; + public $status; + public $destination_details; + public $failure_balance_transaction; + public $failure_reason; + public $instructions_email; + public $next_action; + public $source_transfer_reversal; + public $transfer_reversal; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-session.php b/includes/api/model/class-session.php index 39a88ac..c3709de 100644 --- a/includes/api/model/class-session.php +++ b/includes/api/model/class-session.php @@ -11,6 +11,61 @@ */ class Session extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $consent; + public $currency; + public $custom_fields; + public $customer; + public $expires_at; + public $invoice; + public $line_items; + public $livemode; + public $locale; + public $metadata; + public $mode; + public $payment_intent; + public $payment_method_types; + public $payment_status; + public $return_url; + public $status; + public $subscription; + public $url; + public $after_expiration; + public $allow_promotion_codes; + public $amount_subtotal; + public $amount_total; + public $automatic_tax; + public $billing_address_collection; + public $cancel_url; + public $client_reference_id; + public $consent_collection; + public $custom_text; + public $customer_creation; + public $customer_details; + public $customer_email; + public $invoice_creation; + public $payment_link; + public $payment_method_collection; + public $oayment_method_configuration_details; + public $payment_method_options; + public $phone_number_collection; + public $recovered_from; + public $redirect_on_completion; + public $setup_intent; + public $shipping_cost; + public $shipping_details; + public $shipping_address_collection; + public $shipping_options; + public $submit_type; + public $success_url; + public $tax_id_collection; + public $total_details; + public $ui_mode; + /** * This method is not supported by this object * diff --git a/includes/api/model/class-setupintent.php b/includes/api/model/class-setupintent.php index 62ed709..5e16217 100644 --- a/includes/api/model/class-setupintent.php +++ b/includes/api/model/class-setupintent.php @@ -11,6 +11,34 @@ */ class SetupIntent extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $application; + public $client_secret; + public $customer; + public $description; + public $livemode; + public $metadata; + public $payment_method; + public $payment_method_types; + public $status; + public $usage; + public $attach_to_self; + public $automatic_payment_methods; + public $cancellation_reason; + public $flow_direction; + public $last_setup_error; + public $latest_attempt; + public $mandate; + public $next_action; + public $on_behalf_of; + public $payment_method_configuration_details; + public $payment_method_options; + public $single_use_mandate; + /** * Returns the API endpoint for this object. * diff --git a/includes/api/model/class-subscription.php b/includes/api/model/class-subscription.php index 8d00184..914d314 100644 --- a/includes/api/model/class-subscription.php +++ b/includes/api/model/class-subscription.php @@ -14,6 +14,57 @@ */ class Subscription extends Base { + /** + * Initialize properties that will be used throughout this class and link to the Stripe API. + * + * @since 5.5.2 + */ + public $application; + + public $cancel_at_period_end; + public $currency; + public $customer; + public $discount; + public $discounts; + public $items; + public $livemode; + public $metadata; + public $quantity; + public $schedule; + public $start_date; + public $status; + public $application_fee_percent; + public $automatic_tax; + public $billing_cycle_anchor_confiig; + public $billing_cycle_anchor; + public $billing_thresholds; + public $cancel_at; + public $canceled_at; + public $cancellation_details; + public $collection_method; + public $current_period_end; + public $current_period_start; + public $days_until_due; + public $default_payment_method; + public $default_source; + public $default_tax_rates; + public $ended_at; + public $invoice_settings; + public $latest_invoice; + public $on_behalf_of; + public $next_pending_invoice_item_invoice; + public $pause_collection; + public $payment_settings; + public $pending_invoice_item_interval; + public $pending_setup_intent; + public $pending_update; + public $test_clock; + public $transfer_data; + public $trial_end; + public $trial_start; + public $trial_settings; + + /** * Returns the API endpoint for this object. * diff --git a/includes/payment-element/class-gf-payment-element-payment.php b/includes/payment-element/class-gf-payment-element-payment.php index 0542bc1..2e7f3ad 100644 --- a/includes/payment-element/class-gf-payment-element-payment.php +++ b/includes/payment-element/class-gf-payment-element-payment.php @@ -93,7 +93,7 @@ public function get_payment_methods( $feed, $form ) { $methods = apply_filters( 'gform_stripe_payment_element_payment_methods', array(), $feed, $form ); if ( ! empty( $methods ) ) { - $this->addon->log_debug( __METHOD__ . '() - Payment methods filter is being used, feed type is: ' . $feed['meta']['transactionType'] . ', payment methods: ' . print_r( $methods, true ) ); + $this->addon->log_debug( __METHOD__ . '() - Payment methods filter is being used for submission with form_id: ' . rgar( $form, 'id' ) . ' and feed_id: ' . rgar( $feed, 'id' ) . ', feed type is: ' . $feed['meta']['transactionType'] . ', payment methods: ' . json_encode( $methods ) . ', tracking id: ' . rgpost( 'tracking_id' ) ); } return $methods; @@ -194,7 +194,9 @@ public function create_payment_intent( $order_data, $feed_id, $form_id, $api, $e ); } - $this->addon->log_debug( __METHOD__ . '(): Creating intent with meta: ' . print_r( $intent_meta, true ) ); + + $this->addon->log_debug( __METHOD__ . '(): Creating intent for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) ); + $this->addon->log_debug( __METHOD__ . '(): Intent meta to be created: ' . print_r( $intent_meta, true ) ); return $api->create_payment_intent( $intent_meta ); } @@ -407,9 +409,10 @@ public function get_subscription_intent( $subscription, $feed, $api ) { public function get_subscription_invoice_intent( $subscription, $feed, $api ) { $invoice = rgar( $subscription, 'latest_invoice' ); $finalized_invoice = $api->finalize_invoice( $invoice_id ); + $form_id = rgpost( 'form_id' ); if ( is_wp_error( $finalized_invoice ) ) { - $this->log_debug( __METHOD__ . '(): Unable to finalize invoice; ' . $finalized_invoice->get_error_message() ); + $this->log_debug( __METHOD__ . '(): Unable to finalize invoice; ' . $finalized_invoice->get_error_message() . ', tracking id: ' . rgpost( 'tracking_id' ) ); return $finalized_invoice; } diff --git a/includes/payment-element/class-gf-payment-element-submission.php b/includes/payment-element/class-gf-payment-element-submission.php index a799385..979b871 100644 --- a/includes/payment-element/class-gf-payment-element-submission.php +++ b/includes/payment-element/class-gf-payment-element-submission.php @@ -98,7 +98,7 @@ public function __construct( $addon ) { public function validate( $form_id ) { // Modify the entry values as necessary before creating the draft. add_filter( 'gform_save_field_value', array( $this, 'stripe_payment_element_save_draft_values' ), 10, 5 ); - + GFCommon::log_debug( __METHOD__ . '(): Validating form: ' . $form_id ); return GFAPI::validate_form( $form_id ); } @@ -115,6 +115,8 @@ public function create_draft_submission( $form_id, $stripe_encrypted_params ) { $files = array(); $form = GFAPI::get_form( $form_id ); + $feed = $this->addon->get_feed( rgpost( 'feed_id' ) ); + $tracking_id = rgget( 'tracking_id' ); $field_values = RGForms::post( 'gform_field_values' ); $lead = GFFormsModel::get_current_lead(); $lead['stripe_encrypted_params'] = $stripe_encrypted_params; @@ -135,7 +137,7 @@ public function create_draft_submission( $form_id, $stripe_encrypted_params ) { // Adding $_POST and removing User Registration passwords from submitted values. add_filter( 'gform_submission_values_pre_save', array( $this, 'filter_draft_submission_values' ), 10, 2 ); - + GFCommon::log_debug( __METHOD__ . '(): Creating draft submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); $resume_token = GFFormsModel::save_draft_submission( $form, $lead, @@ -280,12 +282,15 @@ public function process_submission( $form_id, $feed_id, $draft_id, $intent, $sub $this->payment_object_id = $intent ? $intent->id : null; $this->subscription_id = $subscription_id; - $form = GFAPI::get_form( $this->form_id ); + $form = GFAPI::get_form( $this->form_id ); + $feed = $this->addon->get_feed( $feed_id ); + $tracking_id = rgget( 'tracking_id' ); // Prepare the submission values from the draft created while validating the form. $draft = GFFormsModel::get_draft_submission_values( $this->draft_id ); $submission = json_decode( rgar( $draft, 'submission' ), true ); if ( ! $submission ) { + $this->addon->log_debug( __METHOD__ . '(): Aborting Submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), Unable to retrieve the submission values from the draft' . ', tracking id: ' . $tracking_id ); return false; } @@ -295,8 +300,9 @@ public function process_submission( $form_id, $feed_id, $draft_id, $intent, $sub } // This adds the entry, but doesn't run the complete form processing flow. + GFCommon::log_debug( __METHOD__ . '(): Creating entry for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); $this->entry_id = GFAPI::add_entry( $submission['partial_entry'] ); - + $this->addon->log_debug( __METHOD__ . '(): Entry with Id ' . $this->entry_id . ' created for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id:' . $tracking_id ); // If there is a user registration password in the partial entry, add it to the entry meta. if ( ! empty( $submission['partial_entry']['ur_pass'] ) ) { gform_update_meta( $this->entry_id, 'userregistration_password', $submission['partial_entry']['ur_pass'] ); @@ -380,13 +386,16 @@ function( $validation_result, $form ) { GFFormsModel::delete_draft_submission( $this->draft_id ); // Process the form + GFCommon::log_debug( __METHOD__ . '(): Processing submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); GFFormDisplay::process_form( $this->form_id, GFFormDisplay::SUBMISSION_INITIATED_BY_WEBFORM ); // Get the entry and form to handle confirmation. - $entry = GFAPI::get_entry( $this->entry_id ); - $form = GFAPI::get_form( $this->form_id ); + $entry = GFAPI::get_entry( $this->entry_id ); + $form = GFAPI::get_form( $this->form_id ); + GFCommon::log_debug( __METHOD__ . '(): handling confirmation for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); $confirmation = GFFormDisplay::handle_confirmation( $form, $entry, isset( $_POST['gform_ajax'] ) ); + $this->addon->log_debug( __METHOD__ . '(): Submission Confirmation for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id . ' :- ' . print_r( $confirmation, true ) ); if ( is_array( $confirmation ) && isset( $confirmation['redirect'] ) ) { header( "Location: {$confirmation['redirect']}" ); exit; diff --git a/includes/payment-element/class-gf-payment-element.php b/includes/payment-element/class-gf-payment-element.php index ff16c76..0592a11 100644 --- a/includes/payment-element/class-gf-payment-element.php +++ b/includes/payment-element/class-gf-payment-element.php @@ -204,14 +204,17 @@ public function start_checkout() { $form_id = absint( rgpost( 'form_id' ) ); $feed_id = absint( rgpost( 'feed_id' ) ); - + $feed = $this->addon->get_feed( $feed_id ); + $form = GFAPI::get_form( $form_id ); if ( empty( $form_id ) || empty( $feed_id ) ) { wp_send_json_error( 'missing required parameters', 400 ); return; } - $this->check_form_requires_login_nonce( $form_id ); + $this->addon->log_debug( __METHOD__ . '() - Starting checkout for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) ); + $this->check_form_requires_login_nonce( $form_id ); + GFCommon::log_debug( __METHOD__ . '() - Validating form: ' . rgar( $form, 'title' ) . ' and feed: ' . rgars( $feed, 'meta/feedName' ) . ', tracking id: ' . rgpost( 'tracking_id' ) ); $validation_result = $this->submission->validate( $form_id ); $is_spam = rgar( $validation_result, 'is_spam', false ); $is_valid = rgar( $validation_result, 'is_valid' ); @@ -220,6 +223,7 @@ public function start_checkout() { $order_data = $this->submission->extract_order_from_submission( $feed_id, $form_id ); if ( ! $is_valid ) { + $this->addon->log_debug( __METHOD__ . '() - Submission is not valid, aborting submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) ); wp_send_json_success( array( 'is_valid' => false ) ); return; } elseif ( $is_spam ) { @@ -228,7 +232,6 @@ public function start_checkout() { } $order_data['payment_method'] = $payment_method; - $feed = $this->addon->get_feed( $feed_id ); $subscription_id = null; $api = $this->get_api_for_feed( $feed_id ); $subscription = null; @@ -236,6 +239,7 @@ public function start_checkout() { if ( rgars( $feed, 'meta/transactionType' ) === 'subscription' ) { $subscription = $this->payment->create_subscription( $order_data, $feed_id, $form_id, $api ); if ( is_wp_error( $subscription ) ) { + $this->addon->log_debug( __METHOD__ . '() - Could not create subscription, aborting submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) ); wp_send_json_error( $subscription->get_error_message(), 400 ); return; } @@ -247,6 +251,7 @@ public function start_checkout() { } if ( is_wp_error( $intent ) ) { + $this->addon->log_debug( __METHOD__ . '() - Could not create payment intent, aborting submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . rgpost( 'tracking_id' ) ); wp_send_json_error( $intent ); return; } @@ -288,34 +293,42 @@ public function start_checkout() { public function handle_redirect() { $source_redirect = rgget( 'source_redirect_slug' ); + $tracking_id = rgget( 'tracking_id' ); + $form_id = rgget( 'form_id' ); + $feed_id = rgget( 'feed_id' ); + $form = GFAPI::get_form( $form_id ); + $feed = $this->addon->get_feed( $feed_id ); + + $this->addon->log_debug( __METHOD__ . '() - Handling redirect for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); + if ( ! empty( $source_redirect ) ) { - gf_stripe()->log_debug( __METHOD__ . '() - Request is a redirect from SCA. Ignore.' ); + gf_stripe()->log_debug( __METHOD__ . '() - Request is a redirect from SCA. Ignore submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); return false; } $resume_token = rgget( 'resume_token' ); - $draft = GFFormsModel::get_draft_submission_values( $resume_token ); - $submission = json_decode( rgar( $draft, 'submission' ), true ); - gf_stripe()->log_debug( __METHOD__ . "() - resume_token: {$resume_token}, draft: " . print_r( $draft, true ) ); + GFCommon::log_debug( __METHOD__ . '() - Getting draft for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id . ', resume token: ' . $resume_token ); + $draft = GFFormsModel::get_draft_submission_values( $resume_token ); + $submission = json_decode( rgar( $draft, 'submission' ), true ); if ( ! $submission ) { - gf_stripe()->log_debug( __METHOD__ . '() - No submission. Aborting' ); + gf_stripe()->log_debug( __METHOD__ . '() - No submission found for resume token: ' . $resume_token . ', aborting submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); return false; } $params = $this->decrypt_return_params( rgars( $submission, 'partial_entry/stripe_encrypted_params' ) ); - $feed_id = rgar( $params, 'feed_id' ); - gf_stripe()->log_debug( __METHOD__ . '() - Stripe encrypted params: ' . print_r( $params, true ) ); + gf_stripe()->log_debug( __METHOD__ . '() - Stripe encrypted params for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id . ' :- ' . print_r( $params, true ) ); $intent = $this->validate_redirect_intent( $params, $this->get_api_for_feed( $feed_id ) ); if ( $intent ) { $this->maybe_set_link_cookie( $intent ); + } elseif ( $intent === false ) { + return; } add_filter( 'gform_entry_id_pre_save_lead', array( $this->submission, 'get_pending_entry_id' ), 10, 2 ); add_filter( 'gform_field_validation', array( $this->submission, 'maybe_skip_field_validation' ), 10, 4 ); - $form_id = rgar( $params, 'form_id' ); - gf_stripe()->log_debug( __METHOD__ . '() - Processing submission' ); + gf_stripe()->log_debug( __METHOD__ . '() - Processing submission for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . '), tracking id: ' . $tracking_id ); // Remove this action to prevent processing the submission twice. remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); // Simulate the submission. @@ -373,7 +386,7 @@ public function subscribe( $feed, $submission_data, $form, $entry ) { $subscription = $api->get_subscription( $this->get_subscription_id() ); // If the subscription is using `send_invoice` and has a trial, the intent will be null because there wasn't anything paid until this point. - if ( $intent === null || $intent->status === 'processing' ) { + if ( $intent === null || rgobj( $intent, 'status' ) === 'processing' ) { return array( 'is_success' => true, 'subscription_id' => $subscription->id, @@ -384,7 +397,7 @@ public function subscribe( $feed, $submission_data, $form, $entry ) { ); } - if ( ! is_wp_error( $subscription ) ) { + if ( $subscription && ! is_wp_error( $subscription ) ) { $subscription_data = array( 'is_success' => true, @@ -444,7 +457,7 @@ public function complete_processing_entry( $entry, $action, $event ) { * @return array */ public function complete_single_purchase( $entry, $feed, $action, $event ) { - + $this->addon->log_debug( __METHOD__ . '() - Completing single purchase for entry ID: ' . $entry['id'] . ' and feed ID: ' . $feed['id'] ); $action['entry_id'] = $entry['id']; $action['type'] = 'complete_payment'; $action['amount'] = $this->addon->get_amount_import( rgars( $event, 'data/object/amount' ), $entry['currency'] ); @@ -466,6 +479,7 @@ public function complete_single_purchase( $entry, $feed, $action, $event ) { * @return array */ public function complete_subscription( $entry, $feed, $action, $event ) { + $this->addon->log_debug( __METHOD__ . '() - Completing subscription for entry ID: ' . $entry['id'] . ' and feed ID: ' . $feed['id'] ); $api = $this->get_api_for_feed( $feed['id'] ); $intent = $this->payment->get_stripe_payment_object( $feed, @@ -555,6 +569,10 @@ public function decrypt_return_params( $encrypted_params ) { */ public function validate_redirect_intent( $parameters, $api ) { + $form_id = rgar( $parameters, 'form_id' ); + $feed_id = rgar( $parameters, 'feed_id' ); + $form = GFAPI::get_form( $form_id ); + $feed = $this->addon->get_feed( $feed_id ); $intent_id = rgar( $parameters, 'intent_id' ); $invoice_id = rgar( $parameters, 'invoice_id' ); $this->payment->intent_id = $intent_id; @@ -569,7 +587,7 @@ public function validate_redirect_intent( $parameters, $api ) { $intent = $api->get_payment_intent( $intent_id, array( 'expand' => array( 'payment_method' ) ) ); $request_client_secret = rgget( 'payment_intent_client_secret' ); } else { - gf_stripe()->log_debug( __METHOD__ . '() - Invalid intent id. Aborting' ); + gf_stripe()->log_debug( __METHOD__ . '() - Invalid intent id. Aborting tracking id:' . rgget( 'tracking_id' ) . ', for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ')' ); return false; } @@ -577,6 +595,8 @@ public function validate_redirect_intent( $parameters, $api ) { // This happens when a payment method that has an intermediate step fails. if ( $intent->status === 'requires_payment_method' ) { gf_stripe()->log_debug( __METHOD__ . '() - Payment method failed after going to intermediate step, intent: ' . print_r( $intent, true ) ); + gf_stripe()->log_debug( __METHOD__ . '() - Aborting tracking id:' . rgget( 'tracking_id' ) . ', for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ')' ); + GFCache::set( 'payment_element_intent_failure', true ); return false; } @@ -585,13 +605,11 @@ public function validate_redirect_intent( $parameters, $api ) { $intent->client_secret !== $request_client_secret || ! in_array( $intent->status, array( 'succeeded', 'processing', 'requires_capture' ) ) ) { - gf_stripe()->log_debug( __METHOD__ . '() - Invalid intent client secret or status. Aborting' ); + gf_stripe()->log_debug( __METHOD__ . '() - Invalid intent client secret or status, Aborting tracking id:' . rgget( 'tracking_id' ) . ', for form : "' . rgar( $form, 'title' ) . '" (id: ' . rgar( $form, 'id' ) . ') , feed : "' . rgars( $feed, 'meta/feedName' ) . '" (id: ' . rgar( $feed, 'id' ) . ')' ); return false; } - gf_stripe()->log_debug( __METHOD__ . '() - Intent is valid' ); - return $intent; } @@ -778,6 +796,7 @@ private function create_draft_and_send_json_success( $form_id, $feed_id, $client 'is_spam' => $is_spam, 'resume_token' => $resume_token, 'payment_method' => $payment_method, + 'tracking_id' => rgpost( 'tracking_id' ), ); if ( $client_secret === null && $invoice_id ) { diff --git a/includes/stripe/stripe-php/lib/StripeObject.php b/includes/stripe/stripe-php/lib/StripeObject.php index be7c4fc..777597e 100644 --- a/includes/stripe/stripe-php/lib/StripeObject.php +++ b/includes/stripe/stripe-php/lib/StripeObject.php @@ -194,27 +194,72 @@ public function __debugInfo() } // ArrayAccess methods + + /** + * Sets an offset. + * + * @since 5.5.2 + * + * @param mixed $offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] public function offsetSet($k, $v) { $this->{$k} = $v; } + /** + * Checks if an offset exists.r + * + * @since 5.5.2 + * + * @param mixed $offset + * + * @return bool + */ + #[\ReturnTypeWillChange] public function offsetExists($k) { return \array_key_exists($k, $this->_values); } + /** + * Unsets an offset. + * + * @since 5.5.2 + * + * @param mixed $offset + */ + #[\ReturnTypeWillChange] public function offsetUnset($k) { unset($this->{$k}); } + /** + * Gets an offset. + * + * @since 5.5.2 + * + * @param mixed $offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] public function offsetGet($k) { return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null; } // Countable method + /** + * Counts the number of elements in the object. + * + * @since 5.5.2 + */ + #[\ReturnTypeWillChange] public function count() { return \count($this->_values); @@ -421,6 +466,12 @@ public function serializeParamsValue($value, $original, $unsaved, $force, $key = } } + /** + * Applying json Serialize to the object. + * + * @since 5.5.2 + */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray(); diff --git a/js/frontend.js b/js/frontend.js index bb0d3ef..edd3c63 100644 --- a/js/frontend.js +++ b/js/frontend.js @@ -761,7 +761,10 @@ gform.extensions.styles.gravityformsstripe = gform.extensions.styles.gravityform this.resetStripeStatus = function (form, formId, isLastPage) { $('#gf_stripe_response, #gf_stripe_credit_card_last_four, #stripe_credit_card_type').remove(); form.data('gfstripesubmitting', false); - $('#gform_ajax_spinner_' + formId).remove(); + const spinnerNodes = document.querySelectorAll('#gform_ajax_spinner_' + formId); + spinnerNodes.forEach(function (node) { + node.remove(); + }); // must do this or the form cannot be submitted again if (isLastPage) { window["gf_submitting_" + formId] = false; @@ -1444,6 +1447,7 @@ class StripePaymentsHandler { if ('invoice_id' in response.data && response.data.invoice_id !== null && 'resume_token' in response.data) { const redirect_url = new URL(window.location.href); redirect_url.searchParams.append('resume_token', response.data.resume_token); + redirect_url.searchParams.append('tracking_id', response.data.tracking_id); window.location.href = redirect_url.href; } @@ -1521,6 +1525,7 @@ class StripePaymentsHandler { 'action': 'gfstripe_validate_form', 'feed_id': this.GFStripeObj.activeFeed.feedId, 'form_id': this.GFStripeObj.formId, + 'tracking_id': Math.random().toString(36).slice(2, 10), 'payment_method': this.paymentMethod.value.type, 'nonce': gforms_stripe_frontend_strings.validate_form_nonce }; @@ -1536,6 +1541,7 @@ class StripePaymentsHandler { * Updates the payment information amount. * * @since 5.1 + * @since 5.3 Added the updatedPaymentInformation filter. * * @param {Double} newAmount The updated amount. */ @@ -1548,7 +1554,25 @@ class StripePaymentsHandler { // Round total to two decimal places. total = Math.round(total * 100) / 100; - this.elements.update({ amount: total }); + let updatedPaymentInformation = { + amount: total + }; + + /** + * Filters the payment information before updating it. + * + * @since 5.3 + * + * @param {Object} updatedPaymentInformation The object that contains the updated payment information, for possible values, @see https://docs.stripe.com/js/elements_object/update#elements_update-options + * @param {Object} initialPaymentInformation The initial payment information. + * @param {int} feedId The feed ID. + * @param {int} formId The form ID. + * + * @return {Object} The updated payment information. + */ + updatedPaymentInformation = window.gform.applyFilters('gform_stripe_payment_element_updated_payment_information', updatedPaymentInformation, this.GFStripeObj.activeFeed.initial_payment_information, this.GFStripeObj.activeFeed.feedId, this.GFStripeObj.formId); + + this.elements.update(updatedPaymentInformation); } /** @@ -1590,6 +1614,7 @@ class StripePaymentsHandler { // Prepare the return URL. const redirect_url = this.getRedirectUrl(confirmData.resume_token); + redirect_url.searchParams.append('tracking_id', confirmData.tracking_id); const { error: submitError } = await this.elements.submit(); if (submitError) { @@ -1706,6 +1731,8 @@ class StripePaymentsHandler { getRedirectUrl(resume_token) { const redirect_url = new URL(window.location.href); redirect_url.searchParams.append('resume_token', resume_token); + redirect_url.searchParams.append('feed_id', this.GFStripeObj.activeFeed.feedId); + redirect_url.searchParams.append('form_id', this.GFStripeObj.formId); return redirect_url; } diff --git a/js/frontend.js.map b/js/frontend.js.map index b1ea2de..4205acc 100644 --- a/js/frontend.js.map +++ b/js/frontend.js.map @@ -1 +1 @@ -{"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","stripePaymentHandlers","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","isStripePaymentHandlerInitiated","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","recaptchav3Pending","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","trigger","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","recaptchaField","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","undefined","request","isJson","has","set","get","delete","options","credentials","body","headers","URL","searchParams","is_preview","fetch","toString","json","constructor","draftId","validateForm","bind","handlelinkEmailFieldChange","reInitiateLinkWithEmailAddress","clearErrors","initStripe","link_email_field_id","emailField","email","link","mountCard","bindEvents","getStripeCoupon","coupons","stripeCoupons","currentCoupon","getStripeCouponCode","foundCoupon","coupon","localeCompare","sensitivity","getStripeCouponInput","couponField","couponInput","className","couponCode","bindStripeCoupon","addEventListener","handleCouponChange","setAttribute","classList","contains","toUpperCase","updateStripeCoupon","coupon_code","get_stripe_coupon_nonce","initialPaymentInformation","initial_payment_information","appearance","payment_method_types","values","mountLink","linkDiv","createElement","add","before","String","match","destroyLink","emailAddress","defaultValues","siblings","complete","failWithMessage","payment_incomplete","getFormData","invalid_nonce","failed_to_confirm_intent","invoice_id","redirect_url","location","href","resume_token","is_valid_intent","intent","is_valid_submission","is_valid","is_spam","resetFormValidationErrors","hasTrial","isValidCoupon","coupon_invalid","handleRedirect","getRedirectUrl","confirm","payment_amount","formData","FormData","appendParams","validate_form_nonce","newAmount","mode","Math","round","update","applyStripeCoupon","percentage_off","amount_off","confirmData","submitError","paymentData","clientSecret","confirmParams","return_url","payment_method_data","redirect","paymentResult","isSetupIntent","confirmSetup","confirmPayment","e","handlePaymentRedirect","handleFailedPayment","setupIntent","intentTypeString","isAjaxEmbed","errorMessage","delete_draft_nonce","rate_limiting_nonce","error_count","linkContainer","el","failed_to_process_payment","_gformPriceFields","setUpFieldId","productTotal","isTrial","recurringAmount","isTextCoupon","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,UAAUC,CAAV,EAAa;;AAEbL,YAAW,UAAUM,IAAV,EAAgB;;AAE1B,OAAM,IAAIC,IAAV,IAAkBD,IA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;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.stripePaymentHandlers = {};\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.stripePaymentHandlers[ formId ] = 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.isStripePaymentHandlerInitiated( formId ) ) {\n\t\t\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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 (\n\t\t\t\t\tGFStripeObj.stripe_payment == 'payment_element' &&\n\t\t\t\t\tGFStripeObj.isStripePaymentHandlerInitiated( formId )\n\t\t\t\t) {\n\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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\tGFStripeObj.isStripePaymentHandlerInitiated( formId ) &&\n\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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.stripePaymentHandlers[ formId ].updatePaymentAmount( GFStripeObj.stripePaymentHandlers[ formId ].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|| GFStripeObj.recaptchav3Pending()\n\t\t\t\t\t|| 'payment_element' === GFStripeObj.stripe_payment && window[ 'gform_stripe_amount_' + GFStripeObj.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\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.stripePaymentHandlers[ GFStripeObj.formId ].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// 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).trigger( '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 * @function recaptchav3Pending\n\t\t * @description Check if recaptcha v3 is enabled and pending a response.\n\t\t *\n\t\t * @since 5.5.0\n\t\t */\n\t\tthis.recaptchav3Pending = function () {\n\t\t\tconst form = this.form;\n\t\t\tconst recaptchaField = form.find( '.ginput_recaptchav3' );\n\t\t\tif ( ! recaptchaField.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst recaptchaResponse = recaptchaField.find( '.gfield_recaptcha_response' );\n\n\t\t\treturn ! ( recaptchaResponse && 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 * @function isStripePaymentHandlerInitiated.\n\t\t * @description Checks if a Stripe payment handler has been initiated for a form.\n\t\t *\n\t\t * @since 5.4\n\t\t */\n\t\tthis.isStripePaymentHandlerInitiated = function ( formId ) {\n\t\t\treturn (\n\t\t\t\tformId in this.stripePaymentHandlers &&\n\t\t\t\tthis.stripePaymentHandlers[ formId ] !== null &&\n\t\t\t\tthis.stripePaymentHandlers[ formId ] !== undefined\n\t\t\t);\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\n\t// Delete gform_ajax if it exists in the FormData object\n\tif ( typeof data.has === 'function' && data.has( 'gform_ajax' ) ) {\n\n\t\t// Saves a temp gform_ajax so that it can be reset later during form processing.\n\t\tdata.set( 'gform_ajax--stripe-temp', data.get( 'gform_ajax' ) );\n\n\t\t// Remove the ajax input to prevent Gravity Forms ajax submission handler from handling the submission in the backend during Stripe's validation.\n\t\tdata.delete( 'gform_ajax' );\n\t}\n\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\tif ( gforms_stripe_frontend_strings.is_preview ) {\n\t\turl.searchParams.set( 'preview', '1' )\n\t}\n\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 payment element and mount it.\n\t\tthis.card = this.elements.create( 'payment' );\n\n\t\t// If an email field is mapped to link, bind it to initiate link on change.\n\t\tif ( GFStripeObj.activeFeed.link_email_field_id ) {\n\t\t\tconst emailField = document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.link_email_field_id );\n\t\t\tconst email = emailField ? emailField.value : '';\n\t\t\tthis.handlelinkEmailFieldChange( { target: { value: email } } );\n\t\t} else {\n\t\t\tthis.link = null;\n\t\t}\n\n\t\tthis.mountCard();\n\t\tthis.bindEvents();\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 undefined if the coupon is not found.\n\t */\n\tgetStripeCoupon\t() {\n\t\tconst coupons = window.stripeCoupons || {};\n\t\tconst currentCoupon = this.getStripeCouponCode();\n\t\tconst foundCoupon = Object.keys(coupons).find(coupon => {\n\t\t\treturn coupon.localeCompare(currentCoupon, undefined, { sensitivity: 'accent' }) === 0;\n\t\t});\n\n\t\treturn foundCoupon ? coupons[foundCoupon] : undefined;\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\tconst couponField = document.querySelector( '#field_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.coupon );\n\t\treturn couponField ? couponField.querySelector( 'input' ) : null;\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\t\tif ( ! couponInput ) {\n\t\t\treturn '';\n\t\t}\n\t\tif ( couponInput.className === 'gf_coupon_code' ) {\n\t\t\tconst couponCode = couponInput ? document.querySelector( '#gf_coupon_codes_' + this.GFStripeObj.formId ).value : null;\n\t\t\treturn couponCode;\n\t\t}\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\tif ( event.target.classList.contains( 'gf_coupon_code' ) ) {\n\t\t\tevent.target.value = event.target.value.toUpperCase();\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\tif ( this.paymentMethod !== null ) {\n\t\t\t\t\t\tthis.clearErrors();\n\t\t\t\t\t}\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\t// If there is a Link instance, destroy it.\n\t\tthis.destroyLink();\n\n\t\tconst emailAddress = event.target.value;\n\t\tif ( emailAddress ) {\n\t\t\tthis.link = await this.elements.create( \"linkAuthentication\", { defaultValues: { email: emailAddress } } );\n\t\t\tthis.mountLink();\n\t\t\tthis.GFStripeObj.GFCCField.siblings( '.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 ( response === -1 ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.invalid_nonce, this.GFStripeObj.formId );\n\n\t\t\treturn false;\n\t\t}\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 ( 'invoice_id' in response.data && response.data.invoice_id !== null && 'resume_token' in response.data ) {\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\tconst is_valid_intent = 'intent' in response.data\n\t\t\t\t\t\t\t\t\t&& response.data.intent !== false\n\t\t\t\t\t\t\t\t\t&& response.data.intent != null\n\t\t\t\t\t\t\t\t\t&& 'client_secret' in response.data.intent;\n\n\n\t\tconst is_valid_submission = 'data' in response\n\t\t\t\t\t\t\t\t\t&& 'is_valid' in response.data\n\t\t\t\t\t\t\t\t\t&& response.data.is_valid\n\t\t\t\t\t\t\t\t\t&& 'resume_token' in response.data\n\n\t\tconst is_spam = 'is_spam' in response.data && response.data.is_spam;\n\n\t\tif ( ! is_valid_intent && ! is_spam && is_valid_submission ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t\treturn false;\n\t\t}\n\n\n\t\tif ( is_valid_submission ) {\n\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// Do not confirm payment if this is a spam submission.\n\t\t\tif ( is_spam ) {\n\t\t\t\t// For spam submissions, redirect to the confirmation page without confirming the payment. This will process the submission as a spam entry without capturing the payment.\n\t\t\t\tthis.handleRedirect( this.getRedirectUrl( response.data.resume_token ) );\n\t\t\t} else {\n\t\t\t\t// For non-spam submissions, confirm the payment and redirect to the confirmation page.\n\t\t\t\tthis.confirm( response.data );\n\t\t\t}\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 * @since 5.4.0 Updated the method parameter, so it received the whole confirmData object instead of just the resume_token and client secret.\n\t *\n\t * @param {Object} confirmData The confirmData object that contains the resume_token, client secret and intent information.\n\t *\n\t * @return {Promise}\n\t */\n\tasync confirm( confirmData ) {\n\n\t\t// Prepare the return URL.\n\t\tconst redirect_url = this.getRedirectUrl( confirmData.resume_token );\n\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: confirmData.intent.client_secret,\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\t// let Stripe handle redirection only if the payment method requires redirection to a third party page,\n\t\t\t// Otherwise, the add-on will handle the redirection.\n\t\t\tredirect: 'if_required',\n\t\t};\n\n\n\t\t/**\n\t\t * The promise that returns from calling stripe.confirmPayment or stripe.confirmSetup.\n\t\t *\n\t\t * If the payment method used requires redirecting the user to a third party page,\n\t\t * this promise will never resolve, as confirmPayment or confirmSetup redirect the user to the third party page.\n\t\t *\n\t\t * @since 5.0.0\n\t\t *\n\t\t * @type {Promise}\n\t\t */\n\t\tlet paymentResult = {};\n\t\tlet isSetupIntent = confirmData.intent.id.indexOf( 'seti_' ) === 0;\n\t\ttry {\n\t\t\tpaymentResult = isSetupIntent ? await this.stripe.confirmSetup( paymentData ) : await this.stripe.confirmPayment( paymentData );\n\t\t} catch ( e ) {\n\t\t\tconsole.log( e );\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t}\n\n\t\t// If we have a paymentIntent or a setupIntent in the result, the process was successful.\n\t\t// Note that confirming could be successful but the intent status is still 'processing' or 'pending'.\n\t\tif ( 'paymentIntent' in paymentResult || 'setupIntent' in paymentResult ) {\n\t\t\tthis.handlePaymentRedirect( paymentResult, redirect_url );\n\t\t} else {\n\t\t\tawait this.handleFailedPayment( paymentResult );\n\t\t}\n\t}\n\n\t/**\n\t * Redirects the user to the confirmation page after the payment intent is confirmed.\n\t *\n\t * This method will never be executed if the payment method used requires redirecting the user to a third party page.\n\t *\n\t * @since 5.0\n\t * @since 5.2 Added the redirect_url parameter.\n\t * @since 5.4 Renamed the function from handlePayment to handlePaymentRedirect.\n\t *\n\t * @param {Object} paymentResult The result of confirming a payment intent or a setup intent.\n\t * @param {URL} redirect_url The redirect URL the user will be taken to after confirmation.\n\t */\n\thandlePaymentRedirect( paymentResult, redirect_url ) {\n\t\tconst intent = paymentResult.paymentIntent ? paymentResult.paymentIntent : paymentResult.setupIntent;\n\t\t// Add parameters required for entry processing in the backend.\n\t\tconst intentTypeString = intent.id.indexOf( 'seti_' ) === 0 ? 'setup' : 'payment'\n\t\tredirect_url.searchParams.append( intentTypeString + '_intent', intent.id );\n\t\tredirect_url.searchParams.append( intentTypeString + '_intent_client_secret', intent.client_secret );\n\t\tredirect_url.searchParams.append( 'redirect_status', intent.status ? 'succeeded' : 'pending' );\n\n\t\tthis.handleRedirect( redirect_url );\n\t}\n\n\t/**\n\t * Redirects the user to the confirmation page.\n\t *\n\t * @since 5.4.1\n\t *\n\t * @param {URL} redirect_url The redirect URL the user will be taken to after confirmation.\n\t */\n\thandleRedirect( redirect_url ) {\n\n\t\t// If this is not an AJAX embedded form, redirect the user to the confirmation page.\n\t\tif ( ! this.isAjaxEmbed( this.GFStripeObj.formId ) ) {\n\t\t\twindow.location.href = redirect_url.toString();\n\t\t} else {\n\t\t\t// AJAX embeds are handled differently, we need to update the form's action with the redirect URL, and submit it inside the AJAX IFrame.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).attr( 'action' , redirect_url.toString() );\n\t\t\t// Prevent running same logic again after submitting the form.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).data( 'isAjaxSubmitting' , true );\n\t\t\t// Keeping this input makes the backend thinks it is not an ajax form, so we need to remove it.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).find( '[name=\"gform_submit\"]' ).remove();\n\t\t\t// Form will be submitted inside the IFrame, once IFrame content is updated, the form element will be replaced with the content of the IFrame.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).submit();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the URL with the resume token appended to it.\n\t *\n\t * @since 5.4.1\n\t *\n\t * @param resume_token The resume token to append to the URL.\n\t *\n\t * @returns {URL} The URL with the resume token appended to it.\n\t */\n\tgetRedirectUrl( resume_token ) {\n\t\tconst redirect_url = new URL( window.location.href );\n\t\tredirect_url.searchParams.append( 'resume_token', resume_token );\n\t\treturn redirect_url;\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\tthis.destroyLink();\n\t}\n\n\t/**\n\t * Destroys the Stripe payment link and removes any DOM nodes created while initializing it.\n\t *\n\t * @since 5.4.0\n\t */\n\tdestroyLink() {\n\t\tif ( this.link ) {\n\t\t\tthis.link.destroy();\n\t\t\tthis.link = null;\n\n\t\t\tconst linkContainer = this.GFStripeObj.GFCCField.siblings( '.gfield #stripe-payment-link' );\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 ] || this.GFStripeObj.activeFeed === null ) {\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\tif ( this.isTextCoupon() ) {\n\t\t\t\tthis.order.recurringAmount = this.applyStripeCoupon( this.order.recurringAmount );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.order.recurringAmount = gformCalculateProductPrice( formId, this.GFStripeObj.activeFeed.paymentAmount );\n\t\t\tthis.order.recurringAmount = this.applyStripeCoupon( this.order.recurringAmount );\n\t\t}\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\tisTextCoupon() {\n\t\tconst coupon = this.getStripeCouponInput();\n\t\tif ( ! coupon ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn ! coupon.classList.contains( 'gf_coupon_code' )\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":""} \ No newline at end of file +{"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","stripePaymentHandlers","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","isStripePaymentHandlerInitiated","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","recaptchav3Pending","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","trigger","targetPageInput","isConversationalForm","convoForm","currentPage","getCurrentPageNumber","ccPage","currentPageInput","isAjax","gformAddSpinner","$spinnerTarget","spinnerNodes","querySelectorAll","node","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","recaptchaField","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","custom","selectorString","convertElements","converted","unshift","undefined","request","isJson","has","set","get","delete","options","credentials","body","headers","URL","searchParams","is_preview","fetch","toString","json","constructor","draftId","validateForm","bind","handlelinkEmailFieldChange","reInitiateLinkWithEmailAddress","clearErrors","initStripe","link_email_field_id","emailField","email","link","mountCard","bindEvents","getStripeCoupon","coupons","stripeCoupons","currentCoupon","getStripeCouponCode","foundCoupon","coupon","localeCompare","sensitivity","getStripeCouponInput","couponField","couponInput","className","couponCode","bindStripeCoupon","addEventListener","handleCouponChange","setAttribute","classList","contains","toUpperCase","updateStripeCoupon","coupon_code","get_stripe_coupon_nonce","initialPaymentInformation","initial_payment_information","appearance","payment_method_types","values","mountLink","linkDiv","createElement","add","before","String","match","destroyLink","emailAddress","defaultValues","siblings","complete","failWithMessage","payment_incomplete","getFormData","invalid_nonce","failed_to_confirm_intent","invoice_id","redirect_url","location","href","resume_token","tracking_id","is_valid_intent","intent","is_valid_submission","is_valid","is_spam","resetFormValidationErrors","hasTrial","isValidCoupon","coupon_invalid","handleRedirect","getRedirectUrl","confirm","payment_amount","formData","FormData","appendParams","Math","random","validate_form_nonce","newAmount","mode","round","updatedPaymentInformation","update","applyStripeCoupon","percentage_off","amount_off","confirmData","submitError","paymentData","clientSecret","confirmParams","return_url","payment_method_data","redirect","paymentResult","isSetupIntent","confirmSetup","confirmPayment","e","handlePaymentRedirect","handleFailedPayment","setupIntent","intentTypeString","isAjaxEmbed","errorMessage","delete_draft_nonce","rate_limiting_nonce","error_count","linkContainer","el","failed_to_process_payment","_gformPriceFields","setUpFieldId","productTotal","isTrial","recurringAmount","isTextCoupon","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,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ACL,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.stripePaymentHandlers = {};\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.stripePaymentHandlers[ formId ] = 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.isStripePaymentHandlerInitiated( formId ) ) {\n\t\t\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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 (\n\t\t\t\t\tGFStripeObj.stripe_payment == 'payment_element' &&\n\t\t\t\t\tGFStripeObj.isStripePaymentHandlerInitiated( formId )\n\t\t\t\t) {\n\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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\tGFStripeObj.isStripePaymentHandlerInitiated( formId ) &&\n\t\t\t\t\tGFStripeObj.stripePaymentHandlers[ formId ].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.stripePaymentHandlers[ formId ].updatePaymentAmount( GFStripeObj.stripePaymentHandlers[ formId ].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|| GFStripeObj.recaptchav3Pending()\n\t\t\t\t\t|| 'payment_element' === GFStripeObj.stripe_payment && window[ 'gform_stripe_amount_' + GFStripeObj.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\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.stripePaymentHandlers[ GFStripeObj.formId ].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// 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).trigger( '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\t\t\tconst spinnerNodes = document.querySelectorAll( '#gform_ajax_spinner_' + formId );\n\t\t\tspinnerNodes.forEach( function( node ) {\n\t\t\t\tnode.remove();\n\t\t\t} );\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 * @function recaptchav3Pending\n\t\t * @description Check if recaptcha v3 is enabled and pending a response.\n\t\t *\n\t\t * @since 5.5.0\n\t\t */\n\t\tthis.recaptchav3Pending = function () {\n\t\t\tconst form = this.form;\n\t\t\tconst recaptchaField = form.find( '.ginput_recaptchav3' );\n\t\t\tif ( ! recaptchaField.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst recaptchaResponse = recaptchaField.find( '.gfield_recaptcha_response' );\n\n\t\t\treturn ! ( recaptchaResponse && 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 * @function isStripePaymentHandlerInitiated.\n\t\t * @description Checks if a Stripe payment handler has been initiated for a form.\n\t\t *\n\t\t * @since 5.4\n\t\t */\n\t\tthis.isStripePaymentHandlerInitiated = function ( formId ) {\n\t\t\treturn (\n\t\t\t\tformId in this.stripePaymentHandlers &&\n\t\t\t\tthis.stripePaymentHandlers[ formId ] !== null &&\n\t\t\t\tthis.stripePaymentHandlers[ formId ] !== undefined\n\t\t\t);\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\n\t// Delete gform_ajax if it exists in the FormData object\n\tif ( typeof data.has === 'function' && data.has( 'gform_ajax' ) ) {\n\n\t\t// Saves a temp gform_ajax so that it can be reset later during form processing.\n\t\tdata.set( 'gform_ajax--stripe-temp', data.get( 'gform_ajax' ) );\n\n\t\t// Remove the ajax input to prevent Gravity Forms ajax submission handler from handling the submission in the backend during Stripe's validation.\n\t\tdata.delete( 'gform_ajax' );\n\t}\n\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\tif ( gforms_stripe_frontend_strings.is_preview ) {\n\t\turl.searchParams.set( 'preview', '1' )\n\t}\n\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 payment element and mount it.\n\t\tthis.card = this.elements.create( 'payment' );\n\n\t\t// If an email field is mapped to link, bind it to initiate link on change.\n\t\tif ( GFStripeObj.activeFeed.link_email_field_id ) {\n\t\t\tconst emailField = document.querySelector( '#input_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.link_email_field_id );\n\t\t\tconst email = emailField ? emailField.value : '';\n\t\t\tthis.handlelinkEmailFieldChange( { target: { value: email } } );\n\t\t} else {\n\t\t\tthis.link = null;\n\t\t}\n\n\t\tthis.mountCard();\n\t\tthis.bindEvents();\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 undefined if the coupon is not found.\n\t */\n\tgetStripeCoupon\t() {\n\t\tconst coupons = window.stripeCoupons || {};\n\t\tconst currentCoupon = this.getStripeCouponCode();\n\t\tconst foundCoupon = Object.keys(coupons).find(coupon => {\n\t\t\treturn coupon.localeCompare(currentCoupon, undefined, { sensitivity: 'accent' }) === 0;\n\t\t});\n\n\t\treturn foundCoupon ? coupons[foundCoupon] : undefined;\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\tconst couponField = document.querySelector( '#field_' + this.GFStripeObj.formId + '_' + this.GFStripeObj.activeFeed.coupon );\n\t\treturn couponField ? couponField.querySelector( 'input' ) : null;\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\t\tif ( ! couponInput ) {\n\t\t\treturn '';\n\t\t}\n\t\tif ( couponInput.className === 'gf_coupon_code' ) {\n\t\t\tconst couponCode = couponInput ? document.querySelector( '#gf_coupon_codes_' + this.GFStripeObj.formId ).value : null;\n\t\t\treturn couponCode;\n\t\t}\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\tif ( event.target.classList.contains( 'gf_coupon_code' ) ) {\n\t\t\tevent.target.value = event.target.value.toUpperCase();\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\tif ( this.paymentMethod !== null ) {\n\t\t\t\t\t\tthis.clearErrors();\n\t\t\t\t\t}\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\t// If there is a Link instance, destroy it.\n\t\tthis.destroyLink();\n\n\t\tconst emailAddress = event.target.value;\n\t\tif ( emailAddress ) {\n\t\t\tthis.link = await this.elements.create( \"linkAuthentication\", { defaultValues: { email: emailAddress } } );\n\t\t\tthis.mountLink();\n\t\t\tthis.GFStripeObj.GFCCField.siblings( '.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 ( response === -1 ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.invalid_nonce, this.GFStripeObj.formId );\n\n\t\t\treturn false;\n\t\t}\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 ( 'invoice_id' in response.data && response.data.invoice_id !== null && 'resume_token' in response.data ) {\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\tredirect_url.searchParams.append( 'tracking_id', response.data.tracking_id );\n\t\t\twindow.location.href = redirect_url.href;\n\t\t}\n\n\t\tconst is_valid_intent = 'intent' in response.data\n\t\t\t\t\t\t\t\t\t&& response.data.intent !== false\n\t\t\t\t\t\t\t\t\t&& response.data.intent != null\n\t\t\t\t\t\t\t\t\t&& 'client_secret' in response.data.intent;\n\n\n\t\tconst is_valid_submission = 'data' in response\n\t\t\t\t\t\t\t\t\t&& 'is_valid' in response.data\n\t\t\t\t\t\t\t\t\t&& response.data.is_valid\n\t\t\t\t\t\t\t\t\t&& 'resume_token' in response.data\n\n\t\tconst is_spam = 'is_spam' in response.data && response.data.is_spam;\n\n\t\tif ( ! is_valid_intent && ! is_spam && is_valid_submission ) {\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t\treturn false;\n\t\t}\n\n\n\t\tif ( is_valid_submission ) {\n\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// Do not confirm payment if this is a spam submission.\n\t\t\tif ( is_spam ) {\n\t\t\t\t// For spam submissions, redirect to the confirmation page without confirming the payment. This will process the submission as a spam entry without capturing the payment.\n\t\t\t\tthis.handleRedirect( this.getRedirectUrl( response.data.resume_token ) );\n\t\t\t} else {\n\t\t\t\t// For non-spam submissions, confirm the payment and redirect to the confirmation page.\n\t\t\t\tthis.confirm( response.data );\n\t\t\t}\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'tracking_id': Math.random().toString( 36 ).slice( 2, 10 ),\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 * @since 5.3 Added the updatedPaymentInformation filter.\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\tlet updatedPaymentInformation = {\n\t\t\tamount: total,\n\t\t};\n\n\t\t/**\n\t\t * Filters the payment information before updating it.\n\t\t *\n\t\t * @since 5.3\n\t\t *\n\t\t * @param {Object} updatedPaymentInformation The object that contains the updated payment information, for possible values, @see https://docs.stripe.com/js/elements_object/update#elements_update-options\n\t\t * @param {Object} initialPaymentInformation The initial payment information.\n\t\t * @param {int} feedId The feed ID.\n\t\t * @param {int} formId The form ID.\n\t\t *\n\t\t * @return {Object} The updated payment information.\n\t\t */\n\t\tupdatedPaymentInformation = window.gform.applyFilters( 'gform_stripe_payment_element_updated_payment_information', updatedPaymentInformation, this.GFStripeObj.activeFeed.initial_payment_information, this.GFStripeObj.activeFeed.feedId, this.GFStripeObj.formId );\n\n\t\tthis.elements.update( updatedPaymentInformation );\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 * @since 5.4.0 Updated the method parameter, so it received the whole confirmData object instead of just the resume_token and client secret.\n\t *\n\t * @param {Object} confirmData The confirmData object that contains the resume_token, client secret and intent information.\n\t *\n\t * @return {Promise}\n\t */\n\tasync confirm( confirmData ) {\n\n\t\t// Prepare the return URL.\n\t\tconst redirect_url = this.getRedirectUrl( confirmData.resume_token );\n\t\tredirect_url.searchParams.append( 'tracking_id', confirmData.tracking_id );\n\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: confirmData.intent.client_secret,\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\t// let Stripe handle redirection only if the payment method requires redirection to a third party page,\n\t\t\t// Otherwise, the add-on will handle the redirection.\n\t\t\tredirect: 'if_required',\n\t\t};\n\n\n\t\t/**\n\t\t * The promise that returns from calling stripe.confirmPayment or stripe.confirmSetup.\n\t\t *\n\t\t * If the payment method used requires redirecting the user to a third party page,\n\t\t * this promise will never resolve, as confirmPayment or confirmSetup redirect the user to the third party page.\n\t\t *\n\t\t * @since 5.0.0\n\t\t *\n\t\t * @type {Promise}\n\t\t */\n\t\tlet paymentResult = {};\n\t\tlet isSetupIntent = confirmData.intent.id.indexOf( 'seti_' ) === 0;\n\t\ttry {\n\t\t\tpaymentResult = isSetupIntent ? await this.stripe.confirmSetup( paymentData ) : await this.stripe.confirmPayment( paymentData );\n\t\t} catch ( e ) {\n\t\t\tconsole.log( e );\n\t\t\tthis.failWithMessage( gforms_stripe_frontend_strings.failed_to_confirm_intent, this.GFStripeObj.formId )\n\t\t}\n\n\t\t// If we have a paymentIntent or a setupIntent in the result, the process was successful.\n\t\t// Note that confirming could be successful but the intent status is still 'processing' or 'pending'.\n\t\tif ( 'paymentIntent' in paymentResult || 'setupIntent' in paymentResult ) {\n\t\t\tthis.handlePaymentRedirect( paymentResult, redirect_url );\n\t\t} else {\n\t\t\tawait this.handleFailedPayment( paymentResult );\n\t\t}\n\t}\n\n\t/**\n\t * Redirects the user to the confirmation page after the payment intent is confirmed.\n\t *\n\t * This method will never be executed if the payment method used requires redirecting the user to a third party page.\n\t *\n\t * @since 5.0\n\t * @since 5.2 Added the redirect_url parameter.\n\t * @since 5.4 Renamed the function from handlePayment to handlePaymentRedirect.\n\t *\n\t * @param {Object} paymentResult The result of confirming a payment intent or a setup intent.\n\t * @param {URL} redirect_url The redirect URL the user will be taken to after confirmation.\n\t */\n\thandlePaymentRedirect( paymentResult, redirect_url ) {\n\t\tconst intent = paymentResult.paymentIntent ? paymentResult.paymentIntent : paymentResult.setupIntent;\n\t\t// Add parameters required for entry processing in the backend.\n\t\tconst intentTypeString = intent.id.indexOf( 'seti_' ) === 0 ? 'setup' : 'payment'\n\t\tredirect_url.searchParams.append( intentTypeString + '_intent', intent.id );\n\t\tredirect_url.searchParams.append( intentTypeString + '_intent_client_secret', intent.client_secret );\n\t\tredirect_url.searchParams.append( 'redirect_status', intent.status ? 'succeeded' : 'pending' );\n\n\t\tthis.handleRedirect( redirect_url );\n\t}\n\n\t/**\n\t * Redirects the user to the confirmation page.\n\t *\n\t * @since 5.4.1\n\t *\n\t * @param {URL} redirect_url The redirect URL the user will be taken to after confirmation.\n\t */\n\thandleRedirect( redirect_url ) {\n\n\t\t// If this is not an AJAX embedded form, redirect the user to the confirmation page.\n\t\tif ( ! this.isAjaxEmbed( this.GFStripeObj.formId ) ) {\n\t\t\twindow.location.href = redirect_url.toString();\n\t\t} else {\n\t\t\t// AJAX embeds are handled differently, we need to update the form's action with the redirect URL, and submit it inside the AJAX IFrame.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).attr( 'action' , redirect_url.toString() );\n\t\t\t// Prevent running same logic again after submitting the form.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).data( 'isAjaxSubmitting' , true );\n\t\t\t// Keeping this input makes the backend thinks it is not an ajax form, so we need to remove it.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).find( '[name=\"gform_submit\"]' ).remove();\n\t\t\t// Form will be submitted inside the IFrame, once IFrame content is updated, the form element will be replaced with the content of the IFrame.\n\t\t\tjQuery( '#gform_' + this.GFStripeObj.formId ).submit();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the URL with the resume token appended to it.\n\t *\n\t * @since 5.4.1\n\t *\n\t * @param resume_token The resume token to append to the URL.\n\t *\n\t * @returns {URL} The URL with the resume token appended to it.\n\t */\n\tgetRedirectUrl( resume_token ) {\n\t\tconst redirect_url = new URL( window.location.href );\n\t\tredirect_url.searchParams.append( 'resume_token', resume_token );\n\t\tredirect_url.searchParams.append( 'feed_id', this.GFStripeObj.activeFeed.feedId );\n\t\tredirect_url.searchParams.append( 'form_id', this.GFStripeObj.formId );\n\t\treturn redirect_url;\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\tthis.destroyLink();\n\t}\n\n\t/**\n\t * Destroys the Stripe payment link and removes any DOM nodes created while initializing it.\n\t *\n\t * @since 5.4.0\n\t */\n\tdestroyLink() {\n\t\tif ( this.link ) {\n\t\t\tthis.link.destroy();\n\t\t\tthis.link = null;\n\n\t\t\tconst linkContainer = this.GFStripeObj.GFCCField.siblings( '.gfield #stripe-payment-link' );\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 ] || this.GFStripeObj.activeFeed === null ) {\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\tif ( this.isTextCoupon() ) {\n\t\t\t\tthis.order.recurringAmount = this.applyStripeCoupon( this.order.recurringAmount );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.order.recurringAmount = gformCalculateProductPrice( formId, this.GFStripeObj.activeFeed.paymentAmount );\n\t\t\tthis.order.recurringAmount = this.applyStripeCoupon( this.order.recurringAmount );\n\t\t}\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\tisTextCoupon() {\n\t\tconst coupon = this.getStripeCouponInput();\n\t\tif ( ! coupon ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn ! coupon.classList.contains( 'gf_coupon_code' )\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":""} \ No newline at end of file diff --git a/js/frontend.min.js b/js/frontend.min.js index 7c3edc6..a76d6b6 100644 --- a/js/frontend.min.js +++ b/js/frontend.min.js @@ -1 +1 @@ -!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return h})),r.d(t,"Request",(function(){return w})),r.d(t,"Response",(function(){return F})),r.d(t,"DOMException",(function(){return O})),r.d(t,"fetch",(function(){return C}));var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==i&&i,n="URLSearchParams"in i,s="Symbol"in i&&"iterator"in Symbol,a="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in i,d="ArrayBuffer"in i;if(d)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],p=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function _(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=m(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():d&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d&&(ArrayBuffer.prototype.isPrototypeOf(e)||p(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=_(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=_(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(g)}),this.text=function(){var e,t,r,i=_(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=m(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function S(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function F(e,t){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},F.error=function(){var e=new F(null,{status:0,statusText:""});return e.type="error",e};var j=[301,302,303,307,308];F.redirect=function(e,t){if(-1===j.indexOf(t))throw new RangeError("Invalid status code");return new F(null,{status:t,headers:{location:e}})};var O=i.DOMException;try{new O}catch(e){(O=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),O.prototype.constructor=O}function C(e,t){return new Promise((function(r,n){var s=new w(e,t);if(s.signal&&s.signal.aborted)return n(new O("Aborted","AbortError"));var o=new XMLHttpRequest;function l(){o.abort()}o.onload=function(){var e,t,i={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;setTimeout((function(){r(new F(n,i))}),0)},o.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.onabort=function(){setTimeout((function(){n(new O("Aborted","AbortError"))}),0)},o.open(s.method,function(e){try{return""===e&&i.location.href?i.location.href:e}catch(t){return e}}(s.url),!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&(a?o.responseType="blob":d&&s.headers.get("Content-Type")&&-1!==s.headers.get("Content-Type").indexOf("application/octet-stream")&&(o.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof h?s.headers.forEach((function(e,t){o.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){o.setRequestHeader(e,u(t.headers[e]))})),s.signal&&(s.signal.addEventListener("abort",l),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",l)}),o.send(void 0===s._bodyInit?null:s._bodyInit)}))}C.polyfill=!0,i.fetch||(i.fetch=C,i.Headers=h,i.Request=w,i.Response=F)},,function(e,t,r){r(0),e.exports=r(5)},,,function(e,t,r){"use strict";r.r(t);var i,n=async(e,t=!1,r=!1,i=!1)=>{"function"==typeof e.has&&e.has("gform_ajax")&&(e.set("gform_ajax--stripe-temp",e.get("gform_ajax")),e.delete("gform_ajax"));const n={method:"POST",credentials:"same-origin",body:e};t&&(n.headers={Accept:"application/json","content-type":"application/json"});const s=new URL(gforms_stripe_frontend_strings.ajaxurl);return r&&s.searchParams.set("action",r),i&&s.searchParams.set("nonce",i),gforms_stripe_frontend_strings.is_preview&&s.searchParams.set("preview","1"),await fetch(s.toString(),n).then(e=>e.json())},s=Object.assign||function(e){for(var t=1;t0===e.localeCompare(t,void 0,{sensitivity:"accent"}));return r?e[r]:void 0}getStripeCouponInput(){const e=document.querySelector("#field_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.coupon);return e?e.querySelector("input"):null}getStripeCouponCode(){const e=this.getStripeCouponInput();if(!e)return"";if("gf_coupon_code"===e.className){return e?document.querySelector("#gf_coupon_codes_"+this.GFStripeObj.formId).value:null}return e?e.value:""}bindStripeCoupon(){const e=this.getStripeCouponInput();e&&!e.getAttribute("data-listener-added")&&(e.addEventListener("blur",this.handleCouponChange.bind(this)),e.setAttribute("data-listener-added",!0))}async handleCouponChange(e){this.getStripeCouponInput()===e.target&&(e.target.classList.contains("gf_coupon_code")&&(e.target.value=e.target.value.toUpperCase()),await this.updateStripeCoupon(e.target.value),gformCalculateTotalPrice(this.GFStripeObj.formId))}async updateStripeCoupon(e){if(!e)return;if(window.stripeCoupons||(window.stripeCoupons={}),window.stripeCoupons[e])return;const t=await n(JSON.stringify({coupon:e,feed_id:this.GFStripeObj.activeFeed.feedId}),!0,"gfstripe_get_stripe_coupon",gforms_stripe_frontend_strings.get_stripe_coupon_nonce);window.stripeCoupons[e]=t.data}async initStripe(){this.stripe=Stripe(this.apiKey);const e=this.GFStripeObj.activeFeed.initial_payment_information,t=this.GFStripeObj.cardStyle;return"payment_method_types"in e&&(e.payment_method_types=Object.values(e.payment_method_types)),this.elements=this.stripe.elements(s({},e,{appearance:t})),!0}mountCard(){this.card.mount("#"+this.GFStripeObj.GFCCField.attr("id"))}mountLink(){if(null!==this.link){if(document.querySelectorAll(".stripe-payment-link").length<=0){const e=document.createElement("div");e.setAttribute("id","stripe-payment-link"),e.classList.add("StripeElement--link"),this.GFStripeObj.GFCCField.before(jQuery(e))}this.link.mount("#stripe-payment-link")}}async bindEvents(){this.card&&this.card.on("change",e=>{null!==this.paymentMethod&&this.clearErrors(),this.paymentMethod=e}),this.bindStripeCoupon();const e=document.querySelector("#input_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.link_email_field_id);null!==e&&(e.addEventListener("blur",this.handlelinkEmailFieldChange),window.addEventListener("load",async function(){const e=document.querySelector("#input_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.link_email_field_id);String(e.value).toLowerCase().match(/^(([^<>()[\]\\.,;:\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,}))$/)&&this.GFStripeObj.isLastPage()&&this.handlelinkEmailFieldChange({target:{value:e.value}})}.bind(this)))}async reInitiateLinkWithEmailAddress(e){if(!1===this.GFStripeObj.isCreditCardOnPage())return;this.destroyLink();const t=e.target.value;t&&(this.link=await this.elements.create("linkAuthentication",{defaultValues:{email:t}}),this.mountLink(),this.GFStripeObj.GFCCField.siblings(".gfield #stripe-payment-link").addClass("visible"))}async validate(e){const t=jQuery("#gform_"+this.GFStripeObj.formId);if(t.data("isAjaxSubmitting"))return void t.submit();if(!this.paymentMethod.complete&&"link"!==this.paymentMethod.value.type)return this.failWithMessage(gforms_stripe_frontend_strings.payment_incomplete,this.GFStripeObj.formId),!1;gformAddSpinner(this.GFStripeObj.formId);const r=await n(this.getFormData(e.target));if(-1===r)return this.failWithMessage(gforms_stripe_frontend_strings.invalid_nonce,this.GFStripeObj.formId),!1;if("success"in r&&!1===r.success)return this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId),!1;if("invoice_id"in r.data&&null!==r.data.invoice_id&&"resume_token"in r.data){const e=new URL(window.location.href);e.searchParams.append("resume_token",r.data.resume_token),window.location.href=e.href}const i="intent"in r.data&&!1!==r.data.intent&&null!=r.data.intent&&"client_secret"in r.data.intent,s="data"in r&&"is_valid"in r.data&&r.data.is_valid&&"resume_token"in r.data,a="is_spam"in r.data&&r.data.is_spam;if(!i&&!a&&s)return this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId),!1;if(s){if(this.resetFormValidationErrors(),this.draftId=r.data.resume_token,"1"!==this.GFStripeObj.activeFeed.hasTrial&&!this.GFStripeObj.activeFeed.setupFee&&!this.isValidCoupon(r.data.total))return this.failWithMessage(gforms_stripe_frontend_strings.coupon_invalid,this.GFStripeObj.formId),!1;a?this.handleRedirect(this.getRedirectUrl(r.data.resume_token)):this.confirm(r.data)}else e.target.submit()}isValidCoupon(e){const t=this.getStripeCoupon();return!t||t.is_valid&&e==this.order.paymentAmount}getFormData(e){const t=new FormData(e);t.delete("gform_submit");const r={action:"gfstripe_validate_form",feed_id:this.GFStripeObj.activeFeed.feedId,form_id:this.GFStripeObj.formId,payment_method:this.paymentMethod.value.type,nonce:gforms_stripe_frontend_strings.validate_form_nonce};return Object.keys(r).forEach(e=>{t.append(e,r[e])}),t}updatePaymentAmount(e){if(e<=0||"setup"===this.GFStripeObj.activeFeed.initial_payment_information.mode)return;let t=100*e;t=Math.round(100*t)/100,this.elements.update({amount:t})}applyStripeCoupon(e){const t=this.getStripeCoupon();return t&&t.is_valid?(t.percentage_off?e-=e*(t.percentage_off/100):t.amount_off&&(e-=t.amount_off),e):e}async confirm(e){const t=this.getRedirectUrl(e.resume_token),{error:r}=await this.elements.submit();if(r)return void this.failWithMessage(r.message,this.GFStripeObj.formId);const i={elements:this.elements,clientSecret:e.intent.client_secret,confirmParams:{return_url:t.toString(),payment_method_data:{billing_details:{address:{line1:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_line1)),line2:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_line2)),city:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_city)),state:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_state)),postal_code:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_zip))}}}},redirect:"if_required"};let n={},s=0===e.intent.id.indexOf("seti_");try{n=s?await this.stripe.confirmSetup(i):await this.stripe.confirmPayment(i)}catch(e){console.log(e),this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId)}"paymentIntent"in n||"setupIntent"in n?this.handlePaymentRedirect(n,t):await this.handleFailedPayment(n)}handlePaymentRedirect(e,t){const r=e.paymentIntent?e.paymentIntent:e.setupIntent,i=0===r.id.indexOf("seti_")?"setup":"payment";t.searchParams.append(i+"_intent",r.id),t.searchParams.append(i+"_intent_client_secret",r.client_secret),t.searchParams.append("redirect_status",r.status?"succeeded":"pending"),this.handleRedirect(t)}handleRedirect(e){this.isAjaxEmbed(this.GFStripeObj.formId)?(jQuery("#gform_"+this.GFStripeObj.formId).attr("action",e.toString()),jQuery("#gform_"+this.GFStripeObj.formId).data("isAjaxSubmitting",!0),jQuery("#gform_"+this.GFStripeObj.formId).find('[name="gform_submit"]').remove(),jQuery("#gform_"+this.GFStripeObj.formId).submit()):window.location.href=e.toString()}getRedirectUrl(e){const t=new URL(window.location.href);return t.searchParams.append("resume_token",e),t}async handleFailedPayment(e){let t="";"error"in e&&"message"in e.error&&(t=e.error.message),this.failWithMessage(t,this.GFStripeObj.formId);let r=n(JSON.stringify({draft_id:this.draftId}),!0,"gfstripe_delete_draft_entry",gforms_stripe_frontend_strings.delete_draft_nonce);this.GFStripeObj.hasOwnProperty("cardErrorCount")&&(r=await n(JSON.stringify({increase_count:!0}),!0,"gfstripe_payment_element_check_rate_limiting",gforms_stripe_frontend_strings.rate_limiting_nonce),this.GFStripeObj.cardErrorCount=r.data.error_count)}destroy(){this.card&&this.card.destroy(),this.destroyLink()}destroyLink(){if(this.link){this.link.destroy(),this.link=null;const e=this.GFStripeObj.GFCCField.siblings(".gfield #stripe-payment-link");e&&e.remove()}}clearErrors(){this.GFStripeObj.GFCCField.next(".validation_message").length&&this.GFStripeObj.GFCCField.next(".validation_message").remove()}resetFormValidationErrors(){document.querySelectorAll(".gform_validation_errors, .validation_message").forEach(e=>{e.remove()}),document.querySelectorAll(".gfield_error").forEach(e=>{e.classList.remove("gfield_error")})}failWithMessage(e,t){e=e||gforms_stripe_frontend_strings.failed_to_process_payment,this.GFStripeObj.displayStripeCardError({error:{message:e}}),this.GFStripeObj.resetStripeStatus(jQuery("#gform_"+t),t,!0),jQuery("#gform_ajax_spinner_"+t).remove()}getBillingAddressMergeTag(e){return""===e?"":"{:"+e+":value}"}getOrderData(e,t){if(!_gformPriceFields[t]||null===this.GFStripeObj.activeFeed)return this.order;const r=this.GFStripeObj.activeFeed.setupFee;let i=0;const n=this.GFStripeObj.activeFeed.hasTrial;if(r){const r=this.GFStripeObj.getProductFieldPrice(t,this.GFStripeObj.activeFeed.setupFee);i=r.price*r.qty,e-=i}return"form_total"===this.GFStripeObj.activeFeed.paymentAmount?(this.order.recurringAmount=e,this.isTextCoupon()&&(this.order.recurringAmount=this.applyStripeCoupon(this.order.recurringAmount))):(this.order.recurringAmount=gformCalculateProductPrice(t,this.GFStripeObj.activeFeed.paymentAmount),this.order.recurringAmount=this.applyStripeCoupon(this.order.recurringAmount)),this.order.paymentAmount="1"===n?i:this.order.recurringAmount+i,this.order}isTextCoupon(){const e=this.getStripeCouponInput();return!!e&&!e.classList.contains("gf_coupon_code")}isAjaxEmbed(e){return jQuery("#gform_ajax_frame_"+e).length>=1}}window.GFStripe=null,gform.extensions=gform.extensions||{},gform.extensions.styles=gform.extensions.styles||{},gform.extensions.styles.gravityformsstripe=gform.extensions.styles.gravityformsstripe||{},i=jQuery,GFStripe=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);this.form=null,this.activeFeed=null,this.GFCCField=null,this.stripeResponse=null,this.hasPaymentIntent=!1,this.stripePaymentHandlers={},this.cardStyle=this.cardStyle||{},gform.extensions.styles.gravityformsstripe[this.formId]=gform.extensions.styles.gravityformsstripe[this.formId]||{};const r=Object.keys(this.cardStyle).length>0?JSON.parse(JSON.stringify(this.cardStyle)):gform.extensions.styles.gravityformsstripe[this.formId][this.pageInstance]||{};this.setComponentStyleValue=function(e,t,r,i){let n="";if(0===t.indexOf("--")){const s=r.getPropertyValue(t);if(s)n=s;else{const t="fontSmoothing"===e?"-webkit-font-smoothing":e;n=(i?getComputedStyle(i):r).getPropertyValue(t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())}}else n=t;return n.trim()},this.setComponentStyles=function(e,t,i){if(0===Object.keys(e).length)return;const n=document.getElementById("gform_"+this.formId),s=getComputedStyle(n),a=n.querySelector(".gfield input");Object.keys(e).forEach(n=>{if("object"!=typeof e[n]){if("object"!=typeof e[n]){let e="";i?t&&t!==i?(e=this.setComponentStyleValue(n,r[i][t][n],s,a),e&&(this.cardStyle[i][t][n]=e)):(e=this.setComponentStyleValue(n,r[i][n],s,a),e&&(this.cardStyle[i][n]=e)):(e=this.setComponentStyleValue(n,r[n],s,a),e&&(this.cardStyle[n]=e))}}else{i||(this.cardStyle[n]={}),i&&(this.cardStyle[i][n]={});const t=i||n;this.setComponentStyles(e[n],n,t)}})},this.init=async function(){if(this.setComponentStyles(r),this.isCreditCardOnPage()||"stripe.js"!==this.stripe_payment&&("elements"!==this.stripe_payment||i("#gf_stripe_response").length)){var e=this,t=null,n=!1,s=!1,o=this.apiKey;switch(this.form=i("#gform_"+this.formId),this.GFCCField=i("#input_"+this.formId+"_"+this.ccFieldId+"_1"),gform.addAction("gform_frontend_feeds_evaluated",(async function(r,c){if(c===e.formId){t=null,n=!1,s=!1;for(var u=0;u div").length?(i(".ginput_container_creditcard > div:last").hide(),i(".ginput_container_creditcard > div:first").html("

"+gforms_stripe_frontend_strings.requires_action+"

")):i(".ginput_container_creditcard").html("

"+gforms_stripe_frontend_strings.requires_action+"

"),jQuery("#gform_"+c+"_validation_container h2 .gform_ajax_spinner").length<=0&&(jQuery("#gform_"+c+"_validation_container h2").append(''),jQuery("#gform_submit_button_"+c).prop("disabled",!0));const t=jQuery("#gform_"+c+"_validation_container h2 .gform-icon.gform-icon--close"),r=jQuery(".gform-theme--framework").length;console.log(r),console.log(t),t.length&&!r&&t.removeClass("gform-icon--close").addClass("gform-icon--info"),e.scaActionHandler(d,c)}else p.mount("#"+e.GFCCField.attr("id")),p.on("change",(function(t){e.displayStripeCardError(t)}));else if("stripe.js"==e.stripe_payment){Stripe.setPublishableKey(o);break}break}n||("elements"!==e.stripe_payment&&"payment_element"!==e.stripe_payment||(null!=l&&p===l.getElement("card")&&p.destroy(),e.isStripePaymentHandlerInitiated(c)&&e.stripePaymentHandlers[c].destroy(),e.GFCCField.next(".validation_message").length||e.GFCCField.after('
'+gforms_stripe_frontend_strings.no_active_frontend_feed+"
"),wp.a11y.speak(gforms_stripe_frontend_strings.no_active_frontend_feed)),e.resetStripeStatus(e.form,c,e.isLastPage()),o=e.apiKey,e.activeFeed=null)}})),gform.addFilter("gform_product_total",(function(t,r){if("payment_element"==e.stripe_payment&&e.isStripePaymentHandlerInitiated(r)&&e.stripePaymentHandlers[r].getOrderData(t,r),!e.activeFeed)return window["gform_stripe_amount_"+r]=0,t;if("form_total"!==e.activeFeed.paymentAmount){const t=e.getProductFieldPrice(r,e.activeFeed.paymentAmount);if(window["gform_stripe_amount_"+r]=t.price*t.qty,e.activeFeed.hasOwnProperty("setupFee")){const t=e.getProductFieldPrice(r,e.activeFeed.setupFee);window["gform_stripe_amount_"+r]+=t.price*t.qty}}else window["gform_stripe_amount_"+r]=t;return"payment_element"==e.stripe_payment&&e.isStripePaymentHandlerInitiated(r)&&null!==e.stripePaymentHandlers[r].elements&&"1"===gforms_stripe_frontend_strings.stripe_connect_enabled&&e.stripePaymentHandlers[r].updatePaymentAmount(e.stripePaymentHandlers[r].order.paymentAmount),t}),51),this.stripe_payment){case"elements":var d=null,l=null,p=null;i("#gf_stripe_response").length&&(this.stripeResponse=JSON.parse(i("#gf_stripe_response").val()),this.stripeResponse.hasOwnProperty("client_secret")&&(this.hasPaymentIntent=!0))}if(i("#gform_"+this.formId).on("submit",(function(r){let s=!1;const a=parseInt(i("#gform_source_page_number_"+e.formId).val(),10),o=parseInt(i("#gform_target_page_number_"+e.formId).val(),10);if(a>o&&0!==o&&(s=!0),!(s||!n||i(this).data("gfstripesubmitting")||1==i("#gform_save_"+e.formId).val()||!e.isLastPage()&&"elements"!==e.stripe_payment||gformIsHidden(e.GFCCField)||e.maybeHitRateLimits()||e.invisibleCaptchaPending()||e.recaptchav3Pending()||"payment_element"===e.stripe_payment&&0===window["gform_stripe_amount_"+e.formId]))switch(r.preventDefault(),i(this).data("gfstripesubmitting",!0),e.maybeAddSpinner(),e.stripe_payment){case"payment_element":e.injectHoneypot(r),e.stripePaymentHandlers[e.formId].validate(r);break;case"elements":if(e.form=i(this),e.isLastPage()&&!e.isCreditCardOnPage()||gformIsHidden(e.GFCCField)||s)return void i(this).submit();"product"===t.type?e.createPaymentMethod(d,p):e.createToken(d,p);break;case"stripe.js":var l=i(this),c="input_"+e.formId+"_"+e.ccFieldId+"_",u={number:l.find("#"+c+"1").val(),exp_month:l.find("#"+c+"2_month").val(),exp_year:l.find("#"+c+"2_year").val(),cvc:l.find("#"+c+"3").val(),name:l.find("#"+c+"5").val()};e.form=l,Stripe.card.createToken(u,(function(t,r){e.responseHandler(t,r)}))}})),"payment_element_intent_failure"in e&&e.payment_element_intent_failure){const t=jQuery('

'+gforms_stripe_frontend_strings.payment_element_intent_failure+"

");jQuery("#gform_wrapper_"+e.formId).prepend(t)}}},this.getProductFieldPrice=function(e,t){var r=GFMergeTag.getMergeTagValue(e,t,":price"),i=GFMergeTag.getMergeTagValue(e,t,":qty");return"string"==typeof r&&(r=GFMergeTag.getMergeTagValue(e,t+".2",":price"),i=GFMergeTag.getMergeTagValue(e,t+".3",":qty")),{price:r,qty:i}},this.getBillingAddressMergeTag=function(e){return""===e?"":"{:"+e+":value}"},this.responseHandler=function(e,t){for(var r=this.form,n="input_"+this.formId+"_"+this.ccFieldId+"_",s=["1","2_month","2_year","3","5"],a=0;a').val(d.slice(-4))),r.append(i('').val(l))}}r.append(i('').val(i.toJSON(t))),r.submit()},this.elementsResponseHandler=function(e){var t=this.form,r=this,n=this.activeFeed,s=gform.applyFilters("gform_stripe_currency",this.currency,this.formId),a=0===gf_global.gf_currency_config.decimals?window["gform_stripe_amount_"+this.formId]:gformRoundPrice(100*window["gform_stripe_amount_"+this.formId]);if(e.error)return this.displayStripeCardError(e),void this.resetStripeStatus(t,this.formId,this.isLastPage());if(this.hasPaymentIntent)if("product"===n.type)e.hasOwnProperty("paymentMethod")?(i("#gf_stripe_credit_card_last_four").val(e.paymentMethod.card.last4),i("#stripe_credit_card_type").val(e.paymentMethod.card.brand),i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_update_payment_intent",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,payment_intent:e.id,payment_method:e.paymentMethod,currency:s,amount:a,feed_id:n.feedId},success:function(e){e.success?(i("#gf_stripe_response").val(i.toJSON(e.data)),t.submit()):(e.error=e.data,delete e.data,r.displayStripeCardError(e),r.resetStripeStatus(t,r.formId,r.isLastPage()))}})):e.hasOwnProperty("amount")&&t.submit();else{var o=JSON.parse(i("#gf_stripe_response").val());o.updatedToken=e.token.id,i("#gf_stripe_response").val(i.toJSON(o)),t.append(i('').val(e.token.card.last4)),t.append(i('').val(e.token.card.brand)),t.submit()}else i("#gf_stripe_response").length?i("#gf_stripe_response").val(i.toJSON(e)):t.append(i('').val(i.toJSON(e))),"product"===n.type?(t.append(i('').val(e.paymentMethod.card.last4)),t.append(i('').val(e.paymentMethod.card.brand)),i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_create_payment_intent",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,payment_method:e.paymentMethod,currency:s,amount:a,feed_id:n.feedId},success:function(e){e.success?(i("#gf_stripe_response").length?i("#gf_stripe_response").val(i.toJSON(e.data)):t.append(i('').val(i.toJSON(e.data))),t.submit()):(e.error=e.data,delete e.data,r.displayStripeCardError(e),r.resetStripeStatus(t,r.formId,r.isLastPage()))}})):(t.append(i('').val(e.token.card.last4)),t.append(i('').val(e.token.card.brand)),t.submit())},this.scaActionHandler=function(e,t){if(!i("#gform_"+t).data("gfstripescaauth")){i("#gform_"+t).data("gfstripescaauth",!0);var r=this,n=JSON.parse(i("#gf_stripe_response").val());"product"===this.activeFeed.type?e.retrievePaymentIntent(n.client_secret).then((function(s){"requires_action"===s.paymentIntent.status&&e.handleCardAction(n.client_secret).then((function(e){var n=JSON.parse(i("#gf_stripe_response").val());n.scaSuccess=!0,i("#gf_stripe_response").val(i.toJSON(n)),r.maybeAddSpinner(),jQuery("#gform_submit_button_"+t).prop("disabled",!1),i("#gform_"+t).data("gfstripescaauth",!1),i("#gform_"+t).data("gfstripesubmitting",!0).submit(),jQuery("#gform_submit_button_"+t).prop("disabled",!0)}))})):e.retrievePaymentIntent(n.client_secret).then((function(s){"requires_action"===s.paymentIntent.status&&e.handleCardPayment(n.client_secret).then((function(e){r.maybeAddSpinner(),jQuery("#gform_submit_button_"+t).prop("disabled",!1),i("#gform_"+t).data("gfstripescaauth",!1),i("#gform_"+t).data("gfstripesubmitting",!0).trigger("submit")}))}))}},this.isLastPage=function(){var e=i("#gform_target_page_number_"+this.formId);return!(e.length>0)||0==e.val()},this.isConversationalForm=function(){return i('[data-js="gform-conversational-form"]').length>0},this.isCreditCardOnPage=function(){var e=this.getCurrentPageNumber();return!(this.ccPage&&e&&!this.isConversationalForm())||this.ccPage==e},this.getCurrentPageNumber=function(){var e=i("#gform_source_page_number_"+this.formId);return e.length>0&&e.val()},this.maybeAddSpinner=function(){if(!this.isAjax)if("function"==typeof gformAddSpinner)gformAddSpinner(this.formId);else{var e=this.formId;if(0==jQuery("#gform_ajax_spinner_"+e).length){var t=gform.applyFilters("gform_spinner_url",gf_global.spinnerUrl,e);gform.applyFilters("gform_spinner_target_elem",jQuery("#gform_submit_button_"+e+", #gform_wrapper_"+e+" .gform_next_button, #gform_send_resume_link_button_"+e),e).after('')}}},this.resetStripeStatus=function(e,t,r){i("#gf_stripe_response, #gf_stripe_credit_card_last_four, #stripe_credit_card_type").remove(),e.data("gfstripesubmitting",!1),i("#gform_ajax_spinner_"+t).remove(),r&&(window["gf_submitting_"+t]=!1)},this.displayStripeCardError=function(e){e.error&&!this.GFCCField.next(".validation_message").length&&this.GFCCField.after('
');var t=this.GFCCField.next(".validation_message");e.error?(t.html(e.error.message),wp.a11y.speak(e.error.message,"assertive"),i("#gform_ajax_spinner_"+this.formId).length>0&&i("#gform_ajax_spinner_"+this.formId).remove()):t.remove()},this.createToken=function(e,t){const r=this,n=this.activeFeed,s={name:i("#input_"+r.formId+"_"+r.ccFieldId+"_5").val(),address_line1:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_line1)),address_line2:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_line2)),address_city:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_city)),address_state:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_state)),address_zip:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_zip)),address_country:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_country)),currency:gform.applyFilters("gform_stripe_currency",this.currency,this.formId)};e.createToken(t,s).then((function(e){r.elementsResponseHandler(e)}))},this.createPaymentMethod=function(e,t,r){var n=this,s=this.activeFeed,a="";if(""!==s.address_country&&(a=GFMergeTag.replaceMergeTags(n.formId,n.getBillingAddressMergeTag(s.address_country))),""===a||void 0!==r&&""!==r){var o=i("#input_"+this.formId+"_"+this.ccFieldId+"_5").val(),d=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_line1)),l=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_line2)),p=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_city)),c=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_state)),u=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_zip)),f={billing_details:{name:null,address:{}}};""!==o&&(f.billing_details.name=o),""!==d&&(f.billing_details.address.line1=d),""!==l&&(f.billing_details.address.line2=l),""!==p&&(f.billing_details.address.city=p),""!==c&&(f.billing_details.address.state=c),""!==u&&(f.billing_details.address.postal_code=u),""!==r&&(f.billing_details.address.country=r),null===f.billing_details.name&&delete f.billing_details.name,f.billing_details.address==={}&&delete f.billing_details.address,e.createPaymentMethod("card",t,f).then((function(e){null!==n.stripeResponse&&(e.id=n.stripeResponse.id,e.client_secret=n.stripeResponse.client_secret),n.elementsResponseHandler(e)}))}else i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_get_country_code",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,country:a,feed_id:s.feedId},success:function(r){r.success&&n.createPaymentMethod(e,t,r.data.code)}})},this.maybeHitRateLimits=function(){return!!(this.hasOwnProperty("cardErrorCount")&&this.cardErrorCount>=5)},this.invisibleCaptchaPending=function(){var e=this.form.find(".ginput_recaptcha");if(!e.length||"invisible"!==e.data("size"))return!1;var t=e.find(".g-recaptcha-response");return!(t.length&&t.val())},this.recaptchav3Pending=function(){const e=this.form.find(".ginput_recaptchav3");if(!e.length)return!1;const t=e.find(".gfield_recaptcha_response");return!(t&&t.val())},this.injectHoneypot=e=>{const t=e.target;if((this.isFormSubmission(t)||this.isSaveContinue(t))&&!this.isHeadlessBrowser()){const e=``;t.insertAdjacentHTML("beforeend",e)}},this.isSaveContinue=e=>{const t=e.dataset.formid,r=this.getNodes("#gform_save_"+t,!0,e,!0);return r.length>0&&"1"===r[0].value},this.isFormSubmission=e=>{const t=e.dataset.formid,r=this.getNodes(`input[name = "gform_target_page_number_${t}"]`,!0,e,!0)[0];return void 0!==r&&0===parseInt(r.value)},this.isHeadlessBrowser=()=>window._phantom||window.callPhantom||window.__phantomas||window.Buffer||window.emit||window.spawn||window.webdriver||window._selenium||window._Selenium_IDE_Recorder||window.callSelenium||window.__nightmare||window.domAutomation||window.domAutomationController||window.document.__webdriver_evaluate||window.document.__selenium_evaluate||window.document.__webdriver_script_function||window.document.__webdriver_script_func||window.document.__webdriver_script_fn||window.document.__fxdriver_evaluate||window.document.__driver_unwrapped||window.document.__webdriver_unwrapped||window.document.__driver_evaluate||window.document.__selenium_unwrapped||window.document.__fxdriver_unwrapped||window.document.documentElement.getAttribute("selenium")||window.document.documentElement.getAttribute("webdriver")||window.document.documentElement.getAttribute("driver"),this.getNodes=(e="",t=!1,r=document,i=!1)=>{const n=i?e:`[data-js="${e}"]`;let s=r.querySelectorAll(n);return t&&(s=this.convertElements(s)),s},this.convertElements=(e=[])=>{const t=[];let r=e.length;for(;r--;t.unshift(e[r]));return t},this.isStripePaymentHandlerInitiated=function(e){return e in this.stripePaymentHandlers&&null!==this.stripePaymentHandlers[e]&&void 0!==this.stripePaymentHandlers[e]},this.init()}}]); \ No newline at end of file +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return m})),r.d(t,"Request",(function(){return S})),r.d(t,"Response",(function(){return w})),r.d(t,"DOMException",(function(){return O})),r.d(t,"fetch",(function(){return I}));var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==i&&i,n="URLSearchParams"in i,s="Symbol"in i&&"iterator"in Symbol,a="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in i,d="ArrayBuffer"in i;if(d)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],p=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function _(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():d&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d&&(ArrayBuffer.prototype.isPrototypeOf(e)||p(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=_(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=_(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(g)}),this.text=function(){var e,t,r,i=_(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=h(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function F(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},b.call(S.prototype),b.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var j=[301,302,303,307,308];w.redirect=function(e,t){if(-1===j.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})};var O=i.DOMException;try{new O}catch(e){(O=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),O.prototype.constructor=O}function I(e,t){return new Promise((function(r,n){var s=new S(e,t);if(s.signal&&s.signal.aborted)return n(new O("Aborted","AbortError"));var o=new XMLHttpRequest;function l(){o.abort()}o.onload=function(){var e,t,i={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;setTimeout((function(){r(new w(n,i))}),0)},o.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.onabort=function(){setTimeout((function(){n(new O("Aborted","AbortError"))}),0)},o.open(s.method,function(e){try{return""===e&&i.location.href?i.location.href:e}catch(t){return e}}(s.url),!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&(a?o.responseType="blob":d&&s.headers.get("Content-Type")&&-1!==s.headers.get("Content-Type").indexOf("application/octet-stream")&&(o.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof m?s.headers.forEach((function(e,t){o.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){o.setRequestHeader(e,u(t.headers[e]))})),s.signal&&(s.signal.addEventListener("abort",l),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",l)}),o.send(void 0===s._bodyInit?null:s._bodyInit)}))}I.polyfill=!0,i.fetch||(i.fetch=I,i.Headers=m,i.Request=S,i.Response=w)},,function(e,t,r){r(0),e.exports=r(5)},,,function(e,t,r){"use strict";r.r(t);var i,n=async(e,t=!1,r=!1,i=!1)=>{"function"==typeof e.has&&e.has("gform_ajax")&&(e.set("gform_ajax--stripe-temp",e.get("gform_ajax")),e.delete("gform_ajax"));const n={method:"POST",credentials:"same-origin",body:e};t&&(n.headers={Accept:"application/json","content-type":"application/json"});const s=new URL(gforms_stripe_frontend_strings.ajaxurl);return r&&s.searchParams.set("action",r),i&&s.searchParams.set("nonce",i),gforms_stripe_frontend_strings.is_preview&&s.searchParams.set("preview","1"),await fetch(s.toString(),n).then(e=>e.json())},s=Object.assign||function(e){for(var t=1;t0===e.localeCompare(t,void 0,{sensitivity:"accent"}));return r?e[r]:void 0}getStripeCouponInput(){const e=document.querySelector("#field_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.coupon);return e?e.querySelector("input"):null}getStripeCouponCode(){const e=this.getStripeCouponInput();if(!e)return"";if("gf_coupon_code"===e.className){return e?document.querySelector("#gf_coupon_codes_"+this.GFStripeObj.formId).value:null}return e?e.value:""}bindStripeCoupon(){const e=this.getStripeCouponInput();e&&!e.getAttribute("data-listener-added")&&(e.addEventListener("blur",this.handleCouponChange.bind(this)),e.setAttribute("data-listener-added",!0))}async handleCouponChange(e){this.getStripeCouponInput()===e.target&&(e.target.classList.contains("gf_coupon_code")&&(e.target.value=e.target.value.toUpperCase()),await this.updateStripeCoupon(e.target.value),gformCalculateTotalPrice(this.GFStripeObj.formId))}async updateStripeCoupon(e){if(!e)return;if(window.stripeCoupons||(window.stripeCoupons={}),window.stripeCoupons[e])return;const t=await n(JSON.stringify({coupon:e,feed_id:this.GFStripeObj.activeFeed.feedId}),!0,"gfstripe_get_stripe_coupon",gforms_stripe_frontend_strings.get_stripe_coupon_nonce);window.stripeCoupons[e]=t.data}async initStripe(){this.stripe=Stripe(this.apiKey);const e=this.GFStripeObj.activeFeed.initial_payment_information,t=this.GFStripeObj.cardStyle;return"payment_method_types"in e&&(e.payment_method_types=Object.values(e.payment_method_types)),this.elements=this.stripe.elements(s({},e,{appearance:t})),!0}mountCard(){this.card.mount("#"+this.GFStripeObj.GFCCField.attr("id"))}mountLink(){if(null!==this.link){if(document.querySelectorAll(".stripe-payment-link").length<=0){const e=document.createElement("div");e.setAttribute("id","stripe-payment-link"),e.classList.add("StripeElement--link"),this.GFStripeObj.GFCCField.before(jQuery(e))}this.link.mount("#stripe-payment-link")}}async bindEvents(){this.card&&this.card.on("change",e=>{null!==this.paymentMethod&&this.clearErrors(),this.paymentMethod=e}),this.bindStripeCoupon();const e=document.querySelector("#input_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.link_email_field_id);null!==e&&(e.addEventListener("blur",this.handlelinkEmailFieldChange),window.addEventListener("load",async function(){const e=document.querySelector("#input_"+this.GFStripeObj.formId+"_"+this.GFStripeObj.activeFeed.link_email_field_id);String(e.value).toLowerCase().match(/^(([^<>()[\]\\.,;:\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,}))$/)&&this.GFStripeObj.isLastPage()&&this.handlelinkEmailFieldChange({target:{value:e.value}})}.bind(this)))}async reInitiateLinkWithEmailAddress(e){if(!1===this.GFStripeObj.isCreditCardOnPage())return;this.destroyLink();const t=e.target.value;t&&(this.link=await this.elements.create("linkAuthentication",{defaultValues:{email:t}}),this.mountLink(),this.GFStripeObj.GFCCField.siblings(".gfield #stripe-payment-link").addClass("visible"))}async validate(e){const t=jQuery("#gform_"+this.GFStripeObj.formId);if(t.data("isAjaxSubmitting"))return void t.submit();if(!this.paymentMethod.complete&&"link"!==this.paymentMethod.value.type)return this.failWithMessage(gforms_stripe_frontend_strings.payment_incomplete,this.GFStripeObj.formId),!1;gformAddSpinner(this.GFStripeObj.formId);const r=await n(this.getFormData(e.target));if(-1===r)return this.failWithMessage(gforms_stripe_frontend_strings.invalid_nonce,this.GFStripeObj.formId),!1;if("success"in r&&!1===r.success)return this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId),!1;if("invoice_id"in r.data&&null!==r.data.invoice_id&&"resume_token"in r.data){const e=new URL(window.location.href);e.searchParams.append("resume_token",r.data.resume_token),e.searchParams.append("tracking_id",r.data.tracking_id),window.location.href=e.href}const i="intent"in r.data&&!1!==r.data.intent&&null!=r.data.intent&&"client_secret"in r.data.intent,s="data"in r&&"is_valid"in r.data&&r.data.is_valid&&"resume_token"in r.data,a="is_spam"in r.data&&r.data.is_spam;if(!i&&!a&&s)return this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId),!1;if(s){if(this.resetFormValidationErrors(),this.draftId=r.data.resume_token,"1"!==this.GFStripeObj.activeFeed.hasTrial&&!this.GFStripeObj.activeFeed.setupFee&&!this.isValidCoupon(r.data.total))return this.failWithMessage(gforms_stripe_frontend_strings.coupon_invalid,this.GFStripeObj.formId),!1;a?this.handleRedirect(this.getRedirectUrl(r.data.resume_token)):this.confirm(r.data)}else e.target.submit()}isValidCoupon(e){const t=this.getStripeCoupon();return!t||t.is_valid&&e==this.order.paymentAmount}getFormData(e){const t=new FormData(e);t.delete("gform_submit");const r={action:"gfstripe_validate_form",feed_id:this.GFStripeObj.activeFeed.feedId,form_id:this.GFStripeObj.formId,tracking_id:Math.random().toString(36).slice(2,10),payment_method:this.paymentMethod.value.type,nonce:gforms_stripe_frontend_strings.validate_form_nonce};return Object.keys(r).forEach(e=>{t.append(e,r[e])}),t}updatePaymentAmount(e){if(e<=0||"setup"===this.GFStripeObj.activeFeed.initial_payment_information.mode)return;let t=100*e;t=Math.round(100*t)/100;let r={amount:t};r=window.gform.applyFilters("gform_stripe_payment_element_updated_payment_information",r,this.GFStripeObj.activeFeed.initial_payment_information,this.GFStripeObj.activeFeed.feedId,this.GFStripeObj.formId),this.elements.update(r)}applyStripeCoupon(e){const t=this.getStripeCoupon();return t&&t.is_valid?(t.percentage_off?e-=e*(t.percentage_off/100):t.amount_off&&(e-=t.amount_off),e):e}async confirm(e){const t=this.getRedirectUrl(e.resume_token);t.searchParams.append("tracking_id",e.tracking_id);const{error:r}=await this.elements.submit();if(r)return void this.failWithMessage(r.message,this.GFStripeObj.formId);const i={elements:this.elements,clientSecret:e.intent.client_secret,confirmParams:{return_url:t.toString(),payment_method_data:{billing_details:{address:{line1:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_line1)),line2:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_line2)),city:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_city)),state:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_state)),postal_code:GFMergeTag.replaceMergeTags(this.GFStripeObj.formId,this.getBillingAddressMergeTag(this.GFStripeObj.activeFeed.address_zip))}}}},redirect:"if_required"};let n={},s=0===e.intent.id.indexOf("seti_");try{n=s?await this.stripe.confirmSetup(i):await this.stripe.confirmPayment(i)}catch(e){console.log(e),this.failWithMessage(gforms_stripe_frontend_strings.failed_to_confirm_intent,this.GFStripeObj.formId)}"paymentIntent"in n||"setupIntent"in n?this.handlePaymentRedirect(n,t):await this.handleFailedPayment(n)}handlePaymentRedirect(e,t){const r=e.paymentIntent?e.paymentIntent:e.setupIntent,i=0===r.id.indexOf("seti_")?"setup":"payment";t.searchParams.append(i+"_intent",r.id),t.searchParams.append(i+"_intent_client_secret",r.client_secret),t.searchParams.append("redirect_status",r.status?"succeeded":"pending"),this.handleRedirect(t)}handleRedirect(e){this.isAjaxEmbed(this.GFStripeObj.formId)?(jQuery("#gform_"+this.GFStripeObj.formId).attr("action",e.toString()),jQuery("#gform_"+this.GFStripeObj.formId).data("isAjaxSubmitting",!0),jQuery("#gform_"+this.GFStripeObj.formId).find('[name="gform_submit"]').remove(),jQuery("#gform_"+this.GFStripeObj.formId).submit()):window.location.href=e.toString()}getRedirectUrl(e){const t=new URL(window.location.href);return t.searchParams.append("resume_token",e),t.searchParams.append("feed_id",this.GFStripeObj.activeFeed.feedId),t.searchParams.append("form_id",this.GFStripeObj.formId),t}async handleFailedPayment(e){let t="";"error"in e&&"message"in e.error&&(t=e.error.message),this.failWithMessage(t,this.GFStripeObj.formId);let r=n(JSON.stringify({draft_id:this.draftId}),!0,"gfstripe_delete_draft_entry",gforms_stripe_frontend_strings.delete_draft_nonce);this.GFStripeObj.hasOwnProperty("cardErrorCount")&&(r=await n(JSON.stringify({increase_count:!0}),!0,"gfstripe_payment_element_check_rate_limiting",gforms_stripe_frontend_strings.rate_limiting_nonce),this.GFStripeObj.cardErrorCount=r.data.error_count)}destroy(){this.card&&this.card.destroy(),this.destroyLink()}destroyLink(){if(this.link){this.link.destroy(),this.link=null;const e=this.GFStripeObj.GFCCField.siblings(".gfield #stripe-payment-link");e&&e.remove()}}clearErrors(){this.GFStripeObj.GFCCField.next(".validation_message").length&&this.GFStripeObj.GFCCField.next(".validation_message").remove()}resetFormValidationErrors(){document.querySelectorAll(".gform_validation_errors, .validation_message").forEach(e=>{e.remove()}),document.querySelectorAll(".gfield_error").forEach(e=>{e.classList.remove("gfield_error")})}failWithMessage(e,t){e=e||gforms_stripe_frontend_strings.failed_to_process_payment,this.GFStripeObj.displayStripeCardError({error:{message:e}}),this.GFStripeObj.resetStripeStatus(jQuery("#gform_"+t),t,!0),jQuery("#gform_ajax_spinner_"+t).remove()}getBillingAddressMergeTag(e){return""===e?"":"{:"+e+":value}"}getOrderData(e,t){if(!_gformPriceFields[t]||null===this.GFStripeObj.activeFeed)return this.order;const r=this.GFStripeObj.activeFeed.setupFee;let i=0;const n=this.GFStripeObj.activeFeed.hasTrial;if(r){const r=this.GFStripeObj.getProductFieldPrice(t,this.GFStripeObj.activeFeed.setupFee);i=r.price*r.qty,e-=i}return"form_total"===this.GFStripeObj.activeFeed.paymentAmount?(this.order.recurringAmount=e,this.isTextCoupon()&&(this.order.recurringAmount=this.applyStripeCoupon(this.order.recurringAmount))):(this.order.recurringAmount=gformCalculateProductPrice(t,this.GFStripeObj.activeFeed.paymentAmount),this.order.recurringAmount=this.applyStripeCoupon(this.order.recurringAmount)),this.order.paymentAmount="1"===n?i:this.order.recurringAmount+i,this.order}isTextCoupon(){const e=this.getStripeCouponInput();return!!e&&!e.classList.contains("gf_coupon_code")}isAjaxEmbed(e){return jQuery("#gform_ajax_frame_"+e).length>=1}}window.GFStripe=null,gform.extensions=gform.extensions||{},gform.extensions.styles=gform.extensions.styles||{},gform.extensions.styles.gravityformsstripe=gform.extensions.styles.gravityformsstripe||{},i=jQuery,GFStripe=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);this.form=null,this.activeFeed=null,this.GFCCField=null,this.stripeResponse=null,this.hasPaymentIntent=!1,this.stripePaymentHandlers={},this.cardStyle=this.cardStyle||{},gform.extensions.styles.gravityformsstripe[this.formId]=gform.extensions.styles.gravityformsstripe[this.formId]||{};const r=Object.keys(this.cardStyle).length>0?JSON.parse(JSON.stringify(this.cardStyle)):gform.extensions.styles.gravityformsstripe[this.formId][this.pageInstance]||{};this.setComponentStyleValue=function(e,t,r,i){let n="";if(0===t.indexOf("--")){const s=r.getPropertyValue(t);if(s)n=s;else{const t="fontSmoothing"===e?"-webkit-font-smoothing":e;n=(i?getComputedStyle(i):r).getPropertyValue(t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())}}else n=t;return n.trim()},this.setComponentStyles=function(e,t,i){if(0===Object.keys(e).length)return;const n=document.getElementById("gform_"+this.formId),s=getComputedStyle(n),a=n.querySelector(".gfield input");Object.keys(e).forEach(n=>{if("object"!=typeof e[n]){if("object"!=typeof e[n]){let e="";i?t&&t!==i?(e=this.setComponentStyleValue(n,r[i][t][n],s,a),e&&(this.cardStyle[i][t][n]=e)):(e=this.setComponentStyleValue(n,r[i][n],s,a),e&&(this.cardStyle[i][n]=e)):(e=this.setComponentStyleValue(n,r[n],s,a),e&&(this.cardStyle[n]=e))}}else{i||(this.cardStyle[n]={}),i&&(this.cardStyle[i][n]={});const t=i||n;this.setComponentStyles(e[n],n,t)}})},this.init=async function(){if(this.setComponentStyles(r),this.isCreditCardOnPage()||"stripe.js"!==this.stripe_payment&&("elements"!==this.stripe_payment||i("#gf_stripe_response").length)){var e=this,t=null,n=!1,s=!1,o=this.apiKey;switch(this.form=i("#gform_"+this.formId),this.GFCCField=i("#input_"+this.formId+"_"+this.ccFieldId+"_1"),gform.addAction("gform_frontend_feeds_evaluated",(async function(r,c){if(c===e.formId){t=null,n=!1,s=!1;for(var u=0;u div").length?(i(".ginput_container_creditcard > div:last").hide(),i(".ginput_container_creditcard > div:first").html("

"+gforms_stripe_frontend_strings.requires_action+"

")):i(".ginput_container_creditcard").html("

"+gforms_stripe_frontend_strings.requires_action+"

"),jQuery("#gform_"+c+"_validation_container h2 .gform_ajax_spinner").length<=0&&(jQuery("#gform_"+c+"_validation_container h2").append(''),jQuery("#gform_submit_button_"+c).prop("disabled",!0));const t=jQuery("#gform_"+c+"_validation_container h2 .gform-icon.gform-icon--close"),r=jQuery(".gform-theme--framework").length;console.log(r),console.log(t),t.length&&!r&&t.removeClass("gform-icon--close").addClass("gform-icon--info"),e.scaActionHandler(d,c)}else p.mount("#"+e.GFCCField.attr("id")),p.on("change",(function(t){e.displayStripeCardError(t)}));else if("stripe.js"==e.stripe_payment){Stripe.setPublishableKey(o);break}break}n||("elements"!==e.stripe_payment&&"payment_element"!==e.stripe_payment||(null!=l&&p===l.getElement("card")&&p.destroy(),e.isStripePaymentHandlerInitiated(c)&&e.stripePaymentHandlers[c].destroy(),e.GFCCField.next(".validation_message").length||e.GFCCField.after('
'+gforms_stripe_frontend_strings.no_active_frontend_feed+"
"),wp.a11y.speak(gforms_stripe_frontend_strings.no_active_frontend_feed)),e.resetStripeStatus(e.form,c,e.isLastPage()),o=e.apiKey,e.activeFeed=null)}})),gform.addFilter("gform_product_total",(function(t,r){if("payment_element"==e.stripe_payment&&e.isStripePaymentHandlerInitiated(r)&&e.stripePaymentHandlers[r].getOrderData(t,r),!e.activeFeed)return window["gform_stripe_amount_"+r]=0,t;if("form_total"!==e.activeFeed.paymentAmount){const t=e.getProductFieldPrice(r,e.activeFeed.paymentAmount);if(window["gform_stripe_amount_"+r]=t.price*t.qty,e.activeFeed.hasOwnProperty("setupFee")){const t=e.getProductFieldPrice(r,e.activeFeed.setupFee);window["gform_stripe_amount_"+r]+=t.price*t.qty}}else window["gform_stripe_amount_"+r]=t;return"payment_element"==e.stripe_payment&&e.isStripePaymentHandlerInitiated(r)&&null!==e.stripePaymentHandlers[r].elements&&"1"===gforms_stripe_frontend_strings.stripe_connect_enabled&&e.stripePaymentHandlers[r].updatePaymentAmount(e.stripePaymentHandlers[r].order.paymentAmount),t}),51),this.stripe_payment){case"elements":var d=null,l=null,p=null;i("#gf_stripe_response").length&&(this.stripeResponse=JSON.parse(i("#gf_stripe_response").val()),this.stripeResponse.hasOwnProperty("client_secret")&&(this.hasPaymentIntent=!0))}if(i("#gform_"+this.formId).on("submit",(function(r){let s=!1;const a=parseInt(i("#gform_source_page_number_"+e.formId).val(),10),o=parseInt(i("#gform_target_page_number_"+e.formId).val(),10);if(a>o&&0!==o&&(s=!0),!(s||!n||i(this).data("gfstripesubmitting")||1==i("#gform_save_"+e.formId).val()||!e.isLastPage()&&"elements"!==e.stripe_payment||gformIsHidden(e.GFCCField)||e.maybeHitRateLimits()||e.invisibleCaptchaPending()||e.recaptchav3Pending()||"payment_element"===e.stripe_payment&&0===window["gform_stripe_amount_"+e.formId]))switch(r.preventDefault(),i(this).data("gfstripesubmitting",!0),e.maybeAddSpinner(),e.stripe_payment){case"payment_element":e.injectHoneypot(r),e.stripePaymentHandlers[e.formId].validate(r);break;case"elements":if(e.form=i(this),e.isLastPage()&&!e.isCreditCardOnPage()||gformIsHidden(e.GFCCField)||s)return void i(this).submit();"product"===t.type?e.createPaymentMethod(d,p):e.createToken(d,p);break;case"stripe.js":var l=i(this),c="input_"+e.formId+"_"+e.ccFieldId+"_",u={number:l.find("#"+c+"1").val(),exp_month:l.find("#"+c+"2_month").val(),exp_year:l.find("#"+c+"2_year").val(),cvc:l.find("#"+c+"3").val(),name:l.find("#"+c+"5").val()};e.form=l,Stripe.card.createToken(u,(function(t,r){e.responseHandler(t,r)}))}})),"payment_element_intent_failure"in e&&e.payment_element_intent_failure){const t=jQuery('

'+gforms_stripe_frontend_strings.payment_element_intent_failure+"

");jQuery("#gform_wrapper_"+e.formId).prepend(t)}}},this.getProductFieldPrice=function(e,t){var r=GFMergeTag.getMergeTagValue(e,t,":price"),i=GFMergeTag.getMergeTagValue(e,t,":qty");return"string"==typeof r&&(r=GFMergeTag.getMergeTagValue(e,t+".2",":price"),i=GFMergeTag.getMergeTagValue(e,t+".3",":qty")),{price:r,qty:i}},this.getBillingAddressMergeTag=function(e){return""===e?"":"{:"+e+":value}"},this.responseHandler=function(e,t){for(var r=this.form,n="input_"+this.formId+"_"+this.ccFieldId+"_",s=["1","2_month","2_year","3","5"],a=0;a').val(d.slice(-4))),r.append(i('').val(l))}}r.append(i('').val(i.toJSON(t))),r.submit()},this.elementsResponseHandler=function(e){var t=this.form,r=this,n=this.activeFeed,s=gform.applyFilters("gform_stripe_currency",this.currency,this.formId),a=0===gf_global.gf_currency_config.decimals?window["gform_stripe_amount_"+this.formId]:gformRoundPrice(100*window["gform_stripe_amount_"+this.formId]);if(e.error)return this.displayStripeCardError(e),void this.resetStripeStatus(t,this.formId,this.isLastPage());if(this.hasPaymentIntent)if("product"===n.type)e.hasOwnProperty("paymentMethod")?(i("#gf_stripe_credit_card_last_four").val(e.paymentMethod.card.last4),i("#stripe_credit_card_type").val(e.paymentMethod.card.brand),i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_update_payment_intent",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,payment_intent:e.id,payment_method:e.paymentMethod,currency:s,amount:a,feed_id:n.feedId},success:function(e){e.success?(i("#gf_stripe_response").val(i.toJSON(e.data)),t.submit()):(e.error=e.data,delete e.data,r.displayStripeCardError(e),r.resetStripeStatus(t,r.formId,r.isLastPage()))}})):e.hasOwnProperty("amount")&&t.submit();else{var o=JSON.parse(i("#gf_stripe_response").val());o.updatedToken=e.token.id,i("#gf_stripe_response").val(i.toJSON(o)),t.append(i('').val(e.token.card.last4)),t.append(i('').val(e.token.card.brand)),t.submit()}else i("#gf_stripe_response").length?i("#gf_stripe_response").val(i.toJSON(e)):t.append(i('').val(i.toJSON(e))),"product"===n.type?(t.append(i('').val(e.paymentMethod.card.last4)),t.append(i('').val(e.paymentMethod.card.brand)),i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_create_payment_intent",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,payment_method:e.paymentMethod,currency:s,amount:a,feed_id:n.feedId},success:function(e){e.success?(i("#gf_stripe_response").length?i("#gf_stripe_response").val(i.toJSON(e.data)):t.append(i('').val(i.toJSON(e.data))),t.submit()):(e.error=e.data,delete e.data,r.displayStripeCardError(e),r.resetStripeStatus(t,r.formId,r.isLastPage()))}})):(t.append(i('').val(e.token.card.last4)),t.append(i('').val(e.token.card.brand)),t.submit())},this.scaActionHandler=function(e,t){if(!i("#gform_"+t).data("gfstripescaauth")){i("#gform_"+t).data("gfstripescaauth",!0);var r=this,n=JSON.parse(i("#gf_stripe_response").val());"product"===this.activeFeed.type?e.retrievePaymentIntent(n.client_secret).then((function(s){"requires_action"===s.paymentIntent.status&&e.handleCardAction(n.client_secret).then((function(e){var n=JSON.parse(i("#gf_stripe_response").val());n.scaSuccess=!0,i("#gf_stripe_response").val(i.toJSON(n)),r.maybeAddSpinner(),jQuery("#gform_submit_button_"+t).prop("disabled",!1),i("#gform_"+t).data("gfstripescaauth",!1),i("#gform_"+t).data("gfstripesubmitting",!0).submit(),jQuery("#gform_submit_button_"+t).prop("disabled",!0)}))})):e.retrievePaymentIntent(n.client_secret).then((function(s){"requires_action"===s.paymentIntent.status&&e.handleCardPayment(n.client_secret).then((function(e){r.maybeAddSpinner(),jQuery("#gform_submit_button_"+t).prop("disabled",!1),i("#gform_"+t).data("gfstripescaauth",!1),i("#gform_"+t).data("gfstripesubmitting",!0).trigger("submit")}))}))}},this.isLastPage=function(){var e=i("#gform_target_page_number_"+this.formId);return!(e.length>0)||0==e.val()},this.isConversationalForm=function(){return i('[data-js="gform-conversational-form"]').length>0},this.isCreditCardOnPage=function(){var e=this.getCurrentPageNumber();return!(this.ccPage&&e&&!this.isConversationalForm())||this.ccPage==e},this.getCurrentPageNumber=function(){var e=i("#gform_source_page_number_"+this.formId);return e.length>0&&e.val()},this.maybeAddSpinner=function(){if(!this.isAjax)if("function"==typeof gformAddSpinner)gformAddSpinner(this.formId);else{var e=this.formId;if(0==jQuery("#gform_ajax_spinner_"+e).length){var t=gform.applyFilters("gform_spinner_url",gf_global.spinnerUrl,e);gform.applyFilters("gform_spinner_target_elem",jQuery("#gform_submit_button_"+e+", #gform_wrapper_"+e+" .gform_next_button, #gform_send_resume_link_button_"+e),e).after('')}}},this.resetStripeStatus=function(e,t,r){i("#gf_stripe_response, #gf_stripe_credit_card_last_four, #stripe_credit_card_type").remove(),e.data("gfstripesubmitting",!1),document.querySelectorAll("#gform_ajax_spinner_"+t).forEach((function(e){e.remove()})),r&&(window["gf_submitting_"+t]=!1)},this.displayStripeCardError=function(e){e.error&&!this.GFCCField.next(".validation_message").length&&this.GFCCField.after('
');var t=this.GFCCField.next(".validation_message");e.error?(t.html(e.error.message),wp.a11y.speak(e.error.message,"assertive"),i("#gform_ajax_spinner_"+this.formId).length>0&&i("#gform_ajax_spinner_"+this.formId).remove()):t.remove()},this.createToken=function(e,t){const r=this,n=this.activeFeed,s={name:i("#input_"+r.formId+"_"+r.ccFieldId+"_5").val(),address_line1:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_line1)),address_line2:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_line2)),address_city:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_city)),address_state:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_state)),address_zip:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_zip)),address_country:GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(n.address_country)),currency:gform.applyFilters("gform_stripe_currency",this.currency,this.formId)};e.createToken(t,s).then((function(e){r.elementsResponseHandler(e)}))},this.createPaymentMethod=function(e,t,r){var n=this,s=this.activeFeed,a="";if(""!==s.address_country&&(a=GFMergeTag.replaceMergeTags(n.formId,n.getBillingAddressMergeTag(s.address_country))),""===a||void 0!==r&&""!==r){var o=i("#input_"+this.formId+"_"+this.ccFieldId+"_5").val(),d=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_line1)),l=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_line2)),p=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_city)),c=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_state)),u=GFMergeTag.replaceMergeTags(this.formId,this.getBillingAddressMergeTag(s.address_zip)),f={billing_details:{name:null,address:{}}};""!==o&&(f.billing_details.name=o),""!==d&&(f.billing_details.address.line1=d),""!==l&&(f.billing_details.address.line2=l),""!==p&&(f.billing_details.address.city=p),""!==c&&(f.billing_details.address.state=c),""!==u&&(f.billing_details.address.postal_code=u),""!==r&&(f.billing_details.address.country=r),null===f.billing_details.name&&delete f.billing_details.name,f.billing_details.address==={}&&delete f.billing_details.address,e.createPaymentMethod("card",t,f).then((function(e){null!==n.stripeResponse&&(e.id=n.stripeResponse.id,e.client_secret=n.stripeResponse.client_secret),n.elementsResponseHandler(e)}))}else i.ajax({async:!1,url:gforms_stripe_frontend_strings.ajaxurl,dataType:"json",method:"POST",data:{action:"gfstripe_get_country_code",nonce:gforms_stripe_frontend_strings.create_payment_intent_nonce,country:a,feed_id:s.feedId},success:function(r){r.success&&n.createPaymentMethod(e,t,r.data.code)}})},this.maybeHitRateLimits=function(){return!!(this.hasOwnProperty("cardErrorCount")&&this.cardErrorCount>=5)},this.invisibleCaptchaPending=function(){var e=this.form.find(".ginput_recaptcha");if(!e.length||"invisible"!==e.data("size"))return!1;var t=e.find(".g-recaptcha-response");return!(t.length&&t.val())},this.recaptchav3Pending=function(){const e=this.form.find(".ginput_recaptchav3");if(!e.length)return!1;const t=e.find(".gfield_recaptcha_response");return!(t&&t.val())},this.injectHoneypot=e=>{const t=e.target;if((this.isFormSubmission(t)||this.isSaveContinue(t))&&!this.isHeadlessBrowser()){const e=``;t.insertAdjacentHTML("beforeend",e)}},this.isSaveContinue=e=>{const t=e.dataset.formid,r=this.getNodes("#gform_save_"+t,!0,e,!0);return r.length>0&&"1"===r[0].value},this.isFormSubmission=e=>{const t=e.dataset.formid,r=this.getNodes(`input[name = "gform_target_page_number_${t}"]`,!0,e,!0)[0];return void 0!==r&&0===parseInt(r.value)},this.isHeadlessBrowser=()=>window._phantom||window.callPhantom||window.__phantomas||window.Buffer||window.emit||window.spawn||window.webdriver||window._selenium||window._Selenium_IDE_Recorder||window.callSelenium||window.__nightmare||window.domAutomation||window.domAutomationController||window.document.__webdriver_evaluate||window.document.__selenium_evaluate||window.document.__webdriver_script_function||window.document.__webdriver_script_func||window.document.__webdriver_script_fn||window.document.__fxdriver_evaluate||window.document.__driver_unwrapped||window.document.__webdriver_unwrapped||window.document.__driver_evaluate||window.document.__selenium_unwrapped||window.document.__fxdriver_unwrapped||window.document.documentElement.getAttribute("selenium")||window.document.documentElement.getAttribute("webdriver")||window.document.documentElement.getAttribute("driver"),this.getNodes=(e="",t=!1,r=document,i=!1)=>{const n=i?e:`[data-js="${e}"]`;let s=r.querySelectorAll(n);return t&&(s=this.convertElements(s)),s},this.convertElements=(e=[])=>{const t=[];let r=e.length;for(;r--;t.unshift(e[r]));return t},this.isStripePaymentHandlerInitiated=function(e){return e in this.stripePaymentHandlers&&null!==this.stripePaymentHandlers[e]&&void 0!==this.stripePaymentHandlers[e]},this.init()}}]); \ No newline at end of file diff --git a/js/payment_element_form_editor.js b/js/payment_element_form_editor.js index 80da7ab..adfb20a 100644 --- a/js/payment_element_form_editor.js +++ b/js/payment_element_form_editor.js @@ -93,6 +93,7 @@ /*! no static exports found */ /***/ (function(module, exports) { + /** * Mounts the card element into the container. * @@ -267,15 +268,23 @@ const bindEvents = () => { setFieldError('enable_multiple_payment_methods_setting', 'below', gform_stripe_payment_element_form_editor_strings.payment_element_disabled_message); } - const $linkEmailSelector = jQuery('#link_email_field'); - const $linkEmailSelectedId = $linkEmailSelector.val(); - $linkEmailSelector.empty(); + const linkEmailSelect = gform.utils.getNode('#link_email_field', document, true); + const linkEmailSelectedId = linkEmailSelect.value; + const optionNodes = gform.utils.getNodes('gform-stripe-link-email-ids'); + optionNodes.forEach(option => { + option.remove(); + }); form.fields.forEach((field, index) => { if (field.type === 'email') { - $linkEmailSelector.append(jQuery('')); + const option = document.createElement('option'); + option.value = field.id; + option.setAttribute('data-js', 'gform-stripe-link-email-ids'); + option.textContent = `${field.label} - ${gform_stripe_payment_element_form_editor_strings.email_field_id_text}: ${field.id}`; + linkEmailSelect.appendChild(option); } }); - $linkEmailSelector.val($linkEmailSelectedId); + + linkEmailSelect.value = linkEmailSelectedId; jQuery('#field_enable_multiple_payment_methods').prop('checked', field.enableMultiplePaymentMethods ? true : false); jQuery('#link_email_field').val(`linkEmailFieldId` in field ? field.linkEmailFieldId : 0); diff --git a/js/payment_element_form_editor.js.map b/js/payment_element_form_editor.js.map index 9942825..058742b 100644 --- a/js/payment_element_form_editor.js.map +++ b/js/payment_element_form_editor.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/src/payment-element/form_editor.js","webpack:///./node_modules/whatwg-fetch/fetch.js"],"names":["mountCard","jQuery","length","gform_stripe_payment_element_form_editor_strings","stripe_connect_enabled","stripe","Stripe","api_key","text","payment_element_error","elements","amount","currency","payment_element_currency","mode","payment_method_types","card","create","mount","prepend","showHideElement","enabled","form","fields","forEach","field","type","enableMultiplePaymentMethods","$elementContainer","$cardContainer","elementContainerStyle","cardContainerStyle","$linkEmailField","hide","show","get","style","display","showHideFieldSettings","allSettings","getAllFieldSettings","GetSelectedField","filterSubLabelsSettingClasses","settingsArray","paymentElementEnabled","is","splice","indexOf","push","validateFieldPosition","error","has_product","has_option","lastPageFieldIndex","findLastIndex","stripeFieldIndex","findIndex","field_position_validation_error","afterRefreshField","fieldId","id","bindEvents","gform","addAction","addFilter","document","bind","event","is_payment_element_supported","payment_element_supported","addClass","prop","setFieldError","payment_element_disabled_message","$linkEmailSelector","$linkEmailSelectedId","val","empty","index","append","label","linkEmailFieldId","on","e","paymentElementFormEditorHandler","ready"],"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;;;;;AAKA,MAAMA,YAAY,MAAM;AACvB,KAAKC,OAAQ,mCAAR,EAA8CC,MAA9C,IAAwD,CAAxD,IAA6DC,iDAAiDC,sBAAjD,KAA4E,GAA9I,EAAoJ;AACnJ;AACA;AACD,OAAMC,SAASC,OAAQH,iDAAiDI,OAAzD,CAAf;;AAEA,KAAK,CAAEF,MAAP,EAAe;AACdJ,SAAQ,mCAAR,EAA8CO,IAA9C,CAAoDL,iDAAiDM,qBAArG;AACA,EAFD,MAEO;AACN,QAAMC,WAAWL,OAAOK,QAAP,CAAiB;AACjCC,WAAO,GAD0B;AAEj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AQgE,QAAR,EAAmBoB,KAAnB,CAA0B,YAAY;AACrCD;AACA,CAFD;;AAIA;;;AAGAnF,OAAQgE,QAAR,EAAmBiB,EAAnB,CAAuB,mBAAvB,EAA6C,UAAUf,KAAV,EAAiB7C,IAAjB,EAAuBG,KAAvB,EAA+B;AAC3E,KAAKA,MAAMC,IAAN,KAAe,mBAApB,EAA0C;AACzCN;AACApB;AACA;AACD,CALD,E;;;;;;;;;;;;ACjOA;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/payment_element_form_editor.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 = 1);\n","/**\n * Mounts the card element into the container.\n *\n * @since 5.0\n */\nconst mountCard = () => {\n\tif ( jQuery( '.stripe-payment-element-container' ).length <= 0 || gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled !== \"1\" ) {\n\t\treturn;\n\t}\n\tconst stripe = Stripe( gform_stripe_payment_element_form_editor_strings.api_key );\n\n\tif ( ! stripe) {\n\t\tjQuery( '.stripe-payment-element-container' ).text( gform_stripe_payment_element_form_editor_strings.payment_element_error );\n\t} else {\n\t\tconst elements = stripe.elements( {\n\t\t\tamount:100,\n\t\t\tcurrency: gform_stripe_payment_element_form_editor_strings.payment_element_currency,\n\t\t\tmode:\"payment\",\n\t\t\tpayment_method_types: ['card'],\n\t\t} );\n\n\t\tconst card = elements.create( 'payment', { 'readOnly': true } );\n\t\tcard.mount( '.stripe-payment-element-container' );\n\t\t//Prevents users from interacting with the Stripe Field in the form editor\n\t\tjQuery( '.stripe-payment-element-container' ).prepend( '
' );\n\n\n\t}\n}\n\n/**\n * Shows or hides the payment element.\n *\n * @since 4.3\n *\n * @param enabled Whether the element should be shown or hidden.\n */\nconst showHideElement = ( enabled = null ) => {\n\n\tif( enabled === null && gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled === \"1\" ) {\n\t\tenabled = false;\n\t\tform.fields.forEach( ( field ) => {\n\t\t\tif( field.type === 'stripe_creditcard' ) {\n\t\t\t\tenabled = field.enableMultiplePaymentMethods;\n\t\t\t}\n\t\t} )\n\t}\n\n\tconst $elementContainer = jQuery( '.stripe-payment-element-container' );\n\tconst $cardContainer = jQuery( '.ginput_stripe_creditcard' );\n\tconst elementContainerStyle = enabled ? 'block' : 'none';\n\tconst cardContainerStyle = enabled ? 'none' : 'block';\n\tconst $linkEmailField = jQuery( '#link_email_field_container' );\n\n\tif ( ! enabled ) {\n\t\t$linkEmailField.hide();\n\t} else {\n\t\t$linkEmailField.show();\n\t}\n\n\tif ( $elementContainer.length ) {\n\t\t$elementContainer.get(0).style.display = elementContainerStyle;\n\t}\n\tif ( $cardContainer.length ) {\n\t\t$cardContainer.get(0).style.display = cardContainerStyle;\n\t}\n}\n\n/**\n * Shows or hides the sub labels and input placeholders setting as it is not needed for the payment element when its setting is on.\n *\n * Can not call this inside showHideElement because it messes up the other field while the editor is still loading, and showHideElement is called on load.\n *\n * since 4.3\n */\nconst showHideFieldSettings = () => {\n\tjQuery( '.field_setting' ).hide();\n\tlet allSettings = getAllFieldSettings( GetSelectedField() );\n\tjQuery( allSettings ).show();\n}\n\n/**\n * Hooks to the field settings filter to remove the sub label classes and input placeholder classes if needed.\n *\n * @since 4.3\n *\n * @param {Array} settingsArray The field settings classes.\n * @param {Object} field The field object.\n *\n * @return {Array}\n */\nconst filterSubLabelsSettingClasses = ( settingsArray, field ) => {\n\tif ( field.type !== 'stripe_creditcard' ) {\n\t\treturn settingsArray;\n\t}\n\tconst paymentElementEnabled = jQuery( '#field_enable_multiple_payment_methods' ).is(':checked');\n\tif ( paymentElementEnabled ) {\n\t\tsettingsArray.splice( settingsArray.indexOf( '.sub_label_placement_setting' ), 1 );\n\t\tsettingsArray.splice( settingsArray.indexOf( '.sub_labels_setting' ), 1 );\n\t\tsettingsArray.splice( settingsArray.indexOf( '.input_placeholders_setting' ), 1 );\n\t} else {\n\t\tsettingsArray.push( '.sub_labels_setting', '.sub_label_placement_setting', '.input_placeholders_setting' );\n\t}\n\n\treturn settingsArray;\n}\n\n/**\n * Hooks to the form validation filter and validates that the field is in the last page of a multi-page form.\n *\n * @since 4.3\n *\n * @param {String} error The error message provided by the filter that will be returned.\n * @param {Object} form The form object.\n * @param {Boolean} has_product Whether the form has a product or not.\n * @param {Boolean} has_option Whether the form has an option field or not.\n *\n * @return {String}\n */\nconst validateFieldPosition = ( error, form, has_product, has_option ) => {\n\t\tconst lastPageFieldIndex = form.fields.findLastIndex( ( field ) => field.type === 'page' );\n\t\tconst stripeFieldIndex = form.fields.findIndex( ( field ) => field.type === 'stripe_creditcard' && field.enableMultiplePaymentMethods === true );\n\t\tif ( lastPageFieldIndex === -1 || stripeFieldIndex === -1 ) {\n\t\t\treturn error;\n\t\t}\n\n\t\tif ( stripeFieldIndex < lastPageFieldIndex ) {\n\t\t\terror = gform_stripe_payment_element_form_editor_strings.field_position_validation_error;\n\t\t}\n\n\t\treturn error;\n}\n\nconst afterRefreshField = ( fieldId ) => {\n\tconst stripeFieldIndex = form.fields.findIndex( ( field ) => field.type === 'stripe_creditcard' && field.enableMultiplePaymentMethods === true );\n\tif( stripeFieldIndex < 0 || form.fields[stripeFieldIndex].id != fieldId ) {\n\t\treturn;\n\t}\n\n\tshowHideElement();\n\tmountCard();\n}\n\n/**\n * Binds the functionalities needed to their corresponding events.\n *\n * @since 4.3\n */\nconst bindEvents = () => {\n\n\tgform.addAction( 'gform_after_refresh_field_preview', afterRefreshField );\n\n\tgform.addFilter( 'gform_editor_field_settings', filterSubLabelsSettingClasses );\n\tgform.addFilter( 'gform_validation_error_form_editor', validateFieldPosition );\n\n\tjQuery( document ).bind( 'gform_load_field_settings', function( event, field, form ) {\n\n\t\tif ( field.type !== 'stripe_creditcard' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst is_payment_element_supported = gform_stripe_payment_element_form_editor_strings.payment_element_supported === \"1\";\n\n\t\tif ( gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled !== \"1\" || ! is_payment_element_supported ) {\n\t\t\t// Adding disabled class to container.\n\t\t\tjQuery( '.enable_multiple_payment_methods_setting' ).addClass( 'gform-stripe--disabled' );\n\n\t\t\t// Disabling the checkbox.\n\t\t\tjQuery( '#field_enable_multiple_payment_methods' ).prop( 'disabled', true ).prop( 'checked', false );\n\t\t\tjQuery( '#link_email_field' ).prop( 'disabled', true );\n\t\t}\n\n\t\tif ( ! is_payment_element_supported ) {\n\t\t\t// Show the error message.\n\t\t\tsetFieldError( 'enable_multiple_payment_methods_setting', 'below', gform_stripe_payment_element_form_editor_strings.payment_element_disabled_message );\n\t\t}\n\n\t\tconst $linkEmailSelector = jQuery( '#link_email_field' );\n\t\tconst $linkEmailSelectedId = $linkEmailSelector.val();\n\t\t$linkEmailSelector.empty();\n\t\tform.fields.forEach( ( field, index ) => {\n\t\t\tif ( field.type === 'email' ) {\n\t\t\t\t$linkEmailSelector.append( jQuery( '' ) );\n }\n\t\t});\n\t\t$linkEmailSelector.val( $linkEmailSelectedId );\n\n\t\tjQuery('#field_enable_multiple_payment_methods').prop( 'checked', field.enableMultiplePaymentMethods ? true : false );\n\t\tjQuery('#link_email_field').val( `linkEmailFieldId` in field ? field.linkEmailFieldId : 0 );\n\t\tshowHideFieldSettings();\n\t});\n\n\tjQuery( '#field_enable_multiple_payment_methods' ).on( 'change', function ( e ) {\n\t\tshowHideElement( jQuery( this ).is( ':checked' ) );\n\t\tshowHideFieldSettings();\n\t});\n\n\tjQuery( '#link_email_field' ).on( 'change', function ( e ) {\n\t\tconst field = GetSelectedField();\n\t\tfield.linkEmailFieldId = jQuery( this ).val();\n\t});\n\n}\n\n/**\n * Handles the form editor UI logic for the payment element.\n *\n * @since 4.3\n */\nconst paymentElementFormEditorHandler = () => {\n\n\tbindEvents();\n\tshowHideElement();\n\tmountCard();\n}\n\n/**\n * Launches UI handler on page ready.\n */\njQuery( document ).ready( function () {\n\tpaymentElementFormEditorHandler();\n})\n\n/**\n * Reset the UI after adding a new field.\n */\njQuery( document ).on( 'gform_field_added', function( event, form, field ) {\n\tif ( field.type === 'stripe_creditcard' ) {\n\t\tshowHideElement();\n\t\tmountCard();\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":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/src/payment-element/form_editor.js","webpack:///./node_modules/whatwg-fetch/fetch.js"],"names":["mountCard","jQuery","length","gform_stripe_payment_element_form_editor_strings","stripe_connect_enabled","stripe","Stripe","api_key","text","payment_element_error","elements","amount","currency","payment_element_currency","mode","payment_method_types","card","create","mount","prepend","showHideElement","enabled","form","fields","forEach","field","type","enableMultiplePaymentMethods","$elementContainer","$cardContainer","elementContainerStyle","cardContainerStyle","$linkEmailField","hide","show","get","style","display","showHideFieldSettings","allSettings","getAllFieldSettings","GetSelectedField","filterSubLabelsSettingClasses","settingsArray","paymentElementEnabled","is","splice","indexOf","push","validateFieldPosition","error","has_product","has_option","lastPageFieldIndex","findLastIndex","stripeFieldIndex","findIndex","field_position_validation_error","afterRefreshField","fieldId","id","bindEvents","gform","addAction","addFilter","document","bind","event","is_payment_element_supported","payment_element_supported","addClass","prop","setFieldError","payment_element_disabled_message","linkEmailSelect","utils","getNode","linkEmailSelectedId","value","optionNodes","getNodes","option","remove","index","createElement","setAttribute","textContent","label","email_field_id_text","appendChild","val","linkEmailFieldId","on","e","paymentElementFormEditorHandler","ready"],"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;;;;;;;;;;;;;ACjFA;;;;;AAKA,MAAMA,YAAY,MAAM;AACvB,KAAKC,OAAQ,mCAAR,EAA8CC,MAA9C,IAAwD,CAAxD,IAA6DC,iDAAiDC,sBAAjD,KAA4E,GAA9I,EAAoJ;AACnJ;AACA;AACD,OAAMC,SAASC,OAAQH,iDAAiDI,OAAzD,CAAf;;AAEA,KAAK,CAAEF,MAAP,EAAe;AACdJ,SAAQ,mCAAR,EAA8CO,IAA9C,CAAoDL,iDAAiDM,qBAArG;AACA,EA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;;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/payment_element_form_editor.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 = 1);\n","\n/**\n * Mounts the card element into the container.\n *\n * @since 5.0\n */\nconst mountCard = () => {\n\tif ( jQuery( '.stripe-payment-element-container' ).length <= 0 || gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled !== \"1\" ) {\n\t\treturn;\n\t}\n\tconst stripe = Stripe( gform_stripe_payment_element_form_editor_strings.api_key );\n\n\tif ( ! stripe) {\n\t\tjQuery( '.stripe-payment-element-container' ).text( gform_stripe_payment_element_form_editor_strings.payment_element_error );\n\t} else {\n\t\tconst elements = stripe.elements( {\n\t\t\tamount:100,\n\t\t\tcurrency: gform_stripe_payment_element_form_editor_strings.payment_element_currency,\n\t\t\tmode:\"payment\",\n\t\t\tpayment_method_types: ['card'],\n\t\t} );\n\n\t\tconst card = elements.create( 'payment', { 'readOnly': true } );\n\t\tcard.mount( '.stripe-payment-element-container' );\n\t\t//Prevents users from interacting with the Stripe Field in the form editor\n\t\tjQuery( '.stripe-payment-element-container' ).prepend( '
' );\n\n\n\t}\n}\n\n/**\n * Shows or hides the payment element.\n *\n * @since 4.3\n *\n * @param enabled Whether the element should be shown or hidden.\n */\nconst showHideElement = ( enabled = null ) => {\n\n\tif( enabled === null && gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled === \"1\" ) {\n\t\tenabled = false;\n\t\tform.fields.forEach( ( field ) => {\n\t\t\tif( field.type === 'stripe_creditcard' ) {\n\t\t\t\tenabled = field.enableMultiplePaymentMethods;\n\t\t\t}\n\t\t} )\n\t}\n\n\tconst $elementContainer = jQuery( '.stripe-payment-element-container' );\n\tconst $cardContainer = jQuery( '.ginput_stripe_creditcard' );\n\tconst elementContainerStyle = enabled ? 'block' : 'none';\n\tconst cardContainerStyle = enabled ? 'none' : 'block';\n\tconst $linkEmailField = jQuery( '#link_email_field_container' );\n\n\tif ( ! enabled ) {\n\t\t$linkEmailField.hide();\n\t} else {\n\t\t$linkEmailField.show();\n\t}\n\n\tif ( $elementContainer.length ) {\n\t\t$elementContainer.get(0).style.display = elementContainerStyle;\n\t}\n\tif ( $cardContainer.length ) {\n\t\t$cardContainer.get(0).style.display = cardContainerStyle;\n\t}\n}\n\n/**\n * Shows or hides the sub labels and input placeholders setting as it is not needed for the payment element when its setting is on.\n *\n * Can not call this inside showHideElement because it messes up the other field while the editor is still loading, and showHideElement is called on load.\n *\n * since 4.3\n */\nconst showHideFieldSettings = () => {\n\tjQuery( '.field_setting' ).hide();\n\tlet allSettings = getAllFieldSettings( GetSelectedField() );\n\tjQuery( allSettings ).show();\n}\n\n/**\n * Hooks to the field settings filter to remove the sub label classes and input placeholder classes if needed.\n *\n * @since 4.3\n *\n * @param {Array} settingsArray The field settings classes.\n * @param {Object} field The field object.\n *\n * @return {Array}\n */\nconst filterSubLabelsSettingClasses = ( settingsArray, field ) => {\n\tif ( field.type !== 'stripe_creditcard' ) {\n\t\treturn settingsArray;\n\t}\n\tconst paymentElementEnabled = jQuery( '#field_enable_multiple_payment_methods' ).is(':checked');\n\tif ( paymentElementEnabled ) {\n\t\tsettingsArray.splice( settingsArray.indexOf( '.sub_label_placement_setting' ), 1 );\n\t\tsettingsArray.splice( settingsArray.indexOf( '.sub_labels_setting' ), 1 );\n\t\tsettingsArray.splice( settingsArray.indexOf( '.input_placeholders_setting' ), 1 );\n\t} else {\n\t\tsettingsArray.push( '.sub_labels_setting', '.sub_label_placement_setting', '.input_placeholders_setting' );\n\t}\n\n\treturn settingsArray;\n}\n\n/**\n * Hooks to the form validation filter and validates that the field is in the last page of a multi-page form.\n *\n * @since 4.3\n *\n * @param {String} error The error message provided by the filter that will be returned.\n * @param {Object} form The form object.\n * @param {Boolean} has_product Whether the form has a product or not.\n * @param {Boolean} has_option Whether the form has an option field or not.\n *\n * @return {String}\n */\nconst validateFieldPosition = ( error, form, has_product, has_option ) => {\n\t\tconst lastPageFieldIndex = form.fields.findLastIndex( ( field ) => field.type === 'page' );\n\t\tconst stripeFieldIndex = form.fields.findIndex( ( field ) => field.type === 'stripe_creditcard' && field.enableMultiplePaymentMethods === true );\n\t\tif ( lastPageFieldIndex === -1 || stripeFieldIndex === -1 ) {\n\t\t\treturn error;\n\t\t}\n\n\t\tif ( stripeFieldIndex < lastPageFieldIndex ) {\n\t\t\terror = gform_stripe_payment_element_form_editor_strings.field_position_validation_error;\n\t\t}\n\n\t\treturn error;\n}\n\nconst afterRefreshField = ( fieldId ) => {\n\tconst stripeFieldIndex = form.fields.findIndex( ( field ) => field.type === 'stripe_creditcard' && field.enableMultiplePaymentMethods === true );\n\tif( stripeFieldIndex < 0 || form.fields[stripeFieldIndex].id != fieldId ) {\n\t\treturn;\n\t}\n\n\tshowHideElement();\n\tmountCard();\n}\n\n/**\n * Binds the functionalities needed to their corresponding events.\n *\n * @since 4.3\n */\nconst bindEvents = () => {\n\n\tgform.addAction( 'gform_after_refresh_field_preview', afterRefreshField );\n\n\tgform.addFilter( 'gform_editor_field_settings', filterSubLabelsSettingClasses );\n\tgform.addFilter( 'gform_validation_error_form_editor', validateFieldPosition );\n\n\tjQuery( document ).bind( 'gform_load_field_settings', function( event, field, form ) {\n\n\t\tif ( field.type !== 'stripe_creditcard' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst is_payment_element_supported = gform_stripe_payment_element_form_editor_strings.payment_element_supported === \"1\";\n\n\t\tif ( gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled !== \"1\" || ! is_payment_element_supported ) {\n\t\t\t// Adding disabled class to container.\n\t\t\tjQuery( '.enable_multiple_payment_methods_setting' ).addClass( 'gform-stripe--disabled' );\n\n\t\t\t// Disabling the checkbox.\n\t\t\tjQuery( '#field_enable_multiple_payment_methods' ).prop( 'disabled', true ).prop( 'checked', false );\n\t\t\tjQuery( '#link_email_field' ).prop( 'disabled', true );\n\t\t}\n\n\t\tif ( ! is_payment_element_supported ) {\n\t\t\t// Show the error message.\n\t\t\tsetFieldError( 'enable_multiple_payment_methods_setting', 'below', gform_stripe_payment_element_form_editor_strings.payment_element_disabled_message );\n\t\t}\n\n\t\tconst linkEmailSelect = gform.utils.getNode( '#link_email_field', document, true );\n\t\tconst linkEmailSelectedId = linkEmailSelect.value;\n\t\tconst optionNodes = gform.utils.getNodes( 'gform-stripe-link-email-ids' );\n\t\toptionNodes.forEach( ( option ) => { option.remove() } );\n\t\tform.fields.forEach( ( field, index ) => {\n\t\t\tif ( field.type === 'email' ) {\n\t\t\t\tconst option = document.createElement('option');\n\t\t\t\toption.value = field.id;\n\t\t\t\toption.setAttribute( 'data-js', 'gform-stripe-link-email-ids' );\n\t\t\t\toption.textContent = `${field.label} - ${gform_stripe_payment_element_form_editor_strings.email_field_id_text}: ${field.id}`;\n\t\t\t\tlinkEmailSelect.appendChild( option );\n\t\t\t}\n\t\t});\n\n\t\tlinkEmailSelect.value = linkEmailSelectedId;\n\n\t\tjQuery('#field_enable_multiple_payment_methods').prop( 'checked', field.enableMultiplePaymentMethods ? true : false );\n\t\tjQuery('#link_email_field').val( `linkEmailFieldId` in field ? field.linkEmailFieldId : 0 );\n\t\tshowHideFieldSettings();\n\t});\n\n\tjQuery( '#field_enable_multiple_payment_methods' ).on( 'change', function ( e ) {\n\t\tshowHideElement( jQuery( this ).is( ':checked' ) );\n\t\tshowHideFieldSettings();\n\t});\n\n\tjQuery( '#link_email_field' ).on( 'change', function ( e ) {\n\t\tconst field = GetSelectedField();\n\t\tfield.linkEmailFieldId = jQuery( this ).val();\n\t});\n\n}\n\n/**\n * Handles the form editor UI logic for the payment element.\n *\n * @since 4.3\n */\nconst paymentElementFormEditorHandler = () => {\n\n\tbindEvents();\n\tshowHideElement();\n\tmountCard();\n}\n\n/**\n * Launches UI handler on page ready.\n */\njQuery( document ).ready( function () {\n\tpaymentElementFormEditorHandler();\n})\n\n/**\n * Reset the UI after adding a new field.\n */\njQuery( document ).on( 'gform_field_added', function( event, form, field ) {\n\tif ( field.type === 'stripe_creditcard' ) {\n\t\tshowHideElement();\n\t\tmountCard();\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":""} \ No newline at end of file diff --git a/js/payment_element_form_editor.min.js b/js/payment_element_form_editor.min.js index e0a2617..443cf7b 100644 --- a/js/payment_element_form_editor.min.js +++ b/js/payment_element_form_editor.min.js @@ -1 +1 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return h})),r.d(t,"Request",(function(){return v})),r.d(t,"Response",(function(){return T})),r.d(t,"DOMException",(function(){return E})),r.d(t,"fetch",(function(){return x}));var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,i="URLSearchParams"in n,o="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in n,d="ArrayBuffer"in n;if(d)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function p(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function y(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function _(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=_(t);return t.readAsArrayBuffer(e),r}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():d&&s&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=b(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=y(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=y(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var e,t,r,n=y(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=_(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function j(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function T(e,t){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},T.error=function(){var e=new T(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];T.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new T(null,{status:t,headers:{location:e}})};var E=n.DOMException;try{new E}catch(e){(E=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),E.prototype.constructor=E}function x(e,t){return new Promise((function(r,i){var o=new v(e,t);if(o.signal&&o.signal.aborted)return i(new E("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;setTimeout((function(){r(new T(i,n))}),0)},a.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.onabort=function(){setTimeout((function(){i(new E("Aborted","AbortError"))}),0)},a.open(o.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(o.url),!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&(s?a.responseType="blob":d&&o.headers.get("Content-Type")&&-1!==o.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof h?o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){a.setRequestHeader(e,p(t.headers[e]))})),o.signal&&(o.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",l)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=h,n.Request=v,n.Response=T)},,,function(e,t,r){r(0),e.exports=r(4)},function(e,t){const r=()=>{if(jQuery(".stripe-payment-element-container").length<=0||"1"!==gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled)return;const e=Stripe(gform_stripe_payment_element_form_editor_strings.api_key);if(e){e.elements({amount:100,currency:gform_stripe_payment_element_form_editor_strings.payment_element_currency,mode:"payment",payment_method_types:["card"]}).create("payment",{readOnly:!0}).mount(".stripe-payment-element-container"),jQuery(".stripe-payment-element-container").prepend('
')}else jQuery(".stripe-payment-element-container").text(gform_stripe_payment_element_form_editor_strings.payment_element_error)},n=(e=null)=>{null===e&&"1"===gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled&&(e=!1,form.fields.forEach(t=>{"stripe_creditcard"===t.type&&(e=t.enableMultiplePaymentMethods)}));const t=jQuery(".stripe-payment-element-container"),r=jQuery(".ginput_stripe_creditcard"),n=e?"block":"none",i=e?"none":"block",o=jQuery("#link_email_field_container");e?o.show():o.hide(),t.length&&(t.get(0).style.display=n),r.length&&(r.get(0).style.display=i)},i=()=>{jQuery(".field_setting").hide();let e=getAllFieldSettings(GetSelectedField());jQuery(e).show()},o=(e,t)=>{if("stripe_creditcard"!==t.type)return e;return jQuery("#field_enable_multiple_payment_methods").is(":checked")?(e.splice(e.indexOf(".sub_label_placement_setting"),1),e.splice(e.indexOf(".sub_labels_setting"),1),e.splice(e.indexOf(".input_placeholders_setting"),1)):e.push(".sub_labels_setting",".sub_label_placement_setting",".input_placeholders_setting"),e},s=(e,t,r,n)=>{const i=t.fields.findLastIndex(e=>"page"===e.type),o=t.fields.findIndex(e=>"stripe_creditcard"===e.type&&!0===e.enableMultiplePaymentMethods);return-1===i||-1===o||o{const t=form.fields.findIndex(e=>"stripe_creditcard"===e.type&&!0===e.enableMultiplePaymentMethods);t<0||form.fields[t].id!=e||(n(),r())},d=()=>{gform.addAction("gform_after_refresh_field_preview",a),gform.addFilter("gform_editor_field_settings",o),gform.addFilter("gform_validation_error_form_editor",s),jQuery(document).bind("gform_load_field_settings",(function(e,t,r){if("stripe_creditcard"!==t.type)return;const n="1"===gform_stripe_payment_element_form_editor_strings.payment_element_supported;"1"===gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled&&n||(jQuery(".enable_multiple_payment_methods_setting").addClass("gform-stripe--disabled"),jQuery("#field_enable_multiple_payment_methods").prop("disabled",!0).prop("checked",!1),jQuery("#link_email_field").prop("disabled",!0)),n||setFieldError("enable_multiple_payment_methods_setting","below",gform_stripe_payment_element_form_editor_strings.payment_element_disabled_message);const o=jQuery("#link_email_field"),s=o.val();o.empty(),r.fields.forEach((e,t)=>{"email"===e.type&&o.append(jQuery('"))}),o.val(s),jQuery("#field_enable_multiple_payment_methods").prop("checked",!!t.enableMultiplePaymentMethods),jQuery("#link_email_field").val("linkEmailFieldId"in t?t.linkEmailFieldId:0),i()})),jQuery("#field_enable_multiple_payment_methods").on("change",(function(e){n(jQuery(this).is(":checked")),i()})),jQuery("#link_email_field").on("change",(function(e){GetSelectedField().linkEmailFieldId=jQuery(this).val()}))};jQuery(document).ready((function(){d(),n(),r()})),jQuery(document).on("gform_field_added",(function(e,t,i){"stripe_creditcard"===i.type&&(n(),r())}))}]); \ No newline at end of file +!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return h})),r.d(t,"Request",(function(){return v})),r.d(t,"Response",(function(){return A})),r.d(t,"DOMException",(function(){return T})),r.d(t,"fetch",(function(){return x}));var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,i="URLSearchParams"in n,o="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in n,d="ArrayBuffer"in n;if(d)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function y(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function _(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=_(t);return t.readAsArrayBuffer(e),r}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():d&&s&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=b(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=y(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=y(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var e,t,r,n=y(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=_(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function j(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function A(e,t){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})};var T=n.DOMException;try{new T}catch(e){(T=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack}).prototype=Object.create(Error.prototype),T.prototype.constructor=T}function x(e,t){return new Promise((function(r,i){var o=new v(e,t);if(o.signal&&o.signal.aborted)return i(new T("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;setTimeout((function(){r(new A(i,n))}),0)},a.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.onabort=function(){setTimeout((function(){i(new T("Aborted","AbortError"))}),0)},a.open(o.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(o.url),!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&(s?a.responseType="blob":d&&o.headers.get("Content-Type")&&-1!==o.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof h?o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})):Object.getOwnPropertyNames(t.headers).forEach((function(e){a.setRequestHeader(e,c(t.headers[e]))})),o.signal&&(o.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",l)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=h,n.Request=v,n.Response=A)},,,function(e,t,r){r(0),e.exports=r(4)},function(e,t){const r=()=>{if(jQuery(".stripe-payment-element-container").length<=0||"1"!==gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled)return;const e=Stripe(gform_stripe_payment_element_form_editor_strings.api_key);if(e){e.elements({amount:100,currency:gform_stripe_payment_element_form_editor_strings.payment_element_currency,mode:"payment",payment_method_types:["card"]}).create("payment",{readOnly:!0}).mount(".stripe-payment-element-container"),jQuery(".stripe-payment-element-container").prepend('
')}else jQuery(".stripe-payment-element-container").text(gform_stripe_payment_element_form_editor_strings.payment_element_error)},n=(e=null)=>{null===e&&"1"===gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled&&(e=!1,form.fields.forEach(t=>{"stripe_creditcard"===t.type&&(e=t.enableMultiplePaymentMethods)}));const t=jQuery(".stripe-payment-element-container"),r=jQuery(".ginput_stripe_creditcard"),n=e?"block":"none",i=e?"none":"block",o=jQuery("#link_email_field_container");e?o.show():o.hide(),t.length&&(t.get(0).style.display=n),r.length&&(r.get(0).style.display=i)},i=()=>{jQuery(".field_setting").hide();let e=getAllFieldSettings(GetSelectedField());jQuery(e).show()},o=(e,t)=>{if("stripe_creditcard"!==t.type)return e;return jQuery("#field_enable_multiple_payment_methods").is(":checked")?(e.splice(e.indexOf(".sub_label_placement_setting"),1),e.splice(e.indexOf(".sub_labels_setting"),1),e.splice(e.indexOf(".input_placeholders_setting"),1)):e.push(".sub_labels_setting",".sub_label_placement_setting",".input_placeholders_setting"),e},s=(e,t,r,n)=>{const i=t.fields.findLastIndex(e=>"page"===e.type),o=t.fields.findIndex(e=>"stripe_creditcard"===e.type&&!0===e.enableMultiplePaymentMethods);return-1===i||-1===o||o{const t=form.fields.findIndex(e=>"stripe_creditcard"===e.type&&!0===e.enableMultiplePaymentMethods);t<0||form.fields[t].id!=e||(n(),r())},d=()=>{gform.addAction("gform_after_refresh_field_preview",a),gform.addFilter("gform_editor_field_settings",o),gform.addFilter("gform_validation_error_form_editor",s),jQuery(document).bind("gform_load_field_settings",(function(e,t,r){if("stripe_creditcard"!==t.type)return;const n="1"===gform_stripe_payment_element_form_editor_strings.payment_element_supported;"1"===gform_stripe_payment_element_form_editor_strings.stripe_connect_enabled&&n||(jQuery(".enable_multiple_payment_methods_setting").addClass("gform-stripe--disabled"),jQuery("#field_enable_multiple_payment_methods").prop("disabled",!0).prop("checked",!1),jQuery("#link_email_field").prop("disabled",!0)),n||setFieldError("enable_multiple_payment_methods_setting","below",gform_stripe_payment_element_form_editor_strings.payment_element_disabled_message);const o=gform.utils.getNode("#link_email_field",document,!0),s=o.value;gform.utils.getNodes("gform-stripe-link-email-ids").forEach(e=>{e.remove()}),r.fields.forEach((e,t)=>{if("email"===e.type){const t=document.createElement("option");t.value=e.id,t.setAttribute("data-js","gform-stripe-link-email-ids"),t.textContent=`${e.label} - ${gform_stripe_payment_element_form_editor_strings.email_field_id_text}: ${e.id}`,o.appendChild(t)}}),o.value=s,jQuery("#field_enable_multiple_payment_methods").prop("checked",!!t.enableMultiplePaymentMethods),jQuery("#link_email_field").val("linkEmailFieldId"in t?t.linkEmailFieldId:0),i()})),jQuery("#field_enable_multiple_payment_methods").on("change",(function(e){n(jQuery(this).is(":checked")),i()})),jQuery("#link_email_field").on("change",(function(e){GetSelectedField().linkEmailFieldId=jQuery(this).val()}))};jQuery(document).ready((function(){d(),n(),r()})),jQuery(document).on("gform_field_added",(function(e,t,i){"stripe_creditcard"===i.type&&(n(),r())}))}]); \ No newline at end of file diff --git a/languages/gravityformsstripe.pot b/languages/gravityformsstripe.pot index 83cde6a..ed49f9a 100644 --- a/languages/gravityformsstripe.pot +++ b/languages/gravityformsstripe.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPL-2.0+. msgid "" msgstr "" -"Project-Id-Version: Gravity Forms Stripe Add-On 5.5.0\n" +"Project-Id-Version: Gravity Forms Stripe Add-On 5.6.0\n" "Report-Msgid-Bugs-To: https://gravityforms.com/support\n" "Last-Translator: Gravity Forms \n" "Language-Team: Gravity Forms \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-02-22T21:51:45+00:00\n" +"POT-Creation-Date: 2024-04-29T14:17:29+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: gravityformsstripe\n" @@ -56,7 +56,7 @@ msgid "The payment gateway failed to process the request. Please use a different msgstr "" #: class-gf-stripe.php:371 -#: class-gf-stripe.php:8389 +#: class-gf-stripe.php:8449 msgid "We are not able to process your payment request at the moment. Please try again later." msgstr "" @@ -124,728 +124,741 @@ msgstr "" msgid "To enable additional payment methods, you must update Gravity Forms to the latest version." msgstr "" -#: class-gf-stripe.php:1155 +#: class-gf-stripe.php:437 +msgid "Field ID" +msgstr "" + +#: class-gf-stripe.php:1156 msgid "Payment Methods" msgstr "" -#: class-gf-stripe.php:1165 +#: class-gf-stripe.php:1166 msgid "Enable additional payment methods" msgstr "" #. translators: variables are the markup to generate a link. -#: class-gf-stripe.php:1170 +#: class-gf-stripe.php:1171 msgid "Available payment methods can be configured in your %1$sStripe Dashboard%2$s." msgstr "" -#: class-gf-stripe.php:1177 +#: class-gf-stripe.php:1178 msgid "Link Email Field" msgstr "" +#: class-gf-stripe.php:1182 +msgid "Select an Email Field" +msgstr "" + #. translators: variables are the markup to generate a link. -#: class-gf-stripe.php:1196 +#: class-gf-stripe.php:1188 msgid "Link is a payment method that enables your customers to save their payment information so they can use it again on any site that uses Stripe Link. %1$sLearn more about Link%2$s." msgstr "" #. translators: variables are the markup to generate a link. -#: class-gf-stripe.php:1204 +#: class-gf-stripe.php:1196 msgid "This option is disabled because Stripe is authenticated using API keys instead of Stripe Connect. To take advantage of additional payment methods, re-authenticate using Stripe Connect. %1$sLearn more about Stripe payment element%2$s." msgstr "" -#: class-gf-stripe.php:1270 -#: class-gf-stripe.php:7160 +#: class-gf-stripe.php:1262 +#: class-gf-stripe.php:7220 msgid "Access denied." msgstr "" -#: class-gf-stripe.php:1317 -#: class-gf-stripe.php:2499 +#: class-gf-stripe.php:1309 +#: class-gf-stripe.php:2514 msgid "Stripe Account" msgstr "" -#: class-gf-stripe.php:1324 +#: class-gf-stripe.php:1316 msgid "Payment Collection" msgstr "" -#: class-gf-stripe.php:1330 +#: class-gf-stripe.php:1322 msgid "Payment Collection Method" msgstr "" -#: class-gf-stripe.php:1335 +#: class-gf-stripe.php:1327 msgid "Stripe Field (Elements, SCA-ready)" msgstr "" -#: class-gf-stripe.php:1337 +#: class-gf-stripe.php:1329 msgid "Stripe Field" msgstr "" -#: class-gf-stripe.php:1338 +#: class-gf-stripe.php:1330 msgid "Select this option to use a Stripe field hosted by Stripe. The Stripe field can be embedded in a form and supports credit card payments as well as other payment methods such as Google Pay, Apple Pay and bank transfers." msgstr "" #. translators: 1. Open link tag 2. Close link tag -#: class-gf-stripe.php:1341 +#: class-gf-stripe.php:1333 msgid "Stripe Field is ready for %1$sStrong Customer Authentication%2$s for European customers." msgstr "" -#: class-gf-stripe.php:1345 +#: class-gf-stripe.php:1337 msgid "Stripe Payment Form (Stripe Checkout, SCA-ready)" msgstr "" -#: class-gf-stripe.php:1347 +#: class-gf-stripe.php:1339 msgid "Stripe Payment Form" msgstr "" -#: class-gf-stripe.php:1348 +#: class-gf-stripe.php:1340 msgid "Select this option to collect all payment information in a separate page hosted by Stripe. This option is the simplest to implement since it doesn't require a Stripe field in your form. Stripe Checkout supports credit card payments as well as other payment methods such as Google Pay, Apple Pay and bank transfers." msgstr "" #. translators: 1. Open link tag 2. Close link tag -#: class-gf-stripe.php:1351 +#: class-gf-stripe.php:1343 msgid "Stripe Checkout is ready for %1$sStrong Customer Authentication%2$s for European customers." msgstr "" -#: class-gf-stripe.php:1390 -#: class-gf-stripe.php:1393 -#: class-gf-stripe.php:1753 +#: class-gf-stripe.php:1382 +#: class-gf-stripe.php:1385 +#: class-gf-stripe.php:1745 msgid "Connected to Stripe as" msgstr "" -#: class-gf-stripe.php:1393 +#: class-gf-stripe.php:1385 msgid "The Stripe account this feed is currently connected to." msgstr "" -#: class-gf-stripe.php:1397 +#: class-gf-stripe.php:1389 msgid "Mode" msgstr "" -#: class-gf-stripe.php:1402 +#: class-gf-stripe.php:1394 msgid "Live" msgstr "" -#: class-gf-stripe.php:1406 +#: class-gf-stripe.php:1398 msgid "Test" msgstr "" -#: class-gf-stripe.php:1453 -#: class-gf-stripe.php:1488 +#: class-gf-stripe.php:1445 +#: class-gf-stripe.php:1480 msgid "Test Publishable Key" msgstr "" -#: class-gf-stripe.php:1460 -#: class-gf-stripe.php:1493 +#: class-gf-stripe.php:1452 +#: class-gf-stripe.php:1485 msgid "Test Secret Key" msgstr "" -#: class-gf-stripe.php:1468 -#: class-gf-stripe.php:1498 +#: class-gf-stripe.php:1460 +#: class-gf-stripe.php:1490 msgid "Live Publishable Key" msgstr "" -#: class-gf-stripe.php:1475 -#: class-gf-stripe.php:1503 +#: class-gf-stripe.php:1467 +#: class-gf-stripe.php:1495 msgid "Live Secret Key" msgstr "" -#: class-gf-stripe.php:1515 +#: class-gf-stripe.php:1507 msgid "Webhooks Enabled?" msgstr "" -#: class-gf-stripe.php:1523 +#: class-gf-stripe.php:1515 msgid "I have enabled the Gravity Forms webhook URL in my Stripe account." msgstr "" -#: class-gf-stripe.php:1531 +#: class-gf-stripe.php:1523 msgid "Test Signing Secret" msgstr "" -#: class-gf-stripe.php:1540 +#: class-gf-stripe.php:1532 msgid "Live Signing Secret" msgstr "" -#: class-gf-stripe.php:1607 +#: class-gf-stripe.php:1599 msgid "SSL Certificate Required" msgstr "" #. Translators: 1: Open link tag 2: Close link tag -#: class-gf-stripe.php:1609 +#: class-gf-stripe.php:1601 msgid "Make sure you have an SSL certificate installed and enabled, then %1$sclick here to reload the settings page%2$s." msgstr "" -#: class-gf-stripe.php:1635 +#: class-gf-stripe.php:1627 msgid "View Instructions" msgstr "" -#: class-gf-stripe.php:1640 +#: class-gf-stripe.php:1632 msgid "Click the following link and log in to access your Stripe Webhooks management page:" msgstr "" -#: class-gf-stripe.php:1644 +#: class-gf-stripe.php:1636 msgid "Click the \"Add Endpoint\" button above the list of Webhook URLs." msgstr "" -#: class-gf-stripe.php:1646 +#: class-gf-stripe.php:1638 msgid "Enter the following URL in the \"URL to be called\" field:" msgstr "" -#: class-gf-stripe.php:1649 +#: class-gf-stripe.php:1641 msgid "If offered the choice, select the latest API version." msgstr "" -#: class-gf-stripe.php:1650 +#: class-gf-stripe.php:1642 msgid "Click the \"receive all events\" link." msgstr "" -#: class-gf-stripe.php:1651 +#: class-gf-stripe.php:1643 msgid "Click the \"Add Endpoint\" button to save the webhook." msgstr "" -#: class-gf-stripe.php:1652 +#: class-gf-stripe.php:1644 msgid "Copy the signing secret of the newly created webhook on Stripe and paste to the setting field." msgstr "" -#: class-gf-stripe.php:1670 +#: class-gf-stripe.php:1662 msgid "Select how payment information will be collected. You can select one of the Stripe hosted solutions (Stripe Credit Card or Stripe Checkout) which simplifies the PCI compliance process with Stripe." msgstr "" #. translators: Placeholders represent opening and closing link tags. -#: class-gf-stripe.php:1675 +#: class-gf-stripe.php:1667 msgid "The Gravity Forms Credit Card Field was deprecated in the Stripe Add-On in version 3.4. Forms that are currently using this field will stop working in a future version. Refer to %1$sthis guide%2$s for more information about this change." msgstr "" -#: class-gf-stripe.php:1724 +#: class-gf-stripe.php:1716 msgid "Click here to authenticate with Stripe" msgstr "" -#: class-gf-stripe.php:1734 +#: class-gf-stripe.php:1726 msgid "You are currently logged in to Stripe using a deprecated authentication method." msgstr "" #. Translators: 1: Open strong tag 2: Close strong tag -#: class-gf-stripe.php:1736 +#: class-gf-stripe.php:1728 msgid "%1$sPlease login to your Stripe account via Stripe Connect using the button below.%2$s It is a more secure authentication method and will be required for upcoming features of the Stripe Add-on." msgstr "" #. translators: Placeholders represent wrapping link tag. -#: class-gf-stripe.php:1741 +#: class-gf-stripe.php:1733 msgid "%1$sLearn more%2$s about connecting with Stripe." msgstr "" -#: class-gf-stripe.php:1757 -#: class-gf-stripe.php:1775 +#: class-gf-stripe.php:1749 +#: class-gf-stripe.php:1767 msgid "Disconnect your Stripe account" msgstr "" #. translators: placeholder represents contextual target, either "feed" or "site". -#: class-gf-stripe.php:1770 +#: class-gf-stripe.php:1762 msgid "Disconnect this %s only" msgstr "" -#: class-gf-stripe.php:1772 +#: class-gf-stripe.php:1764 msgid "Disconnect all Gravity Forms sites connected to this Stripe account" msgstr "" -#: class-gf-stripe.php:1880 +#: class-gf-stripe.php:1872 msgid "%1$s%2$s%3$s" msgstr "" -#: class-gf-stripe.php:1895 +#: class-gf-stripe.php:1887 msgid "Switch Accounts" msgstr "" #. Translators: 1. Open link tag. 2. Close link tag. -#: class-gf-stripe.php:1911 +#: class-gf-stripe.php:1903 msgid "Logo can be configured on %1$sStripe's branding page%2$s." msgstr "" -#: class-gf-stripe.php:1972 +#: class-gf-stripe.php:1964 msgid "Unable to connect to Stripe due to mismatched state." msgstr "" -#: class-gf-stripe.php:2019 +#: class-gf-stripe.php:2011 msgid "Unable to authenticate with Stripe." msgstr "" -#: class-gf-stripe.php:2053 +#: class-gf-stripe.php:2045 msgid "Capture Payment" msgstr "" -#: class-gf-stripe.php:2054 +#: class-gf-stripe.php:2046 msgid "Capturing payment" msgstr "" #. Translators: 1: Open link tag 2: Close link tag -#: class-gf-stripe.php:2137 +#: class-gf-stripe.php:2152 msgid "You are currently logged in to Stripe using a deprecated authentication method. %1$sRe-authenticate your Stripe account%2$s." msgstr "" #. translators: 1: Open strong tag, 2: Close strong tag, 3: Form title, 4: Open link tag, 5: Close link tag. -#: class-gf-stripe.php:2209 +#: class-gf-stripe.php:2224 msgid "%1$sImportant%2$s: The form %3$s is using a deprecated payment collection method for Stripe that will stop working in a future version. Take action now to continue collecting payments. %4$sLearn more.%5$s" msgstr "" -#: class-gf-stripe.php:2318 +#: class-gf-stripe.php:2333 msgid "You must add a Stripe Card field to your form before creating a feed. Let's go %sadd one%s!" msgstr "" -#: class-gf-stripe.php:2343 +#: class-gf-stripe.php:2358 msgid "Customer Information" msgstr "" -#: class-gf-stripe.php:2352 -#: class-gf-stripe.php:2355 +#: class-gf-stripe.php:2367 +#: class-gf-stripe.php:2370 msgid "Email" msgstr "" -#: class-gf-stripe.php:2355 -#: class-gf-stripe.php:2534 +#: class-gf-stripe.php:2370 +#: class-gf-stripe.php:2549 msgid "You can specify an email field and it will be sent to Stripe as the customer's email." msgstr "" -#: class-gf-stripe.php:2359 +#: class-gf-stripe.php:2374 msgid "Description" msgstr "" -#: class-gf-stripe.php:2364 -#: class-gf-stripe.php:2367 +#: class-gf-stripe.php:2379 +#: class-gf-stripe.php:2382 msgid "Coupon" msgstr "" -#: class-gf-stripe.php:2367 +#: class-gf-stripe.php:2382 msgid "Select which field contains the coupon code to be applied to the recurring charge(s). The coupon must also exist in your Stripe Dashboard." msgstr "" -#: class-gf-stripe.php:2367 +#: class-gf-stripe.php:2382 msgid "If you use Stripe Checkout, the coupon won't be applied to your first invoice." msgstr "" -#: class-gf-stripe.php:2381 +#: class-gf-stripe.php:2396 msgid "You will see this data when viewing a customer page." msgstr "" -#: class-gf-stripe.php:2383 +#: class-gf-stripe.php:2398 msgid "You will see this data when viewing a payment page." msgstr "" -#: class-gf-stripe.php:2390 -#: class-gf-stripe.php:2394 +#: class-gf-stripe.php:2405 +#: class-gf-stripe.php:2409 msgid "Metadata" msgstr "" -#: class-gf-stripe.php:2394 +#: class-gf-stripe.php:2409 msgid "You may send custom meta information to Stripe. A maximum of 50 custom keys may be sent. The key name must be 40 characters or less, and the mapped data will be truncated to 500 characters per requirements by Stripe. " msgstr "" -#: class-gf-stripe.php:2408 +#: class-gf-stripe.php:2423 msgid "Trial" msgstr "" -#: class-gf-stripe.php:2411 +#: class-gf-stripe.php:2426 msgid "Enable a trial period. The user's recurring payment will not begin until after this trial period." msgstr "" -#: class-gf-stripe.php:2418 +#: class-gf-stripe.php:2433 msgid "Trial Period" msgstr "" -#: class-gf-stripe.php:2424 -#: class-gf-stripe.php:2427 +#: class-gf-stripe.php:2439 +#: class-gf-stripe.php:2442 msgid "days" msgstr "" -#: class-gf-stripe.php:2435 -#: class-gf-stripe.php:2438 +#: class-gf-stripe.php:2450 +#: class-gf-stripe.php:2453 msgid "Subscription Name" msgstr "" -#: class-gf-stripe.php:2438 +#: class-gf-stripe.php:2453 msgid "Enter a name for the subscription. It will be displayed on the payment form as well as the Stripe dashboard." msgstr "" -#: class-gf-stripe.php:2448 +#: class-gf-stripe.php:2463 msgid "Stripe Credit Card Field Settings" msgstr "" -#: class-gf-stripe.php:2456 -#: class-gf-stripe.php:2457 +#: class-gf-stripe.php:2471 +#: class-gf-stripe.php:2472 msgid "Billing Information" msgstr "" -#: class-gf-stripe.php:2457 +#: class-gf-stripe.php:2472 msgid "Map your Form Fields to the available listed fields. The address information will be sent to Stripe." msgstr "" -#: class-gf-stripe.php:2469 +#: class-gf-stripe.php:2484 msgid "Stripe Payment Form Settings" msgstr "" -#: class-gf-stripe.php:2470 +#: class-gf-stripe.php:2485 msgid "The following settings control information displayed on the Stripe hosted payment page that is displayed after the form is submitted." msgstr "" -#: class-gf-stripe.php:2487 -#: class-gf-stripe.php:2489 +#: class-gf-stripe.php:2502 +#: class-gf-stripe.php:2504 msgid "Stripe Receipt" msgstr "" -#: class-gf-stripe.php:2489 +#: class-gf-stripe.php:2504 msgid "Stripe can send a receipt via email upon payment. Select an email field to enable this feature." msgstr "" -#: class-gf-stripe.php:2523 +#: class-gf-stripe.php:2538 msgid "Logo" msgstr "" -#: class-gf-stripe.php:2528 -#: class-gf-stripe.php:2534 +#: class-gf-stripe.php:2543 +#: class-gf-stripe.php:2549 msgid "Customer Email" msgstr "" -#: class-gf-stripe.php:2538 -#: class-gf-stripe.php:2540 +#: class-gf-stripe.php:2553 +#: class-gf-stripe.php:2555 msgid "Billing Address" msgstr "" -#: class-gf-stripe.php:2540 +#: class-gf-stripe.php:2555 msgid "When enabled, Stripe Checkout will collect the customer's billing address for you." msgstr "" -#: class-gf-stripe.php:2544 -#: class-gf-stripe.php:2737 -#: class-gf-stripe.php:2803 +#: class-gf-stripe.php:2559 +#: class-gf-stripe.php:2752 +#: class-gf-stripe.php:2818 msgid "Enabled" msgstr "" -#: class-gf-stripe.php:2548 +#: class-gf-stripe.php:2563 msgid "Disabled" msgstr "" -#: class-gf-stripe.php:2670 +#: class-gf-stripe.php:2685 msgid "Do not send receipt" msgstr "" -#: class-gf-stripe.php:2676 +#: class-gf-stripe.php:2691 msgid "Do not set customer email" msgstr "" -#: class-gf-stripe.php:2893 +#: class-gf-stripe.php:2908 msgid "Please enter a valid number of days." msgstr "" -#: class-gf-stripe.php:2947 +#: class-gf-stripe.php:2962 msgid "A field has been mapped to a custom key without a name. Please enter a name for the custom key, remove the metadata item, or return the corresponding drop down to 'Select a Field'." msgstr "" -#: class-gf-stripe.php:2950 +#: class-gf-stripe.php:2965 msgid "The name of custom key %s is too long. Please shorten this to 40 characters or less." msgstr "" -#: class-gf-stripe.php:2968 +#: class-gf-stripe.php:2983 msgid "Please use the correct webhook signing secret, which should start with \"whsec_\"." msgstr "" -#: class-gf-stripe.php:2985 +#: class-gf-stripe.php:3000 msgid "day(s)" msgstr "" -#: class-gf-stripe.php:2986 +#: class-gf-stripe.php:3001 msgid "week(s)" msgstr "" -#: class-gf-stripe.php:2987 +#: class-gf-stripe.php:3002 msgid "month(s)" msgstr "" -#: class-gf-stripe.php:2988 +#: class-gf-stripe.php:3003 msgid "year(s)" msgstr "" -#: class-gf-stripe.php:3033 +#: class-gf-stripe.php:3048 msgid "Payment Pending" msgstr "" -#: class-gf-stripe.php:3034 +#: class-gf-stripe.php:3049 msgid "Payment Authorized" msgstr "" -#: class-gf-stripe.php:3035 +#: class-gf-stripe.php:3050 msgid "Payment Completed" msgstr "" -#: class-gf-stripe.php:3036 +#: class-gf-stripe.php:3051 msgid "Payment Refunded" msgstr "" -#: class-gf-stripe.php:3037 +#: class-gf-stripe.php:3052 msgid "Payment Failed" msgstr "" -#: class-gf-stripe.php:3038 +#: class-gf-stripe.php:3053 msgid "Subscription Created" msgstr "" -#: class-gf-stripe.php:3039 +#: class-gf-stripe.php:3054 msgid "Subscription Canceled" msgstr "" -#: class-gf-stripe.php:3040 +#: class-gf-stripe.php:3055 msgid "Subscription Payment Added" msgstr "" -#: class-gf-stripe.php:3041 +#: class-gf-stripe.php:3056 msgid "Subscription Payment Failed" msgstr "" -#: class-gf-stripe.php:3456 -#: class-gf-stripe.php:3615 -#: class-gf-stripe.php:3656 +#: class-gf-stripe.php:3471 +#: class-gf-stripe.php:3630 +#: class-gf-stripe.php:3671 msgid "Unknown" msgstr "" -#: class-gf-stripe.php:3465 +#: class-gf-stripe.php:3480 msgid "Card type (%s) is not supported. Please enter one of the supported credit cards." msgstr "" #. Translators: 1. Type of credit card. -#: class-gf-stripe.php:3660 +#: class-gf-stripe.php:3675 msgid "Card type (%1$s) is not supported. Please enter one of the supported credit cards." msgstr "" -#: class-gf-stripe.php:3678 +#: class-gf-stripe.php:3693 msgid "There was a problem with your submission." msgstr "" -#: class-gf-stripe.php:3709 +#: class-gf-stripe.php:3724 msgid "This form is not configured to collect payment." msgstr "" -#: class-gf-stripe.php:3730 +#: class-gf-stripe.php:3745 msgid "There was a problem with your submission. Please try again later." msgstr "" -#: class-gf-stripe.php:3734 +#: class-gf-stripe.php:3749 msgid "There was a problem with your submission:" msgstr "" -#: class-gf-stripe.php:3857 -#: class-gf-stripe.php:3899 -#: class-gf-stripe.php:4980 -#: class-gf-stripe.php:5824 +#: class-gf-stripe.php:3856 +#: class-gf-stripe.php:3879 +#: class-gf-stripe.php:3921 +#: class-gf-stripe.php:5010 +#: class-gf-stripe.php:5872 msgid "Your payment attempt has failed. Please enter your card details and try again." msgstr "" -#: class-gf-stripe.php:3894 -#: class-gf-stripe.php:5835 +#: class-gf-stripe.php:3916 +#: class-gf-stripe.php:5883 msgid "This payment might require 3D Secure authentication, please wait while we communicate with Stripe." msgstr "" -#: class-gf-stripe.php:3901 +#: class-gf-stripe.php:3923 msgid "The payment has been canceled" msgstr "" -#: class-gf-stripe.php:4056 +#: class-gf-stripe.php:4078 msgid "Payment with Discounts" msgstr "" -#: class-gf-stripe.php:4128 +#: class-gf-stripe.php:4150 msgid "Setup Fee" msgstr "" -#: class-gf-stripe.php:4215 +#: class-gf-stripe.php:4237 msgid "Unable to create Stripe Checkout session." msgstr "" -#: class-gf-stripe.php:4591 +#: class-gf-stripe.php:4611 +msgid "Cannot get payment intent." +msgstr "" + +#: class-gf-stripe.php:4621 msgid "Cannot get payment intent data." msgstr "" -#: class-gf-stripe.php:4609 +#: class-gf-stripe.php:4639 msgid "Cannot update payment intent data." msgstr "" -#: class-gf-stripe.php:4644 +#: class-gf-stripe.php:4674 msgid "Cannot capture payment intent data." msgstr "" -#: class-gf-stripe.php:4650 +#: class-gf-stripe.php:4680 msgid "Cannot capture the payment; the payment intent status is " msgstr "" -#: class-gf-stripe.php:4667 -#: class-gf-stripe.php:4702 +#: class-gf-stripe.php:4697 +#: class-gf-stripe.php:4732 msgid "Unable to capture the charge." msgstr "" -#: class-gf-stripe.php:4686 +#: class-gf-stripe.php:4716 msgid "Unable to save the charge." msgstr "" -#: class-gf-stripe.php:4756 +#: class-gf-stripe.php:4786 msgid "Failed to get the customer ID from Stripe." msgstr "" -#: class-gf-stripe.php:5284 -#: class-gf-stripe.php:6343 +#: class-gf-stripe.php:5313 +#: class-gf-stripe.php:6408 msgid "Subscription payment has been paid. Amount: %s. Subscription Id: %s" msgstr "" -#: class-gf-stripe.php:5994 +#: class-gf-stripe.php:6042 msgid "Unable to authorize card. No response from Stripe.js." msgstr "" -#: class-gf-stripe.php:6305 -#: class-gf-stripe.php:6379 +#: class-gf-stripe.php:6370 +#: class-gf-stripe.php:6444 msgid "Subscription line item not found in request" msgstr "" -#: class-gf-stripe.php:6408 -#: class-gf-stripe.php:6436 +#: class-gf-stripe.php:6473 +#: class-gf-stripe.php:6501 msgid "Invalid Checkout Session" msgstr "" -#: class-gf-stripe.php:6605 +#: class-gf-stripe.php:6665 msgid "Entry %d was not processed by feed %d. Webhook cannot be processed." msgstr "" -#: class-gf-stripe.php:6622 +#: class-gf-stripe.php:6682 msgid "Entry for %s id: %s was not found. Webhook cannot be processed." msgstr "" -#: class-gf-stripe.php:6703 +#: class-gf-stripe.php:6763 msgid "Invalid request. Webhook could not be processed." msgstr "" -#: class-gf-stripe.php:6709 +#: class-gf-stripe.php:6769 msgid "Test webhook succeeded. Your Stripe Account and Stripe Add-On are configured correctly to process webhooks." msgstr "" -#: class-gf-stripe.php:7240 +#: class-gf-stripe.php:7300 msgid "Setup fee has been paid." msgstr "" -#: class-gf-stripe.php:7242 +#: class-gf-stripe.php:7302 msgid "Trial has been paid." msgstr "" -#: class-gf-stripe.php:7444 +#: class-gf-stripe.php:7504 msgid "You're being redirected to the hosted Checkout page on Stripe..." msgstr "" -#: class-gf-stripe.php:7507 +#: class-gf-stripe.php:7567 msgid "Entry ID: %d" msgstr "" -#: class-gf-stripe.php:7511 +#: class-gf-stripe.php:7571 msgid "Product: %s" msgid_plural "Products: %s" msgstr[0] "" msgstr[1] "" -#: class-gf-stripe.php:7677 +#: class-gf-stripe.php:7737 msgid "Address" msgstr "" -#: class-gf-stripe.php:7683 +#: class-gf-stripe.php:7743 msgid "Address 2" msgstr "" -#: class-gf-stripe.php:7689 +#: class-gf-stripe.php:7749 msgid "City" msgstr "" -#: class-gf-stripe.php:7695 +#: class-gf-stripe.php:7755 msgid "State" msgstr "" -#: class-gf-stripe.php:7701 +#: class-gf-stripe.php:7761 msgid "Zip" msgstr "" -#: class-gf-stripe.php:7707 +#: class-gf-stripe.php:7767 msgid "Country" msgstr "" -#: class-gf-stripe.php:7834 +#: class-gf-stripe.php:7894 msgid "%1$sYour Gravity Forms Stripe Add-On has been updated to 3.0, and now supports Apple Pay and Strong Customer Authentication (SCA/PSD2).%2$s%3$sNOTE:%4$s Stripe has changed Stripe Checkout from a modal display to a full page, and we have altered some existing Stripe hooks. Carefully review %5$sthis guide%6$s to see if your setup may be affected.%7$s" msgstr "" -#: class-gf-stripe.php:7847 +#: class-gf-stripe.php:7907 msgid "%1$sYour Gravity Forms Stripe Add-On has been updated to 3.0, and now supports Apple Pay and Strong Customer Authentication (SCA/PSD2).%2$s%3$sNOTE:%4$s Apple Pay and SCA are only supported by the Stripe Checkout payment collection method. Refer to %5$sthis guide%6$s for more information on payment methods and SCA.%7$s" msgstr "" -#: class-gf-stripe.php:7937 +#: class-gf-stripe.php:7997 msgid "%1$sYour Gravity Forms Stripe Add-On has been updated to 3.4, and now supports Strong Customer Authentication (SCA/PSD2).%2$s%3$sRefer to %4$sthis guide%5$s for more information on payment methods and SCA.%6$s" msgstr "" -#: class-gf-stripe.php:7948 +#: class-gf-stripe.php:8008 msgid "%1$sYour Gravity Forms Stripe Add-On has been updated to 3.4, and it no longer supports the Gravity Forms Credit Card Field in new forms (current integrations can still work as usual).%2$s%3$sRefer to %4$sthis guide%5$s for more information about this change.%6$s" msgstr "" #. translators: PaymentIntent status. -#: class-gf-stripe.php:8040 -#: class-gf-stripe.php:8085 +#: class-gf-stripe.php:8100 +#: class-gf-stripe.php:8145 msgid "PaymentIntent status: %s is invalid." msgstr "" -#: class-gf-stripe.php:8105 -#: class-gf-stripe.php:8190 +#: class-gf-stripe.php:8165 +#: class-gf-stripe.php:8250 msgid "Unable to find entry." msgstr "" -#: class-gf-stripe.php:8112 -#: class-gf-stripe.php:8197 +#: class-gf-stripe.php:8172 +#: class-gf-stripe.php:8257 msgid "Unable to find payment feed." msgstr "" -#: class-gf-stripe.php:8118 +#: class-gf-stripe.php:8178 msgid "Could not initialize Stripe API." msgstr "" -#: class-gf-stripe.php:8215 +#: class-gf-stripe.php:8275 msgid "Unable to find payment on Stripe" msgstr "" -#: class-gf-stripe.php:8423 +#: class-gf-stripe.php:8483 msgid "Unnamed account" msgstr "" -#: class-gf-stripe.php:8448 +#: class-gf-stripe.php:8508 msgid "Could not retrieve payment information from Stripe." msgstr "" -#: class-gf-stripe.php:8456 +#: class-gf-stripe.php:8516 msgid "Payment has already been captured." msgstr "" -#: class-gf-stripe.php:8467 +#: class-gf-stripe.php:8527 msgid "Unable to capture payment" msgstr "" -#: class-gf-stripe.php:8478 +#: class-gf-stripe.php:8538 msgid "Payment captured successfully." msgstr "" -#: class-gf-stripe.php:8525 +#: class-gf-stripe.php:8585 msgid "Feed associated with entry could not be found." msgstr "" -#: class-gf-stripe.php:8560 +#: class-gf-stripe.php:8620 msgid "Refund Payment" msgstr "" -#: class-gf-stripe.php:8561 +#: class-gf-stripe.php:8621 msgid "Sending refund request" msgstr "" -#: class-gf-stripe.php:8586 +#: class-gf-stripe.php:8646 #: includes/class-gf-field-stripe-creditcard.php:73 #: includes/class-gf-field-stripe-creditcard.php:264 msgid "Cardholder Name" msgstr "" -#: includes/api/model/class-customerbalancetransaction.php:25 +#: includes/api/model/class-customerbalancetransaction.php:42 msgid "Updating customer balance transactions are not supported via this object. Use GF_Stripe_API::adjust_customer_balance() instead." msgstr "" -#: includes/api/model/class-event.php:26 +#: includes/api/model/class-event.php:39 msgid "Events cannot be updated." msgstr "" @@ -857,7 +870,7 @@ msgstr "" msgid "Event Object cannot be updated." msgstr "" -#: includes/api/model/class-session.php:25 +#: includes/api/model/class-session.php:80 msgid "Checkout Sessions cannot be updated." msgstr "" @@ -948,12 +961,12 @@ msgstr "" msgid "starting from %s" msgstr "" -#: includes/payment-element/class-gf-payment-element.php:722 -#: includes/payment-element/class-gf-payment-element.php:724 +#: includes/payment-element/class-gf-payment-element.php:740 +#: includes/payment-element/class-gf-payment-element.php:742 msgid "Name" msgstr "" -#: includes/payment-element/class-gf-payment-element.php:724 +#: includes/payment-element/class-gf-payment-element.php:742 msgid "You can specify a name field and it will be sent to Stripe as the customer's name." msgstr "" diff --git a/stripe.php b/stripe.php index 5f3c589..a0c0491 100644 --- a/stripe.php +++ b/stripe.php @@ -3,7 +3,7 @@ * Plugin Name: Gravity Forms Stripe Add-On * Plugin URI: https://gravityforms.com * Description: Integrates Gravity Forms with Stripe, enabling end users to purchase goods and services through Gravity Forms. - * Version: 5.5.0 + * Version: 5.6.0 * Author: Gravity Forms * Author URI: https://gravityforms.com * License: GPL-2.0+ @@ -30,7 +30,7 @@ defined( 'ABSPATH' ) || die(); -define( 'GF_STRIPE_VERSION', '5.5.0' ); +define( 'GF_STRIPE_VERSION', '5.6.0' ); // If Gravity Forms is loaded, bootstrap the Stripe Add-On. add_action( 'gform_loaded', array( 'GF_Stripe_Bootstrap', 'load' ), 5 );