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