@burdenoff/microfe-billing 2026.625.4 → 2026.626.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 (96) hide show
  1. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
  2. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
  4. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  5. package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
  6. package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
  7. package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
  8. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  9. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
  10. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  11. package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
  12. package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
  13. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
  14. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  15. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
  16. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  17. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
  18. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  19. package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
  20. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  21. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
  22. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  23. package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
  24. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  25. package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
  26. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  27. package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
  28. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  29. package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
  30. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  31. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
  32. package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
  33. package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
  34. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  35. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
  36. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  37. package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
  38. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  39. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
  40. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  41. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
  42. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  43. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
  44. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  45. package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
  46. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  47. package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
  48. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  49. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
  50. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  51. package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
  52. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  53. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
  54. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  55. package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
  56. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  57. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
  58. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
  59. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
  60. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
  61. package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
  62. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  63. package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
  64. package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
  65. package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
  66. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  67. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
  68. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  69. package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
  70. package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
  71. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
  72. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
  73. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
  74. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
  75. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
  76. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
  77. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  78. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
  79. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
  80. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
  81. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  82. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
  83. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
  84. package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
  85. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  86. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
  87. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  88. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
  89. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  90. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
  91. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  92. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
  93. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  94. package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
  95. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  96. package/package.json +2 -2
@@ -2,19 +2,20 @@ import { AccessDenied as e } from "../../../shared/components/AccessDenied.js";
2
2
  import "../../../shared/components/index.js";
3
3
  import { formatCurrency as t, formatDate as n } from "../../../shared/utils/format.js";
4
4
  import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions.js";
5
- import { useCreateDiscountMutation as i, useDeleteDiscountMutation as a, useGetDiscountsQuery as o, useUpdateDiscountMutation as s } from "../../../../generated/global-operations.js";
6
- import { nativeImpact as ee, nativeNotify as c } from "../../../../utils/nativeBridge.js";
5
+ import { useCreateDiscountMutation as i, useDeleteDiscountMutation as a, useGetDiscountsQuery as o, useUpdateDiscountMutation as ee } from "../../../../generated/global-operations.js";
6
+ import { nativeImpact as s, nativeNotify as c } from "../../../../utils/nativeBridge.js";
7
7
  import { useMemo as l, useState as u } from "react";
8
8
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
+ import { IllustratedEmptyState as p, PagePurpose as m } from "@burdenoff/fe-libs/ui";
10
11
  //#region src/billing/modules/discounts/pages/DiscountsListPage.tsx
