@scalio-cloud/ui 0.46.0 → 0.48.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/README.md CHANGED
@@ -209,6 +209,10 @@ the setup script as the way out, and the code that comes back as `#scalio_connec
209
209
  app passes its own routes as `client`: `status()` (`{connected, organization, azure_tenant_id, missing, last_error}`),
210
210
  `link()` (`{url}`), `script()` (`{script}`), `redeem(code)` and optionally `check()`. An app with a tenant list
211
211
  creates its default tenant itself in these calls. `onChange(status)` runs after every action.
212
+ Several views can show the tenant at once (back from «Scalio Setup» the wizard opens over the settings page, and
213
+ only one of them takes the code). After a connect, check or removal a view calls `announceTenantChange()`, and
214
+ every view that uses `useTenantChange(reload)` reads its state again; `TenantConnectStep` does both by itself. An
215
+ app with its own connection block does the same, else the wizard keeps showing «Nicht verbunden».
212
216
 
213
217
  `<FirstAdminSetup microsoft={...} codeFrom="portal" onSubmit={...} onMicrosoft={...} lang={lang} />` is the first-run
214
218
  form «Ersten Administrator anlegen» inside `AuthLayout`, with the same texts in every app (Citadel, Beacon and Pulse
@@ -407,7 +411,29 @@ function AppWizard() {
407
411
  ```
408
412
 
409
413
  Test IDs: `setup-wizard`, `wizard-stepper(-item)`, `wizard-step-{id}`, `wizard-next`, `wizard-back`, `wizard-skip`,
410
- `wizard-close`, `wizard-error`, `wizard-success`, `wizard-done`, `settings-open-wizard`.
414
+ `wizard-body`, `wizard-actions`, `wizard-close`, `wizard-error`, `wizard-success`, `wizard-done`, `settings-open-wizard`.
415
+
416
+ Keyboard and layout (from 0.47.0): the wizard has the same height on every step; only the step scrolls, so
417
+ Zurück (left) and Weiter (right) never move. Enter means Weiter (not in a button, link, textarea, select or a field
418
+ inside its own `<form>`, not with a modifier, not while Weiter is blocked). Each step puts the focus on its first
419
+ field, else on Weiter; Tab stays inside the wizard; Escape closes it (when it may be closed). An app with its own
420
+ step dialog uses `enterMeansNext(event.target)` for the same Enter rule.
421
+
422
+ ## Dialogs instead of browser popups (React, from 0.48.0)
423
+
424
+ No `alert`, `confirm` or `prompt` in the apps (scalio-docs ADR 0096). Use the promise dialogs; they mount
425
+ themselves, no provider needed, keyboard as ADR 0095 (focus on OK or the field, Enter confirms, Escape cancels):
426
+
427
+ ```js
428
+ import { askConfirm, askText, showMessage } from "@scalio-cloud/ui/react";
429
+ if (!(await askConfirm({ title: "Benutzer löschen", text: "Das lässt sich nicht rückgängig machen.", confirmLabel: "Löschen", danger: true }))) return;
430
+ const name = await askText({ title: "Umbenennen", label: "Neuer Name", value: old, required: true }); // null on Abbrechen
431
+ await showMessage({ title: "Gespeichert", text: "Alles da." });
432
+ ```
433
+
434
+ Test IDs: `confirm-dialog`, `confirm-dialog-ok`, `confirm-dialog-cancel`, `confirm-dialog-input`. `SaasUpdatesPanel` asks
435
+ with `askConfirm` and then shows `UpdateProgress` (`saas-update-progress`): it polls `/version.json` (props
436
+ `versionUrl`, `checkVersion`, `pollMs` 5 s, `timeoutMs` 20 min) and reloads the page once the new version runs.
411
437
 
412
438
  ## Two-factor card and license panel (React)
413
439
 
package/nav.css CHANGED
@@ -525,8 +525,9 @@
525
525
 
526
526
  /* Setup wizard (SetupWizard, ADR 0060): design of the Nexus wizard, first built in Kontor */
527
527
  .scalio-wizard-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgb(0 0 0 / 0.5); }
528
+ /* Same height on every step (Markus 2026-11-07): only the step scrolls, Zurück and Weiter stay where they are. */
528
529
  .scalio-wizard {
529
- display: flex; flex-direction: column; gap: 1rem; width: calc(100vw - 2rem); max-width: 42rem; max-height: 90vh; overflow-y: auto;
530
+ display: flex; flex-direction: column; gap: 1rem; width: calc(100vw - 2rem); max-width: 42rem; height: min(46rem, 90vh); overflow: hidden;
530
531
  padding: 1.5rem; border: 1px solid hsl(var(--border)); border-radius: 2px; background: hsl(var(--background)); color: hsl(var(--foreground));
531
532
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.25); font-size: 0.875rem;
532
533
  }
@@ -550,9 +551,11 @@
550
551
  .scalio-wizard-step { display: flex; flex-direction: column; gap: 0.75rem; }
551
552
  .scalio-wizard-step-title { margin: 0; font-size: 0.875rem; font-weight: 700; }
552
553
  .scalio-wizard-text { margin: 0; color: hsl(var(--muted-foreground)); }
553
- .scalio-wizard-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
554
+ .scalio-wizard:focus { outline: none; }
555
+ .scalio-wizard-body { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 1rem; overflow-y: auto; }
556
+ .scalio-wizard-actions { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); }
554
557
  .scalio-wizard-actions-right { display: flex; align-items: center; gap: 0.5rem; }
555
- .scalio-wizard-success { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 1.5rem 0; text-align: center; }
558
+ .scalio-wizard-success { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 1.5rem 0; text-align: center; }
556
559
  .scalio-wizard-success .scalio-wizard-step-title { font-size: 1.125rem; }
