@stripe/connect-js 3.3.31-preview-1 → 3.3.31
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 +48 -92
- package/dist/connect.js +48 -92
- package/dist/pure.esm.js +40 -84
- package/dist/pure.js +40 -84
- package/dist/src/shared.d.ts +2 -1
- package/dist/types/config.d.ts +27 -72
- package/package.json +2 -2
- package/src/shared.ts +40 -44
- package/types/config.ts +32 -110
- package/types/shared.d.ts +9 -18
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,56 +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
|
-
"
|
|
78
|
+
payouts: "stripe-connect-payouts",
|
|
79
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
80
|
+
"payout-details": "stripe-connect-payout-details",
|
|
81
|
+
balances: "stripe-connect-balances",
|
|
121
82
|
"account-management": "stripe-connect-account-management",
|
|
122
83
|
"notification-banner": "stripe-connect-notification-banner",
|
|
123
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
84
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
124
85
|
"issuing-card": "stripe-connect-issuing-card",
|
|
125
86
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
126
87
|
"financial-account": "stripe-connect-financial-account",
|
|
127
|
-
recipients: "stripe-connect-recipients",
|
|
128
88
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
129
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
130
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
131
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
132
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
133
89
|
documents: "stripe-connect-documents",
|
|
134
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
135
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
136
90
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
137
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
138
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
139
|
-
balances: "stripe-connect-balances",
|
|
140
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
141
|
-
"app-install": "stripe-connect-app-install",
|
|
142
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
143
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
91
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
144
92
|
};
|
|
145
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";
|
|
146
94
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
147
95
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
148
96
|
const findScript = () => {
|
|
149
|
-
return document.querySelectorAll(`script[src="${
|
|
97
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
150
98
|
};
|
|
151
99
|
const injectScript = () => {
|
|
152
100
|
const script = document.createElement("script");
|
|
@@ -159,6 +107,13 @@ const injectScript = () => {
|
|
|
159
107
|
return script;
|
|
160
108
|
};
|
|
161
109
|
let stripePromise = null;
|
|
110
|
+
const isWindowStripeConnectDefined = stripeConnect => {
|
|
111
|
+
// We only consider `StripeConnect` defined if `init` is a function
|
|
112
|
+
// Why? HTML markup like:
|
|
113
|
+
// <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
|
|
114
|
+
// can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
|
|
115
|
+
return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
|
|
116
|
+
};
|
|
162
117
|
const loadScript = () => {
|
|
163
118
|
// Ensure that we only attempt to load Connect.js at most once
|
|
164
119
|
if (stripePromise !== null) {
|
|
@@ -169,10 +124,8 @@ const loadScript = () => {
|
|
|
169
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.");
|
|
170
125
|
return;
|
|
171
126
|
}
|
|
172
|
-
if (window.StripeConnect) {
|
|
127
|
+
if (isWindowStripeConnectDefined(window.StripeConnect)) {
|
|
173
128
|
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
174
|
-
}
|
|
175
|
-
if (window.StripeConnect) {
|
|
176
129
|
const wrapper = createWrapper(window.StripeConnect);
|
|
177
130
|
resolve(wrapper);
|
|
178
131
|
return;
|
|
@@ -185,7 +138,7 @@ const loadScript = () => {
|
|
|
185
138
|
script = injectScript();
|
|
186
139
|
}
|
|
187
140
|
script.addEventListener("load", () => {
|
|
188
|
-
if (window.StripeConnect) {
|
|
141
|
+
if (isWindowStripeConnectDefined(window.StripeConnect)) {
|
|
189
142
|
const wrapper = createWrapper(window.StripeConnect);
|
|
190
143
|
resolve(wrapper);
|
|
191
144
|
} else {
|
|
@@ -231,6 +184,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
231
184
|
for (const method in methods) {
|
|
232
185
|
element[method] = function (value) {
|
|
233
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.31`);
|
|
189
|
+
}
|
|
234
190
|
this[`${method}InternalOnly`](value);
|
|
235
191
|
});
|
|
236
192
|
};
|
|
@@ -283,7 +239,7 @@ const createWrapper = stripeConnect => {
|
|
|
283
239
|
sdk: true,
|
|
284
240
|
sdkOptions: {
|
|
285
241
|
// This will be replaced by the npm package version when bundling
|
|
286
|
-
sdkVersion: "3.3.31
|
|
242
|
+
sdkVersion: "3.3.31"
|
|
287
243
|
}
|
|
288
244
|
})
|
|
289
245
|
}));
|
package/dist/pure.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,56 +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
|
-
"
|
|
82
|
+
payouts: "stripe-connect-payouts",
|
|
83
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
84
|
+
"payout-details": "stripe-connect-payout-details",
|
|
85
|
+
balances: "stripe-connect-balances",
|
|
125
86
|
"account-management": "stripe-connect-account-management",
|
|
126
87
|
"notification-banner": "stripe-connect-notification-banner",
|
|
127
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
88
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
128
89
|
"issuing-card": "stripe-connect-issuing-card",
|
|
129
90
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
130
91
|
"financial-account": "stripe-connect-financial-account",
|
|
131
|
-
recipients: "stripe-connect-recipients",
|
|
132
92
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
133
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
134
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
135
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
136
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
137
93
|
documents: "stripe-connect-documents",
|
|
138
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
139
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
140
94
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
141
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
142
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
143
|
-
balances: "stripe-connect-balances",
|
|
144
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
145
|
-
"app-install": "stripe-connect-app-install",
|
|
146
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
147
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
148
96
|
};
|
|
149
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";
|
|
150
98
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
151
99
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
152
100
|
const findScript = () => {
|
|
153
|
-
return document.querySelectorAll(`script[src="${
|
|
101
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
154
102
|
};
|
|
155
103
|
const injectScript = () => {
|
|
156
104
|
const script = document.createElement("script");
|
|
@@ -163,6 +111,13 @@ const injectScript = () => {
|
|
|
163
111
|
return script;
|
|
164
112
|
};
|
|
165
113
|
let stripePromise = null;
|
|
114
|
+
const isWindowStripeConnectDefined = stripeConnect => {
|
|
115
|
+
// We only consider `StripeConnect` defined if `init` is a function
|
|
116
|
+
// Why? HTML markup like:
|
|
117
|
+
// <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
|
|
118
|
+
// can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
|
|
119
|
+
return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
|
|
120
|
+
};
|
|
166
121
|
const loadScript = () => {
|
|
167
122
|
// Ensure that we only attempt to load Connect.js at most once
|
|
168
123
|
if (stripePromise !== null) {
|
|
@@ -173,10 +128,8 @@ const loadScript = () => {
|
|
|
173
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.");
|
|
174
129
|
return;
|
|
175
130
|
}
|
|
176
|
-
if (window.StripeConnect) {
|
|
131
|
+
if (isWindowStripeConnectDefined(window.StripeConnect)) {
|
|
177
132
|
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
178
|
-
}
|
|
179
|
-
if (window.StripeConnect) {
|
|
180
133
|
const wrapper = createWrapper(window.StripeConnect);
|
|
181
134
|
resolve(wrapper);
|
|
182
135
|
return;
|
|
@@ -189,7 +142,7 @@ const loadScript = () => {
|
|
|
189
142
|
script = injectScript();
|
|
190
143
|
}
|
|
191
144
|
script.addEventListener("load", () => {
|
|
192
|
-
if (window.StripeConnect) {
|
|
145
|
+
if (isWindowStripeConnectDefined(window.StripeConnect)) {
|
|
193
146
|
const wrapper = createWrapper(window.StripeConnect);
|
|
194
147
|
resolve(wrapper);
|
|
195
148
|
} else {
|
|
@@ -235,6 +188,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
235
188
|
for (const method in methods) {
|
|
236
189
|
element[method] = function (value) {
|
|
237
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.31`);
|
|
193
|
+
}
|
|
238
194
|
this[`${method}InternalOnly`](value);
|
|
239
195
|
});
|
|
240
196
|
};
|
|
@@ -287,7 +243,7 @@ const createWrapper = stripeConnect => {
|
|
|
287
243
|
sdk: true,
|
|
288
244
|
sdkOptions: {
|
|
289
245
|
// This will be replaced by the npm package version when bundling
|
|
290
|
-
sdkVersion: "3.3.31
|
|
246
|
+
sdkVersion: "3.3.31"
|
|
291
247
|
}
|
|
292
248
|
})
|
|
293
249
|
}));
|
package/dist/src/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
2
2
|
export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
|
-
|
|
3
|
+
type ConnectElementHTMLName = "stripe-connect-account-onboarding" | "stripe-connect-disputes-list" | "stripe-connect-payments" | "stripe-connect-payment-details" | "stripe-connect-payment-disputes" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-instant-payouts-promotion" | "stripe-connect-issuing-card" | "stripe-connect-issuing-cards-list" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-payouts" | "stripe-connect-payouts-list" | "stripe-connect-payout-details" | "stripe-connect-balances" | "stripe-connect-documents" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings";
|
|
4
4
|
export declare const componentNameMapping: Record<ConnectElementTagName, ConnectElementHTMLName>;
|
|
5
5
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
6
6
|
debugInstance: () => Promise<StripeConnectInstance>;
|
|
@@ -9,6 +9,7 @@ interface StripeConnectWrapper {
|
|
|
9
9
|
initialize: (params: IStripeConnectInitParams) => StripeConnectInstance;
|
|
10
10
|
}
|
|
11
11
|
export declare const findScript: () => HTMLScriptElement | null;
|
|
12
|
+
export declare const isWindowStripeConnectDefined: (stripeConnect: unknown) => boolean;
|
|
12
13
|
export declare const loadScript: () => Promise<StripeConnectWrapper>;
|
|
13
14
|
export declare const initStripeConnect: (stripePromise: Promise<StripeConnectWrapper>, initParams: IStripeConnectInitParams) => StripeConnectInstanceExtended;
|
|
14
15
|
export {};
|
package/dist/types/config.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
|
9
9
|
export type CollectionOptions = {
|
|
10
10
|
fields: "currently_due" | "eventually_due";
|
|
11
11
|
futureRequirements?: "omit" | "include";
|
|
12
|
+
requirements?: {
|
|
13
|
+
only: string[];
|
|
14
|
+
} | {
|
|
15
|
+
exclude: string[];
|
|
16
|
+
};
|
|
12
17
|
};
|
|
13
18
|
export type Status = "blocked" | "canceled" | "disputed" | "early_fraud_warning" | "failed" | "incomplete" | "partially_refunded" | "pending" | "refund_pending" | "refunded" | "successful" | "uncaptured";
|
|
14
19
|
export type PaymentMethod = "ach_credit_transfer" | "ach_debit" | "acss_debit" | "affirm" | "afterpay_clearpay" | "alipay" | "alma" | "amazon_pay" | "amex_express_checkout" | "android_pay" | "apple_pay" | "au_becs_debit" | "nz_bank_account" | "bancontact" | "bacs_debit" | "bitcoin_source" | "bitcoin" | "blik" | "boleto" | "boleto_pilot" | "card_present" | "card" | "cashapp" | "crypto" | "customer_balance" | "demo_pay" | "dummy_passthrough_card" | "gbp_credit_transfer" | "google_pay" | "eps" | "fpx" | "giropay" | "grabpay" | "ideal" | "id_bank_transfer" | "id_credit_transfer" | "jp_credit_transfer" | "interac_present" | "kakao_pay" | "klarna" | "konbini" | "kr_card" | "kr_market" | "link" | "masterpass" | "mb_way" | "meta_pay" | "multibanco" | "mobilepay" | "naver_pay" | "netbanking" | "ng_bank" | "ng_bank_transfer" | "ng_card" | "ng_market" | "ng_ussd" | "vipps" | "oxxo" | "p24" | "payto" | "pay_by_bank" | "paper_check" | "payco" | "paynow" | "paypal" | "pix" | "promptpay" | "revolut_pay" | "samsung_pay" | "sepa_credit_transfer" | "sepa_debit" | "sofort" | "south_korea_market" | "swish" | "three_d_secure" | "three_d_secure_2" | "three_d_secure_2_eap" | "twint" | "upi" | "us_bank_account" | "visa_checkout" | "wechat" | "wechat_pay" | "zip";
|
|
@@ -42,10 +47,6 @@ export type NotificationCount = {
|
|
|
42
47
|
total: number;
|
|
43
48
|
actionRequired: number;
|
|
44
49
|
};
|
|
45
|
-
export type InstallState = {
|
|
46
|
-
appId: string;
|
|
47
|
-
state: "INSTALLED" | "UNINSTALLED";
|
|
48
|
-
};
|
|
49
50
|
export type LoaderStart = {
|
|
50
51
|
elementTagName: string;
|
|
51
52
|
};
|
|
@@ -60,14 +61,6 @@ export type EmbeddedError = {
|
|
|
60
61
|
type: EmbeddedErrorType;
|
|
61
62
|
message?: string;
|
|
62
63
|
};
|
|
63
|
-
export type FinancingProductType = {
|
|
64
|
-
productType: "standard" | "refill" | "none";
|
|
65
|
-
activeFinancingCount: number;
|
|
66
|
-
};
|
|
67
|
-
export type FinancingPromotionLayoutType = "full" | "banner";
|
|
68
|
-
export type IntervalType = "day" | "week" | "month" | "quarter" | "year";
|
|
69
|
-
export type ReportName = "gross_volume" | "net_volume";
|
|
70
|
-
export type RecipientDataSource = "customers";
|
|
71
64
|
export type EmbeddedErrorType =
|
|
72
65
|
/**
|
|
73
66
|
* Failure to connect to Stripe's API.
|
|
@@ -98,19 +91,6 @@ export declare const ConnectElementCommonMethodConfig: {
|
|
|
98
91
|
setOnLoaderStart: (_listener: (({ elementTagName }: LoaderStart) => void) | undefined) => void;
|
|
99
92
|
};
|
|
100
93
|
export declare const ConnectElementCustomMethodConfig: {
|
|
101
|
-
payments: {
|
|
102
|
-
setDefaultFilters: (_filters: PaymentsListDefaultFilters | undefined) => void;
|
|
103
|
-
};
|
|
104
|
-
"payment-details": {
|
|
105
|
-
setPayment: (_payment: string | undefined) => void;
|
|
106
|
-
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
107
|
-
};
|
|
108
|
-
"payment-disputes": {
|
|
109
|
-
setPayment: (_payment: string | undefined) => void;
|
|
110
|
-
setOnDisputesLoaded: (_listener: (({ total }: {
|
|
111
|
-
total: number;
|
|
112
|
-
}) => void) | undefined) => void;
|
|
113
|
-
};
|
|
114
94
|
"account-onboarding": {
|
|
115
95
|
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
116
96
|
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
@@ -127,6 +107,14 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
127
107
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
128
108
|
setOnNotificationsChange: (_listener: (({ total, actionRequired }: NotificationCount) => void) | undefined) => void;
|
|
129
109
|
};
|
|
110
|
+
"instant-payouts-promotion": {
|
|
111
|
+
setOnInstantPayoutsPromotionLoaded: (_listener: (({ promotionShown }: {
|
|
112
|
+
promotionShown: boolean;
|
|
113
|
+
}) => void) | undefined) => void;
|
|
114
|
+
setOnInstantPayoutCreated: (_listener: (({ payoutId }: {
|
|
115
|
+
payoutId: string;
|
|
116
|
+
}) => void) | undefined) => void;
|
|
117
|
+
};
|
|
130
118
|
"issuing-card": {
|
|
131
119
|
setDefaultCard: (_defaultCard: string | undefined) => void;
|
|
132
120
|
setCardSwitching: (_cardSwitching: boolean | undefined) => void;
|
|
@@ -144,49 +132,19 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
144
132
|
"financial-account-transactions": {
|
|
145
133
|
setFinancialAccount: (_financialAccount: string) => void;
|
|
146
134
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
"app-install": {
|
|
151
|
-
setApp: (_app: string | undefined) => void;
|
|
152
|
-
setOnAppInstallStateFetched: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
153
|
-
setOnAppInstallStateChanged: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
154
|
-
};
|
|
155
|
-
"app-viewport": {
|
|
156
|
-
setApp: (_app: string | undefined) => void;
|
|
157
|
-
setAppData: (_appData: Record<string, string> | undefined) => void;
|
|
135
|
+
payments: {
|
|
136
|
+
setDefaultFilters: (_filters: PaymentsListDefaultFilters | undefined) => void;
|
|
158
137
|
};
|
|
159
|
-
"payment-
|
|
160
|
-
|
|
138
|
+
"payment-details": {
|
|
139
|
+
setPayment: (_payment: string | undefined) => void;
|
|
140
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
161
141
|
};
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
166
|
-
setSupportUrl: (_supportUrl: string | undefined) => void;
|
|
167
|
-
setOnFinancingsLoaded: (_listener: (({ total }: {
|
|
142
|
+
"payment-disputes": {
|
|
143
|
+
setPayment: (_payment: string | undefined) => void;
|
|
144
|
+
setOnDisputesLoaded: (_listener: (({ total }: {
|
|
168
145
|
total: number;
|
|
169
146
|
}) => void) | undefined) => void;
|
|
170
147
|
};
|
|
171
|
-
"capital-financing-application": {
|
|
172
|
-
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
173
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
174
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
175
|
-
};
|
|
176
|
-
"capital-financing-promotion": {
|
|
177
|
-
setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
|
|
178
|
-
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
179
|
-
setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount, }: FinancingProductType) => void) | undefined) => void;
|
|
180
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
181
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
182
|
-
setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
|
|
183
|
-
};
|
|
184
|
-
"reporting-chart": {
|
|
185
|
-
setReportName: (_reportName: ReportName) => void;
|
|
186
|
-
setIntervalStart: (_intervalStart: Date | undefined) => void;
|
|
187
|
-
setIntervalEnd: (_intervalEnd: Date | undefined) => void;
|
|
188
|
-
setIntervalType: (_intervalType: IntervalType | undefined) => void;
|
|
189
|
-
};
|
|
190
148
|
"tax-settings": {
|
|
191
149
|
setHideProductTaxCodeSelector: (_hidden: boolean | undefined) => void;
|
|
192
150
|
setDisplayHeadOfficeCountries: (_countries: string[] | undefined) => void;
|
|
@@ -199,15 +157,12 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
199
157
|
id: string;
|
|
200
158
|
}) => void) | undefined) => void;
|
|
201
159
|
setDisplayCountries: (_countries: string[] | undefined) => void;
|
|
160
|
+
setOnAfterTaxRegistrationExpired: (_listener: (({ id }: {
|
|
161
|
+
id: string;
|
|
162
|
+
}) => void) | undefined) => void;
|
|
202
163
|
};
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"product-tax-code-selector": {
|
|
207
|
-
setOnTaxCodeSelect: (_listener: ((taxCode: string) => void) | undefined) => void;
|
|
208
|
-
setHideDescription: (_hideDescription: boolean | undefined) => void;
|
|
209
|
-
setDisabled: (_disabled: boolean | undefined) => void;
|
|
210
|
-
setInitialTaxCode: (_initialTaxCode: string | undefined) => void;
|
|
164
|
+
"payout-details": {
|
|
165
|
+
setPayout: (_payout: string | undefined) => void;
|
|
166
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
211
167
|
};
|
|
212
|
-
"export-tax-transactions": {};
|
|
213
168
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.3.31
|
|
3
|
+
"version": "3.3.31",
|
|
4
4
|
"description": "Connect.js loading utility package",
|
|
5
5
|
"main": "dist/connect.js",
|
|
6
6
|
"module": "dist/connect.esm.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"jest-environment-jsdom": "^29.5.0",
|
|
64
64
|
"prettier": "2.8.8",
|
|
65
65
|
"rimraf": "^2.6.2",
|
|
66
|
-
"rollup": "^
|
|
66
|
+
"rollup": "^2.79.2",
|
|
67
67
|
"rollup-plugin-babel": "^4.4.0",
|
|
68
68
|
"rollup-plugin-typescript2": "^0.25.3",
|
|
69
69
|
"ts-jest": "^29.1.0",
|