@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/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,691 @@ 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.ForwardRefExoticComponent<ChatboxProps & React.RefAttributes<ChatboxController>>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A collection of actions available on the Chatbox UI.
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
176
|
+
export declare class ChatboxController {
|
|
177
|
+
#private;
|
|
178
|
+
/**
|
|
179
|
+
* Deletes the message with the given ID.
|
|
180
|
+
*
|
|
181
|
+
* @param messageId
|
|
182
|
+
*/
|
|
183
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Enable/disable editing of a given message.
|
|
186
|
+
*
|
|
187
|
+
* @param messageId When `null` is provided, editing mode will be disabled
|
|
188
|
+
*/
|
|
189
|
+
setEditing(messageId: string | null): void;
|
|
190
|
+
/**
|
|
191
|
+
* Edit the message with the given ID.
|
|
192
|
+
*
|
|
193
|
+
* @param messageId
|
|
194
|
+
* @param params
|
|
195
|
+
*/
|
|
196
|
+
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Send a text message to the current conversation.
|
|
199
|
+
*
|
|
200
|
+
* @param params
|
|
201
|
+
*/
|
|
202
|
+
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Send a file message to the current conversation.
|
|
205
|
+
*
|
|
206
|
+
* @param message
|
|
207
|
+
*/
|
|
208
|
+
sendFileMessage(params: {
|
|
209
|
+
fileToken: FileToken;
|
|
210
|
+
custom?: Record<string, string>;
|
|
211
|
+
}): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Send a location message to the current conversation.
|
|
214
|
+
*
|
|
215
|
+
* @param message
|
|
216
|
+
*/
|
|
217
|
+
sendLocationMessage(message: {
|
|
218
|
+
location: Coordinates;
|
|
219
|
+
custom?: Record<string, string>;
|
|
220
|
+
}): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Set/unset the message that's currently being replied to.
|
|
223
|
+
*
|
|
224
|
+
* @param messageId - When `null` is provided, the "replying to" message is cleared
|
|
225
|
+
*/
|
|
226
|
+
setReferencedMessage(messageId: string | null): void;
|
|
227
|
+
/**
|
|
228
|
+
* Toggle the given emoji reaction for the given message. If the current user
|
|
229
|
+
* already added this reaction, it's removed, and otherwise, it's added.
|
|
230
|
+
*
|
|
231
|
+
* Called from the theme's Message component when the user clicks on an
|
|
232
|
+
* existing emoji reaction.
|
|
233
|
+
*
|
|
234
|
+
* @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
|
|
235
|
+
* @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
|
|
236
|
+
*/
|
|
237
|
+
toggleReaction(messageId: string, emoji: string): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Get the plaintext from the message field
|
|
240
|
+
*
|
|
241
|
+
* @returns The text
|
|
242
|
+
*/
|
|
243
|
+
getMessageFieldText(): string;
|
|
244
|
+
/**
|
|
245
|
+
* Set the plaintext in the message field
|
|
246
|
+
* @param text
|
|
247
|
+
*/
|
|
248
|
+
setMessageFieldText(text: string): void;
|
|
249
|
+
/**
|
|
250
|
+
* Focus the message field
|
|
251
|
+
*/
|
|
252
|
+
focusMessageField(): void;
|
|
253
|
+
}
|
|
121
254
|
|
|
255
|
+
/**
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
122
258
|
export declare interface ChatboxProps {
|
|
259
|
+
/**
|
|
260
|
+
* @hidden
|
|
261
|
+
*/
|
|
123
262
|
className?: string;
|
|
124
|
-
|
|
263
|
+
/**
|
|
264
|
+
* @hidden
|
|
265
|
+
*/
|
|
266
|
+
style?: React.CSSProperties;
|
|
267
|
+
/**
|
|
268
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
269
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
270
|
+
*/
|
|
125
271
|
appId: string;
|
|
272
|
+
/**
|
|
273
|
+
* The ID of the current user.
|
|
274
|
+
*
|
|
275
|
+
* @remarks
|
|
276
|
+
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
277
|
+
* be displayed.
|
|
278
|
+
*/
|
|
126
279
|
userId: string;
|
|
280
|
+
/**
|
|
281
|
+
* The ID of the conversation to display.
|
|
282
|
+
*
|
|
283
|
+
* @remarks
|
|
284
|
+
* If the conversation doesn't exist or if the current user isn't a
|
|
285
|
+
* participant of the current conversation, a "Chat not found" message will be
|
|
286
|
+
* displayed.
|
|
287
|
+
*/
|
|
127
288
|
conversationId: string;
|
|
289
|
+
/**
|
|
290
|
+
* A token to authenticate the session with.
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* See the
|
|
294
|
+
* {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide }
|
|
295
|
+
* and
|
|
296
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference }
|
|
297
|
+
* for details and examples.
|
|
298
|
+
*
|
|
299
|
+
* Required when authentication is enabled, otherwise optional.
|
|
300
|
+
*/
|
|
128
301
|
token?: string;
|
|
302
|
+
/**
|
|
303
|
+
* A function that fetches and returns a new authentication token from your
|
|
304
|
+
* server.
|
|
305
|
+
*
|
|
306
|
+
* @remarks
|
|
307
|
+
* TalkJS calls this function whenever the current token is about to expire.
|
|
308
|
+
* This callback is designed to work with any backend setup. See
|
|
309
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens }
|
|
310
|
+
* for details and examples.
|
|
311
|
+
*/
|
|
129
312
|
tokenFetcher?: () => string | Promise<string>;
|
|
313
|
+
/**
|
|
314
|
+
* Lets you override theme components with your own implementations to
|
|
315
|
+
* customize them.
|
|
316
|
+
*
|
|
317
|
+
* @remarks
|
|
318
|
+
* See
|
|
319
|
+
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
320
|
+
* for more info.
|
|
321
|
+
*/
|
|
130
322
|
theme?: Partial<Theme>;
|
|
323
|
+
/**
|
|
324
|
+
* When true, pressing Enter will send a message.
|
|
325
|
+
*
|
|
326
|
+
* @remarks
|
|
327
|
+
* Defaults to `true`.
|
|
328
|
+
*/
|
|
131
329
|
enterSendsMessage?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Sets whether the chat header is visible.
|
|
332
|
+
*
|
|
333
|
+
* @remarks
|
|
334
|
+
* Defaults to `true`.
|
|
335
|
+
*/
|
|
132
336
|
chatHeaderVisible?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Sets whether the message input field is visible.
|
|
339
|
+
*
|
|
340
|
+
* @remarks
|
|
341
|
+
* Defaults to `true`.
|
|
342
|
+
*/
|
|
133
343
|
messageFieldVisible?: boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Sets whether spellcheck is enabled in the message field.
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
* Defaults to `false`.
|
|
349
|
+
*/
|
|
134
350
|
messageFieldSpellcheck?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Adds custom placeholder text for the message input field.
|
|
353
|
+
*
|
|
354
|
+
* @remarks
|
|
355
|
+
* The default placeholder text is `"Say something..."`
|
|
356
|
+
*/
|
|
135
357
|
messageFieldPlaceholder?: string;
|
|
136
|
-
|
|
137
|
-
|
|
358
|
+
/**
|
|
359
|
+
* Callback that triggers when the user deletes a message with the TalkJS UI.
|
|
360
|
+
*
|
|
361
|
+
* @param event Event object describing the message deletion
|
|
362
|
+
*/
|
|
363
|
+
onDeleteMessage?: (event: DeleteMessageEvent) => void;
|
|
364
|
+
/**
|
|
365
|
+
* Callback that triggers when the user sends a message with the TalkJS UI.
|
|
366
|
+
*
|
|
367
|
+
* @param event Event object describing the message sending action
|
|
368
|
+
*/
|
|
369
|
+
onSendMessage?: (event: SendMessageEvent) => void;
|
|
370
|
+
/**
|
|
371
|
+
* Callback that triggers when the user initiates an action that will require
|
|
372
|
+
* a permissions request from the browser, but right before actually
|
|
373
|
+
* requesting the permission from the browser.
|
|
374
|
+
*
|
|
375
|
+
* @remarks
|
|
376
|
+
* You can use this callback to inform the user that they will need to grant a
|
|
377
|
+
* browser permission in order to perform an action.
|
|
378
|
+
*
|
|
379
|
+
* @param request Object describing the permission request
|
|
380
|
+
*/
|
|
138
381
|
beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
|
|
139
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Callback that triggers when the user attempts to initiate an action that
|
|
384
|
+
* requires a specific browser permission, but that permission was not
|
|
385
|
+
* granted.
|
|
386
|
+
*
|
|
387
|
+
* @param event Event object describing the missing permission
|
|
388
|
+
*/
|
|
389
|
+
onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
|
|
390
|
+
/**
|
|
391
|
+
* This event fires when the user clicks an action button or an action Link
|
|
392
|
+
* inside a message.
|
|
393
|
+
*
|
|
394
|
+
* The event's `action` and `params` fields specify the name of action and its
|
|
395
|
+
* parameters, if any.
|
|
396
|
+
*
|
|
397
|
+
* @see {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links}
|
|
398
|
+
*/
|
|
399
|
+
onMessageAction?: (event: MessageActionEvent) => void;
|
|
400
|
+
/**
|
|
401
|
+
* Arbitrary custom data passed down to the theme.
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* Whatever data you pass here will be made available for use in theme
|
|
405
|
+
* components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
|
|
406
|
+
* theme components and through
|
|
407
|
+
* {@linkcode CommonConversationListProps.themeCustom} for ConversationList
|
|
408
|
+
* theme components.
|
|
409
|
+
*/
|
|
140
410
|
themeCustom?: any;
|
|
141
411
|
}
|
|
142
412
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
147
|
-
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
148
|
-
sendFileMessage(message: {
|
|
149
|
-
fileToken: FileToken;
|
|
150
|
-
custom?: Record<string, string>;
|
|
151
|
-
}): Promise<void>;
|
|
152
|
-
sendLocationMessage(message: {
|
|
153
|
-
location: Coordinates;
|
|
154
|
-
custom?: Record<string, string>;
|
|
155
|
-
}): Promise<void>;
|
|
156
|
-
setReferencedMessage(messageId: string | null): void;
|
|
157
|
-
getMessageFieldText: () => string;
|
|
158
|
-
setMessageFieldText: (text: string) => void;
|
|
159
|
-
}
|
|
160
|
-
|
|
413
|
+
/**
|
|
414
|
+
* @public
|
|
415
|
+
*/
|
|
161
416
|
declare interface ChatHeaderProps {
|
|
417
|
+
/**
|
|
418
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
419
|
+
*/
|
|
162
420
|
common: CommonChatboxProps;
|
|
421
|
+
/**
|
|
422
|
+
* A record of user IDs and their connection status.
|
|
423
|
+
*/
|
|
163
424
|
isUserConnected: {
|
|
164
425
|
[userId: string]: boolean;
|
|
165
426
|
};
|
|
427
|
+
/**
|
|
428
|
+
* The current user's permissions.
|
|
429
|
+
*/
|
|
166
430
|
permissions: UserPermissions;
|
|
167
431
|
}
|
|
168
432
|
|
|
433
|
+
/**
|
|
434
|
+
* A collection of props that's shared by every themed component used in the Chatbox UI.
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
169
438
|
declare interface CommonChatboxProps {
|
|
170
|
-
|
|
439
|
+
/**
|
|
440
|
+
* Holds information about your TalkJS app.
|
|
441
|
+
*/
|
|
442
|
+
app: App;
|
|
443
|
+
/**
|
|
444
|
+
* The user that mounted this chatbox.
|
|
445
|
+
*/
|
|
171
446
|
currentUser: UserSnapshot;
|
|
447
|
+
/**
|
|
448
|
+
* A translation object which holds localized strings for internationalization
|
|
449
|
+
* purposes.
|
|
450
|
+
*/
|
|
172
451
|
t: Translation;
|
|
173
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Public interface of the chatbox instance.
|
|
454
|
+
*/
|
|
455
|
+
chatbox: ChatboxController;
|
|
456
|
+
/**
|
|
457
|
+
* Arbitrary custom data passed down to the theme.
|
|
458
|
+
*
|
|
459
|
+
* @remarks
|
|
460
|
+
* The data that you pass to {@link ChatboxProps.themeCustom} will show up
|
|
461
|
+
* here so that you can use it from within theme components.
|
|
462
|
+
*/
|
|
174
463
|
themeCustom?: any;
|
|
464
|
+
/**
|
|
465
|
+
* Describes the capabilities of the current device.
|
|
466
|
+
*/
|
|
175
467
|
device: DeviceFeatures;
|
|
468
|
+
/**
|
|
469
|
+
* The theme object that the chatbox's is currently using.
|
|
470
|
+
*/
|
|
176
471
|
theme: Theme;
|
|
472
|
+
/**
|
|
473
|
+
* The conversation displayed in the chatbox.
|
|
474
|
+
*/
|
|
177
475
|
conversation: ConversationSnapshot;
|
|
476
|
+
/**
|
|
477
|
+
* A list of participants that are part of the conversation that's currently
|
|
478
|
+
* being shown.
|
|
479
|
+
*/
|
|
178
480
|
participants: ParticipantSnapshot[];
|
|
481
|
+
/**
|
|
482
|
+
* Tells you which participants are currently typing
|
|
483
|
+
*/
|
|
179
484
|
typing: TypingSnapshot;
|
|
485
|
+
/**
|
|
486
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
487
|
+
*/
|
|
180
488
|
session: TalkSession;
|
|
181
489
|
}
|
|
182
490
|
|
|
491
|
+
/**
|
|
492
|
+
* A collection of props that's shared by every themed component used in the ConversationList UI.
|
|
493
|
+
*
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
183
496
|
declare interface CommonConversationListProps {
|
|
184
|
-
|
|
497
|
+
/**
|
|
498
|
+
* Holds information about your TalkJS app.
|
|
499
|
+
*/
|
|
500
|
+
app: App;
|
|
501
|
+
/**
|
|
502
|
+
* The user that mounted this chatbox.
|
|
503
|
+
*/
|
|
185
504
|
currentUser: UserSnapshot;
|
|
505
|
+
/**
|
|
506
|
+
* A translation object which holds localized strings for internationalization
|
|
507
|
+
* purposes.
|
|
508
|
+
*/
|
|
186
509
|
t: Translation;
|
|
510
|
+
/**
|
|
511
|
+
* Arbitrary custom data passed down to the theme.
|
|
512
|
+
*
|
|
513
|
+
* @remarks
|
|
514
|
+
* The data that you pass to {@link ConversationListProps.themeCustom} will show up
|
|
515
|
+
* here so that you can use it from within theme components.
|
|
516
|
+
*/
|
|
187
517
|
themeCustom?: any;
|
|
518
|
+
/**
|
|
519
|
+
* Describes the capabilities of the current device.
|
|
520
|
+
*/
|
|
188
521
|
device: DeviceFeatures;
|
|
522
|
+
/**
|
|
523
|
+
* The theme object that the chatbox's is currently using.
|
|
524
|
+
*/
|
|
189
525
|
theme: Theme;
|
|
190
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Public interface of the conversation list instance.
|
|
528
|
+
*/
|
|
529
|
+
conversationList: ConversationListController;
|
|
530
|
+
/**
|
|
531
|
+
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
532
|
+
*/
|
|
191
533
|
session: TalkSession;
|
|
192
534
|
}
|
|
193
535
|
|
|
536
|
+
/**
|
|
537
|
+
* @public
|
|
538
|
+
*/
|
|
194
539
|
declare interface CompactMessageContentProps {
|
|
540
|
+
/**
|
|
541
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
542
|
+
* theme components.
|
|
543
|
+
*
|
|
544
|
+
* @remarks
|
|
545
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
546
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
547
|
+
*/
|
|
195
548
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
549
|
+
/**
|
|
550
|
+
* The message that's being displayed.
|
|
551
|
+
*/
|
|
196
552
|
message: MessageSnapshot | ReferencedMessageSnapshot;
|
|
197
553
|
}
|
|
198
554
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
555
|
+
/**
|
|
556
|
+
* @public
|
|
557
|
+
*/
|
|
204
558
|
declare interface ConversationImageProps {
|
|
559
|
+
/**
|
|
560
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
561
|
+
* theme components.
|
|
562
|
+
*
|
|
563
|
+
* @remarks
|
|
564
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
565
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
566
|
+
*/
|
|
205
567
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
568
|
+
/**
|
|
569
|
+
* The conversation that's being displayed.
|
|
570
|
+
*/
|
|
206
571
|
conversation: ConversationSnapshot;
|
|
572
|
+
/**
|
|
573
|
+
* A list of participants that are a part of the conversation.
|
|
574
|
+
*/
|
|
207
575
|
participants: ParticipantSnapshot[];
|
|
208
576
|
}
|
|
209
577
|
|
|
210
|
-
export declare const ConversationList: ForwardRefExoticComponent<ConversationListProps & RefAttributes<
|
|
578
|
+
export declare const ConversationList: React.ForwardRefExoticComponent<ConversationListProps & React.RefAttributes<ConversationListController>>;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* A collection of actions available on the ConversationList UI.
|
|
582
|
+
*
|
|
583
|
+
* @public
|
|
584
|
+
*/
|
|
585
|
+
export declare class ConversationListController {
|
|
586
|
+
#private;
|
|
587
|
+
/**
|
|
588
|
+
* Select a conversation.
|
|
589
|
+
*
|
|
590
|
+
* @remarks
|
|
591
|
+
* This method is called from the theme's ConversationListItem component when
|
|
592
|
+
* the user clicks on the given conversation. You can also call it
|
|
593
|
+
* programmatically from elsewhere to simulate a user click.
|
|
594
|
+
*
|
|
595
|
+
* This method will trigger the
|
|
596
|
+
* {@linkcode ConversationListProps.onSelectConversation} event. In most
|
|
597
|
+
* cases, if you want to change the selected conversation programmatically
|
|
598
|
+
* from outside the conversation list, it's better to pass a different value
|
|
599
|
+
* to the {@linkcode ConversationListProps.selectedConversationId} prop
|
|
600
|
+
* instead, as that lets you keep your local state in sync with the props
|
|
601
|
+
* passed to the conversation list.
|
|
602
|
+
*/
|
|
603
|
+
selectConversation(conversationId: string): void;
|
|
604
|
+
}
|
|
211
605
|
|
|
212
606
|
declare interface ConversationListItemProps {
|
|
607
|
+
/**
|
|
608
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
609
|
+
*/
|
|
213
610
|
common: CommonConversationListProps;
|
|
611
|
+
/**
|
|
612
|
+
* The conversation that's being displayed.
|
|
613
|
+
*/
|
|
214
614
|
conversation: ConversationSnapshot;
|
|
615
|
+
/**
|
|
616
|
+
* The list of participants that are part of the given conversation.
|
|
617
|
+
*/
|
|
215
618
|
participants: ParticipantSnapshot[];
|
|
619
|
+
/**
|
|
620
|
+
* If `true`, this conversation is the currently selected one in the
|
|
621
|
+
* conversation list.
|
|
622
|
+
*/
|
|
216
623
|
isSelected: boolean;
|
|
217
624
|
}
|
|
218
625
|
|
|
626
|
+
/**
|
|
627
|
+
* @public
|
|
628
|
+
*/
|
|
219
629
|
export declare interface ConversationListProps {
|
|
630
|
+
/**
|
|
631
|
+
* @hidden
|
|
632
|
+
*/
|
|
220
633
|
className?: string;
|
|
221
|
-
|
|
634
|
+
/**
|
|
635
|
+
* @hidden
|
|
636
|
+
*/
|
|
637
|
+
style?: React.CSSProperties;
|
|
638
|
+
/**
|
|
639
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
640
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
641
|
+
*/
|
|
222
642
|
appId: string;
|
|
643
|
+
/**
|
|
644
|
+
* The ID of the current user.
|
|
645
|
+
*
|
|
646
|
+
* @remarks
|
|
647
|
+
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
648
|
+
* be displayed.
|
|
649
|
+
*/
|
|
223
650
|
userId: string;
|
|
224
|
-
|
|
651
|
+
/**
|
|
652
|
+
* The ID of the conversation currently selected in the list.
|
|
653
|
+
*
|
|
654
|
+
* @remarks
|
|
655
|
+
*
|
|
656
|
+
* Changing the value of this prop will cause the ConversationList UI to
|
|
657
|
+
* update.
|
|
658
|
+
*
|
|
659
|
+
* Note that updating the selected conversation through this prop **will not**
|
|
660
|
+
* trigger the {@linkcode onSelectConversation} callback.
|
|
661
|
+
*/
|
|
225
662
|
selectedConversationId?: string;
|
|
663
|
+
/**
|
|
664
|
+
* A token to authenticate the session with.
|
|
665
|
+
*
|
|
666
|
+
* @remarks
|
|
667
|
+
* See the
|
|
668
|
+
* {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide}
|
|
669
|
+
* and
|
|
670
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference}
|
|
671
|
+
* for details and examples.
|
|
672
|
+
*
|
|
673
|
+
* Required when authentication is enabled, otherwise optional.
|
|
674
|
+
*/
|
|
675
|
+
token?: string;
|
|
676
|
+
/**
|
|
677
|
+
* A function that fetches and returns a new authentication token from your
|
|
678
|
+
* server.
|
|
679
|
+
*
|
|
680
|
+
* @remarks
|
|
681
|
+
* TalkJS calls this function whenever the current token is about to expire.
|
|
682
|
+
* This callback is designed to work with any backend setup. See
|
|
683
|
+
* {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens}
|
|
684
|
+
* for details and examples.
|
|
685
|
+
*/
|
|
226
686
|
tokenFetcher?: () => string | Promise<string>;
|
|
687
|
+
/**
|
|
688
|
+
* Lets you override theme components with your own implementations to
|
|
689
|
+
* customize them.
|
|
690
|
+
*
|
|
691
|
+
* @remarks
|
|
692
|
+
* See
|
|
693
|
+
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
694
|
+
* for more info.
|
|
695
|
+
*/
|
|
227
696
|
theme?: Partial<Theme>;
|
|
697
|
+
/**
|
|
698
|
+
* Callback that triggers when the user selects a conversation from the list.
|
|
699
|
+
*
|
|
700
|
+
* @param event Event object containing the selected conversation
|
|
701
|
+
*
|
|
702
|
+
* @remarks
|
|
703
|
+
* Note that updating the selected conversation through the
|
|
704
|
+
* {@linkcode selectedConversationId} prop **will not** trigger this callback.
|
|
705
|
+
*
|
|
706
|
+
* Use this callback to have an adjacent chatbox show the correct
|
|
707
|
+
* conversation. See
|
|
708
|
+
* {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
|
|
709
|
+
*/
|
|
710
|
+
onSelectConversation?: (event: SelectConversationEvent) => void;
|
|
711
|
+
/**
|
|
712
|
+
* Arbitrary custom data passed down to the theme.
|
|
713
|
+
*
|
|
714
|
+
* @remarks
|
|
715
|
+
* Whatever data you pass here will be made available for use in theme
|
|
716
|
+
* components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
|
|
717
|
+
* theme components and through
|
|
718
|
+
* {@linkcode CommonConversationListProps.themeCustom} for ConversationList
|
|
719
|
+
* theme components.
|
|
720
|
+
*/
|
|
228
721
|
themeCustom?: any;
|
|
229
|
-
onSelectConversation?: (e: SelectConversationEvent) => void;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export declare interface ConversationListRef {
|
|
233
|
-
selectConversation(conversationId: string): void;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
declare interface Coordinates {
|
|
237
|
-
latitude: number;
|
|
238
|
-
longitude: number;
|
|
239
722
|
}
|
|
240
723
|
|
|
724
|
+
/**
|
|
725
|
+
* @public
|
|
726
|
+
*/
|
|
241
727
|
declare interface Coordinates {
|
|
242
728
|
latitude: number;
|
|
243
729
|
longitude: number;
|
|
244
730
|
}
|
|
245
731
|
|
|
732
|
+
/**
|
|
733
|
+
* The entire TalkJS default theme.
|
|
734
|
+
*
|
|
735
|
+
* @remarks
|
|
736
|
+
* The entire source code of the theme is available in the {@link https://www.github.com/talkjs/theme-default | TalkJS `theme-default` Github repository.}
|
|
737
|
+
*
|
|
738
|
+
* @public
|
|
739
|
+
*/
|
|
246
740
|
export declare const defaultTheme: Theme;
|
|
247
741
|
|
|
742
|
+
/**
|
|
743
|
+
* An event object dispatched by the {@link ChatboxProps.onDeleteMessage} event.
|
|
744
|
+
*
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
248
747
|
export declare interface DeleteMessageEvent {
|
|
249
748
|
currentUser: UserSnapshot;
|
|
749
|
+
/**
|
|
750
|
+
* The message that was just deleted.
|
|
751
|
+
*/
|
|
250
752
|
message: MessageSnapshot;
|
|
753
|
+
/**
|
|
754
|
+
* The conversation that the message used to be in.
|
|
755
|
+
*/
|
|
251
756
|
conversation: ConversationSnapshot;
|
|
252
757
|
}
|
|
253
758
|
|
|
759
|
+
/**
|
|
760
|
+
* Describes the capabilities of the current device.
|
|
761
|
+
*
|
|
762
|
+
* @public
|
|
763
|
+
*/
|
|
254
764
|
declare interface DeviceFeatures {
|
|
255
765
|
/**
|
|
256
766
|
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
257
767
|
*/
|
|
258
768
|
supportsEmojiPicker: boolean;
|
|
259
769
|
/**
|
|
260
|
-
* True if the user agents reports
|
|
770
|
+
* True if the user agents reports the current device as a mobile/tablet.
|
|
261
771
|
*/
|
|
262
772
|
isMobile: boolean;
|
|
263
773
|
}
|
|
264
774
|
|
|
265
|
-
|
|
775
|
+
/**
|
|
776
|
+
* @public
|
|
777
|
+
*/
|
|
778
|
+
declare interface FileBlockProps {
|
|
266
779
|
/**
|
|
267
|
-
*
|
|
780
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
268
781
|
*/
|
|
269
|
-
|
|
782
|
+
common: CommonChatboxProps;
|
|
270
783
|
/**
|
|
271
|
-
*
|
|
784
|
+
* The message that this content block belongs to.
|
|
785
|
+
*/
|
|
786
|
+
message: MessageSnapshot;
|
|
787
|
+
/**
|
|
788
|
+
* The generic file block to display.
|
|
789
|
+
*/
|
|
790
|
+
block: GenericFileBlock;
|
|
791
|
+
/**
|
|
792
|
+
* The URL used to download the file.
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
796
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
797
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
798
|
+
* the chat, which makes for a smoother user experience.
|
|
799
|
+
*
|
|
800
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
801
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
802
|
+
* while `block.url` will always be defined and should be used for preview
|
|
803
|
+
* purposes.
|
|
272
804
|
*/
|
|
273
|
-
isMobile: boolean;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
declare interface FileBlockProps extends ContentBlockProps {
|
|
277
|
-
block: FileBlock;
|
|
278
805
|
downloadUrl?: string;
|
|
279
806
|
}
|
|
280
807
|
|
|
808
|
+
/**
|
|
809
|
+
* @public
|
|
810
|
+
*/
|
|
281
811
|
declare interface GroupChatImageProps {
|
|
812
|
+
/**
|
|
813
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
814
|
+
* theme components.
|
|
815
|
+
*
|
|
816
|
+
* @remarks
|
|
817
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
818
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
819
|
+
*/
|
|
282
820
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
821
|
+
/**
|
|
822
|
+
* A list of participants that are a part of the conversation.
|
|
823
|
+
*/
|
|
283
824
|
participants: ParticipantSnapshot[];
|
|
284
825
|
}
|
|
285
826
|
|
|
827
|
+
/**
|
|
828
|
+
* @public
|
|
829
|
+
*/
|
|
286
830
|
declare interface IconProps {
|
|
831
|
+
/**
|
|
832
|
+
* A collection of objects which are passed to all Chatbox/ConversationList
|
|
833
|
+
* theme components.
|
|
834
|
+
*
|
|
835
|
+
* @remarks
|
|
836
|
+
* Because this particular theme component can show up in both a `<Chatbox>`
|
|
837
|
+
* and a `<ConversationList>`, this prop has a union type.
|
|
838
|
+
*/
|
|
287
839
|
common: CommonChatboxProps | CommonConversationListProps;
|
|
840
|
+
/**
|
|
841
|
+
* The name of the icon to display.
|
|
842
|
+
*/
|
|
288
843
|
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";
|
|
844
|
+
/**
|
|
845
|
+
* @hidden
|
|
846
|
+
*/
|
|
289
847
|
className?: string;
|
|
290
848
|
}
|
|
291
849
|
|
|
@@ -301,65 +859,227 @@ declare interface IEditorController {
|
|
|
301
859
|
toggleEmojiPicker(): void;
|
|
302
860
|
}
|
|
303
861
|
|
|
304
|
-
|
|
862
|
+
/**
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
declare interface ImageBlockProps {
|
|
866
|
+
/**
|
|
867
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
868
|
+
*/
|
|
869
|
+
common: CommonChatboxProps;
|
|
870
|
+
/**
|
|
871
|
+
* The message that this content block belongs to.
|
|
872
|
+
*/
|
|
873
|
+
message: MessageSnapshot;
|
|
874
|
+
/**
|
|
875
|
+
* The image block to display.
|
|
876
|
+
*/
|
|
305
877
|
block: ImageBlock;
|
|
878
|
+
/**
|
|
879
|
+
* The URL used to download the file.
|
|
880
|
+
*
|
|
881
|
+
* @remarks
|
|
882
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
883
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
884
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
885
|
+
* the chat, which makes for a smoother user experience.
|
|
886
|
+
*
|
|
887
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
888
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
889
|
+
* while `block.url` will always be defined and should be used for preview
|
|
890
|
+
* purposes.
|
|
891
|
+
*/
|
|
306
892
|
downloadUrl?: string;
|
|
307
893
|
}
|
|
308
894
|
|
|
309
|
-
|
|
895
|
+
/**
|
|
896
|
+
* @public
|
|
897
|
+
*/
|
|
898
|
+
declare interface LocationBlockProps {
|
|
899
|
+
/**
|
|
900
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
901
|
+
*/
|
|
902
|
+
common: CommonChatboxProps;
|
|
903
|
+
/**
|
|
904
|
+
* The message that this content block belongs to.
|
|
905
|
+
*/
|
|
906
|
+
message: MessageSnapshot;
|
|
907
|
+
/**
|
|
908
|
+
* The location block to display.
|
|
909
|
+
*/
|
|
310
910
|
block: LocationBlock;
|
|
311
911
|
}
|
|
312
912
|
|
|
913
|
+
/**
|
|
914
|
+
* An event object dispatched by the {@link ChatboxProps.onMessageAction} event.
|
|
915
|
+
*
|
|
916
|
+
* @public
|
|
917
|
+
*/
|
|
918
|
+
export declare interface MessageActionEvent {
|
|
919
|
+
/**
|
|
920
|
+
* The name of the action that was triggered.
|
|
921
|
+
*/
|
|
922
|
+
action: string;
|
|
923
|
+
/**
|
|
924
|
+
* The parameters of the action that was triggered, if any.
|
|
925
|
+
*/
|
|
926
|
+
params: Record<string, string>;
|
|
927
|
+
/**
|
|
928
|
+
* The message that contained the action link or action button.
|
|
929
|
+
*/
|
|
930
|
+
message: MessageSnapshot;
|
|
931
|
+
/**
|
|
932
|
+
* The current conversation.
|
|
933
|
+
*/
|
|
934
|
+
conversation: ConversationSnapshot;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* @public
|
|
939
|
+
*/
|
|
313
940
|
declare interface MessageActionMenuProps {
|
|
941
|
+
/**
|
|
942
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
943
|
+
*/
|
|
314
944
|
common: CommonChatboxProps;
|
|
945
|
+
/**
|
|
946
|
+
* The message that's attached to the action menu.
|
|
947
|
+
*/
|
|
315
948
|
message: MessageSnapshot;
|
|
949
|
+
/**
|
|
950
|
+
* The current user's permissions relating to the given message.
|
|
951
|
+
*/
|
|
316
952
|
permissions: MessagePermissions;
|
|
317
953
|
}
|
|
318
954
|
|
|
955
|
+
/**
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
319
958
|
declare interface MessageDividerProps {
|
|
959
|
+
/**
|
|
960
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
961
|
+
*/
|
|
320
962
|
common: CommonChatboxProps;
|
|
963
|
+
/**
|
|
964
|
+
* If true, this divider separates unread messages from read ones.
|
|
965
|
+
*/
|
|
321
966
|
isReadMarker: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* If true, this divider separates messages sent on two different dates.
|
|
969
|
+
*/
|
|
322
970
|
isDayMarker: boolean;
|
|
971
|
+
/**
|
|
972
|
+
* The date timestamp when {@link MessageDividerProps.isDayMarker} is `true`. Holds the number of
|
|
973
|
+
* milliseconds passed since the Unix Epoch.
|
|
974
|
+
*/
|
|
323
975
|
timestamp?: number;
|
|
324
976
|
}
|
|
325
977
|
|
|
978
|
+
/**
|
|
979
|
+
* @public
|
|
980
|
+
*/
|
|
326
981
|
declare interface MessageFieldProps {
|
|
982
|
+
/**
|
|
983
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
984
|
+
*/
|
|
327
985
|
common: CommonChatboxProps;
|
|
986
|
+
/**
|
|
987
|
+
* The message that's currently being replied to, if any.
|
|
988
|
+
*/
|
|
328
989
|
referencedMessage: MessageSnapshot | undefined;
|
|
990
|
+
/**
|
|
991
|
+
* The current user's permissions.
|
|
992
|
+
*/
|
|
329
993
|
permissions: UserPermissions;
|
|
994
|
+
/**
|
|
995
|
+
* An object holding the state of the message field.
|
|
996
|
+
*/
|
|
330
997
|
editor: IEditorController;
|
|
998
|
+
/**
|
|
999
|
+
* When a message is being edited its ID will be stored here.
|
|
1000
|
+
*/
|
|
331
1001
|
editMessageId: string | undefined;
|
|
332
1002
|
}
|
|
333
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* @public
|
|
1006
|
+
*/
|
|
334
1007
|
declare interface MessageListFooterProps {
|
|
1008
|
+
/**
|
|
1009
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1010
|
+
*/
|
|
335
1011
|
common: CommonChatboxProps;
|
|
336
1012
|
}
|
|
337
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* A set of permissions the current user has for a given message.
|
|
1016
|
+
*
|
|
1017
|
+
* @remarks
|
|
1018
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
1019
|
+
*
|
|
1020
|
+
* @public
|
|
1021
|
+
*/
|
|
338
1022
|
declare interface MessagePermissions extends UserPermissions {
|
|
1023
|
+
/**
|
|
1024
|
+
* True if the user has the ability to delete the given message.
|
|
1025
|
+
*/
|
|
339
1026
|
canDeleteMessage: boolean;
|
|
1027
|
+
/**
|
|
1028
|
+
* True if the user has the ability to reply to the given message.
|
|
1029
|
+
*/
|
|
340
1030
|
canReplyToMessage: boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* True if the user has the ability to edit the given message.
|
|
1033
|
+
*/
|
|
341
1034
|
canEditMessage: boolean;
|
|
1035
|
+
/**
|
|
1036
|
+
* 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.
|
|
1037
|
+
*/
|
|
342
1038
|
canAddReaction: boolean;
|
|
343
1039
|
}
|
|
344
1040
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
canEditMessage: boolean;
|
|
349
|
-
}
|
|
350
|
-
|
|
1041
|
+
/**
|
|
1042
|
+
* @public
|
|
1043
|
+
*/
|
|
351
1044
|
declare interface MessageProps {
|
|
1045
|
+
/**
|
|
1046
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1047
|
+
*/
|
|
352
1048
|
common: CommonChatboxProps;
|
|
1049
|
+
/**
|
|
1050
|
+
* The message that's being displayed.
|
|
1051
|
+
*/
|
|
353
1052
|
message: MessageSnapshot;
|
|
1053
|
+
/**
|
|
1054
|
+
* The current status of the message.
|
|
1055
|
+
*/
|
|
354
1056
|
messageStatus: MessageStatus;
|
|
1057
|
+
/**
|
|
1058
|
+
* The current user's permissions relating to the given message.
|
|
1059
|
+
*/
|
|
355
1060
|
permissions: MessagePermissions;
|
|
356
1061
|
}
|
|
357
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* The current status of the message.
|
|
1065
|
+
*
|
|
1066
|
+
* @remarks
|
|
1067
|
+
* This type can have one of these values:
|
|
1068
|
+
*
|
|
1069
|
+
* - `"sending"` - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.
|
|
1070
|
+
*
|
|
1071
|
+
* - `"sent"` - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.
|
|
1072
|
+
*
|
|
1073
|
+
* - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
|
|
1074
|
+
*
|
|
1075
|
+
* @public
|
|
1076
|
+
*/
|
|
358
1077
|
declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
359
1078
|
|
|
360
1079
|
/**
|
|
361
|
-
* Sent by
|
|
362
|
-
* require explicit browser permission, but that
|
|
1080
|
+
* Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
|
|
1081
|
+
* tried to do an action that require explicit browser permission, but that
|
|
1082
|
+
* permission has been denied.
|
|
363
1083
|
*
|
|
364
1084
|
* @remarks
|
|
365
1085
|
* This event is meant to let you show a message to the user if an action (eg
|
|
@@ -367,7 +1087,7 @@ declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
|
367
1087
|
* browser permission for that has been denied.
|
|
368
1088
|
*
|
|
369
1089
|
* If you want to control when to show the browser permissions prompt, use
|
|
370
|
-
*
|
|
1090
|
+
* {@link ChatboxProps.beforeBrowserPermissionPrompt}.
|
|
371
1091
|
*
|
|
372
1092
|
* This event is emitted both when the user has denied this permission in the
|
|
373
1093
|
* past, and when a user action just triggered a browser permissions prompt
|
|
@@ -388,64 +1108,136 @@ export declare interface MissingBrowserPermissionEvent {
|
|
|
388
1108
|
type: BrowserPermission;
|
|
389
1109
|
}
|
|
390
1110
|
|
|
1111
|
+
/**
|
|
1112
|
+
* @public
|
|
1113
|
+
*/
|
|
391
1114
|
declare interface ReferencedMessageProps {
|
|
1115
|
+
/**
|
|
1116
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1117
|
+
*/
|
|
392
1118
|
common: CommonChatboxProps;
|
|
1119
|
+
/**
|
|
1120
|
+
* The message that's being referenced.
|
|
1121
|
+
*/
|
|
393
1122
|
referencedMessage: ReferencedMessageSnapshot;
|
|
394
1123
|
}
|
|
395
1124
|
|
|
1125
|
+
/**
|
|
1126
|
+
* @public
|
|
1127
|
+
*/
|
|
396
1128
|
declare interface ReplyBarProps {
|
|
1129
|
+
/**
|
|
1130
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1131
|
+
*/
|
|
397
1132
|
common: CommonChatboxProps;
|
|
1133
|
+
/**
|
|
1134
|
+
* The message that's being replied to.
|
|
1135
|
+
*/
|
|
398
1136
|
referencedMessage: MessageSnapshot;
|
|
399
1137
|
}
|
|
400
1138
|
|
|
1139
|
+
/**
|
|
1140
|
+
* An event object dispatched by the
|
|
1141
|
+
* {@link ConversationListProps.onSelectConversation} event.
|
|
1142
|
+
*/
|
|
401
1143
|
export declare interface SelectConversationEvent {
|
|
402
1144
|
currentUser: UserSnapshot;
|
|
1145
|
+
/**
|
|
1146
|
+
* The newly-selected conversation.
|
|
1147
|
+
*/
|
|
403
1148
|
conversation: ConversationSnapshot;
|
|
404
1149
|
}
|
|
405
1150
|
|
|
1151
|
+
/**
|
|
1152
|
+
* An event object dispatched by the {@link ChatboxProps.onSendMessage} event.
|
|
1153
|
+
*
|
|
1154
|
+
* @public
|
|
1155
|
+
*/
|
|
406
1156
|
export declare interface SendMessageEvent {
|
|
407
1157
|
currentUser: UserSnapshot;
|
|
1158
|
+
/**
|
|
1159
|
+
* The message that was just sent.
|
|
1160
|
+
*/
|
|
408
1161
|
message: MessageSnapshot;
|
|
1162
|
+
/**
|
|
1163
|
+
* The conversation the message was sent in.
|
|
1164
|
+
*/
|
|
409
1165
|
conversation: ConversationSnapshot;
|
|
410
1166
|
}
|
|
411
1167
|
|
|
412
|
-
|
|
1168
|
+
/**
|
|
1169
|
+
* @public
|
|
1170
|
+
*/
|
|
1171
|
+
declare interface TextBlockProps {
|
|
1172
|
+
/**
|
|
1173
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1174
|
+
*/
|
|
1175
|
+
common: CommonChatboxProps;
|
|
1176
|
+
/**
|
|
1177
|
+
* The message that this content block belongs to.
|
|
1178
|
+
*/
|
|
1179
|
+
message: MessageSnapshot;
|
|
1180
|
+
/**
|
|
1181
|
+
* The text block to display.
|
|
1182
|
+
*/
|
|
413
1183
|
block: TextBlock;
|
|
414
1184
|
}
|
|
415
1185
|
|
|
1186
|
+
/**
|
|
1187
|
+
* A theme can be used to customize the appearance & behavior of your TalkJS
|
|
1188
|
+
* Chatbox and/or ConversationList.
|
|
1189
|
+
*
|
|
1190
|
+
* @remarks
|
|
1191
|
+
* The implementation of TalkJS's default theme is open-source and
|
|
1192
|
+
* {@link https://github.com/talkjs/theme-default | available on Github. }
|
|
1193
|
+
*
|
|
1194
|
+
* @public
|
|
1195
|
+
*/
|
|
416
1196
|
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:
|
|
1197
|
+
Avatar: React.ComponentType<AvatarProps>;
|
|
1198
|
+
ConversationImage: React.ComponentType<ConversationImageProps>;
|
|
1199
|
+
GroupChatImage: React.ComponentType<GroupChatImageProps>;
|
|
1200
|
+
ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
|
|
1201
|
+
ReplyBar: React.ComponentType<ReplyBarProps>;
|
|
1202
|
+
TimeAgo: React.ComponentType<TimeAgoProps>;
|
|
1203
|
+
MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
|
|
1204
|
+
CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
|
|
1205
|
+
ChatHeader: React.ComponentType<ChatHeaderProps>;
|
|
1206
|
+
Message: React.ComponentType<MessageProps>;
|
|
1207
|
+
MessageField: React.ComponentType<MessageFieldProps>;
|
|
1208
|
+
Icon: React.ComponentType<IconProps>;
|
|
1209
|
+
MessageDivider: React.ComponentType<MessageDividerProps>;
|
|
1210
|
+
MessageListFooter: React.ComponentType<MessageListFooterProps>;
|
|
1211
|
+
TextBlock: React.ComponentType<TextBlockProps>;
|
|
1212
|
+
FileBlock: React.ComponentType<FileBlockProps>;
|
|
1213
|
+
LocationBlock: React.ComponentType<LocationBlockProps>;
|
|
1214
|
+
ImageBlock: React.ComponentType<ImageBlockProps>;
|
|
1215
|
+
AudioBlock: React.ComponentType<AudioBlockProps>;
|
|
1216
|
+
VoiceBlock: React.ComponentType<VoiceBlockProps>;
|
|
1217
|
+
VideoBlock: React.ComponentType<VideoBlockProps>;
|
|
1218
|
+
ConversationListItem: React.ComponentType<ConversationListItemProps>;
|
|
439
1219
|
}
|
|
440
1220
|
|
|
1221
|
+
/**
|
|
1222
|
+
* @public
|
|
1223
|
+
*/
|
|
441
1224
|
declare interface TimeAgoProps {
|
|
1225
|
+
/**
|
|
1226
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1227
|
+
*/
|
|
442
1228
|
common: CommonChatboxProps;
|
|
1229
|
+
/**
|
|
1230
|
+
* The timestamp of when the message was sent. Holds the number of milliseconds passed since the Unix Epoch.
|
|
1231
|
+
*/
|
|
443
1232
|
timestamp: number;
|
|
444
1233
|
}
|
|
445
1234
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
1235
|
+
/**
|
|
1236
|
+
* Translation object
|
|
1237
|
+
*
|
|
1238
|
+
* @public
|
|
1239
|
+
*/
|
|
1240
|
+
declare interface Translation extends TranslationStrings {
|
|
449
1241
|
locale: string;
|
|
450
1242
|
}
|
|
451
1243
|
|
|
@@ -509,35 +1301,114 @@ declare interface TranslationStrings {
|
|
|
509
1301
|
CONTACT_INFORMATION_HIDDEN: string;
|
|
510
1302
|
}
|
|
511
1303
|
|
|
1304
|
+
/**
|
|
1305
|
+
* A set of permissions for the current user.
|
|
1306
|
+
*
|
|
1307
|
+
* @remarks
|
|
1308
|
+
* The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
|
|
1309
|
+
*
|
|
1310
|
+
* @public
|
|
1311
|
+
*/
|
|
512
1312
|
declare interface UserPermissions {
|
|
1313
|
+
/**
|
|
1314
|
+
* True if typing indicators are enabled.
|
|
1315
|
+
*/
|
|
513
1316
|
showTypingIndicator: boolean;
|
|
1317
|
+
/**
|
|
1318
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/File_Sharing/ | file sharing} is enabled.
|
|
1319
|
+
*/
|
|
514
1320
|
canShareFile: boolean;
|
|
1321
|
+
/**
|
|
1322
|
+
* True if location sharing is enabled.
|
|
1323
|
+
*/
|
|
515
1324
|
canShareLocation: boolean;
|
|
1325
|
+
/**
|
|
1326
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
|
|
1327
|
+
*/
|
|
516
1328
|
canMention: boolean;
|
|
1329
|
+
/**
|
|
1330
|
+
* True if
|
|
1331
|
+
* {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
|
|
1332
|
+
* are enabled.
|
|
1333
|
+
*/
|
|
517
1334
|
showOnlineStatus: boolean;
|
|
1335
|
+
/**
|
|
1336
|
+
* True if {@link https://talkjs.com/docs/Features/Messages/Voice_Messages/ | voice messages} are enabled.
|
|
1337
|
+
*/
|
|
518
1338
|
canSendVoiceMessage: boolean;
|
|
1339
|
+
/**
|
|
1340
|
+
* True if the user has the permission to leave a given conversation.
|
|
1341
|
+
*/
|
|
519
1342
|
canLeaveConversation: boolean;
|
|
1343
|
+
/**
|
|
1344
|
+
* True if the user has the permission to mark the given conversation as unread.
|
|
1345
|
+
*/
|
|
520
1346
|
canMarkConversationAsUnread: boolean;
|
|
521
1347
|
}
|
|
522
1348
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
1349
|
+
/**
|
|
1350
|
+
* @public
|
|
1351
|
+
*/
|
|
1352
|
+
declare interface VideoBlockProps {
|
|
1353
|
+
/**
|
|
1354
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1355
|
+
*/
|
|
1356
|
+
common: CommonChatboxProps;
|
|
1357
|
+
/**
|
|
1358
|
+
* The message that this content block belongs to.
|
|
1359
|
+
*/
|
|
1360
|
+
message: MessageSnapshot;
|
|
1361
|
+
/**
|
|
1362
|
+
* The video block to display.
|
|
1363
|
+
*/
|
|
535
1364
|
block: VideoBlock;
|
|
1365
|
+
/**
|
|
1366
|
+
* The URL used to download the file.
|
|
1367
|
+
*
|
|
1368
|
+
* @remarks
|
|
1369
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1370
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1371
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1372
|
+
* the chat, which makes for a smoother user experience.
|
|
1373
|
+
*
|
|
1374
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1375
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1376
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1377
|
+
* purposes.
|
|
1378
|
+
*/
|
|
536
1379
|
downloadUrl?: string;
|
|
537
1380
|
}
|
|
538
1381
|
|
|
539
|
-
|
|
1382
|
+
/**
|
|
1383
|
+
* @public
|
|
1384
|
+
*/
|
|
1385
|
+
declare interface VoiceBlockProps {
|
|
1386
|
+
/**
|
|
1387
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1388
|
+
*/
|
|
1389
|
+
common: CommonChatboxProps;
|
|
1390
|
+
/**
|
|
1391
|
+
* The message that this content block belongs to.
|
|
1392
|
+
*/
|
|
1393
|
+
message: MessageSnapshot;
|
|
1394
|
+
/**
|
|
1395
|
+
* The voice block to display.
|
|
1396
|
+
*/
|
|
540
1397
|
block: VoiceBlock;
|
|
1398
|
+
/**
|
|
1399
|
+
* The URL used to download the file.
|
|
1400
|
+
*
|
|
1401
|
+
* @remarks
|
|
1402
|
+
* This URL is not the same as `block.url`. When the current user sends a file
|
|
1403
|
+
* message, the `block.url` will hold a temporary `blob:` URL until that file
|
|
1404
|
+
* is uploaded to TalkJS. The user can immediately see their file present in
|
|
1405
|
+
* the chat, which makes for a smoother user experience.
|
|
1406
|
+
*
|
|
1407
|
+
* The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
|
|
1408
|
+
* such, this property will be `undefined` until the upload is completed,
|
|
1409
|
+
* while `block.url` will always be defined and should be used for preview
|
|
1410
|
+
* purposes.
|
|
1411
|
+
*/
|
|
541
1412
|
downloadUrl?: string;
|
|
542
1413
|
}
|
|
543
1414
|
|
|
@@ -546,34 +1417,8 @@ export { }
|
|
|
546
1417
|
|
|
547
1418
|
declare global {
|
|
548
1419
|
interface HTMLElementTagNameMap {
|
|
549
|
-
"t-chatbox":
|
|
550
|
-
"t-conversation-list":
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
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;
|
|
1420
|
+
"t-chatbox": ChatboxElement;
|
|
1421
|
+
"t-conversation-list": ConversationListElement;
|
|
577
1422
|
}
|
|
578
1423
|
}
|
|
579
1424
|
|