@scalio-cloud/ui 0.109.0 → 0.110.0
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/app-kit/ScalioFactoryReset.d.ts +15 -0
- package/dist/app-kit/ScalioFactoryReset.d.ts.map +1 -0
- package/dist/app-kit/ScalioLicensePanel.d.ts +23 -0
- package/dist/app-kit/ScalioLicensePanel.d.ts.map +1 -0
- package/dist/app-kit/ScalioLoginPage.d.ts +1 -1
- package/dist/app-kit/ScalioLoginPage.d.ts.map +1 -1
- package/dist/app-kit/ScalioMailSettings.d.ts +13 -0
- package/dist/app-kit/ScalioMailSettings.d.ts.map +1 -0
- package/dist/app-kit/ScalioRoleTenants.d.ts +22 -0
- package/dist/app-kit/ScalioRoleTenants.d.ts.map +1 -0
- package/dist/app-kit/_uiReact.d.ts +307 -0
- package/dist/app-kit/_uiReact.d.ts.map +1 -0
- package/dist/app-kit/index.d.ts +4 -0
- package/dist/app-kit/index.d.ts.map +1 -1
- package/dist/app-kit/index.js +303 -106
- package/dist/app-kit/index.js.map +1 -1
- package/dist/app-kit/index.mjs +213 -40
- package/dist/app-kit/index.mjs.map +1 -1
- package/dist/config/i18nCheck.d.ts +49 -0
- package/dist/config/i18nCheck.d.ts.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +187 -4
- package/dist/config/index.js.map +1 -1
- package/dist/config/index.mjs +178 -3
- package/dist/config/index.mjs.map +1 -1
- package/dist/config/openapi.d.ts +34 -0
- package/dist/config/openapi.d.ts.map +1 -0
- package/dist/editor/RichTextEditor.d.ts +58 -0
- package/dist/editor/RichTextEditor.d.ts.map +1 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +350 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/index.mjs +324 -0
- package/dist/editor/index.mjs.map +1 -0
- package/package.json +22 -1
package/dist/app-kit/index.js
CHANGED
|
@@ -33,12 +33,16 @@ __export(app_kit_exports, {
|
|
|
33
33
|
ScalioAuditHeader: () => ScalioAuditHeader,
|
|
34
34
|
ScalioAuditPage: () => ScalioAuditPage,
|
|
35
35
|
ScalioBackupSection: () => ScalioBackupSection,
|
|
36
|
+
ScalioFactoryReset: () => ScalioFactoryReset,
|
|
36
37
|
ScalioInvitePage: () => ScalioInvitePage,
|
|
37
38
|
ScalioJobsPage: () => ScalioJobsPage,
|
|
39
|
+
ScalioLicensePanel: () => ScalioLicensePanel,
|
|
38
40
|
ScalioLoginPage: () => ScalioLoginPage,
|
|
41
|
+
ScalioMailSettings: () => ScalioMailSettings,
|
|
39
42
|
ScalioMaintenanceBanner: () => ScalioMaintenanceBanner,
|
|
40
43
|
ScalioPasswordChangePage: () => ScalioPasswordChangePage,
|
|
41
44
|
ScalioProfilePage: () => ScalioProfilePage,
|
|
45
|
+
ScalioRoleTenants: () => ScalioRoleTenants,
|
|
42
46
|
ScalioSaasUpdateBanner: () => ScalioSaasUpdateBanner,
|
|
43
47
|
ScalioSaasUpdatesSection: () => ScalioSaasUpdatesSection,
|
|
44
48
|
ScalioSecurityFactors: () => ScalioSecurityFactors,
|
|
@@ -49,9 +53,62 @@ __export(app_kit_exports, {
|
|
|
49
53
|
module.exports = __toCommonJS(app_kit_exports);
|
|
50
54
|
|
|
51
55
|
// src/app-kit/ScalioSecurityFactors.tsx
|
|
52
|
-
var
|
|
56
|
+
var import_react2 = require("react");
|
|
53
57
|
var import_sonner = require("sonner");
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
// src/app-kit/_uiReact.ts
|
|
60
|
+
var import_react = __toESM(require("@scalio-cloud/ui/react"));
|
|
61
|
+
var {
|
|
62
|
+
AuditLog,
|
|
63
|
+
AuditNav,
|
|
64
|
+
AuthHeader,
|
|
65
|
+
AuthLayout,
|
|
66
|
+
AuthMessage,
|
|
67
|
+
BackupPanel,
|
|
68
|
+
FactoryReset,
|
|
69
|
+
JobsPanel,
|
|
70
|
+
LanguageChoice,
|
|
71
|
+
LicensePanel,
|
|
72
|
+
LoginPage,
|
|
73
|
+
MailTransport,
|
|
74
|
+
MaintenanceNotice,
|
|
75
|
+
MicrosoftConnection,
|
|
76
|
+
PageHeader,
|
|
77
|
+
PasswordChange,
|
|
78
|
+
PasswordPolicySelect,
|
|
79
|
+
ProfileIdentity,
|
|
80
|
+
ProfileSection,
|
|
81
|
+
RoleAdmin,
|
|
82
|
+
RoleSourceSettings,
|
|
83
|
+
SaasUpdatesPanel,
|
|
84
|
+
SecurityFactors,
|
|
85
|
+
SelfTestPanel,
|
|
86
|
+
SettingsLayout,
|
|
87
|
+
SettingsSection,
|
|
88
|
+
SupportConnection,
|
|
89
|
+
ThemeChoice,
|
|
90
|
+
TimezoneChoice,
|
|
91
|
+
UpdateBanner,
|
|
92
|
+
UserAdmin,
|
|
93
|
+
accountArea,
|
|
94
|
+
accountGroups,
|
|
95
|
+
auditApi,
|
|
96
|
+
backupApi,
|
|
97
|
+
customerAccessProps,
|
|
98
|
+
factoryResetApi,
|
|
99
|
+
jobsApi,
|
|
100
|
+
labelsFor,
|
|
101
|
+
licenseApi,
|
|
102
|
+
mailApi,
|
|
103
|
+
rolesApi,
|
|
104
|
+
saasUpdatesApi,
|
|
105
|
+
securityApi,
|
|
106
|
+
selftestApi,
|
|
107
|
+
supportApi,
|
|
108
|
+
usersApi
|
|
109
|
+
} = import_react.default;
|
|
110
|
+
|
|
111
|
+
// src/app-kit/ScalioSecurityFactors.tsx
|
|
55
112
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
113
|
var defaultNotify = (text, tone) => {
|
|
57
114
|
if (tone === "error") import_sonner.toast.error(text);
|
|
@@ -70,8 +127,8 @@ function ScalioSecurityFactors({
|
|
|
70
127
|
onMfaChange,
|
|
71
128
|
className = "mt-8 pt-6 border-t border-border"
|
|
72
129
|
}) {
|
|
73
|
-
const client = (0,
|
|
74
|
-
() =>
|
|
130
|
+
const client = (0, import_react2.useMemo)(
|
|
131
|
+
() => securityApi(api, { startRegistration, browserSupportsWebAuthn }),
|
|
75
132
|
[api, startRegistration, browserSupportsWebAuthn]
|
|
76
133
|
);
|
|
77
134
|
const formatError = (e) => {
|
|
@@ -79,7 +136,7 @@ function ScalioSecurityFactors({
|
|
|
79
136
|
return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
|
|
80
137
|
};
|
|
81
138
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
-
|
|
139
|
+
SecurityFactors,
|
|
83
140
|
{
|
|
84
141
|
client,
|
|
85
142
|
lang,
|
|
@@ -97,7 +154,6 @@ function ScalioSecurityFactors({
|
|
|
97
154
|
|
|
98
155
|
// src/app-kit/ScalioPasswordChangePage.tsx
|
|
99
156
|
var import_sonner2 = require("sonner");
|
|
100
|
-
var import_react3 = require("@scalio-cloud/ui/react");
|
|
101
157
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
102
158
|
function ScalioPasswordChangePage({
|
|
103
159
|
api,
|
|
@@ -118,9 +174,9 @@ function ScalioPasswordChangePage({
|
|
|
118
174
|
});
|
|
119
175
|
return data;
|
|
120
176
|
};
|
|
121
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-4", "data-testid": "password-change-required", children: [
|
|
122
178
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
123
|
-
|
|
179
|
+
AuthHeader,
|
|
124
180
|
{
|
|
125
181
|
eyebrow: email,
|
|
126
182
|
title: t("Choose your password"),
|
|
@@ -128,7 +184,7 @@ function ScalioPasswordChangePage({
|
|
|
128
184
|
}
|
|
129
185
|
),
|
|
130
186
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
131
|
-
|
|
187
|
+
PasswordChange,
|
|
132
188
|
{
|
|
133
189
|
onSubmit: change,
|
|
134
190
|
minLength,
|
|
@@ -153,16 +209,15 @@ function ScalioPasswordChangePage({
|
|
|
153
209
|
}
|
|
154
210
|
|
|
155
211
|
// src/app-kit/ScalioProfilePage.tsx
|
|
156
|
-
var
|
|
212
|
+
var import_react5 = require("react");
|
|
157
213
|
var import_sonner3 = require("sonner");
|
|
158
214
|
var import_lucide_react = require("lucide-react");
|
|
159
|
-
var import_react7 = require("@scalio-cloud/ui/react");
|
|
160
215
|
|
|
161
216
|
// src/core/api.ts
|
|
162
217
|
var import_axios = __toESM(require("axios"));
|
|
163
218
|
|
|
164
219
|
// src/core/i18n.tsx
|
|
165
|
-
var
|
|
220
|
+
var import_react3 = __toESM(require("react"));
|
|
166
221
|
function N_(text) {
|
|
167
222
|
return text;
|
|
168
223
|
}
|
|
@@ -182,7 +237,7 @@ function mailReady(settings) {
|
|
|
182
237
|
}
|
|
183
238
|
|
|
184
239
|
// src/core/legal.ts
|
|
185
|
-
var
|
|
240
|
+
var import_react4 = require("react");
|
|
186
241
|
|
|
187
242
|
// src/app-kit/ScalioProfilePage.tsx
|
|
188
243
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -210,11 +265,11 @@ function ScalioProfilePage({
|
|
|
210
265
|
minPasswordLength = 12,
|
|
211
266
|
securityFactors
|
|
212
267
|
}) {
|
|
213
|
-
const L =
|
|
268
|
+
const L = labelsFor(lang);
|
|
214
269
|
const P = L.profile_;
|
|
215
|
-
const [name, setName] = (0,
|
|
216
|
-
const [savingName, setSavingName] = (0,
|
|
217
|
-
const [ssoOn, setSsoOn] = (0,
|
|
270
|
+
const [name, setName] = (0, import_react5.useState)(user?.name || "");
|
|
271
|
+
const [savingName, setSavingName] = (0, import_react5.useState)(false);
|
|
272
|
+
const [ssoOn, setSsoOn] = (0, import_react5.useState)(false);
|
|
218
273
|
const saved = () => {
|
|
219
274
|
import_sonner3.toast.success(P.saved);
|
|
220
275
|
};
|
|
@@ -230,7 +285,7 @@ function ScalioProfilePage({
|
|
|
230
285
|
};
|
|
231
286
|
const resolvedRoles = roleLabels ?? defaultRoles;
|
|
232
287
|
const roleName = user?.role && resolvedRoles[user.role] || t("Reader");
|
|
233
|
-
(0,
|
|
288
|
+
(0, import_react5.useEffect)(() => {
|
|
234
289
|
api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
|
|
235
290
|
if (typeof window === "undefined") return;
|
|
236
291
|
const result = new URLSearchParams(window.location.search).get("microsoft");
|
|
@@ -304,7 +359,7 @@ function ScalioProfilePage({
|
|
|
304
359
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-sm text-muted-foreground", children: P.subtitle })
|
|
305
360
|
] }),
|
|
306
361
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
307
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "account", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileIdentity, { name: user?.name, email: user?.email, role: roleName, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { onSubmit: saveName, className: "flex flex-col sm:flex-row sm:items-end gap-3", children: [
|
|
308
363
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1", children: [
|
|
309
364
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: LABEL_CLASS, htmlFor: "profile-name", children: t("Name") }),
|
|
310
365
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -335,8 +390,8 @@ function ScalioProfilePage({
|
|
|
335
390
|
}
|
|
336
391
|
)
|
|
337
392
|
] }) }) }),
|
|
338
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
339
|
-
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "appearance", lang, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
394
|
+
ThemeChoice,
|
|
340
395
|
{
|
|
341
396
|
theme,
|
|
342
397
|
onChange: (m) => {
|
|
@@ -346,13 +401,13 @@ function ScalioProfilePage({
|
|
|
346
401
|
lang
|
|
347
402
|
}
|
|
348
403
|
) }),
|
|
349
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
350
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
351
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(ProfileSection, { id: "language", lang, children: [
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LanguageChoice, { lang, onChange: chooseLang }),
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TimezoneChoice, { value: user?.timezone || "", onChange: chooseTz, lang })
|
|
352
407
|
] }),
|
|
353
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(ProfileSection, { id: "security", lang, testId: "change-password-section", children: [
|
|
354
409
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
355
|
-
|
|
410
|
+
PasswordChange,
|
|
356
411
|
{
|
|
357
412
|
onSubmit: changePassword,
|
|
358
413
|
onDone: () => import_sonner3.toast.success(t("Password changed. Other devices have been signed out.")),
|
|
@@ -362,8 +417,8 @@ function ScalioProfilePage({
|
|
|
362
417
|
),
|
|
363
418
|
securityFactors
|
|
364
419
|
] }),
|
|
365
|
-
(ssoOn || user?.microsoft) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
366
|
-
|
|
420
|
+
(ssoOn || user?.microsoft) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ProfileSection, { id: "connections", lang, testId: "connections-section", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
421
|
+
MicrosoftConnection,
|
|
367
422
|
{
|
|
368
423
|
linked: Boolean(user?.microsoft),
|
|
369
424
|
canUnlink: Boolean(user?.has_password),
|
|
@@ -377,10 +432,9 @@ function ScalioProfilePage({
|
|
|
377
432
|
}
|
|
378
433
|
|
|
379
434
|
// src/app-kit/ScalioUsersPage.tsx
|
|
380
|
-
var
|
|
435
|
+
var import_react6 = require("react");
|
|
381
436
|
var import_react_router_dom = require("react-router-dom");
|
|
382
437
|
var import_sonner4 = require("sonner");
|
|
383
|
-
var import_react9 = require("@scalio-cloud/ui/react");
|
|
384
438
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
385
439
|
function roleLabel(name, lang) {
|
|
386
440
|
if (name && typeof name === "object") {
|
|
@@ -400,25 +454,25 @@ function ScalioUsersPage({
|
|
|
400
454
|
emptyCustomersHint,
|
|
401
455
|
renderEntraTab
|
|
402
456
|
}) {
|
|
403
|
-
const L =
|
|
457
|
+
const L = labelsFor(lang);
|
|
404
458
|
const [params] = (0, import_react_router_dom.useSearchParams)();
|
|
405
459
|
const { area } = (0, import_react_router_dom.useParams)();
|
|
406
460
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
407
|
-
const usersClient = (0,
|
|
408
|
-
const rolesClient = (0,
|
|
409
|
-
const [rows, setRows] = (0,
|
|
410
|
-
const [ssoOn, setSsoOn] = (0,
|
|
411
|
-
const [mailOn, setMailOn] = (0,
|
|
412
|
-
const [roles, setRoles] = (0,
|
|
413
|
-
const [policy, setPolicy] = (0,
|
|
414
|
-
const load = (0,
|
|
461
|
+
const usersClient = (0, import_react6.useMemo)(() => usersApi(api), [api]);
|
|
462
|
+
const rolesClient = (0, import_react6.useMemo)(() => rolesApi(api), [api]);
|
|
463
|
+
const [rows, setRows] = (0, import_react6.useState)([]);
|
|
464
|
+
const [ssoOn, setSsoOn] = (0, import_react6.useState)(false);
|
|
465
|
+
const [mailOn, setMailOn] = (0, import_react6.useState)(false);
|
|
466
|
+
const [roles, setRoles] = (0, import_react6.useState)([]);
|
|
467
|
+
const [policy, setPolicy] = (0, import_react6.useState)(null);
|
|
468
|
+
const load = (0, import_react6.useCallback)(() => {
|
|
415
469
|
api.get("/users").then((r) => setRows(r.data)).catch(() => setRows([]));
|
|
416
470
|
rolesClient.list().then(setRoles).catch(() => setRoles([]));
|
|
417
471
|
api.get("/users/login-policy").then((r) => setPolicy(r.data)).catch(() => setPolicy(null));
|
|
418
472
|
api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
|
|
419
473
|
api.get("/mail/settings").then((r) => setMailOn(mailReady(r.data))).catch(() => setMailOn(false));
|
|
420
474
|
}, [api, rolesClient]);
|
|
421
|
-
(0,
|
|
475
|
+
(0, import_react6.useEffect)(() => {
|
|
422
476
|
load();
|
|
423
477
|
}, [load]);
|
|
424
478
|
const fail = (e) => {
|
|
@@ -453,7 +507,7 @@ function ScalioUsersPage({
|
|
|
453
507
|
const emergencyCount = rows.filter(
|
|
454
508
|
(u) => u.emergency_admin && u.role === "admin" && u.has_password && !u.access_pending
|
|
455
509
|
).length;
|
|
456
|
-
const active =
|
|
510
|
+
const active = accountArea(area);
|
|
457
511
|
if (!area) {
|
|
458
512
|
const old = params.get("tab");
|
|
459
513
|
const target = old === "signIn" ? "sign-in" : old && ["roles", "entra"].includes(old) ? old : "users";
|
|
@@ -467,7 +521,7 @@ function ScalioUsersPage({
|
|
|
467
521
|
const err = e;
|
|
468
522
|
return err?.response?.data?.detail ? formatApiErrorDetail(err.response.data.detail) : t("The action failed.");
|
|
469
523
|
};
|
|
470
|
-
const groups =
|
|
524
|
+
const groups = accountGroups({ lang }).map(
|
|
471
525
|
(g) => ({
|
|
472
526
|
...g,
|
|
473
527
|
items: g.items.map(
|
|
@@ -479,13 +533,13 @@ function ScalioUsersPage({
|
|
|
479
533
|
)
|
|
480
534
|
})
|
|
481
535
|
);
|
|
482
|
-
const extraCustomerProps = customers ?
|
|
536
|
+
const extraCustomerProps = customers ? customerAccessProps({
|
|
483
537
|
customers,
|
|
484
538
|
lang,
|
|
485
539
|
emptyHint: emptyCustomersHint ?? t("No customers yet. Add them under Settings, Tenants.")
|
|
486
540
|
}) : {};
|
|
487
541
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-testid": "users-page", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
488
|
-
|
|
542
|
+
SettingsLayout,
|
|
489
543
|
{
|
|
490
544
|
groups,
|
|
491
545
|
active,
|
|
@@ -498,7 +552,7 @@ function ScalioUsersPage({
|
|
|
498
552
|
testId: "accounts-layout",
|
|
499
553
|
children: [
|
|
500
554
|
active === "users" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
501
|
-
|
|
555
|
+
UserAdmin,
|
|
502
556
|
{
|
|
503
557
|
client: usersClient,
|
|
504
558
|
me: user.id,
|
|
@@ -516,7 +570,7 @@ function ScalioUsersPage({
|
|
|
516
570
|
}
|
|
517
571
|
),
|
|
518
572
|
active === "roles" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
519
|
-
|
|
573
|
+
RoleAdmin,
|
|
520
574
|
{
|
|
521
575
|
client: rolesClient,
|
|
522
576
|
lang,
|
|
@@ -529,7 +583,7 @@ function ScalioUsersPage({
|
|
|
529
583
|
),
|
|
530
584
|
active === "entra" && renderEntraTab?.(load),
|
|
531
585
|
active === "signIn" && policy && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-testid": "login-policy-card", className: "bg-card border border-border rounded-sm px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
532
|
-
|
|
586
|
+
PasswordPolicySelect,
|
|
533
587
|
{
|
|
534
588
|
value: policy.value,
|
|
535
589
|
emergencyCount,
|
|
@@ -545,9 +599,8 @@ function ScalioUsersPage({
|
|
|
545
599
|
}
|
|
546
600
|
|
|
547
601
|
// src/app-kit/ScalioLoginPage.tsx
|
|
548
|
-
var
|
|
602
|
+
var import_react7 = require("react");
|
|
549
603
|
var import_react_router_dom2 = require("react-router-dom");
|
|
550
|
-
var import_react11 = require("@scalio-cloud/ui/react");
|
|
551
604
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
552
605
|
function ScalioLoginPage({
|
|
553
606
|
api,
|
|
@@ -564,7 +617,7 @@ function ScalioLoginPage({
|
|
|
564
617
|
onSignedIn
|
|
565
618
|
}) {
|
|
566
619
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
567
|
-
(0,
|
|
620
|
+
(0, import_react7.useEffect)(() => {
|
|
568
621
|
if (clearSessionKeys.length === 0) return;
|
|
569
622
|
try {
|
|
570
623
|
for (const key of clearSessionKeys) {
|
|
@@ -573,12 +626,12 @@ function ScalioLoginPage({
|
|
|
573
626
|
} catch {
|
|
574
627
|
}
|
|
575
628
|
}, [clearSessionKeys]);
|
|
576
|
-
const handleSignedIn = (0,
|
|
629
|
+
const handleSignedIn = (0, import_react7.useCallback)(() => {
|
|
577
630
|
if (onSignedIn) onSignedIn();
|
|
578
631
|
else navigate(afterLoginTo, { replace: true });
|
|
579
632
|
}, [onSignedIn, navigate, afterLoginTo]);
|
|
580
633
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
581
|
-
|
|
634
|
+
LoginPage,
|
|
582
635
|
{
|
|
583
636
|
api,
|
|
584
637
|
apiBase,
|
|
@@ -595,10 +648,9 @@ function ScalioLoginPage({
|
|
|
595
648
|
}
|
|
596
649
|
|
|
597
650
|
// src/app-kit/ScalioInvitePage.tsx
|
|
598
|
-
var
|
|
651
|
+
var import_react8 = require("react");
|
|
599
652
|
var import_react_router_dom3 = require("react-router-dom");
|
|
600
653
|
var import_lucide_react2 = require("lucide-react");
|
|
601
|
-
var import_react13 = require("@scalio-cloud/ui/react");
|
|
602
654
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
603
655
|
var FIELD_CLASS2 = "mt-1 w-full h-11 px-3 bg-background border border-input rounded-sm text-sm focus:outline-none focus:ring-1 focus:ring-ring";
|
|
604
656
|
var LABEL_CLASS2 = "text-[11px] font-bold uppercase tracking-widest text-muted-foreground";
|
|
@@ -615,14 +667,14 @@ function ScalioInvitePage({
|
|
|
615
667
|
redirectTo = "/"
|
|
616
668
|
}) {
|
|
617
669
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
618
|
-
const [token] = (0,
|
|
619
|
-
const [info, setInfo] = (0,
|
|
620
|
-
const [invalid, setInvalid] = (0,
|
|
621
|
-
const [pw, setPw] = (0,
|
|
622
|
-
const [pw2, setPw2] = (0,
|
|
623
|
-
const [error, setError] = (0,
|
|
624
|
-
const [busy, setBusy] = (0,
|
|
625
|
-
(0,
|
|
670
|
+
const [token] = (0, import_react8.useState)(() => typeof window !== "undefined" ? window.location.hash.replace(/^#/, "") : "");
|
|
671
|
+
const [info, setInfo] = (0, import_react8.useState)(null);
|
|
672
|
+
const [invalid, setInvalid] = (0, import_react8.useState)(false);
|
|
673
|
+
const [pw, setPw] = (0, import_react8.useState)("");
|
|
674
|
+
const [pw2, setPw2] = (0, import_react8.useState)("");
|
|
675
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
676
|
+
const [busy, setBusy] = (0, import_react8.useState)(false);
|
|
677
|
+
(0, import_react8.useEffect)(() => {
|
|
626
678
|
if (!token) {
|
|
627
679
|
setInvalid(true);
|
|
628
680
|
return;
|
|
@@ -651,16 +703,16 @@ function ScalioInvitePage({
|
|
|
651
703
|
setBusy(false);
|
|
652
704
|
}
|
|
653
705
|
};
|
|
654
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthLayout, { legalUrl, brand, lang, onLangChange, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", "data-testid": "invite-page", children: [
|
|
655
707
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
656
|
-
|
|
708
|
+
AuthHeader,
|
|
657
709
|
{
|
|
658
710
|
eyebrow: info?.email,
|
|
659
711
|
title: welcomeTitle,
|
|
660
712
|
subtitle: t("Choose your password to finish the invitation.")
|
|
661
713
|
}
|
|
662
714
|
),
|
|
663
|
-
invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
715
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthMessage, { kind: "error", testId: "invite-invalid", children: t("This invitation is no longer valid. Ask an administrator for a new one.") }),
|
|
664
716
|
!invalid && !info && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Loader2, { className: "w-5 h-5 animate-spin text-primary" }),
|
|
665
717
|
info && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { onSubmit: submit, className: "space-y-3", children: [
|
|
666
718
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block", children: [
|
|
@@ -691,7 +743,7 @@ function ScalioInvitePage({
|
|
|
691
743
|
}
|
|
692
744
|
)
|
|
693
745
|
] }),
|
|
694
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
746
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AuthMessage, { kind: "error", testId: "invite-error", children: error }),
|
|
695
747
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
696
748
|
"button",
|
|
697
749
|
{
|
|
@@ -710,20 +762,19 @@ function ScalioInvitePage({
|
|
|
710
762
|
}
|
|
711
763
|
|
|
712
764
|
// src/app-kit/ScalioAuditPages.tsx
|
|
713
|
-
var
|
|
765
|
+
var import_react9 = require("react");
|
|
714
766
|
var import_react_router_dom4 = require("react-router-dom");
|
|
715
767
|
var import_sonner5 = require("sonner");
|
|
716
|
-
var import_react15 = require("@scalio-cloud/ui/react");
|
|
717
768
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
718
769
|
var defaultNotify2 = (text, tone) => {
|
|
719
770
|
if (tone === "error") import_sonner5.toast.error(text);
|
|
720
771
|
else import_sonner5.toast.success(text);
|
|
721
772
|
};
|
|
722
773
|
function ScalioAuditHeader({ lang, t }) {
|
|
723
|
-
const L =
|
|
774
|
+
const L = labelsFor(lang);
|
|
724
775
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-3", children: [
|
|
725
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
726
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageHeader, { title: L.auditLog, subtitle: t("Who changed what, and the background jobs of this installation") }),
|
|
777
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AuditNav, { link: import_react_router_dom4.NavLink, lang })
|
|
727
778
|
] });
|
|
728
779
|
}
|
|
729
780
|
function ScalioAuditPage({
|
|
@@ -734,20 +785,20 @@ function ScalioAuditPage({
|
|
|
734
785
|
actionLabel,
|
|
735
786
|
storageKey
|
|
736
787
|
}) {
|
|
737
|
-
const client = (0,
|
|
788
|
+
const client = (0, import_react9.useMemo)(() => auditApi(api), [api]);
|
|
738
789
|
if (!can(user, "audit.view")) return null;
|
|
739
790
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-testid": "audit-page", className: "space-y-5", children: [
|
|
740
791
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScalioAuditHeader, { lang, t }),
|
|
741
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AuditLog, { client, lang, notify: defaultNotify2, actionLabel, storageKey })
|
|
742
793
|
] });
|
|
743
794
|
}
|
|
744
795
|
function ScalioJobsPage({ api, user, lang, t, confirm }) {
|
|
745
|
-
const client = (0,
|
|
796
|
+
const client = (0, import_react9.useMemo)(() => jobsApi(api), [api]);
|
|
746
797
|
if (!can(user, "audit.view")) return null;
|
|
747
798
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-testid": "jobs-page", className: "space-y-5", children: [
|
|
748
799
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ScalioAuditHeader, { lang, t }),
|
|
749
800
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
750
|
-
|
|
801
|
+
JobsPanel,
|
|
751
802
|
{
|
|
752
803
|
client,
|
|
753
804
|
lang,
|
|
@@ -761,23 +812,22 @@ function ScalioJobsPage({ api, user, lang, t, confirm }) {
|
|
|
761
812
|
}
|
|
762
813
|
|
|
763
814
|
// src/app-kit/ScalioSelfTestPage.tsx
|
|
764
|
-
var
|
|
815
|
+
var import_react10 = require("react");
|
|
765
816
|
var import_react_router_dom5 = require("react-router-dom");
|
|
766
817
|
var import_sonner6 = require("sonner");
|
|
767
|
-
var import_react17 = require("@scalio-cloud/ui/react");
|
|
768
818
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
769
819
|
function ScalioSelfTestPage({ api, user, lang, t }) {
|
|
770
|
-
const [on, setOn] = (0,
|
|
771
|
-
const client = (0,
|
|
772
|
-
(0,
|
|
820
|
+
const [on, setOn] = (0, import_react10.useState)(null);
|
|
821
|
+
const client = (0, import_react10.useMemo)(() => selftestApi(api), [api]);
|
|
822
|
+
(0, import_react10.useEffect)(() => {
|
|
773
823
|
api.get("/e2e/status").then((r) => setOn(Boolean(r.data?.enabled))).catch(() => setOn(false));
|
|
774
824
|
}, [api]);
|
|
775
825
|
if (user?.role !== "admin" || on === false) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom5.Navigate, { to: "/", replace: true });
|
|
776
826
|
if (on === null) return null;
|
|
777
827
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-testid": "selftest-page", className: "space-y-5", children: [
|
|
778
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PageHeader, { eyebrow: t("Tests"), title: t("E2E self-check"), subtitle: t("Self-check of this test instance") }),
|
|
779
829
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
780
|
-
|
|
830
|
+
SelfTestPanel,
|
|
781
831
|
{
|
|
782
832
|
client,
|
|
783
833
|
lang,
|
|
@@ -788,10 +838,9 @@ function ScalioSelfTestPage({ api, user, lang, t }) {
|
|
|
788
838
|
}
|
|
789
839
|
|
|
790
840
|
// src/app-kit/ScalioBackupSection.tsx
|
|
791
|
-
var
|
|
841
|
+
var import_react11 = require("react");
|
|
792
842
|
var import_react_router_dom6 = require("react-router-dom");
|
|
793
843
|
var import_sonner7 = require("sonner");
|
|
794
|
-
var import_react19 = require("@scalio-cloud/ui/react");
|
|
795
844
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
796
845
|
var notify = (text, tone) => {
|
|
797
846
|
if (tone === "error") import_sonner7.toast.error(text);
|
|
@@ -806,20 +855,20 @@ function ScalioBackupSection({
|
|
|
806
855
|
description,
|
|
807
856
|
accountTo = "/profile"
|
|
808
857
|
}) {
|
|
809
|
-
const client = (0,
|
|
810
|
-
const labels = (0,
|
|
858
|
+
const client = (0, import_react11.useMemo)(() => backupApi(api), [api]);
|
|
859
|
+
const labels = (0, import_react11.useMemo)(
|
|
811
860
|
() => withDataOnLabel ? { backup: { withDataOn: withDataOnLabel } } : void 0,
|
|
812
861
|
[withDataOnLabel]
|
|
813
862
|
);
|
|
814
863
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
815
|
-
|
|
864
|
+
SettingsSection,
|
|
816
865
|
{
|
|
817
866
|
id: "backup",
|
|
818
867
|
title: t("Backup"),
|
|
819
868
|
testId: "backup-card",
|
|
820
869
|
description: description ?? t("Encrypted export and import, e.g. to move to another instance. After a move the tenants are connected again."),
|
|
821
870
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
822
|
-
|
|
871
|
+
BackupPanel,
|
|
823
872
|
{
|
|
824
873
|
client,
|
|
825
874
|
lang,
|
|
@@ -834,24 +883,23 @@ function ScalioBackupSection({
|
|
|
834
883
|
);
|
|
835
884
|
}
|
|
836
885
|
function ScalioMaintenanceBanner({ api, lang }) {
|
|
837
|
-
const client = (0,
|
|
838
|
-
const [on, setOn] = (0,
|
|
839
|
-
(0,
|
|
886
|
+
const client = (0, import_react11.useMemo)(() => backupApi(api), [api]);
|
|
887
|
+
const [on, setOn] = (0, import_react11.useState)(false);
|
|
888
|
+
(0, import_react11.useEffect)(() => {
|
|
840
889
|
const show = () => setOn(true);
|
|
841
890
|
window.addEventListener("scalio-maintenance", show);
|
|
842
891
|
return () => window.removeEventListener("scalio-maintenance", show);
|
|
843
892
|
}, []);
|
|
844
|
-
return on ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
893
|
+
return on ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MaintenanceNotice, { client, lang }) : null;
|
|
845
894
|
}
|
|
846
895
|
|
|
847
896
|
// src/app-kit/ScalioSaasUpdatesSection.tsx
|
|
848
|
-
var
|
|
897
|
+
var import_react12 = require("react");
|
|
849
898
|
var import_sonner8 = require("sonner");
|
|
850
|
-
var import_react21 = require("@scalio-cloud/ui/react");
|
|
851
899
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
852
900
|
function ScalioSaasUpdateBanner({ api, lang, onOpen }) {
|
|
853
|
-
const client = (0,
|
|
854
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
901
|
+
const client = (0, import_react12.useMemo)(() => saasUpdatesApi(api), [api]);
|
|
902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateBanner, { client, lang, onOpen });
|
|
855
903
|
}
|
|
856
904
|
function ScalioSaasUpdatesSection({
|
|
857
905
|
api,
|
|
@@ -859,13 +907,13 @@ function ScalioSaasUpdatesSection({
|
|
|
859
907
|
t,
|
|
860
908
|
admin = true
|
|
861
909
|
}) {
|
|
862
|
-
const client = (0,
|
|
863
|
-
const notify2 = (0,
|
|
910
|
+
const client = (0, import_react12.useMemo)(() => saasUpdatesApi(api), [api]);
|
|
911
|
+
const notify2 = (0, import_react12.useMemo)(
|
|
864
912
|
() => (msg, tone) => tone === "error" ? import_sonner8.toast.error(msg) : import_sonner8.toast.success(msg),
|
|
865
913
|
[]
|
|
866
914
|
);
|
|
867
|
-
const [prerelease, setPrerelease] = (0,
|
|
868
|
-
(0,
|
|
915
|
+
const [prerelease, setPrerelease] = (0, import_react12.useState)(false);
|
|
916
|
+
(0, import_react12.useEffect)(() => {
|
|
869
917
|
let alive = true;
|
|
870
918
|
client.state().then((d) => {
|
|
871
919
|
if (alive) setPrerelease(Boolean(d?.prerelease?.opt_in));
|
|
@@ -881,14 +929,14 @@ function ScalioSaasUpdatesSection({
|
|
|
881
929
|
setPrerelease(d?.prerelease ? Boolean(d.prerelease.opt_in) : Boolean(on));
|
|
882
930
|
};
|
|
883
931
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
884
|
-
|
|
932
|
+
SettingsSection,
|
|
885
933
|
{
|
|
886
934
|
id: "updates",
|
|
887
935
|
title: t("Updates"),
|
|
888
936
|
description: t("New versions from Scalio, your maintenance window and the deadline"),
|
|
889
937
|
testId: "saas-updates-card",
|
|
890
938
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
891
|
-
|
|
939
|
+
SaasUpdatesPanel,
|
|
892
940
|
{
|
|
893
941
|
client,
|
|
894
942
|
lang,
|
|
@@ -903,24 +951,173 @@ function ScalioSaasUpdatesSection({
|
|
|
903
951
|
}
|
|
904
952
|
|
|
905
953
|
// src/app-kit/ScalioSupportCard.tsx
|
|
906
|
-
var
|
|
907
|
-
var import_react23 = require("@scalio-cloud/ui/react");
|
|
954
|
+
var import_react13 = require("react");
|
|
908
955
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
909
956
|
function ScalioSupportCard({ api, lang, t }) {
|
|
910
|
-
const client = (0,
|
|
911
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
957
|
+
const client = (0, import_react13.useMemo)(() => supportApi(api), [api]);
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingsSection, { id: "support", title: t("Support connection"), testId: "support-connection-card", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SupportConnection, { client, lang }) });
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// src/app-kit/ScalioMailSettings.tsx
|
|
962
|
+
var import_react14 = require("react");
|
|
963
|
+
var import_sonner9 = require("sonner");
|
|
964
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
965
|
+
var defaultNotify3 = (text, tone) => {
|
|
966
|
+
if (tone === "error") import_sonner9.toast.error(text);
|
|
967
|
+
else import_sonner9.toast.success(text);
|
|
968
|
+
};
|
|
969
|
+
function ScalioMailSettings({
|
|
970
|
+
api,
|
|
971
|
+
lang,
|
|
972
|
+
formatApiErrorDetail
|
|
973
|
+
}) {
|
|
974
|
+
const client = (0, import_react14.useMemo)(() => mailApi(api), [api]);
|
|
975
|
+
const formatError = (e) => {
|
|
976
|
+
const err = e;
|
|
977
|
+
return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
|
|
978
|
+
};
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MailTransport, { client, lang, notify: defaultNotify3, formatError });
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// src/app-kit/ScalioLicensePanel.tsx
|
|
983
|
+
var import_react15 = require("react");
|
|
984
|
+
var import_sonner10 = require("sonner");
|
|
985
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
986
|
+
var defaultNotify4 = (text, tone) => {
|
|
987
|
+
if (tone === "error") import_sonner10.toast.error(text);
|
|
988
|
+
else import_sonner10.toast.success(text);
|
|
989
|
+
};
|
|
990
|
+
function ScalioLicensePanel({
|
|
991
|
+
api,
|
|
992
|
+
product,
|
|
993
|
+
lang,
|
|
994
|
+
kindLabel,
|
|
995
|
+
featureLabel,
|
|
996
|
+
confirm,
|
|
997
|
+
formatApiErrorDetail,
|
|
998
|
+
noFeatures
|
|
999
|
+
}) {
|
|
1000
|
+
const client = (0, import_react15.useMemo)(() => licenseApi(api), [api]);
|
|
1001
|
+
const formatError = (e) => {
|
|
1002
|
+
const err = e;
|
|
1003
|
+
return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
|
|
1004
|
+
};
|
|
1005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1006
|
+
LicensePanel,
|
|
1007
|
+
{
|
|
1008
|
+
client,
|
|
1009
|
+
lang,
|
|
1010
|
+
product,
|
|
1011
|
+
kindLabel,
|
|
1012
|
+
featureLabel,
|
|
1013
|
+
noFeatures,
|
|
1014
|
+
notify: defaultNotify4,
|
|
1015
|
+
confirm,
|
|
1016
|
+
formatError
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// src/app-kit/ScalioFactoryReset.tsx
|
|
1022
|
+
var import_react16 = require("react");
|
|
1023
|
+
var import_react_router_dom7 = require("react-router-dom");
|
|
1024
|
+
var import_sonner11 = require("sonner");
|
|
1025
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1026
|
+
var defaultNotify5 = (text, tone) => {
|
|
1027
|
+
if (tone === "error") import_sonner11.toast.error(text);
|
|
1028
|
+
else import_sonner11.toast.success(text);
|
|
1029
|
+
};
|
|
1030
|
+
function ScalioFactoryReset({
|
|
1031
|
+
api,
|
|
1032
|
+
lang,
|
|
1033
|
+
formatApiErrorDetail,
|
|
1034
|
+
accountTo = "/profile",
|
|
1035
|
+
backupTo = "/settings/backup"
|
|
1036
|
+
}) {
|
|
1037
|
+
const client = (0, import_react16.useMemo)(() => factoryResetApi(api), [api]);
|
|
1038
|
+
const formatError = (e) => {
|
|
1039
|
+
const err = e;
|
|
1040
|
+
return formatApiErrorDetail(err?.response?.data?.detail) || err?.message || "";
|
|
1041
|
+
};
|
|
1042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1043
|
+
FactoryReset,
|
|
1044
|
+
{
|
|
1045
|
+
client,
|
|
1046
|
+
lang,
|
|
1047
|
+
accountTo,
|
|
1048
|
+
backupTo,
|
|
1049
|
+
link: import_react_router_dom7.Link,
|
|
1050
|
+
notify: defaultNotify5,
|
|
1051
|
+
formatError
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// src/app-kit/ScalioRoleTenants.tsx
|
|
1057
|
+
var import_react17 = require("react");
|
|
1058
|
+
var import_sonner12 = require("sonner");
|
|
1059
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1060
|
+
var defaultNotify6 = (text, tone) => {
|
|
1061
|
+
if (tone === "error") import_sonner12.toast.error(text);
|
|
1062
|
+
else import_sonner12.toast.success(text);
|
|
1063
|
+
};
|
|
1064
|
+
function ScalioRoleTenants({
|
|
1065
|
+
api,
|
|
1066
|
+
apiBaseUrl,
|
|
1067
|
+
lang,
|
|
1068
|
+
t,
|
|
1069
|
+
confirm,
|
|
1070
|
+
formatApiErrorDetail,
|
|
1071
|
+
onChange
|
|
1072
|
+
}) {
|
|
1073
|
+
const [source, setSource] = (0, import_react17.useState)(null);
|
|
1074
|
+
const [ssoOn, setSsoOn] = (0, import_react17.useState)(false);
|
|
1075
|
+
const load = (0, import_react17.useCallback)(() => {
|
|
1076
|
+
api.get("/users/role-source").then((r) => setSource(r.data)).catch(() => setSource(null));
|
|
1077
|
+
api.get("/auth/scalio/status").then((r) => setSsoOn(Boolean(r.data?.enabled))).catch(() => setSsoOn(false));
|
|
1078
|
+
}, [api]);
|
|
1079
|
+
(0, import_react17.useEffect)(() => {
|
|
1080
|
+
load();
|
|
1081
|
+
}, [load]);
|
|
1082
|
+
if (!source) return null;
|
|
1083
|
+
const save = async ({ source: value, tenants }) => {
|
|
1084
|
+
await api.put("/users/role-source", { source: value, tenants });
|
|
1085
|
+
load();
|
|
1086
|
+
onChange?.();
|
|
1087
|
+
};
|
|
1088
|
+
const formatError = (e) => {
|
|
1089
|
+
const err = e;
|
|
1090
|
+
return err?.response?.data?.detail ? formatApiErrorDetail(err.response.data.detail) : t("The action failed.");
|
|
1091
|
+
};
|
|
1092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg-card border border-border rounded-sm px-4 py-3", "data-testid": "role-tenants", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1093
|
+
RoleSourceSettings,
|
|
1094
|
+
{
|
|
1095
|
+
lang,
|
|
1096
|
+
tenants: true,
|
|
1097
|
+
confirm,
|
|
1098
|
+
onSave: save,
|
|
1099
|
+
consentUrl: ssoOn ? `${apiBaseUrl}/auth/scalio/consent` : void 0,
|
|
1100
|
+
value: { source: source.source, values: source.values, tenants: source.tenants },
|
|
1101
|
+
notify: defaultNotify6,
|
|
1102
|
+
formatError
|
|
1103
|
+
}
|
|
1104
|
+
) });
|
|
912
1105
|
}
|
|
913
1106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
914
1107
|
0 && (module.exports = {
|
|
915
1108
|
ScalioAuditHeader,
|
|
916
1109
|
ScalioAuditPage,
|
|
917
1110
|
ScalioBackupSection,
|
|
1111
|
+
ScalioFactoryReset,
|
|
918
1112
|
ScalioInvitePage,
|
|
919
1113
|
ScalioJobsPage,
|
|
1114
|
+
ScalioLicensePanel,
|
|
920
1115
|
ScalioLoginPage,
|
|
1116
|
+
ScalioMailSettings,
|
|
921
1117
|
ScalioMaintenanceBanner,
|
|
922
1118
|
ScalioPasswordChangePage,
|
|
923
1119
|
ScalioProfilePage,
|
|
1120
|
+
ScalioRoleTenants,
|
|
924
1121
|
ScalioSaasUpdateBanner,
|
|
925
1122
|
ScalioSaasUpdatesSection,
|
|
926
1123
|
ScalioSecurityFactors,
|