@stripe/connect-js 3.3.33-preview-1 → 3.3.33
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/connect.esm.js +39 -89
- package/dist/connect.js +39 -89
- package/dist/pure.esm.js +31 -81
- package/dist/pure.js +31 -81
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +31 -72
- package/package.json +3 -3
- package/src/shared.ts +26 -42
- package/types/config.ts +36 -110
- package/types/shared.d.ts +9 -19
package/dist/connect.esm.js
CHANGED
|
@@ -5,17 +5,6 @@ const ConnectElementCommonMethodConfig = {
|
|
|
5
5
|
setOnLoaderStart: _listener => {}
|
|
6
6
|
};
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
payments: {
|
|
9
|
-
setDefaultFilters: _filters => {}
|
|
10
|
-
},
|
|
11
|
-
"payment-details": {
|
|
12
|
-
setPayment: _payment => {},
|
|
13
|
-
setOnClose: _listener => {}
|
|
14
|
-
},
|
|
15
|
-
"payment-disputes": {
|
|
16
|
-
setPayment: _payment => {},
|
|
17
|
-
setOnDisputesLoaded: _listener => {}
|
|
18
|
-
},
|
|
19
8
|
"account-onboarding": {
|
|
20
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
21
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -32,6 +21,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
32
21
|
setCollectionOptions: _collectionOptions => {},
|
|
33
22
|
setOnNotificationsChange: _listener => {}
|
|
34
23
|
},
|
|
24
|
+
"instant-payouts-promotion": {
|
|
25
|
+
setOnInstantPayoutsPromotionLoaded: _listener => {},
|
|
26
|
+
setOnInstantPayoutCreated: _listener => {}
|
|
27
|
+
},
|
|
35
28
|
"issuing-card": {
|
|
36
29
|
setDefaultCard: _defaultCard => {},
|
|
37
30
|
setCardSwitching: _cardSwitching => {},
|
|
@@ -49,46 +42,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
49
42
|
"financial-account-transactions": {
|
|
50
43
|
setFinancialAccount: _financialAccount => {}
|
|
51
44
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
"app-install": {
|
|
56
|
-
setApp: _app => {},
|
|
57
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
58
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
59
|
-
},
|
|
60
|
-
"app-viewport": {
|
|
61
|
-
setApp: _app => {},
|
|
62
|
-
setAppData: _appData => {}
|
|
63
|
-
},
|
|
64
|
-
"payment-method-settings": {
|
|
65
|
-
setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
|
|
66
|
-
},
|
|
67
|
-
"capital-financing": {
|
|
68
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
69
|
-
setShowFinancingSelector: _showFinancingSelector => {},
|
|
70
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
71
|
-
setSupportUrl: _supportUrl => {},
|
|
72
|
-
setOnFinancingsLoaded: _listener => {}
|
|
73
|
-
},
|
|
74
|
-
"capital-financing-application": {
|
|
75
|
-
setOnApplicationSubmitted: _listener => {},
|
|
76
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
77
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {}
|
|
45
|
+
payments: {
|
|
46
|
+
setDefaultFilters: _filters => {}
|
|
78
47
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
83
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
84
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
85
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {}
|
|
48
|
+
"payment-details": {
|
|
49
|
+
setPayment: _payment => {},
|
|
50
|
+
setOnClose: _listener => {}
|
|
86
51
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
setIntervalEnd: _intervalEnd => {},
|
|
91
|
-
setIntervalType: _intervalType => {}
|
|
52
|
+
"payment-disputes": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnDisputesLoaded: _listener => {}
|
|
92
55
|
},
|
|
93
56
|
"tax-settings": {
|
|
94
57
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -97,57 +60,41 @@ const ConnectElementCustomMethodConfig = {
|
|
|
97
60
|
},
|
|
98
61
|
"tax-registrations": {
|
|
99
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
100
|
-
setDisplayCountries: _countries => {}
|
|
101
|
-
|
|
102
|
-
"tax-threshold-monitoring": {
|
|
103
|
-
setDisplayCountries: _countries => {}
|
|
104
|
-
},
|
|
105
|
-
"product-tax-code-selector": {
|
|
106
|
-
setOnTaxCodeSelect: _listener => {},
|
|
107
|
-
setHideDescription: _hideDescription => {},
|
|
108
|
-
setDisabled: _disabled => {},
|
|
109
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
110
65
|
},
|
|
111
|
-
"
|
|
66
|
+
"payout-details": {
|
|
67
|
+
setPayout: _payout => {},
|
|
68
|
+
setOnClose: _listener => {}
|
|
69
|
+
}
|
|
112
70
|
};
|
|
113
71
|
|
|
114
72
|
const componentNameMapping = {
|
|
73
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
74
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
115
75
|
payments: "stripe-connect-payments",
|
|
116
|
-
payouts: "stripe-connect-payouts",
|
|
117
76
|
"payment-details": "stripe-connect-payment-details",
|
|
118
77
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
"
|
|
78
|
+
payouts: "stripe-connect-payouts",
|
|
79
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
80
|
+
"payout-details": "stripe-connect-payout-details",
|
|
81
|
+
balances: "stripe-connect-balances",
|
|
122
82
|
"account-management": "stripe-connect-account-management",
|
|
123
83
|
"notification-banner": "stripe-connect-notification-banner",
|
|
124
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
84
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
125
85
|
"issuing-card": "stripe-connect-issuing-card",
|
|
126
86
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
127
87
|
"financial-account": "stripe-connect-financial-account",
|
|
128
|
-
recipients: "stripe-connect-recipients",
|
|
129
88
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
130
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
131
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
132
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
133
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
134
89
|
documents: "stripe-connect-documents",
|
|
135
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
136
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
137
90
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
138
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
139
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
140
|
-
balances: "stripe-connect-balances",
|
|
141
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
142
|
-
"app-install": "stripe-connect-app-install",
|
|
143
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
144
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
91
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
145
92
|
};
|
|
146
93
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
147
94
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
148
95
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
149
96
|
const findScript = () => {
|
|
150
|
-
return document.querySelectorAll(`script[src="${
|
|
97
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
151
98
|
};
|
|
152
99
|
const injectScript = () => {
|
|
153
100
|
const script = document.createElement("script");
|
|
@@ -159,7 +106,7 @@ const injectScript = () => {
|
|
|
159
106
|
document.head.appendChild(script);
|
|
160
107
|
return script;
|
|
161
108
|
};
|
|
162
|
-
let stripePromise = null;
|
|
109
|
+
let stripePromise$1 = null;
|
|
163
110
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
164
111
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
165
112
|
// Why? HTML markup like:
|
|
@@ -169,10 +116,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
169
116
|
};
|
|
170
117
|
const loadScript = () => {
|
|
171
118
|
// Ensure that we only attempt to load Connect.js at most once
|
|
172
|
-
if (stripePromise !== null) {
|
|
173
|
-
return stripePromise;
|
|
119
|
+
if (stripePromise$1 !== null) {
|
|
120
|
+
return stripePromise$1;
|
|
174
121
|
}
|
|
175
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
122
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
176
123
|
if (typeof window === "undefined") {
|
|
177
124
|
reject("ConnectJS won't load when rendering code in the server - it can only be loaded on a browser. This error is expected when loading ConnectJS in SSR environments, like NextJS. It will have no impact in the UI, however if you wish to avoid it, you can switch to the `pure` version of the connect.js loader: https://github.com/stripe/connect-js#importing-loadconnect-without-side-effects.");
|
|
178
125
|
return;
|
|
@@ -205,7 +152,7 @@ const loadScript = () => {
|
|
|
205
152
|
reject(error);
|
|
206
153
|
}
|
|
207
154
|
});
|
|
208
|
-
return stripePromise;
|
|
155
|
+
return stripePromise$1;
|
|
209
156
|
};
|
|
210
157
|
const hasCustomMethod = tagName => {
|
|
211
158
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -237,6 +184,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
237
184
|
for (const method in methods) {
|
|
238
185
|
element[method] = function (value) {
|
|
239
186
|
stripeConnectInstance.then(() => {
|
|
187
|
+
if (!this[`${method}InternalOnly`]) {
|
|
188
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.3.33`);
|
|
189
|
+
}
|
|
240
190
|
this[`${method}InternalOnly`](value);
|
|
241
191
|
});
|
|
242
192
|
};
|
|
@@ -289,7 +239,7 @@ const createWrapper = stripeConnect => {
|
|
|
289
239
|
sdk: true,
|
|
290
240
|
sdkOptions: {
|
|
291
241
|
// This will be replaced by the npm package version when bundling
|
|
292
|
-
sdkVersion: "3.3.33
|
|
242
|
+
sdkVersion: "3.3.33"
|
|
293
243
|
}
|
|
294
244
|
})
|
|
295
245
|
}));
|
|
@@ -301,16 +251,16 @@ const createWrapper = stripeConnect => {
|
|
|
301
251
|
|
|
302
252
|
// Execute our own script injection after a tick to give users time to do their
|
|
303
253
|
// own script injection.
|
|
304
|
-
const stripePromise
|
|
254
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
305
255
|
let loadCalled = false;
|
|
306
|
-
stripePromise
|
|
256
|
+
stripePromise.catch(err => {
|
|
307
257
|
if (!loadCalled) {
|
|
308
258
|
console.warn(err);
|
|
309
259
|
}
|
|
310
260
|
});
|
|
311
261
|
const loadConnectAndInitialize = initParams => {
|
|
312
262
|
loadCalled = true;
|
|
313
|
-
return initStripeConnect(stripePromise
|
|
263
|
+
return initStripeConnect(stripePromise, initParams);
|
|
314
264
|
};
|
|
315
265
|
|
|
316
266
|
export { loadConnectAndInitialize };
|
package/dist/connect.js
CHANGED
|
@@ -9,17 +9,6 @@ const ConnectElementCommonMethodConfig = {
|
|
|
9
9
|
setOnLoaderStart: _listener => {}
|
|
10
10
|
};
|
|
11
11
|
const ConnectElementCustomMethodConfig = {
|
|
12
|
-
payments: {
|
|
13
|
-
setDefaultFilters: _filters => {}
|
|
14
|
-
},
|
|
15
|
-
"payment-details": {
|
|
16
|
-
setPayment: _payment => {},
|
|
17
|
-
setOnClose: _listener => {}
|
|
18
|
-
},
|
|
19
|
-
"payment-disputes": {
|
|
20
|
-
setPayment: _payment => {},
|
|
21
|
-
setOnDisputesLoaded: _listener => {}
|
|
22
|
-
},
|
|
23
12
|
"account-onboarding": {
|
|
24
13
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
25
14
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -36,6 +25,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
36
25
|
setCollectionOptions: _collectionOptions => {},
|
|
37
26
|
setOnNotificationsChange: _listener => {}
|
|
38
27
|
},
|
|
28
|
+
"instant-payouts-promotion": {
|
|
29
|
+
setOnInstantPayoutsPromotionLoaded: _listener => {},
|
|
30
|
+
setOnInstantPayoutCreated: _listener => {}
|
|
31
|
+
},
|
|
39
32
|
"issuing-card": {
|
|
40
33
|
setDefaultCard: _defaultCard => {},
|
|
41
34
|
setCardSwitching: _cardSwitching => {},
|
|
@@ -53,46 +46,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
53
46
|
"financial-account-transactions": {
|
|
54
47
|
setFinancialAccount: _financialAccount => {}
|
|
55
48
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
"app-install": {
|
|
60
|
-
setApp: _app => {},
|
|
61
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
62
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
63
|
-
},
|
|
64
|
-
"app-viewport": {
|
|
65
|
-
setApp: _app => {},
|
|
66
|
-
setAppData: _appData => {}
|
|
67
|
-
},
|
|
68
|
-
"payment-method-settings": {
|
|
69
|
-
setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
|
|
70
|
-
},
|
|
71
|
-
"capital-financing": {
|
|
72
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
73
|
-
setShowFinancingSelector: _showFinancingSelector => {},
|
|
74
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
75
|
-
setSupportUrl: _supportUrl => {},
|
|
76
|
-
setOnFinancingsLoaded: _listener => {}
|
|
77
|
-
},
|
|
78
|
-
"capital-financing-application": {
|
|
79
|
-
setOnApplicationSubmitted: _listener => {},
|
|
80
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
81
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {}
|
|
49
|
+
payments: {
|
|
50
|
+
setDefaultFilters: _filters => {}
|
|
82
51
|
},
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
87
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
88
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
89
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {}
|
|
52
|
+
"payment-details": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnClose: _listener => {}
|
|
90
55
|
},
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setIntervalEnd: _intervalEnd => {},
|
|
95
|
-
setIntervalType: _intervalType => {}
|
|
56
|
+
"payment-disputes": {
|
|
57
|
+
setPayment: _payment => {},
|
|
58
|
+
setOnDisputesLoaded: _listener => {}
|
|
96
59
|
},
|
|
97
60
|
"tax-settings": {
|
|
98
61
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -101,57 +64,41 @@ const ConnectElementCustomMethodConfig = {
|
|
|
101
64
|
},
|
|
102
65
|
"tax-registrations": {
|
|
103
66
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
104
|
-
setDisplayCountries: _countries => {}
|
|
105
|
-
|
|
106
|
-
"tax-threshold-monitoring": {
|
|
107
|
-
setDisplayCountries: _countries => {}
|
|
108
|
-
},
|
|
109
|
-
"product-tax-code-selector": {
|
|
110
|
-
setOnTaxCodeSelect: _listener => {},
|
|
111
|
-
setHideDescription: _hideDescription => {},
|
|
112
|
-
setDisabled: _disabled => {},
|
|
113
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
67
|
+
setDisplayCountries: _countries => {},
|
|
68
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
114
69
|
},
|
|
115
|
-
"
|
|
70
|
+
"payout-details": {
|
|
71
|
+
setPayout: _payout => {},
|
|
72
|
+
setOnClose: _listener => {}
|
|
73
|
+
}
|
|
116
74
|
};
|
|
117
75
|
|
|
118
76
|
const componentNameMapping = {
|
|
77
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
78
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
119
79
|
payments: "stripe-connect-payments",
|
|
120
|
-
payouts: "stripe-connect-payouts",
|
|
121
80
|
"payment-details": "stripe-connect-payment-details",
|
|
122
81
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
123
|
-
|
|
124
|
-
"
|
|
125
|
-
"
|
|
82
|
+
payouts: "stripe-connect-payouts",
|
|
83
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
84
|
+
"payout-details": "stripe-connect-payout-details",
|
|
85
|
+
balances: "stripe-connect-balances",
|
|
126
86
|
"account-management": "stripe-connect-account-management",
|
|
127
87
|
"notification-banner": "stripe-connect-notification-banner",
|
|
128
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
88
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
129
89
|
"issuing-card": "stripe-connect-issuing-card",
|
|
130
90
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
131
91
|
"financial-account": "stripe-connect-financial-account",
|
|
132
|
-
recipients: "stripe-connect-recipients",
|
|
133
92
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
134
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
135
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
136
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
137
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
138
93
|
documents: "stripe-connect-documents",
|
|
139
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
140
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
141
94
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
142
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
143
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
144
|
-
balances: "stripe-connect-balances",
|
|
145
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
146
|
-
"app-install": "stripe-connect-app-install",
|
|
147
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
148
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
149
96
|
};
|
|
150
97
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
151
98
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
152
99
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
153
100
|
const findScript = () => {
|
|
154
|
-
return document.querySelectorAll(`script[src="${
|
|
101
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
155
102
|
};
|
|
156
103
|
const injectScript = () => {
|
|
157
104
|
const script = document.createElement("script");
|
|
@@ -163,7 +110,7 @@ const injectScript = () => {
|
|
|
163
110
|
document.head.appendChild(script);
|
|
164
111
|
return script;
|
|
165
112
|
};
|
|
166
|
-
let stripePromise = null;
|
|
113
|
+
let stripePromise$1 = null;
|
|
167
114
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
168
115
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
169
116
|
// Why? HTML markup like:
|
|
@@ -173,10 +120,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
173
120
|
};
|
|
174
121
|
const loadScript = () => {
|
|
175
122
|
// Ensure that we only attempt to load Connect.js at most once
|
|
176
|
-
if (stripePromise !== null) {
|
|
177
|
-
return stripePromise;
|
|
123
|
+
if (stripePromise$1 !== null) {
|
|
124
|
+
return stripePromise$1;
|
|
178
125
|
}
|
|
179
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
126
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
180
127
|
if (typeof window === "undefined") {
|
|
181
128
|
reject("ConnectJS won't load when rendering code in the server - it can only be loaded on a browser. This error is expected when loading ConnectJS in SSR environments, like NextJS. It will have no impact in the UI, however if you wish to avoid it, you can switch to the `pure` version of the connect.js loader: https://github.com/stripe/connect-js#importing-loadconnect-without-side-effects.");
|
|
182
129
|
return;
|
|
@@ -209,7 +156,7 @@ const loadScript = () => {
|
|
|
209
156
|
reject(error);
|
|
210
157
|
}
|
|
211
158
|
});
|
|
212
|
-
return stripePromise;
|
|
159
|
+
return stripePromise$1;
|
|
213
160
|
};
|
|
214
161
|
const hasCustomMethod = tagName => {
|
|
215
162
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -241,6 +188,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
241
188
|
for (const method in methods) {
|
|
242
189
|
element[method] = function (value) {
|
|
243
190
|
stripeConnectInstance.then(() => {
|
|
191
|
+
if (!this[`${method}InternalOnly`]) {
|
|
192
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.3.33`);
|
|
193
|
+
}
|
|
244
194
|
this[`${method}InternalOnly`](value);
|
|
245
195
|
});
|
|
246
196
|
};
|
|
@@ -293,7 +243,7 @@ const createWrapper = stripeConnect => {
|
|
|
293
243
|
sdk: true,
|
|
294
244
|
sdkOptions: {
|
|
295
245
|
// This will be replaced by the npm package version when bundling
|
|
296
|
-
sdkVersion: "3.3.33
|
|
246
|
+
sdkVersion: "3.3.33"
|
|
297
247
|
}
|
|
298
248
|
})
|
|
299
249
|
}));
|
|
@@ -305,16 +255,16 @@ const createWrapper = stripeConnect => {
|
|
|
305
255
|
|
|
306
256
|
// Execute our own script injection after a tick to give users time to do their
|
|
307
257
|
// own script injection.
|
|
308
|
-
const stripePromise
|
|
258
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
309
259
|
let loadCalled = false;
|
|
310
|
-
stripePromise
|
|
260
|
+
stripePromise.catch(err => {
|
|
311
261
|
if (!loadCalled) {
|
|
312
262
|
console.warn(err);
|
|
313
263
|
}
|
|
314
264
|
});
|
|
315
265
|
const loadConnectAndInitialize = initParams => {
|
|
316
266
|
loadCalled = true;
|
|
317
|
-
return initStripeConnect(stripePromise
|
|
267
|
+
return initStripeConnect(stripePromise, initParams);
|
|
318
268
|
};
|
|
319
269
|
|
|
320
270
|
exports.loadConnectAndInitialize = loadConnectAndInitialize;
|
package/dist/pure.esm.js
CHANGED
|
@@ -5,17 +5,6 @@ const ConnectElementCommonMethodConfig = {
|
|
|
5
5
|
setOnLoaderStart: _listener => {}
|
|
6
6
|
};
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
payments: {
|
|
9
|
-
setDefaultFilters: _filters => {}
|
|
10
|
-
},
|
|
11
|
-
"payment-details": {
|
|
12
|
-
setPayment: _payment => {},
|
|
13
|
-
setOnClose: _listener => {}
|
|
14
|
-
},
|
|
15
|
-
"payment-disputes": {
|
|
16
|
-
setPayment: _payment => {},
|
|
17
|
-
setOnDisputesLoaded: _listener => {}
|
|
18
|
-
},
|
|
19
8
|
"account-onboarding": {
|
|
20
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
21
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -32,6 +21,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
32
21
|
setCollectionOptions: _collectionOptions => {},
|
|
33
22
|
setOnNotificationsChange: _listener => {}
|
|
34
23
|
},
|
|
24
|
+
"instant-payouts-promotion": {
|
|
25
|
+
setOnInstantPayoutsPromotionLoaded: _listener => {},
|
|
26
|
+
setOnInstantPayoutCreated: _listener => {}
|
|
27
|
+
},
|
|
35
28
|
"issuing-card": {
|
|
36
29
|
setDefaultCard: _defaultCard => {},
|
|
37
30
|
setCardSwitching: _cardSwitching => {},
|
|
@@ -49,46 +42,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
49
42
|
"financial-account-transactions": {
|
|
50
43
|
setFinancialAccount: _financialAccount => {}
|
|
51
44
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
"app-install": {
|
|
56
|
-
setApp: _app => {},
|
|
57
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
58
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
59
|
-
},
|
|
60
|
-
"app-viewport": {
|
|
61
|
-
setApp: _app => {},
|
|
62
|
-
setAppData: _appData => {}
|
|
63
|
-
},
|
|
64
|
-
"payment-method-settings": {
|
|
65
|
-
setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
|
|
66
|
-
},
|
|
67
|
-
"capital-financing": {
|
|
68
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
69
|
-
setShowFinancingSelector: _showFinancingSelector => {},
|
|
70
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
71
|
-
setSupportUrl: _supportUrl => {},
|
|
72
|
-
setOnFinancingsLoaded: _listener => {}
|
|
73
|
-
},
|
|
74
|
-
"capital-financing-application": {
|
|
75
|
-
setOnApplicationSubmitted: _listener => {},
|
|
76
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
77
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {}
|
|
45
|
+
payments: {
|
|
46
|
+
setDefaultFilters: _filters => {}
|
|
78
47
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
83
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
84
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
85
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {}
|
|
48
|
+
"payment-details": {
|
|
49
|
+
setPayment: _payment => {},
|
|
50
|
+
setOnClose: _listener => {}
|
|
86
51
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
setIntervalEnd: _intervalEnd => {},
|
|
91
|
-
setIntervalType: _intervalType => {}
|
|
52
|
+
"payment-disputes": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnDisputesLoaded: _listener => {}
|
|
92
55
|
},
|
|
93
56
|
"tax-settings": {
|
|
94
57
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -97,57 +60,41 @@ const ConnectElementCustomMethodConfig = {
|
|
|
97
60
|
},
|
|
98
61
|
"tax-registrations": {
|
|
99
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
100
|
-
setDisplayCountries: _countries => {}
|
|
101
|
-
|
|
102
|
-
"tax-threshold-monitoring": {
|
|
103
|
-
setDisplayCountries: _countries => {}
|
|
104
|
-
},
|
|
105
|
-
"product-tax-code-selector": {
|
|
106
|
-
setOnTaxCodeSelect: _listener => {},
|
|
107
|
-
setHideDescription: _hideDescription => {},
|
|
108
|
-
setDisabled: _disabled => {},
|
|
109
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
110
65
|
},
|
|
111
|
-
"
|
|
66
|
+
"payout-details": {
|
|
67
|
+
setPayout: _payout => {},
|
|
68
|
+
setOnClose: _listener => {}
|
|
69
|
+
}
|
|
112
70
|
};
|
|
113
71
|
|
|
114
72
|
const componentNameMapping = {
|
|
73
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
74
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
115
75
|
payments: "stripe-connect-payments",
|
|
116
|
-
payouts: "stripe-connect-payouts",
|
|
117
76
|
"payment-details": "stripe-connect-payment-details",
|
|
118
77
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
"
|
|
78
|
+
payouts: "stripe-connect-payouts",
|
|
79
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
80
|
+
"payout-details": "stripe-connect-payout-details",
|
|
81
|
+
balances: "stripe-connect-balances",
|
|
122
82
|
"account-management": "stripe-connect-account-management",
|
|
123
83
|
"notification-banner": "stripe-connect-notification-banner",
|
|
124
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
84
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
125
85
|
"issuing-card": "stripe-connect-issuing-card",
|
|
126
86
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
127
87
|
"financial-account": "stripe-connect-financial-account",
|
|
128
|
-
recipients: "stripe-connect-recipients",
|
|
129
88
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
130
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
131
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
132
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
133
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
134
89
|
documents: "stripe-connect-documents",
|
|
135
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
136
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
137
90
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
138
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
139
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
140
|
-
balances: "stripe-connect-balances",
|
|
141
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
142
|
-
"app-install": "stripe-connect-app-install",
|
|
143
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
144
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
91
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
145
92
|
};
|
|
146
93
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
147
94
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
148
95
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
149
96
|
const findScript = () => {
|
|
150
|
-
return document.querySelectorAll(`script[src="${
|
|
97
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
151
98
|
};
|
|
152
99
|
const injectScript = () => {
|
|
153
100
|
const script = document.createElement("script");
|
|
@@ -237,6 +184,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
237
184
|
for (const method in methods) {
|
|
238
185
|
element[method] = function (value) {
|
|
239
186
|
stripeConnectInstance.then(() => {
|
|
187
|
+
if (!this[`${method}InternalOnly`]) {
|
|
188
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.3.33`);
|
|
189
|
+
}
|
|
240
190
|
this[`${method}InternalOnly`](value);
|
|
241
191
|
});
|
|
242
192
|
};
|
|
@@ -289,7 +239,7 @@ const createWrapper = stripeConnect => {
|
|
|
289
239
|
sdk: true,
|
|
290
240
|
sdkOptions: {
|
|
291
241
|
// This will be replaced by the npm package version when bundling
|
|
292
|
-
sdkVersion: "3.3.33
|
|
242
|
+
sdkVersion: "3.3.33"
|
|
293
243
|
}
|
|
294
244
|
})
|
|
295
245
|
}));
|