@talkjs/react-components 0.0.27 → 0.0.29
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/base.css +1 -1
- package/default.css +1 -1
- package/default.d.ts +928 -143
- package/default.js +1642 -1537
- package/package.json +2 -2
- package/theming.d.ts +843 -152
- package/theming.js +1036 -944
package/theming.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { AudioBlock } from '@talkjs/core';
|
|
2
2
|
import { ConversationSnapshot } from '@talkjs/core';
|
|
3
|
-
import { default as default_2 } from 'react';
|
|
4
3
|
import { EditMessageParams } from '@talkjs/core';
|
|
5
4
|
import { EditTextMessageParams } from '@talkjs/core';
|
|
6
5
|
import { FileBlock } from '@talkjs/core';
|
|
7
6
|
import { FileToken } from '@talkjs/core';
|
|
7
|
+
import { GenericFileBlock } from '@talkjs/core';
|
|
8
8
|
import { ImageBlock } from '@talkjs/core';
|
|
9
9
|
import { LocationBlock } from '@talkjs/core';
|
|
10
10
|
import { MessageSnapshot } from '@talkjs/core';
|
|
11
11
|
import { ParticipantSnapshot } from '@talkjs/core';
|
|
12
|
-
import
|
|
13
|
-
import { ReactElement } from 'react';
|
|
12
|
+
import * as React from 'react';
|
|
14
13
|
import { ReferencedMessageSnapshot } from '@talkjs/core';
|
|
15
14
|
import { SendMessageParams } from '@talkjs/core';
|
|
16
15
|
import { SendTextMessageParams } from '@talkjs/core';
|
|
@@ -21,19 +20,69 @@ import { UserSnapshot } from '@talkjs/core';
|
|
|
21
20
|
import { VideoBlock } from '@talkjs/core';
|
|
22
21
|
import { VoiceBlock } from '@talkjs/core';
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Holds information about your TalkJS app.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare interface App {
|
|
29
|
+
/**
|
|
30
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
31
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* The name of your app.
|
|
36
|
+
*/
|
|
28
37
|
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* The default locale.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This can be configured from your TalkJS dashboard.
|
|
43
|
+
*/
|
|
29
44
|
defaultLocale: string;
|
|
45
|
+
/**
|
|
46
|
+
* Custom data set for this app.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* This can be configured from your TalkJS dashboard.
|
|
50
|
+
*/
|
|
30
51
|
custom: Record<string, string>;
|
|
31
52
|
}
|
|
32
53
|
|
|
33
54
|
export { AudioBlock }
|
|
34
55
|
|
|
35
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
export declare interface AudioBlockProps {
|
|
60
|
+
/**
|
|
61
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
62
|
+
*/
|
|
63
|
+
common: CommonChatboxProps;
|
|
64
|
+
/**
|
|
65
|
+
* The message that this content block belongs to.
|
|
66
|
+
*/
|
|
67
|
+
message: MessageSnapshot;
|
|
68
|
+
/**
|
|
69
|
+
* The audio block to display.
|
|
70
|
+
*/
|
|
36
71
|
block: AudioBlock;
|
|
72
|
+
/**
|
|
73
|
+
* The URL used to download the file.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
77
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
78
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
79
|
+
* the chat, which makes for a smoother user experience.
|
|
80
|
+
*
|
|
81
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
82
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
83
|
+
* while `block.url` will always be defined and should be used for preview
|
|
84
|
+
* purposes.
|
|
85
|
+
*/
|
|
37
86
|
downloadUrl?: string;
|
|
38
87
|
}
|
|
39
88
|
|
|
@@ -51,147 +100,329 @@ export declare interface AudioBlockProps extends ContentBlockProps {
|
|
|
51
100
|
*/
|
|
52
101
|
export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX.Element;
|
|
53
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
54
106
|
export declare interface AudioPlayerProps {
|
|
107
|
+
/**
|
|
108
|
+
* Source of the audio that's being played.
|
|
109
|
+
*/
|
|
55
110
|
src: string;
|
|
111
|
+
/**
|
|
112
|
+
* Name of the audio file that's being played.
|
|
113
|
+
*/
|
|
56
114
|
filename: string;
|
|
115
|
+
/**
|
|
116
|
+
* Callback that runs when an error is encountered during playback.
|
|
117
|
+
*/
|
|
57
118
|
onError?: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* @hidden
|
|
121
|
+
*/
|
|
58
122
|
className?: string;
|
|
59
123
|
}
|
|
60
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
61
128
|
export declare interface AvatarProps {
|
|
129
|
+
/**
|
|
130
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
131
|
+
* theme components.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
135
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
136
|
+
*/
|
|
62
137
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
138
|
+
/**
|
|
139
|
+
* The URL of the image that's to be displayed.
|
|
140
|
+
*/
|
|
63
141
|
photoUrl: string;
|
|
64
142
|
}
|
|
65
143
|
|
|
66
144
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* type UserId = Brand<string, "UserId">;
|
|
72
|
-
* type MessageId = Brand<string, "MessageId">;
|
|
145
|
+
* A collection of actions available on the Chatbox UI.
|
|
73
146
|
*
|
|
74
|
-
*
|
|
75
|
-
* const b: UserId = "abc"; // error
|
|
76
|
-
* const c: UserId = "abc" as MessageId; // error
|
|
77
|
-
* ```
|
|
147
|
+
* @public
|
|
78
148
|
*/
|
|
79
|
-
declare type Brand<T, B extends string> = T & Branding<B>;
|
|
80
|
-
|
|
81
|
-
declare interface Branding<B extends string> {
|
|
82
|
-
__tag: Record<B, true>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
149
|
export declare interface Chatbox {
|
|
150
|
+
/**
|
|
151
|
+
* Deletes the message with the given ID.
|
|
152
|
+
*
|
|
153
|
+
* @param messageId
|
|
154
|
+
*/
|
|
86
155
|
deleteMessage(messageId: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Enable/disable editing of a given message.
|
|
158
|
+
*
|
|
159
|
+
* @param messageId When `null` is provided, editing mode will be disabled
|
|
160
|
+
*/
|
|
87
161
|
setEditing(messageId: string | null): void;
|
|
162
|
+
/**
|
|
163
|
+
* Edit the message with the given ID.
|
|
164
|
+
*
|
|
165
|
+
* @param messageId
|
|
166
|
+
* @param params
|
|
167
|
+
*/
|
|
88
168
|
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Send a text message to the current conversation.
|
|
171
|
+
*
|
|
172
|
+
* @param params
|
|
173
|
+
*/
|
|
89
174
|
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
90
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Send a file message to the current conversation.
|
|
177
|
+
*
|
|
178
|
+
* @param message
|
|
179
|
+
*/
|
|
180
|
+
sendFileMessage(params: {
|
|
91
181
|
fileToken: FileToken;
|
|
92
182
|
custom?: Record<string, string>;
|
|
93
183
|
}): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Send a location message to the current conversation.
|
|
186
|
+
*
|
|
187
|
+
* @param message
|
|
188
|
+
*/
|
|
94
189
|
sendLocationMessage(message: {
|
|
95
190
|
location: Coordinates;
|
|
96
191
|
custom?: Record<string, string>;
|
|
97
192
|
}): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Set/unset the message that's currently being replied to.
|
|
195
|
+
*
|
|
196
|
+
* @param messageId When `null` is provided, the "replying to" message is cleared
|
|
197
|
+
*/
|
|
98
198
|
setReferencedMessage(messageId: string | null): void;
|
|
99
|
-
getMessageFieldText: () => string;
|
|
100
|
-
setMessageFieldText: (text: string) => void;
|
|
101
199
|
}
|
|
102
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
103
204
|
export declare interface ChatHeaderProps {
|
|
205
|
+
/**
|
|
206
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
207
|
+
*/
|
|
104
208
|
common: CommonChatboxProps;
|
|
209
|
+
/**
|
|
210
|
+
* A record of user IDs and their connection status.
|
|
211
|
+
*/
|
|
105
212
|
isUserConnected: {
|
|
106
213
|
[userId: string]: boolean;
|
|
107
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* The current user's permissions.
|
|
217
|
+
*/
|
|
108
218
|
permissions: UserPermissions;
|
|
109
219
|
}
|
|
110
220
|
|
|
221
|
+
/**
|
|
222
|
+
* A collection of props that's shared by every themed component used in the Chatbox UI.
|
|
223
|
+
*
|
|
224
|
+
* @public
|
|
225
|
+
*/
|
|
111
226
|
export declare interface CommonChatboxProps {
|
|
112
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Holds information about your TalkJS app.
|
|
229
|
+
*/
|
|
230
|
+
app: App;
|
|
231
|
+
/**
|
|
232
|
+
* The user that mounted this chatbox.
|
|
233
|
+
*/
|
|
113
234
|
currentUser: UserSnapshot;
|
|
235
|
+
/**
|
|
236
|
+
* A translation object which holds localized strings for internationalization
|
|
237
|
+
* purposes.
|
|
238
|
+
*/
|
|
114
239
|
t: Translation;
|
|
240
|
+
/**
|
|
241
|
+
* The chatbox instance itself.
|
|
242
|
+
*/
|
|
115
243
|
chatbox: Chatbox;
|
|
244
|
+
/**
|
|
245
|
+
* Arbitrary custom data passed down to the theme.
|
|
246
|
+
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* The data that you pass to {@link ChatboxProps.themeCustom} will show up
|
|
249
|
+
* here so that you can use it from within theme components.
|
|
250
|
+
*/
|
|
116
251
|
themeCustom?: any;
|
|
252
|
+
/**
|
|
253
|
+
* Describes the capabilities of the current device.
|
|
254
|
+
*/
|
|
117
255
|
device: DeviceFeatures;
|
|
256
|
+
/**
|
|
257
|
+
* The theme object that the chatbox's is currently using.
|
|
258
|
+
*/
|
|
118
259
|
theme: Theme;
|
|
260
|
+
/**
|
|
261
|
+
* The conversation displayed in the chatbox.
|
|
262
|
+
*/
|
|
119
263
|
conversation: ConversationSnapshot;
|
|
264
|
+
/**
|
|
265
|
+
* A list of participants that are part of the conversation that's currently
|
|
266
|
+
* being shown.
|
|
267
|
+
*/
|
|
120
268
|
participants: ParticipantSnapshot[];
|
|
269
|
+
/**
|
|
270
|
+
* Tells you which participants are currently typing
|
|
271
|
+
*/
|
|
121
272
|
typing: TypingSnapshot;
|
|
273
|
+
/**
|
|
274
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
275
|
+
*/
|
|
122
276
|
session: TalkSession;
|
|
123
277
|
}
|
|
124
278
|
|
|
279
|
+
/**
|
|
280
|
+
* A collection of props that's shared by every themed component used in the ConversationList UI.
|
|
281
|
+
*
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
125
284
|
export declare interface CommonConversationListProps {
|
|
126
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Holds information about your TalkJS app.
|
|
287
|
+
*/
|
|
288
|
+
app: App;
|
|
289
|
+
/**
|
|
290
|
+
* The user that mounted this chatbox.
|
|
291
|
+
*/
|
|
127
292
|
currentUser: UserSnapshot;
|
|
293
|
+
/**
|
|
294
|
+
* A translation object which holds localized strings for internationalization
|
|
295
|
+
* purposes.
|
|
296
|
+
*/
|
|
128
297
|
t: Translation;
|
|
298
|
+
/**
|
|
299
|
+
* Arbitrary custom data passed down to the theme.
|
|
300
|
+
*
|
|
301
|
+
* @remarks
|
|
302
|
+
* The data that you pass to {@link ConversationListProps.themeCustom} will show up
|
|
303
|
+
* here so that you can use it from within theme components.
|
|
304
|
+
*/
|
|
129
305
|
themeCustom?: any;
|
|
306
|
+
/**
|
|
307
|
+
* Describes the capabilities of the current device.
|
|
308
|
+
*/
|
|
130
309
|
device: DeviceFeatures;
|
|
310
|
+
/**
|
|
311
|
+
* The theme object that the chatbox's is currently using.
|
|
312
|
+
*/
|
|
131
313
|
theme: Theme;
|
|
314
|
+
/**
|
|
315
|
+
* The conversation list instance itself.
|
|
316
|
+
*/
|
|
132
317
|
conversationList: ConversationList;
|
|
318
|
+
/**
|
|
319
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
320
|
+
*/
|
|
133
321
|
session: TalkSession;
|
|
134
322
|
}
|
|
135
323
|
|
|
324
|
+
/**
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
136
327
|
export declare interface CompactMessageContentProps {
|
|
328
|
+
/**
|
|
329
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
330
|
+
* theme components.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
334
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
335
|
+
*/
|
|
137
336
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
337
|
+
/**
|
|
338
|
+
* The message that's being displayed.
|
|
339
|
+
*/
|
|
138
340
|
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
139
341
|
}
|
|
140
342
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
343
|
+
/**
|
|
344
|
+
* @public
|
|
345
|
+
*/
|
|
146
346
|
export declare interface ConversationImageProps {
|
|
347
|
+
/**
|
|
348
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
349
|
+
* theme components.
|
|
350
|
+
*
|
|
351
|
+
* @remarks
|
|
352
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
353
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
354
|
+
*/
|
|
147
355
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
356
|
+
/**
|
|
357
|
+
* The conversation that's being displayed.
|
|
358
|
+
*/
|
|
148
359
|
conversation: ConversationSnapshot;
|
|
360
|
+
/**
|
|
361
|
+
* A list of participants that are a part of the conversation.
|
|
362
|
+
*/
|
|
149
363
|
participants: ParticipantSnapshot[];
|
|
150
364
|
}
|
|
151
365
|
|
|
366
|
+
/**
|
|
367
|
+
* A collection of actions available on the ConversationList UI.
|
|
368
|
+
*
|
|
369
|
+
* @public
|
|
370
|
+
*/
|
|
152
371
|
export declare interface ConversationList {
|
|
372
|
+
/**
|
|
373
|
+
* Programatically select a conversation.
|
|
374
|
+
*
|
|
375
|
+
* @param conversationId
|
|
376
|
+
*
|
|
377
|
+
* @remarks
|
|
378
|
+
* Note that this **will not** trigger the
|
|
379
|
+
* {@linkcode ConversationListProps.onSelectConversation} callback.
|
|
380
|
+
*/
|
|
153
381
|
selectConversation(conversationId: string): void;
|
|
154
382
|
}
|
|
155
383
|
|
|
156
384
|
export declare interface ConversationListItemProps {
|
|
385
|
+
/**
|
|
386
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
387
|
+
*/
|
|
157
388
|
common: CommonConversationListProps;
|
|
389
|
+
/**
|
|
390
|
+
* The conversation that's being displayed.
|
|
391
|
+
*/
|
|
158
392
|
conversation: ConversationSnapshot;
|
|
393
|
+
/**
|
|
394
|
+
* The list of participants that are part of the given conversation.
|
|
395
|
+
*/
|
|
159
396
|
participants: ParticipantSnapshot[];
|
|
397
|
+
/**
|
|
398
|
+
* If `true`, this conversation is the currently selected one in the
|
|
399
|
+
* conversation list.
|
|
400
|
+
*/
|
|
160
401
|
isSelected: boolean;
|
|
161
402
|
}
|
|
162
403
|
|
|
163
404
|
export { ConversationSnapshot }
|
|
164
405
|
|
|
406
|
+
/**
|
|
407
|
+
* @public
|
|
408
|
+
*/
|
|
165
409
|
export declare interface Coordinates {
|
|
166
410
|
latitude: number;
|
|
167
411
|
longitude: number;
|
|
168
412
|
}
|
|
169
413
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
export declare function daysBetween(from: number, to: number): number;
|
|
176
|
-
|
|
177
|
-
export declare interface DeviceFeatures {
|
|
178
|
-
/**
|
|
179
|
-
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
180
|
-
*/
|
|
181
|
-
supportsEmojiPicker: boolean;
|
|
182
|
-
/**
|
|
183
|
-
* True if the user agents reports this device as mobile (incl tablets).
|
|
184
|
-
*/
|
|
185
|
-
isMobile: boolean;
|
|
186
|
-
}
|
|
187
|
-
|
|
414
|
+
/**
|
|
415
|
+
* Describes the capabilities of the current device.
|
|
416
|
+
*
|
|
417
|
+
* @public
|
|
418
|
+
*/
|
|
188
419
|
export declare interface DeviceFeatures {
|
|
189
420
|
/**
|
|
190
421
|
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
191
422
|
*/
|
|
192
423
|
supportsEmojiPicker: boolean;
|
|
193
424
|
/**
|
|
194
|
-
* True if the user agents reports
|
|
425
|
+
* True if the user agents reports the current device as a mobile/tablet.
|
|
195
426
|
*/
|
|
196
427
|
isMobile: boolean;
|
|
197
428
|
}
|
|
@@ -210,17 +441,50 @@ export declare interface EditorController {
|
|
|
210
441
|
toggleEmojiPicker(): void;
|
|
211
442
|
}
|
|
212
443
|
|
|
444
|
+
/**
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
213
447
|
export declare interface EditorProps {
|
|
448
|
+
/**
|
|
449
|
+
* The maximum allowed character length.
|
|
450
|
+
*
|
|
451
|
+
* @remarks
|
|
452
|
+
* The default is `10000`
|
|
453
|
+
*/
|
|
214
454
|
characterLimit?: number;
|
|
455
|
+
/**
|
|
456
|
+
* Determines if the Editor can be interacted with or not.
|
|
457
|
+
*/
|
|
215
458
|
disabled?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Placeholder text when the input is empty to encourage the user to write.
|
|
461
|
+
*
|
|
462
|
+
* @remarks
|
|
463
|
+
* The default is `"Say something..."`
|
|
464
|
+
*/
|
|
216
465
|
placeholder?: string;
|
|
217
|
-
|
|
466
|
+
/**
|
|
467
|
+
* If true, spell-checking is enabled.
|
|
468
|
+
*
|
|
469
|
+
* @remarks
|
|
470
|
+
* The default is `false`
|
|
471
|
+
*/
|
|
218
472
|
spellcheck?: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* @hidden
|
|
475
|
+
*/
|
|
476
|
+
className?: string;
|
|
219
477
|
}
|
|
220
478
|
|
|
221
479
|
export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
|
|
222
480
|
|
|
481
|
+
/**
|
|
482
|
+
* @public
|
|
483
|
+
*/
|
|
223
484
|
export declare interface EmojiPickerProps {
|
|
485
|
+
/**
|
|
486
|
+
* Display the emoji picker in light mode or dark mode.
|
|
487
|
+
*/
|
|
224
488
|
colorScheme: "light" | "dark";
|
|
225
489
|
}
|
|
226
490
|
|
|
@@ -231,54 +495,200 @@ export declare interface EmojiPickerProps {
|
|
|
231
495
|
*/
|
|
232
496
|
export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
|
|
233
497
|
|
|
498
|
+
/**
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
234
501
|
export declare interface EmojiSuggestBarProps {
|
|
235
502
|
}
|
|
236
503
|
|
|
237
504
|
export { FileBlock }
|
|
238
505
|
|
|
239
|
-
|
|
240
|
-
|
|
506
|
+
/**
|
|
507
|
+
* @public
|
|
508
|
+
*/
|
|
509
|
+
export declare interface FileBlockProps {
|
|
510
|
+
/**
|
|
511
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
512
|
+
*/
|
|
513
|
+
common: CommonChatboxProps;
|
|
514
|
+
/**
|
|
515
|
+
* The message that this content block belongs to.
|
|
516
|
+
*/
|
|
517
|
+
message: MessageSnapshot;
|
|
518
|
+
/**
|
|
519
|
+
* The generic file block to display.
|
|
520
|
+
*/
|
|
521
|
+
block: GenericFileBlock;
|
|
522
|
+
/**
|
|
523
|
+
* The URL used to download the file.
|
|
524
|
+
*
|
|
525
|
+
* @remarks
|
|
526
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
527
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
528
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
529
|
+
* the chat, which makes for a smoother user experience.
|
|
530
|
+
*
|
|
531
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
532
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
533
|
+
* while `block.url` will always be defined and should be used for preview
|
|
534
|
+
* purposes.
|
|
535
|
+
*/
|
|
241
536
|
downloadUrl?: string;
|
|
242
537
|
}
|
|
243
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
|
|
541
|
+
* format; whichever's shorter.
|
|
542
|
+
*
|
|
543
|
+
* @public
|
|
544
|
+
*/
|
|
244
545
|
export declare function formatDuration(seconds: number): string;
|
|
245
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Returns a human-readable filesize count.
|
|
549
|
+
*
|
|
550
|
+
* @public
|
|
551
|
+
*/
|
|
246
552
|
export declare function formatFilesize(bytes: number): string;
|
|
247
553
|
|
|
248
|
-
export
|
|
554
|
+
export { GenericFileBlock }
|
|
249
555
|
|
|
556
|
+
/**
|
|
557
|
+
* Given a coordinate, returns an `imageUrl` used to display a Google Maps
|
|
558
|
+
* preview image and a `linkUrl` which points to the given location on Google
|
|
559
|
+
* Maps.
|
|
560
|
+
*
|
|
561
|
+
* @public
|
|
562
|
+
*/
|
|
250
563
|
export declare function getGoogleMapsUrls({ latitude, longitude }: Coordinates): {
|
|
251
564
|
imageUrl: string;
|
|
252
565
|
linkUrl: string;
|
|
253
566
|
};
|
|
254
567
|
|
|
568
|
+
/**
|
|
569
|
+
* Returns the given user's `photoUrl` if available. If not, returns a `data:`
|
|
570
|
+
* URL of a fallback SVG which shows the user's initials.
|
|
571
|
+
*
|
|
572
|
+
* @public
|
|
573
|
+
*/
|
|
255
574
|
export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
|
|
256
575
|
|
|
576
|
+
/**
|
|
577
|
+
* Generates a random color in hex format.
|
|
578
|
+
*
|
|
579
|
+
* @public
|
|
580
|
+
*/
|
|
257
581
|
export declare function getRandomColor(id: string): string;
|
|
258
582
|
|
|
583
|
+
/**
|
|
584
|
+
* @public
|
|
585
|
+
*/
|
|
259
586
|
export declare interface GroupChatImageProps {
|
|
587
|
+
/**
|
|
588
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
589
|
+
* theme components.
|
|
590
|
+
*
|
|
591
|
+
* @remarks
|
|
592
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
593
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
594
|
+
*/
|
|
260
595
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
596
|
+
/**
|
|
597
|
+
* A list of participants that are a part of the conversation.
|
|
598
|
+
*/
|
|
261
599
|
participants: ParticipantSnapshot[];
|
|
262
600
|
}
|
|
263
601
|
|
|
264
|
-
|
|
602
|
+
/**
|
|
603
|
+
* Parses a JSX-like React string into a React element tree.
|
|
604
|
+
*
|
|
605
|
+
* @remarks
|
|
606
|
+
* Uses the {@link https://github.com/developit/htm | `htm`} library under the
|
|
607
|
+
* hood.
|
|
608
|
+
*
|
|
609
|
+
* @public
|
|
610
|
+
*
|
|
611
|
+
* @privateRemarks
|
|
612
|
+
* Adapted from:
|
|
613
|
+
* https://github.com/developit/htm/issues/175#issuecomment-773755560
|
|
614
|
+
*/
|
|
615
|
+
export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
|
|
265
616
|
|
|
617
|
+
/**
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
266
620
|
export declare interface IconProps {
|
|
621
|
+
/**
|
|
622
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
623
|
+
* theme components.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
627
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
628
|
+
*/
|
|
267
629
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
630
|
+
/**
|
|
631
|
+
* The name of the icon to display.
|
|
632
|
+
*/
|
|
268
633
|
type: "attach" | "chevronLeft" | "left" | "chevronRight" | "right" | "chevronUp" | "up" | "chevronDown" | "down" | "close" | "emoji" | "locationPin" | "more" | "plus" | "search" | "send" | "spinner" | "play" | "pause" | "updown" | "addEmoji" | "microphone" | "mic" | "stop" | "download" | "location" | "email" | "movie" | "image" | "attachment" | "horizontalDots" | "verticalDots" | "reply" | "back";
|
|
634
|
+
/**
|
|
635
|
+
* @hidden
|
|
636
|
+
*/
|
|
269
637
|
className?: string;
|
|
270
638
|
}
|
|
271
639
|
|
|
272
640
|
export { ImageBlock }
|
|
273
641
|
|
|
274
|
-
|
|
642
|
+
/**
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
export declare interface ImageBlockProps {
|
|
646
|
+
/**
|
|
647
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
648
|
+
*/
|
|
649
|
+
common: CommonChatboxProps;
|
|
650
|
+
/**
|
|
651
|
+
* The message that this content block belongs to.
|
|
652
|
+
*/
|
|
653
|
+
message: MessageSnapshot;
|
|
654
|
+
/**
|
|
655
|
+
* The image block to display.
|
|
656
|
+
*/
|
|
275
657
|
block: ImageBlock;
|
|
658
|
+
/**
|
|
659
|
+
* The URL used to download the file.
|
|
660
|
+
*
|
|
661
|
+
* @remarks
|
|
662
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
663
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
664
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
665
|
+
* the chat, which makes for a smoother user experience.
|
|
666
|
+
*
|
|
667
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
668
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
669
|
+
* while `block.url` will always be defined and should be used for preview
|
|
670
|
+
* purposes.
|
|
671
|
+
*/
|
|
276
672
|
downloadUrl?: string;
|
|
277
673
|
}
|
|
278
674
|
|
|
279
675
|
export { LocationBlock }
|
|
280
676
|
|
|
281
|
-
|
|
677
|
+
/**
|
|
678
|
+
* @public
|
|
679
|
+
*/
|
|
680
|
+
export declare interface LocationBlockProps {
|
|
681
|
+
/**
|
|
682
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
683
|
+
*/
|
|
684
|
+
common: CommonChatboxProps;
|
|
685
|
+
/**
|
|
686
|
+
* The message that this content block belongs to.
|
|
687
|
+
*/
|
|
688
|
+
message: MessageSnapshot;
|
|
689
|
+
/**
|
|
690
|
+
* The location block to display.
|
|
691
|
+
*/
|
|
282
692
|
block: LocationBlock;
|
|
283
693
|
}
|
|
284
694
|
|
|
@@ -288,73 +698,190 @@ export declare interface MentionSuggestList {
|
|
|
288
698
|
keydown(key: string): boolean;
|
|
289
699
|
}
|
|
290
700
|
|
|
701
|
+
/**
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
291
704
|
export declare interface MentionSuggestListProps {
|
|
292
705
|
}
|
|
293
706
|
|
|
294
707
|
export declare function MenuItem(props: MenuItemProps): JSX.Element;
|
|
295
708
|
|
|
296
|
-
|
|
709
|
+
/**
|
|
710
|
+
* @public
|
|
711
|
+
*/
|
|
712
|
+
export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
713
|
+
/**
|
|
714
|
+
* When a callback is passed, it will be called when the menu item is selected.
|
|
715
|
+
*/
|
|
297
716
|
onSelect?: () => void;
|
|
298
|
-
|
|
299
|
-
textValue?: string;
|
|
300
|
-
};
|
|
717
|
+
}
|
|
301
718
|
|
|
719
|
+
/**
|
|
720
|
+
* @public
|
|
721
|
+
*/
|
|
302
722
|
export declare interface MessageActionMenuProps {
|
|
723
|
+
/**
|
|
724
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
725
|
+
*/
|
|
303
726
|
common: CommonChatboxProps;
|
|
727
|
+
/**
|
|
728
|
+
* The message that's attached to the action menu.
|
|
729
|
+
*/
|
|
304
730
|
message: MessageSnapshot;
|
|
731
|
+
/**
|
|
732
|
+
* The current user's permissions relating to the given message.
|
|
733
|
+
*/
|
|
305
734
|
permissions: MessagePermissions;
|
|
306
735
|
}
|
|
307
736
|
|
|
308
737
|
export declare function MessageContent(props: MessageContentProps): JSX.Element;
|
|
309
738
|
|
|
739
|
+
/**
|
|
740
|
+
* @public
|
|
741
|
+
*/
|
|
310
742
|
export declare interface MessageContentProps {
|
|
743
|
+
/**
|
|
744
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
745
|
+
*/
|
|
311
746
|
common: CommonChatboxProps;
|
|
747
|
+
/**
|
|
748
|
+
* The message whose contents are being displayed
|
|
749
|
+
*/
|
|
312
750
|
message: MessageSnapshot;
|
|
751
|
+
/**
|
|
752
|
+
* The current status of the given message.
|
|
753
|
+
*/
|
|
313
754
|
messageStatus: MessageStatus;
|
|
755
|
+
/**
|
|
756
|
+
* @hidden
|
|
757
|
+
*/
|
|
314
758
|
className?: string;
|
|
315
759
|
}
|
|
316
760
|
|
|
761
|
+
/**
|
|
762
|
+
* @public
|
|
763
|
+
*/
|
|
317
764
|
export declare interface MessageDividerProps {
|
|
765
|
+
/**
|
|
766
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
767
|
+
*/
|
|
318
768
|
common: CommonChatboxProps;
|
|
769
|
+
/**
|
|
770
|
+
* If true, this divider separates unread messages from read ones.
|
|
771
|
+
*/
|
|
319
772
|
isReadMarker: boolean;
|
|
773
|
+
/**
|
|
774
|
+
* If true, this divider separates messages sent on two different dates.
|
|
775
|
+
*/
|
|
320
776
|
isDayMarker: boolean;
|
|
777
|
+
/**
|
|
778
|
+
* The date timestamp when {@link MessageDividerProps.isDayMarker} is `true`. Holds the number of
|
|
779
|
+
* milliseconds passed since the Unix Epoch.
|
|
780
|
+
*/
|
|
321
781
|
timestamp?: number;
|
|
322
782
|
}
|
|
323
783
|
|
|
784
|
+
/**
|
|
785
|
+
* @public
|
|
786
|
+
*/
|
|
324
787
|
export declare interface MessageFieldProps {
|
|
788
|
+
/**
|
|
789
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
790
|
+
*/
|
|
325
791
|
common: CommonChatboxProps;
|
|
792
|
+
/**
|
|
793
|
+
* The message that's currently being replied to, if any.
|
|
794
|
+
*/
|
|
326
795
|
referencedMessage: MessageSnapshot | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* The current user's permissions.
|
|
798
|
+
*/
|
|
327
799
|
permissions: UserPermissions;
|
|
800
|
+
/**
|
|
801
|
+
* An object holding the state of the message field.
|
|
802
|
+
*/
|
|
328
803
|
editor: EditorController;
|
|
804
|
+
/**
|
|
805
|
+
* When a message is being edited its ID will be stored here.
|
|
806
|
+
*/
|
|
329
807
|
editMessageId: string | undefined;
|
|
330
808
|
}
|
|
331
809
|
|
|
810
|
+
/**
|
|
811
|
+
* @public
|
|
812
|
+
*/
|
|
332
813
|
export declare interface MessageListFooterProps {
|
|
814
|
+
/**
|
|
815
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
816
|
+
*/
|
|
333
817
|
common: CommonChatboxProps;
|
|
334
818
|
}
|
|
335
819
|
|
|
820
|
+
/**
|
|
821
|
+
* A set of permissions the current user has for a given message.
|
|
822
|
+
*
|
|
823
|
+
* @remarks
|
|
824
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
825
|
+
*
|
|
826
|
+
* @public
|
|
827
|
+
*/
|
|
336
828
|
export declare interface MessagePermissions extends UserPermissions {
|
|
829
|
+
/**
|
|
830
|
+
* True if the user has the ability to delete the given message.
|
|
831
|
+
*/
|
|
337
832
|
canDeleteMessage: boolean;
|
|
833
|
+
/**
|
|
834
|
+
* True if the user has the ability to reply to the given message.
|
|
835
|
+
*/
|
|
338
836
|
canReplyToMessage: boolean;
|
|
837
|
+
/**
|
|
838
|
+
* True if the user has the ability to edit the given message.
|
|
839
|
+
*/
|
|
339
840
|
canEditMessage: boolean;
|
|
841
|
+
/**
|
|
842
|
+
* True if the user has the ability to add an {@link https://talkjs.com/docs/Features/Messages/Emojis/#emoji-reactions | emoji reaction} to the given message.
|
|
843
|
+
*/
|
|
340
844
|
canAddReaction: boolean;
|
|
341
845
|
}
|
|
342
846
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
canEditMessage: boolean;
|
|
347
|
-
}
|
|
348
|
-
|
|
847
|
+
/**
|
|
848
|
+
* @public
|
|
849
|
+
*/
|
|
349
850
|
export declare interface MessageProps {
|
|
851
|
+
/**
|
|
852
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
853
|
+
*/
|
|
350
854
|
common: CommonChatboxProps;
|
|
855
|
+
/**
|
|
856
|
+
* The message that's being displayed.
|
|
857
|
+
*/
|
|
351
858
|
message: MessageSnapshot;
|
|
859
|
+
/**
|
|
860
|
+
* The current status of the message.
|
|
861
|
+
*/
|
|
352
862
|
messageStatus: MessageStatus;
|
|
863
|
+
/**
|
|
864
|
+
* The current user's permissions relating to the given message.
|
|
865
|
+
*/
|
|
353
866
|
permissions: MessagePermissions;
|
|
354
867
|
}
|
|
355
868
|
|
|
356
869
|
export { MessageSnapshot }
|
|
357
870
|
|
|
871
|
+
/**
|
|
872
|
+
* The current status of the message.
|
|
873
|
+
*
|
|
874
|
+
* @remarks
|
|
875
|
+
* This type can have one of these values:
|
|
876
|
+
*
|
|
877
|
+
* - `"sending"` - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.
|
|
878
|
+
*
|
|
879
|
+
* - `"sent"` - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.
|
|
880
|
+
*
|
|
881
|
+
* - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
|
|
882
|
+
*
|
|
883
|
+
* @public
|
|
884
|
+
*/
|
|
358
885
|
export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
359
886
|
|
|
360
887
|
export { ParticipantSnapshot }
|
|
@@ -377,92 +904,203 @@ export { ParticipantSnapshot }
|
|
|
377
904
|
*/
|
|
378
905
|
export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
|
|
379
906
|
|
|
380
|
-
|
|
907
|
+
/**
|
|
908
|
+
* @public
|
|
909
|
+
*/
|
|
910
|
+
export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
|
|
911
|
+
/**
|
|
912
|
+
* Whether to display a menu or a popover when the button is clicked.
|
|
913
|
+
*
|
|
914
|
+
* @remarks
|
|
915
|
+
* Default value is `"popover"`.
|
|
916
|
+
*/
|
|
917
|
+
type?: "menu" | "popover";
|
|
918
|
+
/**
|
|
919
|
+
* The popover component to render in response to the button click.
|
|
920
|
+
*/
|
|
381
921
|
popoverComponent: React.ComponentType<T>;
|
|
922
|
+
/**
|
|
923
|
+
* Props passed to the popover component.
|
|
924
|
+
*/
|
|
382
925
|
popoverProps: T;
|
|
926
|
+
/**
|
|
927
|
+
* Children nodes rendered inside the button.
|
|
928
|
+
*/
|
|
383
929
|
children: React.ReactNode;
|
|
384
|
-
|
|
385
|
-
} & React.HTMLAttributes<HTMLButtonElement>;
|
|
930
|
+
}
|
|
386
931
|
|
|
387
|
-
export declare function ReactionPicker(
|
|
932
|
+
export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
|
|
388
933
|
|
|
389
|
-
|
|
934
|
+
/**
|
|
935
|
+
* @public
|
|
936
|
+
*/
|
|
937
|
+
export declare interface ReactionPickerProps {
|
|
938
|
+
/**
|
|
939
|
+
* The ID of the message that's being reacted to.
|
|
940
|
+
*/
|
|
390
941
|
messageId: string;
|
|
942
|
+
/**
|
|
943
|
+
* Display the emoji reaction picker in light mode or dark mode.
|
|
944
|
+
*/
|
|
391
945
|
colorScheme: "light" | "dark";
|
|
392
|
-
}
|
|
946
|
+
}
|
|
393
947
|
|
|
948
|
+
/**
|
|
949
|
+
* @public
|
|
950
|
+
*/
|
|
394
951
|
export declare interface ReferencedMessageProps {
|
|
952
|
+
/**
|
|
953
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
954
|
+
*/
|
|
395
955
|
common: CommonChatboxProps;
|
|
956
|
+
/**
|
|
957
|
+
* The message that's being referenced.
|
|
958
|
+
*/
|
|
396
959
|
referencedMessage: ReferencedMessageSnapshot;
|
|
397
960
|
}
|
|
398
961
|
|
|
399
962
|
export { ReferencedMessageSnapshot }
|
|
400
963
|
|
|
964
|
+
/**
|
|
965
|
+
* @public
|
|
966
|
+
*/
|
|
401
967
|
export declare interface ReplyBarProps {
|
|
968
|
+
/**
|
|
969
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
970
|
+
*/
|
|
402
971
|
common: CommonChatboxProps;
|
|
972
|
+
/**
|
|
973
|
+
* The message that's being replied to.
|
|
974
|
+
*/
|
|
403
975
|
referencedMessage: MessageSnapshot;
|
|
404
976
|
}
|
|
405
977
|
|
|
406
978
|
export { TalkSession }
|
|
407
979
|
|
|
408
|
-
declare function Text_2({ block, nonInteractive, className, }: TextProps): ReactElement;
|
|
980
|
+
declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
|
|
409
981
|
export { Text_2 as Text }
|
|
410
982
|
|
|
411
983
|
export { TextBlock }
|
|
412
984
|
|
|
413
|
-
|
|
985
|
+
/**
|
|
986
|
+
* @public
|
|
987
|
+
*/
|
|
988
|
+
export declare interface TextBlockProps {
|
|
989
|
+
/**
|
|
990
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
991
|
+
*/
|
|
992
|
+
common: CommonChatboxProps;
|
|
993
|
+
/**
|
|
994
|
+
* The message that this content block belongs to.
|
|
995
|
+
*/
|
|
996
|
+
message: MessageSnapshot;
|
|
997
|
+
/**
|
|
998
|
+
* The text block to display.
|
|
999
|
+
*/
|
|
414
1000
|
block: TextBlock;
|
|
415
1001
|
}
|
|
416
1002
|
|
|
1003
|
+
/**
|
|
1004
|
+
* @public
|
|
1005
|
+
*/
|
|
417
1006
|
export declare interface TextProps {
|
|
1007
|
+
/**
|
|
1008
|
+
* The block of formatted text to display.
|
|
1009
|
+
*/
|
|
418
1010
|
block: TextBlock;
|
|
419
|
-
|
|
1011
|
+
/**
|
|
1012
|
+
* If true, links and action buttons/links won't be rendered.
|
|
1013
|
+
*
|
|
1014
|
+
* @remarks
|
|
1015
|
+
* The default is `false`
|
|
1016
|
+
*/
|
|
420
1017
|
nonInteractive?: boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* @hidden
|
|
1020
|
+
*/
|
|
1021
|
+
className?: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* The message that this text block belongs to.
|
|
1024
|
+
*/
|
|
1025
|
+
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
421
1026
|
}
|
|
422
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* A theme can be used to customize the appearance & behavior of your TalkJS
|
|
1030
|
+
* Chatbox and/or ConversationList.
|
|
1031
|
+
*
|
|
1032
|
+
* @remarks
|
|
1033
|
+
* The implementation of TalkJS's default theme is open-source and
|
|
1034
|
+
* {@link https://github.com/talkjs/theme-default | available on Github. }
|
|
1035
|
+
*
|
|
1036
|
+
* @public
|
|
1037
|
+
*/
|
|
423
1038
|
export declare interface Theme {
|
|
424
|
-
Avatar:
|
|
425
|
-
ConversationImage:
|
|
426
|
-
GroupChatImage:
|
|
427
|
-
ReferencedMessage:
|
|
428
|
-
ReplyBar:
|
|
429
|
-
TimeAgo:
|
|
430
|
-
MessageActionMenu:
|
|
431
|
-
CompactMessageContent:
|
|
432
|
-
ChatHeader:
|
|
433
|
-
Message:
|
|
434
|
-
MessageField:
|
|
435
|
-
Icon:
|
|
436
|
-
MessageDivider:
|
|
437
|
-
MessageListFooter:
|
|
438
|
-
TextBlock:
|
|
439
|
-
FileBlock:
|
|
440
|
-
LocationBlock:
|
|
441
|
-
ImageBlock:
|
|
442
|
-
AudioBlock:
|
|
443
|
-
VoiceBlock:
|
|
444
|
-
VideoBlock:
|
|
445
|
-
ConversationListItem:
|
|
1039
|
+
Avatar: React.ComponentType<AvatarProps>;
|
|
1040
|
+
ConversationImage: React.ComponentType<ConversationImageProps>;
|
|
1041
|
+
GroupChatImage: React.ComponentType<GroupChatImageProps>;
|
|
1042
|
+
ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
|
|
1043
|
+
ReplyBar: React.ComponentType<ReplyBarProps>;
|
|
1044
|
+
TimeAgo: React.ComponentType<TimeAgoProps>;
|
|
1045
|
+
MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
|
|
1046
|
+
CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
|
|
1047
|
+
ChatHeader: React.ComponentType<ChatHeaderProps>;
|
|
1048
|
+
Message: React.ComponentType<MessageProps>;
|
|
1049
|
+
MessageField: React.ComponentType<MessageFieldProps>;
|
|
1050
|
+
Icon: React.ComponentType<IconProps>;
|
|
1051
|
+
MessageDivider: React.ComponentType<MessageDividerProps>;
|
|
1052
|
+
MessageListFooter: React.ComponentType<MessageListFooterProps>;
|
|
1053
|
+
TextBlock: React.ComponentType<TextBlockProps>;
|
|
1054
|
+
FileBlock: React.ComponentType<FileBlockProps>;
|
|
1055
|
+
LocationBlock: React.ComponentType<LocationBlockProps>;
|
|
1056
|
+
ImageBlock: React.ComponentType<ImageBlockProps>;
|
|
1057
|
+
AudioBlock: React.ComponentType<AudioBlockProps>;
|
|
1058
|
+
VoiceBlock: React.ComponentType<VoiceBlockProps>;
|
|
1059
|
+
VideoBlock: React.ComponentType<VideoBlockProps>;
|
|
1060
|
+
ConversationListItem: React.ComponentType<ConversationListItemProps>;
|
|
446
1061
|
}
|
|
447
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* An object describing a human-readable tim
|
|
1065
|
+
*
|
|
1066
|
+
* @public
|
|
1067
|
+
*/
|
|
448
1068
|
export declare interface TimeAgo {
|
|
449
1069
|
/**
|
|
450
|
-
* An amount of milliseconds after which the values in
|
|
1070
|
+
* An amount of milliseconds after which the values in {@link TimeAgo.long} and {@link TimeAgo.short} _may_ have changed.
|
|
451
1071
|
* If undefined, the values will not change within any meaningful period.
|
|
452
1072
|
*/
|
|
453
1073
|
changeTimeout?: number | undefined;
|
|
1074
|
+
/**
|
|
1075
|
+
* A precise time description containing the exact date and time.
|
|
1076
|
+
*/
|
|
454
1077
|
long: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* A short human-friendly time description, such as "2 minutes ago"
|
|
1080
|
+
*/
|
|
455
1081
|
short: string;
|
|
456
1082
|
}
|
|
457
1083
|
|
|
1084
|
+
/**
|
|
1085
|
+
* @public
|
|
1086
|
+
*/
|
|
458
1087
|
export declare interface TimeAgoProps {
|
|
1088
|
+
/**
|
|
1089
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1090
|
+
*/
|
|
459
1091
|
common: CommonChatboxProps;
|
|
1092
|
+
/**
|
|
1093
|
+
* The timestamp of when the message was sent. Holds the number of milliseconds passed since the Unix Epoch.
|
|
1094
|
+
*/
|
|
460
1095
|
timestamp: number;
|
|
461
1096
|
}
|
|
462
1097
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* Translation object
|
|
1100
|
+
*
|
|
1101
|
+
* @public
|
|
1102
|
+
*/
|
|
1103
|
+
export declare interface Translation extends TranslationStrings {
|
|
466
1104
|
locale: string;
|
|
467
1105
|
}
|
|
468
1106
|
|
|
@@ -526,38 +1164,61 @@ declare interface TranslationStrings {
|
|
|
526
1164
|
CONTACT_INFORMATION_HIDDEN: string;
|
|
527
1165
|
}
|
|
528
1166
|
|
|
529
|
-
/**
|
|
530
|
-
* Formats a time in the past in a twitter-like fashion.
|
|
531
|
-
*/
|
|
532
|
-
export declare function twitterAgo(now: number, ts: number, t: Translation): TimeAgo;
|
|
533
|
-
|
|
534
1167
|
export { TypingSnapshot }
|
|
535
1168
|
|
|
536
1169
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
1170
|
+
* Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
|
|
1171
|
+
* 2014", depending on which is most appropriate.
|
|
1172
|
+
*
|
|
1173
|
+
* @param timestamp The timestamp of the event in milliseconds since Unix epoch.
|
|
1174
|
+
* @param t Relevant translation object to get localized output
|
|
1175
|
+
*
|
|
1176
|
+
* @public
|
|
539
1177
|
*/
|
|
540
|
-
export declare function userFriendlyDate(
|
|
541
|
-
|
|
542
|
-
export declare interface UserPermissions {
|
|
543
|
-
showTypingIndicator: boolean;
|
|
544
|
-
canShareFile: boolean;
|
|
545
|
-
canShareLocation: boolean;
|
|
546
|
-
canMention: boolean;
|
|
547
|
-
showOnlineStatus: boolean;
|
|
548
|
-
canSendVoiceMessage: boolean;
|
|
549
|
-
canLeaveConversation: boolean;
|
|
550
|
-
canMarkConversationAsUnread: boolean;
|
|
551
|
-
}
|
|
1178
|
+
export declare function userFriendlyDate(timestamp: number, t: Translation): string;
|
|
552
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* A set of permissions for the current user.
|
|
1182
|
+
*
|
|
1183
|
+
* @remarks
|
|
1184
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
1185
|
+
*
|
|
1186
|
+
* @public
|
|
1187
|
+
*/
|
|
553
1188
|
export declare interface UserPermissions {
|
|
1189
|
+
/**
|
|
1190
|
+
* True if typing indicators are enabled.
|
|
1191
|
+
*/
|
|
554
1192
|
showTypingIndicator: boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/File_Sharing/ | file sharing} is enabled.
|
|
1195
|
+
*/
|
|
555
1196
|
canShareFile: boolean;
|
|
1197
|
+
/**
|
|
1198
|
+
* True if location sharing is enabled.
|
|
1199
|
+
*/
|
|
556
1200
|
canShareLocation: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
|
|
1203
|
+
*/
|
|
557
1204
|
canMention: boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* True if
|
|
1207
|
+
* {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
|
|
1208
|
+
* are enabled.
|
|
1209
|
+
*/
|
|
558
1210
|
showOnlineStatus: boolean;
|
|
1211
|
+
/**
|
|
1212
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Voice_Messages/ | voice messages} are enabled.
|
|
1213
|
+
*/
|
|
559
1214
|
canSendVoiceMessage: boolean;
|
|
1215
|
+
/**
|
|
1216
|
+
* True if the user has the permission to leave a given conversation.
|
|
1217
|
+
*/
|
|
560
1218
|
canLeaveConversation: boolean;
|
|
1219
|
+
/**
|
|
1220
|
+
* True if the user has the permission to mark the given conversation as unread.
|
|
1221
|
+
*/
|
|
561
1222
|
canMarkConversationAsUnread: boolean;
|
|
562
1223
|
}
|
|
563
1224
|
|
|
@@ -575,37 +1236,77 @@ export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
|
|
|
575
1236
|
|
|
576
1237
|
export { VideoBlock }
|
|
577
1238
|
|
|
578
|
-
|
|
1239
|
+
/**
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
export declare interface VideoBlockProps {
|
|
1243
|
+
/**
|
|
1244
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1245
|
+
*/
|
|
1246
|
+
common: CommonChatboxProps;
|
|
1247
|
+
/**
|
|
1248
|
+
* The message that this content block belongs to.
|
|
1249
|
+
*/
|
|
1250
|
+
message: MessageSnapshot;
|
|
1251
|
+
/**
|
|
1252
|
+
* The video block to display.
|
|
1253
|
+
*/
|
|
579
1254
|
block: VideoBlock;
|
|
1255
|
+
/**
|
|
1256
|
+
* The URL used to download the file.
|
|
1257
|
+
*
|
|
1258
|
+
* @remarks
|
|
1259
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1260
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1261
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1262
|
+
* the chat, which makes for a smoother user experience.
|
|
1263
|
+
*
|
|
1264
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1265
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1266
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1267
|
+
* purposes.
|
|
1268
|
+
*/
|
|
580
1269
|
downloadUrl?: string;
|
|
581
1270
|
}
|
|
582
1271
|
|
|
583
1272
|
export { VoiceBlock }
|
|
584
1273
|
|
|
585
|
-
|
|
1274
|
+
/**
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
export declare interface VoiceBlockProps {
|
|
1278
|
+
/**
|
|
1279
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1280
|
+
*/
|
|
1281
|
+
common: CommonChatboxProps;
|
|
1282
|
+
/**
|
|
1283
|
+
* The message that this content block belongs to.
|
|
1284
|
+
*/
|
|
1285
|
+
message: MessageSnapshot;
|
|
1286
|
+
/**
|
|
1287
|
+
* The voice block to display.
|
|
1288
|
+
*/
|
|
586
1289
|
block: VoiceBlock;
|
|
1290
|
+
/**
|
|
1291
|
+
* The URL used to download the file.
|
|
1292
|
+
*
|
|
1293
|
+
* @remarks
|
|
1294
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1295
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1296
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1297
|
+
* the chat, which makes for a smoother user experience.
|
|
1298
|
+
*
|
|
1299
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1300
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1301
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1302
|
+
* purposes.
|
|
1303
|
+
*/
|
|
587
1304
|
downloadUrl?: string;
|
|
588
1305
|
}
|
|
589
1306
|
|
|
590
1307
|
export { }
|
|
591
1308
|
|
|
592
1309
|
|
|
593
|
-
declare global {
|
|
594
|
-
namespace JSX {
|
|
595
|
-
interface IntrinsicElements {
|
|
596
|
-
"emoji-picker": {
|
|
597
|
-
class?: string;
|
|
598
|
-
ref: React.Ref<HTMLElement>;
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
interface HTMLElementEventMap {
|
|
603
|
-
"emoji-click": EmojiClickEvent;
|
|
604
|
-
"skin-tone-change": SkinToneChangeEvent;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
|
|
609
1310
|
declare global {
|
|
610
1311
|
interface HTMLElementTagNameMap {
|
|
611
1312
|
"t-chatbox": ChatboxHTMLElement;
|
|
@@ -613,13 +1314,3 @@ declare global {
|
|
|
613
1314
|
}
|
|
614
1315
|
}
|
|
615
1316
|
|
|
616
|
-
|
|
617
|
-
declare global {
|
|
618
|
-
namespace JSX {
|
|
619
|
-
interface IntrinsicElements {
|
|
620
|
-
"t-chatbox": typeof UnthemedChatbox;
|
|
621
|
-
"t-conversation-list": typeof UnthemedConversationList;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|