557
560
  .scalio-wizard-success .scalio-wizard-text { max-width: 28rem; }
558
561
  .scalio-wizard-success .scalio-btn { margin-top: 0.5rem; }
@@ -831,3 +834,23 @@
831
834
  /* Einstellungen -> Sicherung (BackupPanel, ADR 0069 W5) */
832
835
  .scalio-notice > ul, .scalio-notice-body > ul { margin: 0; padding-left: 1.25rem; }
833
836
  ul.scalio-notice { flex-direction: column; gap: 0.25rem; padding-left: 2rem; list-style: disc; }
837
+
838
+ /* Dialogs instead of browser popups (ADR 0096): askConfirm, askText, showMessage, UpdateProgress. */
839
+ .scalio-dialog-root { z-index: 70; }
840
+ .scalio-dialog {
841
+ display: flex; flex-direction: column; gap: 0.75rem; width: calc(100vw - 2rem); max-width: 28rem; max-height: 90vh; overflow-y: auto;
842
+ padding: 1.5rem; border: 1px solid hsl(var(--border)); border-radius: 2px; background: hsl(var(--background)); color: hsl(var(--foreground));
843
+ box-shadow: 0 16px 40px rgb(0 0 0 / 0.25); font-size: 0.875rem;
844
+ }
845
+ .scalio-dialog:focus { outline: none; }
846
+ .scalio-dialog-title { margin: 0; font-family: 'Chivo', sans-serif; font-size: 1rem; font-weight: 800; }
847
+ .scalio-dialog-text { margin: 0; color: hsl(var(--muted-foreground)); white-space: pre-line; }
848
+ .scalio-dialog-field { display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
849
+ .scalio-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
850
+ .scalio-btn.is-danger { border-color: hsl(var(--destructive)); background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground, 0 0% 100%)); }
851
+ .scalio-btn.is-danger:hover { background: hsl(var(--destructive) / 0.9); }
852
+ .scalio-progress-steps { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
853
+ .scalio-progress-step { display: flex; align-items: center; gap: 0.5rem; color: hsl(var(--muted-foreground)); }
854
+ .scalio-progress-step.is-active, .scalio-progress-step.is-done { color: hsl(var(--foreground)); }
855
+ .scalio-progress-step.is-done .scalio-icon { color: #059669; }
856
+ .scalio-progress-dot { width: 0.875rem; height: 0.875rem; border: 2px solid hsl(var(--border)); border-radius: 999px; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.46.0",
3
+ "version": "0.48.0",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
package/react/backup.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // Einstellungen -> System -> Sicherung (ADR 0069 wartung/W5; after Nexus BackupSection and ImportSection).
3
3
  // Backend: scalio-backup `web.backup_router` (GET /api/backup/status, POST /api/backup/export, /api/backup/import/...).
4
4
  const React = require("react");
5
+ const { askConfirm } = require("./dialog");
5
6
  const h = React.createElement;
6
7
  const Icons = require("./icons");
7
8
  const { labelsFor } = require("./labels");
@@ -399,7 +400,7 @@ function BackupImport(props) {
399
400
  };
400
401
 
401
402
  const undo = async () => {
402
- if (!window.confirm(L.rollbackConfirm)) return;
403
+ if (!(await askConfirm({ text: L.rollbackConfirm, danger: true, lang: props.lang }))) return;
403
404
  setBusy(true);
404
405
  n.clear();
405
406
  try {
package/react/beacon.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // Verbundene Apps); findings then go to Beacon and become tickets. Backend routes from scalio-connect
5
5
  // (`scalio_connect.peers.web.admin_router`); peersApi(api) maps them for an axios-like client.
6
6
  const React = require("react");
7
+ const { askConfirm } = require("./dialog");
7
8
  const h = React.createElement;
8
9
  const { labelsFor } = require("./labels");
9
10
 
@@ -93,7 +94,7 @@ function BeaconConnection({ client, lang, labels, onChange }) {
93
94
  h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "beacon-check",
94
95
  onClick: () => run(() => client.check(p.id), (d) => L.beaconChecked.replace("{version}", (d && d.version) || "")) }, L.supportCheck),
95
96
  h("button", { type: "button", className: "scalio-btn scalio-btn-danger", disabled: busy, "data-testid": "beacon-remove",
96
- onClick: () => (typeof window === "undefined" || window.confirm(L.beaconRemoveConfirm)) && run(() => client.remove(p.id), L.supportRemoved) },
97
+ onClick: async () => (await askConfirm({ text: L.beaconRemoveConfirm, danger: true, lang })) && run(() => client.remove(p.id), L.supportRemoved) },
97
98
  L.supportRemove))
98
99
  );
99
100
  }),
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ // Proper dialogs instead of browser popups (Markus 2026-11-07, scalio-docs ADR 0096): askConfirm replaces the
3
+ // browser's confirm, askText its prompt, showMessage its alert. Each returns a Promise, so a call site changes
4
+ // from `if (!confirm(t)) return;` to `if (!(await askConfirm({ text: t }))) return;`.
5
+ // The dialog mounts itself into document.body on first use; apps need no provider. Keyboard as ADR 0095: the focus
6
+ // starts on OK (or the text field), Enter confirms, Escape cancels, Tab stays inside.
7
+
8
+ const React = require("react");
9
+ const { labelsFor } = require("./labels");
10
+ const { trapTab } = require("./wizard");
11
+
12
+ const h = React.createElement;
13
+
14
+ const queue = [];
15
+ let notify = null; // set by the mounted host
16
+ let host = null;
17
+
18
+ function mountHost() {
19
+ if (notify || host || typeof document === "undefined") return;
20
+ const { createRoot } = require("react-dom/client");
21
+ host = document.createElement("div");
22
+ host.setAttribute("data-scalio-dialog-host", "");
23
+ document.body.appendChild(host);
24
+ createRoot(host).render(h(DialogHost));
25
+ }
26
+
27
+ function ask(kind, opts) {
28
+ return new Promise((resolve) => {
29
+ queue.push({ kind, opts: opts || {}, resolve });
30
+ mountHost();
31
+ if (notify) notify();
32
+ });
33
+ }
34
+
35
+ const askConfirm = (opts) => ask("confirm", typeof opts === "string" ? { text: opts } : opts);
36
+ const askText = (opts) => ask("text", typeof opts === "string" ? { label: opts } : opts);
37
+ const showMessage = (opts) => ask("message", typeof opts === "string" ? { text: opts } : opts);
38
+
39
+ function pageLang() {
40
+ const l = typeof document !== "undefined" && document.documentElement ? document.documentElement.lang : "";
41
+ return /^en/i.test(l || "") ? "en" : "de";
42
+ }
43
+
44
+ function DialogHost() {
45
+ const [, setN] = React.useState(0);
46
+ React.useEffect(() => {
47
+ notify = () => setN((n) => n + 1);
48
+ if (queue.length) notify();
49
+ return () => { notify = null; };
50
+ }, []);
51
+ const item = queue[0];
52
+ if (!item) return null;
53
+ const done = (value) => {
54
+ queue.shift();
55
+ item.resolve(value);
56
+ setN((n) => n + 1);
57
+ };
58
+ return h(ConfirmDialog, Object.assign({ key: queue.length + ":" + (item.opts.text || item.opts.label || "") }, item.opts, {
59
+ kind: item.kind,
60
+ onDone: done,
61
+ }));
62
+ }
63
+
64
+ function ConfirmDialog(props) {
65
+ const { kind, title, text, label, placeholder, danger, required, onDone } = props;
66
+ const L = Object.assign({}, labelsFor(props.lang || pageLang()).dialog);
67
+ const [value, setValue] = React.useState(props.value == null ? "" : String(props.value));
68
+ const panel = React.useRef(null);
69
+ const okRef = React.useRef(null);
70
+ const inputRef = React.useRef(null);
71
+ const blocked = kind === "text" && required && !value.trim();
72
+ const cancelValue = kind === "confirm" ? false : kind === "text" ? null : undefined;
73
+ const ok = () => { if (!blocked) onDone(kind === "confirm" ? true : kind === "text" ? value.trim() : undefined); };
74
+ const cancel = () => onDone(cancelValue);
75
+
76
+ React.useEffect(() => {
77
+ const before = document.activeElement;
78
+ const first = inputRef.current || okRef.current;
79
+ if (first) first.focus();
80
+ return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
81
+ }, []);
82
+
83
+ function onKeyDown(e) {
84
+ if (e.key === "Tab") return trapTab(e, panel.current);
85
+ if (e.key === "Escape") { e.preventDefault(); cancel(); return; }
86
+ if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
87
+ const tag = e.target && e.target.tagName ? e.target.tagName.toLowerCase() : "";
88
+ if (tag === "button" && e.target !== okRef.current) return; // Abbrechen keeps its own Enter
89
+ e.preventDefault();
90
+ ok();
91
+ }
92
+ }
93
+
94
+ const titleId = "scalio-dialog-title";
95
+ return h(
96
+ "div",
97
+ { className: "scalio-wizard-root scalio-dialog-root", onMouseDown: (e) => { if (e.target === e.currentTarget) cancel(); } },
98
+ h(
99
+ "div",
100
+ {
101
+ ref: panel, onKeyDown, tabIndex: -1,
102
+ role: kind === "message" ? "dialog" : "alertdialog", "aria-modal": "true",
103
+ "aria-labelledby": title ? titleId : undefined, "aria-label": title ? undefined : (text || label || L.confirm),
104
+ className: "scalio-dialog", "data-testid": "confirm-dialog",
105
+ },
106
+ title ? h("h2", { id: titleId, className: "scalio-dialog-title" }, title) : null,
107
+ text ? h("p", { className: "scalio-dialog-text" }, text) : null,
108
+ kind === "text"
109
+ ? h("label", { className: "scalio-dialog-field" },
110
+ label ? h("span", null, label) : null,
111
+ h("input", {
112
+ ref: inputRef, className: "scalio-input", value, placeholder, "data-testid": "confirm-dialog-input",
113
+ "aria-label": label || L.input,
114
+ onChange: (e) => setValue(e.target.value), onInput: (e) => setValue(e.target.value),
115
+ }))
116
+ : null,
117
+ h(
118
+ "div",
119
+ { className: "scalio-dialog-actions" },
120
+ kind === "message" ? null : h("button", { type: "button", className: "scalio-btn", onClick: cancel, "data-testid": "confirm-dialog-cancel" }, props.cancelLabel || L.cancel),
121
+ h("button", {
122
+ ref: okRef, type: "button", disabled: blocked,
123
+ className: danger ? "scalio-btn is-danger" : "scalio-btn is-primary",
124
+ onClick: ok, "data-testid": "confirm-dialog-ok",
125
+ }, props.confirmLabel || L.ok)
126
+ )
127
+ )
128
+ );
129
+ }
130
+
131
+ module.exports = { askConfirm, askText, showMessage, ConfirmDialog, DialogHost };
package/react/index.js CHANGED
@@ -378,6 +378,6 @@ module.exports = {
378
378
  TEST_IDS,
379
379
  initials,
380
380
  };
