@scalio-cloud/ui 0.105.0 → 0.105.2

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.
@@ -9,6 +9,9 @@
9
9
  # in nginx.conf, DIR/dbip-country.mmdb (from geoip-db.sh) to /etc/nginx/geoip/
10
10
  #
11
11
  # SCALIO_GEOIP2_VERSION version of leev/ngx_http_geoip2_module, default below
12
+ # SCALIO_GEOIP2_SHA256 SHA-256 of that version's tarball, needed for a version not pinned below
13
+ #
14
+ # Every download is checked against a pinned SHA-256 before it is unpacked (BL-1081); a mismatch aborts the build.
12
15
  # SCALIO_NGINX_DIR, SCALIO_MODULES_DIR, SCALIO_SKIP_PACKAGES for tests (other paths, no apk/apt)
13
16
  set -eu
14
17
 
@@ -21,6 +24,34 @@ SO=ngx_http_geoip2_module.so
21
24
 
22
25
  log() { echo "scalio-geoip: $*" >&2; }
23
26
 
27
+ # Pinned SHA-256 of the downloaded tarballs. Source: values computed from the tarballs downloaded on 2026-12-03,
28
+ # module: https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/<version>.tar.gz,
29
+ # nginx: https://nginx.org/download/nginx-<version>.tar.gz (the installed nginx of nginx:1.27-alpine/-debian).
30
+ # A new version needs its hash added here (download it, `sha256sum` it, check it against the upstream release).
31
+ module_sha256() {
32
+ case "$1" in
33
+ 3.4) echo ad72fc23348d715a330994984531fab9b3606e160483236737f9a4a6957d9452 ;;
34
+ *) echo "${SCALIO_GEOIP2_SHA256:-}" ;;
35
+ esac
36
+ }
37
+ nginx_sha256() {
38
+ case "$1" in
39
+ 1.27.0) echo b7230e3cf87eaa2d4b0bc56aadc920a960c7873b9991a1b66ffcc08fc650129c ;;
40
+ 1.27.1) echo bd7ba68a6ce1ea3768b771c7e2ab4955a59fb1b1ae8d554fedb6c2304104bdfc ;;
41
+ 1.27.2) echo a91ecfc3a0b3a2c1413afca627bd886d76e0414b81cad0fb7872a9655a1b25fa ;;
42
+ 1.27.3) echo ba23a9568f442036b61cd0e29bd66a47b90634efa91e0b2cf2d719057a9b7903 ;;
43
+ 1.27.4) echo 294816f879b300e621fa4edd5353dd1ec00badb056399eceb30de7db64b753b2 ;;
44
+ 1.27.5) echo e96acebb9c2a6db8a000c3dd1b32ecba1b810f0cd586232d4d921e376674dd0e ;;
45
+ esac
46
+ }
47
+
48
+ # fetch URL SHA256 FILE: download, verify with sha256sum -c, only then is the file used (abort on mismatch)
49
+ fetch() {
50
+ [ -n "$2" ] || { log "no pinned SHA-256 for $1: add it to geoip-module.sh (or SCALIO_GEOIP2_SHA256)"; exit 1; }
51
+ curl -fsSL -o "$3" "$1"
52
+ echo "$2 $3" | sha256sum -c - >/dev/null 2>&1 || { log "SHA-256 mismatch for $1 (expected $2), aborting"; exit 1; }
53
+ }
54
+
24
55
  pkg_install() {
25
56
  [ -z "${SCALIO_SKIP_PACKAGES:-}" ] || return 0
26
57
  if command -v apk >/dev/null 2>&1; then apk add --no-cache "$@"
@@ -30,6 +61,8 @@ pkg_install() {
30
61
 
31
62
  case "$CMD" in
32
63
  build)
64
+ MODSHA=$(module_sha256 "$MODVER")
65
+ [ -n "$MODSHA" ] || { log "no pinned SHA-256 for ngx_http_geoip2_module $MODVER: add it to geoip-module.sh (or set SCALIO_GEOIP2_SHA256)"; exit 1; }
33
66
  if command -v apk >/dev/null 2>&1; then
34
67
  pkg_install build-base linux-headers pcre2-dev zlib-dev openssl-dev libmaxminddb-dev curl
35
68
  else
@@ -37,10 +70,13 @@ case "$CMD" in
37
70
  fi
38
71
  NGXVER=$(nginx -v 2>&1 | sed 's|.*nginx/||; s| .*||')
39
72
  [ -n "$NGXVER" ] || { log "cannot read the nginx version (nginx -v)"; exit 1; }
73
+ NGXSHA=$(nginx_sha256 "$NGXVER")
40
74
  log "building ngx_http_geoip2_module $MODVER for nginx $NGXVER"
41
75
  W=$(mktemp -d); trap 'rm -rf "$W"' EXIT
42
- curl -fsSL "https://nginx.org/download/nginx-$NGXVER.tar.gz" | tar xz -C "$W"
43
- curl -fsSL "https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/$MODVER.tar.gz" | tar xz -C "$W"
76
+ fetch "https://nginx.org/download/nginx-$NGXVER.tar.gz" "$NGXSHA" "$W/nginx.tar.gz"
77
+ fetch "https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/$MODVER.tar.gz" "$MODSHA" "$W/module.tar.gz"
78
+ tar xzf "$W/nginx.tar.gz" -C "$W"
79
+ tar xzf "$W/module.tar.gz" -C "$W"
44
80
  # The module must be compiled with the flags of the installed nginx, --with-compat keeps the binary interface.
45
81
  ( cd "$W/nginx-$NGXVER" && ./configure --with-compat --add-dynamic-module="$W/ngx_http_geoip2_module-$MODVER" >/dev/null && make modules >/dev/null )
46
82
  mkdir -p "$DIR"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.105.0",
3
+ "version": "0.105.2",
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/blocks.d.ts CHANGED
@@ -1,11 +1,21 @@
1
1
  // Types for react/blocks.js (written by hand, no build step).
2
2
  import type * as React from "react";
3
- import type { Props, ScalioComponent } from "./types";
3
+ import type { Props, ScalioComponent, Lang, LabelOverrides, IconComponent, Tone, NoticeKindName } from "./types";
4
4
 
5
- export declare const KpiTile: ScalioComponent<{ label?: any; value?: any; hint?: any; tone?: any; onClick?: any; testId?: any; }>;
5
+ export declare const KpiTile: ScalioComponent<{ label: React.ReactNode; value: React.ReactNode; hint?: React.ReactNode; tone?: Tone; onClick?: () => void; testId?: string; }>;
6
6
  export declare const EmptyState: ScalioComponent<{ text?: any; children?: React.ReactNode; lang?: any; labels?: any; testId?: any; }>;
7
7
  export declare const Loading: ScalioComponent<{ label?: any; lang?: any; labels?: any; testId?: any; }>;
8
- export declare const Notice: ScalioComponent<{ kind?: any; title?: any; children?: React.ReactNode; action?: any; onDismiss?: any; dismissLabel?: any; banner?: any; icon?: any; lang?: any; labels?: any; testId?: any; }>;
8
+ export declare const Notice: ScalioComponent<{
9
+ kind?: NoticeKindName; title?: React.ReactNode; children?: React.ReactNode;
10
+ /** A link (href) or a button (onClick). */
11
+ action?: { label: React.ReactNode; href?: string; onClick?: () => void; testId?: string };
12
+ /** Shows the dismiss button when set. */
13
+ onDismiss?: () => void; dismissLabel?: React.ReactNode;
14
+ banner?: boolean;
15
+ /** An icon component, or false for none. */
16
+ icon?: IconComponent | false;
17
+ lang?: Lang; labels?: LabelOverrides; testId?: string;
18
+ }>;
9
19
  export declare const noticeKind: (kind?: any) => any;
10
20
  export declare const StatusBadge: ScalioComponent<{ tone?: any; children?: React.ReactNode; testId?: any; }>;
11
21
  export declare const TONES: readonly (string)[];
package/react/index.d.ts CHANGED
@@ -1,10 +1,25 @@
1
1
  // Types for react/index.js (the shared app shell; written by hand, no build step).
2
2
  import type * as React from "react";
3
- import type { Props, ScalioComponent } from "./types";
3
+ import type { Props, ScalioComponent, Lang, LabelOverrides, ThemeMode, HeaderBrand, HeaderTestIds, MenuEntry, ShellUser } from "./types";
4
4
 
5
5
  import type * as IconSet from "./icons";
6
6
 
7
- export declare const AppHeader: ScalioComponent<{ lang?: any; labels?: any; testIds?: any; className?: any; testId?: any; onMenu?: any; brand?: any; left?: any; actions?: any; status?: any; onLangChange?: any; theme?: any; onThemeChange?: any; themeModes?: any; docsUrl?: any; onSupport?: any; user?: any; menuItems?: any; onLogout?: any; [key: string]: any; }>;
7
+ export declare const AppHeader: ScalioComponent<{
8
+ lang?: Lang; labels?: LabelOverrides; testIds?: HeaderTestIds; className?: string; testId?: string;
9
+ /** Shows the menu button on small screens. */
10
+ onMenu?: () => void;
11
+ brand?: HeaderBrand; left?: React.ReactNode; actions?: React.ReactNode; status?: React.ReactNode;
12
+ /** Shows the language toggle when set. */
13
+ onLangChange?: (lang: "de" | "en") => void;
14
+ theme?: ThemeMode;
15
+ /** Shows the theme toggle when set. */
16
+ onThemeChange?: (theme: ThemeMode) => void;
17
+ /** Default ["light", "dark"]; with "system" the toggle becomes a menu. */
18
+ themeModes?: readonly ThemeMode[];
19
+ docsUrl?: string; onSupport?: () => void;
20
+ /** No user: no user menu. */
21
+ user?: ShellUser | null | false; menuItems?: readonly MenuEntry[]; onLogout?: () => void;
22
+ }>;
8
23
  export declare const BetaBadge: ScalioComponent<{ lang?: any; labels?: any; testId?: any; className?: any; }>;
9
24
  export declare const UserMenu: ScalioComponent<{ user?: any; items?: any; onLogout?: any; lang?: any; labels?: any; testIds?: any; defaultOpen?: any; }>;
10
25
  export declare const LanguageToggle: ScalioComponent<{ lang?: any; onChange?: any; labels?: any; testId?: any; }>;
@@ -13,7 +28,7 @@ export declare const SupportButton: ScalioComponent<{ onClick?: any; lang?: any;
13
28
  export declare const DocsButton: ScalioComponent<{ href?: any; lang?: any; labels?: any; testId?: any; }>;
14
29
  export declare const manualUrl: (product?: any, opts?: any) => any;
15
30
  export declare const DOCS_DOMAINS: { readonly nexus: string; readonly citadel: string; readonly foundry: string; readonly rosetta: string; readonly beacon: string; readonly pulse: string; readonly folio: string; };
16
- export declare const PageHeader: ScalioComponent<{ eyebrow?: any; title?: any; subtitle?: any; actions?: any; children?: React.ReactNode; back?: any; testId?: any; }>;
31
+ export declare const PageHeader: ScalioComponent<{ eyebrow?: React.ReactNode; title: React.ReactNode; subtitle?: React.ReactNode; actions?: React.ReactNode; children?: React.ReactNode; back?: React.ReactNode; testId?: string; }>;
17
32
  export declare const TEST_IDS: { readonly menu: string; readonly language: string; readonly theme: string; readonly docs: string; readonly support: string; readonly avatar: string; readonly userName: string; readonly userEmail: string; readonly userRole: string; readonly logout: string; };
18
33
  export declare const initials: (user?: any) => any;
19
34
  export declare const Icons: typeof IconSet;
package/react/login.d.ts CHANGED
@@ -1,7 +1,30 @@
1
1
  // Types for react/login.js (written by hand, no build step).
2
2
  import type * as React from "react";
3
- import type { Props, ScalioComponent } from "./types";
3
+ import type { Props, ScalioComponent, Lang, ApiClient, AuthResult } from "./types";
4
4
 
5
- export declare const LoginPage: ScalioComponent<{ endpoints?: any; assign?: any; errorText?: any; location?: any; [key: string]: any; }>;
5
+ export declare const LoginPage: ScalioComponent<{
6
+ api: ApiClient; apiBase?: string;
7
+ auth: {
8
+ user?: any;
9
+ login: (email: string, password: string) => Promise<AuthResult | undefined> | AuthResult | undefined;
10
+ loginMfa: (mfaToken: string, code: string) => Promise<AuthResult | undefined> | AuthResult | undefined;
11
+ loginPasskey: () => Promise<AuthResult | undefined> | AuthResult | undefined;
12
+ loginScalio: (handoff: string) => Promise<AuthResult | undefined> | AuthResult | undefined;
13
+ setup: (name: string, email: string, password: string, setupCode: string) => Promise<AuthResult | undefined> | AuthResult | undefined;
14
+ };
15
+ brand: { mark?: React.ReactNode; name: string; eyebrow?: React.ReactNode; claim?: React.ReactNode; features?: readonly React.ReactNode[]; color?: string; beta?: boolean };
16
+ appName?: string; lang?: Lang; onLangChange?: (lang: "de" | "en") => void; legalUrl?: string; passkeys?: boolean;
17
+ /** Called with auth.user once it is set; the app navigates. */
18
+ onSignedIn?: (user: any) => void;
19
+ forgotPassword?: { href?: string; onClick?: () => void };
20
+ /** Answers for an error code the shared texts do not know. */
21
+ errorText?: (code: string) => string | undefined;
22
+ /** Routes that differ from LOGIN_ENDPOINTS. */
23
+ endpoints?: Partial<Record<"setupStatus" | "loginPolicy" | "demo" | "microsoftStatus" | "microsoftLogin" | "setupMicrosoft", string>>;
24
+ /** Replaces window.location.assign for full-page redirects. */
25
+ assign?: (url: string) => void;
26
+ location?: { search?: string; hash?: string; pathname?: string };
27
+ testIds?: Partial<Record<string, string>>;
28
+ }>;
6
29
  export declare const LOGIN_ENDPOINTS: { readonly setupStatus: string; readonly loginPolicy: string; readonly demo: string; readonly microsoftStatus: string; readonly microsoftLogin: string; readonly setupMicrosoft: string; };
7
30
  export declare const readArrival: (loc?: any) => any;
package/react/nav.d.ts CHANGED
@@ -6,7 +6,14 @@ export declare const VersionTag: ScalioComponent<{ version?: any; commit?: any;
6
6
  export declare const Sidebar: ScalioComponent<Props>;
7
7
  export declare const NavItem: ScalioComponent<{ item?: any; link?: any; activePath?: any; onNavigate?: any; testIdPrefix?: any; }>;
8
8
  export declare const NavDrawer: ScalioComponent<{ open?: any; onClose?: any; children?: React.ReactNode; lang?: any; labels?: any; testId?: any; }>;
9
- export declare const SubNav: ScalioComponent<{ items?: any; link?: any; activePath?: any; label?: any; testId?: any; value?: any; onSelect?: any; }>;
9
+ export declare const SubNav: ScalioComponent<{
10
+ /** Fewer than two visible items: renders nothing. Link tabs have `to`, in-page tabs (with onSelect) have `id`. */
11
+ items: readonly { to?: string; id?: string; label: React.ReactNode; end?: boolean; badge?: React.ReactNode; hidden?: boolean; testId?: string }[];
12
+ /** Router link component (gets to, end, className as function, data-testid). */
13
+ link?: React.ElementType; activePath?: string; label?: string; testId?: string;
14
+ /** Id of the active in-page tab. */
15
+ value?: string; onSelect?: (id: string) => void;
16
+ }>;
10
17
  export declare const WorkspaceSwitcher: ScalioComponent<{ options?: any; value?: any; onSelect?: any; testIdPrefix?: any; testId?: any; }>;
11
18
  export declare const AppShell: ScalioComponent<{ switcher?: any; header?: any; banner?: any; sidebar?: any; children?: React.ReactNode; drawerOpen?: any; onDrawerClose?: any; drawerTop?: any; legalUrl?: any; lang?: any; labels?: any; testId?: any; }>;
12
19
  export declare const ContextSelect: ScalioComponent<{ label?: any; value?: any; options?: any; onChange?: any; hint?: any; after?: any; testId?: any; id?: any; }>;
@@ -1,5 +1,46 @@
1
1
  // Types for react/session.js (written by hand, no build step).
2
2
  import type * as React from "react";
3
- import type { Props, ScalioComponent } from "./types";
3
+ import type { Props, ScalioComponent, ApiClient, AuthResult } from "./types";
4
4
 
5
- export declare const createAuth: (opts?: any) => any;
5
+ /** What useAuth() returns. `user` is null while checking, false when signed out, else the /auth/me answer. */
6
+ export type AuthState = {
7
+ user: null | false | { name?: string; email?: string; role?: string; timezone?: string; [key: string]: any };
8
+ ready: boolean;
9
+ login: (email: string, password: string) => Promise<AuthResult>;
10
+ loginMfa: (mfaToken: string, code: string) => Promise<AuthResult>;
11
+ loginPasskey: () => Promise<AuthResult>;
12
+ loginScalio: (code: string) => Promise<AuthResult>;
13
+ register: (name: string, email: string, password: string) => Promise<AuthResult>;
14
+ setup: (name: string, email: string, password: string, setupCode: string) => Promise<AuthResult>;
15
+ logout: () => Promise<void>;
16
+ updateUser: (user: any) => void;
17
+ /** The page signed in by itself: keeps the user and tells onSignedIn(true). */
18
+ loginWith: (user: any) => void;
19
+ /** Reloads /auth/me and answers the user (throws when the call fails). */
20
+ refresh: () => Promise<any>;
21
+ };
22
+
23
+ export declare const createAuth: (opts: {
24
+ api: ApiClient;
25
+ /** Turns the `detail` of an error answer into text. */
26
+ formatError?: (detail: any) => string;
27
+ /** Resolves to { user } (the passkey answer of the backend). */
28
+ signInWithPasskey?: () => Promise<{ user?: any }>;
29
+ /** True when the user cancelled the passkey dialog (no error text then). */
30
+ passkeyCancelled?: (error: unknown) => boolean;
31
+ /** localStorage key of an older token, removed on start. */
32
+ legacyTokenKey?: string;
33
+ /** Awaited before /auth/me (e.g. redeem a one-time code). Errors are ignored. */
34
+ bootstrap?: (api: ApiClient) => void | Promise<void>;
35
+ /** Called when /auth/me refuses. Answer true after navigating away (hub redirect): the provider then stays loading. */
36
+ onNoSession?: (api: ApiClient) => boolean | void | Promise<boolean | void>;
37
+ /** Every change of the signed-in state. */
38
+ onSignedIn?: (signedIn: boolean) => void;
39
+ /** The window event "auth:unauthorized" while a user was signed in (e.g. show a toast). The user is signed out afterwards. */
40
+ onUnauthorized?: (previousUser: any) => void;
41
+ }) => {
42
+ AuthProvider: ScalioComponent<{ children?: React.ReactNode }>;
43
+ /** Outside the AuthProvider the context is null at run time. */
44
+ useAuth: () => AuthState;
45
+ AuthContext: React.Context<AuthState | null>;
46
+ };
package/react/session.js CHANGED
@@ -6,6 +6,14 @@
6
6
  // { user, ready, login, loginMfa, loginPasskey, loginScalio, register, setup, logout, updateUser }:
7
7
  // user is null while checking, false when signed out, else /api/auth/me. Every action answers { ok, error?, status? };
8
8
  // login with an authenticator app answers { ok: false, mfaToken } and the page asks for the code.
9
+ // It also has loginWith(user) (the page already signed in) and refresh() (reloads /auth/me, answers the user).
10
+ // Optional hooks (Compass: SSO hub, toast, request guard):
11
+ // bootstrap(api) awaited before /auth/me (e.g. redeem a one-time code); errors are ignored.
12
+ // onNoSession(api) called when /auth/me refuses; answer true when it navigated away (hub redirect),
13
+ // the provider then stays loading (ready false, user null).
14
+ // onSignedIn(bool) every change of the signed-in state (start, sign-in, loginWith, logout, unauthorized).
15
+ // onUnauthorized(prev) the window event "auth:unauthorized" (401 of the api client): signs out locally,
16
+ // calls the hook with the previous user (only when there was one).
9
17
  const React = require("react");
10
18
  const { setUserTimezone } = require("./profile");
11
19
 
@@ -17,6 +25,9 @@ function createAuth(opts) {
17
25
  function AuthProvider(props) {
18
26
  const [user, setUser] = React.useState(null); // null = checking
19
27
  const [ready, setReady] = React.useState(false);
28
+ const userRef = React.useRef(null);
29
+ userRef.current = user;
30
+ const notify = (v) => { if (opts.onSignedIn) opts.onSignedIn(v); };
20
31
 
21
32
  React.useEffect(() => {
22
33
  if (opts.legacyTokenKey) {
@@ -26,14 +37,42 @@ function createAuth(opts) {
26
37
  /* private mode */
27
38
  }
28
39
  }
29
- api
30
- .get("/auth/me")
31
- .then((r) => setUser(r.data))
32
- .catch(() => setUser(false))
33
- .finally(() => setReady(true));
40
+ (async () => {
41
+ if (opts.bootstrap) {
42
+ try { await opts.bootstrap(api); } catch (e) { /* e.g. expired code: continue signed out */ }
43
+ }
44
+ let me = null;
45
+ try { me = (await api.get("/auth/me")).data; } catch (e) { me = null; }
46
+ if (me) {
47
+ notify(true);
48
+ setUser(me);
49
+ } else {
50
+ let away = false;
51
+ if (opts.onNoSession) {
52
+ try { away = !!(await opts.onNoSession(api)); } catch (e) { away = false; }
53
+ }
54
+ if (away) return; // navigating away: keep loading
55
+ notify(false);
56
+ setUser(false);
57
+ }
58
+ setReady(true);
59
+ })();
60
+ }, []);
61
+
62
+ React.useEffect(() => {
63
+ if (!opts.onUnauthorized && !opts.onSignedIn) return undefined;
64
+ const handler = () => {
65
+ const prev = userRef.current;
66
+ if (opts.onUnauthorized && prev) opts.onUnauthorized(prev);
67
+ notify(false);
68
+ setUser(false);
69
+ };
70
+ window.addEventListener("auth:unauthorized", handler);
71
+ return () => window.removeEventListener("auth:unauthorized", handler);
34
72
  }, []);
35
73
 
36
74
  const signedIn = (data) => {
75
+ notify(true);
37
76
  setUser(data.user);
38
77
  // /auth/me adds the permissions of the role (own roles).
39
78
  api.get("/auth/me").then((r) => setUser(r.data)).catch(() => null);
@@ -74,6 +113,13 @@ function createAuth(opts) {
74
113
  attempt(async () => signedIn((await api.post("/auth/setup", { name, email, password, setup_code })).data));
75
114
  // Profile page: new name. After a password change the backend sets the new cookie itself.
76
115
  const updateUser = (u) => setUser(u);
116
+ // The page signed in by itself (answer of its own call): only keep the user.
117
+ const loginWith = (u) => { notify(true); setUser(u); };
118
+ const refresh = async () => {
119
+ const r = await api.get("/auth/me");
120
+ setUser(r.data);
121
+ return r.data;
122
+ };
77
123
  // Signs out at the server (the cookie is removed there), then locally even if the call fails.
78
124
  const logout = async () => {
79
125
  try {
@@ -81,13 +127,14 @@ function createAuth(opts) {
81
127
  } catch (e) {
82
128
  /* already signed out */
83
129
  }
130
+ notify(false);
84
131
  setUser(false);
85
132
  };
86
133
 
87
134
  // Times everywhere follow the profile time zone; set before the children render.
88
135
  setUserTimezone(user ? user.timezone : "");
89
136
 
90
- const value = { user, ready, login, loginMfa, loginPasskey, loginScalio, register, setup, logout, updateUser };
137
+ const value = { user, ready, login, loginMfa, loginPasskey, loginScalio, register, setup, logout, updateUser, loginWith, refresh };
91
138
  return React.createElement(AuthContext.Provider, { value }, props.children);
92
139
  }
93
140
 
package/react/types.d.ts CHANGED
@@ -7,3 +7,45 @@ export type Props = { [key: string]: any };
7
7
 
8
8
  /** A function component of this package (React.createElement, no JSX). */
9
9
  export type ScalioComponent<P = Props> = (props: P & { key?: React.Key | null }) => React.ReactNode;
10
+
11
+ /** Language of the texts. Apps hold it as a string; anything but "en" shows German. */
12
+ export type Lang = "de" | "en" | (string & {});
13
+
14
+ /** Text overrides, same shape as an entry of LABELS (see labels.d.ts). */
15
+ export type LabelOverrides = Record<string, any>;
16
+
17
+ /** Theme choice of an app. The toggle offers the modes in `themeModes` (default light and dark). */
18
+ export type ThemeMode = "light" | "dark" | "system";
19
+
20
+ /** An icon component: ones of this package (Icons.*) or any other (e.g. lucide). It gets className. */
21
+ export type IconComponent = React.ElementType;
22
+
23
+ /** The signed-in user as the shell shows it (the app's /auth/me answer carries more). */
24
+ export type ShellUser = { name?: string; email?: string; role?: string; [key: string]: any };
25
+
26
+ /** Brand of the header: an element, or { mark, name, ... }. */
27
+ export type HeaderBrand = React.ReactElement | {
28
+ mark?: React.ReactNode; name?: React.ReactNode; sub?: React.ReactNode; color?: string; beta?: boolean;
29
+ badges?: React.ReactNode; href?: string; onClick?: (event: React.MouseEvent) => void;
30
+ };
31
+
32
+ /** Entry of the user menu (the logout entry is added by `onLogout`). */
33
+ export type MenuEntry = { label: React.ReactNode; icon?: IconComponent; onSelect?: () => void; danger?: boolean; testId?: string };
34
+
35
+ /** Test ids the header lets the app replace. */
36
+ export type HeaderTestIds = Partial<Record<"menu" | "language" | "theme" | "docs" | "support" | "avatar" | "userName" | "userEmail" | "userRole" | "logout", string>>;
37
+
38
+ /** Tones of KpiTile and StatusBadge. */
39
+ export type Tone = "neutral" | "running" | "ok" | "warn" | "error";
40
+
41
+ /** Kinds of Notice; success, action and important are aliases of ok, info and warn. */
42
+ export type NoticeKindName = "info" | "action" | "ok" | "success" | "warn" | "important" | "error";
43
+
44
+ /** Axios-like client of the app: resolves to { data }. */
45
+ export type ApiClient = {
46
+ get(path: string, ...rest: any[]): Promise<{ data: any }>;
47
+ post(path: string, body?: any, ...rest: any[]): Promise<{ data: any }>;
48
+ };
49
+
50
+ /** Answer of every sign-in action. */
51
+ export type AuthResult = { ok: boolean; error?: string; status?: number; mfaToken?: string };