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