@stripe/connect-js 3.3.29-preview-1 → 3.3.31-preview-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/README.md +3 -3
- package/dist/connect.esm.js +6 -1
- package/dist/connect.js +6 -1
- package/dist/pure.esm.js +6 -1
- package/dist/pure.js +6 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/pure.d.ts +1 -1
- package/dist/src/shared.d.ts +2 -2
- package/dist/types/config.d.ts +8 -4
- package/package.json +13 -9
- package/src/index.ts +3 -6
- package/src/pure.test.ts +2 -2
- package/src/pure.ts +3 -6
- package/src/shared.ts +20 -18
- package/types/checks.ts +2 -2
- package/types/config.ts +33 -25
- package/types/index.d.ts +1 -1
- package/types/shared.d.ts +3 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ const fetchClientSecret = async () => {
|
|
|
36
36
|
|
|
37
37
|
const instance = loadConnectAndInitialize({
|
|
38
38
|
publishableKey: "{{pk test123}}",
|
|
39
|
-
fetchClientSecret: fetchClientSecret
|
|
39
|
+
fetchClientSecret: fetchClientSecret,
|
|
40
40
|
});
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ test this code through your Connect account.
|
|
|
47
47
|
If you have deployed a
|
|
48
48
|
[Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/Security/CSP),
|
|
49
49
|
make sure to
|
|
50
|
-
[include Connect.js in your directives](https://stripe.com/docs/
|
|
50
|
+
[include Connect.js in your directives](https://stripe.com/docs/connect/get-started-connect-embedded-components?platform=web#csp-and-http-header-requirements).
|
|
51
51
|
|
|
52
52
|
### Import as a side effect
|
|
53
53
|
|
|
@@ -71,6 +71,6 @@ import { loadConnectAndInitialize } from "@stripe/connect-js/pure";
|
|
|
71
71
|
// Connect.js will not be loaded until `loadConnect` is called
|
|
72
72
|
const instance = loadConnectAndInitialize({
|
|
73
73
|
publishableKey: "{{pk test123}}",
|
|
74
|
-
fetchClientSecret: fetchClientSecret
|
|
74
|
+
fetchClientSecret: fetchClientSecret,
|
|
75
75
|
});
|
|
76
76
|
```
|
package/dist/connect.esm.js
CHANGED
|
@@ -12,6 +12,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
12
12
|
setPayment: _payment => {},
|
|
13
13
|
setOnClose: _listener => {}
|
|
14
14
|
},
|
|
15
|
+
"payment-disputes": {
|
|
16
|
+
setPayment: _payment => {},
|
|
17
|
+
setOnDisputesLoaded: _listener => {}
|
|
18
|
+
},
|
|
15
19
|
"account-onboarding": {
|
|
16
20
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
17
21
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -111,6 +115,7 @@ const componentNameMapping = {
|
|
|
111
115
|
payments: "stripe-connect-payments",
|
|
112
116
|
payouts: "stripe-connect-payouts",
|
|
113
117
|
"payment-details": "stripe-connect-payment-details",
|
|
118
|
+
"payment-disputes": "stripe-connect-payment-disputes",
|
|
114
119
|
"account-onboarding": "stripe-connect-account-onboarding",
|
|
115
120
|
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
116
121
|
"account-management": "stripe-connect-account-management",
|
|
@@ -278,7 +283,7 @@ const createWrapper = stripeConnect => {
|
|
|
278
283
|
sdk: true,
|
|
279
284
|
sdkOptions: {
|
|
280
285
|
// This will be replaced by the npm package version when bundling
|
|
281
|
-
sdkVersion: "3.3.
|
|
286
|
+
sdkVersion: "3.3.31-preview-1"
|
|
282
287
|
}
|
|
283
288
|
})
|
|
284
289
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -16,6 +16,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
16
16
|
setPayment: _payment => {},
|
|
17
17
|
setOnClose: _listener => {}
|
|
18
18
|
},
|
|
19
|
+
"payment-disputes": {
|
|
20
|
+
setPayment: _payment => {},
|
|
21
|
+
setOnDisputesLoaded: _listener => {}
|
|
22
|
+
},
|
|
19
23
|
"account-onboarding": {
|
|
20
24
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
21
25
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -115,6 +119,7 @@ const componentNameMapping = {
|
|
|
115
119
|
payments: "stripe-connect-payments",
|
|
116
120
|
payouts: "stripe-connect-payouts",
|
|
117
121
|
"payment-details": "stripe-connect-payment-details",
|
|
122
|
+
"payment-disputes": "stripe-connect-payment-disputes",
|
|
118
123
|
"account-onboarding": "stripe-connect-account-onboarding",
|
|
119
124
|
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
120
125
|
"account-management": "stripe-connect-account-management",
|
|
@@ -282,7 +287,7 @@ const createWrapper = stripeConnect => {
|
|
|
282
287
|
sdk: true,
|
|
283
288
|
sdkOptions: {
|
|
284
289
|
// This will be replaced by the npm package version when bundling
|
|
285
|
-
sdkVersion: "3.3.
|
|
290
|
+
sdkVersion: "3.3.31-preview-1"
|
|
286
291
|
}
|
|
287
292
|
})
|
|
288
293
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -12,6 +12,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
12
12
|
setPayment: _payment => {},
|
|
13
13
|
setOnClose: _listener => {}
|
|
14
14
|
},
|
|
15
|
+
"payment-disputes": {
|
|
16
|
+
setPayment: _payment => {},
|
|
17
|
+
setOnDisputesLoaded: _listener => {}
|
|
18
|
+
},
|
|
15
19
|
"account-onboarding": {
|
|
16
20
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
17
21
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -111,6 +115,7 @@ const componentNameMapping = {
|
|
|
111
115
|
payments: "stripe-connect-payments",
|
|
112
116
|
payouts: "stripe-connect-payouts",
|
|
113
117
|
"payment-details": "stripe-connect-payment-details",
|
|
118
|
+
"payment-disputes": "stripe-connect-payment-disputes",
|
|
114
119
|
"account-onboarding": "stripe-connect-account-onboarding",
|
|
115
120
|
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
116
121
|
"account-management": "stripe-connect-account-management",
|
|
@@ -278,7 +283,7 @@ const createWrapper = stripeConnect => {
|
|
|
278
283
|
sdk: true,
|
|
279
284
|
sdkOptions: {
|
|
280
285
|
// This will be replaced by the npm package version when bundling
|
|
281
|
-
sdkVersion: "3.3.
|
|
286
|
+
sdkVersion: "3.3.31-preview-1"
|
|
282
287
|
}
|
|
283
288
|
})
|
|
284
289
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -16,6 +16,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
16
16
|
setPayment: _payment => {},
|
|
17
17
|
setOnClose: _listener => {}
|
|
18
18
|
},
|
|
19
|
+
"payment-disputes": {
|
|
20
|
+
setPayment: _payment => {},
|
|
21
|
+
setOnDisputesLoaded: _listener => {}
|
|
22
|
+
},
|
|
19
23
|
"account-onboarding": {
|
|
20
24
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
21
25
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -115,6 +119,7 @@ const componentNameMapping = {
|
|
|
115
119
|
payments: "stripe-connect-payments",
|
|
116
120
|
payouts: "stripe-connect-payouts",
|
|
117
121
|
"payment-details": "stripe-connect-payment-details",
|
|
122
|
+
"payment-disputes": "stripe-connect-payment-disputes",
|
|
118
123
|
"account-onboarding": "stripe-connect-account-onboarding",
|
|
119
124
|
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
120
125
|
"account-management": "stripe-connect-account-management",
|
|
@@ -282,7 +287,7 @@ const createWrapper = stripeConnect => {
|
|
|
282
287
|
sdk: true,
|
|
283
288
|
sdkOptions: {
|
|
284
289
|
// This will be replaced by the npm package version when bundling
|
|
285
|
-
sdkVersion: "3.3.
|
|
290
|
+
sdkVersion: "3.3.31-preview-1"
|
|
286
291
|
}
|
|
287
292
|
})
|
|
288
293
|
}));
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LoadConnectAndInitialize } from "./shared";
|
|
1
|
+
import type { LoadConnectAndInitialize } from "./shared";
|
|
2
2
|
export declare const loadConnectAndInitialize: LoadConnectAndInitialize;
|
package/dist/src/pure.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LoadConnectAndInitialize } from "./shared";
|
|
1
|
+
import type { LoadConnectAndInitialize } from "./shared";
|
|
2
2
|
export declare const loadConnectAndInitialize: LoadConnectAndInitialize;
|
package/dist/src/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
1
|
+
import type { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
2
2
|
export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
|
-
export type ConnectElementHTMLName = "stripe-connect-payments" | "stripe-connect-payouts" | "stripe-connect-payment-details" | "stripe-connect-account-onboarding" | "stripe-connect-payment-method-settings" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-instant-payouts" | "stripe-connect-issuing-card" | "stripe-connect-issuing-cards-list" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-recipients" | "stripe-connect-capital-financing" | "stripe-connect-capital-financing-application" | "stripe-connect-capital-financing-promotion" | "stripe-connect-capital-overview" | "stripe-connect-documents" | "stripe-connect-product-tax-code-selector" | "stripe-connect-export-tax-transactions" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings" | "stripe-connect-tax-threshold-monitoring" | "stripe-connect-balances" | "stripe-connect-payouts-list" | "stripe-connect-app-install" | "stripe-connect-app-viewport" | "stripe-connect-reporting-chart";
|
|
3
|
+
export type ConnectElementHTMLName = "stripe-connect-payments" | "stripe-connect-payouts" | "stripe-connect-payment-details" | "stripe-connect-payment-disputes" | "stripe-connect-account-onboarding" | "stripe-connect-payment-method-settings" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-instant-payouts" | "stripe-connect-issuing-card" | "stripe-connect-issuing-cards-list" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-recipients" | "stripe-connect-capital-financing" | "stripe-connect-capital-financing-application" | "stripe-connect-capital-financing-promotion" | "stripe-connect-capital-overview" | "stripe-connect-documents" | "stripe-connect-product-tax-code-selector" | "stripe-connect-export-tax-transactions" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings" | "stripe-connect-tax-threshold-monitoring" | "stripe-connect-balances" | "stripe-connect-payouts-list" | "stripe-connect-app-install" | "stripe-connect-app-viewport" | "stripe-connect-reporting-chart";
|
|
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
|
@@ -105,6 +105,12 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
105
105
|
setPayment: (_payment: string | undefined) => void;
|
|
106
106
|
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
107
107
|
};
|
|
108
|
+
"payment-disputes": {
|
|
109
|
+
setPayment: (_payment: string | undefined) => void;
|
|
110
|
+
setOnDisputesLoaded: (_listener: (({ total }: {
|
|
111
|
+
total: number;
|
|
112
|
+
}) => void) | undefined) => void;
|
|
113
|
+
};
|
|
108
114
|
"account-onboarding": {
|
|
109
115
|
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
110
116
|
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
@@ -170,7 +176,7 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
170
176
|
"capital-financing-promotion": {
|
|
171
177
|
setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
|
|
172
178
|
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
173
|
-
setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount }: FinancingProductType) => void) | undefined) => void;
|
|
179
|
+
setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount, }: FinancingProductType) => void) | undefined) => void;
|
|
174
180
|
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
175
181
|
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
176
182
|
setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
|
|
@@ -198,9 +204,7 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
198
204
|
setDisplayCountries: (_countries: string[] | undefined) => void;
|
|
199
205
|
};
|
|
200
206
|
"product-tax-code-selector": {
|
|
201
|
-
setOnTaxCodeSelect: (_listener: ((
|
|
202
|
-
taxCode: string;
|
|
203
|
-
}) => void) | undefined) => void;
|
|
207
|
+
setOnTaxCodeSelect: (_listener: ((taxCode: string) => void) | undefined) => void;
|
|
204
208
|
setHideDescription: (_hideDescription: boolean | undefined) => void;
|
|
205
209
|
setDisabled: (_disabled: boolean | undefined) => void;
|
|
206
210
|
setInitialTaxCode: (_initialTaxCode: string | undefined) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.31-preview-1",
|
|
4
4
|
"description": "Connect.js loading utility package",
|
|
5
5
|
"main": "dist/connect.js",
|
|
6
6
|
"module": "dist/connect.esm.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"test:unit": "jest",
|
|
12
12
|
"test:types": "zx ./tests/types/scripts/test.mjs",
|
|
13
13
|
"lint": "eslint '{src,types}/**/*.{ts,js}' && yarn prettier-check",
|
|
14
|
+
"lint-fix": "eslint '{src,types}/**/*.{ts,js}' --fix && yarn prettier-check",
|
|
14
15
|
"typecheck": "tsc --noEmit",
|
|
15
16
|
"build": "yarn clean && rollup -c",
|
|
16
17
|
"validate-change": "yarn run test",
|
|
@@ -45,19 +46,22 @@
|
|
|
45
46
|
"@rollup/plugin-json": "^6.0.0",
|
|
46
47
|
"@rollup/plugin-replace": "^2.3.1",
|
|
47
48
|
"@types/jest": "^24.0.25",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
49
|
-
"@typescript-eslint/parser": "^
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^7",
|
|
50
|
+
"@typescript-eslint/parser": "^7",
|
|
51
|
+
"@typescript-eslint/rule-tester": "^7",
|
|
52
|
+
"@typescript-eslint/scope-manager": "^7",
|
|
53
|
+
"@typescript-eslint/utils": "^7",
|
|
50
54
|
"babel-eslint": "^10.0.3",
|
|
51
55
|
"babel-jest": "^24.9.0",
|
|
52
56
|
"conditional-type-checks": "^1.0.5",
|
|
53
|
-
"eslint": "
|
|
54
|
-
"eslint-config-prettier": "^
|
|
55
|
-
"eslint-plugin-import": "^2.
|
|
56
|
-
"eslint-plugin-jest": "^
|
|
57
|
-
"eslint-plugin-prettier": "^
|
|
57
|
+
"eslint": "8.56.0",
|
|
58
|
+
"eslint-config-prettier": "^8.3.0",
|
|
59
|
+
"eslint-plugin-import": "^2.20.1",
|
|
60
|
+
"eslint-plugin-jest": "^26.6.0",
|
|
61
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
58
62
|
"jest": "^29.5.0",
|
|
59
63
|
"jest-environment-jsdom": "^29.5.0",
|
|
60
|
-
"prettier": "
|
|
64
|
+
"prettier": "2.8.8",
|
|
61
65
|
"rimraf": "^2.6.2",
|
|
62
66
|
"rollup": "^1.29.0",
|
|
63
67
|
"rollup-plugin-babel": "^4.4.0",
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { IStripeConnectInitParams, StripeConnectInstance } from "../types";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
initStripeConnect,
|
|
5
|
-
LoadConnectAndInitialize
|
|
6
|
-
} from "./shared";
|
|
1
|
+
import type { IStripeConnectInitParams, StripeConnectInstance } from "../types";
|
|
2
|
+
import type { LoadConnectAndInitialize } from "./shared";
|
|
3
|
+
import { loadScript, initStripeConnect } from "./shared";
|
|
7
4
|
|
|
8
5
|
// Execute our own script injection after a tick to give users time to do their
|
|
9
6
|
// own script injection.
|
package/src/pure.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
2
|
|
|
3
|
-
import { IStripeConnectInitParams } from "../types";
|
|
3
|
+
import type { IStripeConnectInitParams } from "../types";
|
|
4
4
|
import { SCRIPT_SELECTOR } from "./utils/jestHelpers";
|
|
5
5
|
|
|
6
6
|
describe("pure module", () => {
|
|
@@ -16,7 +16,7 @@ describe("pure module", () => {
|
|
|
16
16
|
publishableKey: "pk_123",
|
|
17
17
|
fetchClientSecret: async () => {
|
|
18
18
|
return "secret_123";
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
20
|
};
|
|
21
21
|
loadConnectAndInitialize(mockInitParams);
|
|
22
22
|
|
package/src/pure.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { IStripeConnectInitParams, StripeConnectInstance } from "../types";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
initStripeConnect,
|
|
5
|
-
LoadConnectAndInitialize
|
|
6
|
-
} from "./shared";
|
|
1
|
+
import type { IStripeConnectInitParams, StripeConnectInstance } from "../types";
|
|
2
|
+
import type { LoadConnectAndInitialize } from "./shared";
|
|
3
|
+
import { loadScript, initStripeConnect } from "./shared";
|
|
7
4
|
|
|
8
5
|
export const loadConnectAndInitialize: LoadConnectAndInitialize = (
|
|
9
6
|
initParams: IStripeConnectInitParams
|
package/src/shared.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
IStripeConnectInitParams,
|
|
3
3
|
StripeConnectInstance,
|
|
4
4
|
ConnectElementTagName,
|
|
5
|
-
ConnectHTMLElementRecord
|
|
5
|
+
ConnectHTMLElementRecord,
|
|
6
6
|
} from "../types";
|
|
7
7
|
import {
|
|
8
8
|
ConnectElementCommonMethodConfig,
|
|
9
|
-
ConnectElementCustomMethodConfig
|
|
9
|
+
ConnectElementCustomMethodConfig,
|
|
10
10
|
} from "../types/config";
|
|
11
11
|
|
|
12
12
|
export type LoadConnectAndInitialize = (
|
|
@@ -17,6 +17,7 @@ export type ConnectElementHTMLName =
|
|
|
17
17
|
| "stripe-connect-payments"
|
|
18
18
|
| "stripe-connect-payouts"
|
|
19
19
|
| "stripe-connect-payment-details"
|
|
20
|
+
| "stripe-connect-payment-disputes"
|
|
20
21
|
| "stripe-connect-account-onboarding"
|
|
21
22
|
| "stripe-connect-payment-method-settings"
|
|
22
23
|
| "stripe-connect-account-management"
|
|
@@ -50,6 +51,7 @@ export const componentNameMapping: Record<
|
|
|
50
51
|
payments: "stripe-connect-payments",
|
|
51
52
|
payouts: "stripe-connect-payouts",
|
|
52
53
|
"payment-details": "stripe-connect-payment-details",
|
|
54
|
+
"payment-disputes": "stripe-connect-payment-disputes",
|
|
53
55
|
"account-onboarding": "stripe-connect-account-onboarding",
|
|
54
56
|
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
55
57
|
"account-management": "stripe-connect-account-management",
|
|
@@ -76,7 +78,7 @@ export const componentNameMapping: Record<
|
|
|
76
78
|
"payouts-list": "stripe-connect-payouts-list",
|
|
77
79
|
"app-install": "stripe-connect-app-install",
|
|
78
80
|
"app-viewport": "stripe-connect-app-viewport",
|
|
79
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
81
|
+
"reporting-chart": "stripe-connect-reporting-chart",
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -194,18 +196,18 @@ export const initStripeConnect = (
|
|
|
194
196
|
}
|
|
195
197
|
})();
|
|
196
198
|
const metaOptions = (initParams as any).metaOptions ?? {};
|
|
197
|
-
const stripeConnectInstance = stripePromise.then(wrapper =>
|
|
199
|
+
const stripeConnectInstance = stripePromise.then((wrapper) =>
|
|
198
200
|
wrapper.initialize({
|
|
199
201
|
...initParams,
|
|
200
|
-
metaOptions: { ...metaOptions, eagerClientSecretPromise }
|
|
202
|
+
metaOptions: { ...metaOptions, eagerClientSecretPromise },
|
|
201
203
|
} as any)
|
|
202
204
|
);
|
|
203
205
|
|
|
204
206
|
return {
|
|
205
|
-
create: tagName => {
|
|
207
|
+
create: (tagName) => {
|
|
206
208
|
let htmlName = componentNameMapping[tagName];
|
|
207
209
|
if (!htmlName) {
|
|
208
|
-
htmlName =
|
|
210
|
+
htmlName = tagName as unknown as ConnectElementHTMLName;
|
|
209
211
|
}
|
|
210
212
|
const element = document.createElement(htmlName);
|
|
211
213
|
|
|
@@ -214,14 +216,14 @@ export const initStripeConnect = (
|
|
|
214
216
|
: {};
|
|
215
217
|
const methods = { ...customMethods, ...ConnectElementCommonMethodConfig };
|
|
216
218
|
for (const method in methods) {
|
|
217
|
-
(element as any)[method] = function(value: any) {
|
|
219
|
+
(element as any)[method] = function (value: any) {
|
|
218
220
|
stripeConnectInstance.then(() => {
|
|
219
221
|
this[`${method}InternalOnly`](value);
|
|
220
222
|
});
|
|
221
223
|
};
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
stripeConnectInstance.then(instance => {
|
|
226
|
+
stripeConnectInstance.then((instance) => {
|
|
225
227
|
if (!element.isConnected && !(element as any).setConnector) {
|
|
226
228
|
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
227
229
|
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
@@ -249,8 +251,8 @@ export const initStripeConnect = (
|
|
|
249
251
|
|
|
250
252
|
return element as ConnectHTMLElementRecord[typeof tagName];
|
|
251
253
|
},
|
|
252
|
-
update: updateOptions => {
|
|
253
|
-
stripeConnectInstance.then(instance => {
|
|
254
|
+
update: (updateOptions) => {
|
|
255
|
+
stripeConnectInstance.then((instance) => {
|
|
254
256
|
instance.update(updateOptions);
|
|
255
257
|
});
|
|
256
258
|
},
|
|
@@ -258,10 +260,10 @@ export const initStripeConnect = (
|
|
|
258
260
|
return stripeConnectInstance;
|
|
259
261
|
},
|
|
260
262
|
logout: () => {
|
|
261
|
-
return stripeConnectInstance.then(instance => {
|
|
263
|
+
return stripeConnectInstance.then((instance) => {
|
|
262
264
|
return instance.logout();
|
|
263
265
|
});
|
|
264
|
-
}
|
|
266
|
+
},
|
|
265
267
|
};
|
|
266
268
|
};
|
|
267
269
|
|
|
@@ -278,12 +280,12 @@ const createWrapper = (stripeConnect: any) => {
|
|
|
278
280
|
sdk: true,
|
|
279
281
|
sdkOptions: {
|
|
280
282
|
// This will be replaced by the npm package version when bundling
|
|
281
|
-
sdkVersion: "_NPM_PACKAGE_VERSION_"
|
|
282
|
-
}
|
|
283
|
-
}
|
|
283
|
+
sdkVersion: "_NPM_PACKAGE_VERSION_",
|
|
284
|
+
},
|
|
285
|
+
},
|
|
284
286
|
});
|
|
285
287
|
return stripeConnectInstance;
|
|
286
|
-
}
|
|
288
|
+
},
|
|
287
289
|
};
|
|
288
290
|
return wrapper;
|
|
289
291
|
};
|
package/types/checks.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConnectElementCustomMethodConfig } from "./config";
|
|
2
|
-
import { ConnectElementTagName } from "./shared.d";
|
|
1
|
+
import type { ConnectElementCustomMethodConfig } from "./config";
|
|
2
|
+
import type { ConnectElementTagName } from "./shared.d";
|
|
3
3
|
|
|
4
4
|
// ensure that keys of ConnectElementCustomMethodConfig are from ConnectElementTagName
|
|
5
5
|
export type HasType<T, Q extends T> = Q;
|
package/types/config.ts
CHANGED
|
@@ -202,18 +202,24 @@ export const ConnectElementCommonMethodConfig = {
|
|
|
202
202
|
): void => {},
|
|
203
203
|
setOnLoaderStart: (
|
|
204
204
|
_listener: (({ elementTagName }: LoaderStart) => void) | undefined
|
|
205
|
-
): void => {}
|
|
205
|
+
): void => {},
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
export const ConnectElementCustomMethodConfig = {
|
|
209
209
|
payments: {
|
|
210
210
|
setDefaultFilters: (
|
|
211
211
|
_filters: PaymentsListDefaultFilters | undefined
|
|
212
|
-
): void => {}
|
|
212
|
+
): void => {},
|
|
213
213
|
},
|
|
214
214
|
"payment-details": {
|
|
215
215
|
setPayment: (_payment: string | undefined): void => {},
|
|
216
|
-
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
216
|
+
setOnClose: (_listener: (() => void) | undefined): void => {},
|
|
217
|
+
},
|
|
218
|
+
"payment-disputes": {
|
|
219
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
220
|
+
setOnDisputesLoaded: (
|
|
221
|
+
_listener: (({ total }: { total: number }) => void) | undefined
|
|
222
|
+
): void => {},
|
|
217
223
|
},
|
|
218
224
|
"account-onboarding": {
|
|
219
225
|
setFullTermsOfServiceUrl: (
|
|
@@ -232,12 +238,12 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
232
238
|
setOnExit: (_listener: (() => void) | undefined): void => {},
|
|
233
239
|
setOnStepChange: (
|
|
234
240
|
_listener: (({ step }: StepChange) => void) | undefined
|
|
235
|
-
): void => {}
|
|
241
|
+
): void => {},
|
|
236
242
|
},
|
|
237
243
|
"account-management": {
|
|
238
244
|
setCollectionOptions: (
|
|
239
245
|
_collectionOptions: CollectionOptions | undefined
|
|
240
|
-
): void => {}
|
|
246
|
+
): void => {},
|
|
241
247
|
},
|
|
242
248
|
"notification-banner": {
|
|
243
249
|
setCollectionOptions: (
|
|
@@ -247,7 +253,7 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
247
253
|
_listener:
|
|
248
254
|
| (({ total, actionRequired }: NotificationCount) => void)
|
|
249
255
|
| undefined
|
|
250
|
-
): void => {}
|
|
256
|
+
): void => {},
|
|
251
257
|
},
|
|
252
258
|
"issuing-card": {
|
|
253
259
|
setDefaultCard: (_defaultCard: string | undefined): void => {},
|
|
@@ -255,23 +261,23 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
255
261
|
setFetchEphemeralKey: (
|
|
256
262
|
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
257
263
|
): void => {},
|
|
258
|
-
setShowSpendControls: (_showSpendControls: boolean | undefined): void => {}
|
|
264
|
+
setShowSpendControls: (_showSpendControls: boolean | undefined): void => {},
|
|
259
265
|
},
|
|
260
266
|
"issuing-cards-list": {
|
|
261
267
|
setFetchEphemeralKey: (
|
|
262
268
|
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
263
269
|
): void => {},
|
|
264
270
|
setShowSpendControls: (_showSpendControls: boolean | undefined): void => {},
|
|
265
|
-
setIssuingProgram: (_issuingProgram: string | undefined): void => {}
|
|
271
|
+
setIssuingProgram: (_issuingProgram: string | undefined): void => {},
|
|
266
272
|
},
|
|
267
273
|
"financial-account": {
|
|
268
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
274
|
+
setFinancialAccount: (_financialAccount: string): void => {},
|
|
269
275
|
},
|
|
270
276
|
"financial-account-transactions": {
|
|
271
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
277
|
+
setFinancialAccount: (_financialAccount: string): void => {},
|
|
272
278
|
},
|
|
273
279
|
recipients: {
|
|
274
|
-
setDataSource: (_dataSource: RecipientDataSource): void => {}
|
|
280
|
+
setDataSource: (_dataSource: RecipientDataSource): void => {},
|
|
275
281
|
},
|
|
276
282
|
"app-install": {
|
|
277
283
|
setApp: (_app: string | undefined): void => {},
|
|
@@ -280,16 +286,16 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
280
286
|
): void => {},
|
|
281
287
|
setOnAppInstallStateChanged: (
|
|
282
288
|
_listener: (({ appId, state }: InstallState) => void) | undefined
|
|
283
|
-
): void => {}
|
|
289
|
+
): void => {},
|
|
284
290
|
},
|
|
285
291
|
"app-viewport": {
|
|
286
292
|
setApp: (_app: string | undefined): void => {},
|
|
287
|
-
setAppData: (_appData: Record<string, string> | undefined): void => {}
|
|
293
|
+
setAppData: (_appData: Record<string, string> | undefined): void => {},
|
|
288
294
|
},
|
|
289
295
|
"payment-method-settings": {
|
|
290
296
|
setPaymentMethodConfiguration: (
|
|
291
297
|
_paymentMethodConfiguration: string | undefined
|
|
292
|
-
): void => {}
|
|
298
|
+
): void => {},
|
|
293
299
|
},
|
|
294
300
|
"capital-financing": {
|
|
295
301
|
setDefaultFinancingOffer: (
|
|
@@ -304,14 +310,16 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
304
310
|
setSupportUrl: (_supportUrl: string | undefined): void => {},
|
|
305
311
|
setOnFinancingsLoaded: (
|
|
306
312
|
_listener: (({ total }: { total: number }) => void) | undefined
|
|
307
|
-
): void => {}
|
|
313
|
+
): void => {},
|
|
308
314
|
},
|
|
309
315
|
"capital-financing-application": {
|
|
310
316
|
setOnApplicationSubmitted: (
|
|
311
317
|
_listener: (() => void) | undefined
|
|
312
318
|
): void => {},
|
|
313
319
|
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
314
|
-
setHowCapitalWorksUrl: (
|
|
320
|
+
setHowCapitalWorksUrl: (
|
|
321
|
+
_howCapitalWorksUrl: string | undefined
|
|
322
|
+
): void => {},
|
|
315
323
|
},
|
|
316
324
|
"capital-financing-promotion": {
|
|
317
325
|
setLayout: (_layout: FinancingPromotionLayoutType | undefined): void => {},
|
|
@@ -322,7 +330,7 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
322
330
|
_listener:
|
|
323
331
|
| (({
|
|
324
332
|
productType,
|
|
325
|
-
activeFinancingCount
|
|
333
|
+
activeFinancingCount,
|
|
326
334
|
}: FinancingProductType) => void)
|
|
327
335
|
| undefined
|
|
328
336
|
): void => {},
|
|
@@ -332,13 +340,13 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
332
340
|
): void => {},
|
|
333
341
|
setEligibilityCriteriaUrl: (
|
|
334
342
|
_eligibilityCriteriaUrl: string | undefined
|
|
335
|
-
): void => {}
|
|
343
|
+
): void => {},
|
|
336
344
|
},
|
|
337
345
|
"reporting-chart": {
|
|
338
346
|
setReportName: (_reportName: ReportName): void => {},
|
|
339
347
|
setIntervalStart: (_intervalStart: Date | undefined): void => {},
|
|
340
348
|
setIntervalEnd: (_intervalEnd: Date | undefined): void => {},
|
|
341
|
-
setIntervalType: (_intervalType: IntervalType | undefined): void => {}
|
|
349
|
+
setIntervalType: (_intervalType: IntervalType | undefined): void => {},
|
|
342
350
|
},
|
|
343
351
|
"tax-settings": {
|
|
344
352
|
setHideProductTaxCodeSelector: (_hidden: boolean | undefined): void => {},
|
|
@@ -347,24 +355,24 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
347
355
|
): void => {},
|
|
348
356
|
setOnTaxSettingsUpdated: (
|
|
349
357
|
_listener: (({ id }: { id: string }) => void) | undefined
|
|
350
|
-
): void => {}
|
|
358
|
+
): void => {},
|
|
351
359
|
},
|
|
352
360
|
"tax-registrations": {
|
|
353
361
|
setOnAfterTaxRegistrationAdded: (
|
|
354
362
|
_listener: (({ id }: { id: string }) => void) | undefined
|
|
355
363
|
): void => {},
|
|
356
|
-
setDisplayCountries: (_countries: string[] | undefined): void => {}
|
|
364
|
+
setDisplayCountries: (_countries: string[] | undefined): void => {},
|
|
357
365
|
},
|
|
358
366
|
"tax-threshold-monitoring": {
|
|
359
|
-
setDisplayCountries: (_countries: string[] | undefined): void => {}
|
|
367
|
+
setDisplayCountries: (_countries: string[] | undefined): void => {},
|
|
360
368
|
},
|
|
361
369
|
"product-tax-code-selector": {
|
|
362
370
|
setOnTaxCodeSelect: (
|
|
363
|
-
_listener: ((
|
|
371
|
+
_listener: ((taxCode: string) => void) | undefined
|
|
364
372
|
): void => {},
|
|
365
373
|
setHideDescription: (_hideDescription: boolean | undefined): void => {},
|
|
366
374
|
setDisabled: (_disabled: boolean | undefined): void => {},
|
|
367
|
-
setInitialTaxCode: (_initialTaxCode: string | undefined): void => {}
|
|
375
|
+
setInitialTaxCode: (_initialTaxCode: string | undefined): void => {},
|
|
368
376
|
},
|
|
369
|
-
"export-tax-transactions": {}
|
|
377
|
+
"export-tax-transactions": {},
|
|
370
378
|
};
|
package/types/index.d.ts
CHANGED
package/types/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ConnectElementCustomMethodConfig,
|
|
3
|
-
ConnectElementCommonMethodConfig
|
|
3
|
+
ConnectElementCommonMethodConfig,
|
|
4
4
|
} from "./config";
|
|
5
5
|
export declare type LoadConnectAndInitialize = (
|
|
6
6
|
initParams: IStripeConnectInitParams
|
|
@@ -490,6 +490,7 @@ export type ConnectElementTagName =
|
|
|
490
490
|
| "payments"
|
|
491
491
|
| "payouts"
|
|
492
492
|
| "payment-details"
|
|
493
|
+
| "payment-disputes"
|
|
493
494
|
| "account-onboarding"
|
|
494
495
|
| "payment-method-settings"
|
|
495
496
|
| "account-management"
|