PageSourceSearch

https://www.heritagebuildersnj.com/wp-content/plugins/contact-form…/assets/js/app.js?ver=3.8.0-1.0.1

js heritagebuildersnj.com collected 2026-10-04 01:48:31 UTC 3,052 bytes, 109 lines download raw bytes

1( function( $ ) {
2    var PAYMENT_CHECKOUT_KEYS = [
3        'cf7apps_stripe_checkout_url',
4        'cf7apps_paypal_checkout_url',
5        'cf7apps_square_checkout_url',
6    ];
7
8    function getPaymentCheckoutUrl( detail ) {
9        if ( ! detail ) {
10            return '';
11        }
12
13        var sources = [ detail, detail.apiResponse ].filter( Boolean );
14
15        for ( var i = 0; i < sources.length; i++ ) {
16            for ( var j = 0; j < PAYMENT_CHECKOUT_KEYS.length; j++ ) {
17                if ( sources[ i ][ PAYMENT_CHECKOUT_KEYS[ j ] ] ) {
18                    return sources[ i ][ PAYMENT_CHECKOUT_KEYS[ j ] ];
19                }
20            }
21        }
22
23        return '';
24    }
25
26    function shouldSkipRedirection( detail ) {
27        if ( getPaymentCheckoutUrl( detail ) ) {
28            return true;
29        }
30
31        if ( window.cf7appsPaymentRedirectPending ) {
32            return true;
33        }
34
35        if (
36            cf7appsRedirection &&
37            cf7appsRedirection.paymentGatewayForms &&
38            detail &&
39            detail.contactFormId &&
40            cf7appsRedirection.paymentGatewayForms[ String( detail.contactFormId ) ]
41        ) {
42            return true;
43        }
44
45        return false;
46    }
47
48    function maybeRedirect( detail ) {
49        if ( ! detail || ! detail.contactFormId ) {
50            return;
51        }
52
53        if ( shouldSkipRedirection( detail ) ) {
54            return;
55        }
56
57        var formId = detail.contactFormId;
58
59        // Defer so payment gateway redirect handlers run first.
60        window.setTimeout( function() {
61            if ( window.cf7appsPaymentRedirectPending ) {
62                return;
63            }
64
65            $.post(
66                cf7appsRedirection.ajaxurl,
67                { action: 'cf7apps_fetch_settings', formId: formId },
68                function( response ) {
69                    if ( ! response.success ) {
70                        return;
71                    }
72
73                    if ( window.cf7appsPaymentRedirectPending ) {
74                        return;
75                    }
76
77                    var data = response.data || {};
78                    var redirectTo = data.redirectTo;
79                    var newTab = data.newTab;
80                    var isEnabled = data.isEnabled;
81
82                    if ( ! isEnabled || ! redirectTo ) {
83                        return;
84                    }
85
86                    if ( newTab ) {
87                        window.open( redirectTo, '_blank' );
88                    } else {
89                        window.location.href = redirectTo;
90                    }
91                }
92            );
93        }, 350 );
94    }
95
96    function onCf7Submit( e ) {
97        var detail = e.detail || {};
98        var status = detail.status || '';
99
100        if ( status && 'mail_sent' !== status && 'sent' !== status ) {
101            return;
102        }
103
104        maybeRedirect( detail );
105    }
106
107    document.addEventListener( 'wpcf7mailsent', onCf7Submit );
108    document.addEventListener( 'wpcf7submit', onCf7Submit );
109} )( jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.