@stripe/connect-js 3.3.55-preview-1 → 3.4.1
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/{types/config.d.ts → components/componentsAndSetters.d.ts} +9 -91
- package/dist/components/componentsAndSettersChecks.d.ts +4 -0
- package/dist/connect.esm.js +27 -128
- package/dist/connect.js +29 -127
- package/dist/exportedTypes/index.d.ts +2 -0
- package/dist/exportedTypes/shared.d.ts +490 -0
- package/dist/index.d.ts +3 -0
- package/dist/init.d.ts +10 -0
- package/dist/pure.d.ts +3 -0
- package/dist/pure.esm.js +19 -120
- package/dist/pure.js +21 -119
- package/dist/utils/scriptUtils.d.ts +3 -0
- package/package.json +3 -3
- package/pure.d.ts +2 -4
- package/{types/config.ts → src/components/componentsAndSetters.ts} +35 -145
- package/{types/checks.ts → src/components/componentsAndSettersChecks.ts} +2 -2
- package/src/exportedTypes/index.ts +4 -0
- package/{types/shared.d.ts → src/exportedTypes/shared.ts} +15 -120
- package/src/index.ts +9 -3
- package/src/{shared.ts → init.ts} +21 -142
- package/src/pure.test.ts +1 -1
- package/src/pure.ts +9 -3
- package/src/utils/scriptUtils.ts +33 -0
- package/dist/src/index.d.ts +0 -2
- package/dist/src/pure.d.ts +0 -2
- package/dist/src/shared.d.ts +0 -15
- package/types/.eslintrc.yml +0 -3
- package/types/index.d.ts +0 -7
- /package/dist/{src/utils → utils}/jestHelpers.d.ts +0 -0
- /package/dist/{src/utils → utils}/jestSetup.d.ts +0 -0
package/dist/pure.esm.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
// Source of truth for the entire list of components. When you add a new component, it should be added here.
|
|
3
|
+
const connectElementTagNames = ["account-onboarding", "disputes-list", "payments", "payment-details", "payment-disputes", "payouts", "payouts-list", "payout-details", "balances", "account-management", "notification-banner", "instant-payouts-promotion", "issuing-card", "issuing-cards-list", "financial-account", "financial-account-transactions", "documents", "tax-registrations", "tax-settings", "balance-report", "payout-reconciliation-report"];
|
|
3
4
|
const ConnectElementCommonMethodConfig = {
|
|
4
5
|
setOnLoadError: _listener => {},
|
|
5
6
|
setOnLoaderStart: _listener => {}
|
|
6
7
|
};
|
|
7
8
|
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
9
|
"account-onboarding": {
|
|
20
10
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
21
11
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -53,49 +43,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
53
43
|
"financial-account-transactions": {
|
|
54
44
|
setFinancialAccount: _financialAccount => {}
|
|
55
45
|
},
|
|
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 => {},
|
|
83
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
46
|
+
payments: {
|
|
47
|
+
setDefaultFilters: _filters => {}
|
|
84
48
|
},
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
89
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
90
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
91
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
92
|
-
setOnApplicationStepChange: _listener => {}
|
|
49
|
+
"payment-details": {
|
|
50
|
+
setPayment: _payment => {},
|
|
51
|
+
setOnClose: _listener => {}
|
|
93
52
|
},
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
setIntervalEnd: _intervalEnd => {},
|
|
98
|
-
setIntervalType: _intervalType => {}
|
|
53
|
+
"payment-disputes": {
|
|
54
|
+
setPayment: _payment => {},
|
|
55
|
+
setOnDisputesLoaded: _listener => {}
|
|
99
56
|
},
|
|
100
57
|
"tax-settings": {
|
|
101
58
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -107,83 +64,20 @@ const ConnectElementCustomMethodConfig = {
|
|
|
107
64
|
setDisplayCountries: _countries => {},
|
|
108
65
|
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
109
66
|
},
|
|
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 => {}
|
|
118
|
-
},
|
|
119
|
-
"export-tax-transactions": {},
|
|
120
67
|
"payout-details": {
|
|
121
68
|
setPayout: _payout => {},
|
|
122
69
|
setOnClose: _listener => {}
|
|
123
70
|
},
|
|
124
|
-
"check-scanning": {
|
|
125
|
-
setHandleCheckScanSubmitted: _handleCheckScanSubmitted => {}
|
|
126
|
-
},
|
|
127
|
-
"agentic-commerce-settings": {
|
|
128
|
-
setOnAgreementUpdated: _listener => {}
|
|
129
|
-
},
|
|
130
|
-
"terminal-hardware-shop": {
|
|
131
|
-
setOnCheckoutFinished: _listener => {}
|
|
132
|
-
},
|
|
133
71
|
"payout-reconciliation-report": {
|
|
134
72
|
setOnReportAvailabilityLoaded: _listener => {}
|
|
135
73
|
}
|
|
136
74
|
};
|
|
137
75
|
|
|
138
|
-
const componentNameMapping = {
|
|
139
|
-
payments: "stripe-connect-payments",
|
|
140
|
-
payouts: "stripe-connect-payouts",
|
|
141
|
-
"payment-details": "stripe-connect-payment-details",
|
|
142
|
-
"payment-disputes": "stripe-connect-payment-disputes",
|
|
143
|
-
"disputes-list": "stripe-connect-disputes-list",
|
|
144
|
-
"account-onboarding": "stripe-connect-account-onboarding",
|
|
145
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
146
|
-
"account-management": "stripe-connect-account-management",
|
|
147
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
148
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
149
|
-
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
150
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
151
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
152
|
-
"financial-account": "stripe-connect-financial-account",
|
|
153
|
-
recipients: "stripe-connect-recipients",
|
|
154
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
155
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
156
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
157
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
158
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
159
|
-
documents: "stripe-connect-documents",
|
|
160
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
161
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
162
|
-
"tax-registrations": "stripe-connect-tax-registrations",
|
|
163
|
-
"tax-settings": "stripe-connect-tax-settings",
|
|
164
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
165
|
-
balances: "stripe-connect-balances",
|
|
166
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
167
|
-
"payout-details": "stripe-connect-payout-details",
|
|
168
|
-
"app-install": "stripe-connect-app-install",
|
|
169
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
170
|
-
"reporting-chart": "stripe-connect-reporting-chart",
|
|
171
|
-
"check-scanning": "stripe-connect-check-scanning",
|
|
172
|
-
"agentic-commerce-settings": "stripe-connect-agentic-commerce-settings",
|
|
173
|
-
"terminal-hardware-orders": "stripe-connect-terminal-hardware-orders",
|
|
174
|
-
"terminal-hardware-shop": "stripe-connect-terminal-hardware-shop",
|
|
175
|
-
"network-cost-passthrough-report": "stripe-connect-network-cost-passthrough-report",
|
|
176
|
-
"balance-report": "stripe-connect-balance-report",
|
|
177
|
-
"payout-reconciliation-report": "stripe-connect-payout-reconciliation-report",
|
|
178
|
-
"recipients-list": "stripe-connect-recipients-list",
|
|
179
|
-
"financial-accounts": "stripe-connect-financial-accounts",
|
|
180
|
-
"financial-accounts-transactions": "stripe-connect-financial-accounts-transactions"
|
|
181
|
-
};
|
|
182
76
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
183
77
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
184
78
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
185
79
|
const findScript = () => {
|
|
186
|
-
return document.querySelectorAll(`script[src="${
|
|
80
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
187
81
|
};
|
|
188
82
|
const injectScript = () => {
|
|
189
83
|
const script = document.createElement("script");
|
|
@@ -195,6 +89,11 @@ const injectScript = () => {
|
|
|
195
89
|
document.head.appendChild(script);
|
|
196
90
|
return script;
|
|
197
91
|
};
|
|
92
|
+
|
|
93
|
+
const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
|
|
94
|
+
acc[name] = `stripe-connect-${name}`;
|
|
95
|
+
return acc;
|
|
96
|
+
}, {});
|
|
198
97
|
let stripePromise = null;
|
|
199
98
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
200
99
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
@@ -274,7 +173,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
274
173
|
element[method] = function (value) {
|
|
275
174
|
stripeConnectInstance.then(() => {
|
|
276
175
|
if (!this[`${method}InternalOnly`]) {
|
|
277
|
-
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.
|
|
176
|
+
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.4.1`);
|
|
278
177
|
}
|
|
279
178
|
this[`${method}InternalOnly`](value);
|
|
280
179
|
});
|
|
@@ -328,7 +227,7 @@ const createWrapper = stripeConnect => {
|
|
|
328
227
|
sdk: true,
|
|
329
228
|
sdkOptions: {
|
|
330
229
|
// This will be replaced by the npm package version when bundling
|
|
331
|
-
sdkVersion: "3.
|
|
230
|
+
sdkVersion: "3.4.1"
|
|
332
231
|
}
|
|
333
232
|
})
|
|
334
233
|
}));
|
|
@@ -346,4 +245,4 @@ const loadConnectAndInitialize = initParams => {
|
|
|
346
245
|
return initStripeConnect(maybeConnect, initParams);
|
|
347
246
|
};
|
|
348
247
|
|
|
349
|
-
export { loadConnectAndInitialize };
|
|
248
|
+
export { ConnectElementCommonMethodConfig, ConnectElementCustomMethodConfig, connectElementTagNames, loadConnectAndInitialize };
|
package/dist/pure.js
CHANGED
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
5
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
// Source of truth for the entire list of components. When you add a new component, it should be added here.
|
|
7
|
+
const connectElementTagNames = ["account-onboarding", "disputes-list", "payments", "payment-details", "payment-disputes", "payouts", "payouts-list", "payout-details", "balances", "account-management", "notification-banner", "instant-payouts-promotion", "issuing-card", "issuing-cards-list", "financial-account", "financial-account-transactions", "documents", "tax-registrations", "tax-settings", "balance-report", "payout-reconciliation-report"];
|
|
7
8
|
const ConnectElementCommonMethodConfig = {
|
|
8
9
|
setOnLoadError: _listener => {},
|
|
9
10
|
setOnLoaderStart: _listener => {}
|
|
10
11
|
};
|
|
11
12
|
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
13
|
"account-onboarding": {
|
|
24
14
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
25
15
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -57,49 +47,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
57
47
|
"financial-account-transactions": {
|
|
58
48
|
setFinancialAccount: _financialAccount => {}
|
|
59
49
|
},
|
|
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 => {},
|
|
87
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
50
|
+
payments: {
|
|
51
|
+
setDefaultFilters: _filters => {}
|
|
88
52
|
},
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
93
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
94
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
95
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
96
|
-
setOnApplicationStepChange: _listener => {}
|
|
53
|
+
"payment-details": {
|
|
54
|
+
setPayment: _payment => {},
|
|
55
|
+
setOnClose: _listener => {}
|
|
97
56
|
},
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setIntervalEnd: _intervalEnd => {},
|
|
102
|
-
setIntervalType: _intervalType => {}
|
|
57
|
+
"payment-disputes": {
|
|
58
|
+
setPayment: _payment => {},
|
|
59
|
+
setOnDisputesLoaded: _listener => {}
|
|
103
60
|
},
|
|
104
61
|
"tax-settings": {
|
|
105
62
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -111,83 +68,20 @@ const ConnectElementCustomMethodConfig = {
|
|
|
111
68
|
setDisplayCountries: _countries => {},
|
|
112
69
|
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
113
70
|
},
|
|
114
|
-
"tax-threshold-monitoring": {
|
|
115
|
-
setDisplayCountries: _countries => {}
|
|
116
|
-
},
|
|
117
|
-
"product-tax-code-selector": {
|
|
118
|
-
setOnTaxCodeSelect: _listener => {},
|
|
119
|
-
setHideDescription: _hideDescription => {},
|
|
120
|
-
setDisabled: _disabled => {},
|
|
121
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
122
|
-
},
|
|
123
|
-
"export-tax-transactions": {},
|
|
124
71
|
"payout-details": {
|
|
125
72
|
setPayout: _payout => {},
|
|
126
73
|
setOnClose: _listener => {}
|
|
127
74
|
},
|
|
128
|
-
"check-scanning": {
|
|
129
|
-
setHandleCheckScanSubmitted: _handleCheckScanSubmitted => {}
|
|
130
|
-
},
|
|
131
|
-
"agentic-commerce-settings": {
|
|
132
|
-
setOnAgreementUpdated: _listener => {}
|
|
133
|
-
},
|
|
134
|
-
"terminal-hardware-shop": {
|
|
135
|
-
setOnCheckoutFinished: _listener => {}
|
|
136
|
-
},
|
|
137
75
|
"payout-reconciliation-report": {
|
|
138
76
|
setOnReportAvailabilityLoaded: _listener => {}
|
|
139
77
|
}
|
|
140
78
|
};
|
|
141
79
|
|
|
142
|
-
const componentNameMapping = {
|
|
143
|
-
payments: "stripe-connect-payments",
|
|
144
|
-
payouts: "stripe-connect-payouts",
|
|
145
|
-
"payment-details": "stripe-connect-payment-details",
|
|
146
|
-
"payment-disputes": "stripe-connect-payment-disputes",
|
|
147
|
-
"disputes-list": "stripe-connect-disputes-list",
|
|
148
|
-
"account-onboarding": "stripe-connect-account-onboarding",
|
|
149
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
150
|
-
"account-management": "stripe-connect-account-management",
|
|
151
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
152
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
153
|
-
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
154
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
155
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
156
|
-
"financial-account": "stripe-connect-financial-account",
|
|
157
|
-
recipients: "stripe-connect-recipients",
|
|
158
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
159
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
160
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
161
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
162
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
163
|
-
documents: "stripe-connect-documents",
|
|
164
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
165
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
166
|
-
"tax-registrations": "stripe-connect-tax-registrations",
|
|
167
|
-
"tax-settings": "stripe-connect-tax-settings",
|
|
168
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
169
|
-
balances: "stripe-connect-balances",
|
|
170
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
171
|
-
"payout-details": "stripe-connect-payout-details",
|
|
172
|
-
"app-install": "stripe-connect-app-install",
|
|
173
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
174
|
-
"reporting-chart": "stripe-connect-reporting-chart",
|
|
175
|
-
"check-scanning": "stripe-connect-check-scanning",
|
|
176
|
-
"agentic-commerce-settings": "stripe-connect-agentic-commerce-settings",
|
|
177
|
-
"terminal-hardware-orders": "stripe-connect-terminal-hardware-orders",
|
|
178
|
-
"terminal-hardware-shop": "stripe-connect-terminal-hardware-shop",
|
|
179
|
-
"network-cost-passthrough-report": "stripe-connect-network-cost-passthrough-report",
|
|
180
|
-
"balance-report": "stripe-connect-balance-report",
|
|
181
|
-
"payout-reconciliation-report": "stripe-connect-payout-reconciliation-report",
|
|
182
|
-
"recipients-list": "stripe-connect-recipients-list",
|
|
183
|
-
"financial-accounts": "stripe-connect-financial-accounts",
|
|
184
|
-
"financial-accounts-transactions": "stripe-connect-financial-accounts-transactions"
|
|
185
|
-
};
|
|
186
80
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
187
81
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
188
82
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
189
83
|
const findScript = () => {
|
|
190
|
-
return document.querySelectorAll(`script[src="${
|
|
84
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
191
85
|
};
|
|
192
86
|
const injectScript = () => {
|
|
193
87
|
const script = document.createElement("script");
|
|
@@ -199,6 +93,11 @@ const injectScript = () => {
|
|
|
199
93
|
document.head.appendChild(script);
|
|
200
94
|
return script;
|
|
201
95
|
};
|
|
96
|
+
|
|
97
|
+
const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
|
|
98
|
+
acc[name] = `stripe-connect-${name}`;
|
|
99
|
+
return acc;
|
|
100
|
+
}, {});
|
|
202
101
|
let stripePromise = null;
|
|
203
102
|
const isWindowStripeConnectDefined = stripeConnect => {
|
|
204
103
|
// We only consider `StripeConnect` defined if `init` is a function
|
|
@@ -278,7 +177,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
278
177
|
element[method] = function (value) {
|
|
279
178
|
stripeConnectInstance.then(() => {
|
|
280
179
|
if (!this[`${method}InternalOnly`]) {
|
|
281
|
-
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.
|
|
180
|
+
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.4.1`);
|
|
282
181
|
}
|
|
283
182
|
this[`${method}InternalOnly`](value);
|
|
284
183
|
});
|
|
@@ -332,7 +231,7 @@ const createWrapper = stripeConnect => {
|
|
|
332
231
|
sdk: true,
|
|
333
232
|
sdkOptions: {
|
|
334
233
|
// This will be replaced by the npm package version when bundling
|
|
335
|
-
sdkVersion: "3.
|
|
234
|
+
sdkVersion: "3.4.1"
|
|
336
235
|
}
|
|
337
236
|
})
|
|
338
237
|
}));
|
|
@@ -350,4 +249,7 @@ const loadConnectAndInitialize = initParams => {
|
|
|
350
249
|
return initStripeConnect(maybeConnect, initParams);
|
|
351
250
|
};
|
|
352
251
|
|
|
252
|
+
exports.ConnectElementCommonMethodConfig = ConnectElementCommonMethodConfig;
|
|
253
|
+
exports.ConnectElementCustomMethodConfig = ConnectElementCustomMethodConfig;
|
|
254
|
+
exports.connectElementTagNames = connectElementTagNames;
|
|
353
255
|
exports.loadConnectAndInitialize = loadConnectAndInitialize;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
2
|
+
export declare const findScript: () => HTMLScriptElement | null;
|
|
3
|
+
export declare const injectScript: () => HTMLScriptElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Connect.js loading utility package (preview version)",
|
|
5
5
|
"main": "dist/connect.js",
|
|
6
6
|
"module": "dist/connect.esm.js",
|
|
@@ -63,13 +63,13 @@
|
|
|
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",
|
|
70
70
|
"typescript": "^4.1.2",
|
|
71
71
|
"yalc": "^1.0.0-pre.53",
|
|
72
|
-
"zx": "^
|
|
72
|
+
"zx": "^8.8.5"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {}
|
|
75
75
|
}
|
package/pure.d.ts
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
2
|
|
|
3
|
+
// Source of truth for the entire list of components. When you add a new component, it should be added here.
|
|
4
|
+
export const connectElementTagNames = [
|
|
5
|
+
"account-onboarding",
|
|
6
|
+
"disputes-list",
|
|
7
|
+
"payments",
|
|
8
|
+
"payment-details",
|
|
9
|
+
"payment-disputes",
|
|
10
|
+
"payouts",
|
|
11
|
+
"payouts-list",
|
|
12
|
+
"payout-details",
|
|
13
|
+
"balances",
|
|
14
|
+
"account-management",
|
|
15
|
+
"notification-banner",
|
|
16
|
+
"instant-payouts-promotion",
|
|
17
|
+
"issuing-card",
|
|
18
|
+
"issuing-cards-list",
|
|
19
|
+
"financial-account",
|
|
20
|
+
"financial-account-transactions",
|
|
21
|
+
"documents",
|
|
22
|
+
"tax-registrations",
|
|
23
|
+
"tax-settings",
|
|
24
|
+
"balance-report",
|
|
25
|
+
"payout-reconciliation-report",
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
// BEGIN: Setter definitions. All setters and their associated types are defined here. When adding a new component, if it has setters, they should be added here as well.
|
|
4
29
|
export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
5
30
|
issuingCard: string;
|
|
6
31
|
nonce: string;
|
|
@@ -141,11 +166,6 @@ export type NotificationCount = {
|
|
|
141
166
|
actionRequired: number;
|
|
142
167
|
};
|
|
143
168
|
|
|
144
|
-
export type InstallState = {
|
|
145
|
-
appId: string;
|
|
146
|
-
state: "INSTALLED" | "UNINSTALLED";
|
|
147
|
-
};
|
|
148
|
-
|
|
149
169
|
export type LoaderStart = {
|
|
150
170
|
elementTagName: string;
|
|
151
171
|
};
|
|
@@ -164,19 +184,6 @@ export type EmbeddedError = {
|
|
|
164
184
|
message?: string;
|
|
165
185
|
};
|
|
166
186
|
|
|
167
|
-
export type FinancingProductType = {
|
|
168
|
-
productType: "standard" | "refill" | "none";
|
|
169
|
-
activeFinancingCount: number;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export type FinancingPromotionLayoutType = "full" | "banner";
|
|
173
|
-
|
|
174
|
-
export type IntervalType = "day" | "week" | "month" | "quarter" | "year";
|
|
175
|
-
|
|
176
|
-
export type ReportName = "gross_volume" | "net_volume";
|
|
177
|
-
|
|
178
|
-
export type RecipientDataSource = "customers";
|
|
179
|
-
|
|
180
187
|
export type EmbeddedErrorType =
|
|
181
188
|
/**
|
|
182
189
|
* Failure to connect to Stripe's API.
|
|
@@ -217,21 +224,6 @@ export const ConnectElementCommonMethodConfig = {
|
|
|
217
224
|
};
|
|
218
225
|
|
|
219
226
|
export const ConnectElementCustomMethodConfig = {
|
|
220
|
-
payments: {
|
|
221
|
-
setDefaultFilters: (
|
|
222
|
-
_filters: PaymentsListDefaultFilters | undefined
|
|
223
|
-
): void => {},
|
|
224
|
-
},
|
|
225
|
-
"payment-details": {
|
|
226
|
-
setPayment: (_payment: string | undefined): void => {},
|
|
227
|
-
setOnClose: (_listener: (() => void) | undefined): void => {},
|
|
228
|
-
},
|
|
229
|
-
"payment-disputes": {
|
|
230
|
-
setPayment: (_payment: string | undefined): void => {},
|
|
231
|
-
setOnDisputesLoaded: (
|
|
232
|
-
_listener: (({ total }: { total: number }) => void) | undefined
|
|
233
|
-
): void => {},
|
|
234
|
-
},
|
|
235
227
|
"account-onboarding": {
|
|
236
228
|
setFullTermsOfServiceUrl: (
|
|
237
229
|
_termOfServiceUrl: string | undefined
|
|
@@ -297,87 +289,21 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
297
289
|
"financial-account-transactions": {
|
|
298
290
|
setFinancialAccount: (_financialAccount: string): void => {},
|
|
299
291
|
},
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
"app-install": {
|
|
304
|
-
setApp: (_app: string | undefined): void => {},
|
|
305
|
-
setOnAppInstallStateFetched: (
|
|
306
|
-
_listener: (({ appId, state }: InstallState) => void) | undefined
|
|
307
|
-
): void => {},
|
|
308
|
-
setOnAppInstallStateChanged: (
|
|
309
|
-
_listener: (({ appId, state }: InstallState) => void) | undefined
|
|
292
|
+
payments: {
|
|
293
|
+
setDefaultFilters: (
|
|
294
|
+
_filters: PaymentsListDefaultFilters | undefined
|
|
310
295
|
): void => {},
|
|
311
296
|
},
|
|
312
|
-
"
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
"payment-method-settings": {
|
|
317
|
-
setPaymentMethodConfiguration: (
|
|
318
|
-
_paymentMethodConfiguration: string | undefined
|
|
319
|
-
): void => {},
|
|
297
|
+
"payment-details": {
|
|
298
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
299
|
+
setOnClose: (_listener: (() => void) | undefined): void => {},
|
|
320
300
|
},
|
|
321
|
-
"
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
): void => {},
|
|
325
|
-
setShowFinancingSelector: (
|
|
326
|
-
_showFinancingSelector: boolean | undefined
|
|
327
|
-
): void => {},
|
|
328
|
-
setHowCapitalWorksUrl: (
|
|
329
|
-
_howCapitalWorksUrl: string | undefined
|
|
330
|
-
): void => {},
|
|
331
|
-
setSupportUrl: (_supportUrl: string | undefined): void => {},
|
|
332
|
-
setOnFinancingsLoaded: (
|
|
301
|
+
"payment-disputes": {
|
|
302
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
303
|
+
setOnDisputesLoaded: (
|
|
333
304
|
_listener: (({ total }: { total: number }) => void) | undefined
|
|
334
305
|
): void => {},
|
|
335
306
|
},
|
|
336
|
-
"capital-financing-application": {
|
|
337
|
-
setOnApplicationSubmitted: (
|
|
338
|
-
_listener: (() => void) | undefined
|
|
339
|
-
): void => {},
|
|
340
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
341
|
-
setHowCapitalWorksUrl: (
|
|
342
|
-
_howCapitalWorksUrl: string | undefined
|
|
343
|
-
): void => {},
|
|
344
|
-
setOnApplicationStepChange: (
|
|
345
|
-
_listener: (({ step }: StepChange) => void) | undefined
|
|
346
|
-
): void => {},
|
|
347
|
-
setDefaultFinancingOffer: (
|
|
348
|
-
_defaultFinancingOffer: string | undefined
|
|
349
|
-
): void => {},
|
|
350
|
-
},
|
|
351
|
-
"capital-financing-promotion": {
|
|
352
|
-
setLayout: (_layout: FinancingPromotionLayoutType | undefined): void => {},
|
|
353
|
-
setOnApplicationSubmitted: (
|
|
354
|
-
_listener: (() => void) | undefined
|
|
355
|
-
): void => {},
|
|
356
|
-
setOnEligibleFinancingOfferLoaded: (
|
|
357
|
-
_listener:
|
|
358
|
-
| (({
|
|
359
|
-
productType,
|
|
360
|
-
activeFinancingCount,
|
|
361
|
-
}: FinancingProductType) => void)
|
|
362
|
-
| undefined
|
|
363
|
-
): void => {},
|
|
364
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
365
|
-
setHowCapitalWorksUrl: (
|
|
366
|
-
_howCapitalWorksUrl: string | undefined
|
|
367
|
-
): void => {},
|
|
368
|
-
setEligibilityCriteriaUrl: (
|
|
369
|
-
_eligibilityCriteriaUrl: string | undefined
|
|
370
|
-
): void => {},
|
|
371
|
-
setOnApplicationStepChange: (
|
|
372
|
-
_listener: (({ step }: StepChange) => void) | undefined
|
|
373
|
-
): void => {},
|
|
374
|
-
},
|
|
375
|
-
"reporting-chart": {
|
|
376
|
-
setReportName: (_reportName: ReportName): void => {},
|
|
377
|
-
setIntervalStart: (_intervalStart: Date | undefined): void => {},
|
|
378
|
-
setIntervalEnd: (_intervalEnd: Date | undefined): void => {},
|
|
379
|
-
setIntervalType: (_intervalType: IntervalType | undefined): void => {},
|
|
380
|
-
},
|
|
381
307
|
"tax-settings": {
|
|
382
308
|
setHideProductTaxCodeSelector: (_hidden: boolean | undefined): void => {},
|
|
383
309
|
setDisplayHeadOfficeCountries: (
|
|
@@ -396,46 +322,10 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
396
322
|
_listener: (({ id }: { id: string }) => void) | undefined
|
|
397
323
|
): void => {},
|
|
398
324
|
},
|
|
399
|
-
"tax-threshold-monitoring": {
|
|
400
|
-
setDisplayCountries: (_countries: string[] | undefined): void => {},
|
|
401
|
-
},
|
|
402
|
-
"product-tax-code-selector": {
|
|
403
|
-
setOnTaxCodeSelect: (
|
|
404
|
-
_listener:
|
|
405
|
-
| ((
|
|
406
|
-
taxCode: string | null,
|
|
407
|
-
_: { analyticsName: string } | null
|
|
408
|
-
) => void)
|
|
409
|
-
| undefined
|
|
410
|
-
): void => {},
|
|
411
|
-
setHideDescription: (_hideDescription: boolean | undefined): void => {},
|
|
412
|
-
setDisabled: (_disabled: boolean | undefined): void => {},
|
|
413
|
-
setInitialTaxCode: (_initialTaxCode: string | undefined): void => {},
|
|
414
|
-
},
|
|
415
|
-
"export-tax-transactions": {},
|
|
416
325
|
"payout-details": {
|
|
417
326
|
setPayout: (_payout: string | undefined): void => {},
|
|
418
327
|
setOnClose: (_listener: (() => void) | undefined): void => {},
|
|
419
328
|
},
|
|
420
|
-
"check-scanning": {
|
|
421
|
-
setHandleCheckScanSubmitted: (
|
|
422
|
-
_handleCheckScanSubmitted: ({
|
|
423
|
-
checkScanToken,
|
|
424
|
-
}: {
|
|
425
|
-
checkScanToken: string;
|
|
426
|
-
}) => Promise<void>
|
|
427
|
-
): void => {},
|
|
428
|
-
},
|
|
429
|
-
"agentic-commerce-settings": {
|
|
430
|
-
setOnAgreementUpdated: (
|
|
431
|
-
_listener:
|
|
432
|
-
| (({ agreementId }: { agreementId: string }) => void)
|
|
433
|
-
| undefined
|
|
434
|
-
): void => {},
|
|
435
|
-
},
|
|
436
|
-
"terminal-hardware-shop": {
|
|
437
|
-
setOnCheckoutFinished: (_listener: (() => void) | undefined): void => {},
|
|
438
|
-
},
|
|
439
329
|
"payout-reconciliation-report": {
|
|
440
330
|
setOnReportAvailabilityLoaded: (
|
|
441
331
|
_listener:
|