@stripe/connect-js 3.3.54-preview-1 → 3.4.1-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.
@@ -1,3 +1,4 @@
1
+ export declare const connectElementTagNames: readonly ["payments", "payouts", "payment-details", "payment-disputes", "disputes-list", "account-onboarding", "payment-method-settings", "account-management", "notification-banner", "instant-payouts", "instant-payouts-promotion", "issuing-card", "issuing-cards-list", "financial-account", "financial-account-transactions", "recipients", "capital-financing", "capital-financing-application", "capital-financing-promotion", "capital-overview", "documents", "product-tax-code-selector", "export-tax-transactions", "tax-registrations", "tax-settings", "tax-threshold-monitoring", "balances", "payouts-list", "payout-details", "app-install", "app-viewport", "reporting-chart", "check-scanning", "agentic-commerce-settings", "terminal-hardware-orders", "terminal-hardware-shop", "network-cost-passthrough-report", "balance-report", "payout-reconciliation-report", "recipients-list", "financial-accounts", "financial-accounts-transactions"];
1
2
  export type FetchEphemeralKeyFunction = (fetchParams: {
2
3
  issuingCard: string;
3
4
  nonce: string;
@@ -0,0 +1,4 @@
1
+ import type { ConnectElementTagName } from "../exportedTypes";
2
+ import type { ConnectElementCustomMethodConfig } from "./componentsAndSetters";
3
+ export type HasType<T, Q extends T> = Q;
4
+ export type CustomMethodConfigValidation = HasType<ConnectElementTagName, keyof typeof ConnectElementCustomMethodConfig>;
@@ -1,5 +1,6 @@
1
- /* eslint-disable @typescript-eslint/no-empty-function */
2
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ // Source of truth for the entire list of components. When you add a new component, it should be added here.
3
+ const connectElementTagNames = ["payments", "payouts", "payment-details", "payment-disputes", "disputes-list", "account-onboarding", "payment-method-settings", "account-management", "notification-banner", "instant-payouts", "instant-payouts-promotion", "issuing-card", "issuing-cards-list", "financial-account", "financial-account-transactions", "recipients", "capital-financing", "capital-financing-application", "capital-financing-promotion", "capital-overview", "documents", "product-tax-code-selector", "export-tax-transactions", "tax-registrations", "tax-settings", "tax-threshold-monitoring", "balances", "payouts-list", "payout-details", "app-install", "app-viewport", "reporting-chart", "check-scanning", "agentic-commerce-settings", "terminal-hardware-orders", "terminal-hardware-shop", "network-cost-passthrough-report", "balance-report", "payout-reconciliation-report", "recipients-list", "financial-accounts", "financial-accounts-transactions"];
3
4
  const ConnectElementCommonMethodConfig = {
4
5
  setOnLoadError: _listener => {},
5
6
  setOnLoaderStart: _listener => {}
@@ -135,52 +136,11 @@ const ConnectElementCustomMethodConfig = {
135
136
  }
136
137
  };
137
138
 
138
- const componentNameMapping = {
139
- payments: "stripe-connect-payments",
140
- payouts: "stripe-connect-payouts",
141
- "payment-details": "stripe-connect-payment-details",
142
- "payment-disputes": "stripe-connect-payment-disputes",
143
- "disputes-list": "stripe-connect-disputes-list",
144
- "account-onboarding": "stripe-connect-account-onboarding",
145
- "payment-method-settings": "stripe-connect-payment-method-settings",
146
- "account-management": "stripe-connect-account-management",
147
- "notification-banner": "stripe-connect-notification-banner",
148
- "instant-payouts": "stripe-connect-instant-payouts",
149
- "instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
150
- "issuing-card": "stripe-connect-issuing-card",
151
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
152
- "financial-account": "stripe-connect-financial-account",
153
- recipients: "stripe-connect-recipients",
154
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
155
- "capital-financing": "stripe-connect-capital-financing",
156
- "capital-financing-application": "stripe-connect-capital-financing-application",
157
- "capital-financing-promotion": "stripe-connect-capital-financing-promotion",
158
- "capital-overview": "stripe-connect-capital-overview",
159
- documents: "stripe-connect-documents",
160
- "product-tax-code-selector": "stripe-connect-product-tax-code-selector",
161
- "export-tax-transactions": "stripe-connect-export-tax-transactions",
162
- "tax-registrations": "stripe-connect-tax-registrations",
163
- "tax-settings": "stripe-connect-tax-settings",
164
- "tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
165
- balances: "stripe-connect-balances",
166
- "payouts-list": "stripe-connect-payouts-list",
167
- "payout-details": "stripe-connect-payout-details",
168
- "app-install": "stripe-connect-app-install",
169
- "app-viewport": "stripe-connect-app-viewport",
170
- "reporting-chart": "stripe-connect-reporting-chart",
171
- "check-scanning": "stripe-connect-check-scanning",
172
- "agentic-commerce-settings": "stripe-connect-agentic-commerce-settings",
173
- "terminal-hardware-orders": "stripe-connect-terminal-hardware-orders",
174
- "terminal-hardware-shop": "stripe-connect-terminal-hardware-shop",
175
- "network-cost-passthrough-report": "stripe-connect-network-cost-passthrough-report",
176
- "balance-report": "stripe-connect-balance-report",
177
- "payout-reconciliation-report": "stripe-connect-payout-reconciliation-report"
178
- };
179
139
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
180
140
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
181
141
  const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
182
142
  const findScript = () => {
183
- return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || null;
143
+ return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
184
144
  };
185
145
  const injectScript = () => {
186
146
  const script = document.createElement("script");
@@ -192,6 +152,11 @@ const injectScript = () => {
192
152
  document.head.appendChild(script);
193
153
  return script;
194
154
  };
155
+
156
+ const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
157
+ acc[name] = `stripe-connect-${name}`;
158
+ return acc;
159
+ }, {});
195
160
  let stripePromise = null;
196
161
  const isWindowStripeConnectDefined = stripeConnect => {
197
162
  // We only consider `StripeConnect` defined if `init` is a function
@@ -271,7 +236,7 @@ const initStripeConnect = (stripePromise, initParams) => {
271
236
  element[method] = function (value) {
272
237
  stripeConnectInstance.then(() => {
273
238
  if (!this[`${method}InternalOnly`]) {
274
- 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.3.54-preview-1`);
239
+ 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.1-preview-1`);
275
240
  }
276
241
  this[`${method}InternalOnly`](value);
277
242
  });
@@ -325,7 +290,7 @@ const createWrapper = stripeConnect => {
325
290
  sdk: true,
326
291
  sdkOptions: {
327
292
  // This will be replaced by the npm package version when bundling
328
- sdkVersion: "3.3.54-preview-1"
293
+ sdkVersion: "3.4.1-preview-1"
329
294
  }
330
295
  })
331
296
  }));
