@stripe/connect-js 3.3.13-beta-1 → 3.3.13
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/README.md +2 -3
- package/dist/connect.esm.js +24 -54
- package/dist/connect.js +24 -54
- package/dist/pure.esm.js +24 -54
- package/dist/pure.js +24 -54
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +46 -39
- package/package.json +1 -1
- package/src/shared.ts +27 -42
- package/types/config.ts +58 -49
- package/types/shared.d.ts +13 -17
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Calling `loadConnectAndInitialize` always loads the latest version of Connect.js
|
|
|
7
7
|
|
|
8
8
|
The embedded onboarding component is generally available now. Please refer to our [documentation](https://stripe.com/docs/connect/supported-embedded-components#account-onboarding) for more information.
|
|
9
9
|
|
|
10
|
-
Note:
|
|
10
|
+
Note: Some Connect embedded components are currently still in preview. These can be [viewed on our doc site](https://docs.stripe.com/connect/supported-embedded-components), where you can also request preview access.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -20,8 +20,7 @@ npm install @stripe/connect-js
|
|
|
20
20
|
## Documentation
|
|
21
21
|
|
|
22
22
|
- [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
|
|
23
|
-
- [Quickstart guide
|
|
24
|
-
- [Quickstart guide for beta](https://stripe.com/docs/connect/connect-embedded-components/beta-quickstart)
|
|
23
|
+
- [Quickstart guide](https://stripe.com/docs/connect/connect-embedded-components/quickstart)
|
|
25
24
|
|
|
26
25
|
## Usage
|
|
27
26
|
|
package/dist/connect.esm.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
const ConnectElementCommonMethodConfig = {
|
|
4
|
+
setOnLoadError: _listener => {},
|
|
5
|
+
setOnLoaderStart: _listener => {}
|
|
6
|
+
};
|
|
3
7
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: _payment => {},
|
|
6
|
-
setOnClose: _listener => {}
|
|
7
|
-
},
|
|
8
8
|
"account-onboarding": {
|
|
9
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
11
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
12
|
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
13
|
setCollectionOptions: _collectionOptions => {},
|
|
14
|
-
setOnExit: _listener => {}
|
|
14
|
+
setOnExit: _listener => {},
|
|
15
|
+
setOnStepChange: _listener => {}
|
|
15
16
|
},
|
|
16
17
|
"account-management": {
|
|
17
18
|
setCollectionOptions: _collectionOptions => {}
|
|
@@ -20,60 +21,30 @@ const ConnectElementCustomMethodConfig = {
|
|
|
20
21
|
setCollectionOptions: _collectionOptions => {},
|
|
21
22
|
setOnNotificationsChange: _listener => {}
|
|
22
23
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setCardSwitching: _cardSwitching => {},
|
|
27
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
28
|
-
},
|
|
29
|
-
"issuing-cards-list": {
|
|
30
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
31
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
32
|
-
},
|
|
33
|
-
"financial-account": {
|
|
34
|
-
setFinancialAccount: _financialAccount => {}
|
|
35
|
-
},
|
|
36
|
-
"financial-account-transactions": {
|
|
37
|
-
setFinancialAccount: _financialAccount => {}
|
|
38
|
-
},
|
|
39
|
-
"app-install": {
|
|
40
|
-
setApp: _app => {},
|
|
41
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
42
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
43
|
-
},
|
|
44
|
-
"app-viewport": {
|
|
45
|
-
setApp: _app => {},
|
|
46
|
-
setAppData: _appData => {}
|
|
24
|
+
"payment-details": {
|
|
25
|
+
setPayment: _payment => {},
|
|
26
|
+
setOnClose: _listener => {}
|
|
47
27
|
}
|
|
48
28
|
};
|
|
49
29
|
|
|
50
30
|
const componentNameMapping = {
|
|
31
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
51
32
|
payments: "stripe-connect-payments",
|
|
52
|
-
payouts: "stripe-connect-payouts",
|
|
53
33
|
"payment-details": "stripe-connect-payment-details",
|
|
54
|
-
|
|
55
|
-
"
|
|
34
|
+
payouts: "stripe-connect-payouts",
|
|
35
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
36
|
+
balances: "stripe-connect-balances",
|
|
56
37
|
"account-management": "stripe-connect-account-management",
|
|
57
38
|
"notification-banner": "stripe-connect-notification-banner",
|
|
58
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
59
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
60
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
61
|
-
"financial-account": "stripe-connect-financial-account",
|
|
62
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
63
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
64
39
|
documents: "stripe-connect-documents",
|
|
65
40
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
66
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
67
|
-
balances: "stripe-connect-balances",
|
|
68
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
69
|
-
"app-install": "stripe-connect-app-install",
|
|
70
|
-
"app-viewport": "stripe-connect-app-viewport"
|
|
41
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
71
42
|
};
|
|
72
43
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
73
44
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
74
45
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
75
46
|
const findScript = () => {
|
|
76
|
-
return document.querySelectorAll(`script[src="${
|
|
47
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
77
48
|
};
|
|
78
49
|
const injectScript = () => {
|
|
79
50
|
const script = document.createElement("script");
|
|
@@ -153,15 +124,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
153
124
|
htmlName = tagName;
|
|
154
125
|
}
|
|
155
126
|
const element = document.createElement(htmlName);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
127
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
128
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
129
|
+
for (const method in methods) {
|
|
130
|
+
element[method] = function (value) {
|
|
131
|
+
stripeConnectInstance.then(() => {
|
|
132
|
+
this[`${method}InternalOnly`](value);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
165
135
|
}
|
|
166
136
|
stripeConnectInstance.then(instance => {
|
|
167
137
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -211,7 +181,7 @@ const createWrapper = stripeConnect => {
|
|
|
211
181
|
sdk: true,
|
|
212
182
|
sdkOptions: {
|
|
213
183
|
// This will be replaced by the npm package version when bundling
|
|
214
|
-
sdkVersion: "3.3.13
|
|
184
|
+
sdkVersion: "3.3.13"
|
|
215
185
|
}
|
|
216
186
|
})
|
|
217
187
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -4,18 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
|
+
const ConnectElementCommonMethodConfig = {
|
|
8
|
+
setOnLoadError: _listener => {},
|
|
9
|
+
setOnLoaderStart: _listener => {}
|
|
10
|
+
};
|
|
7
11
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: _payment => {},
|
|
10
|
-
setOnClose: _listener => {}
|
|
11
|
-
},
|
|
12
12
|
"account-onboarding": {
|
|
13
13
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
14
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
15
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
16
|
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
17
|
setCollectionOptions: _collectionOptions => {},
|
|
18
|
-
setOnExit: _listener => {}
|
|
18
|
+
setOnExit: _listener => {},
|
|
19
|
+
setOnStepChange: _listener => {}
|
|
19
20
|
},
|
|
20
21
|
"account-management": {
|
|
21
22
|
setCollectionOptions: _collectionOptions => {}
|
|
@@ -24,60 +25,30 @@ const ConnectElementCustomMethodConfig = {
|
|
|
24
25
|
setCollectionOptions: _collectionOptions => {},
|
|
25
26
|
setOnNotificationsChange: _listener => {}
|
|
26
27
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
setCardSwitching: _cardSwitching => {},
|
|
31
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
32
|
-
},
|
|
33
|
-
"issuing-cards-list": {
|
|
34
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
35
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
36
|
-
},
|
|
37
|
-
"financial-account": {
|
|
38
|
-
setFinancialAccount: _financialAccount => {}
|
|
39
|
-
},
|
|
40
|
-
"financial-account-transactions": {
|
|
41
|
-
setFinancialAccount: _financialAccount => {}
|
|
42
|
-
},
|
|
43
|
-
"app-install": {
|
|
44
|
-
setApp: _app => {},
|
|
45
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
46
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
47
|
-
},
|
|
48
|
-
"app-viewport": {
|
|
49
|
-
setApp: _app => {},
|
|
50
|
-
setAppData: _appData => {}
|
|
28
|
+
"payment-details": {
|
|
29
|
+
setPayment: _payment => {},
|
|
30
|
+
setOnClose: _listener => {}
|
|
51
31
|
}
|
|
52
32
|
};
|
|
53
33
|
|
|
54
34
|
const componentNameMapping = {
|
|
35
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
55
36
|
payments: "stripe-connect-payments",
|
|
56
|
-
payouts: "stripe-connect-payouts",
|
|
57
37
|
"payment-details": "stripe-connect-payment-details",
|
|
58
|
-
|
|
59
|
-
"
|
|
38
|
+
payouts: "stripe-connect-payouts",
|
|
39
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
40
|
+
balances: "stripe-connect-balances",
|
|
60
41
|
"account-management": "stripe-connect-account-management",
|
|
61
42
|
"notification-banner": "stripe-connect-notification-banner",
|
|
62
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
63
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
64
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
65
|
-
"financial-account": "stripe-connect-financial-account",
|
|
66
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
67
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
68
43
|
documents: "stripe-connect-documents",
|
|
69
44
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
70
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
71
|
-
balances: "stripe-connect-balances",
|
|
72
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
73
|
-
"app-install": "stripe-connect-app-install",
|
|
74
|
-
"app-viewport": "stripe-connect-app-viewport"
|
|
45
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
75
46
|
};
|
|
76
47
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
77
48
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
78
49
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
79
50
|
const findScript = () => {
|
|
80
|
-
return document.querySelectorAll(`script[src="${
|
|
51
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
81
52
|
};
|
|
82
53
|
const injectScript = () => {
|
|
83
54
|
const script = document.createElement("script");
|
|
@@ -157,15 +128,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
157
128
|
htmlName = tagName;
|
|
158
129
|
}
|
|
159
130
|
const element = document.createElement(htmlName);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
131
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
132
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
133
|
+
for (const method in methods) {
|
|
134
|
+
element[method] = function (value) {
|
|
135
|
+
stripeConnectInstance.then(() => {
|
|
136
|
+
this[`${method}InternalOnly`](value);
|
|
137
|
+
});
|
|
138
|
+
};
|
|
169
139
|
}
|
|
170
140
|
stripeConnectInstance.then(instance => {
|
|
171
141
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -215,7 +185,7 @@ const createWrapper = stripeConnect => {
|
|
|
215
185
|
sdk: true,
|
|
216
186
|
sdkOptions: {
|
|
217
187
|
// This will be replaced by the npm package version when bundling
|
|
218
|
-
sdkVersion: "3.3.13
|
|
188
|
+
sdkVersion: "3.3.13"
|
|
219
189
|
}
|
|
220
190
|
})
|
|
221
191
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
const ConnectElementCommonMethodConfig = {
|
|
4
|
+
setOnLoadError: _listener => {},
|
|
5
|
+
setOnLoaderStart: _listener => {}
|
|
6
|
+
};
|
|
3
7
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: _payment => {},
|
|
6
|
-
setOnClose: _listener => {}
|
|
7
|
-
},
|
|
8
8
|
"account-onboarding": {
|
|
9
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
11
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
12
|
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
13
|
setCollectionOptions: _collectionOptions => {},
|
|
14
|
-
setOnExit: _listener => {}
|
|
14
|
+
setOnExit: _listener => {},
|
|
15
|
+
setOnStepChange: _listener => {}
|
|
15
16
|
},
|
|
16
17
|
"account-management": {
|
|
17
18
|
setCollectionOptions: _collectionOptions => {}
|
|
@@ -20,60 +21,30 @@ const ConnectElementCustomMethodConfig = {
|
|
|
20
21
|
setCollectionOptions: _collectionOptions => {},
|
|
21
22
|
setOnNotificationsChange: _listener => {}
|
|
22
23
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setCardSwitching: _cardSwitching => {},
|
|
27
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
28
|
-
},
|
|
29
|
-
"issuing-cards-list": {
|
|
30
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
31
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
32
|
-
},
|
|
33
|
-
"financial-account": {
|
|
34
|
-
setFinancialAccount: _financialAccount => {}
|
|
35
|
-
},
|
|
36
|
-
"financial-account-transactions": {
|
|
37
|
-
setFinancialAccount: _financialAccount => {}
|
|
38
|
-
},
|
|
39
|
-
"app-install": {
|
|
40
|
-
setApp: _app => {},
|
|
41
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
42
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
43
|
-
},
|
|
44
|
-
"app-viewport": {
|
|
45
|
-
setApp: _app => {},
|
|
46
|
-
setAppData: _appData => {}
|
|
24
|
+
"payment-details": {
|
|
25
|
+
setPayment: _payment => {},
|
|
26
|
+
setOnClose: _listener => {}
|
|
47
27
|
}
|
|
48
28
|
};
|
|
49
29
|
|
|
50
30
|
const componentNameMapping = {
|
|
31
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
51
32
|
payments: "stripe-connect-payments",
|
|
52
|
-
payouts: "stripe-connect-payouts",
|
|
53
33
|
"payment-details": "stripe-connect-payment-details",
|
|
54
|
-
|
|
55
|
-
"
|
|
34
|
+
payouts: "stripe-connect-payouts",
|
|
35
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
36
|
+
balances: "stripe-connect-balances",
|
|
56
37
|
"account-management": "stripe-connect-account-management",
|
|
57
38
|
"notification-banner": "stripe-connect-notification-banner",
|
|
58
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
59
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
60
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
61
|
-
"financial-account": "stripe-connect-financial-account",
|
|
62
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
63
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
64
39
|
documents: "stripe-connect-documents",
|
|
65
40
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
66
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
67
|
-
balances: "stripe-connect-balances",
|
|
68
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
69
|
-
"app-install": "stripe-connect-app-install",
|
|
70
|
-
"app-viewport": "stripe-connect-app-viewport"
|
|
41
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
71
42
|
};
|
|
72
43
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
73
44
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
74
45
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
75
46
|
const findScript = () => {
|
|
76
|
-
return document.querySelectorAll(`script[src="${
|
|
47
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
77
48
|
};
|
|
78
49
|
const injectScript = () => {
|
|
79
50
|
const script = document.createElement("script");
|
|
@@ -153,15 +124,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
153
124
|
htmlName = tagName;
|
|
154
125
|
}
|
|
155
126
|
const element = document.createElement(htmlName);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
127
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
128
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
129
|
+
for (const method in methods) {
|
|
130
|
+
element[method] = function (value) {
|
|
131
|
+
stripeConnectInstance.then(() => {
|
|
132
|
+
this[`${method}InternalOnly`](value);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
165
135
|
}
|
|
166
136
|
stripeConnectInstance.then(instance => {
|
|
167
137
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -211,7 +181,7 @@ const createWrapper = stripeConnect => {
|
|
|
211
181
|
sdk: true,
|
|
212
182
|
sdkOptions: {
|
|
213
183
|
// This will be replaced by the npm package version when bundling
|
|
214
|
-
sdkVersion: "3.3.13
|
|
184
|
+
sdkVersion: "3.3.13"
|
|
215
185
|
}
|
|
216
186
|
})
|
|
217
187
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -4,18 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
|
+
const ConnectElementCommonMethodConfig = {
|
|
8
|
+
setOnLoadError: _listener => {},
|
|
9
|
+
setOnLoaderStart: _listener => {}
|
|
10
|
+
};
|
|
7
11
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: _payment => {},
|
|
10
|
-
setOnClose: _listener => {}
|
|
11
|
-
},
|
|
12
12
|
"account-onboarding": {
|
|
13
13
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
14
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
15
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
16
|
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
17
|
setCollectionOptions: _collectionOptions => {},
|
|
18
|
-
setOnExit: _listener => {}
|
|
18
|
+
setOnExit: _listener => {},
|
|
19
|
+
setOnStepChange: _listener => {}
|
|
19
20
|
},
|
|
20
21
|
"account-management": {
|
|
21
22
|
setCollectionOptions: _collectionOptions => {}
|
|
@@ -24,60 +25,30 @@ const ConnectElementCustomMethodConfig = {
|
|
|
24
25
|
setCollectionOptions: _collectionOptions => {},
|
|
25
26
|
setOnNotificationsChange: _listener => {}
|
|
26
27
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
setCardSwitching: _cardSwitching => {},
|
|
31
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
32
|
-
},
|
|
33
|
-
"issuing-cards-list": {
|
|
34
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
35
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
36
|
-
},
|
|
37
|
-
"financial-account": {
|
|
38
|
-
setFinancialAccount: _financialAccount => {}
|
|
39
|
-
},
|
|
40
|
-
"financial-account-transactions": {
|
|
41
|
-
setFinancialAccount: _financialAccount => {}
|
|
42
|
-
},
|
|
43
|
-
"app-install": {
|
|
44
|
-
setApp: _app => {},
|
|
45
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
46
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
47
|
-
},
|
|
48
|
-
"app-viewport": {
|
|
49
|
-
setApp: _app => {},
|
|
50
|
-
setAppData: _appData => {}
|
|
28
|
+
"payment-details": {
|
|
29
|
+
setPayment: _payment => {},
|
|
30
|
+
setOnClose: _listener => {}
|
|
51
31
|
}
|
|
52
32
|
};
|
|
53
33
|
|
|
54
34
|
const componentNameMapping = {
|
|
35
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
55
36
|
payments: "stripe-connect-payments",
|
|
56
|
-
payouts: "stripe-connect-payouts",
|
|
57
37
|
"payment-details": "stripe-connect-payment-details",
|
|
58
|
-
|
|
59
|
-
"
|
|
38
|
+
payouts: "stripe-connect-payouts",
|
|
39
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
40
|
+
balances: "stripe-connect-balances",
|
|
60
41
|
"account-management": "stripe-connect-account-management",
|
|
61
42
|
"notification-banner": "stripe-connect-notification-banner",
|
|
62
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
63
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
64
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
65
|
-
"financial-account": "stripe-connect-financial-account",
|
|
66
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
67
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
68
43
|
documents: "stripe-connect-documents",
|
|
69
44
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
70
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
71
|
-
balances: "stripe-connect-balances",
|
|
72
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
73
|
-
"app-install": "stripe-connect-app-install",
|
|
74
|
-
"app-viewport": "stripe-connect-app-viewport"
|
|
45
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
75
46
|
};
|
|
76
47
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
77
48
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
78
49
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
79
50
|
const findScript = () => {
|
|
80
|
-
return document.querySelectorAll(`script[src="${
|
|
51
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
81
52
|
};
|
|
82
53
|
const injectScript = () => {
|
|
83
54
|
const script = document.createElement("script");
|
|
@@ -157,15 +128,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
157
128
|
htmlName = tagName;
|
|
158
129
|
}
|
|
159
130
|
const element = document.createElement(htmlName);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
131
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
132
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
133
|
+
for (const method in methods) {
|
|
134
|
+
element[method] = function (value) {
|
|
135
|
+
stripeConnectInstance.then(() => {
|
|
136
|
+
this[`${method}InternalOnly`](value);
|
|
137
|
+
});
|
|
138
|
+
};
|
|
169
139
|
}
|
|
170
140
|
stripeConnectInstance.then(instance => {
|
|
171
141
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -215,7 +185,7 @@ const createWrapper = stripeConnect => {
|
|
|
215
185
|
sdk: true,
|
|
216
186
|
sdkOptions: {
|
|
217
187
|
// This will be replaced by the npm package version when bundling
|
|
218
|
-
sdkVersion: "3.3.13
|
|
188
|
+
sdkVersion: "3.3.13"
|
|
219
189
|
}
|
|
220
190
|
})
|
|
221
191
|
}));
|
package/dist/src/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
2
2
|
export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
|
-
|
|
3
|
+
type ConnectElementHTMLName = "stripe-connect-account-onboarding" | "stripe-connect-payments" | "stripe-connect-payment-details" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-payouts" | "stripe-connect-payouts-list" | "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>;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
2
|
-
issuingCard: string;
|
|
3
|
-
nonce: string;
|
|
4
|
-
}) => Promise<{
|
|
5
|
-
issuingCard: string;
|
|
6
|
-
nonce: string;
|
|
7
|
-
ephemeralKeySecret: string;
|
|
8
|
-
}>;
|
|
9
1
|
export type CollectionOptions = {
|
|
10
2
|
fields: "currently_due" | "eventually_due";
|
|
11
3
|
futureRequirements?: "omit" | "include";
|
|
@@ -14,15 +6,50 @@ export type NotificationCount = {
|
|
|
14
6
|
total: number;
|
|
15
7
|
actionRequired: number;
|
|
16
8
|
};
|
|
17
|
-
export type
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
export type LoaderStart = {
|
|
10
|
+
elementTagName: string;
|
|
11
|
+
};
|
|
12
|
+
export type LoadError = {
|
|
13
|
+
elementTagName: string;
|
|
14
|
+
error: EmbeddedError;
|
|
15
|
+
};
|
|
16
|
+
export type StepChange = {
|
|
17
|
+
step: string;
|
|
18
|
+
};
|
|
19
|
+
export type EmbeddedError = {
|
|
20
|
+
type: EmbeddedErrorType;
|
|
21
|
+
message?: string;
|
|
22
|
+
};
|
|
23
|
+
export type EmbeddedErrorType =
|
|
24
|
+
/**
|
|
25
|
+
* Failure to connect to Stripe's API.
|
|
26
|
+
*/
|
|
27
|
+
"api_connection_error"
|
|
28
|
+
/**
|
|
29
|
+
* Failure to perform the authentication flow within Connect Embedded Components
|
|
30
|
+
*/
|
|
31
|
+
| "authentication_error"
|
|
32
|
+
/**
|
|
33
|
+
* Account session create failed
|
|
34
|
+
*/
|
|
35
|
+
| "account_session_create_error"
|
|
36
|
+
/**
|
|
37
|
+
* Request failed with an 4xx status code, typically caused by platform configuration issues
|
|
38
|
+
*/
|
|
39
|
+
| "invalid_request_error"
|
|
40
|
+
/**
|
|
41
|
+
* Too many requests hit the API too quickly.
|
|
42
|
+
*/
|
|
43
|
+
| "rate_limit_error"
|
|
44
|
+
/**
|
|
45
|
+
* API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
|
|
46
|
+
*/
|
|
47
|
+
| "api_error";
|
|
48
|
+
export declare const ConnectElementCommonMethodConfig: {
|
|
49
|
+
setOnLoadError: (_listener: (({ error, elementTagName }: LoadError) => void) | undefined) => void;
|
|
50
|
+
setOnLoaderStart: (_listener: (({ elementTagName }: LoaderStart) => void) | undefined) => void;
|
|
20
51
|
};
|
|
21
52
|
export declare const ConnectElementCustomMethodConfig: {
|
|
22
|
-
"payment-details": {
|
|
23
|
-
setPayment: (_payment: string | undefined) => void;
|
|
24
|
-
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
25
|
-
};
|
|
26
53
|
"account-onboarding": {
|
|
27
54
|
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
28
55
|
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
@@ -30,6 +57,7 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
30
57
|
setSkipTermsOfServiceCollection: (_skipTermsOfServiceCollection: boolean | undefined) => void;
|
|
31
58
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
32
59
|
setOnExit: (_listener: (() => void) | undefined) => void;
|
|
60
|
+
setOnStepChange: (_listener: (({ step }: StepChange) => void) | undefined) => void;
|
|
33
61
|
};
|
|
34
62
|
"account-management": {
|
|
35
63
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
@@ -38,29 +66,8 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
38
66
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
39
67
|
setOnNotificationsChange: (_listener: (({ total, actionRequired }: NotificationCount) => void) | undefined) => void;
|
|
40
68
|
};
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setCardSwitching: (_cardSwitching: boolean | undefined) => void;
|
|
45
|
-
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
46
|
-
};
|
|
47
|
-
"issuing-cards-list": {
|
|
48
|
-
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
49
|
-
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
50
|
-
};
|
|
51
|
-
"financial-account": {
|
|
52
|
-
setFinancialAccount: (_financialAccount: string) => void;
|
|
53
|
-
};
|
|
54
|
-
"financial-account-transactions": {
|
|
55
|
-
setFinancialAccount: (_financialAccount: string) => void;
|
|
56
|
-
};
|
|
57
|
-
"app-install": {
|
|
58
|
-
setApp: (_app: string | undefined) => void;
|
|
59
|
-
setOnAppInstallStateFetched: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
60
|
-
setOnAppInstallStateChanged: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
61
|
-
};
|
|
62
|
-
"app-viewport": {
|
|
63
|
-
setApp: (_app: string | undefined) => void;
|
|
64
|
-
setAppData: (_appData: Record<string, string> | undefined) => void;
|
|
69
|
+
"payment-details": {
|
|
70
|
+
setPayment: (_payment: string | undefined) => void;
|
|
71
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
65
72
|
};
|
|
66
73
|
};
|
package/package.json
CHANGED
package/src/shared.ts
CHANGED
|
@@ -4,59 +4,43 @@ import {
|
|
|
4
4
|
ConnectElementTagName,
|
|
5
5
|
ConnectHTMLElementRecord
|
|
6
6
|
} from "../types";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ConnectElementCommonMethodConfig,
|
|
9
|
+
ConnectElementCustomMethodConfig
|
|
10
|
+
} from "../types/config";
|
|
8
11
|
|
|
9
12
|
export type LoadConnectAndInitialize = (
|
|
10
13
|
initParams: IStripeConnectInitParams
|
|
11
14
|
) => StripeConnectInstance;
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
type ConnectElementHTMLName =
|
|
17
|
+
| "stripe-connect-account-onboarding"
|
|
14
18
|
| "stripe-connect-payments"
|
|
15
|
-
| "stripe-connect-payouts"
|
|
16
19
|
| "stripe-connect-payment-details"
|
|
17
|
-
| "stripe-connect-account-onboarding"
|
|
18
|
-
| "stripe-connect-payment-method-settings"
|
|
19
20
|
| "stripe-connect-account-management"
|
|
20
21
|
| "stripe-connect-notification-banner"
|
|
21
|
-
| "stripe-connect-
|
|
22
|
-
| "stripe-connect-
|
|
23
|
-
| "stripe-connect-
|
|
24
|
-
| "stripe-connect-financial-account"
|
|
25
|
-
| "stripe-connect-financial-account-transactions"
|
|
26
|
-
| "stripe-connect-capital-overview"
|
|
22
|
+
| "stripe-connect-payouts"
|
|
23
|
+
| "stripe-connect-payouts-list"
|
|
24
|
+
| "stripe-connect-balances"
|
|
27
25
|
| "stripe-connect-documents"
|
|
28
26
|
| "stripe-connect-tax-registrations"
|
|
29
|
-
| "stripe-connect-tax-settings"
|
|
30
|
-
| "stripe-connect-balances"
|
|
31
|
-
| "stripe-connect-payouts-list"
|
|
32
|
-
| "stripe-connect-app-install"
|
|
33
|
-
| "stripe-connect-app-viewport";
|
|
27
|
+
| "stripe-connect-tax-settings";
|
|
34
28
|
|
|
35
29
|
export const componentNameMapping: Record<
|
|
36
30
|
ConnectElementTagName,
|
|
37
31
|
ConnectElementHTMLName
|
|
38
32
|
> = {
|
|
33
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
39
34
|
payments: "stripe-connect-payments",
|
|
40
|
-
payouts: "stripe-connect-payouts",
|
|
41
35
|
"payment-details": "stripe-connect-payment-details",
|
|
42
|
-
|
|
43
|
-
"
|
|
36
|
+
payouts: "stripe-connect-payouts",
|
|
37
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
38
|
+
balances: "stripe-connect-balances",
|
|
44
39
|
"account-management": "stripe-connect-account-management",
|
|
45
40
|
"notification-banner": "stripe-connect-notification-banner",
|
|
46
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
47
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
48
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
49
|
-
"financial-account": "stripe-connect-financial-account",
|
|
50
|
-
"financial-account-transactions":
|
|
51
|
-
"stripe-connect-financial-account-transactions",
|
|
52
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
53
41
|
documents: "stripe-connect-documents",
|
|
54
42
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
55
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
56
|
-
balances: "stripe-connect-balances",
|
|
57
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
58
|
-
"app-install": "stripe-connect-app-install",
|
|
59
|
-
"app-viewport": "stripe-connect-app-viewport"
|
|
43
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
60
44
|
};
|
|
61
45
|
|
|
62
46
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -75,10 +59,10 @@ const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
|
75
59
|
export const findScript = (): HTMLScriptElement | null => {
|
|
76
60
|
return (
|
|
77
61
|
document.querySelectorAll<HTMLScriptElement>(
|
|
78
|
-
`script[src="${
|
|
62
|
+
`script[src="${V1_URL}"]`
|
|
79
63
|
)[0] ||
|
|
80
64
|
document.querySelectorAll<HTMLScriptElement>(
|
|
81
|
-
`script[src="${
|
|
65
|
+
`script[src="${V0_URL}"]`
|
|
82
66
|
)[0] ||
|
|
83
67
|
null
|
|
84
68
|
);
|
|
@@ -189,15 +173,16 @@ export const initStripeConnect = (
|
|
|
189
173
|
}
|
|
190
174
|
const element = document.createElement(htmlName);
|
|
191
175
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
176
|
+
const customMethods = hasCustomMethod(tagName)
|
|
177
|
+
? ConnectElementCustomMethodConfig[tagName]
|
|
178
|
+
: {};
|
|
179
|
+
const methods = { ...customMethods, ...ConnectElementCommonMethodConfig };
|
|
180
|
+
for (const method in methods) {
|
|
181
|
+
(element as any)[method] = function(value: any) {
|
|
182
|
+
stripeConnectInstance.then(() => {
|
|
183
|
+
this[`${method}InternalOnly`](value);
|
|
184
|
+
});
|
|
185
|
+
};
|
|
201
186
|
}
|
|
202
187
|
|
|
203
188
|
stripeConnectInstance.then(instance => {
|
package/types/config.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
|
|
4
|
-
export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
5
|
-
issuingCard: string;
|
|
6
|
-
nonce: string;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
issuingCard: string;
|
|
9
|
-
nonce: string;
|
|
10
|
-
ephemeralKeySecret: string;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
4
|
export type CollectionOptions = {
|
|
14
5
|
fields: "currently_due" | "eventually_due";
|
|
15
6
|
futureRequirements?: "omit" | "include";
|
|
@@ -20,16 +11,60 @@ export type NotificationCount = {
|
|
|
20
11
|
actionRequired: number;
|
|
21
12
|
};
|
|
22
13
|
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export type LoaderStart = {
|
|
15
|
+
elementTagName: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type LoadError = {
|
|
19
|
+
elementTagName: string;
|
|
20
|
+
error: EmbeddedError;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type StepChange = {
|
|
24
|
+
step: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type EmbeddedError = {
|
|
28
|
+
type: EmbeddedErrorType;
|
|
29
|
+
message?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type EmbeddedErrorType =
|
|
33
|
+
/**
|
|
34
|
+
* Failure to connect to Stripe's API.
|
|
35
|
+
*/
|
|
36
|
+
| "api_connection_error"
|
|
37
|
+
/**
|
|
38
|
+
* Failure to perform the authentication flow within Connect Embedded Components
|
|
39
|
+
*/
|
|
40
|
+
| "authentication_error"
|
|
41
|
+
/**
|
|
42
|
+
* Account session create failed
|
|
43
|
+
*/
|
|
44
|
+
| "account_session_create_error"
|
|
45
|
+
/**
|
|
46
|
+
* Request failed with an 4xx status code, typically caused by platform configuration issues
|
|
47
|
+
*/
|
|
48
|
+
| "invalid_request_error"
|
|
49
|
+
/**
|
|
50
|
+
* Too many requests hit the API too quickly.
|
|
51
|
+
*/
|
|
52
|
+
| "rate_limit_error"
|
|
53
|
+
/**
|
|
54
|
+
* API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
|
|
55
|
+
*/
|
|
56
|
+
| "api_error";
|
|
57
|
+
|
|
58
|
+
export const ConnectElementCommonMethodConfig = {
|
|
59
|
+
setOnLoadError: (
|
|
60
|
+
_listener: (({ error, elementTagName }: LoadError) => void) | undefined
|
|
61
|
+
): void => {},
|
|
62
|
+
setOnLoaderStart: (
|
|
63
|
+
_listener: (({ elementTagName }: LoaderStart) => void) | undefined
|
|
64
|
+
): void => {}
|
|
26
65
|
};
|
|
27
66
|
|
|
28
67
|
export const ConnectElementCustomMethodConfig = {
|
|
29
|
-
"payment-details": {
|
|
30
|
-
setPayment: (_payment: string | undefined): void => {},
|
|
31
|
-
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
32
|
-
},
|
|
33
68
|
"account-onboarding": {
|
|
34
69
|
setFullTermsOfServiceUrl: (
|
|
35
70
|
_termOfServiceUrl: string | undefined
|
|
@@ -44,7 +79,10 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
44
79
|
setCollectionOptions: (
|
|
45
80
|
_collectionOptions: CollectionOptions | undefined
|
|
46
81
|
): void => {},
|
|
47
|
-
setOnExit: (_listener: (() => void) | undefined): void => {}
|
|
82
|
+
setOnExit: (_listener: (() => void) | undefined): void => {},
|
|
83
|
+
setOnStepChange: (
|
|
84
|
+
_listener: (({ step }: StepChange) => void) | undefined
|
|
85
|
+
): void => {}
|
|
48
86
|
},
|
|
49
87
|
"account-management": {
|
|
50
88
|
setCollectionOptions: (
|
|
@@ -61,37 +99,8 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
61
99
|
| undefined
|
|
62
100
|
): void => {}
|
|
63
101
|
},
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
setCardSwitching: (_cardSwitching: boolean | undefined): void => {},
|
|
68
|
-
setFetchEphemeralKey: (
|
|
69
|
-
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
70
|
-
): void => {}
|
|
71
|
-
},
|
|
72
|
-
"issuing-cards-list": {
|
|
73
|
-
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
74
|
-
setFetchEphemeralKey: (
|
|
75
|
-
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
76
|
-
): void => {}
|
|
77
|
-
},
|
|
78
|
-
"financial-account": {
|
|
79
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
80
|
-
},
|
|
81
|
-
"financial-account-transactions": {
|
|
82
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
83
|
-
},
|
|
84
|
-
"app-install": {
|
|
85
|
-
setApp: (_app: string | undefined): void => {},
|
|
86
|
-
setOnAppInstallStateFetched: (
|
|
87
|
-
_listener: (({ appId, state }: InstallState) => void) | undefined
|
|
88
|
-
): void => {},
|
|
89
|
-
setOnAppInstallStateChanged: (
|
|
90
|
-
_listener: (({ appId, state }: InstallState) => void) | undefined
|
|
91
|
-
): void => {}
|
|
92
|
-
},
|
|
93
|
-
"app-viewport": {
|
|
94
|
-
setApp: (_app: string | undefined): void => {},
|
|
95
|
-
setAppData: (_appData: Record<string, string> | undefined): void => {}
|
|
102
|
+
"payment-details": {
|
|
103
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
104
|
+
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
96
105
|
}
|
|
97
106
|
};
|
package/types/shared.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ConnectElementCustomMethodConfig,
|
|
3
|
+
ConnectElementCommonMethodConfig
|
|
4
|
+
} from "./config";
|
|
2
5
|
|
|
3
6
|
export declare type LoadConnectAndInitialize = (
|
|
4
7
|
initParams: IStripeConnectInitParams
|
|
@@ -412,12 +415,14 @@ export interface IStripeConnectInitParams {
|
|
|
412
415
|
}
|
|
413
416
|
|
|
414
417
|
type ConnectElementCustomMethods = typeof ConnectElementCustomMethodConfig;
|
|
418
|
+
type ConnectElementCommonMethods = typeof ConnectElementCommonMethodConfig;
|
|
415
419
|
|
|
416
420
|
export type ConnectHTMLElementRecord = {
|
|
417
421
|
[K in keyof ConnectElementCustomMethods]: HTMLElement &
|
|
418
|
-
ConnectElementCustomMethods[K]
|
|
422
|
+
ConnectElementCustomMethods[K] &
|
|
423
|
+
ConnectElementCommonMethods;
|
|
419
424
|
} & {
|
|
420
|
-
[key: string]: HTMLElement;
|
|
425
|
+
[key: string]: HTMLElement & ConnectElementCommonMethods;
|
|
421
426
|
};
|
|
422
427
|
|
|
423
428
|
export interface StripeConnectInstance {
|
|
@@ -447,23 +452,14 @@ export interface StripeConnectInstance {
|
|
|
447
452
|
* Tagnames to be used with the `create` method of the Connect instance.
|
|
448
453
|
*/
|
|
449
454
|
export type ConnectElementTagName =
|
|
455
|
+
| "account-onboarding"
|
|
450
456
|
| "payments"
|
|
451
|
-
| "payouts"
|
|
452
457
|
| "payment-details"
|
|
453
|
-
| "account-onboarding"
|
|
454
|
-
| "payment-method-settings"
|
|
455
458
|
| "account-management"
|
|
456
459
|
| "notification-banner"
|
|
457
|
-
| "
|
|
458
|
-
| "
|
|
459
|
-
| "
|
|
460
|
-
| "financial-account"
|
|
461
|
-
| "financial-account-transactions"
|
|
462
|
-
| "capital-overview"
|
|
460
|
+
| "payouts"
|
|
461
|
+
| "payouts-list"
|
|
462
|
+
| "balances"
|
|
463
463
|
| "documents"
|
|
464
464
|
| "tax-registrations"
|
|
465
|
-
| "tax-settings"
|
|
466
|
-
| "balances"
|
|
467
|
-
| "payouts-list"
|
|
468
|
-
| "app-install"
|
|
469
|
-
| "app-viewport";
|
|
465
|
+
| "tax-settings";
|