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