@stripe/connect-js 3.3.36-preview-1 → 3.3.36
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 +37 -89
- package/dist/connect.js +37 -89
- package/dist/pure.esm.js +29 -81
- package/dist/pure.js +29 -81
- package/dist/src/shared.d.ts +1 -1
- package/dist/types/config.d.ts +25 -73
- package/package.json +3 -3
- package/src/shared.ts +25 -40
- package/types/config.ts +28 -115
- package/types/shared.d.ts +97 -18
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,48 +46,16 @@ const ConnectElementCustomMethodConfig = {
|
|
|
57
46
|
"financial-account-transactions": {
|
|
58
47
|
setFinancialAccount: _financialAccount => {}
|
|
59
48
|
},
|
|
60
|
-
|
|
61
|
-
|
|
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 => {},
|
|
86
|
-
setOnApplicationStepChange: _listener => {}
|
|
49
|
+
payments: {
|
|
50
|
+
setDefaultFilters: _filters => {}
|
|
87
51
|
},
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
setOnEligibleFinancingOfferLoaded: _listener => {},
|
|
92
|
-
setPrivacyPolicyUrl: _privacyPolicyUrl => {},
|
|
93
|
-
setHowCapitalWorksUrl: _howCapitalWorksUrl => {},
|
|
94
|
-
setEligibilityCriteriaUrl: _eligibilityCriteriaUrl => {},
|
|
95
|
-
setOnApplicationStepChange: _listener => {}
|
|
52
|
+
"payment-details": {
|
|
53
|
+
setPayment: _payment => {},
|
|
54
|
+
setOnClose: _listener => {}
|
|
96
55
|
},
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
setIntervalEnd: _intervalEnd => {},
|
|
101
|
-
setIntervalType: _intervalType => {}
|
|
56
|
+
"payment-disputes": {
|
|
57
|
+
setPayment: _payment => {},
|
|
58
|
+
setOnDisputesLoaded: _listener => {}
|
|
102
59
|
},
|
|
103
60
|
"tax-settings": {
|
|
104
61
|
setHideProductTaxCodeSelector: _hidden => {},
|
|
@@ -107,58 +64,46 @@ const ConnectElementCustomMethodConfig = {
|
|
|
107
64
|
},
|
|
108
65
|
"tax-registrations": {
|
|
109
66
|
setOnAfterTaxRegistrationAdded: _listener => {},
|
|
110
|
-
setDisplayCountries: _countries => {}
|
|
111
|
-
|
|
112
|
-
"tax-threshold-monitoring": {
|
|
113
|
-
setDisplayCountries: _countries => {}
|
|
67
|
+
setDisplayCountries: _countries => {},
|
|
68
|
+
setOnAfterTaxRegistrationExpired: _listener => {}
|
|
114
69
|
},
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
setDisabled: _disabled => {},
|
|
119
|
-
setInitialTaxCode: _initialTaxCode => {}
|
|
70
|
+
"payout-details": {
|
|
71
|
+
setPayout: _payout => {},
|
|
72
|
+
setOnClose: _listener => {}
|
|
120
73
|
},
|
|
121
|
-
|
|
74
|
+
payoutReconciliationReport: {
|
|
75
|
+
setOnNotAvailable: _listener => {}
|
|
76
|
+
}
|
|
122
77
|
};
|
|
123
78
|
|
|
124
79
|
const componentNameMapping = {
|
|
80
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
81
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
125
82
|
payments: "stripe-connect-payments",
|
|
126
|
-
payouts: "stripe-connect-payouts",
|
|
127
83
|
"payment-details": "stripe-connect-payment-details",
|
|
128
84
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
85
|
+
payouts: "stripe-connect-payouts",
|
|
86
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
87
|
+
"payout-details": "stripe-connect-payout-details",
|
|
88
|
+
balances: "stripe-connect-balances",
|
|
132
89
|
"account-management": "stripe-connect-account-management",
|
|
133
90
|
"notification-banner": "stripe-connect-notification-banner",
|
|
134
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
135
91
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
136
92
|
"issuing-card": "stripe-connect-issuing-card",
|
|
137
93
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
138
94
|
"financial-account": "stripe-connect-financial-account",
|
|
139
|
-
recipients: "stripe-connect-recipients",
|
|
140
95
|
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
141
|
-
"capital-financing": "stripe-connect-capital-financing",
|
|
142
|
-
"capital-financing-application": "stripe-connect-capital-financing-application",
|
|
143
|
-
"capital-financing-promotion": "stripe-connect-capital-financing-promotion",
|
|
144
|
-
"capital-overview": "stripe-connect-capital-overview",
|
|
145
96
|
documents: "stripe-connect-documents",
|
|
146
|
-
"product-tax-code-selector": "stripe-connect-product-tax-code-selector",
|
|
147
|
-
"export-tax-transactions": "stripe-connect-export-tax-transactions",
|
|
148
97
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
149
98
|
"tax-settings": "stripe-connect-tax-settings",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"payouts-list": "stripe-connect-payouts-list",
|
|
153
|
-
"app-install": "stripe-connect-app-install",
|
|
154
|
-
"app-viewport": "stripe-connect-app-viewport",
|
|
155
|
-
"reporting-chart": "stripe-connect-reporting-chart"
|
|
99
|
+
balanceReport: "stripe-connect-balance-report",
|
|
100
|
+
payoutReconciliationReport: "stripe-connect-payout-reconciliation-report"
|
|
156
101
|
};
|
|
157
102
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
158
103
|
const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
|
|
159
104
|
const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
160
105
|
const findScript = () => {
|
|
161
|
-
return document.querySelectorAll(`script[src="${
|
|
106
|
+
return document.querySelectorAll(`script[src="${V1_URL}"]`)[0] || document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
162
107
|
};
|
|
163
108
|
const injectScript = () => {
|
|
164
109
|
const script = document.createElement("script");
|
|
@@ -248,6 +193,9 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
248
193
|
for (const method in methods) {
|
|
249
194
|
element[method] = function (value) {
|
|
250
195
|
stripeConnectInstance.then(() => {
|
|
196
|
+
if (!this[`${method}InternalOnly`]) {
|
|
197
|
+
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.36`);
|
|
198
|
+
}
|
|
251
199
|
this[`${method}InternalOnly`](value);
|
|
252
200
|
});
|
|
253
201
|
};
|
|
@@ -300,7 +248,7 @@ const createWrapper = stripeConnect => {
|
|
|
300
248
|
sdk: true,
|
|
301
249
|
sdkOptions: {
|
|
302
250
|
// This will be replaced by the npm package version when bundling
|
|
303
|
-
sdkVersion: "3.3.36
|
|
251
|
+
sdkVersion: "3.3.36"
|
|
304
252
|
}
|
|
305
253
|
})
|
|
306
254
|
}));
|
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" | "stripe-connect-balance-report" | "stripe-connect-payout-reconciliation-report";
|
|
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;
|
|
@@ -152,51 +136,19 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
152
136
|
"financial-account-transactions": {
|
|
153
137
|
setFinancialAccount: (_financialAccount: string) => void;
|
|
154
138
|
};
|
|
155
|
-
|
|
156
|
-
|
|
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-
|
|
168
|
-
|
|
142
|
+
"payment-details": {
|
|
143
|
+
setPayment: (_payment: string | undefined) => void;
|
|
144
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
169
145
|
};
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
|
|
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
|
-
setOnApplicationStepChange: (_listener: (({ step }: StepChange) => void) | undefined) => void;
|
|
184
|
-
};
|
|
185
|
-
"capital-financing-promotion": {
|
|
186
|
-
setLayout: (_layout: FinancingPromotionLayoutType | undefined) => void;
|
|
187
|
-
setOnApplicationSubmitted: (_listener: (() => void) | undefined) => void;
|
|
188
|
-
setOnEligibleFinancingOfferLoaded: (_listener: (({ productType, activeFinancingCount, }: FinancingProductType) => void) | undefined) => void;
|
|
189
|
-
setPrivacyPolicyUrl: (_privacyPolicyUrl: string | undefined) => void;
|
|
190
|
-
setHowCapitalWorksUrl: (_howCapitalWorksUrl: string | undefined) => void;
|
|
191
|
-
setEligibilityCriteriaUrl: (_eligibilityCriteriaUrl: string | undefined) => void;
|
|
192
|
-
setOnApplicationStepChange: (_listener: (({ step }: StepChange) => void) | undefined) => void;
|
|
193
|
-
};
|
|
194
|
-
"reporting-chart": {
|
|
195
|
-
setReportName: (_reportName: ReportName) => void;
|
|
196
|
-
setIntervalStart: (_intervalStart: Date | undefined) => void;
|
|
197
|
-
setIntervalEnd: (_intervalEnd: Date | undefined) => void;
|
|
198
|
-
setIntervalType: (_intervalType: IntervalType | undefined) => void;
|
|
199
|
-
};
|
|
200
152
|
"tax-settings": {
|
|
201
153
|
setHideProductTaxCodeSelector: (_hidden: boolean | undefined) => void;
|
|
202
154
|
setDisplayHeadOfficeCountries: (_countries: string[] | undefined) => void;
|
|
@@ -209,15 +161,15 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
209
161
|
id: string;
|
|
210
162
|
}) => void) | undefined) => void;
|
|
211
163
|
setDisplayCountries: (_countries: string[] | undefined) => void;
|
|
164
|
+
setOnAfterTaxRegistrationExpired: (_listener: (({ id }: {
|
|
165
|
+
id: string;
|
|
166
|
+
}) => void) | undefined) => void;
|
|
212
167
|
};
|
|
213
|
-
"
|
|
214
|
-
|
|
168
|
+
"payout-details": {
|
|
169
|
+
setPayout: (_payout: string | undefined) => void;
|
|
170
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
215
171
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
setHideDescription: (_hideDescription: boolean | undefined) => void;
|
|
219
|
-
setDisabled: (_disabled: boolean | undefined) => void;
|
|
220
|
-
setInitialTaxCode: (_initialTaxCode: string | undefined) => void;
|
|
172
|
+
payoutReconciliationReport: {
|
|
173
|
+
setOnNotAvailable: (_listener: (() => void) | undefined) => void;
|
|
221
174
|
};
|
|
222
|
-
"export-tax-transactions": {};
|
|
223
175
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/connect-js",
|
|
3
|
-
"version": "3.3.36
|
|
3
|
+
"version": "3.3.36",
|
|
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,76 +13,55 @@ 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"
|
|
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-
|
|
33
|
-
| "stripe-connect-
|
|
34
|
-
| "stripe-connect-
|
|
35
|
-
| "stripe-connect-
|
|
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
35
|
| "stripe-connect-tax-settings"
|
|
42
|
-
| "stripe-connect-
|
|
43
|
-
| "stripe-connect-
|
|
44
|
-
| "stripe-connect-payouts-list"
|
|
45
|
-
| "stripe-connect-app-install"
|
|
46
|
-
| "stripe-connect-app-viewport"
|
|
47
|
-
| "stripe-connect-reporting-chart";
|
|
36
|
+
| "stripe-connect-balance-report"
|
|
37
|
+
| "stripe-connect-payout-reconciliation-report";
|
|
48
38
|
|
|
49
39
|
export const componentNameMapping: Record<
|
|
50
40
|
ConnectElementTagName,
|
|
51
41
|
ConnectElementHTMLName
|
|
52
42
|
> = {
|
|
43
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
44
|
+
"disputes-list": "stripe-connect-disputes-list",
|
|
53
45
|
payments: "stripe-connect-payments",
|
|
54
|
-
payouts: "stripe-connect-payouts",
|
|
55
46
|
"payment-details": "stripe-connect-payment-details",
|
|
56
47
|
"payment-disputes": "stripe-connect-payment-disputes",
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
48
|
+
payouts: "stripe-connect-payouts",
|
|
49
|
+
"payouts-list": "stripe-connect-payouts-list",
|
|
50
|
+
"payout-details": "stripe-connect-payout-details",
|
|
51
|
+
balances: "stripe-connect-balances",
|
|
60
52
|
"account-management": "stripe-connect-account-management",
|
|
61
53
|
"notification-banner": "stripe-connect-notification-banner",
|
|
62
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
63
54
|
"instant-payouts-promotion": "stripe-connect-instant-payouts-promotion",
|
|
64
55
|
"issuing-card": "stripe-connect-issuing-card",
|
|
65
56
|
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
66
57
|
"financial-account": "stripe-connect-financial-account",
|
|
67
|
-
recipients: "stripe-connect-recipients",
|
|
68
58
|
"financial-account-transactions":
|
|
69
59
|
"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
60
|
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
61
|
"tax-registrations": "stripe-connect-tax-registrations",
|
|
79
62
|
"tax-settings": "stripe-connect-tax-settings",
|
|
80
|
-
|
|
81
|
-
|
|
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",
|
|
63
|
+
balanceReport: "stripe-connect-balance-report",
|
|
64
|
+
payoutReconciliationReport: "stripe-connect-payout-reconciliation-report",
|
|
86
65
|
};
|
|
87
66
|
|
|
88
67
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
@@ -101,10 +80,10 @@ const V1_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
|
101
80
|
export const findScript = (): HTMLScriptElement | null => {
|
|
102
81
|
return (
|
|
103
82
|
document.querySelectorAll<HTMLScriptElement>(
|
|
104
|
-
`script[src="${
|
|
83
|
+
`script[src="${V1_URL}"]`
|
|
105
84
|
)[0] ||
|
|
106
85
|
document.querySelectorAll<HTMLScriptElement>(
|
|
107
|
-
`script[src="${
|
|
86
|
+
`script[src="${V0_URL}"]`
|
|
108
87
|
)[0] ||
|
|
109
88
|
null
|
|
110
89
|
);
|
|
@@ -233,6 +212,12 @@ export const initStripeConnect = (
|
|
|
233
212
|
for (const method in methods) {
|
|
234
213
|
(element as any)[method] = function (value: any) {
|
|
235
214
|
stripeConnectInstance.then(() => {
|
|
215
|
+
if (!this[`${method}InternalOnly`]) {
|
|
216
|
+
throw new Error(
|
|
217
|
+
`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_`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
236
221
|
this[`${method}InternalOnly`](value);
|
|
237
222
|
});
|
|
238
223
|
};
|