@@ -349,4 +314,4 @@ const loadConnectAndInitialize = initParams => {
349
314
  return initStripeConnect(stripePromise$1, initParams);
350
315
  };
351
316
 
352
- export { loadConnectAndInitialize };
317
+ export { ConnectElementCommonMethodConfig, ConnectElementCustomMethodConfig, connectElementTagNames, loadConnectAndInitialize };
package/dist/connect.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /* eslint-disable @typescript-eslint/no-empty-function */
6
5
  /* eslint-disable @typescript-eslint/no-unused-vars */
6
+ // Source of truth for the entire list of components. When you add a new component, it should be added here.
7
+ const connectElementTagNames = ["payments", "payouts", "payment-details", "payment-disputes", "disputes-list", "account-onboarding", "payment-method-settings", "account-management", "notification-banner", "instant-payouts", "instant-payouts-promotion", "issuing-card", "issuing-cards-list", "financial-account", "financial-account-transactions", "recipients", "capital-financing", "capital-financing-application", "capital-financing-promotion", "capital-overview", "documents", "product-tax-code-selector", "export-tax-transactions", "tax-registrations", "tax-settings", "tax-threshold-monitoring", "balances", "payouts-list", "payout-details", "app-install", "app-viewport", "reporting-chart", "check-scanning", "agentic-commerce-settings", "terminal-hardware-orders", "terminal-hardware-shop", "network-cost-passthrough-report", "balance-report", "payout-reconciliation-report", "recipients-list", "financial-accounts", "financial-accounts-transactions"];
7
8
  const ConnectElementCommonMethodConfig = {
8
9
  setOnLoadError: _listener => {},
9
10
  setOnLoaderStart: _listener => {}
@@ -139,52 +140,11 @@ const ConnectElementCustomMethodConfig = {
139
140
  }
140
141
  };
141
142
 
