@realtimexsco/live-chat 1.2.0 → 1.3.1

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.mts CHANGED
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
2
3
  import * as zustand_middleware from 'zustand/middleware';
3
4
  import * as zustand from 'zustand';
4
5
  import { ManagerOptions, SocketOptions, Socket } from 'socket.io-client';
@@ -22,12 +23,14 @@ interface IChannel {
22
23
  starredCount?: number;
23
24
  isLeft?: boolean;
24
25
  isBlocked?: boolean;
26
+ email?: string;
25
27
  }
26
28
  interface IMessage {
27
29
  id: string;
28
30
  _id?: string;
29
31
  content: string;
30
32
  sender: string;
33
+ senderId?: string;
31
34
  receiver?: string;
32
35
  timestamp: string;
33
36
  isOwnMessage: boolean;
@@ -49,52 +52,97 @@ interface IMessageAttachment {
49
52
  url: string;
50
53
  type: "image" | "video" | "audio" | "file";
51
54
  name: string;
55
+ fileType?: string;
56
+ size?: number;
57
+ width?: number;
58
+ height?: number;
59
+ duration?: number;
60
+ caption?: string;
61
+ starredBy?: string[];
62
+ reactions?: any[];
63
+ isStarredByMe?: boolean;
64
+ isPinned?: boolean;
65
+ isDeletedForEveryone?: boolean;
66
+ }
67
+ /** Payload shape for dm_send / group_message_send socket events */
68
+ interface ISocketMessageAttachment {
69
+ url: string;
70
+ filename: string;
71
+ fileType: string;
72
+ size?: number;
73
+ width?: number;
74
+ height?: number;
75
+ duration?: number;
76
+ uploadedAt?: string;
77
+ caption?: string;
52
78
  }
53
79
  interface IAttachment {
54
80
  id: string;
55
81
  file: File;
56
82
  previewUrl: string;
57
83
  type: "image" | "video" | "audio" | "file";
84
+ uploadStatus: "uploading" | "uploaded" | "error";
85
+ uploadError?: string;
86
+ caption?: string;
87
+ uploaded?: ISocketMessageAttachment;
58
88
  }
59
89
 
60
- interface UIConfig {
61
- showSidebarAvatar?: boolean;
62
- sidebarAvatarColor?: string;
63
- showChannelDetails?: boolean;
64
- messageDateFormat?: (date: string) => string;
65
- }
66
- interface ChatContextValue {
67
- activeChannel: IChannel | null;
68
- setActiveChannel: (channel: IChannel | null) => void;
69
- onSendMessage?: (content: string, attachments: any[]) => void;
70
- client?: any;
71
- theme?: string;
72
- uiConfig: UIConfig;
73
- themeColor: string;
74
- channelsData?: IChannel[];
75
- messagesData?: Record<string, IMessage[]>;
76
- }
77
- declare const useChatContext: () => ChatContextValue;
78
- interface ChatProps {
79
- children: React.ReactNode;
80
- onSendMessage?: (content: string, attachments: any[]) => void;
81
- client?: {
82
- id: string;
83
- };
84
- theme?: string;
85
- uiConfig?: UIConfig;
86
- themeColor?: string;
87
- accessToken?: string;
88
- loggedUserDetails?: any;
89
- apiUrl?: string;
90
- socketUrl?: string;
91
- channelsData?: IChannel[];
92
- messagesData?: Record<string, IMessage[]>;
93
- onMessageReceived?: (message: any) => void;
94
- onSocketConnected?: (socketId: string) => void;
95
- onSocketError?: (error: string) => void;
90
+ /**
91
+ * Named API targets for selective query-param injection.
92
+ * Consumers pick which endpoints receive `queryParams`.
93
+ */
94
+ declare const CHAT_GET_API_KEYS: readonly ["users", "conversations", "conversationInfo", "messages", "pinnedMessages", "starredMessages", "searchMessages", "searchMessagesContext"];
95
+ declare const CHAT_API_KEYS: readonly ["all", "get", "login", "users", "conversations", "conversationInfo", "messages", "pinnedMessages", "starredMessages", "searchMessages", "searchMessagesContext", "createGroup", "updateGroupPermissions", "updateGroupInfo", "manageMembers", "manageAdmins", "blockUnblock", "presignedUrls"];
96
+ type ChatApiKey = (typeof CHAT_API_KEYS)[number];
97
+ type ChatGetApiKey = (typeof CHAT_GET_API_KEYS)[number];
98
+ type ChatQueryParamValue = string | number | boolean;
99
+ type ChatQueryParams = Record<string, ChatQueryParamValue>;
100
+ type ChatQueryParamsByApi = Partial<Record<Exclude<ChatApiKey, "all" | "get">, ChatQueryParams>>;
101
+ /** Match an axios request URL to a named API key (first match wins). */
102
+ declare function resolveChatApiKey(url?: string): Exclude<ChatApiKey, "all" | "get"> | null;
103
+
104
+ declare const setChatClientId: (id: string) => void;
105
+ declare const setChatAccessToken: (token: string) => void;
106
+ declare const setChatBaseURL: (url: string) => void;
107
+ declare const getChatBaseUrl: () => string;
108
+ declare const setChatSocketUrl: (url: string) => void;
109
+ declare const getChatSocketUrl: () => string;
110
+ declare const setChatQueryParams: (params?: ChatQueryParams | null) => void;
111
+ declare const getChatQueryParams: () => {
112
+ [x: string]: string;
113
+ };
114
+ /**
115
+ * Which APIs receive shared `queryParams`.
116
+ * Default `['get']` = every GET endpoint.
117
+ * Use `['all']` for every method, or specific keys like `['conversations']`.
118
+ */
119
+ declare const setChatQueryParamApis: (apis?: ChatApiKey[] | null) => void;
120
+ declare const getChatQueryParamApis: () => ("all" | "get" | "login" | "users" | "conversations" | "conversationInfo" | "messages" | "pinnedMessages" | "starredMessages" | "searchMessages" | "searchMessagesContext" | "createGroup" | "updateGroupPermissions" | "updateGroupInfo" | "manageMembers" | "manageAdmins" | "blockUnblock" | "presignedUrls")[];
121
+ /** Per-API query params (override / extend shared params for that endpoint). */
122
+ declare const setChatQueryParamsByApi: (byApi?: ChatQueryParamsByApi | null) => void;
123
+ declare const getChatQueryParamsByApi: () => {
124
+ login?: Record<string, string> | undefined;
125
+ users?: Record<string, string> | undefined;
126
+ conversations?: Record<string, string> | undefined;
127
+ conversationInfo?: Record<string, string> | undefined;
128
+ messages?: Record<string, string> | undefined;
129
+ pinnedMessages?: Record<string, string> | undefined;
130
+ starredMessages?: Record<string, string> | undefined;
131
+ searchMessages?: Record<string, string> | undefined;
132
+ searchMessagesContext?: Record<string, string> | undefined;
133
+ createGroup?: Record<string, string> | undefined;
134
+ updateGroupPermissions?: Record<string, string> | undefined;
135
+ updateGroupInfo?: Record<string, string> | undefined;
136
+ manageMembers?: Record<string, string> | undefined;
137
+ manageAdmins?: Record<string, string> | undefined;
138
+ blockUnblock?: Record<string, string> | undefined;
139
+ presignedUrls?: Record<string, string> | undefined;
140
+ };
141
+
142
+ interface ChatForwardItem {
143
+ message: IMessage;
144
+ attachmentId?: string;
96
145
  }
97
- declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React.JSX.Element;
98
146
 
99
147
  interface ChatLayoutConfig {
100
148
  /** Sidebar with profile + conversation list */
@@ -115,28 +163,15 @@ interface ChatLayoutConfig {
115
163
  declare const defaultChatLayoutConfig: Required<ChatLayoutConfig>;
116
164
  declare const mergeChatLayoutConfig: (config?: ChatLayoutConfig) => Required<ChatLayoutConfig>;
117
165
 
118
- interface ChatMainProps {
119
- clientId: string;
120
- loggedUserDetails: any;
121
- accessToken: string;
122
- apiUrl?: string;
123
- socketUrl?: string;
124
- themeColor?: string;
125
- theme?: string;
126
- uiConfig?: UIConfig;
127
- /** Control which sections render. Omit for full UI. */
128
- layout?: ChatLayoutConfig;
129
- }
130
- declare const ChatMain: (props: ChatMainProps) => React.JSX.Element;
131
-
132
166
  interface IUser {
133
167
  _id: string;
168
+ id?: string;
134
169
  name: string;
135
170
  email: string;
136
171
  role: string;
137
172
  isActive: boolean;
138
- createdAt: string | Date;
139
- updatedAt: string | Date;
173
+ createdAt: Date;
174
+ updatedAt: Date;
140
175
  image?: string;
141
176
  refreshToken?: string;
142
177
  isOnline?: boolean;
@@ -149,7 +184,6 @@ interface AuthState {
149
184
  accessToken: string | null;
150
185
  tenantId: string | null;
151
186
  isTenant: boolean;
152
- /** True only after client-user login + session setup completes */
153
187
  isSessionReady: boolean;
154
188
  setSession: (payload: {
155
189
  accessToken: string;
@@ -157,8 +191,8 @@ interface AuthState {
157
191
  tenantId?: string;
158
192
  isTenant?: boolean;
159
193
  }) => void;
160
- setSessionReady: (ready: boolean) => void;
161
194
  clearSession: () => void;
195
+ setSessionReady: (ready: boolean) => void;
162
196
  }
163
197
  interface GroupPermissions {
164
198
  onlyAdminCanSendMessage: boolean;
@@ -176,6 +210,7 @@ interface IConversationInfo {
176
210
  groupName?: string;
177
211
  groupDescription?: string;
178
212
  image?: string;
213
+ groupImage?: string;
179
214
  groupAdmins: any[];
180
215
  createdAt: string;
181
216
  updatedAt: string;
@@ -201,12 +236,8 @@ interface SocketState {
201
236
  isFetchingAllUsers: boolean;
202
237
  isFetchingConversations: boolean;
203
238
  isFetchingMessages: boolean;
204
- isFetchingMessagesByConv: Record<string, number>;
205
- isFetchingInfo: Record<string, boolean>;
206
239
  conversationsPage: number;
207
240
  conversationsHasMore: boolean;
208
- lastConversationsFetchKey: string | null;
209
- sidebarConversationsSearchKey: string | null;
210
241
  lastDM: any | null;
211
242
  lastEditDM: any | null;
212
243
  lastDeleteDM: any | null;
@@ -219,6 +250,8 @@ interface SocketState {
219
250
  typingUsers: Record<string, any[]>;
220
251
  pinnedMessagesByConversation: Record<string, any[]>;
221
252
  starredMessagesByConversation: Record<string, any[]>;
253
+ isFetchingPinnedMessages: Record<string, boolean>;
254
+ isFetchingStarredMessages: Record<string, boolean>;
222
255
  messagePendingActions: Record<string, string[]>;
223
256
  messagesMetadata: Record<string, MessagesMetadata>;
224
257
  liveConversationCounts: Record<string, {
@@ -228,13 +261,14 @@ interface SocketState {
228
261
  isClearingChat: Record<string, boolean>;
229
262
  isDeletingConversation: Record<string, boolean>;
230
263
  conversationInfos: Record<string, IConversationInfo>;
264
+ isFetchingInfo: Record<string, boolean>;
231
265
  isSearchActive: boolean;
232
266
  searchedMessageId: string | null;
233
267
  activeConversationId: string | null;
234
- appError: AppErrorState | null;
235
- composerDisabledReason: string | null;
268
+ globalAppError: AppErrorState | null;
269
+ conversationErrors: Record<string, AppErrorState>;
270
+ composerDisabledByConversation: Record<string, string>;
236
271
  rateLimitResetAt: number;
237
- activeChannel: IChannel | null;
238
272
  connectRequested: (config?: any) => void;
239
273
  disconnectRequested: () => void;
240
274
  setConnecting: () => void;
@@ -270,9 +304,8 @@ interface SocketState {
270
304
  receivedGroupMessage: (payload: any) => void;
271
305
  fetchMessages: (conversationId: string, limit?: number, cursor?: string | null) => Promise<void>;
272
306
  setActiveConversationId: (conversationId: string | null) => void;
273
- setActiveChannel: (channel: IChannel | null) => void;
274
307
  handleAppError: (message: string) => void;
275
- clearAppError: () => void;
308
+ clearAppError: (conversationId?: string | null) => void;
276
309
  setRateLimitResetAt: (resetAt: number) => void;
277
310
  receivedDM: (dm: any) => void;
278
311
  emitDmSend: (payload: any) => void;
@@ -395,6 +428,7 @@ interface SocketState {
395
428
  sender: string;
396
429
  targetConversationIds: string[];
397
430
  sourceConversationId?: string;
431
+ attachmentId?: string;
398
432
  }) => void;
399
433
  clearForwardPending: (messageId?: string) => void;
400
434
  emitConversationUpdate: (payload: {
@@ -405,14 +439,562 @@ interface SocketState {
405
439
  sender: string;
406
440
  }) => void;
407
441
  receivedGroupLeave: (payload: any) => void;
408
- fetchSearchMessageContext: (messageId: string) => Promise<void>;
442
+ fetchSearchMessageContext: (messageId: string, options?: {
443
+ searchMode?: boolean;
444
+ }) => Promise<void>;
409
445
  setSearchActive: (active: boolean) => void;
410
446
  setSearchedMessageId: (messageId: string | null) => void;
411
- toggleBlock: (userId: string, isBlocked: boolean) => void;
447
+ toggleBlock: (userId: string, isBlocked: boolean, conversationId?: string | null) => void;
412
448
  }
413
449
  interface AppStoreState extends SocketState, AuthState {
414
450
  }
415
451
 
452
+ /** Context passed to phone / video call handlers */
453
+ interface ChatCallContext {
454
+ activeChannel: IChannel;
455
+ conversationId: string | null;
456
+ }
457
+ /** Feature flags & callbacks — phone/video call, etc. */
458
+ interface ChatFeatures {
459
+ /** Show voice call button in header (default: `true` for DMs) */
460
+ showPhoneCall?: boolean;
461
+ /** Show video call button in header (default: `true`) */
462
+ showVideoCall?: boolean;
463
+ /**
464
+ * When `true`, hide phone/video buttons in group chats.
465
+ * Default: `false` (buttons show in all chats).
466
+ */
467
+ hideCallActionsInGroupChats?: boolean;
468
+ /** Called when user taps voice call */
469
+ onPhoneCall?: (ctx: ChatCallContext) => void;
470
+ /** Called when user taps video call */
471
+ onVideoCall?: (ctx: ChatCallContext) => void;
472
+ }
473
+ declare const defaultChatFeatures: Required<Pick<ChatFeatures, 'showPhoneCall' | 'showVideoCall' | 'hideCallActionsInGroupChats'>>;
474
+ interface AvatarSlotProps {
475
+ src?: string | null;
476
+ alt?: string;
477
+ name?: string;
478
+ fallback?: string;
479
+ id?: string;
480
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
481
+ showOnline?: boolean;
482
+ isOnline?: boolean;
483
+ className?: string;
484
+ fallbackClassName?: string;
485
+ }
486
+ interface MessageItemSlotProps {
487
+ isSender: boolean;
488
+ message: string;
489
+ createdAt: string;
490
+ attachments?: IMessageAttachment[];
491
+ messageId?: string;
492
+ receiver?: string;
493
+ isEdited?: boolean;
494
+ isDeletedForEveryone?: boolean;
495
+ reactions?: any[];
496
+ conversationId?: string;
497
+ onReply?: () => void;
498
+ onForward?: () => void;
499
+ replyTo?: any;
500
+ isPinned?: boolean;
501
+ isStarred?: boolean;
502
+ isForwarded?: boolean;
503
+ status?: 'sent' | 'delivered' | 'read';
504
+ isGroup?: boolean;
505
+ isSystemMessage?: boolean;
506
+ conversationInfo?: any;
507
+ isHighlighted?: boolean;
508
+ senderName?: string;
509
+ senderImage?: string;
510
+ showSenderName?: boolean;
511
+ showSenderLabel?: boolean;
512
+ senderAvatarImage?: string;
513
+ isGroupedWithPrev?: boolean;
514
+ isGroupedWithNext?: boolean;
515
+ }
516
+ interface ChannelHeaderSlotProps {
517
+ activeChannel: IChannel | null;
518
+ conversationId: string | null;
519
+ onBack?: () => void;
520
+ }
521
+ interface ChannelListSlotProps {
522
+ activeChannel: IChannel | null;
523
+ onChannelSelect: (channel: IChannel) => void;
524
+ onNewChatClick?: () => void;
525
+ debouncedSearch?: string;
526
+ }
527
+ interface ChannelListItemSlotProps {
528
+ channel: IChannel & {
529
+ isTyping?: boolean;
530
+ draftPreview?: string | null;
531
+ isOwnLastMessage?: boolean;
532
+ lastMessage?: IChannel['lastMessage'] & {
533
+ status?: 'sent' | 'delivered' | 'read';
534
+ };
535
+ };
536
+ isActive: boolean;
537
+ onSelect: (channel: IChannel) => void;
538
+ }
539
+ interface LoggedUserDetailsSlotProps {
540
+ loggedUserDetails: any;
541
+ onUserSelect?: (channel: IChannel) => void;
542
+ isCreateModalOpen?: boolean;
543
+ setIsCreateModalOpen?: (open: boolean) => void;
544
+ searchQuery?: string;
545
+ setSearchQuery?: (val: string) => void;
546
+ }
547
+ interface ActiveChannelMessagesSlotProps {
548
+ activeChannel: IChannel | null;
549
+ loggedUserId?: string;
550
+ conversationMessages?: any[];
551
+ localMessages?: IMessage[];
552
+ isLoading?: boolean;
553
+ conversationId?: string | null;
554
+ onReply?: (message: IMessage) => void;
555
+ onForward?: (message: IMessage) => void;
556
+ conversationInfo: IConversationInfo | null;
557
+ }
558
+ interface ChannelMessageBoxSlotProps {
559
+ activeChannel: IChannel | null;
560
+ conversationId: string | null;
561
+ onSendMessage?: (content: string, attachments: IAttachment[], replyTo?: IMessage | null) => void;
562
+ replyTo?: IMessage | null;
563
+ onCancelReply?: () => void;
564
+ }
565
+ interface ForwardModalSlotProps {
566
+ isOpen: boolean;
567
+ onClose: () => void;
568
+ items: ChatForwardItem[];
569
+ onForwardComplete?: (channel: IChannel) => void;
570
+ }
571
+ interface ChatPanelAlertsSlotProps {
572
+ className?: string;
573
+ }
574
+ /**
575
+ * Replace the entire chat shell. Custom layouts should call `useChatController()`
576
+ * for state, handlers, and message data.
577
+ */
578
+ interface ChatLayoutSlotProps {
579
+ layout?: ChatLayoutConfig;
580
+ loggedUserDetails?: any;
581
+ themeColor?: string;
582
+ className?: string;
583
+ shellClassName?: string;
584
+ }
585
+ interface HeaderLeftSideSlotProps {
586
+ onBack?: () => void;
587
+ activeChannel: IChannel;
588
+ pinnedCount: number;
589
+ starredCount: number;
590
+ onOpenDetails: () => void;
591
+ onOpenPins: () => void;
592
+ onOpenStars: () => void;
593
+ }
594
+ interface HeaderRightSideSlotProps {
595
+ activeChannel: IChannel;
596
+ conversationId: string | null;
597
+ isAdmin: boolean;
598
+ canViewMembers: boolean;
599
+ onOpenSearch: () => void;
600
+ onOpenDetails: () => void;
601
+ onOpenPermissions: () => void;
602
+ onOpenMembers: () => void;
603
+ onOpenAdmins: () => void;
604
+ onOpenAttachments: () => void;
605
+ onOpenPins: () => void;
606
+ onOpenStars: () => void;
607
+ onOpenClearChat: () => void;
608
+ onOpenDeleteChannel: () => void;
609
+ onOpenLeaveGroup?: () => void;
610
+ onToggleBlock?: () => void;
611
+ isBlocked?: boolean;
612
+ }
613
+ interface HeaderCallActionsSlotProps {
614
+ activeChannel: IChannel;
615
+ conversationId: string | null;
616
+ showPhoneCall?: boolean;
617
+ showVideoCall?: boolean;
618
+ onPhoneCall?: () => void;
619
+ onVideoCall?: () => void;
620
+ className?: string;
621
+ }
622
+ interface PhoneCallButtonSlotProps {
623
+ activeChannel: IChannel;
624
+ conversationId: string | null;
625
+ onPhoneCall?: () => void;
626
+ className?: string;
627
+ }
628
+ interface VideoCallButtonSlotProps {
629
+ activeChannel: IChannel;
630
+ conversationId: string | null;
631
+ onVideoCall?: () => void;
632
+ className?: string;
633
+ }
634
+ interface HeaderSearchOverlaySlotProps {
635
+ searchQuery: string;
636
+ isSearching: boolean;
637
+ searchResults: any[];
638
+ onSelectResult: (result: any) => void;
639
+ hasMore: boolean;
640
+ isLoadingMore: boolean;
641
+ onLoadMore: () => void;
642
+ }
643
+ interface ChatActionModalSlotProps {
644
+ isOpen: boolean;
645
+ onOpenChange: (open: boolean) => void;
646
+ title: string;
647
+ description: string;
648
+ warningTitle: string;
649
+ warningDescription: string;
650
+ actionButtonText: string;
651
+ loadingText: string;
652
+ isLoading: boolean;
653
+ onAction: () => void;
654
+ type: 'clear' | 'delete' | 'block';
655
+ }
656
+ interface ChannelDetailsDrawerSlotProps {
657
+ isOpen: boolean;
658
+ onOpenChange: (open: boolean) => void;
659
+ activeChannel: IChannel;
660
+ conversationInfo: IConversationInfo | null;
661
+ }
662
+ interface MembersDrawerSlotProps {
663
+ isOpen: boolean;
664
+ onOpenChange: (open: boolean) => void;
665
+ conversationId: string | null;
666
+ conversationInfo: IConversationInfo | null;
667
+ }
668
+ interface AdminsDrawerSlotProps {
669
+ isOpen: boolean;
670
+ onOpenChange: (open: boolean) => void;
671
+ conversationId: string | null;
672
+ conversationInfo: IConversationInfo | null;
673
+ }
674
+ interface PermissionDrawerSlotProps {
675
+ isOpen: boolean;
676
+ onOpenChange: (open: boolean) => void;
677
+ conversationId: string | null;
678
+ conversationInfo: IConversationInfo | null;
679
+ }
680
+ interface AttachmentsDrawerSlotProps {
681
+ isOpen: boolean;
682
+ onOpenChange: (open: boolean) => void;
683
+ }
684
+ interface PinnedMessagesDrawerSlotProps {
685
+ isOpen: boolean;
686
+ onOpenChange: (open: boolean) => void;
687
+ pinnedMessages: any[];
688
+ loggedUserDetails: any;
689
+ conversationId: string | null;
690
+ activeChannel: IChannel;
691
+ loadingIds: Set<string>;
692
+ formatRelativeTime: (date: string) => string;
693
+ onUnpin: (messageId: string) => void;
694
+ }
695
+ interface StarredMessagesDrawerSlotProps {
696
+ isOpen: boolean;
697
+ onOpenChange: (open: boolean) => void;
698
+ starredMessages: any[];
699
+ loggedUserDetails: any;
700
+ conversationId: string | null;
701
+ activeChannel: IChannel;
702
+ loadingIds: Set<string>;
703
+ formatRelativeTime: (date: string) => string;
704
+ onUnstar: (messageId: string) => void;
705
+ }
706
+ interface MessageToolbarSlotProps {
707
+ isSender: boolean;
708
+ isRecent: boolean;
709
+ messageId: string;
710
+ isPinned?: boolean;
711
+ isStarred?: boolean;
712
+ isPinPending?: boolean;
713
+ isStarPending?: boolean;
714
+ isReactionOpen: boolean;
715
+ isDeleteOpen: boolean;
716
+ setIsReactionOpen: (val: boolean) => void;
717
+ setIsDeleteOpen: (val: boolean) => void;
718
+ onReply?: () => void;
719
+ onForward?: () => void;
720
+ onEdit: () => void;
721
+ onDelete: (deleteType: 'me' | 'everyone') => void;
722
+ onReactionClick: (emoji: any) => void;
723
+ onPinClick: () => void;
724
+ onStarClick: () => void;
725
+ canUnpin: boolean;
726
+ canEdit: boolean;
727
+ }
728
+ interface MessageStatusSlotProps {
729
+ status?: 'sent' | 'delivered' | 'read';
730
+ isPending?: boolean;
731
+ isGroup?: boolean;
732
+ className?: string;
733
+ }
734
+ interface MessageAttachmentsSlotProps {
735
+ attachments: IMessageAttachment[];
736
+ isDeletedForEveryone?: boolean;
737
+ }
738
+ interface MessageReactionsSlotProps {
739
+ groupedReactions: Record<string, number>;
740
+ reactions?: any[];
741
+ loggedUserId?: string;
742
+ isSender: boolean;
743
+ isDeletedForEveryone?: boolean;
744
+ onReactionClick: (emoji: string) => void;
745
+ }
746
+ interface MessageReplySnippetSlotProps {
747
+ replyTo: any;
748
+ isSender: boolean;
749
+ loggedUserDetails?: any;
750
+ allUsers?: any[];
751
+ }
752
+ interface ChatClassNames {
753
+ shell?: string;
754
+ mainPanel?: string;
755
+ sidebar?: string;
756
+ loggedUserDetails?: string;
757
+ channelList?: string;
758
+ channelListItem?: string;
759
+ channelListItemActive?: string;
760
+ channelHeader?: string;
761
+ headerLeft?: string;
762
+ headerRight?: string;
763
+ headerCallActions?: string;
764
+ phoneCallButton?: string;
765
+ videoCallButton?: string;
766
+ messageList?: string;
767
+ messageItem?: string;
768
+ messageBubble?: string;
769
+ messageBubbleSender?: string;
770
+ messageBubbleReceiver?: string;
771
+ messageInput?: string;
772
+ messageInputTextarea?: string;
773
+ avatar?: string;
774
+ avatarFallback?: string;
775
+ dateDivider?: string;
776
+ emptyState?: string;
777
+ forwardModal?: string;
778
+ chatPanelAlerts?: string;
779
+ drawer?: string;
780
+ drawerContent?: string;
781
+ searchOverlay?: string;
782
+ }
783
+ interface ChatComponents {
784
+ /** Case 1: replace the entire chat UI shell */
785
+ ChatLayout?: React__default.ComponentType<ChatLayoutSlotProps>;
786
+ LoggedUserDetails?: React__default.ComponentType<LoggedUserDetailsSlotProps>;
787
+ ChannelList?: React__default.ComponentType<ChannelListSlotProps>;
788
+ ChannelListItem?: React__default.ComponentType<ChannelListItemSlotProps>;
789
+ ChannelHeader?: React__default.ComponentType<ChannelHeaderSlotProps>;
790
+ HeaderLeftSide?: React__default.ComponentType<HeaderLeftSideSlotProps>;
791
+ HeaderRightSide?: React__default.ComponentType<HeaderRightSideSlotProps>;
792
+ HeaderCallActions?: React__default.ComponentType<HeaderCallActionsSlotProps>;
793
+ PhoneCallButton?: React__default.ComponentType<PhoneCallButtonSlotProps>;
794
+ VideoCallButton?: React__default.ComponentType<VideoCallButtonSlotProps>;
795
+ HeaderSearchOverlay?: React__default.ComponentType<HeaderSearchOverlaySlotProps>;
796
+ MessageList?: React__default.ComponentType<ActiveChannelMessagesSlotProps>;
797
+ MessageItem?: React__default.ComponentType<MessageItemSlotProps>;
798
+ MessageInput?: React__default.ComponentType<ChannelMessageBoxSlotProps>;
799
+ ForwardModal?: React__default.ComponentType<ForwardModalSlotProps>;
800
+ ChatPanelAlerts?: React__default.ComponentType<ChatPanelAlertsSlotProps>;
801
+ ChatActionModal?: React__default.ComponentType<ChatActionModalSlotProps>;
802
+ ChannelDetailsDrawer?: React__default.ComponentType<ChannelDetailsDrawerSlotProps>;
803
+ MembersDrawer?: React__default.ComponentType<MembersDrawerSlotProps>;
804
+ AdminsDrawer?: React__default.ComponentType<AdminsDrawerSlotProps>;
805
+ PermissionDrawer?: React__default.ComponentType<PermissionDrawerSlotProps>;
806
+ AttachmentsDrawer?: React__default.ComponentType<AttachmentsDrawerSlotProps>;
807
+ PinnedMessagesDrawer?: React__default.ComponentType<PinnedMessagesDrawerSlotProps>;
808
+ StarredMessagesDrawer?: React__default.ComponentType<StarredMessagesDrawerSlotProps>;
809
+ Avatar?: React__default.ComponentType<AvatarSlotProps>;
810
+ MessageToolbar?: React__default.ComponentType<MessageToolbarSlotProps>;
811
+ MessageStatus?: React__default.ComponentType<MessageStatusSlotProps>;
812
+ MessageAttachments?: React__default.ComponentType<MessageAttachmentsSlotProps>;
813
+ MessageReactions?: React__default.ComponentType<MessageReactionsSlotProps>;
814
+ MessageReplySnippet?: React__default.ComponentType<MessageReplySnippetSlotProps>;
815
+ ChatThemeToggle?: React__default.ComponentType<{
816
+ className?: string;
817
+ }>;
818
+ ChatDateTimeSettings?: React__default.ComponentType<Record<string, never>>;
819
+ ChatSocketStatus?: React__default.ComponentType<{
820
+ className?: string;
821
+ }>;
822
+ }
823
+ interface ChatCustomizationConfig {
824
+ components?: ChatComponents;
825
+ classNames?: ChatClassNames;
826
+ features?: ChatFeatures;
827
+ }
828
+ declare const defaultChatClassNames: ChatClassNames;
829
+ declare const defaultChatComponents: ChatComponents;
830
+ declare const mergeChatCustomization: (config?: ChatCustomizationConfig) => {
831
+ components: ChatComponents;
832
+ classNames: ChatClassNames;
833
+ features: ChatFeatures;
834
+ };
835
+
836
+ interface UIConfig extends ChatCustomizationConfig {
837
+ showSidebarAvatar?: boolean;
838
+ sidebarAvatarColor?: string;
839
+ showChannelDetails?: boolean;
840
+ messageDateFormat?: (date: string) => string;
841
+ }
842
+ interface ChatContextValue {
843
+ onSendMessage?: (content: string, attachments: any[]) => void;
844
+ client?: any;
845
+ theme?: string;
846
+ uiConfig: UIConfig;
847
+ themeColor: string;
848
+ channelsData?: IChannel[];
849
+ messagesData?: Record<string, IMessage[]>;
850
+ }
851
+ declare const useChatContext: () => ChatContextValue;
852
+ interface ChatProps {
853
+ children: React__default.ReactNode;
854
+ onSendMessage?: (content: string, attachments: any[]) => void;
855
+ client?: {
856
+ id: string;
857
+ };
858
+ theme?: string;
859
+ uiConfig?: UIConfig;
860
+ themeColor?: string;
861
+ accessToken?: string;
862
+ loggedUserDetails?: any;
863
+ apiUrl: string;
864
+ socketUrl?: string;
865
+ /** Shared query params for selected APIs (see `queryParamApis`) */
866
+ queryParams?: ChatQueryParams;
867
+ /**
868
+ * Which APIs receive `queryParams`.
869
+ * Default: `['get']` (all GET endpoints).
870
+ */
871
+ queryParamApis?: ChatApiKey[];
872
+ /** Different query params per API key */
873
+ queryParamsByApi?: ChatQueryParamsByApi;
874
+ channelsData?: IChannel[];
875
+ messagesData?: Record<string, IMessage[]>;
876
+ onMessageReceived?: (message: any) => void;
877
+ onSocketConnected?: (socketId: string) => void;
878
+ onSocketError?: (error: string) => void;
879
+ }
880
+ declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React__default.JSX.Element;
881
+
882
+ type ChatColorMode = 'light' | 'dark';
883
+
884
+ interface ChatThemeContextValue {
885
+ colorMode: ChatColorMode;
886
+ isDark: boolean;
887
+ isThemeTransitionReady: boolean;
888
+ themeColor: string;
889
+ themeStyles: React__default.CSSProperties;
890
+ scopeClassName: string;
891
+ setColorMode: (mode: ChatColorMode) => void;
892
+ toggleColorMode: () => void;
893
+ showColorModeToggle: boolean;
894
+ }
895
+ interface ChatThemeProviderProps {
896
+ children: React__default.ReactNode;
897
+ /** Brand color — pass from host project, same as npm package usage */
898
+ themeColor: string;
899
+ /** Optional controlled light/dark — omit to use built-in toggle (default: light) */
900
+ colorMode?: ChatColorMode;
901
+ /** Default light/dark when uncontrolled. Defaults to `light`. */
902
+ defaultColorMode?: ChatColorMode;
903
+ onColorModeChange?: (mode: ChatColorMode) => void;
904
+ showColorModeToggle?: boolean;
905
+ }
906
+ declare const ChatThemeProvider: ({ children, themeColor, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, }: ChatThemeProviderProps) => React__default.JSX.Element;
907
+ declare const useChatTheme: () => ChatThemeContextValue;
908
+
909
+ interface ChatDateTimePreferences {
910
+ /** BCP 47 locale, e.g. "en-US", "en-GB". Defaults to browser locale. */
911
+ locale?: string;
912
+ /** IANA timezone, e.g. "America/New_York". Defaults to browser timezone. */
913
+ timeZone?: string;
914
+ /** `true` = 12-hour, `false` = 24-hour. Defaults to locale preference. */
915
+ hour12?: boolean;
916
+ }
917
+ declare function createChatDateTimeFormatters(prefs: ChatDateTimePreferences): {
918
+ prefs: ChatDateTimePreferences;
919
+ formatMessageTime: (input: Date | string | number) => string;
920
+ formatSidebarTime: (input: Date | string | number) => string;
921
+ formatDateDivider: (input: Date | string | number) => string;
922
+ formatShortDate: (input: Date | string | number) => string;
923
+ formatLongDate: (input: Date | string | number) => string;
924
+ formatSavedMessageDate: (dateStr?: string) => string;
925
+ };
926
+ type ChatDateTimeFormatters = ReturnType<typeof createChatDateTimeFormatters>;
927
+
928
+ type ChatViewportHeight = "full" | "screen" | "auto" | (string & {});
929
+ type ChatViewportProps = {
930
+ children: React__default.ReactNode;
931
+ className?: string;
932
+ /**
933
+ * Height strategy for the chat root.
934
+ * - `full` (default): fill parent (`h-full`) — parent must have a bounded height
935
+ * - `screen`: full viewport (`h-dvh`)
936
+ * - `auto`: no height class — use with `className` / `style.height`
937
+ * - any CSS length: e.g. `calc(100dvh - 4rem)` for admin shells with fixed header
938
+ */
939
+ height?: ChatViewportHeight;
940
+ style?: React__default.CSSProperties;
941
+ };
942
+ /** Bounded root wrapper — required for scroll + input to stay inside the chat panel */
943
+ declare function ChatViewport({ children, className, height, style, }: ChatViewportProps): React__default.JSX.Element;
944
+
945
+ interface ChatMainProps {
946
+ clientId: string;
947
+ loggedUserDetails: any;
948
+ accessToken: string;
949
+ apiUrl: string;
950
+ socketUrl?: string;
951
+ /** Shared query params for selected APIs (see `queryParamApis`) */
952
+ queryParams?: ChatQueryParams;
953
+ /**
954
+ * Which APIs receive `queryParams`.
955
+ * Default: `['get']` (all GET endpoints).
956
+ * Examples: `['conversations']`, `['get']`, `['all']`.
957
+ */
958
+ queryParamApis?: ChatApiKey[];
959
+ /**
960
+ * Different query params per API.
961
+ * GET keys: users, conversations, conversationInfo, messages,
962
+ * pinnedMessages, starredMessages, searchMessages, searchMessagesContext
963
+ */
964
+ queryParamsByApi?: ChatQueryParamsByApi;
965
+ themeColor?: string;
966
+ theme?: string;
967
+ uiConfig?: UIConfig;
968
+ /** Replace any built-in component with your own */
969
+ components?: ChatComponents;
970
+ /** Override classNames per UI region */
971
+ classNames?: ChatClassNames;
972
+ /** Phone/video call and other feature callbacks */
973
+ features?: ChatFeatures;
974
+ layout?: ChatLayoutConfig;
975
+ colorMode?: ChatColorMode;
976
+ defaultColorMode?: ChatColorMode;
977
+ onColorModeChange?: (mode: ChatColorMode) => void;
978
+ showColorModeToggle?: boolean;
979
+ locale?: string;
980
+ timeZone?: string;
981
+ hour12?: boolean;
982
+ defaultLocale?: string;
983
+ defaultTimeZone?: string;
984
+ defaultHour12?: boolean;
985
+ onDateTimePreferencesChange?: (prefs: ChatDateTimePreferences) => void;
986
+ showDateTimeSettings?: boolean;
987
+ error?: string | null;
988
+ info?: string | null;
989
+ onErrorDismiss?: () => void;
990
+ onInfoDismiss?: () => void;
991
+ /** Outer viewport height — default `full` (parent must set height). Use `screen` or `calc(100dvh - 4rem)` in admin apps */
992
+ viewportHeight?: ChatViewportHeight;
993
+ /** Extra classes on the viewport wrapper */
994
+ viewportClassName?: string;
995
+ }
996
+ declare const ChatMain: ({ clientId, loggedUserDetails, accessToken, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, themeColor, theme, uiConfig, components, classNames, features, layout, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, locale, timeZone, hour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, error, info, onErrorDismiss, onInfoDismiss, viewportHeight, viewportClassName, }: ChatMainProps) => React__default.JSX.Element;
997
+
416
998
  declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreState>, "setState" | "persist"> & {
417
999
  setState(partial: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState | Partial<AppStoreState>), replace?: false | undefined): unknown;
418
1000
  setState(state: AppStoreState | ((state: AppStoreState) => AppStoreState), replace: true): unknown;
@@ -443,7 +1025,10 @@ interface ISocketConfig {
443
1025
  url: string;
444
1026
  options: Partial<ManagerOptions & SocketOptions>;
445
1027
  }
446
- declare const getSocketConfig: (accessToken: string, tenantId: string, apiBaseUrl?: string) => ISocketConfig;
1028
+ declare const getSocketConfig: (accessToken: string, tenantId: string, options?: {
1029
+ apiUrl?: string;
1030
+ socketUrl?: string;
1031
+ }) => ISocketConfig;
447
1032
 
448
1033
  declare class SocketService {
449
1034
  private socket;
@@ -459,12 +1044,14 @@ declare class SocketService {
459
1044
  messageId: string;
460
1045
  sender: string;
461
1046
  receiver: string;
1047
+ attachmentId?: string;
462
1048
  }): void;
463
1049
  emitDmDelete(payload: {
464
1050
  messageId: string;
465
1051
  sender: string;
466
1052
  receiver: string;
467
- deleteType: "me" | "everyone";
1053
+ deleteType: 'me' | 'everyone';
1054
+ attachmentId?: string;
468
1055
  }): void;
469
1056
  emitDmClearChat(payload: {
470
1057
  conversationId: string;
@@ -526,6 +1113,9 @@ declare class SocketService {
526
1113
  messageId: string;
527
1114
  sender: string;
528
1115
  targetConversationIds: string[];
1116
+ receiver?: string;
1117
+ conversationId?: string;
1118
+ attachmentId?: string;
529
1119
  }): void;
530
1120
  emitGroupJoin(payload: {
531
1121
  conversationId: string;
@@ -550,7 +1140,8 @@ declare class SocketService {
550
1140
  emitGroupDelete(payload: {
551
1141
  messageId: string;
552
1142
  sender: string;
553
- deleteType: "me" | "everyone";
1143
+ deleteType: 'me' | 'everyone';
1144
+ attachmentId?: string;
554
1145
  }): void;
555
1146
  emitGroupPin(payload: {
556
1147
  conversationId: string;
@@ -578,6 +1169,9 @@ declare class SocketService {
578
1169
  messageId: string;
579
1170
  sender: string;
580
1171
  targetConversationIds: string[];
1172
+ conversationId?: string;
1173
+ sourceConversationId?: string;
1174
+ attachmentId?: string;
581
1175
  }): void;
582
1176
  emitConversationUpdate(payload: {
583
1177
  conversationId: string;
@@ -591,8 +1185,8 @@ declare class SocketService {
591
1185
  declare const socketService: SocketService;
592
1186
 
593
1187
  declare const Channel: ({ children }: {
594
- children: React.ReactNode;
595
- }) => React.JSX.Element;
1188
+ children: React__default.ReactNode;
1189
+ }) => React__default.JSX.Element;
596
1190
 
597
1191
  interface ChannelListProps {
598
1192
  activeChannel: IChannel | null;
@@ -600,14 +1194,17 @@ interface ChannelListProps {
600
1194
  onNewChatClick?: () => void;
601
1195
  debouncedSearch?: string;
602
1196
  }
603
- declare const ChannelList: ({ activeChannel, onChannelSelect, onNewChatClick, debouncedSearch }: ChannelListProps) => React.JSX.Element;
1197
+
1198
+ declare const ChannelListView: ({ activeChannel, onChannelSelect, onNewChatClick, debouncedSearch }: ChannelListProps) => React.JSX.Element;
604
1199
 
605
1200
  interface ChannelHeaderProps {
606
1201
  activeChannel: IChannel | null;
607
1202
  conversationId: string | null;
608
1203
  onBack?: () => void;
1204
+ onActiveChannelPatch?: (patch: Partial<IChannel>) => void;
609
1205
  }
610
- declare const ChannelHeader: ({ activeChannel, conversationId, onBack, }: ChannelHeaderProps) => React.JSX.Element | null;
1206
+
1207
+ declare const ChannelHeaderView: (props: ChannelHeaderProps) => React.JSX.Element | null;
611
1208
 
612
1209
  interface ActiveChannelMessagesProps {
613
1210
  activeChannel: IChannel | null;
@@ -618,72 +1215,69 @@ interface ActiveChannelMessagesProps {
618
1215
  conversationId?: string | null;
619
1216
  onReply?: (message: IMessage) => void;
620
1217
  onForward?: (message: IMessage) => void;
1218
+ onForwardItems?: (items: ChatForwardItem[]) => void;
1219
+ onSelectionModeChange?: (active: boolean) => void;
621
1220
  conversationInfo: IConversationInfo | null;
622
1221
  }
623
- declare const ActiveChannelMessages: ({ activeChannel, loggedUserId, conversationMessages, localMessages, isLoading, conversationId, onReply, onForward, conversationInfo }: ActiveChannelMessagesProps) => React.JSX.Element;
1222
+
1223
+ declare const ActiveChannelMessagesView: (props: ActiveChannelMessagesProps) => React.JSX.Element;
624
1224
 
625
1225
  interface ChannelMessageBoxProps {
626
1226
  activeChannel: IChannel | null;
627
1227
  conversationId: string | null;
628
- onSendMessage?: (content: string, attachments: IAttachment[], replyTo?: IMessage | null) => void;
1228
+ onSendMessage?: (content: string, attachments: ISocketMessageAttachment[], replyTo?: IMessage | null) => void;
629
1229
  replyTo?: IMessage | null;
630
1230
  onCancelReply?: () => void;
1231
+ onActiveChannelPatch?: (patch: Partial<IChannel>) => void;
631
1232
  }
632
- declare const ChannelMessageBox: ({ activeChannel, conversationId, onSendMessage, replyTo, onCancelReply }: ChannelMessageBoxProps) => React.JSX.Element | null;
1233
+
1234
+ declare const ChannelMessageBoxView: (props: ChannelMessageBoxProps) => React__default.JSX.Element | null;
633
1235
 
634
1236
  interface LoggedUserDetailsProps {
635
- loggedUserDetails?: any;
1237
+ loggedUserDetails: any;
636
1238
  onUserSelect?: (channel: IChannel) => void;
637
1239
  isCreateModalOpen?: boolean;
638
1240
  setIsCreateModalOpen?: (open: boolean) => void;
639
1241
  searchQuery?: string;
640
1242
  setSearchQuery?: (val: string) => void;
641
- themeColor?: string;
642
1243
  }
643
- declare const LoggedUserDetails: ({ loggedUserDetails: propsLoggedUserDetails, onUserSelect, isCreateModalOpen: propsIsCreateModalOpen, setIsCreateModalOpen: propsSetIsCreateModalOpen, searchQuery: propsSearchQuery, setSearchQuery: propsSetSearchQuery, themeColor: propsThemeColor, }: LoggedUserDetailsProps) => React.JSX.Element;
1244
+ declare const LoggedUserDetails: ({ loggedUserDetails, onUserSelect, isCreateModalOpen, setIsCreateModalOpen, searchQuery, setSearchQuery, }: LoggedUserDetailsProps) => React.JSX.Element;
644
1245
 
645
1246
  interface ForwardModalProps {
646
1247
  isOpen: boolean;
647
1248
  onClose: () => void;
648
- message: IMessage | null;
1249
+ items: ChatForwardItem[];
649
1250
  onForwardComplete: (channel: IChannel) => void;
650
1251
  }
651
- declare const ForwardModal: ({ isOpen, onClose, message, onForwardComplete }: ForwardModalProps) => React.JSX.Element | null;
652
1252
 
653
- interface ChatLayoutProps {
654
- /** Toggle which UI blocks are rendered */
655
- layout?: ChatLayoutConfig;
656
- /** Passed to LoggedUserDetails */
657
- loggedUserDetails?: any;
658
- themeColor?: string;
659
- className?: string;
660
- shellClassName?: string;
661
- }
1253
+ declare function ForwardModalView(props: ForwardModalProps): React.JSX.Element | null;
1254
+
1255
+ type ChatLayoutProps = ChatLayoutSlotProps;
662
1256
  /**
663
- * Composable chat shellturn sections on/off via `layout`.
664
- *
665
- * @example Full UI (default)
666
- * `<ChatLayout />`
667
- *
668
- * @example Messages only (no sidebar, header, or input)
669
- * `<ChatLayout layout={{ sidebar: false, header: false, input: false }} />`
670
- *
671
- * @example Custom — import pieces individually instead:
672
- * `import { Channel, MessageList } from '@realtimexsco/live-chat'`
1257
+ * Chat layout entryrenders `components.ChatLayout` when provided,
1258
+ * otherwise the package default. Custom full-UI layouts should use
1259
+ * `useChatController()` inside their component.
673
1260
  */
674
- declare const ChatLayout: ({ layout, loggedUserDetails: loggedUserDetailsProp, themeColor, className, shellClassName, }: ChatLayoutProps) => React.JSX.Element;
1261
+ declare const ChatLayout: (props: ChatLayoutProps) => React__default.JSX.Element;
1262
+
1263
+ type DefaultChatLayoutProps = ChatLayoutSlotProps;
1264
+ declare const DefaultChatLayout: ({ layout, loggedUserDetails: loggedUserDetailsProp, className, shellClassName, }: DefaultChatLayoutProps) => React__default.JSX.Element;
1265
+
1266
+ declare function buildReplyTarget(message: IMessage, attachmentId?: string): IMessage;
1267
+ declare function buildForwardItem(message: IMessage, attachmentId?: string): ChatForwardItem;
675
1268
 
676
1269
  interface ChatControllerState {
677
- replyTo: IMessage | null;
678
- forwardMessage: IMessage | null;
679
- isForwardModalOpen: boolean;
1270
+ activeChannel: IChannel | null;
1271
+ activeConversationId: string | null;
1272
+ replyToMessage: IMessage | null;
1273
+ forwardItems: ChatForwardItem[];
1274
+ isMessageSelectionMode: boolean;
680
1275
  searchQuery: string;
681
1276
  debouncedSearch: string;
682
1277
  isCreateModalOpen: boolean;
683
1278
  }
684
1279
  declare const useChatController: () => {
685
1280
  activeChannel: IChannel | null;
686
- setActiveChannel: (channel: IChannel | null) => void;
687
1281
  conversationId: string | null;
688
1282
  rateLimitResetAt: number;
689
1283
  isFetchingMessages: boolean;
@@ -694,12 +1288,21 @@ declare const useChatController: () => {
694
1288
  state: ChatControllerState;
695
1289
  updateState: (updates: Partial<ChatControllerState>) => void;
696
1290
  handleChannelSelect: (channel: IChannel) => void;
697
- handleSendMessage: (content: string, attachments: IAttachment[], replyTo?: IMessage | null) => void;
1291
+ handleSendMessage: (content: string, attachments: ISocketMessageAttachment[], replyTo?: IMessage | null) => void;
1292
+ handleSelectionModeChange: (active: boolean) => void;
1293
+ handleActiveChannelPatch: (patch: Partial<IChannel>) => void;
1294
+ buildReplyTarget: typeof buildReplyTarget;
1295
+ buildForwardItem: typeof buildForwardItem;
1296
+ setActiveChannel: (channel: IChannel | null) => void;
698
1297
  };
699
1298
 
700
- declare const setChatClientId: (id: string) => void;
701
- declare const setChatAccessToken: (token: string) => void;
702
- declare const setChatBaseURL: (url: string) => void;
1299
+ /** Normalize API base URL passed by the host app (must end with /api/v1). */
1300
+ declare function resolveApiUrl(apiUrl?: string): string;
1301
+ /**
1302
+ * Socket.io connects to the host origin with path `/connection`.
1303
+ * Prefer explicit `socketUrl`; otherwise derive from `apiUrl` by stripping `/api/v1`.
1304
+ */
1305
+ declare function resolveSocketUrl(socketUrl?: string, apiUrl?: string): string;
703
1306
 
704
1307
  type IDMMessage = {
705
1308
  sender: string;
@@ -767,4 +1370,114 @@ declare function uniqueList<T extends Record<string, any>>(list: T[], key: keyof
767
1370
  declare const capitalizeFirst: (str: string) => string;
768
1371
  declare const getFirstAndLastNameOneCharacter: (name: string) => string;
769
1372
 
770
- export { Channel, ChannelHeader, ChannelList, Chat, ChatLayout, type ChatLayoutConfig, ChatMain, ForwardModal, type IAttachment, type IChannel, type IDMDelete, type IDMEditMessage, type IDMForward, type IDMMessage, type IDMPin, type IDMReaction, type IDMRead, type IDMStar, type IDMTyping, type IDMUnstar, type IMessage, type ISocketConfig, LoggedUserDetails, ChannelMessageBox as MessageInput, ActiveChannelMessages as MessageList, type UIConfig, capitalizeFirst, ChatMain as default, defaultChatLayoutConfig, downloadFile, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatLayoutConfig, setChatAccessToken, setChatBaseURL, setChatClientId, showNotification, socketService, uniqueList, useChatContext, useChatController, useStore as useChatStore };
1373
+ interface ChatCustomizationContextValue {
1374
+ components: ChatComponents;
1375
+ classNames: ChatClassNames;
1376
+ features: ChatFeatures;
1377
+ slotClassName: (key: keyof ChatClassNames, defaultClassName?: string) => string | undefined;
1378
+ resolveComponent: <P extends object>(slot: keyof ChatComponents, DefaultComponent: React__default.ComponentType<P>) => React__default.ComponentType<P>;
1379
+ }
1380
+ interface ChatCustomizationProviderProps {
1381
+ children: React__default.ReactNode;
1382
+ customization?: ChatCustomizationConfig;
1383
+ }
1384
+ declare const ChatCustomizationProvider: ({ children, customization, }: ChatCustomizationProviderProps) => React__default.JSX.Element;
1385
+ declare const useChatCustomization: () => ChatCustomizationContextValue;
1386
+ declare const useChatCustomizationOptional: () => ChatCustomizationContextValue;
1387
+ declare const useChatFeatures: () => ChatFeatures;
1388
+ declare const useChatFeaturesOptional: () => ChatFeatures;
1389
+
1390
+ declare const DefaultChatAvatar: ({ src, alt, name, fallback, size, showOnline, isOnline, className, fallbackClassName, }: AvatarSlotProps) => React__default.JSX.Element;
1391
+ declare const ChatAvatar: (props: AvatarSlotProps) => React__default.JSX.Element;
1392
+
1393
+ declare const DefaultChannelListItem: ({ channel, isActive, onSelect, }: ChannelListItemSlotProps) => React__default.JSX.Element;
1394
+ declare const ChannelListItem: (props: ChannelListItemSlotProps) => React__default.JSX.Element;
1395
+
1396
+ declare const HeaderCallActions: (props: HeaderCallActionsSlotProps) => React__default.JSX.Element | null;
1397
+
1398
+ /**
1399
+ * Built-in components for every `ChatComponents` slot.
1400
+ * Use as fallback when building custom wrappers: `withMyTheme(packageDefaultComponents.MessageItem)`.
1401
+ */
1402
+ declare const packageDefaultComponents: ChatComponents;
1403
+
1404
+ interface MessageItemProps {
1405
+ isSender: boolean;
1406
+ message: string;
1407
+ createdAt: string;
1408
+ attachments?: IMessageAttachment[];
1409
+ messageId?: string;
1410
+ receiver?: string;
1411
+ isEdited?: boolean;
1412
+ isDeletedForEveryone?: boolean;
1413
+ reactions?: any[];
1414
+ conversationId?: string;
1415
+ onReply?: () => void;
1416
+ onForward?: () => void;
1417
+ onReplyClick?: (messageId: string) => void;
1418
+ replyTo?: any;
1419
+ isPinned?: boolean;
1420
+ isStarred?: boolean;
1421
+ isForwarded?: boolean;
1422
+ status?: "sent" | "delivered" | "read";
1423
+ isGroup?: boolean;
1424
+ isSystemMessage?: boolean;
1425
+ conversationInfo?: any;
1426
+ isHighlighted?: boolean;
1427
+ senderName?: string;
1428
+ senderImage?: string;
1429
+ showSenderName?: boolean;
1430
+ showSenderLabel?: boolean;
1431
+ senderAvatarImage?: string;
1432
+ isGroupedWithPrev?: boolean;
1433
+ isGroupedWithNext?: boolean;
1434
+ selectionMode?: boolean;
1435
+ selectedKeys?: Set<string>;
1436
+ onToggleSelect?: () => void;
1437
+ onToggleAttachmentSelect?: (attachmentId: string) => void;
1438
+ onEnterSelectionMode?: (attachmentId?: string) => void;
1439
+ }
1440
+
1441
+ declare function MessageItemView(props: MessageItemProps): React.JSX.Element;
1442
+
1443
+ interface ChatDateTimePreferencesChange {
1444
+ locale?: string;
1445
+ timeZone?: string;
1446
+ hour12?: boolean;
1447
+ }
1448
+ interface ChatLocaleContextValue extends ChatDateTimeFormatters {
1449
+ locale?: string;
1450
+ timeZone?: string;
1451
+ hour12: boolean;
1452
+ setLocale: (locale?: string) => void;
1453
+ setTimeZone: (timeZone?: string) => void;
1454
+ setHour12: (hour12: boolean) => void;
1455
+ showDateTimeSettings: boolean;
1456
+ }
1457
+ interface ChatLocaleProviderProps {
1458
+ children: React__default.ReactNode;
1459
+ locale?: string;
1460
+ timeZone?: string;
1461
+ hour12?: boolean;
1462
+ defaultLocale?: string;
1463
+ defaultTimeZone?: string;
1464
+ defaultHour12?: boolean;
1465
+ onDateTimePreferencesChange?: (prefs: ChatDateTimePreferencesChange) => void;
1466
+ showDateTimeSettings?: boolean;
1467
+ }
1468
+ declare const ChatLocaleProvider: ({ children, locale: controlledLocale, timeZone: controlledTimeZone, hour12: controlledHour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, }: ChatLocaleProviderProps) => React__default.JSX.Element;
1469
+ declare const useChatLocale: () => ChatLocaleContextValue;
1470
+
1471
+ interface ChatAlertsContextValue {
1472
+ error?: string | null;
1473
+ info?: string | null;
1474
+ onDismissError?: () => void;
1475
+ onDismissInfo?: () => void;
1476
+ }
1477
+ declare function ChatAlertsProvider({ children, value, }: {
1478
+ children: ReactNode;
1479
+ value: ChatAlertsContextValue;
1480
+ }): React.JSX.Element;
1481
+ declare function useChatAlerts(): ChatAlertsContextValue;
1482
+
1483
+ export { type ActiveChannelMessagesSlotProps, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CHAT_API_KEYS, CHAT_GET_API_KEYS, Channel, type ChannelDetailsDrawerSlotProps, ChannelHeaderView as ChannelHeader, type ChannelHeaderSlotProps, ChannelListView as ChannelList, ChannelListItem, type ChannelListItemSlotProps, type ChannelListSlotProps, type ChannelMessageBoxSlotProps, Chat, type ChatActionModalSlotProps, ChatAlertsProvider, type ChatApiKey, ChatAvatar, type ChatCallContext, type ChatClassNames, type ChatColorMode, type ChatComponents, type ChatCustomizationConfig, ChatCustomizationProvider, type ChatDateTimePreferences, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, ForwardModalView as ForwardModal, type ForwardModalSlotProps, HeaderCallActions, type HeaderCallActionsSlotProps, type HeaderLeftSideSlotProps, type HeaderRightSideSlotProps, type HeaderSearchOverlaySlotProps, type IAttachment, type IChannel, type IDMDelete, type IDMEditMessage, type IDMForward, type IDMMessage, type IDMPin, type IDMReaction, type IDMRead, type IDMStar, type IDMTyping, type IDMUnstar, type IMessage, type ISocketConfig, LoggedUserDetails, type LoggedUserDetailsSlotProps, type MembersDrawerSlotProps, type MessageAttachmentsSlotProps, ChannelMessageBoxView as MessageInput, MessageItemView as MessageItem, type MessageItemSlotProps, ActiveChannelMessagesView as MessageList, type MessageReactionsSlotProps, type MessageReplySnippetSlotProps, type MessageStatusSlotProps, type MessageToolbarSlotProps, type PermissionDrawerSlotProps, type PhoneCallButtonSlotProps, type PinnedMessagesDrawerSlotProps, type StarredMessagesDrawerSlotProps, type UIConfig, type VideoCallButtonSlotProps, capitalizeFirst, ChatMain as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, downloadFile, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatCustomization, mergeChatLayoutConfig, packageDefaultComponents, resolveApiUrl, resolveChatApiKey, resolveSocketUrl, setChatAccessToken, setChatBaseURL, setChatClientId, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, socketService, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme };