@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.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/AddonCreatePage.js +143 -143
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
- package/package.json +2 -2
|
@@ -5,12 +5,12 @@ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions
|
|
|
5
5
|
import "../../../shared/components/index.js";
|
|
6
6
|
import { useCreateCouponMutation as i } from "../../../../generated/global-operations.js";
|
|
7
7
|
import { useRef as a, useState as o } from "react";
|
|
8
|
-
import { PagePurpose as s } from "@burdenoff/fe-libs/ui";
|
|
9
|
-
import { ArrowLeft as
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { useI18n as
|
|
8
|
+
import { PagePurpose as s, ThemedSelect as c } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { ArrowLeft as l, Package as u, Percent as d, Save as f, Tag as p, Users as m, X as h } from "lucide-react";
|
|
10
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
|
+
import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
12
|
// src/billing/modules/coupons/pages/CreateCouponPage.tsx
|
|
13
|
-
var
|
|
13
|
+
var b = [
|
|
14
14
|
{
|
|
15
15
|
code: "USD",
|
|
16
16
|
symbol: "$",
|
|
@@ -86,7 +86,7 @@ var y = [
|
|
|
86
86
|
symbol: "₩",
|
|
87
87
|
name: "South Korean Won"
|
|
88
88
|
}
|
|
89
|
-
],
|
|
89
|
+
], x = /* @__PURE__ */ "workspaces.bigconsole.botlit.fluidgrids.vibecontrols.healthybowl.adaptercloud.atheletebridge.coolandlovely.hookmovies.labsofscience.subscriberbot.artistrybase.assethandler.brainyrich.buildmyiq.collabkin.comradecircle.cosmicintersection.crewfoundry.ecoimpacthub.eventfullymanaged.ggnomad.govcitizenhub.headshotmarketing.housingvista.intelwatchtower.kadaikodi.manufacturedops.movethewheels.mybodyshield.planmagnet.proserviceworld.semanticfed.technospam.theculturepost.theglobalfuel.timecampus".split("."), S = [
|
|
90
90
|
{
|
|
91
91
|
value: "PLAN",
|
|
92
92
|
label: "Plan purchases"
|
|
@@ -99,11 +99,11 @@ var y = [
|
|
|
99
99
|
value: "STORE",
|
|
100
100
|
label: "Store purchases"
|
|
101
101
|
}
|
|
102
|
-
],
|
|
103
|
-
let { t:
|
|
104
|
-
let n =
|
|
102
|
+
], C = () => {
|
|
103
|
+
let { t: C } = y(), w = (e, t) => {
|
|
104
|
+
let n = C(e);
|
|
105
105
|
return n === e ? t : n;
|
|
106
|
-
},
|
|
106
|
+
}, T = n(), E = r(), [D, O] = o(""), k = a(null), [A, j] = o({
|
|
107
107
|
code: "",
|
|
108
108
|
name: "",
|
|
109
109
|
description: "",
|
|
@@ -123,161 +123,161 @@ var y = [
|
|
|
123
123
|
applicableProductIds: [],
|
|
124
124
|
applicableEntityTypes: [],
|
|
125
125
|
campaignName: ""
|
|
126
|
-
}), [
|
|
127
|
-
if (!
|
|
128
|
-
let
|
|
129
|
-
|
|
126
|
+
}), [M, N] = o({}), [P, F] = o(!1), I = b.find((e) => e.code === A.currency)?.symbol ?? A.currency, [L] = i({ refetchQueries: ["ListCoupons"] });
|
|
127
|
+
if (!E.canManageDiscounts) return /* @__PURE__ */ _(e, { message: "You don't have permission to create coupons." });
|
|
128
|
+
let R = (e, t) => {
|
|
129
|
+
j((n) => ({
|
|
130
130
|
...n,
|
|
131
131
|
[e]: t
|
|
132
|
-
})),
|
|
132
|
+
})), M[e] && N((t) => {
|
|
133
133
|
let n = { ...t };
|
|
134
134
|
return delete n[e], n;
|
|
135
135
|
});
|
|
136
|
-
},
|
|
136
|
+
}, z = () => {
|
|
137
137
|
let e = {};
|
|
138
|
-
return
|
|
139
|
-
}, z = (e) => {
|
|
140
|
-
let t = e.trim();
|
|
141
|
-
t && (k.restrictedToUserIds.includes(t) || L("restrictedToUserIds", [...k.restrictedToUserIds, t]), D(""));
|
|
138
|
+
return A.code.trim() ? /^[A-Z0-9-_]+$/.test(A.code) ? A.code.length < 3 ? e.code = "Code must be at least 3 characters" : A.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", A.name.trim() || (e.name = "Coupon name is required"), A.value <= 0 && (e.value = "Value must be greater than 0"), A.type === "PERCENTAGE" && A.value > 100 && (e.value = "Percentage cannot exceed 100%"), A.scope === "USER_SPECIFIC" && A.restrictedToUserIds.length === 0 && (e.restrictedToUserIds = "Add at least one user email or ID"), A.validFrom || (e.validFrom = "Start date is required"), A.validUntil && A.validUntil < A.validFrom && (e.validUntil = "End date must be after start date"), N(e), Object.keys(e).length === 0;
|
|
142
139
|
}, B = (e) => {
|
|
143
|
-
|
|
140
|
+
let t = e.trim();
|
|
141
|
+
t && (A.restrictedToUserIds.includes(t) || R("restrictedToUserIds", [...A.restrictedToUserIds, t]), O(""));
|
|
144
142
|
}, V = (e) => {
|
|
145
|
-
|
|
143
|
+
R("restrictedToUserIds", A.restrictedToUserIds.filter((t) => t !== e));
|
|
146
144
|
}, H = (e) => {
|
|
147
|
-
|
|
145
|
+
R("applicableProductIds", A.applicableProductIds.includes(e) ? A.applicableProductIds.filter((t) => t !== e) : [...A.applicableProductIds, e]);
|
|
146
|
+
}, U = (e) => {
|
|
147
|
+
R("applicableEntityTypes", A.applicableEntityTypes.includes(e) ? A.applicableEntityTypes.filter((t) => t !== e) : [...A.applicableEntityTypes, e]);
|
|
148
148
|
};
|
|
149
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ v("div", {
|
|
150
150
|
className: "max-w-4xl mx-auto p-4 sm:p-6 space-y-6",
|
|
151
151
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ v("div", {
|
|
153
153
|
className: "flex items-center gap-4",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ _("button", {
|
|
155
155
|
type: "button",
|
|
156
|
-
onClick: () =>
|
|
156
|
+
onClick: () => T("/coupons"),
|
|
157
157
|
className: "p-2 rounded-lg hover:bg-bg-sunken text-text-muted hover:text-text-primary",
|
|
158
|
-
children: /* @__PURE__ */
|
|
159
|
-
}), /* @__PURE__ */
|
|
160
|
-
title:
|
|
158
|
+
children: /* @__PURE__ */ _(l, { className: "size-5" })
|
|
159
|
+
}), /* @__PURE__ */ _(t, {
|
|
160
|
+
title: w("billing.coupons.createTitle", "Create Coupon"),
|
|
161
161
|
description: "Create a new discount code or promotional offer",
|
|
162
|
-
icon: /* @__PURE__ */
|
|
162
|
+
icon: /* @__PURE__ */ _(p, { className: "size-6" })
|
|
163
163
|
})]
|
|
164
164
|
}),
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ _(s, { children: w("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.") }),
|
|
166
|
+
/* @__PURE__ */ v("form", {
|
|
167
167
|
onSubmit: async (e) => {
|
|
168
|
-
if (e.preventDefault(),
|
|
169
|
-
|
|
168
|
+
if (e.preventDefault(), z()) {
|
|
169
|
+
F(!0);
|
|
170
170
|
try {
|
|
171
171
|
let e = {
|
|
172
|
-
code:
|
|
173
|
-
name:
|
|
174
|
-
description:
|
|
175
|
-
scope:
|
|
176
|
-
type:
|
|
177
|
-
value:
|
|
178
|
-
currency:
|
|
179
|
-
minPurchaseAmount:
|
|
180
|
-
maxDiscountAmount:
|
|
181
|
-
maxTotalUses:
|
|
182
|
-
maxUsesPerUser:
|
|
183
|
-
validFrom: new Date(
|
|
184
|
-
validUntil:
|
|
185
|
-
restrictedToUserIds:
|
|
186
|
-
applicableProducts:
|
|
187
|
-
applicableServices:
|
|
188
|
-
applicableProductIds:
|
|
189
|
-
applicableEntityTypes:
|
|
172
|
+
code: A.code,
|
|
173
|
+
name: A.name,
|
|
174
|
+
description: A.description,
|
|
175
|
+
scope: A.scope,
|
|
176
|
+
type: A.type,
|
|
177
|
+
value: A.value,
|
|
178
|
+
currency: A.currency,
|
|
179
|
+
minPurchaseAmount: A.minPurchaseAmount,
|
|
180
|
+
maxDiscountAmount: A.maxDiscountAmount,
|
|
181
|
+
maxTotalUses: A.maxTotalUses,
|
|
182
|
+
maxUsesPerUser: A.maxUsesPerUser,
|
|
183
|
+
validFrom: new Date(A.validFrom).toISOString(),
|
|
184
|
+
validUntil: A.validUntil ? new Date(A.validUntil).toISOString() : void 0,
|
|
185
|
+
restrictedToUserIds: A.restrictedToUserIds,
|
|
186
|
+
applicableProducts: A.applicableProducts,
|
|
187
|
+
applicableServices: A.applicableServices,
|
|
188
|
+
applicableProductIds: A.applicableProductIds,
|
|
189
|
+
applicableEntityTypes: A.applicableEntityTypes,
|
|
190
190
|
excludedProducts: [],
|
|
191
191
|
excludedServices: [],
|
|
192
|
-
campaignName:
|
|
192
|
+
campaignName: A.campaignName || void 0
|
|
193
193
|
};
|
|
194
|
-
if ((await
|
|
194
|
+
if ((await L({ variables: { input: e } })).data?.createCoupon) T("/coupons");
|
|
195
195
|
else throw Error("Failed to create coupon");
|
|
196
196
|
} catch (e) {
|
|
197
197
|
console.error("Error creating coupon:", e);
|
|
198
198
|
let t = e instanceof Error ? e.message : "Failed to create coupon. Please try again.";
|
|
199
|
-
|
|
199
|
+
N({ code: t });
|
|
200
200
|
} finally {
|
|
201
|
-
|
|
201
|
+
F(!1);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
205
|
className: "space-y-6",
|
|
206
206
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ v("div", {
|
|
208
208
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
209
209
|
children: [
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ _("h3", {
|
|
211
211
|
className: "text-lg font-semibold text-text-primary",
|
|
212
212
|
children: "Basic Information"
|
|
213
213
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ v("div", { children: [
|
|
215
|
+
/* @__PURE__ */ _("label", {
|
|
216
216
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
217
217
|
children: "Coupon Code *"
|
|
218
218
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ _("input", {
|
|
220
220
|
type: "text",
|
|
221
|
-
value:
|
|
222
|
-
onChange: (e) =>
|
|
221
|
+
value: A.code,
|
|
222
|
+
onChange: (e) => R("code", e.target.value.toUpperCase()),
|
|
223
223
|
placeholder: "e.g., WELCOME20",
|
|
224
|
-
className: `w-full px-4 py-2 rounded-input border ${
|
|
224
|
+
className: `w-full px-4 py-2 rounded-input border ${M.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)]`
|
|
225
225
|
}),
|
|
226
|
-
|
|
226
|
+
M.code && /* @__PURE__ */ _("p", {
|
|
227
227
|
className: "text-sm text-status-error-text mt-1",
|
|
228
|
-
children:
|
|
228
|
+
children: M.code
|
|
229
229
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ _("p", {
|
|
231
231
|
className: "text-xs text-text-muted mt-1",
|
|
232
232
|
children: "Use uppercase letters, numbers, hyphens, and underscores"
|
|
233
233
|
})
|
|
234
234
|
] }),
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ v("div", { children: [
|
|
236
|
+
/* @__PURE__ */ _("label", {
|
|
237
237
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
238
238
|
children: "Display Name *"
|
|
239
239
|
}),
|
|
240
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ _("input", {
|
|
241
241
|
type: "text",
|
|
242
|
-
value:
|
|
243
|
-
onChange: (e) =>
|
|
242
|
+
value: A.name,
|
|
243
|
+
onChange: (e) => R("name", e.target.value),
|
|
244
244
|
placeholder: "e.g., Welcome 20% Off",
|
|
245
|
-
className: `w-full px-4 py-2 rounded-input border ${
|
|
245
|
+
className: `w-full px-4 py-2 rounded-input border ${M.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)]`
|
|
246
246
|
}),
|
|
247
|
-
|
|
247
|
+
M.name && /* @__PURE__ */ _("p", {
|
|
248
248
|
className: "text-sm text-status-error-text mt-1",
|
|
249
|
-
children:
|
|
249
|
+
children: M.name
|
|
250
250
|
})
|
|
251
251
|
] }),
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
|
|
253
253
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
254
254
|
children: "Description"
|
|
255
|
-
}), /* @__PURE__ */
|
|
256
|
-
value:
|
|
257
|
-
onChange: (e) =>
|
|
255
|
+
}), /* @__PURE__ */ _("textarea", {
|
|
256
|
+
value: A.description,
|
|
257
|
+
onChange: (e) => R("description", e.target.value),
|
|
258
258
|
placeholder: "Optional description for internal use",
|
|
259
259
|
rows: 3,
|
|
260
260
|
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)]"
|
|
261
261
|
})] })
|
|
262
262
|
]
|
|
263
263
|
}),
|
|
264
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ v("div", {
|
|
265
265
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
266
266
|
children: [
|
|
267
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ _("h3", {
|
|
268
268
|
className: "text-lg font-semibold text-text-primary",
|
|
269
269
|
children: "Discount Configuration"
|
|
270
270
|
}),
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ v("div", { children: [
|
|
272
|
+
/* @__PURE__ */ _("label", {
|
|
273
273
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
274
274
|
children: "Coupon Currency *"
|
|
275
275
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
value:
|
|
278
|
-
onChange: (e) =>
|
|
276
|
+
/* @__PURE__ */ _(c, {
|
|
277
|
+
value: A.currency,
|
|
278
|
+
onChange: (e) => R("currency", e.target.value),
|
|
279
279
|
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)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
280
|
-
children:
|
|
280
|
+
children: b.map(({ code: e, symbol: t, name: n }) => /* @__PURE__ */ v("option", {
|
|
281
281
|
value: e,
|
|
282
282
|
children: [
|
|
283
283
|
t,
|
|
@@ -288,380 +288,380 @@ var y = [
|
|
|
288
288
|
]
|
|
289
289
|
}, e))
|
|
290
290
|
}),
|
|
291
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ _("p", {
|
|
292
292
|
className: "text-xs text-text-muted mt-1",
|
|
293
293
|
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."
|
|
294
294
|
})
|
|
295
295
|
] }),
|
|
296
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
|
|
297
297
|
className: "block text-sm font-medium text-text-primary mb-2",
|
|
298
298
|
children: "Discount Type *"
|
|
299
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ _("div", {
|
|
300
300
|
className: "grid grid-cols-3 gap-3",
|
|
301
301
|
children: [
|
|
302
302
|
{
|
|
303
303
|
value: "PERCENTAGE",
|
|
304
304
|
label: "Percentage",
|
|
305
|
-
icon:
|
|
305
|
+
icon: d
|
|
306
306
|
},
|
|
307
307
|
{
|
|
308
308
|
value: "FIXED_AMOUNT",
|
|
309
|
-
label: `Fixed (${
|
|
309
|
+
label: `Fixed (${I})`,
|
|
310
310
|
icon: null
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
value: "FREE_SHIPPING",
|
|
314
314
|
label: "Free Shipping",
|
|
315
|
-
icon:
|
|
315
|
+
icon: u
|
|
316
316
|
}
|
|
317
|
-
].map(({ value: e, label: t, icon: n }) => /* @__PURE__ */
|
|
317
|
+
].map(({ value: e, label: t, icon: n }) => /* @__PURE__ */ v("button", {
|
|
318
318
|
type: "button",
|
|
319
|
-
onClick: () =>
|
|
320
|
-
className: `p-4 rounded-lg border-2 transition-colors ${
|
|
321
|
-
children: [n ? /* @__PURE__ */
|
|
319
|
+
onClick: () => R("type", e),
|
|
320
|
+
className: `p-4 rounded-lg border-2 transition-colors ${A.type === e ? "border-action-primary-bg bg-[var(--color-accent-soft)]" : "border-border-subtle hover:border-action-primary-bg/50"}`,
|
|
321
|
+
children: [n ? /* @__PURE__ */ _(n, { className: "size-5 mx-auto mb-2" }) : /* @__PURE__ */ _("span", {
|
|
322
322
|
className: "block text-lg font-bold mb-2",
|
|
323
|
-
children:
|
|
324
|
-
}), /* @__PURE__ */
|
|
323
|
+
children: I
|
|
324
|
+
}), /* @__PURE__ */ _("p", {
|
|
325
325
|
className: "text-sm font-medium",
|
|
326
326
|
children: t
|
|
327
327
|
})]
|
|
328
328
|
}, e))
|
|
329
329
|
})] }),
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ v("div", { children: [
|
|
331
|
+
/* @__PURE__ */ _("label", {
|
|
332
332
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
333
333
|
children: "Discount Value *"
|
|
334
334
|
}),
|
|
335
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ _("div", {
|
|
336
336
|
className: "relative",
|
|
337
|
-
children:
|
|
337
|
+
children: A.type === "PERCENTAGE" ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(d, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted" }), /* @__PURE__ */ _("input", {
|
|
338
338
|
type: "number",
|
|
339
|
-
value:
|
|
340
|
-
onChange: (e) =>
|
|
339
|
+
value: A.value,
|
|
340
|
+
onChange: (e) => R("value", parseFloat(e.target.value)),
|
|
341
341
|
min: "0",
|
|
342
342
|
max: "100",
|
|
343
343
|
step: "0.01",
|
|
344
|
-
className: `w-full pl-10 pr-4 py-2 rounded-input border ${
|
|
345
|
-
})] }) : /* @__PURE__ */
|
|
344
|
+
className: `w-full pl-10 pr-4 py-2 rounded-input border ${M.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)]`
|
|
345
|
+
})] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
346
346
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
347
|
-
children:
|
|
348
|
-
}), /* @__PURE__ */
|
|
347
|
+
children: I
|
|
348
|
+
}), /* @__PURE__ */ _("input", {
|
|
349
349
|
type: "number",
|
|
350
|
-
value:
|
|
351
|
-
onChange: (e) =>
|
|
350
|
+
value: A.value,
|
|
351
|
+
onChange: (e) => R("value", parseFloat(e.target.value)),
|
|
352
352
|
min: "0",
|
|
353
353
|
step: "0.01",
|
|
354
|
-
className: `w-full pl-10 pr-4 py-2 rounded-input border ${
|
|
354
|
+
className: `w-full pl-10 pr-4 py-2 rounded-input border ${M.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)]`
|
|
355
355
|
})] })
|
|
356
356
|
}),
|
|
357
|
-
|
|
357
|
+
M.value && /* @__PURE__ */ _("p", {
|
|
358
358
|
className: "text-sm text-status-error-text mt-1",
|
|
359
|
-
children:
|
|
359
|
+
children: M.value
|
|
360
360
|
})
|
|
361
361
|
] }),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ v("div", { children: [
|
|
363
|
+
/* @__PURE__ */ v("label", {
|
|
364
364
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
365
365
|
children: [
|
|
366
366
|
"Minimum Purchase Amount (",
|
|
367
|
-
|
|
367
|
+
A.currency,
|
|
368
368
|
")"
|
|
369
369
|
]
|
|
370
370
|
}),
|
|
371
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ v("div", {
|
|
372
372
|
className: "relative",
|
|
373
|
-
children: [/* @__PURE__ */
|
|
373
|
+
children: [/* @__PURE__ */ _("span", {
|
|
374
374
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
375
|
-
children:
|
|
376
|
-
}), /* @__PURE__ */
|
|
375
|
+
children: I
|
|
376
|
+
}), /* @__PURE__ */ _("input", {
|
|
377
377
|
type: "number",
|
|
378
|
-
value:
|
|
379
|
-
onChange: (e) =>
|
|
378
|
+
value: A.minPurchaseAmount || "",
|
|
379
|
+
onChange: (e) => R("minPurchaseAmount", e.target.value ? parseFloat(e.target.value) : null),
|
|
380
380
|
min: "0",
|
|
381
381
|
step: "0.01",
|
|
382
382
|
placeholder: "No minimum",
|
|
383
383
|
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)]"
|
|
384
384
|
})]
|
|
385
385
|
}),
|
|
386
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ v("p", {
|
|
387
387
|
className: "text-xs text-text-muted mt-1",
|
|
388
388
|
children: [
|
|
389
389
|
"Order must be at least this amount in ",
|
|
390
|
-
|
|
390
|
+
A.currency,
|
|
391
391
|
" (auto-converted for other currencies)"
|
|
392
392
|
]
|
|
393
393
|
})
|
|
394
394
|
] }),
|
|
395
|
-
|
|
396
|
-
/* @__PURE__ */
|
|
395
|
+
A.type === "PERCENTAGE" && /* @__PURE__ */ v("div", { children: [
|
|
396
|
+
/* @__PURE__ */ v("label", {
|
|
397
397
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
398
398
|
children: [
|
|
399
399
|
"Maximum Discount Amount (",
|
|
400
|
-
|
|
400
|
+
A.currency,
|
|
401
401
|
")"
|
|
402
402
|
]
|
|
403
403
|
}),
|
|
404
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ v("div", {
|
|
405
405
|
className: "relative",
|
|
406
|
-
children: [/* @__PURE__ */
|
|
406
|
+
children: [/* @__PURE__ */ _("span", {
|
|
407
407
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
|
|
408
|
-
children:
|
|
409
|
-
}), /* @__PURE__ */
|
|
408
|
+
children: I
|
|
409
|
+
}), /* @__PURE__ */ _("input", {
|
|
410
410
|
type: "number",
|
|
411
|
-
value:
|
|
412
|
-
onChange: (e) =>
|
|
411
|
+
value: A.maxDiscountAmount || "",
|
|
412
|
+
onChange: (e) => R("maxDiscountAmount", e.target.value ? parseFloat(e.target.value) : null),
|
|
413
413
|
min: "0",
|
|
414
414
|
step: "0.01",
|
|
415
415
|
placeholder: "No maximum",
|
|
416
416
|
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)]"
|
|
417
417
|
})]
|
|
418
418
|
}),
|
|
419
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ v("p", {
|
|
420
420
|
className: "text-xs text-text-muted mt-1",
|
|
421
421
|
children: [
|
|
422
422
|
"Cap the discount in ",
|
|
423
|
-
|
|
423
|
+
A.currency,
|
|
424
424
|
" — auto-converted to the user's payment currency"
|
|
425
425
|
]
|
|
426
426
|
})
|
|
427
427
|
] })
|
|
428
428
|
]
|
|
429
429
|
}),
|
|
430
|
-
/* @__PURE__ */
|
|
430
|
+
/* @__PURE__ */ v("div", {
|
|
431
431
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
432
432
|
children: [
|
|
433
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ _("h3", {
|
|
434
434
|
className: "text-lg font-semibold text-text-primary",
|
|
435
435
|
children: "Usage Limits"
|
|
436
436
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ v("div", { children: [
|
|
438
|
+
/* @__PURE__ */ _("label", {
|
|
439
439
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
440
440
|
children: "Total Usage Limit"
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ _("input", {
|
|
443
443
|
type: "number",
|
|
444
|
-
value:
|
|
445
|
-
onChange: (e) =>
|
|
444
|
+
value: A.maxTotalUses || "",
|
|
445
|
+
onChange: (e) => R("maxTotalUses", e.target.value ? parseInt(e.target.value) : null),
|
|
446
446
|
min: "1",
|
|
447
447
|
placeholder: "Unlimited",
|
|
448
448
|
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)]"
|
|
449
449
|
}),
|
|
450
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ _("p", {
|
|
451
451
|
className: "text-xs text-text-muted mt-1",
|
|
452
452
|
children: "Maximum number of times this coupon can be used across all users"
|
|
453
453
|
})
|
|
454
454
|
] }),
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ v("div", { children: [
|
|
456
|
+
/* @__PURE__ */ _("label", {
|
|
457
457
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
458
458
|
children: "Per-User Limit *"
|
|
459
459
|
}),
|
|
460
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ _("input", {
|
|
461
461
|
type: "number",
|
|
462
|
-
value:
|
|
463
|
-
onChange: (e) =>
|
|
462
|
+
value: A.maxUsesPerUser,
|
|
463
|
+
onChange: (e) => R("maxUsesPerUser", parseInt(e.target.value)),
|
|
464
464
|
min: "1",
|
|
465
465
|
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)]"
|
|
466
466
|
}),
|
|
467
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ _("p", {
|
|
468
468
|
className: "text-xs text-text-muted mt-1",
|
|
469
469
|
children: "Maximum times a single user can use this coupon"
|
|
470
470
|
})
|
|
471
471
|
] })
|
|
472
472
|
]
|
|
473
473
|
}),
|
|
474
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ v("div", {
|
|
475
475
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
476
|
-
children: [/* @__PURE__ */
|
|
476
|
+
children: [/* @__PURE__ */ _("h3", {
|
|
477
477
|
className: "text-lg font-semibold text-text-primary",
|
|
478
478
|
children: "Validity Period"
|
|
479
|
-
}), /* @__PURE__ */
|
|
479
|
+
}), /* @__PURE__ */ v("div", {
|
|
480
480
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
481
|
+
children: [/* @__PURE__ */ v("div", { children: [
|
|
482
|
+
/* @__PURE__ */ _("label", {
|
|
483
483
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
484
484
|
children: "Start Date *"
|
|
485
485
|
}),
|
|
486
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ _("input", {
|
|
487
487
|
type: "date",
|
|
488
|
-
value:
|
|
489
|
-
onChange: (e) =>
|
|
490
|
-
className: `w-full px-4 py-2 rounded-input border ${
|
|
488
|
+
value: A.validFrom,
|
|
489
|
+
onChange: (e) => R("validFrom", e.target.value),
|
|
490
|
+
className: `w-full px-4 py-2 rounded-input border ${M.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)]`
|
|
491
491
|
}),
|
|
492
|
-
|
|
492
|
+
M.validFrom && /* @__PURE__ */ _("p", {
|
|
493
493
|
className: "text-sm text-status-error-text mt-1",
|
|
494
|
-
children:
|
|
494
|
+
children: M.validFrom
|
|
495
495
|
})
|
|
496
|
-
] }), /* @__PURE__ */
|
|
497
|
-
/* @__PURE__ */
|
|
496
|
+
] }), /* @__PURE__ */ v("div", { children: [
|
|
497
|
+
/* @__PURE__ */ _("label", {
|
|
498
498
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
499
499
|
children: "End Date"
|
|
500
500
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ _("input", {
|
|
502
502
|
type: "date",
|
|
503
|
-
value:
|
|
504
|
-
onChange: (e) =>
|
|
505
|
-
className: `w-full px-4 py-2 rounded-input border ${
|
|
503
|
+
value: A.validUntil,
|
|
504
|
+
onChange: (e) => R("validUntil", e.target.value),
|
|
505
|
+
className: `w-full px-4 py-2 rounded-input border ${M.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)]`
|
|
506
506
|
}),
|
|
507
|
-
|
|
507
|
+
M.validUntil && /* @__PURE__ */ _("p", {
|
|
508
508
|
className: "text-sm text-status-error-text mt-1",
|
|
509
|
-
children:
|
|
509
|
+
children: M.validUntil
|
|
510
510
|
}),
|
|
511
|
-
/* @__PURE__ */
|
|
511
|
+
/* @__PURE__ */ _("p", {
|
|
512
512
|
className: "text-xs text-text-muted mt-1",
|
|
513
513
|
children: "Leave empty for no expiry"
|
|
514
514
|
})
|
|
515
515
|
] })]
|
|
516
516
|
})]
|
|
517
517
|
}),
|
|
518
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ v("div", {
|
|
519
519
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
520
520
|
children: [
|
|
521
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ _("h3", {
|
|
522
522
|
className: "text-lg font-semibold text-text-primary",
|
|
523
523
|
children: "Applicability"
|
|
524
524
|
}),
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ v("div", { children: [
|
|
526
|
+
/* @__PURE__ */ _("label", {
|
|
527
527
|
className: "block text-sm font-medium text-text-primary mb-2",
|
|
528
528
|
children: "Applicable Products"
|
|
529
529
|
}),
|
|
530
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ _("div", {
|
|
531
531
|
className: "flex flex-wrap gap-2",
|
|
532
|
-
children:
|
|
532
|
+
children: x.map((e) => /* @__PURE__ */ _("button", {
|
|
533
533
|
type: "button",
|
|
534
|
-
onClick: () =>
|
|
535
|
-
className: `px-3 py-1.5 rounded-lg border text-sm transition-colors ${
|
|
534
|
+
onClick: () => H(e),
|
|
535
|
+
className: `px-3 py-1.5 rounded-lg border text-sm transition-colors ${A.applicableProductIds.includes(e) ? "border-action-primary-bg bg-[var(--color-accent-soft)] text-text-link font-medium" : "border-border-subtle hover:border-action-primary-bg/50"}`,
|
|
536
536
|
children: e
|
|
537
537
|
}, e))
|
|
538
538
|
}),
|
|
539
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ _("p", {
|
|
540
540
|
className: "text-xs text-text-muted mt-1",
|
|
541
|
-
children:
|
|
541
|
+
children: A.applicableProductIds.length === 0 ? "No selection = applies to all products" : `Applies to: ${A.applicableProductIds.join(", ")}`
|
|
542
542
|
})
|
|
543
543
|
] }),
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ v("div", { children: [
|
|
545
|
+
/* @__PURE__ */ _("label", {
|
|
546
546
|
className: "block text-sm font-medium text-text-primary mb-2",
|
|
547
547
|
children: "Applicable Purchase Types"
|
|
548
548
|
}),
|
|
549
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ _("div", {
|
|
550
550
|
className: "flex flex-wrap gap-2",
|
|
551
|
-
children:
|
|
551
|
+
children: S.map(({ value: e, label: t }) => /* @__PURE__ */ _("button", {
|
|
552
552
|
type: "button",
|
|
553
|
-
onClick: () =>
|
|
554
|
-
className: `px-3 py-1.5 rounded-lg border text-sm transition-colors ${
|
|
553
|
+
onClick: () => U(e),
|
|
554
|
+
className: `px-3 py-1.5 rounded-lg border text-sm transition-colors ${A.applicableEntityTypes.includes(e) ? "border-action-primary-bg bg-[var(--color-accent-soft)] text-text-link font-medium" : "border-border-subtle hover:border-action-primary-bg/50"}`,
|
|
555
555
|
children: t
|
|
556
556
|
}, e))
|
|
557
557
|
}),
|
|
558
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ _("p", {
|
|
559
559
|
className: "text-xs text-text-muted mt-1",
|
|
560
|
-
children:
|
|
560
|
+
children: A.applicableEntityTypes.length === 0 ? "No selection = applies to plan, add-on, and store purchases" : `Applies to: ${A.applicableEntityTypes.join(", ")}`
|
|
561
561
|
})
|
|
562
562
|
] })
|
|
563
563
|
]
|
|
564
564
|
}),
|
|
565
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ v("div", {
|
|
566
566
|
className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
|
|
567
567
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ _("h3", {
|
|
569
569
|
className: "text-lg font-semibold text-text-primary",
|
|
570
570
|
children: "Coupon Scope"
|
|
571
571
|
}),
|
|
572
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
|
|
573
573
|
className: "block text-sm font-medium text-text-primary mb-2",
|
|
574
574
|
children: "Who can use this coupon? *"
|
|
575
|
-
}), /* @__PURE__ */
|
|
576
|
-
value:
|
|
577
|
-
onChange: (e) =>
|
|
575
|
+
}), /* @__PURE__ */ v(c, {
|
|
576
|
+
value: A.scope,
|
|
577
|
+
onChange: (e) => R("scope", e.target.value),
|
|
578
578
|
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)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
579
579
|
children: [
|
|
580
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ _("option", {
|
|
581
581
|
value: "GENERIC",
|
|
582
582
|
children: "Anyone (Public)"
|
|
583
583
|
}),
|
|
584
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ _("option", {
|
|
585
585
|
value: "USER_SPECIFIC",
|
|
586
586
|
children: "Specific Users Only"
|
|
587
587
|
}),
|
|
588
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ _("option", {
|
|
589
589
|
value: "REFERRAL",
|
|
590
590
|
children: "Referral Code"
|
|
591
591
|
}),
|
|
592
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ _("option", {
|
|
593
593
|
value: "CAMPAIGN",
|
|
594
594
|
children: "Campaign-Specific"
|
|
595
595
|
})
|
|
596
596
|
]
|
|
597
597
|
})] }),
|
|
598
|
-
|
|
598
|
+
A.scope === "CAMPAIGN" && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
|
|
599
599
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
600
600
|
children: "Campaign Name"
|
|
601
|
-
}), /* @__PURE__ */
|
|
601
|
+
}), /* @__PURE__ */ _("input", {
|
|
602
602
|
type: "text",
|
|
603
|
-
value:
|
|
604
|
-
onChange: (e) =>
|
|
603
|
+
value: A.campaignName,
|
|
604
|
+
onChange: (e) => R("campaignName", e.target.value),
|
|
605
605
|
placeholder: "e.g., Summer Sale 2024",
|
|
606
606
|
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)]"
|
|
607
607
|
})] }),
|
|
608
|
-
|
|
609
|
-
/* @__PURE__ */
|
|
608
|
+
A.scope === "USER_SPECIFIC" && /* @__PURE__ */ v("div", { children: [
|
|
609
|
+
/* @__PURE__ */ _("label", {
|
|
610
610
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
611
|
-
children: /* @__PURE__ */
|
|
611
|
+
children: /* @__PURE__ */ v("span", {
|
|
612
612
|
className: "flex items-center gap-1.5",
|
|
613
|
-
children: [/* @__PURE__ */
|
|
613
|
+
children: [/* @__PURE__ */ _(m, { className: "size-4" }), "Restricted Users *"]
|
|
614
614
|
})
|
|
615
615
|
}),
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
className: `min-h-[42px] flex flex-wrap gap-2 px-3 py-2 rounded-lg border ${
|
|
618
|
-
onClick: () =>
|
|
619
|
-
children: [
|
|
616
|
+
/* @__PURE__ */ v("div", {
|
|
617
|
+
className: `min-h-[42px] flex flex-wrap gap-2 px-3 py-2 rounded-lg border ${M.restrictedToUserIds ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface cursor-text`,
|
|
618
|
+
onClick: () => k.current?.focus(),
|
|
619
|
+
children: [A.restrictedToUserIds.map((e) => /* @__PURE__ */ v("span", {
|
|
620
620
|
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",
|
|
621
|
-
children: [e, /* @__PURE__ */
|
|
621
|
+
children: [e, /* @__PURE__ */ _("button", {
|
|
622
622
|
type: "button",
|
|
623
623
|
onClick: (t) => {
|
|
624
|
-
t.stopPropagation(),
|
|
624
|
+
t.stopPropagation(), V(e);
|
|
625
625
|
},
|
|
626
626
|
className: "hover:text-status-error-text",
|
|
627
|
-
children: /* @__PURE__ */
|
|
627
|
+
children: /* @__PURE__ */ _(h, { className: "size-3" })
|
|
628
628
|
})]
|
|
629
|
-
}, e)), /* @__PURE__ */
|
|
630
|
-
ref:
|
|
629
|
+
}, e)), /* @__PURE__ */ _("input", {
|
|
630
|
+
ref: k,
|
|
631
631
|
type: "text",
|
|
632
|
-
value:
|
|
633
|
-
onChange: (e) =>
|
|
632
|
+
value: D,
|
|
633
|
+
onChange: (e) => O(e.target.value),
|
|
634
634
|
onKeyDown: (e) => {
|
|
635
|
-
e.key === "Enter" || e.key === "," ? (e.preventDefault(),
|
|
635
|
+
e.key === "Enter" || e.key === "," ? (e.preventDefault(), B(D)) : e.key === "Backspace" && !D && A.restrictedToUserIds.length > 0 && V(A.restrictedToUserIds[A.restrictedToUserIds.length - 1]);
|
|
636
636
|
},
|
|
637
|
-
onBlur: () =>
|
|
638
|
-
placeholder:
|
|
637
|
+
onBlur: () => B(D),
|
|
638
|
+
placeholder: A.restrictedToUserIds.length === 0 ? "Enter user email or ID, press Enter to add" : "Add another…",
|
|
639
639
|
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)]"
|
|
640
640
|
})]
|
|
641
641
|
}),
|
|
642
|
-
|
|
642
|
+
M.restrictedToUserIds && /* @__PURE__ */ _("p", {
|
|
643
643
|
className: "text-sm text-status-error-text mt-1",
|
|
644
|
-
children:
|
|
644
|
+
children: M.restrictedToUserIds
|
|
645
645
|
}),
|
|
646
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ _("p", {
|
|
647
647
|
className: "text-xs text-text-muted mt-1",
|
|
648
648
|
children: "Type an email or user ID and press Enter or comma to add. Only these users can redeem this coupon."
|
|
649
649
|
})
|
|
650
650
|
] })
|
|
651
651
|
]
|
|
652
652
|
}),
|
|
653
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ v("div", {
|
|
654
654
|
className: "flex items-center justify-end gap-3",
|
|
655
|
-
children: [/* @__PURE__ */
|
|
655
|
+
children: [/* @__PURE__ */ _("button", {
|
|
656
656
|
type: "button",
|
|
657
|
-
onClick: () =>
|
|
657
|
+
onClick: () => T("/coupons"),
|
|
658
658
|
className: "px-6 py-3 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
|
|
659
659
|
children: "Cancel"
|
|
660
|
-
}), /* @__PURE__ */
|
|
660
|
+
}), /* @__PURE__ */ _("button", {
|
|
661
661
|
type: "submit",
|
|
662
|
-
disabled:
|
|
662
|
+
disabled: P,
|
|
663
663
|
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",
|
|
664
|
-
children:
|
|
664
|
+
children: P ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", { className: "size-4 border-2 border-action-primary-text border-t-transparent rounded-full animate-spin" }), "Creating…"] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(f, { className: "size-4" }), "Create Coupon"] })
|
|
665
665
|
})]
|
|
666
666
|
})
|
|
667
667
|
]
|
|
@@ -669,6 +669,6 @@ var y = [
|
|
|
669
669
|
]
|
|
670
670
|
});
|
|
671
671
|
};
|
|
672
|
-
export {
|
|
672
|
+
export { C as CreateCouponPage };
|
|
673
673
|
|
|
674
674
|
//# sourceMappingURL=CreateCouponPage.js.map
|