@dloizides/ui-feedback 1.5.0 → 1.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0
4
+
5
+ Two fleet-wide duplicates extracted (W1.2 + W1.3). Both are purely additive — every
6
+ existing export is unchanged.
7
+
8
+ - **Add `createToastBus()` — the shared toast EMIT half (W1.2).** Promoted from the three
9
+ hand-rolled ~25-line twins in `aml-v2` (`components/toast.ts` — `emitToast`/`subscribeToasts`),
10
+ `agora-web` and `zygos-web` (`lib/toastBus.ts` — `toastSuccess`/`toastError`). The returned
11
+ bus is a superset: `subscribe` (the `<ToastHost>` port), `emit(text, type?)`, and the
12
+ `success`/`error`/`info` shorthands.
13
+
14
+ **Deliberately framework-agnostic — no React import, no hook, no provider.** Call sites are
15
+ React Query mutation `onSuccess`/`onError` callbacks with no component context in scope, so a
16
+ hook-based API would break every one of them. It carries no styling: `<ToastHost>` themes each
17
+ toast from `UiProvider`. Text passed in is already localized by the caller.
18
+
19
+ New exports: `createToastBus`, `ToastBus`, `ToastPush`.
20
+
21
+ - **Add `<AppErrorBoundary>` — the shared top-level error boundary (W1.3).** Promoted from the
22
+ SIX app-local copies (`agora-web` + `zygos-web` byte-identical, `kefi-web`, `erevna-web`,
23
+ `katalogos-web`, `ichnos-web`); `aml-v2` had none at all. The axes that actually varied are now
24
+ injected rather than baked in: `onError` (Sentry/logger), `recover` (the apps' chunk-load
25
+ retry), `showDetails` (dev-only error text), `labels` (pre-localized bag), `testIDPrefix`,
26
+ and `fallback` (escape hatch). An optional `onReload` renders the manual **Reload** action
27
+ that kefi/erevna/katalogos shipped alongside **Try Again**.
28
+
29
+ Two behaviour fixes come with the extraction:
30
+ - **Themed.** The fallback renders through the shared `<ErrorState>`, so it reads
31
+ `UiProvider` colours — this removes the 40+ hardcoded Bootstrap-4 hex literals
32
+ (`#f8f9fa`, `#212529`, `#6c757d`, `#fff3cd`, `#856404`, `#007bff`, …) three copies carried.
33
+ - **Announced.** The fallback ships `role="alert"` + `accessibilityLiveRegion="assertive"`;
34
+ none of the six announced anything to a screen reader, and agora/zygos rendered only the
35
+ app *name* with no message and no retry.
36
+
37
+ New exports: `AppErrorBoundary`, `AppErrorBoundaryProps`, `ErrorFallbackState`,
38
+ `ErrorBoundaryLabels`, `DEFAULT_ERROR_BOUNDARY_LABELS`, plus the `errorBoundary` id in
39
+ `FEEDBACK_TEST_IDS` (default prefix `error-boundary`, preserving the existing
40
+ `error-boundary-retry-button` / `-reload-button` / `-updating` Playwright selectors).
41
+
3
42
  ## 1.5.0
4
43
 
5
44
  - **Accessibility (WCAG 2.1 AA) — `ToastHost` announcements.** Each toast is now a live region so
package/README.md CHANGED
@@ -14,6 +14,15 @@ package depending on any app's internals.
14
14
  | `LoadingFallback` | Lightweight spinner for `React.lazy` / `Suspense` boundaries. |
15
15
  | `PageSkeleton` | Shimmer skeleton for full-page loads (list or card variant). |
16
16
  | `ConfirmDialog` | Modal confirm/cancel dialog with destructive + loading states. |
17
+ | `ToastHost` | Transient-toast overlay; pair it with `createToastBus()`. |
18
+ | `WarmingOverlay` | Branded cold-start "warming up…" overlay. |
19
+ | `AppErrorBoundary` | Top-level error boundary with a themed, announced fallback. |
20
+
21
+ ## Helpers
22
+
23
+ | Helper | Purpose |
24
+ |--------|---------|
25
+ | `createToastBus()` | Framework-agnostic toast emit bus — the `ToastHost` `subscribe` port. |
17
26
 
18
27
  ## Install
19
28
 
