@stripe/connect-js 3.3.55-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,55 +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
- "recipients-list": "stripe-connect-recipients-list",
179
- "financial-accounts": "stripe-connect-financial-accounts",
180
- "financial-accounts-transactions": "stripe-connect-financial-accounts-transactions"
181
- };
182
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";
183
140
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
184
141
  const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
185
142
  const findScript = () => {
186
- 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;
187
144
  };
188
145
  const injectScript = () => {
189
146
  const script = document.createElement("script");
@@ -195,6 +152,11 @@ const injectScript = () => {
195
152
  document.head.appendChild(script);
196
153
  return script;
197
154
  };
155
+
156
+ const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
157
+ acc[name] = `stripe-connect-${name}`;
158
+ return acc;
159
+ }, {});
198
160
  let stripePromise = null;
199
161
  const isWindowStripeConnectDefined = stripeConnect => {
200
162
  // We only consider `StripeConnect` defined if `init` is a function
@@ -274,7 +236,7 @@ const initStripeConnect = (stripePromise, initParams) => {
274
236
  element[method] = function (value) {
275
237
  stripeConnectInstance.then(() => {
276
238
  if (!this[`${method}InternalOnly`]) {
277
- 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.55-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`);
278
240
  }
279
241
  this[`${method}InternalOnly`](value);
280
242
  });
@@ -328,7 +290,7 @@ const createWrapper = stripeConnect => {
328
290
  sdk: true,
329
291
  sdkOptions: {
330
292
  // This will be replaced by the npm package version when bundling
331
- sdkVersion: "3.3.55-preview-1"
293
+ sdkVersion: "3.4.1-preview-1"
332
294
  }
333
295
  })
334
296
  }));
@@ -352,4 +314,4 @@ const loadConnectAndInitialize = initParams => {
352
314
  return initStripeConnect(stripePromise$1, initParams);
353
315
  };
354
316
 
355
- 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,55 +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
- "recipients-list": "stripe-connect-recipients-list",
183
- "financial-accounts": "stripe-connect-financial-accounts",
184
- "financial-accounts-transactions": "stripe-connect-financial-accounts-transactions"
185
- };
186
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";
187
144
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
188
145
  const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
189
146
  const findScript = () => {
190
- 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;
191
148
  };
192
149
  const injectScript = () => {
193
150
  const script = document.createElement("script");
@@ -199,6 +156,11 @@ const injectScript = () => {
199
156
  document.head.appendChild(script);
200
157
  return script;
201
158
  };
159
+
160
+ const componentNameMapping = connectElementTagNames.reduce((acc, name) => {
161
+ acc[name] = `stripe-connect-${name}`;
162
+ return acc;
163
+ }, {});
202
164
  let stripePromise = null;
203
165
  const isWindowStripeConnectDefined = stripeConnect => {
204
166
  // We only consider `StripeConnect` defined if `init` is a function
@@ -278,7 +240,7 @@ const initStripeConnect = (stripePromise, initParams) => {
278
240
  element[method] = function (value) {
279
241
  stripeConnectInstance.then(() => {
280
242
  if (!this[`${method}InternalOnly`]) {
281
- 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.55-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`);
282
244
  }
283
245
  this[`${method}InternalOnly`](value);
284
246
  });
@@ -332,7 +294,7 @@ const createWrapper = stripeConnect => {
332
294
  sdk: true,
333
295
  sdkOptions: {
334
296
  // This will be replaced by the npm package version when bundling
335
- sdkVersion: "3.3.55-preview-1"
297
+ sdkVersion: "3.4.1-preview-1"
336
298
  }
337
299
  })
338
300
  }));
@@ -356,4 +318,7 @@ const loadConnectAndInitialize = initParams => {
356
318
  return initStripeConnect(stripePromise$1, initParams);
357
319
  };
358
320
 
321
+ exports.ConnectElementCommonMethodConfig = ConnectElementCommonMethodConfig;
322
+ exports.ConnectElementCustomMethodConfig = ConnectElementCustomMethodConfig;
323
+ exports.connectElementTagNames = connectElementTagNames;
359
324
  exports.loadConnectAndInitialize = loadConnectAndInitialize;
@@ -0,0 +1,2 @@
1
+ export * from "./shared";
2
+ export * from "../components/componentsAndSetters";