@stripe/connect-js 3.4.6-preview.0 → 3.4.7-preview.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 +80 -0
- package/dist/components/componentsAndSetters.d.ts +4 -0
- package/dist/connect.esm.js +8 -4
- package/dist/connect.js +8 -4
- package/dist/pure.esm.js +8 -4
- package/dist/pure.js +8 -4
- package/package.json +1 -1
- package/src/components/componentsAndSetters.ts +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Connect.js ES Module
|
|
2
|
+
|
|
3
|
+
The [Connect.js library](https://stripe.com/docs/connect/get-started-connect-embedded-components) and its supporting API allows you to add connected account dashboard functionality to your website.
|
|
4
|
+
This NPM package contains initialization logic for Connect embedded components along with related types.
|
|
5
|
+
|
|
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
|
+
|
|
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
|
+
|
|
10
|
+
Note: Some Connect embedded components are in preview. These can be [viewed on our doc site](https://docs.stripe.com/connect/supported-embedded-components), where you can also request preview access.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Use `npm` to install the Connect.js module:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @stripe/connect-js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Documentation
|
|
21
|
+
|
|
22
|
+
- [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
|
|
23
|
+
- [Quickstart guide](https://stripe.com/docs/connect/connect-embedded-components/quickstart)
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### `loadConnectAndInitialize`
|
|
28
|
+
|
|
29
|
+
This synchronous function takes in a publishable key, a function to retrieve the client secret returned from the [Account Session API](https://stripe.com/docs/api/account_sessions/create), and other [initialization parameters](https://stripe.com/docs/connect/get-started-connect-embedded-components#configuring-connect-js). It returns a `StripeConnectInstance`. If necessary, it will load Connect.js for you by inserting the Connect.js script tag.
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { loadConnectAndInitialize } from "@stripe/connect-js";
|
|
33
|
+
const fetchClientSecret = async () => {
|
|
34
|
+
// Fetch the AccountSession client secret by making an API call to your service
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const instance = loadConnectAndInitialize({
|
|
38
|
+
publishableKey: "{{pk test123}}",
|
|
39
|
+
fetchClientSecret: fetchClientSecret,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
We’ve placed a random API key in this example. Replace it with your
|
|
44
|
+
[actual publishable API keys](https://dashboard.stripe.com/account/apikeys) to
|
|
45
|
+
test this code through your Connect account.
|
|
46
|
+
|
|
47
|
+
If you have deployed a
|
|
48
|
+
[Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/Security/CSP),
|
|
49
|
+
make sure to
|
|
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
|
+
|
|
52
|
+
### Import as a side effect
|
|
53
|
+
|
|
54
|
+
Import `@stripe/connect-js` as a side effect in code that will be included
|
|
55
|
+
throughout your site (e.g. your root module). This will make sure the Connect.js
|
|
56
|
+
script tag is inserted immediately upon page load.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import "@stripe/connect-js";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Importing `loadConnectAndInitialize` without side effects
|
|
63
|
+
|
|
64
|
+
If you would like to use `loadConnectAndInitialize` in your application, but defer loading the
|
|
65
|
+
Connect.js script until `loadConnectAndInitialize` is first called, use the alternative
|
|
66
|
+
`@stripe/connect-js/pure` import path:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import { loadConnectAndInitialize } from "@stripe/connect-js/pure";
|
|
70
|
+
|
|
71
|
+
// Connect.js will not be loaded until `loadConnect` is called
|
|
72
|
+
const instance = loadConnectAndInitialize({
|
|
73
|
+
publishableKey: "{{pk test123}}",
|
|
74
|
+
fetchClientSecret: fetchClientSecret,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Preview/GA
|
|
79
|
+
|
|
80
|
+
To work with the [preview](https://docs.stripe.com/connect/supported-embedded-components) version of embedded components, use the [preview](/preview) folder. For the stable GA version, use [/ga](/ga).
|
|
@@ -196,6 +196,8 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
196
196
|
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
197
197
|
setOnApplicationStepChange: (_listener: (({ step }: StepChange) => void) | undefined) => void;
|
|
198
198
|
setDefaultFinancingOffer: (_defaultFinancingOffer: string | undefined) => void;
|
|
199
|
+
setOnApplicationInitiated: (_listener: (() => void) | undefined) => void;
|
|
200
|
+
setResumeInitiatedApplication: (_resumeInitiatedApplication: boolean | undefined) => void;
|
|
199
201
|
};
|
|
200
202
|
"capital-financing-promotion": {
|
|
201
203
|
setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
|
|
@@ -205,6 +207,8 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
205
207
|
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
206
208
|
setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
|
|
207
209
|
setOnApplicationStepChange: (_listener: (({ step }: StepChange) => void) | undefined) => void;
|
|
210
|
+
setOnAdvanceToCapitalFinancingApplication: (_listener: (() => void) | undefined) => void;
|
|
211
|
+
setDisableNestedCapitalFinancingApplication: (_disableNestedCapitalFinancingApplication: boolean | undefined) => void;
|
|
208
212
|
};
|
|
209
213
|
"reporting-chart": {
|
|
210
214
|
setReportName: (_reportName: ReportName) => void;
|
package/dist/connect.esm.js
CHANGED
|
@@ -82,7 +82,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
82
82
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
83
83
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
84
84
|
setOnApplicationStepChange: _listener => {},
|
|
85
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
85
|
+
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
86
|
+
setOnApplicationInitiated: _listener => {},
|
|
87
|
+
setResumeInitiatedApplication: _resumeInitiatedApplication => {}
|
|
86
88
|
},
|
|
87
89
|
"capital-financing-promotion": {
|
|
88
90
|
setLayout: _layout => {},
|
|
@@ -91,7 +93,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
91
93
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
92
94
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
93
95
|
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
94
|
-
setOnApplicationStepChange: _listener => {}
|
|
96
|
+
setOnApplicationStepChange: _listener => {},
|
|
97
|
+
setOnAdvanceToCapitalFinancingApplication: _listener => {},
|
|
98
|
+
setDisableNestedCapitalFinancingApplication: _disableNestedCapitalFinancingApplication => {}
|
|
95
99
|
},
|
|
96
100
|
"reporting-chart": {
|
|
97
101
|
setReportName: _reportName => {},
|
|
@@ -237,7 +241,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
237
241
|
element[method] = function (value) {
|
|
238
242
|
stripeConnectInstance.then(() => {
|
|
239
243
|
if (!this[`${method}InternalOnly`]) {
|
|
240
|
-
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.
|
|
244
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.7-preview.0`);
|
|
241
245
|
}
|
|
242
246
|
this[`${method}InternalOnly`](value);
|
|
243
247
|
});
|
|
@@ -291,7 +295,7 @@ const createWrapper = stripeConnect => {
|
|
|
291
295
|
sdk: true,
|
|
292
296
|
sdkOptions: {
|
|
293
297
|
// This will be replaced by the npm package version when bundling
|
|
294
|
-
sdkVersion: "3.4.
|
|
298
|
+
sdkVersion: "3.4.7-preview.0"
|
|
295
299
|
}
|
|
296
300
|
})
|
|
297
301
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -86,7 +86,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
86
86
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
87
87
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
88
88
|
setOnApplicationStepChange: _listener => {},
|
|
89
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
89
|
+
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
90
|
+
setOnApplicationInitiated: _listener => {},
|
|
91
|
+
setResumeInitiatedApplication: _resumeInitiatedApplication => {}
|
|
90
92
|
},
|
|
91
93
|
"capital-financing-promotion": {
|
|
92
94
|
setLayout: _layout => {},
|
|
@@ -95,7 +97,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
95
97
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
96
98
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
97
99
|
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
98
|
-
setOnApplicationStepChange: _listener => {}
|
|
100
|
+
setOnApplicationStepChange: _listener => {},
|
|
101
|
+
setOnAdvanceToCapitalFinancingApplication: _listener => {},
|
|
102
|
+
setDisableNestedCapitalFinancingApplication: _disableNestedCapitalFinancingApplication => {}
|
|
99
103
|
},
|
|
100
104
|
"reporting-chart": {
|
|
101
105
|
setReportName: _reportName => {},
|
|
@@ -241,7 +245,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
241
245
|
element[method] = function (value) {
|
|
242
246
|
stripeConnectInstance.then(() => {
|
|
243
247
|
if (!this[`${method}InternalOnly`]) {
|
|
244
|
-
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.
|
|
248
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.7-preview.0`);
|
|
245
249
|
}
|
|
246
250
|
this[`${method}InternalOnly`](value);
|
|
247
251
|
});
|
|
@@ -295,7 +299,7 @@ const createWrapper = stripeConnect => {
|
|
|
295
299
|
sdk: true,
|
|
296
300
|
sdkOptions: {
|
|
297
301
|
// This will be replaced by the npm package version when bundling
|
|
298
|
-
sdkVersion: "3.4.
|
|
302
|
+
sdkVersion: "3.4.7-preview.0"
|
|
299
303
|
}
|
|
300
304
|
})
|
|
301
305
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -82,7 +82,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
82
82
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
83
83
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
84
84
|
setOnApplicationStepChange: _listener => {},
|
|
85
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
85
|
+
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
86
|
+
setOnApplicationInitiated: _listener => {},
|
|
87
|
+
setResumeInitiatedApplication: _resumeInitiatedApplication => {}
|
|
86
88
|
},
|
|
87
89
|
"capital-financing-promotion": {
|
|
88
90
|
setLayout: _layout => {},
|
|
@@ -91,7 +93,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
91
93
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
92
94
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
93
95
|
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
94
|
-
setOnApplicationStepChange: _listener => {}
|
|
96
|
+
setOnApplicationStepChange: _listener => {},
|
|
97
|
+
setOnAdvanceToCapitalFinancingApplication: _listener => {},
|
|
98
|
+
setDisableNestedCapitalFinancingApplication: _disableNestedCapitalFinancingApplication => {}
|
|
95
99
|
},
|
|
96
100
|
"reporting-chart": {
|
|
97
101
|
setReportName: _reportName => {},
|
|
@@ -237,7 +241,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
237
241
|
element[method] = function (value) {
|
|
238
242
|
stripeConnectInstance.then(() => {
|
|
239
243
|
if (!this[`${method}InternalOnly`]) {
|
|
240
|
-
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.
|
|
244
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.7-preview.0`);
|
|
241
245
|
}
|
|
242
246
|
this[`${method}InternalOnly`](value);
|
|
243
247
|
});
|
|
@@ -291,7 +295,7 @@ const createWrapper = stripeConnect => {
|
|
|
291
295
|
sdk: true,
|
|
292
296
|
sdkOptions: {
|
|
293
297
|
// This will be replaced by the npm package version when bundling
|
|
294
|
-
sdkVersion: "3.4.
|
|
298
|
+
sdkVersion: "3.4.7-preview.0"
|
|
295
299
|
}
|
|
296
300
|
})
|
|
297
301
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -86,7 +86,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
86
86
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
87
87
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
88
88
|
setOnApplicationStepChange: _listener => {},
|
|
89
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {}
|
|
89
|
+
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
90
|
+
setOnApplicationInitiated: _listener => {},
|
|
91
|
+
setResumeInitiatedApplication: _resumeInitiatedApplication => {}
|
|
90
92
|
},
|
|
91
93
|
"capital-financing-promotion": {
|
|
92
94
|
setLayout: _layout => {},
|
|
@@ -95,7 +97,9 @@ const ConnectElementCustomMethodConfig = {
|
|
|
95
97
|
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
96
98
|
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
97
99
|
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
98
|
-
setOnApplicationStepChange: _listener => {}
|
|
100
|
+
setOnApplicationStepChange: _listener => {},
|
|
101
|
+
setOnAdvanceToCapitalFinancingApplication: _listener => {},
|
|
102
|
+
setDisableNestedCapitalFinancingApplication: _disableNestedCapitalFinancingApplication => {}
|
|
99
103
|
},
|
|
100
104
|
"reporting-chart": {
|
|
101
105
|
setReportName: _reportName => {},
|
|
@@ -241,7 +245,7 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
241
245
|
element[method] = function (value) {
|
|
242
246
|
stripeConnectInstance.then(() => {
|
|
243
247
|
if (!this[`${method}InternalOnly`]) {
|
|
244
|
-
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.
|
|
248
|
+
throw new Error(`Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: 3.4.7-preview.0`);
|
|
245
249
|
}
|
|
246
250
|
this[`${method}InternalOnly`](value);
|
|
247
251
|
});
|
|
@@ -295,7 +299,7 @@ const createWrapper = stripeConnect => {
|
|
|
295
299
|
sdk: true,
|
|
296
300
|
sdkOptions: {
|
|
297
301
|
// This will be replaced by the npm package version when bundling
|
|
298
|
-
sdkVersion: "3.4.
|
|
302
|
+
sdkVersion: "3.4.7-preview.0"
|
|
299
303
|
}
|
|
300
304
|
})
|
|
301
305
|
}));
|
package/package.json
CHANGED
|
@@ -402,6 +402,12 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
402
402
|
setDefaultFinancingOffer: (
|
|
403
403
|
_defaultFinancingOffer: string | undefined
|
|
404
404
|
): void => {},
|
|
405
|
+
setOnApplicationInitiated: (
|
|
406
|
+
_listener: (() => void) | undefined
|
|
407
|
+
): void => {},
|
|
408
|
+
setResumeInitiatedApplication: (
|
|
409
|
+
_resumeInitiatedApplication: boolean | undefined
|
|
410
|
+
): void => {},
|
|
405
411
|
},
|
|
406
412
|
"capital-financing-promotion": {
|
|
407
413
|
setLayout: (_layout: FinancingPromotionLayoutType | undefined): void => {},
|
|
@@ -426,6 +432,12 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
426
432
|
setOnApplicationStepChange: (
|
|
427
433
|
_listener: (({ step }: StepChange) => void) | undefined
|
|
428
434
|
): void => {},
|
|
435
|
+
setOnAdvanceToCapitalFinancingApplication: (
|
|
436
|
+
_listener: (() => void) | undefined
|
|
437
|
+
): void => {},
|
|
438
|
+
setDisableNestedCapitalFinancingApplication: (
|
|
439
|
+
_disableNestedCapitalFinancingApplication: boolean | undefined
|
|
440
|
+
): void => {},
|
|
429
441
|
},
|
|
430
442
|
"reporting-chart": {
|
|
431
443
|
setReportName: (_reportName: ReportName): void => {},
|