@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/default.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { AudioBlock } from '@talkjs/core';
|
|
2
2
|
import { ConversationSnapshot } from '@talkjs/core';
|
|
3
|
-
import { CSSProperties } from 'react';
|
|
4
3
|
import { EditMessageParams } from '@talkjs/core';
|
|
5
4
|
import { EditTextMessageParams } from '@talkjs/core';
|
|
6
|
-
import { FileBlock } from '@talkjs/core';
|
|
7
5
|
import { FileToken } from '@talkjs/core';
|
|
8
|
-
import {
|
|
6
|
+
import { GenericFileBlock } from '@talkjs/core';
|
|
9
7
|
import { ImageBlock } from '@talkjs/core';
|
|
10
8
|
import { LocationBlock } from '@talkjs/core';
|
|
11
9
|
import { MessageSnapshot } from '@talkjs/core';
|
|
12
10
|
import { ParticipantSnapshot } from '@talkjs/core';
|
|
13
|
-
import type * as
|
|
14
|
-
import { RefAttributes } from 'react';
|
|
11
|
+
import type * as React from 'react';
|
|
15
12
|
import { ReferencedMessageSnapshot } from '@talkjs/core';
|
|
16
13
|
import { SendMessageParams } from '@talkjs/core';
|
|
17
14
|
import { SendTextMessageParams } from '@talkjs/core';
|
|
@@ -22,58 +19,103 @@ import { UserSnapshot } from '@talkjs/core';
|
|
|
22
19
|
import { VideoBlock } from '@talkjs/core';
|
|
23
20
|
import { VoiceBlock } from '@talkjs/core';
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Holds information about your TalkJS app.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare interface App {
|
|
28
|
+
/**
|
|
29
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
30
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* The name of your app.
|
|
35
|
+
*/
|
|
29
36
|
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* The default locale.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* This can be configured from your TalkJS dashboard.
|
|
42
|
+
*/
|
|
30
43
|
defaultLocale: string;
|
|
44
|
+
/**
|
|
45
|
+
* Custom data set for this app.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* This can be configured from your TalkJS dashboard.
|
|
49
|
+
*/
|
|
31
50
|
custom: Record<string, string>;
|
|
32
51
|
}
|
|
33
52
|
|
|
34
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
declare interface AudioBlockProps {
|
|
57
|
+
/**
|
|
58
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
59
|
+
*/
|
|
60
|
+
common: CommonChatboxProps;
|
|
61
|
+
/**
|
|
62
|
+
* The message that this content block belongs to.
|
|
63
|
+
*/
|
|
64
|
+
message: MessageSnapshot;
|
|
65
|
+
/**
|
|
66
|
+
* The audio block to display.
|
|
67
|
+
*/
|
|
35
68
|
block: AudioBlock;
|
|
69
|
+
/**
|
|
70
|
+
* The URL used to download the file.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
74
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
75
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
76
|
+
* the chat, which makes for a smoother user experience.
|
|
77
|
+
*
|
|
78
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
79
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
80
|
+
* while `block.url` will always be defined and should be used for preview
|
|
81
|
+
* purposes.
|
|
82
|
+
*/
|
|
36
83
|
downloadUrl?: string;
|
|
37
84
|
}
|
|
38
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
39
89
|
declare interface AvatarProps {
|
|
90
|
+
/**
|
|
91
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
92
|
+
* theme components.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
96
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
97
|
+
*/
|
|
40
98
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
99
|
+
/**
|
|
100
|
+
* The URL of the image that's to be displayed.
|
|
101
|
+
*/
|
|
41
102
|
photoUrl: string;
|
|
42
103
|
}
|
|
43
104
|
|
|
44
105
|
/**
|
|
45
|
-
* Brands a base type `T`.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* type UserId = Brand<string, "UserId">;
|
|
50
|
-
* type MessageId = Brand<string, "MessageId">;
|
|
51
|
-
*
|
|
52
|
-
* const a: UserId = "abc" as UserId; // works
|
|
53
|
-
* const b: UserId = "abc"; // error
|
|
54
|
-
* const c: UserId = "abc" as MessageId; // error
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
declare type Brand<T, B extends string> = T & Branding<B>;
|
|
58
|
-
|
|
59
|
-
declare interface Branding<B extends string> {
|
|
60
|
-
__tag: Record<B, true>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @public
|
|
65
|
-
*
|
|
66
106
|
* A string that is one of `"notifications" | "microphone" | "geolocation"`.
|
|
67
107
|
*
|
|
68
108
|
* @remarks
|
|
69
109
|
* Note that more possible values may be added in the future, so make sure your
|
|
70
110
|
* handler can deal with unknown permission types gracefully.
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
71
113
|
*/
|
|
72
114
|
export declare type BrowserPermission = "notifications" | "microphone" | "geolocation";
|
|
73
115
|
|
|
74
116
|
/**
|
|
75
|
-
* Passed to
|
|
76
|
-
* dialog needs to be shown to the user.
|
|
117
|
+
* Passed to {@link ChatboxProps.beforeBrowserPermissionPrompt} when a
|
|
118
|
+
* browser permission dialog needs to be shown to the user.
|
|
77
119
|
*
|
|
78
120
|
* @public
|
|
79
121
|
*/
|
|
@@ -117,175 +159,655 @@ export declare interface BrowserPermissionRequest {
|
|
|
117
159
|
showPrompt(): Promise<"granted" | "denied">;
|
|
118
160
|
}
|
|
119
161
|
|
|
120
|
-
|
|
162
|
+
/**
|
|
163
|
+
* The
|
|
164
|
+
* {@link https://talkjs.com/docs/Features/Chat_UIs/#chatbox | TalkJS Chatbox UI. }
|
|
165
|
+
* Displays a single conversation.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
export declare const Chatbox: React.ComponentType<ChatboxProps & React.RefAttributes<ChatboxRef>>;
|
|
121
170
|
|
|
171
|
+
/**
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
122
174
|
export declare interface ChatboxProps {
|
|
175
|
+
/**
|
|
176
|
+
* @hidden
|
|
177
|
+
*/
|
|
123
178
|
className?: string;
|
|
124
|
-
|
|
179
|
+
/**
|
|
180
|
+
* @hidden
|
|
181
|
+
*/
|
|
182
|
+
style?: React.CSSProperties;
|
|
183
|
+
/**
|
|
184
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
185
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
186
|
+
*/
|
|
125
187
|
appId: string;
|
|
188
|
+
/**
|
|
189
|
+
* The ID of the current user.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
193
|
+
* be displayed.
|
|
194
|
+
*/
|
|
126
195
|
userId: string;
|
|
196
|
+
/**
|
|
197
|
+
* The ID of the conversation to display.
|
|
198
|
+
*
|
|
199
|
+
* @remarks
|
|
200
|
+
* If the conversation doesn't exist or if the current user isn't a
|
|
201
|
+
* participant of the current conversation, a "Chat not found" message will be
|
|
202
|
+
* displayed.
|
|
203
|
+
*/
|
|
127
204
|
conversationId: string;
|
|
205
|
+
/**
|
|
206
|
+
* A token to authenticate the session with.
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* See the
|
|
210
|
+
* {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide }
|
|
211
|
+
* and
|
|
212
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference }
|
|
213
|
+
* for details and examples.
|
|
214
|
+
*
|
|
215
|
+
* Required when authentication is enabled, otherwise optional.
|
|
216
|
+
*/
|
|
128
217
|
token?: string;
|
|
218
|
+
/**
|
|
219
|
+
* A function that fetches and returns a new authentication token from your
|
|
220
|
+
* server.
|
|
221
|
+
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* TalkJS calls this function whenever the current token is about to expire.
|
|
224
|
+
* This callback is designed to work with any backend setup. See
|
|
225
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens }
|
|
226
|
+
* for details and examples.
|
|
227
|
+
*/
|
|
129
228
|
tokenFetcher?: () => string | Promise<string>;
|
|
229
|
+
/**
|
|
230
|
+
* Lets you override theme components with your own implementations to
|
|
231
|
+
* customize them.
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* See
|
|
235
|
+
* {@link https://talkjs.com/docs/SDKs/React/Customization/#custom-theme-components | Custom theme components }
|
|
236
|
+
* for more info.
|
|
237
|
+
*/
|
|
130
238
|
theme?: Partial<Theme>;
|
|
239
|
+
/**
|
|
240
|
+
* When true, pressing Enter will send a message.
|
|
241
|
+
*
|
|
242
|
+
* @remarks
|
|
243
|
+
* Defaults to `true`.
|
|
244
|
+
*/
|
|
131
245
|
enterSendsMessage?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Sets whether the chat header is visible.
|
|
248
|
+
*
|
|
249
|
+
* @remarks
|
|
250
|
+
* Defaults to `true`.
|
|
251
|
+
*/
|
|
132
252
|
chatHeaderVisible?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Sets whether the message input field is visible.
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
* Defaults to `true`.
|
|
258
|
+
*/
|
|
133
259
|
messageFieldVisible?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Sets whether spellcheck is enabled in the message field.
|
|
262
|
+
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* Defaults to `false`.
|
|
265
|
+
*/
|
|
134
266
|
messageFieldSpellcheck?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Adds custom placeholder text for the message input field.
|
|
269
|
+
*
|
|
270
|
+
* @remarks
|
|
271
|
+
* The default placeholder text is `"Say something..."`
|
|
272
|
+
*/
|
|
135
273
|
messageFieldPlaceholder?: string;
|
|
136
|
-
|
|
137
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Callback that triggers when the user deletes a message with the TalkJS UI.
|
|
276
|
+
*
|
|
277
|
+
* @param event Event object describing the message deletion
|
|
278
|
+
*/
|
|
279
|
+
onDeleteMessage?: (event: DeleteMessageEvent) => void;
|
|
280
|
+
/**
|
|
281
|
+
* Callback that triggers when the user sends a message with the TalkJS UI.
|
|
282
|
+
*
|
|
283
|
+
* @param event Event object describing the message sending action
|
|
284
|
+
*/
|
|
285
|
+
onSendMessage?: (event: SendMessageEvent) => void;
|
|
286
|
+
/**
|
|
287
|
+
* Callback that triggers when the user initiates an action that will require
|
|
288
|
+
* a permissions request from the browser, but right before actually
|
|
289
|
+
* requesting the permission from the browser.
|
|
290
|
+
*
|
|
291
|
+
* @remarks
|
|
292
|
+
* You can use this callback to inform the user that they will need to grant a
|
|
293
|
+
* browser permission in order to perform an action.
|
|
294
|
+
*
|
|
295
|
+
* @param request Object describing the permission request
|
|
296
|
+
*/
|
|
138
297
|
beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
|
|
139
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Callback that triggers when the user attempts to initiate an action that
|
|
300
|
+
* requires a specific browser permission, but that permission was not
|
|
301
|
+
* granted.
|
|
302
|
+
*
|
|
303
|
+
* @param event Event object describing the missing permission
|
|
304
|
+
*/
|
|
305
|
+
onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
|
|
306
|
+
/**
|
|
307
|
+
* Arbitrary custom data passed down to the theme.
|
|
308
|
+
*
|
|
309
|
+
* @remarks
|
|
310
|
+
* Whatever data you pass here will be made available for use in theme
|
|
311
|
+
* components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
|
|
312
|
+
* theme components and through
|
|
313
|
+
* {@linkcode CommonConversationListProps.themeCustom} for ConversationList
|
|
314
|
+
* theme components.
|
|
315
|
+
*/
|
|
140
316
|
themeCustom?: any;
|
|
141
317
|
}
|
|
142
318
|
|
|
319
|
+
/**
|
|
320
|
+
* A collection of actions available on the Chatbox UI.
|
|
321
|
+
*
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
143
324
|
export declare interface ChatboxRef {
|
|
325
|
+
/**
|
|
326
|
+
* Deletes the message with the given ID.
|
|
327
|
+
*
|
|
328
|
+
* @param messageId
|
|
329
|
+
*/
|
|
144
330
|
deleteMessage(messageId: string): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Enable/disable editing of a given message.
|
|
333
|
+
*
|
|
334
|
+
* @param messageId When `null` is provided, editing mode will be disabled
|
|
335
|
+
*/
|
|
145
336
|
setEditing(messageId: string | null): void;
|
|
337
|
+
/**
|
|
338
|
+
* Edit the message with the given ID.
|
|
339
|
+
*
|
|
340
|
+
* @param messageId
|
|
341
|
+
* @param params
|
|
342
|
+
*/
|
|
146
343
|
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
344
|
+
/**
|
|
345
|
+
* Send a text message to the current conversation.
|
|
346
|
+
*
|
|
347
|
+
* @param params
|
|
348
|
+
*/
|
|
147
349
|
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
148
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Send a file message to the current conversation.
|
|
352
|
+
*
|
|
353
|
+
* @param message
|
|
354
|
+
*/
|
|
355
|
+
sendFileMessage(params: {
|
|
149
356
|
fileToken: FileToken;
|
|
150
357
|
custom?: Record<string, string>;
|
|
151
358
|
}): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Send a location message to the current conversation.
|
|
361
|
+
*
|
|
362
|
+
* @param message
|
|
363
|
+
*/
|
|
152
364
|
sendLocationMessage(message: {
|
|
153
365
|
location: Coordinates;
|
|
154
366
|
custom?: Record<string, string>;
|
|
155
367
|
}): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* Set/unset the message that's currently being replied to.
|
|
370
|
+
*
|
|
371
|
+
* @param messageId When `null` is provided, the "replying to" message is cleared
|
|
372
|
+
*/
|
|
156
373
|
setReferencedMessage(messageId: string | null): void;
|
|
157
|
-
getMessageFieldText: () => string;
|
|
158
|
-
setMessageFieldText: (text: string) => void;
|
|
159
374
|
}
|
|
160
375
|
|
|
376
|
+
/**
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
161
379
|
declare interface ChatHeaderProps {
|
|
380
|
+
/**
|
|
381
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
382
|
+
*/
|
|
162
383
|
common: CommonChatboxProps;
|
|
384
|
+
/**
|
|
385
|
+
* A record of user IDs and their connection status.
|
|
386
|
+
*/
|
|
163
387
|
isUserConnected: {
|
|
164
388
|
[userId: string]: boolean;
|
|
165
389
|
};
|
|
390
|
+
/**
|
|
391
|
+
* The current user's permissions.
|
|
392
|
+
*/
|
|
166
393
|
permissions: UserPermissions;
|
|
167
394
|
}
|
|
168
395
|
|
|
396
|
+
/**
|
|
397
|
+
* A collection of props that's shared by every themed component used in the Chatbox UI.
|
|
398
|
+
*
|
|
399
|
+
* @public
|
|
400
|
+
*/
|
|
169
401
|
declare interface CommonChatboxProps {
|
|
170
|
-
|
|
402
|
+
/**
|
|
403
|
+
* Holds information about your TalkJS app.
|
|
404
|
+
*/
|
|
405
|
+
app: App;
|
|
406
|
+
/**
|
|
407
|
+
* The user that mounted this chatbox.
|
|
408
|
+
*/
|
|
171
409
|
currentUser: UserSnapshot;
|
|
410
|
+
/**
|
|
411
|
+
* A translation object which holds localized strings for internationalization
|
|
412
|
+
* purposes.
|
|
413
|
+
*/
|
|
172
414
|
t: Translation;
|
|
415
|
+
/**
|
|
416
|
+
* The chatbox instance itself.
|
|
417
|
+
*/
|
|
173
418
|
chatbox: ChatboxRef;
|
|
419
|
+
/**
|
|
420
|
+
* Arbitrary custom data passed down to the theme.
|
|
421
|
+
*
|
|
422
|
+
* @remarks
|
|
423
|
+
* The data that you pass to {@link ChatboxProps.themeCustom} will show up
|
|
424
|
+
* here so that you can use it from within theme components.
|
|
425
|
+
*/
|
|
174
426
|
themeCustom?: any;
|
|
427
|
+
/**
|
|
428
|
+
* Describes the capabilities of the current device.
|
|
429
|
+
*/
|
|
175
430
|
device: DeviceFeatures;
|
|
431
|
+
/**
|
|
432
|
+
* The theme object that the chatbox's is currently using.
|
|
433
|
+
*/
|
|
176
434
|
theme: Theme;
|
|
435
|
+
/**
|
|
436
|
+
* The conversation displayed in the chatbox.
|
|
437
|
+
*/
|
|
177
438
|
conversation: ConversationSnapshot;
|
|
439
|
+
/**
|
|
440
|
+
* A list of participants that are part of the conversation that's currently
|
|
441
|
+
* being shown.
|
|
442
|
+
*/
|
|
178
443
|
participants: ParticipantSnapshot[];
|
|
444
|
+
/**
|
|
445
|
+
* Tells you which participants are currently typing
|
|
446
|
+
*/
|
|
179
447
|
typing: TypingSnapshot;
|
|
448
|
+
/**
|
|
449
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
450
|
+
*/
|
|
180
451
|
session: TalkSession;
|
|
181
452
|
}
|
|
182
453
|
|
|
454
|
+
/**
|
|
455
|
+
* A collection of props that's shared by every themed component used in the ConversationList UI.
|
|
456
|
+
*
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
183
459
|
declare interface CommonConversationListProps {
|
|
184
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Holds information about your TalkJS app.
|
|
462
|
+
*/
|
|
463
|
+
app: App;
|
|
464
|
+
/**
|
|
465
|
+
* The user that mounted this chatbox.
|
|
466
|
+
*/
|
|
185
467
|
currentUser: UserSnapshot;
|
|
468
|
+
/**
|
|
469
|
+
* A translation object which holds localized strings for internationalization
|
|
470
|
+
* purposes.
|
|
471
|
+
*/
|
|
186
472
|
t: Translation;
|
|
473
|
+
/**
|
|
474
|
+
* Arbitrary custom data passed down to the theme.
|
|
475
|
+
*
|
|
476
|
+
* @remarks
|
|
477
|
+
* The data that you pass to {@link ConversationListProps.themeCustom} will show up
|
|
478
|
+
* here so that you can use it from within theme components.
|
|
479
|
+
*/
|
|
187
480
|
themeCustom?: any;
|
|
481
|
+
/**
|
|
482
|
+
* Describes the capabilities of the current device.
|
|
483
|
+
*/
|
|
188
484
|
device: DeviceFeatures;
|
|
485
|
+
/**
|
|
486
|
+
* The theme object that the chatbox's is currently using.
|
|
487
|
+
*/
|
|
189
488
|
theme: Theme;
|
|
489
|
+
/**
|
|
490
|
+
* The conversation list instance itself.
|
|
491
|
+
*/
|
|
190
492
|
conversationList: ConversationListRef;
|
|
493
|
+
/**
|
|
494
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
495
|
+
*/
|
|
191
496
|
session: TalkSession;
|
|
192
497
|
}
|
|
193
498
|
|
|
499
|
+
/**
|
|
500
|
+
* @public
|
|
501
|
+
*/
|
|
194
502
|
declare interface CompactMessageContentProps {
|
|
503
|
+
/**
|
|
504
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
505
|
+
* theme components.
|
|
506
|
+
*
|
|
507
|
+
* @remarks
|
|
508
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
509
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
510
|
+
*/
|
|
195
511
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
512
|
+
/**
|
|
513
|
+
* The message that's being displayed.
|
|
514
|
+
*/
|
|
196
515
|
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
197
516
|
}
|
|
198
517
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
518
|
+
/**
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
204
521
|
declare interface ConversationImageProps {
|
|
522
|
+
/**
|
|
523
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
524
|
+
* theme components.
|
|
525
|
+
*
|
|
526
|
+
* @remarks
|
|
527
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
528
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
529
|
+
*/
|
|
205
530
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
531
|
+
/**
|
|
532
|
+
* The conversation that's being displayed.
|
|
533
|
+
*/
|
|
206
534
|
conversation: ConversationSnapshot;
|
|
535
|
+
/**
|
|
536
|
+
* A list of participants that are a part of the conversation.
|
|
537
|
+
*/
|
|
207
538
|
participants: ParticipantSnapshot[];
|
|
208
539
|
}
|
|
209
540
|
|
|
210
|
-
|
|
541
|
+
/**
|
|
542
|
+
* The
|
|
543
|
+
* {@link https://talkjs.com/docs/Features/Chat_UIs/#conversation-list | Conversation List UI. }
|
|
544
|
+
* Displays a list of a user's conversations. You can use a conversation list on
|
|
545
|
+
* its own on a page, or combine it with a {@link Chatbox} to build a complete message
|
|
546
|
+
* center.
|
|
547
|
+
*
|
|
548
|
+
* @public
|
|
549
|
+
*/
|
|
550
|
+
export declare const ConversationList: React.ComponentType<ConversationListProps & React.RefAttributes<ConversationListRef>>;
|
|
211
551
|
|
|
212
552
|
declare interface ConversationListItemProps {
|
|
553
|
+
/**
|
|
554
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
555
|
+
*/
|
|
213
556
|
common: CommonConversationListProps;
|
|
557
|
+
/**
|
|
558
|
+
* The conversation that's being displayed.
|
|
559
|
+
*/
|
|
214
560
|
conversation: ConversationSnapshot;
|
|
561
|
+
/**
|
|
562
|
+
* The list of participants that are part of the given conversation.
|
|
563
|
+
*/
|
|
215
564
|
participants: ParticipantSnapshot[];
|
|
565
|
+
/**
|
|
566
|
+
* If `true`, this conversation is the currently selected one in the
|
|
567
|
+
* conversation list.
|
|
568
|
+
*/
|
|
216
569
|
isSelected: boolean;
|
|
217
570
|
}
|
|
218
571
|
|
|
572
|
+
/**
|
|
573
|
+
* @public
|
|
574
|
+
*/
|
|
219
575
|
export declare interface ConversationListProps {
|
|
576
|
+
/**
|
|
577
|
+
* @hidden
|
|
578
|
+
*/
|
|
220
579
|
className?: string;
|
|
221
|
-
|
|
580
|
+
/**
|
|
581
|
+
* @hidden
|
|
582
|
+
*/
|
|
583
|
+
style?: React.CSSProperties;
|
|
584
|
+
/**
|
|
585
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
586
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
587
|
+
*/
|
|
222
588
|
appId: string;
|
|
589
|
+
/**
|
|
590
|
+
* The ID of the current user.
|
|
591
|
+
*
|
|
592
|
+
* @remarks
|
|
593
|
+
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
594
|
+
* be displayed.
|
|
595
|
+
*/
|
|
223
596
|
userId: string;
|
|
224
|
-
|
|
597
|
+
/**
|
|
598
|
+
* The ID of the conversation currently selected in the list.
|
|
599
|
+
*
|
|
600
|
+
* @remarks
|
|
601
|
+
*
|
|
602
|
+
* Changing the value of this prop will cause the ConversationList UI to
|
|
603
|
+
* update.
|
|
604
|
+
*
|
|
605
|
+
* Note that updating the selected conversation through this prop **will not**
|
|
606
|
+
* trigger the {@linkcode onSelectConversation} callback.
|
|
607
|
+
*/
|
|
225
608
|
selectedConversationId?: string;
|
|
609
|
+
/**
|
|
610
|
+
* A token to authenticate the session with.
|
|
611
|
+
*
|
|
612
|
+
* @remarks
|
|
613
|
+
* See the
|
|
614
|
+
* {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide}
|
|
615
|
+
* and
|
|
616
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference}
|
|
617
|
+
* for details and examples.
|
|
618
|
+
*
|
|
619
|
+
* Required when authentication is enabled, otherwise optional.
|
|
620
|
+
*/
|
|
621
|
+
token?: string;
|
|
622
|
+
/**
|
|
623
|
+
* A function that fetches and returns a new authentication token from your
|
|
624
|
+
* server.
|
|
625
|
+
*
|
|
626
|
+
* @remarks
|
|
627
|
+
* TalkJS calls this function whenever the current token is about to expire.
|
|
628
|
+
* This callback is designed to work with any backend setup. See
|
|
629
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens}
|
|
630
|
+
* for details and examples.
|
|
631
|
+
*/
|
|
226
632
|
tokenFetcher?: () => string | Promise<string>;
|
|
633
|
+
/**
|
|
634
|
+
* Lets you override theme components with your own implementations to
|
|
635
|
+
* customize them.
|
|
636
|
+
*
|
|
637
|
+
* @remarks
|
|
638
|
+
* See
|
|
639
|
+
* {@link https://talkjs.com/docs/SDKs/React/Customization/#custom-theme-components | Custom theme components }
|
|
640
|
+
* for more info.
|
|
641
|
+
*/
|
|
227
642
|
theme?: Partial<Theme>;
|
|
643
|
+
/**
|
|
644
|
+
* Callback that triggers when the user selects a conversation from the list.
|
|
645
|
+
*
|
|
646
|
+
* @param event Event object containing the selected conversation
|
|
647
|
+
*
|
|
648
|
+
* @remarks
|
|
649
|
+
* Note that updating the selected conversation through the
|
|
650
|
+
* {@linkcode selectedConversationId} prop **will not** trigger this callback.
|
|
651
|
+
*
|
|
652
|
+
* Use this callback to have an adjacent chatbox show the correct
|
|
653
|
+
* conversation. See
|
|
654
|
+
* {@link https://talkjs.com/docs/SDKs/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
|
|
655
|
+
*/
|
|
656
|
+
onSelectConversation?: (event: SelectConversationEvent) => void;
|
|
657
|
+
/**
|
|
658
|
+
* Arbitrary custom data passed down to the theme.
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* Whatever data you pass here will be made available for use in theme
|
|
662
|
+
* components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
|
|
663
|
+
* theme components and through
|
|
664
|
+
* {@linkcode CommonConversationListProps.themeCustom} for ConversationList
|
|
665
|
+
* theme components.
|
|
666
|
+
*/
|
|
228
667
|
themeCustom?: any;
|
|
229
|
-
onSelectConversation?: (e: SelectConversationEvent) => void;
|
|
230
668
|
}
|
|
231
669
|
|
|
670
|
+
/**
|
|
671
|
+
* A collection of actions available on the ConversationList UI.
|
|
672
|
+
*
|
|
673
|
+
* @public
|
|
674
|
+
*/
|
|
232
675
|
export declare interface ConversationListRef {
|
|
676
|
+
/**
|
|
677
|
+
* Programatically select a conversation.
|
|
678
|
+
*
|
|
679
|
+
* @param conversationId
|
|
680
|
+
*
|
|
681
|
+
* @remarks
|
|
682
|
+
* Note that this **will not** trigger the
|
|
683
|
+
* {@linkcode ConversationListProps.onSelectConversation} callback.
|
|
684
|
+
*/
|
|
233
685
|
selectConversation(conversationId: string): void;
|
|
234
686
|
}
|
|
235
687
|
|
|
688
|
+
/**
|
|
689
|
+
* @public
|
|
690
|
+
*/
|
|
236
691
|
declare interface Coordinates {
|
|
237
692
|
latitude: number;
|
|
238
693
|
longitude: number;
|
|
239
694
|
}
|
|
240
695
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
696
|
+
/**
|
|
697
|
+
* The entire TalkJS default theme.
|
|
698
|
+
*
|
|
699
|
+
* @remarks
|
|
700
|
+
* The entire source code of the theme is available in the {@link https://www.github.com/talkjs/theme-default | TalkJS `theme-default` Github repository.}
|
|
701
|
+
*
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
246
704
|
export declare const defaultTheme: Theme;
|
|
247
705
|
|
|
706
|
+
/**
|
|
707
|
+
* An event object dispatched by the {@link ChatboxProps.onDeleteMessage} event.
|
|
708
|
+
*
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
248
711
|
export declare interface DeleteMessageEvent {
|
|
249
712
|
currentUser: UserSnapshot;
|
|
713
|
+
/**
|
|
714
|
+
* The message that was just deleted.
|
|
715
|
+
*/
|
|
250
716
|
message: MessageSnapshot;
|
|
717
|
+
/**
|
|
718
|
+
* The conversation that the message used to be in.
|
|
719
|
+
*/
|
|
251
720
|
conversation: ConversationSnapshot;
|
|
252
721
|
}
|
|
253
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Describes the capabilities of the current device.
|
|
725
|
+
*
|
|
726
|
+
* @public
|
|
727
|
+
*/
|
|
254
728
|
declare interface DeviceFeatures {
|
|
255
729
|
/**
|
|
256
730
|
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
257
731
|
*/
|
|
258
732
|
supportsEmojiPicker: boolean;
|
|
259
733
|
/**
|
|
260
|
-
* True if the user agents reports
|
|
734
|
+
* True if the user agents reports the current device as a mobile/tablet.
|
|
261
735
|
*/
|
|
262
736
|
isMobile: boolean;
|
|
263
737
|
}
|
|
264
738
|
|
|
265
|
-
|
|
739
|
+
/**
|
|
740
|
+
* @public
|
|
741
|
+
*/
|
|
742
|
+
declare interface FileBlockProps {
|
|
266
743
|
/**
|
|
267
|
-
*
|
|
744
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
268
745
|
*/
|
|
269
|
-
|
|
746
|
+
common: CommonChatboxProps;
|
|
270
747
|
/**
|
|
271
|
-
*
|
|
748
|
+
* The message that this content block belongs to.
|
|
749
|
+
*/
|
|
750
|
+
message: MessageSnapshot;
|
|
751
|
+
/**
|
|
752
|
+
* The generic file block to display.
|
|
753
|
+
*/
|
|
754
|
+
block: GenericFileBlock;
|
|
755
|
+
/**
|
|
756
|
+
* The URL used to download the file.
|
|
757
|
+
*
|
|
758
|
+
* @remarks
|
|
759
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
760
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
761
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
762
|
+
* the chat, which makes for a smoother user experience.
|
|
763
|
+
*
|
|
764
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
765
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
766
|
+
* while `block.url` will always be defined and should be used for preview
|
|
767
|
+
* purposes.
|
|
272
768
|
*/
|
|
273
|
-
isMobile: boolean;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
declare interface FileBlockProps extends ContentBlockProps {
|
|
277
|
-
block: FileBlock;
|
|
278
769
|
downloadUrl?: string;
|
|
279
770
|
}
|
|
280
771
|
|
|
772
|
+
/**
|
|
773
|
+
* @public
|
|
774
|
+
*/
|
|
281
775
|
declare interface GroupChatImageProps {
|
|
776
|
+
/**
|
|
777
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
778
|
+
* theme components.
|
|
779
|
+
*
|
|
780
|
+
* @remarks
|
|
781
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
782
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
783
|
+
*/
|
|
282
784
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
785
|
+
/**
|
|
786
|
+
* A list of participants that are a part of the conversation.
|
|
787
|
+
*/
|
|
283
788
|
participants: ParticipantSnapshot[];
|
|
284
789
|
}
|
|
285
790
|
|
|
791
|
+
/**
|
|
792
|
+
* @public
|
|
793
|
+
*/
|
|
286
794
|
declare interface IconProps {
|
|
795
|
+
/**
|
|
796
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
797
|
+
* theme components.
|
|
798
|
+
*
|
|
799
|
+
* @remarks
|
|
800
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
801
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
802
|
+
*/
|
|
287
803
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
804
|
+
/**
|
|
805
|
+
* The name of the icon to display.
|
|
806
|
+
*/
|
|
288
807
|
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";
|
|
808
|
+
/**
|
|
809
|
+
* @hidden
|
|
810
|
+
*/
|
|
289
811
|
className?: string;
|
|
290
812
|
}
|
|
291
813
|
|
|
@@ -301,65 +823,203 @@ declare interface IEditorController {
|
|
|
301
823
|
toggleEmojiPicker(): void;
|
|
302
824
|
}
|
|
303
825
|
|
|
304
|
-
|
|
826
|
+
/**
|
|
827
|
+
* @public
|
|
828
|
+
*/
|
|
829
|
+
declare interface ImageBlockProps {
|
|
830
|
+
/**
|
|
831
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
832
|
+
*/
|
|
833
|
+
common: CommonChatboxProps;
|
|
834
|
+
/**
|
|
835
|
+
* The message that this content block belongs to.
|
|
836
|
+
*/
|
|
837
|
+
message: MessageSnapshot;
|
|
838
|
+
/**
|
|
839
|
+
* The image block to display.
|
|
840
|
+
*/
|
|
305
841
|
block: ImageBlock;
|
|
842
|
+
/**
|
|
843
|
+
* The URL used to download the file.
|
|
844
|
+
*
|
|
845
|
+
* @remarks
|
|
846
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
847
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
848
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
849
|
+
* the chat, which makes for a smoother user experience.
|
|
850
|
+
*
|
|
851
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
852
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
853
|
+
* while `block.url` will always be defined and should be used for preview
|
|
854
|
+
* purposes.
|
|
855
|
+
*/
|
|
306
856
|
downloadUrl?: string;
|
|
307
857
|
}
|
|
308
858
|
|
|
309
|
-
|
|
859
|
+
/**
|
|
860
|
+
* @public
|
|
861
|
+
*/
|
|
862
|
+
declare interface LocationBlockProps {
|
|
863
|
+
/**
|
|
864
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
865
|
+
*/
|
|
866
|
+
common: CommonChatboxProps;
|
|
867
|
+
/**
|
|
868
|
+
* The message that this content block belongs to.
|
|
869
|
+
*/
|
|
870
|
+
message: MessageSnapshot;
|
|
871
|
+
/**
|
|
872
|
+
* The location block to display.
|
|
873
|
+
*/
|
|
310
874
|
block: LocationBlock;
|
|
311
875
|
}
|
|
312
876
|
|
|
877
|
+
/**
|
|
878
|
+
* @public
|
|
879
|
+
*/
|
|
313
880
|
declare interface MessageActionMenuProps {
|
|
881
|
+
/**
|
|
882
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
883
|
+
*/
|
|
314
884
|
common: CommonChatboxProps;
|
|
885
|
+
/**
|
|
886
|
+
* The message that's attached to the action menu.
|
|
887
|
+
*/
|
|
315
888
|
message: MessageSnapshot;
|
|
889
|
+
/**
|
|
890
|
+
* The current user's permissions relating to the given message.
|
|
891
|
+
*/
|
|
316
892
|
permissions: MessagePermissions;
|
|
317
893
|
}
|
|
318
894
|
|
|
895
|
+
/**
|
|
896
|
+
* @public
|
|
897
|
+
*/
|
|
319
898
|
declare interface MessageDividerProps {
|
|
899
|
+
/**
|
|
900
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
901
|
+
*/
|
|
320
902
|
common: CommonChatboxProps;
|
|
903
|
+
/**
|
|
904
|
+
* If true, this divider separates unread messages from read ones.
|
|
905
|
+
*/
|
|
321
906
|
isReadMarker: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* If true, this divider separates messages sent on two different dates.
|
|
909
|
+
*/
|
|
322
910
|
isDayMarker: boolean;
|
|
911
|
+
/**
|
|
912
|
+
* The date timestamp when {@link MessageDividerProps.isDayMarker} is `true`. Holds the number of
|
|
913
|
+
* milliseconds passed since the Unix Epoch.
|
|
914
|
+
*/
|
|
323
915
|
timestamp?: number;
|
|
324
916
|
}
|
|
325
917
|
|
|
918
|
+
/**
|
|
919
|
+
* @public
|
|
920
|
+
*/
|
|
326
921
|
declare interface MessageFieldProps {
|
|
922
|
+
/**
|
|
923
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
924
|
+
*/
|
|
327
925
|
common: CommonChatboxProps;
|
|
926
|
+
/**
|
|
927
|
+
* The message that's currently being replied to, if any.
|
|
928
|
+
*/
|
|
328
929
|
referencedMessage: MessageSnapshot | undefined;
|
|
930
|
+
/**
|
|
931
|
+
* The current user's permissions.
|
|
932
|
+
*/
|
|
329
933
|
permissions: UserPermissions;
|
|
934
|
+
/**
|
|
935
|
+
* An object holding the state of the message field.
|
|
936
|
+
*/
|
|
330
937
|
editor: IEditorController;
|
|
938
|
+
/**
|
|
939
|
+
* When a message is being edited its ID will be stored here.
|
|
940
|
+
*/
|
|
331
941
|
editMessageId: string | undefined;
|
|
332
942
|
}
|
|
333
943
|
|
|
944
|
+
/**
|
|
945
|
+
* @public
|
|
946
|
+
*/
|
|
334
947
|
declare interface MessageListFooterProps {
|
|
948
|
+
/**
|
|
949
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
950
|
+
*/
|
|
335
951
|
common: CommonChatboxProps;
|
|
336
952
|
}
|
|
337
953
|
|
|
954
|
+
/**
|
|
955
|
+
* A set of permissions the current user has for a given message.
|
|
956
|
+
*
|
|
957
|
+
* @remarks
|
|
958
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
959
|
+
*
|
|
960
|
+
* @public
|
|
961
|
+
*/
|
|
338
962
|
declare interface MessagePermissions extends UserPermissions {
|
|
963
|
+
/**
|
|
964
|
+
* True if the user has the ability to delete the given message.
|
|
965
|
+
*/
|
|
339
966
|
canDeleteMessage: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* True if the user has the ability to reply to the given message.
|
|
969
|
+
*/
|
|
340
970
|
canReplyToMessage: boolean;
|
|
971
|
+
/**
|
|
972
|
+
* True if the user has the ability to edit the given message.
|
|
973
|
+
*/
|
|
341
974
|
canEditMessage: boolean;
|
|
975
|
+
/**
|
|
976
|
+
* 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.
|
|
977
|
+
*/
|
|
342
978
|
canAddReaction: boolean;
|
|
343
979
|
}
|
|
344
980
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
canEditMessage: boolean;
|
|
349
|
-
}
|
|
350
|
-
|
|
981
|
+
/**
|
|
982
|
+
* @public
|
|
983
|
+
*/
|
|
351
984
|
declare interface MessageProps {
|
|
985
|
+
/**
|
|
986
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
987
|
+
*/
|
|
352
988
|
common: CommonChatboxProps;
|
|
989
|
+
/**
|
|
990
|
+
* The message that's being displayed.
|
|
991
|
+
*/
|
|
353
992
|
message: MessageSnapshot;
|
|
993
|
+
/**
|
|
994
|
+
* The current status of the message.
|
|
995
|
+
*/
|
|
354
996
|
messageStatus: MessageStatus;
|
|
997
|
+
/**
|
|
998
|
+
* The current user's permissions relating to the given message.
|
|
999
|
+
*/
|
|
355
1000
|
permissions: MessagePermissions;
|
|
356
1001
|
}
|
|
357
1002
|
|
|
1003
|
+
/**
|
|
1004
|
+
* The current status of the message.
|
|
1005
|
+
*
|
|
1006
|
+
* @remarks
|
|
1007
|
+
* This type can have one of these values:
|
|
1008
|
+
*
|
|
1009
|
+
* - `"sending"` - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.
|
|
1010
|
+
*
|
|
1011
|
+
* - `"sent"` - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.
|
|
1012
|
+
*
|
|
1013
|
+
* - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
|
|
1014
|
+
*
|
|
1015
|
+
* @public
|
|
1016
|
+
*/
|
|
358
1017
|
declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
359
1018
|
|
|
360
1019
|
/**
|
|
361
|
-
* Sent by
|
|
362
|
-
* require explicit browser permission, but that
|
|
1020
|
+
* Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
|
|
1021
|
+
* tried to do an action that require explicit browser permission, but that
|
|
1022
|
+
* permission has been denied.
|
|
363
1023
|
*
|
|
364
1024
|
* @remarks
|
|
365
1025
|
* This event is meant to let you show a message to the user if an action (eg
|
|
@@ -367,7 +1027,7 @@ declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
|
367
1027
|
* browser permission for that has been denied.
|
|
368
1028
|
*
|
|
369
1029
|
* If you want to control when to show the browser permissions prompt, use
|
|
370
|
-
*
|
|
1030
|
+
* {@link ChatboxProps.beforeBrowserPermissionPrompt}.
|
|
371
1031
|
*
|
|
372
1032
|
* This event is emitted both when the user has denied this permission in the
|
|
373
1033
|
* past, and when a user action just triggered a browser permissions prompt
|
|
@@ -388,64 +1048,136 @@ export declare interface MissingBrowserPermissionEvent {
|
|
|
388
1048
|
type: BrowserPermission;
|
|
389
1049
|
}
|
|
390
1050
|
|
|
1051
|
+
/**
|
|
1052
|
+
* @public
|
|
1053
|
+
*/
|
|
391
1054
|
declare interface ReferencedMessageProps {
|
|
1055
|
+
/**
|
|
1056
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1057
|
+
*/
|
|
392
1058
|
common: CommonChatboxProps;
|
|
1059
|
+
/**
|
|
1060
|
+
* The message that's being referenced.
|
|
1061
|
+
*/
|
|
393
1062
|
referencedMessage: ReferencedMessageSnapshot;
|
|
394
1063
|
}
|
|
395
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* @public
|
|
1067
|
+
*/
|
|
396
1068
|
declare interface ReplyBarProps {
|
|
1069
|
+
/**
|
|
1070
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1071
|
+
*/
|
|
397
1072
|
common: CommonChatboxProps;
|
|
1073
|
+
/**
|
|
1074
|
+
* The message that's being replied to.
|
|
1075
|
+
*/
|
|
398
1076
|
referencedMessage: MessageSnapshot;
|
|
399
1077
|
}
|
|
400
1078
|
|
|
1079
|
+
/**
|
|
1080
|
+
* An event object dispatched by the
|
|
1081
|
+
* {@link ConversationListProps.onSelectConversation} event.
|
|
1082
|
+
*/
|
|
401
1083
|
export declare interface SelectConversationEvent {
|
|
402
1084
|
currentUser: UserSnapshot;
|
|
1085
|
+
/**
|
|
1086
|
+
* The newly-selected conversation.
|
|
1087
|
+
*/
|
|
403
1088
|
conversation: ConversationSnapshot;
|
|
404
1089
|
}
|
|
405
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* An event object dispatched by the {@link ChatboxProps.onSendMessage} event.
|
|
1093
|
+
*
|
|
1094
|
+
* @public
|
|
1095
|
+
*/
|
|
406
1096
|
export declare interface SendMessageEvent {
|
|
407
1097
|
currentUser: UserSnapshot;
|
|
1098
|
+
/**
|
|
1099
|
+
* The message that was just sent.
|
|
1100
|
+
*/
|
|
408
1101
|
message: MessageSnapshot;
|
|
1102
|
+
/**
|
|
1103
|
+
* The conversation the message was sent in.
|
|
1104
|
+
*/
|
|
409
1105
|
conversation: ConversationSnapshot;
|
|
410
1106
|
}
|
|
411
1107
|
|
|
412
|
-
|
|
1108
|
+
/**
|
|
1109
|
+
* @public
|
|
1110
|
+
*/
|
|
1111
|
+
declare interface TextBlockProps {
|
|
1112
|
+
/**
|
|
1113
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1114
|
+
*/
|
|
1115
|
+
common: CommonChatboxProps;
|
|
1116
|
+
/**
|
|
1117
|
+
* The message that this content block belongs to.
|
|
1118
|
+
*/
|
|
1119
|
+
message: MessageSnapshot;
|
|
1120
|
+
/**
|
|
1121
|
+
* The text block to display.
|
|
1122
|
+
*/
|
|
413
1123
|
block: TextBlock;
|
|
414
1124
|
}
|
|
415
1125
|
|
|
1126
|
+
/**
|
|
1127
|
+
* A theme can be used to customize the appearance & behavior of your TalkJS
|
|
1128
|
+
* Chatbox and/or ConversationList.
|
|
1129
|
+
*
|
|
1130
|
+
* @remarks
|
|
1131
|
+
* The implementation of TalkJS's default theme is open-source and
|
|
1132
|
+
* {@link https://github.com/talkjs/theme-default | available on Github. }
|
|
1133
|
+
*
|
|
1134
|
+
* @public
|
|
1135
|
+
*/
|
|
416
1136
|
export declare interface Theme {
|
|
417
|
-
Avatar:
|
|
418
|
-
ConversationImage:
|
|
419
|
-
GroupChatImage:
|
|
420
|
-
ReferencedMessage:
|
|
421
|
-
ReplyBar:
|
|
422
|
-
TimeAgo:
|
|
423
|
-
MessageActionMenu:
|
|
424
|
-
CompactMessageContent:
|
|
425
|
-
ChatHeader:
|
|
426
|
-
Message:
|
|
427
|
-
MessageField:
|
|
428
|
-
Icon:
|
|
429
|
-
MessageDivider:
|
|
430
|
-
MessageListFooter:
|
|
431
|
-
TextBlock:
|
|
432
|
-
FileBlock:
|
|
433
|
-
LocationBlock:
|
|
434
|
-
ImageBlock:
|
|
435
|
-
AudioBlock:
|
|
436
|
-
VoiceBlock:
|
|
437
|
-
VideoBlock:
|
|
438
|
-
ConversationListItem:
|
|
1137
|
+
Avatar: React.ComponentType<AvatarProps>;
|
|
1138
|
+
ConversationImage: React.ComponentType<ConversationImageProps>;
|
|
1139
|
+
GroupChatImage: React.ComponentType<GroupChatImageProps>;
|
|
1140
|
+
ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
|
|
1141
|
+
ReplyBar: React.ComponentType<ReplyBarProps>;
|
|
1142
|
+
TimeAgo: React.ComponentType<TimeAgoProps>;
|
|
1143
|
+
MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
|
|
1144
|
+
CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
|
|
1145
|
+
ChatHeader: React.ComponentType<ChatHeaderProps>;
|
|
1146
|
+
Message: React.ComponentType<MessageProps>;
|
|
1147
|
+
MessageField: React.ComponentType<MessageFieldProps>;
|
|
1148
|
+
Icon: React.ComponentType<IconProps>;
|
|
1149
|
+
MessageDivider: React.ComponentType<MessageDividerProps>;
|
|
1150
|
+
MessageListFooter: React.ComponentType<MessageListFooterProps>;
|
|
1151
|
+
TextBlock: React.ComponentType<TextBlockProps>;
|
|
1152
|
+
FileBlock: React.ComponentType<FileBlockProps>;
|
|
1153
|
+
LocationBlock: React.ComponentType<LocationBlockProps>;
|
|
1154
|
+
ImageBlock: React.ComponentType<ImageBlockProps>;
|
|
1155
|
+
AudioBlock: React.ComponentType<AudioBlockProps>;
|
|
1156
|
+
VoiceBlock: React.ComponentType<VoiceBlockProps>;
|
|
1157
|
+
VideoBlock: React.ComponentType<VideoBlockProps>;
|
|
1158
|
+
ConversationListItem: React.ComponentType<ConversationListItemProps>;
|
|
439
1159
|
}
|
|
440
1160
|
|
|
1161
|
+
/**
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
441
1164
|
declare interface TimeAgoProps {
|
|
1165
|
+
/**
|
|
1166
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1167
|
+
*/
|
|
442
1168
|
common: CommonChatboxProps;
|
|
1169
|
+
/**
|
|
1170
|
+
* The timestamp of when the message was sent. Holds the number of milliseconds passed since the Unix Epoch.
|
|
1171
|
+
*/
|
|
443
1172
|
timestamp: number;
|
|
444
1173
|
}
|
|
445
1174
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
1175
|
+
/**
|
|
1176
|
+
* Translation object
|
|
1177
|
+
*
|
|
1178
|
+
* @public
|
|
1179
|
+
*/
|
|
1180
|
+
declare interface Translation extends TranslationStrings {
|
|
449
1181
|
locale: string;
|
|
450
1182
|
}
|
|
451
1183
|
|
|
@@ -509,35 +1241,114 @@ declare interface TranslationStrings {
|
|
|
509
1241
|
CONTACT_INFORMATION_HIDDEN: string;
|
|
510
1242
|
}
|
|
511
1243
|
|
|
1244
|
+
/**
|
|
1245
|
+
* A set of permissions for the current user.
|
|
1246
|
+
*
|
|
1247
|
+
* @remarks
|
|
1248
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
1249
|
+
*
|
|
1250
|
+
* @public
|
|
1251
|
+
*/
|
|
512
1252
|
declare interface UserPermissions {
|
|
1253
|
+
/**
|
|
1254
|
+
* True if typing indicators are enabled.
|
|
1255
|
+
*/
|
|
513
1256
|
showTypingIndicator: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/File_Sharing/ | file sharing} is enabled.
|
|
1259
|
+
*/
|
|
514
1260
|
canShareFile: boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* True if location sharing is enabled.
|
|
1263
|
+
*/
|
|
515
1264
|
canShareLocation: boolean;
|
|
1265
|
+
/**
|
|
1266
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
|
|
1267
|
+
*/
|
|
516
1268
|
canMention: boolean;
|
|
1269
|
+
/**
|
|
1270
|
+
* True if
|
|
1271
|
+
* {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
|
|
1272
|
+
* are enabled.
|
|
1273
|
+
*/
|
|
517
1274
|
showOnlineStatus: boolean;
|
|
1275
|
+
/**
|
|
1276
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Voice_Messages/ | voice messages} are enabled.
|
|
1277
|
+
*/
|
|
518
1278
|
canSendVoiceMessage: boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* True if the user has the permission to leave a given conversation.
|
|
1281
|
+
*/
|
|
519
1282
|
canLeaveConversation: boolean;
|
|
1283
|
+
/**
|
|
1284
|
+
* True if the user has the permission to mark the given conversation as unread.
|
|
1285
|
+
*/
|
|
520
1286
|
canMarkConversationAsUnread: boolean;
|
|
521
1287
|
}
|
|
522
1288
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
1289
|
+
/**
|
|
1290
|
+
* @public
|
|
1291
|
+
*/
|
|
1292
|
+
declare interface VideoBlockProps {
|
|
1293
|
+
/**
|
|
1294
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1295
|
+
*/
|
|
1296
|
+
common: CommonChatboxProps;
|
|
1297
|
+
/**
|
|
1298
|
+
* The message that this content block belongs to.
|
|
1299
|
+
*/
|
|
1300
|
+
message: MessageSnapshot;
|
|
1301
|
+
/**
|
|
1302
|
+
* The video block to display.
|
|
1303
|
+
*/
|
|
535
1304
|
block: VideoBlock;
|
|
1305
|
+
/**
|
|
1306
|
+
* The URL used to download the file.
|
|
1307
|
+
*
|
|
1308
|
+
* @remarks
|
|
1309
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1310
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1311
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1312
|
+
* the chat, which makes for a smoother user experience.
|
|
1313
|
+
*
|
|
1314
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1315
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1316
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1317
|
+
* purposes.
|
|
1318
|
+
*/
|
|
536
1319
|
downloadUrl?: string;
|
|
537
1320
|
}
|
|
538
1321
|
|
|
539
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* @public
|
|
1324
|
+
*/
|
|
1325
|
+
declare interface VoiceBlockProps {
|
|
1326
|
+
/**
|
|
1327
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1328
|
+
*/
|
|
1329
|
+
common: CommonChatboxProps;
|
|
1330
|
+
/**
|
|
1331
|
+
* The message that this content block belongs to.
|
|
1332
|
+
*/
|
|
1333
|
+
message: MessageSnapshot;
|
|
1334
|
+
/**
|
|
1335
|
+
* The voice block to display.
|
|
1336
|
+
*/
|
|
540
1337
|
block: VoiceBlock;
|
|
1338
|
+
/**
|
|
1339
|
+
* The URL used to download the file.
|
|
1340
|
+
*
|
|
1341
|
+
* @remarks
|
|
1342
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1343
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1344
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1345
|
+
* the chat, which makes for a smoother user experience.
|
|
1346
|
+
*
|
|
1347
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1348
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1349
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1350
|
+
* purposes.
|
|
1351
|
+
*/
|
|
541
1352
|
downloadUrl?: string;
|
|
542
1353
|
}
|
|
543
1354
|
|
|
@@ -551,29 +1362,3 @@ declare global {
|
|
|
551
1362
|
}
|
|
552
1363
|
}
|
|
553
1364
|
|
|
554
|
-
|
|
555
|
-
declare global {
|
|
556
|
-
namespace JSX {
|
|
557
|
-
interface IntrinsicElements {
|
|
558
|
-
"t-chatbox": typeof UnthemedChatbox;
|
|
559
|
-
"t-conversation-list": typeof UnthemedConversationList;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
declare global {
|
|
566
|
-
namespace JSX {
|
|
567
|
-
interface IntrinsicElements {
|
|
568
|
-
"emoji-picker": {
|
|
569
|
-
class?: string;
|
|
570
|
-
ref: React.Ref<HTMLElement>;
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
interface HTMLElementEventMap {
|
|
575
|
-
"emoji-click": EmojiClickEvent;
|
|
576
|
-
"skin-tone-change": SkinToneChangeEvent;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|