@nivaro/react 0.2.29 → 0.2.30

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/dist/index.d.ts CHANGED
@@ -3,15 +3,19 @@ import type { Command } from '@nivaro/sdk';
3
3
  import { Context } from 'react';
4
4
  import type { CSSProperties } from 'react';
5
5
  import { default as default_2 } from 'react';
6
+ import { DragEvent as DragEvent_2 } from 'react';
6
7
  import { FieldDependencyConfig } from '@nivaro/sdk';
7
8
  import { ImportParseResponse } from '@nivaro/sdk';
8
9
  import { ImportTemplateSummary } from '@nivaro/sdk';
9
10
  import { JSX } from 'react';
10
11
  import { JSXElementConstructor } from 'react';
12
+ import { ListResponse } from '@nivaro/sdk';
11
13
  import type { LucideIcon } from 'lucide-react';
12
14
  import { ManagedUser } from '@nivaro/sdk';
13
15
  import { MutableRefObject } from 'react';
14
16
  import { NivaroClient } from '@nivaro/sdk';
17
+ import { Query } from '@nivaro/sdk';
18
+ import { QueryKey } from '@tanstack/react-query';
15
19
  import { default as React_2 } from 'react';
16
20
  import { ReactElement } from 'react';
17
21
  import { ReactNode } from 'react';
@@ -122,17 +126,54 @@ export declare function AiFeedbackButtons({ requestId, className }: {
122
126
  className?: string;
123
127
  }): JSX.Element | null;
124
128
 
