@stripe/connect-js 3.0.0-beta.1 → 3.0.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 CHANGED
@@ -3,9 +3,11 @@
3
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
4
  This NPM package contains initialization logic for Connect embedded components along with related types.
5
5
 
6
- Calling `loadConnect` 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 `loadConnect` helper itself and the TypeScript type definitions provided for Connect.js. Updates do not affect runtime availability of features of Connect.js.
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
- Note: Connect embedded components is currently still in beta. Please [contact us](https://stripe.com/docs/connect/get-started-connect-embedded-components#access) to request beta access.
8
+ The embedded onboarding component is generally available now. Please refer to our [documentation](https://stripe.com/docs/connect/get-started-connect-embedded-components#account-onboarding) for more information.
9
+
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.
9
11
 
10
12
  ## Installation
11
13
 
@@ -17,25 +19,25 @@ npm install @stripe/connect-js
17
19
 
18
20
  ## Documentation
19
21
 
20
- - [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-uis)
21
- - [Quickstart guide](https://stripe.com/docs/connect/connect-embedded-uis/quickstart)
22
+ - [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
23
+ - [Quickstart guide for GA](https://stripe.com/docs/connect/connect-embedded-components/quickstart)
24
+ - [Quickstart guide for beta](https://stripe.com/docs/connect/connect-embedded-components/beta-quickstart)
22
25
 
23
26
  ## Usage
24
27
 
25
- ### `loadConnect`
26
-
27
- This function returns a `Promise` that resolves with a newly created `StripeConnect`
28
- object once Connect.js has loaded. If necessary, it will load Connect.js for you by inserting the Connect.js script tag.
28
+ ### `loadConnectAndInitialize`
29
29
 
30
- The `stripeConnect.initialize` function returns a `ConnectInstance` once you initialize it with a publishable key and a client secret returned from the [Account Session API](https://stripe.com/docs/api/account_sessions/create) call.
30
+ 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.
31
31
 
32
32
  ```js
33
- import { loadConnect } from "@stripe/connect-js";
33
+ import { loadConnectAndInitialize } from "@stripe/connect-js";
34
+ const fetchClientSecret = async () => {
35
+ // Fetch the AccountSession client secret by making an API call to your service
36
+ };
34
37
 
35
- const stripeConnect = await loadConnect();
36
- const connectInstance = stripeConnect.initialize({
38
+ const instance = loadConnectAndInitialize({
37
39
  publishableKey: "{{pk test123}}",
38
- clientSecret: "{{client secret}}"
40
+ fetchClientSecret: fetchClientSecret
39
41
  });
40
42
  ```
41
43
 
@@ -62,22 +64,25 @@ import "@stripe/connect-js";
62
64
 
63
65
  Manually add the Connect.js script tag to the `<head>` of each page on your site.
64
66
  If an existing script tag is already present, this module will not insert a new
65
- one. When you call `loadConnect`, it will use the existing script tag.
67
+ one. When you call `loadConnectAndInitialize`, it will use the existing script tag.
66
68
 
67
69
  ```html
68
70
  <!-- Somewhere in your site's <head> -->
69
71
  <script src="https://connect-js.stripe.com/v0.1/connect.js" async></script>
70
72
  ```
71
73
 
72
- ### Importing `loadConnect` without side effects
74
+ ### Importing `loadConnectAndInitialize` without side effects
73
75
 
74
- If you would like to use `loadConnect` in your application, but defer loading the
75
- Connect.js script until `loadConnect` is first called, use the alternative
76
+ If you would like to use `loadConnectAndInitialize` in your application, but defer loading the
77
+ Connect.js script until `loadConnectAndInitialize` is first called, use the alternative
76
78
  `@stripe/connect-js/pure` import path:
77
79
 
78
80
  ```js
79
- import { loadConnect } from "@stripe/connect-js/pure";
81
+ import { loadConnectAndInitialize } from "@stripe/connect-js/pure";
80
82
 
81
83
  // Connect.js will not be loaded until `loadConnect` is called
82
- const stripeConnect = await loadConnect();
84
+ const instance = loadConnectAndInitialize({
85
+ publishableKey: "{{pk test123}}",
86
+ fetchClientSecret: fetchClientSecret
87
+ });
83
88
  ```
@@ -1,17 +1,8 @@
1
1
  const componentNameMapping = {
2
- payments: "stripe-connect-payments",
3
- payouts: "stripe-connect-payouts",
4
- "payment-details": "stripe-connect-payment-details",
5
- "account-onboarding": "stripe-connect-account-onboarding",
6
- "payment-method-settings": "stripe-connect-payment-method-settings",
7
- "account-management": "stripe-connect-account-management",
8
- "notification-banner": "stripe-connect-notification-banner",
9
- "instant-payouts": "stripe-connect-instant-payouts",
10
- "issuing-card": "stripe-connect-issuing-card",
11
- "issuing-cards-list": "stripe-connect-issuing-cards-list"
2
+ "account-onboarding": "stripe-connect-account-onboarding"
12
3
  };
13
4
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
14
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
5
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
15
6
  const findScript = () => {
16
7
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
17
8
  };
@@ -109,7 +100,7 @@ const createWrapper = stripeConnect => {
109
100
  sdk: true,
110
101
  sdkOptions: {
111
102
  // This will be replaced by the npm package version when bundling
112
- sdkVersion: "3.0.0-beta.1"
103
+ sdkVersion: "3.0.0"
113
104
  }
114
105
  })
115
106
  }));
package/dist/connect.js CHANGED
@@ -3,19 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const componentNameMapping = {
6
- payments: "stripe-connect-payments",
7
- payouts: "stripe-connect-payouts",
8
- "payment-details": "stripe-connect-payment-details",
9
- "account-onboarding": "stripe-connect-account-onboarding",
10
- "payment-method-settings": "stripe-connect-payment-method-settings",
11
- "account-management": "stripe-connect-account-management",
12
- "notification-banner": "stripe-connect-notification-banner",
13
- "instant-payouts": "stripe-connect-instant-payouts",
14
- "issuing-card": "stripe-connect-issuing-card",
15
- "issuing-cards-list": "stripe-connect-issuing-cards-list"
6
+ "account-onboarding": "stripe-connect-account-onboarding"
16
7
  };
17
8
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
18
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
9
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
19
10
  const findScript = () => {
20
11
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
21
12
  };
@@ -113,7 +104,7 @@ const createWrapper = stripeConnect => {
113
104
  sdk: true,
114
105
  sdkOptions: {
115
106
  // This will be replaced by the npm package version when bundling
116
- sdkVersion: "3.0.0-beta.1"
107
+ sdkVersion: "3.0.0"
117
108
  }
118
109
  })
119
110
  }));
