@burdenoff/microfe-billing 2026.625.3 → 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/lib/native-purchases.js +2 -44
- 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
- package/dist/billing/lib/native-purchases.js.map +0 -1
|
@@ -2,19 +2,20 @@ import { AccessDenied as e } from "../../../shared/components/AccessDenied.js";
|
|
|
2
2
|
import "../../../shared/components/index.js";
|
|
3
3
|
import { formatCurrency as t, formatDate as n } from "../../../shared/utils/format.js";
|
|
4
4
|
import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions.js";
|
|
5
|
-
import { useCreateDiscountMutation as i, useDeleteDiscountMutation as a, useGetDiscountsQuery as o, useUpdateDiscountMutation as
|
|
6
|
-
import { nativeImpact as
|
|
5
|
+
import { useCreateDiscountMutation as i, useDeleteDiscountMutation as a, useGetDiscountsQuery as o, useUpdateDiscountMutation as ee } from "../../../../generated/global-operations.js";
|
|
6
|
+
import { nativeImpact as s, nativeNotify as c } from "../../../../utils/nativeBridge.js";
|
|
7
7
|
import { useMemo as l, useState as u } from "react";
|
|
8
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
-
import { useI18n as
|
|
9
|
+
import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
10
|
+
import { IllustratedEmptyState as p, PagePurpose as m } from "@burdenoff/fe-libs/ui";
|
|
10
11
|
//#region src/billing/modules/discounts/pages/DiscountsListPage.tsx
|
|
11
|
-
function
|
|
12
|
+
function h(e) {
|
|
12
13
|
return e.validUntil ? new Date(e.validUntil) < /* @__PURE__ */ new Date() : !1;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function g(e) {
|
|
15
16
|
return e.type === "PERCENTAGE" ? `${e.value}%` : t(e.value, e.currency ?? "USD");
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
+
var _ = {
|
|
18
19
|
code: "",
|
|
19
20
|
type: "PERCENTAGE",
|
|
20
21
|
value: "",
|
|
@@ -22,97 +23,97 @@ var g = {
|
|
|
22
23
|
maxUses: "",
|
|
23
24
|
validFrom: "",
|
|
24
25
|
validUntil: ""
|
|
25
|
-
},
|
|
26
|
-
let { t } =
|
|
26
|
+
}, v = () => {
|
|
27
|
+
let { t } = te(), n = (e, n) => {
|
|
27
28
|
let r = t(e);
|
|
28
29
|
return r === e ? n : r;
|
|
29
|
-
},
|
|
30
|
+
}, v = r(), { data: x, loading: S, error: C, refetch: w } = o(), [T, { loading: E }] = i(), [D, { loading: O }] = ee(), [k, { loading: A }] = a(), [j, ne] = u(""), [M, N] = u({ kind: "closed" }), [P, F] = u(_), [I, L] = u({
|
|
30
31
|
maxUses: "",
|
|
31
32
|
validUntil: ""
|
|
32
|
-
}), [
|
|
33
|
-
if (!
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
33
|
+
}), [R, z] = u(null), [B, V] = u(/* @__PURE__ */ new Set()), [H, U] = u(!1), W = x?.getDiscounts ?? [], G = W.filter((e) => j ? e.code.toLowerCase().includes(j.toLowerCase()) : !0), K = l(() => G.filter((e) => B.has(e.id)), [G, B]), q = G.length > 0 && G.every((e) => B.has(e.id)), J = G.some((e) => B.has(e.id)) && !q;
|
|
34
|
+
if (!v.canManageDiscounts) return /* @__PURE__ */ d(e, { message: "You don't have permission to manage discount codes." });
|
|
35
|
+
let Y = W.length, X = W.filter((e) => !h(e)).length, re = W.filter((e) => h(e)).length, Z = () => {
|
|
36
|
+
F(_), z(null), N({ kind: "create" });
|
|
37
|
+
}, ie = (e) => {
|
|
38
|
+
L({
|
|
38
39
|
maxUses: e.maxUses == null ? "" : String(e.maxUses),
|
|
39
40
|
validUntil: e.validUntil ? new Date(e.validUntil).toISOString().slice(0, 16) : ""
|
|
40
|
-
}),
|
|
41
|
+
}), z(null), N({
|
|
41
42
|
kind: "edit",
|
|
42
43
|
discount: e
|
|
43
44
|
});
|
|
44
|
-
},
|
|
45
|
-
|
|
45
|
+
}, ae = (e) => {
|
|
46
|
+
z(null), N({
|
|
46
47
|
kind: "delete",
|
|
47
48
|
discount: e
|
|
48
49
|
});
|
|
49
50
|
}, Q = () => {
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
if (e.preventDefault(),
|
|
53
|
-
|
|
51
|
+
N({ kind: "closed" }), z(null);
|
|
52
|
+
}, oe = async (e) => {
|
|
53
|
+
if (e.preventDefault(), z(null), !P.code.trim()) {
|
|
54
|
+
z("Discount code is required.");
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
let t = Number(
|
|
57
|
+
let t = Number(P.value);
|
|
57
58
|
if (Number.isNaN(t) || t <= 0) {
|
|
58
|
-
|
|
59
|
+
z("Value must be a positive number.");
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
if (
|
|
62
|
-
|
|
62
|
+
if (P.type === "PERCENTAGE" && t > 100) {
|
|
63
|
+
z("Percentage value cannot exceed 100.");
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
try {
|
|
66
|
-
await
|
|
67
|
-
code:
|
|
68
|
-
type:
|
|
67
|
+
await T({ variables: {
|
|
68
|
+
code: P.code.trim().toUpperCase(),
|
|
69
|
+
type: P.type,
|
|
69
70
|
value: t,
|
|
70
|
-
currency:
|
|
71
|
-
maxUses:
|
|
72
|
-
validFrom:
|
|
73
|
-
validUntil:
|
|
74
|
-
} }), await
|
|
71
|
+
currency: P.type === "FIXED" ? P.currency : null,
|
|
72
|
+
maxUses: P.maxUses ? Number(P.maxUses) : null,
|
|
73
|
+
validFrom: P.validFrom ? new Date(P.validFrom).toISOString() : null,
|
|
74
|
+
validUntil: P.validUntil ? new Date(P.validUntil).toISOString() : null
|
|
75
|
+
} }), await w(), Q();
|
|
75
76
|
} catch (e) {
|
|
76
|
-
|
|
77
|
+
z(e instanceof Error ? e.message : "Failed to create discount.");
|
|
77
78
|
}
|
|
78
|
-
},
|
|
79
|
-
if (e.preventDefault(),
|
|
80
|
-
|
|
79
|
+
}, se = async (e) => {
|
|
80
|
+
if (e.preventDefault(), M.kind === "edit") {
|
|
81
|
+
z(null);
|
|
81
82
|
try {
|
|
82
|
-
await
|
|
83
|
-
id:
|
|
84
|
-
maxUses:
|
|
85
|
-
validUntil:
|
|
86
|
-
} }), await
|
|
83
|
+
await D({ variables: {
|
|
84
|
+
id: M.discount.id,
|
|
85
|
+
maxUses: I.maxUses ? Number(I.maxUses) : null,
|
|
86
|
+
validUntil: I.validUntil ? new Date(I.validUntil).toISOString() : null
|
|
87
|
+
} }), await w(), Q();
|
|
87
88
|
} catch (e) {
|
|
88
|
-
|
|
89
|
+
z(e instanceof Error ? e.message : "Failed to update discount.");
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
},
|
|
92
|
-
if (
|
|
93
|
-
|
|
92
|
+
}, ce = async () => {
|
|
93
|
+
if (M.kind === "delete") {
|
|
94
|
+
z(null), s("medium");
|
|
94
95
|
try {
|
|
95
|
-
await
|
|
96
|
+
await k({ variables: { id: M.discount.id } }), c("success"), await w(), Q();
|
|
96
97
|
} catch (e) {
|
|
97
|
-
c("error"),
|
|
98
|
+
c("error"), z(e instanceof Error ? e.message : "Failed to delete discount.");
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
|
|
101
|
+
}, le = async () => {
|
|
102
|
+
K.length !== 0 && (z(null), U(!1), await Promise.allSettled(K.map((e) => k({ variables: { id: e.id } }))), await w(), V(/* @__PURE__ */ new Set()));
|
|
103
|
+
}, ue = (e, t) => {
|
|
104
|
+
V((n) => {
|
|
104
105
|
let r = new Set(n);
|
|
105
106
|
return t ? r.add(e) : r.delete(e), r;
|
|
106
|
-
}),
|
|
107
|
+
}), U(!1);
|
|
107
108
|
}, $ = (e) => {
|
|
108
|
-
|
|
109
|
+
V((t) => {
|
|
109
110
|
let n = new Set(t);
|
|
110
|
-
return
|
|
111
|
+
return G.forEach((t) => {
|
|
111
112
|
e ? n.add(t.id) : n.delete(t.id);
|
|
112
113
|
}), n;
|
|
113
|
-
}),
|
|
114
|
+
}), U(!1);
|
|
114
115
|
};
|
|
115
|
-
return
|
|
116
|
+
return S && W.length === 0 ? /* @__PURE__ */ f("div", {
|
|
116
117
|
className: "space-y-6 p-6",
|
|
117
118
|
children: [
|
|
118
119
|
/* @__PURE__ */ d("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }),
|
|
@@ -147,7 +148,7 @@ var g = {
|
|
|
147
148
|
}, e))
|
|
148
149
|
})
|
|
149
150
|
]
|
|
150
|
-
}) :
|
|
151
|
+
}) : C ? /* @__PURE__ */ d("div", {
|
|
151
152
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
152
153
|
children: /* @__PURE__ */ f("div", {
|
|
153
154
|
className: "text-center space-y-4",
|
|
@@ -173,11 +174,11 @@ var g = {
|
|
|
173
174
|
}),
|
|
174
175
|
/* @__PURE__ */ d("p", {
|
|
175
176
|
className: "text-sm text-text-muted",
|
|
176
|
-
children:
|
|
177
|
+
children: C.message
|
|
177
178
|
}),
|
|
178
179
|
/* @__PURE__ */ d("button", {
|
|
179
180
|
type: "button",
|
|
180
|
-
onClick: () =>
|
|
181
|
+
onClick: () => w(),
|
|
181
182
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
182
183
|
children: "Try Again"
|
|
183
184
|
})
|
|
@@ -188,13 +189,20 @@ var g = {
|
|
|
188
189
|
children: [
|
|
189
190
|
/* @__PURE__ */ f("div", {
|
|
190
191
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
191
|
-
children: [/* @__PURE__ */ f("div", { children: [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
children: [/* @__PURE__ */ f("div", { children: [
|
|
193
|
+
/* @__PURE__ */ d("h1", {
|
|
194
|
+
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
195
|
+
children: "Discount Codes"
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ d("p", {
|
|
198
|
+
className: "text-sm text-text-secondary mt-1",
|
|
199
|
+
children: "Create, view, and manage discount codes for billing"
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ d(m, {
|
|
202
|
+
className: "mt-3",
|
|
203
|
+
children: "Discount codes reduce the price of a purchase at checkout. Create codes here, set how much they take off and any limits, and manage which ones are active — separate from time-bounded promotions and customer-facing coupons."
|
|
204
|
+
})
|
|
205
|
+
] }), /* @__PURE__ */ f("button", {
|
|
198
206
|
type: "button",
|
|
199
207
|
onClick: Z,
|
|
200
208
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
@@ -222,7 +230,7 @@ var g = {
|
|
|
222
230
|
children: "Total Discounts"
|
|
223
231
|
}), /* @__PURE__ */ d("p", {
|
|
224
232
|
className: "text-2xl font-semibold text-text-primary tabular-nums mt-1",
|
|
225
|
-
children:
|
|
233
|
+
children: Y
|
|
226
234
|
})]
|
|
227
235
|
}),
|
|
228
236
|
/* @__PURE__ */ f("div", {
|
|
@@ -232,7 +240,7 @@ var g = {
|
|
|
232
240
|
children: "Active"
|
|
233
241
|
}), /* @__PURE__ */ d("p", {
|
|
234
242
|
className: "text-2xl font-semibold text-status-success-text tabular-nums mt-1",
|
|
235
|
-
children:
|
|
243
|
+
children: X
|
|
236
244
|
})]
|
|
237
245
|
}),
|
|
238
246
|
/* @__PURE__ */ f("div", {
|
|
@@ -242,7 +250,7 @@ var g = {
|
|
|
242
250
|
children: "Expired"
|
|
243
251
|
}), /* @__PURE__ */ d("p", {
|
|
244
252
|
className: "text-2xl font-semibold text-status-warning-text tabular-nums mt-1",
|
|
245
|
-
children:
|
|
253
|
+
children: re
|
|
246
254
|
})]
|
|
247
255
|
})
|
|
248
256
|
]
|
|
@@ -265,21 +273,21 @@ var g = {
|
|
|
265
273
|
}), /* @__PURE__ */ d("input", {
|
|
266
274
|
type: "text",
|
|
267
275
|
placeholder: "Search by discount code...",
|
|
268
|
-
value:
|
|
269
|
-
onChange: (e) =>
|
|
276
|
+
value: j,
|
|
277
|
+
onChange: (e) => ne(e.target.value),
|
|
270
278
|
className: "w-full pl-[3.25rem] pr-4 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent"
|
|
271
279
|
})]
|
|
272
280
|
})
|
|
273
281
|
}),
|
|
274
|
-
|
|
282
|
+
G.length > 0 && /* @__PURE__ */ f("div", {
|
|
275
283
|
className: "flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
|
|
276
284
|
children: [/* @__PURE__ */ f("label", {
|
|
277
285
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
278
286
|
children: [/* @__PURE__ */ d("input", {
|
|
279
287
|
type: "checkbox",
|
|
280
|
-
checked:
|
|
288
|
+
checked: q,
|
|
281
289
|
ref: (e) => {
|
|
282
|
-
e && (e.indeterminate =
|
|
290
|
+
e && (e.indeterminate = J && !q);
|
|
283
291
|
},
|
|
284
292
|
onChange: (e) => $(e.target.checked),
|
|
285
293
|
"aria-label": "Select all discounts",
|
|
@@ -290,27 +298,27 @@ var g = {
|
|
|
290
298
|
children: [
|
|
291
299
|
/* @__PURE__ */ f("span", {
|
|
292
300
|
className: "text-sm text-text-muted",
|
|
293
|
-
children: [
|
|
301
|
+
children: [B.size, " selected"]
|
|
294
302
|
}),
|
|
295
|
-
|
|
303
|
+
B.size > 0 && /* @__PURE__ */ d("button", {
|
|
296
304
|
type: "button",
|
|
297
305
|
onClick: () => {
|
|
298
|
-
|
|
306
|
+
V(/* @__PURE__ */ new Set()), U(!1);
|
|
299
307
|
},
|
|
300
308
|
className: "text-sm text-text-muted hover:text-text-primary",
|
|
301
309
|
children: "Clear selection"
|
|
302
310
|
}),
|
|
303
311
|
/* @__PURE__ */ f("button", {
|
|
304
312
|
type: "button",
|
|
305
|
-
onClick: () =>
|
|
306
|
-
disabled:
|
|
313
|
+
onClick: () => U(!0),
|
|
314
|
+
disabled: K.length === 0 || A,
|
|
307
315
|
className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-status-error-border text-status-error-text rounded-md hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50",
|
|
308
|
-
children: ["Delete Selected",
|
|
316
|
+
children: ["Delete Selected", K.length > 0 ? ` (${K.length})` : ""]
|
|
309
317
|
})
|
|
310
318
|
]
|
|
311
319
|
})]
|
|
312
320
|
}),
|
|
313
|
-
|
|
321
|
+
H && K.length > 0 && /* @__PURE__ */ d("div", {
|
|
314
322
|
className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4",
|
|
315
323
|
children: /* @__PURE__ */ f("div", {
|
|
316
324
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
|
|
@@ -318,9 +326,9 @@ var g = {
|
|
|
318
326
|
className: "text-sm font-medium text-text-primary",
|
|
319
327
|
children: [
|
|
320
328
|
"Delete ",
|
|
321
|
-
|
|
329
|
+
K.length,
|
|
322
330
|
" selected discount",
|
|
323
|
-
|
|
331
|
+
K.length === 1 ? "" : "s",
|
|
324
332
|
"?"
|
|
325
333
|
]
|
|
326
334
|
}), /* @__PURE__ */ d("p", {
|
|
@@ -330,52 +338,29 @@ var g = {
|
|
|
330
338
|
className: "flex items-center gap-2",
|
|
331
339
|
children: [/* @__PURE__ */ d("button", {
|
|
332
340
|
type: "button",
|
|
333
|
-
onClick: () =>
|
|
341
|
+
onClick: () => U(!1),
|
|
334
342
|
className: "px-3 py-2 text-sm font-medium text-text-muted hover:text-text-primary",
|
|
335
343
|
children: "Cancel"
|
|
336
344
|
}), /* @__PURE__ */ d("button", {
|
|
337
345
|
type: "button",
|
|
338
|
-
onClick:
|
|
339
|
-
disabled:
|
|
346
|
+
onClick: le,
|
|
347
|
+
disabled: A,
|
|
340
348
|
className: "inline-flex items-center gap-2 rounded-button bg-action-danger-bg px-3 py-2 text-sm font-medium text-action-danger-text hover:bg-action-danger-bgHover disabled:opacity-50",
|
|
341
349
|
children: "Confirm Delete"
|
|
342
350
|
})]
|
|
343
351
|
})]
|
|
344
352
|
})
|
|
345
353
|
}),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
children: /* @__PURE__ */ d("path", {
|
|
357
|
-
strokeLinecap: "round",
|
|
358
|
-
strokeLinejoin: "round",
|
|
359
|
-
strokeWidth: 2,
|
|
360
|
-
d: "M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z"
|
|
361
|
-
})
|
|
362
|
-
})
|
|
363
|
-
}),
|
|
364
|
-
/* @__PURE__ */ d("h3", {
|
|
365
|
-
className: "text-lg font-medium text-text-primary",
|
|
366
|
-
children: "No discount codes found"
|
|
367
|
-
}),
|
|
368
|
-
/* @__PURE__ */ d("p", {
|
|
369
|
-
className: "text-sm text-text-muted mt-1",
|
|
370
|
-
children: k ? "No discount codes match your search." : "Create your first discount code to get started."
|
|
371
|
-
}),
|
|
372
|
-
!k && /* @__PURE__ */ d("button", {
|
|
373
|
-
type: "button",
|
|
374
|
-
onClick: Z,
|
|
375
|
-
className: "mt-4 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
376
|
-
children: "Create your first discount"
|
|
377
|
-
})
|
|
378
|
-
]
|
|
354
|
+
G.length === 0 ? /* @__PURE__ */ d(p, {
|
|
355
|
+
illustration: j ? "empty-search" : "empty-data",
|
|
356
|
+
title: "No discount codes found",
|
|
357
|
+
description: j ? "No discount codes match your search." : "Create your first discount code to get started.",
|
|
358
|
+
action: j ? void 0 : /* @__PURE__ */ d("button", {
|
|
359
|
+
type: "button",
|
|
360
|
+
onClick: Z,
|
|
361
|
+
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
362
|
+
children: "Create your first discount"
|
|
363
|
+
})
|
|
379
364
|
}) : /* @__PURE__ */ d("div", {
|
|
380
365
|
className: "border border-border-seam rounded-card overflow-hidden shadow-[var(--shadow-elevation-1)]",
|
|
381
366
|
children: /* @__PURE__ */ d("div", {
|
|
@@ -389,9 +374,9 @@ var g = {
|
|
|
389
374
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted w-12",
|
|
390
375
|
children: /* @__PURE__ */ d("input", {
|
|
391
376
|
type: "checkbox",
|
|
392
|
-
checked:
|
|
377
|
+
checked: q,
|
|
393
378
|
ref: (e) => {
|
|
394
|
-
e && (e.indeterminate =
|
|
379
|
+
e && (e.indeterminate = J && !q);
|
|
395
380
|
},
|
|
396
381
|
onChange: (e) => $(e.target.checked),
|
|
397
382
|
"aria-label": "Select all discounts",
|
|
@@ -433,21 +418,21 @@ var g = {
|
|
|
433
418
|
] })
|
|
434
419
|
}), /* @__PURE__ */ d("tbody", {
|
|
435
420
|
className: "divide-y divide-border-subtle",
|
|
436
|
-
children:
|
|
421
|
+
children: G.map((e) => /* @__PURE__ */ d(y, {
|
|
437
422
|
discount: e,
|
|
438
|
-
selected:
|
|
439
|
-
onToggleSelect:
|
|
440
|
-
onEdit:
|
|
441
|
-
onDelete:
|
|
423
|
+
selected: B.has(e.id),
|
|
424
|
+
onToggleSelect: ue,
|
|
425
|
+
onEdit: ie,
|
|
426
|
+
onDelete: ae
|
|
442
427
|
}, e.id))
|
|
443
428
|
})]
|
|
444
429
|
})
|
|
445
430
|
})
|
|
446
431
|
}),
|
|
447
|
-
|
|
432
|
+
M.kind === "create" && /* @__PURE__ */ d(b, {
|
|
448
433
|
onClose: Q,
|
|
449
434
|
children: /* @__PURE__ */ f("form", {
|
|
450
|
-
onSubmit:
|
|
435
|
+
onSubmit: oe,
|
|
451
436
|
className: "space-y-4",
|
|
452
437
|
children: [
|
|
453
438
|
/* @__PURE__ */ f("div", {
|
|
@@ -473,9 +458,9 @@ var g = {
|
|
|
473
458
|
})
|
|
474
459
|
})]
|
|
475
460
|
}),
|
|
476
|
-
|
|
461
|
+
R && /* @__PURE__ */ d("div", {
|
|
477
462
|
className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
|
|
478
|
-
children:
|
|
463
|
+
children: R
|
|
479
464
|
}),
|
|
480
465
|
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
|
|
481
466
|
htmlFor: "create-code",
|
|
@@ -492,8 +477,8 @@ var g = {
|
|
|
492
477
|
id: "create-code",
|
|
493
478
|
type: "text",
|
|
494
479
|
required: !0,
|
|
495
|
-
value:
|
|
496
|
-
onChange: (e) =>
|
|
480
|
+
value: P.code,
|
|
481
|
+
onChange: (e) => F((t) => ({
|
|
497
482
|
...t,
|
|
498
483
|
code: e.target.value
|
|
499
484
|
})),
|
|
@@ -515,8 +500,8 @@ var g = {
|
|
|
515
500
|
]
|
|
516
501
|
}), /* @__PURE__ */ f("select", {
|
|
517
502
|
id: "create-type",
|
|
518
|
-
value:
|
|
519
|
-
onChange: (e) =>
|
|
503
|
+
value: P.type,
|
|
504
|
+
onChange: (e) => F((t) => ({
|
|
520
505
|
...t,
|
|
521
506
|
type: e.target.value
|
|
522
507
|
})),
|
|
@@ -546,29 +531,29 @@ var g = {
|
|
|
546
531
|
type: "number",
|
|
547
532
|
required: !0,
|
|
548
533
|
min: "0.01",
|
|
549
|
-
max:
|
|
534
|
+
max: P.type === "PERCENTAGE" ? "100" : void 0,
|
|
550
535
|
step: "0.01",
|
|
551
|
-
value:
|
|
552
|
-
onChange: (e) =>
|
|
536
|
+
value: P.value,
|
|
537
|
+
onChange: (e) => F((t) => ({
|
|
553
538
|
...t,
|
|
554
539
|
value: e.target.value
|
|
555
540
|
})),
|
|
556
|
-
placeholder:
|
|
541
|
+
placeholder: P.type === "PERCENTAGE" ? "10" : "25.00",
|
|
557
542
|
className: "w-full px-3 py-2 pr-8 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent"
|
|
558
543
|
}), /* @__PURE__ */ d("span", {
|
|
559
544
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-text-muted",
|
|
560
|
-
children:
|
|
545
|
+
children: P.type === "PERCENTAGE" ? "%" : P.currency
|
|
561
546
|
})]
|
|
562
547
|
})] })]
|
|
563
548
|
}),
|
|
564
|
-
|
|
549
|
+
P.type === "FIXED" && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
565
550
|
htmlFor: "create-currency",
|
|
566
551
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
567
552
|
children: n("billing.discounts.currency", "Currency")
|
|
568
553
|
}), /* @__PURE__ */ f("select", {
|
|
569
554
|
id: "create-currency",
|
|
570
|
-
value:
|
|
571
|
-
onChange: (e) =>
|
|
555
|
+
value: P.currency,
|
|
556
|
+
onChange: (e) => F((t) => ({
|
|
572
557
|
...t,
|
|
573
558
|
currency: e.target.value
|
|
574
559
|
})),
|
|
@@ -611,8 +596,8 @@ var g = {
|
|
|
611
596
|
type: "number",
|
|
612
597
|
min: "1",
|
|
613
598
|
step: "1",
|
|
614
|
-
value:
|
|
615
|
-
onChange: (e) =>
|
|
599
|
+
value: P.maxUses,
|
|
600
|
+
onChange: (e) => F((t) => ({
|
|
616
601
|
...t,
|
|
617
602
|
maxUses: e.target.value
|
|
618
603
|
})),
|
|
@@ -633,8 +618,8 @@ var g = {
|
|
|
633
618
|
}), /* @__PURE__ */ d("input", {
|
|
634
619
|
id: "create-valid-from",
|
|
635
620
|
type: "datetime-local",
|
|
636
|
-
value:
|
|
637
|
-
onChange: (e) =>
|
|
621
|
+
value: P.validFrom,
|
|
622
|
+
onChange: (e) => F((t) => ({
|
|
638
623
|
...t,
|
|
639
624
|
validFrom: e.target.value
|
|
640
625
|
})),
|
|
@@ -646,8 +631,8 @@ var g = {
|
|
|
646
631
|
}), /* @__PURE__ */ d("input", {
|
|
647
632
|
id: "create-valid-until",
|
|
648
633
|
type: "datetime-local",
|
|
649
|
-
value:
|
|
650
|
-
onChange: (e) =>
|
|
634
|
+
value: P.validUntil,
|
|
635
|
+
onChange: (e) => F((t) => ({
|
|
651
636
|
...t,
|
|
652
637
|
validUntil: e.target.value
|
|
653
638
|
})),
|
|
@@ -663,18 +648,18 @@ var g = {
|
|
|
663
648
|
children: n("billing.discounts.cancel", "Cancel")
|
|
664
649
|
}), /* @__PURE__ */ d("button", {
|
|
665
650
|
type: "submit",
|
|
666
|
-
disabled:
|
|
651
|
+
disabled: E,
|
|
667
652
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
668
|
-
children:
|
|
653
|
+
children: E ? n("billing.discounts.creating", "Creating...") : n("billing.discounts.createDiscount", "Create Discount")
|
|
669
654
|
})]
|
|
670
655
|
})
|
|
671
656
|
]
|
|
672
657
|
})
|
|
673
658
|
}),
|
|
674
|
-
|
|
659
|
+
M.kind === "edit" && /* @__PURE__ */ d(b, {
|
|
675
660
|
onClose: Q,
|
|
676
661
|
children: /* @__PURE__ */ f("form", {
|
|
677
|
-
onSubmit:
|
|
662
|
+
onSubmit: se,
|
|
678
663
|
className: "space-y-4",
|
|
679
664
|
children: [
|
|
680
665
|
/* @__PURE__ */ f("div", {
|
|
@@ -700,9 +685,9 @@ var g = {
|
|
|
700
685
|
})
|
|
701
686
|
})]
|
|
702
687
|
}),
|
|
703
|
-
|
|
688
|
+
R && /* @__PURE__ */ d("div", {
|
|
704
689
|
className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
|
|
705
|
-
children:
|
|
690
|
+
children: R
|
|
706
691
|
}),
|
|
707
692
|
/* @__PURE__ */ f("div", {
|
|
708
693
|
className: "p-3 bg-bg-sunken/50 border border-border-subtle rounded-md space-y-1",
|
|
@@ -714,7 +699,7 @@ var g = {
|
|
|
714
699
|
children: "Code"
|
|
715
700
|
}), /* @__PURE__ */ d("span", {
|
|
716
701
|
className: "font-mono font-medium text-text-primary",
|
|
717
|
-
children:
|
|
702
|
+
children: M.discount.code
|
|
718
703
|
})]
|
|
719
704
|
}),
|
|
720
705
|
/* @__PURE__ */ f("div", {
|
|
@@ -724,7 +709,7 @@ var g = {
|
|
|
724
709
|
children: "Type"
|
|
725
710
|
}), /* @__PURE__ */ d("span", {
|
|
726
711
|
className: "text-text-primary",
|
|
727
|
-
children:
|
|
712
|
+
children: M.discount.type === "PERCENTAGE" ? "Percentage" : "Fixed Amount"
|
|
728
713
|
})]
|
|
729
714
|
}),
|
|
730
715
|
/* @__PURE__ */ f("div", {
|
|
@@ -734,7 +719,7 @@ var g = {
|
|
|
734
719
|
children: "Value"
|
|
735
720
|
}), /* @__PURE__ */ d("span", {
|
|
736
721
|
className: "text-text-primary",
|
|
737
|
-
children:
|
|
722
|
+
children: g(M.discount)
|
|
738
723
|
})]
|
|
739
724
|
}),
|
|
740
725
|
/* @__PURE__ */ f("div", {
|
|
@@ -744,7 +729,7 @@ var g = {
|
|
|
744
729
|
children: "Used"
|
|
745
730
|
}), /* @__PURE__ */ f("span", {
|
|
746
731
|
className: "text-text-primary",
|
|
747
|
-
children: [
|
|
732
|
+
children: [M.discount.usedCount, " times"]
|
|
748
733
|
})]
|
|
749
734
|
})
|
|
750
735
|
]
|
|
@@ -760,8 +745,8 @@ var g = {
|
|
|
760
745
|
type: "number",
|
|
761
746
|
min: "1",
|
|
762
747
|
step: "1",
|
|
763
|
-
value:
|
|
764
|
-
onChange: (e) =>
|
|
748
|
+
value: I.maxUses,
|
|
749
|
+
onChange: (e) => L((t) => ({
|
|
765
750
|
...t,
|
|
766
751
|
maxUses: e.target.value
|
|
767
752
|
})),
|
|
@@ -780,8 +765,8 @@ var g = {
|
|
|
780
765
|
}), /* @__PURE__ */ d("input", {
|
|
781
766
|
id: "edit-valid-until",
|
|
782
767
|
type: "datetime-local",
|
|
783
|
-
value:
|
|
784
|
-
onChange: (e) =>
|
|
768
|
+
value: I.validUntil,
|
|
769
|
+
onChange: (e) => L((t) => ({
|
|
785
770
|
...t,
|
|
786
771
|
validUntil: e.target.value
|
|
787
772
|
})),
|
|
@@ -796,15 +781,15 @@ var g = {
|
|
|
796
781
|
children: "Cancel"
|
|
797
782
|
}), /* @__PURE__ */ d("button", {
|
|
798
783
|
type: "submit",
|
|
799
|
-
disabled:
|
|
784
|
+
disabled: O,
|
|
800
785
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
801
|
-
children:
|
|
786
|
+
children: O ? "Saving..." : "Save Changes"
|
|
802
787
|
})]
|
|
803
788
|
})
|
|
804
789
|
]
|
|
805
790
|
})
|
|
806
791
|
}),
|
|
807
|
-
|
|
792
|
+
M.kind === "delete" && /* @__PURE__ */ d(b, {
|
|
808
793
|
onClose: Q,
|
|
809
794
|
children: /* @__PURE__ */ f("div", {
|
|
810
795
|
className: "space-y-4",
|
|
@@ -832,9 +817,9 @@ var g = {
|
|
|
832
817
|
})
|
|
833
818
|
})]
|
|
834
819
|
}),
|
|
835
|
-
|
|
820
|
+
R && /* @__PURE__ */ d("div", {
|
|
836
821
|
className: "p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md",
|
|
837
|
-
children:
|
|
822
|
+
children: R
|
|
838
823
|
}),
|
|
839
824
|
/* @__PURE__ */ f("div", {
|
|
840
825
|
className: "flex items-start gap-3",
|
|
@@ -859,7 +844,7 @@ var g = {
|
|
|
859
844
|
" ",
|
|
860
845
|
/* @__PURE__ */ d("span", {
|
|
861
846
|
className: "font-mono font-semibold",
|
|
862
|
-
children:
|
|
847
|
+
children: M.discount.code
|
|
863
848
|
}),
|
|
864
849
|
"?"
|
|
865
850
|
]
|
|
@@ -870,10 +855,10 @@ var g = {
|
|
|
870
855
|
" ",
|
|
871
856
|
/* @__PURE__ */ d("span", {
|
|
872
857
|
className: "font-medium",
|
|
873
|
-
children:
|
|
858
|
+
children: M.discount.usedCount
|
|
874
859
|
}),
|
|
875
860
|
" time",
|
|
876
|
-
|
|
861
|
+
M.discount.usedCount === 1 ? "" : "s",
|
|
877
862
|
"."
|
|
878
863
|
]
|
|
879
864
|
})] })]
|
|
@@ -887,10 +872,10 @@ var g = {
|
|
|
887
872
|
children: "Cancel"
|
|
888
873
|
}), /* @__PURE__ */ d("button", {
|
|
889
874
|
type: "button",
|
|
890
|
-
onClick:
|
|
891
|
-
disabled:
|
|
875
|
+
onClick: ce,
|
|
876
|
+
disabled: A,
|
|
892
877
|
className: "px-4 py-2 text-sm font-medium bg-action-danger-bg text-action-danger-text rounded-button hover:bg-action-danger-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
893
|
-
children:
|
|
878
|
+
children: A ? "Deleting..." : "Delete Discount"
|
|
894
879
|
})]
|
|
895
880
|
})
|
|
896
881
|
]
|
|
@@ -898,8 +883,8 @@ var g = {
|
|
|
898
883
|
})
|
|
899
884
|
]
|
|
900
885
|
});
|
|
901
|
-
},
|
|
902
|
-
let o =
|
|
886
|
+
}, y = ({ discount: e, selected: t, onToggleSelect: r, onEdit: i, onDelete: a }) => {
|
|
887
|
+
let o = h(e);
|
|
903
888
|
return /* @__PURE__ */ f("tr", {
|
|
904
889
|
className: `hover:bg-bg-sunken/30 transition-colors ${t ? "bg-bg-sunken/20" : ""}`,
|
|
905
890
|
children: [
|
|
@@ -931,7 +916,7 @@ var g = {
|
|
|
931
916
|
className: "p-4",
|
|
932
917
|
children: /* @__PURE__ */ d("span", {
|
|
933
918
|
className: "text-sm font-medium text-text-primary",
|
|
934
|
-
children:
|
|
919
|
+
children: g(e)
|
|
935
920
|
})
|
|
936
921
|
}),
|
|
937
922
|
/* @__PURE__ */ d("td", {
|
|
@@ -1002,7 +987,7 @@ var g = {
|
|
|
1002
987
|
})
|
|
1003
988
|
]
|
|
1004
989
|
});
|
|
1005
|
-
},
|
|
990
|
+
}, b = ({ onClose: e, children: t }) => /* @__PURE__ */ f("div", {
|
|
1006
991
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
1007
992
|
children: [/* @__PURE__ */ d("div", {
|
|
1008
993
|
className: "absolute inset-0 bg-bg-overlay",
|
|
@@ -1013,6 +998,6 @@ var g = {
|
|
|
1013
998
|
})]
|
|
1014
999
|
});
|
|
1015
1000
|
//#endregion
|
|
1016
|
-
export {
|
|
1001
|
+
export { v as DiscountsListPage };
|
|
1017
1002
|
|
|
1018
1003
|
//# sourceMappingURL=DiscountsListPage.js.map
|