@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,102 +1,107 @@
1
1
  import { CreditWithdrawalHistoryDocument as e, GetCreditBalanceByTypeDocument as t, RequestCreditWithdrawalDocument as n, useGetCostOfCreditsCheckoutQuery as r } from "../../../../generated/global-operations.js";
2
2
  import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
3
- import { MoneyActionDialog as ee } from "../../../shared/components/MoneyActionDialog.js";
4
- import { useBillingEventEmitter as te } from "../../../hooks/useBillingEventEmitter.js";
3
+ import { useBillingEventEmitter as ee } from "../../../hooks/useBillingEventEmitter.js";
4
+ import { MoneyActionDialog as te } from "../../../shared/components/MoneyActionDialog.js";
5
5
  import { useBilling as ne } from "../../../providers/BillingProvider.js";
6
6
  import { useIsFluidgridsVariant as re } from "../../../hooks/useBillingVariant.js";
7
- import { directBillingGraphqlRequest as a } from "../../../shared/utils/directBillingGraphql.js";
8
7
  import "../../../shared/components/index.js";
8
+ import { directBillingGraphqlRequest as a } from "../../../shared/utils/directBillingGraphql.js";
9
9
  import "../../subscriptions/hooks/index.js";
10
10
  import "../../../shared/utils/index.js";
11
11
  import { addPayoutAccount as ie, fetchPayoutAccounts as ae } from "../../earnings/api.js";
12
- import { useBillingAccount as oe, useBillingAccounts as se, useDefaultBillingAccount as ce } from "../../subscriptions/hooks/useSubscriptions.js";
13
- import { formatDate as o, formatRelativeTime as le } from "../../../shared/utils/format.js";
14
- import { statusTokens as s } from "../../../shared/utils/tokens.js";
12
+ import { formatDate as oe, formatRelativeTime as se } from "../../../shared/utils/format.js";
13
+ import { useBillingAccount as ce, useBillingAccounts as le, useDefaultBillingAccount as ue } from "../../subscriptions/hooks/useSubscriptions.js";
14
+ import { statusTokens as o } from "../../../shared/utils/tokens.js";
15
+ import { useTr as de } from "../../../shared/hooks/useTr.js";
16
+ import { PayoutDestinationList as fe } from "../../earnings/components/PayoutDestinationList.js";
17
+ import { PayoutErrorNotice as s } from "../../earnings/components/PayoutErrorNotice.js";
18
+ import { toPayoutDestinations as pe } from "../../earnings/utils/payoutDestination.js";
19
+ import { plainPayoutError as me, rawErrorText as he } from "../../earnings/utils/plainPayoutError.js";
15
20
  import { useEffect as c, useState as l } from "react";
16
- import { EmphasisPanel as u, IllustratedEmptyState as d, PagePurpose as ue } from "@burdenoff/fe-libs/ui";
17
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
21
+ import { EmphasisPanel as ge, IllustratedEmptyState as _e, PagePurpose as ve, ShowTechnicalDetails as ye } from "@burdenoff/fe-libs/ui";
22
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
18
23
  // src/billing/modules/credits/pages/CreditWithdrawalPage.tsx
