@nivaro/react 0.2.4 → 0.2.5

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;
@@ -4634,13 +4729,15 @@ export declare function ProfileSectionCard({ icon, title, hint, children, action
4634
4729
  * notifications, security, preferences); anyone else's is PersonProfile —
4635
4730
  * slim for a colleague, full-featured for an admin.
4636
4731
  */
4637
- export declare function ProfileView({ userId, className, initialTab, extra }: {
4732
+ export declare function ProfileView({ userId, className, initialTab, extra, pushServiceWorker }: {
4638
4733
  userId?: string | null;
4639
4734
  className?: string;
4640
4735
  /** Which tab an admin lands on for someone else's page. */
4641
4736
  initialTab?: 'overview' | 'access' | 'activity' | 'tools';
4642
4737
  /** Host-only cards for the OWN profile (a browser-push card, say), rendered in the right column. */
4643
4738
  extra?: React.ReactNode;
4739
+ /** Service worker the Browser notifications card registers (same origin); false hides the card. */
4740
+ pushServiceWorker?: string | false;
4644
4741
  }): JSX.Element;
4645
4742
 
4646
4743
  /**
@@ -5647,6 +5744,11 @@ export declare interface RoomInfo {
5647
5744
  channel: ChannelMeta | null;
5648
5745
  /** Put away by this person — lives in the Archived tab, never alerts. */
5649
5746
  archived?: boolean;
5747
+ /** Pinned to the top of this person's list (#957). */
5748
+ starred?: boolean;
5749
+ /** Unread messages that name this person. */
5750
+ mentions?: number;
5751
+ welcome_seen_at?: string | null;
5650
5752
  }
5651
5753
 
5652
5754
  /**
@@ -5854,6 +5956,15 @@ export declare function seedQuickPickerSteps(fieldConfig: Array<{
5854
5956
 
5855
5957
  export declare function SelectField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
5856
5958
 
5959
+ declare interface SendInput {
5960
+ text: string;
5961
+ mentions?: string[];
5962
+ attachments?: string[];
5963
+ parentId?: number | null;
5964
+ quoteId?: number | null;
5965
+ urgent?: boolean;
5966
+ }
5967
+
5857
5968
  /**
5858
5969
  * rrweb session recorder for headless frontends — two modes, one hook
5859
5970
  * (the exact model the admin app runs; see admin/src/lib/use-session-recorder.ts).
@@ -6139,6 +6250,121 @@ declare interface SubscriptionRecord {
6139
6250
  notify_email?: boolean;
6140
6251
  }
6141
6252
 
6253
+ export declare interface SupportCategory {
6254
+ id: number;
6255
+ name: string;
6256
+ description: string | null;
6257
+ /** The kind of record this type is for; null = offered everywhere. */
6258
+ collection: string | null;
6259
+ team_id: number | null;
6260
+ team_name: string | null;
6261
+ default_assignee: string | null;
6262
+ default_assignee_name: string | null;
6263
+ is_active: boolean;
6264
+ sort: number;
6265
+ legacy: boolean;
6266
+ }
6267
+
6268
+ /**
6269
+ * Raise a support request (#999). With a record it is a change request about
6270
+ * that record and offers the types meant for its collection; without one it is
6271
+ * General Support. The request lands with the administrators (or the type's
6272
+ * team), who are told at once.
6273
+ */
6274
+ export declare function SupportRequestDialog({ open, onOpenChange, collection, item, recordLabel, onCreated }: {
6275
+ open: boolean;
6276
+ onOpenChange: (open: boolean) => void;
6277
+ collection?: string | null;
6278
+ item?: string | number | null;
6279
+ /** Friendly id of the record ("CM26-79811"), shown in the title. */
6280
+ recordLabel?: string | null;
6281
+ onCreated?: (ticket: SupportTicket) => void;
6282
+ }): JSX.Element;
6283
+
6284
+ export declare function SupportStatusPill({ status, label }: {
6285
+ status: TicketStatus;
6286
+ label?: string;
6287
+ }): JSX.Element;
6288
+
6289
+ export declare interface SupportSummary {
6290
+ mine_open: number;
6291
+ desk: boolean;
6292
+ unassigned: number;
6293
+ assigned_to_me: number;
6294
+ }
6295
+
6296
+ export declare interface SupportTicket {
6297
+ id: number;
6298
+ title: string;
6299
+ description: string | null;
6300
+ status: TicketStatus;
6301
+ status_label: string;
6302
+ priority: 'low' | 'normal' | 'urgent';
6303
+ collection: string | null;
6304
+ item: string | null;
6305
+ record_label: string | null;
6306
+ category_id: number | null;
6307
+ category_name: string | null;
6308
+ team_id: number | null;
6309
+ team_name: string | null;
6310
+ assignee: string | null;
6311
+ assignee_name: string | null;
6312
+ created_by: string;
6313
+ requester_name: string | null;
6314
+ attachments: string[];
6315
+ replies: number;
6316
+ legacy: boolean;
6317
+ created_at: string;
6318
+ updated_at: string | null;
6319
+ completed_at: string | null;
6320
+ }
6321
+
6322
+ export declare interface SupportTicketDetail extends SupportTicket {
6323
+ files: Array<{
6324
+ id: string;
6325
+ title: string | null;
6326
+ filename_download: string | null;
6327
+ type: string | null;
6328
+ filesize: number | string | null;
6329
+ }>;
6330
+ thread: Array<{
6331
+ id: string;
6332
+ text: string;
6333
+ user: string;
6334
+ user_name: string | null;
6335
+ created_at: string;
6336
+ from_requester: boolean;
6337
+ }>;
6338
+ history: Array<{
6339
+ id: number;
6340
+ text: string;
6341
+ user: string | null;
6342
+ user_name: string | null;
6343
+ at: string;
6344
+ }>;
6345
+ can: {
6346
+ work: boolean;
6347
+ reply: boolean;
6348
+ cancel: boolean;
6349
+ reopen: boolean;
6350
+ };
6351
+ }
6352
+
6353
+ /**
6354
+ * The support page (#999). Everyone sees My requests (raise one, follow it).
6355
+ * Administrators — and members of a team a type routes to — also get the Desk
6356
+ * (pick up, reply, close) and, for administrators, the list of request types.
6357
+ *
6358
+ * `initialTicketId` opens a ticket on arrival (/support?ticket=12, the link in
6359
+ * every support notification); `onTicketChange` lets the host keep the URL in
6360
+ * step.
6361
+ */
6362
+ export declare function SupportView({ initialTicketId, onTicketChange, className }: {
6363
+ initialTicketId?: number | null;
6364
+ onTicketChange?: (id: number | null) => void;
6365
+ className?: string;
6366
+ }): JSX.Element;
6367
+
6142
6368
  declare type TabKey = 'catalog' | 'rules' | 'subscriptions' | 'history' | 'widget_alerts' | 'widget_alert_history' | 'anomaly_rules' | 'anomaly_history';
6143
6369
 
6144
6370
  export declare type TabState = {
@@ -6198,6 +6424,18 @@ export declare function TickerNumber({ value, format, durationMs }: {
6198
6424
  durationMs?: number;
6199
6425
  }): JSX.Element;
6200
6426
 
6427
+ /**
6428
+ * One support ticket (#999): what was asked, the thread, the history, and —
6429
+ * for whoever works it — claim, status, type and assignee.
6430
+ */
6431
+ export declare function TicketDetailSheet({ ticketId, onOpenChange }: {
6432
+ ticketId: number | null;
6433
+ onOpenChange: (open: boolean) => void;
6434
+ }): JSX.Element;
6435
+
6436
+ /** Shapes served by /api/support (#999). */
6437
+ declare type TicketStatus = 'open' | 'in_progress' | 'done' | 'cancelled';
6438
+
6201
6439
  export declare function TimezoneCard(): JSX.Element;
6202
6440
 
6203
6441
  export declare function TipLayer(): ReactPortal | null;
@@ -6279,6 +6517,16 @@ export declare function useChannelAdmin(channelId: number | null): {
6279
6517
  visibility?: "open" | "role" | "private";
6280
6518
  role?: string | null;
6281
6519
  is_archived?: boolean;
6520
+ icon?: string | null;
6521
+ color?: string | null;
6522
+ announce?: boolean;
6523
+ description?: string | null;
6524
+ links?: Array<{
6525
+ label: string;
6526
+ url: string;
6527
+ }>;
6528
+ welcome_note?: string | null;
6529
+ default_roles?: string[];
6282
6530
  }, unknown>;
6283
6531
  addMember: UseMutationResult<unknown, Error, string, unknown>;
6284
6532
  removeMember: UseMutationResult<unknown, Error, string, unknown>;
@@ -6298,9 +6546,19 @@ export declare function useChannelMembers(channelId: number | null): {
6298
6546
 
6299
6547
  export declare function useChatConfig(): ChatConfig;
6300
6548
 
6301
- export declare function useChatMessages(room: string | null): {
6302
- messages: NoInfer<ChatMessage[]>;
6549
+ /**
6550
+ * A room's timeline (thread replies excluded). Opens on the newest messages,
6551
+ * or around a message / a day when `anchor` is given (#976, #977); older and
6552
+ * newer history loads on demand.
6553
+ */
6554
+ export declare function useChatMessages(room: string | null, anchor?: ChatAnchor): {
6555
+ messages: ChatMessage[];
6303
6556
  loading: boolean;
6557
+ hasOlder: boolean;
6558
+ hasNewer: boolean;
6559
+ anchorId: number | null;
6560
+ loadOlder: () => Promise<void>;
6561
+ loadingOlder: boolean;
6304
6562
  };
6305
6563
 
6306
6564
  /** Id + name only — /api/roles is admin-gated, so the channel picker reads the
@@ -6323,9 +6581,7 @@ export declare function useChatRooms(): {
6323
6581
  loading: boolean;
6324
6582
  };
6325
6583
 
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): {
6584
+ export declare function useChatSearch(q: string, filters?: ChatSearchFilters): {
6329
6585
  hits: NoInfer<ChatSearchHit[]>;
6330
6586
  loading: boolean;
6331
6587
  };
@@ -6336,6 +6592,8 @@ key?: string;
6336
6592
  topic?: string;
6337
6593
  visibility?: "open" | "role" | "private";
6338
6594
  role?: string | null;
6595
+ icon?: string | null;
6596
+ color?: string | null;
6339
6597
  }, unknown>;
6340
6598
 
6341
6599
  export declare function useCreateGroupDm(): UseMutationResult< {
@@ -6640,9 +6898,11 @@ export declare function UserAvatar({ userId, fallback, className, style, alt }:
6640
6898
  alt?: string;
6641
6899
  }): JSX.Element;
6642
6900
 
6643
- export declare function UserChip({ userId, size }: {
6901
+ export declare function UserChip({ userId, size, children }: {
6644
6902
  userId: string;
6645
6903
  size?: 'default' | 'compact';
6904
+ /** A custom trigger (e.g. a chat avatar) that opens the same user card. */
6905
+ children?: React_2.ReactElement;
6646
6906
  }): React_2.JSX.Element;
6647
6907
 
6648
6908
  /** Integration events about one record, newest first, one page at a time. */
@@ -6689,6 +6949,11 @@ export declare function useRoomMembership(): {
6689
6949
  room: string;
6690
6950
  archived: boolean;
6691
6951
  }, unknown>;
6952
+ setStarred: UseMutationResult<unknown, Error, {
6953
+ room: string;
6954
+ starred: boolean;
6955
+ }, unknown>;
6956
+ dismissWelcome: UseMutationResult<unknown, Error, string, unknown>;
6692
6957
  };
6693
6958
 
6694
6959
  export declare function useRoomPins(room: string | null): NoInfer<PinnedMessage[]>;
@@ -6708,11 +6973,16 @@ export declare function useScopeDimensions(): ScopeDimensionLite[];
6708
6973
 
6709
6974
  export declare function useSectionState(form: UseNivaroFormReturn, defaultCollapsed?: string[]): SectionState;
6710
6975
 
6711
- export declare function useSendChatMessage(room: string): UseMutationResult<void, Error, string | {
6712
- text: string;
6713
- mentions?: string[];
6714
- attachments?: string[];
6715
- }, unknown>;
6976
+ /**
6977
+ * Send through the outbox (#983, #984): the message shows at once as
6978
+ * "Sending…", a network failure keeps it queued and retries in order when the
6979
+ * connection is back, a refusal marks it failed with Retry. The client id rides
6980
+ * the request, so a retry of a send that actually landed is not posted twice.
6981
+ */
6982
+ export declare function useSendChatMessage(room: string): {
6983
+ mutate: (input: string | SendInput) => void;
6984
+ isPending: boolean;
6985
+ };
6716
6986
 
6717
6987
  export declare function useSessionRecorder(options?: SessionRecorderOptions): void;
6718
6988