@stripe/connect-js 3.3.31-preview-1 → 3.3.33-preview-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.
@@ -116,6 +116,7 @@ const componentNameMapping = {
116
116
  payouts: "stripe-connect-payouts",
117
117
  "payment-details": "stripe-connect-payment-details",
118
118
  "payment-disputes": "stripe-connect-payment-disputes",
119
+ "disputes-list": "stripe-connect-disputes-list",
119
120
  "account-onboarding": "stripe-connect-account-onboarding",
120
121
  "payment-method-settings": "stripe-connect-payment-method-settings",
121
122
  "account-management": "stripe-connect-account-management",
@@ -159,6 +160,13 @@ const injectScript = () => {
159
160
  return script;
160
161
  };
161
162
  let stripePromise = null;
163
+ const isWindowStripeConnectDefined = stripeConnect => {
164
+ // We only consider `StripeConnect` defined if `init` is a function
165
+ // Why? HTML markup like:
166
+ // <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
167
+ // can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
168
+ return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
169
+ };
162
170
  const loadScript = () => {
163
171
  // Ensure that we only attempt to load Connect.js at most once
164
172
  if (stripePromise !== null) {
@@ -169,10 +177,8 @@ const loadScript = () => {
169
177
  reject("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.");
170
178
  return;
171
179
  }
172
- if (window.StripeConnect) {
180
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
173
181
  console.warn(EXISTING_SCRIPT_MESSAGE);
174
- }
175
- if (window.StripeConnect) {
176
182
  const wrapper = createWrapper(window.StripeConnect);
177
183
  resolve(wrapper);
178
184
  return;
@@ -185,7 +191,7 @@ const loadScript = () => {
185
191
  script = injectScript();
186
192
  }
187
193
  script.addEventListener("load", () => {
188
- if (window.StripeConnect) {
194
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
189
195
  const wrapper = createWrapper(window.StripeConnect);
190
196
  resolve(wrapper);
191
197
  } else {
@@ -283,7 +289,7 @@ const createWrapper = stripeConnect => {
283
289
  sdk: true,
284
290
  sdkOptions: {
285
291
  // This will be replaced by the npm package version when bundling
286
- sdkVersion: "3.3.31-preview-1"
292
+ sdkVersion: "3.3.33-preview-1"
287
293
  }
288
294
  })
289
295
  }));
package/dist/connect.js CHANGED
@@ -120,6 +120,7 @@ const componentNameMapping = {
120
120
  payouts: "stripe-connect-payouts",
121
121
  "payment-details": "stripe-connect-payment-details",
122
122
  "payment-disputes": "stripe-connect-payment-disputes",
123
+ "disputes-list": "stripe-connect-disputes-list",
123
124
  "account-onboarding": "stripe-connect-account-onboarding",
124
125
  "payment-method-settings": "stripe-connect-payment-method-settings",
125
126
  "account-management": "stripe-connect-account-management",
@@ -163,6 +164,13 @@ const injectScript = () => {
163
164
  return script;
164
165
  };
165
166
  let stripePromise = null;
167
+ const isWindowStripeConnectDefined = stripeConnect => {
168
+ // We only consider `StripeConnect` defined if `init` is a function
169
+ // Why? HTML markup like:
170
+ // <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
171
+ // can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
172
+ return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
173
+ };
166
174
  const loadScript = () => {
167
175
  // Ensure that we only attempt to load Connect.js at most once
168
176
  if (stripePromise !== null) {
@@ -173,10 +181,8 @@ const loadScript = () => {
173
181
  reject("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.");
174
182
  return;
175
183
  }
176
- if (window.StripeConnect) {
184
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
177
185
  console.warn(EXISTING_SCRIPT_MESSAGE);
178
- }
179
- if (window.StripeConnect) {
180
186
  const wrapper = createWrapper(window.StripeConnect);
181
187
  resolve(wrapper);
182
188
  return;
@@ -189,7 +195,7 @@ const loadScript = () => {
189
195
  script = injectScript();
190
196
  }
191
197
  script.addEventListener("load", () => {
192
- if (window.StripeConnect) {
198
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
193
199
  const wrapper = createWrapper(window.StripeConnect);
194
200
  resolve(wrapper);
195
201
  } else {
@@ -287,7 +293,7 @@ const createWrapper = stripeConnect => {
287
293
  sdk: true,
288
294
  sdkOptions: {
289
295
  // This will be replaced by the npm package version when bundling
290
- sdkVersion: "3.3.31-preview-1"
296
+ sdkVersion: "3.3.33-preview-1"
291
297
  }
292
298
  })
293
299
  }));
package/dist/pure.esm.js CHANGED
@@ -116,6 +116,7 @@ const componentNameMapping = {
116
116
  payouts: "stripe-connect-payouts",
117
117
  "payment-details": "stripe-connect-payment-details",
118
118
  "payment-disputes": "stripe-connect-payment-disputes",
119
+ "disputes-list": "stripe-connect-disputes-list",
119
120
  "account-onboarding": "stripe-connect-account-onboarding",
120
121
  "payment-method-settings": "stripe-connect-payment-method-settings",
121
122
  "account-management": "stripe-connect-account-management",
@@ -159,6 +160,13 @@ const injectScript = () => {
159
160
  return script;
160
161
  };
161
162
  let stripePromise = null;
163
+ const isWindowStripeConnectDefined = stripeConnect => {
164
+ // We only consider `StripeConnect` defined if `init` is a function
165
+ // Why? HTML markup like:
166
+ // <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
167
+ // can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
168
+ return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
169
+ };
162
170
  const loadScript = () => {
163
171
  // Ensure that we only attempt to load Connect.js at most once
164
172
  if (stripePromise !== null) {
@@ -169,10 +177,8 @@ const loadScript = () => {
169
177
  reject("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.");
170
178
  return;
171
179
  }
172
- if (window.StripeConnect) {
180
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
173
181
  console.warn(EXISTING_SCRIPT_MESSAGE);
174
- }
175
- if (window.StripeConnect) {
176
182
  const wrapper = createWrapper(window.StripeConnect);
177
183
  resolve(wrapper);
178
184
  return;
@@ -185,7 +191,7 @@ const loadScript = () => {
185
191
  script = injectScript();
186
192
  }
187
193
  script.addEventListener("load", () => {
188
- if (window.StripeConnect) {
194
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
189
195
  const wrapper = createWrapper(window.StripeConnect);
190
196
  resolve(wrapper);
191
197
  } else {
@@ -283,7 +289,7 @@ const createWrapper = stripeConnect => {
283
289
  sdk: true,
284
290
  sdkOptions: {
285
291
  // This will be replaced by the npm package version when bundling
286
- sdkVersion: "3.3.31-preview-1"
292
+ sdkVersion: "3.3.33-preview-1"
287
293
  }
288
294
  })
289
295
  }));
package/dist/pure.js CHANGED
@@ -120,6 +120,7 @@ const componentNameMapping = {
120
120
  payouts: "stripe-connect-payouts",
121
121
  "payment-details": "stripe-connect-payment-details",
122
122
  "payment-disputes": "stripe-connect-payment-disputes",
123
+ "disputes-list": "stripe-connect-disputes-list",
123
124
  "account-onboarding": "stripe-connect-account-onboarding",
124
125
  "payment-method-settings": "stripe-connect-payment-method-settings",
125
126
  "account-management": "stripe-connect-account-management",
@@ -163,6 +164,13 @@ const injectScript = () => {
163
164
  return script;
164
165
  };
165
166
  let stripePromise = null;
167
+ const isWindowStripeConnectDefined = stripeConnect => {
168
+ // We only consider `StripeConnect` defined if `init` is a function
169
+ // Why? HTML markup like:
170
+ // <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
171
+ // can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
172
+ return !!(stripeConnect && typeof stripeConnect === "object" && "init" in stripeConnect && typeof stripeConnect.init === "function");
173
+ };
166
174
  const loadScript = () => {
167
175
  // Ensure that we only attempt to load Connect.js at most once
168
176
  if (stripePromise !== null) {
@@ -173,10 +181,8 @@ const loadScript = () => {
173
181
  reject("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.");
174
182
  return;
175
183
  }
176
- if (window.StripeConnect) {
184
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
177
185
  console.warn(EXISTING_SCRIPT_MESSAGE);
178
- }
179
- if (window.StripeConnect) {
180
186
  const wrapper = createWrapper(window.StripeConnect);
181
187
  resolve(wrapper);
182
188
  return;
@@ -189,7 +195,7 @@ const loadScript = () => {
189
195
  script = injectScript();
190
196
  }
191
197
  script.addEventListener("load", () => {
192
- if (window.StripeConnect) {
198
+ if (isWindowStripeConnectDefined(window.StripeConnect)) {
193
199
  const wrapper = createWrapper(window.StripeConnect);
194
200
  resolve(wrapper);
195
201
  } else {
@@ -287,7 +293,7 @@ const createWrapper = stripeConnect => {
287
293
  sdk: true,
288
294
  sdkOptions: {
289
295
  // This will be replaced by the npm package version when bundling
290
- sdkVersion: "3.3.31-preview-1"
296
+ sdkVersion: "3.3.33-preview-1"
291
297
  }
292
298
  })
293
299
  }));
@@ -1,6 +1,6 @@
1
1
  import type { 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-payment-disputes" | "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" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-recipients" | "stripe-connect-capital-financing" | "stripe-connect-capital-financing-application" | "stripe-connect-capital-financing-promotion" | "stripe-connect-capital-overview" | "stripe-connect-documents" | "stripe-connect-product-tax-code-selector" | "stripe-connect-export-tax-transactions" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings" | "stripe-connect-tax-threshold-monitoring" | "stripe-connect-balances" | "stripe-connect-payouts-list" | "stripe-connect-app-install" | "stripe-connect-app-viewport" | "stripe-connect-reporting-chart";
3
+ export type ConnectElementHTMLName = "stripe-connect-payments" | "stripe-connect-payouts" | "stripe-connect-payment-details" | "stripe-connect-payment-disputes" | "stripe-connect-disputes-list" | "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" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-recipients" | "stripe-connect-capital-financing" | "stripe-connect-capital-financing-application" | "stripe-connect-capital-financing-promotion" | "stripe-connect-capital-overview" | "stripe-connect-documents" | "stripe-connect-product-tax-code-selector" | "stripe-connect-export-tax-transactions" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings" | "stripe-connect-tax-threshold-monitoring" | "stripe-connect-balances" | "stripe-connect-payouts-list" | "stripe-connect-app-install" | "stripe-connect-app-viewport" | "stripe-connect-reporting-chart";
4
4
  export declare const componentNameMapping: Record<ConnectElementTagName, ConnectElementHTMLName>;
5
5
  type StripeConnectInstanceExtended = StripeConnectInstance & {
6
6
  debugInstance: () => Promise<StripeConnectInstance>;
@@ -9,6 +9,7 @@ interface StripeConnectWrapper {
9
9
  initialize: (params: IStripeConnectInitParams) => StripeConnectInstance;
10
10
  }
11
11
  export declare const findScript: () => HTMLScriptElement | null;
12
+ export declare const isWindowStripeConnectDefined: (stripeConnect: unknown) => boolean;
12
13
  export declare const loadScript: () => Promise<StripeConnectWrapper>;
13
14
  export declare const initStripeConnect: (stripePromise: Promise<StripeConnectWrapper>, initParams: IStripeConnectInitParams) => StripeConnectInstanceExtended;
14
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.31-preview-1",
3
+ "version": "3.3.33-preview-1",
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
@@ -18,6 +18,7 @@ export type ConnectElementHTMLName =
18
18
  | "stripe-connect-payouts"
19
19
  | "stripe-connect-payment-details"
20
20
  | "stripe-connect-payment-disputes"
21
+ | "stripe-connect-disputes-list"
21
22
  | "stripe-connect-account-onboarding"
22
23
  | "stripe-connect-payment-method-settings"
23
24
  | "stripe-connect-account-management"
@@ -52,6 +53,7 @@ export const componentNameMapping: Record<
52
53
  payouts: "stripe-connect-payouts",
53
54
  "payment-details": "stripe-connect-payment-details",
54
55
  "payment-disputes": "stripe-connect-payment-disputes",
56
+ "disputes-list": "stripe-connect-disputes-list",
55
57
  "account-onboarding": "stripe-connect-account-onboarding",
56
58
  "payment-method-settings": "stripe-connect-payment-method-settings",
57
59
  "account-management": "stripe-connect-account-management",
@@ -125,6 +127,19 @@ const injectScript = (): HTMLScriptElement => {
125
127
 
126
128
  let stripePromise: Promise<StripeConnectWrapper> | null = null;
127
129
 
130
+ export const isWindowStripeConnectDefined = (stripeConnect: unknown) => {
131
+ // We only consider `StripeConnect` defined if `init` is a function
132
+ // Why? HTML markup like:
133
+ // <a id="StripeConnect"><a id="StripeConnect" name="init" href="stripe"></a></a> in the <head> of the page
134
+ // can end up "contaminating" the window.StripeConnect object and cause issues in connect.js initialization
135
+ return !!(
136
+ stripeConnect &&
137
+ typeof stripeConnect === "object" &&
138
+ "init" in stripeConnect &&
139
+ typeof stripeConnect.init === "function"
140
+ );
141
+ };
142
+
128
143
  export const loadScript = (): Promise<StripeConnectWrapper> => {
129
144
  // Ensure that we only attempt to load Connect.js at most once
130
145
  if (stripePromise !== null) {
@@ -139,11 +154,8 @@ export const loadScript = (): Promise<StripeConnectWrapper> => {
139
154
  return;
140
155
  }
141
156
 
142
- if ((window as any).StripeConnect) {
157
+ if (isWindowStripeConnectDefined((window as any).StripeConnect)) {
143
158
  console.warn(EXISTING_SCRIPT_MESSAGE);
144
- }
145
-
146
- if ((window as any).StripeConnect) {
147
159
  const wrapper = createWrapper((window as any).StripeConnect);
148
160
  resolve(wrapper);
149
161
  return;
@@ -159,7 +171,7 @@ export const loadScript = (): Promise<StripeConnectWrapper> => {
159
171
  }
160
172
 
161
173
  script.addEventListener("load", () => {
162
- if ((window as any).StripeConnect) {
174
+ if (isWindowStripeConnectDefined((window as any).StripeConnect)) {
163
175
  const wrapper = createWrapper((window as any).StripeConnect);
164
176
  resolve(wrapper);
165
177
  } else {
package/types/shared.d.ts CHANGED
@@ -491,6 +491,7 @@ export type ConnectElementTagName =
491
491
  | "payouts"
492
492
  | "payment-details"
493
493
  | "payment-disputes"
494
+ | "disputes-list"
494
495
  | "account-onboarding"
495
496
  | "payment-method-settings"
496
497
  | "account-management"