@burdenoff/microfe-product 2026.1126.1 → 2026.1130.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.
@@ -1,400 +1,386 @@
1
1
  import { useTr as e } from "../../../shared/hooks/useTr.js";
2
- import { useCallback as t, useEffect as n, useState as r } from "react";
3
- import { Check as i, DollarSign as a, Edit as ee, List as o, Loader2 as s, Plus as c, ToggleLeft as l, ToggleRight as u } from "lucide-react";
4
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
- import { IllustratedEmptyState as te } from "@burdenoff/fe-libs/ui";
6
- import { graphqlFetch as m } from "@burdenoff/fe-libs/shared/graphql/fetch";
2
+ import { formatPrice as t } from "../../../shared/utils/formatPrice.js";
3
+ import { useCallback as n, useEffect as r, useState as i } from "react";
4
+ import { Check as a, DollarSign as ee, Edit as o, List as te, Loader2 as s, Plus as c, ToggleLeft as l, ToggleRight as u } from "lucide-react";
5
+ import { Fragment as ne, jsx as d, jsxs as f } from "react/jsx-runtime";
6
+ import { IllustratedEmptyState as re } from "@burdenoff/fe-libs/ui";
7
+ import { graphqlFetch as ie } from "@burdenoff/fe-libs/shared/graphql/fetch";
7
8
  // src/product-management/modules/products/components/ProductPlans.tsx
