@nivaro/react 0.3.9 → 0.3.11

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.
Files changed (80) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +103 -4
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1632 -1564
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +4386 -4142
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +527 -479
  15. package/dist/shared/components/QueryStatStrip.js +74 -70
  16. package/dist/shared/components/RecordGridEditor.js +76 -75
  17. package/dist/shared/components/ReportView.js +818 -827
  18. package/dist/shared/components/SheetHeaderBody.js +16 -14
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/SlashCommands.js +30 -29
  24. package/dist/shared/components/chat/chat-outbox.js +76 -75
  25. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  26. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  27. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  28. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  31. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  32. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  33. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  34. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  35. package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
  36. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  37. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  38. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  39. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  40. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  41. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  42. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  43. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  44. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  45. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  46. package/dist/shared/components/item-edit/helpers.js +133 -134
  47. package/dist/shared/components/item-edit/line-qty.js +57 -0
  48. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  49. package/dist/shared/components/item-edit/staged-links.js +86 -0
  50. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  51. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  52. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  53. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  54. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  55. package/dist/shared/components/panels/CommentPanel.js +350 -315
  56. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  57. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  58. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  59. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  60. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  61. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  62. package/dist/shared/components/queue/QueueWorklist.js +1026 -957
  63. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  64. package/dist/shared/lib/client-version.js +63 -0
  65. package/dist/shared/lib/force-reload.js +36 -0
  66. package/dist/shared/lib/load-error.js +11 -10
  67. package/dist/shared/lib/obligation-banner.js +14 -13
  68. package/dist/shared/lib/obligation-reason-text.js +13 -0
  69. package/dist/shared/lib/presence-live.js +54 -35
  70. package/dist/shared/lib/query-filter-seed.js +34 -11
  71. package/dist/shared/lib/record-outbox.js +76 -75
  72. package/dist/shared/lib/safe-error.js +39 -0
  73. package/dist/shared/lib/sanitize-html.js +24 -15
  74. package/dist/shared/lib/server-clock.js +11 -7
  75. package/dist/shared/lib/sheet-def.js +38 -22
  76. package/dist/shared/lib/unique-options.js +10 -0
  77. package/dist/shared/lib/unsaved-work.js +62 -0
  78. package/dist/shared/lib/utils.js +57 -43
  79. package/dist/shared/lib/validation-rules.js +58 -34
  80. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3063,7 +3063,8 @@ export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
3063
3063
  * the app root. Mount it once per host.
3064
3064
  *
3065
3065
  * A second push while a countdown is running restarts the clock with the
3066
- * newer duration — the later instruction wins.
3066
+ * newer duration — the later instruction wins. The same instruction arriving
3067
+ * twice (live, then again on a reconnect) is ignored.
3067
3068
  *
3068
3069
  * The countdown runs against a wall-clock deadline, not a count of timer
3069
3070
  * ticks: a background tab's timers wake about once a minute, so counting 15
@@ -3071,12 +3072,36 @@ export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
3071
3072
  * build never reloaded while the admin watched). A throttled tab reloads at
3072
3073
  * its first wake past the deadline, and a frozen one the moment it is shown
3073
3074
  * or focused again.
3075
+ *
3076
+ * Sticky refresh: a tab that was asleep or offline is told when it reconnects,
3077
+ * and a tab below an app's minimum build is told on connect
3078
+ * (api/src/services/sticky-refresh.ts). Each checks for itself first
3079
+ * (lib/force-reload.ts) and marks the instruction before reloading, so it
3080
+ * never reloads twice for one instruction (twice at most for a minimum build).
3081
+ *
3082
+ * Unsaved work (lib/unsaved-work.ts) holds the reload: past the deadline the
3083
+ * banner says a reload is waiting and reloads the moment the edits are saved
3084
+ * or discarded — or when the person clicks Reload now.
3074
3085
  */
3075
3086
  export declare function ForceReloadBanner(): JSX.Element | null;
3076
3087
 
