@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.
- package/dist/generated/global-operations.d.ts +81 -2
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +12197 -840
- package/dist/generated/global-types.js.map +1 -1
- package/dist/product-management/modules/products/components/ProductPlans.js +220 -234
- package/dist/product-management/modules/products/components/ProductPlans.js.map +1 -1
- package/dist/product-management/shared/utils/formatPrice.d.ts +8 -0
- package/dist/product-management/shared/utils/formatPrice.js +14 -0
- package/dist/product-management/shared/utils/formatPrice.js.map +1 -0
- package/dist/translations/en.d.ts +2 -0
- package/dist/translations/en.js +2 -0
- package/dist/translations/en.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,400 +1,386 @@
|
|
|
1
1
|
import { useTr as e } from "../../../shared/hooks/useTr.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
function
|
|
10
|
-
let
|
|
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
|
-
}),
|
|
17
|
-
let n = await
|
|
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
|
-
}, []),
|
|
25
|
-
let [e, t] = await Promise.all([
|
|
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 ===
|
|
27
|
+
plans: (e?.getAllPlans || []).filter((e) => e.productID === y),
|
|
28
28
|
quotas: t?.getAllQuotas || []
|
|
29
29
|
};
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
|
|
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
|
|
36
|
-
|
|
35
|
+
let e = await U();
|
|
36
|
+
C(e.plans), T(e.quotas), k(null);
|
|
37
37
|
} catch (e) {
|
|
38
|
-
|
|
38
|
+
W(e);
|
|
39
39
|
} finally {
|
|
40
|
-
|
|
40
|
+
D(!1);
|
|
41
41
|
}
|
|
42
|
-
}, [
|
|
43
|
-
|
|
42
|
+
}, [U, W]);
|
|
43
|
+
r(() => {
|
|
44
44
|
let e = !0;
|
|
45
|
-
return
|
|
46
|
-
e && (
|
|
45
|
+
return U().then((t) => {
|
|
46
|
+
e && (C(t.plans), T(t.quotas), k(null));
|
|
47
47
|
}).catch((t) => {
|
|
48
|
-
e &&
|
|
48
|
+
e && W(t);
|
|
49
49
|
}).finally(() => {
|
|
50
|
-
e &&
|
|
50
|
+
e && D(!1);
|
|
51
51
|
}), () => {
|
|
52
52
|
e = !1;
|
|
53
53
|
};
|
|
54
|
-
}, [
|
|
55
|
-
let
|
|
56
|
-
|
|
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
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
e.preventDefault(),
|
|
61
|
+
}), N(null), j(!1);
|
|
62
|
+
}, se = async (e) => {
|
|
63
|
+
e.preventDefault(), F(!0);
|
|
65
64
|
try {
|
|
66
|
-
|
|
67
|
-
id:
|
|
68
|
-
name:
|
|
69
|
-
price: parseFloat(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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),
|
|
80
|
+
console.error("Failed to save plan:", e), k(x("products.failedToSavePlan", "Failed to save plan"));
|
|
83
81
|
} finally {
|
|
84
|
-
|
|
82
|
+
F(!1);
|
|
85
83
|
}
|
|
86
|
-
},
|
|
84
|
+
}, q = async (e) => {
|
|
87
85
|
try {
|
|
88
|
-
await
|
|
86
|
+
await H(ae, {
|
|
89
87
|
planID: e.id,
|
|
90
88
|
status: !e.isActive
|
|
91
|
-
}), await
|
|
89
|
+
}), await G();
|
|
92
90
|
} catch (e) {
|
|
93
91
|
console.error("Failed to toggle plan:", e);
|
|
94
92
|
}
|
|
95
|
-
},
|
|
96
|
-
|
|
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
|
-
}),
|
|
102
|
+
}), j(!0);
|
|
106
103
|
}, J = async () => {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
name:
|
|
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
|
-
} }),
|
|
110
|
+
} }), z(""), L(!1), await G();
|
|
114
111
|
} catch (e) {
|
|
115
|
-
console.error("Failed to create quota:", e),
|
|
112
|
+
console.error("Failed to create quota:", e), k(x("products.failedToCreateFeature", "Failed to create feature"));
|
|
116
113
|
} finally {
|
|
117
|
-
|
|
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 =
|
|
123
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
123
|
+
/* @__PURE__ */ f("div", {
|
|
127
124
|
className: "flex items-center justify-between mb-4",
|
|
128
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
129
126
|
className: "text-lg font-semibold text-text-primary flex items-center gap-2",
|
|
130
|
-
children: [/* @__PURE__ */
|
|
131
|
-
}), !
|
|
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
|
-
|
|
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__ */
|
|
134
|
+
children: [/* @__PURE__ */ d(c, { size: 14 }), x("products.addPlan", "Add Plan")]
|
|
138
135
|
})]
|
|
139
136
|
}),
|
|
140
|
-
|
|
141
|
-
onSubmit:
|
|
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__ */
|
|
141
|
+
/* @__PURE__ */ d("h3", {
|
|
145
142
|
className: "text-sm font-semibold text-text-primary mb-3",
|
|
146
|
-
children:
|
|
143
|
+
children: M ? x("products.editPlan", "Edit Plan") : x("products.createNewPlan", "Create New Plan")
|
|
147
144
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ f("div", {
|
|
149
146
|
className: "grid grid-cols-2 sm:grid-cols-4 gap-3",
|
|
150
147
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
|
|
152
149
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
153
|
-
children: [
|
|
154
|
-
}), /* @__PURE__ */
|
|
150
|
+
children: [x("products.planName", "Name"), " *"]
|
|
151
|
+
}), /* @__PURE__ */ d("input", {
|
|
155
152
|
type: "text",
|
|
156
|
-
value:
|
|
157
|
-
onChange: (e) =>
|
|
158
|
-
...
|
|
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__ */
|
|
162
|
+
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
|
|
166
163
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
167
|
-
children: [
|
|
168
|
-
}), /* @__PURE__ */
|
|
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:
|
|
173
|
-
onChange: (e) =>
|
|
174
|
-
...
|
|
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__ */
|
|
178
|
+
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("label", {
|
|
182
179
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
183
|
-
children: [
|
|
184
|
-
}), /* @__PURE__ */
|
|
185
|
-
value:
|
|
186
|
-
onChange: (e) =>
|
|
187
|
-
...
|
|
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__ */
|
|
188
|
+
children: [/* @__PURE__ */ d("option", {
|
|
192
189
|
value: "monthly",
|
|
193
|
-
children:
|
|
194
|
-
}), /* @__PURE__ */
|
|
190
|
+
children: x("products.monthly", "Monthly")
|
|
191
|
+
}), /* @__PURE__ */ d("option", {
|
|
195
192
|
value: "yearly",
|
|
196
|
-
children:
|
|
193
|
+
children: x("products.yearly", "Yearly")
|
|
197
194
|
})]
|
|
198
195
|
})] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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__ */
|
|
216
|
+
/* @__PURE__ */ f("div", {
|
|
231
217
|
className: "mt-3",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
218
|
+
children: [/* @__PURE__ */ f("label", {
|
|
233
219
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
234
|
-
children: [/* @__PURE__ */
|
|
220
|
+
children: [/* @__PURE__ */ d(te, {
|
|
235
221
|
size: 12,
|
|
236
222
|
className: "inline mr-1"
|
|
237
|
-
}),
|
|
238
|
-
}),
|
|
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:
|
|
241
|
-
let t =
|
|
242
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
230
|
+
children: [/* @__PURE__ */ d("input", {
|
|
245
231
|
type: "checkbox",
|
|
246
232
|
checked: t,
|
|
247
233
|
onChange: (t) => {
|
|
248
|
-
t.target.checked ?
|
|
249
|
-
...
|
|
250
|
-
quotas: [...
|
|
234
|
+
t.target.checked ? V({
|
|
235
|
+
...B,
|
|
236
|
+
quotas: [...B.quotas, {
|
|
251
237
|
quotaId: e.id,
|
|
252
238
|
quantity: 1
|
|
253
239
|
}]
|
|
254
|
-
}) :
|
|
255
|
-
...
|
|
256
|
-
quotas:
|
|
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__ */
|
|
249
|
+
}), /* @__PURE__ */ f("div", {
|
|
264
250
|
className: "flex items-center gap-2 mt-2",
|
|
265
251
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ f("p", {
|
|
267
253
|
className: "text-xs text-text-secondary",
|
|
268
254
|
children: [
|
|
269
|
-
|
|
255
|
+
B.quotas.length,
|
|
270
256
|
" ",
|
|
271
|
-
|
|
257
|
+
x("products.featuresSelected", "feature(s) selected")
|
|
272
258
|
]
|
|
273
259
|
}),
|
|
274
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ d("span", {
|
|
275
261
|
className: "text-xs text-text-secondary",
|
|
276
262
|
children: "|"
|
|
277
263
|
}),
|
|
278
|
-
|
|
264
|
+
I ? /* @__PURE__ */ f("div", {
|
|
279
265
|
className: "flex items-center gap-1.5",
|
|
280
266
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ d("input", {
|
|
282
268
|
type: "text",
|
|
283
|
-
value:
|
|
284
|
-
onChange: (e) =>
|
|
285
|
-
placeholder:
|
|
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__ */
|
|
277
|
+
/* @__PURE__ */ d("button", {
|
|
292
278
|
type: "button",
|
|
293
279
|
onClick: J,
|
|
294
|
-
disabled:
|
|
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:
|
|
282
|
+
children: x("productCommon.add", "Add")
|
|
297
283
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ d("button", {
|
|
299
285
|
type: "button",
|
|
300
286
|
onClick: () => {
|
|
301
|
-
|
|
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:
|
|
290
|
+
children: x("productCommon.cancel", "Cancel")
|
|
305
291
|
})
|
|
306
292
|
]
|
|
307
|
-
}) : /* @__PURE__ */
|
|
293
|
+
}) : /* @__PURE__ */ d("button", {
|
|
308
294
|
type: "button",
|
|
309
|
-
onClick: () =>
|
|
295
|
+
onClick: () => L(!0),
|
|
310
296
|
className: "text-xs text-[var(--color-action-primary-bg)] hover:underline",
|
|
311
|
-
children:
|
|
297
|
+
children: x("products.createNewFeature", "+ Create new feature")
|
|
312
298
|
})
|
|
313
299
|
]
|
|
314
|
-
})] }) : /* @__PURE__ */
|
|
300
|
+
})] }) : /* @__PURE__ */ f("div", {
|
|
315
301
|
className: "text-xs text-text-secondary",
|
|
316
302
|
children: [
|
|
317
|
-
|
|
303
|
+
x("products.noFeaturesCreated", "No features created yet."),
|
|
318
304
|
" ",
|
|
319
|
-
|
|
305
|
+
I ? /* @__PURE__ */ f("div", {
|
|
320
306
|
className: "flex items-center gap-1.5 mt-1.5",
|
|
321
307
|
children: [
|
|
322
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ d("input", {
|
|
323
309
|
type: "text",
|
|
324
|
-
value:
|
|
325
|
-
onChange: (e) =>
|
|
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__ */
|
|
318
|
+
/* @__PURE__ */ d("button", {
|
|
333
319
|
type: "button",
|
|
334
320
|
onClick: J,
|
|
335
|
-
disabled:
|
|
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__ */
|
|
325
|
+
/* @__PURE__ */ d("button", {
|
|
340
326
|
type: "button",
|
|
341
327
|
onClick: () => {
|
|
342
|
-
|
|
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__ */
|
|
334
|
+
}) : /* @__PURE__ */ d("button", {
|
|
349
335
|
type: "button",
|
|
350
|
-
onClick: () =>
|
|
336
|
+
onClick: () => L(!0),
|
|
351
337
|
className: "text-[var(--color-action-primary-bg)] hover:underline",
|
|
352
|
-
children:
|
|
338
|
+
children: x("products.createYourFirstFeature", "Create your first feature")
|
|
353
339
|
})
|
|
354
340
|
]
|
|
355
341
|
})]
|
|
356
342
|
}),
|
|
357
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ f("div", {
|
|
358
344
|
className: "flex gap-2 mt-3",
|
|
359
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ f("button", {
|
|
360
346
|
type: "submit",
|
|
361
|
-
disabled:
|
|
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: [
|
|
349
|
+
children: [P && /* @__PURE__ */ d(s, {
|
|
364
350
|
size: 14,
|
|
365
351
|
className: "animate-spin"
|
|
366
|
-
}),
|
|
367
|
-
}), /* @__PURE__ */
|
|
352
|
+
}), M ? x("products.updatePlan", "Update Plan") : x("products.createPlan", "Create Plan")]
|
|
353
|
+
}), /* @__PURE__ */ d("button", {
|
|
368
354
|
type: "button",
|
|
369
|
-
onClick:
|
|
355
|
+
onClick: K,
|
|
370
356
|
className: "px-4 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors",
|
|
371
|
-
children:
|
|
357
|
+
children: x("productCommon.cancel", "Cancel")
|
|
372
358
|
})]
|
|
373
359
|
})
|
|
374
360
|
]
|
|
375
361
|
}),
|
|
376
|
-
|
|
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:
|
|
364
|
+
children: O
|
|
379
365
|
}),
|
|
380
|
-
|
|
366
|
+
E ? /* @__PURE__ */ f("div", {
|
|
381
367
|
className: "flex items-center justify-center py-8",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ d(s, {
|
|
383
369
|
size: 20,
|
|
384
370
|
className: "animate-spin text-text-secondary"
|
|
385
|
-
}), /* @__PURE__ */
|
|
371
|
+
}), /* @__PURE__ */ d("span", {
|
|
386
372
|
className: "ml-2 text-sm text-text-secondary",
|
|
387
|
-
children:
|
|
373
|
+
children: x("products.loadingPlans", "Loading plans...")
|
|
388
374
|
})]
|
|
389
|
-
}) :
|
|
375
|
+
}) : S.length === 0 ? /* @__PURE__ */ d(re, {
|
|
390
376
|
illustration: "empty-data",
|
|
391
|
-
title:
|
|
392
|
-
description:
|
|
393
|
-
}) : /* @__PURE__ */
|
|
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__ */
|
|
381
|
+
children: [Z.length > 0 && /* @__PURE__ */ f("div", {
|
|
396
382
|
className: "flex gap-2 mb-2",
|
|
397
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
418
|
-
plans:
|
|
403
|
+
label: x("products.monthlyPlans", "Monthly Plans"),
|
|
404
|
+
plans: le
|
|
419
405
|
}, {
|
|
420
|
-
label:
|
|
421
|
-
plans:
|
|
406
|
+
label: x("products.yearlyPlans", "Yearly Plans"),
|
|
407
|
+
plans: ue
|
|
422
408
|
}] : [{
|
|
423
|
-
label:
|
|
409
|
+
label: x("products.enterprisePlans", "Enterprise Plans"),
|
|
424
410
|
plans: Z
|
|
425
|
-
}]).filter((e) => e.plans.length > 0).map((e) => /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
432
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
427
|
+
children: x("products.popular", "Popular")
|
|
442
428
|
}),
|
|
443
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ f("div", {
|
|
444
430
|
className: "flex items-start justify-between mb-3",
|
|
445
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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 ?
|
|
451
|
-
})] }), !
|
|
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__ */
|
|
439
|
+
children: [/* @__PURE__ */ d("button", {
|
|
454
440
|
type: "button",
|
|
455
|
-
onClick: () =>
|
|
456
|
-
title: e.isActive ?
|
|
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__ */
|
|
444
|
+
children: e.isActive ? /* @__PURE__ */ d(u, {
|
|
459
445
|
size: 16,
|
|
460
446
|
className: "text-[var(--color-status-success)]"
|
|
461
|
-
}) : /* @__PURE__ */
|
|
462
|
-
}), /* @__PURE__ */
|
|
447
|
+
}) : /* @__PURE__ */ d(l, { size: 16 })
|
|
448
|
+
}), /* @__PURE__ */ d("button", {
|
|
463
449
|
type: "button",
|
|
464
|
-
onClick: () =>
|
|
465
|
-
title:
|
|
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__ */
|
|
453
|
+
children: /* @__PURE__ */ d(o, { size: 14 })
|
|
468
454
|
})]
|
|
469
455
|
})]
|
|
470
456
|
}),
|
|
471
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ f("div", {
|
|
472
458
|
className: "mb-4",
|
|
473
|
-
children: [/* @__PURE__ */
|
|
459
|
+
children: [/* @__PURE__ */ d("span", {
|
|
474
460
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
475
|
-
children:
|
|
476
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
475
|
+
return /* @__PURE__ */ f("div", {
|
|
490
476
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
477
|
+
children: [/* @__PURE__ */ d(a, {
|
|
492
478
|
size: 14,
|
|
493
479
|
className: "text-[var(--color-status-success)] flex-shrink-0"
|
|
494
|
-
}), /* @__PURE__ */
|
|
480
|
+
}), /* @__PURE__ */ d("span", { children: n })]
|
|
495
481
|
}, e.id);
|
|
496
|
-
}), e.features.length > 6 && /* @__PURE__ */
|
|
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__ */
|
|
490
|
+
}) : /* @__PURE__ */ d("div", {
|
|
505
491
|
className: "border-t border-border-seam pt-3",
|
|
506
|
-
children: /* @__PURE__ */
|
|
492
|
+
children: /* @__PURE__ */ d("p", {
|
|
507
493
|
className: "text-xs text-text-secondary italic",
|
|
508
|
-
children:
|
|
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 {
|
|
505
|
+
export { y as ProductPlans };
|
|
520
506
|
|
|
521
507
|
//# sourceMappingURL=ProductPlans.js.map
|