@stripe/connect-js 3.3.39-preview-1 → 3.3.39
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 +34 -91
- package/dist/connect.js +34 -91
- package/dist/pure.esm.js +26 -83
- package/dist/pure.js +26 -83
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +19 -76
- package/package.json +4 -4
- package/src/shared.ts +25 -42
- package/types/config.ts +22 -121
- package/types/shared.d.ts +97 -19
- package/LICENSE +0 -21
- package/README.md +0 -76
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 => {},
|
|
@@ -53,48 +42,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
53
42
|
"financial-account-transactions": {
|
|
54
43
|
setFinancialAccount: _financialAccount => {}
|
|
55
44
|
},
|
|
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 => {},
|
|
82
|
-
setOnApplicationStepChange: _listener => {}
|
|
45
|
+
payments: {
|
|
46
|
+
setDefaultFilters: _filters => {}
|
|
83
47
|
},
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
88
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
89
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
90
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
91
|
-
setOnApplicationStepChange: _listener => {}
|
|
48
|
+
"payment-details": {
|
|
49
|
+
setPayment: _payment => {},
|
|
50
|
+
setOnClose: _listener => {}
|
|
92
51
|
},
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setIntervalEnd: _intervalEnd => {},
|
|
97
|
-
setIntervalType: _intervalType => {}
|
|
52
|
+
"payment-disputes": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnDisputesLoaded: _listener => {}
|
|
98
55
|
},
|
|
99
56
|
"tax-settings": {
|
|
100
57
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -103,63 +60,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
103
60
|
},
|
|
104
61
|
"tax-registrations": {
|
|
105
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
106
|
-
setDisplayCountries: _countries => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
107
65
|
},
|
|
108
|
-
"tax-threshold-monitoring": {
|
|
109
|
-
setDisplayCountries: _countries => {}
|
|
110
|
-
},
|
|
111
|
-
"product-tax-code-selector": {
|
|
112
|
-
setOnTaxCodeSelect: _listener => {},
|
|
113
|
-
setHideDescription: _hideDescription => {},
|
|
114
|
-
setDisabled: _disabled => {},
|
|
115
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
116
|
-
},
|
|
117
|
-
"export-tax-transactions": {},
|
|
118
66
|
"payout-details": {
|
|
119
67
|
setPayout: _payout => {},
|
|
120
68
|
setOnClose: _listener => {}
|
|
69
|
+
},
|
|
70
|
+
"payout-reconciliation-report": {
|
|
71
|
+
setOnReportAvailabilityLoaded: _listener => {}
|
|
121
72
|
}
|
|
122
73
|
};
|
|
123
74
|
|
|
124
75
|
const componentNameMapping = {
|
|
76
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
77
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
125
78
|
payments: "stripe-connect-payments",
|
|
126
|
-
payouts: "stripe-connect-payouts",
|
|
127
79
|
"payment-details": "stripe-connect-payment-details",
|
|
128
80
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
81
|
+
payouts: "stripe-connect-payouts",
|
|
82
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
83
|
+
"payout-details": "stripe-connect-payout-details",
|
|
84
|
+
balances: "stripe-connect-balances",
|
|
132
85
|
"account-management": "stripe-connect-account-management",
|
|
133
86
|
"notification-banner": "stripe-connect-notification-banner",
|
|
134
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
135
87
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
136
88
|
"issuing-card": "stripe-connect-issuing-card",
|
|
137
89
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
138
90
|
"financial-account": "stripe-connect-financial-account",
|
|
139
|
-
recipients: "stripe-connect-recipients",
|
|
140
91
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
141
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
142
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
143
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
144
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
145
92
|
documents: "stripe-connect-documents",
|
|
146
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
147
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
148
93
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
149
94
|
"tax-settings": "stripe-connect-tax-settings",
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
153
|
-
"payout-details": "stripe-connect-payout-details",
|
|
154
|
-
"app-install": "stripe-connect-app-install",
|
|
155
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
156
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
"balance-report": "stripe-connect-balance-report",
|
|
96
|
+
"payout-reconciliation-report": "stripe-connect-payout-reconciliation-report"
|
|
157
97
|
};
|
|
158
98
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
159
99
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
160
100
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
161
101
|
const findScript = () => {
|
|
162
|
-
return document.querySelectorAll(`script[src="${
|
|
102
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
163
103
|
};
|
|
164
104
|
const injectScript = () => {
|
|
165
105
|
const script = document.createElement("script");
|
|
@@ -171,7 +111,7 @@ const injectScript = () => {
|
|
|
171
111
|
document.head.appendChild(script);
|
|
172
112
|
return script;
|
|
173
113
|
};
|
|
174
|
-
let stripePromise = null;
|
|
114
|
+
let stripePromise$1 = null;
|
|
175
115
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
176
116
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
177
117
|
// Why? HTML markup like:
|
|
@@ -181,10 +121,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
181
121
|
};
|
|
182
122
|
const loadScript = () => {
|
|
183
123
|
// Ensure that we only attempt to load Connect.js at most once
|
|
184
|
-
if (stripePromise !== null) {
|
|
185
|
-
return stripePromise;
|
|
124
|
+
if (stripePromise$1 !== null) {
|
|
125
|
+
return stripePromise$1;
|
|
186
126
|
}
|
|
187
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
127
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
188
128
|
if (typeof window === "undefined") {
|
|
189
129
|
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.");
|
|
190
130
|
return;
|
|
@@ -217,7 +157,7 @@ const loadScript = () => {
|
|
|
217
157
|
reject(error);
|
|
218
158
|
}
|
|
219
159
|
});
|
|
220
|
-
return stripePromise;
|
|
160
|
+
return stripePromise$1;
|
|
221
161
|
};
|
|
222
162
|
const hasCustomMethod = tagName => {
|
|
223
163
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -249,6 +189,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
249
189
|
for (const method in methods) {
|
|
250
190
|
element[method] = function (value) {
|
|
251
191
|
stripeConnectInstance.then(() => {
|
|
192
|
+
if (!this[`${method}InternalOnly`]) {
|
|
193
|
+
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.39`);
|
|
194
|
+
}
|
|
252
195
|
this[`${method}InternalOnly`](value);
|
|
253
196
|
});
|
|
254
197
|
};
|
|
@@ -301,7 +244,7 @@ const createWrapper = stripeConnect => {
|
|
|
301
244
|
sdk: true,
|
|
302
245
|
sdkOptions: {
|
|
303
246
|
// This will be replaced by the npm package version when bundling
|
|
304
|
-
sdkVersion: "3.3.39
|
|
247
|
+
sdkVersion: "3.3.39"
|
|
305
248
|
}
|
|
306
249
|
})
|
|
307
250
|
}));
|
|
@@ -313,16 +256,16 @@ const createWrapper = stripeConnect => {
|
|
|
313
256
|
|
|
314
257
|
// Execute our own script injection after a tick to give users time to do their
|
|
315
258
|
// own script injection.
|
|
316
|
-
const stripePromise
|
|
259
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
317
260
|
let loadCalled = false;
|
|
318
|
-
stripePromise
|
|
261
|
+
stripePromise.catch(err => {
|
|
319
262
|
if (!loadCalled) {
|
|
320
263
|
console.warn(err);
|
|
321
264
|
}
|
|
322
265
|
});
|
|
323
266
|
const loadConnectAndInitialize = initParams => {
|
|
324
267
|
loadCalled = true;
|
|
325
|
-
return initStripeConnect(stripePromise
|
|
268
|
+
return initStripeConnect(stripePromise, initParams);
|
|
326
269
|
};
|
|
327
270
|
|
|
328
271
|
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 => {},
|
|
@@ -57,48 +46,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
57
46
|
"financial-account-transactions": {
|
|
58
47
|
setFinancialAccount: _financialAccount => {}
|
|
59
48
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
"app-install": {
|
|
64
|
-
setApp: _app => {},
|
|
65
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
66
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
67
|
-
},
|
|
68
|
-
"app-viewport": {
|
|
69
|
-
setApp: _app => {},
|
|
70
|
-
setAppData: _appData => {}
|
|
71
|
-
},
|
|
72
|
-
"payment-method-settings": {
|
|
73
|
-
setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
|
|
74
|
-
},
|
|
75
|
-
"capital-financing": {
|
|
76
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
77
|
-
setShowFinancingSelector: _showFinancingSelector => {},
|
|
78
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
79
|
-
setSupportUrl: _supportUrl => {},
|
|
80
|
-
setOnFinancingsLoaded: _listener => {}
|
|
81
|
-
},
|
|
82
|
-
"capital-financing-application": {
|
|
83
|
-
setOnApplicationSubmitted: _listener => {},
|
|
84
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
85
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
86
|
-
setOnApplicationStepChange: _listener => {}
|
|
49
|
+
payments: {
|
|
50
|
+
setDefaultFilters: _filters => {}
|
|
87
51
|
},
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
92
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
93
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
94
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
95
|
-
setOnApplicationStepChange: _listener => {}
|
|
52
|
+
"payment-details": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnClose: _listener => {}
|
|
96
55
|
},
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
setIntervalEnd: _intervalEnd => {},
|
|
101
|
-
setIntervalType: _intervalType => {}
|
|
56
|
+
"payment-disputes": {
|
|
57
|
+
setPayment: _payment => {},
|
|
58
|
+
setOnDisputesLoaded: _listener => {}
|
|
102
59
|
},
|
|
103
60
|
"tax-settings": {
|
|
104
61
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -107,63 +64,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
107
64
|
},
|
|
108
65
|
"tax-registrations": {
|
|
109
66
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
110
|
-
setDisplayCountries: _countries => {}
|
|
67
|
+
setDisplayCountries: _countries => {},
|
|
68
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
111
69
|
},
|
|
112
|
-
"tax-threshold-monitoring": {
|
|
113
|
-
setDisplayCountries: _countries => {}
|
|
114
|
-
},
|
|
115
|
-
"product-tax-code-selector": {
|
|
116
|
-
setOnTaxCodeSelect: _listener => {},
|
|
117
|
-
setHideDescription: _hideDescription => {},
|
|
118
|
-
setDisabled: _disabled => {},
|
|
119
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
120
|
-
},
|
|
121
|
-
"export-tax-transactions": {},
|
|
122
70
|
"payout-details": {
|
|
123
71
|
setPayout: _payout => {},
|
|
124
72
|
setOnClose: _listener => {}
|
|
73
|
+
},
|
|
74
|
+
"payout-reconciliation-report": {
|
|
75
|
+
setOnReportAvailabilityLoaded: _listener => {}
|
|
125
76
|
}
|
|
126
77
|
};
|
|
127
78
|
|
|
128
79
|
const componentNameMapping = {
|
|
80
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
81
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
129
82
|
payments: "stripe-connect-payments",
|
|
130
|
-
payouts: "stripe-connect-payouts",
|
|
131
83
|
"payment-details": "stripe-connect-payment-details",
|
|
132
84
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
"
|
|
85
|
+
payouts: "stripe-connect-payouts",
|
|
86
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
87
|
+
"payout-details": "stripe-connect-payout-details",
|
|
88
|
+
balances: "stripe-connect-balances",
|
|
136
89
|
"account-management": "stripe-connect-account-management",
|
|
137
90
|
"notification-banner": "stripe-connect-notification-banner",
|
|
138
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
139
91
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
140
92
|
"issuing-card": "stripe-connect-issuing-card",
|
|
141
93
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
142
94
|
"financial-account": "stripe-connect-financial-account",
|
|
143
|
-
recipients: "stripe-connect-recipients",
|
|
144
95
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
145
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
146
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
147
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
148
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
149
96
|
documents: "stripe-connect-documents",
|
|
150
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
151
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
152
97
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
153
98
|
"tax-settings": "stripe-connect-tax-settings",
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
157
|
-
"payout-details": "stripe-connect-payout-details",
|
|
158
|
-
"app-install": "stripe-connect-app-install",
|
|
159
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
160
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
99
|
+
"balance-report": "stripe-connect-balance-report",
|
|
100
|
+
"payout-reconciliation-report": "stripe-connect-payout-reconciliation-report"
|
|
161
101
|
};
|
|
162
102
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
163
103
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
164
104
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
165
105
|
const findScript = () => {
|
|
166
|
-
return document.querySelectorAll(`script[src="${
|
|
106
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
167
107
|
};
|
|
168
108
|
const injectScript = () => {
|
|
169
109
|
const script = document.createElement("script");
|
|
@@ -175,7 +115,7 @@ const injectScript = () => {
|
|
|
175
115
|
document.head.appendChild(script);
|
|
176
116
|
return script;
|
|
177
117
|
};
|
|
178
|
-
let stripePromise = null;
|
|
118
|
+
let stripePromise$1 = null;
|
|
179
119
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
180
120
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
181
121
|
// Why? HTML markup like:
|
|
@@ -185,10 +125,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
185
125
|
};
|
|
186
126
|
const loadScript = () => {
|
|
187
127
|
// Ensure that we only attempt to load Connect.js at most once
|
|
188
|
-
if (stripePromise !== null) {
|
|
189
|
-
return stripePromise;
|
|
128
|
+
if (stripePromise$1 !== null) {
|
|
129
|
+
return stripePromise$1;
|
|
190
130
|
}
|
|
191
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
131
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
192
132
|
if (typeof window === "undefined") {
|
|
193
133
|
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.");
|
|
194
134
|
return;
|
|
@@ -221,7 +161,7 @@ const loadScript = () => {
|
|
|
221
161
|
reject(error);
|
|
222
162
|
}
|
|
223
163
|
});
|
|
224
|
-
return stripePromise;
|
|
164
|
+
return stripePromise$1;
|
|
225
165
|
};
|
|
226
166
|
const hasCustomMethod = tagName => {
|
|
227
167
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -253,6 +193,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
253
193
|
for (const method in methods) {
|
|
254
194
|
element[method] = function (value) {
|
|
255
195
|
stripeConnectInstance.then(() => {
|
|
196
|
+
if (!this[`${method}InternalOnly`]) {
|
|
197
|
+
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.39`);
|
|
198
|
+
}
|
|
256
199
|
this[`${method}InternalOnly`](value);
|
|
257
200
|
});
|
|
258
201
|
};
|
|
@@ -305,7 +248,7 @@ const createWrapper = stripeConnect => {
|
|
|
305
248
|
sdk: true,
|
|
306
249
|
sdkOptions: {
|
|
307
250
|
// This will be replaced by the npm package version when bundling
|
|
308
|
-
sdkVersion: "3.3.39
|
|
251
|
+
sdkVersion: "3.3.39"
|
|
309
252
|
}
|
|
310
253
|
})
|
|
311
254
|
}));
|
|
@@ -317,16 +260,16 @@ const createWrapper = stripeConnect => {
|
|
|
317
260
|
|
|
318
261
|
// Execute our own script injection after a tick to give users time to do their
|
|
319
262
|
// own script injection.
|
|
320
|
-
const stripePromise
|
|
263
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
321
264
|
let loadCalled = false;
|
|
322
|
-
stripePromise
|
|
265
|
+
stripePromise.catch(err => {
|
|
323
266
|
if (!loadCalled) {
|
|
324
267
|
console.warn(err);
|
|
325
268
|
}
|
|
326
269
|
});
|
|
327
270
|
const loadConnectAndInitialize = initParams => {
|
|
328
271
|
loadCalled = true;
|
|
329
|
-
return initStripeConnect(stripePromise
|
|
272
|
+
return initStripeConnect(stripePromise, initParams);
|
|
330
273
|
};
|
|
331
274
|
|
|
332
275
|
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 => {},
|
|
@@ -53,48 +42,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
53
42
|
"financial-account-transactions": {
|
|
54
43
|
setFinancialAccount: _financialAccount => {}
|
|
55
44
|
},
|
|
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 => {},
|
|
82
|
-
setOnApplicationStepChange: _listener => {}
|
|
45
|
+
payments: {
|
|
46
|
+
setDefaultFilters: _filters => {}
|
|
83
47
|
},
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
88
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
89
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
90
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
91
|
-
setOnApplicationStepChange: _listener => {}
|
|
48
|
+
"payment-details": {
|
|
49
|
+
setPayment: _payment => {},
|
|
50
|
+
setOnClose: _listener => {}
|
|
92
51
|
},
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setIntervalEnd: _intervalEnd => {},
|
|
97
|
-
setIntervalType: _intervalType => {}
|
|
52
|
+
"payment-disputes": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnDisputesLoaded: _listener => {}
|
|
98
55
|
},
|
|
99
56
|
"tax-settings": {
|
|
100
57
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -103,63 +60,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
103
60
|
},
|
|
104
61
|
"tax-registrations": {
|
|
105
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
106
|
-
setDisplayCountries: _countries => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
107
65
|
},
|
|
108
|
-
"tax-threshold-monitoring": {
|
|
109
|
-
setDisplayCountries: _countries => {}
|
|
110
|
-
},
|
|
111
|
-
"product-tax-code-selector": {
|
|
112
|
-
setOnTaxCodeSelect: _listener => {},
|
|
113
|
-
setHideDescription: _hideDescription => {},
|
|
114
|
-
setDisabled: _disabled => {},
|
|
115
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
116
|
-
},
|
|
117
|
-
"export-tax-transactions": {},
|
|
118
66
|
"payout-details": {
|
|
119
67
|
setPayout: _payout => {},
|
|
120
68
|
setOnClose: _listener => {}
|
|
69
|
+
},
|
|
70
|
+
"payout-reconciliation-report": {
|
|
71
|
+
setOnReportAvailabilityLoaded: _listener => {}
|
|
121
72
|
}
|
|
122
73
|
};
|
|
123
74
|
|
|
124
75
|
const componentNameMapping = {
|
|
76
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
77
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
125
78
|
payments: "stripe-connect-payments",
|
|
126
|
-
payouts: "stripe-connect-payouts",
|
|
127
79
|
"payment-details": "stripe-connect-payment-details",
|
|
128
80
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
81
|
+
payouts: "stripe-connect-payouts",
|
|
82
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
83
|
+
"payout-details": "stripe-connect-payout-details",
|
|
84
|
+
balances: "stripe-connect-balances",
|
|
132
85
|
"account-management": "stripe-connect-account-management",
|
|
133
86
|
"notification-banner": "stripe-connect-notification-banner",
|
|
134
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
135
87
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
136
88
|
"issuing-card": "stripe-connect-issuing-card",
|
|
137
89
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
138
90
|
"financial-account": "stripe-connect-financial-account",
|
|
139
|
-
recipients: "stripe-connect-recipients",
|
|
140
91
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
141
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
142
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
143
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
144
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
145
92
|
documents: "stripe-connect-documents",
|
|
146
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
147
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
148
93
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
149
94
|
"tax-settings": "stripe-connect-tax-settings",
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
153
|
-
"payout-details": "stripe-connect-payout-details",
|
|
154
|
-
"app-install": "stripe-connect-app-install",
|
|
155
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
156
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
"balance-report": "stripe-connect-balance-report",
|
|
96
|
+
"payout-reconciliation-report": "stripe-connect-payout-reconciliation-report"
|
|
157
97
|
};
|
|
158
98
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
159
99
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
160
100
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
161
101
|
const findScript = () => {
|
|
162
|
-
return document.querySelectorAll(`script[src="${
|
|
102
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
163
103
|
};
|
|
164
104
|
const injectScript = () => {
|
|
165
105
|
const script = document.createElement("script");
|
|
@@ -249,6 +189,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
249
189
|
for (const method in methods) {
|
|
250
190
|
element[method] = function (value) {
|
|
251
191
|
stripeConnectInstance.then(() => {
|
|
192
|
+
if (!this[`${method}InternalOnly`]) {
|
|
193
|
+
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.39`);
|
|
194
|
+
}
|
|
252
195
|
this[`${method}InternalOnly`](value);
|
|
253
196
|
});
|
|
254
197
|
};
|
|
@@ -301,7 +244,7 @@ const createWrapper = stripeConnect => {
|
|
|
301
244
|
sdk: true,
|
|
302
245
|
sdkOptions: {
|
|
303
246
|
// This will be replaced by the npm package version when bundling
|
|
304
|
-
sdkVersion: "3.3.39
|
|
247
|
+
sdkVersion: "3.3.39"
|
|
305
248
|
}
|
|
306
249
|
})
|
|
307
250
|
}));
|