@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
|
@@ -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" | "airwallex"; 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
|
+
}
|