@nivaro/react 0.2.4 → 0.2.6

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
@@ -482,6 +482,10 @@ export declare function BroadcastView({ className }: {
482
482
  className?: string;
483
483
  }): JSX.Element;
484
484
 
485
+ export declare function BrowserPushCard({ serviceWorkerPath }: {
486
+ serviceWorkerPath?: string;
487
+ }): JSX.Element;
488
+
485
489
  export declare function buildCopyAs(input: CopyAsInput): CopyAsSnippets;
486
490
 
487
491
  export declare function buildGroups<T extends QueueGroupingRow>(rows: T[], attribute: string): QueueGroup<T>[];
@@ -649,8 +653,35 @@ declare interface ChannelMeta {
649
653
  topic: string | null;
650
654
  created_by: string | null;
651
655
  is_direct?: boolean;
656
+ /** One of the fixed channel icons (ChannelLook.tsx); null = plain "#". */
657
+ icon?: string | null;
658
+ /** #rrggbb from the fixed palette; null = neutral tile. */
659
+ color?: string | null;
660
+ announce?: boolean;
661
+ description?: string | null;
662
+ links?: Array<{
663
+ label: string;
664
+ url: string;
665
+ }>;
666
+ welcome_note?: string | null;
667
+ default_roles?: string[];
652
668
  }
653
669
 
670
+ export declare function ChatAnalyticsView(): JSX.Element;
671
+
672
+ /** Where a room view opens: the newest messages, or around a message / day. */
673
+ declare type ChatAnchor = {
674
+ around: number;
675
+ } | {
676
+ date: string;
677
+ } | null;
678
+
679
+ /**
680
+ * "Appear away" (#952): the Online list, badges and DM headers show you as
681
+ * away whatever you are doing, until you switch it off or the time runs out.
682
+ */
683
+ export declare function ChatAppearAwayRow(): JSX.Element;
684
+
654
685
  export declare function chatAvatarColor(id: string): string;
655
686
 
656
687
  /**
@@ -732,6 +763,38 @@ export declare interface ChatMessage {
732
763
  reactions?: ChatReaction[];
733
764
  /** The admin who was masquerading as the sender when it was sent. */
734
765
  masquerade_admin_name?: string | null;
766
+ /** Thread reply (#927): the root it answers. Null on the timeline. */
767
+ parent_id?: number | null;
768
+ /** Quoted message (#928). */
769
+ quote_id?: number | null;
770
+ quote?: {
771
+ id: number;
772
+ sender_name: string | null;
773
+ message: string;
774
+ deleted: boolean;
775
+ has_attachments: boolean;
776
+ } | null;
777
+ /** Replies under this message (roots only). */
778
+ thread?: {
779
+ count: number;
780
+ last_reply_at: string | null;
781
+ people: Array<{
782
+ id: string;
783
+ name: string | null;
784
+ }>;
785
+ } | null;
786
+ urgent?: boolean;
787
+ /** A platform line (record activity, flows) rather than a person. */
788
+ is_system?: boolean;
789
+ /** The sender removed the link preview. */
790
+ no_preview?: boolean;
791
+ client_id?: string | null;
792
+ mentions?: string[];
793
+ /** Times written in the message, as stored instants (#962). */
794
+ time_refs?: Array<{
795
+ text: string;
796
+ at: string;
797
+ }>;
735
798
  }
736
799
 
