@stripe/connect-js 1.0.9 → 1.1.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.
@@ -1,4 +1,4 @@
1
- var version = "1.0.9";
1
+ var version = "1.0.10";
2
2
 
3
3
  const componentNameMapping = {
4
4
  payments: "stripe-connect-payments",
@@ -78,7 +78,8 @@ const createWrapper = stripeConnect => {
78
78
  sdkVersion: version
79
79
  }
80
80
  })
81
- }));
81
+ })).connect;
82
+ console.log(stripeConnectInstance, "lemon");
82
83
  // We wrap create so we can map its different strings to supported components
83
84
  const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
84
85
  stripeConnectInstance.create = tagName => {
package/dist/connect.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.0.9";
5
+ var version = "1.0.10";
6
6
 
7
7
  const componentNameMapping = {
8
8
  payments: "stripe-connect-payments",
@@ -82,7 +82,8 @@ const createWrapper = stripeConnect => {
82
82
  sdkVersion: version
83
83
  }
84
84
  })
85
- }));
85
+ })).connect;
86
+ console.log(stripeConnectInstance, "lemon");
86
87
  // We wrap create so we can map its different strings to supported components
87
88
  const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
88
89
  stripeConnectInstance.create = tagName => {
package/dist/pure.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "1.0.9";
1
+ var version = "1.0.10";
2
2
 
3
3
  const componentNameMapping = {
4
4
  payments: "stripe-connect-payments",
@@ -78,7 +78,8 @@ const createWrapper = stripeConnect => {
78
78
  sdkVersion: version
79
79
  }
80
80
  })
81
- }));
81
+ })).connect;
82
+ console.log(stripeConnectInstance, "lemon");
82
83
  // We wrap create so we can map its different strings to supported components
83
84
  const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
84
85
  stripeConnectInstance.create = tagName => {
package/dist/pure.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.0.9";
5
+ var version = "1.0.10";
6
6
 
7
7
  const componentNameMapping = {
8
8
  payments: "stripe-connect-payments",
@@ -82,7 +82,8 @@ const createWrapper = stripeConnect => {
82
82
  sdkVersion: version
83
83
  }
84
84
  })
85
- }));
85
+ })).connect;
86
+ console.log(stripeConnectInstance, "lemon");
86
87
  // We wrap create so we can map its different strings to supported components
87
88
  const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
88
89
  stripeConnectInstance.create = tagName => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "1.0.9",
3
+ "version": "1.1.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
@@ -59,6 +59,13 @@ export const loadScript = (): Promise<StripeConnectWrapper | null> => {
59
59
  }
60
60
 