3088
+ /**
3089
+ * Sticky force refresh — the client half of api/src/services/sticky-refresh.ts.
3090
+ *
3091
+ * The server pushes `client:force-refresh` live, again when a tab that missed it connects, and
3092
+ * whenever a tab connects below an app's minimum build. A browser's shared worker carries every
3093
+ * tab of an app on ONE socket and reports the first tab's build, so a push meant for an old tab
3094
+ * can reach a newer one: each tab checks for itself here before counting down.
3095
+ */
3096
+ /** What `client:force-refresh` carries. Everything after `message` is optional (older servers). */
3077
3097
  export declare interface ForceReloadDetail {
3078
3098
  seconds?: number;
3079
3099
  message?: string;
3100
+ id?: string;
3101
+ issued_at?: number;
3102
+ reason?: 'push' | 'sticky' | 'min-build';
3103
+ min_build?: string;
3104
+ set_at?: number;
3080
3105
  }
3081
3106
 
3082
3107
  /** Drop every settled metadata answer (call after a configuration write made outside the SDK client). */
@@ -3412,6 +3437,8 @@ declare type GuardRule = {
3412
3437
  value?: unknown;
3413
3438
  };
3414
3439
 
3440
+ export declare function hasUnsavedWork(): boolean;
3441
+
3415
3442
  export declare interface HeaderWidgetInfo {
3416
3443
  field: string;
3417
3444
  widgetId: number;
@@ -4803,6 +4830,9 @@ export declare function isChatPanelPinned(): boolean;
4803
4830
 
4804
4831
  export declare function isCleanRecording(): boolean;
4805
4832
 
4833
+ /** A bug in our own code (not the server's answer, not the network). */
4834
+ export declare function isCodeError(err: unknown): boolean;
4835
+
4806
4836
  /** True once a 401 said this tab is signed out, until a sign-in is heard. */
4807
4837
  export declare function isSignedOut(): boolean;
4808
4838
 
@@ -4894,6 +4924,9 @@ export declare interface ItemEditFormProps {
4894
4924
  /** false = skip the document.title side effect — a workspace-tab host keeps
4895
4925
  * several forms mounted and only the ACTIVE one may own the browser tab. */
4896
4926
  documentTitle?: boolean;
4927
+ /** false = mounted but not on screen (a background workspace tab): the form
4928
+ * lets its edit lock go after a while and takes it back when shown. */
4929
+ active?: boolean;
4897
4930
  /** Hands the host a stable save trigger (workspace "Save all"); called with
4898
4931
  * null on unmount. The trigger runs the same handleSave the button does —
4899
4932
  * validation and dialogs included. */
@@ -5533,6 +5566,9 @@ declare interface LockHolder {
5533
5566
  note?: string | null;
5534
5567
  /** Minutes since the holder last did anything (presence), when known. */
5535
5568
  idle_minutes?: number | null;
5569
+ /** Whether THIS viewer may force-take the lock (server verdict; absent =
5570
+ * unknown, the button shows and the server's 403 explains). */
5571
+ may_take_over?: boolean;
5536
5572
  }
5537
5573
 
5538
5574
  declare interface LockQueueEntry {
@@ -7225,6 +7261,8 @@ declare interface QuerySheetDef {
7225
7261
  stats: QueryWidgetStat[];
7226
7262
  /** "As of" line under the tiles: label + the latest value of field. */
7227
7263
  as_of?: SheetHeaderAsOf;
7264
+ /** What the tiles cover, under them ("Project lifetime"); `{{param}}` tokens. */
7265
+ note?: string;
7228
7266
  };
7229
7267
  /** Zero-based tab to open first (clamped into range). */
7230
7268
  initial_tab?: number;
@@ -7233,6 +7271,8 @@ declare interface QuerySheetDef {
7233
7271
  * fields render as fixed context, not pickers. */
7234
7272
  tabs?: Array<{
7235
7273
  label: string;
7274
+ /** What the tab's view covers, above it ("Spend dated in {{funding_years}}"). */
7275
+ note?: string;
7236
7276
  config?: QueryWidgetConfig;
7237
7277
  matrix?: {
7238
7278
  config: MatrixEditorConfig;
@@ -7456,8 +7496,13 @@ declare type QueryWidgetFilter = {
7456
7496
  /** Query-string key that pre-selects this filter when the page URL carries
7457
7497
  * it (`?fy=2026`, a comma list for several values, compared on
7458
7498
  * value_field). Beats default_values and the user-scope seeding; when the
7459
- * URL lacks it, those apply as before. */
7499
+ * URL lacks it, those apply as before. A change made on the page is
7500
+ * written back to the address (an emptied filter as `?fy=`, "All"), so a
7501
+ * reload or a shared link keeps it. */
7460
7502
  url_param?: string;
7503
+ /** One value at a time: picking another replaces it (a per-year query that
7504
+ * would silently sum two years). */
7505
+ single?: boolean;
7461
7506
  };
7462
7507
 
7463
7508
  declare interface QueryWidgetStat {
@@ -7505,6 +7550,12 @@ declare interface QueryWidgetStat {
7505
7550
  * the table the number covers; when NO row does, the tile shows its
7506
7551
  * empty_label instead of a summed zero. */
7507
7552
  coverage?: string;
7553
+ /** A context tile that only means something when the main rows carry this
7554
+ * field — e.g. "Fusion figures as of" over rows whose fusion_synced_at is
7555
+ * null: when no row has a value, the tile shows `requires_label` instead
7556
+ * of its own value (an import date over all-empty Fusion columns misleads). */
7557
+ requires_field?: string;
7558
+ requires_label?: string;
7508
7559
  }
7509
7560
 
7510
7561
  /** The full query-widget surface (filters, stats, table, row actions, drill
@@ -8205,6 +8256,9 @@ export declare function registerReplayCapture(fn: Capture, snap?: Snapshot): ()
8205
8256
 
8206
8257
  export declare function registerRoomOpener(fn: RoomOpener): () => void;
8207
8258
 
8259
+ /** Report a source of unsaved work; the returned function removes it. */
8260
+ export declare function registerUnsavedWork(label: string, dirty: () => boolean): () => void;
8261
+
8208
8262
  /** Register the host's opener. Returns an unregister function. */
8209
8263
  export declare function registerViewAsOpener(fn: ViewAsOpener): () => void;
8210
8264
 
@@ -8366,6 +8420,13 @@ export declare function reportClientCrash(client: {
8366
8420
  url?: string;
8367
8421
  }): Promise<void>;
8368
8422
 
8423
+ /**
8424
+ * Send a code error to the issue log once (POST /issues/client, with the
8425
+ * replay when a recorder is running). Anything else is the server's answer and
8426
+ * already logged there. Never throws.
8427
+ */
8428
+ export declare function reportCodeError(client: Parameters<typeof reportClientCrash>[0] | null | undefined, err: unknown): void;
8429
+
8369
8430
  export declare function ReportProblemButton({ app, floating, className, children, onReported }: {
8370
8431
  /** Your front end's label ('efp'), stored with the report. */
8371
8432
  app?: string;
@@ -8525,7 +8586,8 @@ declare interface ReviewListConfig {
8525
8586
  empty_color?: string | null;
8526
8587
  stamp_user_field?: string | null;
8527
8588
  stamp_date_field?: string | null;
8528
- /** POST this endpoint with {ids, status, note, workflow_id} instead of
8589
+ /** POST this endpoint with {ids, status, note, workflow_id, expected}
8590
+ * (`expected` = each row's status as the list showed it) instead of
8529
8591
  * per-row PATCHes — lets a deployment route decisions through an
8530
8592
  * endpoint that owns stamping, authorization, notes and notifications
8531
8593
  * (e.g. an extension's /decide route). */
@@ -9258,6 +9320,18 @@ export declare interface SocketRealtimeOptions {
9258
9320
 
9259
9321
  export declare type SocketRealtimeWindowEvent = 'catchupFull' | 'accessChanged' | 'configUpdate' | 'forceRefresh';
9260
9322
 
9323
+ /**
9324
+ * No raw JavaScript error text on screen, ever. "Cannot read properties of
9325
+ * null (reading 'id')" told a person nothing and invited them to press Save
9326
+ * again (2026-10-23: a duplicate workflow). A code error (a TypeError,
9327
+ * ReferenceError or RangeError that is not a network failure and carries no
9328
+ * HTTP status) shows one plain sentence instead, and the real error goes to
9329
+ * the issue log through the client crash report. A SyntaxError is left alone:
9330
+ * at runtime it comes from JSON.parse / RegExp on what a person typed, and its
9331
+ * text tells them what to fix.
9332
+ */
9333
+ export declare const SOMETHING_WENT_WRONG = "Something went wrong \u2014 it\u2019s been reported";
9334
+
9261
9335
  declare type Speed = 0.5 | 1 | 1.5 | 2 | 4;
9262
9336
 
9263
9337
  export declare function splitMessageTokens(text: string, entityPattern: string): MessageToken[];
@@ -9388,6 +9462,9 @@ export declare function SubmissionStatusPill({ status }: {
9388
9462
 
9389
9463
  export declare function subscribeClientChaos(cb: () => void): () => void;
9390
9464
 
9465
+ /** Told when a source comes or goes, or the record outbox changes. */
9466
+ export declare function subscribeUnsavedWork(cb: () => void): () => void;
9467
+
9391
9468
  /**
9392
9469
  * The one subscription editor — create + edit for nivaro_notification_subscriptions,
9393
9470
  * shared by the profile's Notifications & alerts card and the My Subscriptions
@@ -9866,6 +9943,9 @@ declare interface UnsavedSummary {
9866
9943
  text: string;
9867
9944
  }
9868
9945
 
9946
+ /** What would be lost, by label (empty = nothing). */
9947
+ export declare function unsavedWorkLabels(): string[];
9948
+
9869
9949
  /** The ids an update covers: one, a coalesced list, or null = "too many — refresh it all". */
9870
9950
  export declare function updateItemIds(ev: CollectionUpdateEvent): Array<string | number> | null;
9871
9951
 
@@ -10263,7 +10343,15 @@ export declare function useIsRecordingSelf(userId: string | number | null | unde
10263
10343
 
10264
10344
  export declare function useItemEditAuth(): ItemEditAuthContextValue;
10265
10345
 
10266
- export declare function useItemLock(collection: string | undefined, item: string | undefined, enabled: boolean): {
10346
+ export declare function useItemLock(collection: string | undefined, item: string | undefined, enabled: boolean, opts?: {
10347
+ /** Take the lock on the first real edit (`claim`), not on open — opening
10348
+ * a record only learns whether someone else holds it. A reader who never
10349
+ * edits (an approver re-opening what they sent back) never blocks the
10350
+ * person who has to fix it. */
10351
+ lazy?: boolean;
10352
+ /** False = mounted but not on screen (a background workspace tab). */
10353
+ active?: boolean;
10354
+ }): {
10267
10355
  lockHolder: LockHolder | null;
10268
10356
  acquired: boolean;
10269
10357
  isReadOnly: boolean;
@@ -10283,6 +10371,7 @@ export declare function useItemLock(collection: string | undefined, item: string
10283
10371
  releasing: boolean;
10284
10372
  released: boolean;
10285
10373
  relock: () => Promise<boolean>;
10374
+ claim: () => Promise<void>;
10286
10375
  };
10287
10376
 
10288
10377
  /** Resolved item-link helpers honoring the host's itemUrl/openItem overrides. */
@@ -10585,6 +10674,13 @@ export declare function useRelationOptions(client: NivaroClient | null, relatedC
10585
10674
  /** The single required videos (the same fetch as useRequiredList). */
10586
10675
  export declare function useRequiredVideos(): UseQueryResult<NoInfer<HelpVideoDto[]>, Error>;
10587
10676
 
10677
+ /**
10678
+ * The sentence to show for a failed action: the server's explanation when it
10679
+ * gave one, the plain "something went wrong" for a code error, else the
10680
+ * error's own message (or `fallback`).
10681
+ */
10682
+ export declare function userErrorMessage(err: unknown, fallback?: string): string;
10683
+
10588
10684
  export declare function useRoomMembership(): {
10589
10685
  join: UseMutationResult<unknown, Error, string, unknown>;
10590
10686
  leave: UseMutationResult<unknown, Error, string, unknown>;
@@ -10734,6 +10830,9 @@ export declare function useTypingIndicator(room: string | null): {
10734
10830
 
10735
10831
  export declare function useUnreadChirp(totalUnread: number, rooms?: RoomInfo[]): void;
10736
10832
 
10833
+ /** A form reports its dirty state while mounted. */
10834
+ export declare function useUnsavedWork(dirty: boolean, label?: string): void;
10835
+
10737
10836
  /** Directory of users to add to a private channel. */
10738
10837
  export declare function useUserSearch(search: string, enabled: boolean): {
10739
10838
  users: NoInfer<{