@@ -66,6 +75,64 @@ import { ErrorState, ConfirmDialog, LoadingFallback } from '@dloizides/ui-feedba
66
75
  />
67
76
  ```
68
77
 
78
+ ## Toasts — `createToastBus()`
79
+
80
+ The toast pipeline is two halves: `createToastBus()` **emits**, `<ToastHost>` **renders**.
81
+ A bus's `subscribe` *is* the host's `subscribe` port.
82
+
83
+ The bus is **framework-agnostic on purpose** — no React import, no hook, no provider — so a
84
+ React Query mutation callback can raise a toast with no component context in scope. It carries
85
+ no styling (`ToastHost` themes every toast from the provider), and the text you pass is already
86
+ localized by you; the bus never sees a translation key.
87
+
88
+ ```ts
89
+ // src/lib/toastBus.ts — one module-level instance per app
90
+ import { createToastBus } from '@dloizides/ui-feedback';
91
+ export const toastBus = createToastBus();
92
+ ```
93
+
94
+ ```tsx
95
+ // once, in the shell:
96
+ <ToastHost subscribe={toastBus.subscribe} />
97
+
98
+ // anywhere — no provider needed:
99
+ useMutation({ onSuccess: () => toastBus.success(FM('menu.saved')) });
100
+ toastBus.error(FM('menu.saveFailed'));
101
+ toastBus.emit(FM('menu.queued'), 'info'); // explicit type; defaults to 'info'
102
+ ```
103
+
104
+ Emitting with no host mounted is a silent no-op. Every subscriber receives every emit, and
105
+ `subscribe` returns an unsubscribe.
106
+
107
+ ## Error boundary — `<AppErrorBoundary>`
108
+
109
+ Wrap your app once. The fallback renders through `ErrorState`, so it themes from the provider,
110
+ and it announces itself (`role="alert"` + `accessibilityLiveRegion="assertive"`).
111
+
112
+ ```tsx
113
+ <AppErrorBoundary
114
+ labels={{ title: FM('errorBoundary.title'), message: FM('errorBoundary.message') }}
115
+ showDetails={__DEV__}
116
+ onError={(error, info) => captureException(error, { extra: { componentStack: info.componentStack } })}
117
+ recover={(error) => isChunkLoadError(error) && attemptChunkRecovery()}
118
+ onReload={reloadPage}
119
+ >
120
+ <App />
121
+ </AppErrorBoundary>
122
+ ```
123
+
124
+ | Prop | Purpose |
125
+ |------|---------|
126
+ | `onError(error, info)` | Reporting sink (Sentry / logger). Called for **every** caught error, before `recover`. |
127
+ | `recover(error)` | Return `true` if handled (e.g. a guarded reload is under way) → shows the `updating` screen instead of the error screen. |
128
+ | `showDetails` | Render the error message in the fallback (dev-only). Default `false`. |
129
+ | `labels` | Partial, **pre-localized** `ErrorBoundaryLabels`; anything omitted uses the English defaults in `DEFAULT_ERROR_BOUNDARY_LABELS`. |
130
+ | `testIDPrefix` | Prefix for every testID. Default `error-boundary`. |
131
+ | `fallback(state)` | Escape hatch — replaces the built-in fallback entirely. Receives `{ error, recovering, retry }`. |
132
+ | `onReload` | Optional secondary **Reload** action. The kit never touches `window`, so you inject the reload. |
133
+
134
+ The package imports no i18n runtime — localize at the call site and pass strings.
135
+
69
136
  ## i18n keys
70
137
 
71
138
  The components call the injected `t(key)` with these keys (provide them in each app's
@@ -78,7 +145,12 @@ locale files): `common.retry`, `common.retryHint`, `common.confirm`, `common.can
78
145
  Default testIDs (`FEEDBACK_TEST_IDS`) match the strings the consuming apps already used,
79
146
  so existing Playwright selectors keep working: `error-state`, `error-state-retry`,
80
147
  `empty-list-cta`, `loading-fallback`, `page-skeleton`, `confirm-dialog`, `confirm-button`,
81
- `cancel-confirm-button`.
148
+ `cancel-confirm-button`, `notification-toast`, `warming-overlay`, `error-boundary`.
149
+
150
+ `AppErrorBoundary` derives its ids from `testIDPrefix` (default `error-boundary`), preserving the
151
+ selectors the app-local copies used: `error-boundary`, `error-boundary-message`,
152
+ `error-boundary-details`, `error-boundary-retry-button`, `error-boundary-reload-button`,
153
+ `error-boundary-updating`.
82
154
 
