@nivaro/react 0.2.28 → 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
@@ -1,16 +1,21 @@
1
1
  import { CascadeFilterRule } from '@nivaro/sdk';
2
+ import type { Command } from '@nivaro/sdk';
2
3
  import { Context } from 'react';
3
4
  import type { CSSProperties } from 'react';
4
5
  import { default as default_2 } from 'react';
6
+ import { DragEvent as DragEvent_2 } from 'react';
5
7
  import { FieldDependencyConfig } from '@nivaro/sdk';
6
8
  import { ImportParseResponse } from '@nivaro/sdk';
7
9
  import { ImportTemplateSummary } from '@nivaro/sdk';
8
10
  import { JSX } from 'react';
9
11
  import { JSXElementConstructor } from 'react';
12
+ import { ListResponse } from '@nivaro/sdk';
10
13
  import type { LucideIcon } from 'lucide-react';
11
14
  import { ManagedUser } from '@nivaro/sdk';
12
15
  import { MutableRefObject } from 'react';
13
16
  import { NivaroClient } from '@nivaro/sdk';
17
+ import { Query } from '@nivaro/sdk';
18
+ import { QueryKey } from '@tanstack/react-query';
14
19
  import { default as React_2 } from 'react';
15
20
  import { ReactElement } from 'react';
16
21
  import { ReactNode } from 'react';
@@ -121,17 +126,54 @@ export declare function AiFeedbackButtons({ requestId, className }: {
121
126
  className?: string;
122
127
  }): JSX.Element | null;
123
128
 
