@stripe/connect-js 3.1.0 → 3.1.1-beta.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 +1 -1
- package/dist/connect.esm.js +31 -9
- package/dist/connect.js +31 -9
- package/dist/pure.esm.js +31 -9
- package/dist/pure.js +31 -9
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +27 -5
- package/package.json +2 -2
- package/src/shared.ts +27 -6
- package/types/checks.ts +9 -0
- package/types/config.ts +31 -14
- package/types/shared.d.ts +26 -16
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,22 +1,44 @@
|
|
|
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
|
+
},
|
|
4
8
|
"account-onboarding": {
|
|
5
|
-
setFullTermsOfServiceUrl:
|
|
6
|
-
setRecipientTermsOfServiceUrl:
|
|
7
|
-
setPrivacyPolicyUrl:
|
|
8
|
-
setSkipTermsOfServiceCollection:
|
|
9
|
-
setOnExit:
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
14
|
+
},
|
|
15
|
+
"issuing-card": {
|
|
16
|
+
setDefaultCard: _defaultCard => {},
|
|
17
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
18
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
19
|
+
},
|
|
20
|
+
"issuing-cards-list": {
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
10
23
|
}
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
const componentNameMapping = {
|
|
14
|
-
|
|
27
|
+
payments: "stripe-connect-payments",
|
|
28
|
+
payouts: "stripe-connect-payouts",
|
|
29
|
+
"payment-details": "stripe-connect-payment-details",
|
|
30
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
31
|
+
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
32
|
+
"account-management": "stripe-connect-account-management",
|
|
33
|
+
"notification-banner": "stripe-connect-notification-banner",
|
|
34
|
+
"instant-payouts": "stripe-connect-instant-payouts",
|
|
35
|
+
"issuing-card": "stripe-connect-issuing-card",
|
|
36
|
+
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
15
37
|
};
|
|
16
38
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
17
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
39
|
+
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
18
40
|
const findScript = () => {
|
|
19
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
41
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
20
42
|
};
|
|
21
43
|
const injectScript = () => {
|
|
22
44
|
const script = document.createElement("script");
|
|
@@ -125,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
125
147
|
sdk: true,
|
|
126
148
|
sdkOptions: {
|
|
127
149
|
// This will be replaced by the npm package version when bundling
|
|
128
|
-
sdkVersion: "3.1.
|
|
150
|
+
sdkVersion: "3.1.1-beta.1"
|
|
129
151
|
}
|
|
130
152
|
})
|
|
131
153
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -5,22 +5,44 @@ 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
|
+
},
|
|
8
12
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
13
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
|
+
setOnExit: _listener => {}
|
|
18
|
+
},
|
|
19
|
+
"issuing-card": {
|
|
20
|
+
setDefaultCard: _defaultCard => {},
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
23
|
+
},
|
|
24
|
+
"issuing-cards-list": {
|
|
25
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
26
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
14
27
|
}
|
|
15
28
|
};
|
|
16
29
|
|
|
17
30
|
const componentNameMapping = {
|
|
18
|
-
|
|
31
|
+
payments: "stripe-connect-payments",
|
|
32
|
+
payouts: "stripe-connect-payouts",
|
|
33
|
+
"payment-details": "stripe-connect-payment-details",
|
|
34
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
35
|
+
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
36
|
+
"account-management": "stripe-connect-account-management",
|
|
37
|
+
"notification-banner": "stripe-connect-notification-banner",
|
|
38
|
+
"instant-payouts": "stripe-connect-instant-payouts",
|
|
39
|
+
"issuing-card": "stripe-connect-issuing-card",
|
|
40
|
+
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
19
41
|
};
|
|
20
42
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
21
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
43
|
+
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
22
44
|
const findScript = () => {
|
|
23
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
45
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
24
46
|
};
|
|
25
47
|
const injectScript = () => {
|
|
26
48
|
const script = document.createElement("script");
|
|
@@ -129,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
129
151
|
sdk: true,
|
|
130
152
|
sdkOptions: {
|
|
131
153
|
// This will be replaced by the npm package version when bundling
|
|
132
|
-
sdkVersion: "3.1.
|
|
154
|
+
sdkVersion: "3.1.1-beta.1"
|
|
133
155
|
}
|
|
134
156
|
})
|
|
135
157
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
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
|
+
},
|
|
4
8
|
"account-onboarding": {
|
|
5
|
-
setFullTermsOfServiceUrl:
|
|
6
|
-
setRecipientTermsOfServiceUrl:
|
|
7
|
-
setPrivacyPolicyUrl:
|
|
8
|
-
setSkipTermsOfServiceCollection:
|
|
9
|
-
setOnExit:
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
14
|
+
},
|
|
15
|
+
"issuing-card": {
|
|
16
|
+
setDefaultCard: _defaultCard => {},
|
|
17
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
18
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
19
|
+
},
|
|
20
|
+
"issuing-cards-list": {
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
10
23
|
}
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
const componentNameMapping = {
|
|
14
|
-
|
|
27
|
+
payments: "stripe-connect-payments",
|
|
28
|
+
payouts: "stripe-connect-payouts",
|
|
29
|
+
"payment-details": "stripe-connect-payment-details",
|
|
30
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
31
|
+
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
32
|
+
"account-management": "stripe-connect-account-management",
|
|
33
|
+
"notification-banner": "stripe-connect-notification-banner",
|
|
34
|
+
"instant-payouts": "stripe-connect-instant-payouts",
|
|
35
|
+
"issuing-card": "stripe-connect-issuing-card",
|
|
36
|
+
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
15
37
|
};
|
|
16
38
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
17
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
39
|
+
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
18
40
|
const findScript = () => {
|
|
19
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
41
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
20
42
|
};
|
|
21
43
|
const injectScript = () => {
|
|
22
44
|
const script = document.createElement("script");
|
|
@@ -125,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
125
147
|
sdk: true,
|
|
126
148
|
sdkOptions: {
|
|
127
149
|
// This will be replaced by the npm package version when bundling
|
|
128
|
-
sdkVersion: "3.1.
|
|
150
|
+
sdkVersion: "3.1.1-beta.1"
|
|
129
151
|
}
|
|
130
152
|
})
|
|
131
153
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -5,22 +5,44 @@ 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
|
+
},
|
|
8
12
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
13
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
|
+
setOnExit: _listener => {}
|
|
18
|
+
},
|
|
19
|
+
"issuing-card": {
|
|
20
|
+
setDefaultCard: _defaultCard => {},
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
23
|
+
},
|
|
24
|
+
"issuing-cards-list": {
|
|
25
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
26
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
14
27
|
}
|
|
15
28
|
};
|
|
16
29
|
|
|
17
30
|
const componentNameMapping = {
|
|
18
|
-
|
|
31
|
+
payments: "stripe-connect-payments",
|
|
32
|
+
payouts: "stripe-connect-payouts",
|
|
33
|
+
"payment-details": "stripe-connect-payment-details",
|
|
34
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
35
|
+
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
36
|
+
"account-management": "stripe-connect-account-management",
|
|
37
|
+
"notification-banner": "stripe-connect-notification-banner",
|
|
38
|
+
"instant-payouts": "stripe-connect-instant-payouts",
|
|
39
|
+
"issuing-card": "stripe-connect-issuing-card",
|
|
40
|
+
"issuing-cards-list": "stripe-connect-issuing-cards-list"
|
|
19
41
|
};
|
|
20
42
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
21
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
43
|
+
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
22
44
|
const findScript = () => {
|
|
23
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
45
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
24
46
|
};
|
|
25
47
|
const injectScript = () => {
|
|
26
48
|
const script = document.createElement("script");
|
|
@@ -129,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
129
151
|
sdk: true,
|
|
130
152
|
sdkOptions: {
|
|
131
153
|
// This will be replaced by the npm package version when bundling
|
|
132
|
-
sdkVersion: "3.1.
|
|
154
|
+
sdkVersion: "3.1.1-beta.1"
|
|
133
155
|
}
|
|
134
156
|
})
|
|
135
157
|
}));
|
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
|
-
type ConnectElementHTMLName = "stripe-connect-account-onboarding";
|
|
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";
|
|
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,9 +1,31 @@
|
|
|
1
|
+
type FetchEphemeralKeyFunction = (fetchParams: {
|
|
2
|
+
issuingCard: string;
|
|
3
|
+
nonce: string;
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
issuingCard: string;
|
|
6
|
+
nonce: string;
|
|
7
|
+
ephemeralKeySecret: string;
|
|
8
|
+
}>;
|
|
1
9
|
export declare const ConnectElementCustomMethodConfig: {
|
|
10
|
+
"payment-details": {
|
|
11
|
+
setPayment: (_payment: string | undefined) => void;
|
|
12
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
13
|
+
};
|
|
2
14
|
"account-onboarding": {
|
|
3
|
-
setFullTermsOfServiceUrl: (
|
|
4
|
-
setRecipientTermsOfServiceUrl: (
|
|
5
|
-
setPrivacyPolicyUrl: (
|
|
6
|
-
setSkipTermsOfServiceCollection: (
|
|
7
|
-
setOnExit: (
|
|
15
|
+
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
16
|
+
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
17
|
+
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
18
|
+
setSkipTermsOfServiceCollection: (_skipTermsOfServiceCollection: boolean | undefined) => void;
|
|
19
|
+
setOnExit: (_listener: (() => void) | undefined) => void;
|
|
20
|
+
};
|
|
21
|
+
"issuing-card": {
|
|
22
|
+
setDefaultCard: (_defaultCard: string | undefined) => void;
|
|
23
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
24
|
+
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
25
|
+
};
|
|
26
|
+
"issuing-cards-list": {
|
|
27
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
28
|
+
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
8
29
|
};
|
|
9
30
|
};
|
|
31
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1-beta.1",
|
|
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,13 +10,32 @@ export type LoadConnectAndInitialize = (
|
|
|
10
10
|
initParams: IStripeConnectInitParams
|
|
11
11
|
) => StripeConnectInstance;
|
|
12
12
|
|
|
13
|
-
type ConnectElementHTMLName =
|
|
13
|
+
export type ConnectElementHTMLName =
|
|
14
|
+
| "stripe-connect-payments"
|
|
15
|
+
| "stripe-connect-payouts"
|
|
16
|
+
| "stripe-connect-payment-details"
|
|
17
|
+
| "stripe-connect-account-onboarding"
|
|
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";
|
|
14
24
|
|
|
15
25
|
export const componentNameMapping: Record<
|
|
16
26
|
ConnectElementTagName,
|
|
17
27
|
ConnectElementHTMLName
|
|
18
28
|
> = {
|
|
19
|
-
|
|
29
|
+
payments: "stripe-connect-payments",
|
|
30
|
+
payouts: "stripe-connect-payouts",
|
|
31
|
+
"payment-details": "stripe-connect-payment-details",
|
|
32
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
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"
|
|
20
39
|
};
|
|
21
40
|
|
|
22
41
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -29,12 +48,14 @@ interface StripeConnectWrapper {
|
|
|
29
48
|
|
|
30
49
|
const EXISTING_SCRIPT_MESSAGE =
|
|
31
50
|
"loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
32
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
51
|
+
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
33
52
|
|
|
34
53
|
export const findScript = (): HTMLScriptElement | null => {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
return (
|
|
55
|
+
document.querySelectorAll<HTMLScriptElement>(
|
|
56
|
+
`script[src="${V0_URL}"]`
|
|
57
|
+
)[0] || null
|
|
58
|
+
);
|
|
38
59
|
};
|
|
39
60
|
|
|
40
61
|
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,27 +1,44 @@
|
|
|
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
|
|
|
4
|
+
type FetchEphemeralKeyFunction = (fetchParams: {
|
|
5
|
+
issuingCard: string;
|
|
6
|
+
nonce: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
issuingCard: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
ephemeralKeySecret: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
6
13
|
export const ConnectElementCustomMethodConfig = {
|
|
14
|
+
"payment-details": {
|
|
15
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
16
|
+
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
17
|
+
},
|
|
7
18
|
"account-onboarding": {
|
|
8
19
|
setFullTermsOfServiceUrl: (
|
|
9
|
-
|
|
20
|
+
_termOfServiceUrl: string | undefined
|
|
10
21
|
): void => {},
|
|
11
22
|
setRecipientTermsOfServiceUrl: (
|
|
12
|
-
|
|
23
|
+
_recipientTermsOfServiceUrl: string | undefined
|
|
13
24
|
): void => {},
|
|
14
|
-
setPrivacyPolicyUrl: (
|
|
25
|
+
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
15
26
|
setSkipTermsOfServiceCollection: (
|
|
16
|
-
|
|
27
|
+
_skipTermsOfServiceCollection: boolean | undefined
|
|
17
28
|
): void => {},
|
|
18
|
-
setOnExit: (
|
|
29
|
+
setOnExit: (_listener: (() => void) | undefined): void => {}
|
|
30
|
+
},
|
|
31
|
+
"issuing-card": {
|
|
32
|
+
setDefaultCard: (_defaultCard: string | undefined): void => {},
|
|
33
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
34
|
+
setFetchEphemeralKey: (
|
|
35
|
+
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
36
|
+
): void => {}
|
|
37
|
+
},
|
|
38
|
+
"issuing-cards-list": {
|
|
39
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
40
|
+
setFetchEphemeralKey: (
|
|
41
|
+
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
42
|
+
): void => {}
|
|
19
43
|
}
|
|
20
44
|
};
|
|
21
|
-
|
|
22
|
-
// ensure that keys of ConnectElementCustomMethodConfig are from ConnectElementTagName
|
|
23
|
-
type HasType<T, Q extends T> = Q;
|
|
24
|
-
type CustomMethodConfigValidation = HasType<
|
|
25
|
-
ConnectElementTagName,
|
|
26
|
-
keyof typeof ConnectElementCustomMethodConfig
|
|
27
|
-
>;
|
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,7 +262,7 @@ export declare type AppearanceVariables = {
|
|
|
262
262
|
|
|
263
263
|
// Body Typography
|
|
264
264
|
/**
|
|
265
|
-
* 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.
|
|
266
266
|
*/
|
|
267
267
|
bodyMdFontSize?: string;
|
|
268
268
|
/**
|
|
@@ -270,7 +270,7 @@ export declare type AppearanceVariables = {
|
|
|
270
270
|
*/
|
|
271
271
|
bodyMdFontWeight?: string;
|
|
272
272
|
/**
|
|
273
|
-
* 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.
|
|
274
274
|
*/
|
|
275
275
|
bodySmFontSize?: string;
|
|
276
276
|
/**
|
|
@@ -280,7 +280,7 @@ export declare type AppearanceVariables = {
|
|
|
280
280
|
|
|
281
281
|
// Heading Typography
|
|
282
282
|
/**
|
|
283
|
-
* 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.
|
|
284
284
|
*/
|
|
285
285
|
headingXlFontSize?: string;
|
|
286
286
|
/**
|
|
@@ -292,7 +292,7 @@ export declare type AppearanceVariables = {
|
|
|
292
292
|
*/
|
|
293
293
|
headingXlTextTransform?: string;
|
|
294
294
|
/**
|
|
295
|
-
* 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.
|
|
296
296
|
*/
|
|
297
297
|
headingLgFontSize?: string;
|
|
298
298
|
/**
|
|
@@ -304,7 +304,7 @@ export declare type AppearanceVariables = {
|
|
|
304
304
|
*/
|
|
305
305
|
headingLgTextTransform?: string;
|
|
306
306
|
/**
|
|
307
|
-
* 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.
|
|
308
308
|
*/
|
|
309
309
|
headingMdFontSize?: string;
|
|
310
310
|
/**
|
|
@@ -316,7 +316,7 @@ export declare type AppearanceVariables = {
|
|
|
316
316
|
*/
|
|
317
317
|
headingMdTextTransform?: string;
|
|
318
318
|
/**
|
|
319
|
-
* 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.
|
|
320
320
|
*/
|
|
321
321
|
headingSmFontSize?: string;
|
|
322
322
|
/**
|
|
@@ -328,7 +328,7 @@ export declare type AppearanceVariables = {
|
|
|
328
328
|
*/
|
|
329
329
|
headingSmTextTransform?: string;
|
|
330
330
|
/**
|
|
331
|
-
* 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.
|
|
332
332
|
*/
|
|
333
333
|
headingXsFontSize?: string;
|
|
334
334
|
/**
|
|
@@ -342,7 +342,7 @@ export declare type AppearanceVariables = {
|
|
|
342
342
|
|
|
343
343
|
// Label Typography
|
|
344
344
|
/**
|
|
345
|
-
* 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.
|
|
346
346
|
*/
|
|
347
347
|
labelMdFontSize?: string;
|
|
348
348
|
/**
|
|
@@ -354,7 +354,7 @@ export declare type AppearanceVariables = {
|
|
|
354
354
|
*/
|
|
355
355
|
labelMdTextTransform?: string;
|
|
356
356
|
/**
|
|
357
|
-
* 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.
|
|
358
358
|
*/
|
|
359
359
|
labelSmFontSize?: string;
|
|
360
360
|
/**
|
|
@@ -446,4 +446,14 @@ export interface StripeConnectInstance {
|
|
|
446
446
|
/**
|
|
447
447
|
* Tagnames to be used with the `create` method of the Connect instance.
|
|
448
448
|
*/
|
|
449
|
-
export type ConnectElementTagName =
|
|
449
|
+
export type ConnectElementTagName =
|
|
450
|
+
| "payments"
|
|
451
|
+
| "payouts"
|
|
452
|
+
| "payment-details"
|
|
453
|
+
| "account-onboarding"
|
|
454
|
+
| "payment-method-settings"
|
|
455
|
+
| "account-management"
|
|
456
|
+
| "notification-banner"
|
|
457
|
+
| "instant-payouts"
|
|
458
|
+
| "issuing-card"
|
|
459
|
+
| "issuing-cards-list";
|