@stripe/stripe-js 3.0.8 → 3.0.9

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.
Files changed (129) hide show
  1. package/dist/api/bank-accounts.d.mts +61 -0
  2. package/dist/api/bank-accounts.d.ts +61 -0
  3. package/dist/api/cards.d.mts +130 -0
  4. package/dist/api/cards.d.ts +130 -0
  5. package/dist/api/financial-connections.d.mts +232 -0
  6. package/dist/api/financial-connections.d.ts +232 -0
  7. package/dist/api/index.d.mts +11 -0
  8. package/dist/api/index.d.ts +11 -0
  9. package/dist/api/orders.d.mts +122 -0
  10. package/dist/api/orders.d.ts +122 -0
  11. package/dist/api/payment-intents.d.mts +330 -0
  12. package/dist/api/payment-intents.d.ts +330 -0
  13. package/dist/api/payment-methods.d.mts +452 -0
  14. package/dist/api/payment-methods.d.ts +452 -0
  15. package/dist/api/setup-intents.d.mts +184 -0
  16. package/dist/api/setup-intents.d.ts +184 -0
  17. package/dist/api/shared.d.mts +125 -0
  18. package/dist/api/shared.d.ts +125 -0
  19. package/dist/api/sources.d.mts +1045 -0
  20. package/dist/api/sources.d.ts +1045 -0
  21. package/dist/api/tokens.d.mts +639 -0
  22. package/dist/api/tokens.d.ts +639 -0
  23. package/dist/api/verification-sessions.d.mts +9 -0
  24. package/dist/api/verification-sessions.d.ts +9 -0
  25. package/dist/index.d.mts +4 -12792
  26. package/dist/index.d.ts +4 -12792
  27. package/dist/{stripe.js → index.js} +1 -1
  28. package/dist/{stripe.mjs → index.mjs} +1 -1
  29. package/dist/pure.d.mts +5 -0
  30. package/dist/pure.d.ts +5 -0
  31. package/dist/pure.js +204 -0
  32. package/dist/pure.mjs +200 -0
  33. package/dist/shared.d.mts +6 -0
  34. package/dist/shared.d.ts +6 -0
  35. package/dist/stripe-js/checkout.d.mts +153 -0
  36. package/dist/stripe-js/checkout.d.ts +153 -0
  37. package/dist/stripe-js/custom-checkout.d.mts +402 -0
  38. package/dist/stripe-js/custom-checkout.d.ts +402 -0
  39. package/dist/stripe-js/elements/address.d.mts +261 -0
  40. package/dist/stripe-js/elements/address.d.ts +261 -0
  41. package/dist/stripe-js/elements/affirm-message.d.mts +65 -0
  42. package/dist/stripe-js/elements/affirm-message.d.ts +65 -0
  43. package/dist/stripe-js/elements/afterpay-clearpay-message.d.mts +119 -0
  44. package/dist/stripe-js/elements/afterpay-clearpay-message.d.ts +119 -0
  45. package/dist/stripe-js/elements/apple-pay.d.mts +156 -0
  46. package/dist/stripe-js/elements/apple-pay.d.ts +156 -0
  47. package/dist/stripe-js/elements/au-bank-account.d.mts +138 -0
  48. package/dist/stripe-js/elements/au-bank-account.d.ts +138 -0
  49. package/dist/stripe-js/elements/base.d.mts +264 -0
  50. package/dist/stripe-js/elements/base.d.ts +264 -0
  51. package/dist/stripe-js/elements/card-cvc.d.mts +119 -0
  52. package/dist/stripe-js/elements/card-cvc.d.ts +119 -0
  53. package/dist/stripe-js/elements/card-expiry.d.mts +119 -0
  54. package/dist/stripe-js/elements/card-expiry.d.ts +119 -0
  55. package/dist/stripe-js/elements/card-number.d.mts +200 -0
  56. package/dist/stripe-js/elements/card-number.d.ts +200 -0
  57. package/dist/stripe-js/elements/card.d.mts +226 -0
  58. package/dist/stripe-js/elements/card.d.ts +226 -0
  59. package/dist/stripe-js/elements/cart.d.mts +224 -0
  60. package/dist/stripe-js/elements/cart.d.ts +224 -0
  61. package/dist/stripe-js/elements/eps-bank.d.mts +140 -0
  62. package/dist/stripe-js/elements/eps-bank.d.ts +140 -0
  63. package/dist/stripe-js/elements/express-checkout.d.mts +446 -0
  64. package/dist/stripe-js/elements/express-checkout.d.ts +446 -0
  65. package/dist/stripe-js/elements/fpx-bank.d.mts +134 -0
  66. package/dist/stripe-js/elements/fpx-bank.d.ts +134 -0
  67. package/dist/stripe-js/elements/iban.d.mts +135 -0
  68. package/dist/stripe-js/elements/iban.d.ts +135 -0
  69. package/dist/stripe-js/elements/ideal-bank.d.mts +140 -0
  70. package/dist/stripe-js/elements/ideal-bank.d.ts +140 -0
  71. package/dist/stripe-js/elements/index.d.mts +22 -0
  72. package/dist/stripe-js/elements/index.d.ts +22 -0
  73. package/dist/stripe-js/elements/issuing/index.d.mts +5 -0
  74. package/dist/stripe-js/elements/issuing/index.d.ts +5 -0
  75. package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.mts +37 -0
  76. package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.ts +37 -0
  77. package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.mts +32 -0
  78. package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.ts +32 -0
  79. package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.mts +32 -0
  80. package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.ts +32 -0
  81. package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.mts +40 -0
  82. package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.ts +40 -0
  83. package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.mts +32 -0
  84. package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.ts +32 -0
  85. package/dist/stripe-js/elements/link-authentication.d.mts +158 -0
  86. package/dist/stripe-js/elements/link-authentication.d.ts +158 -0
  87. package/dist/stripe-js/elements/p24-bank.d.mts +140 -0
  88. package/dist/stripe-js/elements/p24-bank.d.ts +140 -0
  89. package/dist/stripe-js/elements/payment-method-messaging.d.mts +98 -0
  90. package/dist/stripe-js/elements/payment-method-messaging.d.ts +98 -0
  91. package/dist/stripe-js/elements/payment-request-button.d.mts +151 -0
  92. package/dist/stripe-js/elements/payment-request-button.d.ts +151 -0
  93. package/dist/stripe-js/elements/payment.d.mts +275 -0
  94. package/dist/stripe-js/elements/payment.d.ts +275 -0
  95. package/dist/stripe-js/elements/shipping-address.d.mts +215 -0
  96. package/dist/stripe-js/elements/shipping-address.d.ts +215 -0
  97. package/dist/stripe-js/elements-group.d.mts +1129 -0
  98. package/dist/stripe-js/elements-group.d.ts +1129 -0
  99. package/dist/stripe-js/embedded-checkout.d.mts +35 -0
  100. package/dist/stripe-js/embedded-checkout.d.ts +35 -0
  101. package/dist/stripe-js/ephemeral-keys.d.mts +3 -0
  102. package/dist/stripe-js/ephemeral-keys.d.ts +3 -0
  103. package/dist/stripe-js/financial-connections.d.mts +19 -0
  104. package/dist/stripe-js/financial-connections.d.ts +19 -0
  105. package/dist/stripe-js/index.d.mts +13 -0
  106. package/dist/stripe-js/index.d.ts +13 -0
  107. package/dist/stripe-js/orders.d.mts +9 -0
  108. package/dist/stripe-js/orders.d.ts +9 -0
  109. package/dist/stripe-js/payment-intents.d.mts +1470 -0
  110. package/dist/stripe-js/payment-intents.d.ts +1470 -0
  111. package/dist/stripe-js/payment-request.d.mts +529 -0
  112. package/dist/stripe-js/payment-request.d.ts +529 -0
  113. package/dist/stripe-js/setup-intents.d.mts +250 -0
  114. package/dist/stripe-js/setup-intents.d.ts +250 -0
  115. package/dist/stripe-js/stripe.d.mts +1472 -0
  116. package/dist/stripe-js/stripe.d.ts +1472 -0
  117. package/dist/stripe-js/token-and-sources.d.mts +110 -0
  118. package/dist/stripe-js/token-and-sources.d.ts +110 -0
  119. package/dist/utils.d.mts +2 -0
  120. package/dist/utils.d.ts +2 -0
  121. package/lib/index.d.mts +1 -0
  122. package/lib/index.d.ts +1 -0
  123. package/lib/index.js +2 -0
  124. package/lib/index.mjs +1 -0
  125. package/package.json +11 -10
  126. package/pure/index.d.mts +1 -12771
  127. package/pure/index.d.ts +1 -12771
  128. package/pure/index.js +1 -204
  129. package/pure/index.mjs +1 -200