61
61
  stripePromise = new Promise((resolve, reject) => {
62
+ if (typeof window === "undefined") {
63
+ reject(
64
+ "ConnectJS won't load when rendering code in the server - it can only be loaded on a browser. This error is expected when loading ConnectJS in SSR environments, like NextJS. It will have no impact in the UI, however if you wish to avoid it, you can switch to the `pure` version of the connect.js loader: https://github.com/stripe/connect-js#importing-loadconnect-without-side-effects."
65
+ );
66
+ return;
67
+ }
68
+
62
69
  if ((window as any).StripeConnect) {
63
70
  console.warn(EXISTING_SCRIPT_MESSAGE);
64
71
  }
package/types/shared.d.ts CHANGED
@@ -2,116 +2,148 @@ export declare type LoadConnect = () => Promise<StripeConnectWrapper>;
2
2
 
3
3
  export declare type OverlayOption = "dialog" | "drawer";
4
4
 
5
- export declare type UIConfigOptions = {
6
- overlay?: OverlayOption;
7
- overlayZIndex?: number;
5
+ /**
6
+ * Appearance options for the Connect instance.
7
+ */
8
+ export declare type AppearanceOptions = {
9
+ overlays?: OverlayOption;
10
+ variables?: AppearanceVariables;
8
11
  };
9
12
 
10
- export declare type AppearanceOptions = {
13
+ export declare type AppearanceVariables = {
11
14
  colorPrimary?: string;
12
15
  // Primary Button
13
- colorPrimaryButtonBorder?: string;
14
- colorPrimaryButtonBackground?: string;
15
- colorPrimaryButtonText?: string;
16
+ buttonPrimaryColorBorder?: string;
17
+ buttonPrimaryColorBackground?: string;
18
+ buttonPrimaryColorText?: string;
16
19
  // Secondary Button
17
- colorSecondaryButtonBorder?: string;
18
- colorSecondaryButtonBackground?: string;
19
- colorSecondaryButtonText?: string;
20
+ buttonSecondaryColorBorder?: string;
21
+ buttonSecondaryColorBackground?: string;
22
+ buttonSecondaryColorText?: string;
20
23
  // Link
21
- colorPrimaryLinkText?: string;
22
- colorSecondaryLinkText?: string;
24
+ actionPrimaryColorText?: string;
25
+ actionSecondaryColorText?: string;
23
26
  // Border
24
27
  colorBorder?: string;
25
28
  // Form
26
- colorFormHighlightBorder?: string;
27
- colorFormAccent?: string;
29
+ formHighlightColorBorder?: string;
30
+ formAccentColor?: string;
28
31
  // Text
29
32
  colorText?: string;
30
33
  colorSecondaryText?: string;
31
34
  // Background
32
35
  colorBackground?: string;
33
- colorOffsetBackground?: string;
34
- colorFormBackground?: string;
36
+ offsetBackgroundColor?: string;
37
+ formBackgroundColor?: string;
35
38
 
36
39
  // Feedback Colors
37
40
  colorDanger?: string;
38
41
 
39
42
  // Neutral Badge Colors
40
- badgeNeutralBorderColor?: string;
41
- badgeNeutralBackgroundColor?: string;
42
- badgeNeutralTextColor?: string;
43
+ badgeNeutralColorBorder?: string;
44
+ badgeNeutralColorBackground?: string;
45
+ badgeNeutralColorText?: string;
43
46
 
44
47
  // Success Badge Colors
45
- badgeSuccessBorderColor?: string;
46
- badgeSuccessBackgroundColor?: string;
47
- badgeSuccessTextColor?: string;
48
+ badgeSuccessColorBorder?: string;
49
+ badgeSuccessColorBackground?: string;
50
+ badgeSuccessColorText?: string;
48
51
 
49
52
  // Warning Badge Colors
50
- badgeWarningBorderColor?: string;
51
- badgeWarningBackgroundColor?: string;
52
- badgeWarningTextColor?: string;
53
+ badgeWarningColorBorder?: string;
54
+ badgeWarningColorBackground?: string;
55
+ badgeWarningColorText?: string;
53
56
 
54
57
  // Danger Badge Colors
55
- badgeDangerBorderColor?: string;
56
- badgeDangerBackgroundColor?: string;
57
- badgeDangerTextColor?: string;
58
+ badgeDangerColorBorder?: string;
59
+ badgeDangerColorBackground?: string;
60
+ badgeDangerColorText?: string;
58
61
 
59
62
  // Border Sizing
60
63
  borderRadius?: string;
61
- borderRadiusButton?: string;
62
- borderRadiusForm?: string;
63
- borderRadiusBadge?: string;
64
+ buttonBorderRadius?: string;
65
+ formBorderRadius?: string;
66
+ badgeBorderRadius?: string;
67
+ overlayBorderRadius?: string;
68
+
69
+ // Overlay
70
+ overlayZIndex?: number;
71
+
72
+ // Font Sizing
73
+ fontSizeBase?: string;
74
+
75
+ // Spacing
76
+ spacingUnit?: string;
64
77
 
65
78
  // Body Typography
66
- bodyLargeFontSize?: string;
67
- bodyLargeFontWeight?: string;
68
- bodyMediumFontSize?: string;
69
- bodyMediumFontWeight?: string;
70
- bodySmallFontSize?: string;
71
- bodySmallFontWeight?: string;
79
+ bodyLgFontSize?: string;
80
+ bodyLgFontWeight?: string;
81
+ bodyMdFontSize?: string;
82
+ bodyMdFontWeight?: string;
83
+ bodySmFontSize?: string;
84
+ bodySmFontWeight?: string;
72
85
 
73
86
  // Label Typography
74
- labelLargeFontSize?: string;
75
- labelLargeFontWeight?: string;
76
- labelLargeTextTransform?: string;
77
- labelMediumFontSize?: string;
78
- labelMediumFontWeight?: string;
79
- labelMediumTextTransform?: string;
80
- labelSmallFontSize?: string;
81
- labelSmallFontWeight?: string;
82
- labelSmallTextTransform?: string;
87
+ labelLgFontSize?: string;
88
+ labelLgFontWeight?: string;
89
+ labelLgTextTransform?: string;
90
+ labelMdFontSize?: string;
91
+ labelMdFontWeight?: string;
92
+ labelMdTextTransform?: string;
93
+ labelSmFontSize?: string;
94
+ labelSmFontWeight?: string;
95
+ labelSmTextTransform?: string;
83
96
 
84
97
  // Heading Typography
85
- headingXLargeFontSize?: string;
86
- headingXLargeFontWeight?: string;
87
- headingXLargeTextTransform?: string;
88
- headingLargeFontSize?: string;
89
- headingLargeFontWeight?: string;
90
- headingLargeTextTransform?: string;
91
- headingMediumFontSize?: string;
92
- headingMediumFontWeight?: string;
93
- headingMediumTextTransform?: string;
94
- headingSmallFontSize?: string;
95
- headingSmallFontWeight?: string;
96
- headingSmallTextTransform?: string;
97
- headingXSmallFontSize?: string;
98
- headingXSmallFontWeight?: string;
99
- headingXSmallTextTransform?: string;
100
-
101
- // Spacing
102
- spacingScale?: string;
98
+ headingXlFontSize?: string;
99
+ headingXlFontWeight?: string;
100
+ headingXlTextTransform?: string;
101
+ headingLgFontSize?: string;
102
+ headingLgFontWeight?: string;
103
+ headingLgTextTransform?: string;
104
+ headingMdFontSize?: string;
105
+ headingMdFontWeight?: string;
106
+ headingMdTextTransform?: string;
107
+ headingSmFontSize?: string;
108
+ headingSmFontWeight?: string;
109
+ headingSmTextTransform?: string;
110
+ headingXsFontSize?: string;
111
+ headingXsFontWeight?: string;
112
+ headingXsTextTransform?: string;
103
113
  };
104
114
 
105
115
  export type IStripeConnectUpdateParams = {
106
116
  appearance?: AppearanceOptions;
107
117
  };
108
118
 
119
+ /**
120
+ * Initialization parameters for Connect JS. See https://stripe.com/docs/connect/get-started-connect-embedded-components#configuring-connect-js for more details.
121
+ */
109
122
  export interface IStripeConnectInitParams {
123
+ /**
124
+ * The publishable key for the connected account.
125
+ */
110
126
  publishableKey: string;
127
+
128
+ /**
129
+ * The client secret for the connected account.
130
+ */
111
131
  clientSecret: string;
132
+
133
+ /**
134
+ * Appearance options for the Connect instance.
135
+ * @see https://stripe.com/docs/connect/customize-connect-embedded-components
136
+ */
112
137
  appearance?: AppearanceOptions;
113
- uiConfig?: UIConfigOptions;
138
+
139
+ /**
140
+ * Callback function that returns a new client secret. Used to support long running sessions and called on account session expiry.
141
+ */
114
142
  refreshClientSecret?: () => Promise<string>;
143
+
144
+ /**
145
+ * The locale to use for the Connect instance.
146
+ */
115
147
  locale?: string;
116
148
  }
117
149
 
@@ -145,6 +177,9 @@ export interface StripeConnectInstance {
145
177
  logout: () => Promise<void>;
146
178
  }
147
179
 
180
+ /**
181
+ * Tagnames to be used with the `create` method of the Connect instance.
182
+ */
148
183
  export type ConnectElementTagName =
149
184
  | "payments"
150
185
  | "payouts"