@whop/elements 0.0.0 → 1.0.0-beta.0
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/LICENSE +21 -0
- package/README.md +29 -0
- package/_framework.d.cts +179 -0
- package/_framework.d.ts +179 -0
- package/ads.d.cts +581 -0
- package/ads.d.ts +581 -0
- package/checkout.d.cts +139 -0
- package/checkout.d.ts +139 -0
- package/index.cjs +86 -0
- package/index.d.cts +61 -0
- package/index.d.ts +61 -0
- package/index.js +63 -0
- package/package.json +80 -5
- package/payments.d.cts +1142 -0
- package/payments.d.ts +1142 -0
- package/tracking.d.cts +517 -0
- package/tracking.d.ts +517 -0
- package/wallet.d.cts +1441 -0
- package/wallet.d.ts +1441 -0
- package/websites.d.cts +356 -0
- package/websites.d.ts +356 -0
package/tracking.d.ts
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for `whop.tracking.create()`: the controller's props plus its `on<Event>` callbacks. In React, these are the `<Tracking>` component's props.
|
|
3
|
+
* @example
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { loadWhop } from "@whop/elements";
|
|
6
|
+
*
|
|
7
|
+
* const whop = (await loadWhop())({ locale: "en" });
|
|
8
|
+
* const tracking = whop.tracking.create({}); // options: props + on<Event> callbacks
|
|
9
|
+
* ```
|
|
10
|
+
* @see https://docs.whop.com/elements/latest/tracking/overview
|
|
11
|
+
*/
|
|
12
|
+
export interface TrackingOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Account ID, prefixed `biz_`, whose people and events this reads. Required.
|
|
15
|
+
* @default ""
|
|
16
|
+
*/
|
|
17
|
+
accountId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A scoped token both surfaces read with. Mint one token for the whole handle on your server with `POST /api/v1/access_tokens`, and set a fresh one with `update({ accessToken })` before it expires. Reading the lists needs `member:basic:read` or `company:basic:read`; the filter menus' option counts additionally use `stats:read`, and the People table's saved-audience filter uses `audience:basic:read` — without those the menus simply show fewer options. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
20
|
+
*/
|
|
21
|
+
accessToken?: string;
|
|
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 — key your page on it; `{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://…`) — inside an element frame a relative URL would resolve against the frame, so one is treated as unset. Unset, a person click raises `personOpened` on its element instead. `people` and `events` base URLs are accepted for symmetry with the ads handle but nothing under this handle renders them.
|
|
24
|
+
* @default {}
|
|
25
|
+
*/
|
|
26
|
+
links?: CrossLinksConfig;
|
|
27
|
+
/**
|
|
28
|
+
* The window both surfaces cover: `today`, `yesterday`, `last_7_days`, `last_14_days`, `last_30_days`, `last_90_days`, `all_time`, or `custom` (pair it with `customRange`). The elements carry the picker and move this; read it back off `periodChanged`.
|
|
29
|
+
* @default "last_14_days"
|
|
30
|
+
*/
|
|
31
|
+
period?: "today" | "yesterday" | "last_7_days" | "last_14_days" | "last_30_days" | "last_90_days" | "all_time" | "custom";
|
|
32
|
+
/**
|
|
33
|
+
* The explicit window, as ISO 8601 instants, used when `period` is `custom`. Ignored otherwise.
|
|
34
|
+
* @default null
|
|
35
|
+
*/
|
|
36
|
+
customRange?: { from: string; to: string; } | null;
|
|
37
|
+
/**
|
|
38
|
+
* Which of two zones the window resolves in: `account`, the account's own scheduling zone, or `local`, whichever zone the viewer's browser is in. `account` falls back to the viewer's own when the account has set none.
|
|
39
|
+
* @default "account"
|
|
40
|
+
*/
|
|
41
|
+
timezone?: "account" | "local";
|
|
42
|
+
/**
|
|
43
|
+
* Which touch in a person’s journey gets the credit when filtering by source: `last_touch`, the default, or `first_touch`. The elements carry the picker and move this, so a host can drive it and read it back off `attributionModelChanged`.
|
|
44
|
+
* @default "last_touch"
|
|
45
|
+
*/
|
|
46
|
+
attributionModel?: "last_touch" | "first_touch";
|
|
47
|
+
/**
|
|
48
|
+
* Runs when the grouped loading state changes. The value is `true` while any mounted element is still loading.
|
|
49
|
+
*/
|
|
50
|
+
onLoadingChange?: ((loading: boolean) => void);
|
|
51
|
+
/**
|
|
52
|
+
* Visual customization for this group's elements. Overrides the global `WhopElements({ appearance })`. Change it live with `update({ appearance })`.
|
|
53
|
+
*/
|
|
54
|
+
appearance?: import("./_framework.js").Appearance;
|
|
55
|
+
/**
|
|
56
|
+
* 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.
|
|
57
|
+
*/
|
|
58
|
+
locale?: import("./_framework.js").WhopElementsLocale;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Consumer props for the "people" element. Set at create (or as `<PeopleElement />` JSX props), and updatable live via `update()`.
|
|
63
|
+
* @see https://docs.whop.com/elements/latest/tracking/people
|
|
64
|
+
*/
|
|
65
|
+
export interface PeopleElementProps {
|
|
66
|
+
/**
|
|
67
|
+
* Narrow to people acquired by a traffic source, as a source path — `whop:adcamp_…:*` for one of the account’s campaigns, `ext:*` for ads run elsewhere, `referrer:*`, `direct`. The same value the ads table’s click counts link with, so a page can hydrate this straight from its own URL.
|
|
68
|
+
* @default ""
|
|
69
|
+
*/
|
|
70
|
+
source?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Narrow to people who performed an event, by its name — `payment.completed`, `pixel.lead`, `pixel.page`.
|
|
73
|
+
* @default ""
|
|
74
|
+
*/
|
|
75
|
+
eventName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Narrow to people who performed a custom pixel event, by its custom name. Pairs with an empty `eventName`.
|
|
78
|
+
* @default ""
|
|
79
|
+
*/
|
|
80
|
+
customEvent?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Narrow by the `utm_source` their traffic carried. Comma-separate to match any of several.
|
|
83
|
+
* @default ""
|
|
84
|
+
*/
|
|
85
|
+
utmSource?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Narrow by ISO 3166-1 alpha-2 country code, such as `US` or `GB`.
|
|
88
|
+
* @default ""
|
|
89
|
+
*/
|
|
90
|
+
country?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Narrow by device class — `desktop`, `mobile`, `tablet`, `bot`.
|
|
93
|
+
* @default ""
|
|
94
|
+
*/
|
|
95
|
+
device?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Narrow by browser name.
|
|
98
|
+
* @default ""
|
|
99
|
+
*/
|
|
100
|
+
browser?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Narrow by operating system name.
|
|
103
|
+
* @default ""
|
|
104
|
+
*/
|
|
105
|
+
os?: string;
|
|
106
|
+
/**
|
|
107
|
+
* `true` for customers only, `false` for people who never bought, empty for everyone.
|
|
108
|
+
* @default ""
|
|
109
|
+
*/
|
|
110
|
+
hasPurchased?: string;
|
|
111
|
+
/**
|
|
112
|
+
* What the search box is filtered to — a name, an email, or an identifier.
|
|
113
|
+
* @default ""
|
|
114
|
+
*/
|
|
115
|
+
query?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Narrow to a saved audience (`adaud_…`) built from people filters. The audience filter menu moves this.
|
|
118
|
+
* @default ""
|
|
119
|
+
*/
|
|
120
|
+
audienceId?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Pin the event window for `source`/`eventName` filters to an exact ISO 8601 instant instead of the handle’s `period`. Set both `eventFrom` and `eventTo` or neither.
|
|
123
|
+
* @default ""
|
|
124
|
+
*/
|
|
125
|
+
eventFrom?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The pinned event window’s end, as an ISO 8601 instant.
|
|
128
|
+
* @default ""
|
|
129
|
+
*/
|
|
130
|
+
eventTo?: string;
|
|
131
|
+
/**
|
|
132
|
+
* The sorted column: `name`, `email`, `ltv`, `purchase_count`, `event_count`, `first_seen_at`, `last_seen_at`.
|
|
133
|
+
* @default "last_seen_at"
|
|
134
|
+
*/
|
|
135
|
+
sort?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The sort direction.
|
|
138
|
+
* @default "desc"
|
|
139
|
+
*/
|
|
140
|
+
dir?: "asc" | "desc";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The live handle for a mounted "people" element. Returned by `create("people")`; in React, the component's `ref`.
|
|
145
|
+
* @see https://docs.whop.com/elements/latest/tracking/people
|
|
146
|
+
*/
|
|
147
|
+
export interface PeopleElementHandle {
|
|
148
|
+
/**
|
|
149
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
150
|
+
*/
|
|
151
|
+
mount: (target: string | HTMLElement) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
154
|
+
*/
|
|
155
|
+
destroy: () => void;
|
|
156
|
+
/**
|
|
157
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
158
|
+
*/
|
|
159
|
+
update: (options: Partial<PeopleElementProps>) => void;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Options for `create("people")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* const people = tracking.create("people", {}); // this interface: props + on<Event> callbacks
|
|
167
|
+
* people.mount("#tracking-people");
|
|
168
|
+
* ```
|
|
169
|
+
* @see https://docs.whop.com/elements/latest/tracking/people
|
|
170
|
+
*/
|
|
171
|
+
export interface PeopleElementCreateOptions {
|
|
172
|
+
/**
|
|
173
|
+
* Narrow to people acquired by a traffic source, as a source path — `whop:adcamp_…:*` for one of the account’s campaigns, `ext:*` for ads run elsewhere, `referrer:*`, `direct`. The same value the ads table’s click counts link with, so a page can hydrate this straight from its own URL.
|
|
174
|
+
* @default ""
|
|
175
|
+
*/
|
|
176
|
+
source?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Narrow to people who performed an event, by its name — `payment.completed`, `pixel.lead`, `pixel.page`.
|
|
179
|
+
* @default ""
|
|
180
|
+
*/
|
|
181
|
+
eventName?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Narrow to people who performed a custom pixel event, by its custom name. Pairs with an empty `eventName`.
|
|
184
|
+
* @default ""
|
|
185
|
+
*/
|
|
186
|
+
customEvent?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Narrow by the `utm_source` their traffic carried. Comma-separate to match any of several.
|
|
189
|
+
* @default ""
|
|
190
|
+
*/
|
|
191
|
+
utmSource?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Narrow by ISO 3166-1 alpha-2 country code, such as `US` or `GB`.
|
|
194
|
+
* @default ""
|
|
195
|
+
*/
|
|
196
|
+
country?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Narrow by device class — `desktop`, `mobile`, `tablet`, `bot`.
|
|
199
|
+
* @default ""
|
|
200
|
+
*/
|
|
201
|
+
device?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Narrow by browser name.
|
|
204
|
+
* @default ""
|
|
205
|
+
*/
|
|
206
|
+
browser?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Narrow by operating system name.
|
|
209
|
+
* @default ""
|
|
210
|
+
*/
|
|
211
|
+
os?: string;
|
|
212
|
+
/**
|
|
213
|
+
* `true` for customers only, `false` for people who never bought, empty for everyone.
|
|
214
|
+
* @default ""
|
|
215
|
+
*/
|
|
216
|
+
hasPurchased?: string;
|
|
217
|
+
/**
|
|
218
|
+
* What the search box is filtered to — a name, an email, or an identifier.
|
|
219
|
+
* @default ""
|
|
220
|
+
*/
|
|
221
|
+
query?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Narrow to a saved audience (`adaud_…`) built from people filters. The audience filter menu moves this.
|
|
224
|
+
* @default ""
|
|
225
|
+
*/
|
|
226
|
+
audienceId?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Pin the event window for `source`/`eventName` filters to an exact ISO 8601 instant instead of the handle’s `period`. Set both `eventFrom` and `eventTo` or neither.
|
|
229
|
+
* @default ""
|
|
230
|
+
*/
|
|
231
|
+
eventFrom?: string;
|
|
232
|
+
/**
|
|
233
|
+
* The pinned event window’s end, as an ISO 8601 instant.
|
|
234
|
+
* @default ""
|
|
235
|
+
*/
|
|
236
|
+
eventTo?: string;
|
|
237
|
+
/**
|
|
238
|
+
* The sorted column: `name`, `email`, `ltv`, `purchase_count`, `event_count`, `first_seen_at`, `last_seen_at`.
|
|
239
|
+
* @default "last_seen_at"
|
|
240
|
+
*/
|
|
241
|
+
sort?: string;
|
|
242
|
+
/**
|
|
243
|
+
* The sort direction.
|
|
244
|
+
* @default "desc"
|
|
245
|
+
*/
|
|
246
|
+
dir?: "asc" | "desc";
|
|
247
|
+
/**
|
|
248
|
+
* The viewer moved the window from the period selector. Every surface under the same handle has already followed it; persist it and pass it back as `period`/`customRange` on the handle, or the window resets on the next mount.
|
|
249
|
+
*/
|
|
250
|
+
onPeriodChanged?: ((payload: { period: "today" | "yesterday" | "last_7_days" | "last_14_days" | "last_30_days" | "last_90_days" | "all_time" | "custom"; customRange: { from: string; to: string; } | null; }) => void);
|
|
251
|
+
/**
|
|
252
|
+
* The viewer changed which touch gets the credit, from the filter row’s Attribution menu. Every surface under the same handle has already re-credited; persist it and pass it back as `attributionModel` on the handle, or it reverts on the next mount.
|
|
253
|
+
*/
|
|
254
|
+
onAttributionModelChanged?: ((payload: { attributionModel: "last_touch" | "first_touch"; }) => void);
|
|
255
|
+
/**
|
|
256
|
+
* The viewer moved a filter, the search box, or the audience picker. Carries the entire filter state whichever moved — mirror it into your own URL and pass it back as props to make the view reproducible.
|
|
257
|
+
*/
|
|
258
|
+
onFiltersChanged?: ((payload: PeopleFilterBag) => void);
|
|
259
|
+
/**
|
|
260
|
+
* The viewer sorted a column. Persist and pass back as `sort`/`dir`, or sorting resets on the next mount.
|
|
261
|
+
*/
|
|
262
|
+
onSortChanged?: ((payload: { sort: string; dir: "asc" | "desc"; }) => void);
|
|
263
|
+
/**
|
|
264
|
+
* The viewer clicked a person row and the handle has no `links.person` to follow — open your own person view with it (`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.
|
|
265
|
+
*/
|
|
266
|
+
onPersonOpened?: ((payload: { identifier: string; personId: string; }) => void);
|
|
267
|
+
/**
|
|
268
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
269
|
+
*/
|
|
270
|
+
onLoaderStart?: (() => void);
|
|
271
|
+
/**
|
|
272
|
+
* Runs after the element's first complete paint.
|
|
273
|
+
*/
|
|
274
|
+
onReady?: (() => void);
|
|
275
|
+
/**
|
|
276
|
+
* 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.
|
|
277
|
+
*/
|
|
278
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Consumer props for the "events" element. Set at create (or as `<EventsElement />` JSX props), and updatable live via `update()`.
|
|
283
|
+
* @see https://docs.whop.com/elements/latest/tracking/events
|
|
284
|
+
*/
|
|
285
|
+
export interface EventsElementProps {
|
|
286
|
+
/**
|
|
287
|
+
* Pin the window to an exact ISO 8601 instant instead of the handle’s `period` — how a deep link reproduces the precise rows behind a metric. Set both `from` and `to` or neither.
|
|
288
|
+
* @default ""
|
|
289
|
+
*/
|
|
290
|
+
from?: string;
|
|
291
|
+
/**
|
|
292
|
+
* The pinned window’s end, as an ISO 8601 instant.
|
|
293
|
+
* @default ""
|
|
294
|
+
*/
|
|
295
|
+
to?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Narrow to events attributed to a traffic source, as a source path — `whop:adcamp_…:*` for one of the account’s campaigns, `ext:*`, `referrer:*`, `direct`.
|
|
298
|
+
* @default ""
|
|
299
|
+
*/
|
|
300
|
+
source?: string;
|
|
301
|
+
/**
|
|
302
|
+
* Narrow by the `utm_source` the traffic carried.
|
|
303
|
+
* @default ""
|
|
304
|
+
*/
|
|
305
|
+
utmSource?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Narrow by ISO 3166-1 alpha-2 country code, such as `US` or `GB`.
|
|
308
|
+
* @default ""
|
|
309
|
+
*/
|
|
310
|
+
country?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Narrow by device class — `desktop`, `mobile`, `tablet`, `bot`.
|
|
313
|
+
* @default ""
|
|
314
|
+
*/
|
|
315
|
+
device?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Narrow by browser name.
|
|
318
|
+
* @default ""
|
|
319
|
+
*/
|
|
320
|
+
browser?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Narrow by operating system name.
|
|
323
|
+
* @default ""
|
|
324
|
+
*/
|
|
325
|
+
os?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Narrow to one person’s journey — a person ID, an email, or a visitor cookie. Set, the list ignores the window and shows their whole history. The search box moves this.
|
|
328
|
+
* @default ""
|
|
329
|
+
*/
|
|
330
|
+
identifier?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Narrow by event name — `payment.completed`, `pixel.lead`, `pixel.page`, or `pixel.custom:<name>` for a custom event. The same value the ads table’s result counts link with.
|
|
333
|
+
* @default ""
|
|
334
|
+
*/
|
|
335
|
+
event?: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The live handle for a mounted "events" element. Returned by `create("events")`; in React, the component's `ref`.
|
|
340
|
+
* @see https://docs.whop.com/elements/latest/tracking/events
|
|
341
|
+
*/
|
|
342
|
+
export interface EventsElementHandle {
|
|
343
|
+
/**
|
|
344
|
+
* Mounts the element in `target` and starts loading. React components mount themselves.
|
|
345
|
+
*/
|
|
346
|
+
mount: (target: string | HTMLElement) => void;
|
|
347
|
+
/**
|
|
348
|
+
* Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
|
|
349
|
+
*/
|
|
350
|
+
destroy: () => void;
|
|
351
|
+
/**
|
|
352
|
+
* Merges new props into the mounted element. In React, change the component props instead.
|
|
353
|
+
*/
|
|
354
|
+
update: (options: Partial<EventsElementProps>) => void;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Options for `create("events")`: the consumer props plus event callbacks and lifecycle hooks.
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* const events = tracking.create("events", {}); // this interface: props + on<Event> callbacks
|
|
362
|
+
* events.mount("#tracking-events");
|
|
363
|
+
* ```
|
|
364
|
+
* @see https://docs.whop.com/elements/latest/tracking/events
|
|
365
|
+
*/
|
|
366
|
+
export interface EventsElementCreateOptions {
|
|
367
|
+
/**
|
|
368
|
+
* Pin the window to an exact ISO 8601 instant instead of the handle’s `period` — how a deep link reproduces the precise rows behind a metric. Set both `from` and `to` or neither.
|
|
369
|
+
* @default ""
|
|
370
|
+
*/
|
|
371
|
+
from?: string;
|
|
372
|
+
/**
|
|
373
|
+
* The pinned window’s end, as an ISO 8601 instant.
|
|
374
|
+
* @default ""
|
|
375
|
+
*/
|
|
376
|
+
to?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Narrow to events attributed to a traffic source, as a source path — `whop:adcamp_…:*` for one of the account’s campaigns, `ext:*`, `referrer:*`, `direct`.
|
|
379
|
+
* @default ""
|
|
380
|
+
*/
|
|
381
|
+
source?: string;
|
|
382
|
+
/**
|
|
383
|
+
* Narrow by the `utm_source` the traffic carried.
|
|
384
|
+
* @default ""
|
|
385
|
+
*/
|
|
386
|
+
utmSource?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Narrow by ISO 3166-1 alpha-2 country code, such as `US` or `GB`.
|
|
389
|
+
* @default ""
|
|
390
|
+
*/
|
|
391
|
+
country?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Narrow by device class — `desktop`, `mobile`, `tablet`, `bot`.
|
|
394
|
+
* @default ""
|
|
395
|
+
*/
|
|
396
|
+
device?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Narrow by browser name.
|
|
399
|
+
* @default ""
|
|
400
|
+
*/
|
|
401
|
+
browser?: string;
|
|
402
|
+
/**
|
|
403
|
+
* Narrow by operating system name.
|
|
404
|
+
* @default ""
|
|
405
|
+
*/
|
|
406
|
+
os?: string;
|
|
407
|
+
/**
|
|
408
|
+
* Narrow to one person’s journey — a person ID, an email, or a visitor cookie. Set, the list ignores the window and shows their whole history. The search box moves this.
|
|
409
|
+
* @default ""
|
|
410
|
+
*/
|
|
411
|
+
identifier?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Narrow by event name — `payment.completed`, `pixel.lead`, `pixel.page`, or `pixel.custom:<name>` for a custom event. The same value the ads table’s result counts link with.
|
|
414
|
+
* @default ""
|
|
415
|
+
*/
|
|
416
|
+
event?: string;
|
|
417
|
+
/**
|
|
418
|
+
* The viewer moved the window from the period selector. Every surface under the same handle has already followed it; persist it and pass it back as `period`/`customRange` on the handle, or the window resets on the next mount.
|
|
419
|
+
*/
|
|
420
|
+
onPeriodChanged?: ((payload: { period: "today" | "yesterday" | "last_7_days" | "last_14_days" | "last_30_days" | "last_90_days" | "all_time" | "custom"; customRange: { from: string; to: string; } | null; }) => void);
|
|
421
|
+
/**
|
|
422
|
+
* The viewer changed which touch gets the credit, from the filter row’s Attribution menu. Every surface under the same handle has already re-credited; persist it and pass it back as `attributionModel` on the handle, or it reverts on the next mount.
|
|
423
|
+
*/
|
|
424
|
+
onAttributionModelChanged?: ((payload: { attributionModel: "last_touch" | "first_touch"; }) => void);
|
|
425
|
+
/**
|
|
426
|
+
* The viewer moved a filter or the identifier search. Carries the entire filter state whichever moved — mirror it into your own URL and pass it back as props to make the view reproducible.
|
|
427
|
+
*/
|
|
428
|
+
onFiltersChanged?: ((payload: EventsFilterBag) => void);
|
|
429
|
+
/**
|
|
430
|
+
* The viewer clicked a person cell and the handle has no `links.person` to follow — open your own person view with it (`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.
|
|
431
|
+
*/
|
|
432
|
+
onPersonOpened?: ((payload: { identifier: string; personId: string; }) => void);
|
|
433
|
+
/**
|
|
434
|
+
* Runs after the loading skeleton first paints and before `onReady`.
|
|
435
|
+
*/
|
|
436
|
+
onLoaderStart?: (() => void);
|
|
437
|
+
/**
|
|
438
|
+
* Runs after the element's first complete paint.
|
|
439
|
+
*/
|
|
440
|
+
onReady?: (() => void);
|
|
441
|
+
/**
|
|
442
|
+
* 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.
|
|
443
|
+
*/
|
|
444
|
+
onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* The Tracking handle, returned by `whop.tracking.create()` (React: `useTracking()`). Mounts the elements and carries the controller's actions.
|
|
449
|
+
* @see https://docs.whop.com/elements/latest/tracking/overview
|
|
450
|
+
*/
|
|
451
|
+
export interface TrackingHandle {
|
|
452
|
+
/**
|
|
453
|
+
* Everyone the account has seen — visitors and customers resolved from pixel activity, with their source, spend, and activity counters. Search, filter by source, event, geography, or device, sort any column, and page through. A row click follows `links.person` when the handle configures it, and otherwise comes back to you as `personOpened`.
|
|
454
|
+
*/
|
|
455
|
+
create(name: "people", options?: PeopleElementCreateOptions): PeopleElementHandle;
|
|
456
|
+
/**
|
|
457
|
+
* 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`.
|
|
458
|
+
*/
|
|
459
|
+
create(name: "events", options?: EventsElementCreateOptions): EventsElementHandle;
|
|
460
|
+
/**
|
|
461
|
+
* Merges new handle options into every mounted element. In React, change the namespace props instead.
|
|
462
|
+
*/
|
|
463
|
+
update(options: Partial<TrackingOptions>): void;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Tracking's static actions, callable with nothing mounted: `whop.tracking.<method>()` (React: `useWhop().tracking.<method>()`).
|
|
468
|
+
* @see https://docs.whop.com/elements/latest/tracking/overview
|
|
469
|
+
*/
|
|
470
|
+
export interface TrackingStatics {}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* The consumer-facing shape of an element's `links` prop. `people`/`events` are base URLs the canonical query params are appended to; `person` is a template whose `{personId}` and `{identifier}` placeholders are replaced with the row's URL-encoded values.
|
|
474
|
+
* Declared from the app's `CrossLinksConfig`, referenced by a host-capability surface.
|
|
475
|
+
*/
|
|
476
|
+
export interface CrossLinksConfig {
|
|
477
|
+
people?: string | undefined;
|
|
478
|
+
events?: string | undefined;
|
|
479
|
+
person?: string | undefined;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Consumer-facing filters for the People element. The element maps these camelCase options to `/api/v1/people` query parameters.
|
|
484
|
+
* Declared from the app's `PeopleFilterBag`, referenced by a host-capability surface.
|
|
485
|
+
*/
|
|
486
|
+
export interface PeopleFilterBag {
|
|
487
|
+
source: string;
|
|
488
|
+
eventName: string;
|
|
489
|
+
customEvent: string;
|
|
490
|
+
utmSource: string;
|
|
491
|
+
country: string;
|
|
492
|
+
device: string;
|
|
493
|
+
browser: string;
|
|
494
|
+
os: string;
|
|
495
|
+
hasPurchased: string;
|
|
496
|
+
query: string;
|
|
497
|
+
audienceId: string;
|
|
498
|
+
eventFrom: string;
|
|
499
|
+
eventTo: string;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Consumer-facing filters for the Events element. The element maps these camelCase options to `/api/v1/events` query parameters.
|
|
504
|
+
* Declared from the app's `EventsFilterBag`, referenced by a host-capability surface.
|
|
505
|
+
*/
|
|
506
|
+
export interface EventsFilterBag {
|
|
507
|
+
identifier: string;
|
|
508
|
+
event: string;
|
|
509
|
+
source: string;
|
|
510
|
+
country: string;
|
|
511
|
+
utmSource: string;
|
|
512
|
+
device: string;
|
|
513
|
+
browser: string;
|
|
514
|
+
os: string;
|
|
515
|
+
from: string;
|
|
516
|
+
to: string;
|
|
517
|
+
}
|