@stripe/connect-js 3.1.0-beta.1 → 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 -12
- package/dist/connect.esm.js +14 -13
- package/dist/connect.js +14 -13
- package/dist/pure.esm.js +14 -13
- package/dist/pure.js +14 -13
- package/dist/types/config.d.ts +21 -11
- package/package.json +2 -2
- package/src/shared.ts +5 -3
- package/types/checks.ts +9 -0
- package/types/config.ts +25 -20
- package/types/shared.d.ts +70 -35
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
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
|
|
|
@@ -60,17 +60,6 @@ script tag is inserted immediately upon page load.
|
|
|
60
60
|
import "@stripe/connect-js";
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
### Manually include the script tag
|
|
64
|
-
|
|
65
|
-
Manually add the Connect.js script tag to the `<head>` of each page on your site.
|
|
66
|
-
If an existing script tag is already present, this module will not insert a new
|
|
67
|
-
one. When you call `loadConnectAndInitialize`, it will use the existing script tag.
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<!-- Somewhere in your site's <head> -->
|
|
71
|
-
<script src="https://connect-js.stripe.com/v0.1/connect.js" async></script>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
63
|
### Importing `loadConnectAndInitialize` without side effects
|
|
75
64
|
|
|
76
65
|
If you would like to use `loadConnectAndInitialize` in your application, but defer loading the
|
package/dist/connect.esm.js
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
4
|
"payment-details": {
|
|
5
|
-
setPayment:
|
|
6
|
-
setOnClose:
|
|
5
|
+
setPayment: _payment => {},
|
|
6
|
+
setOnClose: _listener => {}
|
|
7
7
|
},
|
|
8
8
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
14
14
|
},
|
|
15
15
|
"issuing-card": {
|
|
16
|
-
setDefaultCard:
|
|
17
|
-
setCardArtFileLink:
|
|
18
|
-
|
|
16
|
+
setDefaultCard: _defaultCard => {},
|
|
17
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
18
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
19
19
|
},
|
|
20
20
|
"issuing-cards-list": {
|
|
21
|
-
setCardArtFileLink:
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -37,7 +38,7 @@ const componentNameMapping = {
|
|
|
37
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";
|
|
38
39
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
39
40
|
const findScript = () => {
|
|
40
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
41
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
41
42
|
};
|
|
42
43
|
const injectScript = () => {
|
|
43
44
|
const script = document.createElement("script");
|
|
@@ -146,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
146
147
|
sdk: true,
|
|
147
148
|
sdkOptions: {
|
|
148
149
|
// This will be replaced by the npm package version when bundling
|
|
149
|
-
sdkVersion: "3.1.
|
|
150
|
+
sdkVersion: "3.1.1-beta.1"
|
|
150
151
|
}
|
|
151
152
|
})
|
|
152
153
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -6,23 +6,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
8
|
"payment-details": {
|
|
9
|
-
setPayment:
|
|
10
|
-
setOnClose:
|
|
9
|
+
setPayment: _payment => {},
|
|
10
|
+
setOnClose: _listener => {}
|
|
11
11
|
},
|
|
12
12
|
"account-onboarding": {
|
|
13
|
-
setFullTermsOfServiceUrl:
|
|
14
|
-
setRecipientTermsOfServiceUrl:
|
|
15
|
-
setPrivacyPolicyUrl:
|
|
16
|
-
setSkipTermsOfServiceCollection:
|
|
17
|
-
setOnExit:
|
|
13
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
|
+
setOnExit: _listener => {}
|
|
18
18
|
},
|
|
19
19
|
"issuing-card": {
|
|
20
|
-
setDefaultCard:
|
|
21
|
-
setCardArtFileLink:
|
|
22
|
-
|
|
20
|
+
setDefaultCard: _defaultCard => {},
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
23
23
|
},
|
|
24
24
|
"issuing-cards-list": {
|
|
25
|
-
setCardArtFileLink:
|
|
25
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
26
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -41,7 +42,7 @@ const componentNameMapping = {
|
|
|
41
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";
|
|
42
43
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
43
44
|
const findScript = () => {
|
|
44
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
45
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
45
46
|
};
|
|
46
47
|
const injectScript = () => {
|
|
47
48
|
const script = document.createElement("script");
|
|
@@ -150,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
150
151
|
sdk: true,
|
|
151
152
|
sdkOptions: {
|
|
152
153
|
// This will be replaced by the npm package version when bundling
|
|
153
|
-
sdkVersion: "3.1.
|
|
154
|
+
sdkVersion: "3.1.1-beta.1"
|
|
154
155
|
}
|
|
155
156
|
})
|
|
156
157
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
4
|
"payment-details": {
|
|
5
|
-
setPayment:
|
|
6
|
-
setOnClose:
|
|
5
|
+
setPayment: _payment => {},
|
|
6
|
+
setOnClose: _listener => {}
|
|
7
7
|
},
|
|
8
8
|
"account-onboarding": {
|
|
9
|
-
setFullTermsOfServiceUrl:
|
|
10
|
-
setRecipientTermsOfServiceUrl:
|
|
11
|
-
setPrivacyPolicyUrl:
|
|
12
|
-
setSkipTermsOfServiceCollection:
|
|
13
|
-
setOnExit:
|
|
9
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
11
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
12
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
13
|
+
setOnExit: _listener => {}
|
|
14
14
|
},
|
|
15
15
|
"issuing-card": {
|
|
16
|
-
setDefaultCard:
|
|
17
|
-
setCardArtFileLink:
|
|
18
|
-
|
|
16
|
+
setDefaultCard: _defaultCard => {},
|
|
17
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
18
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
19
19
|
},
|
|
20
20
|
"issuing-cards-list": {
|
|
21
|
-
setCardArtFileLink:
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -37,7 +38,7 @@ const componentNameMapping = {
|
|
|
37
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";
|
|
38
39
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
39
40
|
const findScript = () => {
|
|
40
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
41
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
41
42
|
};
|
|
42
43
|
const injectScript = () => {
|
|
43
44
|
const script = document.createElement("script");
|
|
@@ -146,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
146
147
|
sdk: true,
|
|
147
148
|
sdkOptions: {
|
|
148
149
|
// This will be replaced by the npm package version when bundling
|
|
149
|
-
sdkVersion: "3.1.
|
|
150
|
+
sdkVersion: "3.1.1-beta.1"
|
|
150
151
|
}
|
|
151
152
|
})
|
|
152
153
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -6,23 +6,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
8
|
"payment-details": {
|
|
9
|
-
setPayment:
|
|
10
|
-
setOnClose:
|
|
9
|
+
setPayment: _payment => {},
|
|
10
|
+
setOnClose: _listener => {}
|
|
11
11
|
},
|
|
12
12
|
"account-onboarding": {
|
|
13
|
-
setFullTermsOfServiceUrl:
|
|
14
|
-
setRecipientTermsOfServiceUrl:
|
|
15
|
-
setPrivacyPolicyUrl:
|
|
16
|
-
setSkipTermsOfServiceCollection:
|
|
17
|
-
setOnExit:
|
|
13
|
+
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
|
+
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
15
|
+
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
16
|
+
setSkipTermsOfServiceCollection: _skipTermsOfServiceCollection => {},
|
|
17
|
+
setOnExit: _listener => {}
|
|
18
18
|
},
|
|
19
19
|
"issuing-card": {
|
|
20
|
-
setDefaultCard:
|
|
21
|
-
setCardArtFileLink:
|
|
22
|
-
|
|
20
|
+
setDefaultCard: _defaultCard => {},
|
|
21
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
22
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
23
23
|
},
|
|
24
24
|
"issuing-cards-list": {
|
|
25
|
-
setCardArtFileLink:
|
|
25
|
+
setCardArtFileLink: _cardArtFileLink => {},
|
|
26
|
+
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -41,7 +42,7 @@ const componentNameMapping = {
|
|
|
41
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";
|
|
42
43
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
43
44
|
const findScript = () => {
|
|
44
|
-
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
|
|
45
|
+
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
45
46
|
};
|
|
46
47
|
const injectScript = () => {
|
|
47
48
|
const script = document.createElement("script");
|
|
@@ -150,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
150
151
|
sdk: true,
|
|
151
152
|
sdkOptions: {
|
|
152
153
|
// This will be replaced by the npm package version when bundling
|
|
153
|
-
sdkVersion: "3.1.
|
|
154
|
+
sdkVersion: "3.1.1-beta.1"
|
|
154
155
|
}
|
|
155
156
|
})
|
|
156
157
|
}));
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,21 +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: {
|
|
2
10
|
"payment-details": {
|
|
3
|
-
setPayment: (
|
|
4
|
-
setOnClose: (
|
|
11
|
+
setPayment: (_payment: string | undefined) => void;
|
|
12
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
5
13
|
};
|
|
6
14
|
"account-onboarding": {
|
|
7
|
-
setFullTermsOfServiceUrl: (
|
|
8
|
-
setRecipientTermsOfServiceUrl: (
|
|
9
|
-
setPrivacyPolicyUrl: (
|
|
10
|
-
setSkipTermsOfServiceCollection: (
|
|
11
|
-
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;
|
|
12
20
|
};
|
|
13
21
|
"issuing-card": {
|
|
14
|
-
setDefaultCard: (
|
|
15
|
-
setCardArtFileLink: (
|
|
16
|
-
|
|
22
|
+
setDefaultCard: (_defaultCard: string | undefined) => void;
|
|
23
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
24
|
+
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
17
25
|
};
|
|
18
26
|
"issuing-cards-list": {
|
|
19
|
-
setCardArtFileLink: (
|
|
27
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
28
|
+
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
20
29
|
};
|
|
21
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
|
@@ -51,9 +51,11 @@ const EXISTING_SCRIPT_MESSAGE =
|
|
|
51
51
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
52
52
|
|
|
53
53
|
export const findScript = (): HTMLScriptElement | null => {
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
return (
|
|
55
|
+
document.querySelectorAll<HTMLScriptElement>(
|
|
56
|
+
`script[src="${V0_URL}"]`
|
|
57
|
+
)[0] || null
|
|
58
|
+
);
|
|
57
59
|
};
|
|
58
60
|
|
|
59
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,39 +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 = {
|
|
7
14
|
"payment-details": {
|
|
8
|
-
setPayment: (
|
|
9
|
-
setOnClose: (
|
|
15
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
16
|
+
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
10
17
|
},
|
|
11
18
|
"account-onboarding": {
|
|
12
19
|
setFullTermsOfServiceUrl: (
|
|
13
|
-
|
|
20
|
+
_termOfServiceUrl: string | undefined
|
|
14
21
|
): void => {},
|
|
15
22
|
setRecipientTermsOfServiceUrl: (
|
|
16
|
-
|
|
23
|
+
_recipientTermsOfServiceUrl: string | undefined
|
|
17
24
|
): void => {},
|
|
18
|
-
setPrivacyPolicyUrl: (
|
|
25
|
+
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
|
|
19
26
|
setSkipTermsOfServiceCollection: (
|
|
20
|
-
|
|
27
|
+
_skipTermsOfServiceCollection: boolean | undefined
|
|
21
28
|
): void => {},
|
|
22
|
-
setOnExit: (
|
|
29
|
+
setOnExit: (_listener: (() => void) | undefined): void => {}
|
|
23
30
|
},
|
|
24
31
|
"issuing-card": {
|
|
25
|
-
setDefaultCard: (
|
|
26
|
-
setCardArtFileLink: (
|
|
27
|
-
|
|
32
|
+
setDefaultCard: (_defaultCard: string | undefined): void => {},
|
|
33
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
34
|
+
setFetchEphemeralKey: (
|
|
35
|
+
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
36
|
+
): void => {}
|
|
28
37
|
},
|
|
29
38
|
"issuing-cards-list": {
|
|
30
|
-
setCardArtFileLink: (
|
|
39
|
+
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
40
|
+
setFetchEphemeralKey: (
|
|
41
|
+
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
42
|
+
): void => {}
|
|
31
43
|
}
|
|
32
44
|
};
|
|
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
|
@@ -6,6 +6,56 @@ export declare type LoadConnectAndInitialize = (
|
|
|
6
6
|
|
|
7
7
|
export declare type OverlayOption = "dialog" | "drawer";
|
|
8
8
|
|
|
9
|
+
/*
|
|
10
|
+
* Use a `CssFontSource` to pass custom fonts via a stylesheet URL when initializing a Connect instance.
|
|
11
|
+
*/
|
|
12
|
+
export declare type CssFontSource = {
|
|
13
|
+
/**
|
|
14
|
+
* A relative or absolute URL pointing to a CSS file with [@font-face](https://developer.mozilla.org/en/docs/Web/CSS/@font-face) definitions, for example:
|
|
15
|
+
*
|
|
16
|
+
* https://fonts.googleapis.com/css?family=Open+Sans
|
|
17
|
+
*
|
|
18
|
+
* Note that if you are using a [content security policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) (CSP), [additional directives](https://stripe.com/docs/security#content-security-policy) may be necessary.
|
|
19
|
+
*/
|
|
20
|
+
cssSrc: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Use a `CustomFontSource` to pass custom fonts when initializing a Connect instance.
|
|
25
|
+
*/
|
|
26
|
+
export declare type CustomFontSource = {
|
|
27
|
+
/**
|
|
28
|
+
* The name to give the font
|
|
29
|
+
*/
|
|
30
|
+
family: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A valid [src](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src) value pointing to your custom font file.
|
|
34
|
+
* This is usually (though not always) a link to a file with a `.woff` , `.otf`, or `.svg` suffix.
|
|
35
|
+
*/
|
|
36
|
+
src: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A valid [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display) value.
|
|
40
|
+
*/
|
|
41
|
+
display?: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Defaults to `normal`.
|
|
45
|
+
*/
|
|
46
|
+
style?: "normal" | "italic" | "oblique";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A valid [unicode-range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range) value.
|
|
50
|
+
*/
|
|
51
|
+
unicodeRange?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A valid [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight), as a string.
|
|
55
|
+
*/
|
|
56
|
+
weight?: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
9
59
|
/**
|
|
10
60
|
* Appearance options for the Connect instance.
|
|
11
61
|
*/
|
|
@@ -26,17 +76,17 @@ export declare type AppearanceVariables = {
|
|
|
26
76
|
fontFamily?: string;
|
|
27
77
|
|
|
28
78
|
/**
|
|
29
|
-
* 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.
|
|
30
80
|
*/
|
|
31
81
|
fontSizeBase?: string;
|
|
32
82
|
|
|
33
83
|
/**
|
|
34
|
-
* 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.
|
|
35
85
|
*/
|
|
36
86
|
spacingUnit?: string;
|
|
37
87
|
|
|
38
88
|
/**
|
|
39
|
-
* 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.
|
|
40
90
|
*/
|
|
41
91
|
borderRadius?: string;
|
|
42
92
|
|
|
@@ -190,15 +240,15 @@ export declare type AppearanceVariables = {
|
|
|
190
240
|
*/
|
|
191
241
|
buttonBorderRadius?: string;
|
|
192
242
|
/**
|
|
193
|
-
* 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.
|
|
194
244
|
*/
|
|
195
245
|
formBorderRadius?: string;
|
|
196
246
|
/**
|
|
197
|
-
* 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.
|
|
198
248
|
*/
|
|
199
249
|
badgeBorderRadius?: string;
|
|
200
250
|
/**
|
|
201
|
-
* 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.
|
|
202
252
|
*/
|
|
203
253
|
overlayBorderRadius?: string;
|
|
204
254
|
|
|
@@ -212,15 +262,7 @@ export declare type AppearanceVariables = {
|
|
|
212
262
|
|
|
213
263
|
// Body Typography
|
|
214
264
|
/**
|
|
215
|
-
* The font size for the
|
|
216
|
-
*/
|
|
217
|
-
bodyLgFontSize?: string;
|
|
218
|
-
/**
|
|
219
|
-
* The font weight for the large body typography. Body typography variables accept a valid font weight value.
|
|
220
|
-
*/
|
|
221
|
-
bodyLgFontWeight?: string;
|
|
222
|
-
/**
|
|
223
|
-
* 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.
|
|
224
266
|
*/
|
|
225
267
|
bodyMdFontSize?: string;
|
|
226
268
|
/**
|
|
@@ -228,7 +270,7 @@ export declare type AppearanceVariables = {
|
|
|
228
270
|
*/
|
|
229
271
|
bodyMdFontWeight?: string;
|
|
230
272
|
/**
|
|
231
|
-
* 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.
|
|
232
274
|
*/
|
|
233
275
|
bodySmFontSize?: string;
|
|
234
276
|
/**
|
|
@@ -238,7 +280,7 @@ export declare type AppearanceVariables = {
|
|
|
238
280
|
|
|
239
281
|
// Heading Typography
|
|
240
282
|
/**
|
|
241
|
-
* 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.
|
|
242
284
|
*/
|
|
243
285
|
headingXlFontSize?: string;
|
|
244
286
|
/**
|
|
@@ -250,7 +292,7 @@ export declare type AppearanceVariables = {
|
|
|
250
292
|
*/
|
|
251
293
|
headingXlTextTransform?: string;
|
|
252
294
|
/**
|
|
253
|
-
* 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.
|
|
254
296
|
*/
|
|
255
297
|
headingLgFontSize?: string;
|
|
256
298
|
/**
|
|
@@ -262,7 +304,7 @@ export declare type AppearanceVariables = {
|
|
|
262
304
|
*/
|
|
263
305
|
headingLgTextTransform?: string;
|
|
264
306
|
/**
|
|
265
|
-
* 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.
|
|
266
308
|
*/
|
|
267
309
|
headingMdFontSize?: string;
|
|
268
310
|
/**
|
|
@@ -274,7 +316,7 @@ export declare type AppearanceVariables = {
|
|
|
274
316
|
*/
|
|
275
317
|
headingMdTextTransform?: string;
|
|
276
318
|
/**
|
|
277
|
-
* 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.
|
|
278
320
|
*/
|
|
279
321
|
headingSmFontSize?: string;
|
|
280
322
|
/**
|
|
@@ -286,7 +328,7 @@ export declare type AppearanceVariables = {
|
|
|
286
328
|
*/
|
|
287
329
|
headingSmTextTransform?: string;
|
|
288
330
|
/**
|
|
289
|
-
* 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.
|
|
290
332
|
*/
|
|
291
333
|
headingXsFontSize?: string;
|
|
292
334
|
/**
|
|
@@ -300,19 +342,7 @@ export declare type AppearanceVariables = {
|
|
|
300
342
|
|
|
301
343
|
// Label Typography
|
|
302
344
|
/**
|
|
303
|
-
* The font size for the
|
|
304
|
-
*/
|
|
305
|
-
labelLgFontSize?: string;
|
|
306
|
-
/**
|
|
307
|
-
* The font weight for the large label typography. Label typography variables accept a valid font weight value.
|
|
308
|
-
*/
|
|
309
|
-
labelLgFontWeight?: string;
|
|
310
|
-
/**
|
|
311
|
-
* The text transform for the large label typography. Label typography variables accept a valid text transform value.
|
|
312
|
-
*/
|
|
313
|
-
labelLgTextTransform?: string;
|
|
314
|
-
/**
|
|
315
|
-
* 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.
|
|
316
346
|
*/
|
|
317
347
|
labelMdFontSize?: string;
|
|
318
348
|
/**
|
|
@@ -324,7 +354,7 @@ export declare type AppearanceVariables = {
|
|
|
324
354
|
*/
|
|
325
355
|
labelMdTextTransform?: string;
|
|
326
356
|
/**
|
|
327
|
-
* 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.
|
|
328
358
|
*/
|
|
329
359
|
labelSmFontSize?: string;
|
|
330
360
|
/**
|
|
@@ -374,6 +404,11 @@ export interface IStripeConnectInitParams {
|
|
|
374
404
|
* The locale to use for the Connect instance.
|
|
375
405
|
*/
|
|
376
406
|
locale?: string;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* An array of custom fonts, which embedded components created from a ConnectInstance can use.
|
|
410
|
+
*/
|
|
411
|
+
fonts?: Array<CssFontSource | CustomFontSource>;
|
|
377
412
|
}
|
|
378
413
|
|
|
379
414
|
type ConnectElementCustomMethods = typeof ConnectElementCustomMethodConfig;
|
|
File without changes
|