@@ -42,7 +42,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
42
42
 
43
43
  stripe._registerWrapper({
44
44
  name: 'stripe-js',
45
- version: "3.0.8",
45
+ version: "3.0.9",
46
46
  startTime: startTime
47
47
  });
48
48
  };
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "3.0.8",
41
+ version: "3.0.9",
42
42
  startTime: startTime
43
43
  });
44
44
  };
@@ -0,0 +1,5 @@
1
+ import {loadStripe as _loadStripe} from './shared';
2
+
3
+ export const loadStripe: typeof _loadStripe & {
4
+ setLoadParameters: (params: {advancedFraudSignals: boolean}) => void;
5
+ };
package/dist/pure.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import {loadStripe as _loadStripe} from './shared';
2
+
3
+ export const loadStripe: typeof _loadStripe & {
4
+ setLoadParameters: (params: {advancedFraudSignals: boolean}) => void;
5
+ };
package/dist/pure.js ADDED
@@ -0,0 +1,204 @@
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.9",
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/dist/pure.mjs ADDED
@@ -0,0 +1,200 @@
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.9",
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 };
@@ -0,0 +1,6 @@
1
+ import {StripeConstructorOptions, Stripe} from './stripe-js';
2
+
3
+ export const loadStripe: (
4
+ publishableKey: string,
5
+ options?: StripeConstructorOptions | undefined
6
+ ) => Promise<Stripe | null>;
@@ -0,0 +1,6 @@
1
+ import {StripeConstructorOptions, Stripe} from './stripe-js';
2
+
3
+ export const loadStripe: (
4
+ publishableKey: string,
5
+ options?: StripeConstructorOptions | undefined
6
+ ) => Promise<Stripe | null>;
@@ -0,0 +1,153 @@
1
+ export interface RedirectToCheckoutServerOptions {
2
+ /**
3
+ * The ID of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions) that is used in [Checkout's server integration](https://stripe.com/docs/payments/checkout/one-time).
4
+ */
5
+ sessionId: string;
6
+ }
7
+
8
+ export interface RedirectToCheckoutClientOptions {
9
+ /**
10
+ * The URL to which Stripe should send customers when payment is complete.
11
+ * If you’d like access to the Checkout Session for the successful payment, read more about it in our guide on [fulfilling your payments with webhooks](https://stripe.com/docs/payments/checkout/fulfillment#webhooks).
12
+ */
13
+ successUrl: string;
14
+
15
+ /**
16
+ * The URL to which Stripe should send customers when payment is canceled.
17
+ */
18
+ cancelUrl: string;
19
+
20
+ /**
21
+ * An array of objects representing the items that your customer would like to purchase.
22
+ * These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout.
23
+ */
24
+ lineItems?: Array<{
25
+ /**
26
+ * The ID of the price that the customer would like to purchase. SKU or plan IDs may also be used.
27
+ */
28
+ price?: string;
29
+
30
+ /**
31
+ * The quantity of units for the item.
32
+ */
33
+ quantity?: number;
34
+ }>;
35
+
36
+ /**
37
+ * An array of objects representing the items that your customer would like to purchase.
38
+ * These items are shown as line items in the Checkout interface and make up the total amount to be collected by Checkout.
39
+ *
40
+ * @deprecated
41
+ */
42
+ items?: Array<{
43
+ /**
44
+ * The ID of the SKU that the customer would like to purchase
45
+ */
46
+ sku?: string;
47
+
48
+ /**
49
+ * The ID of the plan that the customer would like to subscribe to.
50
+ */
51
+ plan?: string;
52
+
53
+ /**
54
+ * The quantity of units for the item.
55
+ */
56
+ quantity?: number;
57
+ }>;
58
+
59
+ /**
60
+ * The mode of the Checkout Session. Required if using lineItems.
61
+ */
62
+ mode?: 'payment' | 'subscription';
63
+
64
+ /**
65
+ * A unique string to reference the Checkout session.
66
+ * This can be a customer ID, a cart ID, or similar.
67
+ * It is included in the `checkout.session.completed` webhook and can be used to fulfill the purchase.
68
+ */
69
+ clientReferenceId?: string;
70
+
71
+ /**
72
+ * The email address used to create the customer object.
73
+ * If you already know your customer's email address, use this attribute to prefill it on Checkout.
74
+ */
75
+ customerEmail?: string;
76
+
77
+ /**
78
+ * Specify whether Checkout should collect the customer’s billing address.
79
+ * If set to `required`, Checkout will attempt to collect the customer’s billing address.
80
+ * If not set or set to `auto` Checkout will only attempt to collect the billing address when necessary.
81
+ */
82
+ billingAddressCollection?: 'auto' | 'required';
83
+
84
+ /**
85
+ * Provides configuration for Checkout to collect a shipping address from a customer.
86
+ */
87
+ shippingAddressCollection?: {
88
+ /**
89
+ * An array of two-letter ISO country codes representing which countries
90
+ * Checkout should provide as options for shipping locations. The codes are
91
+ * expected to be uppercase. Unsupported country codes: AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI.
92
+ */
93
+ allowedCountries: string[];
94
+ };
95
+
96
+ /**
97
+ * The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the locale to display Checkout in.
98
+ * Default is `auto` (Stripe detects the locale of the browser).
99
+ */
100
+ locale?: CheckoutLocale;
101
+
102
+ /**
103
+ * Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the **Submit** button.
104
+ * `submitType` can only be specified when using using line items or SKUs, and not subscriptions.
105
+ * The default is `auto`.
106
+ */
107
+ submitType?: 'auto' | 'book' | 'donate' | 'pay';
108
+ }
109
+
110
+ export type RedirectToCheckoutOptions =
111
+ | RedirectToCheckoutServerOptions
112
+ | RedirectToCheckoutClientOptions;
113
+
114
+ export type CheckoutLocale =
115
+ | 'auto'
116
+ | 'bg'
117
+ | 'cs'
118
+ | 'da'
119
+ | 'de'
120
+ | 'el'
121
+ | 'en'
122
+ | 'en-GB'
123
+ | 'es'
124
+ | 'es-419'
125
+ | 'et'
126
+ | 'fi'
127
+ | 'fil'
128
+ | 'fr'
129
+ | 'fr-CA'
130
+ | 'hr'
131
+ | 'hu'
132
+ | 'id'
133
+ | 'it'
134
+ | 'ja'
135
+ | 'lt'
136
+ | 'lv'
137
+ | 'ms'
138
+ | 'mt'
139
+ | 'nb'
140
+ | 'nl'
141
+ | 'pl'
142
+ | 'pt'
143
+ | 'pt-BR'
144
+ | 'ro'
145
+ | 'ru'
146
+ | 'sk'
147
+ | 'sl'
148
+ | 'sv'
149
+ | 'th'
150
+ | 'tr'
151
+ | 'zh'
152
+ | 'zh-HK'
153
+ | 'zh-TW';