381
- Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"));
381
+ Object.assign(module.exports, Nav, Blocks, require("./settings"), require("./support"), require("./beacon"), require("./security"), require("./license"), require("./palette"), require("./unify"), require("./profile"), require("./actions"), require("./selftest"), require("./users"), require("./customers"), require("./roles"), require("./wizard"), require("./maintenance"), require("./backup"), require("./audit"), require("./mail"), require("./saas_updates"), require("./pages"), require("./tenant"), require("./fields"), require("./dialog"));
382
382
  // After the exports above: auth.js uses LanguageToggle and ThemeToggle from this module.
383
383
  Object.assign(module.exports, require("./auth"), require("./session"), require("./setup"), require("./clientErrors"));
package/react/labels.js CHANGED
@@ -13,6 +13,7 @@ const LABELS = {
13
13
  userMenu: "Benutzermenü",
14
14
  menu: "Menü",
15
15
  version: "Version",
16
+ dialog: { ok: "OK", cancel: "Abbrechen", confirm: "Bestätigen", input: "Eingabe" },
16
17
  wizard: {
17
18
  step: "Schritt {n} von {total}",
18
19
  back: "Zurück",
@@ -576,6 +577,7 @@ const LABELS = {
576
577
  userMenu: "User menu",
577
578
  menu: "Menu",
578
579
  version: "Version",
580
+ dialog: { ok: "OK", cancel: "Cancel", confirm: "Confirm", input: "Input" },
579
581
  wizard: {
580
582
  step: "Step {n} of {total}",
581
583
  back: "Back",
package/react/license.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // licenseApi(api) maps the routes of the scalio-license backend (Citadel, Foundry, Rosetta); mapScalioLicense turns its
4
4
  // answer into the view model the panel shows. An app with another backend passes its own `client` and `map`.
5
5
  const React = require("react");
6
+ const { askConfirm } = require("./dialog");
6
7
  const h = React.createElement;
7
8
  const Icons = require("./icons");
8
9
  const { labelsFor } = require("./labels");
@@ -158,7 +159,7 @@ function LicensePanel(props) {
158
159
  };
159
160
  const remove = async () => {
160
161
  const title = fill(L.removeConfirm, { product: props.product || "Scalio" });
161
- const yes = confirm ? await confirm({ title, action: L.remove, danger: true }) : window.confirm(title);
162
+ const yes = confirm ? await confirm({ title, action: L.remove, danger: true }) : await askConfirm({ title, confirmLabel: L.remove, danger: true });
162
163
  if (yes) run(() => client.removeKey(lang), L.removed);
163
164
  };
164
165
  const addAddon = async () => {
package/react/roles.js CHANGED
@@ -6,6 +6,7 @@
6
6
  // person's role is marked. RoleSourceSettings is the role source (Scalio app or Entra app roles) with the Entra values
7
7
  // and the list of tenants whose roles count, with «Tenant hinzufügen» by admin consent (ADR 0068).
8
8
  const React = require("react");
9
+ const { askConfirm } = require("./dialog");
9
10
  const h = React.createElement;
10
11
  const Icons = require("./icons");
11
12
 
@@ -193,7 +194,7 @@ function rolesApi(api, opts) {
193
194
 
194
195
  async function ask(confirm, title, text, action, danger) {
195
196
  if (confirm) return !!(await confirm({ title, text, action, danger: danger !== false }));
196
- return typeof window !== "undefined" && window.confirm ? window.confirm(title) : true;
197
+ return askConfirm({ title, text, confirmLabel: action, danger: danger !== false });
197
198
  }
198
199
 
199
200
  function Dialog({ title, onClose, children, testId }) {
@@ -8,6 +8,8 @@ const h = React.createElement;
8
8
  const Icons = require("./icons");
9
9
  const { Notice } = require("./blocks");
10
10
  const { SettingsSection, SettingsField: Field } = require("./settings");
11
+ const { askConfirm } = require("./dialog");
12
+ const { trapTab } = require("./wizard");
11
13
 
12
14
  const LABELS = {
13
15
  de: {
@@ -32,6 +34,15 @@ const LABELS = {
32
34
  forced: "Scalio hat den Termin festgelegt.",
33
35
  now: "Jetzt aktualisieren",
34
36
  nowConfirm: "Version {version} jetzt installieren? Die Anwendung ist einige Minuten nicht erreichbar.",
37
+ nowGo: "Jetzt installieren",
38
+ progressTitle: "Update läuft",
39
+ progressText: "Version {version} wird installiert. Die Anwendung ist dabei einige Minuten nicht erreichbar. Diese Seite lädt neu, sobald die neue Version läuft.",
40
+ progressAsked: "Update angefordert",
41
+ progressInstall: "Neue Version wird installiert",
42
+ progressDone: "Version {version} läuft, die Seite wird neu geladen.",
43
+ progressSlow: "Das Update dauert länger als erwartet. Laden Sie die Seite später neu oder prüfen Sie den Stand unter Einstellungen → Updates.",
44
+ progressReload: "Seite neu laden",
45
+ progressClose: "Im Hintergrund weiterlaufen lassen",
35
46
  postpone: "Verschieben bis",
36
47
  postponeGo: "Verschieben",
37
48
  mode: "Verhalten",
@@ -76,6 +87,15 @@ const LABELS = {
76
87
  forced: "Scalio has set the date.",
77
88
  now: "Update now",
78
89
  nowConfirm: "Install version {version} now? The application is unavailable for a few minutes.",
90
+ nowGo: "Install now",
91
+ progressTitle: "Update running",
92
+ progressText: "Version {version} is being installed. The application is unavailable for a few minutes. This page reloads as soon as the new version runs.",
93
+ progressAsked: "Update requested",
94
+ progressInstall: "Installing the new version",
95
+ progressDone: "Version {version} is running, reloading the page.",
96
+ progressSlow: "The update takes longer than expected. Reload the page later or check Settings → Updates.",
97
+ progressReload: "Reload page",
98
+ progressClose: "Keep running in the background",
79
99
  postpone: "Postpone until",
80
100
  postponeGo: "Postpone",
81
101
  mode: "Behaviour",
@@ -171,6 +191,73 @@ function UpdateBanner(props) {
171
191
 
172
192
  const EMPTY_WINDOW = { days: [], start: "02:00", hours: 3, tz: "Europe/Zurich" };
173
193
 
194
+ // The running version as the instance itself reports it (/version.json of the frontend image, ADR 0074).
195
+ async function fetchVersion(url) {
196
+ const r = await fetch(`${url || "/version.json"}?t=${Date.now()}`, { cache: "no-store" });
197
+ if (!r.ok) throw new Error(`HTTP ${r.status}`);
198
+ const d = await r.json();
199
+ return (d && d.version) || "";
200
+ }
201
+
202
+ // After «Jetzt aktualisieren» (Markus 2026-11-07): a dialog that checks in the background until the new version
203
+ // runs and then reloads the page. While the instance is down the check fails; that only means «still installing».
204
+ // Props: version (target), from (version before), lang, labels, checkVersion(), pollMs, timeoutMs, reload(), onClose().
205
+ function UpdateProgress(props) {
206
+ const L = labels(props.lang, props.labels);
207
+ const [phase, setPhase] = React.useState("install"); // install | done | slow
208
+ const panel = React.useRef(null);
209
+ const reload = props.reload || (() => window.location.reload());
210
+ React.useEffect(() => {
211
+ let alive = true;
212
+ let timer = null;
213
+ const started = Date.now();
214
+ const pollMs = props.pollMs || 5000;
215
+ const timeoutMs = props.timeoutMs || 20 * 60 * 1000;
216
+ const check = props.checkVersion || (() => fetchVersion(props.versionUrl));
217
+ const norm = (v) => String(v || "").replace(/^v/, "");
218
+ const round = async () => {
219
+ let v = "";
220
+ try { v = await check(); } catch (e) { v = ""; }
221
+ if (!alive) return;
222
+ const now = norm(v);
223
+ if (now && (now === norm(props.version) || (props.from && now !== norm(props.from)))) {
224
+ setPhase("done");
225
+ timer = setTimeout(() => { if (alive) reload(); }, props.reloadDelayMs == null ? 1500 : props.reloadDelayMs);
226
+ return;
227
+ }
228
+ if (Date.now() - started >= timeoutMs) { setPhase("slow"); return; }
229
+ timer = setTimeout(round, pollMs);
230
+ };
231
+ timer = setTimeout(round, pollMs);
232
+ return () => { alive = false; clearTimeout(timer); };
233
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
234
+ React.useEffect(() => { if (panel.current) panel.current.focus(); }, []);
235
+
236
+ const step = (done, active, text) => h("li", { className: `scalio-progress-step${done ? " is-done" : ""}${active ? " is-active" : ""}` },
237
+ done ? h(Icons.Check, { className: "scalio-icon" }) : active ? h("span", { className: "scalio-spinner", "aria-hidden": "true" }) : h("span", { className: "scalio-progress-dot" }),
238
+ h("span", null, text));
239
+ return h("div", { className: "scalio-wizard-root scalio-dialog-root" },
240
+ h("div", {
241
+ ref: panel, tabIndex: -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "scalio-update-progress-title",
242
+ "aria-busy": phase === "install" ? "true" : "false", className: "scalio-dialog", "data-testid": "saas-update-progress",
243
+ onKeyDown: (e) => { if (e.key === "Tab") trapTab(e, panel.current); else if (e.key === "Escape" && props.onClose) props.onClose(); },
244
+ },
245
+ h("h2", { id: "scalio-update-progress-title", className: "scalio-dialog-title" }, L.progressTitle),
246
+ h("p", { className: "scalio-dialog-text" }, fill(L.progressText, { version: props.version })),
247
+ h("ol", { className: "scalio-progress-steps", "aria-live": "polite" },
248
+ step(true, false, L.progressAsked),
249
+ step(phase !== "install", phase === "install", L.progressInstall),
250
+ phase === "done" ? step(true, false, fill(L.progressDone, { version: props.version })) : null),
251
+ phase === "slow" ? h("div", { className: "scalio-notice is-warn", role: "status" }, L.progressSlow) : null,
252
+ h("div", { className: "scalio-dialog-actions" },
253
+ props.onClose && phase !== "done"
254
+ ? h("button", { type: "button", className: "scalio-btn is-ghost", onClick: props.onClose, "data-testid": "saas-update-progress-close" }, L.progressClose)
255
+ : null,
256
+ phase === "slow"
257
+ ? h("button", { type: "button", className: "scalio-btn is-primary", onClick: reload, "data-testid": "saas-update-progress-reload" }, L.progressReload)
258
+ : null)));
259
+ }
260
+
174
261
  // Props: client (saasUpdatesApi), lang, labels, notify(message, tone), formatError(err).
175
262
  function SaasUpdatesPanel(props) {
176
263
  const L = labels(props.lang, props.labels);
@@ -180,6 +267,7 @@ function SaasUpdatesPanel(props) {
180
267
  const [error, setError] = React.useState("");
181
268
  const [until, setUntil] = React.useState("");
182
269
  const [win, setWin] = React.useState(EMPTY_WINDOW);
270
+ const [updating, setUpdating] = React.useState(null); // {version, from} while the progress dialog is open
183
271
 
184
272
  const take = (d) => {
185
273
  setSt(d);
@@ -194,15 +282,24 @@ function SaasUpdatesPanel(props) {
194
282
  const act = async (op, body) => {
195
283
  setBusy(true);
196
284
  setError("");
285
+ let ok = false;
197
286
  try {
198
287
  take(await props.client.act(op, body));
199
- if (props.notify) props.notify(L.saved, "ok");
288
+ if (props.notify && op !== "now") props.notify(L.saved, "ok");
289
+ ok = true;
200
290
  } catch (e) {
201
291
  const t = fmtErr(e);
202
292
  if (props.notify) props.notify(t, "error");
203
293
  setError(t);
204
294
  }
205
295
  setBusy(false);
296
+ return ok;
297
+ };
298
+ const updateNow = async (offer) => {
299
+ const yes = await askConfirm({ title: L.now, text: fill(L.nowConfirm, { version: offer.version }), confirmLabel: L.nowGo, lang: props.lang });
300
+ if (!yes) return;
301
+ const from = st && st.current_version;
302
+ if (await act("now")) setUpdating({ version: offer.version, from });
206
303
  };
207
304
 
208
305
  if (!st) return h(SettingsSection, { id: "updates", title: L.title, description: L.hint, testId: "saas-updates" },
@@ -228,7 +325,7 @@ function SaasUpdatesPanel(props) {
228
325
  if (!offer.forced) {
229
326
  rows.push(h("div", { key: "acts", className: "scalio-settings-section-footer" },
230
327
  h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy || offer.held, "data-testid": "saas-updates-now",
231
- onClick: () => { if (window.confirm(fill(L.nowConfirm, { version: offer.version }))) act("now"); } },
328
+ onClick: () => updateNow(offer) },
232
329
  h(Icons.Download, { className: "scalio-icon" }), L.now)));
233
330
  rows.push(h(Field, { key: "post", id: "saas-updates-until", label: L.postpone },
234
331
  h("div", { style: { display: "flex", gap: "0.5rem" } },
@@ -264,6 +361,11 @@ function SaasUpdatesPanel(props) {
264
361
  h("div", { className: "scalio-settings-text", "data-testid": "saas-updates-last" },
265
362
  fill(st.last.state === "done" ? L.lastDone : L.lastError, { version: st.last.version, at: when(st.last.at, props.lang) }))));
266
363
  if (error) rows.push(h("div", { key: "err", className: "scalio-notice is-error", role: "alert", "data-testid": "saas-updates-error" }, error));
364
+ if (updating) rows.push(h(UpdateProgress, {
365
+ key: "progress", version: updating.version, from: updating.from, lang: props.lang, labels: props.labels,
366
+ checkVersion: props.checkVersion, versionUrl: props.versionUrl, pollMs: props.pollMs, timeoutMs: props.timeoutMs,
367
+ reloadDelayMs: props.reloadDelayMs, reload: props.reload, onClose: () => setUpdating(null),
368
+ }));
267
369
  return h(SettingsSection, { id: "updates", title: L.title, description: L.hint, testId: "saas-updates" }, rows);
268
370
  }
269
371
 
@@ -271,4 +373,4 @@ function cxNotice(offer) {
271
373
  return `scalio-notice ${offer.kind === "security" ? "is-warn" : "is-info"}`;
272
374
  }
273
375
 
274
- module.exports = { UpdateBanner, SaasUpdatesPanel, saasUpdatesApi, SAAS_UPDATE_LABELS: LABELS };
376
+ module.exports = { UpdateBanner, SaasUpdatesPanel, UpdateProgress, saasUpdatesApi, SAAS_UPDATE_LABELS: LABELS };
package/react/security.js CHANGED
@@ -5,6 +5,7 @@
5
5
  // answers. Every change asks for the current password inline. No runtime dependencies: the app passes the QR
6
6
  // code renderer (`qr`) and the WebAuthn helpers from @simplewebauthn/browser.
7
7
  const React = require("react");
8
+ const { askConfirm } = require("./dialog");
8
9
  const h = React.createElement;
9
10
  const Icons = require("./icons");
10
11
  const { labelsFor } = require("./labels");
@@ -83,7 +84,7 @@ function securityApi(api, webauthn) {
83
84
 
84
85
  async function ask(confirm, title, action) {
85
86
  if (confirm) return !!(await confirm({ title, action, danger: true }));
86
- return typeof window !== "undefined" && window.confirm ? window.confirm(title) : true;
87
+ return askConfirm({ title, confirmLabel: action, danger: true });
87
88
  }
88
89
 
89
90
  function Field({ id, label, children }) {
package/react/support.js CHANGED
@@ -8,6 +8,7 @@
8
8
  // scalio_connect.support.ideas_web): ideas of this app with votes and comments, and "Idee vorschlagen" with similar
9
9
  // ideas shown while typing. The category "Wunsch" then leaves the ticket form.
10
10
  const React = require("react");
11
+ const { askConfirm } = require("./dialog");
11
12
  const h = React.createElement;
12
13
  const { labelsFor } = require("./labels");
13
14
 
@@ -553,7 +554,7 @@ function SupportConnection({ client, lang, labels, onChange }) {
553
554
  h("button", { type: "button", className: "scalio-btn", disabled: busy, "data-testid": "support-connection-check",
554
555
  onClick: () => run(() => client.check(), L.supportChecked) }, L.supportCheck),
555
556
  h("button", { type: "button", className: "scalio-btn scalio-btn-danger", disabled: busy, "data-testid": "support-connection-remove",
556
- onClick: () => (typeof window === "undefined" || window.confirm(L.supportRemoveConfirm)) && run(() => client.disconnect(), L.supportRemoved) },
557
+ onClick: async () => (await askConfirm({ text: L.supportRemoveConfirm, danger: true, lang })) && run(() => client.disconnect(), L.supportRemoved) },
557
558
  L.supportRemove)
558
559
  )
559
560
  : h(
package/react/tenant.js CHANGED
@@ -28,6 +28,24 @@ function takeConnectCode() {
28
28
  return decodeURIComponent(m[1]);
29
29
  }
30
30
 
31
+ // Several views can show the same tenant at once: back from «Scalio Setup» the wizard opens over the settings page.
32
+ // Only one of them takes the code, so whoever changes the connection announces it and every view reloads its state.
33
+ const TENANT_EVENT = "scalio:tenant-changed";
34
+ function announceTenantChange(detail) {
35
+ if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
36
+ window.dispatchEvent(new window.CustomEvent(TENANT_EVENT, { detail: detail || {} }));
37
+ }
38
+ function useTenantChange(onChange) {
39
+ const ref = React.useRef(onChange);
40
+ ref.current = onChange;
41
+ React.useEffect(() => {
42
+ if (typeof window === "undefined" || typeof window.addEventListener !== "function") return undefined;
43
+ const fn = (e) => ref.current && ref.current(e.detail || {});
44
+ window.addEventListener(TENANT_EVENT, fn);
45
+ return () => window.removeEventListener(TENANT_EVENT, fn);
46
+ }, []);
47
+ }
48
+
31
49
  function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, showLater = true }) {
32
50
  const L = labelsFor(lang, labels);
33
51
  const [st, setSt] = React.useState(null);
@@ -40,6 +58,8 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
40
58
  () => client.status().then((d) => (setSt(d || {}), d)).catch((err) => (setError(errorText(err)), setSt({}))),
41
59
  [client]
42
60
  );
61
+ const self = React.useRef({});
62
+ useTenantChange((d) => { if (d.from !== self.current) load(); });
43
63
  const run = async (kind, fn, ok) => {
44
64
  setBusy(kind);
45
65
  setError("");
@@ -53,6 +73,7 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
53
73
  setBusy("");
54
74
  }
55
75
  const d = await load();
76
+ if (kind !== "link" && kind !== "script") announceTenantChange({ from: self.current });
56
77
  if (onChange) onChange(d);
57
78
  };
58
79
  const redeem = (value) => run("code", async () => {
@@ -131,4 +152,4 @@ function TenantConnectStep({ client, app = "Scalio", lang, labels, onChange, sho
131
152
  );
132
153
  }
133
154
 
134
- module.exports = { TenantConnectStep, takeConnectCode };
155
+ module.exports = { TenantConnectStep, takeConnectCode, announceTenantChange, useTenantChange, TENANT_EVENT };
package/react/users.js CHANGED
@@ -5,6 +5,7 @@
5
5
  // account, the actions (start password, second factor, Microsoft link, lock, delete) and approving or merging a
6
6
  // waiting Microsoft account. MicrosoftConnection is the profile card to link one's own Microsoft account.
7
7
  const React = require("react");
8
+ const { askConfirm } = require("./dialog");
8
9
  const h = React.createElement;
9
10
  const Icons = require("./icons");
10
11
  const { labelsFor } = require("./labels");
@@ -93,7 +94,7 @@ function usersApi(api, opts) {
93
94
 
94
95
  async function ask(confirm, title, text, action, danger) {
95
96
  if (confirm) return !!(await confirm({ title, text, action, danger: danger !== false }));
96
- return typeof window !== "undefined" && window.confirm ? window.confirm(title) : true;
97
+ return askConfirm({ title, text, confirmLabel: action, danger: danger !== false });
97
98
  }
98
99
 
99
100
  function Field({ id, label, hint, children }) {
package/react/wizard.js CHANGED
@@ -100,6 +100,35 @@ function useSetupWizard(opts) {
100
100
  return { state, open, setOpen, step, setStep, reload, props };
101
101
  }
102
102
 
103
+ const FIELDS = 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled])';
104
+ const FOCUSABLE = 'a[href], button:not([disabled]), input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
105
+
106
+ // Enter means Weiter unless the element has its own Enter: a button or link, a multi-line field, a select, an
107
+ // editable area, or a field inside its own form (e.g. «Verbindungscode einfügen» submits that form).
108
+ function enterMeansNext(el) {
109
+ if (!el || !el.tagName) return true;
110
+ const tag = el.tagName.toLowerCase();
111
+ if (tag === "button" || tag === "a" || tag === "textarea" || tag === "select" || tag === "summary") return false;
112
+ if (el.isContentEditable) return false;
113
+ if (tag === "input" && /^(button|submit|reset|checkbox|radio|file|color|range)$/i.test(el.type || "")) return false;
114
+ if (el.closest && el.closest("form")) return false;
115
+ const role = el.getAttribute && el.getAttribute("role");
116
+ if (role && /^(button|link|combobox|listbox|option|menuitem|tab|switch|checkbox|radio)$/.test(role)) return false;
117
+ return true;
118
+ }
119
+
120
+ // Tab from the last element goes to the first and Shift+Tab back, so the focus never leaves the open wizard.
121
+ function trapTab(e, root) {
122
+ if (!root) return;
123
+ const items = [...root.querySelectorAll(FOCUSABLE)].filter((n) => !n.closest("[hidden]"));
124
+ if (items.length === 0) return;
125
+ const first = items[0];
126
+ const last = items[items.length - 1];
127
+ const at = document.activeElement;
128
+ if (e.shiftKey && (at === first || at === root)) { e.preventDefault(); last.focus(); }
129
+ else if (!e.shiftKey && at === last) { e.preventDefault(); first.focus(); }
130
+ }
131
+
103
132
  function StepDot({ index, current }) {
104
133
  const cls = index < current ? "is-done" : index === current ? "is-current" : "";
105
134
  return h("span", { className: `scalio-wizard-dot ${cls}`.trim() }, index < current ? h(Icons.Check, { width: 14, height: 14 }) : index + 1);
@@ -130,6 +159,22 @@ function SetupWizard(props) {
130
159
  return () => window.removeEventListener("keydown", onKey);
131
160
  }, [open, onClose, busy]);
132
161
 
162
+ // Keyboard (Markus 2026-11-07): focus moves into each new step (first field, else Weiter), Tab stays inside.
163
+ const panel = React.useRef(null);
164
+ React.useEffect(() => {
165
+ if (!open || !panel.current) return undefined;
166
+ const before = document.activeElement;
167
+ return () => { if (before && typeof before.focus === "function" && document.contains(before)) before.focus(); };
168
+ }, [open]);
169
+ React.useEffect(() => {
170
+ const root = panel.current;
171
+ if (!open || !root) return;
172
+ if (finished) return; // the success view focuses «Fertig» itself
173
+ const field = root.querySelector(`[data-wizard-step] ${FIELDS}`);
174
+ const target = field || root.querySelector('[data-testid="wizard-next"]:not([disabled])') || root;
175
+ if (target && typeof target.focus === "function") target.focus();
176
+ }, [open, index, finished]);
177
+
133
178
  if (!open || !current) return null;
134
179
 
135
180
  async function next(save) {
@@ -178,6 +223,9 @@ function SetupWizard(props) {
178
223
  : h(
179
224
  React.Fragment,
180
225
  null,
226
+ h(
227
+ "div",
228
+ { className: "scalio-wizard-body", "data-testid": "wizard-body" },
181
229
  h(
182
230
  "ol",
183
231
  { className: "scalio-wizard-stepper", "data-testid": "wizard-stepper" },
@@ -194,16 +242,17 @@ function SetupWizard(props) {
194
242
  h("p", { className: "scalio-wizard-count" }, L.step.replace("{n}", String(index + 1)).replace("{total}", String(list.length))),
195
243
  h(
196
244
  "section",
197
- { className: "scalio-wizard-step", "data-testid": `wizard-step-${current.id}` },
245
+ { className: "scalio-wizard-step", "data-testid": `wizard-step-${current.id}`, "data-wizard-step": "" },
198
246
  h("div", null,
199
247
  h("h3", { className: "scalio-wizard-step-title" }, current.title),
200
248
  current.description ? h("p", { className: "scalio-wizard-text" }, current.description) : null),
201
249
  current.content
202
250
  ),
203
- error ? h(Notice, { kind: "error", icon: false, testId: "wizard-error", lang: props.lang }, error) : null,
251
+ error ? h(Notice, { kind: "error", icon: false, testId: "wizard-error", lang: props.lang }, error) : null
252
+ ),
204
253
  h(
205
254
  "div",
206
- { className: "scalio-wizard-actions" },
255
+ { className: "scalio-wizard-actions", "data-testid": "wizard-actions" },
207
256
  left
208
257
  ? h("button", { type: "button", className: "scalio-btn", onClick: left.onClick, disabled: busy, "data-testid": "wizard-back" }, left.label)
209
258
  : h("span", null),
@@ -215,7 +264,7 @@ function SetupWizard(props) {
215
264
  : null,
216
265
  h(
217
266
  "button",
218
- { type: "button", className: "scalio-btn is-primary", onClick: () => next(true), disabled: busy || current.canNext === false, "data-testid": "wizard-next" },
267
+ { type: "button", className: "scalio-btn is-primary", onClick: () => next(true), disabled: busy || current.canNext === false, "data-testid": "wizard-next", "aria-keyshortcuts": "Enter" },
219
268
  busy ? h("span", { className: "scalio-spinner", "aria-hidden": "true" }) : null,
220
269
  last ? L.finish : L.next
221
270
  )
@@ -223,10 +272,24 @@ function SetupWizard(props) {
223
272
  )
224
273
  );
225
274
 
275
+ function onKeyDown(e) {
276
+ if (e.key === "Tab") return trapTab(e, panel.current);
277
+ if (e.key !== "Enter" || finished || busy || e.defaultPrevented || e.isComposing) return;
278
+ if (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) return;
279
+ if (!enterMeansNext(e.target)) return;
280
+ if (current.canNext === false) return;
281
+ e.preventDefault();
282
+ next(true);
283
+ }
284
+
226
285
  return h(
227
286
  "div",
228
287
  { className: "scalio-wizard-root", onMouseDown: (e) => { if (e.target === e.currentTarget && !busy && onClose) onClose(); } },
229
- h("div", { role: "dialog", "aria-modal": "true", "aria-label": title, className: wide ? "scalio-wizard is-wide" : "scalio-wizard", "data-testid": testId || "setup-wizard" }, head, body)
288
+ h("div", {
289
+ ref: panel, tabIndex: -1, onKeyDown,
290
+ role: "dialog", "aria-modal": "true", "aria-label": title,
291
+ className: wide ? "scalio-wizard is-wide" : "scalio-wizard", "data-testid": testId || "setup-wizard",
292
+ }, head, body)
230
293
  );
231
294
  }
232
295
 
@@ -236,4 +299,4 @@ function SetupWizardButton({ lang, labels, testId, className }) {
236
299
  return h("button", { type: "button", className: className || "scalio-btn", onClick: () => openSetupWizard(0), "data-testid": testId || "settings-open-wizard", title: L.openHint }, L.open);
237
300
  }
238
301
 
239
- module.exports = { SetupWizard, SetupWizardButton, useSetupWizard, setupWizardApi, normalizeWizardState, openSetupWizard, OPEN_SETUP_WIZARD };
302
+ module.exports = { SetupWizard, SetupWizardButton, useSetupWizard, setupWizardApi, normalizeWizardState, openSetupWizard, OPEN_SETUP_WIZARD, enterMeansNext, trapTab };