83
155
  ## License
84
156
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Component, ReactNode, ErrorInfo } from 'react';
2
2
 
3
3
  /**
4
4
  * The minimal theme surface the feedback components read. Each consuming app's
@@ -77,6 +77,7 @@ declare const FEEDBACK_TEST_IDS: {
77
77
  readonly cancelConfirmButton: "cancel-confirm-button";
78
78
  readonly notificationToast: "notification-toast";
79
79
  readonly warmingOverlay: "warming-overlay";
80
+ readonly errorBoundary: "error-boundary";
80
81
  };
81
82
 
82
83
  /**
@@ -277,4 +278,146 @@ declare function subscribeWarming(listener: WarmingListener): () => void;
277
278
  /** Current immutable snapshot. Stable identity until the value changes. */
278
279
  declare function getWarmingSnapshot(): WarmingSnapshot;
279
280
 
280
- export { ConfirmDialog, type ConfirmDialogProps, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ToastHost, type ToastHostProps, type ToastInput, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
281
+ /**
282
+ * createToastBus — the shared EMIT half of the toast pipeline, promoted from the
283
+ * hand-rolled twins in aml-v2 (`components/toast.ts`), agora-web and zygos-web
284
+ * (`lib/toastBus.ts`). The RENDERING half is `<ToastHost>`; a bus instance's
285
+ * {@link ToastBus.subscribe} IS the `ToastHost` `subscribe` port.
286
+ *
287
+ * Deliberately FRAMEWORK-AGNOSTIC — no React import, no hook, no provider. Call
288
+ * sites are React Query mutation `onSuccess`/`onError` callbacks that have no
289
+ * component context in scope, so a hook-based API would break every one of them.
290
+ *
291
+ * It carries no styling: `<ToastHost>` themes every toast from `UiProvider`.
292
+ * Text arriving here is ALREADY localized by the caller (`FM()`); this bus never
293
+ * sees a translation key.
294
+ *
295
+ * Usage — one module-level instance per app:
296
+ * ```ts
297
+ * // src/lib/toastBus.ts
298
+ * import { createToastBus } from '@dloizides/ui-feedback';
299
+ * export const toastBus = createToastBus();
300
+ *
301
+ * // anywhere, no provider needed:
302
+ * toastBus.success(FM('menu.saved'));
303
+ *
304
+ * // once, in the shell:
305
+ * <ToastHost subscribe={toastBus.subscribe} />
306
+ * ```
307
+ */
308
+
309
+ /** A registered push callback — what `<ToastHost>` hands to {@link ToastBus.subscribe}. */
310
+ type ToastPush = (toast: ToastInput) => void;
311
+ interface ToastBus {
312
+ /** Register a push callback; returns an unsubscribe. The `<ToastHost>` `subscribe` port. */
313
+ subscribe(push: ToastPush): () => void;
314
+ /** Emit a toast of an explicit type. Defaults to `info`. */
315
+ emit(text: string, type?: ToastType): void;
316
+ /** Emit a success toast. */
317
+ success(text: string): void;
318
+ /** Emit an error toast. */
319
+ error(text: string): void;
320
+ /** Emit an informational toast. */
321
+ info(text: string): void;
322
+ }
323
+ /**
324
+ * Create an independent toast bus. Emitting with no subscriber is a silent no-op
325
+ * (the host simply isn't mounted yet), and every subscriber receives every emit.
326
+ */
327
+ declare function createToastBus(): ToastBus;
328
+
329
+ /**
330
+ * The i18n-agnostic label bag for `<AppErrorBoundary>`.
331
+ *
332
+ * The kit imports no `FM`/i18n runtime — callers localize at the call site and
333
+ * pass PRE-LOCALIZED strings (`labels={{ title: FM('errorBoundary.title') }}`).
334
+ * The defaults below are plain English so the boundary is never blank when a
335
+ * caller omits the bag.
336
+ */
337
+ interface ErrorBoundaryLabels {
338
+ /** Heading of the error screen. */
339
+ title: string;
340
+ /** Body copy under the heading. */
341
+ message: string;
342
+ /** Primary action: reset the boundary and re-render the children. */
343
+ tryAgain: string;
344
+ /** Accessibility hint for the try-again action. */
345
+ tryAgainHint: string;
346
+ /** Secondary action: full page reload (rendered only when `onReload` is given). */
347
+ reload: string;
348
+ /** Accessibility hint for the reload action. */
349
+ reloadHint: string;
350
+ /** Shown while `recover` is handling the error (e.g. a guarded chunk reload). */
351
+ updating: string;
352
+ /** Heading of the dev-only error-details block. */
353
+ errorDetails: string;
354
+ }
355
+ declare const DEFAULT_ERROR_BOUNDARY_LABELS: ErrorBoundaryLabels;
356
+
357
+ /**
358
+ * AppErrorBoundary — the shared top-level React error boundary, promoted from the
359
+ * SIX app-local copies (agora-web + zygos-web byte-identical, kefi-web, erevna-web,
360
+ * katalogos-web, ichnos-web). aml-v2 had none at all.
361
+ *
362
+ * What varied between the copies — and is therefore injected, not baked in:
363
+ * - **reporting** → `onError` (Sentry `captureException` / `loggingService.fatal`)
364
+ * - **recovery** → `recover` (the apps' `isChunkLoadError() && attemptChunkRecovery()`)
365
+ * - **test ids** → `testIDPrefix` (defaults to the value all six already used)
366
+ * - **error text** → `showDetails` (the dev-only stack block)
367
+ * - **wording** → `labels` (pre-localized by the caller; the kit imports no i18n)
368
+ * - **everything else** → `fallback`, the escape hatch
369
+ *
370
+ * What is now uniform: the fallback renders through the shared `<ErrorState>`, so
371
+ * it themes from `UiProvider` instead of the Bootstrap-4 hex literals three copies
372
+ * hardcoded; and it announces via `role="alert"` + `accessibilityLiveRegion`,
373
+ * which none of the six did.
374
+ */
375
+
376
+ /** What the `fallback` render-prop receives. */
377
+ interface ErrorFallbackState {
378
+ /** The caught error, or `null` before anything has been caught. */
379
+ error: Error | null;
380
+ /** True while the caller's `recover` is handling the error. */
381
+ recovering: boolean;
382
+ /** Resets the boundary and re-renders `children`. */
383
+ retry: () => void;
384
+ }
385
+ interface AppErrorBoundaryProps {
386
+ children: ReactNode;
387
+ /** Reporting sink — Sentry / logger. Called for EVERY caught error, before `recover`. */
388
+ onError?: (error: Error, info: ErrorInfo) => void;
389
+ /**
390
+ * Recovery attempt. Return `true` if the error is handled (e.g. a guarded page
391
+ * reload is under way) — the boundary then shows the `updating` screen instead
392
+ * of the error screen. Return `false`/omit to fall through to the fallback.
393
+ */
394
+ recover?: (error: Error) => boolean;
395
+ /** Render the error message in the fallback (dev-only stack). Default `false`. */
396
+ showDetails?: boolean;
397
+ /** Pre-localized wording. Anything omitted falls back to the English defaults. */
398
+ labels?: Partial<ErrorBoundaryLabels>;
399
+ /** Prefix for every testID the boundary renders. Default `error-boundary`. */
400
+ testIDPrefix?: string;
401
+ /** Full escape hatch — replaces the built-in fallback entirely. */
402
+ fallback?: (state: ErrorFallbackState) => ReactNode;
403
+ /**
404
+ * Optional secondary action: a full page reload. Rendered only when provided.
405
+ * (kefi/erevna/katalogos shipped a manual **Reload** alongside **Try Again**;
406
+ * the kit does not touch `window`, so the caller injects the reload itself.)
407
+ */
408
+ onReload?: () => void;
409
+ }
410
+ interface AppErrorBoundaryState {
411
+ hasError: boolean;
412
+ error: Error | null;
413
+ recovering: boolean;
414
+ }
415
+ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppErrorBoundaryState> {
416
+ constructor(props: AppErrorBoundaryProps);
417
+ static getDerivedStateFromError(error: Error): Partial<AppErrorBoundaryState>;
418
+ componentDidCatch(error: Error, info: ErrorInfo): void;
419
+ private readonly handleRetry;
420
+ render(): ReactNode;
421
+ }
422
+
423
+ export { AppErrorBoundary, type AppErrorBoundaryProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Component, ReactNode, ErrorInfo } from 'react';
2
2
 
3
3
  /**
4
4
  * The minimal theme surface the feedback components read. Each consuming app's
@@ -77,6 +77,7 @@ declare const FEEDBACK_TEST_IDS: {
77
77
  readonly cancelConfirmButton: "cancel-confirm-button";
78
78
  readonly notificationToast: "notification-toast";
79
79
  readonly warmingOverlay: "warming-overlay";
80
+ readonly errorBoundary: "error-boundary";
80
81
  };
81
82
 
82
83
  /**
@@ -277,4 +278,146 @@ declare function subscribeWarming(listener: WarmingListener): () => void;
277
278
  /** Current immutable snapshot. Stable identity until the value changes. */
278
279
  declare function getWarmingSnapshot(): WarmingSnapshot;
279
280
 
280
- export { ConfirmDialog, type ConfirmDialogProps, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ToastHost, type ToastHostProps, type ToastInput, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };
281
+ /**
282
+ * createToastBus — the shared EMIT half of the toast pipeline, promoted from the
283
+ * hand-rolled twins in aml-v2 (`components/toast.ts`), agora-web and zygos-web
284
+ * (`lib/toastBus.ts`). The RENDERING half is `<ToastHost>`; a bus instance's
285
+ * {@link ToastBus.subscribe} IS the `ToastHost` `subscribe` port.
286
+ *
287
+ * Deliberately FRAMEWORK-AGNOSTIC — no React import, no hook, no provider. Call
288
+ * sites are React Query mutation `onSuccess`/`onError` callbacks that have no
289
+ * component context in scope, so a hook-based API would break every one of them.
290
+ *
291
+ * It carries no styling: `<ToastHost>` themes every toast from `UiProvider`.
292
+ * Text arriving here is ALREADY localized by the caller (`FM()`); this bus never
293
+ * sees a translation key.
294
+ *
295
+ * Usage — one module-level instance per app:
296
+ * ```ts
297
+ * // src/lib/toastBus.ts
298
+ * import { createToastBus } from '@dloizides/ui-feedback';
299
+ * export const toastBus = createToastBus();
300
+ *
301
+ * // anywhere, no provider needed:
302
+ * toastBus.success(FM('menu.saved'));
303
+ *
304
+ * // once, in the shell:
305
+ * <ToastHost subscribe={toastBus.subscribe} />
306
+ * ```
307
+ */
308
+
309
+ /** A registered push callback — what `<ToastHost>` hands to {@link ToastBus.subscribe}. */
310
+ type ToastPush = (toast: ToastInput) => void;
311
+ interface ToastBus {
312
+ /** Register a push callback; returns an unsubscribe. The `<ToastHost>` `subscribe` port. */
313
+ subscribe(push: ToastPush): () => void;
314
+ /** Emit a toast of an explicit type. Defaults to `info`. */
315
+ emit(text: string, type?: ToastType): void;
316
+ /** Emit a success toast. */
317
+ success(text: string): void;
318
+ /** Emit an error toast. */
319
+ error(text: string): void;
320
+ /** Emit an informational toast. */
321
+ info(text: string): void;
322
+ }
323
+ /**
324
+ * Create an independent toast bus. Emitting with no subscriber is a silent no-op
325
+ * (the host simply isn't mounted yet), and every subscriber receives every emit.
326
+ */
327
+ declare function createToastBus(): ToastBus;
328
+
329
+ /**
330
+ * The i18n-agnostic label bag for `<AppErrorBoundary>`.
331
+ *
332
+ * The kit imports no `FM`/i18n runtime — callers localize at the call site and
333
+ * pass PRE-LOCALIZED strings (`labels={{ title: FM('errorBoundary.title') }}`).
334
+ * The defaults below are plain English so the boundary is never blank when a
335
+ * caller omits the bag.
336
+ */
337
+ interface ErrorBoundaryLabels {
338
+ /** Heading of the error screen. */
339
+ title: string;
340
+ /** Body copy under the heading. */
341
+ message: string;
342
+ /** Primary action: reset the boundary and re-render the children. */
343
+ tryAgain: string;
344
+ /** Accessibility hint for the try-again action. */
345
+ tryAgainHint: string;
346
+ /** Secondary action: full page reload (rendered only when `onReload` is given). */
347
+ reload: string;
348
+ /** Accessibility hint for the reload action. */
349
+ reloadHint: string;
350
+ /** Shown while `recover` is handling the error (e.g. a guarded chunk reload). */
351
+ updating: string;
352
+ /** Heading of the dev-only error-details block. */
353
+ errorDetails: string;
354
+ }
355
+ declare const DEFAULT_ERROR_BOUNDARY_LABELS: ErrorBoundaryLabels;
356
+
357
+ /**
358
+ * AppErrorBoundary — the shared top-level React error boundary, promoted from the
359
+ * SIX app-local copies (agora-web + zygos-web byte-identical, kefi-web, erevna-web,
360
+ * katalogos-web, ichnos-web). aml-v2 had none at all.
361
+ *
362
+ * What varied between the copies — and is therefore injected, not baked in:
363
+ * - **reporting** → `onError` (Sentry `captureException` / `loggingService.fatal`)
364
+ * - **recovery** → `recover` (the apps' `isChunkLoadError() && attemptChunkRecovery()`)
365
+ * - **test ids** → `testIDPrefix` (defaults to the value all six already used)
366
+ * - **error text** → `showDetails` (the dev-only stack block)
367
+ * - **wording** → `labels` (pre-localized by the caller; the kit imports no i18n)
368
+ * - **everything else** → `fallback`, the escape hatch
369
+ *
370
+ * What is now uniform: the fallback renders through the shared `<ErrorState>`, so
371
+ * it themes from `UiProvider` instead of the Bootstrap-4 hex literals three copies
372
+ * hardcoded; and it announces via `role="alert"` + `accessibilityLiveRegion`,
373
+ * which none of the six did.
374
+ */
375
+
376
+ /** What the `fallback` render-prop receives. */
377
+ interface ErrorFallbackState {
378
+ /** The caught error, or `null` before anything has been caught. */
379
+ error: Error | null;
380
+ /** True while the caller's `recover` is handling the error. */
381
+ recovering: boolean;
382
+ /** Resets the boundary and re-renders `children`. */
383
+ retry: () => void;
384
+ }
385
+ interface AppErrorBoundaryProps {
386
+ children: ReactNode;
387
+ /** Reporting sink — Sentry / logger. Called for EVERY caught error, before `recover`. */
388
+ onError?: (error: Error, info: ErrorInfo) => void;
389
+ /**
390
+ * Recovery attempt. Return `true` if the error is handled (e.g. a guarded page
391
+ * reload is under way) — the boundary then shows the `updating` screen instead
392
+ * of the error screen. Return `false`/omit to fall through to the fallback.
393
+ */
394
+ recover?: (error: Error) => boolean;
395
+ /** Render the error message in the fallback (dev-only stack). Default `false`. */
396
+ showDetails?: boolean;
397
+ /** Pre-localized wording. Anything omitted falls back to the English defaults. */
398
+ labels?: Partial<ErrorBoundaryLabels>;
399
+ /** Prefix for every testID the boundary renders. Default `error-boundary`. */
400
+ testIDPrefix?: string;
401
+ /** Full escape hatch — replaces the built-in fallback entirely. */
402
+ fallback?: (state: ErrorFallbackState) => ReactNode;
403
+ /**
404
+ * Optional secondary action: a full page reload. Rendered only when provided.
405
+ * (kefi/erevna/katalogos shipped a manual **Reload** alongside **Try Again**;
406
+ * the kit does not touch `window`, so the caller injects the reload itself.)
407
+ */
408
+ onReload?: () => void;
409
+ }
410
+ interface AppErrorBoundaryState {
411
+ hasError: boolean;
412
+ error: Error | null;
413
+ recovering: boolean;
414
+ }
415
+ declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, AppErrorBoundaryState> {
416
+ constructor(props: AppErrorBoundaryProps);
417
+ static getDerivedStateFromError(error: Error): Partial<AppErrorBoundaryState>;
418
+ componentDidCatch(error: Error, info: ErrorInfo): void;
419
+ private readonly handleRetry;
420
+ render(): ReactNode;
421
+ }
422
+
423
+ export { AppErrorBoundary, type AppErrorBoundaryProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, createToastBus, getWarmingSnapshot, notifyWarming, settleWarming, subscribeWarming, useFeedbackUi, useFeedbackUi as useUi };