@scalio-cloud/ui 0.111.2-dev.139 → 0.112.0-dev.141
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/ScalioAgentSettings.d.ts +40 -0
- package/dist/app-kit/ScalioAgentSettings.d.ts.map +1 -0
- package/dist/app-kit/ScalioAiSettings.d.ts +45 -0
- package/dist/app-kit/ScalioAiSettings.d.ts.map +1 -0
- package/dist/app-kit/ScalioGovernanceCatalog.d.ts +53 -0
- package/dist/app-kit/ScalioGovernanceCatalog.d.ts.map +1 -0
- package/dist/app-kit/ScalioKpiGrid.d.ts +24 -0
- package/dist/app-kit/ScalioKpiGrid.d.ts.map +1 -0
- package/dist/app-kit/ScalioPeerCard.d.ts +49 -0
- package/dist/app-kit/ScalioPeerCard.d.ts.map +1 -0
- package/dist/app-kit/ScalioSetupWizard.d.ts +61 -0
- package/dist/app-kit/ScalioSetupWizard.d.ts.map +1 -0
- package/dist/app-kit/ScalioTenancy.d.ts +78 -0
- package/dist/app-kit/ScalioTenancy.d.ts.map +1 -0
- package/dist/app-kit/_uiReact.d.ts +78 -4
- package/dist/app-kit/_uiReact.d.ts.map +1 -1
- package/dist/app-kit/index.d.ts +7 -0
- package/dist/app-kit/index.d.ts.map +1 -1
- package/dist/app-kit/index.js +930 -2
- package/dist/app-kit/index.js.map +1 -1
- package/dist/app-kit/index.mjs +896 -2
- package/dist/app-kit/index.mjs.map +1 -1
- package/dist/{chunk-WBI44QWN.mjs → chunk-GRPGQLP5.mjs} +28 -2
- package/dist/chunk-GRPGQLP5.mjs.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +27 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +3 -1
- package/dist/core/tenantConnect.d.ts +31 -0
- package/dist/core/tenantConnect.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-WBI44QWN.mjs.map +0 -1
package/dist/app-kit/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/app-kit/index.ts
|
|
31
31
|
var app_kit_exports = {};
|
|
32
32
|
__export(app_kit_exports, {
|
|
33
|
+
ScalioAgentSettings: () => ScalioAgentSettings,
|
|
34
|
+
ScalioAiSettings: () => ScalioAiSettings,
|
|
33
35
|
ScalioAppProviders: () => ScalioAppProviders,
|
|
34
36
|
ScalioAuditHeader: () => ScalioAuditHeader,
|
|
35
37
|
ScalioAuditPage: () => ScalioAuditPage,
|
|
@@ -44,16 +46,20 @@ __export(app_kit_exports, {
|
|
|
44
46
|
ScalioFormDialog: () => ScalioFormDialog,
|
|
45
47
|
ScalioFormError: () => ScalioFormError,
|
|
46
48
|
ScalioFormField: () => ScalioFormField,
|
|
49
|
+
ScalioGovernanceCatalog: () => ScalioGovernanceCatalog,
|
|
47
50
|
ScalioInvitePage: () => ScalioInvitePage,
|
|
48
51
|
ScalioJobsPage: () => ScalioJobsPage,
|
|
52
|
+
ScalioKpiGrid: () => ScalioKpiGrid,
|
|
49
53
|
ScalioLayout: () => ScalioLayout,
|
|
50
54
|
ScalioLicensePanel: () => ScalioLicensePanel,
|
|
51
55
|
ScalioLoginPage: () => ScalioLoginPage,
|
|
56
|
+
ScalioM365Connection: () => ScalioM365Connection,
|
|
52
57
|
ScalioMailSettings: () => ScalioMailSettings,
|
|
53
58
|
ScalioMaintenanceBanner: () => ScalioMaintenanceBanner,
|
|
54
59
|
ScalioMoneyInput: () => ScalioMoneyInput,
|
|
55
60
|
ScalioOfflineBanner: () => ScalioOfflineBanner,
|
|
56
61
|
ScalioPasswordChangePage: () => ScalioPasswordChangePage,
|
|
62
|
+
ScalioPeerCard: () => ScalioPeerCard,
|
|
57
63
|
ScalioProfilePage: () => ScalioProfilePage,
|
|
58
64
|
ScalioResultBadge: () => ScalioResultBadge,
|
|
59
65
|
ScalioRoleTenants: () => ScalioRoleTenants,
|
|
@@ -61,14 +67,18 @@ __export(app_kit_exports, {
|
|
|
61
67
|
ScalioSaasUpdatesSection: () => ScalioSaasUpdatesSection,
|
|
62
68
|
ScalioSecurityFactors: () => ScalioSecurityFactors,
|
|
63
69
|
ScalioSelfTestPage: () => ScalioSelfTestPage,
|
|
70
|
+
ScalioSetupWizard: () => ScalioSetupWizard,
|
|
64
71
|
ScalioSkeleton: () => ScalioSkeleton,
|
|
65
72
|
ScalioSupportCard: () => ScalioSupportCard,
|
|
66
73
|
ScalioTagInput: () => ScalioTagInput,
|
|
74
|
+
ScalioTenancyPanel: () => ScalioTenancyPanel,
|
|
67
75
|
ScalioTenantSettings: () => ScalioTenantSettings,
|
|
76
|
+
ScalioTenantSharePage: () => ScalioTenantSharePage,
|
|
68
77
|
ScalioUsersPage: () => ScalioUsersPage,
|
|
69
78
|
formatDisplayValue: () => formatDisplayValue,
|
|
70
79
|
formatMinorToEditable: () => formatMinorToEditable,
|
|
71
|
-
parseEditableToMinor: () => parseEditableToMinor
|
|
80
|
+
parseEditableToMinor: () => parseEditableToMinor,
|
|
81
|
+
useCustomerOrgs: () => useCustomerOrgs
|
|
72
82
|
});
|
|
73
83
|
module.exports = __toCommonJS(app_kit_exports);
|
|
74
84
|
|
|
@@ -79,6 +89,8 @@ var import_sonner = require("sonner");
|
|
|
79
89
|
// src/app-kit/_uiReact.ts
|
|
80
90
|
var import_react = __toESM(require("@scalio-cloud/ui/react"));
|
|
81
91
|
var {
|
|
92
|
+
AgentsPanel,
|
|
93
|
+
AiSettingsPanel,
|
|
82
94
|
AppHeader,
|
|
83
95
|
AppShell,
|
|
84
96
|
AuditLog,
|
|
@@ -89,12 +101,14 @@ var {
|
|
|
89
101
|
BackupPanel,
|
|
90
102
|
FactoryReset,
|
|
91
103
|
JobsPanel,
|
|
104
|
+
KpiTile,
|
|
92
105
|
LanguageChoice,
|
|
93
106
|
LicensePanel,
|
|
94
107
|
LoginPage,
|
|
95
108
|
MailTransport,
|
|
96
109
|
MaintenanceNotice,
|
|
97
110
|
MicrosoftConnection,
|
|
111
|
+
OrganizationsPanel,
|
|
98
112
|
PageHeader,
|
|
99
113
|
PasswordChange,
|
|
100
114
|
PasswordPolicySelect,
|
|
@@ -108,10 +122,15 @@ var {
|
|
|
108
122
|
SelfTestPanel,
|
|
109
123
|
SettingsLayout,
|
|
110
124
|
SettingsSection,
|
|
125
|
+
SetupWizard,
|
|
111
126
|
Sidebar,
|
|
127
|
+
StatusBadge,
|
|
112
128
|
SupportConnection,
|
|
113
129
|
SupportDrawer,
|
|
114
130
|
TenantConnectStep,
|
|
131
|
+
TenantEditDialog,
|
|
132
|
+
TenantList,
|
|
133
|
+
TenantWizard,
|
|
115
134
|
ThemeChoice,
|
|
116
135
|
ThemeProvider,
|
|
117
136
|
TimezoneChoice,
|
|
@@ -119,6 +138,8 @@ var {
|
|
|
119
138
|
UserAdmin,
|
|
120
139
|
accountArea,
|
|
121
140
|
accountGroups,
|
|
141
|
+
agentsApi,
|
|
142
|
+
aiApi,
|
|
122
143
|
announceTenantChange,
|
|
123
144
|
auditApi,
|
|
124
145
|
backupApi,
|
|
@@ -128,11 +149,16 @@ var {
|
|
|
128
149
|
labelsFor,
|
|
129
150
|
licenseApi,
|
|
130
151
|
mailApi,
|
|
152
|
+
organizationSetupStep,
|
|
153
|
+
organizationsApi,
|
|
154
|
+
peersApi,
|
|
131
155
|
rolesApi,
|
|
132
156
|
saasUpdatesApi,
|
|
133
157
|
securityApi,
|
|
134
158
|
selftestApi,
|
|
159
|
+
setupWizardApi,
|
|
135
160
|
supportApi,
|
|
161
|
+
useSetupWizard,
|
|
136
162
|
usersApi
|
|
137
163
|
} = import_react.default;
|
|
138
164
|
|
|
@@ -267,6 +293,31 @@ function mailReady(settings) {
|
|
|
267
293
|
// src/core/legal.ts
|
|
268
294
|
var import_react4 = require("react");
|
|
269
295
|
|
|
296
|
+
// src/core/tenantConnect.ts
|
|
297
|
+
function createTenantConnectClient(api, options = {}) {
|
|
298
|
+
const { slot = "read", defaultTenantPath = "/tenants/default" } = options;
|
|
299
|
+
let id = options.tenantId ?? null;
|
|
300
|
+
const basePath = async () => {
|
|
301
|
+
if (!id) {
|
|
302
|
+
const res = await api.post(defaultTenantPath);
|
|
303
|
+
id = res.data.id;
|
|
304
|
+
}
|
|
305
|
+
return `/tenants/${encodeURIComponent(id)}/connection/${encodeURIComponent(slot)}`;
|
|
306
|
+
};
|
|
307
|
+
const call = async (method, suffix, body) => {
|
|
308
|
+
const url = `${await basePath()}${suffix}`;
|
|
309
|
+
const res = method === "get" ? await api.get(url) : await api.post(url, body);
|
|
310
|
+
return res.data;
|
|
311
|
+
};
|
|
312
|
+
return {
|
|
313
|
+
status: () => call("get", ""),
|
|
314
|
+
link: () => call("post", "/link"),
|
|
315
|
+
script: () => call("post", "/script"),
|
|
316
|
+
redeem: (code) => call("post", "/code", { code: code.trim() }),
|
|
317
|
+
check: () => call("post", "/check")
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
270
321
|
// src/app-kit/ScalioProfilePage.tsx
|
|
271
322
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
272
323
|
var FIELD_CLASS = "mt-1 w-full h-10 px-3 bg-background border border-input rounded-sm text-sm focus:outline-none focus:ring-1 focus:ring-ring focus:border-ring transition-colors";
|
|
@@ -2245,8 +2296,877 @@ function ScalioLayout({
|
|
|
2245
2296
|
}
|
|
2246
2297
|
);
|
|
2247
2298
|
}
|
|
2299
|
+
|
|
2300
|
+
// src/app-kit/ScalioAiSettings.tsx
|
|
2301
|
+
var import_react25 = require("react");
|
|
2302
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2303
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2304
|
+
function defaultFormatError(error) {
|
|
2305
|
+
const err = error;
|
|
2306
|
+
const detail = err?.response?.data?.detail;
|
|
2307
|
+
if (typeof detail === "string" && detail) return detail;
|
|
2308
|
+
return err?.message || "Request failed";
|
|
2309
|
+
}
|
|
2310
|
+
function ScalioAiSettings({
|
|
2311
|
+
api,
|
|
2312
|
+
lang = "en",
|
|
2313
|
+
endpoint = "/ai/settings",
|
|
2314
|
+
canReset = true,
|
|
2315
|
+
formatError = defaultFormatError,
|
|
2316
|
+
onNotify,
|
|
2317
|
+
onAfterSave
|
|
2318
|
+
}) {
|
|
2319
|
+
const [page, setPage] = (0, import_react25.useState)(null);
|
|
2320
|
+
const client = (0, import_react25.useMemo)(() => aiApi(api), [api]);
|
|
2321
|
+
(0, import_react25.useEffect)(() => {
|
|
2322
|
+
let active = true;
|
|
2323
|
+
api.get(endpoint).then((res) => {
|
|
2324
|
+
if (active) setPage(res.data);
|
|
2325
|
+
}).catch((error) => {
|
|
2326
|
+
if (active) onNotify?.(formatError(error), "error");
|
|
2327
|
+
});
|
|
2328
|
+
return () => {
|
|
2329
|
+
active = false;
|
|
2330
|
+
};
|
|
2331
|
+
}, [api, endpoint, formatError, onNotify]);
|
|
2332
|
+
if (!page) {
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center justify-center py-8", "data-testid": "scalio-ai-settings-loading", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.Loader2, { className: "w-5 h-5 animate-spin text-primary", "aria-label": "Loading" }) });
|
|
2334
|
+
}
|
|
2335
|
+
const features = (page.features || []).map((feature) => ({
|
|
2336
|
+
key: feature.key,
|
|
2337
|
+
max: feature.max,
|
|
2338
|
+
label: lang === "en" ? feature.label_en || feature.label : feature.label
|
|
2339
|
+
}));
|
|
2340
|
+
const handleSave = async (patch) => {
|
|
2341
|
+
const res = await api.put(endpoint, patch);
|
|
2342
|
+
setPage((prev) => prev ? { ...prev, ai: res.data } : prev);
|
|
2343
|
+
onAfterSave?.(res.data);
|
|
2344
|
+
};
|
|
2345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2346
|
+
AiSettingsPanel,
|
|
2347
|
+
{
|
|
2348
|
+
value: page.ai,
|
|
2349
|
+
status: { licensed: page.licensed, scalio: page.scalio },
|
|
2350
|
+
client,
|
|
2351
|
+
canReset,
|
|
2352
|
+
features,
|
|
2353
|
+
lang,
|
|
2354
|
+
onSave: handleSave,
|
|
2355
|
+
formatError,
|
|
2356
|
+
notify: (message, tone) => onNotify?.(message, tone)
|
|
2357
|
+
}
|
|
2358
|
+
);
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
// src/app-kit/ScalioSetupWizard.tsx
|
|
2362
|
+
var import_react26 = require("react");
|
|
2363
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2364
|
+
function ScalioSetupWizard({
|
|
2365
|
+
api,
|
|
2366
|
+
enabled,
|
|
2367
|
+
lang = "en",
|
|
2368
|
+
title,
|
|
2369
|
+
subtitle,
|
|
2370
|
+
success,
|
|
2371
|
+
steps,
|
|
2372
|
+
includeOrganizationStep = true,
|
|
2373
|
+
licenseStep = null,
|
|
2374
|
+
wide = true,
|
|
2375
|
+
onCompleted
|
|
2376
|
+
}) {
|
|
2377
|
+
const client = (0, import_react26.useMemo)(() => setupWizardApi(api), [api]);
|
|
2378
|
+
const wizard = useSetupWizard({ client, enabled, onCompleted });
|
|
2379
|
+
const [unlicensed, setUnlicensed] = (0, import_react26.useState)(false);
|
|
2380
|
+
const [org, setOrg] = (0, import_react26.useState)(null);
|
|
2381
|
+
const open = enabled && Boolean(wizard.open);
|
|
2382
|
+
(0, import_react26.useEffect)(() => {
|
|
2383
|
+
if (!open || !licenseStep) return;
|
|
2384
|
+
let active = true;
|
|
2385
|
+
api.get("/license/summary").then((res) => {
|
|
2386
|
+
if (active) setUnlicensed(res.data?.edition === "community");
|
|
2387
|
+
}).catch(() => {
|
|
2388
|
+
if (active) setUnlicensed(false);
|
|
2389
|
+
});
|
|
2390
|
+
return () => {
|
|
2391
|
+
active = false;
|
|
2392
|
+
};
|
|
2393
|
+
}, [api, licenseStep, open]);
|
|
2394
|
+
(0, import_react26.useEffect)(() => {
|
|
2395
|
+
if (!open || !includeOrganizationStep) return;
|
|
2396
|
+
let active = true;
|
|
2397
|
+
api.get("/organizations/suggestion").then((res) => {
|
|
2398
|
+
if (active) setOrg(res.data);
|
|
2399
|
+
}).catch(() => {
|
|
2400
|
+
if (active) setOrg(null);
|
|
2401
|
+
});
|
|
2402
|
+
return () => {
|
|
2403
|
+
active = false;
|
|
2404
|
+
};
|
|
2405
|
+
}, [api, includeOrganizationStep, open]);
|
|
2406
|
+
if (!enabled) return null;
|
|
2407
|
+
const allSteps = [];
|
|
2408
|
+
if (includeOrganizationStep && org) {
|
|
2409
|
+
allSteps.push(
|
|
2410
|
+
organizationSetupStep({
|
|
2411
|
+
value: org,
|
|
2412
|
+
onChange: setOrg,
|
|
2413
|
+
prefilled: org.prefilled,
|
|
2414
|
+
lang,
|
|
2415
|
+
onSave: async () => {
|
|
2416
|
+
if (org.source === "compass") return;
|
|
2417
|
+
const { name, short_code, classification, language } = org;
|
|
2418
|
+
const res = await api.patch(`/organizations/${encodeURIComponent(org.id)}`, {
|
|
2419
|
+
name,
|
|
2420
|
+
short_code,
|
|
2421
|
+
classification,
|
|
2422
|
+
language
|
|
2423
|
+
});
|
|
2424
|
+
setOrg({ ...res.data, prefilled: org.prefilled });
|
|
2425
|
+
}
|
|
2426
|
+
})
|
|
2427
|
+
);
|
|
2428
|
+
}
|
|
2429
|
+
for (const step of steps) {
|
|
2430
|
+
allSteps.push(step);
|
|
2431
|
+
}
|
|
2432
|
+
if (licenseStep && unlicensed) {
|
|
2433
|
+
allSteps.push({
|
|
2434
|
+
id: "license",
|
|
2435
|
+
optional: true,
|
|
2436
|
+
...licenseStep
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2440
|
+
SetupWizard,
|
|
2441
|
+
{
|
|
2442
|
+
...wizard.props,
|
|
2443
|
+
wide,
|
|
2444
|
+
lang,
|
|
2445
|
+
title,
|
|
2446
|
+
subtitle,
|
|
2447
|
+
steps: allSteps,
|
|
2448
|
+
success
|
|
2449
|
+
}
|
|
2450
|
+
);
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// src/app-kit/ScalioAgentSettings.tsx
|
|
2454
|
+
var import_react27 = require("react");
|
|
2455
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2456
|
+
function defaultMsiLabel(info, lang) {
|
|
2457
|
+
const version = info.build || info.version || "\u2013";
|
|
2458
|
+
const sha = info.sha256 || "\u2013";
|
|
2459
|
+
return lang === "de" ? `MSI-Version ${version}, SHA-256 ${sha}` : `MSI version ${version}, SHA-256 ${sha}`;
|
|
2460
|
+
}
|
|
2461
|
+
function ScalioAgentSettings({
|
|
2462
|
+
api,
|
|
2463
|
+
apiBase,
|
|
2464
|
+
lang = "en",
|
|
2465
|
+
formatError,
|
|
2466
|
+
onNotify,
|
|
2467
|
+
onCopy,
|
|
2468
|
+
formatMsiLabel,
|
|
2469
|
+
children
|
|
2470
|
+
}) {
|
|
2471
|
+
const client = (0, import_react27.useMemo)(() => agentsApi(api), [api]);
|
|
2472
|
+
const [msi, setMsi] = (0, import_react27.useState)(null);
|
|
2473
|
+
(0, import_react27.useEffect)(() => {
|
|
2474
|
+
let active = true;
|
|
2475
|
+
api.get("/agent/msi/info").then((res) => {
|
|
2476
|
+
if (active) setMsi(res.data);
|
|
2477
|
+
}).catch(() => {
|
|
2478
|
+
if (active) setMsi(null);
|
|
2479
|
+
});
|
|
2480
|
+
return () => {
|
|
2481
|
+
active = false;
|
|
2482
|
+
};
|
|
2483
|
+
}, [api]);
|
|
2484
|
+
const copyText = onCopy ?? ((text) => {
|
|
2485
|
+
void navigator.clipboard?.writeText(text);
|
|
2486
|
+
});
|
|
2487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-4 min-w-0", "data-testid": "agent-settings", children: [
|
|
2488
|
+
msi?.available && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-xs text-muted-foreground break-all", "data-testid": "agent-msi-version", children: formatMsiLabel ? formatMsiLabel(msi) : defaultMsiLabel(msi, lang) }),
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2490
|
+
AgentsPanel,
|
|
2491
|
+
{
|
|
2492
|
+
client,
|
|
2493
|
+
lang,
|
|
2494
|
+
formatError,
|
|
2495
|
+
downloadUrl: msi?.available ? `${apiBase}/agent/msi` : void 0,
|
|
2496
|
+
notify: (text, kind) => onNotify?.(text, kind),
|
|
2497
|
+
copy: copyText
|
|
2498
|
+
}
|
|
2499
|
+
),
|
|
2500
|
+
children
|
|
2501
|
+
] });
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
// src/app-kit/ScalioKpiGrid.tsx
|
|
2505
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2506
|
+
var COLUMN_CLASSES = {
|
|
2507
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
2508
|
+
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
2509
|
+
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
|
|
2510
|
+
5: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5"
|
|
2511
|
+
};
|
|
2512
|
+
function ScalioKpiGrid({
|
|
2513
|
+
items,
|
|
2514
|
+
columns = 4,
|
|
2515
|
+
className = "",
|
|
2516
|
+
testId = "scalio-kpi-grid"
|
|
2517
|
+
}) {
|
|
2518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2519
|
+
"div",
|
|
2520
|
+
{
|
|
2521
|
+
className: `grid gap-3 min-w-0 ${COLUMN_CLASSES[columns]} ${className}`.trim(),
|
|
2522
|
+
"data-testid": testId,
|
|
2523
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2524
|
+
KpiTile,
|
|
2525
|
+
{
|
|
2526
|
+
label: item.label,
|
|
2527
|
+
value: item.value,
|
|
2528
|
+
hint: item.hint,
|
|
2529
|
+
tone: item.tone,
|
|
2530
|
+
onClick: item.onClick,
|
|
2531
|
+
testId: item.testId
|
|
2532
|
+
}
|
|
2533
|
+
) }, item.id ?? `${item.label}-${index}`))
|
|
2534
|
+
}
|
|
2535
|
+
);
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
// src/app-kit/ScalioPeerCard.tsx
|
|
2539
|
+
var import_react28 = require("react");
|
|
2540
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2541
|
+
var DEFAULT_APPS = {
|
|
2542
|
+
atrium: "Scalio Atrium",
|
|
2543
|
+
beacon: "Scalio Beacon",
|
|
2544
|
+
citadel: "Scalio Citadel",
|
|
2545
|
+
folio: "Scalio Folio",
|
|
2546
|
+
foundry: "Scalio Foundry",
|
|
2547
|
+
nexus: "Scalio Nexus",
|
|
2548
|
+
pulse: "Scalio Pulse",
|
|
2549
|
+
rosetta: "Scalio Rosetta"
|
|
2550
|
+
};
|
|
2551
|
+
var LABELS3 = {
|
|
2552
|
+
en: {
|
|
2553
|
+
title: "Connected apps",
|
|
2554
|
+
empty: "No app paired yet.",
|
|
2555
|
+
removedByPeer: "Removed by the other app",
|
|
2556
|
+
pairAgain: "Pair again",
|
|
2557
|
+
lastSeen: (d) => `Last seen ${d}`,
|
|
2558
|
+
test: "Test",
|
|
2559
|
+
remove: "Remove",
|
|
2560
|
+
urlPlaceholder: "App address (https://\u2026)",
|
|
2561
|
+
codePlaceholder: "One-time code",
|
|
2562
|
+
pair: "Pair",
|
|
2563
|
+
pairedWith: (app) => `Paired with ${app}`,
|
|
2564
|
+
connectionWorks: (app, ver) => `Connection works (${app}${ver ? ` ${ver}` : ""})`,
|
|
2565
|
+
noConnection: "No connection",
|
|
2566
|
+
confirmTitle: (app) => `Remove the pairing with ${app}?`,
|
|
2567
|
+
confirmText: (own) => `${own} then refuses every call of this app. Pair again with a new code.`,
|
|
2568
|
+
removedWarn: "Pairing removed. The other app could not be told: remove the pairing there as well.",
|
|
2569
|
+
removedOk: "Pairing removed",
|
|
2570
|
+
ownUrl: (own, url) => `Address of this ${own} for the other app: ${url}`
|
|
2571
|
+
},
|
|
2572
|
+
de: {
|
|
2573
|
+
title: "Verbundene Apps",
|
|
2574
|
+
empty: "Noch keine App gekoppelt.",
|
|
2575
|
+
removedByPeer: "Von der anderen App entfernt",
|
|
2576
|
+
pairAgain: "Neu koppeln",
|
|
2577
|
+
lastSeen: (d) => `Zuletzt gesehen ${d}`,
|
|
2578
|
+
test: "Pr\xFCfen",
|
|
2579
|
+
remove: "Entfernen",
|
|
2580
|
+
urlPlaceholder: "Adresse der App (https://\u2026)",
|
|
2581
|
+
codePlaceholder: "Einmalcode",
|
|
2582
|
+
pair: "Koppeln",
|
|
2583
|
+
pairedWith: (app) => `Mit ${app} gekoppelt`,
|
|
2584
|
+
connectionWorks: (app, ver) => `Verbindung funktioniert (${app}${ver ? ` ${ver}` : ""})`,
|
|
2585
|
+
noConnection: "Keine Verbindung",
|
|
2586
|
+
confirmTitle: (app) => `Kopplung mit ${app} entfernen?`,
|
|
2587
|
+
confirmText: (own) => `${own} lehnt danach alle Aufrufe dieser App ab. Zum erneuten Koppeln einen neuen Code verwenden.`,
|
|
2588
|
+
removedWarn: "Kopplung entfernt. Die andere App konnte nicht benachrichtigt werden: Kopplung dort ebenfalls entfernen.",
|
|
2589
|
+
removedOk: "Kopplung entfernt",
|
|
2590
|
+
ownUrl: (own, url) => `Adresse dieser ${own}-Instanz f\xFCr die andere App: ${url}`
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
var btnClass = "inline-flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-sm text-xs font-bold uppercase tracking-wider border border-border bg-card disabled:opacity-50";
|
|
2594
|
+
var inputClass = "w-full min-w-0 bg-background border border-border rounded-sm px-2.5 py-1.5 text-sm";
|
|
2595
|
+
function defaultFormatError2(error) {
|
|
2596
|
+
const err = error;
|
|
2597
|
+
const detail = err?.response?.data?.detail;
|
|
2598
|
+
return typeof detail === "string" && detail ? detail : err?.message || "Request failed";
|
|
2599
|
+
}
|
|
2600
|
+
function ScalioPeerCard({
|
|
2601
|
+
api,
|
|
2602
|
+
lang = "en",
|
|
2603
|
+
sectionId = "connected-apps",
|
|
2604
|
+
title,
|
|
2605
|
+
description,
|
|
2606
|
+
ownAppName = "Scalio",
|
|
2607
|
+
urlPlaceholder,
|
|
2608
|
+
appNames,
|
|
2609
|
+
formatDateTime = (v) => v,
|
|
2610
|
+
formatError = defaultFormatError2,
|
|
2611
|
+
onConfirm,
|
|
2612
|
+
onNotify,
|
|
2613
|
+
testId = "connected-apps"
|
|
2614
|
+
}) {
|
|
2615
|
+
const L = LABELS3[lang];
|
|
2616
|
+
const names = { ...DEFAULT_APPS, ...appNames };
|
|
2617
|
+
const [data, setData] = (0, import_react28.useState)(null);
|
|
2618
|
+
const [url, setUrl] = (0, import_react28.useState)("");
|
|
2619
|
+
const [code, setCode] = (0, import_react28.useState)("");
|
|
2620
|
+
const [busy, setBusy] = (0, import_react28.useState)(false);
|
|
2621
|
+
const load = (0, import_react28.useCallback)(() => {
|
|
2622
|
+
api.get("/peers").then((res) => setData(res.data)).catch(() => setData({ peers: [] }));
|
|
2623
|
+
}, [api]);
|
|
2624
|
+
(0, import_react28.useEffect)(() => {
|
|
2625
|
+
load();
|
|
2626
|
+
}, [load]);
|
|
2627
|
+
const labelOf = (app) => names[app] || app;
|
|
2628
|
+
const handlePair = async () => {
|
|
2629
|
+
setBusy(true);
|
|
2630
|
+
try {
|
|
2631
|
+
const res = await api.post("/peers", { url: url.trim(), code: code.trim() });
|
|
2632
|
+
onNotify?.(L.pairedWith(labelOf(res.data.app)), "success");
|
|
2633
|
+
setUrl("");
|
|
2634
|
+
setCode("");
|
|
2635
|
+
} catch (error) {
|
|
2636
|
+
onNotify?.(formatError(error), "error");
|
|
2637
|
+
} finally {
|
|
2638
|
+
setBusy(false);
|
|
2639
|
+
load();
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
const handleCheck = async (peer) => {
|
|
2643
|
+
try {
|
|
2644
|
+
const res = await api.post(`/peers/${encodeURIComponent(peer.id)}/check`);
|
|
2645
|
+
if (res.data.ok) {
|
|
2646
|
+
onNotify?.(L.connectionWorks(labelOf(res.data.app || peer.app), res.data.version || ""), "success");
|
|
2647
|
+
} else {
|
|
2648
|
+
onNotify?.(res.data.message?.[lang] || res.data.message?.en || res.data.detail || L.noConnection, "error");
|
|
2649
|
+
}
|
|
2650
|
+
} catch (error) {
|
|
2651
|
+
onNotify?.(formatError(error), "error");
|
|
2652
|
+
}
|
|
2653
|
+
load();
|
|
2654
|
+
};
|
|
2655
|
+
const handleRemove = async (peer) => {
|
|
2656
|
+
if (onConfirm) {
|
|
2657
|
+
const ok = await onConfirm({
|
|
2658
|
+
title: L.confirmTitle(labelOf(peer.app)),
|
|
2659
|
+
text: L.confirmText(ownAppName),
|
|
2660
|
+
action: L.remove
|
|
2661
|
+
});
|
|
2662
|
+
if (!ok) return;
|
|
2663
|
+
}
|
|
2664
|
+
try {
|
|
2665
|
+
const res = await api.delete(`/peers/${encodeURIComponent(peer.id)}`);
|
|
2666
|
+
if (res.data?.notified === false && peer.status !== "removed_by_peer") {
|
|
2667
|
+
onNotify?.(L.removedWarn, "warning");
|
|
2668
|
+
} else {
|
|
2669
|
+
onNotify?.(L.removedOk, "success");
|
|
2670
|
+
}
|
|
2671
|
+
} catch (error) {
|
|
2672
|
+
onNotify?.(formatError(error), "error");
|
|
2673
|
+
}
|
|
2674
|
+
load();
|
|
2675
|
+
};
|
|
2676
|
+
const peers = data?.peers || [];
|
|
2677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SettingsSection, { id: sectionId, title: title ?? L.title, description, testId, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-2 min-w-0", children: [
|
|
2678
|
+
data && peers.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm text-muted-foreground", children: L.empty }),
|
|
2679
|
+
peers.map((peer) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2680
|
+
"div",
|
|
2681
|
+
{
|
|
2682
|
+
className: "flex flex-wrap items-center gap-2 text-xs border-t border-border pt-2 min-w-0",
|
|
2683
|
+
"data-testid": `peer-${peer.id}`,
|
|
2684
|
+
children: [
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-medium", children: labelOf(peer.app) }),
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground break-all", children: peer.url }),
|
|
2687
|
+
peer.status === "removed_by_peer" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StatusBadge, { tone: "error", children: L.removedByPeer }) : peer.usable === false && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StatusBadge, { tone: "error", children: L.pairAgain }),
|
|
2688
|
+
peer.last_seen && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: L.lastSeen(formatDateTime(peer.last_seen)) }),
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "flex-1" }),
|
|
2690
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2691
|
+
"button",
|
|
2692
|
+
{
|
|
2693
|
+
type: "button",
|
|
2694
|
+
className: btnClass,
|
|
2695
|
+
onClick: () => void handleCheck(peer),
|
|
2696
|
+
"data-testid": `peer-check-${peer.id}`,
|
|
2697
|
+
children: L.test
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2701
|
+
"button",
|
|
2702
|
+
{
|
|
2703
|
+
type: "button",
|
|
2704
|
+
className: btnClass,
|
|
2705
|
+
onClick: () => void handleRemove(peer),
|
|
2706
|
+
"data-testid": `peer-remove-${peer.id}`,
|
|
2707
|
+
children: L.remove
|
|
2708
|
+
}
|
|
2709
|
+
)
|
|
2710
|
+
]
|
|
2711
|
+
},
|
|
2712
|
+
peer.id
|
|
2713
|
+
)),
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grid gap-2 sm:grid-cols-[2fr_1fr_auto] border-t border-border pt-3", children: [
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2716
|
+
"input",
|
|
2717
|
+
{
|
|
2718
|
+
className: inputClass,
|
|
2719
|
+
value: url,
|
|
2720
|
+
maxLength: 300,
|
|
2721
|
+
placeholder: urlPlaceholder ?? L.urlPlaceholder,
|
|
2722
|
+
onChange: (e) => setUrl(e.target.value),
|
|
2723
|
+
"data-testid": "peer-url"
|
|
2724
|
+
}
|
|
2725
|
+
),
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2727
|
+
"input",
|
|
2728
|
+
{
|
|
2729
|
+
className: inputClass,
|
|
2730
|
+
value: code,
|
|
2731
|
+
maxLength: 100,
|
|
2732
|
+
placeholder: L.codePlaceholder,
|
|
2733
|
+
onChange: (e) => setCode(e.target.value),
|
|
2734
|
+
"data-testid": "peer-code"
|
|
2735
|
+
}
|
|
2736
|
+
),
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2738
|
+
"button",
|
|
2739
|
+
{
|
|
2740
|
+
type: "button",
|
|
2741
|
+
className: btnClass,
|
|
2742
|
+
disabled: busy || !url.trim().startsWith("https://") || code.trim().length < 8,
|
|
2743
|
+
onClick: () => void handlePair(),
|
|
2744
|
+
"data-testid": "peer-pair",
|
|
2745
|
+
children: L.pair
|
|
2746
|
+
}
|
|
2747
|
+
)
|
|
2748
|
+
] }),
|
|
2749
|
+
data?.own_url && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-xs text-muted-foreground break-all", children: L.ownUrl(ownAppName, data.own_url) })
|
|
2750
|
+
] }) });
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
// src/app-kit/ScalioGovernanceCatalog.tsx
|
|
2754
|
+
var import_react29 = require("react");
|
|
2755
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2756
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2757
|
+
var CHANNELS = {
|
|
2758
|
+
en: [
|
|
2759
|
+
{ key: "dev", label: "Dev (newest dev build)" },
|
|
2760
|
+
{ key: "test", label: "Test (release candidates)" },
|
|
2761
|
+
{ key: "prod", label: "Prod (final releases only)" }
|
|
2762
|
+
],
|
|
2763
|
+
de: [
|
|
2764
|
+
{ key: "dev", label: "Dev (neuester Dev-Build)" },
|
|
2765
|
+
{ key: "test", label: "Test (Release Candidates)" },
|
|
2766
|
+
{ key: "prod", label: "Prod (nur finale Releases)" }
|
|
2767
|
+
]
|
|
2768
|
+
};
|
|
2769
|
+
var STATES = {
|
|
2770
|
+
en: {
|
|
2771
|
+
ok: "Source works: the pack of this stage is fetched.",
|
|
2772
|
+
token_unreadable: "The stored token can no longer be read (the instance secret changed). Enter the token again.",
|
|
2773
|
+
not_found_no_token: "GitHub answers 404: the repository is private and no token is stored. Enter a fine-grained token with Contents: read on this repository.",
|
|
2774
|
+
not_found: "GitHub answers 404: the repository does not exist or the token has no access to it. Check the repository name and the token's repository access.",
|
|
2775
|
+
token_invalid: "GitHub rejects the token (HTTP 401): expired or revoked. Enter a new token.",
|
|
2776
|
+
forbidden: "GitHub refuses the request (HTTP 403): missing permission or rate limit.",
|
|
2777
|
+
error: "The last fetch failed, see the message below."
|
|
2778
|
+
},
|
|
2779
|
+
de: {
|
|
2780
|
+
ok: "Quelle funktioniert: Das Paket dieser Stage wird abgerufen.",
|
|
2781
|
+
token_unreadable: "Das gespeicherte Token kann nicht mehr gelesen werden (Instanz-Secret ge\xE4ndert). Bitte Token erneut eingeben.",
|
|
2782
|
+
not_found_no_token: "GitHub antwortet mit 404: Das Repository ist privat und kein Token ist hinterlegt. Bitte ein Fine-Grained-Token mit \xABContents: read\xBB eingeben.",
|
|
2783
|
+
not_found: "GitHub antwortet mit 404: Das Repository existiert nicht oder das Token hat keinen Zugriff. Repository-Name und Zugriff pr\xFCfen.",
|
|
2784
|
+
token_invalid: "GitHub lehnt das Token ab (HTTP 401): abgelaufen oder widerrufen. Neues Token eingeben.",
|
|
2785
|
+
forbidden: "GitHub verweigert die Anfrage (HTTP 403): fehlende Berechtigung oder Rate-Limit.",
|
|
2786
|
+
error: "Der letzte Abruf ist fehlgeschlagen, siehe Meldung unten."
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
var LABELS4 = {
|
|
2790
|
+
en: {
|
|
2791
|
+
source: "Source",
|
|
2792
|
+
intro: "Fetches the signed pack of this stage from GitHub every 15 minutes. Token with read access to the repository's contents only.",
|
|
2793
|
+
repo: "Repository",
|
|
2794
|
+
channel: "Channel",
|
|
2795
|
+
token: "Token",
|
|
2796
|
+
tokenKeep: "Token (empty: keep the stored one)",
|
|
2797
|
+
saveAndFetch: "Save and fetch",
|
|
2798
|
+
removeSource: "Remove source",
|
|
2799
|
+
saved: "Catalog source saved",
|
|
2800
|
+
since: (at) => `Since ${at}`,
|
|
2801
|
+
lastFetch: (at) => `Last fetch: ${at}`
|
|
2802
|
+
},
|
|
2803
|
+
de: {
|
|
2804
|
+
source: "Quelle",
|
|
2805
|
+
intro: "Ruft alle 15 Minuten das signierte Paket dieser Stage von GitHub ab. Token ben\xF6tigt ausschliesslich Leserechte auf die Repository-Inhalte.",
|
|
2806
|
+
repo: "Repository",
|
|
2807
|
+
channel: "Kanal",
|
|
2808
|
+
token: "Token",
|
|
2809
|
+
tokenKeep: "Token (leer lassen, um das gespeicherte zu behalten)",
|
|
2810
|
+
saveAndFetch: "Speichern und abrufen",
|
|
2811
|
+
removeSource: "Quelle entfernen",
|
|
2812
|
+
saved: "Katalogquelle gespeichert",
|
|
2813
|
+
since: (at) => `Seit ${at}`,
|
|
2814
|
+
lastFetch: (at) => `Letzter Abruf: ${at}`
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
2817
|
+
function defaultFormatError3(error) {
|
|
2818
|
+
const err = error;
|
|
2819
|
+
const detail = err?.response?.data?.detail;
|
|
2820
|
+
return typeof detail === "string" && detail ? detail : err?.message || "Request failed";
|
|
2821
|
+
}
|
|
2822
|
+
function ScalioGovernanceCatalog({
|
|
2823
|
+
api,
|
|
2824
|
+
lang = "en",
|
|
2825
|
+
basePath = "/governance/catalog",
|
|
2826
|
+
formatDateTime = (v) => v,
|
|
2827
|
+
formatError = defaultFormatError3,
|
|
2828
|
+
onNotify,
|
|
2829
|
+
onCatalogChange,
|
|
2830
|
+
children
|
|
2831
|
+
}) {
|
|
2832
|
+
const L = LABELS4[lang];
|
|
2833
|
+
const channels = CHANNELS[lang];
|
|
2834
|
+
const stateMap = STATES[lang];
|
|
2835
|
+
const [src, setSrc] = (0, import_react29.useState)(null);
|
|
2836
|
+
const [form, setForm] = (0, import_react29.useState)({ repo: "", channel: "prod", token: "" });
|
|
2837
|
+
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
2838
|
+
(0, import_react29.useEffect)(() => {
|
|
2839
|
+
let active = true;
|
|
2840
|
+
api.get(`${basePath}/source`).then((res) => {
|
|
2841
|
+
if (!active) return;
|
|
2842
|
+
setSrc(res.data);
|
|
2843
|
+
setForm({ repo: res.data.repo || "", channel: res.data.channel || "prod", token: "" });
|
|
2844
|
+
}).catch((error) => {
|
|
2845
|
+
if (active) onNotify?.(formatError(error), "error");
|
|
2846
|
+
});
|
|
2847
|
+
return () => {
|
|
2848
|
+
active = false;
|
|
2849
|
+
};
|
|
2850
|
+
}, [api, basePath, formatError, onNotify]);
|
|
2851
|
+
const handleSave = async (event) => {
|
|
2852
|
+
event.preventDefault();
|
|
2853
|
+
if (busy) return;
|
|
2854
|
+
setBusy(true);
|
|
2855
|
+
try {
|
|
2856
|
+
const updated = await api.put(`${basePath}/source`, form);
|
|
2857
|
+
setForm((prev) => ({ ...prev, token: "" }));
|
|
2858
|
+
const synced = await api.post(`${basePath}/source/sync`);
|
|
2859
|
+
setSrc({ ...updated.data, last_sync: synced.data });
|
|
2860
|
+
if (synced.data.catalog !== void 0) onCatalogChange?.(synced.data.catalog);
|
|
2861
|
+
onNotify?.(L.saved, "success");
|
|
2862
|
+
} catch (error) {
|
|
2863
|
+
onNotify?.(formatError(error), "error");
|
|
2864
|
+
} finally {
|
|
2865
|
+
setBusy(false);
|
|
2866
|
+
}
|
|
2867
|
+
};
|
|
2868
|
+
const handleRemove = async () => {
|
|
2869
|
+
try {
|
|
2870
|
+
const removed = await api.delete(`${basePath}/source`);
|
|
2871
|
+
setSrc(removed.data);
|
|
2872
|
+
const catalog = await api.get(basePath);
|
|
2873
|
+
onCatalogChange?.(catalog.data);
|
|
2874
|
+
} catch (error) {
|
|
2875
|
+
onNotify?.(formatError(error), "error");
|
|
2876
|
+
}
|
|
2877
|
+
};
|
|
2878
|
+
if (!src) return null;
|
|
2879
|
+
const last = src.last_sync;
|
|
2880
|
+
const st = src.state;
|
|
2881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-4 min-w-0", children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("section", { className: "rounded-md border border-border bg-card min-w-0", "data-testid": "catalog-source", children: [
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-5 py-3 border-b border-border text-xs font-bold uppercase tracking-wider text-muted-foreground", children: L.source }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("form", { className: "p-5 space-y-4", onSubmit: (e) => void handleSave(e), "data-testid": "catalog-source-form", children: [
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm text-muted-foreground", children: L.intro }),
|
|
2886
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0", children: [
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "block text-[11px] font-mono uppercase tracking-wider text-muted-foreground mb-1.5", children: L.repo }),
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2890
|
+
"input",
|
|
2891
|
+
{
|
|
2892
|
+
className: "w-full bg-background border border-border rounded-sm px-3 py-2 text-sm",
|
|
2893
|
+
value: form.repo,
|
|
2894
|
+
onChange: (e) => setForm({ ...form, repo: e.target.value }),
|
|
2895
|
+
"data-testid": "catalog-source-repo"
|
|
2896
|
+
}
|
|
2897
|
+
)
|
|
2898
|
+
] }),
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0", children: [
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "block text-[11px] font-mono uppercase tracking-wider text-muted-foreground mb-1.5", children: L.channel }),
|
|
2901
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2902
|
+
"select",
|
|
2903
|
+
{
|
|
2904
|
+
className: "w-full bg-background border border-border rounded-sm px-3 py-2 text-sm",
|
|
2905
|
+
value: form.channel,
|
|
2906
|
+
onChange: (e) => setForm({ ...form, channel: e.target.value }),
|
|
2907
|
+
"data-testid": "catalog-source-channel",
|
|
2908
|
+
children: channels.map((ch) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: ch.key, children: ch.label }, ch.key))
|
|
2909
|
+
}
|
|
2910
|
+
)
|
|
2911
|
+
] }),
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "sm:col-span-2 min-w-0", children: [
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "block text-[11px] font-mono uppercase tracking-wider text-muted-foreground mb-1.5", children: src.token_set ? L.tokenKeep : L.token }),
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2915
|
+
"input",
|
|
2916
|
+
{
|
|
2917
|
+
type: "password",
|
|
2918
|
+
autoComplete: "off",
|
|
2919
|
+
className: "w-full bg-background border border-border rounded-sm px-3 py-2 text-sm",
|
|
2920
|
+
value: form.token,
|
|
2921
|
+
onChange: (e) => setForm({ ...form, token: e.target.value }),
|
|
2922
|
+
"data-testid": "catalog-source-token"
|
|
2923
|
+
}
|
|
2924
|
+
)
|
|
2925
|
+
] })
|
|
2926
|
+
] }),
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2929
|
+
"button",
|
|
2930
|
+
{
|
|
2931
|
+
type: "submit",
|
|
2932
|
+
disabled: busy,
|
|
2933
|
+
className: "inline-flex items-center gap-2 h-10 px-5 rounded-sm bg-primary text-primary-foreground text-xs font-bold uppercase tracking-wider disabled:opacity-50",
|
|
2934
|
+
"data-testid": "catalog-source-save",
|
|
2935
|
+
children: [
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react11.RefreshCw, { className: `w-4 h-4 ${busy ? "animate-spin" : ""}` }),
|
|
2937
|
+
" ",
|
|
2938
|
+
L.saveAndFetch
|
|
2939
|
+
]
|
|
2940
|
+
}
|
|
2941
|
+
),
|
|
2942
|
+
src.configured && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2943
|
+
"button",
|
|
2944
|
+
{
|
|
2945
|
+
type: "button",
|
|
2946
|
+
onClick: () => void handleRemove(),
|
|
2947
|
+
className: "inline-flex items-center gap-2 h-10 px-5 rounded-sm border border-border bg-card text-xs font-bold uppercase tracking-wider",
|
|
2948
|
+
"data-testid": "catalog-source-remove",
|
|
2949
|
+
children: [
|
|
2950
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react11.Trash2, { className: "w-4 h-4" }),
|
|
2951
|
+
" ",
|
|
2952
|
+
L.removeSource
|
|
2953
|
+
]
|
|
2954
|
+
}
|
|
2955
|
+
)
|
|
2956
|
+
] }),
|
|
2957
|
+
st && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2958
|
+
"div",
|
|
2959
|
+
{
|
|
2960
|
+
className: `text-xs rounded border px-3 py-2 ${st.code === "ok" ? "border-green-600/40 text-green-800 dark:text-green-300" : "border-red-600/40 text-red-800 dark:text-red-300"}`,
|
|
2961
|
+
"data-testid": "catalog-source-state",
|
|
2962
|
+
"data-code": st.code,
|
|
2963
|
+
children: [
|
|
2964
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "font-medium", children: stateMap[st.code] || stateMap.error }),
|
|
2965
|
+
st.since && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-muted-foreground", children: L.since(formatDateTime(st.since)) })
|
|
2966
|
+
]
|
|
2967
|
+
}
|
|
2968
|
+
),
|
|
2969
|
+
last && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "text-xs font-mono text-muted-foreground space-y-0.5 break-all", children: [
|
|
2970
|
+
last.at && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
2971
|
+
L.lastFetch(formatDateTime(last.at)),
|
|
2972
|
+
last.fetched?.length ? ` \xB7 ${last.fetched.join(", ")}` : ""
|
|
2973
|
+
] }),
|
|
2974
|
+
(last.errors || []).map((err) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-destructive break-all", children: err }, err))
|
|
2975
|
+
] })
|
|
2976
|
+
] })
|
|
2977
|
+
] }),
|
|
2978
|
+
children
|
|
2979
|
+
] });
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
// src/app-kit/ScalioTenancy.tsx
|
|
2983
|
+
var import_react30 = require("react");
|
|
2984
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2985
|
+
function useCustomerOrgs(api) {
|
|
2986
|
+
const [rows, setRows] = (0, import_react30.useState)([]);
|
|
2987
|
+
const load = (0, import_react30.useCallback)(() => {
|
|
2988
|
+
api.get("/organizations").then((res) => setRows((res.data || []).filter((org) => org.kind === "customer"))).catch(() => setRows([]));
|
|
2989
|
+
}, [api]);
|
|
2990
|
+
(0, import_react30.useEffect)(() => {
|
|
2991
|
+
load();
|
|
2992
|
+
}, [load]);
|
|
2993
|
+
return rows;
|
|
2994
|
+
}
|
|
2995
|
+
function ScalioM365Connection({
|
|
2996
|
+
api,
|
|
2997
|
+
lang = "en",
|
|
2998
|
+
app,
|
|
2999
|
+
tenantId,
|
|
3000
|
+
slot = "read",
|
|
3001
|
+
mode = "wizard",
|
|
3002
|
+
showLater,
|
|
3003
|
+
onChanged,
|
|
3004
|
+
formatError,
|
|
3005
|
+
onNotify
|
|
3006
|
+
}) {
|
|
3007
|
+
const client = (0, import_react30.useMemo)(
|
|
3008
|
+
() => createTenantConnectClient(api, { tenantId, slot }),
|
|
3009
|
+
[api, slot, tenantId]
|
|
3010
|
+
);
|
|
3011
|
+
if (mode === "panel") {
|
|
3012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3013
|
+
MicrosoftConnection,
|
|
3014
|
+
{
|
|
3015
|
+
client,
|
|
3016
|
+
lang,
|
|
3017
|
+
onChanged,
|
|
3018
|
+
formatError,
|
|
3019
|
+
notify: (message, tone) => onNotify?.(message, tone)
|
|
3020
|
+
}
|
|
3021
|
+
);
|
|
3022
|
+
}
|
|
3023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3024
|
+
TenantConnectStep,
|
|
3025
|
+
{
|
|
3026
|
+
client,
|
|
3027
|
+
app,
|
|
3028
|
+
lang,
|
|
3029
|
+
onChange: onChanged,
|
|
3030
|
+
showLater
|
|
3031
|
+
}
|
|
3032
|
+
);
|
|
3033
|
+
}
|
|
3034
|
+
function ScalioTenancyPanel({
|
|
3035
|
+
api,
|
|
3036
|
+
lang = "en",
|
|
3037
|
+
tenants,
|
|
3038
|
+
organizations,
|
|
3039
|
+
columns,
|
|
3040
|
+
actions,
|
|
3041
|
+
appName,
|
|
3042
|
+
limit,
|
|
3043
|
+
readOnly,
|
|
3044
|
+
showOrganizations = false,
|
|
3045
|
+
msp,
|
|
3046
|
+
onAdd,
|
|
3047
|
+
children
|
|
3048
|
+
}) {
|
|
3049
|
+
const orgClient = (0, import_react30.useMemo)(() => organizationsApi(api), [api]);
|
|
3050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-6 min-w-0", "data-testid": "scalio-tenancy-panel", children: [
|
|
3051
|
+
showOrganizations && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3052
|
+
OrganizationsPanel,
|
|
3053
|
+
{
|
|
3054
|
+
client: orgClient,
|
|
3055
|
+
msp,
|
|
3056
|
+
lang,
|
|
3057
|
+
readOnly
|
|
3058
|
+
}
|
|
3059
|
+
),
|
|
3060
|
+
tenants && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3061
|
+
TenantList,
|
|
3062
|
+
{
|
|
3063
|
+
tenants,
|
|
3064
|
+
organizations,
|
|
3065
|
+
columns,
|
|
3066
|
+
actions,
|
|
3067
|
+
appName,
|
|
3068
|
+
limit,
|
|
3069
|
+
onAdd,
|
|
3070
|
+
lang,
|
|
3071
|
+
readOnly
|
|
3072
|
+
}
|
|
3073
|
+
),
|
|
3074
|
+
children
|
|
3075
|
+
] });
|
|
3076
|
+
}
|
|
3077
|
+
var SHARE_LABELS = {
|
|
3078
|
+
en: {
|
|
3079
|
+
loading: "Checking share link\u2026",
|
|
3080
|
+
title: (app) => `Connect tenant to ${app}`,
|
|
3081
|
+
accept: "Accept tenant connection",
|
|
3082
|
+
accepted: "Tenant connection accepted.",
|
|
3083
|
+
invalid: "This share link is invalid or expired.",
|
|
3084
|
+
back: "Continue"
|
|
3085
|
+
},
|
|
3086
|
+
de: {
|
|
3087
|
+
loading: "Freigabelink wird gepr\xFCft\u2026",
|
|
3088
|
+
title: (app) => `Tenant mit ${app} verbinden`,
|
|
3089
|
+
accept: "Tenant-Verbindung \xFCbernehmen",
|
|
3090
|
+
accepted: "Tenant-Verbindung \xFCbernommen.",
|
|
3091
|
+
invalid: "Dieser Freigabelink ist ung\xFCltig oder abgelaufen.",
|
|
3092
|
+
back: "Weiter"
|
|
3093
|
+
}
|
|
3094
|
+
};
|
|
3095
|
+
function ScalioTenantSharePage({
|
|
3096
|
+
api,
|
|
3097
|
+
token,
|
|
3098
|
+
lang = "en",
|
|
3099
|
+
appName,
|
|
3100
|
+
onDone,
|
|
3101
|
+
formatError
|
|
3102
|
+
}) {
|
|
3103
|
+
const L = SHARE_LABELS[lang];
|
|
3104
|
+
const [info, setInfo] = (0, import_react30.useState)(null);
|
|
3105
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
3106
|
+
const [busy, setBusy] = (0, import_react30.useState)(false);
|
|
3107
|
+
const [done, setDone] = (0, import_react30.useState)(false);
|
|
3108
|
+
(0, import_react30.useEffect)(() => {
|
|
3109
|
+
let active = true;
|
|
3110
|
+
api.get(`/tenant-share/${encodeURIComponent(token)}`).then((res) => {
|
|
3111
|
+
if (active) setInfo(res.data);
|
|
3112
|
+
}).catch((err) => {
|
|
3113
|
+
if (active) setError(formatError ? formatError(err) : L.invalid);
|
|
3114
|
+
});
|
|
3115
|
+
return () => {
|
|
3116
|
+
active = false;
|
|
3117
|
+
};
|
|
3118
|
+
}, [L.invalid, api, formatError, token]);
|
|
3119
|
+
const handleAccept = async () => {
|
|
3120
|
+
setBusy(true);
|
|
3121
|
+
setError(null);
|
|
3122
|
+
try {
|
|
3123
|
+
await api.post(`/tenant-share/${encodeURIComponent(token)}/accept`);
|
|
3124
|
+
setDone(true);
|
|
3125
|
+
} catch (err) {
|
|
3126
|
+
setError(formatError ? formatError(err) : L.invalid);
|
|
3127
|
+
} finally {
|
|
3128
|
+
setBusy(false);
|
|
3129
|
+
}
|
|
3130
|
+
};
|
|
3131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "max-w-lg mx-auto my-12 p-6 rounded-md border border-border bg-card space-y-4", "data-testid": "scalio-tenant-share", children: [
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h1", { className: "text-lg font-bold tracking-tight", children: L.title(appName) }),
|
|
3133
|
+
!info && !error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-sm text-muted-foreground", children: L.loading }),
|
|
3134
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-sm text-destructive", role: "alert", children: error }),
|
|
3135
|
+
info && !done && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-4", children: [
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-sm", children: [
|
|
3137
|
+
info.tenant_name && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "font-medium", children: info.tenant_name }),
|
|
3138
|
+
info.domain && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-muted-foreground font-mono text-xs", children: info.domain })
|
|
3139
|
+
] }),
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3141
|
+
"button",
|
|
3142
|
+
{
|
|
3143
|
+
type: "button",
|
|
3144
|
+
disabled: busy,
|
|
3145
|
+
onClick: () => void handleAccept(),
|
|
3146
|
+
className: "inline-flex items-center justify-center h-10 px-5 rounded-sm bg-primary text-primary-foreground text-xs font-bold uppercase tracking-wider disabled:opacity-50",
|
|
3147
|
+
"data-testid": "tenant-share-accept",
|
|
3148
|
+
children: L.accept
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
] }),
|
|
3152
|
+
done && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-3", children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-sm text-green-700 dark:text-green-400", children: L.accepted }),
|
|
3154
|
+
onDone && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3155
|
+
"button",
|
|
3156
|
+
{
|
|
3157
|
+
type: "button",
|
|
3158
|
+
onClick: onDone,
|
|
3159
|
+
className: "inline-flex items-center justify-center h-9 px-4 rounded-sm border border-border bg-background text-xs font-bold uppercase tracking-wider",
|
|
3160
|
+
children: L.back
|
|
3161
|
+
}
|
|
3162
|
+
)
|
|
3163
|
+
] })
|
|
3164
|
+
] });
|
|
3165
|
+
}
|
|
2248
3166
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2249
3167
|
0 && (module.exports = {
|
|
3168
|
+
ScalioAgentSettings,
|
|
3169
|
+
ScalioAiSettings,
|
|
2250
3170
|
ScalioAppProviders,
|
|
2251
3171
|
ScalioAuditHeader,
|
|
2252
3172
|
ScalioAuditPage,
|
|
@@ -2261,16 +3181,20 @@ function ScalioLayout({
|
|
|
2261
3181
|
ScalioFormDialog,
|
|
2262
3182
|
ScalioFormError,
|
|
2263
3183
|
ScalioFormField,
|
|
3184
|
+
ScalioGovernanceCatalog,
|
|
2264
3185
|
ScalioInvitePage,
|
|
2265
3186
|
ScalioJobsPage,
|
|
3187
|
+
ScalioKpiGrid,
|
|
2266
3188
|
ScalioLayout,
|
|
2267
3189
|
ScalioLicensePanel,
|
|
2268
3190
|
ScalioLoginPage,
|
|
3191
|
+
ScalioM365Connection,
|
|
2269
3192
|
ScalioMailSettings,
|
|
2270
3193
|
ScalioMaintenanceBanner,
|
|
2271
3194
|
ScalioMoneyInput,
|
|
2272
3195
|
ScalioOfflineBanner,
|
|
2273
3196
|
ScalioPasswordChangePage,
|
|
3197
|
+
ScalioPeerCard,
|
|
2274
3198
|
ScalioProfilePage,
|
|
2275
3199
|
ScalioResultBadge,
|
|
2276
3200
|
ScalioRoleTenants,
|
|
@@ -2278,13 +3202,17 @@ function ScalioLayout({
|
|
|
2278
3202
|
ScalioSaasUpdatesSection,
|
|
2279
3203
|
ScalioSecurityFactors,
|
|
2280
3204
|
ScalioSelfTestPage,
|
|
3205
|
+
ScalioSetupWizard,
|
|
2281
3206
|
ScalioSkeleton,
|
|
2282
3207
|
ScalioSupportCard,
|
|
2283
3208
|
ScalioTagInput,
|
|
3209
|
+
ScalioTenancyPanel,
|
|
2284
3210
|
ScalioTenantSettings,
|
|
3211
|
+
ScalioTenantSharePage,
|
|
2285
3212
|
ScalioUsersPage,
|
|
2286
3213
|
formatDisplayValue,
|
|
2287
3214
|
formatMinorToEditable,
|
|
2288
|
-
parseEditableToMinor
|
|
3215
|
+
parseEditableToMinor,
|
|
3216
|
+
useCustomerOrgs
|
|
2289
3217
|
});
|
|
2290
3218
|
//# sourceMappingURL=index.js.map
|