@burdenoff/microfe-billing 2026.516.1 → 2026.517.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.
Files changed (59) hide show
  1. package/dist/billing/BillingUserRoutes.js +1 -1
  2. package/dist/billing/BillingUserRoutes.js.map +1 -1
  3. package/dist/billing/modules/billing/hooks/useInvoices.d.ts +0 -1
  4. package/dist/billing/modules/billing/hooks/useInvoices.d.ts.map +1 -1
  5. package/dist/billing/modules/billing/hooks/useInvoices.js +20 -26
  6. package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
  7. package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts.map +1 -1
  8. package/dist/billing/modules/billing/pages/InvoicesListPage.js +176 -170
  9. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  10. package/dist/billing/modules/billing/pages/RefundsPage.js +1 -1
  11. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  12. package/dist/billing/modules/checkout/components/OrderSummary.js +4 -4
  13. package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
  14. package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts.map +1 -1
  15. package/dist/billing/modules/checkout/pages/CheckoutPage.js +2 -2
  16. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  17. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts.map +1 -1
  18. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +178 -209
  19. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  20. package/dist/billing/modules/dashboard/pages/OverviewPage.js +2 -2
  21. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  22. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +2 -2
  23. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  24. package/dist/billing/modules/earnings/api.d.ts +0 -4
  25. package/dist/billing/modules/earnings/api.d.ts.map +1 -1
  26. package/dist/billing/modules/earnings/api.js +10 -14
  27. package/dist/billing/modules/earnings/api.js.map +1 -1
  28. package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts.map +1 -1
  29. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +233 -523
  30. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  31. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -1
  32. package/dist/billing/modules/quota/pages/QuotaPage.js.map +1 -1
  33. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts.map +1 -1
  34. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +44 -101
  35. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  36. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts.map +1 -1
  37. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +46 -105
  38. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  39. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts +1 -1
  40. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts.map +1 -1
  41. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +15 -16
  42. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
  43. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts.map +1 -1
  44. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +165 -158
  45. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  46. package/dist/billing/modules/usage/pages/UsagePage.d.ts.map +1 -1
  47. package/dist/billing/modules/usage/pages/UsagePage.js +3 -3
  48. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  49. package/dist/billing/shared/types/graphql.d.ts +0 -2
  50. package/dist/billing/shared/types/graphql.d.ts.map +1 -1
  51. package/dist/billing/shared/types/graphql.js.map +1 -1
  52. package/dist/generated/global-operations.d.ts +0 -48
  53. package/dist/generated/global-operations.d.ts.map +1 -1
  54. package/dist/generated/global-operations.js +293 -310
  55. package/dist/generated/global-operations.js.map +1 -1
  56. package/dist/generated/global-types.d.ts +0 -9
  57. package/dist/generated/global-types.d.ts.map +1 -1
  58. package/dist/generated/global-types.js.map +1 -1
  59. package/package.json +1 -1
@@ -1,563 +1,273 @@
1
1
  import { useBilling as e } from "../../../providers/BillingProvider.js";
2
2
  import { AccessDenied as t } from "../../../shared/components/AccessDenied.js";
3
3
  import { PageHeader as n } from "../../../shared/components/PageHeader.js";
4
- import { EmptyState as r } from "../../../shared/components/EmptyState.js";
5
- import { ServerError as i } from "../../../shared/components/ServerError.js";
4
+ import { StatCard as r } from "../../../shared/components/StatCard.js";
5
+ import { EmptyState as i } from "../../../shared/components/EmptyState.js";
6
+ import { ServerError as a } from "../../../shared/components/ServerError.js";
6
7
  import "../../../shared/components/index.js";
7
- import { useBillingEventEmitter as a } from "../../../hooks/useBillingEventEmitter.js";
8
- import { formatCurrency as o, formatDateTime as s } from "../../../shared/utils/format.js";
9
- import { isServerError as c } from "../../../shared/utils/error.js";
8
+ import { useBillingEventEmitter as o } from "../../../hooks/useBillingEventEmitter.js";
9
+ import { formatCurrency as s, formatDateTime as c } from "../../../shared/utils/format.js";
10
+ import { isServerError as l } from "../../../shared/utils/error.js";
10
11
  import "../../../shared/utils/index.js";
11
- import { useBillingPermissions as l } from "../../../hooks/useBillingPermissions.js";
12
- import { approvePayoutRequest as u, fetchAdminPayoutRequests as d, fetchAdminPayoutSummary as f, markPayoutPaid as p, rejectPayoutRequest as m } from "../api.js";
13
- import { useEffect as h, useMemo as g, useState as _ } from "react";
14
- import { AlertTriangle as v, Banknote as y, CheckCircle2 as b, ChevronDown as x, ChevronUp as S, Clock as C, CreditCard as w, ReceiptText as T, RefreshCw as E, XCircle as D } from "lucide-react";
15
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
12
+ import { useBillingPermissions as u } from "../../../hooks/useBillingPermissions.js";
13
+ import { approvePayoutRequest as d, fetchAdminPayoutRequests as f, fetchAdminPayoutSummary as p, processPayoutRequest as m, rejectPayoutRequest as h } from "../api.js";
14
+ import { useEffect as g, useMemo as _, useState as v } from "react";
15
+ import { AlertTriangle as y, CheckCircle2 as b, PlayCircle as x, RefreshCw as S, XCircle as C } from "lucide-react";
16
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
16
17
  //#region src/billing/modules/earnings/pages/PayoutAdminPage.tsx
