@stripe/connect-js 3.2.0-beta.1 → 3.2.0
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 +1 -1
- package/dist/connect.esm.js +13 -27
- package/dist/connect.js +13 -27
- package/dist/pure.esm.js +13 -27
- package/dist/pure.js +13 -27
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +8 -16
- package/package.json +2 -2
- package/src/shared.ts +11 -21
- package/types/checks.ts +9 -0
- package/types/config.ts +8 -25
- package/types/shared.d.ts +17 -43
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This NPM package contains initialization logic for Connect embedded components a
|
|
|
5
5
|
|
|
6
6
|
Calling `loadConnectAndInitialize` always loads the latest version of Connect.js, regardless of which version of `@stripe/connect-js` you use. Updates for this package only impact tooling around the `loadConnectAndInitialize` helper itself and the TypeScript type definitions provided for Connect.js. Updates do not affect runtime availability of features of Connect.js.
|
|
7
7
|
|
|
8
|
-
The embedded onboarding component is generally available now. Please refer to our [documentation](https://stripe.com/docs/connect/
|
|
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
10
|
Note: Majority of Connect embedded components are currently still in beta. Please [contact us](https://stripe.com/docs/connect/get-started-connect-embedded-components#access) to request beta access.
|
|
11
11
|
|
package/dist/connect.esm.js
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: payment => {},
|
|
6
|
-
setOnClose: listener => {}
|
|
7
|
-
},
|
|
8
4
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
14
|
-
},
|
|
15
|
-
"issuing-card": {
|
|
16
|
-
setDefaultCard: defaultCard => {},
|
|
17
|
-
setCardArtFileLink: cardArtFileLink => {},
|
|
18
|
-
setCardSwitching: cardSwitching => {}
|
|
5
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
6
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
7
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
8
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
9
|
+
setOnExit: _listener => {}
|
|
19
10
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
11
|
+
"payment-details": {
|
|
12
|
+
setPayment: _payment => {},
|
|
13
|
+
setOnClose: _listener => {}
|
|
22
14
|
}
|
|
23
15
|
};
|
|
24
16
|
|
|
25
17
|
const componentNameMapping = {
|
|
18
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
26
19
|
payments: "stripe-connect-payments",
|
|
27
|
-
payouts: "stripe-connect-payouts",
|
|
28
20
|
"payment-details": "stripe-connect-payment-details",
|
|
29
|
-
|
|
30
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
31
|
-
"account-management": "stripe-connect-account-management",
|
|
32
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
33
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
34
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
35
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
21
|
+
payouts: "stripe-connect-payouts"
|
|
36
22
|
};
|
|
37
23
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
38
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
24
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
39
25
|
const findScript = () => {
|
|
40
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
26
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
41
27
|
};
|
|
42
28
|
const injectScript = () => {
|
|
43
29
|
const script = document.createElement("script");
|
|
@@ -146,7 +132,7 @@ const createWrapper = stripeConnect => {
|
|
|
146
132
|
sdk: true,
|
|
147
133
|
sdkOptions: {
|
|
148
134
|
// This will be replaced by the npm package version when bundling
|
|
149
|
-
sdkVersion: "3.2.0
|
|
135
|
+
sdkVersion: "3.2.0"
|
|
150
136
|
}
|
|
151
137
|
})
|
|
152
138
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -5,43 +5,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: payment => {},
|
|
10
|
-
setOnClose: listener => {}
|
|
11
|
-
},
|
|
12
8
|
"account-onboarding": {
|
|
13
|
-
setFullTermsOfServiceUrl:
|
|
14
|
-
setRecipientTermsOfServiceUrl:
|
|
15
|
-
setPrivacyPolicyUrl:
|
|
16
|
-
setSkipTermsOfServiceCollection:
|
|
17
|
-
setOnExit:
|
|
18
|
-
},
|
|
19
|
-
"issuing-card": {
|
|
20
|
-
setDefaultCard: defaultCard => {},
|
|
21
|
-
setCardArtFileLink: cardArtFileLink => {},
|
|
22
|
-
setCardSwitching: cardSwitching => {}
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
23
14
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
15
|
+
"payment-details": {
|
|
16
|
+
setPayment: _payment => {},
|
|
17
|
+
setOnClose: _listener => {}
|
|
26
18
|
}
|
|
27
19
|
};
|
|
28
20
|
|
|
29
21
|
const componentNameMapping = {
|
|
22
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
30
23
|
payments: "stripe-connect-payments",
|
|
31
|
-
payouts: "stripe-connect-payouts",
|
|
32
24
|
"payment-details": "stripe-connect-payment-details",
|
|
33
|
-
|
|
34
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
35
|
-
"account-management": "stripe-connect-account-management",
|
|
36
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
37
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
38
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
39
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
25
|
+
payouts: "stripe-connect-payouts"
|
|
40
26
|
};
|
|
41
27
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
42
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
28
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
43
29
|
const findScript = () => {
|
|
44
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
30
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
45
31
|
};
|
|
46
32
|
const injectScript = () => {
|
|
47
33
|
const script = document.createElement("script");
|
|
@@ -150,7 +136,7 @@ const createWrapper = stripeConnect => {
|
|
|
150
136
|
sdk: true,
|
|
151
137
|
sdkOptions: {
|
|
152
138
|
// This will be replaced by the npm package version when bundling
|
|
153
|
-
sdkVersion: "3.2.0
|
|
139
|
+
sdkVersion: "3.2.0"
|
|
154
140
|
}
|
|
155
141
|
})
|
|
156
142
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: payment => {},
|
|
6
|
-
setOnClose: listener => {}
|
|
7
|
-
},
|
|
8
4
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
14
|
-
},
|
|
15
|
-
"issuing-card": {
|
|
16
|
-
setDefaultCard: defaultCard => {},
|
|
17
|
-
setCardArtFileLink: cardArtFileLink => {},
|
|
18
|
-
setCardSwitching: cardSwitching => {}
|
|
5
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
6
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
7
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
8
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
9
|
+
setOnExit: _listener => {}
|
|
19
10
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
11
|
+
"payment-details": {
|
|
12
|
+
setPayment: _payment => {},
|
|
13
|
+
setOnClose: _listener => {}
|
|
22
14
|
}
|
|
23
15
|
};
|
|
24
16
|
|
|
25
17
|
const componentNameMapping = {
|
|
18
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
26
19
|
payments: "stripe-connect-payments",
|
|
27
|
-
payouts: "stripe-connect-payouts",
|
|
28
20
|
"payment-details": "stripe-connect-payment-details",
|
|
29
|
-
|
|
30
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
31
|
-
"account-management": "stripe-connect-account-management",
|
|
32
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
33
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
34
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
35
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
21
|
+
payouts: "stripe-connect-payouts"
|
|
36
22
|
};
|
|
37
23
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
38
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
24
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
39
25
|
const findScript = () => {
|
|
40
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
26
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
41
27
|
};
|
|
42
28
|
const injectScript = () => {
|
|
43
29
|
const script = document.createElement("script");
|
|
@@ -146,7 +132,7 @@ const createWrapper = stripeConnect => {
|
|
|
146
132
|
sdk: true,
|
|
147
133
|
sdkOptions: {
|
|
148
134
|
// This will be replaced by the npm package version when bundling
|
|
149
|
-
sdkVersion: "3.2.0
|
|
135
|
+
sdkVersion: "3.2.0"
|
|
150
136
|
}
|
|
151
137
|
})
|
|
152
138
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -5,43 +5,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: payment => {},
|
|
10
|
-
setOnClose: listener => {}
|
|
11
|
-
},
|
|
12
8
|
"account-onboarding": {
|
|
13
|
-
setFullTermsOfServiceUrl:
|
|
14
|
-
setRecipientTermsOfServiceUrl:
|
|
15
|
-
setPrivacyPolicyUrl:
|
|
16
|
-
setSkipTermsOfServiceCollection:
|
|
17
|
-
setOnExit:
|
|
18
|
-
},
|
|
19
|
-
"issuing-card": {
|
|
20
|
-
setDefaultCard: defaultCard => {},
|
|
21
|
-
setCardArtFileLink: cardArtFileLink => {},
|
|
22
|
-
setCardSwitching: cardSwitching => {}
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
23
14
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
15
|
+
"payment-details": {
|
|
16
|
+
setPayment: _payment => {},
|
|
17
|
+
setOnClose: _listener => {}
|
|
26
18
|
}
|
|
27
19
|
};
|
|
28
20
|
|
|
29
21
|
const componentNameMapping = {
|
|
22
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
30
23
|
payments: "stripe-connect-payments",
|
|
31
|
-
payouts: "stripe-connect-payouts",
|
|
32
24
|
"payment-details": "stripe-connect-payment-details",
|
|
33
|
-
|
|
34
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
35
|
-
"account-management": "stripe-connect-account-management",
|
|
36
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
37
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
38
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
39
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
25
|
+
payouts: "stripe-connect-payouts"
|
|
40
26
|
};
|
|
41
27
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
42
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
28
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
43
29
|
const findScript = () => {
|
|
44
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
30
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
45
31
|
};
|
|
46
32
|
const injectScript = () => {
|
|
47
33
|
const script = document.createElement("script");
|
|
@@ -150,7 +136,7 @@ const createWrapper = stripeConnect => {
|
|
|
150
136
|
sdk: true,
|
|
151
137
|
sdkOptions: {
|
|
152
138
|
// This will be replaced by the npm package version when bundling
|
|
153
|
-
sdkVersion: "3.2.0
|
|
139
|
+
sdkVersion: "3.2.0"
|
|
154
140
|
}
|
|
155
141
|
})
|
|
156
142
|
}));
|
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-payouts";
|
|
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,21 +1,13 @@
|
|
|
1
1
|
export declare const ConnectElementCustomMethodConfig: {
|
|
2
|
-
"payment-details": {
|
|
3
|
-
setPayment: (payment: string | undefined) => void;
|
|
4
|
-
setOnClose: (listener: (() => void) | undefined) => void;
|
|
5
|
-
};
|
|
6
2
|
"account-onboarding": {
|
|
7
|
-
setFullTermsOfServiceUrl: (
|
|
8
|
-
setRecipientTermsOfServiceUrl: (
|
|
9
|
-
setPrivacyPolicyUrl: (
|
|
10
|
-
setSkipTermsOfServiceCollection: (
|
|
11
|
-
setOnExit: (
|
|
3
|
+
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
4
|
+
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
5
|
+
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
6
|
+
setSkipTermsOfServiceCollection: (_skipTermsOfServiceCollection: boolean | undefined) => void;
|
|
7
|
+
setOnExit: (_listener: (() => void) | undefined) => void;
|
|
12
8
|
};
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setCardSwitching: (cardSwitching: boolean | undefined) => void;
|
|
17
|
-
};
|
|
18
|
-
"issuing-cards-list": {
|
|
19
|
-
setCardArtFileLink: (cardArtFileLink: string | undefined) => void;
|
|
9
|
+
"payment-details": {
|
|
10
|
+
setPayment: (_payment: string | undefined) => void;
|
|
11
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
20
12
|
};
|
|
21
13
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.2.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Connect.js loading utility package",
|
|
5
5
|
"main": "dist/connect.js",
|
|
6
6
|
"module": "dist/connect.esm.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"typings": "types/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "yarn lint && yarn test:unit --passWithNoTests && yarn typecheck",
|
|
10
|
+
"test": "yarn lint && yarn test:unit --passWithNoTests && yarn typecheck && yarn build",
|
|
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",
|
package/src/shared.ts
CHANGED
|
@@ -10,32 +10,20 @@ export type LoadConnectAndInitialize = (
|
|
|
10
10
|
initParams: IStripeConnectInitParams
|
|
11
11
|
) => StripeConnectInstance;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type ConnectElementHTMLName =
|
|
14
|
+
| "stripe-connect-account-onboarding"
|
|
14
15
|
| "stripe-connect-payments"
|
|
15
|
-
| "stripe-connect-payouts"
|
|
16
16
|
| "stripe-connect-payment-details"
|
|
17
|
-
| "stripe-connect-
|
|
18
|
-
| "stripe-connect-payment-method-settings"
|
|
19
|
-
| "stripe-connect-account-management"
|
|
20
|
-
| "stripe-connect-notification-banner"
|
|
21
|
-
| "stripe-connect-instant-payouts"
|
|
22
|
-
| "stripe-connect-issuing-card"
|
|
23
|
-
| "stripe-connect-issuing-cards-list";
|
|
17
|
+
| "stripe-connect-payouts";
|
|
24
18
|
|
|
25
19
|
export const componentNameMapping: Record<
|
|
26
20
|
ConnectElementTagName,
|
|
27
21
|
ConnectElementHTMLName
|
|
28
22
|
> = {
|
|
23
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
29
24
|
payments: "stripe-connect-payments",
|
|
30
|
-
payouts: "stripe-connect-payouts",
|
|
31
25
|
"payment-details": "stripe-connect-payment-details",
|
|
32
|
-
|
|
33
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
34
|
-
"account-management": "stripe-connect-account-management",
|
|
35
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
36
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
37
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
38
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
26
|
+
payouts: "stripe-connect-payouts"
|
|
39
27
|
};
|
|
40
28
|
|
|
41
29
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -48,12 +36,14 @@ interface StripeConnectWrapper {
|
|
|
48
36
|
|
|
49
37
|
const EXISTING_SCRIPT_MESSAGE =
|
|
50
38
|
"loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
51
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
39
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
52
40
|
|
|
53
41
|
export const findScript = (): HTMLScriptElement | null => {
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
return (
|
|
43
|
+
document.querySelectorAll<HTMLScriptElement>(
|
|
44
|
+
`script[src="${V0_URL}"]`
|
|
45
|
+
)[0] || null
|
|
46
|
+
);
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
const injectScript = (): HTMLScriptElement => {
|
package/types/checks.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConnectElementCustomMethodConfig } from "./config";
|
|
2
|
+
import { ConnectElementTagName } from "./shared.d";
|
|
3
|
+
|
|
4
|
+
// ensure that keys of ConnectElementCustomMethodConfig are from ConnectElementTagName
|
|
5
|
+
export type HasType<T, Q extends T> = Q;
|
|
6
|
+
export type CustomMethodConfigValidation = HasType<
|
|
7
|
+
ConnectElementTagName,
|
|
8
|
+
keyof typeof ConnectElementCustomMethodConfig
|
|
9
|
+
>;
|
package/types/config.ts
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
import { ConnectElementTagName } from "./shared.d";
|
|
2
|
-
|
|
3
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
4
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
3
|
|
|
6
4
|
export const ConnectElementCustomMethodConfig = {
|
|
7
|
-
"payment-details": {
|
|
8
|
-
setPayment: (payment: string | undefined): void => {},
|
|
9
|
-
setOnClose: (listener: (() => void) | undefined): void => {}
|
|
10
|
-
},
|
|
11
5
|
"account-onboarding": {
|
|
12
6
|
setFullTermsOfServiceUrl: (
|
|
13
|
-
|
|
7
|
+
_termOfServiceUrl: string | undefined
|
|
14
8
|
): void => {},
|
|
15
9
|
setRecipientTermsOfServiceUrl: (
|
|
16
|
-
|
|
10
|
+
_recipientTermsOfServiceUrl: string | undefined
|
|
17
11
|
): void => {},
|
|
18
|
-
setPrivacyPolicyUrl: (
|
|
12
|
+
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
19
13
|
setSkipTermsOfServiceCollection: (
|
|
20
|
-
|
|
14
|
+
_skipTermsOfServiceCollection: boolean | undefined
|
|
21
15
|
): void => {},
|
|
22
|
-
setOnExit: (
|
|
16
|
+
setOnExit: (_listener: (() => void) | undefined): void => {}
|
|
23
17
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
setCardSwitching: (cardSwitching: boolean | undefined): void => {}
|
|
28
|
-
},
|
|
29
|
-
"issuing-cards-list": {
|
|
30
|
-
setCardArtFileLink: (cardArtFileLink: string | undefined): void => {}
|
|
18
|
+
"payment-details": {
|
|
19
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
20
|
+
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
31
21
|
}
|
|
32
22
|
};
|
|
33
|
-
|
|
34
|
-
// ensure that keys of ConnectElementCustomMethodConfig are from ConnectElementTagName
|
|
35
|
-
type HasType<T, Q extends T> = Q;
|
|
36
|
-
type CustomMethodConfigValidation = HasType<
|
|
37
|
-
ConnectElementTagName,
|
|
38
|
-
keyof typeof ConnectElementCustomMethodConfig
|
|
39
|
-
>;
|
package/types/shared.d.ts
CHANGED
|
@@ -76,17 +76,17 @@ export declare type AppearanceVariables = {
|
|
|
76
76
|
fontFamily?: string;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* The baseline font size set on the embedded component root. This scales the value of other font size variables. This supports pixel values only.
|
|
79
|
+
* The baseline font size set on the embedded component root. This scales the value of other font size variables. This supports pixel values only ranging from 1px to 40px, 0.1em to 4em, and 0.1rem to 4rem.
|
|
80
80
|
*/
|
|
81
81
|
fontSizeBase?: string;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* The base spacing unit that derives all spacing values. Increase or decrease this value to make your layout more or less spacious. This supports pixel values only.
|
|
84
|
+
* The base spacing unit that derives all spacing values. Increase or decrease this value to make your layout more or less spacious. This supports pixel values only ranging from 8px to 20px.
|
|
85
85
|
*/
|
|
86
86
|
spacingUnit?: string;
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* The general border radius used in embedded components. This sets the default border radius for all components. This supports pixel values only.
|
|
89
|
+
* The general border radius used in embedded components. This sets the default border radius for all components. This supports pixel values only, with a maximum value of 24px.
|
|
90
90
|
*/
|
|
91
91
|
borderRadius?: string;
|
|
92
92
|
|
|
@@ -240,15 +240,15 @@ export declare type AppearanceVariables = {
|
|
|
240
240
|
*/
|
|
241
241
|
buttonBorderRadius?: string;
|
|
242
242
|
/**
|
|
243
|
-
* The border radius used for form elements. This supports pixel values only.
|
|
243
|
+
* The border radius used for form elements. This supports pixel values only, with a maximum value of 24px.
|
|
244
244
|
*/
|
|
245
245
|
formBorderRadius?: string;
|
|
246
246
|
/**
|
|
247
|
-
* The border radius used for badges. This supports pixel values only.
|
|
247
|
+
* The border radius used for badges. This supports pixel values only, with a maximum value of 24px.
|
|
248
248
|
*/
|
|
249
249
|
badgeBorderRadius?: string;
|
|
250
250
|
/**
|
|
251
|
-
* The border radius used for overlays. This supports pixel values only.
|
|
251
|
+
* The border radius used for overlays. This supports pixel values only, with a maximum value of 24px.
|
|
252
252
|
*/
|
|
253
253
|
overlayBorderRadius?: string;
|
|
254
254
|
|
|
@@ -262,15 +262,7 @@ export declare type AppearanceVariables = {
|
|
|
262
262
|
|
|
263
263
|
// Body Typography
|
|
264
264
|
/**
|
|
265
|
-
* The font size for the
|
|
266
|
-
*/
|
|
267
|
-
bodyLgFontSize?: string;
|
|
268
|
-
/**
|
|
269
|
-
* The font weight for the large body typography. Body typography variables accept a valid font weight value.
|
|
270
|
-
*/
|
|
271
|
-
bodyLgFontWeight?: string;
|
|
272
|
-
/**
|
|
273
|
-
* The font size for the medium body typography. Body typography variables accept a valid font size value.
|
|
265
|
+
* The font size for the medium body typography. Body typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
274
266
|
*/
|
|
275
267
|
bodyMdFontSize?: string;
|
|
276
268
|
/**
|
|
@@ -278,7 +270,7 @@ export declare type AppearanceVariables = {
|
|
|
278
270
|
*/
|
|
279
271
|
bodyMdFontWeight?: string;
|
|
280
272
|
/**
|
|
281
|
-
* The font size for the small body typography. Body typography variables accept a valid font size value.
|
|
273
|
+
* The font size for the small body typography. Body typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
282
274
|
*/
|
|
283
275
|
bodySmFontSize?: string;
|
|
284
276
|
/**
|
|
@@ -288,7 +280,7 @@ export declare type AppearanceVariables = {
|
|
|
288
280
|
|
|
289
281
|
// Heading Typography
|
|
290
282
|
/**
|
|
291
|
-
* The font size for the extra large heading typography. Heading typography variables accept a valid font size value.
|
|
283
|
+
* The font size for the extra large heading typography. Heading typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
292
284
|
*/
|
|
293
285
|
headingXlFontSize?: string;
|
|
294
286
|
/**
|
|
@@ -300,7 +292,7 @@ export declare type AppearanceVariables = {
|
|
|
300
292
|
*/
|
|
301
293
|
headingXlTextTransform?: string;
|
|
302
294
|
/**
|
|
303
|
-
* The font size for the large heading typography. Heading typography variables accept a valid font size value.
|
|
295
|
+
* The font size for the large heading typography. Heading typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
304
296
|
*/
|
|
305
297
|
headingLgFontSize?: string;
|
|
306
298
|
/**
|
|
@@ -312,7 +304,7 @@ export declare type AppearanceVariables = {
|
|
|
312
304
|
*/
|
|
313
305
|
headingLgTextTransform?: string;
|
|
314
306
|
/**
|
|
315
|
-
* The font size for the medium heading typography. Heading typography variables accept a valid font size value.
|
|
307
|
+
* The font size for the medium heading typography. Heading typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
316
308
|
*/
|
|
317
309
|
headingMdFontSize?: string;
|
|
318
310
|
/**
|
|
@@ -324,7 +316,7 @@ export declare type AppearanceVariables = {
|
|
|
324
316
|
*/
|
|
325
317
|
headingMdTextTransform?: string;
|
|
326
318
|
/**
|
|
327
|
-
* The font size for the small heading typography. Heading typography variables accept a valid font size value.
|
|
319
|
+
* The font size for the small heading typography. Heading typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
328
320
|
*/
|
|
329
321
|
headingSmFontSize?: string;
|
|
330
322
|
/**
|
|
@@ -336,7 +328,7 @@ export declare type AppearanceVariables = {
|
|
|
336
328
|
*/
|
|
337
329
|
headingSmTextTransform?: string;
|
|
338
330
|
/**
|
|
339
|
-
* The font size for the extra small heading typography. Heading typography variables accept a valid font size value.
|
|
331
|
+
* The font size for the extra small heading typography. Heading typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
340
332
|
*/
|
|
341
333
|
headingXsFontSize?: string;
|
|
342
334
|
/**
|
|
@@ -350,19 +342,7 @@ export declare type AppearanceVariables = {
|
|
|
350
342
|
|
|
351
343
|
// Label Typography
|
|
352
344
|
/**
|
|
353
|
-
* The font size for the
|
|
354
|
-
*/
|
|
355
|
-
labelLgFontSize?: string;
|
|
356
|
-
/**
|
|
357
|
-
* The font weight for the large label typography. Label typography variables accept a valid font weight value.
|
|
358
|
-
*/
|
|
359
|
-
labelLgFontWeight?: string;
|
|
360
|
-
/**
|
|
361
|
-
* The text transform for the large label typography. Label typography variables accept a valid text transform value.
|
|
362
|
-
*/
|
|
363
|
-
labelLgTextTransform?: string;
|
|
364
|
-
/**
|
|
365
|
-
* The font size for the medium label typography. Label typography variables accept a valid font size value.
|
|
345
|
+
* The font size for the medium label typography. Label typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
366
346
|
*/
|
|
367
347
|
labelMdFontSize?: string;
|
|
368
348
|
/**
|
|
@@ -374,7 +354,7 @@ export declare type AppearanceVariables = {
|
|
|
374
354
|
*/
|
|
375
355
|
labelMdTextTransform?: string;
|
|
376
356
|
/**
|
|
377
|
-
* The font size for the small label typography. Label typography variables accept a valid font size value.
|
|
357
|
+
* The font size for the small label typography. Label typography variables accept a valid font size value ranging from 1px to 200px, 0.1em to 12em, and 0.1rem to 12rem.
|
|
378
358
|
*/
|
|
379
359
|
labelSmFontSize?: string;
|
|
380
360
|
/**
|
|
@@ -467,13 +447,7 @@ export interface StripeConnectInstance {
|
|
|
467
447
|
* Tagnames to be used with the `create` method of the Connect instance.
|
|
468
448
|
*/
|
|
469
449
|
export type ConnectElementTagName =
|
|
450
|
+
| "account-onboarding"
|
|
470
451
|
| "payments"
|
|
471
|
-
| "payouts"
|
|
472
452
|
| "payment-details"
|
|
473
|
-
| "
|
|
474
|
-
| "payment-method-settings"
|
|
475
|
-
| "account-management"
|
|
476
|
-
| "notification-banner"
|
|
477
|
-
| "instant-payouts"
|
|
478
|
-
| "issuing-card"
|
|
479
|
-
| "issuing-cards-list";
|
|
453
|
+
| "payouts";
|