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