@usechat/react-native 1.0.1 → 1.0.3
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 +303 -608
- package/dist/index.d.ts +303 -608
- package/dist/index.js +282 -300
- package/dist/index.mjs +302 -320
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { NativeSyntheticEvent, TextInputContentSizeChangeEventData, TextInput
|
|
3
|
+
import { NativeSyntheticEvent, TextInputContentSizeChangeEventData, TextInput } from 'react-native';
|
|
4
4
|
|
|
5
|
-
interface ChatData {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
message: string;
|
|
9
|
-
time: string;
|
|
10
|
-
avatar: string;
|
|
11
|
-
unreadCount?: number;
|
|
12
|
-
isOnline?: boolean;
|
|
13
|
-
hasAttachment?: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface ChatItemProps {
|
|
16
|
-
item: ChatData;
|
|
17
|
-
onPress: (chat: ChatData) => void;
|
|
18
|
-
}
|
|
19
|
-
interface ChatListProps {
|
|
20
|
-
chats: ChatData[];
|
|
21
|
-
onChatPress: (chat: ChatData) => void;
|
|
22
|
-
}
|
|
23
|
-
interface ChatAvatarProps {
|
|
24
|
-
avatar: string;
|
|
25
|
-
isOnline?: boolean;
|
|
26
|
-
size?: 'small' | 'medium' | 'large';
|
|
27
|
-
}
|
|
28
|
-
interface ReplyToMessage$1 {
|
|
29
|
-
id: number;
|
|
30
|
-
text: string;
|
|
31
|
-
senderName?: string;
|
|
32
|
-
isMe: boolean;
|
|
33
|
-
type?: 'text' | 'image';
|
|
34
|
-
imageData?: ImageAttachmentData$1;
|
|
35
|
-
}
|
|
36
|
-
interface MessageReaction$1 {
|
|
37
|
-
emoji: string;
|
|
38
|
-
count: number;
|
|
39
|
-
users: string[];
|
|
40
|
-
}
|
|
41
5
|
interface Message$1 {
|
|
42
6
|
id: number;
|
|
43
7
|
text: string;
|
|
@@ -45,119 +9,15 @@ interface Message$1 {
|
|
|
45
9
|
timestamp: string;
|
|
46
10
|
status?: 'sent' | 'delivered' | 'read';
|
|
47
11
|
senderName?: string;
|
|
12
|
+
senderId?: string;
|
|
48
13
|
replyTo?: ReplyToMessage$1;
|
|
49
14
|
reactions?: MessageReaction$1[];
|
|
50
15
|
type?: 'text' | 'image';
|
|
51
|
-
imageData?: ImageAttachmentData$1;
|
|
52
|
-
deleted?: boolean;
|
|
53
|
-
}
|
|
54
|
-
interface MessageItemProps {
|
|
55
|
-
message: Message$1;
|
|
56
|
-
onLongPress?: (message: Message$1, position?: {
|
|
57
|
-
x: number;
|
|
58
|
-
y: number;
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
}) => void;
|
|
62
|
-
onReactionPress?: (message: Message$1) => void;
|
|
63
|
-
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
64
|
-
}
|
|
65
|
-
interface DateSeparator$2 {
|
|
66
|
-
id: string;
|
|
67
|
-
listItemType: 'date-separator';
|
|
68
|
-
date: string;
|
|
69
|
-
displayDate: string;
|
|
70
|
-
}
|
|
71
|
-
interface MessageWithType$1 extends Message$1 {
|
|
72
|
-
listItemType: 'message';
|
|
73
|
-
}
|
|
74
|
-
type MessageListItem$1 = MessageWithType$1 | DateSeparator$2;
|
|
75
|
-
interface DateSeparatorProps {
|
|
76
|
-
date: string;
|
|
77
|
-
displayDate: string;
|
|
78
|
-
}
|
|
79
|
-
interface AttachmentOption {
|
|
80
|
-
id: string;
|
|
81
|
-
label: string;
|
|
82
|
-
icon: any;
|
|
83
|
-
color: string;
|
|
84
|
-
}
|
|
85
|
-
interface AttachmentMenuProps {
|
|
86
|
-
onOptionSelect: (optionId: string) => void;
|
|
87
|
-
options: AttachmentOption[];
|
|
88
|
-
}
|
|
89
|
-
interface AttachmentMenuRef {
|
|
90
|
-
show: () => void;
|
|
91
|
-
hide: () => void;
|
|
92
|
-
}
|
|
93
|
-
interface UseAttachmentMenuReturn {
|
|
94
|
-
menuRef: React.RefObject<AttachmentMenuRef | null>;
|
|
95
|
-
handleOptionSelect: (optionId: string) => void;
|
|
96
|
-
}
|
|
97
|
-
interface AttachmentResult$1 {
|
|
98
|
-
type: 'image' | 'document' | 'location' | 'contact' | 'poll' | 'event';
|
|
99
|
-
data: any;
|
|
100
|
-
}
|
|
101
|
-
interface ImageAttachmentData$1 {
|
|
102
|
-
uri: string;
|
|
103
|
-
width: number;
|
|
104
|
-
height: number;
|
|
105
|
-
fileSize?: number;
|
|
106
|
-
fileName: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* UseChat SDK License Validation Utility
|
|
111
|
-
*
|
|
112
|
-
* Copyright (c) 2024 Lukasz Ko and UseChat Team
|
|
113
|
-
* Licensed under UseChat SDK License Agreement
|
|
114
|
-
*/
|
|
115
|
-
interface LicenseConfig {
|
|
116
|
-
licenseKey?: string;
|
|
117
|
-
attribution?: boolean;
|
|
118
|
-
environment?: 'development' | 'production';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
interface ChatConfig extends LicenseConfig {
|
|
122
|
-
keyboardBehavior?: 'padding' | 'height' | 'position';
|
|
123
|
-
keyboardVerticalOffset?: number;
|
|
124
|
-
enableReactionDetails?: boolean;
|
|
125
|
-
enableMessageActions?: boolean;
|
|
126
|
-
enableScrollToBottom?: boolean;
|
|
127
|
-
enableTypingIndicator?: boolean;
|
|
128
|
-
onMessageSend?: (text: string, replyTo?: Message$1) => void;
|
|
129
|
-
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
130
|
-
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
131
|
-
}
|
|
132
|
-
interface ChatProviderProps {
|
|
133
|
-
children: ReactNode;
|
|
134
|
-
config?: ChatConfig;
|
|
135
|
-
}
|
|
136
|
-
declare const ChatProvider: (props: ChatProviderProps) => React__default.JSX.Element;
|
|
137
|
-
declare const useChatConfig: () => ChatConfig;
|
|
138
|
-
|
|
139
|
-
interface User {
|
|
140
|
-
id: string;
|
|
141
|
-
name: string;
|
|
142
|
-
avatar?: string;
|
|
143
|
-
isOnline?: boolean;
|
|
144
|
-
}
|
|
145
|
-
interface Message {
|
|
146
|
-
id: number;
|
|
147
|
-
text: string;
|
|
148
|
-
isMe: boolean;
|
|
149
|
-
timestamp: string;
|
|
150
|
-
status?: 'sent' | 'delivered' | 'read';
|
|
151
|
-
senderName?: string;
|
|
152
|
-
senderId?: string;
|
|
153
|
-
replyTo?: ReplyToMessage;
|
|
154
|
-
reactions?: MessageReaction[];
|
|
155
|
-
type?: 'text' | 'image';
|
|
156
16
|
attachments?: Attachment[];
|
|
157
17
|
deleted?: boolean;
|
|
158
|
-
imageData?: ImageAttachmentData;
|
|
18
|
+
imageData?: ImageAttachmentData$1;
|
|
159
19
|
}
|
|
160
|
-
interface ReplyToMessage {
|
|
20
|
+
interface ReplyToMessage$1 {
|
|
161
21
|
id: number;
|
|
162
22
|
text: string;
|
|
163
23
|
senderName?: string;
|
|
@@ -165,9 +25,9 @@ interface ReplyToMessage {
|
|
|
165
25
|
isMe: boolean;
|
|
166
26
|
timestamp?: string;
|
|
167
27
|
type?: 'text' | 'image';
|
|
168
|
-
imageData?: ImageAttachmentData;
|
|
28
|
+
imageData?: ImageAttachmentData$1;
|
|
169
29
|
}
|
|
170
|
-
interface MessageReaction {
|
|
30
|
+
interface MessageReaction$1 {
|
|
171
31
|
emoji: string;
|
|
172
32
|
count: number;
|
|
173
33
|
users: string[];
|
|
@@ -182,33 +42,13 @@ interface Attachment {
|
|
|
182
42
|
uploadStatus?: 'pending' | 'uploading' | 'completed' | 'failed';
|
|
183
43
|
uploadProgress?: number;
|
|
184
44
|
}
|
|
185
|
-
interface ImageAttachmentData {
|
|
45
|
+
interface ImageAttachmentData$1 {
|
|
186
46
|
uri: string;
|
|
187
47
|
width: number;
|
|
188
48
|
height: number;
|
|
189
49
|
fileSize?: number;
|
|
190
50
|
fileName: string;
|
|
191
51
|
}
|
|
192
|
-
interface DocumentAttachmentData {
|
|
193
|
-
uri: string;
|
|
194
|
-
name: string;
|
|
195
|
-
size?: number;
|
|
196
|
-
mimeType?: string;
|
|
197
|
-
}
|
|
198
|
-
interface LocationAttachmentData {
|
|
199
|
-
coordinates: {
|
|
200
|
-
latitude: number;
|
|
201
|
-
longitude: number;
|
|
202
|
-
};
|
|
203
|
-
address?: any;
|
|
204
|
-
timestamp: number;
|
|
205
|
-
}
|
|
206
|
-
interface ContactAttachmentData {
|
|
207
|
-
id?: string;
|
|
208
|
-
name?: string;
|
|
209
|
-
phoneNumbers?: any[];
|
|
210
|
-
emails?: any[];
|
|
211
|
-
}
|
|
212
52
|
interface AttachmentResult {
|
|
213
53
|
id?: string;
|
|
214
54
|
type: 'image' | 'document' | 'location' | 'contact' | 'poll' | 'event';
|
|
@@ -224,15 +64,15 @@ interface ChatScreenHeaderProps {
|
|
|
224
64
|
onSimulateTyping?: () => void;
|
|
225
65
|
}
|
|
226
66
|
interface MessageListProps {
|
|
227
|
-
messages: Message[];
|
|
67
|
+
messages: Message$1[];
|
|
228
68
|
onContentSizeChange?: () => void;
|
|
229
|
-
onMessageLongPress?: (message: Message, position?: {
|
|
69
|
+
onMessageLongPress?: (message: Message$1, position?: {
|
|
230
70
|
x: number;
|
|
231
71
|
y: number;
|
|
232
72
|
width: number;
|
|
233
73
|
height: number;
|
|
234
74
|
}) => void;
|
|
235
|
-
onReactionPress?: (message: Message) => void;
|
|
75
|
+
onReactionPress?: (message: Message$1) => void;
|
|
236
76
|
isTyping?: boolean;
|
|
237
77
|
typingUserName?: string;
|
|
238
78
|
showScrollToBottom?: boolean;
|
|
@@ -245,11 +85,11 @@ interface MessageInputProps {
|
|
|
245
85
|
onFocus?: () => void;
|
|
246
86
|
height: number;
|
|
247
87
|
onContentSizeChange: (height: number) => void;
|
|
248
|
-
replyToMessage?: Message | null;
|
|
88
|
+
replyToMessage?: Message$1 | null;
|
|
249
89
|
onCancelReply?: () => void;
|
|
250
90
|
onAttachmentSend?: (attachmentResult: AttachmentResult, text?: string) => void;
|
|
251
91
|
}
|
|
252
|
-
interface MessageWithType extends Message {
|
|
92
|
+
interface MessageWithType$1 extends Message$1 {
|
|
253
93
|
listItemType: 'message';
|
|
254
94
|
}
|
|
255
95
|
interface DateSeparator$1 {
|
|
@@ -258,21 +98,7 @@ interface DateSeparator$1 {
|
|
|
258
98
|
date: string;
|
|
259
99
|
displayDate: string;
|
|
260
100
|
}
|
|
261
|
-
type MessageListItem = MessageWithType | DateSeparator$1;
|
|
262
|
-
interface UseChatReturn {
|
|
263
|
-
messages: Message[];
|
|
264
|
-
sendMessage: (text: string, replyTo?: ReplyToMessage) => void;
|
|
265
|
-
sendMessageWithAttachments: (text: string, attachments: Attachment[], replyTo?: ReplyToMessage) => void;
|
|
266
|
-
updateMessageStatus: (messageId: number, status: 'sent' | 'delivered' | 'read') => void;
|
|
267
|
-
addReaction: (messageId: number, emoji: string) => void;
|
|
268
|
-
deleteMessage: (messageId: number) => void;
|
|
269
|
-
removeReaction: (messageId: number, emoji: string) => void;
|
|
270
|
-
isLoading: boolean;
|
|
271
|
-
error: string | null;
|
|
272
|
-
addMessage: (message: Message) => void;
|
|
273
|
-
updateMessage: (messageId: number, updates: Partial<Message>) => void;
|
|
274
|
-
setMessages: (messages: Message[]) => void;
|
|
275
|
-
}
|
|
101
|
+
type MessageListItem$1 = MessageWithType$1 | DateSeparator$1;
|
|
276
102
|
interface UseAttachmentsReturn {
|
|
277
103
|
attachments: Attachment[];
|
|
278
104
|
openPicker: (type: 'image' | 'document' | 'location' | 'contact') => Promise<void>;
|
|
@@ -283,22 +109,15 @@ interface UseAttachmentsReturn {
|
|
|
283
109
|
isUploading: boolean;
|
|
284
110
|
uploadProgress: number;
|
|
285
111
|
}
|
|
286
|
-
interface UseTypingIndicatorReturn {
|
|
287
|
-
isTyping: boolean;
|
|
288
|
-
typingUsers: string[];
|
|
289
|
-
startTyping: () => void;
|
|
290
|
-
stopTyping: () => void;
|
|
291
|
-
setTypingUsers: (users: string[]) => void;
|
|
292
|
-
}
|
|
293
112
|
interface RenderMessageProps {
|
|
294
|
-
message: Message;
|
|
295
|
-
onLongPress?: (message: Message, position?: {
|
|
113
|
+
message: Message$1;
|
|
114
|
+
onLongPress?: (message: Message$1, position?: {
|
|
296
115
|
x: number;
|
|
297
116
|
y: number;
|
|
298
117
|
width: number;
|
|
299
118
|
height: number;
|
|
300
119
|
}) => void;
|
|
301
|
-
onReactionPress?: (message: Message) => void;
|
|
120
|
+
onReactionPress?: (message: Message$1) => void;
|
|
302
121
|
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
303
122
|
}
|
|
304
123
|
interface RenderInputProps {
|
|
@@ -308,26 +127,18 @@ interface RenderInputProps {
|
|
|
308
127
|
onFocus?: () => void;
|
|
309
128
|
height: number;
|
|
310
129
|
onContentSizeChange: (height: number) => void;
|
|
311
|
-
replyToMessage?: Message | null;
|
|
130
|
+
replyToMessage?: Message$1 | null;
|
|
312
131
|
onCancelReply?: () => void;
|
|
313
132
|
attachments: Attachment[];
|
|
314
133
|
onAttachmentAdd: (attachment: Attachment) => void;
|
|
315
134
|
onAttachmentRemove: (attachmentId: string) => void;
|
|
316
135
|
onAttachmentUpload: () => Promise<Attachment[]>;
|
|
317
136
|
}
|
|
318
|
-
interface RenderHeaderProps {
|
|
319
|
-
name?: string;
|
|
320
|
-
isOnline?: boolean;
|
|
321
|
-
onBack: () => void;
|
|
322
|
-
onVideoCall?: () => void;
|
|
323
|
-
onVoiceCall?: () => void;
|
|
324
|
-
onInfo?: () => void;
|
|
325
|
-
}
|
|
326
137
|
interface RenderActionSheetProps {
|
|
327
138
|
visible: boolean;
|
|
328
139
|
onClose: () => void;
|
|
329
140
|
isMyMessage: boolean;
|
|
330
|
-
selectedMessage?: Message;
|
|
141
|
+
selectedMessage?: Message$1;
|
|
331
142
|
messagePosition?: {
|
|
332
143
|
x: number;
|
|
333
144
|
y: number;
|
|
@@ -340,7 +151,7 @@ interface RenderActionSheetProps {
|
|
|
340
151
|
interface RenderReactionDetailsProps {
|
|
341
152
|
visible: boolean;
|
|
342
153
|
onClose: () => void;
|
|
343
|
-
reactions: MessageReaction[];
|
|
154
|
+
reactions: MessageReaction$1[];
|
|
344
155
|
messageText: string;
|
|
345
156
|
onAddReaction: (emoji: string) => void;
|
|
346
157
|
onRemoveReaction: (emoji: string) => void;
|
|
@@ -352,159 +163,104 @@ interface AttachmentUploader {
|
|
|
352
163
|
}>;
|
|
353
164
|
validate?: (file: File | any) => boolean | string;
|
|
354
165
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
validator?: (data: any) => boolean | string;
|
|
359
|
-
transformer?: (data: any) => Attachment;
|
|
166
|
+
|
|
167
|
+
interface MessageInputRef {
|
|
168
|
+
focus: () => void;
|
|
360
169
|
}
|
|
361
170
|
|
|
362
|
-
interface
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
171
|
+
interface ChatData {
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
message: string;
|
|
175
|
+
time: string;
|
|
176
|
+
avatar: string;
|
|
177
|
+
unreadCount?: number;
|
|
178
|
+
isOnline?: boolean;
|
|
179
|
+
hasAttachment?: boolean;
|
|
368
180
|
}
|
|
369
|
-
interface
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
renderActionSheet?: (props: RenderActionSheetProps) => ReactNode;
|
|
373
|
-
renderReactionDetails?: (props: RenderReactionDetailsProps) => ReactNode;
|
|
181
|
+
interface ChatItemProps {
|
|
182
|
+
item: ChatData;
|
|
183
|
+
onPress: (chat: ChatData) => void;
|
|
374
184
|
}
|
|
375
|
-
interface
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
renderProps?: ChatRenderProps;
|
|
379
|
-
onMessageSend?: (message: Message) => void;
|
|
380
|
-
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
381
|
-
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
382
|
-
onMessageDelete?: (messageId: number) => void;
|
|
383
|
-
onActionPress?: (action: string, message: Message) => void;
|
|
384
|
-
attachmentUploader?: AttachmentUploader;
|
|
385
|
-
maxAttachments?: number;
|
|
386
|
-
maxFileSize?: number;
|
|
387
|
-
allowedFileTypes?: string[];
|
|
388
|
-
enableReactionDetails?: boolean;
|
|
389
|
-
enableMessageActions?: boolean;
|
|
390
|
-
enableScrollToBottom?: boolean;
|
|
391
|
-
enableTypingIndicator?: boolean;
|
|
392
|
-
isTyping?: boolean;
|
|
393
|
-
typingUserName?: string;
|
|
394
|
-
isLoading?: boolean;
|
|
395
|
-
loadingComponent?: ReactNode;
|
|
185
|
+
interface ChatListProps {
|
|
186
|
+
chats: ChatData[];
|
|
187
|
+
onChatPress: (chat: ChatData) => void;
|
|
396
188
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
189
|
+
interface ChatAvatarProps {
|
|
190
|
+
avatar: string;
|
|
191
|
+
isOnline?: boolean;
|
|
192
|
+
size?: 'small' | 'medium' | 'large';
|
|
401
193
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
interface ImageMessageProps {
|
|
408
|
-
imageData: ImageAttachmentData$1;
|
|
194
|
+
interface ReplyToMessage {
|
|
195
|
+
id: number;
|
|
196
|
+
text: string;
|
|
197
|
+
senderName?: string;
|
|
409
198
|
isMe: boolean;
|
|
410
|
-
|
|
411
|
-
|
|
199
|
+
type?: 'text' | 'image';
|
|
200
|
+
imageData?: ImageAttachmentData;
|
|
412
201
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
202
|
+
interface MessageReaction {
|
|
203
|
+
emoji: string;
|
|
204
|
+
count: number;
|
|
205
|
+
users: string[];
|
|
206
|
+
}
|
|
207
|
+
interface Message {
|
|
208
|
+
id: number;
|
|
209
|
+
text: string;
|
|
416
210
|
isMe: boolean;
|
|
417
211
|
timestamp: string;
|
|
212
|
+
status?: 'sent' | 'delivered' | 'read';
|
|
418
213
|
senderName?: string;
|
|
214
|
+
replyTo?: ReplyToMessage;
|
|
215
|
+
reactions?: MessageReaction[];
|
|
216
|
+
type?: 'text' | 'image';
|
|
217
|
+
imageData?: ImageAttachmentData;
|
|
218
|
+
deleted?: boolean;
|
|
419
219
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
declare const ReplyBubble: React__default.FC<ReplyBubbleProps>;
|
|
427
|
-
|
|
428
|
-
interface ReplyPreviewProps {
|
|
429
|
-
replyToMessage: Message$1;
|
|
430
|
-
onCancel: () => void;
|
|
220
|
+
interface DateSeparator {
|
|
221
|
+
id: string;
|
|
222
|
+
listItemType: 'date-separator';
|
|
223
|
+
date: string;
|
|
224
|
+
displayDate: string;
|
|
431
225
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
interface MessageActionSheetProps {
|
|
435
|
-
visible: boolean;
|
|
436
|
-
onClose: () => void;
|
|
437
|
-
isMyMessage: boolean;
|
|
438
|
-
selectedMessage?: Message$1;
|
|
439
|
-
messagePosition?: {
|
|
440
|
-
x: number;
|
|
441
|
-
y: number;
|
|
442
|
-
width: number;
|
|
443
|
-
height: number;
|
|
444
|
-
};
|
|
445
|
-
onActionPress: (action: string) => void;
|
|
446
|
-
onEmojiReact?: (emoji: string) => void;
|
|
447
|
-
}
|
|
448
|
-
declare const MessageActionSheet: React__default.FC<MessageActionSheetProps>;
|
|
449
|
-
|
|
450
|
-
interface ReactionDetailsSheetProps {
|
|
451
|
-
visible: boolean;
|
|
452
|
-
onClose: () => void;
|
|
453
|
-
reactions: MessageReaction$1[];
|
|
454
|
-
messageText: string;
|
|
455
|
-
onAddReaction?: (emoji: string) => void;
|
|
456
|
-
onRemoveReaction?: (emoji: string) => void;
|
|
226
|
+
interface MessageWithType extends Message {
|
|
227
|
+
listItemType: 'message';
|
|
457
228
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
229
|
+
type MessageListItem = MessageWithType | DateSeparator;
|
|
230
|
+
interface AttachmentOption {
|
|
231
|
+
id: string;
|
|
232
|
+
label: string;
|
|
233
|
+
icon: any;
|
|
234
|
+
color: string;
|
|
464
235
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
interface TypingIndicatorProps {
|
|
470
|
-
isVisible: boolean;
|
|
236
|
+
interface AttachmentMenuProps {
|
|
237
|
+
onOptionSelect: (optionId: string) => void;
|
|
238
|
+
options: AttachmentOption[];
|
|
471
239
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
*/
|
|
476
|
-
declare const TypingIndicator: React__default.FC<TypingIndicatorProps>;
|
|
477
|
-
|
|
478
|
-
interface ScrollToBottomButtonProps {
|
|
479
|
-
visible: boolean;
|
|
480
|
-
onPress: () => void;
|
|
481
|
-
isReplyActive?: boolean;
|
|
240
|
+
interface AttachmentMenuRef {
|
|
241
|
+
show: () => void;
|
|
242
|
+
hide: () => void;
|
|
482
243
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
244
|
+
interface ImageAttachmentData {
|
|
245
|
+
uri: string;
|
|
246
|
+
width: number;
|
|
247
|
+
height: number;
|
|
248
|
+
fileSize?: number;
|
|
249
|
+
fileName: string;
|
|
489
250
|
}
|
|
490
|
-
declare const MessageInput: React__default.ForwardRefExoticComponent<MessageInputProps & React__default.RefAttributes<MessageInputRef>>;
|
|
491
|
-
|
|
492
|
-
declare const useAttachmentMenu: (onAttachmentSelected?: (result: AttachmentResult$1) => void) => UseAttachmentMenuReturn & {
|
|
493
|
-
options: AttachmentOption[];
|
|
494
|
-
};
|
|
495
251
|
|
|
496
252
|
interface MessageInputState<T = string> {
|
|
497
253
|
value: T;
|
|
498
254
|
height: number;
|
|
499
255
|
isFocused: boolean;
|
|
500
|
-
replyToMessage: Message | null;
|
|
256
|
+
replyToMessage: Message$1 | null;
|
|
501
257
|
attachments: AttachmentResult[];
|
|
502
258
|
}
|
|
503
259
|
interface MessageInputActions<T = string> {
|
|
504
260
|
setValue: (value: T) => void;
|
|
505
261
|
setHeight: (height: number) => void;
|
|
506
262
|
setFocus: (focused: boolean) => void;
|
|
507
|
-
setReplyToMessage: (message: Message | null) => void;
|
|
263
|
+
setReplyToMessage: (message: Message$1 | null) => void;
|
|
508
264
|
addAttachment: (attachment: AttachmentResult) => void;
|
|
509
265
|
removeAttachment: (attachmentId: string) => void;
|
|
510
266
|
clearAttachments: () => void;
|
|
@@ -521,7 +277,7 @@ interface MessageInputConfig<T = string> {
|
|
|
521
277
|
initialHeight?: number;
|
|
522
278
|
onValueChange?: (value: T) => void;
|
|
523
279
|
onHeightChange?: (height: number) => void;
|
|
524
|
-
onSend?: (value: T, attachments: AttachmentResult[], replyTo?: Message | null) => void;
|
|
280
|
+
onSend?: (value: T, attachments: AttachmentResult[], replyTo?: Message$1 | null) => void;
|
|
525
281
|
onAttachmentSend?: (attachmentResult: AttachmentResult, text?: T) => void;
|
|
526
282
|
onReplyCancel?: () => void;
|
|
527
283
|
onFocus?: () => void;
|
|
@@ -538,79 +294,45 @@ interface UseMessageInputReturn<T = string> {
|
|
|
538
294
|
textInputRef: React__default.RefObject<TextInput>;
|
|
539
295
|
};
|
|
540
296
|
}
|
|
541
|
-
declare const useMessageInput: <T = string>(config?: MessageInputConfig<T>) => UseMessageInputReturn<T>;
|
|
542
|
-
interface MessageInputContextValue<T = string> {
|
|
543
|
-
state: MessageInputState<T>;
|
|
544
|
-
actions: MessageInputActions<T>;
|
|
545
|
-
refs: {
|
|
546
|
-
textInputRef: React__default.RefObject<TextInput>;
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
declare const useMessageInputContext: <T = string>() => MessageInputContextValue<T>;
|
|
550
|
-
interface MessageInputProviderProps<T = string> {
|
|
551
|
-
children: ReactNode;
|
|
552
|
-
value: MessageInputContextValue<T>;
|
|
553
|
-
}
|
|
554
|
-
declare const MessageInputProvider: <T = string>({ children, value, }: MessageInputProviderProps<T>) => React__default.JSX.Element;
|
|
555
297
|
|
|
556
|
-
interface
|
|
557
|
-
|
|
558
|
-
|
|
298
|
+
interface UseChatMessagesReturn {
|
|
299
|
+
messages: Message[];
|
|
300
|
+
sendMessage: (text: string, replyTo?: ReplyToMessage) => void;
|
|
301
|
+
sendImageMessage: (imageData: any, text?: string, replyTo?: ReplyToMessage) => void;
|
|
302
|
+
updateMessageStatus: (messageId: number, status: 'sent' | 'delivered' | 'read') => void;
|
|
303
|
+
addReaction: (messageId: number, emoji: string) => void;
|
|
304
|
+
deleteMessage: (messageId: number) => void;
|
|
305
|
+
removeReaction: (messageId: number, emoji: string) => void;
|
|
559
306
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
307
|
+
|
|
308
|
+
interface ChatSDKConfig {
|
|
309
|
+
initialMessages?: Message[];
|
|
310
|
+
enableOptimisticUpdates?: boolean;
|
|
563
311
|
}
|
|
564
|
-
interface
|
|
565
|
-
|
|
566
|
-
|
|
312
|
+
interface ChatSDKReturn {
|
|
313
|
+
messages: Message[];
|
|
314
|
+
isTyping: boolean;
|
|
315
|
+
sendMessage: (text: string, replyTo?: Message) => void;
|
|
316
|
+
addReaction: (messageId: number, emoji: string) => void;
|
|
317
|
+
removeReaction: (messageId: number, emoji: string) => void;
|
|
318
|
+
setMessages: (messages: Message[]) => void;
|
|
319
|
+
addMessage: (message: Message) => void;
|
|
320
|
+
updateMessage: (messageId: number, updates: Partial<Message>) => void;
|
|
321
|
+
deleteMessage: (messageId: number) => void;
|
|
322
|
+
setTyping: (isTyping: boolean) => void;
|
|
323
|
+
resetChat: () => void;
|
|
324
|
+
getMessageById: (id: number) => Message | undefined;
|
|
567
325
|
}
|
|
568
|
-
interface AttachmentMenuRenderProps<T = string> {
|
|
569
|
-
actions: MessageInputActions<T>;
|
|
570
|
-
attachmentMenu: ReturnType<typeof useAttachmentMenu>;
|
|
571
|
-
}
|
|
572
|
-
declare const MessageInputCompound: {
|
|
573
|
-
Container: <T = string>({ children, render }: CompoundComponentProps<T>) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
574
|
-
ReplyPreview: <T = string>({ render }: CompoundComponentProps<T>) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
575
|
-
TextArea: <T = string>({ render }: CompoundComponentProps<T>) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
576
|
-
AttachmentButton: <T = string>({ render, }: {
|
|
577
|
-
render?: (props: AttachmentButtonRenderProps<T>) => ReactNode;
|
|
578
|
-
}) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
579
|
-
SendButton: <T = string>({ render, }: {
|
|
580
|
-
render?: (props: SendButtonRenderProps<T>) => ReactNode;
|
|
581
|
-
}) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
582
|
-
AttachmentMenu: <T = string>({ render, }: {
|
|
583
|
-
render?: (props: AttachmentMenuRenderProps<T>) => ReactNode;
|
|
584
|
-
}) => string | number | bigint | boolean | React__default.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
|
|
585
|
-
};
|
|
586
326
|
|
|
587
|
-
interface
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
autoScrollToBottom?: boolean;
|
|
596
|
-
onScrollToBottom?: () => void;
|
|
597
|
-
onScrollToTop?: () => void;
|
|
598
|
-
onScrollPositionChange?: (isNearBottom: boolean, isNearTop: boolean) => void;
|
|
599
|
-
onActionPress?: (action: string, message: Message) => void;
|
|
600
|
-
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
601
|
-
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
602
|
-
onMessageDelete?: (messageId: number) => void;
|
|
603
|
-
onReplyMessage?: (message: Message) => void;
|
|
604
|
-
onCancelReply?: () => void;
|
|
605
|
-
enableMessageActions?: boolean;
|
|
606
|
-
enableReactionDetails?: boolean;
|
|
607
|
-
}
|
|
608
|
-
interface MessageListRef {
|
|
609
|
-
scrollToEnd: (animated?: boolean) => void;
|
|
610
|
-
scrollToOffset: (offset: number, animated?: boolean) => void;
|
|
611
|
-
scrollToIndex: (index: number, animated?: boolean) => void;
|
|
327
|
+
interface UseAttachmentsOptions {
|
|
328
|
+
uploader?: AttachmentUploader;
|
|
329
|
+
maxAttachments?: number;
|
|
330
|
+
maxFileSize?: number;
|
|
331
|
+
allowedTypes?: string[];
|
|
332
|
+
onAttachmentAdd?: (attachment: Attachment) => void;
|
|
333
|
+
onAttachmentRemove?: (attachmentId: string) => void;
|
|
334
|
+
onAttachmentUpload?: (attachments: Attachment[]) => void;
|
|
612
335
|
}
|
|
613
|
-
declare const MessageList: React__default.ForwardRefExoticComponent<ExtendedMessageListProps & React__default.RefAttributes<MessageListRef>>;
|
|
614
336
|
|
|
615
337
|
interface MessageListConfig {
|
|
616
338
|
scrollThreshold?: number;
|
|
@@ -621,48 +343,10 @@ interface MessageListConfig {
|
|
|
621
343
|
maxToRenderPerBatch?: number;
|
|
622
344
|
windowSize?: number;
|
|
623
345
|
}
|
|
624
|
-
/**
|
|
625
|
-
* Level 3: Core message list hook
|
|
626
|
-
* Handles message data preparation, grouping, and basic operations
|
|
627
|
-
*/
|
|
628
|
-
declare function useMessageList(messages: Message[], config?: MessageListConfig): {
|
|
629
|
-
messageItems: MessageListItem$1[];
|
|
630
|
-
keyExtractor: (item: MessageListItem) => string;
|
|
631
|
-
flatListProps: {
|
|
632
|
-
initialNumToRender: number;
|
|
633
|
-
maxToRenderPerBatch: number;
|
|
634
|
-
windowSize: number;
|
|
635
|
-
inverted: boolean;
|
|
636
|
-
showsVerticalScrollIndicator: boolean;
|
|
637
|
-
keyboardShouldPersistTaps: "handled";
|
|
638
|
-
removeClippedSubviews: boolean;
|
|
639
|
-
scrollEventThrottle: number;
|
|
640
|
-
};
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
interface ScrollState {
|
|
644
|
-
isNearBottom: boolean;
|
|
645
|
-
isNearTop: boolean;
|
|
646
|
-
showScrollToBottomButton: boolean;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Level 3: Scroll management hook
|
|
650
|
-
* Handles all scroll-related functionality
|
|
651
|
-
*/
|
|
652
|
-
declare function useMessageListScroll(config?: MessageListConfig): {
|
|
653
|
-
flatListRef: React$1.RefObject<FlatList<any> | null>;
|
|
654
|
-
scrollState: ScrollState;
|
|
655
|
-
handleScroll: (event: any) => void;
|
|
656
|
-
handleContentSizeChange: () => void;
|
|
657
|
-
handleNewMessages: (currentMessageCount: number) => void;
|
|
658
|
-
scrollToEnd: (animated?: boolean) => void;
|
|
659
|
-
scrollToOffset: (offset: number, animated?: boolean) => void;
|
|
660
|
-
scrollToIndex: (index: number, animated?: boolean) => void;
|
|
661
|
-
};
|
|
662
346
|
|
|
663
347
|
interface ActionState {
|
|
664
348
|
actionSheetVisible: boolean;
|
|
665
|
-
selectedMessage: Message | null;
|
|
349
|
+
selectedMessage: Message$1 | null;
|
|
666
350
|
messagePosition?: {
|
|
667
351
|
x: number;
|
|
668
352
|
y: number;
|
|
@@ -670,127 +354,12 @@ interface ActionState {
|
|
|
670
354
|
height: number;
|
|
671
355
|
};
|
|
672
356
|
}
|
|
673
|
-
/**
|
|
674
|
-
* Level 3: Message actions hook
|
|
675
|
-
* Handles action sheet, message selection, and actions
|
|
676
|
-
*/
|
|
677
|
-
declare function useMessageActions(config?: MessageListConfig): {
|
|
678
|
-
actionState: ActionState;
|
|
679
|
-
handleMessageLongPress: (message: Message, position?: {
|
|
680
|
-
x: number;
|
|
681
|
-
y: number;
|
|
682
|
-
width: number;
|
|
683
|
-
height: number;
|
|
684
|
-
}) => void;
|
|
685
|
-
handleActionSheetClose: () => void;
|
|
686
|
-
handleActionPress: (action: string, callbacks?: {
|
|
687
|
-
onReply?: (message: Message) => void;
|
|
688
|
-
onDelete?: (messageId: number) => void;
|
|
689
|
-
onCopy?: (message: Message) => void;
|
|
690
|
-
onCustomAction?: (action: string, message: Message) => void;
|
|
691
|
-
}) => void;
|
|
692
|
-
};
|
|
693
357
|
|
|
694
358
|
interface ReactionState {
|
|
695
359
|
isReactionDetailsVisible: boolean;
|
|
696
360
|
selectedReactions: any[];
|
|
697
361
|
selectedMessageText: string;
|
|
698
362
|
}
|
|
699
|
-
/**
|
|
700
|
-
* Level 3: Message reactions hook
|
|
701
|
-
* Handles reaction details, emoji reactions
|
|
702
|
-
*/
|
|
703
|
-
declare function useMessageReactions(config?: MessageListConfig): {
|
|
704
|
-
reactionState: ReactionState;
|
|
705
|
-
selectedMessage: Message | null;
|
|
706
|
-
handleReactionPress: (message: Message) => void;
|
|
707
|
-
handleReactionDetailsClose: () => void;
|
|
708
|
-
handleAddReaction: (emoji: string, onAdd?: (messageId: number, emoji: string) => void) => void;
|
|
709
|
-
handleRemoveReaction: (emoji: string, onRemove?: (messageId: number, emoji: string) => void) => void;
|
|
710
|
-
handleEmojiReact: (emoji: string, onAdd?: (messageId: number, emoji: string) => void) => void;
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
interface ReplyState {
|
|
714
|
-
replyToMessage: Message | null;
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Level 3: Reply functionality hook
|
|
718
|
-
* Handles reply-to-message state
|
|
719
|
-
*/
|
|
720
|
-
declare function useMessageReply(): {
|
|
721
|
-
replyState: ReplyState;
|
|
722
|
-
setReplyToMessage: (message: Message | null) => void;
|
|
723
|
-
clearReply: () => void;
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
interface MessageListContextValue {
|
|
727
|
-
messageList: ReturnType<typeof useMessageList>;
|
|
728
|
-
scroll: ReturnType<typeof useMessageListScroll>;
|
|
729
|
-
actions: ReturnType<typeof useMessageActions>;
|
|
730
|
-
reactions: ReturnType<typeof useMessageReactions>;
|
|
731
|
-
reply: ReturnType<typeof useMessageReply>;
|
|
732
|
-
config: MessageListConfig;
|
|
733
|
-
callbacks: {
|
|
734
|
-
onScrollToBottom?: () => void;
|
|
735
|
-
onScrollToTop?: () => void;
|
|
736
|
-
onScrollPositionChange?: (isNearBottom: boolean, isNearTop: boolean) => void;
|
|
737
|
-
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
738
|
-
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
739
|
-
onMessageDelete?: (messageId: number) => void;
|
|
740
|
-
onReplyMessage?: (message: Message) => void;
|
|
741
|
-
onActionPress?: (action: string, message: Message) => void;
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
declare function useMessageListContext(): MessageListContextValue;
|
|
745
|
-
declare function MessageListProvider({ children, messages, config, ...callbacks }: {
|
|
746
|
-
children: React__default.ReactNode;
|
|
747
|
-
messages: Message[];
|
|
748
|
-
config?: MessageListConfig;
|
|
749
|
-
} & MessageListContextValue['callbacks']): React__default.JSX.Element;
|
|
750
|
-
|
|
751
|
-
declare const MessageListCompound: {
|
|
752
|
-
Provider: typeof MessageListProvider;
|
|
753
|
-
Container: ({ children, style, }: {
|
|
754
|
-
children: React__default.ReactNode;
|
|
755
|
-
style?: any;
|
|
756
|
-
}) => React__default.JSX.Element;
|
|
757
|
-
Messages: ({ renderMessage, style, }: {
|
|
758
|
-
renderMessage?: (props: {
|
|
759
|
-
message: Message;
|
|
760
|
-
index: number;
|
|
761
|
-
}) => React__default.ReactNode;
|
|
762
|
-
style?: any;
|
|
763
|
-
}) => React__default.JSX.Element;
|
|
764
|
-
TypingIndicator: ({ isVisible }: {
|
|
765
|
-
isVisible?: boolean;
|
|
766
|
-
}) => React__default.JSX.Element | null;
|
|
767
|
-
ScrollButton: ({ visible, isReplyActive, onPress, }: {
|
|
768
|
-
visible?: boolean;
|
|
769
|
-
isReplyActive?: boolean;
|
|
770
|
-
onPress?: () => void;
|
|
771
|
-
}) => React__default.JSX.Element;
|
|
772
|
-
ActionSheet: () => React__default.JSX.Element | null;
|
|
773
|
-
ReactionDetails: () => React__default.JSX.Element | null;
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
declare const _default: (props: ChatListProps) => React__default.JSX.Element;
|
|
777
|
-
|
|
778
|
-
declare const ChatItem: React__default.FC<ChatItemProps>;
|
|
779
|
-
|
|
780
|
-
interface ChatHeaderProps {
|
|
781
|
-
title: string;
|
|
782
|
-
}
|
|
783
|
-
declare const ChatHeader: React__default.FC<ChatHeaderProps>;
|
|
784
|
-
|
|
785
|
-
interface ChatListSearchBarProps {
|
|
786
|
-
value: string;
|
|
787
|
-
onChangeText: (text: string) => void;
|
|
788
|
-
onClear: () => void;
|
|
789
|
-
placeholder?: string;
|
|
790
|
-
}
|
|
791
|
-
declare const ChatListSearchBarBase: React__default.FC<ChatListSearchBarProps>;
|
|
792
|
-
|
|
793
|
-
declare const ChatAvatar: React__default.FC<ChatAvatarProps>;
|
|
794
363
|
|
|
795
364
|
interface ThemeColors {
|
|
796
365
|
primary: string;
|
|
@@ -883,64 +452,63 @@ interface ThemeProviderProps {
|
|
|
883
452
|
theme?: Partial<Theme>;
|
|
884
453
|
}
|
|
885
454
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
455
|
+
interface ChatHeaderProps {
|
|
456
|
+
title: string;
|
|
457
|
+
}
|
|
889
458
|
|
|
890
|
-
|
|
459
|
+
interface ChatListSearchBarProps {
|
|
460
|
+
value: string;
|
|
461
|
+
onChangeText: (text: string) => void;
|
|
462
|
+
onClear: () => void;
|
|
463
|
+
placeholder?: string;
|
|
464
|
+
}
|
|
891
465
|
|
|
892
|
-
interface
|
|
893
|
-
|
|
894
|
-
sendMessage: (text: string, replyTo?: ReplyToMessage$1) => void;
|
|
895
|
-
sendImageMessage: (imageData: any, text?: string, replyTo?: ReplyToMessage$1) => void;
|
|
896
|
-
updateMessageStatus: (messageId: number, status: 'sent' | 'delivered' | 'read') => void;
|
|
897
|
-
addReaction: (messageId: number, emoji: string) => void;
|
|
898
|
-
deleteMessage: (messageId: number) => void;
|
|
899
|
-
removeReaction: (messageId: number, emoji: string) => void;
|
|
466
|
+
interface TypingIndicatorProps {
|
|
467
|
+
isVisible: boolean;
|
|
900
468
|
}
|
|
901
|
-
declare const useChatMessages: (senderName?: string) => UseChatMessagesReturn;
|
|
902
469
|
|
|
903
|
-
interface
|
|
904
|
-
|
|
905
|
-
|
|
470
|
+
interface ExtendedMessageListProps extends MessageListProps {
|
|
471
|
+
isTyping?: boolean;
|
|
472
|
+
typingUserName?: string;
|
|
473
|
+
onScroll?: (event: any) => void;
|
|
474
|
+
onContentSizeChange?: () => void;
|
|
475
|
+
showScrollToBottom?: boolean;
|
|
476
|
+
isReplyActive?: boolean;
|
|
477
|
+
scrollThreshold?: number;
|
|
478
|
+
autoScrollToBottom?: boolean;
|
|
479
|
+
onScrollToBottom?: () => void;
|
|
480
|
+
onScrollToTop?: () => void;
|
|
481
|
+
onScrollPositionChange?: (isNearBottom: boolean, isNearTop: boolean) => void;
|
|
482
|
+
onActionPress?: (action: string, message: Message$1) => void;
|
|
483
|
+
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
484
|
+
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
485
|
+
onMessageDelete?: (messageId: number) => void;
|
|
486
|
+
onReplyMessage?: (message: Message$1) => void;
|
|
487
|
+
onCancelReply?: () => void;
|
|
488
|
+
enableMessageActions?: boolean;
|
|
489
|
+
enableReactionDetails?: boolean;
|
|
906
490
|
}
|
|
907
|
-
interface
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
addReaction: (messageId: number, emoji: string) => void;
|
|
912
|
-
removeReaction: (messageId: number, emoji: string) => void;
|
|
913
|
-
setMessages: (messages: Message$1[]) => void;
|
|
914
|
-
addMessage: (message: Message$1) => void;
|
|
915
|
-
updateMessage: (messageId: number, updates: Partial<Message$1>) => void;
|
|
916
|
-
deleteMessage: (messageId: number) => void;
|
|
917
|
-
setTyping: (isTyping: boolean) => void;
|
|
918
|
-
resetChat: () => void;
|
|
919
|
-
getMessageById: (id: number) => Message$1 | undefined;
|
|
491
|
+
interface MessageListRef {
|
|
492
|
+
scrollToEnd: (animated?: boolean) => void;
|
|
493
|
+
scrollToOffset: (offset: number, animated?: boolean) => void;
|
|
494
|
+
scrollToIndex: (index: number, animated?: boolean) => void;
|
|
920
495
|
}
|
|
921
|
-
/**
|
|
922
|
-
* Hook for external apps to manage chat state
|
|
923
|
-
* Provides all necessary functionality for a complete chat experience
|
|
924
|
-
*/
|
|
925
|
-
declare const useChatSDK: (config?: ChatSDKConfig) => ChatSDKReturn;
|
|
926
496
|
|
|
927
|
-
interface
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
497
|
+
interface ChatConfig {
|
|
498
|
+
keyboardBehavior?: 'padding' | 'height' | 'position';
|
|
499
|
+
keyboardVerticalOffset?: number;
|
|
500
|
+
enableReactionDetails?: boolean;
|
|
501
|
+
enableMessageActions?: boolean;
|
|
502
|
+
enableScrollToBottom?: boolean;
|
|
503
|
+
enableTypingIndicator?: boolean;
|
|
504
|
+
onMessageSend?: (text: string, replyTo?: Message) => void;
|
|
505
|
+
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
506
|
+
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
935
507
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
typingTimeout?: number;
|
|
940
|
-
onTypingStart?: () => void;
|
|
941
|
-
onTypingStop?: () => void;
|
|
508
|
+
interface ChatProviderProps {
|
|
509
|
+
children: ReactNode;
|
|
510
|
+
config?: ChatConfig;
|
|
942
511
|
}
|
|
943
|
-
declare const useTypingIndicator: (options?: UseTypingIndicatorOptions) => UseTypingIndicatorReturn;
|
|
944
512
|
|
|
945
513
|
interface ChatInitConfig {
|
|
946
514
|
projectId: string;
|
|
@@ -953,15 +521,142 @@ interface ChatInitResponse {
|
|
|
953
521
|
projectId: string;
|
|
954
522
|
activatedAt: string;
|
|
955
523
|
}
|
|
956
|
-
interface ChatInitError {
|
|
957
|
-
error: string;
|
|
958
|
-
projectId?: string;
|
|
959
|
-
}
|
|
960
524
|
/**
|
|
961
525
|
* Initialize the chat SDK with project verification
|
|
526
|
+
*
|
|
527
|
+
* This function validates the project ID with the API and sets up the SDK for use.
|
|
528
|
+
* All UseChat components and hooks require this to be called first.
|
|
529
|
+
*
|
|
962
530
|
* @param config - Configuration object containing projectId and optional apiUrl
|
|
963
531
|
* @returns Promise that resolves to ChatInitResponse or rejects with ChatInitError
|
|
964
532
|
*/
|
|
965
533
|
declare const initChat: (config: ChatInitConfig) => Promise<ChatInitResponse>;
|
|
966
534
|
|
|
967
|
-
|
|
535
|
+
/**
|
|
536
|
+
* Simple Authentication System for UseChat SDK
|
|
537
|
+
*
|
|
538
|
+
* This system ensures initChat() is called before using any components or hooks.
|
|
539
|
+
* No loading states - just immediate error throwing for better developer experience.
|
|
540
|
+
*/
|
|
541
|
+
interface AuthState {
|
|
542
|
+
isInitialized: boolean;
|
|
543
|
+
projectId: string | null;
|
|
544
|
+
error: string | null;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get current authentication state (read-only)
|
|
548
|
+
*/
|
|
549
|
+
declare const getAuthState: () => Readonly<AuthState>;
|
|
550
|
+
/**
|
|
551
|
+
* Get the current project ID (throws if not initialized)
|
|
552
|
+
*/
|
|
553
|
+
declare const getProjectId: () => string;
|
|
554
|
+
/**
|
|
555
|
+
* Check if SDK is initialized (without throwing)
|
|
556
|
+
*/
|
|
557
|
+
declare const isInitialized: () => boolean;
|
|
558
|
+
|
|
559
|
+
interface ChatComponents {
|
|
560
|
+
MessageList?: ComponentType<MessageListProps>;
|
|
561
|
+
MessageInput?: ComponentType<MessageInputProps>;
|
|
562
|
+
MessageActionSheet?: ComponentType<any>;
|
|
563
|
+
ReactionDetailsSheet?: ComponentType<any>;
|
|
564
|
+
ScrollToBottomButton?: ComponentType<any>;
|
|
565
|
+
}
|
|
566
|
+
interface ChatRenderProps {
|
|
567
|
+
renderMessage?: (props: RenderMessageProps) => ReactNode;
|
|
568
|
+
renderInput?: (props: RenderInputProps) => ReactNode;
|
|
569
|
+
renderActionSheet?: (props: RenderActionSheetProps) => ReactNode;
|
|
570
|
+
renderReactionDetails?: (props: RenderReactionDetailsProps) => ReactNode;
|
|
571
|
+
}
|
|
572
|
+
interface ChatProps {
|
|
573
|
+
messages?: Message$1[];
|
|
574
|
+
components?: ChatComponents;
|
|
575
|
+
renderProps?: ChatRenderProps;
|
|
576
|
+
onMessageSend?: (message: Message$1) => void;
|
|
577
|
+
onReactionAdd?: (messageId: number, emoji: string) => void;
|
|
578
|
+
onReactionRemove?: (messageId: number, emoji: string) => void;
|
|
579
|
+
onMessageDelete?: (messageId: number) => void;
|
|
580
|
+
onActionPress?: (action: string, message: Message$1) => void;
|
|
581
|
+
attachmentUploader?: AttachmentUploader;
|
|
582
|
+
maxAttachments?: number;
|
|
583
|
+
maxFileSize?: number;
|
|
584
|
+
allowedFileTypes?: string[];
|
|
585
|
+
enableReactionDetails?: boolean;
|
|
586
|
+
enableMessageActions?: boolean;
|
|
587
|
+
enableScrollToBottom?: boolean;
|
|
588
|
+
enableTypingIndicator?: boolean;
|
|
589
|
+
isTyping?: boolean;
|
|
590
|
+
typingUserName?: string;
|
|
591
|
+
isLoading?: boolean;
|
|
592
|
+
loadingComponent?: ReactNode;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
declare const defaultTheme: Theme;
|
|
596
|
+
|
|
597
|
+
declare const Chat: React$1.ComponentType<ChatProps>;
|
|
598
|
+
declare const ChatProvider: React$1.ComponentType<ChatProviderProps>;
|
|
599
|
+
declare const useChatConfig: () => ChatConfig;
|
|
600
|
+
|
|
601
|
+
declare const MessageList: React$1.ComponentType<ExtendedMessageListProps & React$1.RefAttributes<MessageListRef>>;
|
|
602
|
+
declare const MessageInput: React$1.ComponentType<MessageInputProps & React$1.RefAttributes<MessageInputRef>>;
|
|
603
|
+
|
|
604
|
+
declare const ChatScreenHeader: React$1.ComponentType<ChatScreenHeaderProps>;
|
|
605
|
+
declare const TypingIndicator: React$1.ComponentType<TypingIndicatorProps>;
|
|
606
|
+
|
|
607
|
+
declare const ChatList: React$1.ComponentType<ChatListProps>;
|
|
608
|
+
declare const ChatItem: React$1.ComponentType<ChatItemProps>;
|
|
609
|
+
declare const ChatHeader: React$1.ComponentType<ChatHeaderProps>;
|
|
610
|
+
declare const ChatListSearchBar: React$1.ComponentType<ChatListSearchBarProps>;
|
|
611
|
+
|
|
612
|
+
declare const ChatAvatar: React$1.ComponentType<ChatAvatarProps>;
|
|
613
|
+
declare const AttachmentMenu: React$1.ComponentType<AttachmentMenuProps & React$1.RefAttributes<AttachmentMenuRef>>;
|
|
614
|
+
declare const ThemeProvider: React$1.ComponentType<ThemeProviderProps>;
|
|
615
|
+
|
|
616
|
+
declare const useTheme: () => Theme;
|
|
617
|
+
|
|
618
|
+
declare const useChatSDK: (config?: ChatSDKConfig | undefined) => ChatSDKReturn;
|
|
619
|
+
declare const useChatMessages: (senderName?: string | undefined) => UseChatMessagesReturn;
|
|
620
|
+
declare const useMessageList: (messages: Message$1[], config?: MessageListConfig | undefined) => {
|
|
621
|
+
messageItems: MessageListItem[];
|
|
622
|
+
keyExtractor: (item: MessageListItem$1) => string;
|
|
623
|
+
flatListProps: {
|
|
624
|
+
initialNumToRender: number;
|
|
625
|
+
maxToRenderPerBatch: number;
|
|
626
|
+
windowSize: number;
|
|
627
|
+
inverted: boolean;
|
|
628
|
+
showsVerticalScrollIndicator: boolean;
|
|
629
|
+
keyboardShouldPersistTaps: "handled";
|
|
630
|
+
removeClippedSubviews: boolean;
|
|
631
|
+
scrollEventThrottle: number;
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
declare const useMessageActions: (config?: MessageListConfig | undefined) => {
|
|
635
|
+
actionState: ActionState;
|
|
636
|
+
handleMessageLongPress: (message: Message$1, position?: {
|
|
637
|
+
x: number;
|
|
638
|
+
y: number;
|
|
639
|
+
width: number;
|
|
640
|
+
height: number;
|
|
641
|
+
}) => void;
|
|
642
|
+
handleActionSheetClose: () => void;
|
|
643
|
+
handleActionPress: (action: string, callbacks?: {
|
|
644
|
+
onReply?: (message: Message$1) => void;
|
|
645
|
+
onDelete?: (messageId: number) => void;
|
|
646
|
+
onCopy?: (message: Message$1) => void;
|
|
647
|
+
onCustomAction?: (action: string, message: Message$1) => void;
|
|
648
|
+
}) => void;
|
|
649
|
+
};
|
|
650
|
+
declare const useMessageReactions: (config?: MessageListConfig | undefined) => {
|
|
651
|
+
reactionState: ReactionState;
|
|
652
|
+
selectedMessage: Message$1 | null;
|
|
653
|
+
handleReactionPress: (message: Message$1) => void;
|
|
654
|
+
handleReactionDetailsClose: () => void;
|
|
655
|
+
handleAddReaction: (emoji: string, onAdd?: (messageId: number, emoji: string) => void) => void;
|
|
656
|
+
handleRemoveReaction: (emoji: string, onRemove?: (messageId: number, emoji: string) => void) => void;
|
|
657
|
+
handleEmojiReact: (emoji: string, onAdd?: (messageId: number, emoji: string) => void) => void;
|
|
658
|
+
};
|
|
659
|
+
declare const useAttachments: (options?: UseAttachmentsOptions | undefined) => UseAttachmentsReturn;
|
|
660
|
+
declare const useMessageInput: <T = string>(config?: MessageInputConfig<T> | undefined) => UseMessageInputReturn<T>;
|
|
661
|
+
|
|
662
|
+
export { AttachmentMenu, type AttachmentResult, Chat, ChatAvatar, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatInitConfig, type ChatInitResponse, ChatItem, ChatList, ChatListSearchBar, type ChatListSearchBarProps, type ChatProps, ChatProvider, ChatScreenHeader, type Message$1 as Message, MessageInput, type MessageInputRef, MessageList, type MessageListRef, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeSpacing, type ThemeTypography, TypingIndicator, type TypingIndicatorProps, defaultTheme, getAuthState, getProjectId, initChat, isInitialized, useAttachments, useChatConfig, useChatMessages, useChatSDK, useMessageActions, useMessageInput, useMessageList, useMessageReactions, useTheme };
|