17
- var j = {
18
- REQUESTED: "Requested",
19
- APPROVED: "Approved",
20
- REJECTED: "Rejected",
21
- PROCESSING: "Processing",
22
- PAID: "Paid",
23
- FAILED: "Failed",
24
- CANCELED: "Canceled"
25
- }, M = {
26
- REQUESTED: "bg-warning-surface text-warning-foreground",
27
- APPROVED: "bg-info-surface text-info-foreground",
28
- REJECTED: "bg-destructive/10 text-destructive",
29
- PROCESSING: "bg-info-surface text-info-foreground",
30
- PAID: "bg-success-surface text-success-foreground",
31
- FAILED: "bg-destructive/10 text-destructive",
32
- CANCELED: "bg-muted text-muted-foreground"
33
- };
34
- function N({ status: e }) {
35
- return /* @__PURE__ */ k("span", {
36
- className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${M[e] ?? "bg-muted text-muted-foreground"}`,
37
- children: j[e] ?? e
38
- });
39
- }
40
- function P({ account: e }) {
41
- let [t, n] = _(!1), r = e.accountDetails;
42
- return /* @__PURE__ */ A("div", {
43
- className: "rounded-md border border-border bg-muted/40 p-3 text-sm",
44
- children: [/* @__PURE__ */ A("div", {
45
- className: "flex items-center justify-between",
46
- children: [/* @__PURE__ */ A("div", {
47
- className: "flex items-center gap-2 text-foreground font-medium",
48
- children: [
49
- /* @__PURE__ */ k(w, { className: "h-4 w-4 text-muted-foreground" }),
50
- e.displayName ?? e.label,
51
- /* @__PURE__ */ A("span", {
52
- className: "text-xs text-muted-foreground font-normal",
53
- children: [
54
- "(",
55
- e.type === "UPI" ? "UPI" : "Bank",
56
- " · ",
57
- e.country ?? "Unknown",
58
- " ·",
59
- " ",
60
- e.currency,
61
- ")"
62
- ]
63
- })
64
- ]
65
- }), r && /* @__PURE__ */ k("button", {
66
- type: "button",
67
- onClick: () => n((e) => !e),
68
- className: "text-muted-foreground hover:text-foreground",
69
- children: k(t ? S : x, { className: "h-4 w-4" })
70
- })]
71
- }), t && r && /* @__PURE__ */ A("div", {
72
- className: "mt-2 grid gap-1 text-xs",
73
- children: [
74
- r.accountHolderName && /* @__PURE__ */ A("div", {
75
- className: "flex gap-2",
76
- children: [/* @__PURE__ */ k("span", {
77
- className: "text-muted-foreground w-32 shrink-0",
78
- children: "Account holder"
79
- }), /* @__PURE__ */ k("span", {
80
- className: "text-foreground",
81
- children: r.accountHolderName
82
- })]
83
- }),
84
- r.bankName && /* @__PURE__ */ A("div", {
85
- className: "flex gap-2",
86
- children: [/* @__PURE__ */ k("span", {
87
- className: "text-muted-foreground w-32 shrink-0",
88
- children: "Bank"
89
- }), /* @__PURE__ */ k("span", {
90
- className: "text-foreground",
91
- children: r.bankName
92
- })]
93
- }),
94
- e.accountLast4 && /* @__PURE__ */ A("div", {
95
- className: "flex gap-2",
96
- children: [/* @__PURE__ */ k("span", {
97
- className: "text-muted-foreground w-32 shrink-0",
98
- children: "Account (last 4)"
99
- }), /* @__PURE__ */ A("span", {
100
- className: "text-foreground font-mono",
101
- children: ["••••", e.accountLast4]
102
- })]
103
- }),
104
- r.ifsc && /* @__PURE__ */ A("div", {
105
- className: "flex gap-2",
106
- children: [/* @__PURE__ */ k("span", {
107
- className: "text-muted-foreground w-32 shrink-0",
108
- children: "IFSC"
109
- }), /* @__PURE__ */ k("span", {
110
- className: "text-foreground font-mono",
111
- children: r.ifsc
112
- })]
113
- }),
114
- r.routingNumberLast4 && /* @__PURE__ */ A("div", {
115
- className: "flex gap-2",
116
- children: [/* @__PURE__ */ k("span", {
117
- className: "text-muted-foreground w-32 shrink-0",
118
- children: "Routing (last 4)"
119
- }), /* @__PURE__ */ A("span", {
120
- className: "text-foreground font-mono",
121
- children: ["••••", r.routingNumberLast4]
122
- })]
123
- }),
124
- r.upiIdMasked && /* @__PURE__ */ A("div", {
125
- className: "flex gap-2",
126
- children: [/* @__PURE__ */ k("span", {
127
- className: "text-muted-foreground w-32 shrink-0",
128
- children: "UPI ID"
129
- }), /* @__PURE__ */ k("span", {
130
- className: "text-foreground font-mono",
131
- children: r.upiIdMasked
132
- })]
133
- }),
134
- r.swift && /* @__PURE__ */ A("div", {
135
- className: "flex gap-2",
136
- children: [/* @__PURE__ */ k("span", {
137
- className: "text-muted-foreground w-32 shrink-0",
138
- children: "SWIFT"
139
- }), /* @__PURE__ */ k("span", {
140
- className: "text-foreground font-mono",
141
- children: r.swift
142
- })]
143
- })
144
- ]
145
- })]
146
- });
147
- }
148
- function F({ request: e, onApprove: t, onReject: n, onMarkPaid: r }) {
149
- let i = e.status === "REQUESTED" || e.status === "REJECTED", a = e.status === "REQUESTED" || e.status === "APPROVED", c = e.status === "APPROVED" || e.status === "PROCESSING";
150
- return /* @__PURE__ */ A("div", {
151
- className: "rounded-lg border border-border bg-card p-5 space-y-4",
152
- children: [
153
- /* @__PURE__ */ A("div", {
154
- className: "flex flex-wrap items-start justify-between gap-3",
155
- children: [/* @__PURE__ */ A("div", {
156
- className: "space-y-1",
157
- children: [/* @__PURE__ */ A("div", {
158
- className: "flex items-center gap-2",
159
- children: [/* @__PURE__ */ k("span", {
160
- className: "text-xl font-semibold text-foreground",
161
- children: o(e.requestedAmount, e.currency)
162
- }), /* @__PURE__ */ k(N, { status: e.status })]
163
- }), /* @__PURE__ */ A("div", {
164
- className: "text-xs text-muted-foreground space-x-2",
165
- children: [
166
- /* @__PURE__ */ A("span", { children: ["Requested ", s(e.createdAt)] }),
167
- e.requesterUserId && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("span", { children: "·" }), /* @__PURE__ */ A("span", { children: ["by ", e.requesterUserId] })] }),
168
- /* @__PURE__ */ k("span", { children: "·" }),
169
- /* @__PURE__ */ A("span", {
170
- className: "font-mono text-xs",
171
- children: [e.id.slice(0, 8), "…"]
172
- })
173
- ]
174
- })]
175
- }), /* @__PURE__ */ A("div", {
176
- className: "flex flex-wrap gap-2",
177
- children: [
178
- i && /* @__PURE__ */ A("button", {
179
- type: "button",
180
- onClick: () => t(e),
181
- className: "inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground",
182
- children: [/* @__PURE__ */ k(b, { className: "h-3.5 w-3.5" }), "Approve"]
183
- }),
184
- c && /* @__PURE__ */ A("button", {
185
- type: "button",
186
- onClick: () => r(e),
187
- className: "inline-flex items-center gap-1.5 rounded-md bg-success-surface border border-success-border px-3 py-1.5 text-xs font-medium text-success-foreground",
188
- children: [/* @__PURE__ */ k(y, { className: "h-3.5 w-3.5" }), "Mark as Paid"]
189
- }),
190
- a && /* @__PURE__ */ A("button", {
191
- type: "button",
192
- onClick: () => n(e),
193
- className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-destructive",
194
- children: [/* @__PURE__ */ k(D, { className: "h-3.5 w-3.5" }), "Reject"]
195
- })
196
- ]
197
- })]
198
- }),
199
- e.payoutAccount && /* @__PURE__ */ k(P, { account: e.payoutAccount }),
200
- e.userNotes && /* @__PURE__ */ A("div", {
201
- className: "rounded-md bg-muted/40 border border-border px-3 py-2 text-sm",
202
- children: [/* @__PURE__ */ k("span", {
203
- className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
204
- children: "User note"
205
- }), /* @__PURE__ */ k("p", {
206
- className: "mt-1 text-foreground",
207
- children: e.userNotes
208
- })]
209
- }),
210
- (e.internalNotes ?? e.failureReason ?? e.externalReference) && /* @__PURE__ */ A("div", {
211
- className: "grid gap-1 text-xs text-muted-foreground",
212
- children: [
213
- e.externalReference && /* @__PURE__ */ A("div", {
214
- className: "flex gap-2",
215
- children: [/* @__PURE__ */ k(T, { className: "h-3.5 w-3.5 mt-px shrink-0" }), /* @__PURE__ */ A("span", { children: ["Ref: ", /* @__PURE__ */ k("span", {
216
- className: "font-mono text-foreground",
217
- children: e.externalReference
218
- })] })]
219
- }),
220
- e.internalNotes && /* @__PURE__ */ A("div", {
221
- className: "flex gap-2",
222
- children: [/* @__PURE__ */ k("span", {
223
- className: "shrink-0",
224
- children: "Internal note:"
225
- }), /* @__PURE__ */ k("span", {
226
- className: "text-foreground",
227
- children: e.internalNotes
228
- })]
229
- }),
230
- e.failureReason && /* @__PURE__ */ A("div", {
231
- className: "flex gap-2 text-destructive",
232
- children: [/* @__PURE__ */ k(v, { className: "h-3.5 w-3.5 mt-px shrink-0" }), /* @__PURE__ */ k("span", { children: e.failureReason })]
233
- })
234
- ]
235
- }),
236
- (e.paidAt ?? e.processedAt) && /* @__PURE__ */ A("div", {
237
- className: "flex flex-wrap gap-4 text-xs text-muted-foreground",
238
- children: [e.processedAt && /* @__PURE__ */ A("span", {
239
- className: "flex items-center gap-1",
240
- children: [
241
- /* @__PURE__ */ k(C, { className: "h-3 w-3" }),
242
- "Processed ",
243
- s(e.processedAt)
244
- ]
245
- }), e.paidAt && /* @__PURE__ */ A("span", {
246
- className: "flex items-center gap-1",
247
- children: [
248
- /* @__PURE__ */ k(b, { className: "h-3 w-3" }),
249
- "Paid ",
250
- s(e.paidAt)
251
- ]
252
- })]
253
- })
254
- ]
255
- });
256
- }
257
- function I({ summary: e }) {
258
- return /* @__PURE__ */ A("div", {
259
- className: "grid gap-3 sm:grid-cols-3",
260
- children: [
261
- /* @__PURE__ */ A("div", {
262
- className: "rounded-lg border border-border bg-card p-4",
263
- children: [
264
- /* @__PURE__ */ k("div", {
265
- className: "text-xs text-muted-foreground uppercase tracking-wide",
266
- children: "Pending payout"
267
- }),
268
- /* @__PURE__ */ k("div", {
269
- className: "mt-1 text-lg font-semibold text-foreground",
270
- children: o(e.totalRequestedAmount, "USD")
271
- }),
272
- /* @__PURE__ */ A("div", {
273
- className: "text-xs text-muted-foreground mt-0.5",
274
- children: [e.pendingCount, " requests"]
275
- })
276
- ]
277
- }),
278
- /* @__PURE__ */ A("div", {
279
- className: "rounded-lg border border-border bg-card p-4",
280
- children: [/* @__PURE__ */ k("div", {
281
- className: "text-xs text-muted-foreground uppercase tracking-wide",
282
- children: "Processing"
283
- }), /* @__PURE__ */ k("div", {
284
- className: "mt-1 text-lg font-semibold text-foreground",
285
- children: o(e.totalProcessingAmount, "USD")
286
- })]
287
- }),
288
- /* @__PURE__ */ A("div", {
289
- className: "rounded-lg border border-border bg-card p-4",
290
- children: [
291
- /* @__PURE__ */ k("div", {
292
- className: "text-xs text-muted-foreground uppercase tracking-wide",
293
- children: "Total paid"
294
- }),
295
- /* @__PURE__ */ k("div", {
296
- className: "mt-1 text-lg font-semibold text-foreground",
297
- children: o(e.totalPaidAmount, "USD")
298
- }),
299
- e.failedCount > 0 && /* @__PURE__ */ A("div", {
300
- className: "text-xs text-destructive mt-0.5",
301
- children: [e.failedCount, " failed"]
302
- })
303
- ]
304
- })
305
- ]
306
- });
307
- }
308
- function L({ dialog: e, onClose: t, onConfirm: n }) {
309
- let [r, i] = _(""), [a, s] = _(""), [c, l] = _(""), [u, d] = _(!1), f = async () => {
310
- e.type === "reject" && !a.trim() || (d(!0), await n({
311
- notes: r.trim() || void 0,
312
- reason: a.trim() || void 0,
313
- externalReference: c.trim() || void 0
314
- }), d(!1));
315
- };
316
- return /* @__PURE__ */ k("div", {
317
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
318
- children: /* @__PURE__ */ A("div", {
319
- className: "w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg space-y-4",
320
- children: [
321
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h3", {
322
- className: "text-base font-semibold text-foreground",
323
- children: {
324
- approve: "Approve withdrawal request",
325
- reject: "Reject withdrawal request",
326
- mark_paid: "Mark as paid"
327
- }[e.type]
328
- }), /* @__PURE__ */ A("p", {
329
- className: "text-sm text-muted-foreground mt-1",
330
- children: [
331
- o(e.amount, e.currency),
332
- " · ",
333
- e.accountLabel
334
- ]
335
- })] }),
336
- e.type === "mark_paid" && /* @__PURE__ */ A("div", {
337
- className: "space-y-3",
338
- children: [/* @__PURE__ */ A("div", { children: [
339
- /* @__PURE__ */ k("label", {
340
- className: "text-xs font-medium text-foreground block mb-1",
341
- children: "Transaction reference / UTR number"
342
- }),
343
- /* @__PURE__ */ k("input", {
344
- type: "text",
345
- value: c,
346
- onChange: (e) => l(e.target.value),
347
- placeholder: "e.g. UTR123456789012, TXN_abc123",
348
- className: "w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
349
- }),
350
- /* @__PURE__ */ k("p", {
351
- className: "text-xs text-muted-foreground mt-1",
352
- children: "Enter the bank reference number so the user can verify the transfer."
353
- })
354
- ] }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("label", {
355
- className: "text-xs font-medium text-foreground block mb-1",
356
- children: "Internal notes (optional)"
357
- }), /* @__PURE__ */ k("textarea", {
358
- value: r,
359
- onChange: (e) => i(e.target.value),
360
- rows: 2,
361
- placeholder: "Any internal notes about this payment…",
362
- className: "w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring resize-none"
363
- })] })]
364
- }),
365
- e.type === "approve" && /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("label", {
366
- className: "text-xs font-medium text-foreground block mb-1",
367
- children: "Internal notes (optional)"
368
- }), /* @__PURE__ */ k("textarea", {
369
- value: r,
370
- onChange: (e) => i(e.target.value),
371
- rows: 3,
372
- placeholder: "e.g. Verified bank details, approved for transfer…",
373
- className: "w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring resize-none"
374
- })] }),
375
- e.type === "reject" && /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("label", {
376
- className: "text-xs font-medium text-foreground block mb-1",
377
- children: ["Reason for rejection ", /* @__PURE__ */ k("span", {
378
- className: "text-destructive",
379
- children: "*"
380
- })]
381
- }), /* @__PURE__ */ k("textarea", {
382
- value: a,
383
- onChange: (e) => s(e.target.value),
384
- rows: 3,
385
- placeholder: "e.g. Invalid bank details provided, please re-submit with correct IFSC…",
386
- className: "w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring resize-none"
387
- })] }),
388
- /* @__PURE__ */ A("div", {
389
- className: "flex justify-end gap-2 pt-2",
390
- children: [/* @__PURE__ */ k("button", {
391
- type: "button",
392
- onClick: t,
393
- disabled: u,
394
- className: "rounded-md border border-border px-4 py-2 text-sm font-medium text-foreground disabled:opacity-50",
395
- children: "Cancel"
396
- }), /* @__PURE__ */ k("button", {
397
- type: "button",
398
- onClick: () => void f(),
399
- disabled: u || e.type === "reject" && !a.trim(),
400
- className: `rounded-md px-4 py-2 text-sm font-medium disabled:opacity-50 ${e.type === "reject" ? "bg-destructive text-destructive-foreground" : "bg-primary text-primary-foreground"}`,
401
- children: u ? "Saving…" : e.type === "approve" ? "Approve" : e.type === "reject" ? "Reject" : "Confirm Payment"
402
- })]
403
- })
404
- ]
405
- })
406
- });
407
- }
408
- var R = () => {
409
- let o = l(), { emit: s } = a(), { apiGatewayUrl: v, authToken: y, orgId: x } = e(), [S, C] = _(null), [w, T] = _([]), [D, O] = _(!0), [j, M] = _(null), [N, P] = _("pending"), [R, z] = _(null), B = g(() => ({
410
- apiGatewayUrl: v,
411
- authToken: y,
412
- orgId: x
18
+ var E = () => {
19
+ let E = u(), { emit: D } = o(), { apiGatewayUrl: O, authToken: k, orgId: A } = e(), [j, M] = v(null), [N, P] = v([]), [F, I] = v(!0), [L, R] = v(null), z = _(() => ({
20
+ apiGatewayUrl: O,
21
+ authToken: k,
22
+ orgId: A
413
23
  }), [
414
- v,
415
- y,
416
- x
417
- ]), V = async () => {
418
- O(!0), M(null);
24
+ O,
25
+ k,
26
+ A
27
+ ]), B = async () => {
28
+ I(!0), R(null);
419
29
  try {
420
- let [e, t] = await Promise.all([f(B), d(B)]);
421
- C(e), T(t);
30
+ let [e, t] = await Promise.all([p(z), f(z)]);
31
+ M(e), P(t);
422
32
  } catch (e) {
423
- M(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load payout queue"));
33
+ R(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load payout queue"));
424
34
  } finally {
425
- O(!1);
35
+ I(!1);
426
36
  }
427
37
  };
428
- if (h(() => {
429
- V();
430
- }, [B]), !o.isBillingAdmin) return /* @__PURE__ */ k(t, { message: "You don't have permission to manage payouts." });
431
- if (j && c(j)) return /* @__PURE__ */ k(i, {
38
+ if (g(() => {
39
+ B();
40
+ }, [z]), !E.isBillingAdmin) return /* @__PURE__ */ w(t, { message: "You don't have permission to manage payouts." });
41
+ if (L && l(L)) return /* @__PURE__ */ w(a, {
432
42
  title: "Payout queue unavailable",
433
- message: j.message,
434
- onRetry: () => void V(),
43
+ message: L.message,
44
+ onRetry: () => void B(),
435
45
  showRetry: !0
436
46
  });
437
- let H = w.filter((e) => e.status === "REQUESTED"), U = w.filter((e) => e.status === "APPROVED" || e.status === "PROCESSING"), W = w.filter((e) => [
438
- "PAID",
439
- "REJECTED",
440
- "FAILED",
441
- "CANCELED"
442
- ].includes(e.status)), G = [
47
+ let V = j ? [
48
+ {
49
+ title: "Requested",
50
+ value: s(j.totalRequestedAmount, "USD"),
51
+ icon: /* @__PURE__ */ w(y, { className: "h-5 w-5" })
52
+ },
443
53
  {
444
- id: "pending",
445
- label: "Pending",
446
- count: H.length
54
+ title: "Processing",
55
+ value: s(j.totalProcessingAmount, "USD"),
56
+ icon: /* @__PURE__ */ w(x, { className: "h-5 w-5" })
447
57
  },
448
58
  {
449
- id: "approved",
450
- label: "Approved",
451
- count: U.length
59
+ title: "Paid",
60
+ value: s(j.totalPaidAmount, "USD"),
61
+ icon: /* @__PURE__ */ w(b, { className: "h-5 w-5" })
452
62
  },
453
63
  {
454
- id: "history",
455
- label: "History",
456
- count: W.length
64
+ title: "Failed",
65
+ value: j.failedCount,
66
+ icon: /* @__PURE__ */ w(C, { className: "h-5 w-5" })
457
67
  }
458
- ], K = N === "pending" ? H : N === "approved" ? U : W, q = (e, t) => {
459
- z({
460
- type: e,
461
- requestId: t.id,
462
- amount: t.requestedAmount,
463
- currency: t.currency,
464
- accountLabel: t.payoutAccount?.displayName ?? t.payoutAccount?.label ?? "Unknown account"
465
- });
68
+ ] : [], H = async (e) => {
69
+ await d(e, window.prompt("Approval notes (optional)") ?? null, z), D("billing.payout.approved", {
70
+ route: "/billing/payouts",
71
+ entityId: e,
72
+ source: "payout-admin"
73
+ }), await B();
74
+ }, U = async (e) => {
75
+ let t = window.prompt("Reason for rejection");
76
+ t && (await h(e, t, z), D("billing.payout.rejected", {
77
+ route: "/billing/payouts",
78
+ entityId: e,
79
+ source: "payout-admin",
80
+ reason: t
81
+ }), await B());
82
+ }, W = async (e) => {
83
+ await m(e, z), D("billing.payout.processed", {
84
+ route: "/billing/payouts",
85
+ entityId: e,
86
+ source: "payout-admin"
87
+ }), await B();
466
88
  };
467
- return /* @__PURE__ */ A("div", {
89
+ return /* @__PURE__ */ T("div", {
468
90
  className: "space-y-6 p-6",
469
91
  children: [
470
- /* @__PURE__ */ k(n, {
92
+ /* @__PURE__ */ w(n, {
471
93
  title: "Payout queue",
472
- description: "Review withdrawal requests, verify bank details, and mark payments as paid once transferred.",
473
- actions: /* @__PURE__ */ A("button", {
94
+ description: "Approve, reject, and process payout requests across all earnings sources.",
95
+ actions: /* @__PURE__ */ T("button", {
474
96
  type: "button",
475
- onClick: () => void V(),
97
+ onClick: () => void B(),
476
98
  className: "inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm font-medium text-foreground",
477
- children: [/* @__PURE__ */ k(E, { className: `h-4 w-4 ${D ? "animate-spin" : ""}` }), "Refresh"]
99
+ children: [/* @__PURE__ */ w(S, { className: "h-4 w-4" }), "Refresh"]
478
100
  })
479
101
  }),
480
- S && !D && /* @__PURE__ */ k(I, { summary: S }),
481
- D && /* @__PURE__ */ k("div", {
482
- className: "grid gap-3 sm:grid-cols-3",
102
+ F ? /* @__PURE__ */ w("div", {
103
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
483
104
  children: [
484
105
  1,
485
106
  2,
486
- 3
487
- ].map((e) => /* @__PURE__ */ k("div", { className: "h-20 animate-pulse rounded-lg border border-border bg-card" }, e))
488
- }),
489
- j && !c(j) && /* @__PURE__ */ k("div", {
490
- className: "rounded-lg border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive",
491
- children: j.message
492
- }),
493
- /* @__PURE__ */ k("div", {
494
- className: "border-b border-border",
495
- children: /* @__PURE__ */ k("div", {
496
- className: "flex gap-0",
497
- children: G.map((e) => /* @__PURE__ */ A("button", {
498
- type: "button",
499
- onClick: () => P(e.id),
500
- className: `flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${N === e.id ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`,
501
- children: [e.label, e.count > 0 && /* @__PURE__ */ k("span", {
502
- className: `rounded-full px-1.5 py-0.5 text-xs ${N === e.id ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"}`,
503
- children: e.count
504
- })]
505
- }, e.id))
506
- })
507
- }),
508
- N === "approved" && U.length > 0 && /* @__PURE__ */ A("div", {
509
- className: "rounded-lg border border-info-border bg-info-surface px-4 py-3 text-sm text-info-foreground",
510
- children: [
511
- /* @__PURE__ */ k("strong", { children: "How to pay:" }),
512
- " Click the account row to expand bank/UPI details → transfer the exact amount via your bank → click ",
513
- /* @__PURE__ */ k("strong", { children: "Mark as Paid" }),
514
- " and enter the UTR / transaction reference number."
515
- ]
516
- }),
517
- D ? /* @__PURE__ */ k("div", {
518
- className: "space-y-4",
519
- children: [1, 2].map((e) => /* @__PURE__ */ k("div", { className: "h-40 animate-pulse rounded-lg border border-border bg-card" }, e))
520
- }) : K.length === 0 ? /* @__PURE__ */ k(r, {
521
- icon: /* @__PURE__ */ k(b, { className: "h-8 w-8" }),
522
- title: N === "pending" ? "No pending requests" : N === "approved" ? "No approved requests awaiting payment" : "No history yet",
523
- description: N === "pending" ? "New withdrawal requests will appear here." : N === "approved" ? "Approve pending requests first, then send payment and mark as paid." : "Completed and rejected requests will appear here."
524
- }) : /* @__PURE__ */ k("div", {
107
+ 3,
108
+ 4
109
+ ].map((e) => /* @__PURE__ */ w("div", { className: "h-28 animate-pulse rounded-lg border border-border bg-card" }, e))
110
+ }) : j ? /* @__PURE__ */ T("div", {
525
111
  className: "space-y-4",
526
- children: K.map((e) => /* @__PURE__ */ k(F, {
527
- request: e,
528
- onApprove: (e) => q("approve", e),
529
- onReject: (e) => q("reject", e),
530
- onMarkPaid: (e) => q("mark_paid", e)
531
- }, e.id))
532
- }),
533
- R && /* @__PURE__ */ k(L, {
534
- dialog: R,
535
- onClose: () => z(null),
536
- onConfirm: async (e) => {
537
- if (R) try {
538
- R.type === "approve" ? (await u(R.requestId, e.notes ?? null, B), s("billing.payout.approved", {
539
- route: "/billing/payouts",
540
- entityId: R.requestId,
541
- source: "payout-admin"
542
- })) : R.type === "reject" ? (await m(R.requestId, e.reason ?? "", B), s("billing.payout.rejected", {
543
- route: "/billing/payouts",
544
- entityId: R.requestId,
545
- source: "payout-admin",
546
- reason: e.reason
547
- })) : R.type === "mark_paid" && (await p(R.requestId, e.externalReference ?? null, e.notes ?? null, B), s("billing.payout.processed", {
548
- route: "/billing/payouts",
549
- entityId: R.requestId,
550
- source: "payout-admin"
551
- })), z(null), await V();
552
- } catch (e) {
553
- M(e instanceof Error ? e : /* @__PURE__ */ Error("Action failed"));
554
- }
555
- }
112
+ children: [/* @__PURE__ */ w("div", {
113
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
114
+ children: V.map((e) => /* @__PURE__ */ w(r, {
115
+ label: e.title,
116
+ value: e.value,
117
+ icon: e.icon
118
+ }, e.title))
119
+ }), /* @__PURE__ */ T("div", {
120
+ className: "grid gap-4 xl:grid-cols-2",
121
+ children: [/* @__PURE__ */ T("div", {
122
+ className: "rounded-lg border border-border bg-card p-4",
123
+ children: [/* @__PURE__ */ w("h3", {
124
+ className: "mb-3 text-sm font-semibold text-foreground",
125
+ children: "Status breakdown"
126
+ }), /* @__PURE__ */ w("div", {
127
+ className: "space-y-2 text-sm",
128
+ children: (j.statusBreakdown || []).map((e) => /* @__PURE__ */ T("div", {
129
+ className: "flex items-center justify-between",
130
+ children: [/* @__PURE__ */ w("span", {
131
+ className: "text-muted-foreground",
132
+ children: e.status
133
+ }), /* @__PURE__ */ T("span", {
134
+ className: "font-medium text-foreground",
135
+ children: [
136
+ e.count,
137
+ " · ",
138
+ s(e.totalAmount, "USD")
139
+ ]
140
+ })]
141
+ }, e.status))
142
+ })]
143
+ }), /* @__PURE__ */ T("div", {
144
+ className: "rounded-lg border border-border bg-card p-4",
145
+ children: [/* @__PURE__ */ w("h3", {
146
+ className: "mb-3 text-sm font-semibold text-foreground",
147
+ children: "Provider breakdown"
148
+ }), /* @__PURE__ */ w("div", {
149
+ className: "space-y-2 text-sm",
150
+ children: (j.providerBreakdown || []).map((e) => /* @__PURE__ */ T("div", {
151
+ className: "flex items-center justify-between",
152
+ children: [/* @__PURE__ */ w("span", {
153
+ className: "text-muted-foreground",
154
+ children: e.provider
155
+ }), /* @__PURE__ */ T("span", {
156
+ className: "font-medium text-foreground",
157
+ children: [
158
+ e.count,
159
+ " · ",
160
+ s(e.totalAmount, "USD")
161
+ ]
162
+ })]
163
+ }, e.provider))
164
+ })]
165
+ })]
166
+ })]
167
+ }) : null,
168
+ L && !l(L) ? /* @__PURE__ */ w("div", {
169
+ className: "rounded-lg border border-border bg-card p-4 text-sm text-destructive",
170
+ children: L.message
171
+ }) : null,
172
+ /* @__PURE__ */ T("section", {
173
+ className: "rounded-lg border border-border bg-card p-4",
174
+ children: [/* @__PURE__ */ w("h2", {
175
+ className: "mb-4 text-lg font-semibold text-foreground",
176
+ children: "Requests"
177
+ }), N.length === 0 && !F ? /* @__PURE__ */ w(i, {
178
+ icon: /* @__PURE__ */ w(x, { className: "h-8 w-8" }),
179
+ title: "No payout requests",
180
+ description: "New payout requests will appear in this queue."
181
+ }) : /* @__PURE__ */ w("div", {
182
+ className: "overflow-x-auto",
183
+ children: /* @__PURE__ */ T("table", {
184
+ className: "min-w-full text-sm",
185
+ children: [/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ T("tr", {
186
+ className: "border-b border-border text-left text-muted-foreground",
187
+ children: [
188
+ /* @__PURE__ */ w("th", {
189
+ className: "px-3 py-2",
190
+ children: "Amount"
191
+ }),
192
+ /* @__PURE__ */ w("th", {
193
+ className: "px-3 py-2",
194
+ children: "Provider"
195
+ }),
196
+ /* @__PURE__ */ w("th", {
197
+ className: "px-3 py-2",
198
+ children: "Status"
199
+ }),
200
+ /* @__PURE__ */ w("th", {
201
+ className: "px-3 py-2",
202
+ children: "Account"
203
+ }),
204
+ /* @__PURE__ */ w("th", {
205
+ className: "px-3 py-2",
206
+ children: "Created"
207
+ }),
208
+ /* @__PURE__ */ w("th", {
209
+ className: "px-3 py-2",
210
+ children: "Actions"
211
+ })
212
+ ]
213
+ }) }), /* @__PURE__ */ w("tbody", { children: N.map((e) => /* @__PURE__ */ T("tr", {
214
+ className: "border-b border-border/70 text-foreground",
215
+ children: [
216
+ /* @__PURE__ */ w("td", {
217
+ className: "px-3 py-2 font-medium",
218
+ children: s(e.requestedAmount, e.currency)
219
+ }),
220
+ /* @__PURE__ */ w("td", {
221
+ className: "px-3 py-2",
222
+ children: e.provider
223
+ }),
224
+ /* @__PURE__ */ w("td", {
225
+ className: "px-3 py-2",
226
+ children: e.status
227
+ }),
228
+ /* @__PURE__ */ w("td", {
229
+ className: "px-3 py-2",
230
+ children: e.payoutAccount?.label || "-"
231
+ }),
232
+ /* @__PURE__ */ w("td", {
233
+ className: "px-3 py-2",
234
+ children: c(e.createdAt)
235
+ }),
236
+ /* @__PURE__ */ w("td", {
237
+ className: "px-3 py-2",
238
+ children: /* @__PURE__ */ T("div", {
239
+ className: "flex flex-wrap gap-2",
240
+ children: [
241
+ e.status === "REQUESTED" || e.status === "REJECTED" ? /* @__PURE__ */ w("button", {
242
+ type: "button",
243
+ onClick: () => void H(e.id),
244
+ className: "rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground",
245
+ children: "Approve"
246
+ }) : null,
247
+ e.status === "REQUESTED" || e.status === "APPROVED" ? /* @__PURE__ */ w("button", {
248
+ type: "button",
249
+ onClick: () => void U(e.id),
250
+ className: "rounded-md border border-border px-3 py-1.5 text-xs font-medium text-destructive",
251
+ children: "Reject"
252
+ }) : null,
253
+ e.status === "APPROVED" ? /* @__PURE__ */ w("button", {
254
+ type: "button",
255
+ onClick: () => void W(e.id),
256
+ className: "rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground",
257
+ children: "Process"
258
+ }) : null
259
+ ]
260
+ })
261
+ })
262
+ ]
263
+ }, e.id)) })]
264
+ })
265
+ })]
556
266
  })
557
267
  ]
558
268
  });
559
269
  };
560
270
  //#endregion
561
- export { R as PayoutAdminPage };
271
+ export { E as PayoutAdminPage };
562
272
 
563
273
  //# sourceMappingURL=PayoutAdminPage.js.map