@stripe/connect-js 3.3.33-preview-1 → 3.3.33
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/connect.esm.js +39 -89
- package/dist/connect.js +39 -89
- package/dist/pure.esm.js +31 -81
- package/dist/pure.js +31 -81
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +31 -72
- package/package.json +3 -3
- package/src/shared.ts +26 -42
- package/types/config.ts +36 -110
- package/types/shared.d.ts +9 -19
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 => {},
|
|
@@ -36,6 +25,10 @@ const ConnectElementCustomMethodConfig = {
|
|
|
36
25
|
setCollectionOptions: _collectionOptions => {},
|
|
37
26
|
setOnNotificationsChange: _listener => {}
|
|
38
27
|
},
|
|
28
|
+
"instant-payouts-promotion": {
|
|
29
|
+
setOnInstantPayoutsPromotionLoaded: _listener => {},
|
|
30
|
+
setOnInstantPayoutCreated: _listener => {}
|
|
31
|
+
},
|
|
39
32
|
"issuing-card": {
|
|
40
33
|
setDefaultCard: _defaultCard => {},
|
|
41
34
|
setCardSwitching: _cardSwitching => {},
|
|
@@ -53,46 +46,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
53
46
|
"financial-account-transactions": {
|
|
54
47
|
setFinancialAccount: _financialAccount => {}
|
|
55
48
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
"app-install": {
|
|
60
|
-
setApp: _app => {},
|
|
61
|
-
setOnAppInstallStateFetched: _listener => {},
|
|
62
|
-
setOnAppInstallStateChanged: _listener => {}
|
|
63
|
-
},
|
|
64
|
-
"app-viewport": {
|
|
65
|
-
setApp: _app => {},
|
|
66
|
-
setAppData: _appData => {}
|
|
67
|
-
},
|
|
68
|
-
"payment-method-settings": {
|
|
69
|
-
setPaymentMethodConfiguration: _paymentMethodConfiguration => {}
|
|
70
|
-
},
|
|
71
|
-
"capital-financing": {
|
|
72
|
-
setDefaultFinancingOffer: _defaultFinancingOffer => {},
|
|
73
|
-
setShowFinancingSelector: _showFinancingSelector => {},
|
|
74
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
75
|
-
setSupportUrl: _supportUrl => {},
|
|
76
|
-
setOnFinancingsLoaded: _listener => {}
|
|
77
|
-
},
|
|
78
|
-
"capital-financing-application": {
|
|
79
|
-
setOnApplicationSubmitted: _listener => {},
|
|
80
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
81
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {}
|
|
49
|
+
payments: {
|
|
50
|
+
setDefaultFilters: _filters => {}
|
|
82
51
|
},
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
87
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
88
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
89
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {}
|
|
52
|
+
"payment-details": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnClose: _listener => {}
|
|
90
55
|
},
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setIntervalEnd: _intervalEnd => {},
|
|
95
|
-
setIntervalType: _intervalType => {}
|
|
56
|
+
"payment-disputes": {
|
|
57
|
+
setPayment: _payment => {},
|
|
58
|
+
setOnDisputesLoaded: _listener => {}
|
|
96
59
|
},
|
|
97
60
|
"tax-settings": {
|
|
98
61
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -101,57 +64,41 @@ const ConnectElementCustomMethodConfig = {
|
|
|
101
64
|
},
|
|
102
65
|
"tax-registrations": {
|
|
103
66
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
104
|
-
setDisplayCountries: _countries => {}
|
|
105
|
-
|
|
106
|
-
"tax-threshold-monitoring": {
|
|
107
|
-
setDisplayCountries: _countries => {}
|
|
108
|
-
},
|
|
109
|
-
"product-tax-code-selector": {
|
|
110
|
-
setOnTaxCodeSelect: _listener => {},
|
|
111
|
-
setHideDescription: _hideDescription => {},
|
|
112
|
-
setDisabled: _disabled => {},
|
|
113
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
67
|
+
setDisplayCountries: _countries => {},
|
|
68
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
114
69
|
},
|
|
115
|
-
"
|
|
70
|
+
"payout-details": {
|
|
71
|
+
setPayout: _payout => {},
|
|
72
|
+
setOnClose: _listener => {}
|
|
73
|
+
}
|
|
116
74
|
};
|
|
117
75
|
|
|
118
76
|
const componentNameMapping = {
|
|
77
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
78
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
119
79
|
payments: "stripe-connect-payments",
|
|
120
|
-
payouts: "stripe-connect-payouts",
|
|
121
80
|
"payment-details": "stripe-connect-payment-details",
|
|
122
81
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
123
|
-
|
|
124
|
-
"
|
|
125
|
-
"
|
|
82
|
+
payouts: "stripe-connect-payouts",
|
|
83
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
84
|
+
"payout-details": "stripe-connect-payout-details",
|
|
85
|
+
balances: "stripe-connect-balances",
|
|
126
86
|
"account-management": "stripe-connect-account-management",
|
|
127
87
|
"notification-banner": "stripe-connect-notification-banner",
|
|
128
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
88
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
129
89
|
"issuing-card": "stripe-connect-issuing-card",
|
|
130
90
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
131
91
|
"financial-account": "stripe-connect-financial-account",
|
|
132
|
-
recipients: "stripe-connect-recipients",
|
|
133
92
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
134
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
135
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
136
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
137
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
138
93
|
documents: "stripe-connect-documents",
|
|
139
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
140
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
141
94
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
142
|
-
"tax-settings": "stripe-connect-tax-settings"
|
|
143
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
144
|
-
balances: "stripe-connect-balances",
|
|
145
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
146
|
-
"app-install": "stripe-connect-app-install",
|
|
147
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
148
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
95
|
+
"tax-settings": "stripe-connect-tax-settings"
|
|
149
96
|
};
|
|
150
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";
|
|
151
98
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
152
99
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
153
100
|
const findScript = () => {
|
|
154
|
-
return document.querySelectorAll(`script[src="${
|
|
101
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
155
102
|
};
|
|
156
103
|
const injectScript = () => {
|
|
157
104
|
const script = document.createElement("script");
|
|
@@ -241,6 +188,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
241
188
|
for (const method in methods) {
|
|
242
189
|
element[method] = function (value) {
|
|
243
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.33`);
|
|
193
|
+
}
|
|
244
194
|
this[`${method}InternalOnly`](value);
|
|
245
195
|
});
|
|
246
196
|
};
|
|
@@ -293,7 +243,7 @@ const createWrapper = stripeConnect => {
|
|
|
293
243
|
sdk: true,
|
|
294
244
|
sdkOptions: {
|
|
295
245
|
// This will be replaced by the npm package version when bundling
|
|
296
|
-
sdkVersion: "3.3.33
|
|
246
|
+
sdkVersion: "3.3.33"
|
|
297
247
|
}
|
|
298
248
|
})
|
|
299
249
|
}));
|
package/dist/src/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
2
2
|
export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
|
-
|
|
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>;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -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;
|
|
@@ -127,6 +111,14 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
127
111
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
128
112
|
setOnNotificationsChange: (_listener: (({ total, actionRequired }: NotificationCount) => void) | undefined) => void;
|
|
129
113
|
};
|
|
114
|
+
"instant-payouts-promotion": {
|
|
115
|
+
setOnInstantPayoutsPromotionLoaded: (_listener: (({ promotionShown }: {
|
|
116
|
+
promotionShown: boolean;
|
|
117
|
+
}) => void) | undefined) => void;
|
|
118
|
+
setOnInstantPayoutCreated: (_listener: (({ payoutId }: {
|
|
119
|
+
payoutId: string;
|
|
120
|
+
}) => void) | undefined) => void;
|
|
121
|
+
};
|
|
130
122
|
"issuing-card": {
|
|
131
123
|
setDefaultCard: (_defaultCard: string | undefined) => void;
|
|
132
124
|
setCardSwitching: (_cardSwitching: boolean | undefined) => void;
|
|
@@ -144,49 +136,19 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
144
136
|
"financial-account-transactions": {
|
|
145
137
|
setFinancialAccount: (_financialAccount: string) => void;
|
|
146
138
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
"app-install": {
|
|
151
|
-
setApp: (_app: string | undefined) => void;
|
|
152
|
-
setOnAppInstallStateFetched: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
153
|
-
setOnAppInstallStateChanged: (_listener: (({ appId, state }: InstallState) => void) | undefined) => void;
|
|
154
|
-
};
|
|
155
|
-
"app-viewport": {
|
|
156
|
-
setApp: (_app: string | undefined) => void;
|
|
157
|
-
setAppData: (_appData: Record<string, string> | undefined) => void;
|
|
139
|
+
payments: {
|
|
140
|
+
setDefaultFilters: (_filters: PaymentsListDefaultFilters | undefined) => void;
|
|
158
141
|
};
|
|
159
|
-
"payment-
|
|
160
|
-
|
|
142
|
+
"payment-details": {
|
|
143
|
+
setPayment: (_payment: string | undefined) => void;
|
|
144
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
161
145
|
};
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
166
|
-
setSupportUrl: (_supportUrl: string | undefined) => void;
|
|
167
|
-
setOnFinancingsLoaded: (_listener: (({ total }: {
|
|
146
|
+
"payment-disputes": {
|
|
147
|
+
setPayment: (_payment: string | undefined) => void;
|
|
148
|
+
setOnDisputesLoaded: (_listener: (({ total }: {
|
|
168
149
|
total: number;
|
|
169
150
|
}) => void) | undefined) => void;
|
|
170
151
|
};
|
|
171
|
-
"capital-financing-application": {
|
|
172
|
-
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
173
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
174
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
175
|
-
};
|
|
176
|
-
"capital-financing-promotion": {
|
|
177
|
-
setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
|
|
178
|
-
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
179
|
-
setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount, }: FinancingProductType) => void) | undefined) => void;
|
|
180
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
181
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
182
|
-
setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
|
|
183
|
-
};
|
|
184
|
-
"reporting-chart": {
|
|
185
|
-
setReportName: (_reportName: ReportName) => void;
|
|
186
|
-
setIntervalStart: (_intervalStart: Date | undefined) => void;
|
|
187
|
-
setIntervalEnd: (_intervalEnd: Date | undefined) => void;
|
|
188
|
-
setIntervalType: (_intervalType: IntervalType | undefined) => void;
|
|
189
|
-
};
|
|
190
152
|
"tax-settings": {
|
|
191
153
|
setHideProductTaxCodeSelector: (_hidden: boolean | undefined) => void;
|
|
192
154
|
setDisplayHeadOfficeCountries: (_countries: string[] | undefined) => void;
|
|
@@ -199,15 +161,12 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
199
161
|
id: string;
|
|
200
162
|
}) => void) | undefined) => void;
|
|
201
163
|
setDisplayCountries: (_countries: string[] | undefined) => void;
|
|
164
|
+
setOnAfterTaxRegistrationExpired: (_listener: (({ id }: {
|
|
165
|
+
id: string;
|
|
166
|
+
}) => void) | undefined) => void;
|
|
202
167
|
};
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"product-tax-code-selector": {
|
|
207
|
-
setOnTaxCodeSelect: (_listener: ((taxCode: string) => void) | undefined) => void;
|
|
208
|
-
setHideDescription: (_hideDescription: boolean | undefined) => void;
|
|
209
|
-
setDisabled: (_disabled: boolean | undefined) => void;
|
|
210
|
-
setInitialTaxCode: (_initialTaxCode: string | undefined) => void;
|
|
168
|
+
"payout-details": {
|
|
169
|
+
setPayout: (_payout: string | undefined) => void;
|
|
170
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
211
171
|
};
|
|
212
|
-
"export-tax-transactions": {};
|
|
213
172
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.3.33
|
|
3
|
+
"version": "3.3.33",
|
|
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": "^
|
|
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": "^
|
|
72
|
+
"zx": "^8.8.5"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {}
|
|
75
75
|
}
|
package/src/shared.ts
CHANGED
|
@@ -13,74 +13,51 @@ export type LoadConnectAndInitialize = (
|
|
|
13
13
|
initParams: IStripeConnectInitParams
|
|
14
14
|
) => StripeConnectInstance;
|
|
15
15
|
|
|
16
|
-
|
|
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"
|
|
24
|
+
| "stripe-connect-instant-payouts-promotion"
|
|
27
25
|
| "stripe-connect-issuing-card"
|
|
28
26
|
| "stripe-connect-issuing-cards-list"
|
|
29
27
|
| "stripe-connect-financial-account"
|
|
30
28
|
| "stripe-connect-financial-account-transactions"
|
|
31
|
-
| "stripe-connect-
|
|
32
|
-
| "stripe-connect-
|
|
33
|
-
| "stripe-connect-
|
|
34
|
-
| "stripe-connect-
|
|
35
|
-
| "stripe-connect-capital-overview"
|
|
29
|
+
| "stripe-connect-payouts"
|
|
30
|
+
| "stripe-connect-payouts-list"
|
|
31
|
+
| "stripe-connect-payout-details"
|
|
32
|
+
| "stripe-connect-balances"
|
|
36
33
|
| "stripe-connect-documents"
|
|
37
|
-
| "stripe-connect-product-tax-code-selector"
|
|
38
|
-
| "stripe-connect-export-tax-transactions"
|
|
39
34
|
| "stripe-connect-tax-registrations"
|
|
40
|
-
| "stripe-connect-tax-settings"
|
|
41
|
-
| "stripe-connect-tax-threshold-monitoring"
|
|
42
|
-
| "stripe-connect-balances"
|
|
43
|
-
| "stripe-connect-payouts-list"
|
|
44
|
-
| "stripe-connect-app-install"
|
|
45
|
-
| "stripe-connect-app-viewport"
|
|
46
|
-
| "stripe-connect-reporting-chart";
|
|
35
|
+
| "stripe-connect-tax-settings";
|
|
47
36
|
|
|
48
37
|
export const componentNameMapping: Record<
|
|
49
38
|
ConnectElementTagName,
|
|
50
39
|
ConnectElementHTMLName
|
|
51
40
|
> = {
|
|
41
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
42
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
52
43
|
payments: "stripe-connect-payments",
|
|
53
|
-
payouts: "stripe-connect-payouts",
|
|
54
44
|
"payment-details": "stripe-connect-payment-details",
|
|
55
45
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
46
|
+
payouts: "stripe-connect-payouts",
|
|
47
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
48
|
+
"payout-details": "stripe-connect-payout-details",
|
|
49
|
+
balances: "stripe-connect-balances",
|
|
59
50
|
"account-management": "stripe-connect-account-management",
|
|
60
51
|
"notification-banner": "stripe-connect-notification-banner",
|
|
61
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
52
|
+
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
62
53
|
"issuing-card": "stripe-connect-issuing-card",
|
|
63
54
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
64
55
|
"financial-account": "stripe-connect-financial-account",
|
|
65
|
-
recipients: "stripe-connect-recipients",
|
|
66
56
|
"financial-account-transactions":
|
|
67
57
|
"stripe-connect-financial-account-transactions",
|
|
68
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
69
|
-
"capital-financing-application":
|
|
70
|
-
"stripe-connect-capital-financing-application",
|
|
71
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
72
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
73
58
|
documents: "stripe-connect-documents",
|
|
74
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
75
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
76
59
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
77
60
|
"tax-settings": "stripe-connect-tax-settings",
|
|
78
|
-
"tax-threshold-monitoring": "stripe-connect-tax-threshold-monitoring",
|
|
79
|
-
balances: "stripe-connect-balances",
|
|
80
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
81
|
-
"app-install": "stripe-connect-app-install",
|
|
82
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
83
|
-
"reporting-chart": "stripe-connect-reporting-chart",
|
|
84
61
|
};
|
|
85
62
|
|
|
86
63
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -99,10 +76,10 @@ const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
|
99
76
|
export const findScript = (): HTMLScriptElement | null => {
|
|
100
77
|
return (
|
|
101
78
|
document.querySelectorAll<HTMLScriptElement>(
|
|
102
|
-
`script[src="${
|
|
79
|
+
`script[src="${V1_URL}"]`
|
|
103
80
|
)[0] ||
|
|
104
81
|
document.querySelectorAll<HTMLScriptElement>(
|
|
105
|
-
`script[src="${
|
|
82
|
+
`script[src="${V0_URL}"]`
|
|
106
83
|
)[0] ||
|
|
107
84
|
null
|
|
108
85
|
);
|
|
@@ -136,7 +113,8 @@ export const isWindowStripeConnectDefined = (stripeConnect: unknown) => {
|
|
|
136
113
|
stripeConnect &&
|
|
137
114
|
typeof stripeConnect === "object" &&
|
|
138
115
|
"init" in stripeConnect &&
|
|
139
|
-
typeof stripeConnect
|
|
116
|
+
typeof (stripeConnect as { init: unknown } & Record<string, unknown>)
|
|
117
|
+
.init === "function"
|
|
140
118
|
);
|
|
141
119
|
};
|
|
142
120
|
|
|
@@ -230,6 +208,12 @@ export const initStripeConnect = (
|
|
|
230
208
|
for (const method in methods) {
|
|
231
209
|
(element as any)[method] = function (value: any) {
|
|
232
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
|
+
|
|
233
217
|
this[`${method}InternalOnly`](value);
|
|
234
218
|
});
|
|
235
219
|
};
|