@stripe/connect-js 1.0.10 → 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.
@@ -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
@@ -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
@@ -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
@@ -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.10",
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,12 +2,15 @@ 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
16
  buttonPrimaryColorBorder?: string;
@@ -37,24 +40,24 @@ export declare type AppearanceOptions = {
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;
@@ -63,6 +66,9 @@ export declare type AppearanceOptions = {
63
66
  badgeBorderRadius?: string;
64
67
  overlayBorderRadius?: string;
65
68
 
69
+ // Overlay
70
+ overlayZIndex?: number;
71
+
66
72
  // Font Sizing
67
73
  fontSizeBase?: string;
68
74
 
@@ -110,12 +116,34 @@ export type IStripeConnectUpdateParams = {
110
116
  appearance?: AppearanceOptions;
111
117
  };
112
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
+ */
113
122
  export interface IStripeConnectInitParams {
123
+ /**
124
+ * The publishable key for the connected account.
125
+ */
114
126
  publishableKey: string;
127
+
128
+ /**
129
+ * The client secret for the connected account.
130
+ */
115
131
  clientSecret: string;
132
+
133
+ /**
134
+ * Appearance options for the Connect instance.
135
+ * @see https://stripe.com/docs/connect/customize-connect-embedded-components
136
+ */
116
137
  appearance?: AppearanceOptions;
117
- 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
+ */
118
142
  refreshClientSecret?: () => Promise<string>;
143
+
144
+ /**
145
+ * The locale to use for the Connect instance.
146
+ */
119
147
  locale?: string;
120
148
  }
121
149
 
@@ -149,6 +177,9 @@ export interface StripeConnectInstance {
149
177
  logout: () => Promise<void>;
150
178
  }
151
179
 
180
+ /**
181
+ * Tagnames to be used with the `create` method of the Connect instance.
182
+ */
152
183
  export type ConnectElementTagName =
153
184
  | "payments"
154
185
  | "payouts"