@burdenoff/microfe-billing 2026.1113.3 → 2026.1113.4

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