@burdenoff/microfe-billing 2026.1101.1 → 2026.1108.1

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