@crystaltech/hsms-shared-ui 0.7.29 → 0.8.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.
@@ -0,0 +1,16 @@
1
+ import { QueueClient } from './queueClient';
2
+ import { QueueLine } from './types';
3
+ interface Props {
4
+ client: QueueClient;
5
+ module: string;
6
+ apiBase: string;
7
+ lines: QueueLine[];
8
+ /** Where this app's display page lives, e.g. /hsms/pharmacy/queue/display */
9
+ displayPath: string;
10
+ hospitalId?: string;
11
+ getToken?: () => string | null;
12
+ moduleApis?: Record<string, string>;
13
+ }
14
+ /** Named display profiles, one per monitor or group of monitors, each with its own address. */
15
+ export default function QueueDisplayAdmin({ client, module, apiBase, lines, displayPath, hospitalId, getToken, moduleApis }: Props): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,21 @@
1
+ import { QueueHttp } from './types';
2
+ interface Props {
3
+ /** The owning module's API client, to read the display profile. */
4
+ http: QueueHttp;
5
+ module: string;
6
+ apiBase: string;
7
+ displayId: string;
8
+ hospitalId?: string;
9
+ hospitalName?: string;
10
+ hospitalLogo?: string;
11
+ getToken?: () => string | null;
12
+ moduleApis?: Record<string, string>;
13
+ }
14
+ /**
15
+ * A waiting-room screen in the usual professional layout: hospital header, a "Now serving" board
16
+ * (token → counter), the latest call in large type with the next tokens of every line, and a
17
+ * notice ticker. Tokens only: no patient names, nothing about priority. Scales from any screen
18
+ * size (designed at 1920×1080), turns to a stacked layout on portrait screens, and recovers by itself.
19
+ */
20
+ export default function QueueDisplayScreen(props: Props): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * A short "how this works" guide at the top of a section. Open the first time; once closed it stays
4
+ * a one-line "Show guide" link for that person on that browser.
5
+ */
6
+ export declare function Guide({ id, title, steps, tips }: {
7
+ id: string;
8
+ title: string;
9
+ steps: ReactNode[];
10
+ tips?: ReactNode[];
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ /** A one-line explanation under a group of fields. */
13
+ export declare function Hint({ children }: {
14
+ children: ReactNode;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { QueueClient } from './queueClient';
2
+ import { RuleOptions } from './ruleOptions';
3
+ import { QueueLine } from './types';
4
+ interface Props {
5
+ client: QueueClient;
6
+ module: string;
7
+ lines: QueueLine[];
8
+ onChanged: () => void;
9
+ /** Override or extend the pick lists in the rule editor. */
10
+ ruleOptions?: Partial<RuleOptions>;
11
+ }
12
+ /** Lines are data, not code: any number, any rules, changed while patients wait. */
13
+ export default function QueueLineAdmin({ client, module, lines, onChanged, ruleOptions }: Props): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,25 @@
1
+ import { RuleOptions } from './ruleOptions';
2
+ import { QueueHttp } from './types';
3
+ export interface QueueManagementProps {
4
+ /** The module app's API client (axios), pointed at its own backend. */
5
+ http: QueueHttp;
6
+ /** OPD, PHARMACY, LABORATORY, RADIOLOGY, BILLING, ... */
7
+ module: string;
8
+ /** The module's API root, e.g. import.meta.env.VITE_API_URL */
9
+ apiBase: string;
10
+ /** For a super admin: the hospital they chose. */
11
+ hospitalId?: string;
12
+ /** Where this app serves its display page, e.g. /hsms/pharmacy/queue/display */
13
+ displayPath: string;
14
+ title?: string;
15
+ getToken?: () => string | null;
16
+ /** Other modules' API roots when they are not on the same /hsms/<module>/ host. */
17
+ moduleApis?: Record<string, string>;
18
+ /** Extra or different choices for the line rules (patient types, categories, ...). */
19
+ ruleOptions?: Partial<RuleOptions>;
20
+ }
21
+ /**
22
+ * A module's Queue Management: live operations, lines, displays and reports, each shown only to
23
+ * those the server would allow, with a short guide on every tab.
24
+ */
25
+ export default function QueueManagement(props: QueueManagementProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { QueueClient } from './queueClient';
2
+ import { QueueLine, QueueMe } from './types';
3
+ interface Props {
4
+ client: QueueClient;
5
+ me: QueueMe;
6
+ module: string;
7
+ apiBase: string;
8
+ lines: QueueLine[];
9
+ hospitalId?: string;
10
+ getToken?: () => string | null;
11
+ /** Opens the Lines tab, for an administrator with nothing set up yet. */
12
+ onSetUpLines?: () => void;
13
+ /** Reload the lines after a change made here, so every tab agrees. */
14
+ onLinesChanged?: () => void;
15
+ }
16
+ /**
17
+ * The counter view: pick a line and counter, call the next patient, serve, complete. Completing
18
+ * removes the patient at once and the next one is ready; on an automatic line they are called.
19
+ */
20
+ export default function QueueOperatorPanel({ client, me, module, apiBase, lines, hospitalId, getToken, onSetUpLines, onLinesChanged }: Props): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,6 @@
1
+ import { QueueClient } from './queueClient';
2
+ /** Waiting times, throughput, operators, counters and peak hours; priority history for administrators. */
3
+ export default function QueueReportsPanel({ client, showPriority }: {
4
+ client: QueueClient;
5
+ showPriority: boolean;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { Option } from './ruleOptions';
2
+ /** A pick-many dropdown that still accepts a value not in its list. */
3
+ export declare function MultiPick(props: {
4
+ label: string;
5
+ options: Option[];
6
+ value?: string[] | null;
7
+ onChange: (v: string[]) => void;
8
+ placeholder?: string;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ /** Government grade 1–20, or any. */
11
+ export declare function GradePick(props: {
12
+ label: string;
13
+ value?: number | null;
14
+ onChange: (v: number | null) => void;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ /** Pure helpers for the hospital heading on queue screens (no browser or app imports, so tests can load them). */
2
+ /** What a queue screen needs about its hospital; read from the same places as the app header. */
3
+ export interface HospitalBrand {
4
+ id?: string;
5
+ name?: string;
6
+ nameBn?: string;
7
+ address?: string;
8
+ phone?: string;
9
+ website?: string;
10
+ /** Ready to put in an <img>. */
11
+ logoUrl?: string;
12
+ /** The hospital's banner picture, ready to use as a background. */
13
+ bannerUrl?: string;
14
+ }
15
+ export declare function toBrand(h: any, org?: any, resolveLogo?: (path: string) => string): HospitalBrand | null;
16
+ /** "Phone 019… · www…" for a scrolling line along the bottom of a screen. */
17
+ export declare const contactLine: (b: HospitalBrand | null) => string;
@@ -0,0 +1,6 @@
1
+ import { HospitalBrand } from './hospitalBrand';
2
+ export { contactLine, type HospitalBrand } from './hospitalBrand';
3
+ /** The hospital as already known to this browser, without a request. */
4
+ export declare function storedHospital(hospitalId?: string): HospitalBrand | null;
5
+ /** The hospital's name, address and logo, for headings on queue screens. */
6
+ export declare function useHospitalBrand(hospitalId?: string): HospitalBrand | null;
@@ -0,0 +1,65 @@
1
+ import { DisplayProfile, LineSnapshot, QueueEvent, QueueHttp, QueueLine, QueueMe, QueueTicket, ReportSummary } from './types';
2
+ /** Calls to one module's /api/queue, scoped to the hospital when a super admin chose one. */
3
+ export declare function createQueueClient(http: QueueHttp, hospitalId?: string, basePath?: string): {
4
+ me: () => Promise<QueueMe>;
5
+ lines: (includeArchived?: boolean) => Promise<QueueLine[]>;
6
+ createLine: (line: QueueLine) => Promise<QueueLine>;
7
+ updateLine: (id: string, line: QueueLine) => Promise<QueueLine>;
8
+ pause: (id: string, counterId?: string) => Promise<{
9
+ data: unknown;
10
+ }>;
11
+ resume: (id: string, counterId?: string) => Promise<{
12
+ data: unknown;
13
+ }>;
14
+ activate: (id: string) => Promise<{
15
+ data: unknown;
16
+ }>;
17
+ deactivate: (id: string) => Promise<{
18
+ data: unknown;
19
+ }>;
20
+ archive: (id: string) => Promise<{
21
+ data: unknown;
22
+ }>;
23
+ reorder: (ids: string[]) => Promise<{
24
+ data: unknown;
25
+ }>;
26
+ merge: (sourceLineIds: string[], targetLineId: string) => Promise<{
27
+ data: unknown;
28
+ }>;
29
+ split: (id: string, newLine: QueueLine) => Promise<{
30
+ data: unknown;
31
+ }>;
32
+ templates: () => Promise<{
33
+ id: string;
34
+ name: string;
35
+ }[]>;
36
+ saveTemplate: (name: string) => Promise<{
37
+ data: unknown;
38
+ }>;
39
+ applyTemplate: (id: string) => Promise<{
40
+ data: unknown;
41
+ }>;
42
+ snapshot: (lineId: string, view: "public" | "operator") => Promise<LineSnapshot>;
43
+ register: (body: Record<string, unknown>) => Promise<QueueTicket>;
44
+ callNext: (lineId: string, counterId: string) => Promise<QueueTicket | null>;
45
+ recall: (ticketId: string, counterId?: string) => Promise<QueueTicket>;
46
+ start: (ticketId: string) => Promise<QueueTicket>;
47
+ complete: (ticketId: string) => Promise<QueueTicket>;
48
+ skip: (ticketId: string, reason?: string) => Promise<QueueTicket>;
49
+ noShow: (ticketId: string) => Promise<QueueTicket>;
50
+ requeue: (ticketId: string) => Promise<QueueTicket>;
51
+ cancel: (ticketId: string, reason?: string) => Promise<QueueTicket>;
52
+ transfer: (ticketId: string, targetLineId: string, toFront: boolean, reason?: string) => Promise<QueueTicket>;
53
+ prioritise: (ticketId: string, position: number, kind: string, reason: string) => Promise<QueueTicket>;
54
+ displays: () => Promise<DisplayProfile[]>;
55
+ display: (id: string) => Promise<DisplayProfile>;
56
+ saveDisplay: (profile: DisplayProfile) => Promise<DisplayProfile>;
57
+ deleteDisplay: (id: string) => Promise<{
58
+ data: unknown;
59
+ }>;
60
+ summary: (from: string, to: string) => Promise<ReportSummary>;
61
+ priorityHistory: (from: string, to: string) => Promise<QueueEvent[]>;
62
+ };
63
+ export type QueueClient = ReturnType<typeof createQueueClient>;
64
+ /** The message a refused request carries, for a toast or an alert. */
65
+ export declare function queueError(error: unknown): string;
@@ -0,0 +1,63 @@
1
+ import { LineSnapshot } from './types';
2
+ /** One server-sent event. */
3
+ export interface SseEvent {
4
+ event?: string;
5
+ id?: string;
6
+ data?: string;
7
+ }
8
+ /**
9
+ * Reads complete events out of streamed text and returns what is left over for the next chunk.
10
+ * Comments (keep-alive lines) are skipped.
11
+ */
12
+ export declare function parseSse(buffer: string): {
13
+ events: SseEvent[];
14
+ rest: string;
15
+ };
16
+ /** The key a line is known by across modules. */
17
+ export declare const lineKey: (module: string, lineId: string) => string;
18
+ /**
19
+ * Keeps the newer of two pictures of a line. Notices can arrive out of order across pods and
20
+ * reconnects; an older version never replaces a newer one, and a new day always wins.
21
+ */
22
+ export declare function newer(current: LineSnapshot | undefined, incoming: LineSnapshot): boolean;
23
+ /** Tokens called since the previous picture: what a display announces. */
24
+ export declare function newlyCalled(previous: LineSnapshot | undefined, next: LineSnapshot): string[];
25
+ /**
26
+ * Columns and rows for n lines on a screen of the given shape, using the space well: the most
27
+ * square cells that fit, more columns on a wide screen.
28
+ */
29
+ export declare function gridFor(count: number, width: number, height: number, fixedColumns?: number | null): {
30
+ columns: number;
31
+ rows: number;
32
+ };
33
+ /** A token's font size for a cell, in px: as large as fits, never unreadably small. */
34
+ export declare function tokenFontSize(cellWidth: number, cellHeight: number): number;
35
+ /** Bangla digits for a token or count. */
36
+ export declare function bnDigits(value: string | number): string;
37
+ /**
38
+ * A token as it should be said: the letters one by one, then the number as a number, without its
39
+ * leading zeros ("M-004" → "M 4", "GM-012" → "G M 12"; in Bangla "এম ৪").
40
+ */
41
+ export declare function spokenToken(tokenNo: string, language: "EN" | "BN"): string;
42
+ /** A counter's name in Bangla: its own Bangla name, or "Counter 2" → "২ নম্বর কাউন্টার". */
43
+ export declare function counterInBangla(name?: string | null, nameBn?: string | null): string;
44
+ /** "…কাউন্টার" → "…কাউন্টারে", "…রুম" → "…রুমে"; anything else gets "-এ". */
45
+ export declare const toPlace: (place: string) => string;
46
+ /**
47
+ * What a screen says aloud when a token is called, in full sentences so the voice pauses naturally.
48
+ * The patient's name is said only by the voice that can pronounce its script: a name written in
49
+ * English by the English voice, a name in Bangla by the Bangla voice.
50
+ */
51
+ export declare function announcement(tokenNo: string, counterName: string | null | undefined, language: "EN" | "BN", patientName?: string | null, counterNameBn?: string | null): string;
52
+ /**
53
+ * The API address of another module, from this module's own: HSMS serves each module under
54
+ * /hsms/<path>/ on one host. An explicit map wins.
55
+ */
56
+ export declare const MODULE_PATHS: Record<string, string>;
57
+ export declare function apiBaseFor(module: string, ownBase: string, overrides?: Record<string, string>): string;
58
+ /** A time sent as ISO text or as epoch seconds/milliseconds (depends on the backend's JSON settings). */
59
+ export type Instant = string | number;
60
+ /** Milliseconds since the epoch, or null when the value is missing or unreadable. */
61
+ export declare function toMillis(value?: Instant | null): number | null;
62
+ /** Minutes between two instants, rounded, or null. */
63
+ export declare function minutesBetween(from?: Instant | null, to?: Instant | null): number | null;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The spoken side of a queue screen: a soft two-note chime, then each call in the best voice the
3
+ * computer has, one at a time, at a calm pace. Browsers only allow sound after someone has clicked
4
+ * the page once; until then calls are shown but not heard.
5
+ */
6
+ type Lang = "EN" | "BN";
7
+ /** The best installed voice for a language, or null when there is none worth using. */
8
+ export declare function pickVoice(lang: Lang): SpeechSynthesisVoice | null;
9
+ /** Whether this computer can say a language properly; Bangla is skipped rather than mangled. */
10
+ export declare const canSpeak: (lang: Lang) => boolean;
11
+ /** A soft "ding-dong" made in the browser, about a second long. */
12
+ export declare function chime(): number;
13
+ interface Line {
14
+ lang: Lang;
15
+ text: string;
16
+ }
17
+ /** Plays one call: an optional chime, then the lines in order. Calls never overlap. */
18
+ export declare function announce(lines: Line[], withChime: boolean): void;
19
+ export {};
@@ -0,0 +1,18 @@
1
+ import { EligibilityRule } from './types';
2
+ export interface RuleOptions {
3
+ patientTypes: Option[];
4
+ categories: Option[];
5
+ genders: Option[];
6
+ privileges: Option[];
7
+ sourceTypes: Option[];
8
+ }
9
+ export interface Option {
10
+ value: string;
11
+ label: string;
12
+ }
13
+ /** Sources each module issues tickets from; MANUAL is a patient added at the desk. */
14
+ export declare const SOURCES_BY_MODULE: Record<string, Option[]>;
15
+ /** Values the registration and module data use; any other value can still be typed in. */
16
+ export declare const defaultRuleOptions: (module: string) => RuleOptions;
17
+ /** A rule in plain words, e.g. "Government employee, grade 1–9, female". */
18
+ export declare function describeRule(rule: EligibilityRule, options: RuleOptions): string;
@@ -0,0 +1,213 @@
1
+ /** Shapes of the queue engine's API (crystal-redis-package patientqueue, /api/queue). */
2
+ export type TicketStatus = "WAITING" | "CALLED" | "SERVING" | "COMPLETED" | "SKIPPED" | "NO_SHOW" | "CANCELLED" | "TRANSFERRED";
3
+ export interface EligibilityRule {
4
+ patientTypes?: string[];
5
+ categories?: string[];
6
+ genders?: string[];
7
+ minAge?: number | null;
8
+ maxAge?: number | null;
9
+ minGovGrade?: number | null;
10
+ maxGovGrade?: number | null;
11
+ disabled?: boolean | null;
12
+ privileges?: string[];
13
+ sourceTypes?: string[];
14
+ departmentIds?: string[];
15
+ roomIds?: string[];
16
+ }
17
+ export interface CounterDesk {
18
+ id: string;
19
+ name: string;
20
+ nameBn?: string;
21
+ active: boolean;
22
+ paused?: boolean;
23
+ operatorIds?: string[];
24
+ }
25
+ export interface QueueLine {
26
+ id?: string;
27
+ module?: string;
28
+ code?: string;
29
+ name: string;
30
+ nameBn?: string;
31
+ prefix?: string;
32
+ description?: string;
33
+ active: boolean;
34
+ paused?: boolean;
35
+ archived?: boolean;
36
+ displayVisible: boolean;
37
+ sortOrder?: number;
38
+ allocationPriority?: number;
39
+ rules?: EligibilityRule[];
40
+ callPolicy?: "MANUAL" | "AUTO";
41
+ resetPolicy?: "DAILY" | "SHIFT";
42
+ shifts?: {
43
+ code: string;
44
+ start: string;
45
+ end: string;
46
+ }[];
47
+ capacity?: number;
48
+ priorityLimitPerDay?: number;
49
+ counters?: CounterDesk[];
50
+ operatorIds?: string[];
51
+ resourceType?: string;
52
+ resourceId?: string;
53
+ departmentId?: string;
54
+ effectiveFrom?: string | null;
55
+ effectiveTo?: string | null;
56
+ }
57
+ export interface SnapshotEntry {
58
+ tokenNo: string;
59
+ status: TicketStatus;
60
+ position?: number | null;
61
+ counterId?: string | null;
62
+ counterName?: string | null;
63
+ calledAt?: string | number | null;
64
+ recallCount?: number;
65
+ ticketId?: string;
66
+ patientId?: string;
67
+ patientIdentifier?: string;
68
+ patientName?: string;
69
+ patientLabel?: string;
70
+ priority?: boolean;
71
+ sourceType?: string;
72
+ sourceId?: string;
73
+ issuedAt?: string | number;
74
+ }
75
+ export interface LineSnapshot {
76
+ module: string;
77
+ lineId: string;
78
+ code: string;
79
+ name: string;
80
+ nameBn?: string;
81
+ active: boolean;
82
+ paused: boolean;
83
+ displayVisible: boolean;
84
+ callPolicy?: string;
85
+ version: number;
86
+ serviceDate: string;
87
+ counters: {
88
+ id: string;
89
+ name: string;
90
+ nameBn?: string;
91
+ active: boolean;
92
+ paused: boolean;
93
+ }[];
94
+ serving: SnapshotEntry[];
95
+ waiting: SnapshotEntry[];
96
+ waitingCount: number;
97
+ skipped?: SnapshotEntry[] | null;
98
+ generatedAt?: string;
99
+ }
100
+ export interface QueueTicket {
101
+ id: string;
102
+ lineId: string;
103
+ tokenNo: string;
104
+ status: TicketStatus;
105
+ counterId?: string;
106
+ patientName?: string;
107
+ }
108
+ export interface DisplayLineRef {
109
+ module: string;
110
+ lineId: string;
111
+ }
112
+ export interface DisplayProfile {
113
+ id?: string;
114
+ module?: string;
115
+ name: string;
116
+ active: boolean;
117
+ mode: "SINGLE" | "MULTI" | "MODULE" | "COMBINED";
118
+ lines: DisplayLineRef[];
119
+ modules?: string[];
120
+ layout?: string;
121
+ columns?: number | null;
122
+ upcomingCount: number;
123
+ language: "EN" | "BN" | "BOTH";
124
+ voiceEnabled: boolean;
125
+ chimeEnabled: boolean;
126
+ /** Say the patient's name in the spoken call (empty: yes). */
127
+ announcePatientName?: boolean | null;
128
+ /** Show the called patient's ID beside the token (empty: yes). */
129
+ showPatientIdentifier?: boolean | null;
130
+ title?: string;
131
+ bannerText?: string;
132
+ logoUrl?: string;
133
+ notices?: string[];
134
+ emptyMessage?: string;
135
+ emptyMessageBn?: string;
136
+ theme?: "LIGHT" | "DARK";
137
+ }
138
+ export interface QueueMe {
139
+ module: string;
140
+ userId: string;
141
+ configure: boolean;
142
+ supervise: boolean;
143
+ operate: boolean;
144
+ priority: boolean;
145
+ display: boolean;
146
+ serviceDate: string;
147
+ }
148
+ export interface ReportFigures {
149
+ key: string;
150
+ name: string;
151
+ issued: number;
152
+ served: number;
153
+ skipped: number;
154
+ noShow: number;
155
+ cancelled: number;
156
+ transferred: number;
157
+ waitingNow: number;
158
+ prioritised: number;
159
+ averageWaitMinutes?: number | null;
160
+ maxWaitMinutes?: number | null;
161
+ averageServiceMinutes?: number | null;
162
+ busyMinutes?: number | null;
163
+ }
164
+ export interface ReportSummary {
165
+ from: string;
166
+ to: string;
167
+ total: ReportFigures;
168
+ lines: ReportFigures[];
169
+ operators: ReportFigures[];
170
+ counters: ReportFigures[];
171
+ arrivalsByHour: number[];
172
+ byDay: Record<string, ReportFigures>;
173
+ }
174
+ export interface QueueEvent {
175
+ id: string;
176
+ lineId?: string;
177
+ ticketId?: string;
178
+ tokenNo?: string;
179
+ action: string;
180
+ fromStatus?: string;
181
+ toStatus?: string;
182
+ previousPosition?: number;
183
+ newPosition?: number;
184
+ reason?: string;
185
+ detail?: string;
186
+ actorId?: string;
187
+ actorName?: string;
188
+ restricted?: boolean;
189
+ at: string | number;
190
+ }
191
+ /** The part of an axios instance the queue screens use: every module already has one. */
192
+ export interface QueueHttp {
193
+ get<T = unknown>(url: string, config?: {
194
+ params?: Record<string, unknown>;
195
+ }): Promise<{
196
+ data: T;
197
+ }>;
198
+ post<T = unknown>(url: string, body?: unknown, config?: {
199
+ params?: Record<string, unknown>;
200
+ }): Promise<{
201
+ data: T;
202
+ }>;
203
+ put<T = unknown>(url: string, body?: unknown, config?: {
204
+ params?: Record<string, unknown>;
205
+ }): Promise<{
206
+ data: T;
207
+ }>;
208
+ delete<T = unknown>(url: string, config?: {
209
+ params?: Record<string, unknown>;
210
+ }): Promise<{
211
+ data: T;
212
+ }>;
213
+ }
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ interface ConfirmRequest {
3
+ title: string;
4
+ message: ReactNode;
5
+ confirmLabel?: string;
6
+ danger?: boolean;
7
+ }
8
+ /** A proper confirmation dialog in place of the browser's confirm box. */
9
+ export declare function useConfirm(): {
10
+ confirm: (r: ConfirmRequest) => Promise<boolean>;
11
+ dialog: import("react/jsx-runtime").JSX.Element;
12
+ };
13
+ export {};
@@ -0,0 +1,24 @@
1
+ import { LineSnapshot } from './types';
2
+ export interface StreamSource {
3
+ module: string;
4
+ /** The module's API root, e.g. https://api.example/hsms/pharmacy/ */
5
+ apiBase: string;
6
+ /** Lines to follow; empty follows every line of the module (display-visible ones in public view). */
7
+ lineIds?: string[];
8
+ }
9
+ export type StreamStatus = "connecting" | "live" | "reconnecting";
10
+ /**
11
+ * Follows lines live over each module's /api/queue/stream. Reconnects by itself with backoff; on
12
+ * reconnect the server sends the current state again, and older pictures never replace newer ones.
13
+ */
14
+ export declare function useQueueStream(sources: StreamSource[], options: {
15
+ /** public: tokens only; called: plus the called patient's name and ID; operator: everything. */
16
+ view: "public" | "called" | "operator";
17
+ hospitalId?: string;
18
+ getToken?: () => string | null;
19
+ basePath?: string;
20
+ onLine?: (snapshot: LineSnapshot, previous: LineSnapshot | undefined) => void;
21
+ }): {
22
+ lines: Record<string, LineSnapshot>;
23
+ status: Record<string, StreamStatus>;
24
+ };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,17 @@ export { default as Loader } from './components/ui/Loader';
26
26
  export { default as NetworkStatusIndicator } from './components/ui/NetworkStatusIndicator';
27
27
  export { default as RoutesConfigLayout } from './routes/RoutesConfigLayout';
28
28
  export { default as ThemeCustomization } from './theme/ThemeCustomization';
29
+ export { default as QueueManagement } from './components/queue/QueueManagement';
30
+ export type { QueueManagementProps } from './components/queue/QueueManagement';
31
+ export { defaultRuleOptions, SOURCES_BY_MODULE } from './components/queue/ruleOptions';
32
+ export type { RuleOptions } from './components/queue/ruleOptions';
33
+ export { default as QueueDisplayScreen } from './components/queue/QueueDisplayScreen';
34
+ export { createQueueClient, queueError } from './components/queue/queueClient';
35
+ export type { QueueClient } from './components/queue/queueClient';
36
+ export { useQueueStream } from './components/queue/useQueueStream';
37
+ export type { StreamSource, StreamStatus } from './components/queue/useQueueStream';
38
+ export * from './components/queue/queueLogic';
39
+ export type * from './components/queue/types';
29
40
  export { withFontFallback, FONT_FALLBACK_CHAIN } from './theme/fontFamily';
30
41
  export { configureCommonPackage, getApiBaseUrl, getCommonConfig, setApiBaseUrl, } from './config/env';
31
42
  export { configureAuthPackage, getAccountConsoleUrl, getAuthConfig, getPostLogoutRedirectUri, setAccountConsoleRoutes, setAccountConsoleUrl, setPostLogoutRedirectUri, } from './config/auth';