@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.
Files changed (96) hide show
  1. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
  2. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
  4. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  5. package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
  6. package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
  7. package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
  8. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  9. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
  10. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  11. package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
  12. package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
  13. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
  14. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  15. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
  16. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  17. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
  18. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  19. package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
  20. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  21. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
  22. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  23. package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
  24. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  25. package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
  26. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  27. package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
  28. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  29. package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
  30. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  31. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
  32. package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
  33. package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
  34. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  35. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
  36. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  37. package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
  38. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  39. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
  40. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  41. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
  42. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  43. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
  44. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  45. package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
  46. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  47. package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
  48. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  49. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
  50. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  51. package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
  52. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  53. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
  54. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  55. package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
  56. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  57. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
  58. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
  59. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
  60. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
  61. package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
  62. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  63. package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
  64. package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
  65. package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
  66. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  67. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
  68. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  69. package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
  70. package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
  71. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
  72. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
  73. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
  74. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
  75. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
  76. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
  77. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  78. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
  79. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
  80. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
  81. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  82. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
  83. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
  84. package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
  85. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  86. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
  87. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  88. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
  89. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  90. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
  91. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  92. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
  93. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  94. package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
  95. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  96. 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 v = [
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
- ], y = () => {
89
- let { t: y } = _(), b = (e, t) => {
90
- let n = y(e);
89
+ ], b = () => {
90
+ let { t: b } = _(), x = (e, t) => {
91
+ let n = b(e);
91
92
  return n === e ? t : n;
92
- }, x = i(), S = n(), [C, w] = o(""), T = a(null), [E, D] = o({
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
- }), [O, k] = o({}), [A, j] = o(!1), M = v.find((e) => e.code === E.currency)?.symbol ?? E.currency, [N] = r({ refetchQueries: ["ListCoupons"] });
111
- if (!S.canManageDiscounts) return /* @__PURE__ */ h(e, { message: "You don't have permission to create coupons." });
112
- let P = (e, t) => {
113
- D((n) => ({
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
- })), O[e] && k((t) => {
117
+ })), k[e] && A((t) => {
117
118
  let n = { ...t };
118
119
  return delete n[e], n;
119
120
  });
120
- }, F = () => {
121
+ }, I = () => {
121
122
  let e = {};
122
- return E.code.trim() ? /^[A-Z0-9-_]+$/.test(E.code) ? E.code.length < 3 ? e.code = "Code must be at least 3 characters" : E.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", E.name.trim() || (e.name = "Coupon name is required"), E.value <= 0 && (e.value = "Value must be greater than 0"), E.type === "PERCENTAGE" && E.value > 100 && (e.value = "Percentage cannot exceed 100%"), E.scope === "USER_SPECIFIC" && E.restrictedToUserIds.length === 0 && (e.restrictedToUserIds = "Add at least one user email or ID"), E.validFrom || (e.validFrom = "Start date is required"), E.validUntil && E.validUntil < E.validFrom && (e.validUntil = "End date must be after start date"), k(e), Object.keys(e).length === 0;
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
- P("restrictedToUserIds", E.restrictedToUserIds.filter((t) => t !== e));
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: [/* @__PURE__ */ g("div", {
132
- className: "flex items-center gap-4",
133
- children: [/* @__PURE__ */ h("button", {
134
- type: "button",
135
- onClick: () => x("/coupons"),
136
- className: "p-2 rounded-lg hover:bg-bg-sunken text-text-muted hover:text-text-primary",
137
- children: /* @__PURE__ */ h(s, { className: "size-5" })
138
- }), /* @__PURE__ */ h(t, {
139
- title: b("billing.coupons.createTitle", "Create Coupon"),
140
- description: "Create a new discount code or promotional offer",
141
- icon: /* @__PURE__ */ h(d, { className: "size-6" })
142
- })]
143
- }), /* @__PURE__ */ g("form", {
144
- onSubmit: async (e) => {
145
- if (e.preventDefault(), F()) {
146
- j(!0);
147
- try {
148
- if ((await N({ variables: { input: {
149
- code: E.code,
150
- name: E.name,
151
- description: E.description,
152
- scope: E.scope,
153
- type: E.type,
154
- value: E.value,
155
- currency: E.currency,
156
- minPurchaseAmount: E.minPurchaseAmount,
157
- maxDiscountAmount: E.maxDiscountAmount,
158
- maxTotalUses: E.maxTotalUses,
159
- maxUsesPerUser: E.maxUsesPerUser,
160
- validFrom: new Date(E.validFrom).toISOString(),
161
- validUntil: E.validUntil ? new Date(E.validUntil).toISOString() : void 0,
162
- restrictedToUserIds: E.restrictedToUserIds,
163
- applicableProducts: E.applicableProducts,
164
- applicableServices: E.applicableServices,
165
- excludedProducts: [],
166
- excludedServices: [],
167
- campaignName: E.campaignName || void 0
168
- } } })).data?.createCoupon) x("/coupons");
169
- else throw Error("Failed to create coupon");
170
- } catch (e) {
171
- console.error("Error creating coupon:", e), k({ code: e instanceof Error ? e.message : "Failed to create coupon. Please try again." });
172
- } finally {
173
- j(!1);
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
- className: "space-y-6",
178
- children: [
179
- /* @__PURE__ */ g("div", {
180
- className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
181
- children: [
182
- /* @__PURE__ */ h("h3", {
183
- className: "text-lg font-semibold text-text-primary",
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__ */ h("p", {
203
- className: "text-xs text-text-muted mt-1",
204
- children: "Use uppercase letters, numbers, hyphens, and underscores"
205
- })
206
- ] }),
207
- /* @__PURE__ */ g("div", { children: [
208
- /* @__PURE__ */ h("label", {
209
- className: "block text-sm font-medium text-text-primary mb-1",
210
- children: "Display Name *"
211
- }),
212
- /* @__PURE__ */ h("input", {
213
- type: "text",
214
- value: E.name,
215
- onChange: (e) => P("name", e.target.value),
216
- placeholder: "e.g., Welcome 20% Off",
217
- className: `w-full px-4 py-2 rounded-input border ${O.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)]`
218
- }),
219
- O.name && /* @__PURE__ */ h("p", {
220
- className: "text-sm text-status-error-text mt-1",
221
- children: O.name
222
- })
223
- ] }),
224
- /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
225
- className: "block text-sm font-medium text-text-primary mb-1",
226
- children: "Description"
227
- }), /* @__PURE__ */ h("textarea", {
228
- value: E.description,
229
- onChange: (e) => P("description", e.target.value),
230
- placeholder: "Optional description for internal use",
231
- rows: 3,
232
- 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)]"
233
- })] })
234
- ]
235
- }),
236
- /* @__PURE__ */ g("div", {
237
- className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-4",
238
- children: [
239
- /* @__PURE__ */ h("h3", {
240
- className: "text-lg font-semibold text-text-primary",
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: "Coupon Currency *"
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__ */ h("select", {
249
- value: E.currency,
250
- onChange: (e) => P("currency", e.target.value),
251
- 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)]",
252
- children: v.map(({ code: e, symbol: t, name: n }) => /* @__PURE__ */ g("option", {
253
- value: e,
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
- t,
256
- " ",
257
- e,
258
- " — ",
259
- n
342
+ "Minimum Purchase Amount (",
343
+ D.currency,
344
+ ")"
260
345
  ]
261
- }, e))
262
- }),
263
- /* @__PURE__ */ h("p", {
264
- className: "text-xs text-text-muted mt-1",
265
- 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."
266
- })
267
- ] }),
268
- /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
269
- className: "block text-sm font-medium text-text-primary mb-2",
270
- children: "Discount Type *"
271
- }), /* @__PURE__ */ h("div", {
272
- className: "grid grid-cols-3 gap-3",
273
- children: [
274
- {
275
- value: "PERCENTAGE",
276
- label: "Percentage",
277
- icon: l
278
- },
279
- {
280
- value: "FIXED_AMOUNT",
281
- label: `Fixed (${M})`,
282
- icon: null
283
- },
284
- {
285
- value: "FREE_SHIPPING",
286
- label: "Free Shipping",
287
- icon: c
288
- }
289
- ].map(({ value: e, label: t, icon: n }) => /* @__PURE__ */ g("button", {
290
- type: "button",
291
- onClick: () => P("type", e),
292
- className: `p-4 rounded-lg border-2 transition-colors ${E.type === e ? "border-action-primary-bg bg-[var(--color-accent-soft)]" : "border-border-subtle hover:border-action-primary-bg/50"}`,
293
- children: [n ? /* @__PURE__ */ h(n, { className: "size-5 mx-auto mb-2" }) : /* @__PURE__ */ h("span", {
294
- className: "block text-lg font-bold mb-2",
295
- children: M
296
- }), /* @__PURE__ */ h("p", {
297
- className: "text-sm font-medium",
298
- children: t
299
- })]
300
- }, e))
301
- })] }),
302
- /* @__PURE__ */ g("div", { children: [
303
- /* @__PURE__ */ h("label", {
304
- className: "block text-sm font-medium text-text-primary mb-1",
305
- children: "Discount Value *"
306
- }),
307
- /* @__PURE__ */ h("div", {
308
- className: "relative",
309
- children: E.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", {
310
- type: "number",
311
- value: E.value,
312
- onChange: (e) => P("value", parseFloat(e.target.value)),
313
- min: "0",
314
- max: "100",
315
- step: "0.01",
316
- className: `w-full pl-10 pr-4 py-2 rounded-input border ${O.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)]`
317
- })] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
318
- className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
319
- children: M
320
- }), /* @__PURE__ */ h("input", {
321
- type: "number",
322
- value: E.value,
323
- onChange: (e) => P("value", parseFloat(e.target.value)),
324
- min: "0",
325
- step: "0.01",
326
- className: `w-full pl-10 pr-4 py-2 rounded-input border ${O.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)]`
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
- className: "relative",
345
- children: [/* @__PURE__ */ h("span", {
346
- className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-text-muted font-medium",
347
- children: M
348
- }), /* @__PURE__ */ h("input", {
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: E.minPurchaseAmount || "",
351
- onChange: (e) => P("minPurchaseAmount", e.target.value ? parseFloat(e.target.value) : null),
352
- min: "0",
353
- step: "0.01",
354
- placeholder: "No minimum",
355
- 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)]"
356
- })]
357
- }),
358
- /* @__PURE__ */ g("p", {
359
- className: "text-xs text-text-muted mt-1",
360
- children: [
361
- "Order must be at least this amount in ",
362
- E.currency,
363
- " (auto-converted for other currencies)"
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: E.maxDiscountAmount || "",
384
- onChange: (e) => P("maxDiscountAmount", e.target.value ? parseFloat(e.target.value) : null),
385
- min: "0",
386
- step: "0.01",
387
- placeholder: "No maximum",
388
- 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)]"
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("p", {
392
- className: "text-xs text-text-muted mt-1",
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
- "Cap the discount in ",
395
- E.currency,
396
- " — auto-converted to the user's payment currency"
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: "Total Usage Limit"
413
- }),
414
- /* @__PURE__ */ h("input", {
415
- type: "number",
416
- value: E.maxTotalUses || "",
417
- onChange: (e) => P("maxTotalUses", e.target.value ? parseInt(e.target.value) : null),
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__ */ h("p", {
423
- className: "text-xs text-text-muted mt-1",
424
- children: "Maximum number of times this coupon can be used across all users"
425
- })
426
- ] }),
427
- /* @__PURE__ */ g("div", { children: [
428
- /* @__PURE__ */ h("label", {
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__ */ h("option", {
510
- value: "USER_SPECIFIC",
511
- children: "Specific Users Only"
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("option", {
514
- value: "REFERRAL",
515
- children: "Referral Code"
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("option", {
518
- value: "CAMPAIGN",
519
- children: "Campaign-Specific"
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
- E.scope === "CAMPAIGN" && /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
524
- className: "block text-sm font-medium text-text-primary mb-1",
525
- children: "Campaign Name"
526
- }), /* @__PURE__ */ h("input", {
527
- type: "text",
528
- value: E.campaignName,
529
- onChange: (e) => P("campaignName", e.target.value),
530
- placeholder: "e.g., Summer Sale 2024",
531
- 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)]"
532
- })] }),
533
- E.scope === "USER_SPECIFIC" && /* @__PURE__ */ g("div", { children: [
534
- /* @__PURE__ */ h("label", {
535
- className: "block text-sm font-medium text-text-primary mb-1",
536
- children: /* @__PURE__ */ g("span", {
537
- className: "flex items-center gap-1.5",
538
- children: [/* @__PURE__ */ h(f, { className: "size-4" }), "Restricted Users *"]
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 { y as CreateCouponPage };
602
+ export { b as CreateCouponPage };
598
603
 
599
604
  //# sourceMappingURL=CreateCouponPage.js.map