@whop/elements 1.0.0-beta.2 → 1.0.0-beta.3
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/ads.d.cts +32 -2
- package/ads.d.ts +32 -2
- package/checkout.d.cts +3 -3
- package/checkout.d.ts +3 -3
- package/index.d.cts +8 -3
- package/index.d.ts +8 -3
- package/package.json +10 -2
- package/payments.d.cts +11 -11
- package/payments.d.ts +11 -11
- package/tracking.d.cts +94 -3
- package/tracking.d.ts +94 -3
- package/verifications.d.cts +308 -0
- package/verifications.d.ts +308 -0
- package/wallet.d.cts +2100 -571
- package/wallet.d.ts +2100 -571
- package/websites.d.cts +36 -10
- package/websites.d.ts +36 -10
package/wallet.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export interface WalletOptions {
|
|
|
15
15
|
* @default "usd"
|
|
16
16
|
*/
|
|
17
17
|
currency?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional scoped token projected to data-backed wallet children. Without it, reads use the viewer session.
|
|
20
|
+
*/
|
|
21
|
+
accessToken?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Show a holding's balance page in place of the balances chart and list when a row is clicked. Off by default so a host that routes on `balanceSelected` is not covered by a second screen.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
openHoldingOnSelect?: boolean;
|
|
18
27
|
/**
|
|
19
28
|
* Account or user ID whose money these surfaces read. Account IDs are prefixed `biz_`; user IDs are prefixed `user_` and can read only the viewer's own balance.
|
|
20
29
|
*/
|
|
@@ -38,38 +47,30 @@ export interface WalletOptions {
|
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
/**
|
|
41
|
-
* Consumer props for the "
|
|
42
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
50
|
+
* Consumer props for the "required-actions" element. Set at create (or as `<RequiredActionsElement />` JSX props), and updatable live via `update()`.
|
|
51
|
+
* @see https://docs.whop.com/elements/latest/wallet/required-actions
|
|
43
52
|
*/
|
|
44
|
-
export interface
|
|
45
|
-
/**
|
|
46
|
-
* Only show activity for this currency. Without it, activity from every currency is shown.
|
|
47
|
-
*/
|
|
48
|
-
currency?: string;
|
|
53
|
+
export interface RequiredActionsElementProps {
|
|
49
54
|
/**
|
|
50
|
-
* A scoped token for the read
|
|
55
|
+
* A scoped token for the read and for starting verification — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
51
56
|
*/
|
|
52
57
|
accessToken?: string;
|
|
53
58
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @default
|
|
59
|
+
* Which verification the Verify button starts. `individual` (KYC) is what unlocks payouts and a Whop card. `business` (KYB) covers that and additionally unlocks financing and business cards — use it for a company that will need those.
|
|
60
|
+
* @default "individual"
|
|
56
61
|
*/
|
|
57
|
-
|
|
62
|
+
kind?: "individual" | "business";
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/**
|
|
61
|
-
* The live handle for a mounted "
|
|
62
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
66
|
+
* The live handle for a mounted "required-actions" element. Returned by `create("required-actions")`; in React, the component's `ref`.
|
|
67
|
+
* @see https://docs.whop.com/elements/latest/wallet/required-actions
|
|
63
68
|
*/
|
|
64
|
-
export interface
|
|
69
|
+
export interface RequiredActionsElementHandle {
|
|
65
70
|
/**
|
|
66
|
-
* Re-
|
|
71
|
+
* Re-read the account. Call it when the viewer returns from verifying or depositing so the banners reflect the new state without waiting for the cache to expire.
|
|
67
72
|
*/
|
|
68
73
|
refresh: () => Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Set the date filter from outside the element, for example wiring a chart brush selection into the list. Pass `null` to clear it.
|
|
71
|
-
*/
|
|
72
|
-
setDateRange: (input: ActivityDateRangeOverride | null) => Promise<void>;
|
|
73
74
|
/**
|
|
74
75
|
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
75
76
|
*/
|
|
@@ -81,44 +82,40 @@ export interface ActivityElementHandle {
|
|
|
81
82
|
/**
|
|
82
83
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
83
84
|
*/
|
|
84
|
-
update: (options: Partial<
|
|
85
|
+
update: (options: Partial<RequiredActionsElementProps>) => void;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
|
-
* Options for `create("
|
|
89
|
+
* Options for `create("required-actions")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
89
90
|
* @example
|
|
90
91
|
* ```ts
|
|
91
|
-
* const
|
|
92
|
-
*
|
|
92
|
+
* const required_actions = wallet.create("required-actions", {}); // this interface: props + on<Event> callbacks
|
|
93
|
+
* required_actions.mount("#wallet-required-actions");
|
|
93
94
|
* ```
|
|
94
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
95
|
+
* @see https://docs.whop.com/elements/latest/wallet/required-actions
|
|
95
96
|
*/
|
|
96
|
-
export interface
|
|
97
|
-
/**
|
|
98
|
-
* Only show activity for this currency. Without it, activity from every currency is shown.
|
|
99
|
-
*/
|
|
100
|
-
currency?: string;
|
|
97
|
+
export interface RequiredActionsElementCreateOptions {
|
|
101
98
|
/**
|
|
102
|
-
* A scoped token for the read
|
|
99
|
+
* A scoped token for the read and for starting verification — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
103
100
|
*/
|
|
104
101
|
accessToken?: string;
|
|
105
102
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @default
|
|
103
|
+
* Which verification the Verify button starts. `individual` (KYC) is what unlocks payouts and a Whop card. `business` (KYB) covers that and additionally unlocks financing and business cards — use it for a company that will need those.
|
|
104
|
+
* @default "individual"
|
|
108
105
|
*/
|
|
109
|
-
|
|
106
|
+
kind?: "individual" | "business";
|
|
110
107
|
/**
|
|
111
|
-
*
|
|
108
|
+
* The viewer pressed a banner button. Fires for every action, including ones the element also handles itself.
|
|
112
109
|
*/
|
|
113
|
-
|
|
110
|
+
onActionRequested?: ((payload: { action: "deposit_funds" | "submit_information_request" | "update_automatic_withdrawal_method" | "reauthorize_payout_methods" | "update_payout_profile" | "card_usage_review" | "verify_identity" | "sign_formation_documents" | "connect_fulfillment_tracker" | "setup_apple_pay_domains" | "configure_tax_remitter" | "add_vat_registration"; accountId: string; }) => void);
|
|
114
111
|
/**
|
|
115
|
-
* The
|
|
112
|
+
* The viewer pressed Verify on a `verify_identity` action the element can start. The element opens identity verification itself — this fires alongside, so a host can record the trip.
|
|
116
113
|
*/
|
|
117
|
-
|
|
114
|
+
onIdentityVerificationRequested?: ((payload: { accountId: string; }) => void);
|
|
118
115
|
/**
|
|
119
|
-
* The viewer
|
|
116
|
+
* The viewer pressed Add money. The Wallet controller opens its deposit overlay.
|
|
120
117
|
*/
|
|
121
|
-
|
|
118
|
+
onDepositRequested?: ((payload: Record<string, never>) => void);
|
|
122
119
|
/**
|
|
123
120
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
124
121
|
*/
|
|
@@ -153,6 +150,16 @@ export interface ActionsElementProps {
|
|
|
153
150
|
* @default true
|
|
154
151
|
*/
|
|
155
152
|
showSend?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Show the Withdraw button. Off by default so an existing row keeps the buttons it already had.
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
showWithdraw?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Show the Convert button.
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
showConvert?: boolean;
|
|
156
163
|
/**
|
|
157
164
|
* Disable the Deposit button while keeping it visible.
|
|
158
165
|
* @default false
|
|
@@ -168,6 +175,16 @@ export interface ActionsElementProps {
|
|
|
168
175
|
* @default false
|
|
169
176
|
*/
|
|
170
177
|
sendDisabled?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Disable the Withdraw button while keeping it visible.
|
|
180
|
+
* @default false
|
|
181
|
+
*/
|
|
182
|
+
withdrawDisabled?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Disable the Convert button while keeping it visible.
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
187
|
+
convertDisabled?: boolean;
|
|
171
188
|
}
|
|
172
189
|
|
|
173
190
|
/**
|
|
@@ -214,6 +231,16 @@ export interface ActionsElementCreateOptions {
|
|
|
214
231
|
* @default true
|
|
215
232
|
*/
|
|
216
233
|
showSend?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Show the Withdraw button. Off by default so an existing row keeps the buttons it already had.
|
|
236
|
+
* @default false
|
|
237
|
+
*/
|
|
238
|
+
showWithdraw?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Show the Convert button.
|
|
241
|
+
* @default true
|
|
242
|
+
*/
|
|
243
|
+
showConvert?: boolean;
|
|
217
244
|
/**
|
|
218
245
|
* Disable the Deposit button while keeping it visible.
|
|
219
246
|
* @default false
|
|
@@ -229,6 +256,16 @@ export interface ActionsElementCreateOptions {
|
|
|
229
256
|
* @default false
|
|
230
257
|
*/
|
|
231
258
|
sendDisabled?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Disable the Withdraw button while keeping it visible.
|
|
261
|
+
* @default false
|
|
262
|
+
*/
|
|
263
|
+
withdrawDisabled?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Disable the Convert button while keeping it visible.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
convertDisabled?: boolean;
|
|
232
269
|
/**
|
|
233
270
|
* The Deposit button was pressed and the Wallet controller opened its deposit overlay.
|
|
234
271
|
*/
|
|
@@ -241,6 +278,14 @@ export interface ActionsElementCreateOptions {
|
|
|
241
278
|
* The Send button was pressed and the Wallet controller opened its send overlay.
|
|
242
279
|
*/
|
|
243
280
|
onSendRequested?: ((payload: Record<string, never>) => void);
|
|
281
|
+
/**
|
|
282
|
+
* The Withdraw button was pressed and the Wallet controller opened its withdraw overlay.
|
|
283
|
+
*/
|
|
284
|
+
onWithdrawRequested?: ((payload: Record<string, never>) => void);
|
|
285
|
+
/**
|
|
286
|
+
* The Convert button was pressed and the Wallet controller opened its convert overlay.
|
|
287
|
+
*/
|
|
288
|
+
onConvertRequested?: ((payload: Record<string, never>) => void);
|
|
244
289
|
/**
|
|
245
290
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
246
291
|
*/
|
|
@@ -256,80 +301,52 @@ export interface ActionsElementCreateOptions {
|
|
|
256
301
|
}
|
|
257
302
|
|
|
258
303
|
/**
|
|
259
|
-
* Consumer props for the "
|
|
260
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
304
|
+
* Consumer props for the "activity" element. Set at create (or as `<ActivityElement />` JSX props), and updatable live via `update()`.
|
|
305
|
+
* @see https://docs.whop.com/elements/latest/wallet/activity
|
|
261
306
|
*/
|
|
262
|
-
export interface
|
|
263
|
-
/**
|
|
264
|
-
* Prefill the amount and make it read-only — for flows that already know what is owed. An amount at or below zero is ignored, as is one longer than 12 whole digits; the rest is rounded to the currency’s decimal places.
|
|
265
|
-
* @default ""
|
|
266
|
-
*/
|
|
267
|
-
amount?: string;
|
|
268
|
-
/**
|
|
269
|
-
* Offer the crypto rail when the account has a deposit address.
|
|
270
|
-
* @default true
|
|
271
|
-
*/
|
|
272
|
-
showCrypto?: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Offer the bank-transfer rail when the account has wire instructions.
|
|
275
|
-
* @default true
|
|
276
|
-
*/
|
|
277
|
-
showBank?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Cards you already hold for this payer, rendered as funding rows. Choosing one emits `cardDepositRequested` with the amount — the element never collects a card payment.
|
|
280
|
-
* @default []
|
|
281
|
-
*/
|
|
282
|
-
savedCards?: DepositSavedCard[];
|
|
307
|
+
export interface ActivityElementProps {
|
|
283
308
|
/**
|
|
284
|
-
*
|
|
285
|
-
* @default false
|
|
309
|
+
* Only show activity for this currency. Without it, activity from every currency is shown.
|
|
286
310
|
*/
|
|
287
|
-
|
|
311
|
+
currency?: string;
|
|
288
312
|
/**
|
|
289
|
-
*
|
|
290
|
-
* @default false
|
|
313
|
+
* A scoped token for the read. An account needs `company:balance:read`, and a user needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`. Without it the read uses the viewer's own session, which only works same-origin.
|
|
291
314
|
*/
|
|
292
|
-
|
|
315
|
+
accessToken?: string;
|
|
293
316
|
/**
|
|
294
|
-
*
|
|
295
|
-
* @default null
|
|
317
|
+
* Show at most this many rows and stop paging, for a preview of recent activity. The list gains a See all activity control that reports `seeAllRequested` instead of navigating.
|
|
296
318
|
*/
|
|
297
|
-
|
|
319
|
+
maxItems?: number;
|
|
298
320
|
/**
|
|
299
|
-
*
|
|
300
|
-
* @default
|
|
321
|
+
* When off, card transaction rows render inert (no click, no hover) instead of firing `activitySelected`. Use it when you know the viewer isn't allowed to see those details.
|
|
322
|
+
* @default true
|
|
301
323
|
*/
|
|
302
|
-
|
|
324
|
+
canOpenCardTransactionDetails?: boolean;
|
|
303
325
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @default
|
|
326
|
+
* Activity types selected when the element mounts or its account changes. The viewer can change them with the built-in filters.
|
|
327
|
+
* @default []
|
|
306
328
|
*/
|
|
307
|
-
|
|
329
|
+
defaultLineTypes?: ("platform_balance_transfer_outgoing" | "payment_gross" | "withdrawal" | "topup" | "payment_dispute" | "payment_revshare" | "card_spend_authorization" | "airdrop" | "onchain_swap_target" | "payment_gross_reversal" | "payment_refund" | "payment_refund_reversal" | "payment_dispute_reversal" | "payment_dispute_adjustment" | "dispute_hold_adjustment" | "topup_reversal" | "platform_balance_payment" | "platform_balance_payment_refund" | "platform_balance_transfer_incoming" | "internal_balance_transfer_incoming" | "internal_balance_transfer_outgoing" | "onchain_wallet_transfer_incoming" | "onchain_wallet_transfer_outgoing" | "withdrawal_reversal" | "withdrawal_clawback" | "withdrawal_clawback_reversal" | "payment_revshare_refund" | "payment_revshare_reversal" | "payment_referral" | "payment_referral_reversal" | "application_fee_payout" | "airdrop_reversal" | "airdrop_link_created" | "airdrop_link_returned" | "card_spend_authorization_void" | "card_spend_refund" | "onchain_deposit" | "bank_transfer" | "currency_conversion_outgoing" | "currency_conversion_incoming" | "airdrop_link_redeemed" | "resolution_center_refund" | "withdrawal_reclassification" | "payment_revshare_payout" | "platform_affiliate_payment" | "platform_affiliate_payment_reversal" | "onboarding_reward" | "platform_covered_dispute" | "treasury_payin" | "passthrough_gmv" | "promo_reversal" | "misc_reversal" | "ad_spend_charge" | "ad_campaign_budget" | "ad_budget_release" | "ad_publisher_payout" | "ad_publisher_payout_received" | "affiliate_fee" | "application_fee" | "billing_percentage_fee" | "buyer_fee" | "cross_border_percentage_fee" | "dispute_alert_fee" | "fraud_prevention_fee" | "fx_percentage_fee" | "high_risk_merchant_fee" | "orchestration_percentage_fee" | "payment_dispute_fee" | "payment_processing_fixed_fee" | "payment_processing_percentage_fee" | "payout_fee" | "revshare_percentage_fee" | "sales_tax_fee" | "sales_tax_remittance" | "sales_tax_remittance_reversal" | "stripe_domestic_processing_fee" | "stripe_international_processing_fee" | "three_ds_fixed_fee" | "whop_processing_fee")[];
|
|
308
330
|
/**
|
|
309
|
-
*
|
|
331
|
+
* Hide the filter chips, for a compact list that the viewer does not filter.
|
|
310
332
|
* @default false
|
|
311
333
|
*/
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Open straight onto a rail instead of the picker. `crypto` and `bank` need no amount; their back button emits `dismissed` because there is no picker behind them.
|
|
315
|
-
* @default "amount"
|
|
316
|
-
*/
|
|
317
|
-
initialStep?: "amount" | "bank" | "crypto";
|
|
334
|
+
hideFilters?: boolean;
|
|
318
335
|
}
|
|
319
336
|
|
|
320
337
|
/**
|
|
321
|
-
* The live handle for a mounted "
|
|
322
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
338
|
+
* The live handle for a mounted "activity" element. Returned by `create("activity")`; in React, the component's `ref`.
|
|
339
|
+
* @see https://docs.whop.com/elements/latest/wallet/activity
|
|
323
340
|
*/
|
|
324
|
-
export interface
|
|
341
|
+
export interface ActivityElementHandle {
|
|
325
342
|
/**
|
|
326
|
-
*
|
|
343
|
+
* Re-fetch the account's activity from the first page. Call it after a mutation made elsewhere (a deposit, a send) so the list reflects it without waiting for the cache to expire.
|
|
327
344
|
*/
|
|
328
|
-
|
|
345
|
+
refresh: () => Promise<void>;
|
|
329
346
|
/**
|
|
330
|
-
*
|
|
347
|
+
* Set the date filter from outside the element, for example wiring a chart brush selection into the list. Pass `null` to clear it.
|
|
331
348
|
*/
|
|
332
|
-
|
|
349
|
+
setDateRange: (input: ActivityDateRangeOverride | null) => Promise<void>;
|
|
333
350
|
/**
|
|
334
351
|
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
335
352
|
*/
|
|
@@ -341,106 +358,62 @@ export interface DepositElementHandle {
|
|
|
341
358
|
/**
|
|
342
359
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
343
360
|
*/
|
|
344
|
-
update: (options: Partial<
|
|
361
|
+
update: (options: Partial<ActivityElementProps>) => void;
|
|
345
362
|
}
|
|
346
363
|
|
|
347
364
|
/**
|
|
348
|
-
* Options for `create("
|
|
365
|
+
* Options for `create("activity")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
349
366
|
* @example
|
|
350
367
|
* ```ts
|
|
351
|
-
* const
|
|
352
|
-
*
|
|
368
|
+
* const activity = wallet.create("activity", {}); // this interface: props + on<Event> callbacks
|
|
369
|
+
* activity.mount("#wallet-activity");
|
|
353
370
|
* ```
|
|
354
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
371
|
+
* @see https://docs.whop.com/elements/latest/wallet/activity
|
|
355
372
|
*/
|
|
356
|
-
export interface
|
|
357
|
-
/**
|
|
358
|
-
* Prefill the amount and make it read-only — for flows that already know what is owed. An amount at or below zero is ignored, as is one longer than 12 whole digits; the rest is rounded to the currency’s decimal places.
|
|
359
|
-
* @default ""
|
|
360
|
-
*/
|
|
361
|
-
amount?: string;
|
|
362
|
-
/**
|
|
363
|
-
* Offer the crypto rail when the account has a deposit address.
|
|
364
|
-
* @default true
|
|
365
|
-
*/
|
|
366
|
-
showCrypto?: boolean;
|
|
367
|
-
/**
|
|
368
|
-
* Offer the bank-transfer rail when the account has wire instructions.
|
|
369
|
-
* @default true
|
|
370
|
-
*/
|
|
371
|
-
showBank?: boolean;
|
|
372
|
-
/**
|
|
373
|
-
* Cards you already hold for this payer, rendered as funding rows. Choosing one emits `cardDepositRequested` with the amount — the element never collects a card payment.
|
|
374
|
-
* @default []
|
|
375
|
-
*/
|
|
376
|
-
savedCards?: DepositSavedCard[];
|
|
373
|
+
export interface ActivityElementCreateOptions {
|
|
377
374
|
/**
|
|
378
|
-
*
|
|
379
|
-
* @default false
|
|
375
|
+
* Only show activity for this currency. Without it, activity from every currency is shown.
|
|
380
376
|
*/
|
|
381
|
-
|
|
377
|
+
currency?: string;
|
|
382
378
|
/**
|
|
383
|
-
*
|
|
384
|
-
* @default false
|
|
379
|
+
* A scoped token for the read. An account needs `company:balance:read`, and a user needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`. Without it the read uses the viewer's own session, which only works same-origin.
|
|
385
380
|
*/
|
|
386
|
-
|
|
381
|
+
accessToken?: string;
|
|
387
382
|
/**
|
|
388
|
-
*
|
|
389
|
-
* @default null
|
|
383
|
+
* Show at most this many rows and stop paging, for a preview of recent activity. The list gains a See all activity control that reports `seeAllRequested` instead of navigating.
|
|
390
384
|
*/
|
|
391
|
-
|
|
385
|
+
maxItems?: number;
|
|
392
386
|
/**
|
|
393
|
-
*
|
|
394
|
-
* @default
|
|
387
|
+
* When off, card transaction rows render inert (no click, no hover) instead of firing `activitySelected`. Use it when you know the viewer isn't allowed to see those details.
|
|
388
|
+
* @default true
|
|
395
389
|
*/
|
|
396
|
-
|
|
390
|
+
canOpenCardTransactionDetails?: boolean;
|
|
397
391
|
/**
|
|
398
|
-
*
|
|
399
|
-
* @default
|
|
392
|
+
* Activity types selected when the element mounts or its account changes. The viewer can change them with the built-in filters.
|
|
393
|
+
* @default []
|
|
400
394
|
*/
|
|
401
|
-
|
|
395
|
+
defaultLineTypes?: ("platform_balance_transfer_outgoing" | "payment_gross" | "withdrawal" | "topup" | "payment_dispute" | "payment_revshare" | "card_spend_authorization" | "airdrop" | "onchain_swap_target" | "payment_gross_reversal" | "payment_refund" | "payment_refund_reversal" | "payment_dispute_reversal" | "payment_dispute_adjustment" | "dispute_hold_adjustment" | "topup_reversal" | "platform_balance_payment" | "platform_balance_payment_refund" | "platform_balance_transfer_incoming" | "internal_balance_transfer_incoming" | "internal_balance_transfer_outgoing" | "onchain_wallet_transfer_incoming" | "onchain_wallet_transfer_outgoing" | "withdrawal_reversal" | "withdrawal_clawback" | "withdrawal_clawback_reversal" | "payment_revshare_refund" | "payment_revshare_reversal" | "payment_referral" | "payment_referral_reversal" | "application_fee_payout" | "airdrop_reversal" | "airdrop_link_created" | "airdrop_link_returned" | "card_spend_authorization_void" | "card_spend_refund" | "onchain_deposit" | "bank_transfer" | "currency_conversion_outgoing" | "currency_conversion_incoming" | "airdrop_link_redeemed" | "resolution_center_refund" | "withdrawal_reclassification" | "payment_revshare_payout" | "platform_affiliate_payment" | "platform_affiliate_payment_reversal" | "onboarding_reward" | "platform_covered_dispute" | "treasury_payin" | "passthrough_gmv" | "promo_reversal" | "misc_reversal" | "ad_spend_charge" | "ad_campaign_budget" | "ad_budget_release" | "ad_publisher_payout" | "ad_publisher_payout_received" | "affiliate_fee" | "application_fee" | "billing_percentage_fee" | "buyer_fee" | "cross_border_percentage_fee" | "dispute_alert_fee" | "fraud_prevention_fee" | "fx_percentage_fee" | "high_risk_merchant_fee" | "orchestration_percentage_fee" | "payment_dispute_fee" | "payment_processing_fixed_fee" | "payment_processing_percentage_fee" | "payout_fee" | "revshare_percentage_fee" | "sales_tax_fee" | "sales_tax_remittance" | "sales_tax_remittance_reversal" | "stripe_domestic_processing_fee" | "stripe_international_processing_fee" | "three_ds_fixed_fee" | "whop_processing_fee")[];
|
|
402
396
|
/**
|
|
403
|
-
*
|
|
397
|
+
* Hide the filter chips, for a compact list that the viewer does not filter.
|
|
404
398
|
* @default false
|
|
405
399
|
*/
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Open straight onto a rail instead of the picker. `crypto` and `bank` need no amount; their back button emits `dismissed` because there is no picker behind them.
|
|
409
|
-
* @default "amount"
|
|
410
|
-
*/
|
|
411
|
-
initialStep?: "amount" | "bank" | "crypto";
|
|
412
|
-
/**
|
|
413
|
-
* The payer confirmed an amount and a rail. Fires for every rail, before any instructions render — the analytics/funnel hook.
|
|
414
|
-
*/
|
|
415
|
-
onDepositInitiated?: ((payload: { method: "card" | "bank" | "crypto" | "platform_balance"; amount: number; currency: string; paymentMethodId?: string | undefined; }) => void);
|
|
416
|
-
/**
|
|
417
|
-
* A saved card was chosen. Collect the payment on your side, then call `showStep({ step: "amount" })` to return the element to the picker.
|
|
418
|
-
*/
|
|
419
|
-
onCardDepositRequested?: ((payload: { amount: number; currency: string; paymentMethodId: string; }) => void);
|
|
420
|
-
/**
|
|
421
|
-
* The "Add card" row was picked — open your card-collection flow.
|
|
422
|
-
*/
|
|
423
|
-
onAddCardRequested?: ((payload: Record<string, never>) => void);
|
|
424
|
-
/**
|
|
425
|
-
* The bank rail was chosen while `deferBankToHost` is set — run your step, then show the fields yourself or call `showStep({ step: "bank" })`.
|
|
426
|
-
*/
|
|
427
|
-
onBankSelected?: ((payload: Record<string, never>) => void);
|
|
400
|
+
hideFilters?: boolean;
|
|
428
401
|
/**
|
|
429
|
-
*
|
|
402
|
+
* A row was clicked. Open your own detail view or route for it; the element never navigates.
|
|
430
403
|
*/
|
|
431
|
-
|
|
404
|
+
onActivitySelected?: ((payload: { activity: LedgerActivity; }) => void);
|
|
432
405
|
/**
|
|
433
|
-
* The
|
|
406
|
+
* The pointer entered a row, or left one (`null`). Point something of your own at the same moment, like marking the row on a balance chart.
|
|
434
407
|
*/
|
|
435
|
-
|
|
408
|
+
onActivityHovered?: ((payload: { activity: LedgerActivity; } | null) => void);
|
|
436
409
|
/**
|
|
437
|
-
* The
|
|
410
|
+
* The viewer pressed See all activity on a `maxItems` list. Open your own full activity screen; the element never navigates.
|
|
438
411
|
*/
|
|
439
|
-
|
|
412
|
+
onSeeAllRequested?: ((payload: Record<string, never>) => void);
|
|
440
413
|
/**
|
|
441
|
-
* The
|
|
414
|
+
* The viewer changed the date filter through the filter chips rather than through `setDateRange`. Clear any range selection of your own, like a chart brush, that no longer matches.
|
|
442
415
|
*/
|
|
443
|
-
|
|
416
|
+
onDateRangeChanged?: ((payload: { dateRange: { start: string; end: string; } | null; }) => void);
|
|
444
417
|
/**
|
|
445
418
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
446
419
|
*/
|
|
@@ -456,125 +429,219 @@ export interface DepositElementCreateOptions {
|
|
|
456
429
|
}
|
|
457
430
|
|
|
458
431
|
/**
|
|
459
|
-
*
|
|
460
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
432
|
+
* Consumer props for the "activityDetail" element. Set at create (or as `<ActivityDetailElement />` JSX props), and updatable live via `update()`.
|
|
433
|
+
* @see https://docs.whop.com/elements/latest/wallet/activityDetail
|
|
461
434
|
*/
|
|
462
|
-
export interface
|
|
435
|
+
export interface ActivityDetailElementProps {
|
|
463
436
|
/**
|
|
464
|
-
*
|
|
437
|
+
* Optional prefetched ledger activity row. When provided, the element renders it without another request.
|
|
438
|
+
* @default null
|
|
465
439
|
*/
|
|
466
|
-
|
|
440
|
+
activity?: LedgerActivity | null;
|
|
467
441
|
/**
|
|
468
|
-
*
|
|
442
|
+
* Optional ledger activity ID to retrieve when no prefetched activity row is provided.
|
|
443
|
+
* @default null
|
|
469
444
|
*/
|
|
470
|
-
|
|
445
|
+
activityId?: string | null;
|
|
471
446
|
/**
|
|
472
|
-
*
|
|
447
|
+
* Optional card transaction ID (`citx_`) to retrieve and show as a card receipt — what a card table hands back when a row is pressed. Takes precedence over `activityId`, and is ignored when a prefetched row is passed.
|
|
448
|
+
* @default null
|
|
473
449
|
*/
|
|
474
|
-
|
|
450
|
+
cardTransactionId?: string | null;
|
|
475
451
|
/**
|
|
476
|
-
*
|
|
452
|
+
* Show the cardholder row on a card receipt. Company accounts only — a personal wallet has one cardholder, so the row never appears there. Reading the name needs `company:authorized_user:read`; without it the row reads Unavailable.
|
|
453
|
+
* @default true
|
|
477
454
|
*/
|
|
478
|
-
|
|
455
|
+
showCardholder?: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Show the report-an-issue action for eligible card transactions. The action emits an event for the host.
|
|
458
|
+
* @default false
|
|
459
|
+
*/
|
|
460
|
+
showCardTransactionReportIssueAction?: boolean;
|
|
479
461
|
}
|
|
480
462
|
|
|
481
463
|
/**
|
|
482
|
-
*
|
|
483
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
464
|
+
* The live handle for a mounted "activityDetail" element. Returned by `create("activityDetail")`; in React, the component's `ref`.
|
|
465
|
+
* @see https://docs.whop.com/elements/latest/wallet/activityDetail
|
|
484
466
|
*/
|
|
485
|
-
export interface
|
|
467
|
+
export interface ActivityDetailElementHandle {
|
|
486
468
|
/**
|
|
487
|
-
*
|
|
488
|
-
* @default false
|
|
469
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
489
470
|
*/
|
|
490
|
-
|
|
471
|
+
mount: (target: string | HTMLElement) => void;
|
|
491
472
|
/**
|
|
492
|
-
*
|
|
493
|
-
* @default []
|
|
473
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
494
474
|
*/
|
|
495
|
-
|
|
475
|
+
destroy: () => void;
|
|
496
476
|
/**
|
|
497
|
-
*
|
|
498
|
-
* @default 0
|
|
477
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
499
478
|
*/
|
|
500
|
-
|
|
479
|
+
update: (options: Partial<ActivityDetailElementProps>) => void;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Options for `create("activityDetail")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* const activityDetail = wallet.createOverlay("activityDetail", {}); // this interface: props + on<Event> callbacks
|
|
487
|
+
* activityDetail.open();
|
|
488
|
+
* ```
|
|
489
|
+
* @see https://docs.whop.com/elements/latest/wallet/activityDetail
|
|
490
|
+
*/
|
|
491
|
+
export interface ActivityDetailElementCreateOptions {
|
|
501
492
|
/**
|
|
502
|
-
*
|
|
503
|
-
* @default
|
|
493
|
+
* Optional prefetched ledger activity row. When provided, the element renders it without another request.
|
|
494
|
+
* @default null
|
|
504
495
|
*/
|
|
505
|
-
|
|
496
|
+
activity?: LedgerActivity | null;
|
|
506
497
|
/**
|
|
507
|
-
*
|
|
508
|
-
* @default
|
|
498
|
+
* Optional ledger activity ID to retrieve when no prefetched activity row is provided.
|
|
499
|
+
* @default null
|
|
509
500
|
*/
|
|
510
|
-
|
|
501
|
+
activityId?: string | null;
|
|
511
502
|
/**
|
|
512
|
-
*
|
|
513
|
-
* @default
|
|
503
|
+
* Optional card transaction ID (`citx_`) to retrieve and show as a card receipt — what a card table hands back when a row is pressed. Takes precedence over `activityId`, and is ignored when a prefetched row is passed.
|
|
504
|
+
* @default null
|
|
514
505
|
*/
|
|
515
|
-
|
|
506
|
+
cardTransactionId?: string | null;
|
|
516
507
|
/**
|
|
517
|
-
*
|
|
508
|
+
* Show the cardholder row on a card receipt. Company accounts only — a personal wallet has one cardholder, so the row never appears there. Reading the name needs `company:authorized_user:read`; without it the row reads Unavailable.
|
|
509
|
+
* @default true
|
|
510
|
+
*/
|
|
511
|
+
showCardholder?: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Show the report-an-issue action for eligible card transactions. The action emits an event for the host.
|
|
518
514
|
* @default false
|
|
519
515
|
*/
|
|
520
|
-
|
|
516
|
+
showCardTransactionReportIssueAction?: boolean;
|
|
521
517
|
/**
|
|
522
|
-
*
|
|
523
|
-
* @default {"standard":{"maxAmount":0},"instant":{"maxAmount":0}}
|
|
518
|
+
* The card row was clicked.
|
|
524
519
|
*/
|
|
525
|
-
|
|
520
|
+
onCardSelected?: ((payload: { cardId: string; }) => void);
|
|
526
521
|
/**
|
|
527
|
-
*
|
|
528
|
-
* @default false
|
|
522
|
+
* The cardholder row was clicked. Open your own profile surface for that user.
|
|
529
523
|
*/
|
|
530
|
-
|
|
524
|
+
onCardholderSelected?: ((payload: { userId: string; }) => void);
|
|
531
525
|
/**
|
|
532
|
-
*
|
|
533
|
-
* @default false
|
|
526
|
+
* Report an issue was clicked. Open the host-owned card dispute flow.
|
|
534
527
|
*/
|
|
535
|
-
|
|
528
|
+
onCardTransactionIssueRequested?: ((payload: { transactionId: string; }) => void);
|
|
536
529
|
/**
|
|
537
|
-
*
|
|
538
|
-
* @default false
|
|
530
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
539
531
|
*/
|
|
540
|
-
|
|
532
|
+
onLoaderStart?: (() => void);
|
|
541
533
|
/**
|
|
542
|
-
*
|
|
543
|
-
* @default false
|
|
534
|
+
* Runs after the element's first complete paint.
|
|
544
535
|
*/
|
|
545
|
-
|
|
536
|
+
onReady?: (() => void);
|
|
546
537
|
/**
|
|
547
|
-
*
|
|
538
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
539
|
+
*/
|
|
540
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* The overlay handle for "activityDetail". Returned by `createOverlay("activityDetail")`; drives the modal presentation imperatively.
|
|
545
|
+
* @see https://docs.whop.com/elements/latest/wallet/activityDetail
|
|
546
|
+
*/
|
|
547
|
+
export interface ActivityDetailElementOverlayHandle {
|
|
548
|
+
/**
|
|
549
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
550
|
+
*/
|
|
551
|
+
open(): void;
|
|
552
|
+
/**
|
|
553
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
554
|
+
*/
|
|
555
|
+
close(): void;
|
|
556
|
+
/**
|
|
557
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
558
|
+
*/
|
|
559
|
+
destroy(): void;
|
|
560
|
+
/**
|
|
561
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
562
|
+
*/
|
|
563
|
+
update(options: Partial<ActivityDetailElementProps>): void;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Consumer props for the "deposit" element. Set at create (or as `<DepositElement />` JSX props), and updatable live via `update()`.
|
|
568
|
+
* @see https://docs.whop.com/elements/latest/wallet/deposit
|
|
569
|
+
*/
|
|
570
|
+
export interface DepositElementProps {
|
|
571
|
+
/**
|
|
572
|
+
* A scoped token that lets the rails resolution read a personal (`user_`) account — needs `payout:account:read`, plus `payout:account:update` for the bank rail to provision. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the call carries the viewer's own session, which only answers same-origin; business accounts resolve without any credential.
|
|
573
|
+
*/
|
|
574
|
+
accessToken?: string;
|
|
575
|
+
/**
|
|
576
|
+
* Prefill the amount and make it read-only — for flows that already know what is owed. An amount at or below zero is ignored, as is one longer than 12 whole digits; the rest is rounded to the currency’s decimal places.
|
|
548
577
|
* @default ""
|
|
549
578
|
*/
|
|
550
|
-
|
|
579
|
+
amount?: string;
|
|
551
580
|
/**
|
|
552
|
-
*
|
|
581
|
+
* Offer the crypto rail when the account has a deposit address.
|
|
582
|
+
* @default true
|
|
583
|
+
*/
|
|
584
|
+
showCrypto?: boolean;
|
|
585
|
+
/**
|
|
586
|
+
* Offer the bank-transfer rail. Shown even before the account has bank details — choosing it then asks the viewer to verify their identity when that is what the account still owes, and reports the rail as not available yet when it is not.
|
|
587
|
+
* @default true
|
|
588
|
+
*/
|
|
589
|
+
showBank?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Cards you already hold for this payer, rendered as funding rows. Choosing one emits `cardDepositRequested` with the amount — the element never collects a card payment.
|
|
592
|
+
* @default []
|
|
593
|
+
*/
|
|
594
|
+
savedCards?: DepositSavedCard[];
|
|
595
|
+
/**
|
|
596
|
+
* Add an "Add card" row that emits `addCardRequested` so you can open your own card-collection flow.
|
|
553
597
|
* @default false
|
|
554
598
|
*/
|
|
555
|
-
|
|
599
|
+
allowNewCard?: boolean;
|
|
556
600
|
/**
|
|
557
|
-
*
|
|
601
|
+
* Offer a "Platform balance" row that emits `platformBalanceSelected` immediately, with no amount step.
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
showPlatformBalance?: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* Processing fees to preview under the amount when a card row is selected. `percentageFee` is in percentage POINTS (`2.9` is 2.9%); `fixedFee` and `radarFee` are major units (`0.3` is $0.30).
|
|
607
|
+
* @default null
|
|
608
|
+
*/
|
|
609
|
+
cardFee?: DepositCardFee | null;
|
|
610
|
+
/**
|
|
611
|
+
* Preselect a rail by id (`bank`, `crypto`, `platform_balance`, or a saved card id). Continue stays disabled while that rail is not yet offered, rather than funding through another one.
|
|
558
612
|
* @default ""
|
|
559
613
|
*/
|
|
560
|
-
|
|
614
|
+
preferredMethodId?: string;
|
|
561
615
|
/**
|
|
562
|
-
*
|
|
616
|
+
* Emit `bankSelected` and stay on the amount screen instead of showing the wire fields — for hosts that run their own step after the account already has a virtual bank account.
|
|
563
617
|
* @default false
|
|
564
618
|
*/
|
|
565
|
-
|
|
619
|
+
deferBankToHost?: boolean;
|
|
566
620
|
/**
|
|
567
|
-
*
|
|
621
|
+
* Show an "I have deposited my funds" button on the crypto screen that emits `depositConfirmed`, so you can start watching for the transfer.
|
|
568
622
|
* @default false
|
|
569
623
|
*/
|
|
570
|
-
|
|
624
|
+
confirmCryptoDeposit?: boolean;
|
|
625
|
+
/**
|
|
626
|
+
* Open straight onto a rail instead of the picker. `crypto` and `bank` need no amount; their back button emits `dismissed` because there is no picker behind them.
|
|
627
|
+
* @default "amount"
|
|
628
|
+
*/
|
|
629
|
+
initialStep?: "amount" | "bank" | "crypto";
|
|
571
630
|
}
|
|
572
631
|
|
|
573
632
|
/**
|
|
574
|
-
* The live handle for a mounted "
|
|
575
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
633
|
+
* The live handle for a mounted "deposit" element. Returned by `create("deposit")`; in React, the component's `ref`.
|
|
634
|
+
* @see https://docs.whop.com/elements/latest/wallet/deposit
|
|
576
635
|
*/
|
|
577
|
-
export interface
|
|
636
|
+
export interface DepositElementHandle {
|
|
637
|
+
/**
|
|
638
|
+
* Move the element to a screen. `{ step: "amount" }` is how you hand control back after settling a card or platform-balance deposit on your side.
|
|
639
|
+
*/
|
|
640
|
+
showStep: (input: { step: "amount" | "bank" | "crypto"; }) => Promise<void>;
|
|
641
|
+
/**
|
|
642
|
+
* Re-resolve the account's funding rails. Call it after anything on your side changes what the account can offer — finishing bank onboarding, for instance — so the new rail appears without waiting for the cache to expire.
|
|
643
|
+
*/
|
|
644
|
+
refresh: () => Promise<void>;
|
|
578
645
|
/**
|
|
579
646
|
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
580
647
|
*/
|
|
@@ -586,144 +653,1431 @@ export interface WithdrawElementHandle {
|
|
|
586
653
|
/**
|
|
587
654
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
588
655
|
*/
|
|
589
|
-
update: (options: Partial<
|
|
656
|
+
update: (options: Partial<DepositElementProps>) => void;
|
|
590
657
|
}
|
|
591
658
|
|
|
592
659
|
/**
|
|
593
|
-
* Options for `create("
|
|
660
|
+
* Options for `create("deposit")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
594
661
|
* @example
|
|
595
662
|
* ```ts
|
|
596
|
-
* const
|
|
597
|
-
*
|
|
663
|
+
* const deposit = wallet.create("deposit", {}); // this interface: props + on<Event> callbacks
|
|
664
|
+
* deposit.mount("#wallet-deposit");
|
|
598
665
|
* ```
|
|
599
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
666
|
+
* @see https://docs.whop.com/elements/latest/wallet/deposit
|
|
600
667
|
*/
|
|
601
|
-
export interface
|
|
668
|
+
export interface DepositElementCreateOptions {
|
|
602
669
|
/**
|
|
603
|
-
*
|
|
604
|
-
* @default false
|
|
670
|
+
* A scoped token that lets the rails resolution read a personal (`user_`) account — needs `payout:account:read`, plus `payout:account:update` for the bank rail to provision. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the call carries the viewer's own session, which only answers same-origin; business accounts resolve without any credential.
|
|
605
671
|
*/
|
|
606
|
-
|
|
672
|
+
accessToken?: string;
|
|
607
673
|
/**
|
|
608
|
-
*
|
|
609
|
-
* @default
|
|
674
|
+
* Prefill the amount and make it read-only — for flows that already know what is owed. An amount at or below zero is ignored, as is one longer than 12 whole digits; the rest is rounded to the currency’s decimal places.
|
|
675
|
+
* @default ""
|
|
610
676
|
*/
|
|
611
|
-
|
|
677
|
+
amount?: string;
|
|
612
678
|
/**
|
|
613
|
-
*
|
|
614
|
-
* @default
|
|
679
|
+
* Offer the crypto rail when the account has a deposit address.
|
|
680
|
+
* @default true
|
|
615
681
|
*/
|
|
616
|
-
|
|
682
|
+
showCrypto?: boolean;
|
|
617
683
|
/**
|
|
618
|
-
*
|
|
619
|
-
* @default
|
|
684
|
+
* Offer the bank-transfer rail. Shown even before the account has bank details — choosing it then asks the viewer to verify their identity when that is what the account still owes, and reports the rail as not available yet when it is not.
|
|
685
|
+
* @default true
|
|
620
686
|
*/
|
|
621
|
-
|
|
687
|
+
showBank?: boolean;
|
|
622
688
|
/**
|
|
623
|
-
*
|
|
624
|
-
* @default
|
|
689
|
+
* Cards you already hold for this payer, rendered as funding rows. Choosing one emits `cardDepositRequested` with the amount — the element never collects a card payment.
|
|
690
|
+
* @default []
|
|
625
691
|
*/
|
|
626
|
-
|
|
692
|
+
savedCards?: DepositSavedCard[];
|
|
627
693
|
/**
|
|
628
|
-
*
|
|
629
|
-
* @default
|
|
694
|
+
* Add an "Add card" row that emits `addCardRequested` so you can open your own card-collection flow.
|
|
695
|
+
* @default false
|
|
630
696
|
*/
|
|
631
|
-
|
|
697
|
+
allowNewCard?: boolean;
|
|
632
698
|
/**
|
|
633
|
-
*
|
|
699
|
+
* Offer a "Platform balance" row that emits `platformBalanceSelected` immediately, with no amount step.
|
|
634
700
|
* @default false
|
|
635
701
|
*/
|
|
636
|
-
|
|
702
|
+
showPlatformBalance?: boolean;
|
|
637
703
|
/**
|
|
638
|
-
*
|
|
639
|
-
* @default
|
|
704
|
+
* Processing fees to preview under the amount when a card row is selected. `percentageFee` is in percentage POINTS (`2.9` is 2.9%); `fixedFee` and `radarFee` are major units (`0.3` is $0.30).
|
|
705
|
+
* @default null
|
|
640
706
|
*/
|
|
641
|
-
|
|
707
|
+
cardFee?: DepositCardFee | null;
|
|
642
708
|
/**
|
|
643
|
-
*
|
|
644
|
-
* @default
|
|
709
|
+
* Preselect a rail by id (`bank`, `crypto`, `platform_balance`, or a saved card id). Continue stays disabled while that rail is not yet offered, rather than funding through another one.
|
|
710
|
+
* @default ""
|
|
645
711
|
*/
|
|
646
|
-
|
|
712
|
+
preferredMethodId?: string;
|
|
647
713
|
/**
|
|
648
|
-
*
|
|
714
|
+
* Emit `bankSelected` and stay on the amount screen instead of showing the wire fields — for hosts that run their own step after the account already has a virtual bank account.
|
|
649
715
|
* @default false
|
|
650
716
|
*/
|
|
651
|
-
|
|
717
|
+
deferBankToHost?: boolean;
|
|
652
718
|
/**
|
|
653
|
-
*
|
|
719
|
+
* Show an "I have deposited my funds" button on the crypto screen that emits `depositConfirmed`, so you can start watching for the transfer.
|
|
654
720
|
* @default false
|
|
655
721
|
*/
|
|
656
|
-
|
|
722
|
+
confirmCryptoDeposit?: boolean;
|
|
657
723
|
/**
|
|
658
|
-
*
|
|
659
|
-
* @default
|
|
724
|
+
* Open straight onto a rail instead of the picker. `crypto` and `bank` need no amount; their back button emits `dismissed` because there is no picker behind them.
|
|
725
|
+
* @default "amount"
|
|
660
726
|
*/
|
|
661
|
-
|
|
727
|
+
initialStep?: "amount" | "bank" | "crypto";
|
|
662
728
|
/**
|
|
663
|
-
*
|
|
664
|
-
* @default ""
|
|
729
|
+
* The payer confirmed an amount and a rail. Fires for every rail, before any instructions render — the analytics/funnel hook.
|
|
665
730
|
*/
|
|
666
|
-
|
|
731
|
+
onDepositInitiated?: ((payload: { method: "bank" | "crypto" | "card" | "platform_balance"; amount: number; currency: string; paymentMethodId?: string | undefined; }) => void);
|
|
667
732
|
/**
|
|
668
|
-
*
|
|
669
|
-
* @default false
|
|
733
|
+
* A saved card was chosen. Collect the payment on your side, then call `showStep({ step: "amount" })` to return the element to the picker.
|
|
670
734
|
*/
|
|
671
|
-
|
|
735
|
+
onCardDepositRequested?: ((payload: { amount: number; currency: string; paymentMethodId: string; }) => void);
|
|
672
736
|
/**
|
|
673
|
-
* The
|
|
674
|
-
* @default ""
|
|
737
|
+
* The "Add card" row was picked — open your card-collection flow.
|
|
675
738
|
*/
|
|
676
|
-
|
|
739
|
+
onAddCardRequested?: ((payload: Record<string, never>) => void);
|
|
677
740
|
/**
|
|
678
|
-
*
|
|
679
|
-
* @default false
|
|
741
|
+
* The bank rail was chosen while `deferBankToHost` is set — run your step, then show the fields yourself or call `showStep({ step: "bank" })`.
|
|
680
742
|
*/
|
|
681
|
-
|
|
743
|
+
onBankSelected?: ((payload: Record<string, never>) => void);
|
|
682
744
|
/**
|
|
683
|
-
*
|
|
684
|
-
* @default false
|
|
745
|
+
* The viewer chose bank transfer before this account has a virtual bank account. The element stays on the amount screen and never navigates — mount your own verification, such as the `verifications` controller, in answer to this.
|
|
685
746
|
*/
|
|
686
|
-
|
|
747
|
+
onIdentityVerificationRequested?: ((payload: { accountId: string; }) => void);
|
|
687
748
|
/**
|
|
688
|
-
* The amount
|
|
749
|
+
* The platform-balance row was picked. It carries no amount — your own screen collects that.
|
|
689
750
|
*/
|
|
690
|
-
|
|
751
|
+
onPlatformBalanceSelected?: ((payload: Record<string, never>) => void);
|
|
691
752
|
/**
|
|
692
|
-
* The
|
|
753
|
+
* The payer said they sent the crypto. `since` is a unix-seconds floor to start matching incoming transfers from (it looks slightly back in time, so a transfer sent moments before the click still matches).
|
|
754
|
+
*/
|
|
755
|
+
onDepositConfirmed?: ((payload: { network: string; token: string; networkLabel: string; since: number; }) => void);
|
|
756
|
+
/**
|
|
757
|
+
* The visible screen changed.
|
|
758
|
+
*/
|
|
759
|
+
onStepChanged?: ((payload: { step: "amount" | "bank" | "crypto"; }) => void);
|
|
760
|
+
/**
|
|
761
|
+
* The payer backed out of a rail the element was opened directly onto — close the surface holding it.
|
|
762
|
+
*/
|
|
763
|
+
onDismissed?: ((payload: Record<string, never>) => void);
|
|
764
|
+
/**
|
|
765
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
766
|
+
*/
|
|
767
|
+
onLoaderStart?: (() => void);
|
|
768
|
+
/**
|
|
769
|
+
* Runs after the element's first complete paint.
|
|
770
|
+
*/
|
|
771
|
+
onReady?: (() => void);
|
|
772
|
+
/**
|
|
773
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
774
|
+
*/
|
|
775
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* The overlay handle for "deposit". Returned by `createOverlay("deposit")`; drives the modal presentation imperatively.
|
|
780
|
+
* @see https://docs.whop.com/elements/latest/wallet/deposit
|
|
781
|
+
*/
|
|
782
|
+
export interface DepositElementOverlayHandle {
|
|
783
|
+
/**
|
|
784
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
785
|
+
*/
|
|
786
|
+
open(): void;
|
|
787
|
+
/**
|
|
788
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
789
|
+
*/
|
|
790
|
+
close(): void;
|
|
791
|
+
/**
|
|
792
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
793
|
+
*/
|
|
794
|
+
destroy(): void;
|
|
795
|
+
/**
|
|
796
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
797
|
+
*/
|
|
798
|
+
update(options: Partial<DepositElementProps>): void;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Consumer props for the "convert" element. Set at create (or as `<ConvertElement />` JSX props), and updatable live via `update()`.
|
|
803
|
+
* @see https://docs.whop.com/elements/latest/wallet/convert
|
|
804
|
+
*/
|
|
805
|
+
export interface ConvertElementProps {}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* The live handle for a mounted "convert" element. Returned by `create("convert")`; in React, the component's `ref`.
|
|
809
|
+
* @see https://docs.whop.com/elements/latest/wallet/convert
|
|
810
|
+
*/
|
|
811
|
+
export interface ConvertElementHandle {
|
|
812
|
+
/**
|
|
813
|
+
* Re-fetch the account balance after another surface changes it.
|
|
814
|
+
*/
|
|
815
|
+
refresh: () => Promise<void>;
|
|
816
|
+
/**
|
|
817
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
818
|
+
*/
|
|
819
|
+
mount: (target: string | HTMLElement) => void;
|
|
820
|
+
/**
|
|
821
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
822
|
+
*/
|
|
823
|
+
destroy: () => void;
|
|
824
|
+
/**
|
|
825
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
826
|
+
*/
|
|
827
|
+
update: (options: Partial<ConvertElementProps>) => void;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Options for `create("convert")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
832
|
+
* @example
|
|
833
|
+
* ```ts
|
|
834
|
+
* const convert = wallet.create("convert", {}); // this interface: props + on<Event> callbacks
|
|
835
|
+
* convert.mount("#wallet-convert");
|
|
836
|
+
* ```
|
|
837
|
+
* @see https://docs.whop.com/elements/latest/wallet/convert
|
|
838
|
+
*/
|
|
839
|
+
export interface ConvertElementCreateOptions {
|
|
840
|
+
/**
|
|
841
|
+
* The visible conversion step changed.
|
|
842
|
+
*/
|
|
843
|
+
onViewChanged?: ((payload: { view: "pending" | "input" | "review" | "success"; }) => void);
|
|
844
|
+
/**
|
|
845
|
+
* A conversion completed or remains pending after the polling window. Refresh account balance and activity.
|
|
846
|
+
*/
|
|
847
|
+
onBalanceChanged?: ((payload: Record<string, never>) => void);
|
|
848
|
+
/**
|
|
849
|
+
* The viewer finished or dismissed the conversion flow.
|
|
850
|
+
*/
|
|
851
|
+
onDone?: ((payload: Record<string, never>) => void);
|
|
852
|
+
/**
|
|
853
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
854
|
+
*/
|
|
855
|
+
onLoaderStart?: (() => void);
|
|
856
|
+
/**
|
|
857
|
+
* Runs after the element's first complete paint.
|
|
858
|
+
*/
|
|
859
|
+
onReady?: (() => void);
|
|
860
|
+
/**
|
|
861
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
862
|
+
*/
|
|
863
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* The overlay handle for "convert". Returned by `createOverlay("convert")`; drives the modal presentation imperatively.
|
|
868
|
+
* @see https://docs.whop.com/elements/latest/wallet/convert
|
|
869
|
+
*/
|
|
870
|
+
export interface ConvertElementOverlayHandle {
|
|
871
|
+
/**
|
|
872
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
873
|
+
*/
|
|
874
|
+
open(): void;
|
|
875
|
+
/**
|
|
876
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
877
|
+
*/
|
|
878
|
+
close(): void;
|
|
879
|
+
/**
|
|
880
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
881
|
+
*/
|
|
882
|
+
destroy(): void;
|
|
883
|
+
/**
|
|
884
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
885
|
+
*/
|
|
886
|
+
update(options: Partial<ConvertElementProps>): void;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Consumer props for the "withdraw" element. Set at create (or as `<WithdrawElement />` JSX props), and updatable live via `update()`.
|
|
891
|
+
* @see https://docs.whop.com/elements/latest/wallet/withdraw
|
|
892
|
+
*/
|
|
893
|
+
export interface WithdrawElementProps {
|
|
894
|
+
/**
|
|
895
|
+
* A scoped token for listing payout methods and creating the payout — needs `payout:withdraw_funds`, `payout:destination:read`, and `payout:create_destination` to add a bank. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
896
|
+
*/
|
|
897
|
+
accessToken?: string;
|
|
898
|
+
/**
|
|
899
|
+
* Whether the confirmed payout was created successfully.
|
|
900
|
+
* @default false
|
|
901
|
+
*/
|
|
902
|
+
succeeded?: boolean;
|
|
903
|
+
/**
|
|
904
|
+
* Saved payout methods with quotes for the current amount.
|
|
905
|
+
* @default []
|
|
906
|
+
*/
|
|
907
|
+
methods?: WithdrawalMethod[];
|
|
908
|
+
/**
|
|
909
|
+
* Settled balance available to standard payout methods.
|
|
910
|
+
* @default 0
|
|
911
|
+
*/
|
|
912
|
+
availableBalance?: number;
|
|
913
|
+
/**
|
|
914
|
+
* Pending balance that may be available to instant payout methods.
|
|
915
|
+
* @default 0
|
|
916
|
+
*/
|
|
917
|
+
pendingBalance?: number;
|
|
918
|
+
/**
|
|
919
|
+
* The payout account's ISO 3166-1 alpha-2 country.
|
|
920
|
+
* @default "US"
|
|
921
|
+
*/
|
|
922
|
+
payoutCountry?: string;
|
|
923
|
+
/**
|
|
924
|
+
* Payout methods available to add in the selected country, including required fields.
|
|
925
|
+
* @default []
|
|
926
|
+
*/
|
|
927
|
+
supportedMethods?: WithdrawalSupportedMethod[];
|
|
928
|
+
/**
|
|
929
|
+
* Whether supported payout methods are loading for the selected country.
|
|
930
|
+
* @default false
|
|
931
|
+
*/
|
|
932
|
+
supportedMethodsLoading?: boolean;
|
|
933
|
+
/**
|
|
934
|
+
* Live standard and instant payout limits.
|
|
935
|
+
* @default {"standard":{"maxAmount":0},"instant":{"maxAmount":0}}
|
|
936
|
+
*/
|
|
937
|
+
limits?: WithdrawalLimits;
|
|
938
|
+
/**
|
|
939
|
+
* Whether payout methods and limits are loading.
|
|
940
|
+
* @default false
|
|
941
|
+
*/
|
|
942
|
+
loading?: boolean;
|
|
943
|
+
/**
|
|
944
|
+
* Whether the current amount is being repriced.
|
|
945
|
+
* @default false
|
|
946
|
+
*/
|
|
947
|
+
quoteLoading?: boolean;
|
|
948
|
+
/**
|
|
949
|
+
* Whether this payout must use an exact provider-backed quote before confirmation.
|
|
950
|
+
* @default false
|
|
951
|
+
*/
|
|
952
|
+
payoutQuoteRequired?: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* The exact short-lived payout quote returned for the current confirmation request.
|
|
955
|
+
* @default null
|
|
956
|
+
*/
|
|
957
|
+
payoutQuote?: WithdrawalPayoutQuote | null;
|
|
958
|
+
/**
|
|
959
|
+
* Whether an exact payout quote is being created.
|
|
960
|
+
* @default false
|
|
961
|
+
*/
|
|
962
|
+
payoutQuoteLoading?: boolean;
|
|
963
|
+
/**
|
|
964
|
+
* The error from the current exact payout quote request, if any.
|
|
965
|
+
* @default ""
|
|
966
|
+
*/
|
|
967
|
+
payoutQuoteError?: string;
|
|
968
|
+
/**
|
|
969
|
+
* Whether the last quote request was inconclusive and must be retried with the same request ID.
|
|
970
|
+
* @default false
|
|
971
|
+
*/
|
|
972
|
+
payoutQuoteRetryRequired?: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Whether the last payout result was inconclusive and must be retried exactly.
|
|
975
|
+
* @default false
|
|
976
|
+
*/
|
|
977
|
+
withdrawalRetryRequired?: boolean;
|
|
978
|
+
/**
|
|
979
|
+
* The exact unresolved payout request to retry after the element remounts.
|
|
980
|
+
* @default null
|
|
981
|
+
*/
|
|
982
|
+
unresolvedWithdrawalRequest?: WithdrawalRequest | null;
|
|
983
|
+
/**
|
|
984
|
+
* Whether a new payout method is being saved.
|
|
985
|
+
* @default false
|
|
986
|
+
*/
|
|
987
|
+
savingMethod?: boolean;
|
|
988
|
+
/**
|
|
989
|
+
* Whether the confirmed payout is being created.
|
|
990
|
+
* @default false
|
|
991
|
+
*/
|
|
992
|
+
submitting?: boolean;
|
|
993
|
+
/**
|
|
994
|
+
* A host-side error to show inside the current screen.
|
|
995
|
+
* @default ""
|
|
996
|
+
*/
|
|
997
|
+
error?: string;
|
|
998
|
+
/**
|
|
999
|
+
* True when the last payout was refused because the bank could not confirm the account holder name. Shows a fix-or-confirm choice; confirming re-emits withdrawalRequested with acknowledgeBankWarning set. Set this back to false when handling each withdrawalRequested — the choice appears on the change to true, so a flag left true hides every later refusal.
|
|
1000
|
+
* @default false
|
|
1001
|
+
*/
|
|
1002
|
+
bankWarning?: boolean;
|
|
1003
|
+
/**
|
|
1004
|
+
* The most recently created method, selected when it appears in methods.
|
|
1005
|
+
* @default ""
|
|
1006
|
+
*/
|
|
1007
|
+
createdMethodId?: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* Set when the payer backed out of Plaid Link or it failed to open. Unlocks manual entry on a rail that otherwise requires linking.
|
|
1010
|
+
* @default false
|
|
1011
|
+
*/
|
|
1012
|
+
plaidUnavailable?: boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* Whether a bank link is in progress — the Plaid session is open, or the linked method is being saved.
|
|
1015
|
+
* @default false
|
|
1016
|
+
*/
|
|
1017
|
+
linkingBank?: boolean;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* The live handle for a mounted "withdraw" element. Returned by `create("withdraw")`; in React, the component's `ref`.
|
|
1022
|
+
* @see https://docs.whop.com/elements/latest/wallet/withdraw
|
|
1023
|
+
*/
|
|
1024
|
+
export interface WithdrawElementHandle {
|
|
1025
|
+
/**
|
|
1026
|
+
* Re-fetch saved payout methods and limits. Call it after anything on your side changes what the account can pay out to.
|
|
1027
|
+
*/
|
|
1028
|
+
refresh: () => Promise<void>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1031
|
+
*/
|
|
1032
|
+
mount: (target: string | HTMLElement) => void;
|
|
1033
|
+
/**
|
|
1034
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1035
|
+
*/
|
|
1036
|
+
destroy: () => void;
|
|
1037
|
+
/**
|
|
1038
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1039
|
+
*/
|
|
1040
|
+
update: (options: Partial<WithdrawElementProps>) => void;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Options for `create("withdraw")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```ts
|
|
1047
|
+
* const withdraw = wallet.create("withdraw", {}); // this interface: props + on<Event> callbacks
|
|
1048
|
+
* withdraw.mount("#wallet-withdraw");
|
|
1049
|
+
* ```
|
|
1050
|
+
* @see https://docs.whop.com/elements/latest/wallet/withdraw
|
|
1051
|
+
*/
|
|
1052
|
+
export interface WithdrawElementCreateOptions {
|
|
1053
|
+
/**
|
|
1054
|
+
* A scoped token for listing payout methods and creating the payout — needs `payout:withdraw_funds`, `payout:destination:read`, and `payout:create_destination` to add a bank. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
1055
|
+
*/
|
|
1056
|
+
accessToken?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* Whether the confirmed payout was created successfully.
|
|
1059
|
+
* @default false
|
|
1060
|
+
*/
|
|
1061
|
+
succeeded?: boolean;
|
|
1062
|
+
/**
|
|
1063
|
+
* Saved payout methods with quotes for the current amount.
|
|
1064
|
+
* @default []
|
|
1065
|
+
*/
|
|
1066
|
+
methods?: WithdrawalMethod[];
|
|
1067
|
+
/**
|
|
1068
|
+
* Settled balance available to standard payout methods.
|
|
1069
|
+
* @default 0
|
|
1070
|
+
*/
|
|
1071
|
+
availableBalance?: number;
|
|
1072
|
+
/**
|
|
1073
|
+
* Pending balance that may be available to instant payout methods.
|
|
1074
|
+
* @default 0
|
|
1075
|
+
*/
|
|
1076
|
+
pendingBalance?: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* The payout account's ISO 3166-1 alpha-2 country.
|
|
1079
|
+
* @default "US"
|
|
1080
|
+
*/
|
|
1081
|
+
payoutCountry?: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Payout methods available to add in the selected country, including required fields.
|
|
1084
|
+
* @default []
|
|
1085
|
+
*/
|
|
1086
|
+
supportedMethods?: WithdrawalSupportedMethod[];
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether supported payout methods are loading for the selected country.
|
|
1089
|
+
* @default false
|
|
1090
|
+
*/
|
|
1091
|
+
supportedMethodsLoading?: boolean;
|
|
1092
|
+
/**
|
|
1093
|
+
* Live standard and instant payout limits.
|
|
1094
|
+
* @default {"standard":{"maxAmount":0},"instant":{"maxAmount":0}}
|
|
1095
|
+
*/
|
|
1096
|
+
limits?: WithdrawalLimits;
|
|
1097
|
+
/**
|
|
1098
|
+
* Whether payout methods and limits are loading.
|
|
1099
|
+
* @default false
|
|
1100
|
+
*/
|
|
1101
|
+
loading?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Whether the current amount is being repriced.
|
|
1104
|
+
* @default false
|
|
1105
|
+
*/
|
|
1106
|
+
quoteLoading?: boolean;
|
|
1107
|
+
/**
|
|
1108
|
+
* Whether this payout must use an exact provider-backed quote before confirmation.
|
|
1109
|
+
* @default false
|
|
1110
|
+
*/
|
|
1111
|
+
payoutQuoteRequired?: boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* The exact short-lived payout quote returned for the current confirmation request.
|
|
1114
|
+
* @default null
|
|
1115
|
+
*/
|
|
1116
|
+
payoutQuote?: WithdrawalPayoutQuote | null;
|
|
1117
|
+
/**
|
|
1118
|
+
* Whether an exact payout quote is being created.
|
|
1119
|
+
* @default false
|
|
1120
|
+
*/
|
|
1121
|
+
payoutQuoteLoading?: boolean;
|
|
1122
|
+
/**
|
|
1123
|
+
* The error from the current exact payout quote request, if any.
|
|
1124
|
+
* @default ""
|
|
1125
|
+
*/
|
|
1126
|
+
payoutQuoteError?: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Whether the last quote request was inconclusive and must be retried with the same request ID.
|
|
1129
|
+
* @default false
|
|
1130
|
+
*/
|
|
1131
|
+
payoutQuoteRetryRequired?: boolean;
|
|
1132
|
+
/**
|
|
1133
|
+
* Whether the last payout result was inconclusive and must be retried exactly.
|
|
1134
|
+
* @default false
|
|
1135
|
+
*/
|
|
1136
|
+
withdrawalRetryRequired?: boolean;
|
|
1137
|
+
/**
|
|
1138
|
+
* The exact unresolved payout request to retry after the element remounts.
|
|
1139
|
+
* @default null
|
|
1140
|
+
*/
|
|
1141
|
+
unresolvedWithdrawalRequest?: WithdrawalRequest | null;
|
|
1142
|
+
/**
|
|
1143
|
+
* Whether a new payout method is being saved.
|
|
1144
|
+
* @default false
|
|
1145
|
+
*/
|
|
1146
|
+
savingMethod?: boolean;
|
|
1147
|
+
/**
|
|
1148
|
+
* Whether the confirmed payout is being created.
|
|
1149
|
+
* @default false
|
|
1150
|
+
*/
|
|
1151
|
+
submitting?: boolean;
|
|
1152
|
+
/**
|
|
1153
|
+
* A host-side error to show inside the current screen.
|
|
1154
|
+
* @default ""
|
|
1155
|
+
*/
|
|
1156
|
+
error?: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* True when the last payout was refused because the bank could not confirm the account holder name. Shows a fix-or-confirm choice; confirming re-emits withdrawalRequested with acknowledgeBankWarning set. Set this back to false when handling each withdrawalRequested — the choice appears on the change to true, so a flag left true hides every later refusal.
|
|
1159
|
+
* @default false
|
|
1160
|
+
*/
|
|
1161
|
+
bankWarning?: boolean;
|
|
1162
|
+
/**
|
|
1163
|
+
* The most recently created method, selected when it appears in methods.
|
|
1164
|
+
* @default ""
|
|
1165
|
+
*/
|
|
1166
|
+
createdMethodId?: string;
|
|
1167
|
+
/**
|
|
1168
|
+
* Set when the payer backed out of Plaid Link or it failed to open. Unlocks manual entry on a rail that otherwise requires linking.
|
|
1169
|
+
* @default false
|
|
1170
|
+
*/
|
|
1171
|
+
plaidUnavailable?: boolean;
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether a bank link is in progress — the Plaid session is open, or the linked method is being saved.
|
|
1174
|
+
* @default false
|
|
1175
|
+
*/
|
|
1176
|
+
linkingBank?: boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* The amount changed and should be repriced.
|
|
1179
|
+
*/
|
|
1180
|
+
onAmountChanged?: ((payload: { amount: number; }) => void);
|
|
1181
|
+
/**
|
|
1182
|
+
* The add-method country changed and supported methods should be refreshed.
|
|
1183
|
+
*/
|
|
1184
|
+
onCountryChanged?: ((payload: { country: string; }) => void);
|
|
1185
|
+
/**
|
|
1186
|
+
* A supported payout method was selected and its exact required fields should be loaded.
|
|
1187
|
+
*/
|
|
1188
|
+
onSupportedMethodChanged?: ((payload: { country: string; supportedPayoutMethodId: string; destinationCurrency: string; }) => void);
|
|
1189
|
+
/**
|
|
1190
|
+
* The payer submitted the dynamic add-payout-method form.
|
|
1191
|
+
*/
|
|
1192
|
+
onAddMethodRequested?: ((payload: WithdrawalCreateMethodInput) => void);
|
|
1193
|
+
/**
|
|
1194
|
+
* The payer chose to link their bank through Plaid instead of typing details. Open Plaid Link on receipt.
|
|
1195
|
+
*/
|
|
1196
|
+
onPlaidLinkRequested?: ((payload: { country: string; supportedPayoutMethodId: string; destinationCurrency: string; }) => void);
|
|
1197
|
+
/**
|
|
1198
|
+
* The newly added payout method finished its verification step.
|
|
1199
|
+
*/
|
|
1200
|
+
onMethodVerificationCompleted?: ((payload: Record<string, never>) => void);
|
|
1201
|
+
/**
|
|
1202
|
+
* The payer requested to rename a saved payout method.
|
|
1203
|
+
*/
|
|
1204
|
+
onRenameMethodRequested?: ((payload: { methodId: string; }) => void);
|
|
1205
|
+
/**
|
|
1206
|
+
* The payer requested to remove a saved payout method.
|
|
1207
|
+
*/
|
|
1208
|
+
onRemoveMethodRequested?: ((payload: { methodId: string; }) => void);
|
|
1209
|
+
/**
|
|
1210
|
+
* The payer requested an exact short-lived quote before confirming a payout.
|
|
1211
|
+
*/
|
|
1212
|
+
onPayoutQuoteRequested?: ((payload: WithdrawalPayoutQuoteRequest) => void);
|
|
1213
|
+
/**
|
|
1214
|
+
* The payer confirmed the payout. When the host is driving the flow, create the payout on receipt. When the element created it, this fires after success so the host can refresh balances — do not create a second payout.
|
|
1215
|
+
*/
|
|
1216
|
+
onWithdrawalRequested?: ((payload: WithdrawalRequest) => void);
|
|
1217
|
+
/**
|
|
1218
|
+
* The payer finished reviewing a successful payout.
|
|
1219
|
+
*/
|
|
1220
|
+
onDone?: ((payload: Record<string, never>) => void);
|
|
1221
|
+
/**
|
|
1222
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1223
|
+
*/
|
|
1224
|
+
onLoaderStart?: (() => void);
|
|
1225
|
+
/**
|
|
1226
|
+
* Runs after the element's first complete paint.
|
|
1227
|
+
*/
|
|
1228
|
+
onReady?: (() => void);
|
|
1229
|
+
/**
|
|
1230
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1231
|
+
*/
|
|
1232
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* The overlay handle for "withdraw". Returned by `createOverlay("withdraw")`; drives the modal presentation imperatively.
|
|
1237
|
+
* @see https://docs.whop.com/elements/latest/wallet/withdraw
|
|
1238
|
+
*/
|
|
1239
|
+
export interface WithdrawElementOverlayHandle {
|
|
1240
|
+
/**
|
|
1241
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
1242
|
+
*/
|
|
1243
|
+
open(): void;
|
|
1244
|
+
/**
|
|
1245
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
1246
|
+
*/
|
|
1247
|
+
close(): void;
|
|
1248
|
+
/**
|
|
1249
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1250
|
+
*/
|
|
1251
|
+
destroy(): void;
|
|
1252
|
+
/**
|
|
1253
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1254
|
+
*/
|
|
1255
|
+
update(options: Partial<WithdrawElementProps>): void;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Consumer props for the "send" element. Set at create (or as `<SendElement />` JSX props), and updatable live via `update()`.
|
|
1260
|
+
* @see https://docs.whop.com/elements/latest/wallet/send
|
|
1261
|
+
*/
|
|
1262
|
+
export interface SendElementProps {
|
|
1263
|
+
/**
|
|
1264
|
+
* A scoped token for the privileged read/write — needs `payout:transfer_funds` for direct transfers and `payout:withdraw_funds` for recipient lists (plus `company:authorized_user:read` and `member:basic:read` for recipient search, `airdrop_link:manage` for claim links). Omitted, the read carries the viewer's own session, which only answers same-origin.
|
|
1265
|
+
*/
|
|
1266
|
+
accessToken?: string;
|
|
1267
|
+
/**
|
|
1268
|
+
* Overrides the recipient-picker header. Omitted, the header is "Choose recipient".
|
|
1269
|
+
*/
|
|
1270
|
+
title?: string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Off, only the team/other-account list shows — no search box. For a host that knows the viewer lacks `member:basic:read`.
|
|
1273
|
+
* @default true
|
|
1274
|
+
*/
|
|
1275
|
+
canSearchRecipients?: boolean;
|
|
1276
|
+
/**
|
|
1277
|
+
* Off, the "Send via link" row is hidden. For a host that knows the viewer lacks `airdrop_link:manage`.
|
|
1278
|
+
* @default true
|
|
1279
|
+
*/
|
|
1280
|
+
canCreateLink?: boolean;
|
|
1281
|
+
/**
|
|
1282
|
+
* Skip the picker and open straight onto this recipient's amount screen — for a "pay this person" action row. No back button is shown in that case, matching there being no picker behind it.
|
|
1283
|
+
* @default null
|
|
1284
|
+
*/
|
|
1285
|
+
initialRecipient?: SendRecipient | null;
|
|
1286
|
+
/**
|
|
1287
|
+
* Preselect a currency in the amount screen's picker. Falls back to `currency`, then USD.
|
|
1288
|
+
* @default ""
|
|
1289
|
+
*/
|
|
1290
|
+
initialCurrency?: string;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* The live handle for a mounted "send" element. Returned by `create("send")`; in React, the component's `ref`.
|
|
1295
|
+
* @see https://docs.whop.com/elements/latest/wallet/send
|
|
1296
|
+
*/
|
|
1297
|
+
export interface SendElementHandle {
|
|
1298
|
+
/**
|
|
1299
|
+
* Re-fetch the account's balances and recipient list. Call it after anything on your side changes what it can offer.
|
|
1300
|
+
*/
|
|
1301
|
+
refresh: () => Promise<void>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1304
|
+
*/
|
|
1305
|
+
mount: (target: string | HTMLElement) => void;
|
|
1306
|
+
/**
|
|
1307
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1308
|
+
*/
|
|
1309
|
+
destroy: () => void;
|
|
1310
|
+
/**
|
|
1311
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1312
|
+
*/
|
|
1313
|
+
update: (options: Partial<SendElementProps>) => void;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Options for `create("send")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1318
|
+
* @example
|
|
1319
|
+
* ```ts
|
|
1320
|
+
* const send = wallet.create("send", {}); // this interface: props + on<Event> callbacks
|
|
1321
|
+
* send.mount("#wallet-send");
|
|
1322
|
+
* ```
|
|
1323
|
+
* @see https://docs.whop.com/elements/latest/wallet/send
|
|
1324
|
+
*/
|
|
1325
|
+
export interface SendElementCreateOptions {
|
|
1326
|
+
/**
|
|
1327
|
+
* A scoped token for the privileged read/write — needs `payout:transfer_funds` for direct transfers and `payout:withdraw_funds` for recipient lists (plus `company:authorized_user:read` and `member:basic:read` for recipient search, `airdrop_link:manage` for claim links). Omitted, the read carries the viewer's own session, which only answers same-origin.
|
|
1328
|
+
*/
|
|
1329
|
+
accessToken?: string;
|
|
1330
|
+
/**
|
|
1331
|
+
* Overrides the recipient-picker header. Omitted, the header is "Choose recipient".
|
|
1332
|
+
*/
|
|
1333
|
+
title?: string;
|
|
1334
|
+
/**
|
|
1335
|
+
* Off, only the team/other-account list shows — no search box. For a host that knows the viewer lacks `member:basic:read`.
|
|
1336
|
+
* @default true
|
|
1337
|
+
*/
|
|
1338
|
+
canSearchRecipients?: boolean;
|
|
1339
|
+
/**
|
|
1340
|
+
* Off, the "Send via link" row is hidden. For a host that knows the viewer lacks `airdrop_link:manage`.
|
|
1341
|
+
* @default true
|
|
1342
|
+
*/
|
|
1343
|
+
canCreateLink?: boolean;
|
|
1344
|
+
/**
|
|
1345
|
+
* Skip the picker and open straight onto this recipient's amount screen — for a "pay this person" action row. No back button is shown in that case, matching there being no picker behind it.
|
|
1346
|
+
* @default null
|
|
1347
|
+
*/
|
|
1348
|
+
initialRecipient?: SendRecipient | null;
|
|
1349
|
+
/**
|
|
1350
|
+
* Preselect a currency in the amount screen's picker. Falls back to `currency`, then USD.
|
|
1351
|
+
* @default ""
|
|
1352
|
+
*/
|
|
1353
|
+
initialCurrency?: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* The visible screen changed.
|
|
1356
|
+
*/
|
|
1357
|
+
onStepChanged?: ((payload: { step: "success" | "enter_amount" | "select_recipient" | "create_link" | "link_success"; }) => void);
|
|
1358
|
+
/**
|
|
1359
|
+
* A transfer succeeded. Refresh anything on your side reading the account's balance or activity.
|
|
1360
|
+
*/
|
|
1361
|
+
onSendCompleted?: ((payload: { recipient: SendRecipient; amount: number; currency: string; }) => void);
|
|
1362
|
+
/**
|
|
1363
|
+
* A claim link was created. Refresh anything on your side reading the account's balance.
|
|
1364
|
+
*/
|
|
1365
|
+
onLinkCreated?: ((payload: { claimUrl: string; amount: number; redeemableCount: number; }) => void);
|
|
1366
|
+
/**
|
|
1367
|
+
* The viewer clicked "Done" on a success screen — close the surface holding it.
|
|
1368
|
+
*/
|
|
1369
|
+
onDone?: ((payload: Record<string, never>) => void);
|
|
1370
|
+
/**
|
|
1371
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1372
|
+
*/
|
|
1373
|
+
onLoaderStart?: (() => void);
|
|
1374
|
+
/**
|
|
1375
|
+
* Runs after the element's first complete paint.
|
|
1376
|
+
*/
|
|
1377
|
+
onReady?: (() => void);
|
|
1378
|
+
/**
|
|
1379
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1380
|
+
*/
|
|
1381
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* The overlay handle for "send". Returned by `createOverlay("send")`; drives the modal presentation imperatively.
|
|
1386
|
+
* @see https://docs.whop.com/elements/latest/wallet/send
|
|
1387
|
+
*/
|
|
1388
|
+
export interface SendElementOverlayHandle {
|
|
1389
|
+
/**
|
|
1390
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
1391
|
+
*/
|
|
1392
|
+
open(): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
1395
|
+
*/
|
|
1396
|
+
close(): void;
|
|
1397
|
+
/**
|
|
1398
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1399
|
+
*/
|
|
1400
|
+
destroy(): void;
|
|
1401
|
+
/**
|
|
1402
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1403
|
+
*/
|
|
1404
|
+
update(options: Partial<SendElementProps>): void;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* Consumer props for the "cardDetails" element. Set at create (or as `<CardDetailsElement />` JSX props), and updatable live via `update()`.
|
|
1409
|
+
* @see https://docs.whop.com/elements/latest/wallet/cardDetails
|
|
1410
|
+
*/
|
|
1411
|
+
export interface CardDetailsElementProps {
|
|
1412
|
+
/**
|
|
1413
|
+
* A scoped token for the card and its transactions — needs `payout:account:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
1414
|
+
*/
|
|
1415
|
+
accessToken?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* Non-sensitive card metadata a host has already loaded. Supplying it saves the card face a list request; its authorized secrets are still fetched so the reveal stays instant.
|
|
1418
|
+
*/
|
|
1419
|
+
card?: { status: "active" | "frozen" | "canceled" | "invited" | "denied" | null; name: string | null; id: string; last4: string | null; billing: Billing | null; expiration_month: string | null; expiration_year: string | null; };
|
|
1420
|
+
/**
|
|
1421
|
+
* The card this drawer describes, prefixed `icrd_`.
|
|
1422
|
+
* @default ""
|
|
1423
|
+
*/
|
|
1424
|
+
cardId?: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* How many recent transactions to list under the card.
|
|
1427
|
+
* @default 5
|
|
1428
|
+
*/
|
|
1429
|
+
latestCount?: number;
|
|
1430
|
+
/**
|
|
1431
|
+
* Hide the latest-transactions list, for a host that shows its own beneath the drawer.
|
|
1432
|
+
* @default false
|
|
1433
|
+
*/
|
|
1434
|
+
hideTransactions?: boolean;
|
|
1435
|
+
/**
|
|
1436
|
+
* Hide the overflow button, for a host with no card actions of its own to offer.
|
|
1437
|
+
* @default false
|
|
1438
|
+
*/
|
|
1439
|
+
hideMenuButton?: boolean;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* The live handle for a mounted "cardDetails" element. Returned by `create("cardDetails")`; in React, the component's `ref`.
|
|
1444
|
+
* @see https://docs.whop.com/elements/latest/wallet/cardDetails
|
|
1445
|
+
*/
|
|
1446
|
+
export interface CardDetailsElementHandle {
|
|
1447
|
+
/**
|
|
1448
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1449
|
+
*/
|
|
1450
|
+
mount: (target: string | HTMLElement) => void;
|
|
1451
|
+
/**
|
|
1452
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1453
|
+
*/
|
|
1454
|
+
destroy: () => void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1457
|
+
*/
|
|
1458
|
+
update: (options: Partial<CardDetailsElementProps>) => void;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Options for `create("cardDetails")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1463
|
+
* @example
|
|
1464
|
+
* ```ts
|
|
1465
|
+
* const cardDetails = wallet.createOverlay("cardDetails", {}); // this interface: props + on<Event> callbacks
|
|
1466
|
+
* cardDetails.open();
|
|
1467
|
+
* ```
|
|
1468
|
+
* @see https://docs.whop.com/elements/latest/wallet/cardDetails
|
|
1469
|
+
*/
|
|
1470
|
+
export interface CardDetailsElementCreateOptions {
|
|
1471
|
+
/**
|
|
1472
|
+
* A scoped token for the card and its transactions — needs `payout:account:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
1473
|
+
*/
|
|
1474
|
+
accessToken?: string;
|
|
1475
|
+
/**
|
|
1476
|
+
* Non-sensitive card metadata a host has already loaded. Supplying it saves the card face a list request; its authorized secrets are still fetched so the reveal stays instant.
|
|
1477
|
+
*/
|
|
1478
|
+
card?: { status: "active" | "frozen" | "canceled" | "invited" | "denied" | null; name: string | null; id: string; last4: string | null; billing: Billing | null; expiration_month: string | null; expiration_year: string | null; };
|
|
1479
|
+
/**
|
|
1480
|
+
* The card this drawer describes, prefixed `icrd_`.
|
|
1481
|
+
* @default ""
|
|
1482
|
+
*/
|
|
1483
|
+
cardId?: string;
|
|
1484
|
+
/**
|
|
1485
|
+
* How many recent transactions to list under the card.
|
|
1486
|
+
* @default 5
|
|
1487
|
+
*/
|
|
1488
|
+
latestCount?: number;
|
|
1489
|
+
/**
|
|
1490
|
+
* Hide the latest-transactions list, for a host that shows its own beneath the drawer.
|
|
1491
|
+
* @default false
|
|
1492
|
+
*/
|
|
1493
|
+
hideTransactions?: boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Hide the overflow button, for a host with no card actions of its own to offer.
|
|
1496
|
+
* @default false
|
|
1497
|
+
*/
|
|
1498
|
+
hideMenuButton?: boolean;
|
|
1499
|
+
/**
|
|
1500
|
+
* A transaction in the drawer was pressed.
|
|
1501
|
+
*/
|
|
1502
|
+
onTransactionSelected?: ((payload: { transactionId: string; }) => void);
|
|
1503
|
+
/**
|
|
1504
|
+
* View all was pressed. Open your own full transaction surface — the drawer never navigates.
|
|
1505
|
+
*/
|
|
1506
|
+
onAllTransactionsRequested?: ((payload: { cardId: string; }) => void);
|
|
1507
|
+
/**
|
|
1508
|
+
* Top up was pressed. Present your own funding surface, such as the wallet's deposit element.
|
|
1509
|
+
*/
|
|
1510
|
+
onTopUpRequested?: ((payload: { cardId: string; }) => void);
|
|
1511
|
+
/**
|
|
1512
|
+
* Close was pressed. Dismiss the surface you opened the drawer in — the drawer never closes itself.
|
|
1513
|
+
*/
|
|
1514
|
+
onCloseRequested?: ((payload: { cardId: string; }) => void);
|
|
1515
|
+
/**
|
|
1516
|
+
* The overflow button was pressed. Present your own card actions menu.
|
|
1517
|
+
*/
|
|
1518
|
+
onMenuRequested?: ((payload: { cardId: string; }) => void);
|
|
1519
|
+
/**
|
|
1520
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1521
|
+
*/
|
|
1522
|
+
onLoaderStart?: (() => void);
|
|
1523
|
+
/**
|
|
1524
|
+
* Runs after the element's first complete paint.
|
|
1525
|
+
*/
|
|
1526
|
+
onReady?: (() => void);
|
|
1527
|
+
/**
|
|
1528
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1529
|
+
*/
|
|
1530
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* The overlay handle for "cardDetails". Returned by `createOverlay("cardDetails")`; drives the modal presentation imperatively.
|
|
1535
|
+
* @see https://docs.whop.com/elements/latest/wallet/cardDetails
|
|
1536
|
+
*/
|
|
1537
|
+
export interface CardDetailsElementOverlayHandle {
|
|
1538
|
+
/**
|
|
1539
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
1540
|
+
*/
|
|
1541
|
+
open(): void;
|
|
1542
|
+
/**
|
|
1543
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
1544
|
+
*/
|
|
1545
|
+
close(): void;
|
|
1546
|
+
/**
|
|
1547
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1548
|
+
*/
|
|
1549
|
+
destroy(): void;
|
|
1550
|
+
/**
|
|
1551
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1552
|
+
*/
|
|
1553
|
+
update(options: Partial<CardDetailsElementProps>): void;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Consumer props for the "verification" element. Set at create (or as `<VerificationElement />` JSX props), and updatable live via `update()`.
|
|
1558
|
+
* @see https://docs.whop.com/elements/latest/wallet/verification
|
|
1559
|
+
*/
|
|
1560
|
+
export interface VerificationElementProps {
|
|
1561
|
+
/**
|
|
1562
|
+
* A scoped token for the read and for starting verification — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
1563
|
+
*/
|
|
1564
|
+
accessToken?: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* Which verification the button starts. `individual` (KYC) is what unlocks payouts and a Whop card. `business` (KYB) covers that and additionally unlocks financing and business cards — use it for a company that will need those.
|
|
1567
|
+
* @default "individual"
|
|
1568
|
+
*/
|
|
1569
|
+
kind?: "individual" | "business";
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* The live handle for a mounted "verification" element. Returned by `create("verification")`; in React, the component's `ref`.
|
|
1574
|
+
* @see https://docs.whop.com/elements/latest/wallet/verification
|
|
1575
|
+
*/
|
|
1576
|
+
export interface VerificationElementHandle {
|
|
1577
|
+
/**
|
|
1578
|
+
* Re-read the account. Call it when the viewer returns from verifying so the banner reflects the new state without waiting for the cache to expire.
|
|
1579
|
+
*/
|
|
1580
|
+
refresh: () => Promise<void>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1583
|
+
*/
|
|
1584
|
+
mount: (target: string | HTMLElement) => void;
|
|
1585
|
+
/**
|
|
1586
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1587
|
+
*/
|
|
1588
|
+
destroy: () => void;
|
|
1589
|
+
/**
|
|
1590
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1591
|
+
*/
|
|
1592
|
+
update: (options: Partial<VerificationElementProps>) => void;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Options for `create("verification")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1597
|
+
* @example
|
|
1598
|
+
* ```ts
|
|
1599
|
+
* const verification = wallet.create("verification", {}); // this interface: props + on<Event> callbacks
|
|
1600
|
+
* verification.mount("#wallet-verification");
|
|
1601
|
+
* ```
|
|
1602
|
+
* @see https://docs.whop.com/elements/latest/wallet/verification
|
|
1603
|
+
*/
|
|
1604
|
+
export interface VerificationElementCreateOptions {
|
|
1605
|
+
/**
|
|
1606
|
+
* A scoped token for the read and for starting verification — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
1607
|
+
*/
|
|
1608
|
+
accessToken?: string;
|
|
1609
|
+
/**
|
|
1610
|
+
* Which verification the button starts. `individual` (KYC) is what unlocks payouts and a Whop card. `business` (KYB) covers that and additionally unlocks financing and business cards — use it for a company that will need those.
|
|
1611
|
+
* @default "individual"
|
|
1612
|
+
*/
|
|
1613
|
+
kind?: "individual" | "business";
|
|
1614
|
+
/**
|
|
1615
|
+
* The viewer pressed the verify button. The element never navigates — mount your own verification, such as the `verifications` controller, in answer to this.
|
|
1616
|
+
*/
|
|
1617
|
+
onVerificationRequested?: ((payload: { accountId: string; }) => void);
|
|
1618
|
+
/**
|
|
1619
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1620
|
+
*/
|
|
1621
|
+
onLoaderStart?: (() => void);
|
|
1622
|
+
/**
|
|
1623
|
+
* Runs after the element's first complete paint.
|
|
1624
|
+
*/
|
|
1625
|
+
onReady?: (() => void);
|
|
1626
|
+
/**
|
|
1627
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1628
|
+
*/
|
|
1629
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* Consumer props for the "balances" sub-controller: the `create("balances")` options and the minted sub handle's `update()` payload (React: `<Balances>` props). Parent-injected props never appear here.
|
|
1634
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1635
|
+
*/
|
|
1636
|
+
export interface BalancesSubOptions {
|
|
1637
|
+
/**
|
|
1638
|
+
* A scoped token for balance breakdown and settlement reads. An account needs `company:balance:read`. Omitted, the viewer's same-origin session is used.
|
|
1639
|
+
*/
|
|
1640
|
+
accessToken?: string;
|
|
1641
|
+
/**
|
|
1642
|
+
* Show this unit's holding balance page in place of the chart and list when a row is clicked. Off by default so a host that routes on `balanceSelected` is not covered by a second screen.
|
|
1643
|
+
* @default false
|
|
1644
|
+
*/
|
|
1645
|
+
openHoldingOnSelect?: boolean;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* Consumer props for the "balances" sub-controller's "balance" element.
|
|
1650
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1651
|
+
*/
|
|
1652
|
+
export interface BalanceElementProps {
|
|
1653
|
+
/**
|
|
1654
|
+
* A scoped token for the reads. An account needs `company:balance:read` for the total and `stats:read` for the chart; a user's own balance needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`, and set a fresh one before it expires. Without it the reads use the viewer's own session, which only works same-origin.
|
|
1655
|
+
* @default ""
|
|
1656
|
+
*/
|
|
1657
|
+
accessToken?: string;
|
|
1658
|
+
/**
|
|
1659
|
+
* The time range to open on. The buttons change it from there, or set this prop again to control it yourself.
|
|
1660
|
+
* @default "1M"
|
|
1661
|
+
*/
|
|
1662
|
+
range?: "1D" | "1W" | "1M" | "1Y" | "ALL";
|
|
1663
|
+
/**
|
|
1664
|
+
* When the account was opened, as an ISO 8601 timestamp. `ALL` starts here instead of at its five-year default, so an account older than that keeps its full history.
|
|
1665
|
+
* @default ""
|
|
1666
|
+
*/
|
|
1667
|
+
openedAt?: string;
|
|
1668
|
+
/**
|
|
1669
|
+
* Adds the account name to the label: `Total balance · Acme` normally, and `Acme balance on Jul 9` while the viewer reads a point. Without it the label is just `Total balance`.
|
|
1670
|
+
* @default ""
|
|
1671
|
+
*/
|
|
1672
|
+
accountName?: string;
|
|
1673
|
+
/**
|
|
1674
|
+
* The selected range on the chart, as ISO 8601 timestamps. Set it to control the selection yourself, or `null` to clear the one the viewer made. Echo back what `rangeBrushed` reports, and clearing a filter elsewhere on your page clears the selection here too.
|
|
1675
|
+
* @default null
|
|
1676
|
+
*/
|
|
1677
|
+
brush?: { from: string; to: string; } | null;
|
|
1678
|
+
/**
|
|
1679
|
+
* A moment to mark on the chart, as an ISO 8601 timestamp — the point something else on your page is pointing at, like the row under the pointer in an activity list. It reads like the viewer hovering that point themselves, and is ignored when it falls outside the window on screen or when they are reading the chart.
|
|
1680
|
+
* @default ""
|
|
1681
|
+
*/
|
|
1682
|
+
markedAt?: string;
|
|
1683
|
+
/**
|
|
1684
|
+
* For a user, total their own money plus every account they own instead of their own money alone. Ignored for an account, which is a single account already.
|
|
1685
|
+
* @default false
|
|
1686
|
+
*/
|
|
1687
|
+
includeOwnedAccounts?: boolean;
|
|
1688
|
+
/**
|
|
1689
|
+
* Hide the total and its change, leaving the chart and the range buttons.
|
|
1690
|
+
* @default false
|
|
1691
|
+
*/
|
|
1692
|
+
hideTotal?: boolean;
|
|
1693
|
+
/**
|
|
1694
|
+
* Hide the chart, leaving the total and the range buttons.
|
|
1695
|
+
* @default false
|
|
1696
|
+
*/
|
|
1697
|
+
hideChart?: boolean;
|
|
1698
|
+
/**
|
|
1699
|
+
* How tall the chart is drawn, in pixels.
|
|
1700
|
+
* @default 210
|
|
1701
|
+
*/
|
|
1702
|
+
height?: number;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/**
|
|
1706
|
+
* The live handle for a mounted "balance" element. Returned by the "balances" sub handle's `create("balance")`.
|
|
1707
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1708
|
+
*/
|
|
1709
|
+
export interface BalanceElementHandle {
|
|
1710
|
+
/**
|
|
1711
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1712
|
+
*/
|
|
1713
|
+
mount: (target: string | HTMLElement) => void;
|
|
1714
|
+
/**
|
|
1715
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1716
|
+
*/
|
|
1717
|
+
destroy: () => void;
|
|
1718
|
+
/**
|
|
1719
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1720
|
+
*/
|
|
1721
|
+
update: (options: Partial<BalanceElementProps>) => void;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Options for the "balances" sub handle's `create("balance")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1726
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1727
|
+
*/
|
|
1728
|
+
export interface BalanceElementCreateOptions {
|
|
1729
|
+
/**
|
|
1730
|
+
* A scoped token for the reads. An account needs `company:balance:read` for the total and `stats:read` for the chart; a user's own balance needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`, and set a fresh one before it expires. Without it the reads use the viewer's own session, which only works same-origin.
|
|
1731
|
+
* @default ""
|
|
1732
|
+
*/
|
|
1733
|
+
accessToken?: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* The time range to open on. The buttons change it from there, or set this prop again to control it yourself.
|
|
1736
|
+
* @default "1M"
|
|
1737
|
+
*/
|
|
1738
|
+
range?: "1D" | "1W" | "1M" | "1Y" | "ALL";
|
|
1739
|
+
/**
|
|
1740
|
+
* When the account was opened, as an ISO 8601 timestamp. `ALL` starts here instead of at its five-year default, so an account older than that keeps its full history.
|
|
1741
|
+
* @default ""
|
|
1742
|
+
*/
|
|
1743
|
+
openedAt?: string;
|
|
1744
|
+
/**
|
|
1745
|
+
* Adds the account name to the label: `Total balance · Acme` normally, and `Acme balance on Jul 9` while the viewer reads a point. Without it the label is just `Total balance`.
|
|
1746
|
+
* @default ""
|
|
1747
|
+
*/
|
|
1748
|
+
accountName?: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* The selected range on the chart, as ISO 8601 timestamps. Set it to control the selection yourself, or `null` to clear the one the viewer made. Echo back what `rangeBrushed` reports, and clearing a filter elsewhere on your page clears the selection here too.
|
|
1751
|
+
* @default null
|
|
1752
|
+
*/
|
|
1753
|
+
brush?: { from: string; to: string; } | null;
|
|
1754
|
+
/**
|
|
1755
|
+
* A moment to mark on the chart, as an ISO 8601 timestamp — the point something else on your page is pointing at, like the row under the pointer in an activity list. It reads like the viewer hovering that point themselves, and is ignored when it falls outside the window on screen or when they are reading the chart.
|
|
1756
|
+
* @default ""
|
|
1757
|
+
*/
|
|
1758
|
+
markedAt?: string;
|
|
1759
|
+
/**
|
|
1760
|
+
* For a user, total their own money plus every account they own instead of their own money alone. Ignored for an account, which is a single account already.
|
|
1761
|
+
* @default false
|
|
1762
|
+
*/
|
|
1763
|
+
includeOwnedAccounts?: boolean;
|
|
1764
|
+
/**
|
|
1765
|
+
* Hide the total and its change, leaving the chart and the range buttons.
|
|
1766
|
+
* @default false
|
|
1767
|
+
*/
|
|
1768
|
+
hideTotal?: boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* Hide the chart, leaving the total and the range buttons.
|
|
1771
|
+
* @default false
|
|
1772
|
+
*/
|
|
1773
|
+
hideChart?: boolean;
|
|
1774
|
+
/**
|
|
1775
|
+
* How tall the chart is drawn, in pixels.
|
|
1776
|
+
* @default 210
|
|
1777
|
+
*/
|
|
1778
|
+
height?: number;
|
|
1779
|
+
/**
|
|
1780
|
+
* The visible time range changed. Mirror it if something else on your page reads the same period.
|
|
1781
|
+
*/
|
|
1782
|
+
onRangeChanged?: ((payload: { range: "1D" | "1W" | "1M" | "1Y" | "ALL"; }) => void);
|
|
1783
|
+
/**
|
|
1784
|
+
* The viewer dragged across the chart to select a range, or cleared the selection (`null`). Gives ISO 8601 timestamps plus the range they were read in, so you can filter your own views, like an activity list or a table, to the same period.
|
|
1785
|
+
*/
|
|
1786
|
+
onRangeBrushed?: ((payload: { from: string; to: string; range: "1D" | "1W" | "1M" | "1Y" | "ALL"; } | null) => void);
|
|
1787
|
+
/**
|
|
1788
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1789
|
+
*/
|
|
1790
|
+
onLoaderStart?: (() => void);
|
|
1791
|
+
/**
|
|
1792
|
+
* Runs after the element's first complete paint.
|
|
1793
|
+
*/
|
|
1794
|
+
onReady?: (() => void);
|
|
1795
|
+
/**
|
|
1796
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1797
|
+
*/
|
|
1798
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Consumer props for the "balances" sub-controller's "breakdown" element.
|
|
1803
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1804
|
+
*/
|
|
1805
|
+
export interface BreakdownElementProps {
|
|
1806
|
+
/**
|
|
1807
|
+
* Off, the element performs no reads and renders a zero balance.
|
|
1808
|
+
* @default true
|
|
1809
|
+
*/
|
|
1810
|
+
enabled?: boolean;
|
|
1811
|
+
/**
|
|
1812
|
+
* Show amounts in the selected holding. Turn this off to value the same balance breakdown in USD.
|
|
1813
|
+
* @default true
|
|
1814
|
+
*/
|
|
1815
|
+
showSourceCurrency?: boolean;
|
|
1816
|
+
/**
|
|
1817
|
+
* Show the currency title and total above the rows. Turn this off when the surface around it already shows them.
|
|
1818
|
+
* @default true
|
|
1819
|
+
*/
|
|
1820
|
+
showTotal?: boolean;
|
|
1821
|
+
/**
|
|
1822
|
+
* Draw the surrounding page padding. Turn this off when the surface around it already provides it.
|
|
1823
|
+
* @default true
|
|
1824
|
+
*/
|
|
1825
|
+
padded?: boolean;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* The live handle for a mounted "breakdown" element. Returned by the "balances" sub handle's `create("breakdown")`.
|
|
1830
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1831
|
+
*/
|
|
1832
|
+
export interface BreakdownElementHandle {
|
|
1833
|
+
/**
|
|
1834
|
+
* Re-fetch the balance after the host moves money.
|
|
1835
|
+
*/
|
|
1836
|
+
refresh: () => Promise<void>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1839
|
+
*/
|
|
1840
|
+
mount: (target: string | HTMLElement) => void;
|
|
1841
|
+
/**
|
|
1842
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1843
|
+
*/
|
|
1844
|
+
destroy: () => void;
|
|
1845
|
+
/**
|
|
1846
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1847
|
+
*/
|
|
1848
|
+
update: (options: Partial<BreakdownElementProps>) => void;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Options for the "balances" sub handle's `create("breakdown")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1853
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1854
|
+
*/
|
|
1855
|
+
export interface BreakdownElementCreateOptions {
|
|
1856
|
+
/**
|
|
1857
|
+
* Off, the element performs no reads and renders a zero balance.
|
|
1858
|
+
* @default true
|
|
1859
|
+
*/
|
|
1860
|
+
enabled?: boolean;
|
|
1861
|
+
/**
|
|
1862
|
+
* Show amounts in the selected holding. Turn this off to value the same balance breakdown in USD.
|
|
1863
|
+
* @default true
|
|
1864
|
+
*/
|
|
1865
|
+
showSourceCurrency?: boolean;
|
|
1866
|
+
/**
|
|
1867
|
+
* Show the currency title and total above the rows. Turn this off when the surface around it already shows them.
|
|
1868
|
+
* @default true
|
|
1869
|
+
*/
|
|
1870
|
+
showTotal?: boolean;
|
|
1871
|
+
/**
|
|
1872
|
+
* Draw the surrounding page padding. Turn this off when the surface around it already provides it.
|
|
1873
|
+
* @default true
|
|
1874
|
+
*/
|
|
1875
|
+
padded?: boolean;
|
|
1876
|
+
/**
|
|
1877
|
+
* A balance row or its matching bar segment was clicked. The host can open details for `available`, `pending`, `reserve`, or `debt`.
|
|
1878
|
+
*/
|
|
1879
|
+
onBreakdownSelected?: ((payload: { category: "pending" | "available" | "debt" | "reserve"; }) => void);
|
|
1880
|
+
/**
|
|
1881
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1882
|
+
*/
|
|
1883
|
+
onLoaderStart?: (() => void);
|
|
1884
|
+
/**
|
|
1885
|
+
* Runs after the element's first complete paint.
|
|
1886
|
+
*/
|
|
1887
|
+
onReady?: (() => void);
|
|
1888
|
+
/**
|
|
1889
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1890
|
+
*/
|
|
1891
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* Consumer props for the "balances" sub-controller's "settlement" element.
|
|
1896
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1897
|
+
*/
|
|
1898
|
+
export interface SettlementElementProps {
|
|
1899
|
+
/**
|
|
1900
|
+
* Off, the Element performs no read and renders an empty details state.
|
|
1901
|
+
* @default true
|
|
1902
|
+
*/
|
|
1903
|
+
enabled?: boolean;
|
|
1904
|
+
/**
|
|
1905
|
+
* Show amounts in the selected holding. Turn this off to value the details in USD.
|
|
1906
|
+
* @default true
|
|
1907
|
+
*/
|
|
1908
|
+
showSourceCurrency?: boolean;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
/**
|
|
1912
|
+
* The live handle for a mounted "settlement" element. Returned by the "balances" sub handle's `create("settlement")`.
|
|
1913
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1914
|
+
*/
|
|
1915
|
+
export interface SettlementElementHandle {
|
|
1916
|
+
/**
|
|
1917
|
+
* Re-fetch settlement and reserve details.
|
|
1918
|
+
*/
|
|
1919
|
+
refresh: () => Promise<void>;
|
|
1920
|
+
/**
|
|
1921
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1922
|
+
*/
|
|
1923
|
+
mount: (target: string | HTMLElement) => void;
|
|
1924
|
+
/**
|
|
1925
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1926
|
+
*/
|
|
1927
|
+
destroy: () => void;
|
|
1928
|
+
/**
|
|
1929
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1930
|
+
*/
|
|
1931
|
+
update: (options: Partial<SettlementElementProps>) => void;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* Options for the "balances" sub handle's `create("settlement")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1936
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1937
|
+
*/
|
|
1938
|
+
export interface SettlementElementCreateOptions {
|
|
1939
|
+
/**
|
|
1940
|
+
* Off, the Element performs no read and renders an empty details state.
|
|
1941
|
+
* @default true
|
|
1942
|
+
*/
|
|
1943
|
+
enabled?: boolean;
|
|
1944
|
+
/**
|
|
1945
|
+
* Show amounts in the selected holding. Turn this off to value the details in USD.
|
|
1946
|
+
* @default true
|
|
1947
|
+
*/
|
|
1948
|
+
showSourceCurrency?: boolean;
|
|
1949
|
+
/**
|
|
1950
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1951
|
+
*/
|
|
1952
|
+
onLoaderStart?: (() => void);
|
|
1953
|
+
/**
|
|
1954
|
+
* Runs after the element's first complete paint.
|
|
1955
|
+
*/
|
|
1956
|
+
onReady?: (() => void);
|
|
1957
|
+
/**
|
|
1958
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
1959
|
+
*/
|
|
1960
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* The overlay handle for the "balances" sub-controller's "settlement" element.
|
|
1965
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1966
|
+
*/
|
|
1967
|
+
export interface SettlementElementOverlayHandle {
|
|
1968
|
+
/**
|
|
1969
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
1970
|
+
*/
|
|
1971
|
+
open(): void;
|
|
1972
|
+
/**
|
|
1973
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
1974
|
+
*/
|
|
1975
|
+
close(): void;
|
|
1976
|
+
/**
|
|
1977
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
1978
|
+
*/
|
|
1979
|
+
destroy(): void;
|
|
1980
|
+
/**
|
|
1981
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1982
|
+
*/
|
|
1983
|
+
update(options: Partial<SettlementElementProps>): void;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* Consumer props for the "balances" sub-controller's "list" element.
|
|
1988
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1989
|
+
*/
|
|
1990
|
+
export interface ListElementProps {
|
|
1991
|
+
/**
|
|
1992
|
+
* A scoped token for the read. An account needs `company:balance:read`; a user's holdings or owned-account list needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`. Without it the read uses the viewer's own session, which only works same-origin.
|
|
1993
|
+
*/
|
|
1994
|
+
accessToken?: string;
|
|
1995
|
+
/**
|
|
1996
|
+
* For a user's `user_…` account, list their personal balance followed by every owned account the backend returns instead of listing the holdings inside their personal account. Ignored for an account.
|
|
1997
|
+
* @default false
|
|
1998
|
+
*/
|
|
1999
|
+
includeOwnedAccounts?: boolean;
|
|
2000
|
+
/**
|
|
2001
|
+
* Show each row in the currency it is held in (€4.20, 0.00000009 cbBTC) and put the dollar value underneath. Off by default, so every row is in dollars.
|
|
2002
|
+
* @default false
|
|
2003
|
+
*/
|
|
2004
|
+
showSourceCurrency?: boolean;
|
|
2005
|
+
/**
|
|
2006
|
+
* Keep the dollar value under a holding shown in its own currency. Only applies when `showSourceCurrency` is on.
|
|
2007
|
+
* @default true
|
|
2008
|
+
*/
|
|
2009
|
+
showUsdEquivalent?: boolean;
|
|
2010
|
+
/**
|
|
2011
|
+
* Keep the personal row when `includeOwnedAccounts` is on. Turn it off if your app has no personal account to open.
|
|
2012
|
+
* @default true
|
|
2013
|
+
*/
|
|
2014
|
+
showPersonalAccount?: boolean;
|
|
2015
|
+
/**
|
|
2016
|
+
* Show at most this many holding rows, largest first. When there are more, the list gains a Show all balances control that expands the rest in place. Without it every holding is listed.
|
|
2017
|
+
*/
|
|
2018
|
+
maxItems?: number;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
/**
|
|
2022
|
+
* The live handle for a mounted "list" element. Returned by the "balances" sub handle's `create("list")`.
|
|
2023
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2024
|
+
*/
|
|
2025
|
+
export interface ListElementHandle {
|
|
2026
|
+
/**
|
|
2027
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
2028
|
+
*/
|
|
2029
|
+
mount: (target: string | HTMLElement) => void;
|
|
2030
|
+
/**
|
|
2031
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
2032
|
+
*/
|
|
2033
|
+
destroy: () => void;
|
|
2034
|
+
/**
|
|
2035
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
693
2036
|
*/
|
|
694
|
-
|
|
2037
|
+
update: (options: Partial<ListElementProps>) => void;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* Options for the "balances" sub handle's `create("list")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
2042
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2043
|
+
*/
|
|
2044
|
+
export interface ListElementCreateOptions {
|
|
695
2045
|
/**
|
|
696
|
-
* A
|
|
2046
|
+
* A scoped token for the read. An account needs `company:balance:read`; a user's holdings or owned-account list needs `user:balance:read`. Mint it on your server with `POST /api/v1/access_tokens`. Without it the read uses the viewer's own session, which only works same-origin.
|
|
697
2047
|
*/
|
|
698
|
-
|
|
2048
|
+
accessToken?: string;
|
|
699
2049
|
/**
|
|
700
|
-
*
|
|
2050
|
+
* For a user's `user_…` account, list their personal balance followed by every owned account the backend returns instead of listing the holdings inside their personal account. Ignored for an account.
|
|
2051
|
+
* @default false
|
|
701
2052
|
*/
|
|
702
|
-
|
|
2053
|
+
includeOwnedAccounts?: boolean;
|
|
703
2054
|
/**
|
|
704
|
-
*
|
|
2055
|
+
* Show each row in the currency it is held in (€4.20, 0.00000009 cbBTC) and put the dollar value underneath. Off by default, so every row is in dollars.
|
|
2056
|
+
* @default false
|
|
705
2057
|
*/
|
|
706
|
-
|
|
2058
|
+
showSourceCurrency?: boolean;
|
|
707
2059
|
/**
|
|
708
|
-
*
|
|
2060
|
+
* Keep the dollar value under a holding shown in its own currency. Only applies when `showSourceCurrency` is on.
|
|
2061
|
+
* @default true
|
|
709
2062
|
*/
|
|
710
|
-
|
|
2063
|
+
showUsdEquivalent?: boolean;
|
|
711
2064
|
/**
|
|
712
|
-
*
|
|
2065
|
+
* Keep the personal row when `includeOwnedAccounts` is on. Turn it off if your app has no personal account to open.
|
|
2066
|
+
* @default true
|
|
713
2067
|
*/
|
|
714
|
-
|
|
2068
|
+
showPersonalAccount?: boolean;
|
|
715
2069
|
/**
|
|
716
|
-
*
|
|
2070
|
+
* Show at most this many holding rows, largest first. When there are more, the list gains a Show all balances control that expands the rest in place. Without it every holding is listed.
|
|
717
2071
|
*/
|
|
718
|
-
|
|
2072
|
+
maxItems?: number;
|
|
719
2073
|
/**
|
|
720
|
-
*
|
|
2074
|
+
* A holding row was clicked, with `includeOwnedAccounts` off. `holding` is `usd` for the combined dollar row, otherwise the holding symbol (`cbBTC`, `EUR`), and `kind` tells you which of the three it is so you can route without classifying symbols yourself. The element never navigates.
|
|
721
2075
|
*/
|
|
722
|
-
|
|
2076
|
+
onBalanceSelected?: ((payload: { holding: string; kind: "usd" | "cash" | "asset"; }) => void);
|
|
723
2077
|
/**
|
|
724
|
-
*
|
|
2078
|
+
* An account row was clicked, with `includeOwnedAccounts` on. `accountId` is the personal `user_…` tag or an owned `biz_…` tag, and `kind` lets you route without inspecting it. The element never navigates.
|
|
725
2079
|
*/
|
|
726
|
-
|
|
2080
|
+
onAccountSelected?: ((payload: { accountId: string; kind: "business" | "personal"; }) => void);
|
|
727
2081
|
/**
|
|
728
2082
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
729
2083
|
*/
|
|
@@ -739,66 +2093,85 @@ export interface WithdrawElementCreateOptions {
|
|
|
739
2093
|
}
|
|
740
2094
|
|
|
741
2095
|
/**
|
|
742
|
-
* The
|
|
743
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
2096
|
+
* The "balances" sub-handle, minted by `handle.create("balances", …)`. Mounts the sub-controller's elements and carries its actions.
|
|
2097
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
744
2098
|
*/
|
|
745
|
-
export interface
|
|
2099
|
+
export interface BalancesSubHandle {
|
|
746
2100
|
/**
|
|
747
|
-
*
|
|
2101
|
+
* An account's balance and a chart of how it changed. The total and its change sit at the top, the chart below that, and the time range buttons at the bottom. The viewer can read individual points on the chart and switch the time range themselves.
|
|
748
2102
|
*/
|
|
749
|
-
|
|
2103
|
+
create(name: "balance", options?: BalanceElementCreateOptions): BalanceElementHandle;
|
|
750
2104
|
/**
|
|
751
|
-
*
|
|
2105
|
+
* One currency's total split into available, pending, reserve, and negative balances. Zero-value rows disappear, and the surface deliberately contains no money-movement buttons so the host owns those actions.
|
|
752
2106
|
*/
|
|
753
|
-
|
|
2107
|
+
create(name: "breakdown", options?: BreakdownElementCreateOptions): BreakdownElementHandle;
|
|
754
2108
|
/**
|
|
755
|
-
*
|
|
2109
|
+
* The account balance details shown by Whop's dashboard: available funds, pending settlement dates, reserve terms, and any negative balance. It opens as a 550px modal and uses the balances handle's account, currency, and credential.
|
|
756
2110
|
*/
|
|
757
|
-
|
|
2111
|
+
createOverlay(name: "settlement", options?: SettlementElementCreateOptions): SettlementElementOverlayHandle;
|
|
758
2112
|
/**
|
|
759
|
-
*
|
|
2113
|
+
* The holdings behind an account's balance. Every currency and token gets its own row, showing its name and its value in dollars, largest first. Rows can report which one the viewer tapped, so you can open your own screen for it. When `openHoldingOnSelect` is on, a row click shows that holding's balance page in place of this unit's chart and list.
|
|
760
2114
|
*/
|
|
761
|
-
|
|
2115
|
+
create(name: "list", options?: ListElementCreateOptions): ListElementHandle;
|
|
2116
|
+
/**
|
|
2117
|
+
* Merges new props and callbacks into the sub-controller.
|
|
2118
|
+
*/
|
|
2119
|
+
update(options: Partial<BalancesSubOptions>): void;
|
|
2120
|
+
/**
|
|
2121
|
+
* Destroys the sub-controller and its elements, then frees its exclusive slot. A later `create("balances")` starts fresh.
|
|
2122
|
+
*/
|
|
2123
|
+
destroy(): void;
|
|
762
2124
|
}
|
|
763
2125
|
|
|
764
2126
|
/**
|
|
765
|
-
* Consumer props for the "
|
|
766
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
2127
|
+
* Consumer props for the "cards" sub-controller: the `create("cards")` options and the minted sub handle's `update()` payload (React: `<Cards>` props). Parent-injected props never appear here.
|
|
2128
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
767
2129
|
*/
|
|
768
|
-
export interface
|
|
2130
|
+
export interface CardsSubOptions {
|
|
769
2131
|
/**
|
|
770
|
-
* A scoped token for the
|
|
2132
|
+
* A scoped token for the card reads. Card rows need `payout:account:read`; cardholder names also need `company:authorized_user:read`. Omitted, the viewer's same-origin session is used, which only answers same-origin.
|
|
771
2133
|
*/
|
|
772
2134
|
accessToken?: string;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Consumer props for the "cards" sub-controller's "cards" element.
|
|
2139
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2140
|
+
*/
|
|
2141
|
+
export interface CardsElementProps {
|
|
773
2142
|
/**
|
|
774
|
-
*
|
|
775
|
-
* @default true
|
|
2143
|
+
* A scoped token for the privileged read and verification start — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
776
2144
|
*/
|
|
777
|
-
|
|
2145
|
+
accessToken?: string;
|
|
778
2146
|
/**
|
|
779
|
-
* Off, the
|
|
2147
|
+
* Off, the element fetches nothing and keeps the title and "+" button visible with an empty body — for a host that only wants to fetch once some precondition (card issuing being active for this account, say) is true.
|
|
780
2148
|
* @default true
|
|
781
2149
|
*/
|
|
782
|
-
|
|
2150
|
+
enabled?: boolean;
|
|
783
2151
|
/**
|
|
784
|
-
*
|
|
2152
|
+
* Cap the rows shown, most recently issued first. `null` shows every active card.
|
|
785
2153
|
* @default null
|
|
786
2154
|
*/
|
|
787
|
-
|
|
2155
|
+
limit?: number | null;
|
|
788
2156
|
/**
|
|
789
|
-
*
|
|
790
|
-
* @default
|
|
2157
|
+
* Render the title as plain, unclickable text instead of a click target. Off by default, in which case clicking the title emits `viewAllSelected` for you to route to the full cards list — the element never navigates.
|
|
2158
|
+
* @default false
|
|
791
2159
|
*/
|
|
792
|
-
|
|
2160
|
+
disableRedirect?: boolean;
|
|
2161
|
+
/**
|
|
2162
|
+
* Hide the "+" button. Off by default, in which case clicking it emits `addCardRequested`.
|
|
2163
|
+
* @default false
|
|
2164
|
+
*/
|
|
2165
|
+
hideAddButton?: boolean;
|
|
793
2166
|
}
|
|
794
2167
|
|
|
795
2168
|
/**
|
|
796
|
-
* The live handle for a mounted "
|
|
797
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
2169
|
+
* The live handle for a mounted "cards" element. Returned by the "cards" sub handle's `create("cards")`.
|
|
2170
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
798
2171
|
*/
|
|
799
|
-
export interface
|
|
2172
|
+
export interface CardsElementHandle {
|
|
800
2173
|
/**
|
|
801
|
-
* Re-fetch the account's
|
|
2174
|
+
* Re-fetch the account's cards. Call it after a mutation made elsewhere (rename, freeze, cancel, a new card) so the list reflects it without waiting for the cache to expire.
|
|
802
2175
|
*/
|
|
803
2176
|
refresh: () => Promise<void>;
|
|
804
2177
|
/**
|
|
@@ -812,59 +2185,54 @@ export interface SendElementHandle {
|
|
|
812
2185
|
/**
|
|
813
2186
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
814
2187
|
*/
|
|
815
|
-
update: (options: Partial<
|
|
2188
|
+
update: (options: Partial<CardsElementProps>) => void;
|
|
816
2189
|
}
|
|
817
2190
|
|
|
818
2191
|
/**
|
|
819
|
-
* Options for `create("
|
|
820
|
-
* @
|
|
821
|
-
* ```ts
|
|
822
|
-
* const send = wallet.create("send", {}); // this interface: props + on<Event> callbacks
|
|
823
|
-
* send.mount("#wallet-send");
|
|
824
|
-
* ```
|
|
825
|
-
* @see https://docs.whop.com/elements/latest/wallet/send
|
|
2192
|
+
* Options for the "cards" sub handle's `create("cards")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
2193
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
826
2194
|
*/
|
|
827
|
-
export interface
|
|
2195
|
+
export interface CardsElementCreateOptions {
|
|
828
2196
|
/**
|
|
829
|
-
* A scoped token for the privileged read
|
|
2197
|
+
* A scoped token for the privileged read and verification start — needs `payout:account:read` and `identity:write`. Mint it on your server with `POST /api/v1/access_tokens`. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
830
2198
|
*/
|
|
831
2199
|
accessToken?: string;
|
|
832
2200
|
/**
|
|
833
|
-
* Off,
|
|
2201
|
+
* Off, the element fetches nothing and keeps the title and "+" button visible with an empty body — for a host that only wants to fetch once some precondition (card issuing being active for this account, say) is true.
|
|
834
2202
|
* @default true
|
|
835
2203
|
*/
|
|
836
|
-
|
|
2204
|
+
enabled?: boolean;
|
|
837
2205
|
/**
|
|
838
|
-
*
|
|
839
|
-
* @default
|
|
2206
|
+
* Cap the rows shown, most recently issued first. `null` shows every active card.
|
|
2207
|
+
* @default null
|
|
840
2208
|
*/
|
|
841
|
-
|
|
2209
|
+
limit?: number | null;
|
|
842
2210
|
/**
|
|
843
|
-
*
|
|
844
|
-
* @default
|
|
2211
|
+
* Render the title as plain, unclickable text instead of a click target. Off by default, in which case clicking the title emits `viewAllSelected` for you to route to the full cards list — the element never navigates.
|
|
2212
|
+
* @default false
|
|
845
2213
|
*/
|
|
846
|
-
|
|
2214
|
+
disableRedirect?: boolean;
|
|
847
2215
|
/**
|
|
848
|
-
*
|
|
849
|
-
* @default
|
|
2216
|
+
* Hide the "+" button. Off by default, in which case clicking it emits `addCardRequested`.
|
|
2217
|
+
* @default false
|
|
850
2218
|
*/
|
|
851
|
-
|
|
2219
|
+
hideAddButton?: boolean;
|
|
852
2220
|
/**
|
|
853
|
-
*
|
|
2221
|
+
* A card row was clicked. Open your own card details for it — the element never navigates.
|
|
854
2222
|
*/
|
|
855
|
-
|
|
2223
|
+
onCardSelected?: ((payload: { cardId: string; }) => void);
|
|
856
2224
|
/**
|
|
857
|
-
*
|
|
2225
|
+
* The title was clicked. Only fires when `disableRedirect` is false.
|
|
858
2226
|
*/
|
|
859
|
-
|
|
2227
|
+
onViewAllSelected?: ((payload: Record<string, never>) => void);
|
|
860
2228
|
/**
|
|
861
|
-
*
|
|
2229
|
+
* The "+" button was clicked. Only fires when `hideAddButton` is false.
|
|
862
2230
|
*/
|
|
863
|
-
|
|
2231
|
+
onAddCardRequested?: ((payload: Record<string, never>) => void);
|
|
864
2232
|
/**
|
|
865
|
-
* The viewer
|
|
2233
|
+
* The viewer pressed the verify button on an account with no card program. The element starts the hosted session and leaves for it itself — this fires alongside, so a host can record the trip or show its own state.
|
|
866
2234
|
*/
|
|
867
|
-
|
|
2235
|
+
onVerificationRequested?: ((payload: { accountId: string; }) => void);
|
|
868
2236
|
/**
|
|
869
2237
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
870
2238
|
*/
|
|
@@ -880,132 +2248,171 @@ export interface SendElementCreateOptions {
|
|
|
880
2248
|
}
|
|
881
2249
|
|
|
882
2250
|
/**
|
|
883
|
-
*
|
|
884
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
2251
|
+
* Consumer props for the "cards" sub-controller's "cardsTable" element.
|
|
2252
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
885
2253
|
*/
|
|
886
|
-
export interface
|
|
2254
|
+
export interface CardsTableElementProps {
|
|
887
2255
|
/**
|
|
888
|
-
*
|
|
2256
|
+
* A scoped token for the privileged reads. Card rows need `payout:account:read`; cardholder names also need `company:authorized_user:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
889
2257
|
*/
|
|
890
|
-
|
|
2258
|
+
accessToken?: string;
|
|
891
2259
|
/**
|
|
892
|
-
*
|
|
2260
|
+
* Off, the element does not fetch and renders its shell with no card rows.
|
|
2261
|
+
* @default true
|
|
893
2262
|
*/
|
|
894
|
-
|
|
2263
|
+
enabled?: boolean;
|
|
2264
|
+
/**
|
|
2265
|
+
* Hide the create virtual card button. Off by default.
|
|
2266
|
+
* @default false
|
|
2267
|
+
*/
|
|
2268
|
+
hideCreateButton?: boolean;
|
|
2269
|
+
/**
|
|
2270
|
+
* Show last month's spend. Turn this off when the viewer may see cards but not account financials.
|
|
2271
|
+
* @default true
|
|
2272
|
+
*/
|
|
2273
|
+
showFinancials?: boolean;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
/**
|
|
2277
|
+
* The live handle for a mounted "cardsTable" element. Returned by the "cards" sub handle's `create("cardsTable")`.
|
|
2278
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2279
|
+
*/
|
|
2280
|
+
export interface CardsTableElementHandle {
|
|
2281
|
+
/**
|
|
2282
|
+
* Re-fetch the cards and cardholders after the host creates, freezes, cancels, or renames a card.
|
|
2283
|
+
*/
|
|
2284
|
+
refresh: () => Promise<void>;
|
|
2285
|
+
/**
|
|
2286
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
2287
|
+
*/
|
|
2288
|
+
mount: (target: string | HTMLElement) => void;
|
|
895
2289
|
/**
|
|
896
2290
|
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
897
2291
|
*/
|
|
898
|
-
destroy()
|
|
2292
|
+
destroy: () => void;
|
|
899
2293
|
/**
|
|
900
2294
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
901
2295
|
*/
|
|
902
|
-
update(options: Partial<
|
|
2296
|
+
update: (options: Partial<CardsTableElementProps>) => void;
|
|
903
2297
|
}
|
|
904
2298
|
|
|
905
2299
|
/**
|
|
906
|
-
*
|
|
907
|
-
* @see https://docs.whop.com/elements/latest/wallet/
|
|
2300
|
+
* Options for the "cards" sub handle's `create("cardsTable")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
2301
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
908
2302
|
*/
|
|
909
|
-
export interface
|
|
2303
|
+
export interface CardsTableElementCreateOptions {
|
|
910
2304
|
/**
|
|
911
|
-
* A scoped token for the privileged
|
|
2305
|
+
* A scoped token for the privileged reads. Card rows need `payout:account:read`; cardholder names also need `company:authorized_user:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
912
2306
|
*/
|
|
913
2307
|
accessToken?: string;
|
|
914
2308
|
/**
|
|
915
|
-
* Off, the element
|
|
2309
|
+
* Off, the element does not fetch and renders its shell with no card rows.
|
|
916
2310
|
* @default true
|
|
917
2311
|
*/
|
|
918
2312
|
enabled?: boolean;
|
|
919
2313
|
/**
|
|
920
|
-
*
|
|
921
|
-
* @default
|
|
2314
|
+
* Hide the create virtual card button. Off by default.
|
|
2315
|
+
* @default false
|
|
922
2316
|
*/
|
|
923
|
-
|
|
2317
|
+
hideCreateButton?: boolean;
|
|
924
2318
|
/**
|
|
925
|
-
*
|
|
926
|
-
* @default
|
|
2319
|
+
* Show last month's spend. Turn this off when the viewer may see cards but not account financials.
|
|
2320
|
+
* @default true
|
|
927
2321
|
*/
|
|
928
|
-
|
|
2322
|
+
showFinancials?: boolean;
|
|
929
2323
|
/**
|
|
930
|
-
*
|
|
931
|
-
* @default false
|
|
2324
|
+
* A row was clicked. Open the host-owned card details experience for this card.
|
|
932
2325
|
*/
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* The live handle for a mounted "cards" element. Returned by `create("cards")`; in React, the component's `ref`.
|
|
938
|
-
* @see https://docs.whop.com/elements/latest/wallet/cards
|
|
939
|
-
*/
|
|
940
|
-
export interface CardsElementHandle {
|
|
2326
|
+
onCardSelected?: ((payload: { cardId: string; }) => void);
|
|
941
2327
|
/**
|
|
942
|
-
*
|
|
2328
|
+
* The create virtual card button was clicked.
|
|
943
2329
|
*/
|
|
944
|
-
|
|
2330
|
+
onCreateCardRequested?: ((payload: Record<string, never>) => void);
|
|
945
2331
|
/**
|
|
946
|
-
*
|
|
2332
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
947
2333
|
*/
|
|
948
|
-
|
|
2334
|
+
onLoaderStart?: (() => void);
|
|
949
2335
|
/**
|
|
950
|
-
*
|
|
2336
|
+
* Runs after the element's first complete paint.
|
|
951
2337
|
*/
|
|
952
|
-
|
|
2338
|
+
onReady?: (() => void);
|
|
953
2339
|
/**
|
|
954
|
-
*
|
|
2340
|
+
* Runs when the element fails to load or crashes. The fallback remains visible. Use `code` for programmatic handling. `sourceKey` identifies a failed host-state source.
|
|
955
2341
|
*/
|
|
956
|
-
|
|
2342
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
957
2343
|
}
|
|
958
2344
|
|
|
959
2345
|
/**
|
|
960
|
-
*
|
|
961
|
-
* @
|
|
962
|
-
* ```ts
|
|
963
|
-
* const cards = wallet.create("cards", {}); // this interface: props + on<Event> callbacks
|
|
964
|
-
* cards.mount("#wallet-cards");
|
|
965
|
-
* ```
|
|
966
|
-
* @see https://docs.whop.com/elements/latest/wallet/cards
|
|
2346
|
+
* Consumer props for the "cards" sub-controller's "cardsChart" element.
|
|
2347
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
967
2348
|
*/
|
|
968
|
-
export interface
|
|
2349
|
+
export interface CardsChartElementProps {
|
|
969
2350
|
/**
|
|
970
|
-
* A scoped token for
|
|
2351
|
+
* A scoped token for card transaction reads. Needs `payout:account:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
971
2352
|
*/
|
|
972
2353
|
accessToken?: string;
|
|
973
2354
|
/**
|
|
974
|
-
* Off, the
|
|
2355
|
+
* Off, the chart performs no reads and renders an empty plot.
|
|
975
2356
|
* @default true
|
|
976
2357
|
*/
|
|
977
2358
|
enabled?: boolean;
|
|
978
2359
|
/**
|
|
979
|
-
*
|
|
980
|
-
* @default
|
|
2360
|
+
* The initial reporting window: `7d`, `1m`, `3m`, `ytd`, or `1y`.
|
|
2361
|
+
* @default "1m"
|
|
981
2362
|
*/
|
|
982
|
-
|
|
2363
|
+
period?: "7d" | "1m" | "3m" | "ytd" | "1y";
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* The live handle for a mounted "cardsChart" element. Returned by the "cards" sub handle's `create("cardsChart")`.
|
|
2368
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2369
|
+
*/
|
|
2370
|
+
export interface CardsChartElementHandle {
|
|
983
2371
|
/**
|
|
984
|
-
*
|
|
985
|
-
* @default false
|
|
2372
|
+
* Re-fetch the selected spend window.
|
|
986
2373
|
*/
|
|
987
|
-
|
|
2374
|
+
refresh: () => Promise<void>;
|
|
2375
|
+
/**
|
|
2376
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
2377
|
+
*/
|
|
2378
|
+
mount: (target: string | HTMLElement) => void;
|
|
2379
|
+
/**
|
|
2380
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
2381
|
+
*/
|
|
2382
|
+
destroy: () => void;
|
|
2383
|
+
/**
|
|
2384
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
2385
|
+
*/
|
|
2386
|
+
update: (options: Partial<CardsChartElementProps>) => void;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* Options for the "cards" sub handle's `create("cardsChart")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
2391
|
+
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
2392
|
+
*/
|
|
2393
|
+
export interface CardsChartElementCreateOptions {
|
|
988
2394
|
/**
|
|
989
|
-
*
|
|
990
|
-
* @default false
|
|
2395
|
+
* A scoped token for card transaction reads. Needs `payout:account:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
991
2396
|
*/
|
|
992
|
-
|
|
2397
|
+
accessToken?: string;
|
|
993
2398
|
/**
|
|
994
|
-
*
|
|
2399
|
+
* Off, the chart performs no reads and renders an empty plot.
|
|
2400
|
+
* @default true
|
|
995
2401
|
*/
|
|
996
|
-
|
|
2402
|
+
enabled?: boolean;
|
|
997
2403
|
/**
|
|
998
|
-
* The
|
|
2404
|
+
* The initial reporting window: `7d`, `1m`, `3m`, `ytd`, or `1y`.
|
|
2405
|
+
* @default "1m"
|
|
999
2406
|
*/
|
|
1000
|
-
|
|
2407
|
+
period?: "7d" | "1m" | "3m" | "ytd" | "1y";
|
|
1001
2408
|
/**
|
|
1002
|
-
* The
|
|
2409
|
+
* The viewer selected a new reporting window. The chart has already updated itself.
|
|
1003
2410
|
*/
|
|
1004
|
-
|
|
2411
|
+
onPeriodChanged?: ((payload: { period: "7d" | "1m" | "3m" | "ytd" | "1y"; }) => void);
|
|
1005
2412
|
/**
|
|
1006
|
-
* The viewer
|
|
2413
|
+
* The viewer selected or cleared a daily bar. Dates use `YYYY-MM-DD` in UTC.
|
|
1007
2414
|
*/
|
|
1008
|
-
|
|
2415
|
+
onDateSelected?: ((payload: { date: string | null; }) => void);
|
|
1009
2416
|
/**
|
|
1010
2417
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1011
2418
|
*/
|
|
@@ -1021,73 +2428,46 @@ export interface CardsElementCreateOptions {
|
|
|
1021
2428
|
}
|
|
1022
2429
|
|
|
1023
2430
|
/**
|
|
1024
|
-
* Consumer props for the "
|
|
1025
|
-
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1026
|
-
*/
|
|
1027
|
-
export interface BalancesSubOptions {}
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Consumer props for the "balances" sub-controller's "balance" element.
|
|
2431
|
+
* Consumer props for the "cards" sub-controller's "whopCard" element.
|
|
1031
2432
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1032
2433
|
*/
|
|
1033
|
-
export interface
|
|
2434
|
+
export interface WhopCardElementProps {
|
|
1034
2435
|
/**
|
|
1035
|
-
* A scoped token for
|
|
1036
|
-
* @default ""
|
|
2436
|
+
* A scoped token for card access. Omitted calls carry the viewer session when same-origin. Secrets are returned only when the API authorizes the viewer.
|
|
1037
2437
|
*/
|
|
1038
2438
|
accessToken?: string;
|
|
1039
2439
|
/**
|
|
1040
|
-
*
|
|
1041
|
-
* @default "1M"
|
|
1042
|
-
*/
|
|
1043
|
-
range?: "1D" | "1W" | "1M" | "1Y" | "ALL";
|
|
1044
|
-
/**
|
|
1045
|
-
* When the account was opened, as an ISO 8601 timestamp. `ALL` starts here instead of at its five-year default, so an account older than that keeps its full history.
|
|
1046
|
-
* @default ""
|
|
1047
|
-
*/
|
|
1048
|
-
openedAt?: string;
|
|
1049
|
-
/**
|
|
1050
|
-
* Adds the account name to the label: `Total balance · Acme` normally, and `Acme balance on Jul 9` while the viewer reads a point. Without it the label is just `Total balance`.
|
|
1051
|
-
* @default ""
|
|
1052
|
-
*/
|
|
1053
|
-
accountName?: string;
|
|
1054
|
-
/**
|
|
1055
|
-
* The selected range on the chart, as ISO 8601 timestamps. Set it to control the selection yourself, or `null` to clear the one the viewer made. Echo back what `rangeBrushed` reports, and clearing a filter elsewhere on your page clears the selection here too.
|
|
1056
|
-
* @default null
|
|
1057
|
-
*/
|
|
1058
|
-
brush?: { from: string; to: string; } | null;
|
|
1059
|
-
/**
|
|
1060
|
-
* A moment to mark on the chart, as an ISO 8601 timestamp — the point something else on your page is pointing at, like the row under the pointer in an activity list. It reads like the viewer hovering that point themselves, and is ignored when it falls outside the window on screen or when they are reading the chart.
|
|
2440
|
+
* Issued card ID, prefixed `icrd_`.
|
|
1061
2441
|
* @default ""
|
|
1062
2442
|
*/
|
|
1063
|
-
|
|
2443
|
+
cardId?: string;
|
|
1064
2444
|
/**
|
|
1065
|
-
*
|
|
2445
|
+
* Hide the View details and Lock card buttons. The card itself remains clickable to reveal details.
|
|
1066
2446
|
* @default false
|
|
1067
2447
|
*/
|
|
1068
|
-
|
|
2448
|
+
hideControls?: boolean;
|
|
1069
2449
|
/**
|
|
1070
|
-
*
|
|
2450
|
+
* Disable the lock control while keeping it visible. Useful when a host has temporarily frozen card actions.
|
|
1071
2451
|
* @default false
|
|
1072
2452
|
*/
|
|
1073
|
-
|
|
2453
|
+
disableLock?: boolean;
|
|
1074
2454
|
/**
|
|
1075
|
-
* Hide the
|
|
2455
|
+
* Hide the Add to Apple Wallet button. It is shown for active and locked cards by default.
|
|
1076
2456
|
* @default false
|
|
1077
2457
|
*/
|
|
1078
|
-
|
|
2458
|
+
hideAppleWalletButton?: boolean;
|
|
1079
2459
|
/**
|
|
1080
|
-
*
|
|
1081
|
-
* @default
|
|
2460
|
+
* Direct-mode integration option. Emits `lockRequested` without updating the card so a first-party host can retain its confirmation flow.
|
|
2461
|
+
* @default false
|
|
1082
2462
|
*/
|
|
1083
|
-
|
|
2463
|
+
deferLockToHost?: boolean;
|
|
1084
2464
|
}
|
|
1085
2465
|
|
|
1086
2466
|
/**
|
|
1087
|
-
* The live handle for a mounted "
|
|
2467
|
+
* The live handle for a mounted "whopCard" element. Returned by the "cards" sub handle's `create("whopCard")`.
|
|
1088
2468
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1089
2469
|
*/
|
|
1090
|
-
export interface
|
|
2470
|
+
export interface WhopCardElementHandle {
|
|
1091
2471
|
/**
|
|
1092
2472
|
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1093
2473
|
*/
|
|
@@ -1099,72 +2479,59 @@ export interface BalanceElementHandle {
|
|
|
1099
2479
|
/**
|
|
1100
2480
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1101
2481
|
*/
|
|
1102
|
-
update: (options: Partial<
|
|
2482
|
+
update: (options: Partial<WhopCardElementProps>) => void;
|
|
1103
2483
|
}
|
|
1104
2484
|
|
|
1105
2485
|
/**
|
|
1106
|
-
* Options for the "
|
|
2486
|
+
* Options for the "cards" sub handle's `create("whopCard")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1107
2487
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1108
2488
|
*/
|
|
1109
|
-
export interface
|
|
2489
|
+
export interface WhopCardElementCreateOptions {
|
|
1110
2490
|
/**
|
|
1111
|
-
* A scoped token for
|
|
1112
|
-
* @default ""
|
|
2491
|
+
* A scoped token for card access. Omitted calls carry the viewer session when same-origin. Secrets are returned only when the API authorizes the viewer.
|
|
1113
2492
|
*/
|
|
1114
2493
|
accessToken?: string;
|
|
1115
2494
|
/**
|
|
1116
|
-
*
|
|
1117
|
-
* @default "1M"
|
|
1118
|
-
*/
|
|
1119
|
-
range?: "1D" | "1W" | "1M" | "1Y" | "ALL";
|
|
1120
|
-
/**
|
|
1121
|
-
* When the account was opened, as an ISO 8601 timestamp. `ALL` starts here instead of at its five-year default, so an account older than that keeps its full history.
|
|
1122
|
-
* @default ""
|
|
1123
|
-
*/
|
|
1124
|
-
openedAt?: string;
|
|
1125
|
-
/**
|
|
1126
|
-
* Adds the account name to the label: `Total balance · Acme` normally, and `Acme balance on Jul 9` while the viewer reads a point. Without it the label is just `Total balance`.
|
|
2495
|
+
* Issued card ID, prefixed `icrd_`.
|
|
1127
2496
|
* @default ""
|
|
1128
2497
|
*/
|
|
1129
|
-
|
|
2498
|
+
cardId?: string;
|
|
1130
2499
|
/**
|
|
1131
|
-
*
|
|
1132
|
-
* @default
|
|
2500
|
+
* Hide the View details and Lock card buttons. The card itself remains clickable to reveal details.
|
|
2501
|
+
* @default false
|
|
1133
2502
|
*/
|
|
1134
|
-
|
|
2503
|
+
hideControls?: boolean;
|
|
1135
2504
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
* @default
|
|
2505
|
+
* Disable the lock control while keeping it visible. Useful when a host has temporarily frozen card actions.
|
|
2506
|
+
* @default false
|
|
1138
2507
|
*/
|
|
1139
|
-
|
|
2508
|
+
disableLock?: boolean;
|
|
1140
2509
|
/**
|
|
1141
|
-
*
|
|
2510
|
+
* Hide the Add to Apple Wallet button. It is shown for active and locked cards by default.
|
|
1142
2511
|
* @default false
|
|
1143
2512
|
*/
|
|
1144
|
-
|
|
2513
|
+
hideAppleWalletButton?: boolean;
|
|
1145
2514
|
/**
|
|
1146
|
-
*
|
|
2515
|
+
* Direct-mode integration option. Emits `lockRequested` without updating the card so a first-party host can retain its confirmation flow.
|
|
1147
2516
|
* @default false
|
|
1148
2517
|
*/
|
|
1149
|
-
|
|
2518
|
+
deferLockToHost?: boolean;
|
|
1150
2519
|
/**
|
|
1151
|
-
*
|
|
1152
|
-
* @default false
|
|
2520
|
+
* Fires after details are revealed or hidden.
|
|
1153
2521
|
*/
|
|
1154
|
-
|
|
2522
|
+
onDetailsChanged?: ((payload: { cardId: string; revealed: boolean; }) => void);
|
|
1155
2523
|
/**
|
|
1156
|
-
*
|
|
1157
|
-
* @default 210
|
|
2524
|
+
* Fires instead of updating when `deferLockToHost` is true.
|
|
1158
2525
|
*/
|
|
1159
|
-
|
|
2526
|
+
onLockRequested?: ((payload: { cardId: string; locked: boolean; }) => void);
|
|
1160
2527
|
/**
|
|
1161
|
-
*
|
|
2528
|
+
* Fires after the Cards REST API successfully locks or unlocks the card.
|
|
1162
2529
|
*/
|
|
1163
|
-
|
|
2530
|
+
onLockChanged?: ((payload: { cardId: string; locked: boolean; }) => void);
|
|
1164
2531
|
/**
|
|
1165
|
-
*
|
|
2532
|
+
* Fires when the viewer presses Add to Apple Wallet. The host owns the resulting Apple Wallet flow.
|
|
1166
2533
|
*/
|
|
1167
|
-
|
|
2534
|
+
onAppleWalletRequested?: ((payload: { cardId: string; }) => void);
|
|
1168
2535
|
/**
|
|
1169
2536
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1170
2537
|
*/
|
|
@@ -1180,41 +2547,55 @@ export interface BalanceElementCreateOptions {
|
|
|
1180
2547
|
}
|
|
1181
2548
|
|
|
1182
2549
|
/**
|
|
1183
|
-
* Consumer props for the "
|
|
2550
|
+
* Consumer props for the "cards" sub-controller's "cardTransactions" element.
|
|
1184
2551
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1185
2552
|
*/
|
|
1186
|
-
export interface
|
|
2553
|
+
export interface CardTransactionsElementProps {
|
|
1187
2554
|
/**
|
|
1188
|
-
* A scoped token for the
|
|
2555
|
+
* A scoped token for the reads. Rows and card labels need `payout:account:read`; cardholder names also need `company:authorized_user:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
1189
2556
|
*/
|
|
1190
2557
|
accessToken?: string;
|
|
1191
2558
|
/**
|
|
1192
|
-
*
|
|
1193
|
-
* @default
|
|
2559
|
+
* Off, the table performs no reads and renders empty.
|
|
2560
|
+
* @default true
|
|
1194
2561
|
*/
|
|
1195
|
-
|
|
2562
|
+
enabled?: boolean;
|
|
1196
2563
|
/**
|
|
1197
|
-
*
|
|
1198
|
-
* @default
|
|
2564
|
+
* Restrict the table to these cards. Empty shows every card on the account.
|
|
2565
|
+
* @default []
|
|
1199
2566
|
*/
|
|
1200
|
-
|
|
2567
|
+
cardIds?: string[];
|
|
1201
2568
|
/**
|
|
1202
|
-
*
|
|
1203
|
-
* @default
|
|
2569
|
+
* Restrict the table to these cardholders. Empty shows every cardholder on the account.
|
|
2570
|
+
* @default []
|
|
1204
2571
|
*/
|
|
1205
|
-
|
|
2572
|
+
cardholderIds?: string[];
|
|
1206
2573
|
/**
|
|
1207
|
-
*
|
|
2574
|
+
* Restrict the table to these statuses — `completed`, `pending`, `declined` or `reversed`. Anything else is ignored. Empty shows every status.
|
|
2575
|
+
* @default []
|
|
2576
|
+
*/
|
|
2577
|
+
statuses?: string[];
|
|
2578
|
+
/**
|
|
2579
|
+
* Show the cardholder column and its filter. Off for an account whose cards all belong to one person.
|
|
1208
2580
|
* @default true
|
|
1209
2581
|
*/
|
|
1210
|
-
|
|
2582
|
+
showCardholders?: boolean;
|
|
2583
|
+
/**
|
|
2584
|
+
* How many transactions to read per page.
|
|
2585
|
+
* @default 50
|
|
2586
|
+
*/
|
|
2587
|
+
pageSize?: number;
|
|
1211
2588
|
}
|
|
1212
2589
|
|
|
1213
2590
|
/**
|
|
1214
|
-
* The live handle for a mounted "
|
|
2591
|
+
* The live handle for a mounted "cardTransactions" element. Returned by the "cards" sub handle's `create("cardTransactions")`.
|
|
1215
2592
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1216
2593
|
*/
|
|
1217
|
-
export interface
|
|
2594
|
+
export interface CardTransactionsElementHandle {
|
|
2595
|
+
/**
|
|
2596
|
+
* Re-read the transactions, for a host that just changed something on the account.
|
|
2597
|
+
*/
|
|
2598
|
+
refresh: () => Promise<void>;
|
|
1218
2599
|
/**
|
|
1219
2600
|
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
1220
2601
|
*/
|
|
@@ -1226,46 +2607,52 @@ export interface ListElementHandle {
|
|
|
1226
2607
|
/**
|
|
1227
2608
|
* Merges new props into the mounted element. In React, change the component props instead.
|
|
1228
2609
|
*/
|
|
1229
|
-
update: (options: Partial<
|
|
2610
|
+
update: (options: Partial<CardTransactionsElementProps>) => void;
|
|
1230
2611
|
}
|
|
1231
2612
|
|
|
1232
2613
|
/**
|
|
1233
|
-
* Options for the "
|
|
2614
|
+
* Options for the "cards" sub handle's `create("cardTransactions")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
1234
2615
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1235
2616
|
*/
|
|
1236
|
-
export interface
|
|
2617
|
+
export interface CardTransactionsElementCreateOptions {
|
|
1237
2618
|
/**
|
|
1238
|
-
* A scoped token for the
|
|
2619
|
+
* A scoped token for the reads. Rows and card labels need `payout:account:read`; cardholder names also need `company:authorized_user:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.
|
|
1239
2620
|
*/
|
|
1240
2621
|
accessToken?: string;
|
|
1241
2622
|
/**
|
|
1242
|
-
*
|
|
1243
|
-
* @default
|
|
2623
|
+
* Off, the table performs no reads and renders empty.
|
|
2624
|
+
* @default true
|
|
1244
2625
|
*/
|
|
1245
|
-
|
|
2626
|
+
enabled?: boolean;
|
|
1246
2627
|
/**
|
|
1247
|
-
*
|
|
1248
|
-
* @default
|
|
2628
|
+
* Restrict the table to these cards. Empty shows every card on the account.
|
|
2629
|
+
* @default []
|
|
1249
2630
|
*/
|
|
1250
|
-
|
|
2631
|
+
cardIds?: string[];
|
|
1251
2632
|
/**
|
|
1252
|
-
*
|
|
1253
|
-
* @default
|
|
2633
|
+
* Restrict the table to these cardholders. Empty shows every cardholder on the account.
|
|
2634
|
+
* @default []
|
|
1254
2635
|
*/
|
|
1255
|
-
|
|
2636
|
+
cardholderIds?: string[];
|
|
1256
2637
|
/**
|
|
1257
|
-
*
|
|
2638
|
+
* Restrict the table to these statuses — `completed`, `pending`, `declined` or `reversed`. Anything else is ignored. Empty shows every status.
|
|
2639
|
+
* @default []
|
|
2640
|
+
*/
|
|
2641
|
+
statuses?: string[];
|
|
2642
|
+
/**
|
|
2643
|
+
* Show the cardholder column and its filter. Off for an account whose cards all belong to one person.
|
|
1258
2644
|
* @default true
|
|
1259
2645
|
*/
|
|
1260
|
-
|
|
2646
|
+
showCardholders?: boolean;
|
|
1261
2647
|
/**
|
|
1262
|
-
*
|
|
2648
|
+
* How many transactions to read per page.
|
|
2649
|
+
* @default 50
|
|
1263
2650
|
*/
|
|
1264
|
-
|
|
2651
|
+
pageSize?: number;
|
|
1265
2652
|
/**
|
|
1266
|
-
*
|
|
2653
|
+
* A row was pressed. Open your own detail surface in answer to this — the element never navigates.
|
|
1267
2654
|
*/
|
|
1268
|
-
|
|
2655
|
+
onTransactionSelected?: ((payload: { transactionId: string; }) => void);
|
|
1269
2656
|
/**
|
|
1270
2657
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
1271
2658
|
*/
|
|
@@ -1281,24 +2668,36 @@ export interface ListElementCreateOptions {
|
|
|
1281
2668
|
}
|
|
1282
2669
|
|
|
1283
2670
|
/**
|
|
1284
|
-
* The "
|
|
2671
|
+
* The "cards" sub-handle, minted by `handle.create("cards", …)`. Mounts the sub-controller's elements and carries its actions.
|
|
1285
2672
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1286
2673
|
*/
|
|
1287
|
-
export interface
|
|
2674
|
+
export interface CardsSubHandle {
|
|
1288
2675
|
/**
|
|
1289
|
-
*
|
|
2676
|
+
* Lists the account's active issued cards, most recently issued first. Needs an `accessToken`. The title and rows are click targets that emit events instead of navigating — a host wires up its own routing and card-detail UI.
|
|
1290
2677
|
*/
|
|
1291
|
-
create(name: "
|
|
2678
|
+
create(name: "cards", options?: CardsElementCreateOptions): CardsElementHandle;
|
|
1292
2679
|
/**
|
|
1293
|
-
*
|
|
2680
|
+
* A sortable table of every issued card on an account, including cardholder, last month's spend, limit, and creation date. Rows and the create button emit events so the host owns card details and issuance flows.
|
|
1294
2681
|
*/
|
|
1295
|
-
create(name: "
|
|
2682
|
+
create(name: "cardsTable", options?: CardsTableElementCreateOptions): CardsTableElementHandle;
|
|
2683
|
+
/**
|
|
2684
|
+
* A business account's card spend over time, using the same interactive bar chart as Whop's cards dashboard. The period picker changes the mounted chart and emits an event so the host can persist the selection.
|
|
2685
|
+
*/
|
|
2686
|
+
create(name: "cardsChart", options?: CardsChartElementCreateOptions): CardsChartElementHandle;
|
|
2687
|
+
/**
|
|
2688
|
+
* Renders one issued Whop Card. The element prefetches authorized secrets immediately after it mounts with a card ID, but keeps them masked until the viewer clicks it or selects `View details`. The API remains the permission authority. Includes lock and unlock controls by default.
|
|
2689
|
+
*/
|
|
2690
|
+
create(name: "whopCard", options?: WhopCardElementCreateOptions): WhopCardElementHandle;
|
|
2691
|
+
/**
|
|
2692
|
+
* Every card transaction on an account, as the sortable table the dashboard shows: date, merchant, amount, cashback, status, card and cardholder, with filters for status, card and cardholder. A host can seed any of those three so the table opens on a narrowed view the reader can still widen. Card and cardholder narrow the read itself; search and status narrow the rows already loaded, so the count and total describe the current view rather than the account's lifetime. Selecting a row reports it — the element never opens a drawer of its own.
|
|
2693
|
+
*/
|
|
2694
|
+
create(name: "cardTransactions", options?: CardTransactionsElementCreateOptions): CardTransactionsElementHandle;
|
|
1296
2695
|
/**
|
|
1297
2696
|
* Merges new props and callbacks into the sub-controller.
|
|
1298
2697
|
*/
|
|
1299
|
-
update(options: Partial<
|
|
2698
|
+
update(options: Partial<CardsSubOptions>): void;
|
|
1300
2699
|
/**
|
|
1301
|
-
* Destroys the sub-controller and its elements, then frees its exclusive slot. A later `create("
|
|
2700
|
+
* Destroys the sub-controller and its elements, then frees its exclusive slot. A later `create("cards")` starts fresh.
|
|
1302
2701
|
*/
|
|
1303
2702
|
destroy(): void;
|
|
1304
2703
|
}
|
|
@@ -1308,46 +2707,70 @@ export interface BalancesSubHandle {
|
|
|
1308
2707
|
* @see https://docs.whop.com/elements/latest/wallet/overview
|
|
1309
2708
|
*/
|
|
1310
2709
|
export interface WalletHandle {
|
|
2710
|
+
/**
|
|
2711
|
+
* The outstanding-action banners from Whop's balance dashboard — identity verification, deposits, tax, and the rest — in the same order the API returns them. An account with nothing outstanding renders nothing at all, so the element can sit permanently in a layout. Copy comes from the API. Pressing Verify starts a hosted identity session and leaves for it; Add money asks the Wallet controller to open deposit; every other button follows the action's own link. Needs an `accessToken`. A failed read renders nothing rather than an error — a banner should never become the loudest thing on someone else's page.
|
|
2712
|
+
*/
|
|
2713
|
+
create(name: "required-actions", options?: RequiredActionsElementCreateOptions): RequiredActionsElementHandle;
|
|
2714
|
+
/**
|
|
2715
|
+
* The account action row from Whop's balance dashboard. Deposit, Send, Withdraw, and Convert open the Wallet controller's built-in overlays. Accept opens Whop's checkout-link creator for a business account or company creation for a personal account. Each button also emits its requested event so the embedding page can observe the action.
|
|
2716
|
+
*/
|
|
2717
|
+
create(name: "actions", options?: ActionsElementCreateOptions): ActionsElementHandle;
|
|
1311
2718
|
/**
|
|
1312
2719
|
* An account's ledger activity: every movement of money in or out, newest first. The list pages as the viewer scrolls, and rows report which one was tapped instead of navigating, so you can open your own detail screen.
|
|
1313
2720
|
*/
|
|
1314
2721
|
create(name: "activity", options?: ActivityElementCreateOptions): ActivityElementHandle;
|
|
1315
2722
|
/**
|
|
1316
|
-
*
|
|
2723
|
+
* A standalone detail drawer for one movement. Point it at a prefetched financial-activity row, a ledger activity ID, or a card transaction ID — a prefetched row takes precedence, otherwise the element retrieves the record itself. A card transaction opens the card receipt: merchant, amount, status, the card it was charged to, its cardholder on a company account, the settlement date, category, currency conversion and cashback.
|
|
1317
2724
|
*/
|
|
1318
|
-
|
|
2725
|
+
createOverlay(name: "activityDetail", options?: ActivityDetailElementCreateOptions): ActivityDetailElementOverlayHandle;
|
|
1319
2726
|
/**
|
|
1320
|
-
* Funds a Whop account. Renders an amount field and the account's live funding rails — crypto (a per-network deposit address with its QR) and bank transfer (the wire fields for each settlement currency)
|
|
2727
|
+
* Funds a Whop account. Renders an amount field and the account's live funding rails — crypto (a per-network deposit address with its QR) and bank transfer (the wire fields for each settlement currency). A business account's rails resolve with no credentials, so they work on any page; a personal (`user_`) account only reveals its rails to itself, so pass `accessToken` for it — omitted, the viewer's own same-origin session covers it. Cards and platform balance are opt-in: pass `savedCards`, `allowNewCard`, or `showPlatformBalance` and the element collects the amount and the choice, then emits `cardDepositRequested` / `addCardRequested` / `platformBalanceSelected` and waits for you to call `showStep({ step: 'amount' })` when your own screen is done.
|
|
1321
2728
|
*/
|
|
1322
2729
|
create(name: "deposit", options?: DepositElementCreateOptions): DepositElementHandle;
|
|
1323
2730
|
/**
|
|
1324
|
-
* Funds a Whop account. Renders an amount field and the account's live funding rails — crypto (a per-network deposit address with its QR) and bank transfer (the wire fields for each settlement currency)
|
|
2731
|
+
* Funds a Whop account. Renders an amount field and the account's live funding rails — crypto (a per-network deposit address with its QR) and bank transfer (the wire fields for each settlement currency). A business account's rails resolve with no credentials, so they work on any page; a personal (`user_`) account only reveals its rails to itself, so pass `accessToken` for it — omitted, the viewer's own same-origin session covers it. Cards and platform balance are opt-in: pass `savedCards`, `allowNewCard`, or `showPlatformBalance` and the element collects the amount and the choice, then emits `cardDepositRequested` / `addCardRequested` / `platformBalanceSelected` and waits for you to call `showStep({ step: 'amount' })` when your own screen is done.
|
|
1325
2732
|
*/
|
|
1326
2733
|
createOverlay(name: "deposit", options?: DepositElementCreateOptions): DepositElementOverlayHandle;
|
|
1327
2734
|
/**
|
|
1328
|
-
*
|
|
2735
|
+
* Converts an account's USD balance to Gold or Coinbase Wrapped Bitcoin, and back, through Whop's public swaps API. A cross-origin mount needs an `accessToken` scoped to `company:balance:read` plus `crypto_wallet:swap` or `crypto_wallet:manage`.
|
|
2736
|
+
*/
|
|
2737
|
+
create(name: "convert", options?: ConvertElementCreateOptions): ConvertElementHandle;
|
|
2738
|
+
/**
|
|
2739
|
+
* Converts an account's USD balance to Gold or Coinbase Wrapped Bitcoin, and back, through Whop's public swaps API. A cross-origin mount needs an `accessToken` scoped to `company:balance:read` plus `crypto_wallet:swap` or `crypto_wallet:manage`.
|
|
2740
|
+
*/
|
|
2741
|
+
createOverlay(name: "convert", options?: ConvertElementCreateOptions): ConvertElementOverlayHandle;
|
|
2742
|
+
/**
|
|
2743
|
+
* Collects a payout amount and saved payout method, groups standard and instant delivery choices with live fees and arrival estimates, and collects a new payout method when needed. When the host does not drive the flow, the element lists methods and creates the payout itself — pass `accessToken` (or rely on the viewer's same-origin session). A host that already talks to the payouts API can still supply methods, limits, and loading flags; confirming then emits `withdrawalRequested` for that host to create.
|
|
1329
2744
|
*/
|
|
1330
2745
|
create(name: "withdraw", options?: WithdrawElementCreateOptions): WithdrawElementHandle;
|
|
1331
2746
|
/**
|
|
1332
|
-
* Collects a payout amount and saved payout method, groups standard and instant delivery choices with live fees and arrival estimates, collects a new payout method when needed, and
|
|
2747
|
+
* Collects a payout amount and saved payout method, groups standard and instant delivery choices with live fees and arrival estimates, and collects a new payout method when needed. When the host does not drive the flow, the element lists methods and creates the payout itself — pass `accessToken` (or rely on the viewer's same-origin session). A host that already talks to the payouts API can still supply methods, limits, and loading flags; confirming then emits `withdrawalRequested` for that host to create.
|
|
1333
2748
|
*/
|
|
1334
2749
|
createOverlay(name: "withdraw", options?: WithdrawElementCreateOptions): WithdrawElementOverlayHandle;
|
|
1335
2750
|
/**
|
|
1336
|
-
* Sends money from an account to a recipient — a user, another account, or a public claim link anyone can redeem. Renders its own recipient search resolved from the account ID with no credentials beyond the account's own token. Needs an `accessToken` scoped to `payout:withdraw_funds
|
|
2751
|
+
* Sends money from an account to a recipient — a user, another account, or a public claim link anyone can redeem. Direct transfers use the source account's configured fiat or crypto rail. Renders its own recipient search resolved from the account ID with no credentials beyond the account's own token. Needs an `accessToken` scoped to `payout:transfer_funds` for direct transfers and `payout:withdraw_funds` for recipient lists; account recipient search additionally needs `company:authorized_user:read` and `member:basic:read`, and account claim links need `airdrop_link:manage` — a host without one of those scopes should turn off the matching prop rather than leave a row that will 403.
|
|
1337
2752
|
*/
|
|
1338
2753
|
create(name: "send", options?: SendElementCreateOptions): SendElementHandle;
|
|
1339
2754
|
/**
|
|
1340
|
-
* Sends money from an account to a recipient — a user, another account, or a public claim link anyone can redeem. Renders its own recipient search resolved from the account ID with no credentials beyond the account's own token. Needs an `accessToken` scoped to `payout:withdraw_funds
|
|
2755
|
+
* Sends money from an account to a recipient — a user, another account, or a public claim link anyone can redeem. Direct transfers use the source account's configured fiat or crypto rail. Renders its own recipient search resolved from the account ID with no credentials beyond the account's own token. Needs an `accessToken` scoped to `payout:transfer_funds` for direct transfers and `payout:withdraw_funds` for recipient lists; account recipient search additionally needs `company:authorized_user:read` and `member:basic:read`, and account claim links need `airdrop_link:manage` — a host without one of those scopes should turn off the matching prop rather than leave a row that will 403.
|
|
1341
2756
|
*/
|
|
1342
2757
|
createOverlay(name: "send", options?: SendElementCreateOptions): SendElementOverlayHandle;
|
|
1343
2758
|
/**
|
|
1344
|
-
*
|
|
2759
|
+
* One card and what has been spent on it: the card itself, what it has spent against its limit, and its latest transactions. Opens as a drawer. The card face, its reveal and its lock come from the `whopCard` element composed inside, so a host gets one surface rather than assembling three. Pressing a transaction, or asking for the full list, reports the request — the drawer never navigates.
|
|
1345
2760
|
*/
|
|
1346
|
-
|
|
2761
|
+
createOverlay(name: "cardDetails", options?: CardDetailsElementCreateOptions): CardDetailsElementOverlayHandle;
|
|
2762
|
+
/**
|
|
2763
|
+
* A banner asking the account holder to verify their identity, shown only while verification is outstanding — an account that has already verified renders nothing at all, so the element can sit permanently in a layout. The headline and body come from the API, so they track the account's actual state: an unstarted account is invited to unlock cards and payouts, one under review reads as pending, and a failed or flagged one says so. Pressing the button reports `verificationRequested` and stays put, so the host mounts its own verification — the `verifications` controller's `kyc` element, say. Needs an `accessToken`. A failed read renders nothing rather than an error — a nudge should never become the loudest thing on the page.
|
|
2764
|
+
*/
|
|
2765
|
+
create(name: "verification", options?: VerificationElementCreateOptions): VerificationElementHandle;
|
|
1347
2766
|
/**
|
|
1348
|
-
*
|
|
2767
|
+
* Three views of an account's money. The balance view shows the total, a chart of how it changed, and a picker for the time range. The list view shows the holdings that make up that total, valued in dollars. The breakdown view splits one currency into available, pending, reserve, and negative amounts without money-movement controls. When `openHoldingOnSelect` is on, a list row replaces this unit's canvas — the chart and the list — with that holding's balance page instead of only reporting the click.
|
|
1349
2768
|
*/
|
|
1350
2769
|
create(name: "balances", options?: BalancesSubOptions): BalancesSubHandle;
|
|
2770
|
+
/**
|
|
2771
|
+
* An account's card surfaces, mounted from one place: the compact issued-card list, the full sortable roster, the spend chart, and a single revealable card. Mount the faces the page needs — they share the account and the credential this unit is minted with, so a page showing a chart above a roster wires them once.
|
|
2772
|
+
*/
|
|
2773
|
+
create(name: "cards", options?: CardsSubOptions): CardsSubHandle;
|
|
1351
2774
|
/**
|
|
1352
2775
|
* Merges new handle options into every mounted element. In React, change the namespace props instead.
|
|
1353
2776
|
*/
|
|
@@ -1411,11 +2834,15 @@ export interface LedgerActivity {
|
|
|
1411
2834
|
/**
|
|
1412
2835
|
* The ledger line category this activity was posted under.
|
|
1413
2836
|
*/
|
|
1414
|
-
line_type: "
|
|
2837
|
+
line_type: "platform_balance_transfer_outgoing" | "payment_gross" | "withdrawal" | "topup" | "payment_dispute" | "payment_revshare" | "card_spend_authorization" | "airdrop" | "onchain_swap_target" | "payment_gross_reversal" | "payment_refund" | "payment_refund_reversal" | "payment_dispute_reversal" | "payment_dispute_adjustment" | "dispute_hold_adjustment" | "topup_reversal" | "platform_balance_payment" | "platform_balance_payment_refund" | "platform_balance_transfer_incoming" | "internal_balance_transfer_incoming" | "internal_balance_transfer_outgoing" | "onchain_wallet_transfer_incoming" | "onchain_wallet_transfer_outgoing" | "withdrawal_reversal" | "withdrawal_clawback" | "withdrawal_clawback_reversal" | "payment_revshare_refund" | "payment_revshare_reversal" | "payment_referral" | "payment_referral_reversal" | "application_fee_payout" | "airdrop_reversal" | "airdrop_link_created" | "airdrop_link_returned" | "card_spend_authorization_void" | "card_spend_refund" | "onchain_deposit" | "bank_transfer" | "currency_conversion_outgoing" | "currency_conversion_incoming" | "airdrop_link_redeemed" | "resolution_center_refund" | "withdrawal_reclassification" | "payment_revshare_payout" | "platform_affiliate_payment" | "platform_affiliate_payment_reversal" | "onboarding_reward" | "platform_covered_dispute" | "treasury_payin" | "passthrough_gmv" | "promo_reversal" | "misc_reversal" | "ad_spend_charge" | "ad_campaign_budget" | "ad_budget_release" | "ad_publisher_payout" | "ad_publisher_payout_received" | "affiliate_fee" | "application_fee" | "billing_percentage_fee" | "buyer_fee" | "cross_border_percentage_fee" | "dispute_alert_fee" | "fraud_prevention_fee" | "fx_percentage_fee" | "high_risk_merchant_fee" | "orchestration_percentage_fee" | "payment_dispute_fee" | "payment_processing_fixed_fee" | "payment_processing_percentage_fee" | "payout_fee" | "revshare_percentage_fee" | "sales_tax_fee" | "sales_tax_remittance" | "sales_tax_remittance_reversal" | "stripe_domestic_processing_fee" | "stripe_international_processing_fee" | "three_ds_fixed_fee" | "whop_processing_fee" | "balance_reservation" | "balance_reservation_reversal" | "card_interchange" | "card_load_deposit" | "card_load_transfer" | "card_unload_deposit" | "card_unload_transfer" | "company_referral" | "connected_account_negative_balance" | "dispute_representment_fee" | "external_card_load_deposit" | "installment_default" | "internal_withdrawal" | "internal_withdrawal_complete" | "internal_withdrawal_fee" | "internal_withdrawal_fee_reversal" | "internal_withdrawal_in_transit" | "internal_withdrawal_in_transit_reversal" | "internal_withdrawal_markup_fee" | "internal_withdrawal_markup_fee_payout" | "internal_withdrawal_markup_fee_payout_reversal" | "internal_withdrawal_markup_fee_reversal" | "internal_withdrawal_reversal" | "legacy_crypto_payment" | "legacy_payment" | "legacy_payment_refund" | "license_sale" | "license_sale_commission" | "license_sale_revenue" | "marketplace_affiliate_fee" | "misc_purchase" | "misc_refund" | "onchain_swap_source" | "onchain_withdrawal" | "payment_referral_refund" | "platform_balance_transfer_fee" | "platform_earning" | "referral_bonus" | "software_rental_revshare" | "software_rental_transaction" | "swap_fee" | "topup_fee" | "withdrawal_fee" | "withdrawal_fee_reversal" | "withdrawal_markup_fee" | "withdrawal_markup_fee_payout" | "withdrawal_markup_fee_payout_reversal" | "withdrawal_markup_fee_reversal" | "withdrawal_topup_adjustment" | "deposit" | "wallet_transfer_incoming" | "wallet_transfer_outgoing" | "swap_source" | "swap_target";
|
|
1415
2838
|
/**
|
|
1416
2839
|
* Signed amount in the currency's smallest precision units.
|
|
1417
2840
|
*/
|
|
1418
2841
|
amount: string;
|
|
2842
|
+
/**
|
|
2843
|
+
* Dollar value of this movement as a decimal string, signed like `amount`. Converted from the posted amount at the rate that was live when the line posted — the same pricing the wallet balance chart and the financial reports use — so a crypto row carries its dollar value too. `null` for a currency Whop holds no exchange rate for.
|
|
2844
|
+
*/
|
|
2845
|
+
usd_amount: string | null;
|
|
1419
2846
|
/**
|
|
1420
2847
|
* Currency for this ledger activity.
|
|
1421
2848
|
*/
|
|
@@ -1425,13 +2852,9 @@ export interface LedgerActivity {
|
|
|
1425
2852
|
*/
|
|
1426
2853
|
posted_at: string;
|
|
1427
2854
|
/**
|
|
1428
|
-
* ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on
|
|
2855
|
+
* ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on payouts, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date.
|
|
1429
2856
|
*/
|
|
1430
2857
|
available_at: string | null;
|
|
1431
|
-
/**
|
|
1432
|
-
* When the activity record was created.
|
|
1433
|
-
*/
|
|
1434
|
-
created_at: string | null;
|
|
1435
2858
|
/**
|
|
1436
2859
|
* Resource associated with this ledger activity.
|
|
1437
2860
|
*/
|
|
@@ -1439,11 +2862,43 @@ export interface LedgerActivity {
|
|
|
1439
2862
|
/**
|
|
1440
2863
|
* Source of this ledger activity.
|
|
1441
2864
|
*/
|
|
1442
|
-
source: { object: string; id: string; status?: string | null | undefined; payment_amount?: Money | null | undefined; payment_method_type?: string | null | undefined; payment_processor?: string | null | undefined; card_brand?: string | null | undefined; reason?: string | null | undefined; claim_url?: string | null | undefined; amount_float?: number | null | undefined; created_at?: string | null | undefined; estimated_arrival?: string | null | undefined; payer_name?: string | null | undefined; payout_token_nickname?: string | null | undefined; tx_hash?: string | null | undefined; sender_address?: string | null | undefined; chain?: string | null | undefined; from_amount?: string | null | undefined; from_currency?: string | null | undefined; to_amount?: string | null | undefined; to_currency?: string | null | undefined; payout_destination?: { payer_name?: string | null | undefined; icon_url?: string | null | undefined; } | null | undefined; [key: string]: unknown; } | null;
|
|
2865
|
+
source: { object: string; id: string; status?: string | null | undefined; payment_amount?: Money | null | undefined; payment_method_type?: string | null | undefined; payment_processor?: string | null | undefined; card_brand?: string | null | undefined; reason?: string | null | undefined; notes?: string | null | undefined; risk_review_hold?: boolean | null | undefined; claim_url?: string | null | undefined; amount_float?: number | null | undefined; created_at?: string | null | undefined; estimated_arrival?: string | null | undefined; payer_name?: string | null | undefined; payout_token_nickname?: string | null | undefined; tx_hash?: string | null | undefined; sender_address?: string | null | undefined; chain?: string | null | undefined; from_amount?: string | null | undefined; from_currency?: string | null | undefined; to_amount?: string | null | undefined; to_currency?: string | null | undefined; payout_destination?: { payer_name?: string | null | undefined; icon_url?: string | null | undefined; } | null | undefined; [key: string]: unknown; } | null;
|
|
1443
2866
|
/**
|
|
1444
2867
|
* Payment related to this ledger activity. Included when rich resource hydration is enabled and the movement is tied to a payment.
|
|
1445
2868
|
*/
|
|
1446
|
-
payment?: { object: "payment"; id: string; amount: Money | null; payment_method_type: string | null; payment_processor: string | null; card_brand: string | null; card_last4: string | null; created_at: string; } | null | undefined;
|
|
2869
|
+
payment?: { object: "payment"; id: string; amount: Money | null; payment_method_type: string | null; payment_processor: string | null; card_brand: string | null; card_last4: string | null; user: { id: string; name: string; email: string | null; } | null; product: { id: string; name: string; } | null; plan: { id: string; name: string | null; } | null; created_at: string; } | null | undefined;
|
|
2870
|
+
/**
|
|
2871
|
+
* Payment ID for any payment-related activity, including refunds and disputes.
|
|
2872
|
+
*/
|
|
2873
|
+
payment_id?: string | null | undefined;
|
|
2874
|
+
/**
|
|
2875
|
+
* ID of the customer associated with the payment.
|
|
2876
|
+
*/
|
|
2877
|
+
user_id?: string | null | undefined;
|
|
2878
|
+
/**
|
|
2879
|
+
* Display name of the customer associated with the payment.
|
|
2880
|
+
*/
|
|
2881
|
+
user_name?: string | null | undefined;
|
|
2882
|
+
/**
|
|
2883
|
+
* Email of the customer associated with the payment. Requires member:email:read.
|
|
2884
|
+
*/
|
|
2885
|
+
user_email?: string | null | undefined;
|
|
2886
|
+
/**
|
|
2887
|
+
* ID of the product associated with the payment, when applicable.
|
|
2888
|
+
*/
|
|
2889
|
+
product_id?: string | null | undefined;
|
|
2890
|
+
/**
|
|
2891
|
+
* Name of the product associated with the payment, when applicable.
|
|
2892
|
+
*/
|
|
2893
|
+
product_name?: string | null | undefined;
|
|
2894
|
+
/**
|
|
2895
|
+
* ID of the plan associated with the payment, when applicable.
|
|
2896
|
+
*/
|
|
2897
|
+
plan_id?: string | null | undefined;
|
|
2898
|
+
/**
|
|
2899
|
+
* Name of the plan associated with the payment, when applicable.
|
|
2900
|
+
*/
|
|
2901
|
+
plan_name?: string | null | undefined;
|
|
1447
2902
|
/**
|
|
1448
2903
|
* The viewer account that owns this row's ledger. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise.
|
|
1449
2904
|
*/
|
|
@@ -1515,6 +2970,7 @@ export interface WithdrawalQuote {
|
|
|
1515
2970
|
exchangeRate: number;
|
|
1516
2971
|
minLimit: number;
|
|
1517
2972
|
maxLimit?: number | null | undefined;
|
|
2973
|
+
instantUnavailableReason?: "minimum_crypto_sales_not_met" | null | undefined;
|
|
1518
2974
|
standard?: WithdrawalQuoteSpeed | null | undefined;
|
|
1519
2975
|
instant?: WithdrawalQuoteSpeed | null | undefined;
|
|
1520
2976
|
}
|
|
@@ -1524,12 +2980,14 @@ export interface WithdrawalQuote {
|
|
|
1524
2980
|
*/
|
|
1525
2981
|
export interface WithdrawalMethod {
|
|
1526
2982
|
id: string;
|
|
2983
|
+
createdAt?: string | null | undefined;
|
|
1527
2984
|
nickname?: string | null | undefined;
|
|
1528
2985
|
accountReference?: string | null | undefined;
|
|
1529
2986
|
payerName?: string | null | undefined;
|
|
1530
2987
|
destinationCurrency: string;
|
|
1531
2988
|
isDefault: boolean;
|
|
1532
2989
|
iconUrl?: string | null | undefined;
|
|
2990
|
+
name?: string | null | undefined;
|
|
1533
2991
|
deliveryType: string;
|
|
1534
2992
|
supportsStandard: boolean;
|
|
1535
2993
|
supportsInstant: boolean;
|
|
@@ -1574,8 +3032,50 @@ export interface WithdrawalSupportedMethod {
|
|
|
1574
3032
|
* Declared from the app's `WithdrawalLimits`, referenced by a host-capability surface.
|
|
1575
3033
|
*/
|
|
1576
3034
|
export interface WithdrawalLimits {
|
|
1577
|
-
standard: { maxAmount: number; errorMessage?: string | null | undefined; };
|
|
1578
|
-
instant: { maxAmount: number; dailyAmountRemaining?: number | null | undefined; errorMessage?: string | null | undefined; };
|
|
3035
|
+
standard: { maxAmount: number; errorCode?: string | null | undefined; errorMessage?: string | null | undefined; };
|
|
3036
|
+
instant: { maxAmount: number; dailyAmountRemaining?: number | null | undefined; errorCode?: string | null | undefined; errorMessage?: string | null | undefined; };
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
/**
|
|
3040
|
+
* Declared from the app's `WithdrawalMoney`, referenced by a host-capability surface.
|
|
3041
|
+
*/
|
|
3042
|
+
export interface WithdrawalMoney {
|
|
3043
|
+
currency: string;
|
|
3044
|
+
amount: string;
|
|
3045
|
+
decimals: number;
|
|
3046
|
+
display_decimals: number;
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
/**
|
|
3050
|
+
* Declared from the app's `WithdrawalPayoutQuote`, referenced by a host-capability surface.
|
|
3051
|
+
*/
|
|
3052
|
+
export interface WithdrawalPayoutQuote {
|
|
3053
|
+
requestId: string;
|
|
3054
|
+
payoutMethodId: string;
|
|
3055
|
+
speed: "standard" | "instant";
|
|
3056
|
+
id: string;
|
|
3057
|
+
amount: WithdrawalMoney;
|
|
3058
|
+
fee: WithdrawalMoney;
|
|
3059
|
+
netAmount: WithdrawalMoney;
|
|
3060
|
+
destinationAmount: WithdrawalMoney;
|
|
3061
|
+
exchangeRate: number;
|
|
3062
|
+
expiresAt: string;
|
|
3063
|
+
quoteToken: string;
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
/**
|
|
3067
|
+
* Declared from the app's `WithdrawalRequest`, referenced by a host-capability surface.
|
|
3068
|
+
*/
|
|
3069
|
+
export interface WithdrawalRequest {
|
|
3070
|
+
amount: number;
|
|
3071
|
+
currency: string;
|
|
3072
|
+
payoutMethodId: string;
|
|
3073
|
+
presentedFee: number;
|
|
3074
|
+
quoteId?: string | undefined;
|
|
3075
|
+
quoteToken?: string | undefined;
|
|
3076
|
+
speed: "standard" | "instant";
|
|
3077
|
+
notes?: string | undefined;
|
|
3078
|
+
acknowledgeBankWarning?: boolean | undefined;
|
|
1579
3079
|
}
|
|
1580
3080
|
|
|
1581
3081
|
/**
|
|
@@ -1590,16 +3090,14 @@ export interface WithdrawalCreateMethodInput {
|
|
|
1590
3090
|
}
|
|
1591
3091
|
|
|
1592
3092
|
/**
|
|
1593
|
-
* Declared from the app's `
|
|
3093
|
+
* Declared from the app's `WithdrawalPayoutQuoteRequest`, referenced by a host-capability surface.
|
|
1594
3094
|
*/
|
|
1595
|
-
export interface
|
|
3095
|
+
export interface WithdrawalPayoutQuoteRequest {
|
|
3096
|
+
requestId: string;
|
|
1596
3097
|
amount: number;
|
|
1597
3098
|
currency: string;
|
|
1598
3099
|
payoutMethodId: string;
|
|
1599
|
-
presentedFee: number;
|
|
1600
3100
|
speed: "standard" | "instant";
|
|
1601
|
-
notes?: string | undefined;
|
|
1602
|
-
acknowledgeBankWarning?: boolean | undefined;
|
|
1603
3101
|
}
|
|
1604
3102
|
|
|
1605
3103
|
/**
|
|
@@ -1612,3 +3110,34 @@ export interface SendRecipient {
|
|
|
1612
3110
|
profilePicUrl: string | null;
|
|
1613
3111
|
kind: "business" | "user" | "email";
|
|
1614
3112
|
}
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* The billing address.
|
|
3116
|
+
* Declared from the app's `Billing`, referenced by a host-capability surface.
|
|
3117
|
+
*/
|
|
3118
|
+
export interface Billing {
|
|
3119
|
+
/**
|
|
3120
|
+
* Billing city.
|
|
3121
|
+
*/
|
|
3122
|
+
city: string | null;
|
|
3123
|
+
/**
|
|
3124
|
+
* Billing country code.
|
|
3125
|
+
*/
|
|
3126
|
+
country_code: string | null;
|
|
3127
|
+
/**
|
|
3128
|
+
* Street address line 1.
|
|
3129
|
+
*/
|
|
3130
|
+
line1: string | null;
|
|
3131
|
+
/**
|
|
3132
|
+
* Street address line 2.
|
|
3133
|
+
*/
|
|
3134
|
+
line2: string | null;
|
|
3135
|
+
/**
|
|
3136
|
+
* Billing postal code.
|
|
3137
|
+
*/
|
|
3138
|
+
postal_code: string | null;
|
|
3139
|
+
/**
|
|
3140
|
+
* Billing region or state.
|
|
3141
|
+
*/
|
|
3142
|
+
region: string | null;
|
|
3143
|
+
}
|