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