@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.2

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 (62) hide show
  1. package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
  2. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
  4. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  5. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
  6. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  7. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
  8. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
  9. package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
  10. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  11. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
  12. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
  13. package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
  14. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  15. package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
  16. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  17. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
  18. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
  19. package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
  20. package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
  21. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
  22. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
  23. package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
  24. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  25. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
  26. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  27. package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
  28. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  29. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
  30. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  31. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
  32. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  33. package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
  34. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  35. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
  36. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
  37. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
  38. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  39. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
  40. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
  41. package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
  42. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  43. package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
  44. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  45. package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
  46. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  47. package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
  48. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  49. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
  50. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  51. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
  52. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  53. package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
  54. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  55. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
  56. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  57. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
  58. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
  59. package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
  60. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  61. package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
  62. package/package.json +2 -2
@@ -3,175 +3,175 @@ import { PageHeader as t } from "../../../shared/components/PageHeader.js";
3
3
  import { useBillingNavigate as n } from "../../../hooks/useBillingNavigate.js";
4
4
  import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions.js";
5
5
  import "../../../shared/components/index.js";
6
- import { useDeactivateCouponMutation as i, useListCouponsQuery as a, useUpdateCouponMutation as o } from "../../../../generated/global-operations.js";
7
- import { CouponStatus as s } from "../../../../generated/global-types.js";
8
- import { useEffect as c, useMemo as l, useState as u } from "react";
9
- import { IllustratedEmptyState as ee, PagePurpose as d, ResponsiveTable as f } from "@burdenoff/fe-libs/ui";
10
- import { AlertCircle as p, CheckCircle as m, ChevronLeft as h, ChevronRight as g, DollarSign as _, Download as v, Edit as y, Eye as b, Package as te, Percent as ne, Plus as re, Power as ie, PowerOff as ae, Search as oe, Tag as x, Trash2 as se, TrendingUp as S } from "lucide-react";
11
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
12
- import { useI18n as E } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
6
+ import { useDeactivateCouponMutation as i, useListCouponsQuery as a, useUpdateCouponMutation as ee } from "../../../../generated/global-operations.js";
7
+ import { CouponStatus as o } from "../../../../generated/global-types.js";
8
+ import { useEffect as s, useMemo as c, useState as l } from "react";
9
+ import { IllustratedEmptyState as u, PagePurpose as d, ResponsiveTable as f, ThemedSelect as p } from "@burdenoff/fe-libs/ui";
10
+ import { AlertCircle as m, CheckCircle as h, ChevronLeft as g, ChevronRight as _, DollarSign as v, Download as te, Edit as ne, Eye as re, Package as ie, Percent as ae, Plus as oe, Power as y, PowerOff as se, Search as b, Tag as x, Trash2 as S, TrendingUp as C } from "lucide-react";
11
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
12
+ import { useI18n as D } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
13
  // src/billing/modules/coupons/pages/CouponsListPage.tsx