8
- var ne = "\n query GetAllPlans {\n getAllPlans {\n id\n name\n price\n currency\n duration\n isActive\n productID\n features {\n id\n quotaId\n quota {\n id\n name\n limits\n }\n }\n createdAt\n }\n }\n", h = "\n query GetAllQuotas {\n getAllQuotas {\n id\n name\n limits\n }\n }\n", g = "\n mutation CreateQuota($input: createQuotaInput!) {\n createQuota(input: $input)\n }\n", re = "\n mutation CreatePlan($input: createPlanInput!) {\n createPlan(input: $input)\n }\n", _ = "\n mutation UpdatePlan($input: updatePlanInput!) {\n updatePlan(input: $input)\n }\n", ie = "\n mutation TogglePlan($planID: ID!, $status: Boolean!) {\n togglePlan(planID: $planID, status: $status)\n }\n";
9
- function v({ productId: v, productName: ae, readOnly: y = !1 }) {
10
- let b = e(), [x, S] = r([]), [C, w] = r([]), [oe, T] = r(!0), [E, D] = r(null), [O, k] = r(!1), [A, j] = r(null), [M, N] = r(!1), [P, F] = r(!1), [I, L] = r(""), [R, z] = r({
9
+ var p = "USD", m = "\n query GetAllPlans {\n getAllPlans {\n id\n name\n price\n currency\n duration\n isActive\n productID\n features {\n id\n quotaId\n quota {\n id\n name\n limits\n }\n }\n createdAt\n }\n }\n", h = "\n query GetAllQuotas {\n getAllQuotas {\n id\n name\n limits\n }\n }\n", g = "\n mutation CreateQuota($input: createQuotaInput!) {\n createQuota(input: $input)\n }\n", _ = "\n mutation CreatePlan($input: createPlanInput!) {\n createPlan(input: $input)\n }\n", v = "\n mutation UpdatePlan($input: updatePlanInput!) {\n updatePlan(input: $input)\n }\n", ae = "\n mutation TogglePlan($planID: ID!, $status: Boolean!) {\n togglePlan(planID: $planID, status: $status)\n }\n";
10
+ function y({ productId: y, productName: oe, readOnly: b = !1 }) {
11
+ let x = e(), [S, C] = i([]), [w, T] = i([]), [E, D] = i(!0), [O, k] = i(null), [A, j] = i(!1), [M, N] = i(null), [P, F] = i(!1), [I, L] = i(!1), [R, z] = i(""), [B, V] = i({
11
12
  name: "",
12
13
  price: "",
13
- currency: "USD",
14
14
  duration: "monthly",
15
15
  quotas: []
16
- }), B = t(async (e, t) => {
17
- let n = await m({
16
+ }), H = n(async (e, t) => {
17
+ let n = await ie({
18
18
  gateway: "global",
19
19
  query: e,
20
20
  variables: t
21
21
  });
22
22
  if (n.errors?.length) throw Error(n.errors[0].message);
23
23
  return n.data ?? null;
24
- }, []), V = t(async () => {
25
- let [e, t] = await Promise.all([B(ne), B(h)]);
24
+ }, []), U = n(async () => {
25
+ let [e, t] = await Promise.all([H(m), H(h)]);
26
26
  return {
27
- plans: (e?.getAllPlans || []).filter((e) => e.productID === v),
27
+ plans: (e?.getAllPlans || []).filter((e) => e.productID === y),
28
28
  quotas: t?.getAllQuotas || []
29
29
  };
30
- }, [v, B]), H = t((e) => {
31
- D(b("products.failedToLoadPlans", "Failed to load plans")), console.error("Failed to fetch plans:", e);
32
- }, [b]), U = t(async () => {
33
- T(!0);
30
+ }, [y, H]), W = n((e) => {
31
+ k(x("products.failedToLoadPlans", "Failed to load plans")), console.error("Failed to fetch plans:", e);
32
+ }, [x]), G = n(async () => {
33
+ D(!0);
34
34
  try {
35
- let e = await V();
36
- S(e.plans), w(e.quotas), D(null);
35
+ let e = await U();
36
+ C(e.plans), T(e.quotas), k(null);
37
37
  } catch (e) {
38
- H(e);
38
+ W(e);
39
39
  } finally {
40
- T(!1);
40
+ D(!1);
41
41
  }
42
- }, [V, H]);
43
- n(() => {
42
+ }, [U, W]);
43
+ r(() => {
44
44
  let e = !0;
45
- return V().then((t) => {
46
- e && (S(t.plans), w(t.quotas), D(null));
45
+ return U().then((t) => {
46
+ e && (C(t.plans), T(t.quotas), k(null));
47
47
  }).catch((t) => {
48
- e && H(t);
48
+ e && W(t);
49
49
  }).finally(() => {
50
- e && T(!1);
50
+ e && D(!1);
51
51
  }), () => {
52
52
  e = !1;
53
53
  };
54
- }, [V, H]);
55
- let W = () => {
56
- z({
54
+ }, [U, W]);
55
+ let K = () => {
56
+ V({
57
57
  name: "",
58
58
  price: "",
59
- currency: "USD",
60
59
  duration: "monthly",
61
60
  quotas: []
62
- }), j(null), k(!1);
63
- }, G = async (e) => {
64
- e.preventDefault(), N(!0);
61
+ }), N(null), j(!1);
62
+ }, se = async (e) => {
63
+ e.preventDefault(), F(!0);
65
64
  try {
66
- A ? await B(_, { input: {
67
- id: A.id,
68
- name: R.name,
69
- price: parseFloat(R.price),
70
- currency: R.currency,
71
- duration: R.duration,
72
- quotas: R.quotas
73
- } }) : await B(re, { input: {
74
- name: R.name,
75
- price: parseFloat(R.price),
76
- currency: R.currency,
77
- duration: R.duration,
78
- productId: v,
79
- quotas: R.quotas
80
- } }), W(), await U();
65
+ M ? await H(v, { input: {
66
+ id: M.id,
67
+ name: B.name,
68
+ price: parseFloat(B.price),
69
+ duration: B.duration,
70
+ quotas: B.quotas
71
+ } }) : await H(_, { input: {
72
+ name: B.name,
73
+ price: parseFloat(B.price),
74
+ currency: p,
75
+ duration: B.duration,
76
+ productId: y,
77
+ quotas: B.quotas
78
+ } }), K(), await G();
81
79
  } catch (e) {
82
- console.error("Failed to save plan:", e), D(b("products.failedToSavePlan", "Failed to save plan"));
80
+ console.error("Failed to save plan:", e), k(x("products.failedToSavePlan", "Failed to save plan"));
83
81
  } finally {
84
- N(!1);
82
+ F(!1);
85
83
  }
86
- }, K = async (e) => {
84
+ }, q = async (e) => {
87
85
  try {
88
- await B(ie, {
86
+ await H(ae, {
89
87
  planID: e.id,
90
88
  status: !e.isActive
91
- }), await U();
89
+ }), await G();
92
90
  } catch (e) {
93
91
  console.error("Failed to toggle plan:", e);
94
92
  }
95
- }, q = (e) => {
96
- j(e), z({
93
+ }, ce = (e) => {
94
+ N(e), V({
97
95
  name: e.name,
98
96
  price: e.price.toString(),
99
- currency: e.currency,
100
97
  duration: e.duration,
101
98
  quotas: (e.features || []).map((e) => ({
102
99
  quotaId: e.quotaId,
103
100
  quantity: 1
104
101
  }))
105
- }), k(!0);
102
+ }), j(!0);
106
103
  }, J = async () => {
107
- if (I.trim()) try {
108
- N(!0), await B(g, { input: {
109
- name: I.trim(),
104
+ if (R.trim()) try {
105
+ F(!0), await H(g, { input: {
106
+ name: R.trim(),
110
107
  quotaType: "PRODUCT_SPECIFIC",
111
108
  limits: {},
112
109
  reusable: !0
113
- } }), L(""), F(!1), await U();
110
+ } }), z(""), L(!1), await G();
114
111
  } catch (e) {
115
- console.error("Failed to create quota:", e), D(b("products.failedToCreateFeature", "Failed to create feature"));
112
+ console.error("Failed to create quota:", e), k(x("products.failedToCreateFeature", "Failed to create feature"));
116
113
  } finally {
117
- N(!1);
114
+ F(!1);
118
115
  }
119
116
  }, Y = (e) => {
120
117
  let t = e.toLowerCase();
121
118
  return t.includes("team") || t.includes("business") || t.includes("enterprise");
122
- }, X = x.filter((e) => !Y(e.name)), Z = x.filter((e) => Y(e.name)), se = X.filter((e) => e.duration === "monthly"), ce = X.filter((e) => e.duration === "yearly"), [Q, $] = r("individual");
123
- return /* @__PURE__ */ p("div", {
119
+ }, X = S.filter((e) => !Y(e.name)), Z = S.filter((e) => Y(e.name)), le = X.filter((e) => e.duration === "monthly"), ue = X.filter((e) => e.duration === "yearly"), [Q, $] = i("individual");
120
+ return /* @__PURE__ */ f("div", {
124
121
  className: "bg-bg-surface bg-accent-wash border border-border-seam rounded-card p-6 shadow-elevation-1 transition-[box-shadow,border-color] duration-200 hover:border-border-strong hover:shadow-[var(--shadow-pop)] lg:col-span-2",
125
122
  children: [
126
- /* @__PURE__ */ p("div", {
123
+ /* @__PURE__ */ f("div", {
127
124
  className: "flex items-center justify-between mb-4",
128
- children: [/* @__PURE__ */ p("h2", {
125
+ children: [/* @__PURE__ */ f("h2", {
129
126
  className: "text-lg font-semibold text-text-primary flex items-center gap-2",
130
- children: [/* @__PURE__ */ f(a, { size: 18 }), b("products.pricingPlans", "Pricing Plans")]
131
- }), !y && /* @__PURE__ */ p("button", {
127
+ children: [/* @__PURE__ */ d(ee, { size: 18 }), x("products.pricingPlans", "Pricing Plans")]
128
+ }), !b && /* @__PURE__ */ f("button", {
132
129
  type: "button",
133
130
  onClick: () => {
134
- W(), k(!O);
131
+ K(), j(!A);
135
132
  },
136
133
  className: "\n inline-flex items-center gap-1.5 px-3 py-1.5\n bg-[var(--color-bg-accent)] text-[var(--color-text-on-accent)]\n rounded-lg text-sm font-medium\n hover:opacity-90 transition-all duration-200\n ",
137
- children: [/* @__PURE__ */ f(c, { size: 14 }), b("products.addPlan", "Add Plan")]
134
+ children: [/* @__PURE__ */ d(c, { size: 14 }), x("products.addPlan", "Add Plan")]
138
135
  })]
139
136
  }),
140
- O && !y && /* @__PURE__ */ p("form", {
141
- onSubmit: G,
137
+ A && !b && /* @__PURE__ */ f("form", {
138
+ onSubmit: se,
142
139
  className: "mb-6 p-4 bg-bg-sunken rounded-lg border border-default",
143
140
  children: [
144
- /* @__PURE__ */ f("h3", {
141
+ /* @__PURE__ */ d("h3", {
145
142
  className: "text-sm font-semibold text-text-primary mb-3",
146
- children: A ? b("products.editPlan", "Edit Plan") : b("products.createNewPlan", "Create New Plan")
143
+ children: M ? x("products.editPlan", "Edit Plan") : x("products.createNewPlan", "Create New Plan")
147
144
  }),
148
- /* @__PURE__ */ p("div", {
145
+ /* @__PURE__ */ f("div", {
149
146
  className: "grid grid-cols-2 sm:grid-cols-4 gap-3",
150
147
  children: [
151
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("label", {
148
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
152
149
  className: "block text-xs font-medium text-text-secondary mb-1",
153
- children: [b("products.planName", "Name"), " *"]
154
- }), /* @__PURE__ */ f("input", {
150
+ children: [x("products.planName", "Name"), " *"]
151
+ }), /* @__PURE__ */ d("input", {
155
152
  type: "text",
156
- value: R.name,
157
- onChange: (e) => z({
158
- ...R,
153
+ value: B.name,
154
+ onChange: (e) => V({
155
+ ...B,
159
156
  name: e.target.value
160
157
  }),
161
158
  placeholder: "e.g. Basic",
162
159
  required: !0,
163
160
  className: "w-full px-3 py-2 text-sm rounded-md border border-default bg-surface text-text-primary"
164
161
  })] }),
165
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("label", {
162
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
166
163
  className: "block text-xs font-medium text-text-secondary mb-1",
167
- children: [b("products.planPrice", "Price"), " *"]
168
- }), /* @__PURE__ */ f("input", {
164
+ children: [x("products.planPrice", "Price"), " *"]
165
+ }), /* @__PURE__ */ d("input", {
169
166
  type: "number",
170
167
  step: "0.01",
171
168
  min: "0",
172
- value: R.price,
173
- onChange: (e) => z({
174
- ...R,
169
+ value: B.price,
170
+ onChange: (e) => V({
171
+ ...B,
175
172
  price: e.target.value
176
173
  }),
177
174
  placeholder: "9.99",
178
175
  required: !0,
179
176
  className: "w-full px-3 py-2 text-sm rounded-md border border-default bg-surface text-text-primary"
180
177
  })] }),
181
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("label", {
178
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
182
179
  className: "block text-xs font-medium text-text-secondary mb-1",
183
- children: [b("products.planDuration", "Duration"), " *"]
184
- }), /* @__PURE__ */ p("select", {
185
- value: R.duration,
186
- onChange: (e) => z({
187
- ...R,
180
+ children: [x("products.planDuration", "Duration"), " *"]
181
+ }), /* @__PURE__ */ f("select", {
182
+ value: B.duration,
183
+ onChange: (e) => V({
184
+ ...B,
188
185
  duration: e.target.value
189
186
  }),
190
187
  className: "w-full px-3 py-2 text-sm rounded-md border border-default bg-surface text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
191
- children: [/* @__PURE__ */ f("option", {
188
+ children: [/* @__PURE__ */ d("option", {
192
189
  value: "monthly",
193
- children: b("products.monthly", "Monthly")
194
- }), /* @__PURE__ */ f("option", {
190
+ children: x("products.monthly", "Monthly")
191
+ }), /* @__PURE__ */ d("option", {
195
192
  value: "yearly",
196
- children: b("products.yearly", "Yearly")
193
+ children: x("products.yearly", "Yearly")
197
194
  })]
198
195
  })] }),
199
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
200
- className: "block text-xs font-medium text-text-secondary mb-1",
201
- children: b("products.currency", "Currency")
202
- }), /* @__PURE__ */ p("select", {
203
- value: R.currency,
204
- onChange: (e) => z({
205
- ...R,
206
- currency: e.target.value
196
+ /* @__PURE__ */ f("div", { children: [
197
+ /* @__PURE__ */ d("span", {
198
+ id: "plan-currency-label",
199
+ className: "block text-xs font-medium text-text-secondary mb-1",
200
+ children: x("products.currency", "Currency")
207
201
  }),
208
- className: "w-full px-3 py-2 text-sm rounded-md border border-default bg-surface text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
209
- children: [
210
- /* @__PURE__ */ f("option", {
211
- value: "USD",
212
- children: "USD"
213
- }),
214
- /* @__PURE__ */ f("option", {
215
- value: "EUR",
216
- children: "EUR"
217
- }),
218
- /* @__PURE__ */ f("option", {
219
- value: "GBP",
220
- children: "GBP"
221
- }),
222
- /* @__PURE__ */ f("option", {
223
- value: "INR",
224
- children: "INR"
225
- })
226
- ]
227
- })] })
202
+ /* @__PURE__ */ d("output", {
203
+ "aria-labelledby": "plan-currency-label",
204
+ "aria-describedby": "plan-currency-hint",
205
+ className: "block w-full px-3 py-2 text-sm rounded-md border border-default bg-bg-sunken text-text-primary",
206
+ children: M?.currency ?? p
207
+ }),
208
+ /* @__PURE__ */ d("p", {
209
+ id: "plan-currency-hint",
210
+ className: "mt-1 text-xs text-text-secondary",
211
+ children: M ? x("products.planCurrencyLocked", "A plan's currency can't be changed after it is created.") : x("products.planCurrencyBase", "Plans are priced in USD, the billing base currency.")
212
+ })
213
+ ] })
228
214
  ]
229
215
  }),
230
- /* @__PURE__ */ p("div", {
216
+ /* @__PURE__ */ f("div", {
231
217
  className: "mt-3",
232
- children: [/* @__PURE__ */ p("label", {
218
+ children: [/* @__PURE__ */ f("label", {
233
219
  className: "block text-xs font-medium text-text-secondary mb-1",
234
- children: [/* @__PURE__ */ f(o, {
220
+ children: [/* @__PURE__ */ d(te, {
235
221
  size: 12,
236
222
  className: "inline mr-1"
237
- }), b("products.featuresQuotas", "Features / Quotas")]
238
- }), C.length > 0 ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
223
+ }), x("products.featuresQuotas", "Features / Quotas")]
224
+ }), w.length > 0 ? /* @__PURE__ */ f(ne, { children: [/* @__PURE__ */ d("div", {
239
225
  className: "space-y-1.5 max-h-32 overflow-y-auto",
240
- children: C.map((e) => {
241
- let t = R.quotas.some((t) => t.quotaId === e.id);
242
- return /* @__PURE__ */ p("label", {
226
+ children: w.map((e) => {
227
+ let t = B.quotas.some((t) => t.quotaId === e.id);
228
+ return /* @__PURE__ */ f("label", {
243
229
  className: "flex items-center gap-2 text-xs text-text-primary cursor-pointer hover:bg-bg-sunken/50 px-2 py-1 rounded",
244
- children: [/* @__PURE__ */ f("input", {
230
+ children: [/* @__PURE__ */ d("input", {
245
231
  type: "checkbox",
246
232
  checked: t,
247
233
  onChange: (t) => {
248
- t.target.checked ? z({
249
- ...R,
250
- quotas: [...R.quotas, {
234
+ t.target.checked ? V({
235
+ ...B,
236
+ quotas: [...B.quotas, {
251
237
  quotaId: e.id,
252
238
  quantity: 1
253
239
  }]
254
- }) : z({
255
- ...R,
256
- quotas: R.quotas.filter((t) => t.quotaId !== e.id)
240
+ }) : V({
241
+ ...B,
242
+ quotas: B.quotas.filter((t) => t.quotaId !== e.id)
257
243
  });
258
244
  },
259
245
  className: "rounded border-default"
260
246
  }), e.name]
261
247
  }, e.id);
262
248
  })
263
- }), /* @__PURE__ */ p("div", {
249
+ }), /* @__PURE__ */ f("div", {
264
250
  className: "flex items-center gap-2 mt-2",
265
251
  children: [
266
- /* @__PURE__ */ p("p", {
252
+ /* @__PURE__ */ f("p", {
267
253
  className: "text-xs text-text-secondary",
268
254
  children: [
269
- R.quotas.length,
255
+ B.quotas.length,
270
256
  " ",
271
- b("products.featuresSelected", "feature(s) selected")
257
+ x("products.featuresSelected", "feature(s) selected")
272
258
  ]
273
259
  }),
274
- /* @__PURE__ */ f("span", {
260
+ /* @__PURE__ */ d("span", {
275
261
  className: "text-xs text-text-secondary",
276
262
  children: "|"
277
263
  }),
278
- P ? /* @__PURE__ */ p("div", {
264
+ I ? /* @__PURE__ */ f("div", {
279
265
  className: "flex items-center gap-1.5",
280
266
  children: [
281
- /* @__PURE__ */ f("input", {
267
+ /* @__PURE__ */ d("input", {
282
268
  type: "text",
283
- value: I,
284
- onChange: (e) => L(e.target.value),
285
- placeholder: b("products.featureNamePlaceholder", "Feature name"),
269
+ value: R,
270
+ onChange: (e) => z(e.target.value),
271
+ placeholder: x("products.featureNamePlaceholder", "Feature name"),
286
272
  className: "px-2 py-1 text-xs rounded border border-default bg-surface text-text-primary w-36",
287
273
  onKeyDown: (e) => {
288
274
  e.key === "Enter" && (e.preventDefault(), J());
289
275
  }
290
276
  }),
291
- /* @__PURE__ */ f("button", {
277
+ /* @__PURE__ */ d("button", {
292
278
  type: "button",
293
279
  onClick: J,
294
- disabled: M || !I.trim(),
280
+ disabled: P || !R.trim(),
295
281
  className: "px-2 py-1 text-xs bg-[var(--color-bg-accent)] text-[var(--color-text-on-accent)] rounded hover:opacity-90 disabled:opacity-50",
296
- children: b("productCommon.add", "Add")
282
+ children: x("productCommon.add", "Add")
297
283
  }),
298
- /* @__PURE__ */ f("button", {
284
+ /* @__PURE__ */ d("button", {
299
285
  type: "button",
300
286
  onClick: () => {
301
- F(!1), L("");
287
+ L(!1), z("");
302
288
  },
303
289
  className: "px-1.5 py-1 text-xs text-text-secondary hover:text-text-primary",
304
- children: b("productCommon.cancel", "Cancel")
290
+ children: x("productCommon.cancel", "Cancel")
305
291
  })
306
292
  ]
307
- }) : /* @__PURE__ */ f("button", {
293
+ }) : /* @__PURE__ */ d("button", {
308
294
  type: "button",
309
- onClick: () => F(!0),
295
+ onClick: () => L(!0),
310
296
  className: "text-xs text-[var(--color-action-primary-bg)] hover:underline",
311
- children: b("products.createNewFeature", "+ Create new feature")
297
+ children: x("products.createNewFeature", "+ Create new feature")
312
298
  })
313
299
  ]
314
- })] }) : /* @__PURE__ */ p("div", {
300
+ })] }) : /* @__PURE__ */ f("div", {
315
301
  className: "text-xs text-text-secondary",
316
302
  children: [
317
- b("products.noFeaturesCreated", "No features created yet."),
303
+ x("products.noFeaturesCreated", "No features created yet."),
318
304
  " ",
319
- P ? /* @__PURE__ */ p("div", {
305
+ I ? /* @__PURE__ */ f("div", {
320
306
  className: "flex items-center gap-1.5 mt-1.5",
321
307
  children: [
322
- /* @__PURE__ */ f("input", {
308
+ /* @__PURE__ */ d("input", {
323
309
  type: "text",
324
- value: I,
325
- onChange: (e) => L(e.target.value),
310
+ value: R,
311
+ onChange: (e) => z(e.target.value),
326
312
  placeholder: "Feature name",
327
313
  className: "px-2 py-1 text-xs rounded border border-default bg-surface text-text-primary w-36",
328
314
  onKeyDown: (e) => {
329
315
  e.key === "Enter" && (e.preventDefault(), J());
330
316
  }
331
317
  }),
332
- /* @__PURE__ */ f("button", {
318
+ /* @__PURE__ */ d("button", {
333
319
  type: "button",
334
320
  onClick: J,
335
- disabled: M || !I.trim(),
321
+ disabled: P || !R.trim(),
336
322
  className: "px-2 py-1 text-xs bg-[var(--color-bg-accent)] text-[var(--color-text-on-accent)] rounded hover:opacity-90 disabled:opacity-50",
337
323
  children: "Add"
338
324
  }),
339
- /* @__PURE__ */ f("button", {
325
+ /* @__PURE__ */ d("button", {
340
326
  type: "button",
341
327
  onClick: () => {
342
- F(!1), L("");
328
+ L(!1), z("");
343
329
  },
344
330
  className: "px-1.5 py-1 text-xs text-text-secondary hover:text-text-primary",
345
331
  children: "Cancel"
346
332
  })
347
333
  ]
348
- }) : /* @__PURE__ */ f("button", {
334
+ }) : /* @__PURE__ */ d("button", {
349
335
  type: "button",
350
- onClick: () => F(!0),
336
+ onClick: () => L(!0),
351
337
  className: "text-[var(--color-action-primary-bg)] hover:underline",
352
- children: b("products.createYourFirstFeature", "Create your first feature")
338
+ children: x("products.createYourFirstFeature", "Create your first feature")
353
339
  })
354
340
  ]
355
341
  })]
356
342
  }),
357
- /* @__PURE__ */ p("div", {
343
+ /* @__PURE__ */ f("div", {
358
344
  className: "flex gap-2 mt-3",
359
- children: [/* @__PURE__ */ p("button", {
345
+ children: [/* @__PURE__ */ f("button", {
360
346
  type: "submit",
361
- disabled: M,
347
+ disabled: P,
362
348
  className: "\n inline-flex items-center gap-1.5 px-4 py-2\n bg-[var(--color-bg-accent)] text-[var(--color-text-on-accent)]\n rounded-md text-sm font-medium\n hover:opacity-90 transition-all duration-200\n disabled:opacity-50\n ",
363
- children: [M && /* @__PURE__ */ f(s, {
349
+ children: [P && /* @__PURE__ */ d(s, {
364
350
  size: 14,
365
351
  className: "animate-spin"
366
- }), A ? b("products.updatePlan", "Update Plan") : b("products.createPlan", "Create Plan")]
367
- }), /* @__PURE__ */ f("button", {
352
+ }), M ? x("products.updatePlan", "Update Plan") : x("products.createPlan", "Create Plan")]
353
+ }), /* @__PURE__ */ d("button", {
368
354
  type: "button",
369
- onClick: W,
355
+ onClick: K,
370
356
  className: "px-4 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors",
371
- children: b("productCommon.cancel", "Cancel")
357
+ children: x("productCommon.cancel", "Cancel")
372
358
  })]
373
359
  })
374
360
  ]
375
361
  }),
376
- E && /* @__PURE__ */ f("div", {
362
+ O && /* @__PURE__ */ d("div", {
377
363
  className: "mb-4 p-3 bg-[var(--color-status-error-subtle)] border border-[var(--color-status-error-border)] rounded-lg text-sm text-[var(--color-status-error)]",
378
- children: E
364
+ children: O
379
365
  }),
380
- oe ? /* @__PURE__ */ p("div", {
366
+ E ? /* @__PURE__ */ f("div", {
381
367
  className: "flex items-center justify-center py-8",
382
- children: [/* @__PURE__ */ f(s, {
368
+ children: [/* @__PURE__ */ d(s, {
383
369
  size: 20,
384
370
  className: "animate-spin text-text-secondary"
385
- }), /* @__PURE__ */ f("span", {
371
+ }), /* @__PURE__ */ d("span", {
386
372
  className: "ml-2 text-sm text-text-secondary",
387
- children: b("products.loadingPlans", "Loading plans...")
373
+ children: x("products.loadingPlans", "Loading plans...")
388
374
  })]
389
- }) : x.length === 0 ? /* @__PURE__ */ f(te, {
375
+ }) : S.length === 0 ? /* @__PURE__ */ d(re, {
390
376
  illustration: "empty-data",
391
- title: b("products.noPricingPlans", "No pricing plans yet"),
392
- description: b("products.clickAddPlan", "Click \"Add Plan\" to create your first plan")
393
- }) : /* @__PURE__ */ p("div", {
377
+ title: x("products.noPricingPlans", "No pricing plans yet"),
378
+ description: x("products.clickAddPlan", "Click \"Add Plan\" to create your first plan")
379
+ }) : /* @__PURE__ */ f("div", {
394
380
  className: "space-y-6",
395
- children: [Z.length > 0 && /* @__PURE__ */ p("div", {
381
+ children: [Z.length > 0 && /* @__PURE__ */ f("div", {
396
382
  className: "flex gap-2 mb-2",
397
- children: [/* @__PURE__ */ p("button", {
383
+ children: [/* @__PURE__ */ f("button", {
398
384
  type: "button",
399
385
  onClick: () => $("individual"),
400
386
  className: `px-4 py-1.5 rounded-lg text-sm font-medium transition-all ${Q === "individual" ? "bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)]" : "bg-[var(--color-bg-muted)] text-text-secondary hover:text-text-primary"}`,
@@ -403,7 +389,7 @@ function v({ productId: v, productName: ae, readOnly: y = !1 }) {
403
389
  X.length,
404
390
  ")"
405
391
  ]
406
- }), /* @__PURE__ */ p("button", {
392
+ }), /* @__PURE__ */ f("button", {
407
393
  type: "button",
408
394
  onClick: () => $("enterprise"),
409
395
  className: `px-4 py-1.5 rounded-lg text-sm font-medium transition-all ${Q === "enterprise" ? "bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)]" : "bg-[var(--color-bg-muted)] text-text-secondary hover:text-text-primary"}`,
@@ -414,71 +400,71 @@ function v({ productId: v, productName: ae, readOnly: y = !1 }) {
414
400
  ]
415
401
  })]
416
402
  }), (Q === "individual" || Z.length === 0 ? [{
417
- label: b("products.monthlyPlans", "Monthly Plans"),
418
- plans: se
403
+ label: x("products.monthlyPlans", "Monthly Plans"),
404
+ plans: le
419
405
  }, {
420
- label: b("products.yearlyPlans", "Yearly Plans"),
421
- plans: ce
406
+ label: x("products.yearlyPlans", "Yearly Plans"),
407
+ plans: ue
422
408
  }] : [{
423
- label: b("products.enterprisePlans", "Enterprise Plans"),
409
+ label: x("products.enterprisePlans", "Enterprise Plans"),
424
410
  plans: Z
425
- }]).filter((e) => e.plans.length > 0).map((e) => /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h3", {
411
+ }]).filter((e) => e.plans.length > 0).map((e) => /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h3", {
426
412
  className: "text-xs font-semibold text-text-secondary uppercase tracking-wider mb-3",
427
413
  children: e.label
428
- }), /* @__PURE__ */ f("div", {
414
+ }), /* @__PURE__ */ d("div", {
429
415
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
430
416
  children: e.plans.sort((e, t) => e.price - t.price).map((e) => {
431
- let t = e.currency === "USD" ? "$" : e.currency === "EUR" ? "€" : e.currency === "GBP" ? "£" : "₹", n = e.name.toLowerCase().includes("professional") || e.name.toLowerCase().includes("pro");
432
- return /* @__PURE__ */ p("div", {
417
+ let n = e.name.toLowerCase().includes("professional") || e.name.toLowerCase().includes("pro");
418
+ return /* @__PURE__ */ f("div", {
433
419
  className: `
434
420
  relative rounded-xl border p-5 transition-all duration-200
435
421
  ${e.isActive ? "border-default bg-surface hover:shadow-md" : "border-default bg-bg-sunken/30 opacity-60"}
436
422
  ${n ? "border-[var(--color-action-primary-bg)] ring-1 ring-[var(--color-action-primary-bg)]/20" : ""}
437
423
  `,
438
424
  children: [
439
- n && /* @__PURE__ */ f("span", {
425
+ n && /* @__PURE__ */ d("span", {
440
426
  className: "absolute -top-2.5 left-1/2 -translate-x-1/2 px-3 py-0.5 text-xs font-semibold bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)] rounded-full",
441
- children: b("products.popular", "Popular")
427
+ children: x("products.popular", "Popular")
442
428
  }),
443
- /* @__PURE__ */ p("div", {
429
+ /* @__PURE__ */ f("div", {
444
430
  className: "flex items-start justify-between mb-3",
445
- children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h4", {
431
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h4", {
446
432
  className: "text-base font-semibold text-text-primary",
447
433
  children: e.name
448
- }), /* @__PURE__ */ f("span", {
434
+ }), /* @__PURE__ */ d("span", {
449
435
  className: `inline-flex items-center px-1.5 py-0.5 text-xs font-medium rounded-full mt-1 ${e.isActive ? "bg-[var(--color-status-success-subtle)] text-[var(--color-status-success)]" : "bg-bg-sunken text-text-secondary"}`,
450
- children: e.isActive ? b("products.statusActive", "Active") : b("products.statusInactive", "Inactive")
451
- })] }), !y && /* @__PURE__ */ p("div", {
436
+ children: e.isActive ? x("products.statusActive", "Active") : x("products.statusInactive", "Inactive")
437
+ })] }), !b && /* @__PURE__ */ f("div", {
452
438
  className: "flex items-center gap-0.5",
453
- children: [/* @__PURE__ */ f("button", {
439
+ children: [/* @__PURE__ */ d("button", {
454
440
  type: "button",
455
- onClick: () => K(e),
456
- title: e.isActive ? b("products.deactivate", "Deactivate") : b("products.activate", "Activate"),
441
+ onClick: () => q(e),
442
+ title: e.isActive ? x("products.deactivate", "Deactivate") : x("products.activate", "Activate"),
457
443
  className: "p-1.5 rounded-lg hover:bg-bg-sunken transition-colors text-text-secondary hover:text-text-primary",
458
- children: e.isActive ? /* @__PURE__ */ f(u, {
444
+ children: e.isActive ? /* @__PURE__ */ d(u, {
459
445
  size: 16,
460
446
  className: "text-[var(--color-status-success)]"
461
- }) : /* @__PURE__ */ f(l, { size: 16 })
462
- }), /* @__PURE__ */ f("button", {
447
+ }) : /* @__PURE__ */ d(l, { size: 16 })
448
+ }), /* @__PURE__ */ d("button", {
463
449
  type: "button",
464
- onClick: () => q(e),
465
- title: b("products.edit", "Edit"),
450
+ onClick: () => ce(e),
451
+ title: x("products.edit", "Edit"),
466
452
  className: "p-1.5 rounded-lg hover:bg-bg-sunken transition-colors text-text-secondary hover:text-text-primary",
467
- children: /* @__PURE__ */ f(ee, { size: 14 })
453
+ children: /* @__PURE__ */ d(o, { size: 14 })
468
454
  })]
469
455
  })]
470
456
  }),
471
- /* @__PURE__ */ p("div", {
457
+ /* @__PURE__ */ f("div", {
472
458
  className: "mb-4",
473
- children: [/* @__PURE__ */ p("span", {
459
+ children: [/* @__PURE__ */ d("span", {
474
460
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
475
- children: [t, e.price]
476
- }), /* @__PURE__ */ p("span", {
461
+ children: t(e.price, e.currency)
462
+ }), /* @__PURE__ */ f("span", {
477
463
  className: "text-sm text-text-secondary ml-1",
478
464
  children: ["/", e.duration === "monthly" ? "month" : "year"]
479
465
  })]
480
466
  }),
481
- e.features && e.features.length > 0 ? /* @__PURE__ */ p("div", {
467
+ e.features && e.features.length > 0 ? /* @__PURE__ */ f("div", {
482
468
  className: "space-y-2 border-t border-border-seam pt-3",
483
469
  children: [e.features.slice(0, 6).map((e) => {
484
470
  let t = e.quota, n = e.quotaId;
@@ -486,14 +472,14 @@ function v({ productId: v, productName: ae, readOnly: y = !1 }) {
486
472
  let e = t.name.split("."), r = ((e.length >= 3 ? e[e.length - 2] : e[e.length - 1]) || t.name).replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()), i = t.limits && typeof t.limits == "object" ? t.limits.value : null;
487
473
  n = typeof i == "number" ? `${i.toLocaleString()} ${r}` : r;
488
474
  }
489
- return /* @__PURE__ */ p("div", {
475
+ return /* @__PURE__ */ f("div", {
490
476
  className: "flex items-center gap-2 text-sm text-text-primary",
491
- children: [/* @__PURE__ */ f(i, {
477
+ children: [/* @__PURE__ */ d(a, {
492
478
  size: 14,
493
479
  className: "text-[var(--color-status-success)] flex-shrink-0"
494
- }), /* @__PURE__ */ f("span", { children: n })]
480
+ }), /* @__PURE__ */ d("span", { children: n })]
495
481
  }, e.id);
496
- }), e.features.length > 6 && /* @__PURE__ */ p("p", {
482
+ }), e.features.length > 6 && /* @__PURE__ */ f("p", {
497
483
  className: "text-xs text-text-secondary pl-5",
498
484
  children: [
499
485
  "+",
@@ -501,11 +487,11 @@ function v({ productId: v, productName: ae, readOnly: y = !1 }) {
501
487
  " more"
502
488
  ]
503
489
  })]
504
- }) : /* @__PURE__ */ f("div", {
490
+ }) : /* @__PURE__ */ d("div", {
505
491
  className: "border-t border-border-seam pt-3",
506
- children: /* @__PURE__ */ f("p", {
492
+ children: /* @__PURE__ */ d("p", {
507
493
  className: "text-xs text-text-secondary italic",
508
- children: b("products.noFeaturesAssigned", "No features assigned")
494
+ children: x("products.noFeaturesAssigned", "No features assigned")
509
495
  })
510
496
  })
511
497
  ]
@@ -516,6 +502,6 @@ function v({ productId: v, productName: ae, readOnly: y = !1 }) {
516
502
  ]
517
503
  });
518
504
  }
519
- export { v as ProductPlans };
505
+ export { y as ProductPlans };
520
506
 
521
507
  //# sourceMappingURL=ProductPlans.js.map