@burdenoff/microfe-billing 2026.625.4 → 2026.626.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,8 +8,9 @@ import { useRef as a, useState as o } from "react";
|
|
|
8
8
|
import { ArrowLeft as s, Package as c, Percent as l, Save as u, Tag as d, Users as f, X as p } from "lucide-react";
|
|
9
9
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
10
|
import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { PagePurpose as v } from "@burdenoff/fe-libs/ui";
|
|
11
12
|
//#region src/billing/modules/coupons/pages/CreateCouponPage.tsx
|
|
12
|
-
var
|
|
13
|
+
var y = [
|
|
13
14
|
{
|
|
14
15
|
code: "USD",
|
|
15
16
|
symbol: "$",
|
|
@@ -85,11 +86,11 @@ var v = [
|
|
|
85
86
|
symbol: "₩",
|
|
86
87
|
name: "South Korean Won"
|
|
87
88
|
}
|
|
88
|
-
],
|
|
89
|
-
let { t:
|
|
90
|
-
let n =
|
|
89
|
+
], b = () => {
|
|
90
|
+
let { t: b } = _(), x = (e, t) => {
|
|
91
|
+
let n = b(e);
|
|
91
92
|
return n === e ? t : n;
|
|
92
|
-
},
|
|
93
|
+
}, S = i(), C = n(), [w, T] = o(""), E = a(null), [D, O] = o({
|
|
93
94
|
code: "",
|
|
94
95
|
name: "",
|
|
95
96
|
description: "",
|
|
@@ -107,493 +108,497 @@ var v = [
|
|
|
107
108
|
applicableProducts: [],
|
|
108
109
|
applicableServices: [],
|
|
109
110
|
campaignName: ""
|
|
110
|
-
}), [
|
|
111
|
-
if (!
|
|
112
|
-
let
|
|
113
|
-
|
|
111
|
+
}), [k, A] = o({}), [j, M] = o(!1), N = y.find((e) => e.code === D.currency)?.symbol ?? D.currency, [P] = r({ refetchQueries: ["ListCoupons"] });
|
|
112
|
+
if (!C.canManageDiscounts) return /* @__PURE__ */ h(e, { message: "You don't have permission to create coupons." });
|
|
113
|
+
let F = (e, t) => {
|
|
114
|
+
O((n) => ({
|
|
114
115
|
...n,
|
|
115
116
|
[e]: t
|
|
116
|
-
})),
|
|
117
|
+
})), k[e] && A((t) => {
|
|
117
118
|
let n = { ...t };
|
|
118
119
|
return delete n[e], n;
|
|
119
120
|
});
|
|
120
|
-
},
|
|
121
|
+
}, I = () => {
|
|
121
122
|
let e = {};
|
|
122
|
-
return
|
|
123
|
-
}, I = (e) => {
|
|
124
|
-
let t = e.trim();
|
|
125
|
-
t && (E.restrictedToUserIds.includes(t) || P("restrictedToUserIds", [...E.restrictedToUserIds, t]), w(""));
|
|
123
|
+
return D.code.trim() ? /^[A-Z0-9-_]+$/.test(D.code) ? D.code.length < 3 ? e.code = "Code must be at least 3 characters" : D.code.length > 50 && (e.code = "Code must be at most 50 characters") : e.code = "Code must contain only uppercase letters, numbers, hyphens, and underscores" : e.code = "Coupon code is required", D.name.trim() || (e.name = "Coupon name is required"), D.value <= 0 && (e.value = "Value must be greater than 0"), D.type === "PERCENTAGE" && D.value > 100 && (e.value = "Percentage cannot exceed 100%"), D.scope === "USER_SPECIFIC" && D.restrictedToUserIds.length === 0 && (e.restrictedToUserIds = "Add at least one user email or ID"), D.validFrom || (e.validFrom = "Start date is required"), D.validUntil && D.validUntil < D.validFrom && (e.validUntil = "End date must be after start date"), A(e), Object.keys(e).length === 0;
|
|
126
124
|
}, L = (e) => {
|
|
127
|
-
|
|
125
|
+
let t = e.trim();
|
|
126
|
+
t && (D.restrictedToUserIds.includes(t) || F("restrictedToUserIds", [...D.restrictedToUserIds, t]), T(""));
|
|
127
|
+
}, R = (e) => {
|
|
128
|
+
F("restrictedToUserIds", D.restrictedToUserIds.filter((t) => t !== e));
|
|
128
129
|
};
|
|
129
130
|
return /* @__PURE__ */ g("div", {
|
|
130
131
|
className: "max-w-4xl mx-auto p-4 sm:p-6 space-y-6",
|
|
131
|
-
children: [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ g("div", {
|
|
134
|
+
className: "flex items-center gap-4",
|
|
135
|
+
children: [/* @__PURE__ */ h("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
onClick: () => S("/coupons"),
|
|
138
|
+
className: "p-2 rounded-lg hover:bg-bg-sunken text-text-muted hover:text-text-primary",
|
|
139
|
+
children: /* @__PURE__ */ h(s, { className: "size-5" })
|
|
140
|
+
}), /* @__PURE__ */ h(t, {
|
|
141
|
+
title: x("billing.coupons.createTitle", "Create Coupon"),
|
|
142
|
+
description: "Create a new discount code or promotional offer",
|
|
143
|
+
icon: /* @__PURE__ */ h(d, { className: "size-6" })
|
|
144
|
+
})]
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ h(v, { children: x("billing.coupons.createPurpose", "Define a new discount code customers can redeem at checkout. Choose whether it takes a percentage or fixed amount off, set any usage limit and expiry, and pick which products it applies to.") }),
|
|
147
|
+
/* @__PURE__ */ g("form", {
|
|
148
|
+
onSubmit: async (e) => {
|
|
149
|
+
if (e.preventDefault(), I()) {
|
|
150
|
+
M(!0);
|
|
151
|
+
try {
|
|
152
|
+
if ((await P({ variables: { input: {
|
|
153
|
+
code: D.code,
|
|
154
|
+
name: D.name,
|
|
155
|
+
description: D.description,
|
|
156
|
+
scope: D.scope,
|
|
157
|
+
type: D.type,
|
|
158
|
+
value: D.value,
|
|
159
|
+
currency: D.currency,
|
|
160
|
+
minPurchaseAmount: D.minPurchaseAmount,
|
|
161
|
+
maxDiscountAmount: D.maxDiscountAmount,
|
|
162
|
+
maxTotalUses: D.maxTotalUses,
|
|
163
|
+
maxUsesPerUser: D.maxUsesPerUser,
|
|
164
|
+
validFrom: new Date(D.validFrom).toISOString(),
|
|
165
|
+
validUntil: D.validUntil ? new Date(D.validUntil).toISOString() : void 0,
|
|
166
|
+
restrictedToUserIds: D.restrictedToUserIds,
|
|
167
|
+
applicableProducts: D.applicableProducts,
|
|
168
|
+
applicableServices: D.applicableServices,
|
|
169
|
+
excludedProducts: [],
|
|
170
|
+
excludedServices: [],
|
|
171
|
+
campaignName: D.campaignName || void 0
|
|
172
|
+
} } })).data?.createCoupon) S("/coupons");
|
|
173
|
+
else throw Error("Failed to create coupon");
|
|
174
|
+
} catch (e) {
|
|
175
|
+
console.error("Error creating coupon:", e), A({ code: e instanceof Error ? e.message : "Failed to create coupon. Please try again." });
|
|
176
|
+
} finally {
|
|
177
|
+
M(!1);
|
|
178
|
+
}
|
|
174
179
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
children: "Basic Information"
|
|
185
|
-
}),
|
|
186
|
-
/* @__PURE__ */ g("div", { children: [
|
|
187
|
-
/* @__PURE__ */ h("label", {
|
|
188
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
189
|
-
children: "Coupon Code *"
|
|
190
|
-
}),
|
|
191
|
-
/* @__PURE__ */ h("input", {
|
|
192
|
-
type: "text",
|
|
193
|
-
value: E.code,
|
|
194
|
-
onChange: (e) => P("code", e.target.value.toUpperCase()),
|
|
195
|
-
placeholder: "e.g., WELCOME20",
|
|
196
|
-
className: `w-full px-4 py-2 rounded-input border ${O.code ? "border-status-error-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)]`
|
|
197
|
-
}),
|
|
198
|
-
O.code && /* @__PURE__ */ h("p", {
|
|
199
|
-
className: "text-sm text-status-error-text mt-1",
|
|
200
|
-
children: O.code
|
|
180
|
+
},
|
|
181
|
+
className: "space-y-6",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ g("div", {
|
|
184
|
+
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ h("h3", {
|
|
187
|
+
className: "text-lg font-semibold text-text-primary",
|
|
188
|
+
children: "Basic Information"
|
|
201
189
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
children: "Discount Configuration"
|
|
242
|
-
}),
|
|
243
|
-
/* @__PURE__ */ g("div", { children: [
|
|
244
|
-
/* @__PURE__ */ h("label", {
|
|
190
|
+
/* @__PURE__ */ g("div", { children: [
|
|
191
|
+
/* @__PURE__ */ h("label", {
|
|
192
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
193
|
+
children: "Coupon Code *"
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ h("input", {
|
|
196
|
+
type: "text",
|
|
197
|
+
value: D.code,
|
|
198
|
+
onChange: (e) => F("code", e.target.value.toUpperCase()),
|
|
199
|
+
placeholder: "e.g., WELCOME20",
|
|
200
|
+
className: `w-full px-4 py-2 rounded-input border ${k.code ? "border-status-error-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)]`
|
|
201
|
+
}),
|
|
202
|
+
k.code && /* @__PURE__ */ h("p", {
|
|
203
|
+
className: "text-sm text-status-error-text mt-1",
|
|
204
|
+
children: k.code
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ h("p", {
|
|
207
|
+
className: "text-xs text-text-muted mt-1",
|
|
208
|
+
children: "Use uppercase letters, numbers, hyphens, and underscores"
|
|
209
|
+
})
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ g("div", { children: [
|
|
212
|
+
/* @__PURE__ */ h("label", {
|
|
213
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
214
|
+
children: "Display Name *"
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ h("input", {
|
|
217
|
+
type: "text",
|
|
218
|
+
value: D.name,
|
|
219
|
+
onChange: (e) => F("name", e.target.value),
|
|
220
|
+
placeholder: "e.g., Welcome 20% Off",
|
|
221
|
+
className: `w-full px-4 py-2 rounded-input border ${k.name ? "border-status-error-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)]`
|
|
222
|
+
}),
|
|
223
|
+
k.name && /* @__PURE__ */ h("p", {
|
|
224
|
+
className: "text-sm text-status-error-text mt-1",
|
|
225
|
+
children: k.name
|
|
226
|
+
})
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
245
229
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
246
|
-
children: "
|
|
230
|
+
children: "Description"
|
|
231
|
+
}), /* @__PURE__ */ h("textarea", {
|
|
232
|
+
value: D.description,
|
|
233
|
+
onChange: (e) => F("description", e.target.value),
|
|
234
|
+
placeholder: "Optional description for internal use",
|
|
235
|
+
rows: 3,
|
|
236
|
+
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
237
|
+
})] })
|
|
238
|
+
]
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ g("div", {
|
|
241
|
+
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ h("h3", {
|
|
244
|
+
className: "text-lg font-semibold text-text-primary",
|
|
245
|
+
children: "Discount Configuration"
|
|
247
246
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
/* @__PURE__ */ g("div", { children: [
|
|
248
|
+
/* @__PURE__ */ h("label", {
|
|
249
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
250
|
+
children: "Coupon Currency *"
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ h("select", {
|
|
253
|
+
value: D.currency,
|
|
254
|
+
onChange: (e) => F("currency", e.target.value),
|
|
255
|
+
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
256
|
+
children: y.map(({ code: e, symbol: t, name: n }) => /* @__PURE__ */ g("option", {
|
|
257
|
+
value: e,
|
|
258
|
+
children: [
|
|
259
|
+
t,
|
|
260
|
+
" ",
|
|
261
|
+
e,
|
|
262
|
+
" — ",
|
|
263
|
+
n
|
|
264
|
+
]
|
|
265
|
+
}, e))
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ h("p", {
|
|
268
|
+
className: "text-xs text-text-muted mt-1",
|
|
269
|
+
children: "Amounts below are in this currency. Users paying in a different currency (e.g. INR) will have the amounts automatically converted using live exchange rates at validation time."
|
|
270
|
+
})
|
|
271
|
+
] }),
|
|
272
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
273
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
274
|
+
children: "Discount Type *"
|
|
275
|
+
}), /* @__PURE__ */ h("div", {
|
|
276
|
+
className: "grid grid-cols-3 gap-3",
|
|
277
|
+
children: [
|
|
278
|
+
{
|
|
279
|
+
value: "PERCENTAGE",
|
|
280
|
+
label: "Percentage",
|
|
281
|
+
icon: l
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
value: "FIXED_AMOUNT",
|
|
285
|
+
label: `Fixed (${N})`,
|
|
286
|
+
icon: null
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
value: "FREE_SHIPPING",
|
|
290
|
+
label: "Free Shipping",
|
|
291
|
+
icon: c
|
|
292
|
+
}
|
|
293
|
+
].map(({ value: e, label: t, icon: n }) => /* @__PURE__ */ g("button", {
|
|
294
|
+
type: "button",
|
|
295
|
+
onClick: () => F("type", e),
|
|
296
|
+
className: `p-4 rounded-lg border-2 transition-colors ${D.type === e ? "border-action-primary-bg bg-[var(--color-accent-soft)]" : "border-border-subtle hover:border-action-primary-bg/50"}`,
|
|
297
|
+
children: [n ? /* @__PURE__ */ h(n, { className: "size-5 mx-auto mb-2" }) : /* @__PURE__ */ h("span", {
|
|
298
|
+
className: "block text-lg font-bold mb-2",
|
|
299
|
+
children: N
|
|
300
|
+
}), /* @__PURE__ */ h("p", {
|
|
301
|
+
className: "text-sm font-medium",
|
|
302
|
+
children: t
|
|
303
|
+
})]
|
|
304
|
+
}, e))
|
|
305
|
+
})] }),
|
|
306
|
+
/* @__PURE__ */ g("div", { children: [
|
|
307
|
+
/* @__PURE__ */ h("label", {
|
|
308
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
309
|
+
children: "Discount Value *"
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ h("div", {
|
|
312
|
+
className: "relative",
|
|
313
|
+
children: D.type === "PERCENTAGE" ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(l, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted" }), /* @__PURE__ */ h("input", {
|
|
314
|
+
type: "number",
|
|
315
|
+
value: D.value,
|
|
316
|
+
onChange: (e) => F("value", parseFloat(e.target.value)),
|
|
317
|
+
min: "0",
|
|
318
|
+
max: "100",
|
|
319
|
+
step: "0.01",
|
|
320
|
+
className: `w-full pl-10 pr-4 py-2 rounded-input border ${k.value ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
321
|
+
})] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
322
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
323
|
+
children: N
|
|
324
|
+
}), /* @__PURE__ */ h("input", {
|
|
325
|
+
type: "number",
|
|
326
|
+
value: D.value,
|
|
327
|
+
onChange: (e) => F("value", parseFloat(e.target.value)),
|
|
328
|
+
min: "0",
|
|
329
|
+
step: "0.01",
|
|
330
|
+
className: `w-full pl-10 pr-4 py-2 rounded-input border ${k.value ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
331
|
+
})] })
|
|
332
|
+
}),
|
|
333
|
+
k.value && /* @__PURE__ */ h("p", {
|
|
334
|
+
className: "text-sm text-status-error-text mt-1",
|
|
335
|
+
children: k.value
|
|
336
|
+
})
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ g("div", { children: [
|
|
339
|
+
/* @__PURE__ */ g("label", {
|
|
340
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
254
341
|
children: [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
" — ",
|
|
259
|
-
n
|
|
342
|
+
"Minimum Purchase Amount (",
|
|
343
|
+
D.currency,
|
|
344
|
+
")"
|
|
260
345
|
]
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
})] })
|
|
328
|
-
}),
|
|
329
|
-
O.value && /* @__PURE__ */ h("p", {
|
|
330
|
-
className: "text-sm text-status-error-text mt-1",
|
|
331
|
-
children: O.value
|
|
332
|
-
})
|
|
333
|
-
] }),
|
|
334
|
-
/* @__PURE__ */ g("div", { children: [
|
|
335
|
-
/* @__PURE__ */ g("label", {
|
|
336
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
337
|
-
children: [
|
|
338
|
-
"Minimum Purchase Amount (",
|
|
339
|
-
E.currency,
|
|
340
|
-
")"
|
|
341
|
-
]
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ g("div", {
|
|
348
|
+
className: "relative",
|
|
349
|
+
children: [/* @__PURE__ */ h("span", {
|
|
350
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
351
|
+
children: N
|
|
352
|
+
}), /* @__PURE__ */ h("input", {
|
|
353
|
+
type: "number",
|
|
354
|
+
value: D.minPurchaseAmount || "",
|
|
355
|
+
onChange: (e) => F("minPurchaseAmount", e.target.value ? parseFloat(e.target.value) : null),
|
|
356
|
+
min: "0",
|
|
357
|
+
step: "0.01",
|
|
358
|
+
placeholder: "No minimum",
|
|
359
|
+
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)]"
|
|
360
|
+
})]
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ g("p", {
|
|
363
|
+
className: "text-xs text-text-muted mt-1",
|
|
364
|
+
children: [
|
|
365
|
+
"Order must be at least this amount in ",
|
|
366
|
+
D.currency,
|
|
367
|
+
" (auto-converted for other currencies)"
|
|
368
|
+
]
|
|
369
|
+
})
|
|
370
|
+
] }),
|
|
371
|
+
D.type === "PERCENTAGE" && /* @__PURE__ */ g("div", { children: [
|
|
372
|
+
/* @__PURE__ */ g("label", {
|
|
373
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
374
|
+
children: [
|
|
375
|
+
"Maximum Discount Amount (",
|
|
376
|
+
D.currency,
|
|
377
|
+
")"
|
|
378
|
+
]
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ g("div", {
|
|
381
|
+
className: "relative",
|
|
382
|
+
children: [/* @__PURE__ */ h("span", {
|
|
383
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
384
|
+
children: N
|
|
385
|
+
}), /* @__PURE__ */ h("input", {
|
|
386
|
+
type: "number",
|
|
387
|
+
value: D.maxDiscountAmount || "",
|
|
388
|
+
onChange: (e) => F("maxDiscountAmount", e.target.value ? parseFloat(e.target.value) : null),
|
|
389
|
+
min: "0",
|
|
390
|
+
step: "0.01",
|
|
391
|
+
placeholder: "No maximum",
|
|
392
|
+
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)]"
|
|
393
|
+
})]
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ g("p", {
|
|
396
|
+
className: "text-xs text-text-muted mt-1",
|
|
397
|
+
children: [
|
|
398
|
+
"Cap the discount in ",
|
|
399
|
+
D.currency,
|
|
400
|
+
" — auto-converted to the user's payment currency"
|
|
401
|
+
]
|
|
402
|
+
})
|
|
403
|
+
] })
|
|
404
|
+
]
|
|
405
|
+
}),
|
|
406
|
+
/* @__PURE__ */ g("div", {
|
|
407
|
+
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ h("h3", {
|
|
410
|
+
className: "text-lg font-semibold text-text-primary",
|
|
411
|
+
children: "Usage Limits"
|
|
342
412
|
}),
|
|
343
|
-
/* @__PURE__ */ g("div", {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
413
|
+
/* @__PURE__ */ g("div", { children: [
|
|
414
|
+
/* @__PURE__ */ h("label", {
|
|
415
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
416
|
+
children: "Total Usage Limit"
|
|
417
|
+
}),
|
|
418
|
+
/* @__PURE__ */ h("input", {
|
|
349
419
|
type: "number",
|
|
350
|
-
value:
|
|
351
|
-
onChange: (e) =>
|
|
352
|
-
min: "
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
"
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
E.type === "PERCENTAGE" && /* @__PURE__ */ g("div", { children: [
|
|
368
|
-
/* @__PURE__ */ g("label", {
|
|
369
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
370
|
-
children: [
|
|
371
|
-
"Maximum Discount Amount (",
|
|
372
|
-
E.currency,
|
|
373
|
-
")"
|
|
374
|
-
]
|
|
375
|
-
}),
|
|
376
|
-
/* @__PURE__ */ g("div", {
|
|
377
|
-
className: "relative",
|
|
378
|
-
children: [/* @__PURE__ */ h("span", {
|
|
379
|
-
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
380
|
-
children: M
|
|
381
|
-
}), /* @__PURE__ */ h("input", {
|
|
420
|
+
value: D.maxTotalUses || "",
|
|
421
|
+
onChange: (e) => F("maxTotalUses", e.target.value ? parseInt(e.target.value) : null),
|
|
422
|
+
min: "1",
|
|
423
|
+
placeholder: "Unlimited",
|
|
424
|
+
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ h("p", {
|
|
427
|
+
className: "text-xs text-text-muted mt-1",
|
|
428
|
+
children: "Maximum number of times this coupon can be used across all users"
|
|
429
|
+
})
|
|
430
|
+
] }),
|
|
431
|
+
/* @__PURE__ */ g("div", { children: [
|
|
432
|
+
/* @__PURE__ */ h("label", {
|
|
433
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
434
|
+
children: "Per-User Limit *"
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ h("input", {
|
|
382
437
|
type: "number",
|
|
383
|
-
value:
|
|
384
|
-
onChange: (e) =>
|
|
385
|
-
min: "
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
438
|
+
value: D.maxUsesPerUser,
|
|
439
|
+
onChange: (e) => F("maxUsesPerUser", parseInt(e.target.value)),
|
|
440
|
+
min: "1",
|
|
441
|
+
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ h("p", {
|
|
444
|
+
className: "text-xs text-text-muted mt-1",
|
|
445
|
+
children: "Maximum times a single user can use this coupon"
|
|
446
|
+
})
|
|
447
|
+
] })
|
|
448
|
+
]
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ g("div", {
|
|
451
|
+
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
452
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
453
|
+
className: "text-lg font-semibold text-text-primary",
|
|
454
|
+
children: "Validity Period"
|
|
455
|
+
}), /* @__PURE__ */ g("div", {
|
|
456
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
457
|
+
children: [/* @__PURE__ */ g("div", { children: [
|
|
458
|
+
/* @__PURE__ */ h("label", {
|
|
459
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
460
|
+
children: "Start Date *"
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ h("input", {
|
|
463
|
+
type: "date",
|
|
464
|
+
value: D.validFrom,
|
|
465
|
+
onChange: (e) => F("validFrom", e.target.value),
|
|
466
|
+
className: `w-full px-4 py-2 rounded-input border ${k.validFrom ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
467
|
+
}),
|
|
468
|
+
k.validFrom && /* @__PURE__ */ h("p", {
|
|
469
|
+
className: "text-sm text-status-error-text mt-1",
|
|
470
|
+
children: k.validFrom
|
|
471
|
+
})
|
|
472
|
+
] }), /* @__PURE__ */ g("div", { children: [
|
|
473
|
+
/* @__PURE__ */ h("label", {
|
|
474
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
475
|
+
children: "End Date"
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ h("input", {
|
|
478
|
+
type: "date",
|
|
479
|
+
value: D.validUntil,
|
|
480
|
+
onChange: (e) => F("validUntil", e.target.value),
|
|
481
|
+
className: `w-full px-4 py-2 rounded-input border ${k.validUntil ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
482
|
+
}),
|
|
483
|
+
k.validUntil && /* @__PURE__ */ h("p", {
|
|
484
|
+
className: "text-sm text-status-error-text mt-1",
|
|
485
|
+
children: k.validUntil
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ h("p", {
|
|
488
|
+
className: "text-xs text-text-muted mt-1",
|
|
489
|
+
children: "Leave empty for no expiry"
|
|
490
|
+
})
|
|
491
|
+
] })]
|
|
492
|
+
})]
|
|
493
|
+
}),
|
|
494
|
+
/* @__PURE__ */ g("div", {
|
|
495
|
+
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ h("h3", {
|
|
498
|
+
className: "text-lg font-semibold text-text-primary",
|
|
499
|
+
children: "Coupon Scope"
|
|
390
500
|
}),
|
|
391
|
-
/* @__PURE__ */ g("
|
|
392
|
-
className: "text-
|
|
501
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
502
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
503
|
+
children: "Who can use this coupon? *"
|
|
504
|
+
}), /* @__PURE__ */ g("select", {
|
|
505
|
+
value: D.scope,
|
|
506
|
+
onChange: (e) => F("scope", e.target.value),
|
|
507
|
+
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
393
508
|
children: [
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
509
|
+
/* @__PURE__ */ h("option", {
|
|
510
|
+
value: "GENERIC",
|
|
511
|
+
children: "Anyone (Public)"
|
|
512
|
+
}),
|
|
513
|
+
/* @__PURE__ */ h("option", {
|
|
514
|
+
value: "USER_SPECIFIC",
|
|
515
|
+
children: "Specific Users Only"
|
|
516
|
+
}),
|
|
517
|
+
/* @__PURE__ */ h("option", {
|
|
518
|
+
value: "REFERRAL",
|
|
519
|
+
children: "Referral Code"
|
|
520
|
+
}),
|
|
521
|
+
/* @__PURE__ */ h("option", {
|
|
522
|
+
value: "CAMPAIGN",
|
|
523
|
+
children: "Campaign-Specific"
|
|
524
|
+
})
|
|
397
525
|
]
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
]
|
|
401
|
-
}),
|
|
402
|
-
/* @__PURE__ */ g("div", {
|
|
403
|
-
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
404
|
-
children: [
|
|
405
|
-
/* @__PURE__ */ h("h3", {
|
|
406
|
-
className: "text-lg font-semibold text-text-primary",
|
|
407
|
-
children: "Usage Limits"
|
|
408
|
-
}),
|
|
409
|
-
/* @__PURE__ */ g("div", { children: [
|
|
410
|
-
/* @__PURE__ */ h("label", {
|
|
526
|
+
})] }),
|
|
527
|
+
D.scope === "CAMPAIGN" && /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
411
528
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
412
|
-
children: "
|
|
413
|
-
}),
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
min: "1",
|
|
419
|
-
placeholder: "Unlimited",
|
|
529
|
+
children: "Campaign Name"
|
|
530
|
+
}), /* @__PURE__ */ h("input", {
|
|
531
|
+
type: "text",
|
|
532
|
+
value: D.campaignName,
|
|
533
|
+
onChange: (e) => F("campaignName", e.target.value),
|
|
534
|
+
placeholder: "e.g., Summer Sale 2024",
|
|
420
535
|
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
421
|
-
}),
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
430
|
-
children: "Per-User Limit *"
|
|
431
|
-
}),
|
|
432
|
-
/* @__PURE__ */ h("input", {
|
|
433
|
-
type: "number",
|
|
434
|
-
value: E.maxUsesPerUser,
|
|
435
|
-
onChange: (e) => P("maxUsesPerUser", parseInt(e.target.value)),
|
|
436
|
-
min: "1",
|
|
437
|
-
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
438
|
-
}),
|
|
439
|
-
/* @__PURE__ */ h("p", {
|
|
440
|
-
className: "text-xs text-text-muted mt-1",
|
|
441
|
-
children: "Maximum times a single user can use this coupon"
|
|
442
|
-
})
|
|
443
|
-
] })
|
|
444
|
-
]
|
|
445
|
-
}),
|
|
446
|
-
/* @__PURE__ */ g("div", {
|
|
447
|
-
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
448
|
-
children: [/* @__PURE__ */ h("h3", {
|
|
449
|
-
className: "text-lg font-semibold text-text-primary",
|
|
450
|
-
children: "Validity Period"
|
|
451
|
-
}), /* @__PURE__ */ g("div", {
|
|
452
|
-
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
453
|
-
children: [/* @__PURE__ */ g("div", { children: [
|
|
454
|
-
/* @__PURE__ */ h("label", {
|
|
455
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
456
|
-
children: "Start Date *"
|
|
457
|
-
}),
|
|
458
|
-
/* @__PURE__ */ h("input", {
|
|
459
|
-
type: "date",
|
|
460
|
-
value: E.validFrom,
|
|
461
|
-
onChange: (e) => P("validFrom", e.target.value),
|
|
462
|
-
className: `w-full px-4 py-2 rounded-input border ${O.validFrom ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
463
|
-
}),
|
|
464
|
-
O.validFrom && /* @__PURE__ */ h("p", {
|
|
465
|
-
className: "text-sm text-status-error-text mt-1",
|
|
466
|
-
children: O.validFrom
|
|
467
|
-
})
|
|
468
|
-
] }), /* @__PURE__ */ g("div", { children: [
|
|
469
|
-
/* @__PURE__ */ h("label", {
|
|
470
|
-
className: "block text-sm font-medium text-text-primary mb-1",
|
|
471
|
-
children: "End Date"
|
|
472
|
-
}),
|
|
473
|
-
/* @__PURE__ */ h("input", {
|
|
474
|
-
type: "date",
|
|
475
|
-
value: E.validUntil,
|
|
476
|
-
onChange: (e) => P("validUntil", e.target.value),
|
|
477
|
-
className: `w-full px-4 py-2 rounded-input border ${O.validUntil ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
478
|
-
}),
|
|
479
|
-
O.validUntil && /* @__PURE__ */ h("p", {
|
|
480
|
-
className: "text-sm text-status-error-text mt-1",
|
|
481
|
-
children: O.validUntil
|
|
482
|
-
}),
|
|
483
|
-
/* @__PURE__ */ h("p", {
|
|
484
|
-
className: "text-xs text-text-muted mt-1",
|
|
485
|
-
children: "Leave empty for no expiry"
|
|
486
|
-
})
|
|
487
|
-
] })]
|
|
488
|
-
})]
|
|
489
|
-
}),
|
|
490
|
-
/* @__PURE__ */ g("div", {
|
|
491
|
-
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
492
|
-
children: [
|
|
493
|
-
/* @__PURE__ */ h("h3", {
|
|
494
|
-
className: "text-lg font-semibold text-text-primary",
|
|
495
|
-
children: "Coupon Scope"
|
|
496
|
-
}),
|
|
497
|
-
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
498
|
-
className: "block text-sm font-medium text-text-primary mb-2",
|
|
499
|
-
children: "Who can use this coupon? *"
|
|
500
|
-
}), /* @__PURE__ */ g("select", {
|
|
501
|
-
value: E.scope,
|
|
502
|
-
onChange: (e) => P("scope", e.target.value),
|
|
503
|
-
className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
504
|
-
children: [
|
|
505
|
-
/* @__PURE__ */ h("option", {
|
|
506
|
-
value: "GENERIC",
|
|
507
|
-
children: "Anyone (Public)"
|
|
536
|
+
})] }),
|
|
537
|
+
D.scope === "USER_SPECIFIC" && /* @__PURE__ */ g("div", { children: [
|
|
538
|
+
/* @__PURE__ */ h("label", {
|
|
539
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
540
|
+
children: /* @__PURE__ */ g("span", {
|
|
541
|
+
className: "flex items-center gap-1.5",
|
|
542
|
+
children: [/* @__PURE__ */ h(f, { className: "size-4" }), "Restricted Users *"]
|
|
543
|
+
})
|
|
508
544
|
}),
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
|
|
511
|
-
|
|
545
|
+
/* @__PURE__ */ g("div", {
|
|
546
|
+
className: `min-h-[42px] flex flex-wrap gap-2 px-3 py-2 rounded-lg border ${k.restrictedToUserIds ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface cursor-text`,
|
|
547
|
+
onClick: () => E.current?.focus(),
|
|
548
|
+
children: [D.restrictedToUserIds.map((e) => /* @__PURE__ */ g("span", {
|
|
549
|
+
className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-[var(--color-accent-soft)] text-text-link text-sm font-medium",
|
|
550
|
+
children: [e, /* @__PURE__ */ h("button", {
|
|
551
|
+
type: "button",
|
|
552
|
+
onClick: (t) => {
|
|
553
|
+
t.stopPropagation(), R(e);
|
|
554
|
+
},
|
|
555
|
+
className: "hover:text-status-error-text",
|
|
556
|
+
children: /* @__PURE__ */ h(p, { className: "size-3" })
|
|
557
|
+
})]
|
|
558
|
+
}, e)), /* @__PURE__ */ h("input", {
|
|
559
|
+
ref: E,
|
|
560
|
+
type: "text",
|
|
561
|
+
value: w,
|
|
562
|
+
onChange: (e) => T(e.target.value),
|
|
563
|
+
onKeyDown: (e) => {
|
|
564
|
+
e.key === "Enter" || e.key === "," ? (e.preventDefault(), L(w)) : e.key === "Backspace" && !w && D.restrictedToUserIds.length > 0 && R(D.restrictedToUserIds[D.restrictedToUserIds.length - 1]);
|
|
565
|
+
},
|
|
566
|
+
onBlur: () => L(w),
|
|
567
|
+
placeholder: D.restrictedToUserIds.length === 0 ? "Enter user email or ID, press Enter to add" : "Add another…",
|
|
568
|
+
className: "flex-1 min-w-[200px] bg-transparent text-text-primary placeholder:text-text-muted text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
|
|
569
|
+
})]
|
|
512
570
|
}),
|
|
513
|
-
/* @__PURE__ */ h("
|
|
514
|
-
|
|
515
|
-
children:
|
|
571
|
+
k.restrictedToUserIds && /* @__PURE__ */ h("p", {
|
|
572
|
+
className: "text-sm text-status-error-text mt-1",
|
|
573
|
+
children: k.restrictedToUserIds
|
|
516
574
|
}),
|
|
517
|
-
/* @__PURE__ */ h("
|
|
518
|
-
|
|
519
|
-
children: "
|
|
575
|
+
/* @__PURE__ */ h("p", {
|
|
576
|
+
className: "text-xs text-text-muted mt-1",
|
|
577
|
+
children: "Type an email or user ID and press Enter or comma to add. Only these users can redeem this coupon."
|
|
520
578
|
})
|
|
521
|
-
]
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
type: "
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
/* @__PURE__ */ g("div", {
|
|
542
|
-
className: `min-h-[42px] flex flex-wrap gap-2 px-3 py-2 rounded-lg border ${O.restrictedToUserIds ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface cursor-text`,
|
|
543
|
-
onClick: () => T.current?.focus(),
|
|
544
|
-
children: [E.restrictedToUserIds.map((e) => /* @__PURE__ */ g("span", {
|
|
545
|
-
className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-[var(--color-accent-soft)] text-text-link text-sm font-medium",
|
|
546
|
-
children: [e, /* @__PURE__ */ h("button", {
|
|
547
|
-
type: "button",
|
|
548
|
-
onClick: (t) => {
|
|
549
|
-
t.stopPropagation(), L(e);
|
|
550
|
-
},
|
|
551
|
-
className: "hover:text-status-error-text",
|
|
552
|
-
children: /* @__PURE__ */ h(p, { className: "size-3" })
|
|
553
|
-
})]
|
|
554
|
-
}, e)), /* @__PURE__ */ h("input", {
|
|
555
|
-
ref: T,
|
|
556
|
-
type: "text",
|
|
557
|
-
value: C,
|
|
558
|
-
onChange: (e) => w(e.target.value),
|
|
559
|
-
onKeyDown: (e) => {
|
|
560
|
-
e.key === "Enter" || e.key === "," ? (e.preventDefault(), I(C)) : e.key === "Backspace" && !C && E.restrictedToUserIds.length > 0 && L(E.restrictedToUserIds[E.restrictedToUserIds.length - 1]);
|
|
561
|
-
},
|
|
562
|
-
onBlur: () => I(C),
|
|
563
|
-
placeholder: E.restrictedToUserIds.length === 0 ? "Enter user email or ID, press Enter to add" : "Add another…",
|
|
564
|
-
className: "flex-1 min-w-[200px] bg-transparent text-text-primary placeholder:text-text-muted text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
|
|
565
|
-
})]
|
|
566
|
-
}),
|
|
567
|
-
O.restrictedToUserIds && /* @__PURE__ */ h("p", {
|
|
568
|
-
className: "text-sm text-status-error-text mt-1",
|
|
569
|
-
children: O.restrictedToUserIds
|
|
570
|
-
}),
|
|
571
|
-
/* @__PURE__ */ h("p", {
|
|
572
|
-
className: "text-xs text-text-muted mt-1",
|
|
573
|
-
children: "Type an email or user ID and press Enter or comma to add. Only these users can redeem this coupon."
|
|
574
|
-
})
|
|
575
|
-
] })
|
|
576
|
-
]
|
|
577
|
-
}),
|
|
578
|
-
/* @__PURE__ */ g("div", {
|
|
579
|
-
className: "flex items-center justify-end gap-3",
|
|
580
|
-
children: [/* @__PURE__ */ h("button", {
|
|
581
|
-
type: "button",
|
|
582
|
-
onClick: () => x("/coupons"),
|
|
583
|
-
className: "px-6 py-3 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
|
|
584
|
-
children: "Cancel"
|
|
585
|
-
}), /* @__PURE__ */ h("button", {
|
|
586
|
-
type: "submit",
|
|
587
|
-
disabled: A,
|
|
588
|
-
className: "px-6 py-3 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
589
|
-
children: A ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", { className: "size-4 border-2 border-action-primary-text border-t-transparent rounded-full animate-spin" }), "Creating…"] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(u, { className: "size-4" }), "Create Coupon"] })
|
|
590
|
-
})]
|
|
591
|
-
})
|
|
592
|
-
]
|
|
593
|
-
})]
|
|
579
|
+
] })
|
|
580
|
+
]
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ g("div", {
|
|
583
|
+
className: "flex items-center justify-end gap-3",
|
|
584
|
+
children: [/* @__PURE__ */ h("button", {
|
|
585
|
+
type: "button",
|
|
586
|
+
onClick: () => S("/coupons"),
|
|
587
|
+
className: "px-6 py-3 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
|
|
588
|
+
children: "Cancel"
|
|
589
|
+
}), /* @__PURE__ */ h("button", {
|
|
590
|
+
type: "submit",
|
|
591
|
+
disabled: j,
|
|
592
|
+
className: "px-6 py-3 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
593
|
+
children: j ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", { className: "size-4 border-2 border-action-primary-text border-t-transparent rounded-full animate-spin" }), "Creating…"] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(u, { className: "size-4" }), "Create Coupon"] })
|
|
594
|
+
})]
|
|
595
|
+
})
|
|
596
|
+
]
|
|
597
|
+
})
|
|
598
|
+
]
|
|
594
599
|
});
|
|
595
600
|
};
|
|
596
601
|
//#endregion
|
|
597
|
-
export {
|
|
602
|
+
export { b as CreateCouponPage };
|
|
598
603
|
|
|
599
604
|
//# sourceMappingURL=CreateCouponPage.js.map
|