737
800
  export declare interface ChatOnlineUser {
@@ -813,17 +876,19 @@ declare interface ChatReaction {
813
876
  user_name: string | null;
814
877
  }
815
878
 
816
- export declare function ChatRoomList({ rooms, onOpen, onNewGroup, archivedView, loading }: {
879
+ export declare function ChatRoomList({ rooms, onOpen, onNewGroup, archivedView, loading, onView }: {
817
880
  rooms: RoomInfo[];
818
- onOpen: (room: RoomInfo) => void;
881
+ onOpen: (room: RoomInfo, anchor?: ChatAnchor) => void;
819
882
  /** Opens the group-conversation composer (host renders the dialog). */
820
883
  onNewGroup?: () => void;
884
+ /** Opens the mentions / scheduled / catch-up views (host renders them). */
885
+ onView?: (view: 'mentions' | 'scheduled' | 'catchup') => void;
821
886
  /** The Archived tab: no assistant entry, rows offer Unarchive. */
822
887
  archivedView?: boolean;
823
888
  loading?: boolean;
824
889
  }): JSX.Element;
825
890
 
826
- export declare function ChatRoomView({ room, label, onBack, onOpenSettings, renderMessageBody, initialUnread }: {
891
+ export declare function ChatRoomView({ room, label, onBack, onOpenSettings, renderMessageBody, initialUnread, anchor: anchorProp }: {
827
892
  room: string;
828
893
  label: string;
829
894
  onBack: () => void;
@@ -834,10 +899,24 @@ export declare function ChatRoomView({ room, label, onBack, onOpenSettings, rend
834
899
  }) => React.ReactNode;
835
900
  /** Unread count at open — anchors the "New messages" divider. */
836
901
  initialUnread?: number;
902
+ /** Open around a message (a search hit, #977) or a day (#976). */
903
+ anchor?: ChatAnchor;
837
904
  }): JSX.Element;
838
905
 
906
+ /** Search every room in MY sidebar (server enforces visibility by
907
+ * construction — the room set is the user's own). */
908
+ declare interface ChatSearchFilters {
909
+ sender?: string | null;
910
+ room?: string | null;
911
+ from?: string | null;
912
+ to?: string | null;
913
+ has_attachment?: boolean;
914
+ mentions_me?: boolean;
915
+ }
916
+
839
917
  declare interface ChatSearchHit {
840
918
  id: number;
919
+ parent_id?: number | null;
841
920
  room: string;
842
921
  sender: string | null;
843
922
  sender_name: string | null;
@@ -845,6 +924,18 @@ declare interface ChatSearchHit {
845
924
  date_created: string;
846
925
  }
847
926
 
927
+ /**
928
+ * The mentions / scheduled / catch-up views for hosts that lay chat out
929
+ * themselves (the admin /chat workspace). The slide-over panel renders the
930
+ * same views internally.
931
+ */
932
+ export declare function ChatSideView({ view, rooms, onBack, onOpen }: {
933
+ view: 'mentions' | 'scheduled' | 'catchup';
934
+ rooms: RoomInfo[];
935
+ onBack: () => void;
936
+ onOpen: (room: string, label: string, anchor?: ChatAnchor) => void;
937
+ }): JSX.Element;
938
+
848
939
  /**
849
940
  * Nivaro chat UI — a complete team panel (Online tab, grouped rooms, live
850
941
  * conversations with mentions, typing, receipts, search).
@@ -1394,6 +1485,8 @@ declare interface DirectoryChannel {
1394
1485
  role: string | null;
1395
1486
  joined: boolean;
1396
1487
  members: number;
1488
+ icon?: string | null;
1489
+ color?: string | null;
1397
1490
  }
1398
1491
 
1399
1492
  /** Forget a run: stops watching it (the server run continues on its own). */
@@ -3967,6 +4060,8 @@ export declare interface NotificationRouteMap {
3967
4060
  approvals?: () => string | null;
3968
4061
  access_requests?: () => string | null;
3969
4062
  my_work?: () => string | null;
4063
+ /** A support ticket (#999); hosts without a support page fall back to the server url. */
4064
+ support?: (id?: string | null) => string | null;
3970
4065
  }
3971
4066
 
3972
4067
  export declare function NotificationRulesCard(): JSX.Element;
@@ -4016,7 +4111,7 @@ export declare type NotificationTarget = {
4016
4111
  /** Server-side target spec (services/notification-target.ts) — what the
4017
4112
  * notification is about and what a click should offer. */
4018
4113
  export declare interface NotificationTargetSpec {
4019
- kind: 'record' | 'task' | 'approval' | 'access_request' | 'sla' | 'chat' | 'queue' | 'report' | 'alerts' | 'issue' | 'import' | 'dashboard' | 'my_work' | 'home' | 'external';
4114
+ kind: 'record' | 'task' | 'approval' | 'access_request' | 'sla' | 'chat' | 'queue' | 'report' | 'alerts' | 'issue' | 'import' | 'dashboard' | 'my_work' | 'home' | 'support' | 'external';
4020
4115
  collection?: string | null;
4021
4116
  id?: string | number | null;
4022
4117
  room?: string | null;
@@ -4332,7 +4427,12 @@ declare type PathStepKind = 'request' | 'cron' | 'import' | 'feed' | 'write' | '
4332
4427
 
4333
4428
  declare interface PendingTask {
4334
4429
  title: string;
4430
+ description?: string;
4335
4431
  assignee: string | null;
4432
+ /** Display name for the queued row (the picker already knows it). */
4433
+ assignee_name?: string | null;
4434
+ team_id?: number | null;
4435
+ team_name?: string | null;
4336
4436
  due_date: string;
4337
4437
  priority?: string;
4338
4438
  }
@@ -4634,13 +4734,15 @@ export declare function ProfileSectionCard({ icon, title, hint, children, action
4634
4734
  * notifications, security, preferences); anyone else's is PersonProfile —
4635
4735
  * slim for a colleague, full-featured for an admin.
4636
4736
  */
4637
- export declare function ProfileView({ userId, className, initialTab, extra }: {
4737
+ export declare function ProfileView({ userId, className, initialTab, extra, pushServiceWorker }: {
4638
4738
  userId?: string | null;
4639
4739
  className?: string;
4640
4740
  /** Which tab an admin lands on for someone else's page. */
4641
4741
  initialTab?: 'overview' | 'access' | 'activity' | 'tools';
4642
4742
  /** Host-only cards for the OWN profile (a browser-push card, say), rendered in the right column. */
4643
4743
  extra?: React.ReactNode;
4744
+ /** Service worker the Browser notifications card registers (same origin); false hides the card. */
4745
+ pushServiceWorker?: string | false;
4644
4746
  }): JSX.Element;
4645
4747
 
4646
4748
  /**
@@ -5647,6 +5749,11 @@ export declare interface RoomInfo {
5647
5749
  channel: ChannelMeta | null;
5648
5750
  /** Put away by this person — lives in the Archived tab, never alerts. */
5649
5751
  archived?: boolean;
5752
+ /** Pinned to the top of this person's list (#957). */
5753
+ starred?: boolean;
5754
+ /** Unread messages that name this person. */
5755
+ mentions?: number;
5756
+ welcome_seen_at?: string | null;
5650
5757
  }
5651
5758
 
5652
5759
  /**
@@ -5854,6 +5961,15 @@ export declare function seedQuickPickerSteps(fieldConfig: Array<{
5854
5961
 
5855
5962
  export declare function SelectField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
5856
5963
 
5964
+ declare interface SendInput {
5965
+ text: string;
5966
+ mentions?: string[];
5967
+ attachments?: string[];
5968
+ parentId?: number | null;
5969
+ quoteId?: number | null;
5970
+ urgent?: boolean;
5971
+ }
5972
+
5857
5973
  /**
5858
5974
  * rrweb session recorder for headless frontends — two modes, one hook
5859
5975
  * (the exact model the admin app runs; see admin/src/lib/use-session-recorder.ts).
@@ -6139,6 +6255,121 @@ declare interface SubscriptionRecord {
6139
6255
  notify_email?: boolean;
6140
6256
  }
6141
6257
 
6258
+ export declare interface SupportCategory {
6259
+ id: number;
6260
+ name: string;
6261
+ description: string | null;
6262
+ /** The kind of record this type is for; null = offered everywhere. */
6263
+ collection: string | null;
6264
+ team_id: number | null;
6265
+ team_name: string | null;
6266
+ default_assignee: string | null;
6267
+ default_assignee_name: string | null;
6268
+ is_active: boolean;
6269
+ sort: number;
6270
+ legacy: boolean;
6271
+ }
6272
+
6273
+ /**
6274
+ * Raise a support request (#999). With a record it is a change request about
6275
+ * that record and offers the types meant for its collection; without one it is
6276
+ * General Support. The request lands with the administrators (or the type's
6277
+ * team), who are told at once.
6278
+ */
6279
+ export declare function SupportRequestDialog({ open, onOpenChange, collection, item, recordLabel, onCreated }: {
6280
+ open: boolean;
6281
+ onOpenChange: (open: boolean) => void;
6282
+ collection?: string | null;
6283
+ item?: string | number | null;
6284
+ /** Friendly id of the record ("CM26-79811"), shown in the title. */
6285
+ recordLabel?: string | null;
6286
+ onCreated?: (ticket: SupportTicket) => void;
6287
+ }): JSX.Element;
6288
+
6289
+ export declare function SupportStatusPill({ status, label }: {
6290
+ status: TicketStatus;
6291
+ label?: string;
6292
+ }): JSX.Element;
6293
+
6294
+ export declare interface SupportSummary {
6295
+ mine_open: number;
6296
+ desk: boolean;
6297
+ unassigned: number;
6298
+ assigned_to_me: number;
6299
+ }
6300
+
6301
+ export declare interface SupportTicket {
6302
+ id: number;
6303
+ title: string;
6304
+ description: string | null;
6305
+ status: TicketStatus;
6306
+ status_label: string;
6307
+ priority: 'low' | 'normal' | 'urgent';
6308
+ collection: string | null;
6309
+ item: string | null;
6310
+ record_label: string | null;
6311
+ category_id: number | null;
6312
+ category_name: string | null;
6313
+ team_id: number | null;
6314
+ team_name: string | null;
6315
+ assignee: string | null;
6316
+ assignee_name: string | null;
6317
+ created_by: string;
6318
+ requester_name: string | null;
6319
+ attachments: string[];
6320
+ replies: number;
6321
+ legacy: boolean;
6322
+ created_at: string;
6323
+ updated_at: string | null;
6324
+ completed_at: string | null;
6325
+ }
6326
+
6327
+ export declare interface SupportTicketDetail extends SupportTicket {
6328
+ files: Array<{
6329
+ id: string;
6330
+ title: string | null;
6331
+ filename_download: string | null;
6332
+ type: string | null;
6333
+ filesize: number | string | null;
6334
+ }>;
6335
+ thread: Array<{
6336
+ id: string;
6337
+ text: string;
6338
+ user: string;
6339
+ user_name: string | null;
6340
+ created_at: string;
6341
+ from_requester: boolean;
6342
+ }>;
6343
+ history: Array<{
6344
+ id: number;
6345
+ text: string;
6346
+ user: string | null;
6347
+ user_name: string | null;
6348
+ at: string;
6349
+ }>;
6350
+ can: {
6351
+ work: boolean;
6352
+ reply: boolean;
6353
+ cancel: boolean;
6354
+ reopen: boolean;
6355
+ };
6356
+ }
6357
+
6358
+ /**
6359
+ * The support page (#999). Everyone sees My requests (raise one, follow it).
6360
+ * Administrators — and members of a team a type routes to — also get the Desk
6361
+ * (pick up, reply, close) and, for administrators, the list of request types.
6362
+ *
6363
+ * `initialTicketId` opens a ticket on arrival (/support?ticket=12, the link in
6364
+ * every support notification); `onTicketChange` lets the host keep the URL in
6365
+ * step.
6366
+ */
6367
+ export declare function SupportView({ initialTicketId, onTicketChange, className }: {
6368
+ initialTicketId?: number | null;
6369
+ onTicketChange?: (id: number | null) => void;
6370
+ className?: string;
6371
+ }): JSX.Element;
6372
+
6142
6373
  declare type TabKey = 'catalog' | 'rules' | 'subscriptions' | 'history' | 'widget_alerts' | 'widget_alert_history' | 'anomaly_rules' | 'anomaly_history';
6143
6374
 
6144
6375
  export declare type TabState = {
@@ -6148,13 +6379,14 @@ export declare type TabState = {
6148
6379
  hasTabs: boolean;
6149
6380
  };
6150
6381
 
6151
- export declare function TaskPanel({ collection, item, title, defaultExpanded, queuedTasks, onQueueTask }: {
6382
+ export declare function TaskPanel({ collection, item, title, defaultExpanded, queuedTasks, onQueueTask, onRemoveQueuedTask }: {
6152
6383
  collection: string;
6153
6384
  item: string;
6154
6385
  title?: string;
6155
6386
  defaultExpanded?: boolean;
6156
6387
  queuedTasks?: PendingTask[];
6157
6388
  onQueueTask?: (task: PendingTask) => void;
6389
+ onRemoveQueuedTask?: (index: number) => void;
6158
6390
  }): JSX.Element | null;
6159
6391
 
6160
6392
  export declare function TeamScopeEditor({ teamId, scopes, onSaved }: {
@@ -6198,6 +6430,18 @@ export declare function TickerNumber({ value, format, durationMs }: {
6198
6430
  durationMs?: number;
6199
6431
  }): JSX.Element;
6200
6432
 
6433
+ /**
6434
+ * One support ticket (#999): what was asked, the thread, the history, and —
6435
+ * for whoever works it — claim, status, type and assignee.
6436
+ */
6437
+ export declare function TicketDetailSheet({ ticketId, onOpenChange }: {
6438
+ ticketId: number | null;
6439
+ onOpenChange: (open: boolean) => void;
6440
+ }): JSX.Element;
6441
+
6442
+ /** Shapes served by /api/support (#999). */
6443
+ declare type TicketStatus = 'open' | 'in_progress' | 'done' | 'cancelled';
6444
+
6201
6445
  export declare function TimezoneCard(): JSX.Element;
6202
6446
 
6203
6447
  export declare function TipLayer(): ReactPortal | null;
@@ -6279,6 +6523,16 @@ export declare function useChannelAdmin(channelId: number | null): {
6279
6523
  visibility?: "open" | "role" | "private";
6280
6524
  role?: string | null;
6281
6525
  is_archived?: boolean;
6526
+ icon?: string | null;
6527
+ color?: string | null;
6528
+ announce?: boolean;
6529
+ description?: string | null;
6530
+ links?: Array<{
6531
+ label: string;
6532
+ url: string;
6533
+ }>;
6534
+ welcome_note?: string | null;
6535
+ default_roles?: string[];
6282
6536
  }, unknown>;
6283
6537
  addMember: UseMutationResult<unknown, Error, string, unknown>;
6284
6538
  removeMember: UseMutationResult<unknown, Error, string, unknown>;
@@ -6298,9 +6552,19 @@ export declare function useChannelMembers(channelId: number | null): {
6298
6552
 
6299
6553
  export declare function useChatConfig(): ChatConfig;
6300
6554
 
6301
- export declare function useChatMessages(room: string | null): {
6302
- messages: NoInfer<ChatMessage[]>;
6555
+ /**
6556
+ * A room's timeline (thread replies excluded). Opens on the newest messages,
6557
+ * or around a message / a day when `anchor` is given (#976, #977); older and
6558
+ * newer history loads on demand.
6559
+ */
6560
+ export declare function useChatMessages(room: string | null, anchor?: ChatAnchor): {
6561
+ messages: ChatMessage[];
6303
6562
  loading: boolean;
6563
+ hasOlder: boolean;
6564
+ hasNewer: boolean;
6565
+ anchorId: number | null;
6566
+ loadOlder: () => Promise<void>;
6567
+ loadingOlder: boolean;
6304
6568
  };
6305
6569
 
6306
6570
  /** Id + name only — /api/roles is admin-gated, so the channel picker reads the
@@ -6323,9 +6587,7 @@ export declare function useChatRooms(): {
6323
6587
  loading: boolean;
6324
6588
  };
6325
6589
 
6326
- /** Search every room in MY sidebar (server enforces visibility by
6327
- * construction — the room set is the user's own). */
6328
- export declare function useChatSearch(q: string): {
6590
+ export declare function useChatSearch(q: string, filters?: ChatSearchFilters): {
6329
6591
  hits: NoInfer<ChatSearchHit[]>;
6330
6592
  loading: boolean;
6331
6593
  };
@@ -6336,6 +6598,8 @@ key?: string;
6336
6598
  topic?: string;
6337
6599
  visibility?: "open" | "role" | "private";
6338
6600
  role?: string | null;
6601
+ icon?: string | null;
6602
+ color?: string | null;
6339
6603
  }, unknown>;
6340
6604
 
6341
6605
  export declare function useCreateGroupDm(): UseMutationResult< {
@@ -6640,9 +6904,11 @@ export declare function UserAvatar({ userId, fallback, className, style, alt }:
6640
6904
  alt?: string;
6641
6905
  }): JSX.Element;
6642
6906
 
6643
- export declare function UserChip({ userId, size }: {
6907
+ export declare function UserChip({ userId, size, children }: {
6644
6908
  userId: string;
6645
6909
  size?: 'default' | 'compact';
6910
+ /** A custom trigger (e.g. a chat avatar) that opens the same user card. */
6911
+ children?: React_2.ReactElement;
6646
6912
  }): React_2.JSX.Element;
6647
6913
 
6648
6914
  /** Integration events about one record, newest first, one page at a time. */
@@ -6689,6 +6955,11 @@ export declare function useRoomMembership(): {
6689
6955
  room: string;
6690
6956
  archived: boolean;
6691
6957
  }, unknown>;
6958
+ setStarred: UseMutationResult<unknown, Error, {
6959
+ room: string;
6960
+ starred: boolean;
6961
+ }, unknown>;
6962
+ dismissWelcome: UseMutationResult<unknown, Error, string, unknown>;
6692
6963
  };
6693
6964
 
6694
6965
  export declare function useRoomPins(room: string | null): NoInfer<PinnedMessage[]>;
@@ -6708,11 +6979,16 @@ export declare function useScopeDimensions(): ScopeDimensionLite[];
6708
6979
 
6709
6980
  export declare function useSectionState(form: UseNivaroFormReturn, defaultCollapsed?: string[]): SectionState;
6710
6981
 
6711
- export declare function useSendChatMessage(room: string): UseMutationResult<void, Error, string | {
6712
- text: string;
6713
- mentions?: string[];
6714
- attachments?: string[];
6715
- }, unknown>;
6982
+ /**
6983
+ * Send through the outbox (#983, #984): the message shows at once as
6984
+ * "Sending…", a network failure keeps it queued and retries in order when the
6985
+ * connection is back, a refusal marks it failed with Retry. The client id rides
6986
+ * the request, so a retry of a send that actually landed is not posted twice.
6987
+ */
6988
+ export declare function useSendChatMessage(room: string): {
6989
+ mutate: (input: string | SendInput) => void;
6990
+ isPending: boolean;
6991
+ };
6716
6992
 
6717
6993
  export declare function useSessionRecorder(options?: SessionRecorderOptions): void;
6718
6994