124
- export declare function AiMarkdown({ content, className, autolink }: {
129
+ export declare function AiMarkdown({ content, className, autolink, switchable, onChartPoint }: {
125
130
  content: string;
126
131
  className?: string;
127
132
  /** Turn friendly ids into record links. Default: on whenever a NivaroProvider is present. */
128
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;
129
138
  }): JSX.Element;
130
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
+
131
158
  export declare function AiReviewCard({ templateId }: {
132
159
  templateId: string;
133
160
  }): React_2.JSX.Element;
134
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
+
135
177
  export declare function AlertManagerView({ defaultTab, hiddenTabs, onOpenReport, className }: AlertManagerViewProps): JSX.Element;
136
178
 
137
179
  export declare interface AlertManagerViewProps {
@@ -332,6 +374,10 @@ export declare function AsItWasSheet({ notificationId, title, onClose }: {
332
374
  onClose: () => void;
333
375
  }): JSX.Element;
334
376
 
377
+ export declare function AskContextProvider({ children }: {
378
+ children: ReactNode;
379
+ }): JSX.Element;
380
+
335
381
  /**
336
382
  * "Fill from a document" — a person drops a statement of work, a quote, a
337
383
  * spreadsheet on a NEW record and reviews what the model read out of it
@@ -362,6 +408,69 @@ declare type AskInput = AskRelationInput | {
362
408
  type: 'text';
363
409
  };
364
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
+
365
474
  /** What a relation ask in the document-autofill review carries from the
366
475
  * field's own picker configuration. */
367
476
  declare type AskRelationInput = {
@@ -545,10 +654,28 @@ export declare function BrowserPushCard({ serviceWorkerPath }: {
545
654
  serviceWorkerPath?: string;
546
655
  }): JSX.Element;
547
656
 
657
+ export declare function buildClientCrashBody(error: unknown, info: {
658
+ componentStack?: string | null;
659
+ } | null | undefined, url: string, replay: ReplayLink | null): ClientCrashBody;
660
+
548
661
  export declare function buildCopyAs(input: CopyAsInput): CopyAsSnippets;
549
662
 
550
663
  export declare function buildGroups<T extends QueueGroupingRow>(rows: T[], attribute: string): QueueGroup<T>[];
551
664
 
665
+ /** The POST /support/report-problem body (exported for tests). */
666
+ export declare function buildReportPayload(input: {
667
+ sentence: string;
668
+ route: string;
669
+ app?: string | null;
670
+ screenshot: string | null;
671
+ includeShot: boolean;
672
+ context: {
673
+ text: string;
674
+ fileId: string | null;
675
+ replay: ReplayLink | null;
676
+ } | null;
677
+ }): ReportProblemPayload;
678
+
552
679
  export declare function BulkActionButtons({ targets, enabledKeys, tone, disabled, onDone }: {
553
680
  targets: BulkTarget[];
554
681
  /** Surface allow-list (browser_config.bulk_actions / display_config.bulk_action_keys). */
@@ -656,13 +783,27 @@ declare interface CaptionStyle {
656
783
  position: 'bottom' | 'top';
657
784
  }
658
785
 
786
+ declare type Capture = (kind: ReplayClipKind) => Promise<ReplayLink | null>;
787
+
659
788
  /**
660
789
  * Grab the replay link for an error being reported right now. Resolves null
661
790
  * when no recorder is active (both settings off, recording failed, or the
662
791
  * clip upload took longer than 4s) — error reporting must never wait on or
663
792
  * break because of replay capture.
664
793
  */
665
- export declare function captureErrorClip(): Promise<ErrorReplayLink | null>;
794
+ export declare function captureErrorClip(kind?: ReplayClipKind): Promise<ErrorReplayLink | null>;
795
+
796
+ /**
797
+ * A downscaled JPEG data URI of the page (≤ 1280px wide), or null when
798
+ * html2canvas is missing or the capture fails. Elements carrying `ignoreAttr`
799
+ * (the reporter's own button) are left out.
800
+ */
801
+ export declare function captureMaskedScreenshot(opts?: {
802
+ ignoreAttr?: string;
803
+ maxWidth?: number;
804
+ }): Promise<string | null>;
805
+
806
+ export declare function captureReplayClip(kind?: ReplayClipKind, timeoutMs?: number): Promise<ReplayLink | null>;
666
807
 
667
808
  export { CascadeFilterRule }
668
809
 
@@ -790,6 +931,19 @@ declare interface Chapter {
790
931
  title: string;
791
932
  }
792
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
+
793
947
  export declare function ChatAnalyticsView(): JSX.Element;
794
948
 
795
949
  /** Where a room view opens: the newest messages, or around a message / day. */
@@ -918,6 +1072,7 @@ export declare interface ChatMessage {
918
1072
  text: string;
919
1073
  at: string;
920
1074
  }>;
1075
+ poll?: ChatPoll | null;
921
1076
  }
922
1077
 
923
1078
  export declare interface ChatOnlineUser {
@@ -952,6 +1107,30 @@ export declare function ChatPanel({ open, onClose, renderMessageBody, requestedD
952
1107
  } | null;
953
1108
  }): JSX.Element | null;
954
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
+
955
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;
956
1135
 
957
1136
  export declare interface ChatProviderProps {
@@ -1011,7 +1190,7 @@ export declare function ChatRoomList({ rooms, onOpen, onNewGroup, archivedView,
1011
1190
  loading?: boolean;
1012
1191
  }): JSX.Element;
1013
1192
 
1014
- 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 }: {
1015
1194
  room: string;
1016
1195
  label: string;
1017
1196
  onBack: () => void;
@@ -1024,6 +1203,8 @@ export declare function ChatRoomView({ room, label: labelProp, onBack, onOpenSet
1024
1203
  initialUnread?: number;
1025
1204
  /** Open around a message (a search hit, #977) or a day (#976). */
1026
1205
  anchor?: ChatAnchor;
1206
+ /** Deep link (?thread=): open this thread's pane once the root is readable. */
1207
+ openThread?: number | null;
1027
1208
  }): JSX.Element;
1028
1209
 
1029
1210
  /** Search every room in MY sidebar (server enforces visibility by
@@ -1122,12 +1303,34 @@ export declare const CLEAN_RECORDING_ATTR = "data-nvr-recording-clean";
1122
1303
  /** Clear the schema cache (e.g. after a schema change). */
1123
1304
  export declare function clearFormSchemaCache(collection?: string): void;
1124
1305
 
1306
+ /** Sign-out: every entry on this browser goes, whoever's it was. */
1307
+ export declare function clearRecordOutbox(): Promise<void>;
1308
+
1125
1309
  declare interface ClientAction {
1126
1310
  type: 'open-sidebar';
1127
1311
  collection: string;
1128
1312
  itemId: string;
1129
1313
  }
1130
1314
 
1315
+ /**
1316
+ * Report a render crash into the issue log with its replay (#1370) — the one
1317
+ * call a host's error boundary makes from componentDidCatch:
1318
+ *
1319
+ * componentDidCatch(error, info) { void reportClientCrash(client, error, info) }
1320
+ *
1321
+ * It asks the registered session recorder for the last minute (or the live
1322
+ * recording's offset), then posts POST /issues/client with the replay link,
1323
+ * exactly as the admin's PageErrorBoundary does. Never throws and never
1324
+ * blocks rendering: the capture self-times-out and a failed post is dropped.
1325
+ */
1326
+ export declare interface ClientCrashBody {
1327
+ message: string;
1328
+ stack?: string;
1329
+ url: string;
1330
+ recording_id?: string;
1331
+ recording_offset_ms?: number | null;
1332
+ }
1333
+
1131
1334
  /** A short clip or GIF of a video (#1562), as GET /help-videos/:id/clips lists it. */
1132
1335
  declare interface ClipDto {
1133
1336
  id: string;
@@ -1151,10 +1354,26 @@ declare interface ClipDto {
1151
1354
  created_at: string;
1152
1355
  }
1153
1356
 
1357
+ /**
1358
+ * Where in a clip "the moment" is. An error clip has none (the whole clip is
1359
+ * the context); a support clip is the moment of asking — its last event,
1360
+ * measured from its first (the player's t=0).
1361
+ */
1362
+ export declare function clipEndOffset(events: unknown[], kind: ReplayClipKind): number | null;
1363
+
1154
1364
  declare type ClipKind = 'mp4' | 'gif';
1155
1365
 
1156
1366
  declare type ClipStatus = 'queued' | 'rendering' | 'ready' | 'failed';
1157
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
+
1158
1377
  export declare function CloneDialog({ collection, itemId, fields, relations, currentValues, onSuccess }: CloneDialogProps): JSX.Element;
1159
1378
 
1160
1379
  declare interface CloneDialogProps {
@@ -1286,10 +1505,24 @@ export declare function CollectionImportPanel({ initialJobId, onJobOpen }: {
1286
1505
  */
1287
1506
  export declare interface CollectionUpdateEvent {
1288
1507
  collection: string;
1289
- item: string | number;
1508
+ /** The record that changed; null on a coalesced message (#1681), whose ids are in `items`. */
1509
+ item: string | number | null;
1290
1510
  action?: 'create' | 'update' | 'delete';
1291
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;
1292
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;
1293
1526
  }
1294
1527
 
1295
1528
  export declare interface Column<T = Record<string, unknown>> {
@@ -1397,6 +1630,16 @@ export declare type ComponentOverrides = {
1397
1630
  * several conditions AND together. */
1398
1631
  export declare function conditionsToFilter(conditions: string | undefined): Record<string, unknown> | null;
1399
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
+
1400
1643
  export declare function ConformanceView({ className }: {
1401
1644
  className?: string;
1402
1645
  }): JSX.Element;
@@ -1444,6 +1687,8 @@ export declare function createGatedClient(client: NivaroClient, opts?: {
1444
1687
 
1445
1688
  export declare function createLeaderSocket(key: string, cbs: LeaderCallbacks): LeaderSocketHandle;
1446
1689
 
1690
+ export declare function createSocketRealtime(opts: SocketRealtimeOptions): SocketRealtime;
1691
+
1447
1692
  export declare function CronBuilder({ value, onChange, disabled }: {
1448
1693
  value: string;
1449
1694
  onChange: (cron: string) => void;
@@ -1515,7 +1760,7 @@ export declare function CustomStatusEditor({ status, invalidate, theme, showExpi
1515
1760
  className?: string;
1516
1761
  }): JSX.Element;
1517
1762
 
1518
- 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;
1519
1764
 
1520
1765
  export declare interface DataTableProps<T = Record<string, unknown>> {
1521
1766
  columns: Column<T>[];
@@ -1583,6 +1828,13 @@ export declare interface DataTableProps<T = Record<string, unknown>> {
1583
1828
  onSelectionChange?: (ids: string[]) => void;
1584
1829
  /** Optional per-row class — e.g. at-risk background tinting. */
1585
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;
1586
1838
  /** Grouped rendering: when set, `rows` is ignored for the body; each group renders
1587
1839
  * a full-width header row followed by its rows (unless collapsed). Pagination hides. */
1588
1840
  rowGroups?: Array<{
@@ -1711,6 +1963,11 @@ export declare function dmPeer(room: string, self: string): string | null;
1711
1963
 
1712
1964
  export declare function dmRoom(a: string, b: string): string;
1713
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
+
1714
1971
  declare type DocumentApplySelection = {
1715
1972
  values: Record<string, unknown>;
1716
1973
  lines_by_alias: Record<string, Array<{
@@ -1824,6 +2081,12 @@ declare type DocumentProposal = {
1824
2081
  hints_used?: string[];
1825
2082
  };
1826
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
+
1827
2090
  /** One dot per partner, worst outcome winning — a red dot must never be
1828
2091
  * hidden behind a green one from the same partner. Superseded rows are
1829
2092
  * never a partner's CURRENT state, so they never contribute a dot at all. */
@@ -2380,6 +2643,16 @@ export declare function formatNumber(n: number | null | undefined): string;
2380
2643
 
2381
2644
  export declare function formatRelative(date: string | Date): string;
2382
2645
 
2646
+ /**
2647
+ * The tail as a plain-text attachment a person can open from the ticket:
2648
+ * where they were, the console lines and the request log (route, status, ms).
2649
+ */
2650
+ export declare function formatReplayTail(tail: ReplayTail, ctx: {
2651
+ route: string;
2652
+ when?: Date;
2653
+ userAgent?: string | null;
2654
+ }): string;
2655
+
2383
2656
  export declare function formatStatusExpiry(expiresAt: string | null | undefined): string | null;
2384
2657
 
2385
2658
  export declare function formatValue(raw: string, cfg: ColumnFormatConfig): string;
@@ -2598,6 +2871,9 @@ export declare function getLayoutSlot(key: string | null | undefined): LayoutSlo
2598
2871
 
2599
2872
  export declare function getMentionQuery(text: string, cursorPos: number): string | null;
2600
2873
 
2874
+ /** A copy of the rings, oldest first. */
2875
+ export declare function getReplayTail(): ReplayTail;
2876
+
2601
2877
  export declare const GridFlushContext: React_2.Context<GridFlushContextValue | null>;
2602
2878
 
2603
2879
  export declare type GridFlushContextValue = {
@@ -3369,7 +3645,8 @@ export declare interface ImportProgressEvent {
3369
3645
  stage: 'row_count' | 'preparing' | 'importing' | 'completed' | 'error';
3370
3646
  row_count?: number;
3371
3647
  duration?: number;
3372
- error?: string;
3648
+ /** `true` on a failure — the message itself stays behind the authenticated run routes. */
3649
+ error?: string | boolean;
3373
3650
  }
3374
3651
 
3375
3652
  /**
@@ -3649,6 +3926,9 @@ declare interface InputBinding {
3649
3926
  binding_value: string;
3650
3927
  }
3651
3928
 
3929
+ /** Idempotent; a no-op outside a browser. Watches for the rest of the page's life. */
3930
+ export declare function installReplayTail(): void;
3931
+
3652
3932
  export declare type IntegrationActionResult = {
3653
3933
  key: string;
3654
3934
  ok: boolean;
@@ -4139,6 +4419,17 @@ export declare function ItemLockBanner({ lockHolder, onTakeOver, takingOver, isA
4139
4419
  joining?: boolean;
4140
4420
  }): JSX.Element | null;
4141
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
+
4142
4433
  export declare function JsonMapEditor({ config, scope }: {
4143
4434
  config: JsonMapEditorConfig;
4144
4435
  scope: Record<string, unknown>;
@@ -4379,6 +4670,63 @@ declare interface ListRequest {
4379
4670
  page?: number;
4380
4671
  }
4381
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
+
4382
4730
  declare interface LockHolder {
4383
4731
  locked_by: string;
4384
4732
  locked_by_name: string | null;
@@ -4409,6 +4757,20 @@ export declare interface M2MStagingCtx {
4409
4757
  getDerivedOrigin?: (parentField: string) => string | null;
4410
4758
  }
4411
4759
 
4760
+ /**
4761
+ * A screenshot of the page for Report a problem (#1390), with every typed
4762
+ * value masked first — the same rule session replay applies (all inputs
4763
+ * masked, `.nvr-no-record` blocked). html2canvas renders a CLONE of the
4764
+ * document, and the masking happens on that clone, so the live page is never
4765
+ * touched.
4766
+ *
4767
+ * html2canvas is an optional peer dependency of @nivaro/react (the admin
4768
+ * already ships it): loaded on demand, and without it the report simply goes
4769
+ * without a screenshot.
4770
+ */
4771
+ /** Mask every typed value and blank every `.nvr-no-record` element under `root`. */
4772
+ export declare function maskInputsIn(root: Document | Element): void;
4773
+
4412
4774
  declare type MatchedDrawerConfig = {
4413
4775
  /** Rows selected by filter instead of an FK to the child row — values may be
4414
4776
  * '$parent.id', '$parent.<field>', '$row.<field>', or literals; dotted keys
@@ -4546,6 +4908,13 @@ declare interface MatrixEditorConfig {
4546
4908
  };
4547
4909
  }
4548
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
+
4549
4918
  declare interface MessageToken {
4550
4919
  text: string;
4551
4920
  entity?: string;
@@ -5076,6 +5445,8 @@ export declare function onFieldInterfacesChange(cb: () => void): () => void;
5076
5445
  */
5077
5446
  export declare function onIdleChange(fn: (idle: boolean) => void): () => void;
5078
5447
 
5448
+ export declare function openAskPanel(question?: string): void;
5449
+
5079
5450
  export declare function openCatalogItem(collection: string, id: string, context?: Record<string, unknown>): void;
5080
5451
 
5081
5452
  export declare function openChatRoom(room: string, label?: string): void;
@@ -5246,6 +5617,12 @@ export declare function OwnersSlot({ collection, item, title, defaultExpanded }:
5246
5617
  defaultExpanded?: boolean;
5247
5618
  }): JSX.Element | null;
5248
5619
 
5620
+ /** The ping body, or null when the path is not something the server keeps. */
5621
+ export declare function pageAtPayload(path: string, app: string): {
5622
+ path: string;
5623
+ app: string;
5624
+ } | null;
5625
+
5249
5626
  export declare function PageRenderer({ slug, hideHeader, className }: PageRendererProps): JSX.Element;
5250
5627
 
5251
5628
  export declare interface PageRendererPage {
@@ -5475,6 +5852,17 @@ export declare interface PersonProfileData {
5475
5852
  online: boolean;
5476
5853
  idle_minutes: number | null;
5477
5854
  last_seen: string | null;
5855
+ /** #1394 — admins and the person's manager only. */
5856
+ stuck?: {
5857
+ minutes: number;
5858
+ label: string | null;
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;
5478
5866
  };
5479
5867
  teams: Array<{
5480
5868
  id: number;
@@ -5688,8 +6076,14 @@ export declare type PlayerHandle = {
5688
6076
  remeasure(): void;
5689
6077
  };
5690
6078
 
5691
- /** Play the configured notification sound. No-op for 'off'/unknown/unavailable audio. */
5692
- 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;
5693
6087
 
5694
6088
  declare type Point = {
5695
6089
  x: number;
@@ -5730,6 +6124,18 @@ declare function pollProposal(opts: {
5730
6124
  */
5731
6125
  export declare function precisionOf(options: unknown, fallback?: number): number;
5732
6126
 
6127
+ export declare interface PreparedReplayClip {
6128
+ /** Upload what was taken at prepare time; null when nothing is recording. */
6129
+ commit(timeoutMs?: number): Promise<ReplayLink | null>;
6130
+ }
6131
+
6132
+ /**
6133
+ * Take the moment now, upload on commit — nothing leaves the browser until
6134
+ * then, so a dialog that is cancelled uploads nothing. Without a recorder
6135
+ * snapshot it falls back to capturing at commit time.
6136
+ */
6137
+ export declare function prepareReplayClip(kind: ReplayClipKind): PreparedReplayClip;
6138
+
5733
6139
  /**
5734
6140
  * Inline attachment preview — click a file, see it, without a download round
5735
6141
  * trip. Images, PDFs, video and audio render in an overlay; anything else
@@ -6219,7 +6625,7 @@ export declare function QueueItemSheet({ item, onOpenChange, onClaim, onRelease,
6219
6625
  itemLayout?: string | null;
6220
6626
  }): JSX.Element;
6221
6627
 
6222
- 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 }: {
6223
6629
  items: QueueItemRow[];
6224
6630
  onDrop: (item: QueueItemRow, targetState: string) => void;
6225
6631
  onCardClick: (item: QueueItemRow) => void;
@@ -6233,6 +6639,8 @@ export declare function QueueKanbanBoard({ items, onDrop, onCardClick, onClaim,
6233
6639
  laneLabel?: (key: string) => string;
6234
6640
  /** When false the per-card Claim/Release button is hidden. */
6235
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;
6236
6644
  }): JSX.Element;
6237
6645
 
6238
6646
  declare interface QueueOwner {
@@ -6246,8 +6654,14 @@ declare interface QueueOwner_2 {
6246
6654
  }
6247
6655
 
6248
6656
  export declare interface QueueRealtimeAdapter {
6249
- /** Subscribe to update events for these collections; call onUpdate per event; return unsubscribe. */
6250
- 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;
6251
6665
  }
6252
6666
 
6253
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;
@@ -6379,10 +6793,48 @@ export declare interface RealtimeAdapter {
6379
6793
  on(event: string, cb: (payload: any) => void): () => void;
6380
6794
  /** Emit an event to the server (record:uploading, record:join…). */
6381
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;
6382
6806
  }
6383
6807
 
6384
6808
  export declare const RealtimeContext: Context<RealtimeAdapter | null>;
6385
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
+
6386
6838
  export declare function RecentRecordsRail({ limit, title, className }: {
6387
6839
  limit?: number;
6388
6840
  title?: string;
@@ -6598,6 +7050,18 @@ declare type RecordingHandoff = {
6598
7050
  };
6599
7051
  };
6600
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
+
6601
7065
  export declare function RecordReadView({ collection, itemId, layoutData, flush, renderSlot, integrityMarks, renderGrid, onEditSection, gridCounts }: {
6602
7066
  collection: string;
6603
7067
  itemId: string;
@@ -6647,6 +7111,23 @@ export declare function RecordRecapStrip({ collection, itemId }: {
6647
7111
  itemId: string;
6648
7112
  }): JSX.Element | null;
6649
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
+
6650
7131
  /**
6651
7132
  * Per-record notification subscription — a bell in the item header that lets
6652
7133
  * any user watch this specific record. Backed entirely by the existing
@@ -6691,6 +7172,9 @@ export declare function registerHelpVideoPage(key: string): () => void;
6691
7172
 
6692
7173
  export declare function registerLayoutSlot(plugin: LayoutSlotPlugin): void;
6693
7174
 
7175
+ /** Called by a host's recorder module. Returns an undo for tests / HMR. */
7176
+ export declare function registerReplayCapture(fn: Capture, snap?: Snapshot): () => void;
7177
+
6694
7178
  export declare function registerRoomOpener(fn: RoomOpener): () => void;
6695
7179
 
6696
7180
  /** Register the host's opener. Returns an unregister function. */
@@ -6786,6 +7270,86 @@ export declare function RenderSettingsButton(): JSX.Element | null;
6786
7270
 
6787
7271
  declare type RenderStatus = 'none' | 'queued' | 'rendering' | 'ready' | 'failed' | 'unavailable';
6788
7272
 
7273
+ /** Why the clip is being cut: the server labels the recording by it
7274
+ * (error → app 'error-clip', support → app 'support-clip'). */
7275
+ export declare type ReplayClipKind = 'error' | 'support';
7276
+
7277
+ /** The admin's replay deep link: /session-replays?recording=<id>&t=<ms>. */
7278
+ export declare function replayHref(link: ReplayLink | {
7279
+ recording_id: string;
7280
+ offset_ms?: number | null;
7281
+ }, base?: string): string;
7282
+
7283
+ /**
7284
+ * One place every shared surface asks "what did they just see?" (#1370, #1377).
7285
+ *
7286
+ * The session recorder lives in the HOST — admin/src/lib/use-session-recorder.ts
7287
+ * or @nivaro/react's useSessionRecorder — but the surfaces that want its clip
7288
+ * (an error boundary helper, the support dialog, Report a problem) are shared
7289
+ * components. The recorder registers its capture function here once at module
7290
+ * load; shared code calls `captureReplayClip()` and never imports a host.
7291
+ *
7292
+ * Resolves null when no recorder is registered, both replay modes are off,
7293
+ * or the capture takes longer than the timeout — a report must never wait on
7294
+ * or break because of replay.
7295
+ */
7296
+ export declare interface ReplayLink {
7297
+ recording_id: string;
7298
+ /** Milliseconds into the recording where the moment happened. Null for a
7299
+ * clip — the whole clip IS the context (the moment is its end). */
7300
+ offset_ms: number | null;
7301
+ }
7302
+
7303
+ export declare interface ReplayTail {
7304
+ console: TailConsoleLine[];
7305
+ requests: TailRequest[];
7306
+ }
7307
+
7308
+ export declare function reportClientCrash(client: {
7309
+ request<T>(cmd: Command<T>): Promise<T>;
7310
+ }, error: unknown, info?: {
7311
+ componentStack?: string | null;
7312
+ } | null, opts?: {
7313
+ url?: string;
7314
+ }): Promise<void>;
7315
+
7316
+ export declare function ReportProblemButton({ app, floating, className, children, onReported }: {
7317
+ /** Your front end's label ('efp'), stored with the report. */
7318
+ app?: string;
7319
+ /** Pin a round button to the bottom-right corner (default) or render inline. */
7320
+ floating?: boolean;
7321
+ className?: string;
7322
+ /** Inline trigger content (when `floating` is false). */
7323
+ children?: ReactNode;
7324
+ onReported?: (r: {
7325
+ ticket: SupportTicket;
7326
+ issue_id: number;
7327
+ }) => void;
7328
+ }): JSX.Element;
7329
+
7330
+ /**
7331
+ * Report a problem (#1390) — the shared control a portal shell mounts
7332
+ * (exported from @nivaro/react), built on the admin's bug reporter.
7333
+ *
7334
+ * The person writes one sentence. With it go: a screenshot of the page taken
7335
+ * BEFORE the dialog covers it, every typed value masked (html2canvas, an
7336
+ * optional peer); the replay of the last minute when error replay is on (or
7337
+ * the live recording's moment); the console tail and the last twenty
7338
+ * requests; and the route. POST /support/report-problem files an ISSUE
7339
+ * (source client, raised by the person) and a support request linked to it,
7340
+ * which they follow under My requests. They can leave the screenshot and the
7341
+ * "what I was doing" context out.
7342
+ */
7343
+ export declare interface ReportProblemPayload {
7344
+ sentence: string;
7345
+ route: string;
7346
+ app?: string;
7347
+ screenshot: string | null;
7348
+ context: string | null;
7349
+ attachments: string[];
7350
+ replay?: ReplayLink;
7351
+ }
7352
+
6789
7353
  export declare function ReportView({ reportId, showFilterBar, dateRange, initialEntityFilters, refetchInterval, className, emptyState, reportUrl }: ReportViewProps & {
6790
7354
  reportUrl?: (id: string) => string;
6791
7355
  }): JSX.Element;
@@ -7142,18 +7706,6 @@ declare interface RowSnooze {
7142
7706
  note: string | null;
7143
7707
  }
7144
7708
 
7145
- /**
7146
- * Real-user monitoring collector. Hand-rolled (no web-vitals dep): one 'load'
7147
- * event per page load (TTFB / FCP / LCP / total) once LCP settles, plus one
7148
- * 'route' event per SPA navigation (time from route change to a settled
7149
- * frame). Batched and sent via sendBeacon/fetch to POST /api/rum — fire and
7150
- * forget, RUM must never affect the page it measures.
7151
- *
7152
- * Host wiring: call `startRum({app, routePattern})` once at app mount, and
7153
- * `rumRouteChange(pathname)` on every route change. `routePattern` turns a
7154
- * concrete path into its pattern ('/collections/workflows/123' →
7155
- * '/collections/:c/:id') so p75s aggregate per PAGE, not per record.
7156
- */
7157
7709
  /** Route-change timing: from the navigation to a settled double-rAF frame. */
7158
7710
  export declare function rumRouteChange(pathname: string): void;
7159
7711
 
@@ -7210,6 +7762,16 @@ declare interface SendInput {
7210
7762
  urgent?: boolean;
7211
7763
  }
7212
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
+
7213
7775
  /**
7214
7776
  * rrweb session recorder for headless frontends — two modes, one hook
7215
7777
  * (the exact model the admin app runs; see admin/src/lib/use-session-recorder.ts).
@@ -7231,7 +7793,9 @@ declare interface SendInput {
7231
7793
  * NivaroProvider (or pass a client explicitly). Needs `rrweb` installed in
7232
7794
  * the host (optional peer dependency; without it the hook warns once and
7233
7795
  * no-ops). Privacy in both modes: every input masked, `nvr-no-record`
7234
- * class blocked; in clip mode events never leave the browser except on error.
7796
+ * class blocked, and record field values, rich text and file names masked by
7797
+ * the instance's masking rules (#1361); in clip mode events never leave the
7798
+ * browser except on error.
7235
7799
  *
7236
7800
  * `captureErrorClip` is a module singleton so an error boundary — a class
7237
7801
  * component far from this hook — can call it without plumbing.
@@ -7243,6 +7807,12 @@ export declare interface SessionRecorderOptions {
7243
7807
  client?: NivaroClient;
7244
7808
  /** Force-disable locally regardless of the instance setting. */
7245
7809
  disabled?: boolean;
7810
+ /**
7811
+ * Your app's build or version, stamped on every uploaded chunk so DB Health
7812
+ * can show recording cost per build (#1368). Defaults to the
7813
+ * @nivaro/react version.
7814
+ */
7815
+ build?: string;
7246
7816
  }
7247
7817
 
7248
7818
  export declare function setDisplayTimezone(tz: string | null): void;
@@ -7267,6 +7837,8 @@ export declare function setNumberFormat(opts: {
7267
7837
  * reads as Demo User during a clean recording. Hosts call it once they know. */
7268
7838
  export declare function setRecordingSelf(userId: string | number | null | undefined): void;
7269
7839
 
7840
+ export declare function setServerClockOffset(ms: number): void;
7841
+
7270
7842
  export declare function setTimeDisplay(mode: string | null | undefined): void;
7271
7843
 
7272
7844
  /**
@@ -7317,6 +7889,14 @@ declare interface SignalDrill {
7317
7889
  id: string;
7318
7890
  }
7319
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
+
7320
7900
  declare interface SignalThreshold {
7321
7901
  key: string;
7322
7902
  label: string;
@@ -7398,6 +7978,14 @@ export declare type SlotRendererProps = {
7398
7978
  defaultExpanded: boolean;
7399
7979
  };
7400
7980
 
7981
+ /**
7982
+ * Two-phase capture: take the moment NOW (the clip's events, or the live
7983
+ * recording's offset), upload later. A support dialog snapshots when it
7984
+ * opens — by the time the person has typed their question the rolling
7985
+ * buffer would hold mostly the dialog itself.
7986
+ */
7987
+ declare type Snapshot = (kind: ReplayClipKind) => (() => Promise<ReplayLink | null>) | null;
7988
+
7401
7989
  export declare interface SnoozeInput {
7402
7990
  signal: string;
7403
7991
  row_key?: string;
@@ -7430,6 +8018,77 @@ export declare function SnoozeMenu({ signal, signalLabel, rowKey, group, default
7430
8018
  compact?: boolean;
7431
8019
  }): JSX.Element;
7432
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
+
7433
8092
  declare type Speed = 0.5 | 1 | 1.5 | 2 | 4;
7434
8093
 
7435
8094
  export declare function splitMessageTokens(text: string, entityPattern: string): MessageToken[];
@@ -7501,6 +8160,21 @@ declare interface StepStyle {
7501
8160
  size: 'small' | 'medium' | 'large';
7502
8161
  }
7503
8162
 
8163
+ /**
8164
+ * Idle or stuck (#1394). /presence/online, the people page and the team view
8165
+ * answer `stuck: { minutes, label }` for someone at the keyboard, on the same
8166
+ * route, with nothing saved for ten minutes — shown to admins and the
8167
+ * person's manager only. One wording everywhere.
8168
+ */
8169
+ export declare interface StuckState {
8170
+ minutes: number;
8171
+ /** The record's friendly id ("CM26-80332") or the page path. */
8172
+ label: string | null;
8173
+ }
8174
+
8175
+ /** "stuck on CM26-80332 for 12m" (or "stuck for 12m" with no page). */
8176
+ export declare function stuckText(s: StuckState): string;
8177
+
7504
8178
  export declare function SubmissionRow({ sub, onRetry, retrying, onShowPath, initialOpen }: {
7505
8179
  sub: ErpSubmission;
7506
8180
  onRetry: (id: number) => void;
@@ -7586,6 +8260,12 @@ export declare interface SupportCategory {
7586
8260
  * that record and offers the types meant for its collection; without one it is
7587
8261
  * General Support. The request lands with the administrators (or the type's
7588
8262
  * team), who are told at once.
8263
+ *
8264
+ * #1377 — unless the person unticks it, the request carries what they were
8265
+ * looking at: the replay taken the moment the dialog OPENED (the error-replay
8266
+ * buffer cut as an app='support-clip' recording, or the live recording at
8267
+ * that moment) and a text attachment with the page, the console tail and the
8268
+ * last twenty requests. Nothing uploads unless the request is sent.
7589
8269
  */
7590
8270
  export declare function SupportRequestDialog({ open, onOpenChange, collection, item, recordLabel, onCreated }: {
7591
8271
  open: boolean;
@@ -7628,6 +8308,13 @@ export declare interface SupportTicket {
7628
8308
  created_by: string;
7629
8309
  requester_name: string | null;
7630
8310
  attachments: string[];
8311
+ /** #1390 — the issue a Report a problem filed alongside this request. */
8312
+ issue_id?: number | null;
8313
+ /** #1377 — the requester's replay at the moment they asked (admins open it). */
8314
+ replay?: {
8315
+ recording_id: string;
8316
+ offset_ms: number | null;
8317
+ } | null;
7631
8318
  replies: number;
7632
8319
  legacy: boolean;
7633
8320
  created_at: string;
@@ -7690,6 +8377,20 @@ export declare type TabState = {
7690
8377
  hasTabs: boolean;
7691
8378
  };
7692
8379
 
8380
+ declare interface TailConsoleLine {
8381
+ at: number;
8382
+ level: string;
8383
+ msg: string;
8384
+ }
8385
+
8386
+ declare interface TailRequest {
8387
+ at: number;
8388
+ method: string;
8389
+ route: string;
8390
+ status: number;
8391
+ ms: number;
8392
+ }
8393
+
7693
8394
  export declare function TaskPanel({ collection, item, title, defaultExpanded, queuedTasks, onQueueTask, onRemoveQueuedTask }: {
7694
8395
  collection: string;
7695
8396
  item: string;
@@ -7778,6 +8479,15 @@ declare type Tone = 'accent' | 'warning' | 'neutral';
7778
8479
  * (superseded) is informational (neutral). */
7779
8480
  export declare function toneForOutcome(outcome: string): 'danger' | 'warning' | 'neutral' | 'positive';
7780
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
+
7781
8491
  /** Install the listeners. Safe to call more than once. */
7782
8492
  export declare function trackActivity(): void;
7783
8493
 
@@ -7906,6 +8616,12 @@ declare interface UnsavedSummary {
7906
8616
  text: string;
7907
8617
  }
7908
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
+
7909
8625
  /** An uploaded music file (POST /help-videos/:id/music). */
7910
8626
  declare interface UploadedMusic {
7911
8627
  id: string;
@@ -7965,9 +8681,31 @@ export declare function useApiFetchConfig(): {
7965
8681
 
7966
8682
  export declare function useApiUpdate(): ApiVersionInfo | null;
7967
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
+
7968
8693
  /** Every run the shell should show or a form may pick up. */
7969
8694
  export declare function useAutofillRuns(): AutofillRun[];
7970
8695
 
8696
+ /**
8697
+ * Auto-record on a signal (#1371) for headless hosts: listens for the
8698
+ * server's `replay:record` on the host's RealtimeAdapter (the socket the
8699
+ * portal already holds) and starts a three-minute recording labelled
8700
+ * auto:<signal> through the shared runner. useSessionRecorder calls it, so a
8701
+ * host that records needs nothing more; without a realtime adapter or rrweb
8702
+ * it does nothing.
8703
+ */
8704
+ export declare function useAutoRecord(opts?: {
8705
+ client?: NivaroClient | null;
8706
+ disabled?: boolean;
8707
+ }): void;
8708
+
7971
8709
  /** Available actions per collection, for the viewer. */
7972
8710
  export declare function useAvailableBulkActions(collections: string[]): UseQueryResult<NoInfer<Record<string, AvailableBulkAction[]>>, Error>;
7973
8711
 
@@ -8079,6 +8817,9 @@ export declare function useDebounced<T>(value: T, delayMs?: number): T;
8079
8817
 
8080
8818
  export declare function useDeleteMessage(room: string): UseMutationResult<unknown, Error, number, unknown>;
8081
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
+
8082
8823
  export declare function useDrilldown(): DrilldownContextValue | null;
8083
8824
 
8084
8825
  export declare function useDrilldownViews(): Record<string, DrilldownViewOverride>;
@@ -8113,7 +8854,7 @@ export declare function useFeatureFlag(key: string): boolean;
8113
8854
  /**
8114
8855
  * Feature flags client (#651): `useFeatureFlag('new_dashboard')` — the
8115
8856
  * caller's effective set comes from GET /feature-flags/mine (role +
8116
- * 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
8117
8858
  * failures resolve FALSE, so a flag can gate new code with zero risk to the
8118
8859
  * old path.
8119
8860
  */
@@ -8231,6 +8972,20 @@ export declare function useItemNavigation(): {
8231
8972
  open: (target: ItemLinkTarget) => void;
8232
8973
  };
8233
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
+
8234
8989
  /**
8235
8990
  * Mark read. The server upserts against UNIQUE(user, room), so the old
8236
8991
  * select-then-insert dance (and the per-room promise chain that stopped it
@@ -8357,6 +9112,12 @@ export declare function useOverlayState<T>(key: string): {
8357
9112
  back: (steps?: number) => void;
8358
9113
  };
8359
9114
 
9115
+ export declare function usePageAt(opts: {
9116
+ app: string;
9117
+ path?: string;
9118
+ disabled?: boolean;
9119
+ }): void;
9120
+
8360
9121
  export declare function usePartner(id: number | null): UseQueryResult<NoInfer<IntegrationPartnerDetail>, Error>;
8361
9122
 
8362
9123
  export declare function usePartners(): UseQueryResult<NoInfer<{
@@ -8370,6 +9131,12 @@ export declare function usePersonProfile(userId: string | null | undefined): Use
8370
9131
 
8371
9132
  export declare function usePlanGridHost(): PlanGridHost | null;
8372
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
+
8373
9140
  /**
8374
9141
  * The quick picker BEFORE a record exists — the "+ New" menus open it, and on
8375
9142
  * Create the host navigates to the new-record page with the picks in
@@ -8413,6 +9180,9 @@ export declare function UserChip({ userId, size, children }: {
8413
9180
  children?: React_2.ReactElement;
8414
9181
  }): React_2.JSX.Element;
8415
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
+
8416
9186
  /** Integration events about one record, newest first, one page at a time. */
8417
9187
  export declare function useRecordIntegrationActivity(collection: string, item: string, page: number): UseQueryResult<NoInfer<{
8418
9188
  entries: IntegrationEvent[];
@@ -8420,6 +9190,15 @@ page: number;
8420
9190
  has_more: boolean;
8421
9191
  }>, Error>;
8422
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
+
8423
9202
  export declare function useRefreshSignals(): UseMutationResult<unknown, Error, void, unknown>;
8424
9203
 
8425
9204
  /**
@@ -8507,6 +9286,11 @@ export declare function UserRosterCluster({ users, showSingleName }: {
8507
9286
  showSingleName?: boolean;
8508
9287
  }): React_2.JSX.Element;
8509
9288
 
9289
+ declare interface UserSyncOptions {
9290
+ /** The host refetches whatever it keeps preferences in (the admin's auth user). */
9291
+ onPrefsChanged?: () => void;
9292
+ }
9293
+
8510
9294
  export declare function useScopeDimensions(): ScopeDimensionLite[];
8511
9295
 
8512
9296
  export declare function useSectionState(form: UseNivaroFormReturn, defaultCollapsed?: string[]): SectionState;
@@ -8564,6 +9348,13 @@ messageId: number;
8564
9348
  emoji: string;
8565
9349
  }, unknown>;
8566
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
+
8567
9358
  export declare function useTypingIndicator(room: string | null): {
8568
9359
  onType: () => void;
8569
9360
  clearTyping: () => void;
@@ -8583,6 +9374,8 @@ export declare function useUserSearch(search: string, enabled: boolean): {
8583
9374
  loading: boolean;
8584
9375
  };
8585
9376
 
9377
+ export declare function useUserSync(opts?: UserSyncOptions): void;
9378
+
8586
9379
  export declare function useWatchFields(form: UseNivaroFormReturn, fields: string[]): Record<string, unknown>;
8587
9380
 
8588
9381
  /**
@@ -8765,6 +9558,11 @@ declare interface WidgetSlotProps {
8765
9558
  onContentChange?: (hasContent: boolean) => void;
8766
9559
  }
8767
9560
 
9561
+ /** Add the clip kind to a session-recording start command (POST /start body). */
9562
+ export declare function withClipKind<T extends {
9563
+ _body?: unknown;
9564
+ }>(cmd: T, kind: ReplayClipKind): T;
9565
+
8768
9566
  export declare function withGetCoalescing(client: NivaroClient, opts?: CoalescingOptions): NivaroClient;
8769
9567
 
8770
9568
  export declare function WorkflowPanel({ collection, item }: {