@burdenoff/microfe-billing 2026.1112.1 → 2026.1112.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.
@@ -2,28 +2,30 @@ import { useBillingPermissions as e } from "../../../hooks/useBillingPermissions
2
2
  import { AccessDenied as t } from "../../../shared/components/AccessDenied.js";
3
3
  import { PageHeader as n } from "../../../shared/components/PageHeader.js";
4
4
  import { ServerError as r } from "../../../shared/components/ServerError.js";
5
- import { useBillingEventEmitter as i } from "../../../hooks/useBillingEventEmitter.js";
6
- import { useBilling as a } from "../../../providers/BillingProvider.js";
7
- import { formatCurrency as o, formatDateTime as s } from "../../../shared/utils/format.js";
8
- import { isServerError as c } from "../../../shared/utils/error.js";
5
+ import { MoneyActionDialog as ee } from "../../../shared/components/MoneyActionDialog.js";
6
+ import { useIsFluidgridsVariant as te } from "../../../hooks/useBillingVariant.js";
9
7
  import "../../../shared/components/index.js";
8
+ import { formatCurrency as i, formatDateTime as a } from "../../../shared/utils/format.js";
9
+ import { isServerError as o } from "../../../shared/utils/error.js";
10
+ import { useBillingEventEmitter as s } from "../../../hooks/useBillingEventEmitter.js";
11
+ import { useBilling as c } from "../../../providers/BillingProvider.js";
10
12
  import "../../../shared/utils/index.js";
11
- import { useGetDefaultBillingAccountSettingsQuery as ee } from "../../../../generated/global-operations.js";
12
- import { addPayoutAccount as te, archivePayoutAccount as ne, fetchPayoutAccounts as re, fetchPayoutRequests as ie, requestPayout as ae, setDefaultPayoutAccount as oe, updatePayoutAccount as se } from "../api.js";
13
- import { PAYOUT_ACCOUNT_TONE_CLASSES as ce, isPayoutAccountPayable as l, payoutAccountStatusView as u, pickPayableAccountId as le } from "../payoutAccountStatus.js";
14
- import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
15
- import { Landmark as h, RefreshCw as g, Send as _ } from "lucide-react";
16
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
17
- import { AlertDialog as ue, AlertDialogAction as de, AlertDialogCancel as fe, AlertDialogContent as pe, AlertDialogDescription as me, AlertDialogFooter as he, AlertDialogHeader as ge, AlertDialogTitle as _e, IllustratedEmptyState as x, PagePurpose as S, ResponsiveTable as C } from "@burdenoff/fe-libs/ui";
13
+ import { useGetDefaultBillingAccountSettingsQuery as l } from "../../../../generated/global-operations.js";
14
+ import { addPayoutAccount as u, archivePayoutAccount as ne, fetchPayoutAccounts as re, fetchPayoutRequests as ie, requestPayout as ae, setDefaultPayoutAccount as oe, updatePayoutAccount as se } from "../api.js";
15
+ import { PAYOUT_ACCOUNT_TONE_CLASSES as ce, isPayoutAccountPayable as d, payoutAccountStatusView as f, pickPayableAccountId as le } from "../payoutAccountStatus.js";
16
+ import { useCallback as ue, useEffect as de, useMemo as fe, useState as p } from "react";
17
+ import { Landmark as pe, RefreshCw as me, Send as he } from "lucide-react";
18
+ import { Fragment as ge, jsx as m, jsxs as h } from "react/jsx-runtime";
19
+ import { AlertDialog as _e, AlertDialogAction as ve, AlertDialogCancel as ye, AlertDialogContent as be, AlertDialogDescription as g, AlertDialogFooter as xe, AlertDialogHeader as Se, AlertDialogTitle as Ce, IllustratedEmptyState as _, PagePurpose as we, ResponsiveTable as Te } from "@burdenoff/fe-libs/ui";
18
20
  // src/billing/modules/earnings/pages/PayoutsPage.tsx