package/dist/pure.esm.js CHANGED
@@ -1,17 +1,8 @@
1
1
  const componentNameMapping = {
2
- payments: "stripe-connect-payments",
3
- payouts: "stripe-connect-payouts",
4
- "payment-details": "stripe-connect-payment-details",
5
- "account-onboarding": "stripe-connect-account-onboarding",
6
- "payment-method-settings": "stripe-connect-payment-method-settings",
7
- "account-management": "stripe-connect-account-management",
8
- "notification-banner": "stripe-connect-notification-banner",
9
- "instant-payouts": "stripe-connect-instant-payouts",
10
- "issuing-card": "stripe-connect-issuing-card",
11
- "issuing-cards-list": "stripe-connect-issuing-cards-list"
2
+ "account-onboarding": "stripe-connect-account-onboarding"
12
3
  };
13
4
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
14
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
5
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
15
6
  const findScript = () => {
16
7
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
17
8
  };
@@ -109,7 +100,7 @@ const createWrapper = stripeConnect => {
109
100
  sdk: true,
110
101
  sdkOptions: {
111
102
  // This will be replaced by the npm package version when bundling
112
- sdkVersion: "3.0.0-beta.1"
103
+ sdkVersion: "3.0.0"
113
104
  }
114
105
  })
115
106
  }));
