@burdenoff/microfe-billing 2026.1114.3 → 2026.1114.4
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/billing/pages/UserRefundsPage.js +143 -140
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +59 -67
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/settings/index.js +3 -3
- package/dist/billing/modules/settings/pages/SettingsPage.js +192 -179
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.d.ts +6 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +77 -78
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +65 -59
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,127 +1,128 @@
|
|
|
1
1
|
import { EMPTY_SETTINGS_FORM as e, formFromAccount as t, hasFormChanges as n, toUpdateInput as ee } from "../utils/accountForm.js";
|
|
2
2
|
import { useIsFluidgridsVariant as te } from "../../../hooks/useBillingVariant.js";
|
|
3
3
|
import { AccessDenied as r } from "../../../shared/components/AccessDenied.js";
|
|
4
|
-
import { PageHeader as
|
|
5
|
-
import { useBillingEventEmitter as
|
|
6
|
-
import { useBillingPermissions as
|
|
7
|
-
import { useBilling as
|
|
8
|
-
import { directBillingGraphqlRequest as
|
|
4
|
+
import { PageHeader as ne } from "../../../shared/components/PageHeader.js";
|
|
5
|
+
import { useBillingEventEmitter as re } from "../../../hooks/useBillingEventEmitter.js";
|
|
6
|
+
import { useBillingPermissions as ie } from "../../../hooks/useBillingPermissions.js";
|
|
7
|
+
import { useBilling as ae } from "../../../providers/BillingProvider.js";
|
|
8
|
+
import { directBillingGraphqlRequest as oe } from "../../../shared/utils/directBillingGraphql.js";
|
|
9
9
|
import "../../../shared/components/index.js";
|
|
10
|
+
import { TeamPermissionsPage as se } from "./TeamPermissionsPage.js";
|
|
10
11
|
import "../../../shared/utils/index.js";
|
|
11
|
-
import { ArchiveBillingAccountSettingsDocument as
|
|
12
|
-
import { useTr as
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { AccessGate as
|
|
12
|
+
import { ArchiveBillingAccountSettingsDocument as ce, useGetBillingAccountSettingsQuery as le, useGetBillingAccountsSettingsQuery as ue, useGetDefaultBillingAccountSettingsQuery as de, useSetDefaultBillingAccountSettingsMutation as fe, useUpdateBillingAccountSettingsMutation as pe } from "../../../../generated/global-operations.js";
|
|
13
|
+
import { useTr as me } from "../../../shared/hooks/useTr.js";
|
|
14
|
+
import { useCallback as i, useEffect as he, useMemo as a, useState as o } from "react";
|
|
15
|
+
import { AccessGate as s, AlertDialog as c, AlertDialogAction as ge, AlertDialogCancel as _e, AlertDialogContent as ve, AlertDialogDescription as ye, AlertDialogFooter as be, AlertDialogHeader as xe, AlertDialogTitle as Se, OptionalFields as Ce, PagePurpose as we } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
16
17
|
// src/billing/modules/settings/pages/SettingsPage.tsx
|
|
17
|
-
var
|
|
18
|
+
var Te = () => {
|
|
18
19
|
if (typeof window < "u") return new URLSearchParams(window.location.search).get("billingAccountId") || void 0;
|
|
19
|
-
},
|
|
20
|
-
let
|
|
21
|
-
variables: { id:
|
|
22
|
-
skip: !
|
|
23
|
-
}),
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
let e =
|
|
20
|
+
}, f = () => {
|
|
21
|
+
let f = me(), p = ie(), m = te(), { apiGatewayUrl: h, authToken: g, orgId: _ } = ae(), { emit: v } = re(), [y, b] = o(Te), [x, S] = o(!1), [C, w] = o(!1), [T, E] = o(!1), [D, O] = o(!1), [k, A] = o(null), [Ee, j] = o(!1), [De, M] = o(!1), [Oe, N] = o(!1), [P, F] = o(e), { data: I, loading: ke, refetch: L } = ue({}), R = a(() => I?.getBillingAccountsByOrg || [], [I?.getBillingAccountsByOrg]), { data: Ae, loading: je, refetch: z } = de({}), B = Ae?.getDefaultBillingAccount || null, { data: Me, loading: V, refetch: H } = le({
|
|
22
|
+
variables: { id: y },
|
|
23
|
+
skip: !y
|
|
24
|
+
}), U = Me?.getBillingAccount || null, [W] = pe(), [G] = fe(), K = a(() => {
|
|
25
|
+
if (y) {
|
|
26
|
+
if (U) return U;
|
|
27
|
+
let e = R.find((e) => e.id === y);
|
|
27
28
|
if (e) return e;
|
|
28
|
-
if (
|
|
29
|
+
if (V) return null;
|
|
29
30
|
}
|
|
30
|
-
return
|
|
31
|
+
return B;
|
|
31
32
|
}, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
33
|
+
y,
|
|
34
|
+
U,
|
|
35
|
+
R,
|
|
36
|
+
V,
|
|
37
|
+
B
|
|
38
|
+
]), Ne = ke || je || y && V;
|
|
39
|
+
he(() => {
|
|
40
|
+
K && F(t(K));
|
|
41
|
+
}, [K]);
|
|
42
|
+
let Pe = (e) => {
|
|
43
|
+
b(e.id), S(!1), j(!1), A(null);
|
|
44
|
+
}, q = (e, t) => {
|
|
45
|
+
F((n) => ({
|
|
45
46
|
...n,
|
|
46
47
|
[e]: t
|
|
47
|
-
})),
|
|
48
|
-
},
|
|
49
|
-
if (
|
|
50
|
-
|
|
48
|
+
})), j(!1), A(null);
|
|
49
|
+
}, J = a(() => R.find((e) => e.isDefault) || null, [R]), Y = a(() => n(P, K), [P, K]), X = P.isDefault && !K?.isDefault, Z = X && J && J.id !== K?.id, Q = i(async () => {
|
|
50
|
+
if (K?.id) {
|
|
51
|
+
w(!0), A(null), j(!1), M(!1), N(!1);
|
|
51
52
|
try {
|
|
52
|
-
await
|
|
53
|
+
await W({ variables: { input: ee(K.id, P) } }), v("billing.billing_account.updated", {
|
|
53
54
|
route: "/billing/settings",
|
|
54
|
-
entityId:
|
|
55
|
+
entityId: K.id,
|
|
55
56
|
source: "settings"
|
|
56
|
-
}), X && (await
|
|
57
|
-
variables: { id:
|
|
57
|
+
}), X && (await G({
|
|
58
|
+
variables: { id: K.id },
|
|
58
59
|
refetchQueries: ["GetBillingAccountsByTenant", "GetDefaultBillingAccount"]
|
|
59
|
-
}),
|
|
60
|
+
}), v("billing.billing_account.updated", {
|
|
60
61
|
route: "/billing/settings",
|
|
61
|
-
entityId:
|
|
62
|
+
entityId: K.id,
|
|
62
63
|
source: "settings.default"
|
|
63
|
-
})),
|
|
64
|
+
})), y ? await H() : await z(), j(!0), setTimeout(() => j(!1), 3e3);
|
|
64
65
|
} catch (e) {
|
|
65
|
-
|
|
66
|
+
A(e instanceof Error ? e.message : "Failed to save changes");
|
|
66
67
|
} finally {
|
|
67
|
-
|
|
68
|
+
w(!1);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
K?.id,
|
|
73
|
+
P,
|
|
73
74
|
X,
|
|
75
|
+
W,
|
|
74
76
|
G,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
q?.id && (Z ? (P(!0), N(!0)) : Q());
|
|
77
|
+
y,
|
|
78
|
+
H,
|
|
79
|
+
z,
|
|
80
|
+
v
|
|
81
|
+
]), Fe = i(() => {
|
|
82
|
+
K?.id && (Z ? (N(!0), M(!0)) : Q());
|
|
82
83
|
}, [
|
|
83
|
-
|
|
84
|
+
K?.id,
|
|
84
85
|
Z,
|
|
85
86
|
Q
|
|
86
|
-
]), $ =
|
|
87
|
-
accountName:
|
|
87
|
+
]), $ = a(() => K ? R.find((e) => e.id !== K.id && e.isActive) : void 0, [K, R]), Ie = K ? K.isDefault ? $ ? f("billing.settings.archiveDefaultConfirm", "Archive {{accountName}}? {{replacementName}} will become the default account.", {
|
|
88
|
+
accountName: K.name,
|
|
88
89
|
replacementName: $.name
|
|
89
|
-
}) :
|
|
90
|
-
if (
|
|
91
|
-
|
|
90
|
+
}) : f("billing.settings.archiveDefaultNoReplacementConfirm", "Archive {{accountName}}? No replacement default account is available.", { accountName: K.name }) : f("billing.settings.archiveConfirm", "Archive {{accountName}}?", { accountName: K.name }) : "", Le = i(async () => {
|
|
91
|
+
if (K?.id && K.isActive) {
|
|
92
|
+
E(!0), A(null), j(!1);
|
|
92
93
|
try {
|
|
93
|
-
await
|
|
94
|
-
apiGatewayUrl:
|
|
95
|
-
authToken:
|
|
96
|
-
orgId:
|
|
97
|
-
query:
|
|
94
|
+
await oe({
|
|
95
|
+
apiGatewayUrl: h,
|
|
96
|
+
authToken: g,
|
|
97
|
+
orgId: _,
|
|
98
|
+
query: ce,
|
|
98
99
|
variables: {
|
|
99
|
-
id:
|
|
100
|
+
id: K.id,
|
|
100
101
|
reason: "Archived from billing settings",
|
|
101
|
-
replacementDefaultBillingAccountId:
|
|
102
|
+
replacementDefaultBillingAccountId: K.isDefault ? $?.id ?? null : null
|
|
102
103
|
}
|
|
103
|
-
}),
|
|
104
|
+
}), v("billing.billing_account.archived", {
|
|
104
105
|
route: "/billing/settings",
|
|
105
|
-
entityId:
|
|
106
|
+
entityId: K.id,
|
|
106
107
|
source: "settings"
|
|
107
|
-
}), await Promise.all([
|
|
108
|
+
}), await Promise.all([L(), z()]), b($?.id), j(!0), setTimeout(() => j(!1), 3e3);
|
|
108
109
|
} catch (e) {
|
|
109
|
-
|
|
110
|
+
A(e instanceof Error ? e.message : "Failed to archive billing account");
|
|
110
111
|
} finally {
|
|
111
|
-
|
|
112
|
+
E(!1);
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
}, [
|
|
116
|
+
h,
|
|
115
117
|
g,
|
|
116
|
-
|
|
117
|
-
q,
|
|
118
|
+
K,
|
|
118
119
|
$,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
_,
|
|
121
|
+
L,
|
|
122
|
+
z,
|
|
123
|
+
v
|
|
123
124
|
]);
|
|
124
|
-
return
|
|
125
|
+
return p.canManageBillingAccount ? Ne && !K ? /* @__PURE__ */ d("div", {
|
|
125
126
|
className: "space-y-6 p-6",
|
|
126
127
|
children: [/* @__PURE__ */ u("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ u("div", {
|
|
127
128
|
className: "border border-border-subtle rounded-lg p-6 space-y-4",
|
|
@@ -134,16 +135,16 @@ var f = () => {
|
|
|
134
135
|
}) : /* @__PURE__ */ d("div", {
|
|
135
136
|
className: "space-y-6 p-6",
|
|
136
137
|
children: [
|
|
137
|
-
/* @__PURE__ */ u(
|
|
138
|
-
title:
|
|
139
|
-
description:
|
|
138
|
+
/* @__PURE__ */ u(ne, {
|
|
139
|
+
title: f("billing.settings.billingSettings", "Billing Settings"),
|
|
140
|
+
description: f("billing.settings.description", "Manage your billing account configuration")
|
|
140
141
|
}),
|
|
141
|
-
/* @__PURE__ */ u(
|
|
142
|
-
|
|
142
|
+
/* @__PURE__ */ u(we, { children: f("billing.settings.purpose", "Configure how a billing account behaves — its name and contact details, default currency, tax information and whether it's your default account. Changes here affect how invoices are generated and which account new purchases bill to.") }),
|
|
143
|
+
R.length > 1 && /* @__PURE__ */ d("div", {
|
|
143
144
|
className: "relative",
|
|
144
145
|
children: [/* @__PURE__ */ d("button", {
|
|
145
146
|
type: "button",
|
|
146
|
-
onClick: () =>
|
|
147
|
+
onClick: () => S(!x),
|
|
147
148
|
className: "w-full sm:w-auto flex items-center justify-between gap-3 px-4 py-3 border border-border-subtle rounded-lg bg-bg-surface hover:bg-bg-sunken/50 transition-colors",
|
|
148
149
|
children: [/* @__PURE__ */ d("div", {
|
|
149
150
|
className: "flex items-center gap-3",
|
|
@@ -165,14 +166,14 @@ var f = () => {
|
|
|
165
166
|
className: "text-left",
|
|
166
167
|
children: [/* @__PURE__ */ u("p", {
|
|
167
168
|
className: "text-sm font-medium text-text-primary",
|
|
168
|
-
children:
|
|
169
|
+
children: K?.name || f("billing.settings.selectAccount", "Select Account")
|
|
169
170
|
}), /* @__PURE__ */ u("p", {
|
|
170
171
|
className: "text-xs text-text-secondary",
|
|
171
|
-
children:
|
|
172
|
+
children: K?.email
|
|
172
173
|
})]
|
|
173
174
|
})]
|
|
174
175
|
}), /* @__PURE__ */ u("svg", {
|
|
175
|
-
className: `size-4 text-text-secondary transition-transform ${
|
|
176
|
+
className: `size-4 text-text-secondary transition-transform ${x ? "rotate-180" : ""}`,
|
|
176
177
|
fill: "none",
|
|
177
178
|
viewBox: "0 0 24 24",
|
|
178
179
|
stroke: "currentColor",
|
|
@@ -183,14 +184,14 @@ var f = () => {
|
|
|
183
184
|
d: "M19 9l-7 7-7-7"
|
|
184
185
|
})
|
|
185
186
|
})]
|
|
186
|
-
}),
|
|
187
|
+
}), x && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
|
|
187
188
|
className: "fixed inset-0 z-10",
|
|
188
|
-
onClick: () =>
|
|
189
|
+
onClick: () => S(!1)
|
|
189
190
|
}), /* @__PURE__ */ u("div", {
|
|
190
191
|
className: "absolute top-full left-0 right-0 sm:right-auto mt-1 w-full sm:w-80 bg-popover border border-border-subtle rounded-lg shadow-lg z-20 py-1 max-h-60 overflow-y-auto",
|
|
191
|
-
children:
|
|
192
|
+
children: R.map((e) => /* @__PURE__ */ d("button", {
|
|
192
193
|
type: "button",
|
|
193
|
-
onClick: () =>
|
|
194
|
+
onClick: () => Pe(e),
|
|
194
195
|
className: "w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-bg-sunken transition-colors",
|
|
195
196
|
children: [/* @__PURE__ */ d("div", {
|
|
196
197
|
className: "flex items-center gap-3 min-w-0",
|
|
@@ -218,7 +219,7 @@ var f = () => {
|
|
|
218
219
|
children: e.email
|
|
219
220
|
})]
|
|
220
221
|
})]
|
|
221
|
-
}),
|
|
222
|
+
}), K?.id === e.id && /* @__PURE__ */ u("svg", {
|
|
222
223
|
className: "size-4 text-primary flex-shrink-0",
|
|
223
224
|
fill: "none",
|
|
224
225
|
viewBox: "0 0 24 24",
|
|
@@ -241,11 +242,11 @@ var f = () => {
|
|
|
241
242
|
className: "flex items-center justify-between",
|
|
242
243
|
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h2", {
|
|
243
244
|
className: "text-lg font-semibold text-text-primary",
|
|
244
|
-
children:
|
|
245
|
+
children: f("billing.settings.accountInfo", "Account Information")
|
|
245
246
|
}), /* @__PURE__ */ u("p", {
|
|
246
247
|
className: "text-sm text-text-secondary mt-1",
|
|
247
|
-
children:
|
|
248
|
-
})] }),
|
|
248
|
+
children: f("billing.settings.accountInfoDescription", "Update your billing contact details and tax information")
|
|
249
|
+
})] }), K?.isDefault && /* @__PURE__ */ d("span", {
|
|
249
250
|
className: "inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium bg-action-primary-bg/10 text-primary rounded-full",
|
|
250
251
|
children: [/* @__PURE__ */ u("svg", {
|
|
251
252
|
className: "size-3",
|
|
@@ -256,60 +257,60 @@ var f = () => {
|
|
|
256
257
|
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
|
257
258
|
clipRule: "evenodd"
|
|
258
259
|
})
|
|
259
|
-
}),
|
|
260
|
+
}), f("billing.settings.defaultAccount", "Default Account")]
|
|
260
261
|
})]
|
|
261
262
|
})
|
|
262
263
|
}), /* @__PURE__ */ d("div", {
|
|
263
264
|
className: "p-6 space-y-6",
|
|
264
265
|
children: [
|
|
265
|
-
|
|
266
|
+
K && /* @__PURE__ */ d("div", {
|
|
266
267
|
className: "grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm pb-4 border-b border-border-subtle",
|
|
267
268
|
children: [
|
|
268
269
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
269
270
|
className: "text-text-secondary",
|
|
270
|
-
children:
|
|
271
|
+
children: f("billing.settings.status", "Status")
|
|
271
272
|
}), /* @__PURE__ */ u("p", {
|
|
272
|
-
className: `font-medium ${
|
|
273
|
-
children:
|
|
273
|
+
className: `font-medium ${K.isActive ? "text-status-success-text" : "text-status-error-text"}`,
|
|
274
|
+
children: K.isActive ? f("billing.settings.active", "Active") : f("billing.settings.inactive", "Inactive")
|
|
274
275
|
})] }),
|
|
275
276
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
276
277
|
className: "text-text-secondary",
|
|
277
|
-
children:
|
|
278
|
+
children: f("billing.settings.creditBalance", "Credit Balance")
|
|
278
279
|
}), /* @__PURE__ */ d("p", {
|
|
279
280
|
className: "font-medium text-text-primary",
|
|
280
281
|
children: [
|
|
281
|
-
(
|
|
282
|
+
(K.creditAmount || 0).toLocaleString(),
|
|
282
283
|
" ",
|
|
283
|
-
|
|
284
|
+
f("billing.common.credits", "Credits")
|
|
284
285
|
]
|
|
285
286
|
})] }),
|
|
286
287
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
287
288
|
className: "text-text-secondary",
|
|
288
|
-
children:
|
|
289
|
+
children: f("billing.settings.accountId", "Account ID")
|
|
289
290
|
}), /* @__PURE__ */ u("p", {
|
|
290
291
|
className: "font-mono text-xs text-text-primary truncate",
|
|
291
|
-
title:
|
|
292
|
-
children:
|
|
292
|
+
title: K.id,
|
|
293
|
+
children: K.id
|
|
293
294
|
})] }),
|
|
294
295
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
295
296
|
className: "text-text-secondary",
|
|
296
|
-
children:
|
|
297
|
+
children: f("billing.settings.created", "Created")
|
|
297
298
|
}), /* @__PURE__ */ u("p", {
|
|
298
299
|
className: "font-medium text-text-primary",
|
|
299
|
-
children:
|
|
300
|
+
children: K.createdAt ? new Date(K.createdAt).toLocaleDateString() : f("billing.settings.notAvailable", "N/A")
|
|
300
301
|
})] })
|
|
301
302
|
]
|
|
302
303
|
}),
|
|
303
304
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h3", {
|
|
304
305
|
className: "text-sm font-medium text-text-primary mb-4",
|
|
305
|
-
children:
|
|
306
|
+
children: f("billing.settings.contactDetails", "Contact Details")
|
|
306
307
|
}), /* @__PURE__ */ d("div", {
|
|
307
308
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
308
309
|
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
|
|
309
310
|
htmlFor: "billing-account-name",
|
|
310
311
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
311
312
|
children: [
|
|
312
|
-
|
|
313
|
+
f("billing.settings.accountName", "Account Name"),
|
|
313
314
|
" ",
|
|
314
315
|
/* @__PURE__ */ u("span", {
|
|
315
316
|
className: "text-status-error-text",
|
|
@@ -319,14 +320,14 @@ var f = () => {
|
|
|
319
320
|
}), /* @__PURE__ */ u("input", {
|
|
320
321
|
id: "billing-account-name",
|
|
321
322
|
type: "text",
|
|
322
|
-
value:
|
|
323
|
-
onChange: (e) =>
|
|
323
|
+
value: P.name,
|
|
324
|
+
onChange: (e) => q("name", e.target.value),
|
|
324
325
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
|
325
326
|
})] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
|
|
326
327
|
htmlFor: "billing-account-email",
|
|
327
328
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
328
329
|
children: [
|
|
329
|
-
|
|
330
|
+
f("billing.settings.email", "Email"),
|
|
330
331
|
" ",
|
|
331
332
|
/* @__PURE__ */ u("span", {
|
|
332
333
|
className: "text-status-error-text",
|
|
@@ -336,18 +337,18 @@ var f = () => {
|
|
|
336
337
|
}), /* @__PURE__ */ u("input", {
|
|
337
338
|
id: "billing-account-email",
|
|
338
339
|
type: "email",
|
|
339
|
-
value:
|
|
340
|
-
onChange: (e) =>
|
|
340
|
+
value: P.email,
|
|
341
|
+
onChange: (e) => q("email", e.target.value),
|
|
341
342
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
|
342
343
|
})] })]
|
|
343
344
|
})] }),
|
|
344
|
-
/* @__PURE__ */ u(
|
|
345
|
-
...
|
|
345
|
+
/* @__PURE__ */ u(Ce, {
|
|
346
|
+
...m ? {
|
|
346
347
|
storageKey: "billing.settings.account",
|
|
347
|
-
label:
|
|
348
|
+
label: f("billing.settings.moreOptions", "More options")
|
|
348
349
|
} : {},
|
|
349
|
-
title:
|
|
350
|
-
description:
|
|
350
|
+
title: f("billing.settings.advancedTitle", "Advanced settings"),
|
|
351
|
+
description: f("billing.settings.advancedDescription", "Billing email override, currency, and tax identification."),
|
|
351
352
|
children: /* @__PURE__ */ d("div", {
|
|
352
353
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
353
354
|
children: [
|
|
@@ -355,29 +356,29 @@ var f = () => {
|
|
|
355
356
|
/* @__PURE__ */ u("label", {
|
|
356
357
|
htmlFor: "billing-account-billing-email",
|
|
357
358
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
358
|
-
children:
|
|
359
|
+
children: f("billing.settings.billingEmail", "Billing Email")
|
|
359
360
|
}),
|
|
360
361
|
/* @__PURE__ */ u("input", {
|
|
361
362
|
id: "billing-account-billing-email",
|
|
362
363
|
type: "email",
|
|
363
|
-
value:
|
|
364
|
-
onChange: (e) =>
|
|
365
|
-
placeholder:
|
|
364
|
+
value: P.billingEmail,
|
|
365
|
+
onChange: (e) => q("billingEmail", e.target.value),
|
|
366
|
+
placeholder: f("billing.settings.billingEmailPlaceholder", "Optional - defaults to account email"),
|
|
366
367
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
|
367
368
|
}),
|
|
368
369
|
/* @__PURE__ */ u("p", {
|
|
369
370
|
className: "text-xs text-text-secondary mt-1",
|
|
370
|
-
children:
|
|
371
|
+
children: f("billing.settings.billingEmailHelp", "Invoices will be sent to this email if provided")
|
|
371
372
|
})
|
|
372
373
|
] }),
|
|
373
374
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
374
375
|
htmlFor: "billing-account-currency",
|
|
375
376
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
376
|
-
children:
|
|
377
|
+
children: f("billing.settings.currency", "Currency")
|
|
377
378
|
}), /* @__PURE__ */ d("select", {
|
|
378
379
|
id: "billing-account-currency",
|
|
379
|
-
value:
|
|
380
|
-
onChange: (e) =>
|
|
380
|
+
value: P.currency,
|
|
381
|
+
onChange: (e) => q("currency", e.target.value),
|
|
381
382
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
382
383
|
children: [
|
|
383
384
|
/* @__PURE__ */ u("option", {
|
|
@@ -404,26 +405,26 @@ var f = () => {
|
|
|
404
405
|
/* @__PURE__ */ u("label", {
|
|
405
406
|
htmlFor: "billing-account-tax-id",
|
|
406
407
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
407
|
-
children:
|
|
408
|
+
children: f("billing.settings.taxId", "Tax ID / VAT Number")
|
|
408
409
|
}),
|
|
409
410
|
/* @__PURE__ */ u("input", {
|
|
410
411
|
id: "billing-account-tax-id",
|
|
411
412
|
type: "text",
|
|
412
|
-
value:
|
|
413
|
-
onChange: (e) =>
|
|
414
|
-
placeholder:
|
|
413
|
+
value: P.taxId,
|
|
414
|
+
onChange: (e) => q("taxId", e.target.value),
|
|
415
|
+
placeholder: f("billing.settings.taxIdPlaceholder", "Enter your tax identification number"),
|
|
415
416
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
|
|
416
417
|
}),
|
|
417
418
|
/* @__PURE__ */ u("p", {
|
|
418
419
|
className: "text-xs text-text-secondary mt-1",
|
|
419
|
-
children:
|
|
420
|
+
children: f("billing.settings.taxIdHelp", "Used for invoices and tax compliance (e.g., GST, VAT number)")
|
|
420
421
|
})
|
|
421
422
|
]
|
|
422
423
|
})
|
|
423
424
|
]
|
|
424
425
|
})
|
|
425
426
|
}),
|
|
426
|
-
|
|
427
|
+
K?.isActive && R.length > 1 && /* @__PURE__ */ u("div", {
|
|
427
428
|
className: "pt-4 border-t border-border-subtle",
|
|
428
429
|
children: /* @__PURE__ */ d("div", {
|
|
429
430
|
className: "flex items-start gap-3",
|
|
@@ -432,12 +433,12 @@ var f = () => {
|
|
|
432
433
|
children: /* @__PURE__ */ u("input", {
|
|
433
434
|
type: "checkbox",
|
|
434
435
|
id: "isDefault",
|
|
435
|
-
checked:
|
|
436
|
-
onChange: (e) =>
|
|
436
|
+
checked: P.isDefault,
|
|
437
|
+
onChange: (e) => F((t) => ({
|
|
437
438
|
...t,
|
|
438
439
|
isDefault: e.target.checked
|
|
439
440
|
})),
|
|
440
|
-
disabled:
|
|
441
|
+
disabled: K?.isDefault,
|
|
441
442
|
className: "size-4 rounded border-border-subtle text-primary focus:ring-primary focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
442
443
|
})
|
|
443
444
|
}), /* @__PURE__ */ d("div", {
|
|
@@ -445,10 +446,10 @@ var f = () => {
|
|
|
445
446
|
children: [/* @__PURE__ */ u("label", {
|
|
446
447
|
htmlFor: "isDefault",
|
|
447
448
|
className: "text-sm font-medium text-text-primary cursor-pointer",
|
|
448
|
-
children:
|
|
449
|
+
children: f("billing.settings.setDefault", "Set as default billing account")
|
|
449
450
|
}), /* @__PURE__ */ u("p", {
|
|
450
451
|
className: "text-xs text-text-secondary mt-0.5",
|
|
451
|
-
children:
|
|
452
|
+
children: K?.isDefault ? f("billing.settings.currentDefaultDescription", "This is currently your default billing account") : f("billing.settings.makePrimaryDescription", "Make this your primary billing account for new subscriptions")
|
|
452
453
|
})]
|
|
453
454
|
})]
|
|
454
455
|
})
|
|
@@ -457,7 +458,7 @@ var f = () => {
|
|
|
457
458
|
className: "pt-4 border-t border-border-subtle flex items-center justify-between",
|
|
458
459
|
children: [/* @__PURE__ */ d("div", {
|
|
459
460
|
className: "flex items-center gap-2",
|
|
460
|
-
children: [
|
|
461
|
+
children: [Ee && /* @__PURE__ */ d("div", {
|
|
461
462
|
className: "flex items-center gap-2 text-sm text-status-success-text",
|
|
462
463
|
children: [/* @__PURE__ */ u("svg", {
|
|
463
464
|
className: "size-4",
|
|
@@ -470,8 +471,8 @@ var f = () => {
|
|
|
470
471
|
strokeWidth: 2,
|
|
471
472
|
d: "M5 13l4 4L19 7"
|
|
472
473
|
})
|
|
473
|
-
}),
|
|
474
|
-
}),
|
|
474
|
+
}), f("billing.settings.saveSuccess", "Changes saved successfully")]
|
|
475
|
+
}), k && /* @__PURE__ */ d("div", {
|
|
475
476
|
className: "flex items-center gap-2 text-sm text-status-error-text",
|
|
476
477
|
children: [/* @__PURE__ */ u("svg", {
|
|
477
478
|
className: "size-4",
|
|
@@ -484,22 +485,22 @@ var f = () => {
|
|
|
484
485
|
strokeWidth: 2,
|
|
485
486
|
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
486
487
|
})
|
|
487
|
-
}),
|
|
488
|
+
}), k]
|
|
488
489
|
})]
|
|
489
490
|
}), /* @__PURE__ */ d("div", {
|
|
490
491
|
className: "flex items-center gap-3",
|
|
491
|
-
children: [
|
|
492
|
+
children: [p.canArchiveBillingAccount && K?.isActive ? /* @__PURE__ */ u("button", {
|
|
492
493
|
type: "button",
|
|
493
|
-
onClick: () =>
|
|
494
|
-
disabled:
|
|
494
|
+
onClick: () => O(!0),
|
|
495
|
+
disabled: C || T,
|
|
495
496
|
className: "px-4 py-2 text-sm font-medium border border-border-subtle text-status-error-text rounded-md hover:bg-status-error-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
496
|
-
children:
|
|
497
|
+
children: T ? f("billing.settings.archiving", "Archiving...") : f("billing.settings.archiveAccount", "Archive Account")
|
|
497
498
|
}) : null, /* @__PURE__ */ d("button", {
|
|
498
499
|
type: "button",
|
|
499
|
-
onClick:
|
|
500
|
-
disabled: !
|
|
500
|
+
onClick: Fe,
|
|
501
|
+
disabled: !Y || C || T || !P.name || !P.email,
|
|
501
502
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2",
|
|
502
|
-
children: [
|
|
503
|
+
children: [C && /* @__PURE__ */ d("svg", {
|
|
503
504
|
className: "size-4 animate-spin",
|
|
504
505
|
fill: "none",
|
|
505
506
|
viewBox: "0 0 24 24",
|
|
@@ -515,19 +516,19 @@ var f = () => {
|
|
|
515
516
|
fill: "currentColor",
|
|
516
517
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
517
518
|
})]
|
|
518
|
-
}),
|
|
519
|
+
}), C ? f("billing.common.saving", "Saving...") : f("billing.common.saveChanges", "Save Changes")]
|
|
519
520
|
})]
|
|
520
521
|
})]
|
|
521
522
|
})
|
|
522
523
|
]
|
|
523
524
|
})]
|
|
524
525
|
}),
|
|
525
|
-
|
|
526
|
+
De && Oe && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
|
|
526
527
|
className: "fixed inset-0 bg-overlay-scrim z-40",
|
|
527
528
|
onClick: () => {
|
|
528
|
-
|
|
529
|
+
C || (M(!1), N(!1), F((e) => ({
|
|
529
530
|
...e,
|
|
530
|
-
isDefault:
|
|
531
|
+
isDefault: K?.isDefault || !1
|
|
531
532
|
})));
|
|
532
533
|
}
|
|
533
534
|
}), /* @__PURE__ */ u("div", {
|
|
@@ -537,13 +538,13 @@ var f = () => {
|
|
|
537
538
|
children: [
|
|
538
539
|
/* @__PURE__ */ u("h3", {
|
|
539
540
|
className: "text-lg font-semibold text-text-primary mb-2",
|
|
540
|
-
children:
|
|
541
|
+
children: f("billing.settings.confirmDefaultTitle", "Confirm Default Account Change")
|
|
541
542
|
}),
|
|
542
543
|
/* @__PURE__ */ u("p", {
|
|
543
544
|
className: "text-sm text-text-secondary mb-4",
|
|
544
|
-
children:
|
|
545
|
+
children: f("billing.settings.confirmDefaultDescription", "You are about to set {{accountName}} as your default billing account and save your changes.", { accountName: K?.name ?? "" })
|
|
545
546
|
}),
|
|
546
|
-
|
|
547
|
+
J && J.id !== K?.id && /* @__PURE__ */ u("div", {
|
|
547
548
|
className: "mb-4 p-3 bg-status-warning-bg-subtle border border-border-subtle rounded-md",
|
|
548
549
|
children: /* @__PURE__ */ d("div", {
|
|
549
550
|
className: "flex items-start gap-2",
|
|
@@ -562,10 +563,10 @@ var f = () => {
|
|
|
562
563
|
className: "text-sm",
|
|
563
564
|
children: [/* @__PURE__ */ u("p", {
|
|
564
565
|
className: "font-medium text-status-warning-text",
|
|
565
|
-
children:
|
|
566
|
+
children: f("billing.settings.currentDefaultWillChange", "Current default will change")
|
|
566
567
|
}), /* @__PURE__ */ u("p", {
|
|
567
568
|
className: "text-status-warning-text mt-0.5",
|
|
568
|
-
children:
|
|
569
|
+
children: f("billing.settings.currentDefaultWillChangeDescription", "{{accountName}} will no longer be the default account.", { accountName: J.name })
|
|
569
570
|
})]
|
|
570
571
|
})]
|
|
571
572
|
})
|
|
@@ -575,20 +576,20 @@ var f = () => {
|
|
|
575
576
|
children: [/* @__PURE__ */ u("button", {
|
|
576
577
|
type: "button",
|
|
577
578
|
onClick: () => {
|
|
578
|
-
|
|
579
|
+
M(!1), N(!1), F((e) => ({
|
|
579
580
|
...e,
|
|
580
|
-
isDefault:
|
|
581
|
+
isDefault: K?.isDefault || !1
|
|
581
582
|
}));
|
|
582
583
|
},
|
|
583
|
-
disabled:
|
|
584
|
+
disabled: C,
|
|
584
585
|
className: "px-4 py-2 text-sm font-medium text-text-primary border border-border-subtle rounded-md hover:bg-bg-sunken transition-colors disabled:opacity-50",
|
|
585
|
-
children:
|
|
586
|
+
children: f("billing.common.cancel", "Cancel")
|
|
586
587
|
}), /* @__PURE__ */ d("button", {
|
|
587
588
|
type: "button",
|
|
588
589
|
onClick: Q,
|
|
589
|
-
disabled:
|
|
590
|
+
disabled: C,
|
|
590
591
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 disabled:opacity-50 transition-colors flex items-center gap-2",
|
|
591
|
-
children: [
|
|
592
|
+
children: [C && /* @__PURE__ */ d("svg", {
|
|
592
593
|
className: "size-4 animate-spin",
|
|
593
594
|
fill: "none",
|
|
594
595
|
viewBox: "0 0 24 24",
|
|
@@ -604,28 +605,40 @@ var f = () => {
|
|
|
604
605
|
fill: "currentColor",
|
|
605
606
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
606
607
|
})]
|
|
607
|
-
}),
|
|
608
|
+
}), C ? f("billing.common.saving", "Saving...") : f("billing.common.saveChanges", "Save Changes")]
|
|
608
609
|
})]
|
|
609
610
|
})
|
|
610
611
|
]
|
|
611
612
|
})
|
|
612
613
|
})] }),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
children:
|
|
614
|
+
m && p.isBillingAdmin ? /* @__PURE__ */ d("section", {
|
|
615
|
+
"aria-labelledby": "billing-settings-team-heading",
|
|
616
|
+
className: "space-y-4 border-t border-border-subtle pt-6",
|
|
617
|
+
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h2", {
|
|
618
|
+
id: "billing-settings-team-heading",
|
|
619
|
+
className: "text-lg font-semibold text-text-primary",
|
|
620
|
+
children: f("billing.settings.teamPermissions", "Team & permissions")
|
|
621
|
+
}), /* @__PURE__ */ u("p", {
|
|
622
|
+
className: "mt-1 text-sm text-text-secondary",
|
|
623
|
+
children: f("billing.settings.teamPermissionsHint", "Control who can manage this billing account and what they can do.")
|
|
624
|
+
})] }), /* @__PURE__ */ u(se, { embedded: !0 })]
|
|
625
|
+
}) : null,
|
|
626
|
+
/* @__PURE__ */ u(c, {
|
|
627
|
+
open: D,
|
|
628
|
+
onOpenChange: O,
|
|
629
|
+
children: /* @__PURE__ */ d(ve, { children: [/* @__PURE__ */ d(xe, { children: [/* @__PURE__ */ u(Se, { children: f("billing.settings.archiveDialogTitle", "Archive billing account?") }), /* @__PURE__ */ u(ye, { children: Ie })] }), /* @__PURE__ */ d(be, { children: [/* @__PURE__ */ u(_e, { children: f("billing.common.cancel", "Cancel") }), /* @__PURE__ */ u(ge, {
|
|
617
630
|
onClick: () => {
|
|
618
|
-
|
|
631
|
+
O(!1), Le();
|
|
619
632
|
},
|
|
620
|
-
children:
|
|
633
|
+
children: f("billing.settings.archiveAccount", "Archive Account")
|
|
621
634
|
})] })] })
|
|
622
635
|
})
|
|
623
636
|
]
|
|
624
|
-
}) :
|
|
625
|
-
message:
|
|
626
|
-
granterHint:
|
|
627
|
-
}) : /* @__PURE__ */ u(r, { message:
|
|
637
|
+
}) : m ? /* @__PURE__ */ u(s, {
|
|
638
|
+
message: f("billing.settings.needAccess", "You need access to billing settings"),
|
|
639
|
+
granterHint: f("billing.settings.needAccessHint", "Ask a billing admin of this organization to give you access.")
|
|
640
|
+
}) : /* @__PURE__ */ u(r, { message: f("billing.settings.noManagePermission", "You don't have permission to manage billing settings.") });
|
|
628
641
|
};
|
|
629
|
-
export {
|
|
642
|
+
export { f as SettingsPage };
|
|
630
643
|
|
|
631
644
|
//# sourceMappingURL=SettingsPage.js.map
|