11
- function m(e) {
12
+ function h(e) {
12
13
  return e.validUntil ? new Date(e.validUntil) < /* @__PURE__ */ new Date() : !1;
13
14
  }
14
- function h(e) {
15
+ function g(e) {
15
16
  return e.type === "PERCENTAGE" ? `${e.value}%` : t(e.value, e.currency ?? "USD");
16
17
  }
17
- var g = {
18
+ var _ = {
18
19
  code: "",
19
20
  type: "PERCENTAGE",
20
21
  value: "",
@@ -22,97 +23,97 @@ var g = {
22
23
  maxUses: "",
23
24
  validFrom: "",
24
25
  validUntil: ""
25
- }, _ = () => {
26
- let { t } = p(), n = (e, n) => {
26
+ }, v = () => {
27
+ let { t } = te(), n = (e, n) => {
27
28
  let r = t(e);
28
29
  return r === e ? n : r;
29
- }, _ = r(), { data: te, loading: b, error: x, refetch: S } = o(), [C, { loading: w }] = i(), [T, { loading: E }] = s(), [D, { loading: O }] = a(), [k, A] = u(""), [j, M] = u({ kind: "closed" }), [N, P] = u(g), [F, I] = u({
30
+ }, v = r(), { data: x, loading: S, error: C, refetch: w } = o(), [T, { loading: E }] = i(), [D, { loading: O }] = ee(), [k, { loading: A }] = a(), [j, ne] = u(""), [M, N] = u({ kind: "closed" }), [P, F] = u(_), [I, L] = u({
30
31
  maxUses: "",
31
32
  validUntil: ""
32
- }), [L, R] = u(null), [z, B] = u(/* @__PURE__ */ new Set()), [V, H] = u(!1), U = te?.getDiscounts ?? [], W = U.filter((e) => k ? e.code.toLowerCase().includes(k.toLowerCase()) : !0), G = l(() => W.filter((e) => z.has(e.id)), [W, z]), K = W.length > 0 && W.every((e) => z.has(e.id)), q = W.some((e) => z.has(e.id)) && !K;
33
- if (!_.canManageDiscounts) return /* @__PURE__ */ d(e, { message: "You don't have permission to manage discount codes." });
34
- let J = U.length, Y = U.filter((e) => !m(e)).length, X = U.filter((e) => m(e)).length, Z = () => {
35
- P(g), R(null), M({ kind: "create" });
36
- }, ne = (e) => {
37
- I({
33
+ }), [R, z] = u(null), [B, V] = u(/* @__PURE__ */ new Set()), [H, U] = u(!1), W = x?.getDiscounts ?? [], G = W.filter((e) => j ? e.code.toLowerCase().includes(j.toLowerCase()) : !0), K = l(() => G.filter((e) => B.has(e.id)), [G, B]), q = G.length > 0 && G.every((e) => B.has(e.id)), J = G.some((e) => B.has(e.id)) && !q;
34
+ if (!v.canManageDiscounts) return /* @__PURE__ */ d(e, { message: "You don't have permission to manage discount codes." });
35
+ let Y = W.length, X = W.filter((e) => !h(e)).length, re = W.filter((e) => h(e)).length, Z = () => {
36
+ F(_), z(null), N({ kind: "create" });
37
+ }, ie = (e) => {
38
+ L({
38
39
  maxUses: e.maxUses == null ? "" : String(e.maxUses),
39
40
  validUntil: e.validUntil ? new Date(e.validUntil).toISOString().slice(0, 16) : ""
40
- }), R(null), M({
41
+ }), z(null), N({
41
42
  kind: "edit",
42
43
  discount: e
43
44
  });
44
- }, re = (e) => {
45
- R(null), M({
45
+ }, ae = (e) => {
46
+ z(null), N({
46
47
  kind: "delete",
47
48
  discount: e
48
49
  });
49
50
  }, Q = () => {
50
- M({ kind: "closed" }), R(null);
51
- }, ie = async (e) => {
52
- if (e.preventDefault(), R(null), !N.code.trim()) {
53
- R("Discount code is required.");
51
+ N({ kind: "closed" }), z(null);
52
+ }, oe = async (e) => {
53
+ if (e.preventDefault(), z(null), !P.code.trim()) {
54
+ z("Discount code is required.");
54
55
  return;
55
56
  }
56
- let t = Number(N.value);
57
+ let t = Number(P.value);
57
58
  if (Number.isNaN(t) || t <= 0) {
58
- R("Value must be a positive number.");
59
+ z("Value must be a positive number.");
59
60
  return;
60
61
  }
61
- if (N.type === "PERCENTAGE" && t > 100) {
62
- R("Percentage value cannot exceed 100.");
62
+ if (P.type === "PERCENTAGE" && t > 100) {
63
+ z("Percentage value cannot exceed 100.");
63
64
  return;
64
65
  }
65
66
  try {
66
- await C({ variables: {
67
- code: N.code.trim().toUpperCase(),
68
- type: N.type,
67
+ await T({ variables: {
68
+ code: P.code.trim().toUpperCase(),
69
+ type: P.type,
69
70
  value: t,
70
- currency: N.type === "FIXED" ? N.currency : null,
71
- maxUses: N.maxUses ? Number(N.maxUses) : null,
72
- validFrom: N.validFrom ? new Date(N.validFrom).toISOString() : null,
73
- validUntil: N.validUntil ? new Date(N.validUntil).toISOString() : null
74
- } }), await S(), Q();
71
+ currency: P.type === "FIXED" ? P.currency : null,
72
+ maxUses: P.maxUses ? Number(P.maxUses) : null,
73
+ validFrom: P.validFrom ? new Date(P.validFrom).toISOString() : null,
74
+ validUntil: P.validUntil ? new Date(P.validUntil).toISOString() : null
75
+ } }), await w(), Q();
75
76
  } catch (e) {
76
- R(e instanceof Error ? e.message : "Failed to create discount.");
77
+ z(e instanceof Error ? e.message : "Failed to create discount.");
77
78
  }
78
- }, ae = async (e) => {
79
- if (e.preventDefault(), j.kind === "edit") {
80
- R(null);
79
+ }, se = async (e) => {
80
+ if (e.preventDefault(), M.kind === "edit") {
81
+ z(null);
81
82
  try {
82
- await T({ variables: {
83
- id: j.discount.id,
84
- maxUses: F.maxUses ? Number(F.maxUses) : null,
85
- validUntil: F.validUntil ? new Date(F.validUntil).toISOString() : null
86
- } }), await S(), Q();
83
+ await D({ variables: {
84
+ id: M.discount.id,
85
+ maxUses: I.maxUses ? Number(I.maxUses) : null,
86
+ validUntil: I.validUntil ? new Date(I.validUntil).toISOString() : null
87
+ } }), await w(), Q();
87
88
  } catch (e) {
88
- R(e instanceof Error ? e.message : "Failed to update discount.");
89
+ z(e instanceof Error ? e.message : "Failed to update discount.");
89
90
  }
90
91
  }
91
- }, oe = async () => {
92
- if (j.kind === "delete") {
93
- R(null), ee("medium");
92
+ }, ce = async () => {
93
+ if (M.kind === "delete") {
94
+ z(null), s("medium");
94
95
  try {
95
- await D({ variables: { id: j.discount.id } }), c("success"), await S(), Q();
96
+ await k({ variables: { id: M.discount.id } }), c("success"), await w(), Q();
96
97
  } catch (e) {
97
- c("error"), R(e instanceof Error ? e.message : "Failed to delete discount.");
98
+ c("error"), z(e instanceof Error ? e.message : "Failed to delete discount.");
98
99
  }
99
100
  }
100
- }, se = async () => {
101
- G.length !== 0 && (R(null), H(!1), await Promise.allSettled(G.map((e) => D({ variables: { id: e.id } }))), await S(), B(/* @__PURE__ */ new Set()));
102
- }, ce = (e, t) => {
103
- B((n) => {
101
+ }, le = async () => {
102
+ K.length !== 0 && (z(null), U(!1), await Promise.allSettled(K.map((e) => k({ variables: { id: e.id } }))), await w(), V(/* @__PURE__ */ new Set()));
103
+ }, ue = (e, t) => {
104
+ V((n) => {
104
105
  let r = new Set(n);
105
106
  return t ? r.add(e) : r.delete(e), r;
106
- }), H(!1);
107
+ }), U(!1);
107
108
  }, $ = (e) => {
108
- B((t) => {
109
+ V((t) => {
109
110
  let n = new Set(t);
110
- return W.forEach((t) => {
111
+ return G.forEach((t) => {
111
112
  e ? n.add(t.id) : n.delete(t.id);
112
113
  }), n;
113
- }), H(!1);
114
+ }), U(!1);
114
115
  };
115
- return b && U.length === 0 ? /* @__PURE__ */ f("div", {
116
+ return S && W.length === 0 ? /* @__PURE__ */ f("div", {
116
117
  className: "space-y-6 p-6",
117
118
  children: [
118
119
  /* @__PURE__ */ d("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }),
@@ -147,7 +148,7 @@ var g = {
147
148
  }, e))
148
149
  })
149
150
  ]
150
- }) : x ? /* @__PURE__ */ d("div", {
151
+ }) : C ? /* @__PURE__ */ d("div", {
151
152
  className: "flex items-center justify-center h-full min-h-[400px]",
152
153
  children: /* @__PURE__ */ f("div", {
153
154
  className: "text-center space-y-4",
@@ -173,11 +174,11 @@ var g = {
173
174
  }),
174
175
  /* @__PURE__ */ d("p", {
175
176
  className: "text-sm text-text-muted",
176
- children: x.message
177
+ children: C.message
177
178
  }),
178
179
  /* @__PURE__ */ d("button", {
179
180
  type: "button",
180
- onClick: () => S(),
181
+ onClick: () => w(),
181
182
  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",
182
183
  children: "Try Again"
183
184
  })
@@ -188,13 +189,20 @@ var g = {
188
189
  children: [
189
190
  /* @__PURE__ */ f("div", {
190
191
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
191
- children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h1", {
192
- className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
193
- children: "Discount Codes"
194
- }), /* @__PURE__ */ d("p", {
195
- className: "text-sm text-text-secondary mt-1",
196
- children: "Create, view, and manage discount codes for billing"
197
- })] }), /* @__PURE__ */ f("button", {
192
+ children: [/* @__PURE__ */ f("div", { children: [
193
+ /* @__PURE__ */ d("h1", {
194
+ className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
195
+ children: "Discount Codes"
196
+ }),
197
+ /* @__PURE__ */ d("p", {
198
+ className: "text-sm text-text-secondary mt-1",
199
+ children: "Create, view, and manage discount codes for billing"
200
+ }),
201
+ /* @__PURE__ */ d(m, {
202
+ className: "mt-3",
203
+ children: "Discount codes reduce the price of a purchase at checkout. Create codes here, set how much they take off and any limits, and manage which ones are active — separate from time-bounded promotions and customer-facing coupons."
204
+ })
205
+ ] }), /* @__PURE__ */ f("button", {
198
206
  type: "button",
199
207
  onClick: Z,
200
208
  className: "inline-flex items-center gap-2 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 duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
@@ -222,7 +230,7 @@ var g = {
222
230
  children: "Total Discounts"
223
231
  }), /* @__PURE__ */ d("p", {
224
232
  className: "text-2xl font-semibold text-text-primary tabular-nums mt-1",
225
- children: J
233
+ children: Y
226
234
  })]
227
235
  }),
228
236
  /* @__PURE__ */ f("div", {
@@ -232,7 +240,7 @@ var g = {
232
240
  children: "Active"
233
241
  }), /* @__PURE__ */ d("p", {
234
242
  className: "text-2xl font-semibold text-status-success-text tabular-nums mt-1",
235
- children: Y
243
+ children: X
236
244
  })]
237
245
  }),
238
246
  /* @__PURE__ */ f("div", {
@@ -242,7 +250,7 @@ var g = {
242
250
  children: "Expired"
243
251
  }), /* @__PURE__ */ d("p", {
244
252
  className: "text-2xl font-semibold text-status-warning-text tabular-nums mt-1",
245
- children: X
253
+ children: re
246
254
  })]
247
255
  })
248
256
  ]
@@ -265,21 +273,21 @@ var g = {
265
273
  }), /* @__PURE__ */ d("input", {
266
274
  type: "text",
267
275
  placeholder: "Search by discount code...",
268
- value: k,
269
- onChange: (e) => A(e.target.value),
276
+ value: j,
277
+ onChange: (e) => ne(e.target.value),
270
278
  className: "w-full pl-[3.25rem] pr-4 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent"
271
279
  })]
272
280
  })
273
281
  }),
274
- W.length > 0 && /* @__PURE__ */ f("div", {
282
+ G.length > 0 && /* @__PURE__ */ f("div", {
275
283
  className: "flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
276
284
  children: [/* @__PURE__ */ f("label", {
277
285
  className: "flex items-center gap-2 text-sm text-text-primary",
278
286
  children: [/* @__PURE__ */ d("input", {
279
287
  type: "checkbox",
280
- checked: K,
288
+ checked: q,
281
289
  ref: (e) => {
282
- e && (e.indeterminate = q && !K);
290
+ e && (e.indeterminate = J && !q);
283
291
  },
284
292
  onChange: (e) => $(e.target.checked),
285
293
  "aria-label": "Select all discounts",
@@ -290,27 +298,27 @@ var g = {
290
298
  children: [
291
299
  /* @__PURE__ */ f("span", {
292
300
  className: "text-sm text-text-muted",
293
- children: [z.size, " selected"]
301
+ children: [B.size, " selected"]
294
302
  }),
295
- z.size > 0 && /* @__PURE__ */ d("button", {
303
+ B.size > 0 && /* @__PURE__ */ d("button", {
296
304
  type: "button",
297
305
  onClick: () => {
298
- B(/* @__PURE__ */ new Set()), H(!1);
306
+ V(/* @__PURE__ */ new Set()), U(!1);
299
307
  },
300
308
  className: "text-sm text-text-muted hover:text-text-primary",
301
309
  children: "Clear selection"
302
310
  }),
303
311
  /* @__PURE__ */ f("button", {
304
312
  type: "button",
305
- onClick: () => H(!0),
306
- disabled: G.length === 0 || O,
313
+ onClick: () => U(!0),
314
+ disabled: K.length === 0 || A,
307
315
  className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-status-error-border text-status-error-text rounded-md hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50",
308
- children: ["Delete Selected", G.length > 0 ? ` (${G.length})` : ""]
316
+ children: ["Delete Selected", K.length > 0 ? ` (${K.length})` : ""]
309
317
  })
310
318
  ]
311
319
  })]
312
320
  }),
313
- V && G.length > 0 && /* @__PURE__ */ d("div", {
321
+ H && K.length > 0 && /* @__PURE__ */ d("div", {
314
322
  className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4",
315
323
  children: /* @__PURE__ */ f("div", {
316
324
  className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
@@ -318,9 +326,9 @@ var g = {
318
326
  className: "text-sm font-medium text-text-primary",
319
327
  children: [
320
328
  "Delete ",
321
- G.length,
329
+ K.length,
322
330
  " selected discount",
323
- G.length === 1 ? "" : "s",
331
+ K.length === 1 ? "" : "s",
324
332
  "?"
325
333
  ]
326
334
  }), /* @__PURE__ */ d("p", {
@@ -330,52 +338,29 @@ var g = {
330
338
  className: "flex items-center gap-2",
331
339
  children: [/* @__PURE__ */ d("button", {
332
340
  type: "button",
333
- onClick: () => H(!1),
341
+ onClick: () => U(!1),
334
342
  className: "px-3 py-2 text-sm font-medium text-text-muted hover:text-text-primary",
335
343
  children: "Cancel"
336
344
  }), /* @__PURE__ */ d("button", {
337
345
  type: "button",
338
- onClick: se,
339
- disabled: O,
346
+ onClick: le,
347
+ disabled: A,
340
348
  className: "inline-flex items-center gap-2 rounded-button bg-action-danger-bg px-3 py-2 text-sm font-medium text-action-danger-text hover:bg-action-danger-bgHover disabled:opacity-50",
341
349
  children: "Confirm Delete"
342
350
  })]
343
351
  })]
344
352
  })
345
353
  }),
346
- W.length === 0 ? /* @__PURE__ */ f("div", {
347
- className: "flex flex-col items-center justify-center py-16 border border-dashed border-border-seam rounded-card bg-bg-surface",
348
- children: [
349
- /* @__PURE__ */ d("div", {
350
- className: "size-12 rounded-full bg-[var(--color-accent-soft)] flex items-center justify-center mb-4",
351
- children: /* @__PURE__ */ d("svg", {
352
- className: "size-6 text-text-muted",
353
- fill: "none",
354
- viewBox: "0 0 24 24",
355
- stroke: "currentColor",
356
- children: /* @__PURE__ */ d("path", {
357
- strokeLinecap: "round",
358
- strokeLinejoin: "round",
359
- strokeWidth: 2,
360
- d: "M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z"
361
- })
362
- })
363
- }),
364
- /* @__PURE__ */ d("h3", {
365
- className: "text-lg font-medium text-text-primary",
366
- children: "No discount codes found"
367
- }),
368
- /* @__PURE__ */ d("p", {
369
- className: "text-sm text-text-muted mt-1",
370
- children: k ? "No discount codes match your search." : "Create your first discount code to get started."
371
- }),
372
- !k && /* @__PURE__ */ d("button", {
373
- type: "button",
374
- onClick: Z,
375
- className: "mt-4 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",
376
- children: "Create your first discount"
377
- })
378
- ]
354
+ G.length === 0 ? /* @__PURE__ */ d(p, {
355
+ illustration: j ? "empty-search" : "empty-data",
356
+ title: "No discount codes found",
357
+ description: j ? "No discount codes match your search." : "Create your first discount code to get started.",
358
+ action: j ? void 0 : /* @__PURE__ */ d("button", {
359
+ type: "button",
360
+ onClick: Z,
361
+ 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",
362
+ children: "Create your first discount"
363
+ })
379
364
  }) : /* @__PURE__ */ d("div", {
380
365
  className: "border border-border-seam rounded-card overflow-hidden shadow-[var(--shadow-elevation-1)]",
381
366
  children: /* @__PURE__ */ d("div", {
@@ -389,9 +374,9 @@ var g = {
389
374
  className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted w-12",
390
375
  children: /* @__PURE__ */ d("input", {
391
376
  type: "checkbox",
392
- checked: K,
377
+ checked: q,
393
378
  ref: (e) => {
394
- e && (e.indeterminate = q && !K);
379
+ e && (e.indeterminate = J && !q);
395
380
  },
396
381
  onChange: (e) => $(e.target.checked),
397
382
  "aria-label": "Select all discounts",
@@ -433,21 +418,21 @@ var g = {
433
418
  ] })
434
419
  }), /* @__PURE__ */ d("tbody", {
435
420
  className: "divide-y divide-border-subtle",
436
- children: W.map((e) => /* @__PURE__ */ d(v, {
421
+ children: G.map((e) => /* @__PURE__ */ d(y, {
437
422
  discount: e,
438
- selected: z.has(e.id),
439
- onToggleSelect: ce,
440
- onEdit: ne,
441
- onDelete: re
423
+ selected: B.has(e.id),
424
+ onToggleSelect: ue,
425
+ onEdit: ie,
426
+ onDelete: ae
442
427
  }, e.id))
443
428
  })]
444
429
  })
445
430
  })
446
431
  }),
447
- j.kind === "create" && /* @__PURE__ */ d(y, {
432
+ M.kind === "create" && /* @__PURE__ */ d(b, {
448
433
  onClose: Q,
449
434
  children: /* @__PURE__ */ f("form", {
450
- onSubmit: ie,
435
+ onSubmit: oe,
451
436
  className: "space-y-4",
452
437
  children: [
453
438
  /* @__PURE__ */ f("div", {
@@ -473,9 +458,9 @@ var g = {
473
458
  })
474
459
  })]
475
460
  }),
476
- L && /* @__PURE__ */ d("div", {
461
+ R && /* @__PURE__ */ d("div", {
477
462
  className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
478
- children: L
463
+ children: R
479
464
  }),
480
465
  /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
481
466
  htmlFor: "create-code",
@@ -492,8 +477,8 @@ var g = {
492
477
  id: "create-code",
493
478
  type: "text",
494
479
  required: !0,
495
- value: N.code,
496
- onChange: (e) => P((t) => ({
480
+ value: P.code,
481
+ onChange: (e) => F((t) => ({
497
482
  ...t,
498
483
  code: e.target.value
499
484
  })),
@@ -515,8 +500,8 @@ var g = {
515
500
  ]
516
501
  }), /* @__PURE__ */ f("select", {
517
502
  id: "create-type",
518
- value: N.type,
519
- onChange: (e) => P((t) => ({
503
+ value: P.type,
504
+ onChange: (e) => F((t) => ({
520
505
  ...t,
521
506
  type: e.target.value
522
507
  })),
@@ -546,29 +531,29 @@ var g = {
546
531
  type: "number",
547
532
  required: !0,
548
533
  min: "0.01",
549
- max: N.type === "PERCENTAGE" ? "100" : void 0,
534
+ max: P.type === "PERCENTAGE" ? "100" : void 0,
550
535
  step: "0.01",
551
- value: N.value,
552
- onChange: (e) => P((t) => ({
536
+ value: P.value,
537
+ onChange: (e) => F((t) => ({
553
538
  ...t,
554
539
  value: e.target.value
555
540
  })),
556
- placeholder: N.type === "PERCENTAGE" ? "10" : "25.00",
541
+ placeholder: P.type === "PERCENTAGE" ? "10" : "25.00",
557
542
  className: "w-full px-3 py-2 pr-8 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent"
558
543
  }), /* @__PURE__ */ d("span", {
559
544
  className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-text-muted",
560
- children: N.type === "PERCENTAGE" ? "%" : N.currency
545
+ children: P.type === "PERCENTAGE" ? "%" : P.currency
561
546
  })]
562
547
  })] })]
563
548
  }),
564
- N.type === "FIXED" && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
549
+ P.type === "FIXED" && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
565
550
  htmlFor: "create-currency",
566
551
  className: "block text-sm font-medium text-text-primary mb-1",
567
552
  children: n("billing.discounts.currency", "Currency")
568
553
  }), /* @__PURE__ */ f("select", {
569
554
  id: "create-currency",
570
- value: N.currency,
571
- onChange: (e) => P((t) => ({
555
+ value: P.currency,
556
+ onChange: (e) => F((t) => ({
572
557
  ...t,
573
558
  currency: e.target.value
574
559
  })),
@@ -611,8 +596,8 @@ var g = {
611
596
  type: "number",
612
597
  min: "1",
613
598
  step: "1",
614
- value: N.maxUses,
615
- onChange: (e) => P((t) => ({
599
+ value: P.maxUses,
600
+ onChange: (e) => F((t) => ({
616
601
  ...t,
617
602
  maxUses: e.target.value
618
603
  })),
@@ -633,8 +618,8 @@ var g = {
633
618
  }), /* @__PURE__ */ d("input", {
634
619
  id: "create-valid-from",
635
620
  type: "datetime-local",
636
- value: N.validFrom,
637
- onChange: (e) => P((t) => ({
621
+ value: P.validFrom,
622
+ onChange: (e) => F((t) => ({
638
623
  ...t,
639
624
  validFrom: e.target.value
640
625
  })),
@@ -646,8 +631,8 @@ var g = {
646
631
  }), /* @__PURE__ */ d("input", {
647
632
  id: "create-valid-until",
648
633
  type: "datetime-local",
649
- value: N.validUntil,
650
- onChange: (e) => P((t) => ({
634
+ value: P.validUntil,
635
+ onChange: (e) => F((t) => ({
651
636
  ...t,
652
637
  validUntil: e.target.value
653
638
  })),
@@ -663,18 +648,18 @@ var g = {
663
648
  children: n("billing.discounts.cancel", "Cancel")
664
649
  }), /* @__PURE__ */ d("button", {
665
650
  type: "submit",
666
- disabled: w,
651
+ disabled: E,
667
652
  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 disabled:opacity-50 disabled:cursor-not-allowed",
668
- children: w ? n("billing.discounts.creating", "Creating...") : n("billing.discounts.createDiscount", "Create Discount")
653
+ children: E ? n("billing.discounts.creating", "Creating...") : n("billing.discounts.createDiscount", "Create Discount")
669
654
  })]
670
655
  })
671
656
  ]
672
657
  })
673
658
  }),
674
- j.kind === "edit" && /* @__PURE__ */ d(y, {
659
+ M.kind === "edit" && /* @__PURE__ */ d(b, {
675
660
  onClose: Q,
676
661
  children: /* @__PURE__ */ f("form", {
677
- onSubmit: ae,
662
+ onSubmit: se,
678
663
  className: "space-y-4",
679
664
  children: [
680
665
  /* @__PURE__ */ f("div", {
@@ -700,9 +685,9 @@ var g = {
700
685
  })
701
686
  })]
702
687
  }),
703
- L && /* @__PURE__ */ d("div", {
688
+ R && /* @__PURE__ */ d("div", {
704
689
  className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
705
- children: L
690
+ children: R
706
691
  }),
707
692
  /* @__PURE__ */ f("div", {
708
693
  className: "p-3 bg-bg-sunken/50 border border-border-subtle rounded-md space-y-1",
@@ -714,7 +699,7 @@ var g = {
714
699
  children: "Code"
715
700
  }), /* @__PURE__ */ d("span", {
716
701
  className: "font-mono font-medium text-text-primary",
717
- children: j.discount.code
702
+ children: M.discount.code
718
703
  })]
719
704
  }),
720
705
  /* @__PURE__ */ f("div", {
@@ -724,7 +709,7 @@ var g = {
724
709
  children: "Type"
725
710
  }), /* @__PURE__ */ d("span", {
726
711
  className: "text-text-primary",
727
- children: j.discount.type === "PERCENTAGE" ? "Percentage" : "Fixed Amount"
712
+ children: M.discount.type === "PERCENTAGE" ? "Percentage" : "Fixed Amount"
728
713
  })]
729
714
  }),
730
715
  /* @__PURE__ */ f("div", {
@@ -734,7 +719,7 @@ var g = {
734
719
  children: "Value"
735
720
  }), /* @__PURE__ */ d("span", {
736
721
  className: "text-text-primary",
737
- children: h(j.discount)
722
+ children: g(M.discount)
738
723
  })]
739
724
  }),
740
725
  /* @__PURE__ */ f("div", {
@@ -744,7 +729,7 @@ var g = {
744
729
  children: "Used"
745
730
  }), /* @__PURE__ */ f("span", {
746
731
  className: "text-text-primary",
747
- children: [j.discount.usedCount, " times"]
732
+ children: [M.discount.usedCount, " times"]
748
733
  })]
749
734
  })
750
735
  ]
@@ -760,8 +745,8 @@ var g = {
760
745
  type: "number",
761
746
  min: "1",
762
747
  step: "1",
763
- value: F.maxUses,
764
- onChange: (e) => I((t) => ({
748
+ value: I.maxUses,
749
+ onChange: (e) => L((t) => ({
765
750
  ...t,
766
751
  maxUses: e.target.value
767
752
  })),
@@ -780,8 +765,8 @@ var g = {
780
765
  }), /* @__PURE__ */ d("input", {
781
766
  id: "edit-valid-until",
782
767
  type: "datetime-local",
783
- value: F.validUntil,
784
- onChange: (e) => I((t) => ({
768
+ value: I.validUntil,
769
+ onChange: (e) => L((t) => ({
785
770
  ...t,
786
771
  validUntil: e.target.value
787
772
  })),
@@ -796,15 +781,15 @@ var g = {
796
781
  children: "Cancel"
797
782
  }), /* @__PURE__ */ d("button", {
798
783
  type: "submit",
799
- disabled: E,
784
+ disabled: O,
800
785
  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 disabled:opacity-50 disabled:cursor-not-allowed",
801
- children: E ? "Saving..." : "Save Changes"
786
+ children: O ? "Saving..." : "Save Changes"
802
787
  })]
803
788
  })
804
789
  ]
805
790
  })
806
791
  }),
807
- j.kind === "delete" && /* @__PURE__ */ d(y, {
792
+ M.kind === "delete" && /* @__PURE__ */ d(b, {
808
793
  onClose: Q,
809
794
  children: /* @__PURE__ */ f("div", {
810
795
  className: "space-y-4",
@@ -832,9 +817,9 @@ var g = {
832
817
  })
833
818
  })]
834
819
  }),
835
- L && /* @__PURE__ */ d("div", {
820
+ R && /* @__PURE__ */ d("div", {
836
821
  className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
837
- children: L
822
+ children: R
838
823
  }),
839
824
  /* @__PURE__ */ f("div", {
840
825
  className: "flex items-start gap-3",
@@ -859,7 +844,7 @@ var g = {
859
844
  " ",
860
845
  /* @__PURE__ */ d("span", {
861
846
  className: "font-mono font-semibold",
862
- children: j.discount.code
847
+ children: M.discount.code
863
848
  }),
864
849
  "?"
865
850
  ]
@@ -870,10 +855,10 @@ var g = {
870
855
  " ",
871
856
  /* @__PURE__ */ d("span", {
872
857
  className: "font-medium",
873
- children: j.discount.usedCount
858
+ children: M.discount.usedCount
874
859
  }),
875
860
  " time",
876
- j.discount.usedCount === 1 ? "" : "s",
861
+ M.discount.usedCount === 1 ? "" : "s",
877
862
  "."
878
863
  ]
879
864
  })] })]
@@ -887,10 +872,10 @@ var g = {
887
872
  children: "Cancel"
888
873
  }), /* @__PURE__ */ d("button", {
889
874
  type: "button",
890
- onClick: oe,
891
- disabled: O,
875
+ onClick: ce,
876
+ disabled: A,
892
877
  className: "px-4 py-2 text-sm font-medium bg-action-danger-bg text-action-danger-text rounded-button hover:bg-action-danger-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
893
- children: O ? "Deleting..." : "Delete Discount"
878
+ children: A ? "Deleting..." : "Delete Discount"
894
879
  })]
895
880
  })
896
881
  ]
@@ -898,8 +883,8 @@ var g = {
898
883
  })
899
884
  ]
900
885
  });
901
- }, v = ({ discount: e, selected: t, onToggleSelect: r, onEdit: i, onDelete: a }) => {
902
- let o = m(e);
886
+ }, y = ({ discount: e, selected: t, onToggleSelect: r, onEdit: i, onDelete: a }) => {
887
+ let o = h(e);
903
888
  return /* @__PURE__ */ f("tr", {
904
889
  className: `hover:bg-bg-sunken/30 transition-colors ${t ? "bg-bg-sunken/20" : ""}`,
905
890
  children: [
@@ -931,7 +916,7 @@ var g = {
931
916
  className: "p-4",
932
917
  children: /* @__PURE__ */ d("span", {
933
918
  className: "text-sm font-medium text-text-primary",
934
- children: h(e)
919
+ children: g(e)
935
920
  })
936
921
  }),
937
922
  /* @__PURE__ */ d("td", {
@@ -1002,7 +987,7 @@ var g = {
1002
987
  })
1003
988
  ]
1004
989
  });
1005
- }, y = ({ onClose: e, children: t }) => /* @__PURE__ */ f("div", {
990
+ }, b = ({ onClose: e, children: t }) => /* @__PURE__ */ f("div", {
1006
991
  className: "fixed inset-0 z-50 flex items-center justify-center",
1007
992
  children: [/* @__PURE__ */ d("div", {
1008
993
  className: "absolute inset-0 bg-bg-overlay",
@@ -1013,6 +998,6 @@ var g = {
1013
998
  })]
1014
999
  });
1015
1000
  //#endregion
1016
- export { _ as DiscountsListPage };
1001
+ export { v as DiscountsListPage };
1017
1002
 
1018
1003
  //# sourceMappingURL=DiscountsListPage.js.map