@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
@@ -9,25 +9,26 @@ import { useEffect as s, useState as c } from "react";
9
9
  import { AlertCircle as l, ArrowLeft as u, CheckCircle as d, Save as f } from "lucide-react";
10
10
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
11
11
  import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
+ import { PagePurpose as g } from "@burdenoff/fe-libs/ui";
12
13
  //#region src/billing/modules/coupons/pages/EditCouponPage.tsx
13
- var g = () => {
14
- let { t: g } = h(), _ = (e, t) => {
15
- let n = g(e);
14
+ var _ = () => {
15
+ let { t: _ } = h(), v = (e, t) => {
16
+ let n = _(e);
16
17
  return n === e ? t : n;
17
- }, v = a(), y = n(), b = window.location.pathname.split("/").slice(-2)[0], [x, { data: S, loading: C, error: w }] = r(), [T, { loading: E }] = i(), [D, O] = c({
18
+ }, y = a(), b = n(), x = window.location.pathname.split("/").slice(-2)[0], [S, { data: C, loading: w, error: T }] = r(), [E, { loading: D }] = i(), [O, k] = c({
18
19
  name: "",
19
20
  description: "",
20
21
  status: o.Active,
21
22
  maxTotalUses: "",
22
23
  maxUsesPerUser: "",
23
24
  validUntil: ""
24
- }), [k, A] = c({}), [j, M] = c(""), [N, P] = c(!1);
25
+ }), [A, j] = c({}), [M, N] = c(""), [P, F] = c(!1);
25
26
  if (s(() => {
26
- b && x({ variables: { id: b } });
27
- }, [b, x]), s(() => {
28
- if (S?.getCoupon) {
29
- let e = S.getCoupon;
30
- O({
27
+ x && S({ variables: { id: x } });
28
+ }, [x, S]), s(() => {
29
+ if (C?.getCoupon) {
30
+ let e = C.getCoupon;
31
+ k({
31
32
  name: e.name,
32
33
  description: e.description || "",
33
34
  status: e.status,
@@ -36,45 +37,45 @@ var g = () => {
36
37
  validUntil: e.validUntil ? new Date(e.validUntil).toISOString().split("T")[0] : ""
37
38
  });
38
39
  }
39
- }, [S]), !y.canManageDiscounts) return /* @__PURE__ */ p(e, { message: "You don't have permission to manage coupons." });
40
- let F = (e, t) => {
41
- O((n) => ({
40
+ }, [C]), !b.canManageDiscounts) return /* @__PURE__ */ p(e, { message: "You don't have permission to manage coupons." });
41
+ let I = (e, t) => {
42
+ k((n) => ({
42
43
  ...n,
43
44
  [e]: t
44
- })), k[e] && A((t) => ({
45
+ })), A[e] && j((t) => ({
45
46
  ...t,
46
47
  [e]: ""
47
48
  }));
48
- }, I = () => {
49
+ }, L = () => {
49
50
  let e = {};
50
- return D.name.trim() || (e.name = "Name is required"), D.maxTotalUses && parseInt(D.maxTotalUses) < 1 && (e.maxTotalUses = "Must be at least 1"), D.maxUsesPerUser && parseInt(D.maxUsesPerUser) < 1 && (e.maxUsesPerUser = "Must be at least 1"), A(e), Object.keys(e).length === 0;
51
- }, L = async (e) => {
52
- if (e.preventDefault(), M(""), P(!1), I()) {
53
- if (!b) {
54
- M("Coupon ID is missing");
51
+ return O.name.trim() || (e.name = "Name is required"), O.maxTotalUses && parseInt(O.maxTotalUses) < 1 && (e.maxTotalUses = "Must be at least 1"), O.maxUsesPerUser && parseInt(O.maxUsesPerUser) < 1 && (e.maxUsesPerUser = "Must be at least 1"), j(e), Object.keys(e).length === 0;
52
+ }, R = async (e) => {
53
+ if (e.preventDefault(), N(""), F(!1), L()) {
54
+ if (!x) {
55
+ N("Coupon ID is missing");
55
56
  return;
56
57
  }
57
58
  try {
58
59
  let e = {};
59
- D.name.trim() && (e.name = D.name.trim()), D.description.trim() && (e.description = D.description.trim()), D.status && (e.status = D.status), D.maxTotalUses && (e.maxTotalUses = parseInt(D.maxTotalUses)), D.maxUsesPerUser && (e.maxUsesPerUser = parseInt(D.maxUsesPerUser)), D.validUntil && (e.validUntil = new Date(D.validUntil).toISOString()), await T({ variables: {
60
- id: b,
60
+ O.name.trim() && (e.name = O.name.trim()), O.description.trim() && (e.description = O.description.trim()), O.status && (e.status = O.status), O.maxTotalUses && (e.maxTotalUses = parseInt(O.maxTotalUses)), O.maxUsesPerUser && (e.maxUsesPerUser = parseInt(O.maxUsesPerUser)), O.validUntil && (e.validUntil = new Date(O.validUntil).toISOString()), await E({ variables: {
61
+ id: x,
61
62
  input: e
62
- } }), P(!0), setTimeout(() => {
63
- v("/coupons");
63
+ } }), F(!0), setTimeout(() => {
64
+ y("/coupons");
64
65
  }, 1500);
65
66
  } catch (e) {
66
- console.error("Failed to update coupon:", e), M(e instanceof Error ? e.message : "Failed to update coupon");
67
+ console.error("Failed to update coupon:", e), N(e instanceof Error ? e.message : "Failed to update coupon");
67
68
  }
68
69
  }
69
70
  };
70
- if (C) return /* @__PURE__ */ m("div", {
71
+ if (w) return /* @__PURE__ */ m("div", {
71
72
  className: "p-8",
72
73
  children: [/* @__PURE__ */ p(t, {
73
- title: _("billing.coupons.editTitle", "Edit Coupon"),
74
+ title: v("billing.coupons.editTitle", "Edit Coupon"),
74
75
  description: "Loading coupon data...",
75
76
  actions: /* @__PURE__ */ m("button", {
76
77
  type: "button",
77
- onClick: () => v("/coupons"),
78
+ onClick: () => y("/coupons"),
78
79
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
79
80
  children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back"]
80
81
  })
@@ -86,14 +87,14 @@ var g = () => {
86
87
  })
87
88
  })]
88
89
  });
89
- if (w || !S?.getCoupon) return /* @__PURE__ */ m("div", {
90
+ if (T || !C?.getCoupon) return /* @__PURE__ */ m("div", {
90
91
  className: "p-8",
91
92
  children: [/* @__PURE__ */ p(t, {
92
93
  title: "Edit Coupon",
93
94
  description: "Coupon not found",
94
95
  actions: /* @__PURE__ */ m("button", {
95
96
  type: "button",
96
- onClick: () => v("/coupons"),
97
+ onClick: () => y("/coupons"),
97
98
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
98
99
  children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back"]
99
100
  })
@@ -101,282 +102,289 @@ var g = () => {
101
102
  className: "flex items-center justify-center h-64",
102
103
  children: /* @__PURE__ */ p("div", {
103
104
  className: "text-status-error-text",
104
- children: w ? `Error: ${w.message}` : "Coupon not found"
105
+ children: T ? `Error: ${T.message}` : "Coupon not found"
105
106
  })
106
107
  })]
107
108
  });
108
- let R = S.getCoupon;
109
+ let z = C.getCoupon;
109
110
  return /* @__PURE__ */ m("div", {
110
111
  className: "p-8",
111
- children: [/* @__PURE__ */ p(t, {
112
- title: "Edit Coupon",
113
- description: `Editing: ${R.code}`,
114
- actions: /* @__PURE__ */ m("button", {
115
- type: "button",
116
- onClick: () => v("/coupons"),
117
- className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
118
- children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back to Coupons"]
119
- })
120
- }), /* @__PURE__ */ p("div", {
121
- className: "max-w-3xl mx-auto mt-8",
122
- children: /* @__PURE__ */ m("form", {
123
- onSubmit: L,
124
- className: "space-y-6",
125
- children: [
126
- /* @__PURE__ */ m("div", {
127
- className: "bg-bg-sunken/30 border border-border-subtle rounded-lg p-6",
128
- children: [/* @__PURE__ */ p("h3", {
129
- className: "text-lg font-semibold text-text-primary mb-4",
130
- children: "Coupon Details (Read-Only)"
131
- }), /* @__PURE__ */ m("div", {
132
- className: "grid grid-cols-2 gap-4 text-sm",
133
- children: [
134
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
135
- className: "text-text-muted",
136
- children: "Code:"
137
- }), /* @__PURE__ */ p("span", {
138
- className: "ml-2 font-mono font-medium text-text-primary",
139
- children: R.code
140
- })] }),
141
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
142
- className: "text-text-muted",
143
- children: "Type:"
144
- }), /* @__PURE__ */ p("span", {
145
- className: "ml-2 text-text-primary capitalize",
146
- children: R.type.replace("_", " ").toLowerCase()
147
- })] }),
148
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
149
- className: "text-text-muted",
150
- children: "Value:"
151
- }), /* @__PURE__ */ p("span", {
152
- className: "ml-2 text-text-primary",
153
- children: R.type === "PERCENTAGE" ? `${R.value}%` : `$${R.value}`
154
- })] }),
155
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
156
- className: "text-text-muted",
157
- children: "Scope:"
158
- }), /* @__PURE__ */ p("span", {
159
- className: "ml-2 text-text-primary",
160
- children: R.scope
161
- })] }),
162
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
163
- className: "text-text-muted",
164
- children: "Current Uses:"
165
- }), /* @__PURE__ */ m("span", {
166
- className: "ml-2 text-text-primary",
167
- children: [R.currentUses, R.maxTotalUses ? ` / ${R.maxTotalUses}` : ""]
168
- })] }),
169
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
170
- className: "text-text-muted",
171
- children: "Created:"
172
- }), /* @__PURE__ */ p("span", {
173
- className: "ml-2 text-text-primary",
174
- children: new Date(R.createdAt).toLocaleDateString()
175
- })] })
176
- ]
177
- })]
178
- }),
179
- /* @__PURE__ */ m("div", {
180
- className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-6",
181
- children: [
182
- /* @__PURE__ */ p("h3", {
183
- className: "text-lg font-semibold text-text-primary",
184
- children: "Editable Fields"
185
- }),
186
- /* @__PURE__ */ m("div", {
187
- className: "space-y-2",
112
+ children: [
113
+ /* @__PURE__ */ p(t, {
114
+ title: "Edit Coupon",
115
+ description: `Editing: ${z.code}`,
116
+ actions: /* @__PURE__ */ m("button", {
117
+ type: "button",
118
+ onClick: () => y("/coupons"),
119
+ className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
120
+ children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back to Coupons"]
121
+ })
122
+ }),
123
+ /* @__PURE__ */ p(g, {
124
+ className: "mt-2",
125
+ children: "Update an existing coupon's discount, limits, expiry or applicable products. The code itself and its usage history are read-only; deactivate the coupon if you want to stop it being redeemed."
126
+ }),
127
+ /* @__PURE__ */ p("div", {
128
+ className: "max-w-3xl mx-auto mt-8",
129
+ children: /* @__PURE__ */ m("form", {
130
+ onSubmit: R,
131
+ className: "space-y-6",
132
+ children: [
133
+ /* @__PURE__ */ m("div", {
134
+ className: "bg-bg-sunken/30 border border-border-subtle rounded-lg p-6",
135
+ children: [/* @__PURE__ */ p("h3", {
136
+ className: "text-lg font-semibold text-text-primary mb-4",
137
+ children: "Coupon Details (Read-Only)"
138
+ }), /* @__PURE__ */ m("div", {
139
+ className: "grid grid-cols-2 gap-4 text-sm",
188
140
  children: [
189
- /* @__PURE__ */ m("label", {
190
- htmlFor: "name",
191
- className: "block text-sm font-medium text-text-primary",
192
- children: ["Name ", /* @__PURE__ */ p("span", {
193
- className: "text-status-error-text",
194
- children: "*"
195
- })]
196
- }),
197
- /* @__PURE__ */ p("input", {
198
- id: "name",
199
- type: "text",
200
- value: D.name,
201
- onChange: (e) => F("name", e.target.value),
202
- placeholder: "e.g., Welcome Discount",
203
- className: "w-full px-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)]"
204
- }),
205
- k.name && /* @__PURE__ */ p("p", {
206
- className: "text-sm text-status-error-text",
207
- children: k.name
208
- })
141
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
142
+ className: "text-text-muted",
143
+ children: "Code:"
144
+ }), /* @__PURE__ */ p("span", {
145
+ className: "ml-2 font-mono font-medium text-text-primary",
146
+ children: z.code
147
+ })] }),
148
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
149
+ className: "text-text-muted",
150
+ children: "Type:"
151
+ }), /* @__PURE__ */ p("span", {
152
+ className: "ml-2 text-text-primary capitalize",
153
+ children: z.type.replace("_", " ").toLowerCase()
154
+ })] }),
155
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
156
+ className: "text-text-muted",
157
+ children: "Value:"
158
+ }), /* @__PURE__ */ p("span", {
159
+ className: "ml-2 text-text-primary",
160
+ children: z.type === "PERCENTAGE" ? `${z.value}%` : `$${z.value}`
161
+ })] }),
162
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
163
+ className: "text-text-muted",
164
+ children: "Scope:"
165
+ }), /* @__PURE__ */ p("span", {
166
+ className: "ml-2 text-text-primary",
167
+ children: z.scope
168
+ })] }),
169
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
170
+ className: "text-text-muted",
171
+ children: "Current Uses:"
172
+ }), /* @__PURE__ */ m("span", {
173
+ className: "ml-2 text-text-primary",
174
+ children: [z.currentUses, z.maxTotalUses ? ` / ${z.maxTotalUses}` : ""]
175
+ })] }),
176
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
177
+ className: "text-text-muted",
178
+ children: "Created:"
179
+ }), /* @__PURE__ */ p("span", {
180
+ className: "ml-2 text-text-primary",
181
+ children: new Date(z.createdAt).toLocaleDateString()
182
+ })] })
209
183
  ]
