@whop/elements 1.0.0-beta.4 → 1.0.0-beta.5

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/checkout.d.cts CHANGED
@@ -11,17 +11,21 @@
11
11
  */
12
12
  export interface CheckoutOptions {
13
13
  /**
14
- * Existing plan ID, prefixed `plan_`. The element creates a checkout session for it, and the plan defines the price; nothing about amounts can be asserted client-side. Every checkout is created from this or a `checkoutConfiguration` — omitting both refuses loudly at mount. Set at create only: the session is minted from it, and changing it later refuses.
14
+ * Existing plan ID, prefixed `plan_`. Shorthand for an `items` array containing this plan and `quantity`. The plan defines the price; nothing about amounts can be asserted client-side. Pass either `plan`, `items`, or a `checkoutConfiguration`. Set at create only: the session is minted from it, and changing it later refuses.
15
15
  */
16
16
  plan?: string;
17
- /**
18
- * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
19
- */
20
- checkoutConfiguration?: string;
21
17
  /**
22
18
  * How many units to purchase. Plans that disallow multiples refuse values above 1. Set at create only: the session is minted with it, and changing it later refuses. @default 1
23
19
  */
24
20
  quantity?: number;
21
+ /**
22
+ * The plans in this checkout and how many units of each to purchase. Every item must belong to the same seller and use compatible billing terms; the API validates the complete cart and prices it as one charge. Pass this instead of `plan`, `quantity`, or `checkoutConfiguration`. Set at create only: the session is minted from this exact cart, and changing it later refuses.
23
+ */
24
+ items?: CheckoutItemInput[];
25
+ /**
26
+ * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
27
+ */
28
+ checkoutConfiguration?: string;
25
29
  /**
26
30
  * A promo code to apply before the buyer ever sees the price — the discount is on the first quote, and the buyer can still change or remove it. Pass the code a marketing link carried: a code that has expired or was never valid opens the checkout at full price with the reason on the promo row, never a checkout that will not open. Set at create only.
27
31
  */
@@ -64,7 +68,18 @@ export interface CheckoutOptions {
64
68
  * Consumer props for the "checkout" element. Set at create (or as `<CheckoutElement />` JSX props), and updatable live via `update()`.
65
69
  * @see https://docs.whop.com/elements/latest/checkout/checkout
66
70
  */
67
- export interface CheckoutElementProps {}
71
+ export interface CheckoutElementProps {
72
+ /**
73
+ * Prefills the buyer email the host page already knows: the authenticated first-party viewer’s, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyer’s email wins over it. Empty (default) leaves the field for the buyer.
74
+ * @default ""
75
+ */
76
+ buyerEmail?: string;
77
+ /**
78
+ * Keeps the buyer from editing the prefilled `buyerEmail` — an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a `buyerEmail` there is nothing to lock.
79
+ * @default false
80
+ */
81
+ lockBuyerEmail?: boolean;
82
+ }
68
83
 
69
84
  /**
70
85
  * The live handle for a mounted "checkout" element. Returned by `create("checkout")`; in React, the component's `ref`.
@@ -95,6 +110,16 @@ export interface CheckoutElementHandle {
95
110
  * @see https://docs.whop.com/elements/latest/checkout/checkout
96
111
  */
97
112
  export interface CheckoutElementCreateOptions {
113
+ /**
114
+ * Prefills the buyer email the host page already knows: the authenticated first-party viewer’s, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyer’s email wins over it. Empty (default) leaves the field for the buyer.
115
+ * @default ""
116
+ */
117
+ buyerEmail?: string;
118
+ /**
119
+ * Keeps the buyer from editing the prefilled `buyerEmail` — an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a `buyerEmail` there is nothing to lock.
120
+ * @default false
121
+ */
122
+ lockBuyerEmail?: boolean;
98
123
  /**
99
124
  * Runs after the loading skeleton first paints and before `onReady`.
100
125
  */
@@ -115,7 +140,7 @@ export interface CheckoutElementCreateOptions {
115
140
  */
116
141
  export interface ExpressCheckoutElementProps {
117
142
  /**
118
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
143
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
119
144
  * @default ["apple_pay","google_pay"]
120
145
  */
121
146
  wallets?: ("apple_pay" | "google_pay")[];
@@ -156,7 +181,7 @@ export interface ExpressCheckoutElementHandle {
156
181
  */
157
182
  export interface ExpressCheckoutElementCreateOptions {
158
183
  /**
159
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
184
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
160
185
  * @default ["apple_pay","google_pay"]
161
186
  */
162
187
  wallets?: ("apple_pay" | "google_pay")[];
@@ -190,7 +215,7 @@ export interface CheckoutHandle {
190
215
  */
191
216
  create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
192
217
  /**
193
- * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Apple Pay additionally requires the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before the button renders there. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
218
+ * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Both wallets require the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before either button renders there. Offering Google Pay on your own site is subject to the Google Pay API Terms of Service. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
194
219
  * Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
195
220
  */
196
221
  create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
@@ -210,6 +235,20 @@ export interface CheckoutHandle {
210
235
  */
211
236
  export interface CheckoutStatics {}
212
237
 
238
+ /**
239
+ * Declared from the app's `CheckoutItemInput`, referenced by a host-capability surface.
240
+ */
241
+ export interface CheckoutItemInput {
242
+ /**
243
+ * Existing plan ID, prefixed `plan_`.
244
+ */
245
+ plan: string;
246
+ /**
247
+ * Number of units to purchase. Defaults to 1; plans can disallow quantities above 1.
248
+ */
249
+ quantity?: number | undefined;
250
+ }
251
+
213
252
  /**
214
253
  * Checkout attribution recorded with the session. The element maps these fields to `POST /api/v1/checkout_sessions`; empty values are omitted, and `country` is resolved by the API.
215
254
  * Declared from the app's `CheckoutAttributionInput`, referenced by a host-capability surface.
package/checkout.d.ts CHANGED
@@ -11,17 +11,21 @@
11
11
  */
12
12
  export interface CheckoutOptions {
13
13
  /**
14
- * Existing plan ID, prefixed `plan_`. The element creates a checkout session for it, and the plan defines the price; nothing about amounts can be asserted client-side. Every checkout is created from this or a `checkoutConfiguration` — omitting both refuses loudly at mount. Set at create only: the session is minted from it, and changing it later refuses.
14
+ * Existing plan ID, prefixed `plan_`. Shorthand for an `items` array containing this plan and `quantity`. The plan defines the price; nothing about amounts can be asserted client-side. Pass either `plan`, `items`, or a `checkoutConfiguration`. Set at create only: the session is minted from it, and changing it later refuses.
15
15
  */
16
16
  plan?: string;
17
- /**
18
- * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
19
- */
20
- checkoutConfiguration?: string;
21
17
  /**
22
18
  * How many units to purchase. Plans that disallow multiples refuse values above 1. Set at create only: the session is minted with it, and changing it later refuses. @default 1
23
19
  */
24
20
  quantity?: number;
21
+ /**
22
+ * The plans in this checkout and how many units of each to purchase. Every item must belong to the same seller and use compatible billing terms; the API validates the complete cart and prices it as one charge. Pass this instead of `plan`, `quantity`, or `checkoutConfiguration`. Set at create only: the session is minted from this exact cart, and changing it later refuses.
23
+ */
24
+ items?: CheckoutItemInput[];
25
+ /**
26
+ * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
27
+ */
28
+ checkoutConfiguration?: string;
25
29
  /**
26
30
  * A promo code to apply before the buyer ever sees the price — the discount is on the first quote, and the buyer can still change or remove it. Pass the code a marketing link carried: a code that has expired or was never valid opens the checkout at full price with the reason on the promo row, never a checkout that will not open. Set at create only.
27
31
  */
@@ -64,7 +68,18 @@ export interface CheckoutOptions {
64
68
  * Consumer props for the "checkout" element. Set at create (or as `<CheckoutElement />` JSX props), and updatable live via `update()`.
65
69
  * @see https://docs.whop.com/elements/latest/checkout/checkout
66
70
  */
67
- export interface CheckoutElementProps {}
71
+ export interface CheckoutElementProps {
72
+ /**
73
+ * Prefills the buyer email the host page already knows: the authenticated first-party viewer’s, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyer’s email wins over it. Empty (default) leaves the field for the buyer.
74
+ * @default ""
75
+ */
76
+ buyerEmail?: string;
77
+ /**
78
+ * Keeps the buyer from editing the prefilled `buyerEmail` — an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a `buyerEmail` there is nothing to lock.
79
+ * @default false
80
+ */
81
+ lockBuyerEmail?: boolean;
82
+ }
68
83
 
69
84
  /**
70
85
  * The live handle for a mounted "checkout" element. Returned by `create("checkout")`; in React, the component's `ref`.
@@ -95,6 +110,16 @@ export interface CheckoutElementHandle {
95
110
  * @see https://docs.whop.com/elements/latest/checkout/checkout
96
111
  */
97
112
  export interface CheckoutElementCreateOptions {
113
+ /**
114
+ * Prefills the buyer email the host page already knows: the authenticated first-party viewer’s, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyer’s email wins over it. Empty (default) leaves the field for the buyer.
115
+ * @default ""
116
+ */
117
+ buyerEmail?: string;
118
+ /**
119
+ * Keeps the buyer from editing the prefilled `buyerEmail` — an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a `buyerEmail` there is nothing to lock.
120
+ * @default false
121
+ */
122
+ lockBuyerEmail?: boolean;
98
123
  /**
99
124
  * Runs after the loading skeleton first paints and before `onReady`.
100
125
  */
@@ -115,7 +140,7 @@ export interface CheckoutElementCreateOptions {
115
140
  */
116
141
  export interface ExpressCheckoutElementProps {
117
142
  /**
118
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
143
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
119
144
  * @default ["apple_pay","google_pay"]
120
145
  */
121
146
  wallets?: ("apple_pay" | "google_pay")[];
@@ -156,7 +181,7 @@ export interface ExpressCheckoutElementHandle {
156
181
  */
157
182
  export interface ExpressCheckoutElementCreateOptions {
158
183
  /**
159
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
184
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
160
185
  * @default ["apple_pay","google_pay"]
161
186
  */
162
187
  wallets?: ("apple_pay" | "google_pay")[];
@@ -190,7 +215,7 @@ export interface CheckoutHandle {
190
215
  */
191
216
  create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
192
217
  /**
193
- * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Apple Pay additionally requires the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before the button renders there. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
218
+ * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Both wallets require the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before either button renders there. Offering Google Pay on your own site is subject to the Google Pay API Terms of Service. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
194
219
  * Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
195
220
  */
196
221
  create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
@@ -210,6 +235,20 @@ export interface CheckoutHandle {
210
235
  */
211
236
  export interface CheckoutStatics {}
212
237
 
238
+ /**
239
+ * Declared from the app's `CheckoutItemInput`, referenced by a host-capability surface.
240
+ */
241
+ export interface CheckoutItemInput {
242
+ /**
243
+ * Existing plan ID, prefixed `plan_`.
244
+ */
245
+ plan: string;
246
+ /**
247
+ * Number of units to purchase. Defaults to 1; plans can disallow quantities above 1.
248
+ */
249
+ quantity?: number | undefined;
250
+ }
251
+
213
252
  /**
214
253
  * Checkout attribution recorded with the session. The element maps these fields to `POST /api/v1/checkout_sessions`; empty values are omitted, and `country` is resolved by the API.
215
254
  * Declared from the app's `CheckoutAttributionInput`, referenced by a host-capability surface.
@@ -0,0 +1,328 @@
1
+ /**
2
+ * Options for `whop.dashboard.create()`: the controller's props plus its `on<Event>` callbacks. In React, these are the `<Dashboard>` component's props.
3
+ * @example
4
+ * ```ts
5
+ * import { loadWhop } from "@whop/elements";
6
+ *
7
+ * const whop = (await loadWhop())({ locale: "en" });
8
+ * const dashboard = whop.dashboard.create({}); // options: props + on<Event> callbacks
9
+ * ```
10
+ * @see https://docs.whop.com/elements/latest/dashboard/overview
11
+ */
12
+ export interface DashboardOptions {
13
+ /**
14
+ * A scoped token every surface under this handle reads 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 payments needs `payment:basic:read`; buyer emails additionally need `member:email:read`, the customer journey `member:basic:read`, the tracking column `shipment:basic:read`, and the product and plan names on a payment `access_pass:basic:read` and `plan:basic:read`. Omitted, the reads carry the viewer's own session, which only answers same-origin.
15
+ */
16
+ accessToken?: string;
17
+ /**
18
+ * Account ID, prefixed `biz_`, whose payments these surfaces read.
19
+ */
20
+ accountId: string;
21
+ /**
22
+ * Runs when the grouped loading state changes. The value is `true` while any mounted element is still loading.
23
+ */
24
+ onLoadingChange?: ((loading: boolean) => void);
25
+ /**
26
+ * 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.
27
+ */
28
+ analytics?: false;
29
+ /**
30
+ * Visual customization for this group's elements. Overrides the global `WhopElements({ appearance })`. Change it live with `update({ appearance })`.
31
+ */
32
+ appearance?: import("./_framework.js").Appearance;
33
+ /**
34
+ * 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.
35
+ */
36
+ locale?: import("./_framework.js").WhopElementsLocale;
37
+ }
38
+
39
+ /**
40
+ * Consumer props for the "paymentsTable" element. Set at create (or as `<PaymentsTableElement />` JSX props), and updatable live via `update()`.
41
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentsTable
42
+ */
43
+ export interface PaymentsTableElementProps {
44
+ /**
45
+ * Show the header action menu, Export button, and table settings button.
46
+ * @default true
47
+ */
48
+ showActions?: boolean;
49
+ /**
50
+ * Show the three-dot action menu on each payment row.
51
+ * @default true
52
+ */
53
+ showRowActions?: boolean;
54
+ /**
55
+ * Show the six payment status boxes above the filters.
56
+ * @default true
57
+ */
58
+ showStatusTabs?: boolean;
59
+ /**
60
+ * Show the tracking column and filter for physical-product accounts. Tracking data requires `shipment:basic:read`.
61
+ * @default true
62
+ */
63
+ showTracking?: boolean;
64
+ }
65
+
66
+ /**
67
+ * The live handle for a mounted "paymentsTable" element. Returned by `create("paymentsTable")`; in React, the component's `ref`.
68
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentsTable
69
+ */
70
+ export interface PaymentsTableElementHandle {
71
+ /**
72
+ * Reload payments after a refund or another change.
73
+ */
74
+ refresh: () => Promise<void>;
75
+ /**
76
+ * Mounts the element in `target` and starts loading. React components mount themselves.
77
+ */
78
+ mount: (target: string | HTMLElement) => void;
79
+ /**
80
+ * Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
81
+ */
82
+ destroy: () => void;
83
+ /**
84
+ * Merges new props into the mounted element. In React, change the component props instead.
85
+ */
86
+ update: (options: Partial<PaymentsTableElementProps>) => void;
87
+ }
88
+
89
+ /**
90
+ * Options for `create("paymentsTable")`: the consumer props plus event callbacks and lifecycle hooks.
91
+ * @example
92
+ * ```ts
93
+ * const paymentsTable = dashboard.create("paymentsTable", {}); // this interface: props + on<Event> callbacks
94
+ * paymentsTable.mount("#dashboard-paymentsTable");
95
+ * ```
96
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentsTable
97
+ */
98
+ export interface PaymentsTableElementCreateOptions {
99
+ /**
100
+ * Show the header action menu, Export button, and table settings button.
101
+ * @default true
102
+ */
103
+ showActions?: boolean;
104
+ /**
105
+ * Show the three-dot action menu on each payment row.
106
+ * @default true
107
+ */
108
+ showRowActions?: boolean;
109
+ /**
110
+ * Show the six payment status boxes above the filters.
111
+ * @default true
112
+ */
113
+ showStatusTabs?: boolean;
114
+ /**
115
+ * Show the tracking column and filter for physical-product accounts. Tracking data requires `shipment:basic:read`.
116
+ * @default true
117
+ */
118
+ showTracking?: boolean;
119
+ /**
120
+ * Open payment details in your application.
121
+ */
122
+ onPaymentSelected?: ((payload: { paymentId: string; }) => void);
123
+ /**
124
+ * Open the invoice in your application.
125
+ */
126
+ onInvoiceRequested?: ((payload: { paymentId: string; }) => void);
127
+ /**
128
+ * Open the buyer in your application.
129
+ */
130
+ onUserSelected?: ((payload: { userId: string; }) => void);
131
+ /**
132
+ * The viewer requested a refund. Your application must confirm and authorize it server-side. Refund controls are enabled only when this callback is provided.
133
+ */
134
+ onRefundRequested?: ((payload: { paymentIds: string[]; }) => void);
135
+ /**
136
+ * Open the account’s payment settings in your application.
137
+ */
138
+ onSettingsRequested?: ((payload: Record<string, never>) => void);
139
+ /**
140
+ * Runs after the loading skeleton first paints and before `onReady`.
141
+ */
142
+ onLoaderStart?: (() => void);
143
+ /**
144
+ * Runs after the element's first complete paint.
145
+ */
146
+ onReady?: (() => void);
147
+ /**
148
+ * 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.
149
+ */
150
+ onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
151
+ }
152
+
153
+ /**
154
+ * Consumer props for the "paymentDetail" element. Set at create (or as `<PaymentDetailElement />` JSX props), and updatable live via `update()`.
155
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentDetail
156
+ */
157
+ export interface PaymentDetailElementProps {
158
+ /**
159
+ * Show the top-right Refund button and action menu. Mutating actions require event handlers.
160
+ * @default true
161
+ */
162
+ showActions?: boolean;
163
+ /**
164
+ * The payment to display, prefixed pay_. Required to load a payment.
165
+ * @default ""
166
+ */
167
+ paymentId?: string;
168
+ /**
169
+ * Show the payment amount, fees, and net amount.
170
+ * @default true
171
+ */
172
+ showBreakdown?: boolean;
173
+ /**
174
+ * Show the payment activity timeline.
175
+ * @default true
176
+ */
177
+ showActivity?: boolean;
178
+ /**
179
+ * Show customer name, username, email, phone, and billing address when permitted.
180
+ * @default true
181
+ */
182
+ showCustomer?: boolean;
183
+ /**
184
+ * Show product, plan, payment method, and payment identifiers.
185
+ * @default true
186
+ */
187
+ showDetails?: boolean;
188
+ /**
189
+ * Show the customer journey. Reads the account-scoped Events API only while visible.
190
+ * @default true
191
+ */
192
+ showJourney?: boolean;
193
+ }
194
+
195
+ /**
196
+ * The live handle for a mounted "paymentDetail" element. Returned by `create("paymentDetail")`; in React, the component's `ref`.
197
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentDetail
198
+ */
199
+ export interface PaymentDetailElementHandle {
200
+ /**
201
+ * Reload the payment and its fees after a host action completes.
202
+ */
203
+ refresh: () => Promise<void>;
204
+ /**
205
+ * Mounts the element in `target` and starts loading. React components mount themselves.
206
+ */
207
+ mount: (target: string | HTMLElement) => void;
208
+ /**
209
+ * Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.
210
+ */
211
+ destroy: () => void;
212
+ /**
213
+ * Merges new props into the mounted element. In React, change the component props instead.
214
+ */
215
+ update: (options: Partial<PaymentDetailElementProps>) => void;
216
+ }
217
+
218
+ /**
219
+ * Options for `create("paymentDetail")`: the consumer props plus event callbacks and lifecycle hooks.
220
+ * @example
221
+ * ```ts
222
+ * const paymentDetail = dashboard.create("paymentDetail", {}); // this interface: props + on<Event> callbacks
223
+ * paymentDetail.mount("#dashboard-paymentDetail");
224
+ * ```
225
+ * @see https://docs.whop.com/elements/latest/dashboard/paymentDetail
226
+ */
227
+ export interface PaymentDetailElementCreateOptions {
228
+ /**
229
+ * Show the top-right Refund button and action menu. Mutating actions require event handlers.
230
+ * @default true
231
+ */
232
+ showActions?: boolean;
233
+ /**
234
+ * The payment to display, prefixed pay_. Required to load a payment.
235
+ * @default ""
236
+ */
237
+ paymentId?: string;
238
+ /**
239
+ * Show the payment amount, fees, and net amount.
240
+ * @default true
241
+ */
242
+ showBreakdown?: boolean;
243
+ /**
244
+ * Show the payment activity timeline.
245
+ * @default true
246
+ */
247
+ showActivity?: boolean;
248
+ /**
249
+ * Show customer name, username, email, phone, and billing address when permitted.
250
+ * @default true
251
+ */
252
+ showCustomer?: boolean;
253
+ /**
254
+ * Show product, plan, payment method, and payment identifiers.
255
+ * @default true
256
+ */
257
+ showDetails?: boolean;
258
+ /**
259
+ * Show the customer journey. Reads the account-scoped Events API only while visible.
260
+ * @default true
261
+ */
262
+ showJourney?: boolean;
263
+ /**
264
+ * Confirm and authorize a refund in your application. Enabled only when refundable and a handler is provided.
265
+ */
266
+ onRefundRequested?: ((payload: { paymentId: string; }) => void);
267
+ /**
268
+ * Confirm and authorize another charge attempt in your application.
269
+ */
270
+ onRetryRequested?: ((payload: { paymentId: string; }) => void);
271
+ /**
272
+ * Confirm and authorize voiding this payment in your application.
273
+ */
274
+ onVoidRequested?: ((payload: { paymentId: string; }) => void);
275
+ /**
276
+ * View or download the invoice in your application.
277
+ */
278
+ onInvoiceRequested?: ((payload: { paymentId: string; }) => void);
279
+ /**
280
+ * Open the customer in your application.
281
+ */
282
+ onCustomerSelected?: ((payload: { userId: string; memberId: string | null; }) => void);
283
+ /**
284
+ * Open your customer messaging UI.
285
+ */
286
+ onMessageRequested?: ((payload: { userId: string; }) => void);
287
+ /**
288
+ * Runs after the loading skeleton first paints and before `onReady`.
289
+ */
290
+ onLoaderStart?: (() => void);
291
+ /**
292
+ * Runs after the element's first complete paint.
293
+ */
294
+ onReady?: (() => void);
295
+ /**
296
+ * 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.
297
+ */
298
+ onError?: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void);
299
+ }
300
+
301
+ /**
302
+ * The Dashboard handle, returned by `whop.dashboard.create()` (React: `useDashboard()`). Mounts the elements and carries the controller's actions.
303
+ * @see https://docs.whop.com/elements/latest/dashboard/overview
304
+ */
305
+ export interface DashboardHandle {
306
+ /**
307
+ * 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.
308
+ */
309
+ create(name: "paymentsTable", options?: PaymentsTableElementCreateOptions): PaymentsTableElementHandle;
310
+ /**
311
+ * A payment detail page with the dashboard breakdown, activity, customer, details, and customer journey. Each section can be hidden. Reads payment:basic:read; customer email needs member:email:read and journey needs member:basic:read. Action events let your application confirm and authorize changes; this element never refunds, retries, or voids a payment itself.
312
+ */
313
+ create(name: "paymentDetail", options?: PaymentDetailElementCreateOptions): PaymentDetailElementHandle;
314
+ /**
315
+ * Merges new handle options into every mounted element. In React, change the namespace props instead.
316
+ */
317
+ update(options: Partial<DashboardOptions>): void;
318
+ /**
319
+ * 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.
320
+ */
321
+ destroy(): void;
322
+ }
323
+
324
+ /**
325
+ * Dashboard's static actions, callable with nothing mounted: `whop.dashboard.<method>()` (React: `useWhop().dashboard.<method>()`).
326
+ * @see https://docs.whop.com/elements/latest/dashboard/overview
327
+ */
328
+ export interface DashboardStatics {}