14
- var D = () => {
15
- let { t: D } = E(), O = (e, t) => {
16
- let n = D(e);
14
+ var O = () => {
15
+ let { t: O } = D(), k = (e, t) => {
16
+ let n = O(e);
17
17
  return n === e ? t : n;
18
- }, k = n(), ce = r(), [A, j] = u(""), [M, N] = u("ALL"), [P, F] = u("ALL"), [I] = u("ALL"), [L, R] = u(0), [z, B] = u(null), [V, H] = u(null), [U, W] = u(null), { data: G, loading: le, refetch: K } = a({ variables: {
18
+ }, A = n(), ce = r(), [j, M] = l(""), [N, P] = l("ALL"), [F, I] = l("ALL"), [L] = l("ALL"), [R, z] = l(0), [B, V] = l(null), [H, U] = l(null), [W, G] = l(null), { data: K, loading: le, refetch: q } = a({ variables: {
19
19
  limit: 20,
20
- offset: L * 20,
20
+ offset: R * 20,
21
21
  filter: {
22
- status: M === "ALL" ? void 0 : M,
23
- type: P === "ALL" ? void 0 : P,
24
- scope: I === "ALL" ? void 0 : I,
25
- search: A || void 0
22
+ status: N === "ALL" ? void 0 : N,
23
+ type: F === "ALL" ? void 0 : F,
24
+ scope: L === "ALL" ? void 0 : L,
25
+ search: j || void 0
26
26
  }
27
- } }), q = l(() => G?.listCoupons?.coupons ?? [], [G?.listCoupons?.coupons]), J = G?.listCoupons?.total ?? 0, ue = G?.listCoupons?.hasMore ?? !1, de = Math.ceil(J / 20), [Y, { loading: X }] = i(), [fe] = o(), Z = q;
28
- c(() => {
29
- R(0);
27
+ } }), J = c(() => K?.listCoupons?.coupons ?? [], [K?.listCoupons?.coupons]), Y = K?.listCoupons?.total ?? 0, ue = K?.listCoupons?.hasMore ?? !1, de = Math.ceil(Y / 20), [fe, { loading: X }] = i(), [pe] = ee(), Z = J;
28
+ s(() => {
29
+ z(0);
30
30
  }, [
31
- A,
32
- M,
33
- P,
34
- I
31
+ j,
32
+ N,
33
+ F,
34
+ L
35
35
  ]);
36
- let Q = l(() => {
37
- let e = q.filter((e) => e.status === "ACTIVE").length, t = q.reduce((e, t) => e + t.currentUses, 0), n = q.reduce((e, t) => t.type === "FIXED_AMOUNT" ? e + t.value * t.currentUses : e, 0);
36
+ let Q = c(() => {
37
+ let e = J.filter((e) => e.status === "ACTIVE").length, t = J.reduce((e, t) => e + t.currentUses, 0), n = J.reduce((e, t) => t.type === "FIXED_AMOUNT" ? e + t.value * t.currentUses : e, 0);
38
38
  return {
39
- totalCoupons: J,
39
+ totalCoupons: Y,
40
40
  activeCoupons: e,
41
41
  totalUses: t,
42
42
  totalDiscountValue: n
43
43
  };
44
- }, [q, J]);
45
- if (!ce.canManageDiscounts) return /* @__PURE__ */ w(e, { message: "You don't have permission to manage coupons." });
44
+ }, [J, Y]);
45
+ if (!ce.canManageDiscounts) return /* @__PURE__ */ T(e, { message: "You don't have permission to manage coupons." });
46
46
  let $ = (e) => new Intl.NumberFormat("en-US", {
47
47
  style: "currency",
48
48
  currency: "USD"
49
- }).format(e), pe = (e) => new Date(e).toLocaleDateString("en-US", {
49
+ }).format(e), me = (e) => new Date(e).toLocaleDateString("en-US", {
50
50
  year: "numeric",
51
51
  month: "short",
52
52
  day: "numeric"
53
- }), me = (e) => {
53
+ }), he = (e) => {
54
54
  switch (e) {
55
55
  case "ACTIVE": return "text-status-success-text bg-status-success-bg-subtle";
56
56
  case "INACTIVE": return "text-text-secondary bg-bg-canvas";
57
57
  case "EXPIRED": return "text-status-error-text bg-status-error-bg-subtle";
58
58
  default: return "text-text-secondary bg-bg-canvas";
59
59
  }
60
- }, he = (e) => {
60
+ }, ge = (e) => {
61
61
  switch (e) {
62
- case "PERCENTAGE": return /* @__PURE__ */ w(ne, { className: "size-4" });
63
- case "FIXED_AMOUNT": return /* @__PURE__ */ w(_, { className: "size-4" });
64
- case "FREE_SHIPPING": return /* @__PURE__ */ w(te, { className: "size-4" });
65
- default: return /* @__PURE__ */ w(x, { className: "size-4" });
62
+ case "PERCENTAGE": return /* @__PURE__ */ T(ae, { className: "size-4" });
63
+ case "FIXED_AMOUNT": return /* @__PURE__ */ T(v, { className: "size-4" });
64
+ case "FREE_SHIPPING": return /* @__PURE__ */ T(ie, { className: "size-4" });
65
+ default: return /* @__PURE__ */ T(x, { className: "size-4" });
66
66
  }
67
67
  };
68
- return /* @__PURE__ */ T("div", {
68
+ return /* @__PURE__ */ E("div", {
69
69
  className: "max-w-7xl mx-auto p-4 sm:p-6 space-y-6",
70
70
  children: [
71
- /* @__PURE__ */ T("div", {
71
+ /* @__PURE__ */ E("div", {
72
72
  className: "flex items-center justify-between",
73
- children: [/* @__PURE__ */ w(t, {
74
- title: O("billing.coupons.title", "Coupons"),
73
+ children: [/* @__PURE__ */ T(t, {
74
+ title: k("billing.coupons.title", "Coupons"),
75
75
  description: "Manage discount codes and promotional offers",
76
- icon: /* @__PURE__ */ w(x, { className: "size-6" })
77
- }), /* @__PURE__ */ T("button", {
76
+ icon: /* @__PURE__ */ T(x, { className: "size-6" })
77
+ }), /* @__PURE__ */ E("button", {
78
78
  type: "button",
79
- onClick: () => k("/coupons/create"),
79
+ onClick: () => A("/coupons/create"),
80
80
  className: "inline-flex items-center gap-2 rounded-button bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors duration-200 hover:bg-action-primary-bgHover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
81
- children: [/* @__PURE__ */ w(re, { className: "size-4" }), "Create Coupon"]
81
+ children: [/* @__PURE__ */ T(oe, { className: "size-4" }), "Create Coupon"]
82
82
  })]
83
83
  }),
84
- /* @__PURE__ */ w(d, { children: O("billing.coupons.purpose", "Create and manage discount codes that customers redeem at checkout — percentage or fixed-amount off, with optional usage limits and expiry. Track how often each coupon has been used and deactivate ones you no longer want to honour.") }),
85
- /* @__PURE__ */ T("div", {
84
+ /* @__PURE__ */ T(d, { children: k("billing.coupons.purpose", "Create and manage discount codes that customers redeem at checkout — percentage or fixed-amount off, with optional usage limits and expiry. Track how often each coupon has been used and deactivate ones you no longer want to honour.") }),
85
+ /* @__PURE__ */ E("div", {
86
86
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",
87
87
  children: [
88
- /* @__PURE__ */ T("div", {
88
+ /* @__PURE__ */ E("div", {
89
89
  className: "rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]",
90
90
  children: [
91
- /* @__PURE__ */ T("div", {
91
+ /* @__PURE__ */ E("div", {
92
92
  className: "flex items-center justify-between mb-2",
93
- children: [/* @__PURE__ */ w("span", {
93
+ children: [/* @__PURE__ */ T("span", {
94
94
  className: "text-sm text-text-secondary",
95
95
  children: "Total Coupons"
96
- }), /* @__PURE__ */ w("span", {
96
+ }), /* @__PURE__ */ T("span", {
97
97
  className: "flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)]",
98
- children: /* @__PURE__ */ w(x, { className: "size-4 text-accent-blue" })
98
+ children: /* @__PURE__ */ T(x, { className: "size-4 text-accent-blue" })
99
99
  })]
100
100
  }),
101
- /* @__PURE__ */ w("p", {
101
+ /* @__PURE__ */ T("p", {
102
102
  className: "text-2xl font-semibold text-text-primary tabular-nums",
103
103
  children: Q.totalCoupons
104
104
  }),
105
- /* @__PURE__ */ T("p", {
105
+ /* @__PURE__ */ E("p", {
106
106
  className: "text-xs text-text-muted mt-1",
107
107
  children: [Q.activeCoupons, " active"]
108
108
  })
109
109
  ]
110
110
  }),
111
- /* @__PURE__ */ T("div", {
111
+ /* @__PURE__ */ E("div", {
112
112
  className: "rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]",
113
113
  children: [
114
- /* @__PURE__ */ T("div", {
114
+ /* @__PURE__ */ E("div", {
115
115
  className: "flex items-center justify-between mb-2",
116
- children: [/* @__PURE__ */ w("span", {
116
+ children: [/* @__PURE__ */ T("span", {
117
117
  className: "text-sm text-text-secondary",
118
118
  children: "Total Uses"
119
- }), /* @__PURE__ */ w("span", {
119
+ }), /* @__PURE__ */ T("span", {
120
120
  className: "flex size-9 items-center justify-center rounded-lg bg-status-success-bg-subtle",
121
- children: /* @__PURE__ */ w(S, { className: "size-4 text-status-success-text" })
121
+ children: /* @__PURE__ */ T(C, { className: "size-4 text-status-success-text" })
122
122
  })]
123
123
  }),
124
- /* @__PURE__ */ w("p", {
124
+ /* @__PURE__ */ T("p", {
125
125
  className: "text-2xl font-semibold text-text-primary tabular-nums",
126
126
  children: Q.totalUses
127
127
  }),
128
- /* @__PURE__ */ w("p", {
128
+ /* @__PURE__ */ T("p", {
129
129
  className: "text-xs text-text-muted mt-1",
130
130
  children: "All time"
131
131
  })
132
132
  ]
133
133
  }),
134
- /* @__PURE__ */ T("div", {
134
+ /* @__PURE__ */ E("div", {
135
135
  className: "rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]",
136
136
  children: [
137
- /* @__PURE__ */ T("div", {
137
+ /* @__PURE__ */ E("div", {
138
138
  className: "flex items-center justify-between mb-2",
139
- children: [/* @__PURE__ */ w("span", {
139
+ children: [/* @__PURE__ */ T("span", {
140
140
  className: "text-sm text-text-secondary",
141
141
  children: "Total Discount"
142
- }), /* @__PURE__ */ w("span", {
142
+ }), /* @__PURE__ */ T("span", {
143
143
  className: "flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)]",
144
- children: /* @__PURE__ */ w(_, { className: "size-4 text-accent-purple" })
144
+ children: /* @__PURE__ */ T(v, { className: "size-4 text-accent-purple" })
145
145
  })]
146
146
  }),
147
- /* @__PURE__ */ w("p", {
147
+ /* @__PURE__ */ T("p", {
148
148
  className: "text-2xl font-semibold text-text-primary tabular-nums",
149
149
  children: $(Q.totalDiscountValue)
150
150
  }),
151
- /* @__PURE__ */ w("p", {
151
+ /* @__PURE__ */ T("p", {
152
152
  className: "text-xs text-text-muted mt-1",
153
153
  children: "Fixed amount only"
154
154
  })
155
155
  ]
156
156
  }),
157
- /* @__PURE__ */ T("div", {
157
+ /* @__PURE__ */ E("div", {
158
158
  className: "rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]",
159
159
  children: [
160
- /* @__PURE__ */ T("div", {
160
+ /* @__PURE__ */ E("div", {
161
161
  className: "flex items-center justify-between mb-2",
162
- children: [/* @__PURE__ */ w("span", {
162
+ children: [/* @__PURE__ */ T("span", {
163
163
  className: "text-sm text-text-secondary",
164
164
  children: "Active Rate"
165
- }), /* @__PURE__ */ w("span", {
165
+ }), /* @__PURE__ */ T("span", {
166
166
  className: "flex size-9 items-center justify-center rounded-lg bg-status-success-bg-subtle",
167
- children: /* @__PURE__ */ w(m, { className: "size-4 text-status-success-text" })
167
+ children: /* @__PURE__ */ T(h, { className: "size-4 text-status-success-text" })
168
168
  })]
169
169
  }),
170
- /* @__PURE__ */ T("p", {
170
+ /* @__PURE__ */ E("p", {
171
171
  className: "text-2xl font-semibold text-text-primary tabular-nums",
172
172
  children: [Q.totalCoupons > 0 ? Math.round(Q.activeCoupons / Q.totalCoupons * 100) : 0, "%"]
173
173
  }),
174
- /* @__PURE__ */ w("p", {
174
+ /* @__PURE__ */ T("p", {
175
175
  className: "text-xs text-text-muted mt-1",
176
176
  children: "Of all coupons"
177
177
  })
@@ -179,42 +179,42 @@ var D = () => {
179
179
  })
180
180
  ]
181
181
  }),
182
- U && /* @__PURE__ */ T("div", {
183
- className: U.tone === "success" ? "flex items-start gap-3 rounded-lg border border-status-success-border bg-status-success-bg-subtle p-4 text-status-success-text" : "flex items-start gap-3 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4 text-status-error-text",
182
+ W && /* @__PURE__ */ E("div", {
183
+ className: W.tone === "success" ? "flex items-start gap-3 rounded-lg border border-status-success-border bg-status-success-bg-subtle p-4 text-status-success-text" : "flex items-start gap-3 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4 text-status-error-text",
184
184
  role: "status",
185
185
  "aria-live": "polite",
186
- children: [U.tone === "success" ? /* @__PURE__ */ w(m, { className: "mt-0.5 size-4 shrink-0" }) : /* @__PURE__ */ w(p, { className: "mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ w("p", {
186
+ children: [W.tone === "success" ? /* @__PURE__ */ T(h, { className: "mt-0.5 size-4 shrink-0" }) : /* @__PURE__ */ T(m, { className: "mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ T("p", {
187
187
  className: "text-sm font-medium",
188
- children: U.message
188
+ children: W.message
189
189
  })]
190
190
  }),
191
- z && /* @__PURE__ */ w("div", {
191
+ B && /* @__PURE__ */ T("div", {
192
192
  className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4",
193
- children: /* @__PURE__ */ T("div", {
193
+ children: /* @__PURE__ */ E("div", {
194
194
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
195
- children: [/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("p", {
195
+ children: [/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ E("p", {
196
196
  className: "font-medium text-status-error-text",
197
197
  children: [
198
198
  "Deactivate coupon ",
199
- /* @__PURE__ */ w("span", {
199
+ /* @__PURE__ */ T("span", {
200
200
  className: "font-mono",
201
- children: z.code
201
+ children: B.code
202
202
  }),
203
203
  "?"
204
204
  ]
205
- }), /* @__PURE__ */ w("p", {
205
+ }), /* @__PURE__ */ T("p", {
206
206
  className: "mt-1 text-sm text-status-error-text",
207
207
  children: "This will prevent new checkouts from applying this coupon."
208
- })] }), /* @__PURE__ */ T("div", {
208
+ })] }), /* @__PURE__ */ E("div", {
209
209
  className: "flex gap-2 self-end sm:self-auto",
210
- children: [/* @__PURE__ */ w("button", {
210
+ children: [/* @__PURE__ */ T("button", {
211
211
  type: "button",
212
- onClick: () => B(null),
212
+ onClick: () => V(null),
213
213
  className: "rounded-button border border-border-subtle bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
214
214
  children: "Cancel"
215
- }), /* @__PURE__ */ w("button", {
215
+ }), /* @__PURE__ */ T("button", {
216
216
  type: "button",
217
- onClick: () => ge(z.id),
217
+ onClick: () => _e(B.id),
218
218
  disabled: X,
219
219
  className: "rounded-button bg-action-danger-bg px-3 py-2 text-sm font-medium text-action-danger-text transition-colors hover:bg-action-danger-bgHover disabled:cursor-not-allowed disabled:opacity-50",
220
220
  children: X ? "Deactivating…" : "Deactivate"
@@ -222,69 +222,69 @@ var D = () => {
222
222
  })]
223
223
  })
224
224
  }),
225
- /* @__PURE__ */ w("div", {
225
+ /* @__PURE__ */ T("div", {
226
226
  className: "bg-bg-surface border border-border-subtle rounded-lg p-4",
227
- children: /* @__PURE__ */ T("div", {
227
+ children: /* @__PURE__ */ E("div", {
228
228
  className: "grid grid-cols-1 md:grid-cols-4 gap-4",
229
229
  children: [
230
- /* @__PURE__ */ w("div", {
230
+ /* @__PURE__ */ T("div", {
231
231
  className: "md:col-span-2",
232
- children: /* @__PURE__ */ T("div", {
232
+ children: /* @__PURE__ */ E("div", {
233
233
  className: "relative",
234
- children: [/* @__PURE__ */ w(oe, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted" }), /* @__PURE__ */ w("input", {
234
+ children: [/* @__PURE__ */ T(b, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted" }), /* @__PURE__ */ T("input", {
235
235
  type: "text",
236
236
  placeholder: "Search coupons...",
237
- value: A,
238
- onChange: (e) => j(e.target.value),
237
+ value: j,
238
+ onChange: (e) => M(e.target.value),
239
239
  className: "w-full pl-10 pr-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
240
240
  })]
241
241
  })
242
242
  }),
243
- /* @__PURE__ */ T("select", {
244
- value: M,
243
+ /* @__PURE__ */ E(p, {
244
+ value: N,
245
245
  onChange: (e) => {
246
- N(e.target.value), R(0);
246
+ P(e.target.value), z(0);
247
247
  },
248
248
  className: "px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
249
249
  children: [
250
- /* @__PURE__ */ w("option", {
250
+ /* @__PURE__ */ T("option", {
251
251
  value: "ALL",
252
252
  children: "All Status"
253
253
  }),
254
- /* @__PURE__ */ w("option", {
254
+ /* @__PURE__ */ T("option", {
255
255
  value: "ACTIVE",
256
256
  children: "Active"
257
257
  }),
258
- /* @__PURE__ */ w("option", {
258
+ /* @__PURE__ */ T("option", {
259
259
  value: "INACTIVE",
260
260
  children: "Inactive"
261
261
  }),
262
- /* @__PURE__ */ w("option", {
262
+ /* @__PURE__ */ T("option", {
263
263
  value: "EXPIRED",
264
264
  children: "Expired"
265
265
  })
266
266
  ]
267
267
  }),
268
- /* @__PURE__ */ T("select", {
269
- value: P,
268
+ /* @__PURE__ */ E(p, {
269
+ value: F,
270
270
  onChange: (e) => {
271
- F(e.target.value), R(0);
271
+ I(e.target.value), z(0);
272
272
  },
273
273
  className: "px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
274
274
  children: [
275
- /* @__PURE__ */ w("option", {
275
+ /* @__PURE__ */ T("option", {
276
276
  value: "ALL",
277
277
  children: "All Types"
278
278
  }),
279
- /* @__PURE__ */ w("option", {
279
+ /* @__PURE__ */ T("option", {
280
280
  value: "PERCENTAGE",
281
281
  children: "Percentage"
282
282
  }),
283
- /* @__PURE__ */ w("option", {
283
+ /* @__PURE__ */ T("option", {
284
284
  value: "FIXED_AMOUNT",
285
285
  children: "Fixed Amount"
286
286
  }),
287
- /* @__PURE__ */ w("option", {
287
+ /* @__PURE__ */ T("option", {
288
288
  value: "FREE_SHIPPING",
289
289
  children: "Free Shipping"
290
290
  })
@@ -293,21 +293,21 @@ var D = () => {
293
293
  ]
294
294
  })
295
295
  }),
296
- /* @__PURE__ */ w("div", {
296
+ /* @__PURE__ */ T("div", {
297
297
  className: "bg-bg-surface border border-border-seam rounded-card overflow-hidden shadow-[var(--shadow-elevation-1)]",
298
- children: le ? /* @__PURE__ */ w("div", {
298
+ children: le ? /* @__PURE__ */ T("div", {
299
299
  className: "p-8 text-center text-text-muted",
300
300
  children: "Loading coupons…"
301
- }) : /* @__PURE__ */ w(f, {
301
+ }) : /* @__PURE__ */ T(f, {
302
302
  columns: [
303
303
  {
304
304
  key: "code",
305
305
  header: "Code",
306
306
  priority: "primary",
307
- cell: (e) => /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
307
+ cell: (e) => /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
308
308
  className: "font-medium text-text-primary font-mono",
309
309
  children: e.code
310
- }), /* @__PURE__ */ w("p", {
310
+ }), /* @__PURE__ */ T("p", {
311
311
  className: "text-sm text-text-muted",
312
312
  children: e.name
313
313
  })] })
@@ -315,9 +315,9 @@ var D = () => {
315
315
  {
316
316
  key: "type",
317
317
  header: "Type",
318
- cell: (e) => /* @__PURE__ */ T("div", {
318
+ cell: (e) => /* @__PURE__ */ E("div", {
319
319
  className: "flex items-center gap-2",
320
- children: [he(e.type), /* @__PURE__ */ w("span", {
320
+ children: [ge(e.type), /* @__PURE__ */ T("span", {
321
321
  className: "text-sm text-text-primary capitalize",
322
322
  children: e.type.replace("_", " ").toLowerCase()
323
323
  })]
@@ -326,7 +326,7 @@ var D = () => {
326
326
  {
327
327
  key: "value",
328
328
  header: "Value",
329
- cell: (e) => /* @__PURE__ */ w("span", {
329
+ cell: (e) => /* @__PURE__ */ T("span", {
330
330
  className: "text-sm font-medium text-text-primary tabular-nums",
331
331
  children: e.type === "PERCENTAGE" ? `${e.value}%` : $(e.value)
332
332
  })
@@ -334,26 +334,26 @@ var D = () => {
334
334
  {
335
335
  key: "status",
336
336
  header: "Status",
337
- cell: (e) => /* @__PURE__ */ w("span", {
338
- className: `inline-flex px-2 py-1 rounded-full text-xs font-medium ${me(e.status)}`,
337
+ cell: (e) => /* @__PURE__ */ T("span", {
338
+ className: `inline-flex px-2 py-1 rounded-full text-xs font-medium ${he(e.status)}`,
339
339
  children: e.status
340
340
  })
341
341
  },
342
342
  {
343
343
  key: "usage",
344
344
  header: "Usage",
345
- cell: (e) => /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("div", {
345
+ cell: (e) => /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("div", {
346
346
  className: "text-sm text-text-primary tabular-nums",
347
- children: [/* @__PURE__ */ w("span", {
347
+ children: [/* @__PURE__ */ T("span", {
348
348
  className: "font-medium",
349
349
  children: e.currentUses
350
- }), e.maxTotalUses && /* @__PURE__ */ T("span", {
350
+ }), e.maxTotalUses && /* @__PURE__ */ E("span", {
351
351
  className: "text-text-muted",
352
352
  children: [" / ", e.maxTotalUses]
353
353
  })]
354
- }), e.maxTotalUses && /* @__PURE__ */ w("div", {
354
+ }), e.maxTotalUses && /* @__PURE__ */ T("div", {
355
355
  className: "w-full bg-bg-sunken rounded-full h-1.5 mt-1",
356
- children: /* @__PURE__ */ w("div", {
356
+ children: /* @__PURE__ */ T("div", {
357
357
  className: "bg-action-primary-bg h-1.5 rounded-full",
358
358
  style: { width: `${Math.min(e.currentUses / e.maxTotalUses * 100, 100)}%` }
359
359
  })
@@ -363,144 +363,144 @@ var D = () => {
363
363
  key: "validUntil",
364
364
  header: "Valid Until",
365
365
  priority: "hidden-on-mobile",
366
- cell: (e) => /* @__PURE__ */ w("span", {
366
+ cell: (e) => /* @__PURE__ */ T("span", {
367
367
  className: "text-sm text-text-muted",
368
- children: e.validUntil ? pe(e.validUntil) : "No expiry"
368
+ children: e.validUntil ? me(e.validUntil) : "No expiry"
369
369
  })
370
370
  }
371
371
  ],
372
372
  data: Z,
373
373
  rowKey: (e) => e.id,
374
- rowActions: (e) => /* @__PURE__ */ T(C, { children: [
375
- /* @__PURE__ */ w("button", {
374
+ rowActions: (e) => /* @__PURE__ */ E(w, { children: [
375
+ /* @__PURE__ */ T("button", {
376
376
  type: "button",
377
- onClick: () => k(`/coupons/${e.id}`),
377
+ onClick: () => A(`/coupons/${e.id}`),
378
378
  className: "p-2 rounded-lg hover:bg-bg-sunken text-text-muted hover:text-text-primary",
379
379
  title: "View details",
380
- children: /* @__PURE__ */ w(b, { className: "size-4" })
380
+ children: /* @__PURE__ */ T(re, { className: "size-4" })
381
381
  }),
382
- /* @__PURE__ */ w("button", {
382
+ /* @__PURE__ */ T("button", {
383
383
  type: "button",
384
- onClick: () => k(`/coupons/${e.id}/edit`),
384
+ onClick: () => A(`/coupons/${e.id}/edit`),
385
385
  className: "p-2 rounded-lg hover:bg-bg-sunken text-text-muted hover:text-text-primary",
386
386
  title: "Edit coupon",
387
- children: /* @__PURE__ */ w(y, { className: "size-4" })
387
+ children: /* @__PURE__ */ T(ne, { className: "size-4" })
388
388
  }),
389
- e.status === "ACTIVE" ? /* @__PURE__ */ w("button", {
389
+ e.status === "ACTIVE" ? /* @__PURE__ */ T("button", {
390
390
  type: "button",
391
- onClick: () => B(e),
392
- disabled: X || V === e.id,
391
+ onClick: () => V(e),
392
+ disabled: X || H === e.id,
393
393
  className: "p-2 rounded-lg hover:bg-status-error-bg-subtle text-text-muted hover:text-status-error-text disabled:opacity-50 disabled:cursor-not-allowed",
394
394
  title: "Deactivate coupon",
395
- children: /* @__PURE__ */ w(ae, { className: "size-4" })
396
- }) : e.status === "INACTIVE" ? /* @__PURE__ */ w("button", {
395
+ children: /* @__PURE__ */ T(se, { className: "size-4" })
396
+ }) : e.status === "INACTIVE" ? /* @__PURE__ */ T("button", {
397
397
  type: "button",
398
- onClick: () => _e(e.id, s.Active),
399
- disabled: V === e.id,
398
+ onClick: () => ve(e.id, o.Active),
399
+ disabled: H === e.id,
400
400
  className: "p-2 rounded-lg hover:bg-status-success-bg-subtle text-text-muted hover:text-status-success-text disabled:opacity-50 disabled:cursor-not-allowed",
401
401
  title: "Activate coupon",
402
- children: /* @__PURE__ */ w(ie, { className: "size-4" })
403
- }) : /* @__PURE__ */ w("button", {
402
+ children: /* @__PURE__ */ T(y, { className: "size-4" })
403
+ }) : /* @__PURE__ */ T("button", {
404
404
  type: "button",
405
405
  disabled: !0,
406
406
  className: "p-2 rounded-lg text-text-muted/40 cursor-not-allowed",
407
407
  title: `Cannot change status (${e.status.toLowerCase()})`,
408
- children: /* @__PURE__ */ w(se, { className: "size-4" })
408
+ children: /* @__PURE__ */ T(S, { className: "size-4" })
409
409
  })
410
410
  ] }),
411
- emptyState: /* @__PURE__ */ w(ee, {
411
+ emptyState: /* @__PURE__ */ T(u, {
412
412
  illustration: "empty-data",
413
413
  title: "No coupons found",
414
414
  description: "Create a coupon to start offering discounts at checkout."
415
415
  })
416
416
  })
417
417
  }),
418
- J > 20 && /* @__PURE__ */ T("div", {
418
+ Y > 20 && /* @__PURE__ */ E("div", {
419
419
  className: "flex items-center justify-between px-2",
420
- children: [/* @__PURE__ */ T("p", {
420
+ children: [/* @__PURE__ */ E("p", {
421
421
  className: "text-sm text-text-muted",
422
422
  children: [
423
423
  "Showing ",
424
- L * 20 + 1,
424
+ R * 20 + 1,
425
425
  "–",
426
- Math.min((L + 1) * 20, J),
426
+ Math.min((R + 1) * 20, Y),
427
427
  " of ",
428
- J,
428
+ Y,
429
429
  " ",
430
430
  "coupons"
431
431
  ]
432
- }), /* @__PURE__ */ T("div", {
432
+ }), /* @__PURE__ */ E("div", {
433
433
  className: "flex items-center gap-2",
434
434
  children: [
435
- /* @__PURE__ */ w("button", {
435
+ /* @__PURE__ */ T("button", {
436
436
  type: "button",
437
- onClick: () => R((e) => Math.max(0, e - 1)),
438
- disabled: L === 0,
437
+ onClick: () => z((e) => Math.max(0, e - 1)),
438
+ disabled: R === 0,
439
439
  className: "p-2 rounded-lg border border-border-subtle hover:bg-bg-sunken disabled:opacity-40 disabled:cursor-not-allowed",
440
- children: /* @__PURE__ */ w(h, { className: "size-4" })
440
+ children: /* @__PURE__ */ T(g, { className: "size-4" })
441
441
  }),
442
- /* @__PURE__ */ T("span", {
442
+ /* @__PURE__ */ E("span", {
443
443
  className: "text-sm text-text-primary font-medium",
444
444
  children: [
445
- L + 1,
445
+ R + 1,
446
446
  " / ",
447
447
  de
448
448
  ]
449
449
  }),
450
- /* @__PURE__ */ w("button", {
450
+ /* @__PURE__ */ T("button", {
451
451
  type: "button",
452
- onClick: () => R((e) => e + 1),
452
+ onClick: () => z((e) => e + 1),
453
453
  disabled: !ue,
454
454
  className: "p-2 rounded-lg border border-border-subtle hover:bg-bg-sunken disabled:opacity-40 disabled:cursor-not-allowed",
455
- children: /* @__PURE__ */ w(g, { className: "size-4" })
455
+ children: /* @__PURE__ */ T(_, { className: "size-4" })
456
456
  })
457
457
  ]
458
458
  })]
459
459
  }),
460
- /* @__PURE__ */ w("div", {
460
+ /* @__PURE__ */ T("div", {
461
461
  className: "flex justify-end",
462
- children: /* @__PURE__ */ T("button", {
462
+ children: /* @__PURE__ */ E("button", {
463
463
  type: "button",
464
- onClick: ve,
464
+ onClick: ye,
465
465
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
466
- children: [/* @__PURE__ */ w(v, { className: "size-4" }), "Export Coupons"]
466
+ children: [/* @__PURE__ */ T(te, { className: "size-4" }), "Export Coupons"]
467
467
  })
468
468
  })
469
469
  ]
470
470
  });
471
- async function ge(e) {
471
+ async function _e(e) {
472
472
  try {
473
- await Y({ variables: { id: e } }), await K(), B(null), W({
473
+ await fe({ variables: { id: e } }), await q(), V(null), G({
474
474
  tone: "success",
475
475
  message: "Coupon deactivated successfully."
476
476
  });
477
477
  } catch (e) {
478
- console.error("Failed to deactivate coupon:", e), W({
478
+ console.error("Failed to deactivate coupon:", e), G({
479
479
  tone: "error",
480
480
  message: `Failed to deactivate coupon: ${e instanceof Error ? e.message : "Unknown error"}`
481
481
  });
482
482
  }
483
483
  }
484
- async function _e(e, t) {
485
- H(e);
484
+ async function ve(e, t) {
485
+ U(e);
486
486
  try {
487
- await fe({ variables: {
487
+ await pe({ variables: {
488
488
  id: e,
489
489
  input: { status: t }
490
- } }), await K(), W({
490
+ } }), await q(), G({
491
491
  tone: "success",
492
- message: `Coupon ${t === s.Active ? "activated" : "deactivated"} successfully.`
492
+ message: `Coupon ${t === o.Active ? "activated" : "deactivated"} successfully.`
493
493
  });
494
494
  } catch (e) {
495
- console.error("Failed to update coupon status:", e), W({
495
+ console.error("Failed to update coupon status:", e), G({
496
496
  tone: "error",
497
497
  message: `Failed to update status: ${e instanceof Error ? e.message : "Unknown error"}`
498
498
  });
499
499
  } finally {
500
- H(null);
500
+ U(null);
501
501
  }
502
502
  }
503
- function ve() {
503
+ function ye() {
504
504
  let e = Z.map((e) => ({
505
505
  code: e.code,
506
506
  name: e.name,
@@ -513,19 +513,19 @@ var D = () => {
513
513
  validUntil: e.validUntil ?? ""
514
514
  }));
515
515
  if (e.length === 0) {
516
- W({
516
+ G({
517
517
  tone: "error",
518
518
  message: "There are no coupons to export for the current filters."
519
519
  });
520
520
  return;
521
521
  }
522
522
  let t = Object.keys(e[0]).join(","), n = e.map((e) => Object.values(e).map((e) => `"${String(e).replaceAll("\"", "\"\"")}"`).join(",")).join("\n"), r = new Blob([`${t}\n${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
523
- a.href = i, a.download = "billing-coupons.csv", a.click(), URL.revokeObjectURL(i), W({
523
+ a.href = i, a.download = "billing-coupons.csv", a.click(), URL.revokeObjectURL(i), G({
524
524
  tone: "success",
525
525
  message: `Exported ${e.length} coupon${e.length === 1 ? "" : "s"} to CSV.`
526
526
  });
527
527
  }
528
528
  };
529
- export { D as CouponsListPage };
529
+ export { O as CouponsListPage };
530
530
 
531
531
  //# sourceMappingURL=CouponsListPage.js.map