19
- var w = [
21
+ var Ee = [
20
22
  {
21
23
  key: "amount",
22
24
  header: "Amount",
23
25
  priority: "primary",
24
- cell: (e) => /* @__PURE__ */ y("span", {
26
+ cell: (e) => /* @__PURE__ */ m("span", {
25
27
  className: "tabular-nums",
26
- children: o(e.requestedAmount, e.currency)
28
+ children: i(e.requestedAmount, e.currency)
27
29
  })
28
30
  },
29
31
  {
@@ -44,10 +46,10 @@ var w = [
44
46
  {
45
47
  key: "created",
46
48
  header: "Created",
47
- cell: (e) => s(e.createdAt)
49
+ cell: (e) => a(e.createdAt)
48
50
  }
49
- ], T = () => {
50
- let o = e(), { emit: s } = i(), { apiGatewayUrl: T, authToken: E, orgId: D } = a(), { data: O } = ee({}), k = O?.getDefaultBillingAccount?.id, [A, j] = m([]), [M, N] = m([]), [P, F] = m(!0), [I, L] = m(null), [R, z] = m({
51
+ ], v = () => {
52
+ let a = e(), v = te(), [De, y] = p(!1), [b, x] = p(!1), [S, C] = p(null), [w, T] = p(null), { emit: E } = s(), { apiGatewayUrl: D, authToken: O, orgId: k } = c(), { data: Oe } = l({}), A = Oe?.getDefaultBillingAccount?.id, [j, ke] = p([]), [M, Ae] = p([]), [N, P] = p(!0), [F, I] = p(null), [L, R] = p({
51
53
  label: "",
52
54
  type: "BANK_ACCOUNT",
53
55
  providerPreference: "AUTO",
@@ -59,57 +61,57 @@ var w = [
59
61
  routingNumber: "",
60
62
  ifsc: "",
61
63
  upiId: ""
62
- }), [B, V] = m(""), [H, U] = m(""), [W, G] = m(null), [K, q] = m(null), [J, Y] = m(null), X = p(() => ({
63
- apiGatewayUrl: T,
64
- authToken: E,
65
- orgId: D
64
+ }), [z, B] = p(""), [V, H] = p(""), [U, W] = p(null), [G, K] = p(null), [q, J] = p(null), Y = fe(() => ({
65
+ apiGatewayUrl: D,
66
+ authToken: O,
67
+ orgId: k
66
68
  }), [
67
- T,
68
- E,
69
- D
70
- ]), Z = d(async () => {
71
- if (k) {
72
- F(!0), L(null);
69
+ D,
70
+ O,
71
+ k
72
+ ]), X = ue(async () => {
73
+ if (A) {
74
+ P(!0), I(null);
73
75
  try {
74
- let [e, t] = await Promise.all([re(k, X), ie(k, X)]);
75
- j(e), N(t), U((t) => le(e, t));
76
+ let [e, t] = await Promise.all([re(A, Y), ie(A, Y)]);
77
+ ke(e), Ae(t), H((t) => le(e, t));
76
78
  } catch (e) {
77
- L(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load payout data"));
79
+ I(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load payout data"));
78
80
  } finally {
79
- F(!1);
81
+ P(!1);
80
82
  }
81
83
  }
82
- }, [k, X]);
83
- if (f(() => {
84
- Z();
85
- }, [Z]), !o.canManagePaymentMethods) return /* @__PURE__ */ y(t, { message: "You don't have permission to manage payout accounts." });
86
- if (I && c(I)) return /* @__PURE__ */ y(r, {
84
+ }, [A, Y]);
85
+ if (de(() => {
86
+ X();
87
+ }, [X]), !a.canManagePaymentMethods) return /* @__PURE__ */ m(t, { message: "You don't have permission to manage payout accounts." });
88
+ if (F && o(F)) return /* @__PURE__ */ m(r, {
87
89
  title: "Payout data unavailable",
88
- message: I.message,
89
- onRetry: () => void Z(),
90
+ message: F.message,
91
+ onRetry: () => void X(),
90
92
  showRetry: !0
91
93
  });
92
- let ve = async () => {
93
- if (!k) return;
94
- Y(null);
94
+ let je = async () => {
95
+ if (!A) return;
96
+ J(null);
95
97
  let e = {
96
- billingAccountId: k,
97
- ...R
98
+ billingAccountId: A,
99
+ ...L
98
100
  };
99
- if (W) await se(W, e, X), s("billing.payout_account.updated", {
101
+ if (U) await se(U, e, Y), E("billing.payout_account.updated", {
100
102
  route: "/billing/payouts",
101
- entityId: W,
103
+ entityId: U,
102
104
  source: "payouts"
103
105
  });
104
106
  else {
105
- let t = await te(e, X);
106
- s("billing.payout_account.added", {
107
+ let t = await u(e, Y);
108
+ E("billing.payout_account.added", {
107
109
  route: "/billing/payouts",
108
- entityId: k,
110
+ entityId: A,
109
111
  source: "payouts"
110
- }), Y(t.status === "ACTIVE" ? "Payout account saved and ready to receive payouts." : "Payout account saved. It stays pending until the payout processor verifies it; you can request payouts to it once it is verified.");
112
+ }), J(t.status === "ACTIVE" ? "Payout account saved and ready to receive payouts." : "Payout account saved. It stays pending until the payout processor verifies it; you can request payouts to it once it is verified.");
111
113
  }
112
- z({
114
+ R({
113
115
  label: "",
114
116
  type: "BANK_ACCOUNT",
115
117
  providerPreference: "AUTO",
@@ -121,17 +123,17 @@ var w = [
121
123
  routingNumber: "",
122
124
  ifsc: "",
123
125
  upiId: ""
124
- }), G(null), await Z();
125
- }, ye = async (e) => {
126
- Y(null), await oe(e, X), await Z();
127
- }, be = async (e) => {
128
- Y(null), await ne(e, X), s("billing.payout_account.archived", {
126
+ }), W(null), await X();
127
+ }, Me = async (e) => {
128
+ J(null), await oe(e, Y), await X();
129
+ }, Ne = async (e) => {
130
+ J(null), await ne(e, Y), E("billing.payout_account.archived", {
129
131
  route: "/billing/payouts",
130
132
  entityId: e,
131
133
  source: "payouts"
132
- }), await Z();
133
- }, xe = (e) => {
134
- Y(null), G(e.id), z((t) => ({
134
+ }), await X();
135
+ }, Pe = (e) => {
136
+ J(null), W(e.id), R((t) => ({
135
137
  ...t,
136
138
  label: e.label,
137
139
  type: e.type,
@@ -145,121 +147,156 @@ var w = [
145
147
  ifsc: "",
146
148
  upiId: ""
147
149
  }));
148
- }, Q = A.find((e) => e.id === H), $ = A.some(l), Se = async () => {
149
- k && H && B && Q && l(Q) && (await ae({
150
- billingAccountId: k,
151
- payoutAccountId: H,
152
- amount: Number(B),
153
- currency: Q.currency
154
- }, X), s("billing.payout.requested", {
150
+ }, Z = j.find((e) => e.id === V), Q = j.some(d), $ = async () => {
151
+ A && V && z && Z && d(Z) && (await ae({
152
+ billingAccountId: A,
153
+ payoutAccountId: V,
154
+ amount: Number(z),
155
+ currency: Z.currency
156
+ }, Y), E("billing.payout.requested", {
155
157
  route: "/billing/payouts",
156
- entityId: H,
158
+ entityId: V,
157
159
  source: "payouts",
158
- amount: Number(B),
159
- currency: Q.currency
160
- }), V(""), await Z());
160
+ amount: Number(z),
161
+ currency: Z.currency
162
+ }), B(""), await X());
163
+ }, Fe = async () => {
164
+ x(!0), C(null);
165
+ try {
166
+ await $(), y(!1), T({
167
+ ok: !0,
168
+ message: `Payout of ${i(Number(z), Z?.currency ?? "")} requested. We'll show its status below.`
169
+ });
170
+ } catch (e) {
171
+ C(e instanceof Error ? e.message : "The payout request failed.");
172
+ } finally {
173
+ x(!1);
174
+ }
161
175
  };
162
- return /* @__PURE__ */ b("div", {
176
+ return /* @__PURE__ */ h("div", {
163
177
  className: "space-y-6 p-6",
164
178
  children: [
165
- /* @__PURE__ */ y(n, {
179
+ v && /* @__PURE__ */ m(ee, {
180
+ open: De,
181
+ title: "Review your payout",
182
+ description: "The amount is moved out of your available balance when you confirm.",
183
+ details: [{
184
+ label: "Amount",
185
+ value: i(Number(z), Z?.currency ?? "")
186
+ }, {
187
+ label: "Paid to",
188
+ value: Z ? `${Z.label} · ${Z.currency}` : ""
189
+ }],
190
+ confirmLabel: "Request payout",
191
+ busyLabel: "Requesting…",
192
+ isBusy: b,
193
+ error: S,
194
+ onConfirm: () => void Fe(),
195
+ onCancel: () => y(!1)
196
+ }),
197
+ v && w && /* @__PURE__ */ m("div", {
198
+ role: w.ok ? "status" : "alert",
199
+ className: `rounded-md border p-3 text-sm ${w.ok ? "border-status-success-border text-status-success-text" : "border-status-error-border text-status-error-text"}`,
200
+ children: w.message
201
+ }),
202
+ /* @__PURE__ */ m(n, {
166
203
  title: "Payouts",
167
204
  description: "Register payout accounts, request withdrawals, and track disbursement status."
168
205
  }),
169
- /* @__PURE__ */ y(S, { children: "Get your earnings paid out to a real bank account or UPI. Register where you want to be paid, request a withdrawal of your available balance, and track each request from submission through to disbursement here." }),
170
- J ? /* @__PURE__ */ y("div", {
206
+ /* @__PURE__ */ m(we, { children: "Get your earnings paid out to a real bank account or UPI. Register where you want to be paid, request a withdrawal of your available balance, and track each request from submission through to disbursement here." }),
207
+ q ? /* @__PURE__ */ m("div", {
171
208
  role: "status",
172
209
  className: "rounded-lg border border-border-subtle bg-status-info-bg-subtle p-4 text-sm text-status-info-text",
173
- children: J
210
+ children: q
174
211
  }) : null,
175
- I && !c(I) ? /* @__PURE__ */ y("div", {
212
+ F && !o(F) ? /* @__PURE__ */ m("div", {
176
213
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text",
177
- children: I.message
214
+ children: F.message
178
215
  }) : null,
179
- /* @__PURE__ */ b("div", {
216
+ /* @__PURE__ */ h("div", {
180
217
  className: "grid gap-6 xl:grid-cols-[1.05fr,1.95fr]",
181
- children: [/* @__PURE__ */ b("section", {
218
+ children: [/* @__PURE__ */ h("section", {
182
219
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
183
220
  children: [
184
- /* @__PURE__ */ y("h2", {
221
+ /* @__PURE__ */ m("h2", {
185
222
  className: "mb-4 text-lg font-semibold text-text-primary",
186
- children: W ? "Edit payout account" : "Add payout account"
223
+ children: U ? "Edit payout account" : "Add payout account"
187
224
  }),
188
- /* @__PURE__ */ b("div", {
225
+ /* @__PURE__ */ h("div", {
189
226
  className: "space-y-3",
190
227
  children: [
191
- /* @__PURE__ */ y("input", {
192
- value: R.label,
193
- onChange: (e) => z((t) => ({
228
+ /* @__PURE__ */ m("input", {
229
+ value: L.label,
230
+ onChange: (e) => R((t) => ({
194
231
  ...t,
195
232
  label: e.target.value
196
233
  })),
197
234
  placeholder: "Label",
198
235
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
199
236
  }),
200
- /* @__PURE__ */ b("div", {
237
+ /* @__PURE__ */ h("div", {
201
238
  className: "grid gap-3 md:grid-cols-2",
202
- children: [/* @__PURE__ */ b("select", {
203
- value: R.type,
204
- onChange: (e) => z((t) => ({
239
+ children: [/* @__PURE__ */ h("select", {
240
+ value: L.type,
241
+ onChange: (e) => R((t) => ({
205
242
  ...t,
206
243
  type: e.target.value
207
244
  })),
208
245
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
209
246
  children: [
210
- /* @__PURE__ */ y("option", {
247
+ /* @__PURE__ */ m("option", {
211
248
  value: "BANK_ACCOUNT",
212
249
  children: "Bank account"
213
250
  }),
214
- /* @__PURE__ */ y("option", {
251
+ /* @__PURE__ */ m("option", {
215
252
  value: "UPI",
216
253
  children: "UPI"
217
254
  }),
218
- /* @__PURE__ */ y("option", {
255
+ /* @__PURE__ */ m("option", {
219
256
  value: "WALLET",
220
257
  children: "Wallet"
221
258
  })
222
259
  ]
223
- }), /* @__PURE__ */ b("select", {
224
- value: R.providerPreference,
225
- onChange: (e) => z((t) => ({
260
+ }), /* @__PURE__ */ h("select", {
261
+ value: L.providerPreference,
262
+ onChange: (e) => R((t) => ({
226
263
  ...t,
227
264
  providerPreference: e.target.value
228
265
  })),
229
266
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
230
267
  children: [
231
- /* @__PURE__ */ y("option", {
268
+ /* @__PURE__ */ m("option", {
232
269
  value: "AUTO",
233
270
  children: "Auto"
234
271
  }),
235
- /* @__PURE__ */ y("option", {
272
+ /* @__PURE__ */ m("option", {
236
273
  value: "STRIPE",
237
274
  children: "Stripe"
238
275
  }),
239
- /* @__PURE__ */ y("option", {
276
+ /* @__PURE__ */ m("option", {
240
277
  value: "RAZORPAY",
241
278
  children: "Razorpay"
242
279
  }),
243
- /* @__PURE__ */ y("option", {
280
+ /* @__PURE__ */ m("option", {
244
281
  value: "MANUAL",
245
282
  children: "Manual"
246
283
  })
247
284
  ]
248
285
  })]
249
286
  }),
250
- /* @__PURE__ */ b("div", {
287
+ /* @__PURE__ */ h("div", {
251
288
  className: "grid gap-3 md:grid-cols-2",
252
- children: [/* @__PURE__ */ y("input", {
253
- value: R.country,
254
- onChange: (e) => z((t) => ({
289
+ children: [/* @__PURE__ */ m("input", {
290
+ value: L.country,
291
+ onChange: (e) => R((t) => ({
255
292
  ...t,
256
293
  country: e.target.value.toUpperCase()
257
294
  })),
258
295
  placeholder: "Country",
259
296
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
260
- }), /* @__PURE__ */ y("input", {
261
- value: R.currency,
262
- onChange: (e) => z((t) => ({
297
+ }), /* @__PURE__ */ m("input", {
298
+ value: L.currency,
299
+ onChange: (e) => R((t) => ({
263
300
  ...t,
264
301
  currency: e.target.value.toUpperCase()
265
302
  })),
@@ -267,49 +304,49 @@ var w = [
267
304
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
268
305
  })]
269
306
  }),
270
- /* @__PURE__ */ y("input", {
271
- value: R.accountHolderName,
272
- onChange: (e) => z((t) => ({
307
+ /* @__PURE__ */ m("input", {
308
+ value: L.accountHolderName,
309
+ onChange: (e) => R((t) => ({
273
310
  ...t,
274
311
  accountHolderName: e.target.value
275
312
  })),
276
313
  placeholder: "Account holder name",
277
314
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
278
315
  }),
279
- R.type === "BANK_ACCOUNT" ? /* @__PURE__ */ b(v, { children: [
280
- /* @__PURE__ */ y("input", {
281
- value: R.bankName,
282
- onChange: (e) => z((t) => ({
316
+ L.type === "BANK_ACCOUNT" ? /* @__PURE__ */ h(ge, { children: [
317
+ /* @__PURE__ */ m("input", {
318
+ value: L.bankName,
319
+ onChange: (e) => R((t) => ({
283
320
  ...t,
284
321
  bankName: e.target.value
285
322
  })),
286
323
  placeholder: "Bank name",
287
324
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
288
325
  }),
289
- /* @__PURE__ */ y("input", {
290
- value: R.accountNumber,
291
- onChange: (e) => z((t) => ({
326
+ /* @__PURE__ */ m("input", {
327
+ value: L.accountNumber,
328
+ onChange: (e) => R((t) => ({
292
329
  ...t,
293
330
  accountNumber: e.target.value
294
331
  })),
295
332
  placeholder: "Account number",
296
333
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
297
334
  }),
298
- /* @__PURE__ */ y("input", {
299
- value: R.country === "IN" ? R.ifsc : R.routingNumber,
300
- onChange: (e) => z((t) => t.country === "IN" ? {
335
+ /* @__PURE__ */ m("input", {
336
+ value: L.country === "IN" ? L.ifsc : L.routingNumber,
337
+ onChange: (e) => R((t) => t.country === "IN" ? {
301
338
  ...t,
302
339
  ifsc: e.target.value
303
340
  } : {
304
341
  ...t,
305
342
  routingNumber: e.target.value
306
343
  }),
307
- placeholder: R.country === "IN" ? "IFSC" : "Routing number",
344
+ placeholder: L.country === "IN" ? "IFSC" : "Routing number",
308
345
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
309
346
  })
310
- ] }) : R.type === "UPI" ? /* @__PURE__ */ y("input", {
311
- value: R.upiId,
312
- onChange: (e) => z((t) => ({
347
+ ] }) : L.type === "UPI" ? /* @__PURE__ */ m("input", {
348
+ value: L.upiId,
349
+ onChange: (e) => R((t) => ({
313
350
  ...t,
314
351
  upiId: e.target.value
315
352
  })),
@@ -318,16 +355,16 @@ var w = [
318
355
  }) : null
319
356
  ]
320
357
  }),
321
- /* @__PURE__ */ b("button", {
358
+ /* @__PURE__ */ h("button", {
322
359
  type: "button",
323
- onClick: () => void ve(),
360
+ onClick: () => void je(),
324
361
  className: "mt-4 inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text",
325
- children: [/* @__PURE__ */ y(h, { className: "size-4" }), W ? "Update payout account" : "Save payout account"]
362
+ children: [/* @__PURE__ */ m(pe, { className: "size-4" }), U ? "Update payout account" : "Save payout account"]
326
363
  }),
327
- W ? /* @__PURE__ */ y("button", {
364
+ U ? /* @__PURE__ */ m("button", {
328
365
  type: "button",
329
366
  onClick: () => {
330
- G(null), z({
367
+ W(null), R({
331
368
  label: "",
332
369
  type: "BANK_ACCOUNT",
333
370
  providerPreference: "AUTO",
@@ -345,96 +382,98 @@ var w = [
345
382
  children: "Cancel edit"
346
383
  }) : null
347
384
  ]
348
- }), /* @__PURE__ */ b("section", {
385
+ }), /* @__PURE__ */ h("section", {
349
386
  className: "space-y-4",
350
- children: [/* @__PURE__ */ b("div", {
387
+ children: [/* @__PURE__ */ h("div", {
351
388
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
352
389
  children: [
353
- /* @__PURE__ */ b("div", {
390
+ /* @__PURE__ */ h("div", {
354
391
  className: "mb-4 flex items-center justify-between",
355
- children: [/* @__PURE__ */ y("h2", {
392
+ children: [/* @__PURE__ */ m("h2", {
356
393
  className: "text-lg font-semibold text-text-primary",
357
394
  children: "Request payout"
358
- }), /* @__PURE__ */ b("button", {
395
+ }), /* @__PURE__ */ h("button", {
359
396
  type: "button",
360
- onClick: () => void Z(),
397
+ onClick: () => void X(),
361
398
  className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary",
362
- children: [/* @__PURE__ */ y(g, { className: "size-4" }), "Refresh"]
399
+ children: [/* @__PURE__ */ m(me, { className: "size-4" }), "Refresh"]
363
400
  })]
364
401
  }),
365
- A.length === 0 && !P ? /* @__PURE__ */ y(x, {
402
+ j.length === 0 && !N ? /* @__PURE__ */ m(_, {
366
403
  illustration: "empty-generic",
367
404
  title: "No payout accounts yet",
368
405
  description: "Add a payout account before requesting a withdrawal."
369
- }) : /* @__PURE__ */ b("div", {
406
+ }) : /* @__PURE__ */ h("div", {
370
407
  className: "space-y-3",
371
408
  children: [
372
- /* @__PURE__ */ b("select", {
373
- value: H,
374
- onChange: (e) => U(e.target.value),
409
+ /* @__PURE__ */ h("select", {
410
+ value: V,
411
+ onChange: (e) => H(e.target.value),
375
412
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
376
- children: [$ ? null : /* @__PURE__ */ y("option", {
413
+ children: [Q ? null : /* @__PURE__ */ m("option", {
377
414
  value: "",
378
415
  children: "No verified payout account yet"
379
- }), A.map((e) => /* @__PURE__ */ b("option", {
416
+ }), j.map((e) => /* @__PURE__ */ h("option", {
380
417
  value: e.id,
381
- disabled: !l(e),
418
+ disabled: !d(e),
382
419
  children: [
383
420
  e.label,
384
421
  " · ",
385
422
  e.currency,
386
423
  " ·",
387
424
  " ",
388
- u(e.status).label
425
+ f(e.status).label
389
426
  ]
390
427
  }, e.id))]
391
428
  }),
392
- $ ? null : /* @__PURE__ */ y("p", {
429
+ Q ? null : /* @__PURE__ */ m("p", {
393
430
  className: "text-sm text-text-secondary",
394
431
  children: "Payouts can be requested once one of your payout accounts is verified."
395
432
  }),
396
- /* @__PURE__ */ b("label", {
433
+ /* @__PURE__ */ h("label", {
397
434
  className: "block space-y-1 text-sm font-medium text-text-primary",
398
- children: [/* @__PURE__ */ y("span", { children: "Amount" }), /* @__PURE__ */ y("input", {
399
- value: B,
400
- onChange: (e) => V(e.target.value),
435
+ children: [/* @__PURE__ */ m("span", { children: "Amount" }), /* @__PURE__ */ m("input", {
436
+ value: z,
437
+ onChange: (e) => B(e.target.value),
401
438
  inputMode: "decimal",
402
439
  placeholder: "0.00",
403
440
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm font-normal text-text-primary"
404
441
  })]
405
442
  }),
406
- /* @__PURE__ */ b("button", {
443
+ /* @__PURE__ */ h("button", {
407
444
  type: "button",
408
- onClick: () => void Se(),
409
- disabled: !Q || !l(Q),
445
+ onClick: () => {
446
+ v ? (C(null), T(null), y(!0)) : $();
447
+ },
448
+ disabled: !Z || !d(Z),
410
449
  className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:cursor-not-allowed disabled:opacity-50",
411
- children: [/* @__PURE__ */ y(_, { className: "size-4" }), "Request payout"]
450
+ children: [/* @__PURE__ */ m(he, { className: "size-4" }), "Request payout"]
412
451
  })
413
452
  ]
414
453
  }),
415
- A.length > 0 ? /* @__PURE__ */ b("div", {
454
+ j.length > 0 ? /* @__PURE__ */ h("div", {
416
455
  className: "mt-4 space-y-3 rounded-md border border-border-subtle bg-bg-surface/60 p-3",
417
- children: [/* @__PURE__ */ y("h3", {
456
+ children: [/* @__PURE__ */ m("h3", {
418
457
  className: "text-sm font-semibold text-text-primary",
419
458
  children: "Saved payout accounts"
420
- }), A.map((e) => {
421
- let t = u(e.status);
422
- return /* @__PURE__ */ b("div", {
459
+ }), j.map((e) => {
460
+ let t = f(e.status);
461
+ return /* @__PURE__ */ h("div", {
423
462
  className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-border-subtle/70 bg-bg-surface px-3 py-2 text-sm",
424
- children: [/* @__PURE__ */ b("div", { children: [
425
- /* @__PURE__ */ b("p", {
463
+ children: [/* @__PURE__ */ h("div", { children: [
464
+ /* @__PURE__ */ h("p", {
426
465
  className: "flex flex-wrap items-center gap-2 font-medium text-text-primary",
427
466
  children: [
428
467
  e.label,
429
468
  " ",
430
469
  e.isDefault ? "• Default" : "",
431
- /* @__PURE__ */ y("span", {
470
+ /* @__PURE__ */ m("span", {
432
471
  className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${ce[t.tone]}`,
433
472
  children: t.label
434
473
  })
435
474
  ]
436
475
  }),
437
- /* @__PURE__ */ b("p", {
476
+ /* @__PURE__ */ h("p", {
438
477
  className: "text-text-secondary",
439
478
  children: [
440
479
  e.providerPreference,
@@ -442,28 +481,28 @@ var w = [
442
481
  e.currency
443
482
  ]
444
483
  }),
445
- t.hint ? /* @__PURE__ */ y("p", {
484
+ t.hint ? /* @__PURE__ */ m("p", {
446
485
  className: "mt-1 text-xs text-text-secondary",
447
486
  children: t.hint
448
487
  }) : null
449
- ] }), /* @__PURE__ */ b("div", {
488
+ ] }), /* @__PURE__ */ h("div", {
450
489
  className: "flex flex-wrap gap-2",
451
490
  children: [
452
- /* @__PURE__ */ y("button", {
491
+ /* @__PURE__ */ m("button", {
453
492
  type: "button",
454
- onClick: () => xe(e),
493
+ onClick: () => Pe(e),
455
494
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary",
456
495
  children: "Edit"
457
496
  }),
458
- e.isDefault ? null : /* @__PURE__ */ y("button", {
497
+ e.isDefault ? null : /* @__PURE__ */ m("button", {
459
498
  type: "button",
460
- onClick: () => void ye(e.id),
499
+ onClick: () => void Me(e.id),
461
500
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary",
462
501
  children: "Make default"
463
502
  }),
464
- /* @__PURE__ */ y("button", {
503
+ /* @__PURE__ */ m("button", {
465
504
  type: "button",
466
- onClick: () => q(e.id),
505
+ onClick: () => K(e.id),
467
506
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text",
468
507
  children: "Archive"
469
508
  })
@@ -473,32 +512,32 @@ var w = [
473
512
  })]
474
513
  }) : null
475
514
  ]
476
- }), /* @__PURE__ */ b("div", {
515
+ }), /* @__PURE__ */ h("div", {
477
516
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
478
- children: [/* @__PURE__ */ y("h2", {
517
+ children: [/* @__PURE__ */ m("h2", {
479
518
  className: "mb-4 text-lg font-semibold text-text-primary",
480
519
  children: "Payout requests"
481
- }), M.length === 0 && !P ? /* @__PURE__ */ y(x, {
520
+ }), M.length === 0 && !N ? /* @__PURE__ */ m(_, {
482
521
  illustration: "empty-data",
483
522
  title: "No payout requests yet",
484
523
  description: "Your payout requests and processing updates will appear here."
485
- }) : /* @__PURE__ */ y(C, {
524
+ }) : /* @__PURE__ */ m(Te, {
486
525
  data: M,
487
526
  rowKey: (e) => e.id,
488
- columns: w
527
+ columns: Ee
489
528
  })]
490
529
  })]
491
530
  })]
492
531
  }),
493
- /* @__PURE__ */ y(ue, {
494
- open: K !== null,
532
+ /* @__PURE__ */ m(_e, {
533
+ open: G !== null,
495
534
  onOpenChange: (e) => {
496
- e || q(null);
535
+ e || K(null);
497
536
  },
498
- children: /* @__PURE__ */ b(pe, { children: [/* @__PURE__ */ b(ge, { children: [/* @__PURE__ */ y(_e, { children: "Archive payout account?" }), /* @__PURE__ */ y(me, { children: "Archive this payout account? You can add a new one at any time." })] }), /* @__PURE__ */ b(he, { children: [/* @__PURE__ */ y(fe, { children: "Cancel" }), /* @__PURE__ */ y(de, {
537
+ children: /* @__PURE__ */ h(be, { children: [/* @__PURE__ */ h(Se, { children: [/* @__PURE__ */ m(Ce, { children: "Archive payout account?" }), /* @__PURE__ */ m(g, { children: "Archive this payout account? You can add a new one at any time." })] }), /* @__PURE__ */ h(xe, { children: [/* @__PURE__ */ m(ye, { children: "Cancel" }), /* @__PURE__ */ m(ve, {
499
538
  onClick: () => {
500
- let e = K;
501
- q(null), e && be(e);
539
+ let e = G;
540
+ K(null), e && Ne(e);
502
541
  },
503
542
  children: "Archive"
504
543
  })] })] })
@@ -506,6 +545,6 @@ var w = [
506
545
  ]
507
546
  });
508
547
  };
509
- export { T as PayoutsPage };
548
+ export { v as PayoutsPage };
510
549
 
511
550
  //# sourceMappingURL=PayoutsPage.js.map