125
- export declare function AiMarkdown({ content, className, autolink }: {
129
+ export declare function AiMarkdown({ content, className, autolink, switchable, onChartPoint }: {
126
130
  content: string;
127
131
  className?: string;
128
132
  /** Turn friendly ids into record links. Default: on whenever a NivaroProvider is present. */
129
133
  autolink?: boolean;
134
+ /** Offer Table · Chart · List on blocks that hold rows (#1885). */
135
+ switchable?: boolean;
136
+ /** Make chart points clickable (drill into the rows behind a bar, point or slice). */
137
+ onChartPoint?: ChartPointHandler;
130
138
  }): JSX.Element;
131
139
 
140
+ /**
141
+ * "Remember this?" under an Ask AI answer (#1845). The model may offer a
142
+ * standing note it inferred ("By my zone I mean Zone 3"); the answer carries
143
+ * it as `memory_suggestions` — only to the person who asked (a shared reader
144
+ * never receives it). Nothing is saved until the Remember click, which POSTs
145
+ * /ai/memory: the person's own notes, the same caps as Profile → Ask AI
146
+ * memory. "Not now" only hides the offer here. Renders nothing without
147
+ * suggestions or a NivaroProvider.
148
+ */
149
+ export declare interface AiMemorySuggestion {
150
+ text: string;
151
+ }
152
+
153
+ export declare function AiMemorySuggestions({ suggestions, className }: {
154
+ suggestions?: AiMemorySuggestion[] | null;
155
+ className?: string;
156
+ }): JSX.Element | null;
157
+
132
158
  export declare function AiReviewCard({ templateId }: {
133
159
  templateId: string;
134
160
  }): React_2.JSX.Element;
135
161
 
162
+ /**
163
+ * A streamed AI answer on the client (#688). Socket-agnostic: the host hands
164
+ * in `subscribe(event, handler)` for its own transport (admin: the shared
165
+ * admin socket; a headless host: its socket, or an EventSource over the SSE
166
+ * form). The hook POSTs with `stream: true`, pairs the events to the
167
+ * stream id the 202 answered with — events that race ahead of that answer
168
+ * are buffered — and keeps the growing text, the status line and the
169
+ * narration (a tool round's own words) as state, flushed once per frame.
170
+ *
171
+ * A reply that comes back WHOLE (the server had no socket for the caller,
172
+ * or `stream` was not honoured) is handed to `onDone` straight away, so a
173
+ * caller never branches on the transport.
174
+ */
175
+ declare type AiStreamSubscribe = (event: 'ai:delta' | 'ai:status' | 'ai:done' | 'ai:error', handler: (payload: Record<string, unknown>) => void) => () => void;
176
+
136
177
  export declare function AlertManagerView({ defaultTab, hiddenTabs, onOpenReport, className }: AlertManagerViewProps): JSX.Element;
137
178
 
138
179
  export declare interface AlertManagerViewProps {
@@ -333,6 +374,10 @@ export declare function AsItWasSheet({ notificationId, title, onClose }: {
333
374
  onClose: () => void;
334
375
  }): JSX.Element;
335
376
 
377
+ export declare function AskContextProvider({ children }: {
378
+ children: ReactNode;
379
+ }): JSX.Element;
380
+
336
381
  /**
337
382
  * "Fill from a document" — a person drops a statement of work, a quote, a
338
383
  * spreadsheet on a NEW record and reviews what the model read out of it
@@ -363,6 +408,69 @@ declare type AskInput = AskRelationInput | {
363
408
  type: 'text';
364
409
  };
365
410
 
411
+ declare interface AskListFilter {
412
+ path: string;
413
+ op: string;
414
+ value: unknown;
415
+ not?: boolean;
416
+ }
417
+
418
+ export declare interface AskPageContext {
419
+ record?: AskRecordRef;
420
+ list?: {
421
+ collection: string;
422
+ label?: string;
423
+ ids: string[];
424
+ filters: AskListFilter[];
425
+ search?: string | null;
426
+ total?: number | null;
427
+ };
428
+ queue?: {
429
+ id: string;
430
+ label?: string;
431
+ scope?: string | null;
432
+ /** The queue's own filter JSON as the worklist sends it. */
433
+ filters?: string | null;
434
+ items: Array<{
435
+ collection: string;
436
+ id: string;
437
+ }>;
438
+ };
439
+ report?: {
440
+ id: string;
441
+ label?: string;
442
+ date_range?: unknown;
443
+ entity_filters?: unknown[];
444
+ };
445
+ }
446
+
447
+ export declare function AskPanel({ subscribe, connected, askPath }: {
448
+ /** The host's transport for ai:delta / ai:status / ai:done / ai:error. */
449
+ subscribe: AiStreamSubscribe;
450
+ connected?: () => boolean;
451
+ /** Where the full Ask AI page lives (gets `?conversation=<id>`). */
452
+ askPath?: string;
453
+ }): ReactPortal | null;
454
+
455
+ /**
456
+ * Ask AI from anywhere (#1835 #1933 #1886). The host mounts ONE
457
+ * AskContextProvider above its pages and one AskPanel inside it; a page says
458
+ * what is on screen with usePublishAskContext — the open record, the list or
459
+ * queue with its filters and visible rows, the report with its date range and
460
+ * filters. The panel shows that as a removable chip and sends it with the
461
+ * question as IDS AND FILTERS ONLY: the server reads everything again as the
462
+ * asker, so nothing a page publishes is trusted.
463
+ *
464
+ * Without the provider (a host that never mounts the panel) every hook here
465
+ * is a no-op.
466
+ */
467
+ declare interface AskRecordRef {
468
+ collection: string;
469
+ id: string;
470
+ /** What the chip says; never sent. */
471
+ label?: string;
472
+ }
473
+
366
474
  /** What a relation ask in the document-autofill review carries from the
367
475
  * field's own picker configuration. */
368
476
  declare type AskRelationInput = {
@@ -823,6 +931,19 @@ declare interface Chapter {
823
931
  title: string;
824
932
  }
825
933
 
934
+ /** Click on a chart point (#1943): the host opens the rows behind it. */
935
+ declare type ChartPointHandler = (label: string, spec: ChartSpec) => void;
936
+
937
+ /** A chart the model attached (#724): a fenced ```chart block holding JSON. */
938
+ declare type ChartSpec = {
939
+ type: 'bar' | 'line' | 'pie';
940
+ title?: string;
941
+ data: Array<{
942
+ label: string;
943
+ value: number;
944
+ }>;
945
+ };
946
+
826
947
  export declare function ChatAnalyticsView(): JSX.Element;
827
948
 
828
949
  /** Where a room view opens: the newest messages, or around a message / day. */
@@ -951,6 +1072,7 @@ export declare interface ChatMessage {
951
1072
  text: string;
952
1073
  at: string;
953
1074
  }>;
1075
+ poll?: ChatPoll | null;
954
1076
  }
955
1077
 
956
1078
  export declare interface ChatOnlineUser {
@@ -985,6 +1107,30 @@ export declare function ChatPanel({ open, onClose, renderMessageBody, requestedD
985
1107
  } | null;
986
1108
  }): JSX.Element | null;
987
1109
 
1110
+ /** A poll posted into a room (#2337); counts are server-side, anonymous polls carry no voters. */
1111
+ declare interface ChatPoll {
1112
+ id: number;
1113
+ message_id: number;
1114
+ question: string;
1115
+ multiple: boolean;
1116
+ anonymous: boolean;
1117
+ closes_at: string | null;
1118
+ closed_at: string | null;
1119
+ closed: boolean;
1120
+ options: Array<{
1121
+ index: number;
1122
+ label: string;
1123
+ count: number;
1124
+ voters?: Array<{
1125
+ id: string;
1126
+ name: string | null;
1127
+ }>;
1128
+ }>;
1129
+ mine: number[];
1130
+ total_voters: number;
1131
+ can_close: boolean;
1132
+ }
1133
+
988
1134
  export declare function ChatProvider({ children, me, onlineUsers, collections, globalRoom, globalLabel, entityPattern, entityUrl, roomLabel, recordUrl, sessionUrl, realtime, subscribeRooms, setTypingRoom, navigate, sound, theme }: ChatProviderProps): JSX.Element;
989
1135
 
990
1136
  export declare interface ChatProviderProps {
@@ -1044,7 +1190,7 @@ export declare function ChatRoomList({ rooms, onOpen, onNewGroup, archivedView,
1044
1190
  loading?: boolean;
1045
1191
  }): JSX.Element;
1046
1192
 
1047
- export declare function ChatRoomView({ room, label: labelProp, onBack, onOpenSettings, renderMessageBody, initialUnread, anchor: anchorProp }: {
1193
+ export declare function ChatRoomView({ room, label: labelProp, onBack, onOpenSettings, renderMessageBody, initialUnread, anchor: anchorProp, openThread }: {
1048
1194
  room: string;
1049
1195
  label: string;
1050
1196
  onBack: () => void;
@@ -1057,6 +1203,8 @@ export declare function ChatRoomView({ room, label: labelProp, onBack, onOpenSet
1057
1203
  initialUnread?: number;
1058
1204
  /** Open around a message (a search hit, #977) or a day (#976). */
1059
1205
  anchor?: ChatAnchor;
1206
+ /** Deep link (?thread=): open this thread's pane once the root is readable. */
1207
+ openThread?: number | null;
1060
1208
  }): JSX.Element;
1061
1209
 
1062
1210
  /** Search every room in MY sidebar (server enforces visibility by
@@ -1155,6 +1303,9 @@ export declare const CLEAN_RECORDING_ATTR = "data-nvr-recording-clean";
1155
1303
  /** Clear the schema cache (e.g. after a schema change). */
1156
1304
  export declare function clearFormSchemaCache(collection?: string): void;
1157
1305
 
1306
+ /** Sign-out: every entry on this browser goes, whoever's it was. */
1307
+ export declare function clearRecordOutbox(): Promise<void>;
1308
+
1158
1309
  declare interface ClientAction {
1159
1310
  type: 'open-sidebar';
1160
1311
  collection: string;
@@ -1214,6 +1365,15 @@ declare type ClipKind = 'mp4' | 'gif';
1214
1365
 
1215
1366
  declare type ClipStatus = 'queued' | 'rendering' | 'ready' | 'failed';
1216
1367
 
1368
+ export declare interface ClockSample {
1369
+ /** This client's clock when the request left. */
1370
+ sent: number;
1371
+ /** The server's clock when it answered. */
1372
+ server: number;
1373
+ /** This client's clock when the answer arrived. */
1374
+ received: number;
1375
+ }
1376
+
1217
1377
  export declare function CloneDialog({ collection, itemId, fields, relations, currentValues, onSuccess }: CloneDialogProps): JSX.Element;
1218
1378
 
1219
1379
  declare interface CloneDialogProps {
@@ -1345,10 +1505,24 @@ export declare function CollectionImportPanel({ initialJobId, onJobOpen }: {
1345
1505
  */
1346
1506
  export declare interface CollectionUpdateEvent {
1347
1507
  collection: string;
1348
- item: string | number;
1508
+ /** The record that changed; null on a coalesced message (#1681), whose ids are in `items`. */
1509
+ item: string | number | null;
1349
1510
  action?: 'create' | 'update' | 'delete';
1350
1511
  changed_fields?: string[];
1512
+ /** 'raw' — a procedure, import or script made the write (#1875); 'import' — a staged import
1513
+ * run wrote it through the items service (#1826). */
1514
+ source?: 'raw' | 'import';
1515
+ /** With item '*': a raw write touched this many records of the collection. */
1516
+ bulk?: number;
1351
1517
  _seq?: number;
1518
+ /**
1519
+ * #1681 — a burst merged into one message (only for hosts that opted in with the
1520
+ * `coalesce` feature): the ids it covers, or null with `many` when there were too many.
1521
+ */
1522
+ coalesced?: boolean;
1523
+ items?: Array<string | number> | null;
1524
+ many?: boolean;
1525
+ count?: number;
1352
1526
  }
1353
1527
 
1354
1528
  export declare interface Column<T = Record<string, unknown>> {
@@ -1456,6 +1630,16 @@ export declare type ComponentOverrides = {
1456
1630
  * several conditions AND together. */
1457
1631
  export declare function conditionsToFilter(conditions: string | undefined): Record<string, unknown> | null;
1458
1632
 
1633
+ /**
1634
+ * Keep sounds apart per sign-in: a "View as" tab is someone else and must not be silenced by
1635
+ * (or silence) the administrator's own tabs. Call before the first sound; same idea as the
1636
+ * socket leader's key.
1637
+ */
1638
+ export declare function configureTabSound(nextScope: string): void;
1639
+
1640
+ /** Keep a "View as" tab apart from the administrator's own tabs (same idea as the socket leader's key). */
1641
+ export declare function configureUserSync(scope: string): void;
1642
+
1459
1643
  export declare function ConformanceView({ className }: {
1460
1644
  className?: string;
1461
1645
  }): JSX.Element;
@@ -1503,6 +1687,8 @@ export declare function createGatedClient(client: NivaroClient, opts?: {
1503
1687
 
1504
1688
  export declare function createLeaderSocket(key: string, cbs: LeaderCallbacks): LeaderSocketHandle;
1505
1689
 
1690
+ export declare function createSocketRealtime(opts: SocketRealtimeOptions): SocketRealtime;
1691
+
1506
1692
  export declare function CronBuilder({ value, onChange, disabled }: {
1507
1693
  value: string;
1508
1694
  onChange: (cron: string) => void;
@@ -1574,7 +1760,7 @@ export declare function CustomStatusEditor({ status, invalidate, theme, showExpi
1574
1760
  className?: string;
1575
1761
  }): JSX.Element;
1576
1762
 
1577
- export declare function DataTable<T = Record<string, unknown>>({ columns, rows, rowKey, total, page, limit, isLoading, isError, errorMessage, sort, onSortChange, onPageChange, onRowClick, onRowContextMenu, searchValue, onSearchChange, searchPlaceholder, filterDefs, filterValues, onFilterChange, toolbarRight, emptyMessage, minBodyHeight, fillHeight, footer, hideFilterRow, nowrapCells, density, pinFirstColumn, columnPins, onColumnPinChange, columnFilterRow, hScrollProxy, selectedIds, onSelectionChange, rowClassName, enterKey, rowGroups, collapsedGroups, onToggleGroup }: DataTableProps<T>): React_2.JSX.Element;
1763
+ export declare function DataTable<T = Record<string, unknown>>({ columns, rows, rowKey, total, page, limit, isLoading, isError, errorMessage, sort, onSortChange, onPageChange, onRowClick, onRowContextMenu, searchValue, onSearchChange, searchPlaceholder, filterDefs, filterValues, onFilterChange, toolbarRight, emptyMessage, minBodyHeight, fillHeight, footer, hideFilterRow, nowrapCells, density, pinFirstColumn, columnPins, onColumnPinChange, columnFilterRow, hScrollProxy, selectedIds, onSelectionChange, rowClassName, rowDragProps, rowTitle, enterKey, rowGroups, collapsedGroups, onToggleGroup }: DataTableProps<T>): React_2.JSX.Element;
1578
1764
 
1579
1765
  export declare interface DataTableProps<T = Record<string, unknown>> {
1580
1766
  columns: Column<T>[];
@@ -1642,6 +1828,13 @@ export declare interface DataTableProps<T = Record<string, unknown>> {
1642
1828
  onSelectionChange?: (ids: string[]) => void;
1643
1829
  /** Optional per-row class — e.g. at-risk background tinting. */
1644
1830
  rowClassName?: (row: T) => string | undefined;
1831
+ /** Optional per-row drag props — rows dragged into Ask AI (#1886). */
1832
+ rowDragProps?: (row: T) => {
1833
+ draggable?: boolean;
1834
+ onDragStart?: (e: React_2.DragEvent) => void;
1835
+ };
1836
+ /** Optional per-row tooltip — e.g. "Changed by Beth just now". */
1837
+ rowTitle?: (row: T) => string | undefined;
1645
1838
  /** Grouped rendering: when set, `rows` is ignored for the body; each group renders
1646
1839
  * a full-width header row followed by its rows (unless collapsed). Pagination hides. */
1647
1840
  rowGroups?: Array<{
@@ -1770,6 +1963,11 @@ export declare function dmPeer(room: string, self: string): string | null;
1770
1963
 
1771
1964
  export declare function dmRoom(a: string, b: string): string;
1772
1965
 
1966
+ /** The small bell-off mark shown on a person's own avatar while do not disturb is on. */
1967
+ export declare function DndMark({ className }: {
1968
+ className?: string;
1969
+ }): JSX.Element;
1970
+
1773
1971
  declare type DocumentApplySelection = {
1774
1972
  values: Record<string, unknown>;
1775
1973
  lines_by_alias: Record<string, Array<{
@@ -1883,6 +2081,12 @@ declare type DocumentProposal = {
1883
2081
  hints_used?: string[];
1884
2082
  };
1885
2083
 
2084
+ /**
2085
+ * Do not disturb (#2114): holds toasts and sounds on every tab and device until a time or
2086
+ * until switched off. The inbox still fills and critical notifications still break through.
2087
+ */
2088
+ export declare function DoNotDisturbRow(): JSX.Element;
2089
+
1886
2090
  /** One dot per partner, worst outcome winning — a red dot must never be
1887
2091
  * hidden behind a green one from the same partner. Superseded rows are
1888
2092
  * never a partner's CURRENT state, so they never contribute a dot at all. */
@@ -3441,7 +3645,8 @@ export declare interface ImportProgressEvent {
3441
3645
  stage: 'row_count' | 'preparing' | 'importing' | 'completed' | 'error';
3442
3646
  row_count?: number;
3443
3647
  duration?: number;
3444
- error?: string;
3648
+ /** `true` on a failure — the message itself stays behind the authenticated run routes. */
3649
+ error?: string | boolean;
3445
3650
  }
3446
3651
 
3447
3652
  /**
@@ -4214,6 +4419,17 @@ export declare function ItemLockBanner({ lockHolder, onTakeOver, takingOver, isA
4214
4419
  joining?: boolean;
4215
4420
  }): JSX.Element | null;
4216
4421
 
4422
+ /**
4423
+ * The Jobs tray (#1724) — long things the signed-in person started (bulk runs, backfills,
4424
+ * imports, exports, PDFs) at the bottom of EVERY page, with live progress, then a result with a
4425
+ * link to the details or the finished file. Entries follow the person across pages and tabs until
4426
+ * they dismiss them. Mount once in the app shell, inside a client + navigation provider; the
4427
+ * host forwards the socket's `job:progress` (see `relayLiveEvent`).
4428
+ *
4429
+ * Portals to <body>: a `fixed` element under an animated page wrapper anchors to the wrapper.
4430
+ */
4431
+ export declare function JobsTray(): ReactPortal | null;
4432
+
4217
4433
  export declare function JsonMapEditor({ config, scope }: {
4218
4434
  config: JsonMapEditorConfig;
4219
4435
  scope: Record<string, unknown>;
@@ -4454,6 +4670,63 @@ declare interface ListRequest {
4454
4670
  page?: number;
4455
4671
  }
4456
4672
 
4673
+ /**
4674
+ * Live data hooks for headless frontends (#1751).
4675
+ *
4676
+ * const { data: order, deleted } = useLiveRecord('orders', id)
4677
+ * const { data: page } = useLiveList('orders', { filter: { status: { _eq: 'open' } }, limit: 25 })
4678
+ *
4679
+ * Each is a react-query read through the viewer's own permission-checked `/items` route that
4680
+ * stays current: when the host mounts a realtime adapter (`RealtimeContext`, e.g.
4681
+ * `createSocketRealtime`), other people's writes are patched into the cached data in place —
4682
+ * the collection browser's pattern — and without one (or while the socket is reconnecting) the
4683
+ * read polls instead.
4684
+ *
4685
+ * The socket only ever says THAT a record changed (ids, action, field names). Values always come
4686
+ * from a fresh read as the viewer, so row filters, User Scopes and field policies apply exactly
4687
+ * as they do for the first load.
4688
+ */
4689
+ export declare interface LiveHookOptions {
4690
+ /** Pause the read and the live feed. */
4691
+ enabled?: boolean;
4692
+ /** Poll interval while there is no live socket (default 30 s; 0 = never). */
4693
+ pollMs?: number;
4694
+ /** Slow safety poll while the socket is live (default none). */
4695
+ safetyPollMs?: number;
4696
+ /** Burst window: events inside it are handled as one patch (default 250 ms). */
4697
+ debounceMs?: number;
4698
+ /** Also react to this tab's own writes (default false: a save never echoes back). */
4699
+ includeOwn?: boolean;
4700
+ }
4701
+
4702
+ export declare function liveListKey(collection: string, query?: Query<any>): QueryKey;
4703
+
4704
+ export declare interface LiveListOptions extends LiveHookOptions {
4705
+ }
4706
+
4707
+ export declare type LiveListResult<T> = UseQueryResult<ListResponse<T>> & {
4708
+ /** Changes arrive over the socket (false: the read is polling). */
4709
+ live: boolean;
4710
+ };
4711
+
4712
+ export declare function liveRecordKey(collection: string, id: string | number | null | undefined, fields?: string[]): QueryKey;
4713
+
4714
+ export declare interface LiveRecordOptions extends LiveHookOptions {
4715
+ /**
4716
+ * Fields to read (the `/items` `fields` list, dotted paths allowed). With an explicit list a
4717
+ * change re-reads only the named fields it touched; without one the whole record is re-read
4718
+ * (a virtual computed field may depend on any column).
4719
+ */
4720
+ fields?: string[];
4721
+ }
4722
+
4723
+ export declare type LiveRecordResult<T> = UseQueryResult<T | null> & {
4724
+ /** The record was deleted (or the viewer lost access to it) while mounted. */
4725
+ deleted: boolean;
4726
+ /** Changes arrive over the socket (false: the read is polling). */
4727
+ live: boolean;
4728
+ };
4729
+
4457
4730
  declare interface LockHolder {
4458
4731
  locked_by: string;
4459
4732
  locked_by_name: string | null;
@@ -4635,6 +4908,13 @@ declare interface MatrixEditorConfig {
4635
4908
  };
4636
4909
  }
4637
4910
 
4911
+ /**
4912
+ * The offset from a few samples: the server stamped its answer somewhere inside the round
4913
+ * trip, so assume the midpoint, and trust the sample with the shortest round trip (the least
4914
+ * room for the stamp to sit off-centre). Null when no sample is usable.
4915
+ */
4916
+ export declare function measureClockOffset(samples: ClockSample[]): number | null;
4917
+
4638
4918
  declare interface MessageToken {
4639
4919
  text: string;
4640
4920
  entity?: string;
@@ -5165,6 +5445,8 @@ export declare function onFieldInterfacesChange(cb: () => void): () => void;
5165
5445
  */
5166
5446
  export declare function onIdleChange(fn: (idle: boolean) => void): () => void;
5167
5447
 
5448
+ export declare function openAskPanel(question?: string): void;
5449
+
5168
5450
  export declare function openCatalogItem(collection: string, id: string, context?: Record<string, unknown>): void;
5169
5451
 
5170
5452
  export declare function openChatRoom(room: string, label?: string): void;
@@ -5575,6 +5857,12 @@ export declare interface PersonProfileData {
5575
5857
  minutes: number;
5576
5858
  label: string | null;
5577
5859
  } | null;
5860
+ /** #1982 — "appear away". */
5861
+ away?: boolean;
5862
+ /** #2114 — notifications held (do not disturb). */
5863
+ dnd?: boolean;
5864
+ /** #1982 — false: the viewer's scopes keep this person off the Online list. */
5865
+ visible?: boolean;
5578
5866
  };
5579
5867
  teams: Array<{
5580
5868
  id: number;
@@ -5788,8 +6076,14 @@ export declare type PlayerHandle = {
5788
6076
  remeasure(): void;
5789
6077
  };
5790
6078
 
5791
- /** Play the configured notification sound. No-op for 'off'/unknown/unavailable audio. */
5792
- export declare function playNotificationSound(kind: NotificationSound | string | null | undefined): void;
6079
+ /**
6080
+ * Play the configured notification sound. No-op for 'off'/unknown/unavailable audio.
6081
+ * With several tabs open only the most recently used one plays (#2435) — except `preview`,
6082
+ * the sample a settings control plays for the person looking at it.
6083
+ */
6084
+ export declare function playNotificationSound(kind: NotificationSound | string | null | undefined, opts?: {
6085
+ preview?: boolean;
6086
+ }): void;
5793
6087
 
5794
6088
  declare type Point = {
5795
6089
  x: number;
@@ -6331,7 +6625,7 @@ export declare function QueueItemSheet({ item, onOpenChange, onClaim, onRelease,
6331
6625
  itemLayout?: string | null;
6332
6626
  }): JSX.Element;
6333
6627
 
6334
- export declare function QueueKanbanBoard({ items, onDrop, onCardClick, onClaim, onRelease, swimlaneBy, stateLabels, laneLabel, claimsEnabled }: {
6628
+ export declare function QueueKanbanBoard({ items, onDrop, onCardClick, onClaim, onRelease, swimlaneBy, stateLabels, laneLabel, claimsEnabled, onDraggingChange }: {
6335
6629
  items: QueueItemRow[];
6336
6630
  onDrop: (item: QueueItemRow, targetState: string) => void;
6337
6631
  onCardClick: (item: QueueItemRow) => void;
@@ -6345,6 +6639,8 @@ export declare function QueueKanbanBoard({ items, onDrop, onCardClick, onClaim,
6345
6639
  laneLabel?: (key: string) => string;
6346
6640
  /** When false the per-card Claim/Release button is hidden. */
6347
6641
  claimsEnabled?: boolean;
6642
+ /** Tells the host a card is mid-drag, so live updates do not reshuffle cards under it. */
6643
+ onDraggingChange?: (dragging: boolean) => void;
6348
6644
  }): JSX.Element;
6349
6645
 
6350
6646
  declare interface QueueOwner {
@@ -6358,8 +6654,14 @@ declare interface QueueOwner_2 {
6358
6654
  }
6359
6655
 
6360
6656
  export declare interface QueueRealtimeAdapter {
6361
- /** Subscribe to update events for these collections; call onUpdate per event; return unsubscribe. */
6362
- subscribe: (collections: string[], onUpdate: () => void) => () => void;
6657
+ /** Subscribe to update events for these collections; call onUpdate per event (with the
6658
+ * `collection:update` payload when the host has it); return unsubscribe. */
6659
+ subscribe: (collections: string[], onUpdate: (ev?: {
6660
+ collection?: string;
6661
+ item?: unknown;
6662
+ action?: string;
6663
+ changed_fields?: string[];
6664
+ }) => void) => () => void;
6363
6665
  }
6364
6666
 
6365
6667
  export declare function QueueWorklist({ queueId, realtime, renderError, hideCreateActions, onAsk }: QueueWorklistProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null;
@@ -6491,10 +6793,48 @@ export declare interface RealtimeAdapter {
6491
6793
  on(event: string, cb: (payload: any) => void): () => void;
6492
6794
  /** Emit an event to the server (record:uploading, record:join…). */
6493
6795
  emit(event: string, payload?: any): void;
6796
+ /** Optional (#1725): the connection's current state. Hosts without it are treated as live. */
6797
+ status?(): RealtimeStatus;
6798
+ /** Optional (#1725): called on every state change. Returns unsubscribe. */
6799
+ onStatus?(cb: (s: RealtimeStatus) => void): () => void;
6800
+ /**
6801
+ * Join an admin-only server room (`jobs`, `conformance`…) so its events reach `on`.
6802
+ * Returns leave. Optional: a host without it simply never receives those events,
6803
+ * and the component keeps polling.
6804
+ */
6805
+ joinWatch?(room: string): () => void;
6494
6806
  }
6495
6807
 
6496
6808
  export declare const RealtimeContext: Context<RealtimeAdapter | null>;
6497
6809
 
6810
+ /**
6811
+ * The stale mark lists and queues show while live updates are paused (#1725): what is on
6812
+ * screen may be behind. Nothing while live, or for a host without a realtime status.
6813
+ */
6814
+ export declare function RealtimeStaleMark({ className }: {
6815
+ className?: string;
6816
+ }): JSX.Element | null;
6817
+
6818
+ /**
6819
+ * #1725 / #1672 — the live connection's state, for the reconnect banner and the stale mark on
6820
+ * lists and queues. `transport` is how events arrive: the websocket, HTTP long-polling when the
6821
+ * upgrade was blocked, or the read-only SSE stream when polling is off too.
6822
+ */
6823
+ export declare interface RealtimeStatus {
6824
+ state: 'live' | 'reconnecting';
6825
+ transport: 'websocket' | 'polling' | 'sse' | null;
6826
+ /** Set once after a reconnect whose catch-up had to reload: what was refreshed. */
6827
+ refreshed?: string | null;
6828
+ }
6829
+
6830
+ /**
6831
+ * Reconnect banner (#1725): while the host's live connection is down, a small strip says live
6832
+ * updates are paused; after the reconnect and catch-up it says so (and, when catch-up had to
6833
+ * reload, what was refreshed), then clears itself. Renders nothing for hosts without a
6834
+ * realtime status, and nothing while the browser is offline (OfflineBanner says that).
6835
+ */
6836
+ export declare function RealtimeStatusBanner(): JSX.Element | null;
6837
+
6498
6838
  export declare function RecentRecordsRail({ limit, title, className }: {
6499
6839
  limit?: number;
6500
6840
  title?: string;
@@ -6710,6 +7050,18 @@ declare type RecordingHandoff = {
6710
7050
  };
6711
7051
  };
6712
7052
 
7053
+ /**
7054
+ * Mounted ONCE by a host (admin's AppLayout), inside a NivaroProvider and a
7055
+ * QueryClientProvider: binds the outbox to the signed-in person so saves left
7056
+ * from an earlier visit replay on any page, and says what happened to them.
7057
+ * `onOpenRecord` opens a record whose replay hit someone else's change — the
7058
+ * record form then opens its merge dialog.
7059
+ */
7060
+ export declare function RecordOutboxHost({ userId, onOpenRecord }: {
7061
+ userId: string | null | undefined;
7062
+ onOpenRecord?: (collection: string, itemId: string) => void;
7063
+ }): null;
7064
+
6713
7065
  export declare function RecordReadView({ collection, itemId, layoutData, flush, renderSlot, integrityMarks, renderGrid, onEditSection, gridCounts }: {
6714
7066
  collection: string;
6715
7067
  itemId: string;
@@ -6759,6 +7111,23 @@ export declare function RecordRecapStrip({ collection, itemId }: {
6759
7111
  itemId: string;
6760
7112
  }): JSX.Element | null;
6761
7113
 
7114
+ /**
7115
+ * Live "who is doing what" signals on a record, a support ticket or an issue — names only,
7116
+ * never content, sent only to people already admitted to the same room (the record read gate,
7117
+ * the ticket gate):
7118
+ *
7119
+ * note "Beth is writing a note" (#1721, record rooms)
7120
+ * transition "Kim is approving" (#1722, record rooms)
7121
+ * reply "Kim is replying" (#2026, ticket pages)
7122
+ * viewers "Kim is looking at this" (#1882, ticket and issue pages)
7123
+ *
7124
+ * A signal is a heartbeat, not a toggle: the sender repeats it while it is true and the
7125
+ * receiver lets it lapse after SIGNAL_TTL_MS, so a closed tab or a dropped connection never
7126
+ * leaves a stale "is typing" behind. A host with a separate record-room socket (the admin)
7127
+ * relays through `nvr:record-signal-out` and `relayLiveEvent('record:signal')`.
7128
+ */
7129
+ declare type RecordSignalKind = 'note' | 'transition';
7130
+
6762
7131
  /**
6763
7132
  * Per-record notification subscription — a bell in the item header that lets
6764
7133
  * any user watch this specific record. Backed entirely by the existing
@@ -7393,6 +7762,16 @@ declare interface SendInput {
7393
7762
  urgent?: boolean;
7394
7763
  }
7395
7764
 
7765
+ /**
7766
+ * Server time (#2132). A machine whose clock drifts shows "2 minutes ago" for something that
7767
+ * just happened and runs countdowns early or late. The host measures the offset between this
7768
+ * clock and the server's when its socket connects (`measureClockOffset` over a few `time:sync`
7769
+ * round trips) and stores it here; relative labels and countdowns read `serverNow()` instead of
7770
+ * `Date.now()`. Zero until measured, so a host without a socket behaves exactly as before.
7771
+ */
7772
+ /** The server's current time, in epoch milliseconds, as best this client knows it. */
7773
+ export declare function serverNow(): number;
7774
+
7396
7775
  /**
7397
7776
  * rrweb session recorder for headless frontends — two modes, one hook
7398
7777
  * (the exact model the admin app runs; see admin/src/lib/use-session-recorder.ts).
@@ -7458,6 +7837,8 @@ export declare function setNumberFormat(opts: {
7458
7837
  * reads as Demo User during a clean recording. Hosts call it once they know. */
7459
7838
  export declare function setRecordingSelf(userId: string | number | null | undefined): void;
7460
7839
 
7840
+ export declare function setServerClockOffset(ms: number): void;
7841
+
7461
7842
  export declare function setTimeDisplay(mode: string | null | undefined): void;
7462
7843
 
7463
7844
  /**
@@ -7508,6 +7889,14 @@ declare interface SignalDrill {
7508
7889
  id: string;
7509
7890
  }
7510
7891
 
7892
+ declare interface SignalPerson {
7893
+ id: string;
7894
+ name: string;
7895
+ }
7896
+
7897
+ /** "Beth is writing a note", "Beth and Kim are approving". */
7898
+ export declare function signalSentence(names: string[], verbPhrase: string): string | null;
7899
+
7511
7900
  declare interface SignalThreshold {
7512
7901
  key: string;
7513
7902
  label: string;
@@ -7629,6 +8018,77 @@ export declare function SnoozeMenu({ signal, signalLabel, rowKey, group, default
7629
8018
  compact?: boolean;
7630
8019
  }): JSX.Element;
7631
8020
 
8021
+ /**
8022
+ * A RealtimeAdapter over one Socket.io connection the HOST already holds (#2027, #1751) — what a
8023
+ * portal or headless frontend mounts in `RealtimeContext` so every shared live surface (lists,
8024
+ * record pages, My Work, Notes, tasks, ops pages, the @nivaro/react live hooks) works there the
8025
+ * way it does in the admin app, without per-app socket wiring.
8026
+ *
8027
+ * const realtime = createSocketRealtime({ socket: () => getSocket() })
8028
+ * <RealtimeContext.Provider value={realtime}>…</RealtimeContext.Provider>
8029
+ *
8030
+ * The host keeps owning the connection: it creates the socket, sends `auth {token}` on connect
8031
+ * and its `client:hello`. The adapter owns everything room-shaped on top of it:
8032
+ *
8033
+ * - `collection:join` / `collection:leave`, reference counted per collection;
8034
+ * `admin:join` (watch rooms) and `ops:join` (live operations topics) likewise.
8035
+ * - Every held room is joined again after each `auth:ok` (a reconnect is a new server socket).
8036
+ * - Missed-event catch-up: events carry `_seq`; after a reconnect the adapter sends its cursor
8037
+ * (`catchup {cursor}`), replays `catchup:events` into the same listeners, and turns a
8038
+ * `catchup:full` (the journal no longer covers the gap) into the `nvr:catchup-full` window event
8039
+ * lists and records already reload on.
8040
+ * - `access:changed` with rooms taken away → `nvr:access-changed`; `config:update` →
8041
+ * `nvr:config-update`; `client:force-refresh` → `nvr:force-refresh` (the window events admin's
8042
+ * socket raises, so shared banners and forms behave the same in every host).
8043
+ * - Connection state for the reconnect banner and stale marks (`status` / `onStatus`).
8044
+ *
8045
+ * The socket is duck-typed (socket.io-client's `Socket` fits), so this package takes no
8046
+ * dependency on socket.io-client. It never decides what a viewer may see: every room is gated by
8047
+ * the server at join time, and payloads carry ids and field names only.
8048
+ */
8049
+ /** The slice of a socket.io-client `Socket` the adapter uses. */
8050
+ export declare interface SocketLike {
8051
+ connected: boolean;
8052
+ on(event: string, cb: (...args: any[]) => void): unknown;
8053
+ off(event: string, cb?: (...args: any[]) => void): unknown;
8054
+ emit(event: string, ...args: any[]): unknown;
8055
+ onAny?(cb: (event: string, ...args: any[]) => void): unknown;
8056
+ listeners?(event: string): Array<(...args: any[]) => void>;
8057
+ io?: {
8058
+ engine?: {
8059
+ transport?: {
8060
+ name?: string;
8061
+ };
8062
+ };
8063
+ };
8064
+ }
8065
+
8066
+ export declare interface SocketRealtime extends RealtimeAdapter {
8067
+ status(): RealtimeStatus;
8068
+ onStatus(cb: (s: RealtimeStatus) => void): () => void;
8069
+ joinWatch(room: string): () => void;
8070
+ /** Collections, watch rooms and ops topics currently held (for diagnostics and tests). */
8071
+ held(): {
8072
+ collections: string[];
8073
+ watch: string[];
8074
+ ops: string[];
8075
+ };
8076
+ }
8077
+
8078
+ export declare interface SocketRealtimeOptions {
8079
+ /** The host's socket, or a getter (called lazily, on the first subscription). */
8080
+ socket: SocketLike | (() => SocketLike);
8081
+ /**
8082
+ * Window events to raise from socket events (all on by default). Turn one off when the host
8083
+ * already raises it itself, so a banner does not run twice.
8084
+ */
8085
+ windowEvents?: Partial<Record<SocketRealtimeWindowEvent, boolean>>;
8086
+ /** How long a reconnect waits for its catch-up answer before it counts as live again. */
8087
+ catchupTimeoutMs?: number;
8088
+ }
8089
+
8090
+ export declare type SocketRealtimeWindowEvent = 'catchupFull' | 'accessChanged' | 'configUpdate' | 'forceRefresh';
8091
+
7632
8092
  declare type Speed = 0.5 | 1 | 1.5 | 2 | 4;
7633
8093
 
7634
8094
  export declare function splitMessageTokens(text: string, entityPattern: string): MessageToken[];
@@ -8019,6 +8479,15 @@ declare type Tone = 'accent' | 'warning' | 'neutral';
8019
8479
  * (superseded) is informational (neutral). */
8020
8480
  export declare function toneForOutcome(outcome: string): 'danger' | 'warning' | 'neutral' | 'positive';
8021
8481
 
8482
+ declare interface TopicPresence {
8483
+ /** The other people on this page right now. */
8484
+ viewers: SignalPerson[];
8485
+ /** Names of the other people replying right now. */
8486
+ replying: string[];
8487
+ /** Tell the others you are (or stopped) replying. Call on every keystroke burst; it throttles. */
8488
+ signalReplying: (active: boolean) => void;
8489
+ }
8490
+
8022
8491
  /** Install the listeners. Safe to call more than once. */
8023
8492
  export declare function trackActivity(): void;
8024
8493
 
@@ -8147,6 +8616,12 @@ declare interface UnsavedSummary {
8147
8616
  text: string;
8148
8617
  }
8149
8618
 
8619
+ /** The ids an update covers: one, a coalesced list, or null = "too many — refresh it all". */
8620
+ export declare function updateItemIds(ev: CollectionUpdateEvent): Array<string | number> | null;
8621
+
8622
+ /** Whether an update may touch record `id` (a `many` burst touches everything). */
8623
+ export declare function updateTouches(ev: CollectionUpdateEvent, id: string | number): boolean;
8624
+
8150
8625
  /** An uploaded music file (POST /help-videos/:id/music). */
8151
8626
  declare interface UploadedMusic {
8152
8627
  id: string;
@@ -8206,6 +8681,15 @@ export declare function useApiFetchConfig(): {
8206
8681
 
8207
8682
  export declare function useApiUpdate(): ApiVersionInfo | null;
8208
8683
 
8684
+ /**
8685
+ * Drag props for a row or chip that can be dropped into the panel (#1886).
8686
+ * Only while the panel is open — rows stay text-selectable otherwise.
8687
+ */
8688
+ export declare function useAskRecordDrag(): (ref: AskRecordRef) => {
8689
+ draggable?: boolean;
8690
+ onDragStart?: (e: DragEvent_2) => void;
8691
+ };
8692
+
8209
8693
  /** Every run the shell should show or a form may pick up. */
8210
8694
  export declare function useAutofillRuns(): AutofillRun[];
8211
8695
 
@@ -8333,6 +8817,9 @@ export declare function useDebounced<T>(value: T, delayMs?: number): T;
8333
8817
 
8334
8818
  export declare function useDeleteMessage(room: string): UseMutationResult<unknown, Error, number, unknown>;
8335
8819
 
8820
+ /** Re-render when do not disturb is due to end, so the mark and the row clear on time. */
8821
+ export declare function useDndActive(): boolean;
8822
+
8336
8823
  export declare function useDrilldown(): DrilldownContextValue | null;
8337
8824
 
8338
8825
  export declare function useDrilldownViews(): Record<string, DrilldownViewOverride>;
@@ -8367,7 +8854,7 @@ export declare function useFeatureFlag(key: string): boolean;
8367
8854
  /**
8368
8855
  * Feature flags client (#651): `useFeatureFlag('new_dashboard')` — the
8369
8856
  * caller's effective set comes from GET /feature-flags/mine (role +
8370
- * percentage resolved server-side), cached 60s. Unknown flags and fetch
8857
+ * percentage resolved server-side), cached 60s and re-read when a flag is toggled. Unknown flags and fetch
8371
8858
  * failures resolve FALSE, so a flag can gate new code with zero risk to the
8372
8859
  * old path.
8373
8860
  */
@@ -8485,6 +8972,20 @@ export declare function useItemNavigation(): {
8485
8972
  open: (target: ItemLinkTarget) => void;
8486
8973
  };
8487
8974
 
8975
+ /**
8976
+ * A list read (`readItems` query), kept current: rows others change are re-read as the viewer
8977
+ * and patched in place, rows that stop matching leave, deletes drop out, and anything whose
8978
+ * place the client cannot know (a new match, a reorder, a bulk write) refetches the page quietly
8979
+ * — the old rows stay on screen until the new ones arrive.
8980
+ */
8981
+ export declare function useLiveList<T extends Record<string, unknown> = Record<string, unknown>>(collection: string | null | undefined, query?: Query<T>, opts?: LiveListOptions): LiveListResult<T>;
8982
+
8983
+ /**
8984
+ * One record, kept current. `data` is null when the record does not exist or the viewer cannot
8985
+ * read it (the server answers both the same way).
8986
+ */
8987
+ export declare function useLiveRecord<T extends Record<string, unknown> = Record<string, unknown>>(collection: string | null | undefined, id: string | number | null | undefined, opts?: LiveRecordOptions): LiveRecordResult<T>;
8988
+
8488
8989
  /**
8489
8990
  * Mark read. The server upserts against UNIQUE(user, room), so the old
8490
8991
  * select-then-insert dance (and the per-room promise chain that stopped it
@@ -8630,6 +9131,12 @@ export declare function usePersonProfile(userId: string | null | undefined): Use
8630
9131
 
8631
9132
  export declare function usePlanGridHost(): PlanGridHost | null;
8632
9133
 
9134
+ /**
9135
+ * Publish what this page shows. Re-publishes only when the context's content
9136
+ * changes (compared as JSON), and withdraws it when the page unmounts.
9137
+ */
9138
+ export declare function usePublishAskContext(ctx: AskPageContext | null | undefined): void;
9139
+
8633
9140
  /**
8634
9141
  * The quick picker BEFORE a record exists — the "+ New" menus open it, and on
8635
9142
  * Create the host navigates to the new-record page with the picks in
@@ -8673,6 +9180,9 @@ export declare function UserChip({ userId, size, children }: {
8673
9180
  children?: React_2.ReactElement;
8674
9181
  }): React_2.JSX.Element;
8675
9182
 
9183
+ /** The host's connection state, or null when the host gives none (no realtime, or no status). */
9184
+ export declare function useRealtimeStatus(): RealtimeStatus | null;
9185
+
8676
9186
  /** Integration events about one record, newest first, one page at a time. */
8677
9187
  export declare function useRecordIntegrationActivity(collection: string, item: string, page: number): UseQueryResult<NoInfer<{
8678
9188
  entries: IntegrationEvent[];
@@ -8680,6 +9190,15 @@ page: number;
8680
9190
  has_more: boolean;
8681
9191
  }>, Error>;
8682
9192
 
9193
+ /** Names of the OTHER people currently signalling `kind` on this record. */
9194
+ export declare function useRecordSignalPeers(collection: string | null | undefined, item: string | number | null | undefined, kind: RecordSignalKind): string[];
9195
+
9196
+ /**
9197
+ * While `active`, tell the record's other viewers (start now, then every SIGNAL_BEAT_MS);
9198
+ * `stop` when it ends or the component goes away.
9199
+ */
9200
+ export declare function useRecordSignalWhile(collection: string | null | undefined, item: string | number | null | undefined, kind: RecordSignalKind, active: boolean): void;
9201
+
8683
9202
  export declare function useRefreshSignals(): UseMutationResult<unknown, Error, void, unknown>;
8684
9203
 
8685
9204
  /**
@@ -8767,6 +9286,11 @@ export declare function UserRosterCluster({ users, showSingleName }: {
8767
9286
  showSingleName?: boolean;
8768
9287
  }): React_2.JSX.Element;
8769
9288
 
9289
+ declare interface UserSyncOptions {
9290
+ /** The host refetches whatever it keeps preferences in (the admin's auth user). */
9291
+ onPrefsChanged?: () => void;
9292
+ }
9293
+
8770
9294
  export declare function useScopeDimensions(): ScopeDimensionLite[];
8771
9295
 
8772
9296
  export declare function useSectionState(form: UseNivaroFormReturn, defaultCollapsed?: string[]): SectionState;
@@ -8824,6 +9348,13 @@ messageId: number;
8824
9348
  emoji: string;
8825
9349
  }, unknown>;
8826
9350
 
9351
+ /**
9352
+ * Presence on one ticket (`ticket:<id>`) or issue (`issue-view:<id>`) page. Joining is gated
9353
+ * server-side (a ticket only admits people who can open it). Without a host realtime adapter
9354
+ * the hook is inert.
9355
+ */
9356
+ export declare function useTopicPresence(topic: string | null | undefined, selfId?: string | null): TopicPresence;
9357
+
8827
9358
  export declare function useTypingIndicator(room: string | null): {
8828
9359
  onType: () => void;
8829
9360
  clearTyping: () => void;
@@ -8843,6 +9374,8 @@ export declare function useUserSearch(search: string, enabled: boolean): {
8843
9374
  loading: boolean;
8844
9375
  };
8845
9376
 
9377
+ export declare function useUserSync(opts?: UserSyncOptions): void;
9378
+
8846
9379
  export declare function useWatchFields(form: UseNivaroFormReturn, fields: string[]): Record<string, unknown>;
8847
9380
 
8848
9381
  /**