19
- async function de(e, n) {
24
+ async function be(e, n) {
20
25
  return (await a({
21
26
  ...n,
22
27
  query: t,
23
28
  variables: { billingAccountId: e }
24
29
  })).getCreditBalanceByType;
25
30
  }
26
- async function fe(e, t) {
31
+ async function xe(e, t) {
27
32
  return (await a({
28
33
  ...t,
29
34
  query: n,
30
35
  variables: { input: e }
31
36
  })).requestCreditWithdrawal;
32
37
  }
33
- async function pe(t, n) {
38
+ async function Se(t, n) {
34
39
  return (await a({
35
40
  ...n,
36
41
  query: e,
37
42
  variables: { billingAccountId: t }
38
43
  })).myPayoutRequests.items;
39
44
  }
40
- var h = ({ label: e, value: t, description: n, highlight: r }) => {
41
- let i = /* @__PURE__ */ m(f, { children: [
42
- /* @__PURE__ */ p("p", {
45
+ var p = ({ label: e, value: t, description: n, highlight: r }) => {
46
+ let i = /* @__PURE__ */ f(u, { children: [
47
+ /* @__PURE__ */ d("p", {
43
48
  className: "text-sm text-text-secondary",
44
49
  children: e
45
50
  }),
46
- /* @__PURE__ */ m("p", {
51
+ /* @__PURE__ */ f("p", {
47
52
  className: `text-2xl font-bold mt-1 ${r ? "text-text-link" : "text-text-primary"}`,
48
53
  children: [
49
54
  t.toLocaleString(),
50
55
  " ",
51
- /* @__PURE__ */ p("span", {
56
+ /* @__PURE__ */ d("span", {
52
57
  className: "text-base font-normal",
53
58
  children: "credits"
54
59
  })
55
60
  ]
56
61
  }),
57
- n && /* @__PURE__ */ p("p", {
62
+ n && /* @__PURE__ */ d("p", {
58
63
  className: "text-xs text-text-secondary mt-1",
59
64
  children: n
60
65
  })
61
66
  ] });
62
- return r ? /* @__PURE__ */ p(u, {
67
+ return r ? /* @__PURE__ */ d(ge, {
63
68
  className: "p-5",
64
69
  children: i
65
- }) : /* @__PURE__ */ p("div", {
70
+ }) : /* @__PURE__ */ d("div", {
66
71
  className: "border border-border-subtle rounded-lg p-5 bg-bg-surface",
67
72
  children: i
68
73
  });
69
74
  };
70
- function me(e) {
75
+ function Ce(e) {
71
76
  switch (e.toUpperCase()) {
72
- case "PAID": return s.success.text;
77
+ case "PAID": return o.success.text;
73
78
  case "APPROVED":
74
- case "PROCESSING": return s.info.text;
75
- case "REQUESTED": return s.warning.text;
79
+ case "PROCESSING": return o.info.text;
80
+ case "REQUESTED": return o.warning.text;
76
81
  case "REJECTED":
77
82
  case "FAILED":
78
- case "CANCELED": return s.error.text;
83
+ case "CANCELED": return o.error.text;
79
84
  default: return "text-text-secondary";
80
85
  }
81
86
  }
82
- function he(e) {
87
+ function we(e) {
83
88
  switch (e.toUpperCase()) {
84
- case "PAID": return `${s.success.bg} ${s.success.text}`;
89
+ case "PAID": return `${o.success.bg} ${o.success.text}`;
85
90
  case "APPROVED":
86
- case "PROCESSING": return `${s.info.bg} ${s.info.text}`;
87
- case "REQUESTED": return `${s.warning.bg} ${s.warning.text}`;
91
+ case "PROCESSING": return `${o.info.bg} ${o.info.text}`;
92
+ case "REQUESTED": return `${o.warning.bg} ${o.warning.text}`;
88
93
  case "REJECTED":
89
94
  case "FAILED":
90
- case "CANCELED": return `${s.error.bg} ${s.error.text}`;
95
+ case "CANCELED": return `${o.error.bg} ${o.error.text}`;
91
96
  default: return "bg-bg-sunken text-text-secondary";
92
97
  }
93
98
  }
94
- var ge = () => {
95
- let e = i(), { billingAccounts: t } = se(), [n, a] = l(void 0), { billingAccount: u, isLoading: ge } = ce(), { billingAccount: _e, isLoading: ve } = oe(n), g = n ? _e : u, ye = n ? ve : ge, { apiGatewayUrl: be, authToken: xe, orgId: Se } = ne(), { emit: _ } = te(), [v, Ce] = l(null), [we, y] = l(!1), [b, x] = l(null), [Te, Ee] = l([]), [De, S] = l(!1), [C, Oe] = l([]), [ke, w] = l(!1), [T, E] = l(""), [D, O] = l(""), [k, A] = l(""), [j, M] = l(!1), [N, P] = l(null), [F, I] = l(!1), L = re(), [Ae, R] = l(!1);
99
+ var Te = () => {
100
+ let e = i(), { billingAccounts: t } = le(), [n, a] = l(void 0), { billingAccount: ge, isLoading: Te } = ue(), { billingAccount: Ee, isLoading: De } = ce(n), m = n ? Ee : ge, h = n ? De : Te, { apiGatewayUrl: Oe, authToken: ke, orgId: Ae } = ne(), { emit: g } = ee(), [_, je] = l(null), [Me, v] = l(!1), [y, b] = l(null), [Ne, Pe] = l([]), [Fe, x] = l(!1), [S, Ie] = l([]), [Le, C] = l(!1), [w, T] = l(""), [E, D] = l(""), [O, k] = l(""), [A, j] = l(!1), [M, N] = l(null), [P, F] = l(null), [Re, ze] = l(null), [Be, Ve] = l(null), [I, L] = l(!1), R = re(), He = de(), [Ue, z] = l(!1);
96
101
  c(() => {
97
- F && R(!1);
98
- }, [F]);
99
- let [z, B] = l(!1), [V, H] = l({
102
+ I && z(!1);
103
+ }, [I]);
104
+ let [B, V] = l(!1), [H, U] = l({
100
105
  label: "",
101
106
  type: "BANK_ACCOUNT",
102
107
  accountHolderName: "",
@@ -106,75 +111,75 @@ var ge = () => {
106
111
  upiId: "",
107
112
  country: "",
108
113
  currency: "USD"
109
- }), [U, je] = l(!1), [Me, Ne] = l(null), W = g?.id, G = () => ({
110
- apiGatewayUrl: be,
111
- authToken: xe,
112
- orgId: Se
113
- }), Pe = async () => {
114
+ }), [We, Ge] = l(!1), [Ke, qe] = l(null), W = m?.id, G = () => ({
115
+ apiGatewayUrl: Oe,
116
+ authToken: ke,
117
+ orgId: Ae
118
+ }), Je = async () => {
114
119
  if (W) {
115
- y(!0), x(null);
120
+ v(!0), b(null), ze(null);
116
121
  try {
117
- let e = await de(W, G());
118
- Ce(e);
122
+ let e = await be(W, G());
123
+ je(e);
119
124
  } catch (e) {
120
- x(e instanceof Error ? e.message : "Failed to load balance");
125
+ ze(e), b(e instanceof Error ? e.message : "Failed to load balance");
121
126
  } finally {
122
- y(!1);
127
+ v(!1);
123
128
  }
124
129
  }
125
130
  }, K = async () => {
126
131
  if (W) {
127
- S(!0);
132
+ x(!0);
128
133
  try {
129
134
  let e = await ae(W, G());
130
- Ee(e);
135
+ Pe(e);
131
136
  let t = e.find((e) => e.isDefault) ?? e[0];
132
- t && E(t.id);
137
+ t && T(t.id);
133
138
  } catch {} finally {
134
- S(!1);
139
+ x(!1);
135
140
  }
136
141
  }
137
142
  }, q = async () => {
138
143
  if (W) {
139
- w(!0);
144
+ C(!0);
140
145
  try {
141
- let e = await pe(W, G());
142
- Oe(e);
146
+ let e = await Se(W, G());
147
+ Ie(e);
143
148
  } catch {} finally {
144
- w(!1);
149
+ C(!1);
145
150
  }
146
151
  }
147
152
  };
148
153
  c(() => {
149
- W && (Pe(), K(), q());
154
+ W && (Je(), K(), q());
150
155
  }, [W]), c(() => {
151
- g?.currency && H((e) => ({
156
+ m?.currency && U((e) => ({
152
157
  ...e,
153
- currency: g.currency ?? "USD"
158
+ currency: m.currency ?? "USD"
154
159
  }));
155
- }, [g?.currency]);
156
- let Fe = async () => {
160
+ }, [m?.currency]);
161
+ let Ye = async () => {
157
162
  if (W) {
158
- Ne(null), je(!0);
163
+ qe(null), Ve(null), Ge(!0);
159
164
  try {
160
- let e = V.country.trim().toUpperCase() === "IN" || V.country.trim().toLowerCase() === "india";
165
+ let e = H.country.trim().toUpperCase() === "IN" || H.country.trim().toLowerCase() === "india";
161
166
  await ie({
162
167
  billingAccountId: W,
163
- label: V.label,
164
- type: V.type,
165
- accountHolderName: V.accountHolderName,
166
- country: V.country || void 0,
167
- currency: V.currency,
168
- ...V.type === "BANK_ACCOUNT" && {
169
- accountNumber: V.accountNumber,
170
- ...e ? { ifsc: V.ifscCode } : { routingNumber: V.routingNumber }
168
+ label: H.label,
169
+ type: H.type,
170
+ accountHolderName: H.accountHolderName,
171
+ country: H.country || void 0,
172
+ currency: H.currency,
173
+ ...H.type === "BANK_ACCOUNT" && {
174
+ accountNumber: H.accountNumber,
175
+ ...e ? { ifsc: H.ifscCode } : { routingNumber: H.routingNumber }
171
176
  },
172
- ...V.type === "UPI" && { upiId: V.upiId }
173
- }, G()), _("billing.payout_account.added", {
177
+ ...H.type === "UPI" && { upiId: H.upiId }
178
+ }, G()), g("billing.payout_account.added", {
174
179
  route: "/billing/credits/withdraw",
175
180
  entityId: W,
176
181
  source: "credit-withdrawal"
177
- }), await K(), B(!1), H({
182
+ }), await K(), V(!1), U({
178
183
  label: "",
179
184
  type: "BANK_ACCOUNT",
180
185
  accountHolderName: "",
@@ -186,55 +191,55 @@ var ge = () => {
186
191
  currency: "USD"
187
192
  });
188
193
  } catch (e) {
189
- Ne(e instanceof Error ? e.message : "Failed to add account");
194
+ Ve(e), qe(e instanceof Error ? e.message : "Failed to add account");
190
195
  } finally {
191
- je(!1);
196
+ Ge(!1);
192
197
  }
193
198
  }
194
- }, Ie = async () => {
195
- if (!W || !T) return;
196
- let e = parseFloat(D);
199
+ }, Xe = async () => {
200
+ if (!W || !w) return;
201
+ let e = parseFloat(E);
197
202
  if (!(!e || e <= 0)) {
198
- P(null), M(!0);
203
+ N(null), F(null), j(!0);
199
204
  try {
200
- let t = await fe({
205
+ let t = await xe({
201
206
  billingAccountId: W,
202
207
  creditAmount: e,
203
- payoutAccountId: T,
204
- notes: k || void 0
208
+ payoutAccountId: w,
209
+ notes: O || void 0
205
210
  }, G());
206
- _("billing.credits.withdrawal_requested", {
211
+ g("billing.credits.withdrawal_requested", {
207
212
  route: "/billing/credits/withdraw",
208
213
  entityId: t.id,
209
214
  source: "credit-withdrawal",
210
215
  amount: e
211
- }), I(!0), O(""), A(""), await Pe(), await q();
216
+ }), L(!0), D(""), k(""), await Je(), await q();
212
217
  } catch (e) {
213
- P(e instanceof Error ? e.message : "Withdrawal request failed");
218
+ F(e), N(e instanceof Error ? e.message : "Withdrawal request failed");
214
219
  } finally {
215
- M(!1);
220
+ j(!1);
216
221
  }
217
222
  }
218
- }, J = g?.currency ?? "USD", Y = parseFloat(D) || 0, { data: Le, loading: Re } = r({
223
+ }, J = m?.currency ?? "USD", Y = parseFloat(E) || 0, { data: Ze, loading: Qe } = r({
219
224
  variables: {
220
225
  creditAmount: Y,
221
226
  currency: J
222
227
  },
223
- skip: Y <= 0 || !g
224
- }), ze = Le?.getCostOfCredits?.amount;
225
- if (!e.canWithdrawCredits) return /* @__PURE__ */ p("div", {
228
+ skip: Y <= 0 || !m
229
+ }), $e = Ze?.getCostOfCredits?.amount;
230
+ if (!e.canWithdrawCredits) return /* @__PURE__ */ d("div", {
226
231
  className: "flex items-center justify-center h-full min-h-[400px]",
227
- children: /* @__PURE__ */ m("div", {
232
+ children: /* @__PURE__ */ f("div", {
228
233
  className: "text-center space-y-2",
229
234
  children: [
230
- /* @__PURE__ */ p("div", {
235
+ /* @__PURE__ */ d("div", {
231
236
  className: "size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center",
232
- children: /* @__PURE__ */ p("svg", {
237
+ children: /* @__PURE__ */ d("svg", {
233
238
  className: "size-6 text-text-secondary",
234
239
  fill: "none",
235
240
  viewBox: "0 0 24 24",
236
241
  stroke: "currentColor",
237
- children: /* @__PURE__ */ p("path", {
242
+ children: /* @__PURE__ */ d("path", {
238
243
  strokeLinecap: "round",
239
244
  strokeLinejoin: "round",
240
245
  strokeWidth: 2,
@@ -242,123 +247,136 @@ var ge = () => {
242
247
  })
243
248
  })
244
249
  }),
245
- /* @__PURE__ */ p("h2", {
250
+ /* @__PURE__ */ d("h2", {
246
251
  className: "text-lg font-semibold text-text-primary",
247
252
  children: "Access Denied"
248
253
  }),
249
- /* @__PURE__ */ p("p", {
254
+ /* @__PURE__ */ d("p", {
250
255
  className: "text-sm text-text-secondary",
251
256
  children: "You don't have permission to withdraw credits."
252
257
  })
253
258
  ]
254
259
  })
255
260
  });
256
- if (!ye && !g) return /* @__PURE__ */ p("div", {
261
+ if (!h && !m) return /* @__PURE__ */ d("div", {
257
262
  className: "flex items-center justify-center h-full min-h-[400px]",
258
- children: /* @__PURE__ */ m("div", {
263
+ children: /* @__PURE__ */ f("div", {
259
264
  className: "text-center space-y-2",
260
- children: [/* @__PURE__ */ p("h2", {
265
+ children: [/* @__PURE__ */ d("h2", {
261
266
  className: "text-lg font-semibold text-text-primary",
262
267
  children: "No Billing Account"
263
- }), /* @__PURE__ */ p("p", {
268
+ }), /* @__PURE__ */ d("p", {
264
269
  className: "text-sm text-text-secondary",
265
270
  children: "You need a billing account to withdraw credits."
266
271
  })]
267
272
  })
268
273
  });
269
- if (ye && !g) return /* @__PURE__ */ m("div", {
274
+ if (h && !m) return /* @__PURE__ */ f("div", {
270
275
  className: "space-y-6 px-6 lg:px-8 py-6",
271
- children: [/* @__PURE__ */ p("div", { className: "h-8 w-64 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ p("div", {
276
+ children: [/* @__PURE__ */ d("div", { className: "h-8 w-64 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ d("div", {
272
277
  className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
273
278
  children: [
274
279
  1,
275
280
  2,
276
281
  3,
277
282
  4
278
- ].map((e) => /* @__PURE__ */ m("div", {
283
+ ].map((e) => /* @__PURE__ */ f("div", {
279
284
  className: "border border-border-subtle rounded-lg p-5",
280
- children: [/* @__PURE__ */ p("div", { className: "h-4 w-24 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ p("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" })]
285
+ children: [/* @__PURE__ */ d("div", { className: "h-4 w-24 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ d("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" })]
281
286
  }, e))
282
287
  })]
283
288
  });
284
- let X = v?.withdrawable ?? 0, Z = .005, Be = Y > 0 && Y <= X + Z, Q = Te.filter((e) => e.status !== "ARCHIVED"), $ = j ? null : Q.length === 0 ? "Add a payout method above before requesting a withdrawal." : T ? Y > 0 ? Y > X + Z ? `Amount exceeds your withdrawable balance of ${X.toLocaleString()} credits.` : null : "Enter an amount to withdraw." : "Select a payout method above.";
285
- return /* @__PURE__ */ m("div", {
289
+ let X = _?.withdrawable ?? 0, Z = .005, et = Y > 0 && Y <= X + Z, Q = Ne.filter((e) => e.status !== "ARCHIVED"), $ = A ? null : Q.length === 0 ? "Add a payout method above before requesting a withdrawal." : w ? Y > 0 ? Y > X + Z ? `Amount exceeds your withdrawable balance of ${X.toLocaleString()} credits.` : null : "Enter an amount to withdraw." : "Select a payout method above.";
290
+ return /* @__PURE__ */ f("div", {
286
291
  className: "space-y-6 px-6 lg:px-8 py-6",
287
292
  children: [
288
- L && /* @__PURE__ */ p(ee, {
289
- open: Ae,
293
+ R && /* @__PURE__ */ d(te, {
294
+ open: Ue,
290
295
  title: "Review your withdrawal",
291
296
  description: "These credits are converted to a payout when you confirm.",
292
- details: [{
293
- label: "Credits",
294
- value: D
295
- }, {
296
- label: "Paid to",
297
- value: Q.find((e) => e.id === T)?.label ?? ""
298
- }],
297
+ details: [
298
+ {
299
+ label: "Credits",
300
+ value: E
301
+ },
302
+ {
303
+ label: "Paid to",
304
+ value: Q.find((e) => e.id === w)?.label ?? ""
305
+ },
306
+ ...P && he(P) ? [{
307
+ label: He("billing.payoutError.technical", "Technical details"),
308
+ value: /* @__PURE__ */ d(ye, {
309
+ copyable: !0,
310
+ children: he(P)
311
+ })
312
+ }] : []
313
+ ],
299
314
  confirmLabel: "Request withdrawal",
300
315
  busyLabel: "Requesting…",
301
- isBusy: j,
302
- error: N,
303
- onConfirm: () => void Ie(),
304
- onCancel: () => R(!1)
316
+ isBusy: A,
317
+ error: M ? me(P, He) : null,
318
+ onConfirm: () => void Xe(),
319
+ onCancel: () => z(!1)
305
320
  }),
306
- /* @__PURE__ */ m("div", {
321
+ /* @__PURE__ */ f("div", {
307
322
  className: "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",
308
- children: [/* @__PURE__ */ m("div", { children: [
309
- /* @__PURE__ */ p("h1", {
323
+ children: [/* @__PURE__ */ f("div", { children: [
324
+ /* @__PURE__ */ d("h1", {
310
325
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
311
326
  children: "Withdraw Credits"
312
327
  }),
313
- /* @__PURE__ */ p("p", {
328
+ /* @__PURE__ */ d("p", {
314
329
  className: "text-sm text-text-secondary mt-1",
315
330
  children: "Convert your withdrawable credits (purchased & earned) to a payout"
316
331
  }),
317
- /* @__PURE__ */ p(ue, {
332
+ /* @__PURE__ */ d(ve, {
318
333
  className: "mt-3",
319
334
  children: "Turn the credits you bought or earned (from sales and referrals) back into real money. Add a bank account or UPI as a payout destination, request a withdrawal for any amount up to your withdrawable balance, and track each request here until it is paid. Granted credits (coupons, admin grants) are not withdrawable."
320
335
  })
321
- ] }), t.length > 1 && /* @__PURE__ */ p("select", {
322
- value: g?.id ?? "",
336
+ ] }), t.length > 1 && /* @__PURE__ */ d("select", {
337
+ value: m?.id ?? "",
323
338
  onChange: (e) => a(e.target.value),
324
339
  "aria-label": "Switch billing account",
325
340
  className: "px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] w-full sm:min-w-[200px] sm:w-auto",
326
- children: t.map((e) => /* @__PURE__ */ p("option", {
341
+ children: t.map((e) => /* @__PURE__ */ d("option", {
327
342
  value: e.id,
328
343
  children: e.name
329
344
  }, e.id))
330
345
  })]
331
346
  }),
332
- /* @__PURE__ */ p("div", {
347
+ /* @__PURE__ */ d("div", {
333
348
  className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
334
- children: we ? [
349
+ children: Me ? [
335
350
  1,
336
351
  2,
337
352
  3,
338
353
  4
339
- ].map((e) => /* @__PURE__ */ m("div", {
354
+ ].map((e) => /* @__PURE__ */ f("div", {
340
355
  className: "border border-border-subtle rounded-lg p-5",
341
- children: [/* @__PURE__ */ p("div", { className: "h-4 w-20 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ p("div", { className: "h-8 w-28 bg-bg-sunken animate-pulse rounded" })]
342
- }, e)) : b ? /* @__PURE__ */ p("div", {
356
+ children: [/* @__PURE__ */ d("div", { className: "h-4 w-20 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ d("div", { className: "h-8 w-28 bg-bg-sunken animate-pulse rounded" })]
357
+ }, e)) : y ? R ? /* @__PURE__ */ d(s, {
358
+ error: Re,
359
+ className: "col-span-4"
360
+ }) : /* @__PURE__ */ d("div", {
343
361
  className: "col-span-4 text-sm text-status-error-text",
344
- children: b
345
- }) : /* @__PURE__ */ m(f, { children: [
346
- /* @__PURE__ */ p(h, {
362
+ children: y
363
+ }) : /* @__PURE__ */ f(u, { children: [
364
+ /* @__PURE__ */ d(p, {
347
365
  label: "Purchased",
348
- value: v?.purchased ?? 0,
366
+ value: _?.purchased ?? 0,
349
367
  description: "From credit purchases"
350
368
  }),
351
- /* @__PURE__ */ p(h, {
369
+ /* @__PURE__ */ d(p, {
352
370
  label: "Earned",
353
- value: v?.earned ?? 0,
371
+ value: _?.earned ?? 0,
354
372
  description: "From sales & referrals"
355
373
  }),
356
- /* @__PURE__ */ p(h, {
374
+ /* @__PURE__ */ d(p, {
357
375
  label: "Granted",
358
- value: v?.granted ?? 0,
376
+ value: _?.granted ?? 0,
359
377
  description: "Coupons & admin grants — non-withdrawable"
360
378
  }),
361
- /* @__PURE__ */ p(h, {
379
+ /* @__PURE__ */ d(p, {
362
380
  label: "Withdrawable",
363
381
  value: X,
364
382
  description: "Purchased + earned",
@@ -366,38 +384,38 @@ var ge = () => {
366
384
  })
367
385
  ] })
368
386
  }),
369
- F && /* @__PURE__ */ m("div", {
387
+ I && /* @__PURE__ */ f("div", {
370
388
  className: "flex items-center gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-border text-status-success-text",
371
389
  children: [
372
- /* @__PURE__ */ p("svg", {
390
+ /* @__PURE__ */ d("svg", {
373
391
  className: "size-5 shrink-0",
374
392
  fill: "none",
375
393
  viewBox: "0 0 24 24",
376
394
  stroke: "currentColor",
377
- children: /* @__PURE__ */ p("path", {
395
+ children: /* @__PURE__ */ d("path", {
378
396
  strokeLinecap: "round",
379
397
  strokeLinejoin: "round",
380
398
  strokeWidth: 2,
381
399
  d: "M5 13l4 4L19 7"
382
400
  })
383
401
  }),
384
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("p", {
402
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("p", {
385
403
  className: "font-medium",
386
404
  children: "Withdrawal request submitted"
387
- }), /* @__PURE__ */ p("p", {
405
+ }), /* @__PURE__ */ d("p", {
388
406
  className: "text-sm opacity-80",
389
407
  children: "Our team will review and process your request."
390
408
  })] }),
391
- /* @__PURE__ */ p("button", {
409
+ /* @__PURE__ */ d("button", {
392
410
  type: "button",
393
- onClick: () => I(!1),
411
+ onClick: () => L(!1),
394
412
  className: "ml-auto text-current opacity-60 hover:opacity-100",
395
- children: /* @__PURE__ */ p("svg", {
413
+ children: /* @__PURE__ */ d("svg", {
396
414
  className: "size-4",
397
415
  fill: "none",
398
416
  viewBox: "0 0 24 24",
399
417
  stroke: "currentColor",
400
- children: /* @__PURE__ */ p("path", {
418
+ children: /* @__PURE__ */ d("path", {
401
419
  strokeLinecap: "round",
402
420
  strokeLinejoin: "round",
403
421
  strokeWidth: 2,
@@ -407,82 +425,82 @@ var ge = () => {
407
425
  })
408
426
  ]
409
427
  }),
410
- /* @__PURE__ */ m("div", {
428
+ /* @__PURE__ */ f("div", {
411
429
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
412
- children: [/* @__PURE__ */ m("div", {
430
+ children: [/* @__PURE__ */ f("div", {
413
431
  className: "space-y-4",
414
432
  children: [
415
- /* @__PURE__ */ m("div", {
433
+ /* @__PURE__ */ f("div", {
416
434
  className: "flex items-center justify-between",
417
- children: [/* @__PURE__ */ p("h2", {
435
+ children: [/* @__PURE__ */ d("h2", {
418
436
  className: "text-base font-semibold text-text-primary",
419
437
  children: "Payout Account"
420
- }), /* @__PURE__ */ p("button", {
438
+ }), /* @__PURE__ */ d("button", {
421
439
  type: "button",
422
- onClick: () => B((e) => !e),
440
+ onClick: () => V((e) => !e),
423
441
  className: "text-sm text-text-link hover:underline",
424
- children: z ? "Cancel" : "+ Add new"
442
+ children: B ? "Cancel" : "+ Add new"
425
443
  })]
426
444
  }),
427
- z && /* @__PURE__ */ m("div", {
445
+ B && /* @__PURE__ */ f("div", {
428
446
  className: "border border-border-subtle rounded-lg p-4 space-y-3 bg-bg-sunken",
429
447
  children: [
430
- /* @__PURE__ */ p("h3", {
448
+ /* @__PURE__ */ d("h3", {
431
449
  className: "text-sm font-medium text-text-primary",
432
450
  children: "New Payout Account"
433
451
  }),
434
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
452
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
435
453
  className: "block text-xs text-text-secondary mb-1",
436
454
  children: "Label"
437
- }), /* @__PURE__ */ p("input", {
455
+ }), /* @__PURE__ */ d("input", {
438
456
  type: "text",
439
- value: V.label,
440
- onChange: (e) => H((t) => ({
457
+ value: H.label,
458
+ onChange: (e) => U((t) => ({
441
459
  ...t,
442
460
  label: e.target.value
443
461
  })),
444
462
  placeholder: "e.g. My Bank Account",
445
463
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
446
464
  })] }),
447
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
465
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
448
466
  className: "block text-xs text-text-secondary mb-1",
449
467
  children: "Account Holder Name"
450
- }), /* @__PURE__ */ p("input", {
468
+ }), /* @__PURE__ */ d("input", {
451
469
  type: "text",
452
- value: V.accountHolderName,
453
- onChange: (e) => H((t) => ({
470
+ value: H.accountHolderName,
471
+ onChange: (e) => U((t) => ({
454
472
  ...t,
455
473
  accountHolderName: e.target.value
456
474
  })),
457
475
  placeholder: "Full name as on bank account",
458
476
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
459
477
  })] }),
460
- /* @__PURE__ */ m("div", {
478
+ /* @__PURE__ */ f("div", {
461
479
  className: "grid grid-cols-2 gap-3",
462
- children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
480
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
463
481
  className: "block text-xs text-text-secondary mb-1",
464
482
  children: "Type"
465
- }), /* @__PURE__ */ m("select", {
466
- value: V.type,
467
- onChange: (e) => H((t) => ({
483
+ }), /* @__PURE__ */ f("select", {
484
+ value: H.type,
485
+ onChange: (e) => U((t) => ({
468
486
  ...t,
469
487
  type: e.target.value
470
488
  })),
471
489
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
472
- children: [/* @__PURE__ */ p("option", {
490
+ children: [/* @__PURE__ */ d("option", {
473
491
  value: "BANK_ACCOUNT",
474
492
  children: "Bank Account"
475
- }), /* @__PURE__ */ p("option", {
493
+ }), /* @__PURE__ */ d("option", {
476
494
  value: "UPI",
477
495
  children: "UPI"
478
496
  })]
479
- })] }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
497
+ })] }), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
480
498
  className: "block text-xs text-text-secondary mb-1",
481
499
  children: "Country"
482
- }), /* @__PURE__ */ p("input", {
500
+ }), /* @__PURE__ */ d("input", {
483
501
  type: "text",
484
- value: V.country,
485
- onChange: (e) => H((t) => ({
502
+ value: H.country,
503
+ onChange: (e) => U((t) => ({
486
504
  ...t,
487
505
  country: e.target.value
488
506
  })),
@@ -490,94 +508,98 @@ var ge = () => {
490
508
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
491
509
  })] })]
492
510
  }),
493
- V.type === "BANK_ACCOUNT" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
511
+ H.type === "BANK_ACCOUNT" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
494
512
  className: "block text-xs text-text-secondary mb-1",
495
513
  children: "Account Number"
496
- }), /* @__PURE__ */ p("input", {
514
+ }), /* @__PURE__ */ d("input", {
497
515
  type: "text",
498
- value: V.accountNumber,
499
- onChange: (e) => H((t) => ({
516
+ value: H.accountNumber,
517
+ onChange: (e) => U((t) => ({
500
518
  ...t,
501
519
  accountNumber: e.target.value
502
520
  })),
503
521
  placeholder: "Account number",
504
522
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
505
- })] }), V.country.trim().toUpperCase() === "IN" || V.country.trim().toLowerCase() === "india" ? /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
523
+ })] }), H.country.trim().toUpperCase() === "IN" || H.country.trim().toLowerCase() === "india" ? /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
506
524
  className: "block text-xs text-text-secondary mb-1",
507
525
  children: "IFSC Code"
508
- }), /* @__PURE__ */ p("input", {
526
+ }), /* @__PURE__ */ d("input", {
509
527
  type: "text",
510
- value: V.ifscCode,
511
- onChange: (e) => H((t) => ({
528
+ value: H.ifscCode,
529
+ onChange: (e) => U((t) => ({
512
530
  ...t,
513
531
  ifscCode: e.target.value.toUpperCase()
514
532
  })),
515
533
  placeholder: "e.g. SBIN0001234",
516
534
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
517
- })] }) : /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
535
+ })] }) : /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
518
536
  className: "block text-xs text-text-secondary mb-1",
519
537
  children: "Routing Number"
520
- }), /* @__PURE__ */ p("input", {
538
+ }), /* @__PURE__ */ d("input", {
521
539
  type: "text",
522
- value: V.routingNumber,
523
- onChange: (e) => H((t) => ({
540
+ value: H.routingNumber,
541
+ onChange: (e) => U((t) => ({
524
542
  ...t,
525
543
  routingNumber: e.target.value
526
544
  })),
527
545
  placeholder: "Routing / sort code",
528
546
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
529
547
  })] })] }),
530
- V.type === "UPI" && /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
548
+ H.type === "UPI" && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
531
549
  className: "block text-xs text-text-secondary mb-1",
532
550
  children: "UPI ID"
533
- }), /* @__PURE__ */ p("input", {
551
+ }), /* @__PURE__ */ d("input", {
534
552
  type: "text",
535
- value: V.upiId,
536
- onChange: (e) => H((t) => ({
553
+ value: H.upiId,
554
+ onChange: (e) => U((t) => ({
537
555
  ...t,
538
556
  upiId: e.target.value
539
557
  })),
540
558
  placeholder: "yourname@upi",
541
559
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
542
560
  })] }),
543
- Me && /* @__PURE__ */ p("p", {
561
+ Ke && (R ? /* @__PURE__ */ d(s, { error: Be }) : /* @__PURE__ */ d("p", {
544
562
  className: "text-xs text-status-error-text",
545
- children: Me
546
- }),
547
- /* @__PURE__ */ p("button", {
563
+ children: Ke
564
+ })),
565
+ /* @__PURE__ */ d("button", {
548
566
  type: "button",
549
- onClick: () => void Fe(),
550
- disabled: U || !V.label || !V.accountHolderName,
567
+ onClick: () => void Ye(),
568
+ disabled: We || !H.label || !H.accountHolderName,
551
569
  className: "w-full py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
552
- children: U ? "Saving…" : "Save Account"
570
+ children: We ? "Saving…" : "Save Account"
553
571
  })
554
572
  ]
555
573
  }),
556
- De ? /* @__PURE__ */ p("div", {
574
+ Fe ? /* @__PURE__ */ d("div", {
557
575
  className: "space-y-2",
558
- children: [1, 2].map((e) => /* @__PURE__ */ p("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
559
- }) : Q.length === 0 && !z ? /* @__PURE__ */ p(d, {
576
+ children: [1, 2].map((e) => /* @__PURE__ */ d("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
577
+ }) : Q.length === 0 && !B ? /* @__PURE__ */ d(_e, {
560
578
  illustration: "empty-generic",
561
579
  title: "No payout accounts yet",
562
580
  description: "Add a bank account or UPI to receive your withdrawn credits.",
563
- action: /* @__PURE__ */ p("button", {
581
+ action: /* @__PURE__ */ d("button", {
564
582
  type: "button",
565
- onClick: () => B(!0),
583
+ onClick: () => V(!0),
566
584
  className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
567
585
  children: "Add a bank account or UPI"
568
586
  })
569
- }) : /* @__PURE__ */ p("div", {
587
+ }) : R ? /* @__PURE__ */ d(fe, {
588
+ destinations: pe(Q),
589
+ selectedId: w,
590
+ onSelect: T
591
+ }) : /* @__PURE__ */ d("div", {
570
592
  className: "space-y-2",
571
- children: Q.map((e) => /* @__PURE__ */ p("button", {
593
+ children: Q.map((e) => /* @__PURE__ */ d("button", {
572
594
  type: "button",
573
- onClick: () => E(e.id),
574
- className: `w-full text-left p-4 border rounded-lg transition-colors ${T === e.id ? "border-border-strong bg-[var(--color-accent-soft)]" : "border-border-subtle bg-bg-surface hover:border-border-strong"}`,
575
- children: /* @__PURE__ */ m("div", {
595
+ onClick: () => T(e.id),
596
+ className: `w-full text-left p-4 border rounded-lg transition-colors ${w === e.id ? "border-border-strong bg-[var(--color-accent-soft)]" : "border-border-subtle bg-bg-surface hover:border-border-strong"}`,
597
+ children: /* @__PURE__ */ f("div", {
576
598
  className: "flex items-center justify-between",
577
- children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("p", {
599
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("p", {
578
600
  className: "text-sm font-medium text-text-primary",
579
601
  children: e.label
580
- }), /* @__PURE__ */ m("p", {
602
+ }), /* @__PURE__ */ f("p", {
581
603
  className: "text-xs text-text-secondary mt-0.5",
582
604
  children: [
583
605
  e.type.replaceAll("_", " "),
@@ -585,23 +607,23 @@ var ge = () => {
585
607
  e.accountLast4 ? ` ···${e.accountLast4}` : "",
586
608
  e.country ? ` · ${e.country}` : ""
587
609
  ]
588
- })] }), /* @__PURE__ */ m("div", {
610
+ })] }), /* @__PURE__ */ f("div", {
589
611
  className: "flex items-center gap-2",
590
612
  children: [
591
- e.isDefault && /* @__PURE__ */ p("span", {
613
+ e.isDefault && /* @__PURE__ */ d("span", {
592
614
  className: "text-xs px-2 py-0.5 rounded bg-[var(--color-accent-soft)] text-text-link font-medium",
593
615
  children: "Default"
594
616
  }),
595
- /* @__PURE__ */ p("span", {
596
- className: `text-xs px-2 py-0.5 rounded font-medium ${e.status === "ACTIVE" ? `${s.success.bg} ${s.success.text}` : e.status === "PENDING_VERIFICATION" ? `${s.warning.bg} ${s.warning.text}` : `${s.error.bg} ${s.error.text}`}`,
617
+ /* @__PURE__ */ d("span", {
618
+ className: `text-xs px-2 py-0.5 rounded font-medium ${e.status === "ACTIVE" ? `${o.success.bg} ${o.success.text}` : e.status === "PENDING_VERIFICATION" ? `${o.warning.bg} ${o.warning.text}` : `${o.error.bg} ${o.error.text}`}`,
597
619
  children: e.status.replaceAll("_", " ").toLowerCase()
598
620
  }),
599
- T === e.id && /* @__PURE__ */ p("svg", {
621
+ w === e.id && /* @__PURE__ */ d("svg", {
600
622
  className: "size-4 text-text-link shrink-0",
601
623
  fill: "none",
602
624
  viewBox: "0 0 24 24",
603
625
  stroke: "currentColor",
604
- children: /* @__PURE__ */ p("path", {
626
+ children: /* @__PURE__ */ d("path", {
605
627
  strokeLinecap: "round",
606
628
  strokeLinejoin: "round",
607
629
  strokeWidth: 2,
@@ -614,48 +636,48 @@ var ge = () => {
614
636
  }, e.id))
615
637
  })
616
638
  ]
617
- }), /* @__PURE__ */ m("div", {
639
+ }), /* @__PURE__ */ f("div", {
618
640
  className: "space-y-4",
619
- children: [/* @__PURE__ */ p("h2", {
641
+ children: [/* @__PURE__ */ d("h2", {
620
642
  className: "text-base font-semibold text-text-primary",
621
643
  children: "Request Withdrawal"
622
- }), /* @__PURE__ */ m("div", {
644
+ }), /* @__PURE__ */ f("div", {
623
645
  className: "border border-border-subtle rounded-lg p-5 bg-bg-surface space-y-4",
624
646
  children: [
625
- /* @__PURE__ */ m("div", { children: [
626
- /* @__PURE__ */ p("label", {
647
+ /* @__PURE__ */ f("div", { children: [
648
+ /* @__PURE__ */ d("label", {
627
649
  className: "block text-sm font-medium text-text-primary mb-1",
628
650
  children: "Credits to Withdraw"
629
651
  }),
630
- /* @__PURE__ */ p("input", {
652
+ /* @__PURE__ */ d("input", {
631
653
  type: "number",
632
654
  min: 1,
633
655
  max: X,
634
656
  step: 1,
635
- value: D,
636
- onChange: (e) => O(e.target.value),
657
+ value: E,
658
+ onChange: (e) => D(e.target.value),
637
659
  placeholder: "Enter credit amount",
638
660
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
639
661
  }),
640
- /* @__PURE__ */ m("p", {
662
+ /* @__PURE__ */ f("p", {
641
663
  className: "text-xs text-text-secondary mt-1",
642
664
  children: [
643
665
  "Max withdrawable:",
644
666
  " ",
645
- /* @__PURE__ */ m("span", {
667
+ /* @__PURE__ */ f("span", {
646
668
  className: "font-medium",
647
669
  children: [X.toLocaleString(), " credits"]
648
670
  })
649
671
  ]
650
672
  }),
651
- Y > 0 && Y <= X + Z && /* @__PURE__ */ p("p", {
673
+ Y > 0 && Y <= X + Z && /* @__PURE__ */ d("p", {
652
674
  className: "text-xs text-text-secondary mt-1",
653
- children: Re ? "Calculating…" : ze == null ? null : /* @__PURE__ */ m(f, { children: [
675
+ children: Qe ? "Calculating…" : $e == null ? null : /* @__PURE__ */ f(u, { children: [
654
676
  "Estimated payout:",
655
677
  " ",
656
- /* @__PURE__ */ p("span", {
678
+ /* @__PURE__ */ d("span", {
657
679
  className: "font-semibold text-text-primary",
658
- children: ze.toLocaleString(void 0, {
680
+ children: $e.toLocaleString(void 0, {
659
681
  style: "currency",
660
682
  currency: J,
661
683
  minimumFractionDigits: 2,
@@ -666,35 +688,36 @@ var ge = () => {
666
688
  "at the current credit rate"
667
689
  ] })
668
690
  }),
669
- Y > 0 && Y > X + Z && /* @__PURE__ */ p("p", {
691
+ Y > 0 && Y > X + Z && /* @__PURE__ */ d("p", {
670
692
  className: "text-xs text-status-error-text mt-1",
671
693
  children: "Amount exceeds your withdrawable balance"
672
694
  })
673
695
  ] }),
674
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("label", {
696
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
675
697
  className: "block text-sm font-medium text-text-primary mb-1",
676
- children: ["Notes ", /* @__PURE__ */ p("span", {
698
+ children: ["Notes ", /* @__PURE__ */ d("span", {
677
699
  className: "text-text-secondary font-normal",
678
700
  children: "(optional)"
679
701
  })]
680
- }), /* @__PURE__ */ p("textarea", {
681
- value: k,
682
- onChange: (e) => A(e.target.value),
702
+ }), /* @__PURE__ */ d("textarea", {
703
+ value: O,
704
+ onChange: (e) => k(e.target.value),
683
705
  placeholder: "Any notes for this withdrawal request",
684
706
  rows: 2,
685
707
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none"
686
708
  })] }),
687
- N && /* @__PURE__ */ p("div", {
709
+ M && R && /* @__PURE__ */ d(s, { error: P }),
710
+ M && !R && /* @__PURE__ */ d("div", {
688
711
  className: "p-3 rounded-button bg-status-error-bg-subtle border border-status-error-border",
689
- children: /* @__PURE__ */ p("p", {
712
+ children: /* @__PURE__ */ d("p", {
690
713
  className: "text-sm text-status-error-text",
691
- children: N
714
+ children: M
692
715
  })
693
716
  }),
694
- /* @__PURE__ */ m("div", {
717
+ /* @__PURE__ */ f("div", {
695
718
  className: "pt-1 border-t border-border-subtle",
696
719
  children: [
697
- /* @__PURE__ */ m("p", {
720
+ /* @__PURE__ */ f("p", {
698
721
  className: "text-xs text-text-secondary mb-3",
699
722
  children: [
700
723
  "Credits will be converted to ",
@@ -702,18 +725,18 @@ var ge = () => {
702
725
  " at the current credit rate. Withdrawals are reviewed before processing and may take 3–5 business days."
703
726
  ]
704
727
  }),
705
- $ && /* @__PURE__ */ p("p", {
728
+ $ && /* @__PURE__ */ d("p", {
706
729
  className: "text-xs text-status-warning-text mb-2",
707
730
  children: $
708
731
  }),
709
- /* @__PURE__ */ p("button", {
732
+ /* @__PURE__ */ d("button", {
710
733
  type: "button",
711
734
  onClick: () => {
712
- L ? (P(null), I(!1), R(!0)) : Ie();
735
+ R ? (N(null), L(!1), z(!0)) : Xe();
713
736
  },
714
- disabled: j || !Be || !T || Q.length === 0,
737
+ disabled: A || !et || !w || Q.length === 0,
715
738
  className: "w-full py-2.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
716
- children: j ? "Submitting…" : "Request Withdrawal"
739
+ children: A ? "Submitting…" : "Request Withdrawal"
717
740
  })
718
741
  ]
719
742
  })
@@ -721,24 +744,24 @@ var ge = () => {
721
744
  })]
722
745
  })]
723
746
  }),
724
- /* @__PURE__ */ m("div", {
747
+ /* @__PURE__ */ f("div", {
725
748
  className: "space-y-3",
726
- children: [/* @__PURE__ */ m("div", {
749
+ children: [/* @__PURE__ */ f("div", {
727
750
  className: "flex items-center justify-between",
728
- children: [/* @__PURE__ */ p("h2", {
751
+ children: [/* @__PURE__ */ d("h2", {
729
752
  className: "text-base font-semibold text-text-primary",
730
753
  children: "Withdrawal History"
731
- }), /* @__PURE__ */ p("button", {
754
+ }), /* @__PURE__ */ d("button", {
732
755
  type: "button",
733
756
  onClick: () => void q(),
734
757
  className: "text-sm text-text-secondary hover:text-text-primary transition-colors",
735
758
  "aria-label": "Refresh withdrawal history",
736
- children: /* @__PURE__ */ p("svg", {
759
+ children: /* @__PURE__ */ d("svg", {
737
760
  className: "size-4",
738
761
  fill: "none",
739
762
  viewBox: "0 0 24 24",
740
763
  stroke: "currentColor",
741
- children: /* @__PURE__ */ p("path", {
764
+ children: /* @__PURE__ */ d("path", {
742
765
  strokeLinecap: "round",
743
766
  strokeLinejoin: "round",
744
767
  strokeWidth: 2,
@@ -746,51 +769,51 @@ var ge = () => {
746
769
  })
747
770
  })
748
771
  })]
749
- }), ke ? /* @__PURE__ */ p("div", {
772
+ }), Le ? /* @__PURE__ */ d("div", {
750
773
  className: "space-y-2",
751
774
  children: [
752
775
  1,
753
776
  2,
754
777
  3
755
- ].map((e) => /* @__PURE__ */ p("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
756
- }) : C.length === 0 ? /* @__PURE__ */ p(d, {
778
+ ].map((e) => /* @__PURE__ */ d("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
779
+ }) : S.length === 0 ? /* @__PURE__ */ d(_e, {
757
780
  illustration: "empty-data",
758
781
  title: "No withdrawal requests yet",
759
782
  description: "Once you request a withdrawal, its status will appear here."
760
- }) : /* @__PURE__ */ p("div", {
783
+ }) : /* @__PURE__ */ d("div", {
761
784
  className: "border border-border-subtle rounded-lg overflow-hidden",
762
- children: /* @__PURE__ */ m("table", {
785
+ children: /* @__PURE__ */ f("table", {
763
786
  className: "w-full text-sm",
764
- children: [/* @__PURE__ */ p("thead", {
787
+ children: [/* @__PURE__ */ d("thead", {
765
788
  className: "bg-bg-sunken border-b border-border-subtle",
766
- children: /* @__PURE__ */ m("tr", { children: [
767
- /* @__PURE__ */ p("th", {
789
+ children: /* @__PURE__ */ f("tr", { children: [
790
+ /* @__PURE__ */ d("th", {
768
791
  className: "text-left px-4 py-3 text-xs font-medium text-text-secondary uppercase tracking-wide",
769
792
  children: "Amount"
770
793
  }),
771
- /* @__PURE__ */ p("th", {
794
+ /* @__PURE__ */ d("th", {
772
795
  className: "text-left px-4 py-3 text-xs font-medium text-text-secondary uppercase tracking-wide",
773
796
  children: "Status"
774
797
  }),
775
- /* @__PURE__ */ p("th", {
798
+ /* @__PURE__ */ d("th", {
776
799
  className: "text-left px-4 py-3 text-xs font-medium text-text-secondary uppercase tracking-wide hidden sm:table-cell",
777
800
  children: "Payout Account"
778
801
  }),
779
- /* @__PURE__ */ p("th", {
802
+ /* @__PURE__ */ d("th", {
780
803
  className: "text-left px-4 py-3 text-xs font-medium text-text-secondary uppercase tracking-wide hidden md:table-cell",
781
804
  children: "Requested"
782
805
  }),
783
- /* @__PURE__ */ p("th", {
806
+ /* @__PURE__ */ d("th", {
784
807
  className: "text-left px-4 py-3 text-xs font-medium text-text-secondary uppercase tracking-wide hidden md:table-cell",
785
808
  children: "Completed"
786
809
  })
787
810
  ] })
788
- }), /* @__PURE__ */ p("tbody", {
811
+ }), /* @__PURE__ */ d("tbody", {
789
812
  className: "divide-y divide-border-subtle",
790
- children: C.map((e) => /* @__PURE__ */ m("tr", {
813
+ children: S.map((e) => /* @__PURE__ */ f("tr", {
791
814
  className: "hover:bg-bg-sunken transition-colors",
792
815
  children: [
793
- /* @__PURE__ */ m("td", {
816
+ /* @__PURE__ */ f("td", {
794
817
  className: "px-4 py-3 font-medium text-text-primary",
795
818
  children: [
796
819
  e.requestedAmount.toLocaleString(),
@@ -798,33 +821,33 @@ var ge = () => {
798
821
  e.currency
799
822
  ]
800
823
  }),
801
- /* @__PURE__ */ m("td", {
824
+ /* @__PURE__ */ f("td", {
802
825
  className: "px-4 py-3",
803
- children: [/* @__PURE__ */ p("span", {
804
- className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${he(e.status)}`,
826
+ children: [/* @__PURE__ */ d("span", {
827
+ className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${we(e.status)}`,
805
828
  children: e.status.charAt(0) + e.status.slice(1).toLowerCase()
806
- }), e.failureReason && /* @__PURE__ */ p("p", {
829
+ }), e.failureReason && /* @__PURE__ */ d("p", {
807
830
  className: "text-xs text-status-error-text mt-0.5 max-w-[180px] truncate",
808
831
  title: e.failureReason,
809
832
  children: e.failureReason
810
833
  })]
811
834
  }),
812
- /* @__PURE__ */ p("td", {
835
+ /* @__PURE__ */ d("td", {
813
836
  className: "px-4 py-3 text-text-secondary hidden sm:table-cell",
814
- children: e.payoutAccount ? /* @__PURE__ */ m("span", { children: [e.payoutAccount.label, e.payoutAccount.accountLast4 ? ` ···${e.payoutAccount.accountLast4}` : ""] }) : "—"
837
+ children: e.payoutAccount ? /* @__PURE__ */ f("span", { children: [e.payoutAccount.label, e.payoutAccount.accountLast4 ? ` ···${e.payoutAccount.accountLast4}` : ""] }) : "—"
815
838
  }),
816
- /* @__PURE__ */ p("td", {
839
+ /* @__PURE__ */ d("td", {
817
840
  className: "px-4 py-3 text-text-secondary hidden md:table-cell",
818
- children: /* @__PURE__ */ p("span", {
819
- title: o(e.createdAt, "long"),
820
- children: le(e.createdAt)
841
+ children: /* @__PURE__ */ d("span", {
842
+ title: oe(e.createdAt, "long"),
843
+ children: se(e.createdAt)
821
844
  })
822
845
  }),
823
- /* @__PURE__ */ p("td", {
846
+ /* @__PURE__ */ d("td", {
824
847
  className: "px-4 py-3 text-text-secondary hidden md:table-cell",
825
- children: e.paidAt ? /* @__PURE__ */ p("span", {
826
- className: me("PAID"),
827
- children: o(e.paidAt, "short")
848
+ children: e.paidAt ? /* @__PURE__ */ d("span", {
849
+ className: Ce("PAID"),
850
+ children: oe(e.paidAt, "short")
828
851
  }) : "—"
829
852
  })
830
853
  ]
@@ -836,6 +859,6 @@ var ge = () => {
836
859
  ]
837
860
  });
838
861
  };
839
- export { ge as CreditWithdrawalPage };
862
+ export { Te as CreditWithdrawalPage };
840
863
 
841
864
  //# sourceMappingURL=CreditWithdrawalPage.js.map