210
- }),
211
- /* @__PURE__ */ m("div", {
212
- className: "space-y-2",
213
- children: [/* @__PURE__ */ p("label", {
214
- htmlFor: "description",
215
- className: "block text-sm font-medium text-text-primary",
216
- children: "Description"
217
- }), /* @__PURE__ */ p("textarea", {
218
- id: "description",
219
- value: D.description,
220
- onChange: (e) => F("description", e.target.value),
221
- placeholder: "Optional description",
222
- rows: 3,
223
- className: "w-full px-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)] resize-none"
224
- })]
225
- }),
226
- /* @__PURE__ */ m("div", {
227
- className: "space-y-2",
228
- children: [/* @__PURE__ */ p("label", {
229
- htmlFor: "status",
230
- className: "block text-sm font-medium text-text-primary",
231
- children: "Status"
232
- }), /* @__PURE__ */ m("select", {
233
- id: "status",
234
- value: D.status,
235
- onChange: (e) => F("status", e.target.value),
236
- className: "w-full 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)]",
184
+ })]
185
+ }),
186
+ /* @__PURE__ */ m("div", {
187
+ className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-6",
188
+ children: [
189
+ /* @__PURE__ */ p("h3", {
190
+ className: "text-lg font-semibold text-text-primary",
191
+ children: "Editable Fields"
192
+ }),
193
+ /* @__PURE__ */ m("div", {
194
+ className: "space-y-2",
237
195
  children: [
238
- /* @__PURE__ */ p("option", {
239
- value: "ACTIVE",
240
- children: "Active"
241
- }),
242
- /* @__PURE__ */ p("option", {
243
- value: "INACTIVE",
244
- children: "Inactive"
196
+ /* @__PURE__ */ m("label", {
197
+ htmlFor: "name",
198
+ className: "block text-sm font-medium text-text-primary",
199
+ children: ["Name ", /* @__PURE__ */ p("span", {
200
+ className: "text-status-error-text",
201
+ children: "*"
202
+ })]
245
203
  }),
246
- /* @__PURE__ */ p("option", {
247
- value: "EXPIRED",
248
- children: "Expired"
204
+ /* @__PURE__ */ p("input", {
205
+ id: "name",
206
+ type: "text",
207
+ value: O.name,
208
+ onChange: (e) => I("name", e.target.value),
209
+ placeholder: "e.g., Welcome Discount",
210
+ className: "w-full px-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)]"
249
211
  }),
250
- /* @__PURE__ */ p("option", {
251
- value: "DEPLETED",
252
- children: "Depleted"
212
+ A.name && /* @__PURE__ */ p("p", {
213
+ className: "text-sm text-status-error-text",
214
+ children: A.name
253
215
  })
254
216
  ]
255
- })]
256
- }),
257
- /* @__PURE__ */ m("div", {
258
- className: "space-y-2",
259
- children: [
260
- /* @__PURE__ */ p("label", {
261
- htmlFor: "maxTotalUses",
217
+ }),
218
+ /* @__PURE__ */ m("div", {
219
+ className: "space-y-2",
220
+ children: [/* @__PURE__ */ p("label", {
221
+ htmlFor: "description",
222
+ className: "block text-sm font-medium text-text-primary",
223
+ children: "Description"
224
+ }), /* @__PURE__ */ p("textarea", {
225
+ id: "description",
226
+ value: O.description,
227
+ onChange: (e) => I("description", e.target.value),
228
+ placeholder: "Optional description",
229
+ rows: 3,
230
+ className: "w-full px-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)] resize-none"
231
+ })]
232
+ }),
233
+ /* @__PURE__ */ m("div", {
234
+ className: "space-y-2",
235
+ children: [/* @__PURE__ */ p("label", {
236
+ htmlFor: "status",
262
237
  className: "block text-sm font-medium text-text-primary",
263
- children: "Maximum Total Uses"
264
- }),
265
- /* @__PURE__ */ p("input", {
266
- id: "maxTotalUses",
267
- type: "number",
268
- min: "1",
269
- value: D.maxTotalUses,
270
- onChange: (e) => F("maxTotalUses", e.target.value),
271
- placeholder: "Leave empty for unlimited",
272
- className: "w-full px-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)]"
273
- }),
274
- k.maxTotalUses && /* @__PURE__ */ p("p", {
275
- className: "text-sm text-status-error-text",
276
- children: k.maxTotalUses
277
- }),
278
- /* @__PURE__ */ m("p", {
279
- className: "text-sm text-text-muted",
238
+ children: "Status"
239
+ }), /* @__PURE__ */ m("select", {
240
+ id: "status",
241
+ value: O.status,
242
+ onChange: (e) => I("status", e.target.value),
243
+ className: "w-full 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)]",
280
244
  children: [
281
- "Current uses: ",
282
- R.currentUses,
283
- R.maxTotalUses ? ` / ${R.maxTotalUses}` : ""
245
+ /* @__PURE__ */ p("option", {
246
+ value: "ACTIVE",
247
+ children: "Active"
248
+ }),
249
+ /* @__PURE__ */ p("option", {
250
+ value: "INACTIVE",
251
+ children: "Inactive"
252
+ }),
253
+ /* @__PURE__ */ p("option", {
254
+ value: "EXPIRED",
255
+ children: "Expired"
256
+ }),
257
+ /* @__PURE__ */ p("option", {
258
+ value: "DEPLETED",
259
+ children: "Depleted"
260
+ })
284
261
  ]
285
- })
286
- ]
287
- }),
288
- /* @__PURE__ */ m("div", {
289
- className: "space-y-2",
290
- children: [
291
- /* @__PURE__ */ p("label", {
292
- htmlFor: "maxUsesPerUser",
293
- className: "block text-sm font-medium text-text-primary",
294
- children: "Maximum Uses Per User"
295
- }),
296
- /* @__PURE__ */ p("input", {
297
- id: "maxUsesPerUser",
298
- type: "number",
299
- min: "1",
300
- value: D.maxUsesPerUser,
301
- onChange: (e) => F("maxUsesPerUser", e.target.value),
302
- placeholder: "e.g., 1",
303
- className: "w-full px-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)]"
304
- }),
305
- k.maxUsesPerUser && /* @__PURE__ */ p("p", {
306
- className: "text-sm text-status-error-text",
307
- children: k.maxUsesPerUser
308
- })
309
- ]
310
- }),
311
- /* @__PURE__ */ m("div", {
312
- className: "space-y-2",
313
- children: [
314
- /* @__PURE__ */ p("label", {
315
- htmlFor: "validUntil",
316
- className: "block text-sm font-medium text-text-primary",
317
- children: "Valid Until"
318
- }),
319
- /* @__PURE__ */ p("input", {
320
- id: "validUntil",
321
- type: "date",
322
- value: D.validUntil,
323
- onChange: (e) => F("validUntil", e.target.value),
324
- className: "w-full 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)]"
325
- }),
326
- /* @__PURE__ */ p("p", {
327
- className: "text-sm text-text-muted",
328
- children: "Leave empty for no expiration"
329
- })
330
- ]
331
- })
332
- ]
333
- }),
334
- j && /* @__PURE__ */ m("div", {
335
- className: "flex items-start gap-3 p-4 rounded-lg bg-status-error-bg-subtle border border-status-error-border",
336
- children: [/* @__PURE__ */ p(l, { className: "size-5 text-status-error-text mt-0.5" }), /* @__PURE__ */ m("div", {
337
- className: "flex-1",
338
- children: [/* @__PURE__ */ p("p", {
339
- className: "text-sm font-medium text-status-error-text",
340
- children: "Error"
341
- }), /* @__PURE__ */ p("p", {
342
- className: "text-sm text-status-error-text/90 mt-1",
343
- children: j
262
+ })]
263
+ }),
264
+ /* @__PURE__ */ m("div", {
265
+ className: "space-y-2",
266
+ children: [
267
+ /* @__PURE__ */ p("label", {
268
+ htmlFor: "maxTotalUses",
269
+ className: "block text-sm font-medium text-text-primary",
270
+ children: "Maximum Total Uses"
271
+ }),
272
+ /* @__PURE__ */ p("input", {
273
+ id: "maxTotalUses",
274
+ type: "number",
275
+ min: "1",
276
+ value: O.maxTotalUses,
277
+ onChange: (e) => I("maxTotalUses", e.target.value),
278
+ placeholder: "Leave empty for unlimited",
279
+ className: "w-full px-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)]"
280
+ }),
281
+ A.maxTotalUses && /* @__PURE__ */ p("p", {
282
+ className: "text-sm text-status-error-text",
283
+ children: A.maxTotalUses
284
+ }),
285
+ /* @__PURE__ */ m("p", {
286
+ className: "text-sm text-text-muted",
287
+ children: [
288
+ "Current uses: ",
289
+ z.currentUses,
290
+ z.maxTotalUses ? ` / ${z.maxTotalUses}` : ""
291
+ ]
292
+ })
293
+ ]
294
+ }),
295
+ /* @__PURE__ */ m("div", {
296
+ className: "space-y-2",
297
+ children: [
298
+ /* @__PURE__ */ p("label", {
299
+ htmlFor: "maxUsesPerUser",
300
+ className: "block text-sm font-medium text-text-primary",
301
+ children: "Maximum Uses Per User"
302
+ }),
303
+ /* @__PURE__ */ p("input", {
304
+ id: "maxUsesPerUser",
305
+ type: "number",
306
+ min: "1",
307
+ value: O.maxUsesPerUser,
308
+ onChange: (e) => I("maxUsesPerUser", e.target.value),
309
+ placeholder: "e.g., 1",
310
+ className: "w-full px-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)]"
311
+ }),
312
+ A.maxUsesPerUser && /* @__PURE__ */ p("p", {
313
+ className: "text-sm text-status-error-text",
314
+ children: A.maxUsesPerUser
315
+ })
316
+ ]
317
+ }),
318
+ /* @__PURE__ */ m("div", {
319
+ className: "space-y-2",
320
+ children: [
321
+ /* @__PURE__ */ p("label", {
322
+ htmlFor: "validUntil",
323
+ className: "block text-sm font-medium text-text-primary",
324
+ children: "Valid Until"
325
+ }),
326
+ /* @__PURE__ */ p("input", {
327
+ id: "validUntil",
328
+ type: "date",
329
+ value: O.validUntil,
330
+ onChange: (e) => I("validUntil", e.target.value),
331
+ className: "w-full 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)]"
332
+ }),
333
+ /* @__PURE__ */ p("p", {
334
+ className: "text-sm text-text-muted",
335
+ children: "Leave empty for no expiration"
336
+ })
337
+ ]
338
+ })
339
+ ]
340
+ }),
341
+ M && /* @__PURE__ */ m("div", {
342
+ className: "flex items-start gap-3 p-4 rounded-lg bg-status-error-bg-subtle border border-status-error-border",
343
+ children: [/* @__PURE__ */ p(l, { className: "size-5 text-status-error-text mt-0.5" }), /* @__PURE__ */ m("div", {
344
+ className: "flex-1",
345
+ children: [/* @__PURE__ */ p("p", {
346
+ className: "text-sm font-medium text-status-error-text",
347
+ children: "Error"
348
+ }), /* @__PURE__ */ p("p", {
349
+ className: "text-sm text-status-error-text/90 mt-1",
350
+ children: M
351
+ })]
344
352
  })]
345
- })]
346
- }),
347
- N && /* @__PURE__ */ m("div", {
348
- className: "flex items-start gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-bg-subtle",
349
- children: [/* @__PURE__ */ p(d, { className: "size-5 text-status-success-text mt-0.5" }), /* @__PURE__ */ m("div", {
350
- className: "flex-1",
351
- children: [/* @__PURE__ */ p("p", {
352
- className: "text-sm font-medium text-status-success-text",
353
- children: "Success"
354
- }), /* @__PURE__ */ p("p", {
355
- className: "text-sm text-status-success-text/90 mt-1",
356
- children: "Coupon updated successfully! Redirecting…"
353
+ }),
354
+ P && /* @__PURE__ */ m("div", {
355
+ className: "flex items-start gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-bg-subtle",
356
+ children: [/* @__PURE__ */ p(d, { className: "size-5 text-status-success-text mt-0.5" }), /* @__PURE__ */ m("div", {
357
+ className: "flex-1",
358
+ children: [/* @__PURE__ */ p("p", {
359
+ className: "text-sm font-medium text-status-success-text",
360
+ children: "Success"
361
+ }), /* @__PURE__ */ p("p", {
362
+ className: "text-sm text-status-success-text/90 mt-1",
363
+ children: "Coupon updated successfully! Redirecting…"
364
+ })]
357
365
  })]
358
- })]
359
- }),
360
- /* @__PURE__ */ m("div", {
361
- className: "flex gap-4 pt-4 border-t border-border-subtle",
362
- children: [/* @__PURE__ */ m("button", {
363
- type: "submit",
364
- disabled: E || N,
365
- className: "px-6 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
366
- children: [/* @__PURE__ */ p(f, { className: "size-4" }), E ? "Updating..." : "Update Coupon"]
367
- }), /* @__PURE__ */ p("button", {
368
- type: "button",
369
- onClick: () => v("/coupons"),
370
- className: "px-6 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
371
- children: "Cancel"
372
- })]
373
- })
374
- ]
366
+ }),
367
+ /* @__PURE__ */ m("div", {
368
+ className: "flex gap-4 pt-4 border-t border-border-subtle",
369
+ children: [/* @__PURE__ */ m("button", {
370
+ type: "submit",
371
+ disabled: D || P,
372
+ className: "px-6 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
373
+ children: [/* @__PURE__ */ p(f, { className: "size-4" }), D ? "Updating..." : "Update Coupon"]
374
+ }), /* @__PURE__ */ p("button", {
375
+ type: "button",
376
+ onClick: () => y("/coupons"),
377
+ className: "px-6 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
378
+ children: "Cancel"
379
+ })]
380
+ })
381
+ ]
382
+ })
375
383
  })
376
- })]
384
+ ]
377
385
  });
378
386
  };
379
387
  //#endregion
380
- export { g as EditCouponPage };
388
+ export { _ as EditCouponPage };
381
389
 
382
390
  //# sourceMappingURL=EditCouponPage.js.map