PageSourceSearch

https://www.superbrightleds.com/static/version1790190235/frontend/…/Hyva_CheckoutStripe/js/load-stripe.min.js

js superbrightleds.com collected 2026-09-25 03:53:29 UTC 1,588 bytes, 56 lines download raw bytes

1// This prevents callbacks from being overwritten in the event of multiple executions.
2window.stripeCallbacks = window.stripeCallbacks || [];
3
4/**
5 * The Stripe JS library is used in multiple locations, so centralize the loading of it.
6 *
7 * @param callback
8 */
9window.loadStripe = function (callback) {
10    const scriptId = 'stripe-js';
11    const stripeScript = document.getElementById(scriptId);
12
13    if (typeof Stripe !== 'undefined') {
14        callback();
15        return;
16    }
17
18    window.stripeCallbacks.push(callback);
19
20    if (stripeScript) {
21        return;
22    }
23
24    const script = document.createElement('script');
25    script.src = 'https://js.stripe.com/v3/';
26    script.id = scriptId;
27    script.onload = () => {
28        window.stripeCallbacks.forEach((callback) => callback());
29        // Clear the callbacks after execution to prevent duplicate executions
30        window.stripeCallbacks = [];
31    };
32    script.onerror = () => {
33        console.error(new Error('Stripe SDK could not be loaded'));
34    };
35
36    document.head.append(script);
37};
38
39/**
40 * Stripe utility functions
41 */
42window.stripeUtils = window.stripeUtils || {};
43
44/**
45 * Used by Express Checkout wallets at various pages.
46 * Calculates the total amount from line items.
47 *
48 * @param {Array} lineItems - Array of line items with amount property
49 * @returns {number} Total amount in cents
50 */
51window.stripeUtils.addLineItemsAmounts = function(lineItems) {
52    if (!lineItems || !Array.isArray(lineItems)) {
53        return 0;
54    }
55    return lineItems.reduce((total, item) => total + (item.amount || 0), 0);
56};

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.