@stripe/connect-js 3.3.35-preview-1 → 3.3.35

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.
package/dist/pure.js CHANGED
@@ -9,17 +9,6 @@ const ConnectElementCommonMethodConfig = {
9
9
  setOnLoaderStart: _listener => {}
10
10
  };
11
11
  const ConnectElementCustomMethodConfig = {
12
- payments: {
13
- setDefaultFilters: _filters => {}
14
- },
15
- "payment-details": {
16
- setPayment: _payment => {},
17
- setOnClose: _listener => {}
18
- },
19
- "payment-disputes": {
20
- setPayment: _payment => {},
21
- setOnDisputesLoaded: _listener => {}
22
- },
23
12
  "account-onboarding": {
24
13
  setFullTermsOfServiceUrl: _termOfServiceUrl => {},
25
14
  setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
@@ -57,46 +46,16 @@ const ConnectElementCustomMethodConfig = {
57
46
  "financial-account-transactions": {
58
47
  setFinancialAccount: _financialAccount => {}
59
48
  },
60
- recipients: {
61
- setDataSource: _dataSource => {}
62
- },
63
- "app-install": {
64
- setApp: _app => {},
65
- setOnAppInstallStateFetched: _listener => {},
66
- setOnAppInstallStateChanged: _listener => {}
67
- },
68
- "app-viewport": {
69
- setApp: _app => {},
70
- setAppData: _appData => {}
71
- },
72
- "payment-method-settings": {
73
- setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
74
- },
75
- "capital-financing": {
76
- setDefaultFinancingOffer: _defaultFinancingOffer => {},
77
- setShowFinancingSelector: _showFinancingSelector => {},
78
- setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
79
- setSupportUrl: _supportUrl => {},
80
- setOnFinancingsLoaded: _listener => {}
81
- },
82
- "capital-financing-application": {
83
- setOnApplicationSubmitted: _listener => {},
84
- setPrivacyPolicyUrl: _privacyPolicyUrl => {},
85
- setHowCapitalWorksUrl: _howCapitalWorksUrl => {}
49
+ payments: {
50
+ setDefaultFilters: _filters => {}
86
51
  },
87
- "capital-financing-promotion": {
88
- setLayout: _layout => {},
89
- setOnApplicationSubmitted: _listener => {},
90
- setOnEligibleFinancingOfferLoaded: _listener => {},
91
- setPrivacyPolicyUrl: _privacyPolicyUrl => {},
92
- setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
93
- setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {}
52
+ "payment-details": {
53
+ setPayment: _payment => {},
54
+ setOnClose: _listener => {}
94
55
  },
95
- "reporting-chart": {
96
- setReportName: _reportName => {},
97
- setIntervalStart: _intervalStart => {},
98
- setIntervalEnd: _intervalEnd => {},
99
- setIntervalType: _intervalType => {}
56
+ "payment-disputes": {
57
+ setPayment: _payment => {},
58
+ setOnDisputesLoaded: _listener => {}
100
59
  },
101
60
  "tax-settings": {
102
61
  setHideProductTaxCodeSelector: _hidden => {},
@@ -105,58 +64,41 @@ const ConnectElementCustomMethodConfig = {
105
64
  },
106
65
  "tax-registrations": {
107
66
  setOnAfterTaxRegistrationAdded: _listener => {},
108
- setDisplayCountries: _countries => {}
109
- },
110
- "tax-threshold-monitoring": {
111
- setDisplayCountries: _countries => {}
112
- },
113
- "product-tax-code-selector": {
114
- setOnTaxCodeSelect: _listener => {},
115
- setHideDescription: _hideDescription => {},
116
- setDisabled: _disabled => {},
117
- setInitialTaxCode: _initialTaxCode => {}
67
+ setDisplayCountries: _countries => {},
68
+ setOnAfterTaxRegistrationExpired: _listener => {}
118
69
  },
119
- "export-tax-transactions": {}
70
+ "payout-details": {
71
+ setPayout: _payout => {},
72
+ setOnClose: _listener => {}
73
+ }
120
74
  };
121
75
 
122
76
  const componentNameMapping = {
77
+ "account-onboarding": "stripe-connect-account-onboarding",
78
+ "disputes-list": "stripe-connect-disputes-list",
123
79
  payments: "stripe-connect-payments",
124
- payouts: "stripe-connect-payouts",
125
80
  "payment-details": "stripe-connect-payment-details",
126
81
  "payment-disputes": "stripe-connect-payment-disputes",
127
- "disputes-list": "stripe-connect-disputes-list",
128
- "account-onboarding": "stripe-connect-account-onboarding",
129
- "payment-method-settings": "stripe-connect-payment-method-settings",
82
+ payouts: "stripe-connect-payouts",
83
+ "payouts-list": "stripe-connect-payouts-list",
84
+ "payout-details": "stripe-connect-payout-details",
85
+ balances: "stripe-connect-balances",
130
86
  "account-management": "stripe-connect-account-management",
131
87
  "notification-banner": "stripe-connect-notification-banner",
132
- "instant-payouts": "stripe-connect-instant-payouts",
133
88
  "instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
134
89
  "issuing-card": "stripe-connect-issuing-card",
135
90
  "issuing-cards-list": "stripe-connect-issuing-cards-list",
136
91
  "financial-account": "stripe-connect-financial-account",
137
- recipients: "stripe-connect-recipients",
138
92
  "financial-account-transactions": "stripe-connect-financial-account-transactions",
139
- "capital-financing": "stripe-connect-capital-financing",
140
- "capital-financing-application": "stripe-connect-capital-financing-application",
141
- "capital-financing-promotion": "stripe-connect-capital-financing-promotion",
142
- "capital-overview": "stripe-connect-capital-overview",
143
93
  documents: "stripe-connect-documents",
144
- "product-tax-code-selector": "stripe-connect-product-tax-code-selector",
145
- "export-tax-transactions": "stripe-connect-export-tax-transactions",
146
94
  "tax-registrations": "stripe-connect-tax-registrations",
147
- "tax-settings": "stripe-connect-tax-settings",
148
- "tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
149
- balances: "stripe-connect-balances",
150
- "payouts-list": "stripe-connect-payouts-list",
151
- "app-install": "stripe-connect-app-install",
152
- "app-viewport": "stripe-connect-app-viewport",
153
- "reporting-chart": "stripe-connect-reporting-chart"
95
+ "tax-settings": "stripe-connect-tax-settings"
154
96
  };
155
97
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
156
98
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
157
99
  const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
158
100
  const findScript = () => {
159
- return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || null;
101
+ return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
160
102
  };
161
103
  const injectScript = () => {
162
104
  const script = document.createElement("script");
@@ -246,6 +188,9 @@ const initStripeConnect = (stripePromise, initParams) => {
246
188
  for (const method in methods) {
247
189
  element[method] = function (value) {
248
190
  stripeConnectInstance.then(() => {
191
+ if (!this[`${method}InternalOnly`]) {
192
+ 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.35`);
193
+ }
249
194
  this[`${method}InternalOnly`](value);
250
195
  });
251
196
  };
@@ -298,7 +243,7 @@ const createWrapper = stripeConnect => {
298
243
  sdk: true,
299
244
  sdkOptions: {
300
245
  // This will be replaced by the npm package version when bundling
301
- sdkVersion: "3.3.35-preview-1"
246
+ sdkVersion: "3.3.35"
302
247
  }
303
248
  })
304
249
  }));
@@ -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-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-instant-payouts-promotion" | "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
+ type ConnectElementHTMLName = "stripe-connect-account-onboarding" | "stripe-connect-disputes-list" | "stripe-connect-payments" | "stripe-connect-payment-details" | "stripe-connect-payment-disputes" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-instant-payouts-promotion" | "stripe-connect-issuing-card" | "stripe-connect-issuing-cards-list" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-payouts" | "stripe-connect-payouts-list" | "stripe-connect-payout-details" | "stripe-connect-balances" | "stripe-connect-documents" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings";
4
4
  export declare const componentNameMapping: Record<ConnectElementTagName, ConnectElementHTMLName>;
5
5
  type StripeConnectInstanceExtended = StripeConnectInstance & {
6
6
  debugInstance: () => Promise<StripeConnectInstance>;
@@ -9,6 +9,11 @@ export type FetchEphemeralKeyFunction = (fetchParams: {
9
9
  export type CollectionOptions = {
10
10
  fields: "currently_due" | "eventually_due";
11
11
  futureRequirements?: "omit" | "include";
12
+ requirements?: {
13
+ only: string[];
14
+ } | {
15
+ exclude: string[];
16
+ };
12
17
  };
13
18
  export type Status = "blocked" | "canceled" | "disputed" | "early_fraud_warning" | "failed" | "incomplete" | "partially_refunded" | "pending" | "refund_pending" | "refunded" | "successful" | "uncaptured";
14
19
  export type PaymentMethod = "ach_credit_transfer" | "ach_debit" | "acss_debit" | "affirm" | "afterpay_clearpay" | "alipay" | "alma" | "amazon_pay" | "amex_express_checkout" | "android_pay" | "apple_pay" | "au_becs_debit" | "nz_bank_account" | "bancontact" | "bacs_debit" | "bitcoin_source" | "bitcoin" | "blik" | "boleto" | "boleto_pilot" | "card_present" | "card" | "cashapp" | "crypto" | "customer_balance" | "demo_pay" | "dummy_passthrough_card" | "gbp_credit_transfer" | "google_pay" | "eps" | "fpx" | "giropay" | "grabpay" | "ideal" | "id_bank_transfer" | "id_credit_transfer" | "jp_credit_transfer" | "interac_present" | "kakao_pay" | "klarna" | "konbini" | "kr_card" | "kr_market" | "link" | "masterpass" | "mb_way" | "meta_pay" | "multibanco" | "mobilepay" | "naver_pay" | "netbanking" | "ng_bank" | "ng_bank_transfer" | "ng_card" | "ng_market" | "ng_ussd" | "vipps" | "oxxo" | "p24" | "payto" | "pay_by_bank" | "paper_check" | "payco" | "paynow" | "paypal" | "pix" | "promptpay" | "revolut_pay" | "samsung_pay" | "sepa_credit_transfer" | "sepa_debit" | "sofort" | "south_korea_market" | "swish" | "three_d_secure" | "three_d_secure_2" | "three_d_secure_2_eap" | "twint" | "upi" | "us_bank_account" | "visa_checkout" | "wechat" | "wechat_pay" | "zip";
@@ -42,10 +47,6 @@ export type NotificationCount = {
42
47
  total: number;
43
48
  actionRequired: number;
44
49
  };
45
- export type InstallState = {
46
- appId: string;
47
- state: "INSTALLED" | "UNINSTALLED";
48
- };
49
50
  export type LoaderStart = {
50
51
  elementTagName: string;
51
52
  };
@@ -60,14 +61,6 @@ export type EmbeddedError = {
60
61
  type: EmbeddedErrorType;
61
62
  message?: string;
62
63
  };
63
- export type FinancingProductType = {
64
- productType: "standard" | "refill" | "none";
65
- activeFinancingCount: number;
66
- };
67
- export type FinancingPromotionLayoutType = "full" | "banner";
68
- export type IntervalType = "day" | "week" | "month" | "quarter" | "year";
69
- export type ReportName = "gross_volume" | "net_volume";
70
- export type RecipientDataSource = "customers";
71
64
  export type EmbeddedErrorType =
72
65
  /**
73
66
  * Failure to connect to Stripe's API.
@@ -89,6 +82,10 @@ export type EmbeddedErrorType =
89
82
  * Too many requests hit the API too quickly.
90
83
  */
91
84
  | "rate_limit_error"
85
+ /**
86
+ * Failure to render the component, typically caused by browser extensions or network issues
87
+ */
88
+ | "render_error"
92
89
  /**
93
90
  * API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
94
91
  */
@@ -98,19 +95,6 @@ export declare const ConnectElementCommonMethodConfig: {
98
95
  setOnLoaderStart: (_listener: (({ elementTagName }: LoaderStart) => void) | undefined) => void;
99
96
  };
100
97
  export declare const ConnectElementCustomMethodConfig: {
101
- payments: {
102
- setDefaultFilters: (_filters: PaymentsListDefaultFilters | undefined) => void;
103
- };
104
- "payment-details": {
105
- setPayment: (_payment: string | undefined) => void;
106
- setOnClose: (_listener: (() => void) | undefined) => void;
107
- };
108
- "payment-disputes": {
109
- setPayment: (_payment: string | undefined) => void;
110
- setOnDisputesLoaded: (_listener: (({ total }: {
111
- total: number;
112
- }) => void) | undefined) => void;
113
- };
114
98
  "account-onboarding": {
115
99
  setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
116
100
  setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
@@ -152,49 +136,19 @@ export declare const ConnectElementCustomMethodConfig: {
152
136
  "financial-account-transactions": {
153
137
  setFinancialAccount: (_financialAccount: string) => void;
154
138
  };
155
- recipients: {
156
- setDataSource: (_dataSource: RecipientDataSource) => void;
157
- };
158
- "app-install": {
159
- setApp: (_app: string | undefined) => void;
160
- setOnAppInstallStateFetched: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
161
- setOnAppInstallStateChanged: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
162
- };
163
- "app-viewport": {
164
- setApp: (_app: string | undefined) => void;
165
- setAppData: (_appData: Record<string, string> | undefined) => void;
139
+ payments: {
140
+ setDefaultFilters: (_filters: PaymentsListDefaultFilters | undefined) => void;
166
141
  };
167
- "payment-method-settings": {
168
- setPaymentMethodConfiguration: (_paymentMethodConfiguration: string | undefined) => void;
142
+ "payment-details": {
143
+ setPayment: (_payment: string | undefined) => void;
144
+ setOnClose: (_listener: (() => void) | undefined) => void;
169
145
  };
170
- "capital-financing": {
171
- setDefaultFinancingOffer: (_defaultFinancingOffer: string | undefined) => void;
172
- setShowFinancingSelector: (_showFinancingSelector: boolean | undefined) => void;
173
- setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
174
- setSupportUrl: (_supportUrl: string | undefined) => void;
175
- setOnFinancingsLoaded: (_listener: (({ total }: {
146
+ "payment-disputes": {
147
+ setPayment: (_payment: string | undefined) => void;
148
+ setOnDisputesLoaded: (_listener: (({ total }: {
176
149
  total: number;
177
150
  }) => void) | undefined) => void;
178
151
  };
179
- "capital-financing-application": {
180
- setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
181
- setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
182
- setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
183
- };
184
- "capital-financing-promotion": {
185
- setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
186
- setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
187
- setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount, }: FinancingProductType) => void) | undefined) => void;
188
- setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
189
- setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
190
- setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
191
- };
192
- "reporting-chart": {
193
- setReportName: (_reportName: ReportName) => void;
194
- setIntervalStart: (_intervalStart: Date | undefined) => void;
195
- setIntervalEnd: (_intervalEnd: Date | undefined) => void;
196
- setIntervalType: (_intervalType: IntervalType | undefined) => void;
197
- };
198
152
  "tax-settings": {
199
153
  setHideProductTaxCodeSelector: (_hidden: boolean | undefined) => void;
200
154
  setDisplayHeadOfficeCountries: (_countries: string[] | undefined) => void;
@@ -207,15 +161,12 @@ export declare const ConnectElementCustomMethodConfig: {
207
161
  id: string;
208
162
  }) => void) | undefined) => void;
209
163
  setDisplayCountries: (_countries: string[] | undefined) => void;
164
+ setOnAfterTaxRegistrationExpired: (_listener: (({ id }: {
165
+ id: string;
166
+ }) => void) | undefined) => void;
210
167
  };
211
- "tax-threshold-monitoring": {
212
- setDisplayCountries: (_countries: string[] | undefined) => void;
213
- };
214
- "product-tax-code-selector": {
215
- setOnTaxCodeSelect: (_listener: ((taxCode: string) => void) | undefined) => void;
216
- setHideDescription: (_hideDescription: boolean | undefined) => void;
217
- setDisabled: (_disabled: boolean | undefined) => void;
218
- setInitialTaxCode: (_initialTaxCode: string | undefined) => void;
168
+ "payout-details": {
169
+ setPayout: (_payout: string | undefined) => void;
170
+ setOnClose: (_listener: (() => void) | undefined) => void;
219
171
  };
220
- "export-tax-transactions": {};
221
172
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.35-preview-1",
3
+ "version": "3.3.35",
4
4
  "description": "Connect.js loading utility package",
5
5
  "main": "dist/connect.js",
6
6
  "module": "dist/connect.esm.js",
@@ -63,13 +63,13 @@
63
63
  "jest-environment-jsdom": "^29.5.0",
64
64
  "prettier": "2.8.8",
65
65
  "rimraf": "^2.6.2",
66
- "rollup": "^1.29.0",
66
+ "rollup": "^2.79.2",
67
67
  "rollup-plugin-babel": "^4.4.0",
68
68
  "rollup-plugin-typescript2": "^0.25.3",
69
69
  "ts-jest": "^29.1.0",
70
70
  "typescript": "^4.1.2",
71
71
  "yalc": "^1.0.0-pre.53",
72
- "zx": "^4.2.0"
72
+ "zx": "^8.8.5"
73
73
  },
74
74
  "dependencies": {}
75
75
  }
package/src/shared.ts CHANGED
@@ -13,76 +13,51 @@ export type LoadConnectAndInitialize = (
13
13
  initParams: IStripeConnectInitParams
14
14
  ) => StripeConnectInstance;
15
15
 
16
- export type ConnectElementHTMLName =
16
+ type ConnectElementHTMLName =
17
+ | "stripe-connect-account-onboarding"
18
+ | "stripe-connect-disputes-list"
17
19
  | "stripe-connect-payments"
18
- | "stripe-connect-payouts"
19
20
  | "stripe-connect-payment-details"
20
21
  | "stripe-connect-payment-disputes"
21
- | "stripe-connect-disputes-list"
22
- | "stripe-connect-account-onboarding"
23
- | "stripe-connect-payment-method-settings"
24
22
  | "stripe-connect-account-management"
25
23
  | "stripe-connect-notification-banner"
26
- | "stripe-connect-instant-payouts"
27
24
  | "stripe-connect-instant-payouts-promotion"
28
25
  | "stripe-connect-issuing-card"
29
26
  | "stripe-connect-issuing-cards-list"
30
27
  | "stripe-connect-financial-account"
31
28
  | "stripe-connect-financial-account-transactions"
32
- | "stripe-connect-recipients"
33
- | "stripe-connect-capital-financing"
34
- | "stripe-connect-capital-financing-application"
35
- | "stripe-connect-capital-financing-promotion"
36
- | "stripe-connect-capital-overview"
29
+ | "stripe-connect-payouts"
30
+ | "stripe-connect-payouts-list"
31
+ | "stripe-connect-payout-details"
32
+ | "stripe-connect-balances"
37
33
  | "stripe-connect-documents"
38
- | "stripe-connect-product-tax-code-selector"
39
- | "stripe-connect-export-tax-transactions"
40
34
  | "stripe-connect-tax-registrations"
41
- | "stripe-connect-tax-settings"
42
- | "stripe-connect-tax-threshold-monitoring"
43
- | "stripe-connect-balances"
44
- | "stripe-connect-payouts-list"
45
- | "stripe-connect-app-install"
46
- | "stripe-connect-app-viewport"
47
- | "stripe-connect-reporting-chart";
35
+ | "stripe-connect-tax-settings";
48
36
 
49
37
  export const componentNameMapping: Record<
50
38
  ConnectElementTagName,
51
39
  ConnectElementHTMLName
52
40
  > = {
41
+ "account-onboarding": "stripe-connect-account-onboarding",
42
+ "disputes-list": "stripe-connect-disputes-list",
53
43
  payments: "stripe-connect-payments",
54
- payouts: "stripe-connect-payouts",
55
44
  "payment-details": "stripe-connect-payment-details",
56
45
  "payment-disputes": "stripe-connect-payment-disputes",
57
- "disputes-list": "stripe-connect-disputes-list",
58
- "account-onboarding": "stripe-connect-account-onboarding",
59
- "payment-method-settings": "stripe-connect-payment-method-settings",
46
+ payouts: "stripe-connect-payouts",
47
+ "payouts-list": "stripe-connect-payouts-list",
48
+ "payout-details": "stripe-connect-payout-details",
49
+ balances: "stripe-connect-balances",
60
50
  "account-management": "stripe-connect-account-management",
61
51
  "notification-banner": "stripe-connect-notification-banner",
62
- "instant-payouts": "stripe-connect-instant-payouts",
63
52
  "instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
64
53
  "issuing-card": "stripe-connect-issuing-card",
65
54
  "issuing-cards-list": "stripe-connect-issuing-cards-list",
66
55
  "financial-account": "stripe-connect-financial-account",
67
- recipients: "stripe-connect-recipients",
68
56
  "financial-account-transactions":
69
57
  "stripe-connect-financial-account-transactions",
70
- "capital-financing": "stripe-connect-capital-financing",
71
- "capital-financing-application":
72
- "stripe-connect-capital-financing-application",
73
- "capital-financing-promotion": "stripe-connect-capital-financing-promotion",
74
- "capital-overview": "stripe-connect-capital-overview",
75
58
  documents: "stripe-connect-documents",
76
- "product-tax-code-selector": "stripe-connect-product-tax-code-selector",
77
- "export-tax-transactions": "stripe-connect-export-tax-transactions",
78
59
  "tax-registrations": "stripe-connect-tax-registrations",
79
60
  "tax-settings": "stripe-connect-tax-settings",
80
- "tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
81
- balances: "stripe-connect-balances",
82
- "payouts-list": "stripe-connect-payouts-list",
83
- "app-install": "stripe-connect-app-install",
84
- "app-viewport": "stripe-connect-app-viewport",
85
- "reporting-chart": "stripe-connect-reporting-chart",
86
61
  };
87
62
 
88
63
  type StripeConnectInstanceExtended = StripeConnectInstance & {
@@ -101,10 +76,10 @@ const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
101
76
  export const findScript = (): HTMLScriptElement | null => {
102
77
  return (
103
78
  document.querySelectorAll<HTMLScriptElement>(
104
- `script[src="${V0_URL}"]`
79
+ `script[src="${V1_URL}"]`
105
80
  )[0] ||
106
81
  document.querySelectorAll<HTMLScriptElement>(
107
- `script[src="${V1_URL}"]`
82
+ `script[src="${V0_URL}"]`
108
83
  )[0] ||
109
84
  null
110
85
  );
@@ -233,6 +208,12 @@ export const initStripeConnect = (
233
208
  for (const method in methods) {
234
209
  (element as any)[method] = function (value: any) {
235
210
  stripeConnectInstance.then(() => {
211
+ if (!this[`${method}InternalOnly`]) {
212
+ throw new Error(
213
+ `Method ${method} is not available in the ${tagName} HTML element. Are you using a supported version of the "@stripe/connect-js" package? Using version: _NPM_PACKAGE_VERSION_`
214
+ );
215
+ }
216
+
236
217
  this[`${method}InternalOnly`](value);
237
218
  });
238
219
  };
package/types/config.ts CHANGED
@@ -13,6 +13,13 @@ export type FetchEphemeralKeyFunction = (fetchParams: {
13
13
  export type CollectionOptions = {
14
14
  fields: "currently_due" | "eventually_due";
15
15
  futureRequirements?: "omit" | "include";
16
+ requirements?:
17
+ | {
18
+ only: string[];
19
+ }
20
+ | {
21
+ exclude: string[];
22
+ };
16
23
  };
17
24
 
18
25
  export type Status =
@@ -134,11 +141,6 @@ export type NotificationCount = {
134
141
  actionRequired: number;
135
142
  };
136
143
 
137
- export type InstallState = {
138
- appId: string;
139
- state: "INSTALLED" | "UNINSTALLED";
140
- };
141
-
142
144
  export type LoaderStart = {
143
145
  elementTagName: string;
144
146
  };
@@ -157,19 +159,6 @@ export type EmbeddedError = {
157
159
  message?: string;
158
160
  };
159
161
 
160
- export type FinancingProductType = {
161
- productType: "standard" | "refill" | "none";
162
- activeFinancingCount: number;
163
- };
164
-
165
- export type FinancingPromotionLayoutType = "full" | "banner";
166
-
167
- export type IntervalType = "day" | "week" | "month" | "quarter" | "year";
168
-
169
- export type ReportName = "gross_volume" | "net_volume";
170
-
171
- export type RecipientDataSource = "customers";
172
-
173
162
  export type EmbeddedErrorType =
174
163
  /**
175
164
  * Failure to connect to Stripe's API.
@@ -191,6 +180,10 @@ export type EmbeddedErrorType =
191
180
  * Too many requests hit the API too quickly.
192
181
  */
193
182
  | "rate_limit_error"
183
+ /**
184
+ * Failure to render the component, typically caused by browser extensions or network issues
185
+ */
186
+ | "render_error"
194
187
  /**
195
188
  * API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
196
189
  */
@@ -206,21 +199,6 @@ export const ConnectElementCommonMethodConfig = {
206
199
  };
207
200
 
208
201
  export const ConnectElementCustomMethodConfig = {
209
- payments: {
210
- setDefaultFilters: (
211
- _filters: PaymentsListDefaultFilters | undefined
212
- ): void => {},
213
- },
214
- "payment-details": {
215
- setPayment: (_payment: string | undefined): void => {},
216
- setOnClose: (_listener: (() => void) | undefined): void => {},
217
- },
218
- "payment-disputes": {
219
- setPayment: (_payment: string | undefined): void => {},
220
- setOnDisputesLoaded: (
221
- _listener: (({ total }: { total: number }) => void) | undefined
222
- ): void => {},
223
- },
224
202
  "account-onboarding": {
225
203
  setFullTermsOfServiceUrl: (
226
204
  _termOfServiceUrl: string | undefined
@@ -286,78 +264,21 @@ export const ConnectElementCustomMethodConfig = {
286
264
  "financial-account-transactions": {
287
265
  setFinancialAccount: (_financialAccount: string): void => {},
288
266
  },
289
- recipients: {
290
- setDataSource: (_dataSource: RecipientDataSource): void => {},
291
- },
292
- "app-install": {
293
- setApp: (_app: string | undefined): void => {},
294
- setOnAppInstallStateFetched: (
295
- _listener: (({ appId, state }: InstallState) => void) | undefined
296
- ): void => {},
297
- setOnAppInstallStateChanged: (
298
- _listener: (({ appId, state }: InstallState) => void) | undefined
267
+ payments: {
268
+ setDefaultFilters: (
269
+ _filters: PaymentsListDefaultFilters | undefined
299
270
  ): void => {},
300
271
  },
301
- "app-viewport": {
302
- setApp: (_app: string | undefined): void => {},
303
- setAppData: (_appData: Record<string, string> | undefined): void => {},
304
- },
305
- "payment-method-settings": {
306
- setPaymentMethodConfiguration: (
307
- _paymentMethodConfiguration: string | undefined
308
- ): void => {},
272
+ "payment-details": {
273
+ setPayment: (_payment: string | undefined): void => {},
274
+ setOnClose: (_listener: (() => void) | undefined): void => {},
309
275
  },
310
- "capital-financing": {
311
- setDefaultFinancingOffer: (
312
- _defaultFinancingOffer: string | undefined
313
- ): void => {},
314
- setShowFinancingSelector: (
315
- _showFinancingSelector: boolean | undefined
316
- ): void => {},
317
- setHowCapitalWorksUrl: (
318
- _howCapitalWorksUrl: string | undefined
319
- ): void => {},
320
- setSupportUrl: (_supportUrl: string | undefined): void => {},
321
- setOnFinancingsLoaded: (
276
+ "payment-disputes": {
277
+ setPayment: (_payment: string | undefined): void => {},
278
+ setOnDisputesLoaded: (
322
279
  _listener: (({ total }: { total: number }) => void) | undefined
323
280
  ): void => {},
324
281
  },
325
- "capital-financing-application": {
326
- setOnApplicationSubmitted: (
327
- _listener: (() => void) | undefined
328
- ): void => {},
329
- setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
330
- setHowCapitalWorksUrl: (
331
- _howCapitalWorksUrl: string | undefined
332
- ): void => {},
333
- },
334
- "capital-financing-promotion": {
335
- setLayout: (_layout: FinancingPromotionLayoutType | undefined): void => {},
336
- setOnApplicationSubmitted: (
337
- _listener: (() => void) | undefined
338
- ): void => {},
339
- setOnEligibleFinancingOfferLoaded: (
340
- _listener:
341
- | (({
342
- productType,
343
- activeFinancingCount,
344
- }: FinancingProductType) => void)
345
- | undefined
346
- ): void => {},
347
- setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined): void => {},
348
- setHowCapitalWorksUrl: (
349
- _howCapitalWorksUrl: string | undefined
350
- ): void => {},
351
- setEligibilityCriteriaUrl: (
352
- _eligibilityCriteriaUrl: string | undefined
353
- ): void => {},
354
- },
355
- "reporting-chart": {
356
- setReportName: (_reportName: ReportName): void => {},
357
- setIntervalStart: (_intervalStart: Date | undefined): void => {},
358
- setIntervalEnd: (_intervalEnd: Date | undefined): void => {},
359
- setIntervalType: (_intervalType: IntervalType | undefined): void => {},
360
- },
361
282
  "tax-settings": {
362
283
  setHideProductTaxCodeSelector: (_hidden: boolean | undefined): void => {},
363
284
  setDisplayHeadOfficeCountries: (
@@ -372,17 +293,12 @@ export const ConnectElementCustomMethodConfig = {
372
293
  _listener: (({ id }: { id: string }) => void) | undefined
373
294
  ): void => {},
374
295
  setDisplayCountries: (_countries: string[] | undefined): void => {},
375
- },
376
- "tax-threshold-monitoring": {
377
- setDisplayCountries: (_countries: string[] | undefined): void => {},
378
- },
379
- "product-tax-code-selector": {
380
- setOnTaxCodeSelect: (
381
- _listener: ((taxCode: string) => void) | undefined
296
+ setOnAfterTaxRegistrationExpired: (
297
+ _listener: (({ id }: { id: string }) => void) | undefined
382
298
  ): void => {},
383
- setHideDescription: (_hideDescription: boolean | undefined): void => {},
384
- setDisabled: (_disabled: boolean | undefined): void => {},
385
- setInitialTaxCode: (_initialTaxCode: string | undefined): void => {},
386
299
  },
387
- "export-tax-transactions": {},
300
+ "payout-details": {
301
+ setPayout: (_payout: string | undefined): void => {},
302
+ setOnClose: (_listener: (() => void) | undefined): void => {},
303
+ },
388
304
  };