package/dist/pure.js CHANGED
@@ -3,19 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const componentNameMapping = {
6
- payments: "stripe-connect-payments",
7
- payouts: "stripe-connect-payouts",
8
- "payment-details": "stripe-connect-payment-details",
9
- "account-onboarding": "stripe-connect-account-onboarding",
10
- "payment-method-settings": "stripe-connect-payment-method-settings",
11
- "account-management": "stripe-connect-account-management",
12
- "notification-banner": "stripe-connect-notification-banner",
13
- "instant-payouts": "stripe-connect-instant-payouts",
14
- "issuing-card": "stripe-connect-issuing-card",
15
- "issuing-cards-list": "stripe-connect-issuing-cards-list"
6
+ "account-onboarding": "stripe-connect-account-onboarding"
16
7
  };
17
8
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
18
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
9
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
19
10
  const findScript = () => {
20
11
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0];
21
12
  };
@@ -113,7 +104,7 @@ const createWrapper = stripeConnect => {
113
104
  sdk: true,
114
105
  sdkOptions: {
115
106
  // This will be replaced by the npm package version when bundling
116
- sdkVersion: "3.0.0-beta.1"
107
+ sdkVersion: "3.0.0"
117
108
  }
118
109
  })
119
110
  }));
package/dist/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
- 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";
3
+ type ConnectElementHTMLName = "stripe-connect-account-onboarding";
4
4
  export declare const componentNameMapping: Record<ConnectElementTagName, ConnectElementHTMLName>;
