@crystaltech/hsms-shared-ui 0.7.21 → 0.7.23

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Says that a new version has been deployed and loads it on request. Never reloads by itself: a
3
+ * doctor in the middle of a prescription chooses when. "Later" hides it until the next check
4
+ * finds it again; it does not dismiss the update.
5
+ */
6
+ declare const AppUpdateBanner: () => import("react/jsx-runtime").JSX.Element;
7
+ export default AppUpdateBanner;
@@ -0,0 +1,14 @@
1
+ interface NetworkStatusIndicatorProps {
2
+ /** Shown before the status in the full form, e.g. "HSMS". */
3
+ systemName?: string;
4
+ /** The dot alone, with the status in a tooltip - for a collapsed sidebar. */
5
+ compact?: boolean;
6
+ /** Colour of the label text. */
7
+ textColor?: string;
8
+ }
9
+ /**
10
+ * A live connection status: a coloured dot and what it means. Red when the computer is offline,
11
+ * amber when the network is up but the server does not answer, green only when it does.
12
+ */
13
+ declare const NetworkStatusIndicator: ({ systemName, compact, textColor, }: NetworkStatusIndicatorProps) => import("react/jsx-runtime").JSX.Element;
14
+ export default NetworkStatusIndicator;
@@ -0,0 +1,8 @@
1
+ import { AppUpdateState } from '../pwa/appUpdate';
2
+ /**
3
+ * Whether a newer version of the app is waiting, and the function that loads it. Starts the
4
+ * watcher on first use - see pwa/appUpdate.
5
+ */
6
+ export declare function useAppUpdate(): AppUpdateState & {
7
+ reload: () => void;
8
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Whether this workstation can reach the system right now.
3
+ *
4
+ * - `online`: the browser has a network and the HSMS server answered.
5
+ * - `offline`: the browser has no network at all - cable out, Wi-Fi down.
6
+ * - `unreachable`: there is a network, but the HSMS server does not answer. The browser's own
7
+ * flag says "online" here, which is why it is not trusted alone: a ward PC on a LAN whose
8
+ * uplink is down reports itself online while every save fails.
9
+ * - `checking`: not known yet.
10
+ */
11
+ export type NetworkStatus = "checking" | "online" | "offline" | "unreachable";
12
+ /** How often the server is asked while the browser says it is online. */
13
+ export declare const NETWORK_PROBE_INTERVAL_MS = 30000;
14
+ export declare function probeServer(): Promise<boolean>;
15
+ /**
16
+ * The workstation's network status, kept current: the browser's online/offline events answer at
17
+ * once, and the server is asked every {@link NETWORK_PROBE_INTERVAL_MS} - and as soon as the
18
+ * browser reports the network back - to tell "online" from "online but cut off".
19
+ */
20
+ export declare function useNetworkStatus(): NetworkStatus;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as ThemeSetting } from './components/ThemeSetting';
2
+ export { default as AppUpdateBanner } from './components/ui/AppUpdateBanner';
2
3
  export { default as Banner } from './components/banner/Banner';
3
4
  export { default as GlobalHospitalSelectDialog } from './components/GlobalHospitalSelectDialog';
4
5
  export { default as MainLayout } from './components/layout/MainLayout';
@@ -22,9 +23,15 @@ export { default as CustomSwitch } from './components/ui/CustomSwitch';
22
23
  export { default as CustomTabs } from './components/ui/CustomTabs';
23
24
  export { default as CustomTextField } from './components/ui/CustomTextfield';
24
25
  export { default as Loader } from './components/ui/Loader';
26
+ export { default as NetworkStatusIndicator } from './components/ui/NetworkStatusIndicator';
25
27
  export { default as RoutesConfigLayout } from './routes/RoutesConfigLayout';
26
28
  export { default as ThemeCustomization } from './theme/ThemeCustomization';
27
29
  export { configureCommonPackage, getApiBaseUrl, getCommonConfig, setApiBaseUrl, } from './config/env';
28
30
  export { configureAuthPackage, getAccountConsoleUrl, getAuthConfig, getPostLogoutRedirectUri, setAccountConsoleRoutes, setAccountConsoleUrl, setPostLogoutRedirectUri, } from './config/auth';
31
+ export { NETWORK_PROBE_INTERVAL_MS, probeServer, useNetworkStatus, } from './hooks/useNetworkStatus';
32
+ export type { NetworkStatus } from './hooks/useNetworkStatus';
33
+ export { useAppUpdate } from './hooks/useAppUpdate';
34
+ export { applyAppUpdate, checkForAppUpdate, handleStaleBuildError, registerUnsavedWorkCheck, startAppUpdateWatcher, UPDATE_CHECK_INTERVAL_MS, } from './pwa/appUpdate';
35
+ export type { AppUpdateReason, AppUpdateState } from './pwa/appUpdate';
29
36
  export { defaultTheme } from './theme/defaultTheme';
30
37
  export type { ITheme, TypographyStyle } from './theme/defaultTheme';