@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/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
|
*/
|
package/tracking.d.ts
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
|
*/
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for `whop.verifications.create()`: the controller's props plus its `on<Event>` callbacks. In React, these are the `<Verifications>` component's props.
|
|
3
|
+
* @example
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { loadWhop } from "@whop/elements";
|
|
6
|
+
*
|
|
7
|
+
* const whop = (await loadWhop())({ locale: "en" });
|
|
8
|
+
* const verifications = whop.verifications.create({}); // options: props + on<Event> callbacks
|
|
9
|
+
* ```
|
|
10
|
+
* @see https://docs.whop.com/elements/latest/verifications/overview
|
|
11
|
+
*/
|
|
12
|
+
export interface VerificationsOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Use `individual` for KYC or `business` for KYB. The mounted element owns the matching intake form.
|
|
15
|
+
* @default "individual"
|
|
16
|
+
*/
|
|
17
|
+
kind?: "individual" | "business";
|
|
18
|
+
/**
|
|
19
|
+
* The account being verified: a company `biz_…` tag or the viewer's own `user_…` tag.
|
|
20
|
+
*/
|
|
21
|
+
accountId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Called on your page before the element mounts. Return a fresh bearer credential with `identity:read` and `identity:write`; omit it only for a same-origin Whop session.
|
|
24
|
+
*/
|
|
25
|
+
getToken?: (() => Promise<string>);
|
|
26
|
+
/**
|
|
27
|
+
* Runs when the grouped loading state changes. The value is `true` while any mounted element is still loading.
|
|
28
|
+
*/
|
|
29
|
+
onLoadingChange?: ((loading: boolean) => void);
|
|
30
|
+
/**
|
|
31
|
+
* 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.
|
|
32
|
+
*/
|
|
33
|
+
analytics?: false;
|
|
34
|
+
/**
|
|
35
|
+
* Visual customization for this group's elements. Overrides the global `WhopElements({ appearance })`. Change it live with `update({ appearance })`.
|
|
36
|
+
*/
|
|
37
|
+
appearance?: import("./_framework.js").Appearance;
|
|
38
|
+
/**
|
|
39
|
+
* Locale for this group's element UI text. Set it to one of the app's built locales to override the global configuration. Any other value falls back to the default locale.
|
|
40
|
+
*/
|
|
41
|
+
locale?: import("./_framework.js").WhopElementsLocale;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Consumer props for the "kyc" element. Set at create (or as `<KycElement />` JSX props), and updatable live via `update()`.
|
|
46
|
+
* @see https://docs.whop.com/elements/latest/verifications/kyc
|
|
47
|
+
*/
|
|
48
|
+
export interface KycElementProps {}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The live handle for a mounted "kyc" element. Returned by `create("kyc")`; in React, the component's `ref`.
|
|
52
|
+
* @see https://docs.whop.com/elements/latest/verifications/kyc
|
|
53
|
+
*/
|
|
54
|
+
export interface KycElementHandle {
|
|
55
|
+
/**
|
|
56
|
+
* Fetch the latest verification status immediately. Pending and review states also poll automatically.
|
|
57
|
+
*/
|
|
58
|
+
refresh: () => Promise<{ verificationId: string; status: "not_started" | "pending" | "processing" | "manual_review" | "approved" | "rejected" | "action_required"; } | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Abandon the current attempt and start a fresh hosted session immediately.
|
|
61
|
+
*/
|
|
62
|
+
restart: () => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
65
|
+
*/
|
|
66
|
+
mount: (target: string | HTMLElement) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
69
|
+
*/
|
|
70
|
+
destroy: () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
73
|
+
*/
|
|
74
|
+
update: (options: Partial<KycElementProps>) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Options for `create("kyc")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const kyc = verifications.create("kyc", {}); // this interface: props + on<Event> callbacks
|
|
82
|
+
* kyc.mount("#verifications-kyc");
|
|
83
|
+
* ```
|
|
84
|
+
* @see https://docs.whop.com/elements/latest/verifications/kyc
|
|
85
|
+
*/
|
|
86
|
+
export interface KycElementCreateOptions {
|
|
87
|
+
/**
|
|
88
|
+
* The verification entered a new status, including the status found on first mount.
|
|
89
|
+
*/
|
|
90
|
+
onStatusChanged?: ((payload: { verificationId: string; status: "not_started" | "pending" | "processing" | "manual_review" | "approved" | "rejected" | "action_required"; }) => void);
|
|
91
|
+
/**
|
|
92
|
+
* Verification was approved. Fires once when the element first observes `approved`.
|
|
93
|
+
*/
|
|
94
|
+
onCompleted?: ((payload: { verificationId: string; }) => void);
|
|
95
|
+
/**
|
|
96
|
+
* Whop needs follow-up information. The element renders and submits the requested fields itself.
|
|
97
|
+
*/
|
|
98
|
+
onActionRequired?: ((payload: { verificationId: string; requestedInformation: ActionRequiredItem[]; }) => void);
|
|
99
|
+
/**
|
|
100
|
+
* The initial load, intake submission, follow-up submission, or an explicit restart failed.
|
|
101
|
+
*/
|
|
102
|
+
onLoadFailed?: ((payload: { reason: "access_denied" | "unavailable"; }) => void);
|
|
103
|
+
/**
|
|
104
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
105
|
+
*/
|
|
106
|
+
onLoaderStart?: (() => void);
|
|
107
|
+
/**
|
|
108
|
+
* Runs after the element's first complete paint.
|
|
109
|
+
*/
|
|
110
|
+
onReady?: (() => void);
|
|
111
|
+
/**
|
|
112
|
+
* 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.
|
|
113
|
+
*/
|
|
114
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Consumer props for the "capabilities" element. Set at create (or as `<CapabilitiesElement />` JSX props), and updatable live via `update()`.
|
|
119
|
+
* @see https://docs.whop.com/elements/latest/verifications/capabilities
|
|
120
|
+
*/
|
|
121
|
+
export interface CapabilitiesElementProps {
|
|
122
|
+
/**
|
|
123
|
+
* Hide the individual and business verification rows, leaving only the capabilities.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
hideStatus?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Hide the capabilities list, leaving only the two verification rows.
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
hideCapabilities?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The live handle for a mounted "capabilities" element. Returned by `create("capabilities")`; in React, the component's `ref`.
|
|
136
|
+
* @see https://docs.whop.com/elements/latest/verifications/capabilities
|
|
137
|
+
*/
|
|
138
|
+
export interface CapabilitiesElementHandle {
|
|
139
|
+
/**
|
|
140
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
141
|
+
*/
|
|
142
|
+
mount: (target: string | HTMLElement) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
145
|
+
*/
|
|
146
|
+
destroy: () => void;
|
|
147
|
+
/**
|
|
148
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
149
|
+
*/
|
|
150
|
+
update: (options: Partial<CapabilitiesElementProps>) => void;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Options for `create("capabilities")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const capabilities = verifications.create("capabilities", {}); // this interface: props + on<Event> callbacks
|
|
158
|
+
* capabilities.mount("#verifications-capabilities");
|
|
159
|
+
* ```
|
|
160
|
+
* @see https://docs.whop.com/elements/latest/verifications/capabilities
|
|
161
|
+
*/
|
|
162
|
+
export interface CapabilitiesElementCreateOptions {
|
|
163
|
+
/**
|
|
164
|
+
* Hide the individual and business verification rows, leaving only the capabilities.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
hideStatus?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Hide the capabilities list, leaving only the two verification rows.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
hideCapabilities?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* The viewer pressed a verify button. The element never navigates — mount your own verification, such as this namespace’s `kyc` element, in answer to this.
|
|
175
|
+
*/
|
|
176
|
+
onVerificationRequested?: ((payload: { accountId: string; kind: "individual" | "business"; }) => void);
|
|
177
|
+
/**
|
|
178
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
179
|
+
*/
|
|
180
|
+
onLoaderStart?: (() => void);
|
|
181
|
+
/**
|
|
182
|
+
* Runs after the element's first complete paint.
|
|
183
|
+
*/
|
|
184
|
+
onReady?: (() => void);
|
|
185
|
+
/**
|
|
186
|
+
* 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.
|
|
187
|
+
*/
|
|
188
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Consumer props for the "rfi" element. Set at create (or as `<RfiElement />` JSX props), and updatable live via `update()`.
|
|
193
|
+
* @see https://docs.whop.com/elements/latest/verifications/rfi
|
|
194
|
+
*/
|
|
195
|
+
export interface RfiElementProps {
|
|
196
|
+
/**
|
|
197
|
+
* Hide the rows that are already with a reviewer, leaving only what the viewer can act on.
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
hideUnderReview?: boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The live handle for a mounted "rfi" element. Returned by `create("rfi")`; in React, the component's `ref`.
|
|
205
|
+
* @see https://docs.whop.com/elements/latest/verifications/rfi
|
|
206
|
+
*/
|
|
207
|
+
export interface RfiElementHandle {
|
|
208
|
+
/**
|
|
209
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
210
|
+
*/
|
|
211
|
+
mount: (target: string | HTMLElement) => void;
|
|
212
|
+
/**
|
|
213
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
214
|
+
*/
|
|
215
|
+
destroy: () => void;
|
|
216
|
+
/**
|
|
217
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
218
|
+
*/
|
|
219
|
+
update: (options: Partial<RfiElementProps>) => void;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Options for `create("rfi")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* const rfi = verifications.create("rfi", {}); // this interface: props + on<Event> callbacks
|
|
227
|
+
* rfi.mount("#verifications-rfi");
|
|
228
|
+
* ```
|
|
229
|
+
* @see https://docs.whop.com/elements/latest/verifications/rfi
|
|
230
|
+
*/
|
|
231
|
+
export interface RfiElementCreateOptions {
|
|
232
|
+
/**
|
|
233
|
+
* Hide the rows that are already with a reviewer, leaving only what the viewer can act on.
|
|
234
|
+
* @default false
|
|
235
|
+
*/
|
|
236
|
+
hideUnderReview?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* One group of requirements was answered. Fires per group, not once per field.
|
|
239
|
+
*/
|
|
240
|
+
onSubmitted?: ((payload: { source: "identity" | "payout" | "audit" | "card_issuing" | "bank" | "ads" | "application"; itemIds: string[]; }) => void);
|
|
241
|
+
/**
|
|
242
|
+
* Nothing is outstanding any more. Fires when the element first observes an empty list, including on mount.
|
|
243
|
+
*/
|
|
244
|
+
onCompleted?: ((payload: { accountId: string; }) => void);
|
|
245
|
+
/**
|
|
246
|
+
* The outstanding requests could not be read, or answering one failed.
|
|
247
|
+
*/
|
|
248
|
+
onLoadFailed?: ((payload: { reason: "access_denied" | "unavailable"; }) => void);
|
|
249
|
+
/**
|
|
250
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
251
|
+
*/
|
|
252
|
+
onLoaderStart?: (() => void);
|
|
253
|
+
/**
|
|
254
|
+
* Runs after the element's first complete paint.
|
|
255
|
+
*/
|
|
256
|
+
onReady?: (() => void);
|
|
257
|
+
/**
|
|
258
|
+
* 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.
|
|
259
|
+
*/
|
|
260
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The Verifications handle, returned by `whop.verifications.create()` (React: `useVerifications()`). Mounts the elements and carries the controller's actions.
|
|
265
|
+
* @see https://docs.whop.com/elements/latest/verifications/overview
|
|
266
|
+
*/
|
|
267
|
+
export interface VerificationsHandle {
|
|
268
|
+
/**
|
|
269
|
+
* A complete identity-verification flow. It collects individual KYC or business KYB details, starts or resumes the hosted provider session, handles follow-up information and document requests, polls status, and renders the final result without requiring the host to build verification UI.
|
|
270
|
+
*/
|
|
271
|
+
create(name: "kyc", options?: KycElementCreateOptions): KycElementHandle;
|
|
272
|
+
/**
|
|
273
|
+
* The account's verification standing: whether individual and business verification are done, and which capabilities that unlocks. Read-only — pressing a verify button reports `verificationRequested` and stays put, so the host mounts its own flow, such as this namespace's `kyc` element. Both halves can be hidden, so a host that only wants the capability list, or only the two verification rows, can drop the other.
|
|
274
|
+
*/
|
|
275
|
+
create(name: "capabilities", options?: CapabilitiesElementCreateOptions): CapabilitiesElementHandle;
|
|
276
|
+
/**
|
|
277
|
+
* Everything the account still owes compliance, and the forms to answer it. Each row is one group of requirements — grouped by the system that asked, because each relays to its provider once its own items are answered — and pressing it opens that group’s form in place. Rows already with a reviewer are shown but not answerable. Renders an all-clear once nothing is outstanding, so it can sit permanently in a settings page.
|
|
278
|
+
*/
|
|
279
|
+
create(name: "rfi", options?: RfiElementCreateOptions): RfiElementHandle;
|
|
280
|
+
/**
|
|
281
|
+
* Merges new handle options into every mounted element. In React, change the namespace props instead.
|
|
282
|
+
*/
|
|
283
|
+
update(options: Partial<VerificationsOptions>): void;
|
|
284
|
+
/**
|
|
285
|
+
* Destroys every element and sub-controller this handle created, removes the controller frame, and releases its subscriptions. You can call it more than once, but a destroyed handle refuses any other call — create a new handle to start over. React removes the group automatically when the provider unmounts.
|
|
286
|
+
*/
|
|
287
|
+
destroy(): void;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Verifications's static actions, callable with nothing mounted: `whop.verifications.<method>()` (React: `useWhop().verifications.<method>()`).
|
|
292
|
+
* @see https://docs.whop.com/elements/latest/verifications/overview
|
|
293
|
+
*/
|
|
294
|
+
export interface VerificationsStatics {}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Declared from the app's `ActionRequiredItem`, referenced by a host-capability surface.
|
|
298
|
+
*/
|
|
299
|
+
export interface ActionRequiredItem {
|
|
300
|
+
id: string;
|
|
301
|
+
requirement: string;
|
|
302
|
+
type: string;
|
|
303
|
+
label: string;
|
|
304
|
+
source?: "identity" | "payout" | "audit" | "card_issuing" | "bank" | "ads" | "application" | undefined;
|
|
305
|
+
optional?: boolean | undefined;
|
|
306
|
+
options?: string[] | undefined;
|
|
307
|
+
errors?: { code: string; reason: string; }[] | undefined;
|
|
308
|
+
}
|