@stripe/stripe-js 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +12792 -4
- package/dist/index.d.ts +12792 -4
- package/dist/{index.js → stripe.js} +1 -1
- package/dist/{index.mjs → stripe.mjs} +1 -1
- package/package.json +10 -11
- package/pure/index.d.mts +12771 -1
- package/pure/index.d.ts +12771 -1
- package/pure/index.js +204 -1
- package/pure/index.mjs +200 -1
- package/dist/api/bank-accounts.d.mts +0 -61
- package/dist/api/bank-accounts.d.ts +0 -61
- package/dist/api/cards.d.mts +0 -130
- package/dist/api/cards.d.ts +0 -130
- package/dist/api/financial-connections.d.mts +0 -232
- package/dist/api/financial-connections.d.ts +0 -232
- package/dist/api/index.d.mts +0 -11
- package/dist/api/index.d.ts +0 -11
- package/dist/api/orders.d.mts +0 -122
- package/dist/api/orders.d.ts +0 -122
- package/dist/api/payment-intents.d.mts +0 -330
- package/dist/api/payment-intents.d.ts +0 -330
- package/dist/api/payment-methods.d.mts +0 -452
- package/dist/api/payment-methods.d.ts +0 -452
- package/dist/api/setup-intents.d.mts +0 -184
- package/dist/api/setup-intents.d.ts +0 -184
- package/dist/api/shared.d.mts +0 -125
- package/dist/api/shared.d.ts +0 -125
- package/dist/api/sources.d.mts +0 -1045
- package/dist/api/sources.d.ts +0 -1045
- package/dist/api/tokens.d.mts +0 -639
- package/dist/api/tokens.d.ts +0 -639
- package/dist/api/verification-sessions.d.mts +0 -9
- package/dist/api/verification-sessions.d.ts +0 -9
- package/dist/pure.d.mts +0 -5
- package/dist/pure.d.ts +0 -5
- package/dist/pure.js +0 -204
- package/dist/pure.mjs +0 -200
- package/dist/shared.d.mts +0 -6
- package/dist/shared.d.ts +0 -6
- package/dist/stripe-js/checkout.d.mts +0 -153
- package/dist/stripe-js/checkout.d.ts +0 -153
- package/dist/stripe-js/custom-checkout.d.mts +0 -402
- package/dist/stripe-js/custom-checkout.d.ts +0 -402
- package/dist/stripe-js/elements/address.d.mts +0 -261
- package/dist/stripe-js/elements/address.d.ts +0 -261
- package/dist/stripe-js/elements/affirm-message.d.mts +0 -65
- package/dist/stripe-js/elements/affirm-message.d.ts +0 -65
- package/dist/stripe-js/elements/afterpay-clearpay-message.d.mts +0 -119
- package/dist/stripe-js/elements/afterpay-clearpay-message.d.ts +0 -119
- package/dist/stripe-js/elements/apple-pay.d.mts +0 -156
- package/dist/stripe-js/elements/apple-pay.d.ts +0 -156
- package/dist/stripe-js/elements/au-bank-account.d.mts +0 -138
- package/dist/stripe-js/elements/au-bank-account.d.ts +0 -138
- package/dist/stripe-js/elements/base.d.mts +0 -264
- package/dist/stripe-js/elements/base.d.ts +0 -264
- package/dist/stripe-js/elements/card-cvc.d.mts +0 -119
- package/dist/stripe-js/elements/card-cvc.d.ts +0 -119
- package/dist/stripe-js/elements/card-expiry.d.mts +0 -119
- package/dist/stripe-js/elements/card-expiry.d.ts +0 -119
- package/dist/stripe-js/elements/card-number.d.mts +0 -200
- package/dist/stripe-js/elements/card-number.d.ts +0 -200
- package/dist/stripe-js/elements/card.d.mts +0 -226
- package/dist/stripe-js/elements/card.d.ts +0 -226
- package/dist/stripe-js/elements/cart.d.mts +0 -224
- package/dist/stripe-js/elements/cart.d.ts +0 -224
- package/dist/stripe-js/elements/eps-bank.d.mts +0 -140
- package/dist/stripe-js/elements/eps-bank.d.ts +0 -140
- package/dist/stripe-js/elements/express-checkout.d.mts +0 -446
- package/dist/stripe-js/elements/express-checkout.d.ts +0 -446
- package/dist/stripe-js/elements/fpx-bank.d.mts +0 -134
- package/dist/stripe-js/elements/fpx-bank.d.ts +0 -134
- package/dist/stripe-js/elements/iban.d.mts +0 -135
- package/dist/stripe-js/elements/iban.d.ts +0 -135
- package/dist/stripe-js/elements/ideal-bank.d.mts +0 -140
- package/dist/stripe-js/elements/ideal-bank.d.ts +0 -140
- package/dist/stripe-js/elements/index.d.mts +0 -22
- package/dist/stripe-js/elements/index.d.ts +0 -22
- package/dist/stripe-js/elements/issuing/index.d.mts +0 -5
- package/dist/stripe-js/elements/issuing/index.d.ts +0 -5
- package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.mts +0 -37
- package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.ts +0 -37
- package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.mts +0 -32
- package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.ts +0 -32
- package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.mts +0 -32
- package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.ts +0 -32
- package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.mts +0 -40
- package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.ts +0 -40
- package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.mts +0 -32
- package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.ts +0 -32
- package/dist/stripe-js/elements/link-authentication.d.mts +0 -158
- package/dist/stripe-js/elements/link-authentication.d.ts +0 -158
- package/dist/stripe-js/elements/p24-bank.d.mts +0 -140
- package/dist/stripe-js/elements/p24-bank.d.ts +0 -140
- package/dist/stripe-js/elements/payment-method-messaging.d.mts +0 -98
- package/dist/stripe-js/elements/payment-method-messaging.d.ts +0 -98
- package/dist/stripe-js/elements/payment-request-button.d.mts +0 -151
- package/dist/stripe-js/elements/payment-request-button.d.ts +0 -151
- package/dist/stripe-js/elements/payment.d.mts +0 -275
- package/dist/stripe-js/elements/payment.d.ts +0 -275
- package/dist/stripe-js/elements/shipping-address.d.mts +0 -215
- package/dist/stripe-js/elements/shipping-address.d.ts +0 -215
- package/dist/stripe-js/elements-group.d.mts +0 -1129
- package/dist/stripe-js/elements-group.d.ts +0 -1129
- package/dist/stripe-js/embedded-checkout.d.mts +0 -35
- package/dist/stripe-js/embedded-checkout.d.ts +0 -35
- package/dist/stripe-js/ephemeral-keys.d.mts +0 -3
- package/dist/stripe-js/ephemeral-keys.d.ts +0 -3
- package/dist/stripe-js/financial-connections.d.mts +0 -19
- package/dist/stripe-js/financial-connections.d.ts +0 -19
- package/dist/stripe-js/index.d.mts +0 -13
- package/dist/stripe-js/index.d.ts +0 -13
- package/dist/stripe-js/orders.d.mts +0 -9
- package/dist/stripe-js/orders.d.ts +0 -9
- package/dist/stripe-js/payment-intents.d.mts +0 -1470
- package/dist/stripe-js/payment-intents.d.ts +0 -1470
- package/dist/stripe-js/payment-request.d.mts +0 -529
- package/dist/stripe-js/payment-request.d.ts +0 -529
- package/dist/stripe-js/setup-intents.d.mts +0 -250
- package/dist/stripe-js/setup-intents.d.ts +0 -250
- package/dist/stripe-js/stripe.d.mts +0 -1472
- package/dist/stripe-js/stripe.d.ts +0 -1472
- package/dist/stripe-js/token-and-sources.d.mts +0 -110
- package/dist/stripe-js/token-and-sources.d.ts +0 -110
- package/dist/utils.d.mts +0 -2
- package/dist/utils.d.ts +0 -2
- package/lib/index.d.mts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -2
- package/lib/index.mjs +0 -1
package/pure/index.js
CHANGED
|
@@ -1 +1,204 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _typeof(obj) {
|
|
6
|
+
"@babel/helpers - typeof";
|
|
7
|
+
|
|
8
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
9
|
+
_typeof = function (obj) {
|
|
10
|
+
return typeof obj;
|
|
11
|
+
};
|
|
12
|
+
} else {
|
|
13
|
+
_typeof = function (obj) {
|
|
14
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return _typeof(obj);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
22
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
23
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
24
|
+
var findScript = function findScript() {
|
|
25
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
26
|
+
|
|
27
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
28
|
+
var script = scripts[i];
|
|
29
|
+
|
|
30
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return script;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var injectScript = function injectScript(params) {
|
|
41
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
42
|
+
var script = document.createElement('script');
|
|
43
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
44
|
+
var headOrBody = document.head || document.body;
|
|
45
|
+
|
|
46
|
+
if (!headOrBody) {
|
|
47
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
headOrBody.appendChild(script);
|
|
51
|
+
return script;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
55
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
stripe._registerWrapper({
|
|
60
|
+
name: 'stripe-js',
|
|
61
|
+
version: "3.0.10",
|
|
62
|
+
startTime: startTime
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var stripePromise = null;
|
|
67
|
+
var onErrorListener = null;
|
|
68
|
+
var onLoadListener = null;
|
|
69
|
+
|
|
70
|
+
var onError = function onError(reject) {
|
|
71
|
+
return function () {
|
|
72
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var onLoad = function onLoad(resolve, reject) {
|
|
77
|
+
return function () {
|
|
78
|
+
if (window.Stripe) {
|
|
79
|
+
resolve(window.Stripe);
|
|
80
|
+
} else {
|
|
81
|
+
reject(new Error('Stripe.js not available'));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var loadScript = function loadScript(params) {
|
|
87
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
88
|
+
if (stripePromise !== null) {
|
|
89
|
+
return stripePromise;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
93
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
94
|
+
// Resolve to null when imported server side. This makes the module
|
|
95
|
+
// safe to import in an isomorphic code base.
|
|
96
|
+
resolve(null);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (window.Stripe && params) {
|
|
101
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (window.Stripe) {
|
|
105
|
+
resolve(window.Stripe);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
var script = findScript();
|
|
111
|
+
|
|
112
|
+
if (script && params) {
|
|
113
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
114
|
+
} else if (!script) {
|
|
115
|
+
script = injectScript(params);
|
|
116
|
+
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
|
117
|
+
var _script$parentNode;
|
|
118
|
+
|
|
119
|
+
// remove event listeners
|
|
120
|
+
script.removeEventListener('load', onLoadListener);
|
|
121
|
+
script.removeEventListener('error', onErrorListener); // if script exists, but we are reloading due to an error,
|
|
122
|
+
// reload script to trigger 'load' event
|
|
123
|
+
|
|
124
|
+
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
|
125
|
+
script = injectScript(params);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
onLoadListener = onLoad(resolve, reject);
|
|
129
|
+
onErrorListener = onError(reject);
|
|
130
|
+
script.addEventListener('load', onLoadListener);
|
|
131
|
+
script.addEventListener('error', onErrorListener);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
reject(error);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
}); // Resets stripePromise on error
|
|
137
|
+
|
|
138
|
+
return stripePromise["catch"](function (error) {
|
|
139
|
+
stripePromise = null;
|
|
140
|
+
return Promise.reject(error);
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
144
|
+
if (maybeStripe === null) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
149
|
+
registerWrapper(stripe, startTime);
|
|
150
|
+
return stripe;
|
|
151
|
+
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
152
|
+
|
|
153
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
154
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
155
|
+
|
|
156
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
157
|
+
throw new Error(errorMessage);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
161
|
+
return params;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
throw new Error(errorMessage);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var loadParams;
|
|
168
|
+
var loadStripeCalled = false;
|
|
169
|
+
var loadStripe = function loadStripe() {
|
|
170
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
171
|
+
args[_key] = arguments[_key];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
loadStripeCalled = true;
|
|
175
|
+
var startTime = Date.now();
|
|
176
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
177
|
+
return initStripe(maybeStripe, args, startTime);
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
loadStripe.setLoadParameters = function (params) {
|
|
182
|
+
// we won't throw an error if setLoadParameters is called with the same values as before
|
|
183
|
+
if (loadStripeCalled && loadParams) {
|
|
184
|
+
var validatedParams = validateLoadParams(params);
|
|
185
|
+
var parameterKeys = Object.keys(validatedParams);
|
|
186
|
+
var sameParameters = parameterKeys.reduce(function (previousValue, currentValue) {
|
|
187
|
+
var _loadParams;
|
|
188
|
+
|
|
189
|
+
return previousValue && params[currentValue] === ((_loadParams = loadParams) === null || _loadParams === void 0 ? void 0 : _loadParams[currentValue]);
|
|
190
|
+
}, true);
|
|
191
|
+
|
|
192
|
+
if (sameParameters) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (loadStripeCalled) {
|
|
198
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
loadParams = validateLoadParams(params);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
exports.loadStripe = loadStripe;
|
package/pure/index.mjs
CHANGED
|
@@ -1 +1,200 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) {
|
|
2
|
+
"@babel/helpers - typeof";
|
|
3
|
+
|
|
4
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
5
|
+
_typeof = function (obj) {
|
|
6
|
+
return typeof obj;
|
|
7
|
+
};
|
|
8
|
+
} else {
|
|
9
|
+
_typeof = function (obj) {
|
|
10
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return _typeof(obj);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
18
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
19
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
20
|
+
var findScript = function findScript() {
|
|
21
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
22
|
+
|
|
23
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
24
|
+
var script = scripts[i];
|
|
25
|
+
|
|
26
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return script;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var injectScript = function injectScript(params) {
|
|
37
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
38
|
+
var script = document.createElement('script');
|
|
39
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
40
|
+
var headOrBody = document.head || document.body;
|
|
41
|
+
|
|
42
|
+
if (!headOrBody) {
|
|
43
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
headOrBody.appendChild(script);
|
|
47
|
+
return script;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
51
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
stripe._registerWrapper({
|
|
56
|
+
name: 'stripe-js',
|
|
57
|
+
version: "3.0.10",
|
|
58
|
+
startTime: startTime
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var stripePromise = null;
|
|
63
|
+
var onErrorListener = null;
|
|
64
|
+
var onLoadListener = null;
|
|
65
|
+
|
|
66
|
+
var onError = function onError(reject) {
|
|
67
|
+
return function () {
|
|
68
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var onLoad = function onLoad(resolve, reject) {
|
|
73
|
+
return function () {
|
|
74
|
+
if (window.Stripe) {
|
|
75
|
+
resolve(window.Stripe);
|
|
76
|
+
} else {
|
|
77
|
+
reject(new Error('Stripe.js not available'));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var loadScript = function loadScript(params) {
|
|
83
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
84
|
+
if (stripePromise !== null) {
|
|
85
|
+
return stripePromise;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
89
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
90
|
+
// Resolve to null when imported server side. This makes the module
|
|
91
|
+
// safe to import in an isomorphic code base.
|
|
92
|
+
resolve(null);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (window.Stripe && params) {
|
|
97
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (window.Stripe) {
|
|
101
|
+
resolve(window.Stripe);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
var script = findScript();
|
|
107
|
+
|
|
108
|
+
if (script && params) {
|
|
109
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
110
|
+
} else if (!script) {
|
|
111
|
+
script = injectScript(params);
|
|
112
|
+
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
|
113
|
+
var _script$parentNode;
|
|
114
|
+
|
|
115
|
+
// remove event listeners
|
|
116
|
+
script.removeEventListener('load', onLoadListener);
|
|
117
|
+
script.removeEventListener('error', onErrorListener); // if script exists, but we are reloading due to an error,
|
|
118
|
+
// reload script to trigger 'load' event
|
|
119
|
+
|
|
120
|
+
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
|
121
|
+
script = injectScript(params);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
onLoadListener = onLoad(resolve, reject);
|
|
125
|
+
onErrorListener = onError(reject);
|
|
126
|
+
script.addEventListener('load', onLoadListener);
|
|
127
|
+
script.addEventListener('error', onErrorListener);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
reject(error);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}); // Resets stripePromise on error
|
|
133
|
+
|
|
134
|
+
return stripePromise["catch"](function (error) {
|
|
135
|
+
stripePromise = null;
|
|
136
|
+
return Promise.reject(error);
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
140
|
+
if (maybeStripe === null) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
145
|
+
registerWrapper(stripe, startTime);
|
|
146
|
+
return stripe;
|
|
147
|
+
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
148
|
+
|
|
149
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
150
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
151
|
+
|
|
152
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
153
|
+
throw new Error(errorMessage);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
157
|
+
return params;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
throw new Error(errorMessage);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var loadParams;
|
|
164
|
+
var loadStripeCalled = false;
|
|
165
|
+
var loadStripe = function loadStripe() {
|
|
166
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
167
|
+
args[_key] = arguments[_key];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
loadStripeCalled = true;
|
|
171
|
+
var startTime = Date.now();
|
|
172
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
173
|
+
return initStripe(maybeStripe, args, startTime);
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
loadStripe.setLoadParameters = function (params) {
|
|
178
|
+
// we won't throw an error if setLoadParameters is called with the same values as before
|
|
179
|
+
if (loadStripeCalled && loadParams) {
|
|
180
|
+
var validatedParams = validateLoadParams(params);
|
|
181
|
+
var parameterKeys = Object.keys(validatedParams);
|
|
182
|
+
var sameParameters = parameterKeys.reduce(function (previousValue, currentValue) {
|
|
183
|
+
var _loadParams;
|
|
184
|
+
|
|
185
|
+
return previousValue && params[currentValue] === ((_loadParams = loadParams) === null || _loadParams === void 0 ? void 0 : _loadParams[currentValue]);
|
|
186
|
+
}, true);
|
|
187
|
+
|
|
188
|
+
if (sameParameters) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (loadStripeCalled) {
|
|
194
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
loadParams = validateLoadParams(params);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export { loadStripe };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The BankAccount object.
|
|
3
|
-
*/
|
|
4
|
-
export interface BankAccount {
|
|
5
|
-
/**
|
|
6
|
-
* Unique identifier for the object.
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* String representing the object's type. Objects of the same type share the same value.
|
|
12
|
-
*/
|
|
13
|
-
object: 'bank_account';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The name of the person or business that owns the bank account.
|
|
17
|
-
*/
|
|
18
|
-
account_holder_name: string | null;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The type of entity that holds the account. This can be either `individual` or `company`.
|
|
22
|
-
*/
|
|
23
|
-
account_holder_type: string | null;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Name of the bank associated with the routing number (e.g., `WELLS FARGO`).
|
|
27
|
-
*/
|
|
28
|
-
bank_name: string | null;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Two-letter ISO code representing the country the bank account is located in.
|
|
32
|
-
*/
|
|
33
|
-
country: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
|
|
37
|
-
*/
|
|
38
|
-
currency: string;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
|
42
|
-
*/
|
|
43
|
-
fingerprint: string | null;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The last four digits of the bank account number.
|
|
47
|
-
*/
|
|
48
|
-
last4: string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The routing transit number for the bank account.
|
|
52
|
-
*/
|
|
53
|
-
routing_number: string | null;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn't enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a transfer sent to this bank account fails, we'll set the status to `errored` and will not continue to send transfers until the bank details are updated.
|
|
57
|
-
*
|
|
58
|
-
* For external accounts, possible values are `new` and `errored`. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to `errored` and transfers are stopped until account details are updated.
|
|
59
|
-
*/
|
|
60
|
-
status: string;
|
|
61
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The BankAccount object.
|
|
3
|
-
*/
|
|
4
|
-
export interface BankAccount {
|
|
5
|
-
/**
|
|
6
|
-
* Unique identifier for the object.
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* String representing the object's type. Objects of the same type share the same value.
|
|
12
|
-
*/
|
|
13
|
-
object: 'bank_account';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The name of the person or business that owns the bank account.
|
|
17
|
-
*/
|
|
18
|
-
account_holder_name: string | null;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The type of entity that holds the account. This can be either `individual` or `company`.
|
|
22
|
-
*/
|
|
23
|
-
account_holder_type: string | null;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Name of the bank associated with the routing number (e.g., `WELLS FARGO`).
|
|
27
|
-
*/
|
|
28
|
-
bank_name: string | null;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Two-letter ISO code representing the country the bank account is located in.
|
|
32
|
-
*/
|
|
33
|
-
country: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
|
|
37
|
-
*/
|
|
38
|
-
currency: string;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
|
42
|
-
*/
|
|
43
|
-
fingerprint: string | null;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The last four digits of the bank account number.
|
|
47
|
-
*/
|
|
48
|
-
last4: string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The routing transit number for the bank account.
|
|
52
|
-
*/
|
|
53
|
-
routing_number: string | null;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn't enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a transfer sent to this bank account fails, we'll set the status to `errored` and will not continue to send transfers until the bank details are updated.
|
|
57
|
-
*
|
|
58
|
-
* For external accounts, possible values are `new` and `errored`. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to `errored` and transfers are stopped until account details are updated.
|
|
59
|
-
*/
|
|
60
|
-
status: string;
|
|
61
|
-
}
|
package/dist/api/cards.d.mts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {Metadata} from './shared';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The Card object.
|
|
5
|
-
*/
|
|
6
|
-
export interface Card {
|
|
7
|
-
/**
|
|
8
|
-
* Unique identifier for the object.
|
|
9
|
-
*/
|
|
10
|
-
id: string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* String representing the object's type. Objects of the same type share the same value.
|
|
14
|
-
*/
|
|
15
|
-
object: 'card';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* City/District/Suburb/Town/Village.
|
|
19
|
-
*/
|
|
20
|
-
address_city: string | null;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Billing address country, if provided when creating card.
|
|
24
|
-
*/
|
|
25
|
-
address_country: string | null;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Address line 1 (Street address/PO Box/Company name).
|
|
29
|
-
*/
|
|
30
|
-
address_line1: string | null;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
|
|
34
|
-
*/
|
|
35
|
-
address_line1_check: string | null;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Address line 2 (Apartment/Suite/Unit/Building).
|
|
39
|
-
*/
|
|
40
|
-
address_line2: string | null;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* State/County/Province/Region.
|
|
44
|
-
*/
|
|
45
|
-
address_state: string | null;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* ZIP or postal code.
|
|
49
|
-
*/
|
|
50
|
-
address_zip: string | null;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
|
|
54
|
-
*/
|
|
55
|
-
address_zip_check: string | null;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
|
|
59
|
-
*/
|
|
60
|
-
brand: string;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
|
|
64
|
-
*/
|
|
65
|
-
country: string | null;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
|
69
|
-
*/
|
|
70
|
-
currency?: string | null;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
|
|
74
|
-
*/
|
|
75
|
-
customer?: string | null;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
|
|
79
|
-
*/
|
|
80
|
-
cvc_check: string | null;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* (For tokenized numbers only.) The last four digits of the device account number.
|
|
84
|
-
*/
|
|
85
|
-
dynamic_last4: string | null;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Two-digit number representing the card's expiration month.
|
|
89
|
-
*/
|
|
90
|
-
exp_month: number;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Four-digit number representing the card's expiration year.
|
|
94
|
-
*/
|
|
95
|
-
exp_year: number;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example.
|
|
99
|
-
*/
|
|
100
|
-
fingerprint?: string | null;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
|
|
104
|
-
*/
|
|
105
|
-
funding: string;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The last four digits of the card.
|
|
109
|
-
*/
|
|
110
|
-
last4: string;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
|
114
|
-
*/
|
|
115
|
-
metadata: Metadata;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Cardholder name.
|
|
119
|
-
*/
|
|
120
|
-
name: string | null;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* If the card number is tokenized, this is the method that was used. Can be `apple_pay` or `google_pay`.
|
|
124
|
-
*/
|
|
125
|
-
tokenization_method: string | null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export namespace Card {
|
|
129
|
-
export type AvailablePayoutMethod = 'instant' | 'standard';
|
|
130
|
-
}
|