142
- const componentNameMapping = {
143
- payments: "stripe-connect-payments",
144
- payouts: "stripe-connect-payouts",
145
- "payment-details": "stripe-connect-payment-details",
146
- "payment-disputes": "stripe-connect-payment-disputes",
147
- "disputes-list": "stripe-connect-disputes-list",
148
- "account-onboarding": "stripe-connect-account-onboarding",
149
- "payment-method-settings": "stripe-connect-payment-method-settings",
150
- "account-management": "stripe-connect-account-management",
151
- "notification-banner": "stripe-connect-notification-banner",
152
- "instant-payouts": "stripe-connect-instant-payouts",
153
- "instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
154
- "issuing-card": "stripe-connect-issuing-card",
155
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
156
- "financial-account": "stripe-connect-financial-account",
157
- recipients: "stripe-connect-recipients",
158
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
159
- "capital-financing": "stripe-connect-capital-financing",
160
- "capital-financing-application": "stripe-connect-capital-financing-application",
161
- "capital-financing-promotion": "stripe-connect-capital-financing-promotion",
162
- "capital-overview": "stripe-connect-capital-overview",
163
- documents: "stripe-connect-documents",
164
- "product-tax-code-selector": "stripe-connect-product-tax-code-selector",
165
- "export-tax-transactions": "stripe-connect-export-tax-transactions",
166
- "tax-registrations": "stripe-connect-tax-registrations",
167
- "tax-settings": "stripe-connect-tax-settings",
168
- "tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
169
- balances: "stripe-connect-balances",
170
- "payouts-list": "stripe-connect-payouts-list",
171
- "payout-details": "stripe-connect-payout-details",
172
- "app-install": "stripe-connect-app-install",
173
- "app-viewport": "stripe-connect-app-viewport",
174
- "reporting-chart": "stripe-connect-reporting-chart",
175
- "check-scanning": "stripe-connect-check-scanning",
176
- "agentic-commerce-settings": "stripe-connect-agentic-commerce-settings",
177
- "terminal-hardware-orders": "stripe-connect-terminal-hardware-orders",
178
- "terminal-hardware-shop": "stripe-connect-terminal-hardware-shop",
179
- "network-cost-passthrough-report": "stripe-connect-network-cost-passthrough-report",
180
- "balance-report": "stripe-connect-balance-report",
181
- "payout-reconciliation-report": "stripe-connect-payout-reconciliation-report"
182
- };
183
143
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
184
144
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
185
145
  const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
186
146
  const findScript = () => {
187
- return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || null;
147
+ return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
188
148
  };
189
149
  const injectScript = () => {
190
150
  const script = document.createElement("script");
@@ -196,6 +156,11 @@ const injectScript = () => {
196
156
  document.head.appendChild(script);
197
157
  return script;
198
158
  };
159
+
160
+ const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
161
+ acc[name] = `stripe-connect-${name}`;
162
+ return acc;
163
+ }, {});
199
164
  let stripePromise = null;
200
165
  const isWindowStripeConnectDefined = stripeConnect => {
201
166
  // We only consider `StripeConnect` defined if `init` is a function
@@ -275,7 +240,7 @@ const initStripeConnect = (stripePromise, initParams) => {
275
240
  element[method] = function (value) {
276
241
  stripeConnectInstance.then(() => {
277
242
  if (!this[`${method}InternalOnly`]) {
278
- 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.3.54-preview-1`);
243
+ 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.1-preview-1`);
279
244
  }
280
245
  this[`${method}InternalOnly`](value);
281
246
  });
@@ -329,7 +294,7 @@ const createWrapper = stripeConnect => {
329
294
  sdk: true,
330
295
  sdkOptions: {
331
296
  // This will be replaced by the npm package version when bundling
332
- sdkVersion: "3.3.54-preview-1"
297
+ sdkVersion: "3.4.1-preview-1"
333
298
  }
334
299
  })
335
300
  }));
@@ -353,4 +318,7 @@ const loadConnectAndInitialize = initParams => {
353
318
  return initStripeConnect(stripePromise$1, initParams);
354
319
  };
355
320
 
321
+ exports.ConnectElementCommonMethodConfig = ConnectElementCommonMethodConfig;
322
+ exports.ConnectElementCustomMethodConfig = ConnectElementCustomMethodConfig;
323
+ exports.connectElementTagNames = connectElementTagNames;
356
324
  exports.loadConnectAndInitialize = loadConnectAndInitialize;
@@ -0,0 +1,2 @@
1
+ export * from "./shared";
2
+ export * from "../components/componentsAndSetters";