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