@stripe/connect-js 3.3.36-preview-1 → 3.3.36
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 +37 -89
- package/dist/connect.js +37 -89
- package/dist/pure.esm.js +29 -81
- package/dist/pure.js +29 -81
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +25 -73
- package/package.json +3 -3
- package/src/shared.ts +25 -40
- package/types/config.ts +28 -115
- package/types/shared.d.ts +97 -18
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,58 +60,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
103
60
|
},
|
|
104
61
|
"tax-registrations": {
|
|
105
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
106
|
-
setDisplayCountries: _countries => {}
|
|
107
|
-
|
|
108
|
-
"tax-threshold-monitoring": {
|
|
109
|
-
setDisplayCountries: _countries => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
110
65
|
},
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
setDisabled: _disabled => {},
|
|
115
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
66
|
+
"payout-details": {
|
|
67
|
+
setPayout: _payout => {},
|
|
68
|
+
setOnClose: _listener => {}
|
|
116
69
|
},
|
|
117
|
-
|
|
70
|
+
payoutReconciliationReport: {
|
|
71
|
+
setOnNotAvailable: _listener => {}
|
|
72
|
+
}
|
|
118
73
|
};
|
|
119
74
|
|
|
120
75
|
const componentNameMapping = {
|
|
76
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
77
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
121
78
|
payments: "stripe-connect-payments",
|
|
122
|
-
payouts: "stripe-connect-payouts",
|
|
123
79
|
"payment-details": "stripe-connect-payment-details",
|
|
124
80
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
"
|
|
81
|
+
payouts: "stripe-connect-payouts",
|
|
82
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
83
|
+
"payout-details": "stripe-connect-payout-details",
|
|
84
|
+
balances: "stripe-connect-balances",
|
|
128
85
|
"account-management": "stripe-connect-account-management",
|
|
129
86
|
"notification-banner": "stripe-connect-notification-banner",
|
|
130
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
131
87
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
132
88
|
"issuing-card": "stripe-connect-issuing-card",
|
|
133
89
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
134
90
|
"financial-account": "stripe-connect-financial-account",
|
|
135
|
-
recipients: "stripe-connect-recipients",
|
|
136
91
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
137
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
138
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
139
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
140
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
141
92
|
documents: "stripe-connect-documents",
|
|
142
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
143
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
144
93
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
145
94
|
"tax-settings": "stripe-connect-tax-settings",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
149
|
-
"app-install": "stripe-connect-app-install",
|
|
150
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
151
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
balanceReport: "stripe-connect-balance-report",
|
|
96
|
+
payoutReconciliationReport: "stripe-connect-payout-reconciliation-report"
|
|
152
97
|
};
|
|
153
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";
|
|
154
99
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
155
100
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
156
101
|
const findScript = () => {
|
|
157
|
-
return document.querySelectorAll(`script[src="${
|
|
102
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
158
103
|
};
|
|
159
104
|
const injectScript = () => {
|
|
160
105
|
const script = document.createElement("script");
|
|
@@ -166,7 +111,7 @@ const injectScript = () => {
|
|
|
166
111
|
document.head.appendChild(script);
|
|
167
112
|
return script;
|
|
168
113
|
};
|
|
169
|
-
let stripePromise = null;
|
|
114
|
+
let stripePromise$1 = null;
|
|
170
115
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
171
116
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
172
117
|
// Why? HTML markup like:
|
|
@@ -176,10 +121,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
176
121
|
};
|
|
177
122
|
const loadScript = () => {
|
|
178
123
|
// Ensure that we only attempt to load Connect.js at most once
|
|
179
|
-
if (stripePromise !== null) {
|
|
180
|
-
return stripePromise;
|
|
124
|
+
if (stripePromise$1 !== null) {
|
|
125
|
+
return stripePromise$1;
|
|
181
126
|
}
|
|
182
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
127
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
183
128
|
if (typeof window === "undefined") {
|
|
184
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.");
|
|
185
130
|
return;
|
|
@@ -212,7 +157,7 @@ const loadScript = () => {
|
|
|
212
157
|
reject(error);
|
|
213
158
|
}
|
|
214
159
|
});
|
|
215
|
-
return stripePromise;
|
|
160
|
+
return stripePromise$1;
|
|
216
161
|
};
|
|
217
162
|
const hasCustomMethod = tagName => {
|
|
218
163
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -244,6 +189,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
244
189
|
for (const method in methods) {
|
|
245
190
|
element[method] = function (value) {
|
|
246
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.36`);
|
|
194
|
+
}
|
|
247
195
|
this[`${method}InternalOnly`](value);
|
|
248
196
|
});
|
|
249
197
|
};
|
|
@@ -296,7 +244,7 @@ const createWrapper = stripeConnect => {
|
|
|
296
244
|
sdk: true,
|
|
297
245
|
sdkOptions: {
|
|
298
246
|
// This will be replaced by the npm package version when bundling
|
|
299
|
-
sdkVersion: "3.3.36
|
|
247
|
+
sdkVersion: "3.3.36"
|
|
300
248
|
}
|
|
301
249
|
})
|
|
302
250
|
}));
|
|
@@ -308,16 +256,16 @@ const createWrapper = stripeConnect => {
|
|
|
308
256
|
|
|
309
257
|
// Execute our own script injection after a tick to give users time to do their
|
|
310
258
|
// own script injection.
|
|
311
|
-
const stripePromise
|
|
259
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
312
260
|
let loadCalled = false;
|
|
313
|
-
stripePromise
|
|
261
|
+
stripePromise.catch(err => {
|
|
314
262
|
if (!loadCalled) {
|
|
315
263
|
console.warn(err);
|
|
316
264
|
}
|
|
317
265
|
});
|
|
318
266
|
const loadConnectAndInitialize = initParams => {
|
|
319
267
|
loadCalled = true;
|
|
320
|
-
return initStripeConnect(stripePromise
|
|
268
|
+
return initStripeConnect(stripePromise, initParams);
|
|
321
269
|
};
|
|
322
270
|
|
|
323
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,58 +64,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
107
64
|
},
|
|
108
65
|
"tax-registrations": {
|
|
109
66
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
110
|
-
setDisplayCountries: _countries => {}
|
|
111
|
-
|
|
112
|
-
"tax-threshold-monitoring": {
|
|
113
|
-
setDisplayCountries: _countries => {}
|
|
67
|
+
setDisplayCountries: _countries => {},
|
|
68
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
114
69
|
},
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
setDisabled: _disabled => {},
|
|
119
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
70
|
+
"payout-details": {
|
|
71
|
+
setPayout: _payout => {},
|
|
72
|
+
setOnClose: _listener => {}
|
|
120
73
|
},
|
|
121
|
-
|
|
74
|
+
payoutReconciliationReport: {
|
|
75
|
+
setOnNotAvailable: _listener => {}
|
|
76
|
+
}
|
|
122
77
|
};
|
|
123
78
|
|
|
124
79
|
const componentNameMapping = {
|
|
80
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
81
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
125
82
|
payments: "stripe-connect-payments",
|
|
126
|
-
payouts: "stripe-connect-payouts",
|
|
127
83
|
"payment-details": "stripe-connect-payment-details",
|
|
128
84
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
85
|
+
payouts: "stripe-connect-payouts",
|
|
86
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
87
|
+
"payout-details": "stripe-connect-payout-details",
|
|
88
|
+
balances: "stripe-connect-balances",
|
|
132
89
|
"account-management": "stripe-connect-account-management",
|
|
133
90
|
"notification-banner": "stripe-connect-notification-banner",
|
|
134
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
135
91
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
136
92
|
"issuing-card": "stripe-connect-issuing-card",
|
|
137
93
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
138
94
|
"financial-account": "stripe-connect-financial-account",
|
|
139
|
-
recipients: "stripe-connect-recipients",
|
|
140
95
|
"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
96
|
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
97
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
149
98
|
"tax-settings": "stripe-connect-tax-settings",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
153
|
-
"app-install": "stripe-connect-app-install",
|
|
154
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
155
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
99
|
+
balanceReport: "stripe-connect-balance-report",
|
|
100
|
+
payoutReconciliationReport: "stripe-connect-payout-reconciliation-report"
|
|
156
101
|
};
|
|
157
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";
|
|
158
103
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
159
104
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
160
105
|
const findScript = () => {
|
|
161
|
-
return document.querySelectorAll(`script[src="${
|
|
106
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
162
107
|
};
|
|
163
108
|
const injectScript = () => {
|
|
164
109
|
const script = document.createElement("script");
|
|
@@ -170,7 +115,7 @@ const injectScript = () => {
|
|
|
170
115
|
document.head.appendChild(script);
|
|
171
116
|
return script;
|
|
172
117
|
};
|
|
173
|
-
let stripePromise = null;
|
|
118
|
+
let stripePromise$1 = null;
|
|
174
119
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
175
120
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
176
121
|
// Why? HTML markup like:
|
|
@@ -180,10 +125,10 @@ const isWindowStripeConnectDefined = stripeConnect => {
|
|
|
180
125
|
};
|
|
181
126
|
const loadScript = () => {
|
|
182
127
|
// Ensure that we only attempt to load Connect.js at most once
|
|
183
|
-
if (stripePromise !== null) {
|
|
184
|
-
return stripePromise;
|
|
128
|
+
if (stripePromise$1 !== null) {
|
|
129
|
+
return stripePromise$1;
|
|
185
130
|
}
|
|
186
|
-
stripePromise = new Promise((resolve, reject) => {
|
|
131
|
+
stripePromise$1 = new Promise((resolve, reject) => {
|
|
187
132
|
if (typeof window === "undefined") {
|
|
188
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.");
|
|
189
134
|
return;
|
|
@@ -216,7 +161,7 @@ const loadScript = () => {
|
|
|
216
161
|
reject(error);
|
|
217
162
|
}
|
|
218
163
|
});
|
|
219
|
-
return stripePromise;
|
|
164
|
+
return stripePromise$1;
|
|
220
165
|
};
|
|
221
166
|
const hasCustomMethod = tagName => {
|
|
222
167
|
return tagName in ConnectElementCustomMethodConfig;
|
|
@@ -248,6 +193,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
248
193
|
for (const method in methods) {
|
|
249
194
|
element[method] = function (value) {
|
|
250
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.36`);
|
|
198
|
+
}
|
|
251
199
|
this[`${method}InternalOnly`](value);
|
|
252
200
|
});
|
|
253
201
|
};
|
|
@@ -300,7 +248,7 @@ const createWrapper = stripeConnect => {
|
|
|
300
248
|
sdk: true,
|
|
301
249
|
sdkOptions: {
|
|
302
250
|
// This will be replaced by the npm package version when bundling
|
|
303
|
-
sdkVersion: "3.3.36
|
|
251
|
+
sdkVersion: "3.3.36"
|
|
304
252
|
}
|
|
305
253
|
})
|
|
306
254
|
}));
|
|
@@ -312,16 +260,16 @@ const createWrapper = stripeConnect => {
|
|
|
312
260
|
|
|
313
261
|
// Execute our own script injection after a tick to give users time to do their
|
|
314
262
|
// own script injection.
|
|
315
|
-
const stripePromise
|
|
263
|
+
const stripePromise = Promise.resolve().then(() => loadScript());
|
|
316
264
|
let loadCalled = false;
|
|
317
|
-
stripePromise
|
|
265
|
+
stripePromise.catch(err => {
|
|
318
266
|
if (!loadCalled) {
|
|
319
267
|
console.warn(err);
|
|
320
268
|
}
|
|
321
269
|
});
|
|
322
270
|
const loadConnectAndInitialize = initParams => {
|
|
323
271
|
loadCalled = true;
|
|
324
|
-
return initStripeConnect(stripePromise
|
|
272
|
+
return initStripeConnect(stripePromise, initParams);
|
|
325
273
|
};
|
|
326
274
|
|
|
327
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,58 +60,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
103
60
|
},
|
|
104
61
|
"tax-registrations": {
|
|
105
62
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
106
|
-
setDisplayCountries: _countries => {}
|
|
107
|
-
|
|
108
|
-
"tax-threshold-monitoring": {
|
|
109
|
-
setDisplayCountries: _countries => {}
|
|
63
|
+
setDisplayCountries: _countries => {},
|
|
64
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
110
65
|
},
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
setDisabled: _disabled => {},
|
|
115
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
66
|
+
"payout-details": {
|
|
67
|
+
setPayout: _payout => {},
|
|
68
|
+
setOnClose: _listener => {}
|
|
116
69
|
},
|
|
117
|
-
|
|
70
|
+
payoutReconciliationReport: {
|
|
71
|
+
setOnNotAvailable: _listener => {}
|
|
72
|
+
}
|
|
118
73
|
};
|
|
119
74
|
|
|
120
75
|
const componentNameMapping = {
|
|
76
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
77
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
121
78
|
payments: "stripe-connect-payments",
|
|
122
|
-
payouts: "stripe-connect-payouts",
|
|
123
79
|
"payment-details": "stripe-connect-payment-details",
|
|
124
80
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
"
|
|
81
|
+
payouts: "stripe-connect-payouts",
|
|
82
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
83
|
+
"payout-details": "stripe-connect-payout-details",
|
|
84
|
+
balances: "stripe-connect-balances",
|
|
128
85
|
"account-management": "stripe-connect-account-management",
|
|
129
86
|
"notification-banner": "stripe-connect-notification-banner",
|
|
130
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
131
87
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
132
88
|
"issuing-card": "stripe-connect-issuing-card",
|
|
133
89
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
134
90
|
"financial-account": "stripe-connect-financial-account",
|
|
135
|
-
recipients: "stripe-connect-recipients",
|
|
136
91
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
137
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
138
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
139
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
140
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
141
92
|
documents: "stripe-connect-documents",
|
|
142
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
143
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
144
93
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
145
94
|
"tax-settings": "stripe-connect-tax-settings",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
149
|
-
"app-install": "stripe-connect-app-install",
|
|
150
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
151
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
balanceReport: "stripe-connect-balance-report",
|
|
96
|
+
payoutReconciliationReport: "stripe-connect-payout-reconciliation-report"
|
|
152
97
|
};
|
|
153
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";
|
|
154
99
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
155
100
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
156
101
|
const findScript = () => {
|
|
157
|
-
return document.querySelectorAll(`script[src="${
|
|
102
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
158
103
|
};
|
|
159
104
|
const injectScript = () => {
|
|
160
105
|
const script = document.createElement("script");
|
|
@@ -244,6 +189,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
244
189
|
for (const method in methods) {
|
|
245
190
|
element[method] = function (value) {
|
|
246
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.36`);
|
|
194
|
+
}
|
|
247
195
|
this[`${method}InternalOnly`](value);
|
|
248
196
|
});
|
|
249
197
|
};
|
|
@@ -296,7 +244,7 @@ const createWrapper = stripeConnect => {
|
|
|
296
244
|
sdk: true,
|
|
297
245
|
sdkOptions: {
|
|
298
246
|
// This will be replaced by the npm package version when bundling
|
|
299
|
-
sdkVersion: "3.3.36
|
|
247
|
+
sdkVersion: "3.3.36"
|
|
300
248
|
}
|
|
301
249
|
})
|
|
302
250
|
}));
|