5
5
  type StripeConnectInstanceExtended = StripeConnectInstance & {
6
6
  debugInstance: () => Promise<StripeConnectInstance>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0",
4
4
  "description": "Connect.js loading utility package",
5
5
  "main": "dist/connect.js",
6
6
  "module": "dist/connect.esm.js",
package/src/shared.ts CHANGED
@@ -9,32 +9,13 @@ export type LoadConnectAndInitialize = (
9
9
  initParams: IStripeConnectInitParams
10
10
  ) => StripeConnectInstance;
11
11
 
12
- export type ConnectElementHTMLName =
13
- | "stripe-connect-payments"
14
- | "stripe-connect-payouts"
15
- | "stripe-connect-payment-details"
16
- | "stripe-connect-account-onboarding"
17
- | "stripe-connect-payment-method-settings"
18
- | "stripe-connect-account-management"
19
- | "stripe-connect-notification-banner"
20
- | "stripe-connect-instant-payouts"
21
- | "stripe-connect-issuing-card"
22
- | "stripe-connect-issuing-cards-list";
12
+ type ConnectElementHTMLName = "stripe-connect-account-onboarding";
23
13
 
24
14
  export const componentNameMapping: Record<
25
15
  ConnectElementTagName,
26
16
  ConnectElementHTMLName
27
17
  > = {
28
- payments: "stripe-connect-payments",
29
- payouts: "stripe-connect-payouts",
30
- "payment-details": "stripe-connect-payment-details",
31
- "account-onboarding": "stripe-connect-account-onboarding",
32
- "payment-method-settings": "stripe-connect-payment-method-settings",
33
- "account-management": "stripe-connect-account-management",
34
- "notification-banner": "stripe-connect-notification-banner",
35
- "instant-payouts": "stripe-connect-instant-payouts",
36
- "issuing-card": "stripe-connect-issuing-card",
37
- "issuing-cards-list": "stripe-connect-issuing-cards-list"
18
+ "account-onboarding": "stripe-connect-account-onboarding"
38
19
  };
39
20
 
40
21
  type StripeConnectInstanceExtended = StripeConnectInstance & {
@@ -47,7 +28,7 @@ interface StripeConnectWrapper {
47
28
 
48
29
  const EXISTING_SCRIPT_MESSAGE =
49
30
  "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
50
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
31
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
51
32
 
52
33
  export const findScript = (): HTMLScriptElement | null => {
53
34
  return document.querySelectorAll<HTMLScriptElement>(
@@ -139,7 +120,7 @@ export const initStripeConnect = (
139
120
  create: tagName => {
140
121
  let htmlName = componentNameMapping[tagName];
141
122
  if (!htmlName) {
142
- htmlName = tagName as ConnectElementHTMLName;
123
+ htmlName = (tagName as unknown) as ConnectElementHTMLName;
143
124
  }
144
125
  const element = document.createElement(htmlName);
145
126
  stripeConnectInstance.then(instance => {
package/types/shared.d.ts CHANGED
@@ -209,14 +209,6 @@ export declare type AppearanceVariables = {
209
209
  overlayZIndex?: number;
210
210
 
211
211
  // Body Typography
212
- /**
213
- * The font size for the large body typography. Body typography variables accept a valid font size value.
214
- */
215
- bodyLgFontSize?: string;
216
- /**
217
- * The font weight for the large body typography. Body typography variables accept a valid font weight value.
218
- */
219
- bodyLgFontWeight?: string;
220
212
  /**
221
213
  * The font size for the medium body typography. Body typography variables accept a valid font size value.
222
214
  */
@@ -297,18 +289,6 @@ export declare type AppearanceVariables = {
297
289
  headingXsTextTransform?: string;
298
290
 
299
291
  // Label Typography
300
- /**
301
- * The font size for the large label typography. Label typography variables accept a valid font size value.
302
- */
303
- labelLgFontSize?: string;
304
- /**
305
- * The font weight for the large label typography. Label typography variables accept a valid font weight value.
306
- */
307
- labelLgFontWeight?: string;
308
- /**
309
- * The text transform for the large label typography. Label typography variables accept a valid text transform value.
310
- */
311
- labelLgTextTransform?: string;
312
292
  /**
313
293
  * The font size for the medium label typography. Label typography variables accept a valid font size value.
314
294
  */
@@ -384,10 +364,6 @@ type ConnectHTMLElementRecordBase = {
384
364
  interface ConnectHTMLElementRecord
385
365
  extends ConnectHTMLElementRecordBase,
386
366
  ConnectHTMLElementRecordFallback {
387
- "payment-details": HTMLElement & {
388
- setPayment: (payment: string | undefined) => void;
389
- setOnClose: (listener: (() => void) | undefined) => void;
390
- };
391
367
  "account-onboarding": HTMLElement & {
392
368
  setFullTermsOfServiceUrl: (termOfServiceUrl: string | undefined) => void;
393
369
  setRecipientTermsOfServiceUrl: (
@@ -397,7 +373,7 @@ interface ConnectHTMLElementRecord
397
373
  setSkipTermsOfServiceCollection: (
398
374
  skipTermsOfServiceCollection: boolean | undefined
399
375
  ) => void;
400
- setOnExit: (listener: (() => void) | undefined) => void;
376
+ setOnExit: (listener: () => void) => void;
401
377
  };
402
378
  }
403
379
 
@@ -427,14 +403,4 @@ export interface StripeConnectInstance {
427
403
  /**
428
404
  * Tagnames to be used with the `create` method of the Connect instance.
429
405
  */
430
- export type ConnectElementTagName =
431
- | "payments"
432
- | "payouts"
433
- | "payment-details"
434
- | "account-onboarding"
435
- | "payment-method-settings"
436
- | "account-management"
437
- | "notification-banner"
438
- | "instant-payouts"
439
- | "issuing-card"
440
- | "issuing-cards-list";
406
+ export type ConnectElementTagName = "account-onboarding";