@burdenoff/microfe-billing 2026.625.3 → 2026.625.5

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 (98) hide show
  1. package/dist/billing/lib/native-purchases.js +2 -44
  2. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
  3. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
  4. package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
  5. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  6. package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
  7. package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
  8. package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
  9. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  10. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
  11. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  12. package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
  13. package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
  14. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
  15. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  16. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
  17. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  18. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
  19. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  20. package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
  21. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  22. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
  23. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  24. package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
  25. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  26. package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
  27. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  28. package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
  29. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  30. package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
  31. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  32. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
  33. package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
  34. package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
  35. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  36. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
  37. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  38. package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
  39. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  40. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
  41. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  42. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
  43. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  44. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
  45. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  46. package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
  47. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  48. package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
  49. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  50. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
  51. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  52. package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
  53. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  54. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
  55. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  56. package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
  57. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  58. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
  59. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
  60. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
  61. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
  62. package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
  63. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  64. package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
  65. package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
  66. package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
  67. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  68. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
  69. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  70. package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
  71. package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
  72. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
  73. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
  74. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
  75. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
  76. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
  77. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
  78. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  79. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
  80. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
  81. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
  82. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  83. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
  84. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
  85. package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
  86. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  87. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
  88. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  89. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
  90. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  91. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
  92. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  93. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
  94. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  95. package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
  96. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  97. package/package.json +2 -2
  98. package/dist/billing/lib/native-purchases.js.map +0 -1
@@ -1,41 +1,41 @@
1
1
  import { useBilling as e } from "../../../providers/BillingProvider.js";
2
2
  import { statusTokens as t } from "../../../shared/utils/tokens.js";
3
3
  import { useBillingEventEmitter as n } from "../../../hooks/useBillingEventEmitter.js";
4
- import { formatDate as r, formatRelativeTime as ee } from "../../../shared/utils/format.js";
5
- import { directBillingGraphqlRequest as i } from "../../../shared/utils/directBillingGraphql.js";
4
+ import { formatDate as r, formatRelativeTime as i } from "../../../shared/utils/format.js";
5
+ import { directBillingGraphqlRequest as a } from "../../../shared/utils/directBillingGraphql.js";
6
6
  import "../../../shared/utils/index.js";
7
- import { useBillingPermissions as te } from "../../../hooks/useBillingPermissions.js";
8
- import { CreditWithdrawalHistoryDocument as a, GetCreditBalanceByTypeDocument as o, RequestCreditWithdrawalDocument as s, useGetCostOfCreditsCheckoutQuery as ne } from "../../../../generated/global-operations.js";
9
- import { useDefaultBillingAccount as re } from "../../subscriptions/hooks/useSubscriptions.js";
7
+ import { useBillingPermissions as ee } from "../../../hooks/useBillingPermissions.js";
8
+ import { CreditWithdrawalHistoryDocument as o, GetCreditBalanceByTypeDocument as s, RequestCreditWithdrawalDocument as c, useGetCostOfCreditsCheckoutQuery as te } from "../../../../generated/global-operations.js";
9
+ import { useDefaultBillingAccount as ne } from "../../subscriptions/hooks/useSubscriptions.js";
10
10
  import "../../subscriptions/hooks/index.js";
11
- import { addPayoutAccount as ie, fetchPayoutAccounts as c } from "../../earnings/api.js";
11
+ import { addPayoutAccount as re, fetchPayoutAccounts as ie } from "../../earnings/api.js";
12
12
  import { useEffect as l, useState as u } from "react";
13
13
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
14
+ import { EmphasisPanel as m, IllustratedEmptyState as h, PagePurpose as ae } from "@burdenoff/fe-libs/ui";
14
15
  //#region src/billing/modules/credits/pages/CreditWithdrawalPage.tsx
