@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.
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- 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
|
|
14
|
-
let { t:
|
|
15
|
-
let n =
|
|
14
|
+
var _ = () => {
|
|
15
|
+
let { t: _ } = h(), v = (e, t) => {
|
|
16
|
+
let n = _(e);
|
|
16
17
|
return n === e ? t : n;
|
|
17
|
-
},
|
|
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
|
-
}), [
|
|
25
|
+
}), [A, j] = c({}), [M, N] = c(""), [P, F] = c(!1);
|
|
25
26
|
if (s(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
if (
|
|
29
|
-
let e =
|
|
30
|
-
|
|
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
|
-
}, [
|
|
40
|
-
let
|
|
41
|
-
|
|
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
|
-
})),
|
|
45
|
+
})), A[e] && j((t) => ({
|
|
45
46
|
...t,
|
|
46
47
|
[e]: ""
|
|
47
48
|
}));
|
|
48
|
-
},
|
|
49
|
+
}, L = () => {
|
|
49
50
|
let e = {};
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
-
if (e.preventDefault(),
|
|
53
|
-
if (!
|
|
54
|
-
|
|
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
|
-
|
|
60
|
-
id:
|
|
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
|
-
} }),
|
|
63
|
-
|
|
63
|
+
} }), F(!0), setTimeout(() => {
|
|
64
|
+
y("/coupons");
|
|
64
65
|
}, 1500);
|
|
65
66
|
} catch (e) {
|
|
66
|
-
console.error("Failed to update coupon:", e),
|
|
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 (
|
|
71
|
+
if (w) return /* @__PURE__ */ m("div", {
|
|
71
72
|
className: "p-8",
|
|
72
73
|
children: [/* @__PURE__ */ p(t, {
|
|
73
|
-
title:
|
|
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: () =>
|
|
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 (
|
|
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: () =>
|
|
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:
|
|
105
|
+
children: T ? `Error: ${T.message}` : "Coupon not found"
|
|
105
106
|
})
|
|
106
107
|
})]
|
|
107
108
|
});
|
|
108
|
-
let
|
|
109
|
+
let z = C.getCoupon;
|
|
109
110
|
return /* @__PURE__ */ m("div", {
|
|
110
111
|
className: "p-8",
|
|
111
|
-
children: [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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("
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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__ */
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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("
|
|
247
|
-
|
|
248
|
-
|
|
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("
|
|
251
|
-
|
|
252
|
-
children:
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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: "
|
|
264
|
-
}),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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 {
|
|
388
|
+
export { _ as EditCouponPage };
|
|
381
389
|
|
|
382
390
|
//# sourceMappingURL=EditCouponPage.js.map
|