@realtimexsco/live-chat 1.0.0

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.
@@ -0,0 +1,701 @@
1
+ import React from 'react';
2
+ import * as zustand_middleware from 'zustand/middleware';
3
+ import * as zustand from 'zustand';
4
+ import { Socket } from 'socket.io-client';
5
+
6
+ interface IChannel {
7
+ id: string;
8
+ name: string;
9
+ avatar?: string;
10
+ lastMessage?: {
11
+ content: string;
12
+ timestamp: string;
13
+ sender: string;
14
+ };
15
+ unreadCount?: number;
16
+ isOnline?: boolean;
17
+ image?: string;
18
+ isGroup?: boolean;
19
+ conversationId?: string;
20
+ pinnedCount?: number;
21
+ starredCount?: number;
22
+ isLeft?: boolean;
23
+ isBlocked?: boolean;
24
+ }
25
+ interface IMessage {
26
+ id: string;
27
+ _id?: string;
28
+ content: string;
29
+ sender: string;
30
+ receiver?: string;
31
+ timestamp: string;
32
+ isOwnMessage: boolean;
33
+ channelId: string;
34
+ conversationId?: string;
35
+ attachments?: IMessageAttachment[];
36
+ isEdited?: boolean;
37
+ isDeletedForEveryone?: boolean;
38
+ reactions?: any[];
39
+ replyTo?: IMessage;
40
+ isPinned?: boolean;
41
+ isStarred?: boolean;
42
+ isForwarded?: boolean;
43
+ status?: 'sent' | 'delivered' | 'read';
44
+ isSystemMessage?: boolean;
45
+ }
46
+ interface IMessageAttachment {
47
+ id: string;
48
+ url: string;
49
+ type: "image" | "video" | "audio" | "file";
50
+ name: string;
51
+ }
52
+ interface IAttachment {
53
+ id: string;
54
+ file: File;
55
+ previewUrl: string;
56
+ type: "image" | "video" | "audio" | "file";
57
+ }
58
+
59
+ interface UIConfig {
60
+ showSidebarAvatar?: boolean;
61
+ sidebarAvatarColor?: string;
62
+ showChannelDetails?: boolean;
63
+ messageDateFormat?: (date: string) => string;
64
+ }
65
+ interface ChatContextValue {
66
+ activeChannel: IChannel | null;
67
+ setActiveChannel: (channel: IChannel | null) => void;
68
+ onSendMessage?: (content: string, attachments: any[]) => void;
69
+ client?: any;
70
+ theme?: string;
71
+ uiConfig: UIConfig;
72
+ themeColor: string;
73
+ channelsData?: IChannel[];
74
+ messagesData?: Record<string, IMessage[]>;
75
+ }
76
+ declare const useChatContext: () => ChatContextValue;
77
+ interface ChatProps {
78
+ children: React.ReactNode;
79
+ onSendMessage?: (content: string, attachments: any[]) => void;
80
+ client?: {
81
+ id: string;
82
+ };
83
+ theme?: string;
84
+ uiConfig?: UIConfig;
85
+ themeColor?: string;
86
+ accessToken?: string;
87
+ loggedUserDetails?: any;
88
+ apiUrl?: string;
89
+ socketUrl?: string;
90
+ channelsData?: IChannel[];
91
+ messagesData?: Record<string, IMessage[]>;
92
+ onMessageReceived?: (message: any) => void;
93
+ onSocketConnected?: (socketId: string) => void;
94
+ onSocketError?: (error: string) => void;
95
+ }
96
+ declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React.JSX.Element;
97
+
98
+ interface ChatLayoutConfig {
99
+ /** Sidebar with profile + conversation list */
100
+ sidebar?: boolean;
101
+ /** Logged-in user profile block at top of sidebar */
102
+ loggedUserDetails?: boolean;
103
+ /** Conversation list in sidebar */
104
+ channelList?: boolean;
105
+ /** Active channel header (name, actions, search) */
106
+ header?: boolean;
107
+ /** Scrollable message area */
108
+ messageList?: boolean;
109
+ /** Message composer / input box */
110
+ input?: boolean;
111
+ /** Forward message modal */
112
+ forwardModal?: boolean;
113
+ }
114
+ declare const defaultChatLayoutConfig: Required<ChatLayoutConfig>;
115
+ declare const mergeChatLayoutConfig: (config?: ChatLayoutConfig) => Required<ChatLayoutConfig>;
116
+
117
+ interface ChatMainProps {
118
+ clientId: string;
119
+ loggedUserDetails: any;
120
+ accessToken: string;
121
+ apiUrl?: string;
122
+ socketUrl?: string;
123
+ themeColor?: string;
124
+ theme?: string;
125
+ uiConfig?: UIConfig;
126
+ /** Control which sections render. Omit for full UI. */
127
+ layout?: ChatLayoutConfig;
128
+ }
129
+ declare const ChatMain: (props: ChatMainProps) => React.JSX.Element;
130
+
131
+ interface IUser {
132
+ _id: string;
133
+ name: string;
134
+ email: string;
135
+ role: string;
136
+ isActive: boolean;
137
+ createdAt: string | Date;
138
+ updatedAt: string | Date;
139
+ image?: string;
140
+ refreshToken?: string;
141
+ isOnline?: boolean;
142
+ }
143
+
144
+ type SocketStatus = "idle" | "connecting" | "connected" | "disconnected" | "error";
145
+ interface AuthState {
146
+ loggedUserDetails: IUser | null;
147
+ isAuthenticate: boolean;
148
+ accessToken: string | null;
149
+ tenantId: string | null;
150
+ isTenant: boolean;
151
+ /** True only after client-user login + session setup completes */
152
+ isSessionReady: boolean;
153
+ setSession: (payload: {
154
+ accessToken: string;
155
+ user?: any;
156
+ tenantId?: string;
157
+ isTenant?: boolean;
158
+ }) => void;
159
+ setSessionReady: (ready: boolean) => void;
160
+ clearSession: () => void;
161
+ }
162
+ interface GroupPermissions {
163
+ onlyAdminCanSendMessage: boolean;
164
+ onlyAdminCanEditInfo: boolean;
165
+ senderCanEditMessage: boolean;
166
+ allowMemberAdd: boolean;
167
+ allowMemberRemove: boolean;
168
+ moderationEnabled: boolean;
169
+ }
170
+ interface IConversationInfo {
171
+ _id: string;
172
+ conversationType: string;
173
+ participants: any[];
174
+ owner: any;
175
+ groupName?: string;
176
+ groupDescription?: string;
177
+ image?: string;
178
+ groupAdmins: any[];
179
+ createdAt: string;
180
+ updatedAt: string;
181
+ groupPermissions: GroupPermissions;
182
+ }
183
+ interface MessagesMetadata {
184
+ nextCursor: string | null;
185
+ hasMore: boolean;
186
+ isFirstPage: boolean;
187
+ }
188
+ interface AppErrorState {
189
+ message: string;
190
+ type: "participant" | "permission" | "edit" | "rate_limit" | "generic";
191
+ }
192
+ interface SocketState {
193
+ status: SocketStatus;
194
+ socketId: string | null;
195
+ error: string | null;
196
+ onlineUsers: any[];
197
+ allUsers: any[];
198
+ conversations: any[];
199
+ messagesByConversation: Record<string, any[]>;
200
+ isFetchingAllUsers: boolean;
201
+ isFetchingConversations: boolean;
202
+ isFetchingMessages: boolean;
203
+ isFetchingMessagesByConv: Record<string, number>;
204
+ isFetchingInfo: Record<string, boolean>;
205
+ conversationsPage: number;
206
+ conversationsHasMore: boolean;
207
+ lastConversationsFetchKey: string | null;
208
+ sidebarConversationsSearchKey: string | null;
209
+ lastDM: any | null;
210
+ lastEditDM: any | null;
211
+ lastDeleteDM: any | null;
212
+ lastPinUpdate: any | null;
213
+ lastStarUpdate: any | null;
214
+ lastReactionUpdate: any | null;
215
+ lastStatusUpdate: any | null;
216
+ lastDMMarkRead: any | null;
217
+ deletedForMeIds: string[];
218
+ typingUsers: Record<string, any[]>;
219
+ pinnedMessagesByConversation: Record<string, any[]>;
220
+ starredMessagesByConversation: Record<string, any[]>;
221
+ messagePendingActions: Record<string, string[]>;
222
+ messagesMetadata: Record<string, MessagesMetadata>;
223
+ liveConversationCounts: Record<string, {
224
+ pinnedCount: number;
225
+ starredCount: number;
226
+ }>;
227
+ isClearingChat: Record<string, boolean>;
228
+ isDeletingConversation: Record<string, boolean>;
229
+ conversationInfos: Record<string, IConversationInfo>;
230
+ isSearchActive: boolean;
231
+ searchedMessageId: string | null;
232
+ activeConversationId: string | null;
233
+ appError: AppErrorState | null;
234
+ composerDisabledReason: string | null;
235
+ rateLimitResetAt: number;
236
+ activeChannel: IChannel | null;
237
+ connectRequested: (config?: any) => void;
238
+ disconnectRequested: () => void;
239
+ setConnecting: () => void;
240
+ setConnected: (payload: {
241
+ socketId: string;
242
+ }) => void;
243
+ setDisconnected: () => void;
244
+ setError: (error: string) => void;
245
+ setOnlineUsers: (onlineUsers: any[]) => void;
246
+ fetchAllUsers: (force?: boolean) => Promise<void>;
247
+ emitGetOnlineUsers: () => void;
248
+ fetchConversations: (limit?: number, page?: number, search?: string, force?: boolean) => Promise<void>;
249
+ resetConversations: () => void;
250
+ updateConversation: (conversation: any) => void;
251
+ receivedCountUpdate: (payload: any) => void;
252
+ fetchConversationInfo: (conversationId: string) => Promise<void>;
253
+ updateGroupPermissions: (conversationId: string, permissions: Partial<GroupPermissions>) => Promise<void>;
254
+ updateGroupDetails: (conversationId: string, details: {
255
+ groupName?: string;
256
+ groupDescription?: string;
257
+ groupImage?: string;
258
+ }) => Promise<void>;
259
+ manageGroupMembers: (payload: {
260
+ conversationId: string;
261
+ participants: string[];
262
+ type: 'add' | 'remove';
263
+ }) => Promise<void>;
264
+ manageGroupAdmins: (payload: {
265
+ conversationId: string;
266
+ groupAdmins: string[];
267
+ type: 'add' | 'remove';
268
+ }) => Promise<void>;
269
+ receivedGroupMessage: (payload: any) => void;
270
+ fetchMessages: (conversationId: string, limit?: number, cursor?: string | null) => Promise<void>;
271
+ setActiveConversationId: (conversationId: string | null) => void;
272
+ setActiveChannel: (channel: IChannel | null) => void;
273
+ handleAppError: (message: string) => void;
274
+ clearAppError: () => void;
275
+ setRateLimitResetAt: (resetAt: number) => void;
276
+ receivedDM: (dm: any) => void;
277
+ emitDmSend: (payload: any) => void;
278
+ emitDmEdit: (payload: any) => void;
279
+ receivedEditDM: (payload: any) => void;
280
+ emitDmDelete: (payload: any) => void;
281
+ receivedDeleteForMe: (payload: any) => void;
282
+ receivedDeleteForEveryone: (payload: any) => void;
283
+ markDeletedForMe: (messageId: string) => void;
284
+ emitDmClearChat: (payload: {
285
+ conversationId: string;
286
+ sender: string;
287
+ }) => void;
288
+ receivedDmClearChat: (payload: {
289
+ conversationId: string;
290
+ }) => void;
291
+ emitGroupClearChat: (payload: {
292
+ conversationId: string;
293
+ sender: string;
294
+ }) => void;
295
+ receivedGroupClearChat: (payload: {
296
+ conversationId: string;
297
+ }) => void;
298
+ emitDmDeleteConversation: (payload: {
299
+ conversationId: string;
300
+ sender: string;
301
+ receiver: string;
302
+ }) => void;
303
+ receivedDmDeleteConversation: (payload: {
304
+ conversationId: string;
305
+ }) => void;
306
+ emitGroupDeleteConversation: (payload: {
307
+ conversationId: string;
308
+ sender: string;
309
+ }) => void;
310
+ receivedGroupDeleteConversation: (payload: {
311
+ conversationId: string;
312
+ }) => void;
313
+ emitDmReactionAdd: (payload: any) => void;
314
+ receivedReactionAdd: (payload: any) => void;
315
+ emitDmReactionRemove: (payload: any) => void;
316
+ receivedReactionRemove: (payload: any) => void;
317
+ receivedGroupReactionAdd: (payload: any) => void;
318
+ receivedGroupReactionRemove: (payload: any) => void;
319
+ emitDmPin: (payload: any) => void;
320
+ emitDmUnpin: (payload: any) => void;
321
+ receivedPinUpdate: (payload: any) => void;
322
+ fetchPinnedMessages: (conversationId: string) => Promise<void>;
323
+ emitDmStar: (payload: any) => void;
324
+ emitDmUnstar: (payload: any) => void;
325
+ receivedStarUpdate: (payload: any) => void;
326
+ fetchStarredMessages: (conversationId: string) => Promise<void>;
327
+ emitTypingStart: (payload: any) => void;
328
+ emitTypingStop: (payload: any) => void;
329
+ setTypingStart: (payload: any) => void;
330
+ setTypingStop: (payload: any) => void;
331
+ emitMarkAsRead: (payload: any) => void;
332
+ receivedMarkRead: (payload: any) => void;
333
+ receivedDMMarkRead: (payload: any) => void;
334
+ receivedGroupMarkRead: (payload: any) => void;
335
+ receivedStatusUpdate: (payload: any) => void;
336
+ receivedGroupStatusUpdate: (payload: any) => void;
337
+ emitDmForward: (payload: any) => void;
338
+ receivedForward: (payload: any) => void;
339
+ emitGroupJoin: (payload: {
340
+ conversationId: string;
341
+ userId: string;
342
+ }) => void;
343
+ emitGroupMessageSend: (payload: any) => void;
344
+ emitGroupTypingStart: (payload: {
345
+ conversationId: string;
346
+ userId: string;
347
+ }) => void;
348
+ emitGroupTypingStop: (payload: {
349
+ conversationId: string;
350
+ userId: string;
351
+ }) => void;
352
+ emitGroupEdit: (payload: any) => void;
353
+ emitGroupReactionAdd: (payload: any) => void;
354
+ emitGroupReactionRemove: (payload: any) => void;
355
+ emitGroupMarkRead: (payload: {
356
+ conversationId: string;
357
+ userId: string;
358
+ }) => void;
359
+ emitGroupMessageDelivered: (payload: {
360
+ conversationId: string;
361
+ messageId: string;
362
+ userId: string;
363
+ }) => void;
364
+ emitGroupDelete: (payload: {
365
+ messageId: string;
366
+ sender: string;
367
+ deleteType: 'me' | 'everyone';
368
+ conversationId: string;
369
+ }) => void;
370
+ emitGroupPin: (payload: {
371
+ conversationId: string;
372
+ sender: string;
373
+ messageId: string;
374
+ receiver: string;
375
+ }) => void;
376
+ emitGroupUnpin: (payload: {
377
+ conversationId: string;
378
+ sender: string;
379
+ messageId: string;
380
+ receiver: string;
381
+ }) => void;
382
+ emitGroupStar: (payload: {
383
+ messageId: string;
384
+ sender: string;
385
+ conversationId: string;
386
+ }) => void;
387
+ emitGroupUnstar: (payload: {
388
+ messageId: string;
389
+ sender: string;
390
+ conversationId: string;
391
+ }) => void;
392
+ emitGroupForward: (payload: {
393
+ messageId: string;
394
+ sender: string;
395
+ targetConversationIds: string[];
396
+ sourceConversationId?: string;
397
+ }) => void;
398
+ clearForwardPending: (messageId?: string) => void;
399
+ emitConversationUpdate: (payload: {
400
+ conversationId: string;
401
+ }) => void;
402
+ emitGroupLeave: (payload: {
403
+ conversationId: string;
404
+ sender: string;
405
+ }) => void;
406
+ receivedGroupLeave: (payload: any) => void;
407
+ fetchSearchMessageContext: (messageId: string) => Promise<void>;
408
+ setSearchActive: (active: boolean) => void;
409
+ setSearchedMessageId: (messageId: string | null) => void;
410
+ toggleBlock: (userId: string, isBlocked: boolean) => void;
411
+ }
412
+ interface AppStoreState extends SocketState, AuthState {
413
+ }
414
+
415
+ declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreState>, "setState" | "persist"> & {
416
+ setState(partial: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState | Partial<AppStoreState>), replace?: false | undefined): unknown;
417
+ setState(state: AppStoreState | ((state: AppStoreState) => AppStoreState), replace: true): unknown;
418
+ persist: {
419
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<AppStoreState, {
420
+ loggedUserDetails: IUser | null;
421
+ isAuthenticate: boolean;
422
+ accessToken: string | null;
423
+ tenantId: string | null;
424
+ isTenant: boolean;
425
+ }, unknown>>) => void;
426
+ clearStorage: () => void;
427
+ rehydrate: () => Promise<void> | void;
428
+ hasHydrated: () => boolean;
429
+ onHydrate: (fn: (state: AppStoreState) => void) => () => void;
430
+ onFinishHydration: (fn: (state: AppStoreState) => void) => () => void;
431
+ getOptions: () => Partial<zustand_middleware.PersistOptions<AppStoreState, {
432
+ loggedUserDetails: IUser | null;
433
+ isAuthenticate: boolean;
434
+ accessToken: string | null;
435
+ tenantId: string | null;
436
+ isTenant: boolean;
437
+ }, unknown>>;
438
+ };
439
+ }>;
440
+
441
+ interface ISocketConfig {
442
+ url: string;
443
+ options: any;
444
+ }
445
+ declare class SocketService {
446
+ private socket;
447
+ private currentConfig;
448
+ private isConnecting;
449
+ connect(config: ISocketConfig): void;
450
+ disconnect(): void;
451
+ emit(event: string, payload?: any): void;
452
+ getSocket(): Socket | null;
453
+ emitDmSend(payload: any): void;
454
+ emitDmEdit(payload: {
455
+ content: string;
456
+ messageId: string;
457
+ sender: string;
458
+ receiver: string;
459
+ }): void;
460
+ emitDmDelete(payload: {
461
+ messageId: string;
462
+ sender: string;
463
+ receiver: string;
464
+ deleteType: "me" | "everyone";
465
+ }): void;
466
+ emitDmClearChat(payload: {
467
+ conversationId: string;
468
+ sender: string;
469
+ }): void;
470
+ emitGroupClearChat(payload: {
471
+ conversationId: string;
472
+ sender: string;
473
+ }): void;
474
+ emitDmDeleteConversation(payload: {
475
+ conversationId: string;
476
+ sender: string;
477
+ receiver: string;
478
+ }): void;
479
+ emitGroupDeleteConversation(payload: {
480
+ conversationId: string;
481
+ sender: string;
482
+ }): void;
483
+ emitDmReactionAdd(payload: {
484
+ messageId: string;
485
+ sender: string;
486
+ receiver: string;
487
+ reaction: string;
488
+ }): void;
489
+ emitDmReactionRemove(payload: {
490
+ messageId: string;
491
+ sender: string;
492
+ receiver: string;
493
+ reaction: string;
494
+ }): void;
495
+ emitTypingStart(payload: any): void;
496
+ emitTypingStop(payload: any): void;
497
+ emitMarkAsRead(payload: {
498
+ conversationId: string;
499
+ sender: string;
500
+ receiver: string;
501
+ }): void;
502
+ emitDmPin(payload: {
503
+ conversationId: string;
504
+ sender: string;
505
+ messageId: string;
506
+ receiver: string;
507
+ }): void;
508
+ emitDmUnpin(payload: {
509
+ conversationId: string;
510
+ sender: string;
511
+ messageId: string;
512
+ receiver: string;
513
+ }): void;
514
+ emitDmStar(payload: {
515
+ messageId: string;
516
+ sender: string;
517
+ }): void;
518
+ emitDmUnstar(payload: {
519
+ messageId: string;
520
+ sender: string;
521
+ }): void;
522
+ emitDmForward(payload: {
523
+ messageId: string;
524
+ sender: string;
525
+ targetConversationIds: string[];
526
+ }): void;
527
+ emitGroupJoin(payload: {
528
+ conversationId: string;
529
+ userId: string;
530
+ }): void;
531
+ emitGroupMessageSend(payload: any): void;
532
+ emitGroupTypingStart(payload: {
533
+ conversationId: string;
534
+ userId: string;
535
+ }): void;
536
+ emitGroupTypingStop(payload: {
537
+ conversationId: string;
538
+ userId: string;
539
+ }): void;
540
+ emitGroupEdit(payload: any): void;
541
+ emitGroupReactionAdd(payload: any): void;
542
+ emitGroupMarkRead(payload: {
543
+ conversationId: string;
544
+ userId: string;
545
+ }): void;
546
+ emitGroupReactionRemove(payload: any): void;
547
+ emitGroupDelete(payload: {
548
+ messageId: string;
549
+ sender: string;
550
+ deleteType: "me" | "everyone";
551
+ }): void;
552
+ emitGroupPin(payload: {
553
+ conversationId: string;
554
+ sender: string;
555
+ messageId: string;
556
+ receiver: string;
557
+ }): void;
558
+ emitGroupUnpin(payload: {
559
+ conversationId: string;
560
+ sender: string;
561
+ messageId: string;
562
+ receiver: string;
563
+ }): void;
564
+ emitGroupStar(payload: {
565
+ messageId: string;
566
+ sender: string;
567
+ conversationId: string;
568
+ }): void;
569
+ emitGroupUnstar(payload: {
570
+ messageId: string;
571
+ sender: string;
572
+ conversationId: string;
573
+ }): void;
574
+ emitGroupForward(payload: {
575
+ messageId: string;
576
+ sender: string;
577
+ targetConversationIds: string[];
578
+ }): void;
579
+ emitConversationUpdate(payload: {
580
+ conversationId: string;
581
+ }): void;
582
+ emitGroupLeave(payload: {
583
+ conversationId: string;
584
+ sender: string;
585
+ }): void;
586
+ emitGetOnlineUsers(): void;
587
+ }
588
+ declare const socketService: SocketService;
589
+
590
+ declare const Channel: ({ children }: {
591
+ children: React.ReactNode;
592
+ }) => React.JSX.Element;
593
+
594
+ interface ChannelListProps {
595
+ activeChannel: IChannel | null;
596
+ onChannelSelect: (channel: IChannel) => void;
597
+ onNewChatClick?: () => void;
598
+ debouncedSearch?: string;
599
+ }
600
+ declare const ChannelList: ({ activeChannel, onChannelSelect, onNewChatClick, debouncedSearch }: ChannelListProps) => React.JSX.Element;
601
+
602
+ interface ChannelHeaderProps {
603
+ activeChannel: IChannel | null;
604
+ conversationId: string | null;
605
+ onBack?: () => void;
606
+ }
607
+ declare const ChannelHeader: ({ activeChannel, conversationId, onBack, }: ChannelHeaderProps) => React.JSX.Element | null;
608
+
609
+ interface ActiveChannelMessagesProps {
610
+ activeChannel: IChannel | null;
611
+ loggedUserId?: string;
612
+ conversationMessages?: any[];
613
+ localMessages?: IMessage[];
614
+ isLoading?: boolean;
615
+ conversationId?: string | null;
616
+ onReply?: (message: IMessage) => void;
617
+ onForward?: (message: IMessage) => void;
618
+ conversationInfo: IConversationInfo | null;
619
+ }
620
+ declare const ActiveChannelMessages: ({ activeChannel, loggedUserId, conversationMessages, localMessages, isLoading, conversationId, onReply, onForward, conversationInfo }: ActiveChannelMessagesProps) => React.JSX.Element;
621
+
622
+ interface ChannelMessageBoxProps {
623
+ activeChannel: IChannel | null;
624
+ conversationId: string | null;
625
+ onSendMessage?: (content: string, attachments: IAttachment[], replyTo?: IMessage | null) => void;
626
+ replyTo?: IMessage | null;
627
+ onCancelReply?: () => void;
628
+ }
629
+ declare const ChannelMessageBox: ({ activeChannel, conversationId, onSendMessage, replyTo, onCancelReply }: ChannelMessageBoxProps) => React.JSX.Element | null;
630
+
631
+ interface LoggedUserDetailsProps {
632
+ loggedUserDetails?: any;
633
+ onUserSelect?: (channel: IChannel) => void;
634
+ isCreateModalOpen?: boolean;
635
+ setIsCreateModalOpen?: (open: boolean) => void;
636
+ searchQuery?: string;
637
+ setSearchQuery?: (val: string) => void;
638
+ themeColor?: string;
639
+ }
640
+ declare const LoggedUserDetails: ({ loggedUserDetails: propsLoggedUserDetails, onUserSelect, isCreateModalOpen: propsIsCreateModalOpen, setIsCreateModalOpen: propsSetIsCreateModalOpen, searchQuery: propsSearchQuery, setSearchQuery: propsSetSearchQuery, themeColor: propsThemeColor, }: LoggedUserDetailsProps) => React.JSX.Element;
641
+
642
+ interface ForwardModalProps {
643
+ isOpen: boolean;
644
+ onClose: () => void;
645
+ message: IMessage | null;
646
+ onForwardComplete: (channel: IChannel) => void;
647
+ }
648
+ declare const ForwardModal: ({ isOpen, onClose, message, onForwardComplete }: ForwardModalProps) => React.JSX.Element | null;
649
+
650
+ interface ChatLayoutProps {
651
+ /** Toggle which UI blocks are rendered */
652
+ layout?: ChatLayoutConfig;
653
+ /** Passed to LoggedUserDetails */
654
+ loggedUserDetails?: any;
655
+ themeColor?: string;
656
+ className?: string;
657
+ shellClassName?: string;
658
+ }
659
+ /**
660
+ * Composable chat shell — turn sections on/off via `layout`.
661
+ *
662
+ * @example Full UI (default)
663
+ * `<ChatLayout />`
664
+ *
665
+ * @example Messages only (no sidebar, header, or input)
666
+ * `<ChatLayout layout={{ sidebar: false, header: false, input: false }} />`
667
+ *
668
+ * @example Custom — import pieces individually instead:
669
+ * `import { Channel, MessageList } from '@realtimexsco/live-chat'`
670
+ */
671
+ declare const ChatLayout: ({ layout, loggedUserDetails: loggedUserDetailsProp, themeColor, className, shellClassName, }: ChatLayoutProps) => React.JSX.Element;
672
+
673
+ interface ChatControllerState {
674
+ replyTo: IMessage | null;
675
+ forwardMessage: IMessage | null;
676
+ isForwardModalOpen: boolean;
677
+ searchQuery: string;
678
+ debouncedSearch: string;
679
+ isCreateModalOpen: boolean;
680
+ }
681
+ declare const useChatController: () => {
682
+ activeChannel: IChannel | null;
683
+ setActiveChannel: (channel: IChannel | null) => void;
684
+ conversationId: string | null;
685
+ rateLimitResetAt: number;
686
+ isFetchingMessages: boolean;
687
+ loggedUserDetails: IUser | null;
688
+ conversationInfos: Record<string, IConversationInfo>;
689
+ conversationMessages: any[];
690
+ currentLocalMessages: IMessage[];
691
+ state: ChatControllerState;
692
+ updateState: (updates: Partial<ChatControllerState>) => void;
693
+ handleChannelSelect: (channel: IChannel) => void;
694
+ handleSendMessage: (content: string, attachments: IAttachment[], replyTo?: IMessage | null) => void;
695
+ };
696
+
697
+ declare const setChatClientId: (id: string) => void;
698
+ declare const setChatAccessToken: (token: string) => void;
699
+ declare const setChatBaseURL: (url: string) => void;
700
+
701
+ export { Channel, ChannelHeader, ChannelList, Chat, ChatLayout, type ChatLayoutConfig, ChatMain, ForwardModal, type IAttachment, type IChannel, type IMessage, type ISocketConfig, LoggedUserDetails, ChannelMessageBox as MessageInput, ActiveChannelMessages as MessageList, type UIConfig, ChatMain as default, defaultChatLayoutConfig, mergeChatLayoutConfig, setChatAccessToken, setChatBaseURL, setChatClientId, socketService, useChatContext, useChatController, useStore as useChatStore };