15
- async function ae(e, t) {
16
- return (await i({
16
+ async function oe(e, t) {
17
+ return (await a({
17
18
  ...t,
18
- query: o,
19
+ query: s,
19
20
  variables: { billingAccountId: e }
20
21
  })).getCreditBalanceByType;
21
22
  }
22
- async function oe(e, t) {
23
- return (await i({
23
+ async function se(e, t) {
24
+ return (await a({
24
25
  ...t,
25
- query: s,
26
+ query: c,
26
27
  variables: { input: e }
27
28
  })).requestCreditWithdrawal;
28
29
  }
29
- async function se(e, t) {
30
- return (await i({
30
+ async function ce(e, t) {
31
+ return (await a({
31
32
  ...t,
32
- query: a,
33
+ query: o,
33
34
  variables: { billingAccountId: e }
34
35
  })).myPayoutRequests.items;
35
36
  }
36
- var m = ({ label: e, value: t, description: n, highlight: r }) => /* @__PURE__ */ p("div", {
37
- className: `border border-border-subtle rounded-lg p-5 ${r ? "bg-gradient-to-br from-[var(--color-accent-soft)] to-[var(--color-accent-soft)]" : "bg-bg-surface"}`,
38
- children: [
37
+ var g = ({ label: e, value: t, description: n, highlight: r }) => {
38
+ let i = /* @__PURE__ */ p(d, { children: [
39
39
  /* @__PURE__ */ f("p", {
40
40
  className: "text-sm text-text-secondary",
41
41
  children: e
@@ -55,9 +55,16 @@ var m = ({ label: e, value: t, description: n, highlight: r }) => /* @__PURE__ *
55
55
  className: "text-xs text-text-secondary mt-1",
56
56
  children: n
57
57
  })
58
- ]
59
- });
60
- function ce(e) {
58
+ ] });
59
+ return r ? /* @__PURE__ */ f(m, {
60
+ className: "p-5",
61
+ children: i
62
+ }) : /* @__PURE__ */ f("div", {
63
+ className: "border border-border-subtle rounded-lg p-5 bg-bg-surface",
64
+ children: i
65
+ });
66
+ };
67
+ function le(e) {
61
68
  switch (e.toUpperCase()) {
62
69
  case "PAID": return t.success.text;
63
70
  case "APPROVED":
@@ -69,7 +76,7 @@ function ce(e) {
69
76
  default: return "text-text-secondary";
70
77
  }
71
78
  }
72
- function le(e) {
79
+ function ue(e) {
73
80
  switch (e.toUpperCase()) {
74
81
  case "PAID": return `${t.success.bg} ${t.success.text}`;
75
82
  case "APPROVED":
@@ -81,8 +88,8 @@ function le(e) {
81
88
  default: return "bg-bg-sunken text-text-secondary";
82
89
  }
83
90
  }
84
- var h = () => {
85
- let i = te(), { billingAccount: a, isLoading: o } = re(), { apiGatewayUrl: s, authToken: h, orgId: ue } = e(), { emit: g } = n(), [_, de] = u(null), [fe, v] = u(!1), [y, b] = u(null), [pe, me] = u([]), [he, x] = u(!1), [S, ge] = u([]), [_e, C] = u(!1), [w, T] = u(""), [E, D] = u(""), [O, k] = u(""), [A, j] = u(!1), [M, N] = u(null), [ve, P] = u(!1), [F, I] = u(!1), [L, R] = u({
91
+ var de = () => {
92
+ let a = ee(), { billingAccount: o, isLoading: s } = ne(), { apiGatewayUrl: c, authToken: m, orgId: de } = e(), { emit: _ } = n(), [v, fe] = u(null), [pe, y] = u(!1), [b, x] = u(null), [me, he] = u([]), [ge, S] = u(!1), [C, _e] = u([]), [ve, w] = u(!1), [T, E] = u(""), [D, O] = u(""), [k, A] = u(""), [j, M] = u(!1), [N, P] = u(null), [ye, F] = u(!1), [I, L] = u(!1), [R, z] = u({
86
93
  label: "",
87
94
  type: "BANK_ACCOUNT",
88
95
  accountHolderName: "",
@@ -92,73 +99,73 @@ var h = () => {
92
99
  upiId: "",
93
100
  country: "",
94
101
  currency: "USD"
95
- }), [z, B] = u(!1), [V, H] = u(null), U = a?.id, W = () => ({
96
- apiGatewayUrl: s,
97
- authToken: h,
98
- orgId: ue
99
- }), G = async () => {
100
- if (U) {
101
- v(!0), b(null);
102
+ }), [B, V] = u(!1), [H, U] = u(null), W = o?.id, G = () => ({
103
+ apiGatewayUrl: c,
104
+ authToken: m,
105
+ orgId: de
106
+ }), K = async () => {
107
+ if (W) {
108
+ y(!0), x(null);
102
109
  try {
103
- de(await ae(U, W()));
110
+ fe(await oe(W, G()));
104
111
  } catch (e) {
105
- b(e instanceof Error ? e.message : "Failed to load balance");
112
+ x(e instanceof Error ? e.message : "Failed to load balance");
106
113
  } finally {
107
- v(!1);
114
+ y(!1);
108
115
  }
109
116
  }
110
- }, K = async () => {
111
- if (U) {
112
- x(!0);
117
+ }, q = async () => {
118
+ if (W) {
119
+ S(!0);
113
120
  try {
114
- let e = await c(U, W());
115
- me(e);
121
+ let e = await ie(W, G());
122
+ he(e);
116
123
  let t = e.find((e) => e.isDefault) ?? e[0];
117
- t && T(t.id);
124
+ t && E(t.id);
118
125
  } catch {} finally {
119
- x(!1);
126
+ S(!1);
120
127
  }
121
128
  }
122
- }, q = async () => {
123
- if (U) {
124
- C(!0);
129
+ }, J = async () => {
130
+ if (W) {
131
+ w(!0);
125
132
  try {
126
- ge(await se(U, W()));
133
+ _e(await ce(W, G()));
127
134
  } catch {} finally {
128
- C(!1);
135
+ w(!1);
129
136
  }
130
137
  }
131
138
  };
132
139
  l(() => {
133
- U && (G(), K(), q());
134
- }, [U]), l(() => {
135
- a?.currency && R((e) => ({
140
+ W && (K(), q(), J());
141
+ }, [W]), l(() => {
142
+ o?.currency && z((e) => ({
136
143
  ...e,
137
- currency: a.currency ?? "USD"
144
+ currency: o.currency ?? "USD"
138
145
  }));
139
- }, [a?.currency]);
140
- let ye = async () => {
141
- if (U) {
142
- H(null), B(!0);
146
+ }, [o?.currency]);
147
+ let be = async () => {
148
+ if (W) {
149
+ U(null), V(!0);
143
150
  try {
144
- let e = L.country.trim().toUpperCase() === "IN" || L.country.trim().toLowerCase() === "india";
145
- await ie({
146
- billingAccountId: U,
147
- label: L.label,
148
- type: L.type,
149
- accountHolderName: L.accountHolderName,
150
- country: L.country || void 0,
151
- currency: L.currency,
152
- ...L.type === "BANK_ACCOUNT" && {
153
- accountNumber: L.accountNumber,
154
- ...e ? { ifsc: L.ifscCode } : { routingNumber: L.routingNumber }
151
+ let e = R.country.trim().toUpperCase() === "IN" || R.country.trim().toLowerCase() === "india";
152
+ await re({
153
+ billingAccountId: W,
154
+ label: R.label,
155
+ type: R.type,
156
+ accountHolderName: R.accountHolderName,
157
+ country: R.country || void 0,
158
+ currency: R.currency,
159
+ ...R.type === "BANK_ACCOUNT" && {
160
+ accountNumber: R.accountNumber,
161
+ ...e ? { ifsc: R.ifscCode } : { routingNumber: R.routingNumber }
155
162
  },
156
- ...L.type === "UPI" && { upiId: L.upiId }
157
- }, W()), g("billing.payout_account.added", {
163
+ ...R.type === "UPI" && { upiId: R.upiId }
164
+ }, G()), _("billing.payout_account.added", {
158
165
  route: "/billing/credits/withdraw",
159
- entityId: U,
166
+ entityId: W,
160
167
  source: "credit-withdrawal"
161
- }), await K(), I(!1), R({
168
+ }), await q(), L(!1), z({
162
169
  label: "",
163
170
  type: "BANK_ACCOUNT",
164
171
  accountHolderName: "",
@@ -170,42 +177,42 @@ var h = () => {
170
177
  currency: "USD"
171
178
  });
172
179
  } catch (e) {
173
- H(e instanceof Error ? e.message : "Failed to add account");
180
+ U(e instanceof Error ? e.message : "Failed to add account");
174
181
  } finally {
175
- B(!1);
182
+ V(!1);
176
183
  }
177
184
  }
178
- }, be = async () => {
179
- if (!U || !w) return;
180
- let e = parseFloat(E);
185
+ }, xe = async () => {
186
+ if (!W || !T) return;
187
+ let e = parseFloat(D);
181
188
  if (!(!e || e <= 0)) {
182
- N(null), j(!0);
189
+ P(null), M(!0);
183
190
  try {
184
- g("billing.credits.withdrawal_requested", {
191
+ _("billing.credits.withdrawal_requested", {
185
192
  route: "/billing/credits/withdraw",
186
- entityId: (await oe({
187
- billingAccountId: U,
193
+ entityId: (await se({
194
+ billingAccountId: W,
188
195
  creditAmount: e,
189
- payoutAccountId: w,
190
- notes: O || void 0
191
- }, W())).id,
196
+ payoutAccountId: T,
197
+ notes: k || void 0
198
+ }, G())).id,
192
199
  source: "credit-withdrawal",
193
200
  amount: e
194
- }), P(!0), D(""), k(""), await G(), await q();
201
+ }), F(!0), O(""), A(""), await K(), await J();
195
202
  } catch (e) {
196
- N(e instanceof Error ? e.message : "Withdrawal request failed");
203
+ P(e instanceof Error ? e.message : "Withdrawal request failed");
197
204
  } finally {
198
- j(!1);
205
+ M(!1);
199
206
  }
200
207
  }
201
- }, J = a?.currency ?? "USD", Y = parseFloat(E) || 0, { data: xe, loading: X } = ne({
208
+ }, Y = o?.currency ?? "USD", X = parseFloat(D) || 0, { data: Se, loading: Ce } = te({
202
209
  variables: {
203
- creditAmount: Y,
204
- currency: J
210
+ creditAmount: X,
211
+ currency: Y
205
212
  },
206
- skip: Y <= 0 || !a
207
- }), Z = xe?.getCostOfCredits?.amount;
208
- if (!i.canWithdrawCredits) return /* @__PURE__ */ f("div", {
213
+ skip: X <= 0 || !o
214
+ }), Z = Se?.getCostOfCredits?.amount;
215
+ if (!a.canWithdrawCredits) return /* @__PURE__ */ f("div", {
209
216
  className: "flex items-center justify-center h-full min-h-[400px]",
210
217
  children: /* @__PURE__ */ p("div", {
211
218
  className: "text-center space-y-2",
@@ -236,7 +243,7 @@ var h = () => {
236
243
  ]
237
244
  })
238
245
  });
239
- if (!o && !a) return /* @__PURE__ */ f("div", {
246
+ if (!s && !o) return /* @__PURE__ */ f("div", {
240
247
  className: "flex items-center justify-center h-full min-h-[400px]",
241
248
  children: /* @__PURE__ */ p("div", {
242
249
  className: "text-center space-y-2",
@@ -249,7 +256,7 @@ var h = () => {
249
256
  })]
250
257
  })
251
258
  });
252
- if (o && !a) return /* @__PURE__ */ p("div", {
259
+ if (s && !o) return /* @__PURE__ */ p("div", {
253
260
  className: "space-y-6 px-6 lg:px-8 py-6",
254
261
  children: [/* @__PURE__ */ f("div", { className: "h-8 w-64 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ f("div", {
255
262
  className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
@@ -264,20 +271,27 @@ var h = () => {
264
271
  }, e))
265
272
  })]
266
273
  });
267
- let Q = _?.withdrawable ?? 0, Se = Y > 0 && Y <= Q, $ = pe.filter((e) => e.status !== "ARCHIVED");
274
+ let Q = v?.withdrawable ?? 0, we = X > 0 && X <= Q, $ = me.filter((e) => e.status !== "ARCHIVED");
268
275
  return /* @__PURE__ */ p("div", {
269
276
  className: "space-y-6 px-6 lg:px-8 py-6",
270
277
  children: [
271
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
272
- className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
273
- children: "Withdraw Credits"
274
- }), /* @__PURE__ */ f("p", {
275
- className: "text-sm text-text-secondary mt-1",
276
- children: "Convert your withdrawable credits (purchased & earned) to a payout"
277
- })] }),
278
+ /* @__PURE__ */ p("div", { children: [
279
+ /* @__PURE__ */ f("h1", {
280
+ className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
281
+ children: "Withdraw Credits"
282
+ }),
283
+ /* @__PURE__ */ f("p", {
284
+ className: "text-sm text-text-secondary mt-1",
285
+ children: "Convert your withdrawable credits (purchased & earned) to a payout"
286
+ }),
287
+ /* @__PURE__ */ f(ae, {
288
+ className: "mt-3",
289
+ 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."
290
+ })
291
+ ] }),
278
292
  /* @__PURE__ */ f("div", {
279
293
  className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
280
- children: fe ? [
294
+ children: pe ? [
281
295
  1,
282
296
  2,
283
297
  3,
@@ -285,26 +299,26 @@ var h = () => {
285
299
  ].map((e) => /* @__PURE__ */ p("div", {
286
300
  className: "border border-border-subtle rounded-lg p-5",
287
301
  children: [/* @__PURE__ */ f("div", { className: "h-4 w-20 bg-bg-sunken animate-pulse rounded mb-2" }), /* @__PURE__ */ f("div", { className: "h-8 w-28 bg-bg-sunken animate-pulse rounded" })]
288
- }, e)) : y ? /* @__PURE__ */ f("div", {
302
+ }, e)) : b ? /* @__PURE__ */ f("div", {
289
303
  className: "col-span-4 text-sm text-status-error-text",
290
- children: y
304
+ children: b
291
305
  }) : /* @__PURE__ */ p(d, { children: [
292
- /* @__PURE__ */ f(m, {
306
+ /* @__PURE__ */ f(g, {
293
307
  label: "Purchased",
294
- value: _?.purchased ?? 0,
308
+ value: v?.purchased ?? 0,
295
309
  description: "From credit purchases"
296
310
  }),
297
- /* @__PURE__ */ f(m, {
311
+ /* @__PURE__ */ f(g, {
298
312
  label: "Earned",
299
- value: _?.earned ?? 0,
313
+ value: v?.earned ?? 0,
300
314
  description: "From sales & referrals"
301
315
  }),
302
- /* @__PURE__ */ f(m, {
316
+ /* @__PURE__ */ f(g, {
303
317
  label: "Granted",
304
- value: _?.granted ?? 0,
318
+ value: v?.granted ?? 0,
305
319
  description: "Coupons & admin grants — non-withdrawable"
306
320
  }),
307
- /* @__PURE__ */ f(m, {
321
+ /* @__PURE__ */ f(g, {
308
322
  label: "Withdrawable",
309
323
  value: Q,
310
324
  description: "Purchased + earned",
@@ -312,7 +326,7 @@ var h = () => {
312
326
  })
313
327
  ] })
314
328
  }),
315
- ve && /* @__PURE__ */ p("div", {
329
+ ye && /* @__PURE__ */ p("div", {
316
330
  className: "flex items-center gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-border text-status-success-text",
317
331
  children: [
318
332
  /* @__PURE__ */ f("svg", {
@@ -336,7 +350,7 @@ var h = () => {
336
350
  })] }),
337
351
  /* @__PURE__ */ f("button", {
338
352
  type: "button",
339
- onClick: () => P(!1),
353
+ onClick: () => F(!1),
340
354
  className: "ml-auto text-current opacity-60 hover:opacity-100",
341
355
  children: /* @__PURE__ */ f("svg", {
342
356
  className: "size-4",
@@ -365,12 +379,12 @@ var h = () => {
365
379
  children: "Payout Account"
366
380
  }), /* @__PURE__ */ f("button", {
367
381
  type: "button",
368
- onClick: () => I((e) => !e),
382
+ onClick: () => L((e) => !e),
369
383
  className: "text-sm text-text-link hover:underline",
370
- children: F ? "Cancel" : "+ Add new"
384
+ children: I ? "Cancel" : "+ Add new"
371
385
  })]
372
386
  }),
373
- F && /* @__PURE__ */ p("div", {
387
+ I && /* @__PURE__ */ p("div", {
374
388
  className: "border border-border-subtle rounded-lg p-4 space-y-3 bg-bg-sunken",
375
389
  children: [
376
390
  /* @__PURE__ */ f("h3", {
@@ -382,8 +396,8 @@ var h = () => {
382
396
  children: "Label"
383
397
  }), /* @__PURE__ */ f("input", {
384
398
  type: "text",
385
- value: L.label,
386
- onChange: (e) => R((t) => ({
399
+ value: R.label,
400
+ onChange: (e) => z((t) => ({
387
401
  ...t,
388
402
  label: e.target.value
389
403
  })),
@@ -395,8 +409,8 @@ var h = () => {
395
409
  children: "Account Holder Name"
396
410
  }), /* @__PURE__ */ f("input", {
397
411
  type: "text",
398
- value: L.accountHolderName,
399
- onChange: (e) => R((t) => ({
412
+ value: R.accountHolderName,
413
+ onChange: (e) => z((t) => ({
400
414
  ...t,
401
415
  accountHolderName: e.target.value
402
416
  })),
@@ -409,8 +423,8 @@ var h = () => {
409
423
  className: "block text-xs text-text-secondary mb-1",
410
424
  children: "Type"
411
425
  }), /* @__PURE__ */ p("select", {
412
- value: L.type,
413
- onChange: (e) => R((t) => ({
426
+ value: R.type,
427
+ onChange: (e) => z((t) => ({
414
428
  ...t,
415
429
  type: e.target.value
416
430
  })),
@@ -427,8 +441,8 @@ var h = () => {
427
441
  children: "Country"
428
442
  }), /* @__PURE__ */ f("input", {
429
443
  type: "text",
430
- value: L.country,
431
- onChange: (e) => R((t) => ({
444
+ value: R.country,
445
+ onChange: (e) => z((t) => ({
432
446
  ...t,
433
447
  country: e.target.value
434
448
  })),
@@ -436,25 +450,25 @@ var h = () => {
436
450
  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)]"
437
451
  })] })]
438
452
  }),
439
- L.type === "BANK_ACCOUNT" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
453
+ R.type === "BANK_ACCOUNT" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
440
454
  className: "block text-xs text-text-secondary mb-1",
441
455
  children: "Account Number"
442
456
  }), /* @__PURE__ */ f("input", {
443
457
  type: "text",
444
- value: L.accountNumber,
445
- onChange: (e) => R((t) => ({
458
+ value: R.accountNumber,
459
+ onChange: (e) => z((t) => ({
446
460
  ...t,
447
461
  accountNumber: e.target.value
448
462
  })),
449
463
  placeholder: "Account number",
450
464
  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)]"
451
- })] }), L.country.trim().toUpperCase() === "IN" || L.country.trim().toLowerCase() === "india" ? /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
465
+ })] }), R.country.trim().toUpperCase() === "IN" || R.country.trim().toLowerCase() === "india" ? /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
452
466
  className: "block text-xs text-text-secondary mb-1",
453
467
  children: "IFSC Code"
454
468
  }), /* @__PURE__ */ f("input", {
455
469
  type: "text",
456
- value: L.ifscCode,
457
- onChange: (e) => R((t) => ({
470
+ value: R.ifscCode,
471
+ onChange: (e) => z((t) => ({
458
472
  ...t,
459
473
  ifscCode: e.target.value.toUpperCase()
460
474
  })),
@@ -465,75 +479,59 @@ var h = () => {
465
479
  children: "Routing Number"
466
480
  }), /* @__PURE__ */ f("input", {
467
481
  type: "text",
468
- value: L.routingNumber,
469
- onChange: (e) => R((t) => ({
482
+ value: R.routingNumber,
483
+ onChange: (e) => z((t) => ({
470
484
  ...t,
471
485
  routingNumber: e.target.value
472
486
  })),
473
487
  placeholder: "Routing / sort code",
474
488
  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)]"
475
489
  })] })] }),
476
- L.type === "UPI" && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
490
+ R.type === "UPI" && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
477
491
  className: "block text-xs text-text-secondary mb-1",
478
492
  children: "UPI ID"
479
493
  }), /* @__PURE__ */ f("input", {
480
494
  type: "text",
481
- value: L.upiId,
482
- onChange: (e) => R((t) => ({
495
+ value: R.upiId,
496
+ onChange: (e) => z((t) => ({
483
497
  ...t,
484
498
  upiId: e.target.value
485
499
  })),
486
500
  placeholder: "yourname@upi",
487
501
  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)]"
488
502
  })] }),
489
- V && /* @__PURE__ */ f("p", {
503
+ H && /* @__PURE__ */ f("p", {
490
504
  className: "text-xs text-status-error-text",
491
- children: V
505
+ children: H
492
506
  }),
493
507
  /* @__PURE__ */ f("button", {
494
508
  type: "button",
495
- onClick: () => void ye(),
496
- disabled: z || !L.label || !L.accountHolderName,
509
+ onClick: () => void be(),
510
+ disabled: B || !R.label || !R.accountHolderName,
497
511
  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",
498
- children: z ? "Saving…" : "Save Account"
512
+ children: B ? "Saving…" : "Save Account"
499
513
  })
500
514
  ]
501
515
  }),
502
- he ? /* @__PURE__ */ f("div", {
516
+ ge ? /* @__PURE__ */ f("div", {
503
517
  className: "space-y-2",
504
518
  children: [1, 2].map((e) => /* @__PURE__ */ f("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
505
- }) : $.length === 0 && !F ? /* @__PURE__ */ p("div", {
506
- className: "flex flex-col items-center justify-center py-8 border border-dashed border-border-subtle rounded-lg",
507
- children: [
508
- /* @__PURE__ */ f("svg", {
509
- className: "size-8 text-text-secondary mb-2",
510
- fill: "none",
511
- viewBox: "0 0 24 24",
512
- stroke: "currentColor",
513
- children: /* @__PURE__ */ f("path", {
514
- strokeLinecap: "round",
515
- strokeLinejoin: "round",
516
- strokeWidth: 1.5,
517
- d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
518
- })
519
- }),
520
- /* @__PURE__ */ f("p", {
521
- className: "text-sm text-text-secondary",
522
- children: "No payout accounts yet"
523
- }),
524
- /* @__PURE__ */ f("button", {
525
- type: "button",
526
- onClick: () => I(!0),
527
- className: "mt-2 text-sm text-text-link hover:underline",
528
- children: "Add a bank account or UPI"
529
- })
530
- ]
519
+ }) : $.length === 0 && !I ? /* @__PURE__ */ f(h, {
520
+ illustration: "empty-generic",
521
+ title: "No payout accounts yet",
522
+ description: "Add a bank account or UPI to receive your withdrawn credits.",
523
+ action: /* @__PURE__ */ f("button", {
524
+ type: "button",
525
+ onClick: () => L(!0),
526
+ 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",
527
+ children: "Add a bank account or UPI"
528
+ })
531
529
  }) : /* @__PURE__ */ f("div", {
532
530
  className: "space-y-2",
533
531
  children: $.map((e) => /* @__PURE__ */ f("button", {
534
532
  type: "button",
535
- onClick: () => T(e.id),
536
- 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"}`,
533
+ onClick: () => E(e.id),
534
+ 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"}`,
537
535
  children: /* @__PURE__ */ p("div", {
538
536
  className: "flex items-center justify-between",
539
537
  children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
@@ -558,7 +556,7 @@ var h = () => {
558
556
  className: `text-xs px-2 py-0.5 rounded font-medium ${e.status === "ACTIVE" ? `${t.success.bg} ${t.success.text}` : e.status === "PENDING_VERIFICATION" ? `${t.warning.bg} ${t.warning.text}` : `${t.error.bg} ${t.error.text}`}`,
559
557
  children: e.status.replaceAll("_", " ").toLowerCase()
560
558
  }),
561
- w === e.id && /* @__PURE__ */ f("svg", {
559
+ T === e.id && /* @__PURE__ */ f("svg", {
562
560
  className: "size-4 text-text-link shrink-0",
563
561
  fill: "none",
564
562
  viewBox: "0 0 24 24",
@@ -594,8 +592,8 @@ var h = () => {
594
592
  min: 1,
595
593
  max: Q,
596
594
  step: 1,
597
- value: E,
598
- onChange: (e) => D(e.target.value),
595
+ value: D,
596
+ onChange: (e) => O(e.target.value),
599
597
  placeholder: "Enter credit amount",
600
598
  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)]"
601
599
  }),
@@ -610,16 +608,16 @@ var h = () => {
610
608
  })
611
609
  ]
612
610
  }),
613
- Y > 0 && Y <= Q && /* @__PURE__ */ f("p", {
611
+ X > 0 && X <= Q && /* @__PURE__ */ f("p", {
614
612
  className: "text-xs text-text-secondary mt-1",
615
- children: X ? "Calculating…" : Z == null ? null : /* @__PURE__ */ p(d, { children: [
613
+ children: Ce ? "Calculating…" : Z == null ? null : /* @__PURE__ */ p(d, { children: [
616
614
  "Estimated payout:",
617
615
  " ",
618
616
  /* @__PURE__ */ f("span", {
619
617
  className: "font-semibold text-text-primary",
620
618
  children: Z.toLocaleString(void 0, {
621
619
  style: "currency",
622
- currency: J,
620
+ currency: Y,
623
621
  minimumFractionDigits: 2,
624
622
  maximumFractionDigits: 2
625
623
  })
@@ -628,7 +626,7 @@ var h = () => {
628
626
  "at the current credit rate"
629
627
  ] })
630
628
  }),
631
- Y > 0 && Y > Q && /* @__PURE__ */ f("p", {
629
+ X > 0 && X > Q && /* @__PURE__ */ f("p", {
632
630
  className: "text-xs text-status-error-text mt-1",
633
631
  children: "Amount exceeds your withdrawable balance"
634
632
  })
@@ -640,17 +638,17 @@ var h = () => {
640
638
  children: "(optional)"
641
639
  })]
642
640
  }), /* @__PURE__ */ f("textarea", {
643
- value: O,
644
- onChange: (e) => k(e.target.value),
641
+ value: k,
642
+ onChange: (e) => A(e.target.value),
645
643
  placeholder: "Any notes for this withdrawal request",
646
644
  rows: 2,
647
645
  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"
648
646
  })] }),
649
- M && /* @__PURE__ */ f("div", {
647
+ N && /* @__PURE__ */ f("div", {
650
648
  className: "p-3 rounded-button bg-status-error-bg-subtle border border-status-error-border",
651
649
  children: /* @__PURE__ */ f("p", {
652
650
  className: "text-sm text-status-error-text",
653
- children: M
651
+ children: N
654
652
  })
655
653
  }),
656
654
  /* @__PURE__ */ p("div", {
@@ -659,15 +657,15 @@ var h = () => {
659
657
  className: "text-xs text-text-secondary mb-3",
660
658
  children: [
661
659
  "Credits will be converted to ",
662
- J,
660
+ Y,
663
661
  " at the current credit rate. Withdrawals are reviewed before processing and may take 3–5 business days."
664
662
  ]
665
663
  }), /* @__PURE__ */ f("button", {
666
664
  type: "button",
667
- onClick: () => void be(),
668
- disabled: A || !Se || !w || $.length === 0,
665
+ onClick: () => void xe(),
666
+ disabled: j || !we || !T || $.length === 0,
669
667
  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",
670
- children: A ? "Submitting…" : "Request Withdrawal"
668
+ children: j ? "Submitting…" : "Request Withdrawal"
671
669
  })]
672
670
  })
673
671
  ]
@@ -683,7 +681,7 @@ var h = () => {
683
681
  children: "Withdrawal History"
684
682
  }), /* @__PURE__ */ f("button", {
685
683
  type: "button",
686
- onClick: () => void q(),
684
+ onClick: () => void J(),
687
685
  className: "text-sm text-text-secondary hover:text-text-primary transition-colors",
688
686
  "aria-label": "Refresh withdrawal history",
689
687
  children: /* @__PURE__ */ f("svg", {
@@ -699,30 +697,17 @@ var h = () => {
699
697
  })
700
698
  })
701
699
  })]
702
- }), _e ? /* @__PURE__ */ f("div", {
700
+ }), ve ? /* @__PURE__ */ f("div", {
703
701
  className: "space-y-2",
704
702
  children: [
705
703
  1,
706
704
  2,
707
705
  3
708
706
  ].map((e) => /* @__PURE__ */ f("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
709
- }) : S.length === 0 ? /* @__PURE__ */ p("div", {
710
- className: "flex flex-col items-center justify-center py-10 border border-dashed border-border-subtle rounded-lg",
711
- children: [/* @__PURE__ */ f("svg", {
712
- className: "size-8 text-text-secondary mb-2",
713
- fill: "none",
714
- viewBox: "0 0 24 24",
715
- stroke: "currentColor",
716
- children: /* @__PURE__ */ f("path", {
717
- strokeLinecap: "round",
718
- strokeLinejoin: "round",
719
- strokeWidth: 1.5,
720
- d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
721
- })
722
- }), /* @__PURE__ */ f("p", {
723
- className: "text-sm text-text-secondary",
724
- children: "No withdrawal requests yet"
725
- })]
707
+ }) : C.length === 0 ? /* @__PURE__ */ f(h, {
708
+ illustration: "empty-data",
709
+ title: "No withdrawal requests yet",
710
+ description: "Once you request a withdrawal, its status will appear here."
726
711
  }) : /* @__PURE__ */ f("div", {
727
712
  className: "border border-border-subtle rounded-lg overflow-hidden",
728
713
  children: /* @__PURE__ */ p("table", {
@@ -753,7 +738,7 @@ var h = () => {
753
738
  ] })
754
739
  }), /* @__PURE__ */ f("tbody", {
755
740
  className: "divide-y divide-border-subtle",
756
- children: S.map((e) => /* @__PURE__ */ p("tr", {
741
+ children: C.map((e) => /* @__PURE__ */ p("tr", {
757
742
  className: "hover:bg-bg-sunken transition-colors",
758
743
  children: [
759
744
  /* @__PURE__ */ p("td", {
@@ -767,7 +752,7 @@ var h = () => {
767
752
  /* @__PURE__ */ p("td", {
768
753
  className: "px-4 py-3",
769
754
  children: [/* @__PURE__ */ f("span", {
770
- className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${le(e.status)}`,
755
+ className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${ue(e.status)}`,
771
756
  children: e.status.charAt(0) + e.status.slice(1).toLowerCase()
772
757
  }), e.failureReason && /* @__PURE__ */ f("p", {
773
758
  className: "text-xs text-status-error-text mt-0.5 max-w-[180px] truncate",
@@ -783,13 +768,13 @@ var h = () => {
783
768
  className: "px-4 py-3 text-text-secondary hidden md:table-cell",
784
769
  children: /* @__PURE__ */ f("span", {
785
770
  title: r(e.createdAt, "long"),
786
- children: ee(e.createdAt)
771
+ children: i(e.createdAt)
787
772
  })
788
773
  }),
789
774
  /* @__PURE__ */ f("td", {
790
775
  className: "px-4 py-3 text-text-secondary hidden md:table-cell",
791
776
  children: e.paidAt ? /* @__PURE__ */ f("span", {
792
- className: ce("PAID"),
777
+ className: le("PAID"),
793
778
  children: r(e.paidAt, "short")
794
779
  }) : "—"
795
780
  })
@@ -803,6 +788,6 @@ var h = () => {
803
788
  });
804
789
  };
805
790
  //#endregion
806
- export { h as CreditWithdrawalPage };
791
+ export { de as CreditWithdrawalPage };
807
792
 
808
793
  //# sourceMappingURL=CreditWithdrawalPage.js.map