@talkjs/react-components 0.0.28 → 0.0.30
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/README.md +1 -1
- package/base.css +1 -1
- package/default.css +1 -1
- package/default.d.ts +1011 -166
- package/default.js +1787 -1617
- package/globalConstants.js +32 -40
- package/package.json +1 -1
- package/theming.d.ts +884 -158
- package/theming.js +1052 -952
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,364 @@ 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
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
149
|
+
export declare class ChatboxController {
|
|
150
|
+
#private;
|
|
151
|
+
/**
|
|
152
|
+
* Deletes the message with the given ID.
|
|
153
|
+
*
|
|
154
|
+
* @param messageId
|
|
155
|
+
*/
|
|
86
156
|
deleteMessage(messageId: string): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Enable/disable editing of a given message.
|
|
159
|
+
*
|
|
160
|
+
* @param messageId When `null` is provided, editing mode will be disabled
|
|
161
|
+
*/
|
|
87
162
|
setEditing(messageId: string | null): void;
|
|
163
|
+
/**
|
|
164
|
+
* Edit the message with the given ID.
|
|
165
|
+
*
|
|
166
|
+
* @param messageId
|
|
167
|
+
* @param params
|
|
168
|
+
*/
|
|
88
169
|
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Send a text message to the current conversation.
|
|
172
|
+
*
|
|
173
|
+
* @param params
|
|
174
|
+
*/
|
|
89
175
|
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
90
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Send a file message to the current conversation.
|
|
178
|
+
*
|
|
179
|
+
* @param message
|
|
180
|
+
*/
|
|
181
|
+
sendFileMessage(params: {
|
|
91
182
|
fileToken: FileToken;
|
|
92
183
|
custom?: Record<string, string>;
|
|
93
184
|
}): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Send a location message to the current conversation.
|
|
187
|
+
*
|
|
188
|
+
* @param message
|
|
189
|
+
*/
|
|
94
190
|
sendLocationMessage(message: {
|
|
95
191
|
location: Coordinates;
|
|
96
192
|
custom?: Record<string, string>;
|
|
97
193
|
}): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Set/unset the message that's currently being replied to.
|
|
196
|
+
*
|
|
197
|
+
* @param messageId - When `null` is provided, the "replying to" message is cleared
|
|
198
|
+
*/
|
|
98
199
|
setReferencedMessage(messageId: string | null): void;
|
|
99
|
-
|
|
100
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Toggle the given emoji reaction for the given message. If the current user
|
|
202
|
+
* already added this reaction, it's removed, and otherwise, it's added.
|
|
203
|
+
*
|
|
204
|
+
* Called from the theme's Message component when the user clicks on an
|
|
205
|
+
* existing emoji reaction.
|
|
206
|
+
*
|
|
207
|
+
* @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
|
|
208
|
+
* @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
|
|
209
|
+
*/
|
|
210
|
+
toggleReaction(messageId: string, emoji: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Get the plaintext from the message field
|
|
213
|
+
*
|
|
214
|
+
* @returns The text
|
|
215
|
+
*/
|
|
216
|
+
getMessageFieldText(): string;
|
|
217
|
+
/**
|
|
218
|
+
* Set the plaintext in the message field
|
|
219
|
+
* @param text
|
|
220
|
+
*/
|
|
221
|
+
setMessageFieldText(text: string): void;
|
|
222
|
+
/**
|
|
223
|
+
* Focus the message field
|
|
224
|
+
*/
|
|
225
|
+
focusMessageField(): void;
|
|
101
226
|
}
|
|
102
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
103
231
|
export declare interface ChatHeaderProps {
|
|
232
|
+
/**
|
|
233
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
234
|
+
*/
|
|
104
235
|
common: CommonChatboxProps;
|
|
236
|
+
/**
|
|
237
|
+
* A record of user IDs and their connection status.
|
|
238
|
+
*/
|
|
105
239
|
isUserConnected: {
|
|
106
240
|
[userId: string]: boolean;
|
|
107
241
|
};
|
|
242
|
+
/**
|
|
243
|
+
* The current user's permissions.
|
|
244
|
+
*/
|
|
108
245
|
permissions: UserPermissions;
|
|
109
246
|
}
|
|
110
247
|
|
|
248
|
+
/**
|
|
249
|
+
* A collection of props that's shared by every themed component used in the Chatbox UI.
|
|
250
|
+
*
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
111
253
|
export declare interface CommonChatboxProps {
|
|
112
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Holds information about your TalkJS app.
|
|
256
|
+
*/
|
|
257
|
+
app: App;
|
|
258
|
+
/**
|
|
259
|
+
* The user that mounted this chatbox.
|
|
260
|
+
*/
|
|
113
261
|
currentUser: UserSnapshot;
|
|
262
|
+
/**
|
|
263
|
+
* A translation object which holds localized strings for internationalization
|
|
264
|
+
* purposes.
|
|
265
|
+
*/
|
|
114
266
|
t: Translation;
|
|
115
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Public interface of the chatbox instance.
|
|
269
|
+
*/
|
|
270
|
+
chatbox: ChatboxController;
|
|
271
|
+
/**
|
|
272
|
+
* Arbitrary custom data passed down to the theme.
|
|
273
|
+
*
|
|
274
|
+
* @remarks
|
|
275
|
+
* The data that you pass to {@link ChatboxProps.themeCustom} will show up
|
|
276
|
+
* here so that you can use it from within theme components.
|
|
277
|
+
*/
|
|
116
278
|
themeCustom?: any;
|
|
279
|
+
/**
|
|
280
|
+
* Describes the capabilities of the current device.
|
|
281
|
+
*/
|
|
117
282
|
device: DeviceFeatures;
|
|
283
|
+
/**
|
|
284
|
+
* The theme object that the chatbox's is currently using.
|
|
285
|
+
*/
|
|
118
286
|
theme: Theme;
|
|
287
|
+
/**
|
|
288
|
+
* The conversation displayed in the chatbox.
|
|
289
|
+
*/
|
|
119
290
|
conversation: ConversationSnapshot;
|
|
291
|
+
/**
|
|
292
|
+
* A list of participants that are part of the conversation that's currently
|
|
293
|
+
* being shown.
|
|
294
|
+
*/
|
|
120
295
|
participants: ParticipantSnapshot[];
|
|
296
|
+
/**
|
|
297
|
+
* Tells you which participants are currently typing
|
|
298
|
+
*/
|
|
121
299
|
typing: TypingSnapshot;
|
|
300
|
+
/**
|
|
301
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
302
|
+
*/
|
|
122
303
|
session: TalkSession;
|
|
123
304
|
}
|
|
124
305
|
|
|
306
|
+
/**
|
|
307
|
+
* A collection of props that's shared by every themed component used in the ConversationList UI.
|
|
308
|
+
*
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
125
311
|
export declare interface CommonConversationListProps {
|
|
126
|
-
|
|
312
|
+
/**
|
|
313
|
+
* Holds information about your TalkJS app.
|
|
314
|
+
*/
|
|
315
|
+
app: App;
|
|
316
|
+
/**
|
|
317
|
+
* The user that mounted this chatbox.
|
|
318
|
+
*/
|
|
127
319
|
currentUser: UserSnapshot;
|
|
320
|
+
/**
|
|
321
|
+
* A translation object which holds localized strings for internationalization
|
|
322
|
+
* purposes.
|
|
323
|
+
*/
|
|
128
324
|
t: Translation;
|
|
325
|
+
/**
|
|
326
|
+
* Arbitrary custom data passed down to the theme.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
* The data that you pass to {@link ConversationListProps.themeCustom} will show up
|
|
330
|
+
* here so that you can use it from within theme components.
|
|
331
|
+
*/
|
|
129
332
|
themeCustom?: any;
|
|
333
|
+
/**
|
|
334
|
+
* Describes the capabilities of the current device.
|
|
335
|
+
*/
|
|
130
336
|
device: DeviceFeatures;
|
|
337
|
+
/**
|
|
338
|
+
* The theme object that the chatbox's is currently using.
|
|
339
|
+
*/
|
|
131
340
|
theme: Theme;
|
|
132
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Public interface of the conversation list instance.
|
|
343
|
+
*/
|
|
344
|
+
conversationList: ConversationListController;
|
|
345
|
+
/**
|
|
346
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
347
|
+
*/
|
|
133
348
|
session: TalkSession;
|
|
134
349
|
}
|
|
135
350
|
|
|
351
|
+
/**
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
136
354
|
export declare interface CompactMessageContentProps {
|
|
355
|
+
/**
|
|
356
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
357
|
+
* theme components.
|
|
358
|
+
*
|
|
359
|
+
* @remarks
|
|
360
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
361
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
362
|
+
*/
|
|
137
363
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
364
|
+
/**
|
|
365
|
+
* The message that's being displayed.
|
|
366
|
+
*/
|
|
138
367
|
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
139
368
|
}
|
|
140
369
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
370
|
+
/**
|
|
371
|
+
* @public
|
|
372
|
+
*/
|
|
146
373
|
export declare interface ConversationImageProps {
|
|
374
|
+
/**
|
|
375
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
376
|
+
* theme components.
|
|
377
|
+
*
|
|
378
|
+
* @remarks
|
|
379
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
380
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
381
|
+
*/
|
|
147
382
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
383
|
+
/**
|
|
384
|
+
* The conversation that's being displayed.
|
|
385
|
+
*/
|
|
148
386
|
conversation: ConversationSnapshot;
|
|
387
|
+
/**
|
|
388
|
+
* A list of participants that are a part of the conversation.
|
|
389
|
+
*/
|
|
149
390
|
participants: ParticipantSnapshot[];
|
|
150
391
|
}
|
|
151
392
|
|
|
152
|
-
|
|
393
|
+
/**
|
|
394
|
+
* A collection of actions available on the ConversationList UI.
|
|
395
|
+
*
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
export declare class ConversationListController {
|
|
399
|
+
#private;
|
|
400
|
+
/**
|
|
401
|
+
* Select a conversation.
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* This method is called from the theme's ConversationListItem component when
|
|
405
|
+
* the user clicks on the given conversation. You can also call it
|
|
406
|
+
* programmatically from elsewhere to simulate a user click.
|
|
407
|
+
*
|
|
408
|
+
* This method will trigger the
|
|
409
|
+
* {@linkcode ConversationListProps.onSelectConversation} event. In most
|
|
410
|
+
* cases, if you want to change the selected conversation programmatically
|
|
411
|
+
* from outside the conversation list, it's better to pass a different value
|
|
412
|
+
* to the {@linkcode ConversationListProps.selectedConversationId} prop
|
|
413
|
+
* instead, as that lets you keep your local state in sync with the props
|
|
414
|
+
* passed to the conversation list.
|
|
415
|
+
*/
|
|
153
416
|
selectConversation(conversationId: string): void;
|
|
154
417
|
}
|
|
155
418
|
|
|
156
419
|
export declare interface ConversationListItemProps {
|
|
420
|
+
/**
|
|
421
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
422
|
+
*/
|
|
157
423
|
common: CommonConversationListProps;
|
|
424
|
+
/**
|
|
425
|
+
* The conversation that's being displayed.
|
|
426
|
+
*/
|
|
158
427
|
conversation: ConversationSnapshot;
|
|
428
|
+
/**
|
|
429
|
+
* The list of participants that are part of the given conversation.
|
|
430
|
+
*/
|
|
159
431
|
participants: ParticipantSnapshot[];
|
|
432
|
+
/**
|
|
433
|
+
* If `true`, this conversation is the currently selected one in the
|
|
434
|
+
* conversation list.
|
|
435
|
+
*/
|
|
160
436
|
isSelected: boolean;
|
|
161
437
|
}
|
|
162
438
|
|
|
163
439
|
export { ConversationSnapshot }
|
|
164
440
|
|
|
441
|
+
/**
|
|
442
|
+
* @public
|
|
443
|
+
*/
|
|
165
444
|
export declare interface Coordinates {
|
|
166
445
|
latitude: number;
|
|
167
446
|
longitude: number;
|
|
168
447
|
}
|
|
169
448
|
|
|
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
|
-
|
|
449
|
+
/**
|
|
450
|
+
* Describes the capabilities of the current device.
|
|
451
|
+
*
|
|
452
|
+
* @public
|
|
453
|
+
*/
|
|
188
454
|
export declare interface DeviceFeatures {
|
|
189
455
|
/**
|
|
190
456
|
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
191
457
|
*/
|
|
192
458
|
supportsEmojiPicker: boolean;
|
|
193
459
|
/**
|
|
194
|
-
* True if the user agents reports
|
|
460
|
+
* True if the user agents reports the current device as a mobile/tablet.
|
|
195
461
|
*/
|
|
196
462
|
isMobile: boolean;
|
|
197
463
|
}
|
|
@@ -210,17 +476,50 @@ export declare interface EditorController {
|
|
|
210
476
|
toggleEmojiPicker(): void;
|
|
211
477
|
}
|
|
212
478
|
|
|
479
|
+
/**
|
|
480
|
+
* @public
|
|
481
|
+
*/
|
|
213
482
|
export declare interface EditorProps {
|
|
483
|
+
/**
|
|
484
|
+
* The maximum allowed character length.
|
|
485
|
+
*
|
|
486
|
+
* @remarks
|
|
487
|
+
* The default is `10000`
|
|
488
|
+
*/
|
|
214
489
|
characterLimit?: number;
|
|
490
|
+
/**
|
|
491
|
+
* Determines if the Editor can be interacted with or not.
|
|
492
|
+
*/
|
|
215
493
|
disabled?: boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Placeholder text when the input is empty to encourage the user to write.
|
|
496
|
+
*
|
|
497
|
+
* @remarks
|
|
498
|
+
* The default is `"Say something..."`
|
|
499
|
+
*/
|
|
216
500
|
placeholder?: string;
|
|
217
|
-
|
|
501
|
+
/**
|
|
502
|
+
* If true, spell-checking is enabled.
|
|
503
|
+
*
|
|
504
|
+
* @remarks
|
|
505
|
+
* The default is `false`
|
|
506
|
+
*/
|
|
218
507
|
spellcheck?: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* @hidden
|
|
510
|
+
*/
|
|
511
|
+
className?: string;
|
|
219
512
|
}
|
|
220
513
|
|
|
221
514
|
export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
|
|
222
515
|
|
|
516
|
+
/**
|
|
517
|
+
* @public
|
|
518
|
+
*/
|
|
223
519
|
export declare interface EmojiPickerProps {
|
|
520
|
+
/**
|
|
521
|
+
* Display the emoji picker in light mode or dark mode.
|
|
522
|
+
*/
|
|
224
523
|
colorScheme: "light" | "dark";
|
|
225
524
|
}
|
|
226
525
|
|
|
@@ -231,54 +530,200 @@ export declare interface EmojiPickerProps {
|
|
|
231
530
|
*/
|
|
232
531
|
export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
|
|
233
532
|
|
|
533
|
+
/**
|
|
534
|
+
* @public
|
|
535
|
+
*/
|
|
234
536
|
export declare interface EmojiSuggestBarProps {
|
|
235
537
|
}
|
|
236
538
|
|
|
237
539
|
export { FileBlock }
|
|
238
540
|
|
|
239
|
-
|
|
240
|
-
|
|
541
|
+
/**
|
|
542
|
+
* @public
|
|
543
|
+
*/
|
|
544
|
+
export declare interface FileBlockProps {
|
|
545
|
+
/**
|
|
546
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
547
|
+
*/
|
|
548
|
+
common: CommonChatboxProps;
|
|
549
|
+
/**
|
|
550
|
+
* The message that this content block belongs to.
|
|
551
|
+
*/
|
|
552
|
+
message: MessageSnapshot;
|
|
553
|
+
/**
|
|
554
|
+
* The generic file block to display.
|
|
555
|
+
*/
|
|
556
|
+
block: GenericFileBlock;
|
|
557
|
+
/**
|
|
558
|
+
* The URL used to download the file.
|
|
559
|
+
*
|
|
560
|
+
* @remarks
|
|
561
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
562
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
563
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
564
|
+
* the chat, which makes for a smoother user experience.
|
|
565
|
+
*
|
|
566
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
567
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
568
|
+
* while `block.url` will always be defined and should be used for preview
|
|
569
|
+
* purposes.
|
|
570
|
+
*/
|
|
241
571
|
downloadUrl?: string;
|
|
242
572
|
}
|
|
243
573
|
|
|
574
|
+
/**
|
|
575
|
+
* Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
|
|
576
|
+
* format; whichever's shorter.
|
|
577
|
+
*
|
|
578
|
+
* @public
|
|
579
|
+
*/
|
|
244
580
|
export declare function formatDuration(seconds: number): string;
|
|
245
581
|
|
|
582
|
+
/**
|
|
583
|
+
* Returns a human-readable filesize count.
|
|
584
|
+
*
|
|
585
|
+
* @public
|
|
586
|
+
*/
|
|
246
587
|
export declare function formatFilesize(bytes: number): string;
|
|
247
588
|
|
|
248
|
-
export
|
|
589
|
+
export { GenericFileBlock }
|
|
249
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Given a coordinate, returns an `imageUrl` used to display a Google Maps
|
|
593
|
+
* preview image and a `linkUrl` which points to the given location on Google
|
|
594
|
+
* Maps.
|
|
595
|
+
*
|
|
596
|
+
* @public
|
|
597
|
+
*/
|
|
250
598
|
export declare function getGoogleMapsUrls({ latitude, longitude }: Coordinates): {
|
|
251
599
|
imageUrl: string;
|
|
252
600
|
linkUrl: string;
|
|
253
601
|
};
|
|
254
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Returns the given user's `photoUrl` if available. If not, returns a `data:`
|
|
605
|
+
* URL of a fallback SVG which shows the user's initials.
|
|
606
|
+
*
|
|
607
|
+
* @public
|
|
608
|
+
*/
|
|
255
609
|
export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
|
|
256
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Generates a random color in hex format.
|
|
613
|
+
*
|
|
614
|
+
* @public
|
|
615
|
+
*/
|
|
257
616
|
export declare function getRandomColor(id: string): string;
|
|
258
617
|
|
|
618
|
+
/**
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
259
621
|
export declare interface GroupChatImageProps {
|
|
622
|
+
/**
|
|
623
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
624
|
+
* theme components.
|
|
625
|
+
*
|
|
626
|
+
* @remarks
|
|
627
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
628
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
629
|
+
*/
|
|
260
630
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
631
|
+
/**
|
|
632
|
+
* A list of participants that are a part of the conversation.
|
|
633
|
+
*/
|
|
261
634
|
participants: ParticipantSnapshot[];
|
|
262
635
|
}
|
|
263
636
|
|
|
264
|
-
|
|
637
|
+
/**
|
|
638
|
+
* Parses a JSX-like React string into a React element tree.
|
|
639
|
+
*
|
|
640
|
+
* @remarks
|
|
641
|
+
* Uses the {@link https://github.com/developit/htm | `htm`} library under the
|
|
642
|
+
* hood.
|
|
643
|
+
*
|
|
644
|
+
* @public
|
|
645
|
+
*
|
|
646
|
+
* @privateRemarks
|
|
647
|
+
* Adapted from:
|
|
648
|
+
* https://github.com/developit/htm/issues/175#issuecomment-773755560
|
|
649
|
+
*/
|
|
650
|
+
export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
|
|
265
651
|
|
|
652
|
+
/**
|
|
653
|
+
* @public
|
|
654
|
+
*/
|
|
266
655
|
export declare interface IconProps {
|
|
656
|
+
/**
|
|
657
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
658
|
+
* theme components.
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
662
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
663
|
+
*/
|
|
267
664
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
665
|
+
/**
|
|
666
|
+
* The name of the icon to display.
|
|
667
|
+
*/
|
|
268
668
|
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";
|
|
669
|
+
/**
|
|
670
|
+
* @hidden
|
|
671
|
+
*/
|
|
269
672
|
className?: string;
|
|
270
673
|
}
|
|
271
674
|
|
|
272
675
|
export { ImageBlock }
|
|
273
676
|
|
|
274
|
-
|
|
677
|
+
/**
|
|
678
|
+
* @public
|
|
679
|
+
*/
|
|
680
|
+
export declare interface ImageBlockProps {
|
|
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 image block to display.
|
|
691
|
+
*/
|
|
275
692
|
block: ImageBlock;
|
|
693
|
+
/**
|
|
694
|
+
* The URL used to download the file.
|
|
695
|
+
*
|
|
696
|
+
* @remarks
|
|
697
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
698
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
699
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
700
|
+
* the chat, which makes for a smoother user experience.
|
|
701
|
+
*
|
|
702
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
703
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
704
|
+
* while `block.url` will always be defined and should be used for preview
|
|
705
|
+
* purposes.
|
|
706
|
+
*/
|
|
276
707
|
downloadUrl?: string;
|
|
277
708
|
}
|
|
278
709
|
|
|
279
710
|
export { LocationBlock }
|
|
280
711
|
|
|
281
|
-
|
|
712
|
+
/**
|
|
713
|
+
* @public
|
|
714
|
+
*/
|
|
715
|
+
export declare interface LocationBlockProps {
|
|
716
|
+
/**
|
|
717
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
718
|
+
*/
|
|
719
|
+
common: CommonChatboxProps;
|
|
720
|
+
/**
|
|
721
|
+
* The message that this content block belongs to.
|
|
722
|
+
*/
|
|
723
|
+
message: MessageSnapshot;
|
|
724
|
+
/**
|
|
725
|
+
* The location block to display.
|
|
726
|
+
*/
|
|
282
727
|
block: LocationBlock;
|
|
283
728
|
}
|
|
284
729
|
|
|
@@ -288,73 +733,190 @@ export declare interface MentionSuggestList {
|
|
|
288
733
|
keydown(key: string): boolean;
|
|
289
734
|
}
|
|
290
735
|
|
|
736
|
+
/**
|
|
737
|
+
* @public
|
|
738
|
+
*/
|
|
291
739
|
export declare interface MentionSuggestListProps {
|
|
292
740
|
}
|
|
293
741
|
|
|
294
742
|
export declare function MenuItem(props: MenuItemProps): JSX.Element;
|
|
295
743
|
|
|
296
|
-
|
|
744
|
+
/**
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
748
|
+
/**
|
|
749
|
+
* When a callback is passed, it will be called when the menu item is selected.
|
|
750
|
+
*/
|
|
297
751
|
onSelect?: () => void;
|
|
298
|
-
|
|
299
|
-
textValue?: string;
|
|
300
|
-
};
|
|
752
|
+
}
|
|
301
753
|
|
|
754
|
+
/**
|
|
755
|
+
* @public
|
|
756
|
+
*/
|
|
302
757
|
export declare interface MessageActionMenuProps {
|
|
758
|
+
/**
|
|
759
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
760
|
+
*/
|
|
303
761
|
common: CommonChatboxProps;
|
|
762
|
+
/**
|
|
763
|
+
* The message that's attached to the action menu.
|
|
764
|
+
*/
|
|
304
765
|
message: MessageSnapshot;
|
|
766
|
+
/**
|
|
767
|
+
* The current user's permissions relating to the given message.
|
|
768
|
+
*/
|
|
305
769
|
permissions: MessagePermissions;
|
|
306
770
|
}
|
|
307
771
|
|
|
308
772
|
export declare function MessageContent(props: MessageContentProps): JSX.Element;
|
|
309
773
|
|
|
774
|
+
/**
|
|
775
|
+
* @public
|
|
776
|
+
*/
|
|
310
777
|
export declare interface MessageContentProps {
|
|
778
|
+
/**
|
|
779
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
780
|
+
*/
|
|
311
781
|
common: CommonChatboxProps;
|
|
782
|
+
/**
|
|
783
|
+
* The message whose contents are being displayed
|
|
784
|
+
*/
|
|
312
785
|
message: MessageSnapshot;
|
|
786
|
+
/**
|
|
787
|
+
* The current status of the given message.
|
|
788
|
+
*/
|
|
313
789
|
messageStatus: MessageStatus;
|
|
790
|
+
/**
|
|
791
|
+
* @hidden
|
|
792
|
+
*/
|
|
314
793
|
className?: string;
|
|
315
794
|
}
|
|
316
795
|
|
|
796
|
+
/**
|
|
797
|
+
* @public
|
|
798
|
+
*/
|
|
317
799
|
export declare interface MessageDividerProps {
|
|
800
|
+
/**
|
|
801
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
802
|
+
*/
|
|
318
803
|
common: CommonChatboxProps;
|
|
804
|
+
/**
|
|
805
|
+
* If true, this divider separates unread messages from read ones.
|
|
806
|
+
*/
|
|
319
807
|
isReadMarker: boolean;
|
|
808
|
+
/**
|
|
809
|
+
* If true, this divider separates messages sent on two different dates.
|
|
810
|
+
*/
|
|
320
811
|
isDayMarker: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* The date timestamp when {@link MessageDividerProps.isDayMarker} is `true`. Holds the number of
|
|
814
|
+
* milliseconds passed since the Unix Epoch.
|
|
815
|
+
*/
|
|
321
816
|
timestamp?: number;
|
|
322
817
|
}
|
|
323
818
|
|
|
819
|
+
/**
|
|
820
|
+
* @public
|
|
821
|
+
*/
|
|
324
822
|
export declare interface MessageFieldProps {
|
|
823
|
+
/**
|
|
824
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
825
|
+
*/
|
|
325
826
|
common: CommonChatboxProps;
|
|
827
|
+
/**
|
|
828
|
+
* The message that's currently being replied to, if any.
|
|
829
|
+
*/
|
|
326
830
|
referencedMessage: MessageSnapshot | undefined;
|
|
831
|
+
/**
|
|
832
|
+
* The current user's permissions.
|
|
833
|
+
*/
|
|
327
834
|
permissions: UserPermissions;
|
|
835
|
+
/**
|
|
836
|
+
* An object holding the state of the message field.
|
|
837
|
+
*/
|
|
328
838
|
editor: EditorController;
|
|
839
|
+
/**
|
|
840
|
+
* When a message is being edited its ID will be stored here.
|
|
841
|
+
*/
|
|
329
842
|
editMessageId: string | undefined;
|
|
330
843
|
}
|
|
331
844
|
|
|
845
|
+
/**
|
|
846
|
+
* @public
|
|
847
|
+
*/
|
|
332
848
|
export declare interface MessageListFooterProps {
|
|
849
|
+
/**
|
|
850
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
851
|
+
*/
|
|
333
852
|
common: CommonChatboxProps;
|
|
334
853
|
}
|
|
335
854
|
|
|
855
|
+
/**
|
|
856
|
+
* A set of permissions the current user has for a given message.
|
|
857
|
+
*
|
|
858
|
+
* @remarks
|
|
859
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
860
|
+
*
|
|
861
|
+
* @public
|
|
862
|
+
*/
|
|
336
863
|
export declare interface MessagePermissions extends UserPermissions {
|
|
864
|
+
/**
|
|
865
|
+
* True if the user has the ability to delete the given message.
|
|
866
|
+
*/
|
|
337
867
|
canDeleteMessage: boolean;
|
|
868
|
+
/**
|
|
869
|
+
* True if the user has the ability to reply to the given message.
|
|
870
|
+
*/
|
|
338
871
|
canReplyToMessage: boolean;
|
|
872
|
+
/**
|
|
873
|
+
* True if the user has the ability to edit the given message.
|
|
874
|
+
*/
|
|
339
875
|
canEditMessage: boolean;
|
|
876
|
+
/**
|
|
877
|
+
* 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.
|
|
878
|
+
*/
|
|
340
879
|
canAddReaction: boolean;
|
|
341
880
|
}
|
|
342
881
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
canEditMessage: boolean;
|
|
347
|
-
}
|
|
348
|
-
|
|
882
|
+
/**
|
|
883
|
+
* @public
|
|
884
|
+
*/
|
|
349
885
|
export declare interface MessageProps {
|
|
886
|
+
/**
|
|
887
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
888
|
+
*/
|
|
350
889
|
common: CommonChatboxProps;
|
|
890
|
+
/**
|
|
891
|
+
* The message that's being displayed.
|
|
892
|
+
*/
|
|
351
893
|
message: MessageSnapshot;
|
|
894
|
+
/**
|
|
895
|
+
* The current status of the message.
|
|
896
|
+
*/
|
|
352
897
|
messageStatus: MessageStatus;
|
|
898
|
+
/**
|
|
899
|
+
* The current user's permissions relating to the given message.
|
|
900
|
+
*/
|
|
353
901
|
permissions: MessagePermissions;
|
|
354
902
|
}
|
|
355
903
|
|
|
356
904
|
export { MessageSnapshot }
|
|
357
905
|
|
|
906
|
+
/**
|
|
907
|
+
* The current status of the message.
|
|
908
|
+
*
|
|
909
|
+
* @remarks
|
|
910
|
+
* This type can have one of these values:
|
|
911
|
+
*
|
|
912
|
+
* - `"sending"` - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.
|
|
913
|
+
*
|
|
914
|
+
* - `"sent"` - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.
|
|
915
|
+
*
|
|
916
|
+
* - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
|
|
917
|
+
*
|
|
918
|
+
* @public
|
|
919
|
+
*/
|
|
358
920
|
export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
359
921
|
|
|
360
922
|
export { ParticipantSnapshot }
|
|
@@ -377,92 +939,203 @@ export { ParticipantSnapshot }
|
|
|
377
939
|
*/
|
|
378
940
|
export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
|
|
379
941
|
|
|
380
|
-
|
|
942
|
+
/**
|
|
943
|
+
* @public
|
|
944
|
+
*/
|
|
945
|
+
export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
|
|
946
|
+
/**
|
|
947
|
+
* Whether to display a menu or a popover when the button is clicked.
|
|
948
|
+
*
|
|
949
|
+
* @remarks
|
|
950
|
+
* Default value is `"popover"`.
|
|
951
|
+
*/
|
|
952
|
+
type?: "menu" | "popover";
|
|
953
|
+
/**
|
|
954
|
+
* The popover component to render in response to the button click.
|
|
955
|
+
*/
|
|
381
956
|
popoverComponent: React.ComponentType<T>;
|
|
957
|
+
/**
|
|
958
|
+
* Props passed to the popover component.
|
|
959
|
+
*/
|
|
382
960
|
popoverProps: T;
|
|
961
|
+
/**
|
|
962
|
+
* Children nodes rendered inside the button.
|
|
963
|
+
*/
|
|
383
964
|
children: React.ReactNode;
|
|
384
|
-
|
|
385
|
-
} & React.HTMLAttributes<HTMLButtonElement>;
|
|
965
|
+
}
|
|
386
966
|
|
|
387
|
-
export declare function ReactionPicker(
|
|
967
|
+
export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
|
|
388
968
|
|
|
389
|
-
|
|
969
|
+
/**
|
|
970
|
+
* @public
|
|
971
|
+
*/
|
|
972
|
+
export declare interface ReactionPickerProps {
|
|
973
|
+
/**
|
|
974
|
+
* The ID of the message that's being reacted to.
|
|
975
|
+
*/
|
|
390
976
|
messageId: string;
|
|
977
|
+
/**
|
|
978
|
+
* Display the emoji reaction picker in light mode or dark mode.
|
|
979
|
+
*/
|
|
391
980
|
colorScheme: "light" | "dark";
|
|
392
|
-
}
|
|
981
|
+
}
|
|
393
982
|
|
|
983
|
+
/**
|
|
984
|
+
* @public
|
|
985
|
+
*/
|
|
394
986
|
export declare interface ReferencedMessageProps {
|
|
987
|
+
/**
|
|
988
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
989
|
+
*/
|
|
395
990
|
common: CommonChatboxProps;
|
|
991
|
+
/**
|
|
992
|
+
* The message that's being referenced.
|
|
993
|
+
*/
|
|
396
994
|
referencedMessage: ReferencedMessageSnapshot;
|
|
397
995
|
}
|
|
398
996
|
|
|
399
997
|
export { ReferencedMessageSnapshot }
|
|
400
998
|
|
|
999
|
+
/**
|
|
1000
|
+
* @public
|
|
1001
|
+
*/
|
|
401
1002
|
export declare interface ReplyBarProps {
|
|
1003
|
+
/**
|
|
1004
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1005
|
+
*/
|
|
402
1006
|
common: CommonChatboxProps;
|
|
1007
|
+
/**
|
|
1008
|
+
* The message that's being replied to.
|
|
1009
|
+
*/
|
|
403
1010
|
referencedMessage: MessageSnapshot;
|
|
404
1011
|
}
|
|
405
1012
|
|
|
406
1013
|
export { TalkSession }
|
|
407
1014
|
|
|
408
|
-
declare function Text_2({ block, nonInteractive, className, }: TextProps): ReactElement;
|
|
1015
|
+
declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
|
|
409
1016
|
export { Text_2 as Text }
|
|
410
1017
|
|
|
411
1018
|
export { TextBlock }
|
|
412
1019
|
|
|
413
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* @public
|
|
1022
|
+
*/
|
|
1023
|
+
export declare interface TextBlockProps {
|
|
1024
|
+
/**
|
|
1025
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1026
|
+
*/
|
|
1027
|
+
common: CommonChatboxProps;
|
|
1028
|
+
/**
|
|
1029
|
+
* The message that this content block belongs to.
|
|
1030
|
+
*/
|
|
1031
|
+
message: MessageSnapshot;
|
|
1032
|
+
/**
|
|
1033
|
+
* The text block to display.
|
|
1034
|
+
*/
|
|
414
1035
|
block: TextBlock;
|
|
415
1036
|
}
|
|
416
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* @public
|
|
1040
|
+
*/
|
|
417
1041
|
export declare interface TextProps {
|
|
1042
|
+
/**
|
|
1043
|
+
* The block of formatted text to display.
|
|
1044
|
+
*/
|
|
418
1045
|
block: TextBlock;
|
|
419
|
-
|
|
1046
|
+
/**
|
|
1047
|
+
* If true, links and action buttons/links won't be rendered.
|
|
1048
|
+
*
|
|
1049
|
+
* @remarks
|
|
1050
|
+
* The default is `false`
|
|
1051
|
+
*/
|
|
420
1052
|
nonInteractive?: boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* @hidden
|
|
1055
|
+
*/
|
|
1056
|
+
className?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* The message that this text block belongs to.
|
|
1059
|
+
*/
|
|
1060
|
+
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
421
1061
|
}
|
|
422
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* A theme can be used to customize the appearance & behavior of your TalkJS
|
|
1065
|
+
* Chatbox and/or ConversationList.
|
|
1066
|
+
*
|
|
1067
|
+
* @remarks
|
|
1068
|
+
* The implementation of TalkJS's default theme is open-source and
|
|
1069
|
+
* {@link https://github.com/talkjs/theme-default | available on Github. }
|
|
1070
|
+
*
|
|
1071
|
+
* @public
|
|
1072
|
+
*/
|
|
423
1073
|
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:
|
|
1074
|
+
Avatar: React.ComponentType<AvatarProps>;
|
|
1075
|
+
ConversationImage: React.ComponentType<ConversationImageProps>;
|
|
1076
|
+
GroupChatImage: React.ComponentType<GroupChatImageProps>;
|
|
1077
|
+
ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
|
|
1078
|
+
ReplyBar: React.ComponentType<ReplyBarProps>;
|
|
1079
|
+
TimeAgo: React.ComponentType<TimeAgoProps>;
|
|
1080
|
+
MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
|
|
1081
|
+
CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
|
|
1082
|
+
ChatHeader: React.ComponentType<ChatHeaderProps>;
|
|
1083
|
+
Message: React.ComponentType<MessageProps>;
|
|
1084
|
+
MessageField: React.ComponentType<MessageFieldProps>;
|
|
1085
|
+
Icon: React.ComponentType<IconProps>;
|
|
1086
|
+
MessageDivider: React.ComponentType<MessageDividerProps>;
|
|
1087
|
+
MessageListFooter: React.ComponentType<MessageListFooterProps>;
|
|
1088
|
+
TextBlock: React.ComponentType<TextBlockProps>;
|
|
1089
|
+
FileBlock: React.ComponentType<FileBlockProps>;
|
|
1090
|
+
LocationBlock: React.ComponentType<LocationBlockProps>;
|
|
1091
|
+
ImageBlock: React.ComponentType<ImageBlockProps>;
|
|
1092
|
+
AudioBlock: React.ComponentType<AudioBlockProps>;
|
|
1093
|
+
VoiceBlock: React.ComponentType<VoiceBlockProps>;
|
|
1094
|
+
VideoBlock: React.ComponentType<VideoBlockProps>;
|
|
1095
|
+
ConversationListItem: React.ComponentType<ConversationListItemProps>;
|
|
446
1096
|
}
|
|
447
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* An object describing a human-readable tim
|
|
1100
|
+
*
|
|
1101
|
+
* @public
|
|
1102
|
+
*/
|
|
448
1103
|
export declare interface TimeAgo {
|
|
449
1104
|
/**
|
|
450
|
-
* An amount of milliseconds after which the values in
|
|
1105
|
+
* An amount of milliseconds after which the values in {@link TimeAgo.long} and {@link TimeAgo.short} _may_ have changed.
|
|
451
1106
|
* If undefined, the values will not change within any meaningful period.
|
|
452
1107
|
*/
|
|
453
1108
|
changeTimeout?: number | undefined;
|
|
1109
|
+
/**
|
|
1110
|
+
* A precise time description containing the exact date and time.
|
|
1111
|
+
*/
|
|
454
1112
|
long: string;
|
|
1113
|
+
/**
|
|
1114
|
+
* A short human-friendly time description, such as "2 minutes ago"
|
|
1115
|
+
*/
|
|
455
1116
|
short: string;
|
|
456
1117
|
}
|
|
457
1118
|
|
|
1119
|
+
/**
|
|
1120
|
+
* @public
|
|
1121
|
+
*/
|
|
458
1122
|
export declare interface TimeAgoProps {
|
|
1123
|
+
/**
|
|
1124
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1125
|
+
*/
|
|
459
1126
|
common: CommonChatboxProps;
|
|
1127
|
+
/**
|
|
1128
|
+
* The timestamp of when the message was sent. Holds the number of milliseconds passed since the Unix Epoch.
|
|
1129
|
+
*/
|
|
460
1130
|
timestamp: number;
|
|
461
1131
|
}
|
|
462
1132
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
1133
|
+
/**
|
|
1134
|
+
* Translation object
|
|
1135
|
+
*
|
|
1136
|
+
* @public
|
|
1137
|
+
*/
|
|
1138
|
+
export declare interface Translation extends TranslationStrings {
|
|
466
1139
|
locale: string;
|
|
467
1140
|
}
|
|
468
1141
|
|
|
@@ -526,38 +1199,61 @@ declare interface TranslationStrings {
|
|
|
526
1199
|
CONTACT_INFORMATION_HIDDEN: string;
|
|
527
1200
|
}
|
|
528
1201
|
|
|
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
1202
|
export { TypingSnapshot }
|
|
535
1203
|
|
|
536
1204
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
1205
|
+
* Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
|
|
1206
|
+
* 2014", depending on which is most appropriate.
|
|
1207
|
+
*
|
|
1208
|
+
* @param timestamp The timestamp of the event in milliseconds since Unix epoch.
|
|
1209
|
+
* @param t Relevant translation object to get localized output
|
|
1210
|
+
*
|
|
1211
|
+
* @public
|
|
539
1212
|
*/
|
|
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
|
-
}
|
|
1213
|
+
export declare function userFriendlyDate(timestamp: number, t: Translation): string;
|
|
552
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* A set of permissions for the current user.
|
|
1217
|
+
*
|
|
1218
|
+
* @remarks
|
|
1219
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
1220
|
+
*
|
|
1221
|
+
* @public
|
|
1222
|
+
*/
|
|
553
1223
|
export declare interface UserPermissions {
|
|
1224
|
+
/**
|
|
1225
|
+
* True if typing indicators are enabled.
|
|
1226
|
+
*/
|
|
554
1227
|
showTypingIndicator: boolean;
|
|
1228
|
+
/**
|
|
1229
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/File_Sharing/ | file sharing} is enabled.
|
|
1230
|
+
*/
|
|
555
1231
|
canShareFile: boolean;
|
|
1232
|
+
/**
|
|
1233
|
+
* True if location sharing is enabled.
|
|
1234
|
+
*/
|
|
556
1235
|
canShareLocation: boolean;
|
|
1236
|
+
/**
|
|
1237
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
|
|
1238
|
+
*/
|
|
557
1239
|
canMention: boolean;
|
|
1240
|
+
/**
|
|
1241
|
+
* True if
|
|
1242
|
+
* {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
|
|
1243
|
+
* are enabled.
|
|
1244
|
+
*/
|
|
558
1245
|
showOnlineStatus: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Voice_Messages/ | voice messages} are enabled.
|
|
1248
|
+
*/
|
|
559
1249
|
canSendVoiceMessage: boolean;
|
|
1250
|
+
/**
|
|
1251
|
+
* True if the user has the permission to leave a given conversation.
|
|
1252
|
+
*/
|
|
560
1253
|
canLeaveConversation: boolean;
|
|
1254
|
+
/**
|
|
1255
|
+
* True if the user has the permission to mark the given conversation as unread.
|
|
1256
|
+
*/
|
|
561
1257
|
canMarkConversationAsUnread: boolean;
|
|
562
1258
|
}
|
|
563
1259
|
|
|
@@ -575,51 +1271,81 @@ export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
|
|
|
575
1271
|
|
|
576
1272
|
export { VideoBlock }
|
|
577
1273
|
|
|
578
|
-
|
|
1274
|
+
/**
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
export declare interface VideoBlockProps {
|
|
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 video block to display.
|
|
1288
|
+
*/
|
|
579
1289
|
block: VideoBlock;
|
|
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
|
+
*/
|
|
580
1304
|
downloadUrl?: string;
|
|
581
1305
|
}
|
|
582
1306
|
|
|
583
1307
|
export { VoiceBlock }
|
|
584
1308
|
|
|
585
|
-
|
|
1309
|
+
/**
|
|
1310
|
+
* @public
|
|
1311
|
+
*/
|
|
1312
|
+
export declare interface VoiceBlockProps {
|
|
1313
|
+
/**
|
|
1314
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1315
|
+
*/
|
|
1316
|
+
common: CommonChatboxProps;
|
|
1317
|
+
/**
|
|
1318
|
+
* The message that this content block belongs to.
|
|
1319
|
+
*/
|
|
1320
|
+
message: MessageSnapshot;
|
|
1321
|
+
/**
|
|
1322
|
+
* The voice block to display.
|
|
1323
|
+
*/
|
|
586
1324
|
block: VoiceBlock;
|
|
1325
|
+
/**
|
|
1326
|
+
* The URL used to download the file.
|
|
1327
|
+
*
|
|
1328
|
+
* @remarks
|
|
1329
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1330
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1331
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1332
|
+
* the chat, which makes for a smoother user experience.
|
|
1333
|
+
*
|
|
1334
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1335
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1336
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1337
|
+
* purposes.
|
|
1338
|
+
*/
|
|
587
1339
|
downloadUrl?: string;
|
|
588
1340
|
}
|
|
589
1341
|
|
|
590
1342
|
export { }
|
|
591
1343
|
|
|
592
1344
|
|
|
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
1345
|
declare global {
|
|
610
1346
|
interface HTMLElementTagNameMap {
|
|
611
|
-
"t-chatbox":
|
|
612
|
-
"t-conversation-list":
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
declare global {
|
|
618
|
-
namespace JSX {
|
|
619
|
-
interface IntrinsicElements {
|
|
620
|
-
"t-chatbox": typeof UnthemedChatbox;
|
|
621
|
-
"t-conversation-list": typeof UnthemedConversationList;
|
|
622
|
-
}
|
|
1347
|
+
"t-chatbox": ChatboxElement;
|
|
1348
|
+
"t-conversation-list": ConversationListElement;
|
|
623
1349
|
}
|
|
624
1350
|
}
|
|
625
1351
|
|