@whop/elements 1.0.0-beta.2 → 1.0.0-beta.4
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/_framework.d.cts +6 -1
- package/_framework.d.ts +6 -1
- package/ads.d.cts +32 -2
- package/ads.d.ts +32 -2
- package/checkout.d.cts +4 -4
- package/checkout.d.ts +4 -4
- package/index.cjs +1 -1
- package/index.d.cts +10 -5
- package/index.d.ts +10 -5
- package/index.js +1 -1
- package/package.json +10 -2
- package/payments.d.cts +240 -35
- package/payments.d.ts +240 -35
- 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 +2294 -546
- package/wallet.d.ts +2294 -546
- package/websites.d.cts +36 -10
- package/websites.d.ts +36 -10
package/payments.d.ts
CHANGED
|
@@ -12,9 +12,17 @@
|
|
|
12
12
|
export type PaymentsOptions = (
|
|
13
13
|
| {
|
|
14
14
|
/**
|
|
15
|
-
* Account ID, prefixed `biz_`.
|
|
15
|
+
* Account ID, prefixed `biz_`. Required for PaymentsElement; omit only when calling static methods without an account surface.
|
|
16
16
|
*/
|
|
17
17
|
accountId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Mount mode, `payment` by default. `setup` saves a payment method and charges nothing, now or later: only methods that can be saved are offered and amount bounds do not apply. Confirm with `createConfirmationToken()`, then create the setup intent server-side.
|
|
20
|
+
*/
|
|
21
|
+
mode?: "payment";
|
|
22
|
+
/**
|
|
23
|
+
* Scoped bearer token for PaymentsElement. Requires `payment:basic:read`; buyer emails additionally require `member:email:read`. Omit only with a same-origin Whop session.
|
|
24
|
+
*/
|
|
25
|
+
accessToken?: string;
|
|
18
26
|
/**
|
|
19
27
|
* Plan ID, prefixed `plan_`. It resolves client-side to currency, amount, and method configuration. Pass a plan or inline currency and amount, never both.
|
|
20
28
|
*/
|
|
@@ -28,7 +36,7 @@ export type PaymentsOptions = (
|
|
|
28
36
|
*/
|
|
29
37
|
returnUrl?: string;
|
|
30
38
|
/**
|
|
31
|
-
*
|
|
39
|
+
* A setup saves the payment method for `off_session` use, the only usage a setup accepts, and displays the save consent.
|
|
32
40
|
*/
|
|
33
41
|
setupFutureUsage?: "off_session" | "on_session";
|
|
34
42
|
/**
|
|
@@ -50,11 +58,19 @@ export type PaymentsOptions = (
|
|
|
50
58
|
}
|
|
51
59
|
| {
|
|
52
60
|
/**
|
|
53
|
-
* Account ID, prefixed `biz_`.
|
|
61
|
+
* Account ID, prefixed `biz_`. Required for PaymentsElement; omit only when calling static methods without an account surface.
|
|
54
62
|
*/
|
|
55
63
|
accountId: string;
|
|
56
64
|
/**
|
|
57
|
-
*
|
|
65
|
+
* Mount mode, `payment` by default. `setup` saves a payment method and charges nothing, now or later: only methods that can be saved are offered and amount bounds do not apply. Confirm with `createConfirmationToken()`, then create the setup intent server-side.
|
|
66
|
+
*/
|
|
67
|
+
mode?: "payment";
|
|
68
|
+
/**
|
|
69
|
+
* Scoped bearer token for PaymentsElement. Requires `payment:basic:read`; buyer emails additionally require `member:email:read`. Omit only with a same-origin Whop session.
|
|
70
|
+
*/
|
|
71
|
+
accessToken?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Lowercase three-letter ISO 4217 currency code. It filters the payment-method matrix.
|
|
58
74
|
*/
|
|
59
75
|
currency: string;
|
|
60
76
|
/**
|
|
@@ -74,7 +90,7 @@ export type PaymentsOptions = (
|
|
|
74
90
|
*/
|
|
75
91
|
returnUrl?: string;
|
|
76
92
|
/**
|
|
77
|
-
*
|
|
93
|
+
* A setup saves the payment method for `off_session` use, the only usage a setup accepts, and displays the save consent.
|
|
78
94
|
*/
|
|
79
95
|
setupFutureUsage?: "off_session" | "on_session";
|
|
80
96
|
/**
|
|
@@ -96,15 +112,81 @@ export type PaymentsOptions = (
|
|
|
96
112
|
}
|
|
97
113
|
| {
|
|
98
114
|
/**
|
|
99
|
-
* Account ID, prefixed `biz_`.
|
|
115
|
+
* Account ID, prefixed `biz_`. Required for PaymentsElement; omit only when calling static methods without an account surface.
|
|
116
|
+
*/
|
|
117
|
+
accountId: string;
|
|
118
|
+
/**
|
|
119
|
+
* Mount mode, `payment` by default. `setup` saves a payment method and charges nothing, now or later: only methods that can be saved are offered and amount bounds do not apply. Confirm with `createConfirmationToken()`, then create the setup intent server-side.
|
|
100
120
|
*/
|
|
101
|
-
|
|
121
|
+
mode: "setup";
|
|
122
|
+
/**
|
|
123
|
+
* Scoped bearer token for PaymentsElement. Requires `payment:basic:read`; buyer emails additionally require `member:email:read`. Omit only with a same-origin Whop session.
|
|
124
|
+
*/
|
|
125
|
+
accessToken?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Lowercase three-letter ISO 4217 currency code. It filters the payment-method matrix.
|
|
128
|
+
*/
|
|
129
|
+
currency: string;
|
|
102
130
|
/**
|
|
103
131
|
* Plan ID, prefixed `plan_`. It resolves client-side to currency, amount, and method configuration. Pass a plan or inline currency and amount, never both.
|
|
104
132
|
*/
|
|
105
133
|
plan?: undefined;
|
|
106
134
|
/**
|
|
107
|
-
*
|
|
135
|
+
* Payment amount in minor units. Methods whose bounds exclude it aren't offered.
|
|
136
|
+
*/
|
|
137
|
+
amount?: undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Minor-unit `feeInclusive` and `feeFree` totals used to gate methods when checkout re-prices `amount` for a fee-free method such as BNPL. Each method is checked against its matching total, preventing the selected fee-free method from disappearing. When omitted, `amount` gates every method.
|
|
140
|
+
*/
|
|
141
|
+
offerAmounts?: undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Account payment-method filters in the API's `enabled`, `disabled`, and `include_platform_defaults` format. `disabled` removes types, `enabled` restores offered types, and `include_platform_defaults: false` leaves only enabled types. Plans provide their own configuration.
|
|
144
|
+
*/
|
|
145
|
+
paymentMethodConfiguration?: { enabled?: string[] | undefined; disabled?: string[] | undefined; include_platform_defaults?: boolean | undefined; };
|
|
146
|
+
/**
|
|
147
|
+
* Return URL for off-site bank or 3DS steps. Defaults to the mounting page.
|
|
148
|
+
*/
|
|
149
|
+
returnUrl?: string;
|
|
150
|
+
/**
|
|
151
|
+
* A setup saves the payment method for `off_session` use, the only usage a setup accepts, and displays the save consent.
|
|
152
|
+
*/
|
|
153
|
+
setupFutureUsage?: "off_session";
|
|
154
|
+
/**
|
|
155
|
+
* Wallet availability override for deterministic previews. Live checkouts probe the host.
|
|
156
|
+
*/
|
|
157
|
+
previewWalletAvailability?: WalletAvailability;
|
|
158
|
+
/**
|
|
159
|
+
* Checkout session updated when a buyer signs in. Pass its `chs_`-prefixed `id` and `client_secret`. Without them, sign-in succeeds but the session does not record the buyer.
|
|
160
|
+
*/
|
|
161
|
+
checkoutSession?: { id: string; clientSecret: string; };
|
|
162
|
+
/**
|
|
163
|
+
* Runs when the grouped loading state changes. The value is `true` while any mounted element is still loading.
|
|
164
|
+
*/
|
|
165
|
+
onLoadingChange?: ((loading: boolean) => void);
|
|
166
|
+
/**
|
|
167
|
+
* Set `false` to turn off Whop's built-in usage analytics for this handle and its elements. The analytics identity is never threaded to its frames. A reserved option, not element data.
|
|
168
|
+
*/
|
|
169
|
+
analytics?: false;
|
|
170
|
+
}
|
|
171
|
+
| {
|
|
172
|
+
/**
|
|
173
|
+
* Account ID, prefixed `biz_`. Required for PaymentsElement; omit only when calling static methods without an account surface.
|
|
174
|
+
*/
|
|
175
|
+
accountId?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Scoped bearer token for PaymentsElement. Requires `payment:basic:read`; buyer emails additionally require `member:email:read`. Omit only with a same-origin Whop session.
|
|
178
|
+
*/
|
|
179
|
+
accessToken?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Mount mode, `payment` by default. `setup` saves a payment method and charges nothing, now or later: only methods that can be saved are offered and amount bounds do not apply. Confirm with `createConfirmationToken()`, then create the setup intent server-side.
|
|
182
|
+
*/
|
|
183
|
+
mode?: undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Plan ID, prefixed `plan_`. It resolves client-side to currency, amount, and method configuration. Pass a plan or inline currency and amount, never both.
|
|
186
|
+
*/
|
|
187
|
+
plan?: undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Lowercase three-letter ISO 4217 currency code. It filters the payment-method matrix.
|
|
108
190
|
*/
|
|
109
191
|
currency?: undefined;
|
|
110
192
|
/**
|
|
@@ -124,7 +206,7 @@ export type PaymentsOptions = (
|
|
|
124
206
|
*/
|
|
125
207
|
returnUrl?: string;
|
|
126
208
|
/**
|
|
127
|
-
*
|
|
209
|
+
* A setup saves the payment method for `off_session` use, the only usage a setup accepts, and displays the save consent.
|
|
128
210
|
*/
|
|
129
211
|
setupFutureUsage?: "off_session" | "on_session";
|
|
130
212
|
/**
|
|
@@ -155,6 +237,120 @@ export type PaymentsOptions = (
|
|
|
155
237
|
locale?: import("./_framework.js").WhopElementsLocale;
|
|
156
238
|
};
|
|
157
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Consumer props for the "payments" element. Set at create (or as `<PaymentsElement />` JSX props), and updatable live via `update()`.
|
|
242
|
+
* @see https://docs.whop.com/elements/latest/payments/payments
|
|
243
|
+
*/
|
|
244
|
+
export interface PaymentsElementProps {
|
|
245
|
+
/**
|
|
246
|
+
* Show the header action menu, Export button, and table settings button.
|
|
247
|
+
* @default true
|
|
248
|
+
*/
|
|
249
|
+
showActions?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Show the three-dot action menu on each payment row.
|
|
252
|
+
* @default true
|
|
253
|
+
*/
|
|
254
|
+
showRowActions?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Show the six payment status boxes above the filters.
|
|
257
|
+
* @default true
|
|
258
|
+
*/
|
|
259
|
+
showStatusTabs?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Show the tracking column and filter for physical-product accounts. Tracking data requires `shipment:basic:read`.
|
|
262
|
+
* @default true
|
|
263
|
+
*/
|
|
264
|
+
showTracking?: boolean;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* The live handle for a mounted "payments" element. Returned by `create("payments")`; in React, the component's `ref`.
|
|
269
|
+
* @see https://docs.whop.com/elements/latest/payments/payments
|
|
270
|
+
*/
|
|
271
|
+
export interface PaymentsElementHandle {
|
|
272
|
+
/**
|
|
273
|
+
* Reload payments after a refund or another change.
|
|
274
|
+
*/
|
|
275
|
+
refresh: () => Promise<void>;
|
|
276
|
+
/**
|
|
277
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
278
|
+
*/
|
|
279
|
+
mount: (target: string | HTMLElement) => void;
|
|
280
|
+
/**
|
|
281
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
282
|
+
*/
|
|
283
|
+
destroy: () => void;
|
|
284
|
+
/**
|
|
285
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
286
|
+
*/
|
|
287
|
+
update: (options: Partial<PaymentsElementProps>) => void;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Options for `create("payments")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* const payments = payments.create("payments", {}); // this interface: props + on<Event> callbacks
|
|
295
|
+
* payments.mount("#payments-payments");
|
|
296
|
+
* ```
|
|
297
|
+
* @see https://docs.whop.com/elements/latest/payments/payments
|
|
298
|
+
*/
|
|
299
|
+
export interface PaymentsElementCreateOptions {
|
|
300
|
+
/**
|
|
301
|
+
* Show the header action menu, Export button, and table settings button.
|
|
302
|
+
* @default true
|
|
303
|
+
*/
|
|
304
|
+
showActions?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Show the three-dot action menu on each payment row.
|
|
307
|
+
* @default true
|
|
308
|
+
*/
|
|
309
|
+
showRowActions?: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Show the six payment status boxes above the filters.
|
|
312
|
+
* @default true
|
|
313
|
+
*/
|
|
314
|
+
showStatusTabs?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Show the tracking column and filter for physical-product accounts. Tracking data requires `shipment:basic:read`.
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
showTracking?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Open payment details in your application.
|
|
322
|
+
*/
|
|
323
|
+
onPaymentSelected?: ((payload: { paymentId: string; }) => void);
|
|
324
|
+
/**
|
|
325
|
+
* Open the invoice in your application.
|
|
326
|
+
*/
|
|
327
|
+
onInvoiceRequested?: ((payload: { paymentId: string; }) => void);
|
|
328
|
+
/**
|
|
329
|
+
* Open the buyer in your application.
|
|
330
|
+
*/
|
|
331
|
+
onUserSelected?: ((payload: { userId: string; }) => void);
|
|
332
|
+
/**
|
|
333
|
+
* The viewer requested a refund. Your application must confirm and authorize it server-side. Refund controls are enabled only when this callback is provided.
|
|
334
|
+
*/
|
|
335
|
+
onRefundRequested?: ((payload: { paymentIds: string[]; }) => void);
|
|
336
|
+
/**
|
|
337
|
+
* Open the account’s payment settings in your application.
|
|
338
|
+
*/
|
|
339
|
+
onSettingsRequested?: ((payload: Record<string, never>) => void);
|
|
340
|
+
/**
|
|
341
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
342
|
+
*/
|
|
343
|
+
onLoaderStart?: (() => void);
|
|
344
|
+
/**
|
|
345
|
+
* Runs after the element's first complete paint.
|
|
346
|
+
*/
|
|
347
|
+
onReady?: (() => void);
|
|
348
|
+
/**
|
|
349
|
+
* 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.
|
|
350
|
+
*/
|
|
351
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
352
|
+
}
|
|
353
|
+
|
|
158
354
|
/**
|
|
159
355
|
* Consumer props for the "payment" element. Set at create (or as `<PaymentElement />` JSX props), and updatable live via `update()`.
|
|
160
356
|
* @see https://docs.whop.com/elements/latest/payments/payment
|
|
@@ -166,7 +362,7 @@ export interface PaymentElementProps {
|
|
|
166
362
|
*/
|
|
167
363
|
order?: string[];
|
|
168
364
|
/**
|
|
169
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
365
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
170
366
|
* @default {"billingDetails":"minimal"}
|
|
171
367
|
*/
|
|
172
368
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -226,7 +422,7 @@ export interface PaymentElementCreateOptions {
|
|
|
226
422
|
*/
|
|
227
423
|
order?: string[];
|
|
228
424
|
/**
|
|
229
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
425
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
230
426
|
* @default {"billingDetails":"minimal"}
|
|
231
427
|
*/
|
|
232
428
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -246,7 +442,7 @@ export interface PaymentElementCreateOptions {
|
|
|
246
442
|
*/
|
|
247
443
|
autoSelect?: boolean;
|
|
248
444
|
/**
|
|
249
|
-
* Fires when selection changes. `complete: true` means the buyer selected a method and completed its card fields or required inputs. Use it to enable confirmation. `method` provides category, per-currency countries, and amount bounds for dependent UI such as country fields
|
|
445
|
+
* Fires when selection changes. `complete: true` means the buyer selected a method and completed its card fields or required inputs. Use it to enable confirmation. `method` provides category, per-currency countries, and amount bounds for dependent UI such as country fields. `supportsBuyerFee` indicates whether to include Whop's buyer service fee in the displayed total.
|
|
250
446
|
*/
|
|
251
447
|
onChange?: ((payload: { complete: boolean; type?: string | undefined; supportsBuyerFee?: boolean | undefined; method?: { type: string; category: string; template: string; display_name: string; countries: ({ country: string; min_amount: number | null; max_amount: number | null; })[]; min_amount: number | null; max_amount: number | null; } | undefined; }) => void);
|
|
252
448
|
/**
|
|
@@ -273,10 +469,10 @@ export interface PaymentElementCreateOptions {
|
|
|
273
469
|
*/
|
|
274
470
|
export interface AddressElementProps {
|
|
275
471
|
/**
|
|
276
|
-
* `
|
|
277
|
-
* @default "
|
|
472
|
+
* Browser autocomplete purpose: `billing` (default) or `shipping`.
|
|
473
|
+
* @default "billing"
|
|
278
474
|
*/
|
|
279
|
-
|
|
475
|
+
mode?: "billing" | "shipping";
|
|
280
476
|
/**
|
|
281
477
|
* Address line 2: always visible (default), revealed by a text button (`toggle`), or never collected.
|
|
282
478
|
* @default "always"
|
|
@@ -288,10 +484,10 @@ export interface AddressElementProps {
|
|
|
288
484
|
*/
|
|
289
485
|
name?: "split" | "combined" | "none";
|
|
290
486
|
/**
|
|
291
|
-
*
|
|
292
|
-
* @default "
|
|
487
|
+
* `full` (default) stacks labeled fields. `compact` groups placeholder-labeled fields within one border.
|
|
488
|
+
* @default "full"
|
|
293
489
|
*/
|
|
294
|
-
|
|
490
|
+
layout?: "full" | "compact";
|
|
295
491
|
/**
|
|
296
492
|
* `full` (default) follows the selected country's complete address format. `minimal` collects only country and postal code. `name` independently adds required name fields. Set `name` to `none` to omit them. This element does not add fields required by a payment method. Card confirmation requires a name, country, and postal code, so keep `name` enabled or pass `billingDetails.name`.
|
|
297
493
|
* @default "full"
|
|
@@ -323,7 +519,7 @@ export interface AddressElementProps {
|
|
|
323
519
|
/**
|
|
324
520
|
* Additional fields rendered with the address form. Values are validated and emitted in the separate `custom` map.
|
|
325
521
|
*/
|
|
326
|
-
customFields?: ({ key: string; label: string; type: "text" | "
|
|
522
|
+
customFields?: ({ key: string; label: string; type: "text" | "select" | "phone" | "date"; position: "after_name" | "after_organization" | "before_country" | "after_address"; required?: boolean | undefined; options?: string[] | undefined; format?: string | undefined; autocomplete?: string | undefined; })[];
|
|
327
523
|
/**
|
|
328
524
|
* Fallback country after `defaultValues` and IP detection. Use an ISO 3166-1 alpha-2 code. An empty value falls back to `US`.
|
|
329
525
|
* @default ""
|
|
@@ -369,10 +565,10 @@ export interface AddressElementHandle {
|
|
|
369
565
|
*/
|
|
370
566
|
export interface AddressElementCreateOptions {
|
|
371
567
|
/**
|
|
372
|
-
* `
|
|
373
|
-
* @default "
|
|
568
|
+
* Browser autocomplete purpose: `billing` (default) or `shipping`.
|
|
569
|
+
* @default "billing"
|
|
374
570
|
*/
|
|
375
|
-
|
|
571
|
+
mode?: "billing" | "shipping";
|
|
376
572
|
/**
|
|
377
573
|
* Address line 2: always visible (default), revealed by a text button (`toggle`), or never collected.
|
|
378
574
|
* @default "always"
|
|
@@ -384,10 +580,10 @@ export interface AddressElementCreateOptions {
|
|
|
384
580
|
*/
|
|
385
581
|
name?: "split" | "combined" | "none";
|
|
386
582
|
/**
|
|
387
|
-
*
|
|
388
|
-
* @default "
|
|
583
|
+
* `full` (default) stacks labeled fields. `compact` groups placeholder-labeled fields within one border.
|
|
584
|
+
* @default "full"
|
|
389
585
|
*/
|
|
390
|
-
|
|
586
|
+
layout?: "full" | "compact";
|
|
391
587
|
/**
|
|
392
588
|
* `full` (default) follows the selected country's complete address format. `minimal` collects only country and postal code. `name` independently adds required name fields. Set `name` to `none` to omit them. This element does not add fields required by a payment method. Card confirmation requires a name, country, and postal code, so keep `name` enabled or pass `billingDetails.name`.
|
|
393
589
|
* @default "full"
|
|
@@ -419,7 +615,7 @@ export interface AddressElementCreateOptions {
|
|
|
419
615
|
/**
|
|
420
616
|
* Additional fields rendered with the address form. Values are validated and emitted in the separate `custom` map.
|
|
421
617
|
*/
|
|
422
|
-
customFields?: ({ key: string; label: string; type: "text" | "
|
|
618
|
+
customFields?: ({ key: string; label: string; type: "text" | "select" | "phone" | "date"; position: "after_name" | "after_organization" | "before_country" | "after_address"; required?: boolean | undefined; options?: string[] | undefined; format?: string | undefined; autocomplete?: string | undefined; })[];
|
|
423
619
|
/**
|
|
424
620
|
* Fallback country after `defaultValues` and IP detection. Use an ISO 3166-1 alpha-2 code. An empty value falls back to `US`.
|
|
425
621
|
* @default ""
|
|
@@ -490,9 +686,9 @@ export interface CardElementCreateOptions {
|
|
|
490
686
|
*/
|
|
491
687
|
layout?: "compact" | "stacked";
|
|
492
688
|
/**
|
|
493
|
-
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one.
|
|
689
|
+
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
494
690
|
*/
|
|
495
|
-
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; }) => void);
|
|
691
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
496
692
|
/**
|
|
497
693
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
498
694
|
*/
|
|
@@ -602,7 +798,7 @@ export interface TaxIdElementProps {
|
|
|
602
798
|
*/
|
|
603
799
|
disabled?: boolean;
|
|
604
800
|
/**
|
|
605
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
801
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
606
802
|
* @default ""
|
|
607
803
|
*/
|
|
608
804
|
country?: string;
|
|
@@ -652,7 +848,7 @@ export interface TaxIdElementCreateOptions {
|
|
|
652
848
|
*/
|
|
653
849
|
disabled?: boolean;
|
|
654
850
|
/**
|
|
655
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
851
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
656
852
|
* @default ""
|
|
657
853
|
*/
|
|
658
854
|
country?: string;
|
|
@@ -751,9 +947,9 @@ export interface CardFieldsSubOptions {
|
|
|
751
947
|
*/
|
|
752
948
|
networks?: CardNetworkArt[];
|
|
753
949
|
/**
|
|
754
|
-
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one.
|
|
950
|
+
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
755
951
|
*/
|
|
756
|
-
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; }) => void);
|
|
952
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
757
953
|
}
|
|
758
954
|
|
|
759
955
|
/**
|
|
@@ -950,6 +1146,11 @@ export interface PaymentRequestResourceOptions {
|
|
|
950
1146
|
* @default true
|
|
951
1147
|
*/
|
|
952
1148
|
requestPayerEmail?: boolean;
|
|
1149
|
+
/**
|
|
1150
|
+
* Ask the sheet for the payer's phone number, delivered as `payer.phone` on the result — in E.164 where it parses against the country of the contact that supplied it, as the wallet gave it otherwise; `payer.country` is the billing country. Google Pay collects it through the billing address the sheet already asks for.
|
|
1151
|
+
* @default false
|
|
1152
|
+
*/
|
|
1153
|
+
requestPayerPhone?: boolean;
|
|
953
1154
|
/**
|
|
954
1155
|
* Ask the sheet for a shipping address (and offer `shippingOptions` when given).
|
|
955
1156
|
* @default false
|
|
@@ -975,7 +1176,7 @@ export interface PaymentRequestResourceOptions {
|
|
|
975
1176
|
*/
|
|
976
1177
|
export interface PaymentRequestResource {
|
|
977
1178
|
/**
|
|
978
|
-
* Returns availability for each wallet when the account offers it, the device supports it, and this page's origin is approved for the account (first-party whop.com pages are pre-approved; a merchant page needs its domain registered as a payment method domain). Apple Pay on non-WebKit browsers is the desktop iPhone-handoff flow, so mobile devices there report it unavailable — native Apple Pay on iOS browsers is unaffected. `order` ranks the wallets by which sheet is native to the browser — Apple Pay first on Safari, Google Pay first elsewhere — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
1179
|
+
* Returns availability for each wallet when the account offers it, the device supports it, and this page's origin is approved for the account (first-party whop.com pages are pre-approved; a merchant page needs its domain registered and verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain)). Apple Pay on non-WebKit browsers is the desktop iPhone-handoff flow, so mobile devices there report it unavailable — native Apple Pay on iOS browsers is unaffected. `order` ranks the wallets by which sheet is native to the browser — Apple Pay first on Safari, Google Pay first elsewhere — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
979
1180
|
*/
|
|
980
1181
|
canMakePayment: () => Promise<WalletAvailability>;
|
|
981
1182
|
/**
|
|
@@ -1018,6 +1219,10 @@ export interface PaymentRequestResource {
|
|
|
1018
1219
|
* @see https://docs.whop.com/elements/latest/payments/overview
|
|
1019
1220
|
*/
|
|
1020
1221
|
export interface PaymentsHandle {
|
|
1222
|
+
/**
|
|
1223
|
+
* The dashboard payments table with status cards, search, filters, sorting, row selection, CSV export, column settings, and pagination. Reads all payment pages to compute complete counts and filter locally; intended for accounts with modest payment histories. Customer details and refunds are handed to your application through events.
|
|
1224
|
+
*/
|
|
1225
|
+
create(name: "payments", options?: PaymentsElementCreateOptions): PaymentsElementHandle;
|
|
1021
1226
|
/**
|
|
1022
1227
|
* Shows available payment methods and collects the selected method's required fields and disclosures. Use `change` to enable your pay button. In its activation handler, call `payments.createConfirmationToken()`. Confirm the token server-side, then pass any pending step to `payments.handleNextAction(…)`. Use `addressChange` for address-dependent updates.
|
|
1023
1228
|
* Exclusive slot `entry`. Mount exactly one of: payment | card | cardFields.
|
|
@@ -1070,7 +1275,7 @@ export interface PaymentsHandle {
|
|
|
1070
1275
|
*/
|
|
1071
1276
|
export interface PaymentsStatics {
|
|
1072
1277
|
/**
|
|
1073
|
-
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL.
|
|
1278
|
+
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL. Inside an iframe they navigate the top-level tab. If the embedding page refuses that navigation, they reject with code `TAB_NAVIGATION_BLOCKED`, and the payment stays pending. Set `returnUrl` to update the destination before presentation. An update failure rejects before any step runs. Inline steps never navigate to that URL. A payment whose charge is still being decided is polled until a step appears or it settles; a decided payment with no step resolves immediately.
|
|
1074
1279
|
*/
|
|
1075
1280
|
handleNextAction: (input: { clientSecret: string; returnUrl?: string | undefined; pollIntervalMs?: number | undefined; }) => Promise<{ status: string; redirected: boolean; lastPaymentError: { code?: string | null | undefined; decline_code?: string | null | undefined; message?: string | null | undefined; } | null; }>;
|
|
1076
1281
|
/**
|
|
@@ -1149,7 +1354,7 @@ export interface PaymentRequestResult {
|
|
|
1149
1354
|
*/
|
|
1150
1355
|
ctok: string;
|
|
1151
1356
|
type: "apple_pay" | "google_pay";
|
|
1152
|
-
payer: { email?: string | undefined; name?: string | undefined; phone?: string | undefined; };
|
|
1357
|
+
payer: { email?: string | undefined; name?: string | undefined; phone?: string | undefined; country?: string | undefined; };
|
|
1153
1358
|
shipping: { address?: PaymentRequestAddress | undefined; option?: PaymentRequestShippingOption | undefined; } | null;
|
|
1154
1359
|
}
|
|
1155
1360
|
|
package/tracking.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ export interface TrackingOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
accessToken?: string;
|
|
22
22
|
/**
|
|
23
|
-
* Where person links lead on your site. `person` is an absolute-URL template with two placeholders, each replaced URL-encoded per row: `{personId}` is the stable `prsn_…` ID, identical for the same person on every surface
|
|
23
|
+
* Where person links lead on your site. `person` is an absolute-URL template with two placeholders, each replaced URL-encoded per row: `{personId}` is the stable `prsn_…` ID, identical for the same person on every surface, so key your page on it and mount the `person` element there; `{identifier}` is the most human-meaningful identifier the surface has (a user ID or email where known), so it can differ across surfaces. It must be absolute (`https://…`); a relative URL would resolve against the element frame, so one is treated as unset. Unset, a person click raises `personOpened` on its element instead, which is the cue to present `person` over your page. `people` and `events` base URLs are accepted for symmetry with the ads handle but nothing under this handle renders them.
|
|
24
24
|
* @default {}
|
|
25
25
|
*/
|
|
26
26
|
links?: CrossLinksConfig;
|
|
@@ -265,7 +265,7 @@ export interface PeopleElementCreateOptions {
|
|
|
265
265
|
*/
|
|
266
266
|
onSortChanged?: ((payload: { sort: string; dir: "asc" | "desc"; }) => void);
|
|
267
267
|
/**
|
|
268
|
-
* The viewer clicked a person row and the handle has no `links.person` to follow
|
|
268
|
+
* The viewer clicked a person row and the handle has no `links.person` to follow. Present the `person` element with it, e.g. `createOverlay("person", { identifier: payload.personId })` (`personId` is the stable per-person key; `identifier` is the most human-meaningful one the surface has), or pass `links.person` on the handle to turn rows into real anchors instead.
|
|
269
269
|
*/
|
|
270
270
|
onPersonOpened?: ((payload: { identifier: string; personId: string; }) => void);
|
|
271
271
|
/**
|
|
@@ -431,7 +431,7 @@ export interface EventsElementCreateOptions {
|
|
|
431
431
|
*/
|
|
432
432
|
onFiltersChanged?: ((payload: EventsFilterBag) => void);
|
|
433
433
|
/**
|
|
434
|
-
* The viewer clicked a person cell and the handle has no `links.person` to follow
|
|
434
|
+
* The viewer clicked a person cell and the handle has no `links.person` to follow. Present the `person` element with it, e.g. `createOverlay("person", { identifier: payload.personId })` (`personId` is the stable per-person key; `identifier` is the most human-meaningful one the surface has), or pass `links.person` on the handle to turn the cells into real anchors instead.
|
|
435
435
|
*/
|
|
436
436
|
onPersonOpened?: ((payload: { identifier: string; personId: string; }) => void);
|
|
437
437
|
/**
|
|
@@ -448,6 +448,89 @@ export interface EventsElementCreateOptions {
|
|
|
448
448
|
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Consumer props for the "person" element. Set at create (or as `<PersonElement />` JSX props), and updatable live via `update()`.
|
|
453
|
+
* @see https://docs.whop.com/elements/latest/tracking/person
|
|
454
|
+
*/
|
|
455
|
+
export interface PersonElementProps {
|
|
456
|
+
/**
|
|
457
|
+
* The person to show, as any identifier the account has seen them under: the stable `prsn_…` person ID, a Whop user ID, or an email. Required. `personOpened` carries two of these; prefer its `personId`, the stable key that names the same person on every surface. If nothing resolves, the view says so rather than rendering empty.
|
|
458
|
+
* @default ""
|
|
459
|
+
*/
|
|
460
|
+
identifier?: string;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* The live handle for a mounted "person" element. Returned by `create("person")`; in React, the component's `ref`.
|
|
465
|
+
* @see https://docs.whop.com/elements/latest/tracking/person
|
|
466
|
+
*/
|
|
467
|
+
export interface PersonElementHandle {
|
|
468
|
+
/**
|
|
469
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
470
|
+
*/
|
|
471
|
+
mount: (target: string | HTMLElement) => void;
|
|
472
|
+
/**
|
|
473
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
474
|
+
*/
|
|
475
|
+
destroy: () => void;
|
|
476
|
+
/**
|
|
477
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
478
|
+
*/
|
|
479
|
+
update: (options: Partial<PersonElementProps>) => void;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Options for `create("person")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* const person = tracking.create("person", {}); // this interface: props + on<Event> callbacks
|
|
487
|
+
* person.mount("#tracking-person");
|
|
488
|
+
* ```
|
|
489
|
+
* @see https://docs.whop.com/elements/latest/tracking/person
|
|
490
|
+
*/
|
|
491
|
+
export interface PersonElementCreateOptions {
|
|
492
|
+
/**
|
|
493
|
+
* The person to show, as any identifier the account has seen them under: the stable `prsn_…` person ID, a Whop user ID, or an email. Required. `personOpened` carries two of these; prefer its `personId`, the stable key that names the same person on every surface. If nothing resolves, the view says so rather than rendering empty.
|
|
494
|
+
* @default ""
|
|
495
|
+
*/
|
|
496
|
+
identifier?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
499
|
+
*/
|
|
500
|
+
onLoaderStart?: (() => void);
|
|
501
|
+
/**
|
|
502
|
+
* Runs after the element's first complete paint.
|
|
503
|
+
*/
|
|
504
|
+
onReady?: (() => void);
|
|
505
|
+
/**
|
|
506
|
+
* 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.
|
|
507
|
+
*/
|
|
508
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* The overlay handle for "person". Returned by `createOverlay("person")`; drives the modal presentation imperatively.
|
|
513
|
+
* @see https://docs.whop.com/elements/latest/tracking/person
|
|
514
|
+
*/
|
|
515
|
+
export interface PersonElementOverlayHandle {
|
|
516
|
+
/**
|
|
517
|
+
* Open the overlay. The first call mounts the element. Later calls reuse it.
|
|
518
|
+
*/
|
|
519
|
+
open(): void;
|
|
520
|
+
/**
|
|
521
|
+
* Close the overlay without destroying it. Keep the handle and `open()` again.
|
|
522
|
+
*/
|
|
523
|
+
close(): void;
|
|
524
|
+
/**
|
|
525
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
526
|
+
*/
|
|
527
|
+
destroy(): void;
|
|
528
|
+
/**
|
|
529
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
530
|
+
*/
|
|
531
|
+
update(options: Partial<PersonElementProps>): void;
|
|
532
|
+
}
|
|
533
|
+
|
|
451
534
|
/**
|
|
452
535
|
* The Tracking handle, returned by `whop.tracking.create()` (React: `useTracking()`). Mounts the elements and carries the controller's actions.
|
|
453
536
|
* @see https://docs.whop.com/elements/latest/tracking/overview
|
|
@@ -461,6 +544,14 @@ export interface TrackingHandle {
|
|
|
461
544
|
* Every event the account measured — page views, leads, purchases, and custom pixel events — as a raw, filterable stream. The rows behind any metric: filter by event, source, geography, or device over the handle’s window, or search one person’s identifier to read their whole journey. A person cell follows `links.person` when the handle configures it, and otherwise comes back to you as `personOpened`.
|
|
462
545
|
*/
|
|
463
546
|
create(name: "events", options?: EventsElementCreateOptions): EventsElementHandle;
|
|
547
|
+
/**
|
|
548
|
+
* Everything the account knows about one person: who they are, where they came from, what they have spent, and every event they have performed, in order. The view a person click leads to: mount it on the page `links.person` points at, or present it over your own page when `people` or `events` raise `personOpened`. `identifier` takes any identifier a person has been seen under, so a `personOpened` payload resolves here unchanged.
|
|
549
|
+
*/
|
|
550
|
+
create(name: "person", options?: PersonElementCreateOptions): PersonElementHandle;
|
|
551
|
+
/**
|
|
552
|
+
* Everything the account knows about one person: who they are, where they came from, what they have spent, and every event they have performed, in order. The view a person click leads to: mount it on the page `links.person` points at, or present it over your own page when `people` or `events` raise `personOpened`. `identifier` takes any identifier a person has been seen under, so a `personOpened` payload resolves here unchanged.
|
|
553
|
+
*/
|
|
554
|
+
createOverlay(name: "person", options?: PersonElementCreateOptions): PersonElementOverlayHandle;
|
|
464
555
|
/**
|
|
465
556
|
* Merges new handle options into every mounted element. In React, change the namespace props instead.
|
|
466
557
|
*/
|