@burdenoff/microfe-billing 2026.528.1 → 2026.529.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +82 -81
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +105 -104
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +162 -161
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +85 -84
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +115 -114
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/shared/utils/index.js +1 -0
- package/dist/billing/shared/utils/planFeatureQuantity.js +11 -0
- package/dist/billing/shared/utils/planFeatureQuantity.js.map +1 -0
- package/dist/generated/global-operations.js +1 -0
- package/dist/generated/global-operations.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,39 +5,40 @@ import { CurrencyPriceOverridesEditor as r } from "../../../shared/components/Cu
|
|
|
5
5
|
import "../../../shared/components/index.js";
|
|
6
6
|
import { PlanDuration as i } from "../../../shared/types/graphql.js";
|
|
7
7
|
import { isServerError as a } from "../../../shared/utils/error.js";
|
|
8
|
+
import { getPlanFeatureQuantity as o } from "../../../shared/utils/planFeatureQuantity.js";
|
|
8
9
|
import "../../../shared/utils/index.js";
|
|
9
|
-
import { useBillingPermissions as
|
|
10
|
-
import { useBillingNavigate as
|
|
11
|
-
import { usePlan as
|
|
12
|
-
import { useQuotas as
|
|
10
|
+
import { useBillingPermissions as s } from "../../../hooks/useBillingPermissions.js";
|
|
11
|
+
import { useBillingNavigate as c } from "../../../hooks/useBillingNavigate.js";
|
|
12
|
+
import { usePlan as l, usePlanMutations as u } from "../hooks/usePlans.js";
|
|
13
|
+
import { useQuotas as d } from "../hooks/useQuotas.js";
|
|
13
14
|
import "../hooks/index.js";
|
|
14
|
-
import { useEffect as
|
|
15
|
-
import { useParams as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { useI18n as
|
|
15
|
+
import { useEffect as f, useState as p } from "react";
|
|
16
|
+
import { useParams as m } from "react-router-dom";
|
|
17
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
18
|
+
import { useI18n as v } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
18
19
|
//#region src/billing/modules/plans/pages/PlanEditPage.tsx
|
|
19
|
-
var
|
|
20
|
-
let { t:
|
|
21
|
-
let n =
|
|
20
|
+
var y = () => {
|
|
21
|
+
let { t: y } = v(), b = (e, t) => {
|
|
22
|
+
let n = y(e);
|
|
22
23
|
return n === e ? t : n;
|
|
23
|
-
}, { planId:
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
24
|
+
}, { planId: x } = m(), S = c(), C = s(), { plan: w, isLoading: T, error: E, refetch: D } = l(x), { quotas: O, isLoading: k } = d({ onlyActive: !0 }), { updatePlan: A, isUpdating: j } = u(), [M, N] = p(""), [P, F] = p(""), [I, L] = p("USD"), [R, z] = p(i.MONTHLY), [B, V] = p(!0), [H, U] = p([]), [W, G] = p([]), [K, q] = p(null), [J, Y] = p(!1);
|
|
25
|
+
if (f(() => {
|
|
26
|
+
if (w && (N(w.name ?? ""), F(String(w.price ?? "")), L(w.currency ?? "USD"), z(w.duration ?? i.MONTHLY), V(w.isActive ?? !0), w.features && w.features.length > 0)) {
|
|
26
27
|
let e = [], t = /* @__PURE__ */ new Map();
|
|
27
|
-
for (let e of
|
|
28
|
-
let n = e.quota.id, r = e
|
|
29
|
-
t.set(n,
|
|
28
|
+
for (let e of w.features) if (e.quota?.id) {
|
|
29
|
+
let n = e.quota.id, r = o(e) || 1;
|
|
30
|
+
t.set(n, r);
|
|
30
31
|
}
|
|
31
32
|
for (let [n, r] of t) e.push({
|
|
32
33
|
quotaId: n,
|
|
33
34
|
quantity: r
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
+
U(e);
|
|
36
37
|
}
|
|
37
|
-
}, [
|
|
38
|
-
if (
|
|
38
|
+
}, [w]), !C.canManagePlans) return /* @__PURE__ */ g(e, { message: b("billing.plans.noEditPermission", "You don't have permission to edit plans.") });
|
|
39
|
+
if (T || k) return /* @__PURE__ */ _("div", {
|
|
39
40
|
className: "space-y-6 p-6",
|
|
40
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ g("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" }), /* @__PURE__ */ g("div", {
|
|
41
42
|
className: "max-w-2xl space-y-4",
|
|
42
43
|
children: [
|
|
43
44
|
1,
|
|
@@ -45,269 +46,269 @@ var v = () => {
|
|
|
45
46
|
3,
|
|
46
47
|
4,
|
|
47
48
|
5
|
|
48
|
-
].map((e) => /* @__PURE__ */
|
|
49
|
+
].map((e) => /* @__PURE__ */ g("div", { className: "h-16 bg-muted animate-pulse rounded" }, e))
|
|
49
50
|
})]
|
|
50
51
|
});
|
|
51
|
-
if (
|
|
52
|
+
if (E && a(E)) return /* @__PURE__ */ g("div", {
|
|
52
53
|
className: "p-6",
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
-
title:
|
|
55
|
-
message:
|
|
56
|
-
onRetry: () =>
|
|
54
|
+
children: /* @__PURE__ */ g(n, {
|
|
55
|
+
title: b("billing.plans.serverUnavailable", "Server Unavailable"),
|
|
56
|
+
message: b("billing.plans.serverUnavailableLoadPlan", "Unable to load plan. The server might be down or experiencing issues."),
|
|
57
|
+
onRetry: () => D(),
|
|
57
58
|
showRetry: !0
|
|
58
59
|
})
|
|
59
60
|
});
|
|
60
|
-
if (!
|
|
61
|
+
if (!w) return /* @__PURE__ */ g("div", {
|
|
61
62
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ _("div", {
|
|
63
64
|
className: "text-center space-y-4",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ g("h2", {
|
|
65
66
|
className: "text-lg font-semibold text-foreground",
|
|
66
|
-
children:
|
|
67
|
-
}), /* @__PURE__ */
|
|
67
|
+
children: b("billing.plans.planNotFound", "Plan not found")
|
|
68
|
+
}), /* @__PURE__ */ g("button", {
|
|
68
69
|
type: "button",
|
|
69
|
-
onClick: () =>
|
|
70
|
+
onClick: () => S("/plans"),
|
|
70
71
|
className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90",
|
|
71
72
|
children: "Back to Plans"
|
|
72
73
|
})]
|
|
73
74
|
})
|
|
74
75
|
});
|
|
75
|
-
let
|
|
76
|
-
|
|
76
|
+
let X = () => {
|
|
77
|
+
U([{
|
|
77
78
|
quotaId: "",
|
|
78
79
|
quantity: 1
|
|
79
|
-
}, ...
|
|
80
|
-
},
|
|
81
|
-
H
|
|
82
|
-
},
|
|
83
|
-
let r = [...
|
|
84
|
-
t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n),
|
|
80
|
+
}, ...H]);
|
|
81
|
+
}, Z = (e) => {
|
|
82
|
+
U(H.filter((t, n) => n !== e));
|
|
83
|
+
}, Q = (e, t, n) => {
|
|
84
|
+
let r = [...H];
|
|
85
|
+
t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n), U(r);
|
|
85
86
|
};
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ _("div", {
|
|
87
88
|
className: "space-y-6 p-6",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
89
|
-
title: `Edit Plan: ${
|
|
90
|
-
description:
|
|
91
|
-
}), /* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ g(t, {
|
|
90
|
+
title: `Edit Plan: ${w.name}`,
|
|
91
|
+
description: b("billing.plans.editPlanDesc", "Update the plan details and quota allocations")
|
|
92
|
+
}), /* @__PURE__ */ _("form", {
|
|
92
93
|
onSubmit: async (e) => {
|
|
93
|
-
if (e.preventDefault(),
|
|
94
|
-
|
|
94
|
+
if (e.preventDefault(), q(null), Y(!1), !M.trim()) {
|
|
95
|
+
q("Plan name is required");
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
if (!
|
|
98
|
-
|
|
98
|
+
if (!P || isNaN(Number(P)) || Number(P) < 0) {
|
|
99
|
+
q("Valid price is required");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
102
|
+
if (H.length === 0) {
|
|
103
|
+
q("At least one quota is required");
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
106
|
+
if (H.filter((e) => e.quotaId === "").length > 0) {
|
|
107
|
+
q("Please select a quota for all allocations");
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
let t = {
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
112
|
-
price: Number(
|
|
113
|
-
currency:
|
|
114
|
-
duration:
|
|
115
|
-
isActive:
|
|
116
|
-
quotas:
|
|
111
|
+
id: x,
|
|
112
|
+
name: M.trim(),
|
|
113
|
+
price: Number(P),
|
|
114
|
+
currency: I,
|
|
115
|
+
duration: R,
|
|
116
|
+
isActive: B,
|
|
117
|
+
quotas: H.map((e) => ({
|
|
117
118
|
quotaId: e.quotaId,
|
|
118
119
|
quantity: e.quantity
|
|
119
120
|
})),
|
|
120
|
-
...
|
|
121
|
+
...W.length > 0 ? { currencyPriceOverrides: W } : {}
|
|
121
122
|
};
|
|
122
123
|
try {
|
|
123
|
-
await
|
|
124
|
+
await A(t), Y(!0), setTimeout(() => S(`/plans/${x}`), 1500);
|
|
124
125
|
} catch (e) {
|
|
125
|
-
|
|
126
|
+
q(e instanceof Error ? e.message : "Failed to update plan");
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
129
|
className: "space-y-6",
|
|
129
130
|
children: [
|
|
130
|
-
|
|
131
|
+
K && /* @__PURE__ */ g("div", {
|
|
131
132
|
className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ g("p", {
|
|
133
134
|
className: "text-sm text-status-error-text",
|
|
134
|
-
children:
|
|
135
|
+
children: K
|
|
135
136
|
})
|
|
136
137
|
}),
|
|
137
|
-
|
|
138
|
+
J && /* @__PURE__ */ g("div", {
|
|
138
139
|
className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
|
|
139
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ g("p", {
|
|
140
141
|
className: "text-sm text-status-success-text",
|
|
141
|
-
children:
|
|
142
|
+
children: b("billing.plans.updateSuccess", "Plan updated successfully! Redirecting...")
|
|
142
143
|
})
|
|
143
144
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ _("div", {
|
|
145
146
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
146
|
-
children: [/* @__PURE__ */
|
|
147
|
+
children: [/* @__PURE__ */ _("div", {
|
|
147
148
|
className: "border border-border rounded-lg bg-card overflow-hidden h-fit",
|
|
148
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ g("div", {
|
|
149
150
|
className: "p-4 border-b border-border bg-muted/30",
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ g("h2", {
|
|
151
152
|
className: "font-semibold text-foreground",
|
|
152
|
-
children:
|
|
153
|
+
children: b("billing.plans.basicInfo", "Basic Information")
|
|
153
154
|
})
|
|
154
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ _("div", {
|
|
155
156
|
className: "p-4 space-y-4",
|
|
156
157
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
|
|
158
159
|
htmlFor: "name",
|
|
159
160
|
className: "block text-sm font-medium text-foreground mb-1",
|
|
160
|
-
children: [
|
|
161
|
-
}), /* @__PURE__ */
|
|
161
|
+
children: [b("billing.plans.planNameLabel", "Plan Name"), " *"]
|
|
162
|
+
}), /* @__PURE__ */ g("input", {
|
|
162
163
|
id: "name",
|
|
163
164
|
type: "text",
|
|
164
|
-
value:
|
|
165
|
-
onChange: (e) =>
|
|
165
|
+
value: M,
|
|
166
|
+
onChange: (e) => N(e.target.value),
|
|
166
167
|
className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary",
|
|
167
|
-
placeholder:
|
|
168
|
+
placeholder: b("billing.plans.planNamePlaceholder", "e.g., Pro Plan"),
|
|
168
169
|
required: !0
|
|
169
170
|
})] }),
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ _("div", {
|
|
171
172
|
className: "grid grid-cols-2 gap-4",
|
|
172
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
|
|
173
174
|
htmlFor: "price",
|
|
174
175
|
className: "block text-sm font-medium text-foreground mb-1",
|
|
175
|
-
children: [
|
|
176
|
-
}), /* @__PURE__ */
|
|
176
|
+
children: [b("billing.plans.priceLabel", "Price"), " *"]
|
|
177
|
+
}), /* @__PURE__ */ g("input", {
|
|
177
178
|
id: "price",
|
|
178
179
|
type: "number",
|
|
179
180
|
step: "0.01",
|
|
180
181
|
min: "0",
|
|
181
|
-
value:
|
|
182
|
-
onChange: (e) =>
|
|
182
|
+
value: P,
|
|
183
|
+
onChange: (e) => F(e.target.value),
|
|
183
184
|
className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary",
|
|
184
185
|
placeholder: "49.99",
|
|
185
186
|
required: !0
|
|
186
|
-
})] }), /* @__PURE__ */
|
|
187
|
+
})] }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
|
|
187
188
|
htmlFor: "currency",
|
|
188
189
|
className: "block text-sm font-medium text-foreground mb-1",
|
|
189
|
-
children: [
|
|
190
|
-
}), /* @__PURE__ */
|
|
190
|
+
children: [b("billing.plans.currencyLabel", "Currency"), " *"]
|
|
191
|
+
}), /* @__PURE__ */ _("select", {
|
|
191
192
|
id: "currency",
|
|
192
|
-
value:
|
|
193
|
-
onChange: (e) =>
|
|
193
|
+
value: I,
|
|
194
|
+
onChange: (e) => L(e.target.value),
|
|
194
195
|
className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary",
|
|
195
196
|
children: [
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ g("option", {
|
|
197
198
|
value: "USD",
|
|
198
199
|
children: "USD ($)"
|
|
199
200
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ g("option", {
|
|
201
202
|
value: "EUR",
|
|
202
203
|
children: "EUR"
|
|
203
204
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ g("option", {
|
|
205
206
|
value: "GBP",
|
|
206
207
|
children: "GBP"
|
|
207
208
|
}),
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ g("option", {
|
|
209
210
|
value: "INR",
|
|
210
211
|
children: "INR"
|
|
211
212
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ g("option", {
|
|
213
214
|
value: "AUD",
|
|
214
215
|
children: "AUD"
|
|
215
216
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ g("option", {
|
|
217
218
|
value: "CAD",
|
|
218
219
|
children: "CAD"
|
|
219
220
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ g("option", {
|
|
221
222
|
value: "JPY",
|
|
222
223
|
children: "JPY"
|
|
223
224
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ g("option", {
|
|
225
226
|
value: "SGD",
|
|
226
227
|
children: "SGD"
|
|
227
228
|
})
|
|
228
229
|
]
|
|
229
230
|
})] })]
|
|
230
231
|
}),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
|
|
232
233
|
htmlFor: "duration",
|
|
233
234
|
className: "block text-sm font-medium text-foreground mb-1",
|
|
234
|
-
children: [
|
|
235
|
-
}), /* @__PURE__ */
|
|
235
|
+
children: [b("billing.plans.billingPeriodLabel", "Billing Period"), " *"]
|
|
236
|
+
}), /* @__PURE__ */ _("select", {
|
|
236
237
|
id: "duration",
|
|
237
|
-
value:
|
|
238
|
-
onChange: (e) =>
|
|
238
|
+
value: R,
|
|
239
|
+
onChange: (e) => z(e.target.value),
|
|
239
240
|
className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary",
|
|
240
|
-
children: [/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ g("option", {
|
|
241
242
|
value: i.MONTHLY,
|
|
242
243
|
children: "Monthly"
|
|
243
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ g("option", {
|
|
244
245
|
value: i.YEARLY,
|
|
245
246
|
children: "Yearly"
|
|
246
247
|
})]
|
|
247
248
|
})] }),
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ _("div", {
|
|
249
250
|
className: "flex items-center gap-3",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
251
|
+
children: [/* @__PURE__ */ g("input", {
|
|
251
252
|
id: "isActive",
|
|
252
253
|
type: "checkbox",
|
|
253
|
-
checked:
|
|
254
|
-
onChange: (e) =>
|
|
254
|
+
checked: B,
|
|
255
|
+
onChange: (e) => V(e.target.checked),
|
|
255
256
|
className: "size-4 rounded border-border text-primary focus:ring-primary"
|
|
256
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ g("label", {
|
|
257
258
|
htmlFor: "isActive",
|
|
258
259
|
className: "text-sm font-medium text-foreground",
|
|
259
|
-
children:
|
|
260
|
+
children: b("billing.plans.planIsActive", "Plan is active")
|
|
260
261
|
})]
|
|
261
262
|
})
|
|
262
263
|
]
|
|
263
264
|
})]
|
|
264
|
-
}), /* @__PURE__ */
|
|
265
|
+
}), /* @__PURE__ */ _("div", {
|
|
265
266
|
className: "border border-border rounded-lg bg-card overflow-hidden h-fit",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
267
|
+
children: [/* @__PURE__ */ _("div", {
|
|
267
268
|
className: "p-4 border-b border-border bg-muted/30 flex items-center justify-between",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ g("h2", {
|
|
269
270
|
className: "font-semibold text-foreground",
|
|
270
|
-
children:
|
|
271
|
-
}), /* @__PURE__ */
|
|
271
|
+
children: b("billing.plans.quotaAllocations", "Quota Allocations")
|
|
272
|
+
}), /* @__PURE__ */ g("button", {
|
|
272
273
|
type: "button",
|
|
273
|
-
onClick:
|
|
274
|
+
onClick: X,
|
|
274
275
|
className: "px-3 py-1 text-sm font-medium text-primary hover:bg-primary/10 rounded-md transition-colors",
|
|
275
276
|
children: "+ Add Quota"
|
|
276
277
|
})]
|
|
277
|
-
}), /* @__PURE__ */
|
|
278
|
+
}), /* @__PURE__ */ g("div", {
|
|
278
279
|
className: "p-4 space-y-3",
|
|
279
|
-
children:
|
|
280
|
+
children: H.length === 0 ? /* @__PURE__ */ g("p", {
|
|
280
281
|
className: "text-sm text-muted-foreground",
|
|
281
|
-
children:
|
|
282
|
-
}) :
|
|
283
|
-
let n =
|
|
284
|
-
return /* @__PURE__ */
|
|
282
|
+
children: b("billing.plans.noQuotasAllocated", "No quotas allocated. Click \"Add Quota\" to add one.")
|
|
283
|
+
}) : H.map((e, t) => {
|
|
284
|
+
let n = O.find((t) => t.id === e.quotaId), r = n?.limits, i = r?.value ?? 0, a = r?.type ?? "unknown", o = i * e.quantity;
|
|
285
|
+
return /* @__PURE__ */ _("div", {
|
|
285
286
|
className: "p-3 border border-border rounded-lg bg-muted/20 space-y-3",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
287
|
+
children: [/* @__PURE__ */ _("div", {
|
|
287
288
|
className: "flex items-center gap-3",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
289
|
+
children: [/* @__PURE__ */ _("select", {
|
|
289
290
|
value: e.quotaId,
|
|
290
|
-
onChange: (e) =>
|
|
291
|
+
onChange: (e) => Q(t, "quotaId", e.target.value),
|
|
291
292
|
className: `flex-1 px-3 py-2 border border-border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-primary ${e.quotaId === "" ? "text-muted-foreground" : "text-foreground"}`,
|
|
292
|
-
children: [/* @__PURE__ */
|
|
293
|
+
children: [/* @__PURE__ */ g("option", {
|
|
293
294
|
value: "",
|
|
294
295
|
disabled: !0,
|
|
295
|
-
children:
|
|
296
|
-
}),
|
|
296
|
+
children: b("billing.plans.selectQuota", "Select a quota...")
|
|
297
|
+
}), O.map((e) => /* @__PURE__ */ g("option", {
|
|
297
298
|
value: e.id,
|
|
298
299
|
children: e.name
|
|
299
300
|
}, e.id))]
|
|
300
|
-
}), /* @__PURE__ */
|
|
301
|
+
}), /* @__PURE__ */ g("button", {
|
|
301
302
|
type: "button",
|
|
302
|
-
onClick: () =>
|
|
303
|
+
onClick: () => Z(t),
|
|
303
304
|
className: "p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors",
|
|
304
305
|
title: "Remove quota",
|
|
305
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ g("svg", {
|
|
306
307
|
className: "size-5",
|
|
307
308
|
fill: "none",
|
|
308
309
|
viewBox: "0 0 24 24",
|
|
309
310
|
stroke: "currentColor",
|
|
310
|
-
children: /* @__PURE__ */
|
|
311
|
+
children: /* @__PURE__ */ g("path", {
|
|
311
312
|
strokeLinecap: "round",
|
|
312
313
|
strokeLinejoin: "round",
|
|
313
314
|
strokeWidth: 2,
|
|
@@ -315,49 +316,49 @@ var v = () => {
|
|
|
315
316
|
})
|
|
316
317
|
})
|
|
317
318
|
})]
|
|
318
|
-
}), n && /* @__PURE__ */
|
|
319
|
+
}), n && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
|
|
319
320
|
className: "flex items-center justify-between text-sm",
|
|
320
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ _("div", {
|
|
321
322
|
className: "text-muted-foreground",
|
|
322
323
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ _("span", {
|
|
324
325
|
className: "capitalize",
|
|
325
326
|
children: ["Type: ", a]
|
|
326
327
|
}),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ g("span", {
|
|
328
329
|
className: "mx-2",
|
|
329
330
|
children: "•"
|
|
330
331
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ _("span", { children: [
|
|
332
333
|
"Value per unit:",
|
|
333
334
|
" ",
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ g("span", {
|
|
335
336
|
className: "font-medium text-foreground",
|
|
336
337
|
children: i.toLocaleString()
|
|
337
338
|
})
|
|
338
339
|
] })
|
|
339
340
|
]
|
|
340
341
|
})
|
|
341
|
-
}), /* @__PURE__ */
|
|
342
|
+
}), /* @__PURE__ */ _("div", {
|
|
342
343
|
className: "flex items-center gap-4",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ _("div", {
|
|
344
345
|
className: "flex items-center gap-2",
|
|
345
|
-
children: [/* @__PURE__ */
|
|
346
|
+
children: [/* @__PURE__ */ _("label", {
|
|
346
347
|
className: "text-sm text-muted-foreground",
|
|
347
|
-
children: [
|
|
348
|
-
}), /* @__PURE__ */
|
|
348
|
+
children: [b("billing.plans.quantity", "Quantity"), ":"]
|
|
349
|
+
}), /* @__PURE__ */ g("input", {
|
|
349
350
|
type: "number",
|
|
350
351
|
min: "1",
|
|
351
352
|
value: e.quantity,
|
|
352
|
-
onChange: (e) =>
|
|
353
|
+
onChange: (e) => Q(t, "quantity", e.target.value),
|
|
353
354
|
className: "w-24 px-3 py-1.5 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary text-center"
|
|
354
355
|
})]
|
|
355
|
-
}), /* @__PURE__ */
|
|
356
|
+
}), /* @__PURE__ */ _("div", {
|
|
356
357
|
className: "flex items-center gap-2 text-sm",
|
|
357
|
-
children: [/* @__PURE__ */
|
|
358
|
+
children: [/* @__PURE__ */ g("span", {
|
|
358
359
|
className: "text-muted-foreground",
|
|
359
360
|
children: "="
|
|
360
|
-
}), /* @__PURE__ */
|
|
361
|
+
}), /* @__PURE__ */ _("span", {
|
|
361
362
|
className: "font-semibold text-status-success-text",
|
|
362
363
|
children: [o.toLocaleString(), " total"]
|
|
363
364
|
})]
|
|
@@ -368,20 +369,20 @@ var v = () => {
|
|
|
368
369
|
})]
|
|
369
370
|
})]
|
|
370
371
|
}),
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
overrides:
|
|
373
|
-
onChange:
|
|
372
|
+
/* @__PURE__ */ g(r, {
|
|
373
|
+
overrides: W,
|
|
374
|
+
onChange: G
|
|
374
375
|
}),
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ _("div", {
|
|
376
377
|
className: "flex items-center gap-3 pt-4",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ g("button", {
|
|
378
379
|
type: "submit",
|
|
379
|
-
disabled:
|
|
380
|
+
disabled: j,
|
|
380
381
|
className: "px-6 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50",
|
|
381
|
-
children:
|
|
382
|
-
}), /* @__PURE__ */
|
|
382
|
+
children: j ? b("billing.plans.saving", "Saving...") : b("billing.plans.saveChanges", "Save Changes")
|
|
383
|
+
}), /* @__PURE__ */ g("button", {
|
|
383
384
|
type: "button",
|
|
384
|
-
onClick: () =>
|
|
385
|
+
onClick: () => S(`/plans/${x}`),
|
|
385
386
|
className: "px-6 py-2 text-sm font-medium border border-border text-foreground rounded-md hover:bg-muted transition-colors",
|
|
386
387
|
children: "Cancel"
|
|
387
388
|
})]
|
|
@@ -391,6 +392,6 @@ var v = () => {
|
|
|
391
392
|
});
|
|
392
393
|
};
|
|
393
394
|
//#endregion
|
|
394
|
-
export {
|
|
395
|
+
export { y as PlanEditPage };
|
|
395
396
|
|
|
396
397
|
//# sourceMappingURL=PlanEditPage.js.map
|