@talkjs/web-components 0.1.5 → 0.1.7
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.cjs +414 -277
- package/default.css +1 -1
- package/default.d.ts +738 -241
- package/default.js +10567 -9967
- package/package.json +1 -1
package/default.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { AudioBlock } from '@talkjs/core';
|
|
2
|
+
import { ContentBlock } from '@talkjs/core';
|
|
3
|
+
import { ConversationSearch } from '@talkjs/core';
|
|
4
|
+
import { ConversationSearchState } from '@talkjs/core';
|
|
2
5
|
import { ConversationSnapshot } from '@talkjs/core';
|
|
3
6
|
import { EditMessageParams } from '@talkjs/core';
|
|
4
7
|
import { EditTextMessageParams } from '@talkjs/core';
|
|
@@ -8,11 +11,14 @@ import { GenericFileBlock } from '@talkjs/core';
|
|
|
8
11
|
import { ImageBlock } from '@talkjs/core';
|
|
9
12
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
10
13
|
import { LocationBlock } from '@talkjs/core';
|
|
14
|
+
import { MessageSearch } from '@talkjs/core';
|
|
15
|
+
import { MessageSearchState } from '@talkjs/core';
|
|
11
16
|
import { MessageSnapshot } from '@talkjs/core';
|
|
12
17
|
import { ParticipantSnapshot } from '@talkjs/core';
|
|
13
18
|
import * as Preact from 'preact/compat';
|
|
14
19
|
import * as React_2 from 'react';
|
|
15
20
|
import { ReferencedMessageSnapshot } from '@talkjs/core';
|
|
21
|
+
import { SearchMessageSnapshot } from '@talkjs/core';
|
|
16
22
|
import { SendMessageParams } from '@talkjs/core';
|
|
17
23
|
import { SendTextMessageParams } from '@talkjs/core';
|
|
18
24
|
import { TalkSession } from '@talkjs/core';
|
|
@@ -109,6 +115,8 @@ export declare interface AudioBlockProps {
|
|
|
109
115
|
* Also, it has some additional settings that let us turn the sound wave display
|
|
110
116
|
* into a series of nice rounded bars. Less signal, but also less distraction. I
|
|
111
117
|
* kinda like it!
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
112
120
|
*/
|
|
113
121
|
export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX_2.Element;
|
|
114
122
|
|
|
@@ -153,6 +161,247 @@ export declare interface AvatarProps {
|
|
|
153
161
|
photoUrl: string;
|
|
154
162
|
}
|
|
155
163
|
|
|
164
|
+
/**
|
|
165
|
+
* An event object dispatched by the
|
|
166
|
+
* {@link ChatboxProps.onBackButtonClick} event.
|
|
167
|
+
*
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export declare interface BackButtonClickEvent {
|
|
171
|
+
currentUser: UserSnapshot;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
export declare interface BaseChatboxProps {
|
|
178
|
+
/**
|
|
179
|
+
* @hidden
|
|
180
|
+
*/
|
|
181
|
+
className?: string;
|
|
182
|
+
/**
|
|
183
|
+
* @hidden
|
|
184
|
+
*/
|
|
185
|
+
style?: React_2.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
|
+
*/
|
|
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
|
+
*/
|
|
198
|
+
userId: string;
|
|
199
|
+
/**
|
|
200
|
+
* The ID of the currently focused message.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* Whenever this value changes to a valid message ID, the relevant message
|
|
204
|
+
* will be scrolled into view.
|
|
205
|
+
*
|
|
206
|
+
* If you're using a modern web framework like React or Vue, also include an
|
|
207
|
+
* {@link onFocusMessage} prop where you'll update your local `focusedMessageId` state
|
|
208
|
+
* so that it stays in sync with the UI's internals.
|
|
209
|
+
*
|
|
210
|
+
* Note that updating the selected conversation through this prop **will not**
|
|
211
|
+
* trigger the {@link onFocusMessage} callback.
|
|
212
|
+
*/
|
|
213
|
+
focusedMessageId?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Lets you override theme components with your own implementations to
|
|
216
|
+
* customize them.
|
|
217
|
+
*
|
|
218
|
+
* @remarks
|
|
219
|
+
* See
|
|
220
|
+
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
221
|
+
* for more info.
|
|
222
|
+
*/
|
|
223
|
+
theme?: Partial<Theme>;
|
|
224
|
+
/**
|
|
225
|
+
* When true, pressing Enter will send a message.
|
|
226
|
+
*
|
|
227
|
+
* @remarks
|
|
228
|
+
* Defaults to `true`.
|
|
229
|
+
*/
|
|
230
|
+
enterSendsMessage?: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Sets whether the chat header is visible.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* Defaults to `true`.
|
|
236
|
+
*/
|
|
237
|
+
chatHeaderVisible?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Sets whether the message input field is visible.
|
|
240
|
+
*
|
|
241
|
+
* @remarks
|
|
242
|
+
* Defaults to `true`.
|
|
243
|
+
*/
|
|
244
|
+
messageFieldVisible?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Sets whether spellcheck is enabled in the message field.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* Defaults to `false`.
|
|
250
|
+
*/
|
|
251
|
+
messageFieldSpellcheck?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Adds custom placeholder text for the message input field.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* The default placeholder text is `"Say something..."`
|
|
257
|
+
*/
|
|
258
|
+
messageFieldPlaceholder?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Callback that triggers when the user deletes a message with the TalkJS UI.
|
|
261
|
+
*
|
|
262
|
+
* @param event - Event object describing the message deletion
|
|
263
|
+
*/
|
|
264
|
+
onDeleteMessage?: (event: DeleteMessageEvent) => void;
|
|
265
|
+
/**
|
|
266
|
+
* Callback that triggers when the user sends a message with the TalkJS UI.
|
|
267
|
+
*
|
|
268
|
+
* @param event - Event object describing the message sending action
|
|
269
|
+
*/
|
|
270
|
+
onSendMessage?: (event: SendMessageEvent) => void;
|
|
271
|
+
/**
|
|
272
|
+
* Callback that triggers when the user initiates an action that will require
|
|
273
|
+
* a permissions request from the browser, but right before actually
|
|
274
|
+
* requesting the permission from the browser.
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* You can use this callback to inform the user that they will need to grant a
|
|
278
|
+
* browser permission in order to perform an action.
|
|
279
|
+
*
|
|
280
|
+
* @param request - Object describing the permission request
|
|
281
|
+
*/
|
|
282
|
+
beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
|
|
283
|
+
/**
|
|
284
|
+
* Callback that triggers when the user attempts to initiate an action that
|
|
285
|
+
* requires a specific browser permission, but that permission was not
|
|
286
|
+
* granted.
|
|
287
|
+
*
|
|
288
|
+
* @param event - Event object describing the missing permission
|
|
289
|
+
*/
|
|
290
|
+
onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
|
|
291
|
+
/**
|
|
292
|
+
* This event fires when the user clicks an action button or an action Link
|
|
293
|
+
* inside a message.
|
|
294
|
+
*
|
|
295
|
+
* @remarks
|
|
296
|
+
* The event's `action` and `params` fields specify the name of action and its
|
|
297
|
+
* parameters, if any.
|
|
298
|
+
*
|
|
299
|
+
* See
|
|
300
|
+
* {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
|
|
301
|
+
* for more info.
|
|
302
|
+
*/
|
|
303
|
+
onMessageAction?: (event: MessageActionEvent) => void;
|
|
304
|
+
/**
|
|
305
|
+
* Callback that triggers when a message is focused or unfocused.
|
|
306
|
+
*
|
|
307
|
+
* @param event - Event object describing the message focus action
|
|
308
|
+
*
|
|
309
|
+
* @remarks
|
|
310
|
+
* Note that updating the focused message through the
|
|
311
|
+
* {@link focusedMessageId} prop **will not** trigger this callback.
|
|
312
|
+
*/
|
|
313
|
+
onFocusMessage?: (event: FocusMessageEvent) => void;
|
|
314
|
+
/**
|
|
315
|
+
* Arbitrary custom data passed down to the theme.
|
|
316
|
+
*
|
|
317
|
+
* @remarks
|
|
318
|
+
* Whatever data you pass here will be made available for use in theme
|
|
319
|
+
* components through {@link CommonChatboxProps.themeCustom} for Chatbox
|
|
320
|
+
* theme components and through
|
|
321
|
+
* {@link CommonConversationListProps.themeCustom} for ConversationList
|
|
322
|
+
* theme components.
|
|
323
|
+
*/
|
|
324
|
+
themeCustom?: any;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @public
|
|
329
|
+
*/
|
|
330
|
+
export declare interface BaseConversationListProps {
|
|
331
|
+
/**
|
|
332
|
+
* @hidden
|
|
333
|
+
*/
|
|
334
|
+
className?: string;
|
|
335
|
+
/**
|
|
336
|
+
* @hidden
|
|
337
|
+
*/
|
|
338
|
+
style?: React_2.CSSProperties;
|
|
339
|
+
/**
|
|
340
|
+
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
341
|
+
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
342
|
+
*/
|
|
343
|
+
appId: string;
|
|
344
|
+
/**
|
|
345
|
+
* The ID of the current user.
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
349
|
+
* be displayed.
|
|
350
|
+
*/
|
|
351
|
+
userId: string;
|
|
352
|
+
/**
|
|
353
|
+
* The ID of the conversation currently selected in the list.
|
|
354
|
+
*
|
|
355
|
+
* @remarks
|
|
356
|
+
*
|
|
357
|
+
* Changing the value of this prop will cause the ConversationList UI to
|
|
358
|
+
* update.
|
|
359
|
+
*
|
|
360
|
+
* If you're using a modern web framework like React or Vue, also include an
|
|
361
|
+
* {@link onSelectConversation} prop where you'll update your local `selectedConversationId` state
|
|
362
|
+
* so that it stays in sync with the UI's internals.
|
|
363
|
+
*
|
|
364
|
+
* Note that updating the selected conversation through this prop **will not**
|
|
365
|
+
* trigger the {@link onSelectConversation} callback.
|
|
366
|
+
*/
|
|
367
|
+
selectedConversationId?: string;
|
|
368
|
+
/**
|
|
369
|
+
* Lets you override theme components with your own implementations to
|
|
370
|
+
* customize them.
|
|
371
|
+
*
|
|
372
|
+
* @remarks
|
|
373
|
+
* See
|
|
374
|
+
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
375
|
+
* for more info.
|
|
376
|
+
*/
|
|
377
|
+
theme?: Partial<Theme>;
|
|
378
|
+
/**
|
|
379
|
+
* Callback that triggers when the user selects a conversation from the list.
|
|
380
|
+
*
|
|
381
|
+
* @param event - Event object containing the selected conversation
|
|
382
|
+
*
|
|
383
|
+
* @remarks
|
|
384
|
+
* Note that updating the selected conversation through the
|
|
385
|
+
* {@link selectedConversationId} prop **will not** trigger this callback.
|
|
386
|
+
*
|
|
387
|
+
* Use this callback to have an adjacent chatbox show the correct
|
|
388
|
+
* conversation. See
|
|
389
|
+
* {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
|
|
390
|
+
*/
|
|
391
|
+
onSelectConversation?: (event: SelectConversationEvent) => void;
|
|
392
|
+
/**
|
|
393
|
+
* Arbitrary custom data passed down to the theme.
|
|
394
|
+
*
|
|
395
|
+
* @remarks
|
|
396
|
+
* Whatever data you pass here will be made available for use in theme
|
|
397
|
+
* components through {@link CommonChatboxProps.themeCustom} for Chatbox
|
|
398
|
+
* theme components and through
|
|
399
|
+
* {@link CommonConversationListProps.themeCustom} for ConversationList
|
|
400
|
+
* theme components.
|
|
401
|
+
*/
|
|
402
|
+
themeCustom?: any;
|
|
403
|
+
}
|
|
404
|
+
|
|
156
405
|
/**
|
|
157
406
|
* @public
|
|
158
407
|
*/
|
|
@@ -229,33 +478,24 @@ export declare class ChatboxController {
|
|
|
229
478
|
#private;
|
|
230
479
|
/**
|
|
231
480
|
* Deletes the message with the given ID.
|
|
232
|
-
*
|
|
233
|
-
* @param messageId
|
|
234
481
|
*/
|
|
235
482
|
deleteMessage(messageId: string): Promise<void>;
|
|
236
483
|
/**
|
|
237
484
|
* Enable/disable editing of a given message.
|
|
238
485
|
*
|
|
239
|
-
* @param messageId When `null` is provided, editing mode will be disabled
|
|
486
|
+
* @param messageId - When `null` is provided, editing mode will be disabled
|
|
240
487
|
*/
|
|
241
488
|
setEditing(messageId: string | null): void;
|
|
242
489
|
/**
|
|
243
490
|
* Edit the message with the given ID.
|
|
244
|
-
*
|
|
245
|
-
* @param messageId
|
|
246
|
-
* @param params
|
|
247
491
|
*/
|
|
248
492
|
editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
249
493
|
/**
|
|
250
494
|
* Send a text message to the current conversation.
|
|
251
|
-
*
|
|
252
|
-
* @param params
|
|
253
495
|
*/
|
|
254
496
|
sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
|
|
255
497
|
/**
|
|
256
498
|
* Send a file message to the current conversation.
|
|
257
|
-
*
|
|
258
|
-
* @param message
|
|
259
499
|
*/
|
|
260
500
|
sendFileMessage(params: {
|
|
261
501
|
fileToken: FileToken;
|
|
@@ -263,8 +503,6 @@ export declare class ChatboxController {
|
|
|
263
503
|
}): Promise<void>;
|
|
264
504
|
/**
|
|
265
505
|
* Send a location message to the current conversation.
|
|
266
|
-
*
|
|
267
|
-
* @param message
|
|
268
506
|
*/
|
|
269
507
|
sendLocationMessage(message: {
|
|
270
508
|
location: Coordinates;
|
|
@@ -285,8 +523,9 @@ export declare class ChatboxController {
|
|
|
285
523
|
*
|
|
286
524
|
* @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
|
|
287
525
|
* @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
|
|
526
|
+
* @param force - If included, turns the toggle into a one way-only operation. Setting to `true` will add this reaction for the current user and setting to `false` will remove it if it was already added for the current user
|
|
288
527
|
*/
|
|
289
|
-
toggleReaction(messageId: string, emoji: string): Promise<void>;
|
|
528
|
+
toggleReaction(messageId: string, emoji: string, force?: boolean): Promise<void>;
|
|
290
529
|
/**
|
|
291
530
|
* Get the plaintext from the message field
|
|
292
531
|
*
|
|
@@ -295,13 +534,63 @@ export declare class ChatboxController {
|
|
|
295
534
|
getMessageFieldText(): string;
|
|
296
535
|
/**
|
|
297
536
|
* Set the plaintext in the message field
|
|
298
|
-
* @param text
|
|
299
537
|
*/
|
|
300
538
|
setMessageFieldText(text: string): void;
|
|
301
539
|
/**
|
|
302
540
|
* Focus the message field
|
|
303
541
|
*/
|
|
304
542
|
focusMessageField(): void;
|
|
543
|
+
/**
|
|
544
|
+
* Toggles whether the `ChatSearchBox` should be visible or not.
|
|
545
|
+
*
|
|
546
|
+
* @param force - If included, turns the toggle into a one way-only operation. Setting to `true` will enable the search box, and setting to `false` will disable it.
|
|
547
|
+
*/
|
|
548
|
+
toggleSearchBox(force?: boolean): void;
|
|
549
|
+
/**
|
|
550
|
+
* Scrolls to the message with the given messageId and marks it as "focused",
|
|
551
|
+
* meaning the {@link CommonChatboxProps.focusedMessage} field will be
|
|
552
|
+
* populated.
|
|
553
|
+
*
|
|
554
|
+
* If `null` is passed the `focusedMessage` will be cleared.
|
|
555
|
+
*
|
|
556
|
+
* @returns `true` if a message with the given ID was found and was scrolled
|
|
557
|
+
* to.
|
|
558
|
+
*/
|
|
559
|
+
focusMessage(messageId: string | null): Promise<MessageSnapshot | null>;
|
|
560
|
+
/**
|
|
561
|
+
* Highlights certain strings in messages
|
|
562
|
+
*
|
|
563
|
+
* @remarks
|
|
564
|
+
* The TalkJS search feature includes the ability to highlight certain strings in messages. Call
|
|
565
|
+
* this method to highlight certain strings without having the user invoke the search feature.
|
|
566
|
+
* Call again with an empty array to disable highlighting.
|
|
567
|
+
*
|
|
568
|
+
* Note: like the search feature, this option only works on the Growth plan and up.
|
|
569
|
+
*/
|
|
570
|
+
setHighlightedStrings(words: string[]): void;
|
|
571
|
+
/**
|
|
572
|
+
* Searches for a message upwards that contains highlighted strings.
|
|
573
|
+
* If a message is found, the UI will scroll that message into view.
|
|
574
|
+
*
|
|
575
|
+
* Strings are highlighted when you explicitly call {@link setHighlightedStrings} or
|
|
576
|
+
* when a user types a word/phrase into the `ChatSearchBox`.
|
|
577
|
+
*
|
|
578
|
+
* @returns A promise resolving to a {@link MessageSnapshot} if a message was found. The promise
|
|
579
|
+
* resolves to `null` otherwise.
|
|
580
|
+
*/
|
|
581
|
+
jumpToPreviousHighlight(): Promise<MessageSnapshot | null>;
|
|
582
|
+
/**
|
|
583
|
+
* Searches for messages downwards that contains highlighted strings.
|
|
584
|
+
* If a message is found, the UI will scroll that message into view.
|
|
585
|
+
*
|
|
586
|
+
* Strings are highlighted when you explicitly call {@link setHighlightedStrings} or
|
|
587
|
+
* when a user types a word/phrase into the `ChatSearchBox`.
|
|
588
|
+
*
|
|
589
|
+
* @returns A promise resolving to a {@link MessageSnapshot} if a message was found. The promise
|
|
590
|
+
* resolves to `null` otherwise.
|
|
591
|
+
*/
|
|
592
|
+
jumpToNextHighlight(): Promise<MessageSnapshot | null>;
|
|
593
|
+
clickBackButton(): void;
|
|
305
594
|
}
|
|
306
595
|
|
|
307
596
|
/**
|
|
@@ -316,37 +605,38 @@ export declare const ChatboxElement: new () => TalkJS.ChatboxElement;
|
|
|
316
605
|
/**
|
|
317
606
|
* @public
|
|
318
607
|
*/
|
|
319
|
-
export declare interface ChatboxProps {
|
|
608
|
+
export declare interface ChatboxProps extends BaseChatboxProps {
|
|
320
609
|
/**
|
|
321
|
-
*
|
|
322
|
-
*/
|
|
323
|
-
className?: string;
|
|
324
|
-
/**
|
|
325
|
-
* @hidden
|
|
326
|
-
*/
|
|
327
|
-
style?: React_2.CSSProperties;
|
|
328
|
-
/**
|
|
329
|
-
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
330
|
-
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
331
|
-
*/
|
|
332
|
-
appId: string;
|
|
333
|
-
/**
|
|
334
|
-
* The ID of the current user.
|
|
610
|
+
* The ID of the conversation to display.
|
|
335
611
|
*
|
|
336
612
|
* @remarks
|
|
337
|
-
* If the
|
|
338
|
-
* be
|
|
613
|
+
* If the conversation doesn't exist or if the current user isn't a
|
|
614
|
+
* participant of the current conversation, a "Conversation not found" message will be
|
|
615
|
+
* displayed (after a timeout). If you create the conversation in parallel (eg
|
|
616
|
+
* via the REST API or via the Data API), it will show in the chatbox
|
|
617
|
+
* automatically. This means that you can safely point a chatbox at a
|
|
618
|
+
* conversation that might not yet exist. This way the chatbox UI and the
|
|
619
|
+
* conversation can load in parallel, which results in snappier UX.
|
|
620
|
+
*
|
|
621
|
+
* Passing `null` deselects the current conversation and shows an empty panel.
|
|
622
|
+
* This may be useful for Inbox-like scenarios where you want to keep the
|
|
623
|
+
* chatbox loaded, without showing a conversation.
|
|
624
|
+
*
|
|
625
|
+
* In the background, the Chatbox keeps active subscriptions to recent
|
|
626
|
+
* conversations, so that switching back and forth between conversations has
|
|
627
|
+
* snappy UX.
|
|
339
628
|
*/
|
|
340
|
-
|
|
629
|
+
conversationId: string | null;
|
|
341
630
|
/**
|
|
342
|
-
*
|
|
631
|
+
* Fired when the back button in the chat header is clicked.
|
|
343
632
|
*
|
|
344
633
|
* @remarks
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
634
|
+
* By default this back button is only shown inside an inbox on small screens.
|
|
635
|
+
* You can change this behavior in the ChatHeader theme.
|
|
636
|
+
*
|
|
637
|
+
* @public
|
|
348
638
|
*/
|
|
349
|
-
|
|
639
|
+
onBackButtonClick?: (event: BackButtonClickEvent) => void;
|
|
350
640
|
/**
|
|
351
641
|
* A token to authenticate the session with.
|
|
352
642
|
*
|
|
@@ -371,107 +661,6 @@ export declare interface ChatboxProps {
|
|
|
371
661
|
* for details and examples.
|
|
372
662
|
*/
|
|
373
663
|
tokenFetcher?: () => string | Promise<string>;
|
|
374
|
-
/**
|
|
375
|
-
* Lets you override theme components with your own implementations to
|
|
376
|
-
* customize them.
|
|
377
|
-
*
|
|
378
|
-
* @remarks
|
|
379
|
-
* See
|
|
380
|
-
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
381
|
-
* for more info.
|
|
382
|
-
*/
|
|
383
|
-
theme?: Partial<Theme>;
|
|
384
|
-
/**
|
|
385
|
-
* When true, pressing Enter will send a message.
|
|
386
|
-
*
|
|
387
|
-
* @remarks
|
|
388
|
-
* Defaults to `true`.
|
|
389
|
-
*/
|
|
390
|
-
enterSendsMessage?: boolean;
|
|
391
|
-
/**
|
|
392
|
-
* Sets whether the chat header is visible.
|
|
393
|
-
*
|
|
394
|
-
* @remarks
|
|
395
|
-
* Defaults to `true`.
|
|
396
|
-
*/
|
|
397
|
-
chatHeaderVisible?: boolean;
|
|
398
|
-
/**
|
|
399
|
-
* Sets whether the message input field is visible.
|
|
400
|
-
*
|
|
401
|
-
* @remarks
|
|
402
|
-
* Defaults to `true`.
|
|
403
|
-
*/
|
|
404
|
-
messageFieldVisible?: boolean;
|
|
405
|
-
/**
|
|
406
|
-
* Sets whether spellcheck is enabled in the message field.
|
|
407
|
-
*
|
|
408
|
-
* @remarks
|
|
409
|
-
* Defaults to `false`.
|
|
410
|
-
*/
|
|
411
|
-
messageFieldSpellcheck?: boolean;
|
|
412
|
-
/**
|
|
413
|
-
* Adds custom placeholder text for the message input field.
|
|
414
|
-
*
|
|
415
|
-
* @remarks
|
|
416
|
-
* The default placeholder text is `"Say something..."`
|
|
417
|
-
*/
|
|
418
|
-
messageFieldPlaceholder?: string;
|
|
419
|
-
/**
|
|
420
|
-
* Callback that triggers when the user deletes a message with the TalkJS UI.
|
|
421
|
-
*
|
|
422
|
-
* @param event Event object describing the message deletion
|
|
423
|
-
*/
|
|
424
|
-
onDeleteMessage?: (event: DeleteMessageEvent) => void;
|
|
425
|
-
/**
|
|
426
|
-
* Callback that triggers when the user sends a message with the TalkJS UI.
|
|
427
|
-
*
|
|
428
|
-
* @param event Event object describing the message sending action
|
|
429
|
-
*/
|
|
430
|
-
onSendMessage?: (event: SendMessageEvent) => void;
|
|
431
|
-
/**
|
|
432
|
-
* Callback that triggers when the user initiates an action that will require
|
|
433
|
-
* a permissions request from the browser, but right before actually
|
|
434
|
-
* requesting the permission from the browser.
|
|
435
|
-
*
|
|
436
|
-
* @remarks
|
|
437
|
-
* You can use this callback to inform the user that they will need to grant a
|
|
438
|
-
* browser permission in order to perform an action.
|
|
439
|
-
*
|
|
440
|
-
* @param request Object describing the permission request
|
|
441
|
-
*/
|
|
442
|
-
beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
|
|
443
|
-
/**
|
|
444
|
-
* Callback that triggers when the user attempts to initiate an action that
|
|
445
|
-
* requires a specific browser permission, but that permission was not
|
|
446
|
-
* granted.
|
|
447
|
-
*
|
|
448
|
-
* @param event Event object describing the missing permission
|
|
449
|
-
*/
|
|
450
|
-
onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
|
|
451
|
-
/**
|
|
452
|
-
* This event fires when the user clicks an action button or an action Link
|
|
453
|
-
* inside a message.
|
|
454
|
-
*
|
|
455
|
-
* @remarks
|
|
456
|
-
* The event's `action` and `params` fields specify the name of action and its
|
|
457
|
-
* parameters, if any.
|
|
458
|
-
*
|
|
459
|
-
* See
|
|
460
|
-
* {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
|
|
461
|
-
* for more info.
|
|
462
|
-
*/
|
|
463
|
-
onMessageAction?: (event: MessageActionEvent) => void;
|
|
464
|
-
/**
|
|
465
|
-
* Arbitrary custom data passed down to the theme.
|
|
466
|
-
*
|
|
467
|
-
* @remarks
|
|
468
|
-
* Whatever data you pass here will be made available for use in theme
|
|
469
|
-
* components through {@link CommonChatboxProps.themeCustom} for Chatbox
|
|
470
|
-
* theme components and through
|
|
471
|
-
* {@link CommonConversationListProps.themeCustom} for ConversationList
|
|
472
|
-
* theme components.
|
|
473
|
-
*/
|
|
474
|
-
themeCustom?: any;
|
|
475
664
|
}
|
|
476
665
|
|
|
477
666
|
/**
|
|
@@ -494,6 +683,36 @@ export declare interface ChatHeaderProps {
|
|
|
494
683
|
permissions: UserPermissions;
|
|
495
684
|
}
|
|
496
685
|
|
|
686
|
+
/**
|
|
687
|
+
* @public
|
|
688
|
+
*/
|
|
689
|
+
export declare interface ChatSearchBoxProps {
|
|
690
|
+
/**
|
|
691
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
692
|
+
*/
|
|
693
|
+
common: CommonChatboxProps;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* The current state of the chat search
|
|
698
|
+
*
|
|
699
|
+
* @remarks
|
|
700
|
+
* This type can have one of these values:
|
|
701
|
+
*
|
|
702
|
+
* - `"hidden"` - The {@link Theme.ChatSearchBox} is not shown to the user.
|
|
703
|
+
*
|
|
704
|
+
* - `"visible"` - The {@link Theme.ChatSearchBox} is shown to the user.
|
|
705
|
+
*
|
|
706
|
+
* - `"searching"` - Waiting for more older messages to be loaded from the server.
|
|
707
|
+
*
|
|
708
|
+
* - `"noResults"` - There are 0 messages that contain the phrase entered by the user.
|
|
709
|
+
*
|
|
710
|
+
* - `"noMoreResults"` - There are not any more messages in the given direction that contain a match for the phrase entered by the user.
|
|
711
|
+
*
|
|
712
|
+
* @public
|
|
713
|
+
*/
|
|
714
|
+
export declare type ChatSearchState = "hidden" | "visible" | "searching" | "noResults" | "noMoreResults";
|
|
715
|
+
|
|
497
716
|
/**
|
|
498
717
|
* A collection of props that's shared by every themed component used in the Chatbox UI.
|
|
499
718
|
*
|
|
@@ -530,21 +749,40 @@ export declare interface CommonChatboxProps {
|
|
|
530
749
|
*/
|
|
531
750
|
device: DeviceFeatures;
|
|
532
751
|
/**
|
|
533
|
-
* The theme object that the chatbox
|
|
752
|
+
* The theme object that the chatbox is currently using.
|
|
534
753
|
*/
|
|
535
754
|
theme: Theme;
|
|
755
|
+
/**
|
|
756
|
+
* The ID of the conversation displayed in the chatbox.
|
|
757
|
+
*
|
|
758
|
+
* @remarks
|
|
759
|
+
* Prefer this field instead of `common.conversation.id` (which always has the
|
|
760
|
+
* same value), as this enables an optimization that prevents needless
|
|
761
|
+
* re-renders.
|
|
762
|
+
*/
|
|
763
|
+
conversationId: string;
|
|
536
764
|
/**
|
|
537
765
|
* The conversation displayed in the chatbox.
|
|
538
766
|
*/
|
|
539
767
|
conversation: ConversationSnapshot;
|
|
540
768
|
/**
|
|
541
|
-
* Tells you which participants are currently typing
|
|
769
|
+
* Tells you which participants are currently typing.
|
|
542
770
|
*/
|
|
543
771
|
typing: TypingSnapshot;
|
|
544
772
|
/**
|
|
545
773
|
* The underlying TalkJS session object that handles sending and receiving chat data.
|
|
546
774
|
*/
|
|
547
775
|
session: TalkSession;
|
|
776
|
+
/**
|
|
777
|
+
* The message that was most recently scrolled into view as a result of calling one of the following methods:
|
|
778
|
+
* {@link ChatboxController.focusMessage}, {@link ChatboxController.jumpToPreviousHighlight}
|
|
779
|
+
* or {@link ChatboxController.jumpToNextHighlight}
|
|
780
|
+
*/
|
|
781
|
+
focusedMessage: MessageSnapshot | null;
|
|
782
|
+
/**
|
|
783
|
+
* The current state of the chat search
|
|
784
|
+
*/
|
|
785
|
+
chatSearchState: ChatSearchState;
|
|
548
786
|
}
|
|
549
787
|
|
|
550
788
|
/**
|
|
@@ -579,7 +817,7 @@ export declare interface CommonConversationListProps {
|
|
|
579
817
|
*/
|
|
580
818
|
device: DeviceFeatures;
|
|
581
819
|
/**
|
|
582
|
-
* The theme object that the
|
|
820
|
+
* The theme object that the conversation list is currently using.
|
|
583
821
|
*/
|
|
584
822
|
theme: Theme;
|
|
585
823
|
/**
|
|
@@ -642,7 +880,8 @@ export declare interface ConversationImageProps {
|
|
|
642
880
|
export declare class ConversationListController {
|
|
643
881
|
#private;
|
|
644
882
|
/**
|
|
645
|
-
*
|
|
883
|
+
* Selects a conversation with the given ID, or de-select a conversation by
|
|
884
|
+
* passing `null`.
|
|
646
885
|
*
|
|
647
886
|
* @remarks
|
|
648
887
|
* This method is called from the theme's ConversationListItem component when
|
|
@@ -656,8 +895,11 @@ export declare class ConversationListController {
|
|
|
656
895
|
* to the {@link ConversationListProps.selectedConversationId} prop
|
|
657
896
|
* instead, as that lets you keep your local state in sync with the props
|
|
658
897
|
* passed to the conversation list.
|
|
898
|
+
*
|
|
899
|
+
* You can also optionally pass a `focusedMessageId` to signify the intent
|
|
900
|
+
* of scrolling to a particular message within that conversation.
|
|
659
901
|
*/
|
|
660
|
-
selectConversation(conversationId: string): void
|
|
902
|
+
selectConversation(conversationId: string | null, focusedMessageId?: string): Promise<void>;
|
|
661
903
|
}
|
|
662
904
|
|
|
663
905
|
/**
|
|
@@ -671,59 +913,29 @@ export declare class ConversationListController {
|
|
|
671
913
|
*/
|
|
672
914
|
export declare const ConversationListElement: new () => TalkJS.ConversationListElement;
|
|
673
915
|
|
|
674
|
-
export declare interface ConversationListItemProps {
|
|
675
|
-
/**
|
|
676
|
-
* A collection of objects which are passed to all ConversationList theme components.
|
|
677
|
-
*/
|
|
678
|
-
common: CommonConversationListProps;
|
|
679
|
-
/**
|
|
680
|
-
* The conversation that's being displayed.
|
|
681
|
-
*/
|
|
682
|
-
conversation: ConversationSnapshot;
|
|
683
|
-
/**
|
|
684
|
-
* If `true`, this conversation is the currently selected one in the
|
|
685
|
-
* conversation list.
|
|
686
|
-
*/
|
|
687
|
-
isSelected: boolean;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
916
|
/**
|
|
691
917
|
* @public
|
|
692
918
|
*/
|
|
693
|
-
export declare interface
|
|
694
|
-
/**
|
|
695
|
-
* @hidden
|
|
696
|
-
*/
|
|
697
|
-
className?: string;
|
|
698
|
-
/**
|
|
699
|
-
* @hidden
|
|
700
|
-
*/
|
|
701
|
-
style?: React_2.CSSProperties;
|
|
702
|
-
/**
|
|
703
|
-
* Your app's unique TalkJS ID. You can find it on the Settings page of the
|
|
704
|
-
* {@link https://talkjs.com/dashboard | TalkJS dashboard.}
|
|
705
|
-
*/
|
|
706
|
-
appId: string;
|
|
919
|
+
export declare interface ConversationListItemProps {
|
|
707
920
|
/**
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
* @remarks
|
|
711
|
-
* If the given user ID doesn't exist, a "Something went wrong" message will
|
|
712
|
-
* be displayed.
|
|
921
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
713
922
|
*/
|
|
714
|
-
|
|
923
|
+
common: CommonConversationListProps;
|
|
715
924
|
/**
|
|
716
|
-
* The
|
|
717
|
-
*
|
|
718
|
-
* @remarks
|
|
719
|
-
*
|
|
720
|
-
* Changing the value of this prop will cause the ConversationList UI to
|
|
721
|
-
* update.
|
|
722
|
-
*
|
|
723
|
-
* Note that updating the selected conversation through this prop **will not**
|
|
724
|
-
* trigger the {@link onSelectConversation} callback.
|
|
925
|
+
* The conversation that's being displayed.
|
|
725
926
|
*/
|
|
726
|
-
|
|
927
|
+
conversation: ConversationSnapshot;
|
|
928
|
+
/**
|
|
929
|
+
* If `true`, this conversation is the currently selected one in the
|
|
930
|
+
* conversation list.
|
|
931
|
+
*/
|
|
932
|
+
isSelected: boolean;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
export declare interface ConversationListProps extends BaseConversationListProps {
|
|
727
939
|
/**
|
|
728
940
|
* A token to authenticate the session with.
|
|
729
941
|
*
|
|
@@ -748,43 +960,12 @@ export declare interface ConversationListProps {
|
|
|
748
960
|
* for details and examples.
|
|
749
961
|
*/
|
|
750
962
|
tokenFetcher?: () => string | Promise<string>;
|
|
751
|
-
/**
|
|
752
|
-
* Lets you override theme components with your own implementations to
|
|
753
|
-
* customize them.
|
|
754
|
-
*
|
|
755
|
-
* @remarks
|
|
756
|
-
* See
|
|
757
|
-
* {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
|
|
758
|
-
* for more info.
|
|
759
|
-
*/
|
|
760
|
-
theme?: Partial<Theme>;
|
|
761
|
-
/**
|
|
762
|
-
* Callback that triggers when the user selects a conversation from the list.
|
|
763
|
-
*
|
|
764
|
-
* @param event Event object containing the selected conversation
|
|
765
|
-
*
|
|
766
|
-
* @remarks
|
|
767
|
-
* Note that updating the selected conversation through the
|
|
768
|
-
* {@link selectedConversationId} prop **will not** trigger this callback.
|
|
769
|
-
*
|
|
770
|
-
* Use this callback to have an adjacent chatbox show the correct
|
|
771
|
-
* conversation. See
|
|
772
|
-
* {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
|
|
773
|
-
*/
|
|
774
|
-
onSelectConversation?: (event: SelectConversationEvent) => void;
|
|
775
|
-
/**
|
|
776
|
-
* Arbitrary custom data passed down to the theme.
|
|
777
|
-
*
|
|
778
|
-
* @remarks
|
|
779
|
-
* Whatever data you pass here will be made available for use in theme
|
|
780
|
-
* components through {@link CommonChatboxProps.themeCustom} for Chatbox
|
|
781
|
-
* theme components and through
|
|
782
|
-
* {@link CommonConversationListProps.themeCustom} for ConversationList
|
|
783
|
-
* theme components.
|
|
784
|
-
*/
|
|
785
|
-
themeCustom?: any;
|
|
786
963
|
}
|
|
787
964
|
|
|
965
|
+
export { ConversationSearch }
|
|
966
|
+
|
|
967
|
+
export { ConversationSearchState }
|
|
968
|
+
|
|
788
969
|
export { ConversationSnapshot }
|
|
789
970
|
|
|
790
971
|
/**
|
|
@@ -838,18 +1019,52 @@ export declare interface DeviceFeatures {
|
|
|
838
1019
|
isMobile: boolean;
|
|
839
1020
|
}
|
|
840
1021
|
|
|
1022
|
+
/**
|
|
1023
|
+
* @public
|
|
1024
|
+
*/
|
|
841
1025
|
export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX_2.Element;
|
|
842
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* Lets you query and control the message editor.
|
|
1029
|
+
*
|
|
1030
|
+
* @remarks
|
|
1031
|
+
* Available inside the {@link https://talkjs.com/docs/UI_Components/Theme/Theme_components/MessageField | MessageField} theme component.
|
|
1032
|
+
* Connects with the internals of the {@link https://talkjs.com/docs/UI_Components/Theme/System_components/Editor | Editor} system component.
|
|
1033
|
+
*
|
|
1034
|
+
* @public
|
|
1035
|
+
*/
|
|
843
1036
|
export declare interface EditorController {
|
|
844
|
-
|
|
1037
|
+
/**
|
|
1038
|
+
* True if the maximum message length has been exceeded.
|
|
1039
|
+
*
|
|
1040
|
+
* @remarks
|
|
1041
|
+
* Sending should be disabled when true
|
|
1042
|
+
*/
|
|
845
1043
|
atTextLimit: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* True if the editor is empty.
|
|
1046
|
+
*/
|
|
846
1047
|
isEmpty: boolean;
|
|
1048
|
+
/**
|
|
1049
|
+
* The number of characters in the editor.
|
|
1050
|
+
*
|
|
1051
|
+
* @remarks
|
|
1052
|
+
* Note that this is an estimation, and it may slightly exceed the actual number of characters in the editor.
|
|
1053
|
+
*/
|
|
847
1054
|
characterCount: number;
|
|
1055
|
+
/**
|
|
1056
|
+
* Whether the emoji picker should be shown. Toggle with {@link toggleEmojiPicker}.
|
|
1057
|
+
*/
|
|
848
1058
|
showEmojiPicker: boolean;
|
|
1059
|
+
/** Send the message and clear the editor */
|
|
849
1060
|
send(): void;
|
|
1061
|
+
/** Open the "share location" dialog */
|
|
850
1062
|
shareLocation(): void;
|
|
1063
|
+
/** Open the "attach file" dialog */
|
|
851
1064
|
attachFile(): void;
|
|
1065
|
+
/** Open or close the emoji picker */
|
|
852
1066
|
toggleEmojiPicker(): void;
|
|
1067
|
+
/** Start recording a voice message */
|
|
853
1068
|
recordVoiceMessage(): void;
|
|
854
1069
|
}
|
|
855
1070
|
|
|
@@ -888,6 +1103,9 @@ export declare interface EditorProps {
|
|
|
888
1103
|
className?: string;
|
|
889
1104
|
}
|
|
890
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* @public
|
|
1108
|
+
*/
|
|
891
1109
|
export declare function EmojiPicker(props: EmojiPickerProps): JSX_2.Element;
|
|
892
1110
|
|
|
893
1111
|
/**
|
|
@@ -901,9 +1119,7 @@ export declare interface EmojiPickerProps {
|
|
|
901
1119
|
}
|
|
902
1120
|
|
|
903
1121
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* Uses the IndexedDB-backed emoji database from "emoji-picker-element".
|
|
1122
|
+
* @public
|
|
907
1123
|
*/
|
|
908
1124
|
export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX_2.Element;
|
|
909
1125
|
|
|
@@ -948,6 +1164,18 @@ export declare interface FileBlockProps {
|
|
|
948
1164
|
downloadUrl?: string;
|
|
949
1165
|
}
|
|
950
1166
|
|
|
1167
|
+
/**
|
|
1168
|
+
* An event object dispatched by the {@link ChatboxProps.onFocusMessage} event.
|
|
1169
|
+
*
|
|
1170
|
+
* @public
|
|
1171
|
+
*/
|
|
1172
|
+
export declare interface FocusMessageEvent {
|
|
1173
|
+
/**
|
|
1174
|
+
* The message that was focused (or `null` if the focus was cleared)
|
|
1175
|
+
*/
|
|
1176
|
+
message: MessageSnapshot | null;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
951
1179
|
/**
|
|
952
1180
|
* Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
|
|
953
1181
|
* format; whichever's shorter.
|
|
@@ -992,6 +1220,79 @@ export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
|
|
|
992
1220
|
*/
|
|
993
1221
|
export declare function getRandomColor(id: string): string;
|
|
994
1222
|
|
|
1223
|
+
/**
|
|
1224
|
+
* Props passed to the GlobalSearchBox theme component.
|
|
1225
|
+
*
|
|
1226
|
+
* @public
|
|
1227
|
+
*/
|
|
1228
|
+
export declare interface GlobalSearchBoxProps {
|
|
1229
|
+
/**
|
|
1230
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
1231
|
+
*/
|
|
1232
|
+
common: CommonConversationListProps;
|
|
1233
|
+
/**
|
|
1234
|
+
* Marks the given message ID or conversation ID as the currently selected search result.
|
|
1235
|
+
*/
|
|
1236
|
+
query: string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Sets a search query for the global search
|
|
1239
|
+
*/
|
|
1240
|
+
setQuery(query: string): void;
|
|
1241
|
+
/**
|
|
1242
|
+
* Cancels the current search
|
|
1243
|
+
*/
|
|
1244
|
+
cancel(): void;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Props passed to the GlobalSearchResultHeader theme component.
|
|
1249
|
+
*
|
|
1250
|
+
* @public
|
|
1251
|
+
*/
|
|
1252
|
+
export declare interface GlobalSearchResultHeaderProps {
|
|
1253
|
+
/**
|
|
1254
|
+
* A collection of objects which are passed to all ConversationList theme components.
|
|
1255
|
+
*/
|
|
1256
|
+
common: CommonConversationListProps;
|
|
1257
|
+
/**
|
|
1258
|
+
* Whether this header is displayed above conversation search results or message search results.
|
|
1259
|
+
*/
|
|
1260
|
+
type: "messages" | "conversations";
|
|
1261
|
+
/**
|
|
1262
|
+
* True if more search results can be loaded.
|
|
1263
|
+
*/
|
|
1264
|
+
canLoadMore: boolean;
|
|
1265
|
+
/**
|
|
1266
|
+
* Call this function to load more search results.
|
|
1267
|
+
*/
|
|
1268
|
+
loadMore(): void;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
export declare interface GlobalSearchResultItemProps {
|
|
1272
|
+
/**
|
|
1273
|
+
* A collection of objects which are passed to all GlobalSearchResultItem theme components.
|
|
1274
|
+
*/
|
|
1275
|
+
common: CommonConversationListProps;
|
|
1276
|
+
/**
|
|
1277
|
+
* The conversation that's being displayed.
|
|
1278
|
+
*/
|
|
1279
|
+
conversation: ConversationSnapshot;
|
|
1280
|
+
/**
|
|
1281
|
+
* The message containing the result item. If it's missing, then the search
|
|
1282
|
+
* match is on the conversation itself.
|
|
1283
|
+
*/
|
|
1284
|
+
message?: MessageSnapshot;
|
|
1285
|
+
/**
|
|
1286
|
+
* If `true`, this search result is the currently selected one.
|
|
1287
|
+
*/
|
|
1288
|
+
isSelected: boolean;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* @public
|
|
1293
|
+
*/
|
|
1294
|
+
export declare type GlobalSearchStatus = "idle" | "searching" | "noResults";
|
|
1295
|
+
|
|
995
1296
|
/**
|
|
996
1297
|
* @public
|
|
997
1298
|
*/
|
|
@@ -1011,6 +1312,22 @@ export declare interface GroupChatImageProps {
|
|
|
1011
1312
|
participants: ParticipantSnapshot[];
|
|
1012
1313
|
}
|
|
1013
1314
|
|
|
1315
|
+
export declare function Highlightable({ text, className }: HighlightableProps): React_2.DetailedReactHTMLElement<{
|
|
1316
|
+
className: string;
|
|
1317
|
+
}, HTMLElement>;
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* @public
|
|
1321
|
+
*/
|
|
1322
|
+
export declare interface HighlightableProps {
|
|
1323
|
+
/** The text to display */
|
|
1324
|
+
text: string;
|
|
1325
|
+
/**
|
|
1326
|
+
* @hidden
|
|
1327
|
+
*/
|
|
1328
|
+
className?: string;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1014
1331
|
/**
|
|
1015
1332
|
* Parses a JSX-like React string into a React element tree.
|
|
1016
1333
|
*
|
|
@@ -1084,6 +1401,46 @@ export declare interface ImageBlockProps {
|
|
|
1084
1401
|
downloadUrl?: string;
|
|
1085
1402
|
}
|
|
1086
1403
|
|
|
1404
|
+
/**
|
|
1405
|
+
* A collection of actions available on the Inbox UI
|
|
1406
|
+
*
|
|
1407
|
+
* @remarks
|
|
1408
|
+
* Exposes a `chatbox` field which, if a conversation is currently selected,
|
|
1409
|
+
* lets you control the chatbox encapsulated by this inbox.
|
|
1410
|
+
*
|
|
1411
|
+
* @public
|
|
1412
|
+
*/
|
|
1413
|
+
export declare class InboxController {
|
|
1414
|
+
#private;
|
|
1415
|
+
/**
|
|
1416
|
+
* The {@link ChatboxController} object of the underlying chatbox
|
|
1417
|
+
*
|
|
1418
|
+
* @remarks
|
|
1419
|
+
* This lets you programmatically control the chatbox side of this inbox, ie
|
|
1420
|
+
* the right panel. For example, to control the message field text:
|
|
1421
|
+
*
|
|
1422
|
+
* ```js
|
|
1423
|
+
* // Obtain a reference to the inbox object, eg:
|
|
1424
|
+
* // const inbox = inboxRef.current; // react
|
|
1425
|
+
* // const inbox = document.querySelector("t-inbox") // web
|
|
1426
|
+
* // const inbox = inboxRef.value // vue
|
|
1427
|
+
* // etc
|
|
1428
|
+
*
|
|
1429
|
+
* inbox.chatbox.setMessageFieldText("Hey there");
|
|
1430
|
+
* ```
|
|
1431
|
+
*/
|
|
1432
|
+
get chatbox(): ChatboxController;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* The {@link https://talkjs.com/docs/Features/Chat_UIs/#inbox | Inbox UI. }
|
|
1437
|
+
* Combines a Conversation List with a Chatbox, responsively scaling down on
|
|
1438
|
+
* smaller screens.
|
|
1439
|
+
*
|
|
1440
|
+
* @public
|
|
1441
|
+
*/
|
|
1442
|
+
export declare const InboxElement: new () => TalkJS.InboxElement;
|
|
1443
|
+
|
|
1087
1444
|
export { LocationBlock }
|
|
1088
1445
|
|
|
1089
1446
|
/**
|
|
@@ -1104,18 +1461,20 @@ export declare interface LocationBlockProps {
|
|
|
1104
1461
|
block: LocationBlock;
|
|
1105
1462
|
}
|
|
1106
1463
|
|
|
1464
|
+
/**
|
|
1465
|
+
* @public
|
|
1466
|
+
*/
|
|
1107
1467
|
export declare function MentionSuggestList(props: MentionSuggestListProps): JSX_2.Element | null;
|
|
1108
1468
|
|
|
1109
|
-
export declare interface MentionSuggestList {
|
|
1110
|
-
keydown(key: string): boolean;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
1469
|
/**
|
|
1114
1470
|
* @public
|
|
1115
1471
|
*/
|
|
1116
1472
|
export declare interface MentionSuggestListProps {
|
|
1117
1473
|
}
|
|
1118
1474
|
|
|
1475
|
+
/**
|
|
1476
|
+
* @public
|
|
1477
|
+
*/
|
|
1119
1478
|
export declare function MenuItem(props: MenuItemProps): JSX_2.Element;
|
|
1120
1479
|
|
|
1121
1480
|
/**
|
|
@@ -1170,6 +1529,9 @@ export declare interface MessageActionMenuProps {
|
|
|
1170
1529
|
permissions: MessagePermissions;
|
|
1171
1530
|
}
|
|
1172
1531
|
|
|
1532
|
+
/**
|
|
1533
|
+
* @public
|
|
1534
|
+
*/
|
|
1173
1535
|
export declare function MessageContent(props: MessageContentProps): JSX_2.Element;
|
|
1174
1536
|
|
|
1175
1537
|
/**
|
|
@@ -1318,6 +1680,10 @@ export declare interface MessageProps {
|
|
|
1318
1680
|
permissions: MessagePermissions;
|
|
1319
1681
|
}
|
|
1320
1682
|
|
|
1683
|
+
export { MessageSearch }
|
|
1684
|
+
|
|
1685
|
+
export { MessageSearchState }
|
|
1686
|
+
|
|
1321
1687
|
export { MessageSnapshot }
|
|
1322
1688
|
|
|
1323
1689
|
/**
|
|
@@ -1332,9 +1698,10 @@ export { MessageSnapshot }
|
|
|
1332
1698
|
*
|
|
1333
1699
|
* - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
|
|
1334
1700
|
*
|
|
1701
|
+
* - `"virtual"` - a virtual message made with the <VirtualMessage> system component
|
|
1335
1702
|
* @public
|
|
1336
1703
|
*/
|
|
1337
|
-
export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
1704
|
+
export declare type MessageStatus = "sending" | "sent" | "everyoneRead" | "virtual";
|
|
1338
1705
|
|
|
1339
1706
|
/**
|
|
1340
1707
|
* Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
|
|
@@ -1368,6 +1735,16 @@ export declare interface MissingBrowserPermissionEvent {
|
|
|
1368
1735
|
type: BrowserPermission;
|
|
1369
1736
|
}
|
|
1370
1737
|
|
|
1738
|
+
/**
|
|
1739
|
+
* @public
|
|
1740
|
+
*/
|
|
1741
|
+
export declare interface NoConversationSelectedProps {
|
|
1742
|
+
/**
|
|
1743
|
+
* A collection of objects which are passed to all Chatbox theme components.
|
|
1744
|
+
*/
|
|
1745
|
+
common: CommonChatboxProps;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1371
1748
|
export { ParticipantSnapshot }
|
|
1372
1749
|
|
|
1373
1750
|
/**
|
|
@@ -1427,6 +1804,9 @@ export declare interface PopoverButtonProps<T extends object> extends React_2.HT
|
|
|
1427
1804
|
|
|
1428
1805
|
export { Preact }
|
|
1429
1806
|
|
|
1807
|
+
/**
|
|
1808
|
+
* @public
|
|
1809
|
+
*/
|
|
1430
1810
|
export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX_2.Element;
|
|
1431
1811
|
|
|
1432
1812
|
/**
|
|
@@ -1487,16 +1867,30 @@ export declare interface ReplyBarProps {
|
|
|
1487
1867
|
referencedMessage: MessageSnapshot;
|
|
1488
1868
|
}
|
|
1489
1869
|
|
|
1870
|
+
export declare function SearchInput(props: SearchInputProps): JSX_2.Element;
|
|
1871
|
+
|
|
1872
|
+
export declare interface SearchInputProps extends React_2.HTMLAttributes<HTMLInputElement> {
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
export { SearchMessageSnapshot }
|
|
1876
|
+
|
|
1490
1877
|
/**
|
|
1491
1878
|
* An event object dispatched by the
|
|
1492
1879
|
* {@link ConversationListProps.onSelectConversation} event.
|
|
1880
|
+
*
|
|
1881
|
+
* @public
|
|
1493
1882
|
*/
|
|
1494
1883
|
export declare interface SelectConversationEvent {
|
|
1495
1884
|
currentUser: UserSnapshot;
|
|
1496
1885
|
/**
|
|
1497
|
-
* The newly-selected conversation
|
|
1886
|
+
* The newly-selected conversation, or `null` if a conversation was
|
|
1887
|
+
* de-selected.
|
|
1498
1888
|
*/
|
|
1499
|
-
conversation: ConversationSnapshot;
|
|
1889
|
+
conversation: ConversationSnapshot | null;
|
|
1890
|
+
/**
|
|
1891
|
+
* The message that was scrolled into view within the conversation
|
|
1892
|
+
*/
|
|
1893
|
+
focusedMessage?: MessageSnapshot;
|
|
1500
1894
|
}
|
|
1501
1895
|
|
|
1502
1896
|
/**
|
|
@@ -1590,6 +1984,7 @@ export declare interface Theme {
|
|
|
1590
1984
|
TimeAgo: React_2.ComponentType<TimeAgoProps>;
|
|
1591
1985
|
MessageActionMenu: React_2.ComponentType<MessageActionMenuProps>;
|
|
1592
1986
|
CompactMessageContent: React_2.ComponentType<CompactMessageContentProps>;
|
|
1987
|
+
ChatSearchBox: React_2.ComponentType<ChatSearchBoxProps>;
|
|
1593
1988
|
ChatHeader: React_2.ComponentType<ChatHeaderProps>;
|
|
1594
1989
|
MessageListHeader: React_2.ComponentType<MessageListHeaderProps>;
|
|
1595
1990
|
Message: React_2.ComponentType<MessageProps>;
|
|
@@ -1599,6 +1994,7 @@ export declare interface Theme {
|
|
|
1599
1994
|
MessageListFooter: React_2.ComponentType<MessageListFooterProps>;
|
|
1600
1995
|
BeforeMessages: React_2.ComponentType<BeforeMessagesProps>;
|
|
1601
1996
|
AfterMessages: React_2.ComponentType<AfterMessagesProps>;
|
|
1997
|
+
NoConversationSelected: React_2.ComponentType<NoConversationSelectedProps>;
|
|
1602
1998
|
TextBlock: React_2.ComponentType<TextBlockProps>;
|
|
1603
1999
|
FileBlock: React_2.ComponentType<FileBlockProps>;
|
|
1604
2000
|
LocationBlock: React_2.ComponentType<LocationBlockProps>;
|
|
@@ -1609,6 +2005,9 @@ export declare interface Theme {
|
|
|
1609
2005
|
VoiceRecorder: React_2.ComponentType<VoiceRecorderProps>;
|
|
1610
2006
|
RecordingPreview: React_2.ComponentType<RecordingPreviewProps>;
|
|
1611
2007
|
ConversationListItem: React_2.ComponentType<ConversationListItemProps>;
|
|
2008
|
+
GlobalSearchResultItem: React_2.ComponentType<GlobalSearchResultItemProps>;
|
|
2009
|
+
GlobalSearchBox: React_2.ComponentType<GlobalSearchBoxProps>;
|
|
2010
|
+
GlobalSearchResultHeader: React_2.ComponentType<GlobalSearchResultHeaderProps>;
|
|
1612
2011
|
}
|
|
1613
2012
|
|
|
1614
2013
|
/**
|
|
@@ -1655,7 +2054,10 @@ export declare interface Translation extends TranslationStrings {
|
|
|
1655
2054
|
locale: string;
|
|
1656
2055
|
}
|
|
1657
2056
|
|
|
1658
|
-
|
|
2057
|
+
/**
|
|
2058
|
+
* @public
|
|
2059
|
+
*/
|
|
2060
|
+
export declare interface TranslationStrings {
|
|
1659
2061
|
YESTERDAY: string;
|
|
1660
2062
|
TODAY: string;
|
|
1661
2063
|
DAYS: string;
|
|
@@ -1729,6 +2131,10 @@ declare interface TranslationStrings {
|
|
|
1729
2131
|
ARIA_MORE_ACTIONS: string;
|
|
1730
2132
|
ARIA_REPLYING_TO: (senderName: string, content: string) => string;
|
|
1731
2133
|
REPLY_MODE_LEAVE_ARIA_LABEL: string;
|
|
2134
|
+
SELECT_CONVERSATION: string;
|
|
2135
|
+
SEARCH_RESULTS_CONVERSATIONS: string;
|
|
2136
|
+
SEARCH_RESULTS_MESSAGES: string;
|
|
2137
|
+
SEARCH_RESULTS_SHOW_MORE: string;
|
|
1732
2138
|
}
|
|
1733
2139
|
|
|
1734
2140
|
export { TypingSnapshot }
|
|
@@ -1741,8 +2147,8 @@ export declare type UploadState = "pending" | "done" | "error";
|
|
|
1741
2147
|
* It'll initially return an empty list, and re-render the calling component as data participants are loaded.
|
|
1742
2148
|
* It'll also cause a re-render when any of those participants change, such as when a user's name or photoUrl changes.
|
|
1743
2149
|
*
|
|
1744
|
-
* @param conversationId ID of the conversation
|
|
1745
|
-
* @param limit Maximum number of participants to subscribe to. Defaults to 10. The maximum is 100.
|
|
2150
|
+
* @param conversationId - ID of the conversation
|
|
2151
|
+
* @param limit - Maximum number of participants to subscribe to. Defaults to 10. The maximum is 100.
|
|
1746
2152
|
* @returns List of participant snapshots.
|
|
1747
2153
|
*
|
|
1748
2154
|
* @public
|
|
@@ -1753,8 +2159,8 @@ export declare function useParticipants(conversationId: string, limit?: number):
|
|
|
1753
2159
|
* Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
|
|
1754
2160
|
* 2014", depending on which is most appropriate.
|
|
1755
2161
|
*
|
|
1756
|
-
* @param timestamp The timestamp of the event in milliseconds since Unix epoch.
|
|
1757
|
-
* @param t Relevant translation object to get localized output
|
|
2162
|
+
* @param timestamp - The timestamp of the event in milliseconds since Unix epoch.
|
|
2163
|
+
* @param t - Relevant translation object to get localized output
|
|
1758
2164
|
*
|
|
1759
2165
|
* @public
|
|
1760
2166
|
*/
|
|
@@ -1785,6 +2191,10 @@ export declare interface UserPermissions {
|
|
|
1785
2191
|
* True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
|
|
1786
2192
|
*/
|
|
1787
2193
|
canMention: boolean;
|
|
2194
|
+
/**
|
|
2195
|
+
* True if the user can use search and other related features.
|
|
2196
|
+
*/
|
|
2197
|
+
canSearch: boolean;
|
|
1788
2198
|
/**
|
|
1789
2199
|
* True if
|
|
1790
2200
|
* {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
|
|
@@ -1852,6 +2262,87 @@ export declare interface VideoBlockProps {
|
|
|
1852
2262
|
downloadUrl?: string;
|
|
1853
2263
|
}
|
|
1854
2264
|
|
|
2265
|
+
/**
|
|
2266
|
+
* Lets you render a fake message with content and sender of your choice,
|
|
2267
|
+
* without having to compose a complete MessageSnapshot object.
|
|
2268
|
+
*
|
|
2269
|
+
* @remarks
|
|
2270
|
+
* This system component renders a fake message that looks and behaves like a
|
|
2271
|
+
* real chat message, but is never stored or sent through TalkJS. It is useful
|
|
2272
|
+
* for showing contextual prompts such as welcome messages at the top of a
|
|
2273
|
+
* conversation.
|
|
2274
|
+
*
|
|
2275
|
+
* Uses the provided props to compose a complete {@link MessageSnapshot} object,
|
|
2276
|
+
* which is then passed to the
|
|
2277
|
+
* {@link https://talkjs.com/docs/UI_Components/Theme/Theme_components/Message | Message} component
|
|
2278
|
+
* from your theme.
|
|
2279
|
+
*
|
|
2280
|
+
* Because the message isn't a real, stored message, the message is rendered as
|
|
2281
|
+
* if the user has no permissions to perform any actions on this message (such
|
|
2282
|
+
* as reply, edit, etc). This means the built-in action menu will not be
|
|
2283
|
+
* accessible.
|
|
2284
|
+
*
|
|
2285
|
+
* @public
|
|
2286
|
+
*/
|
|
2287
|
+
export declare function VirtualMessage(props: VirtualMessageProps): JSX_2.Element | null;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* @public
|
|
2291
|
+
*/
|
|
2292
|
+
export declare interface VirtualMessageProps {
|
|
2293
|
+
/**
|
|
2294
|
+
* The text of the message. Accepts formatting markup like the chatbox message field does, eg `*this*` would become bold.
|
|
2295
|
+
*
|
|
2296
|
+
* @remarks
|
|
2297
|
+
* Specify either `text` or `content`, but not both.
|
|
2298
|
+
*/
|
|
2299
|
+
text?: string;
|
|
2300
|
+
/**
|
|
2301
|
+
* The content of the message as a content block.
|
|
2302
|
+
*
|
|
2303
|
+
* @remarks
|
|
2304
|
+
* Lets you precisely control the formatting of the message, see
|
|
2305
|
+
* {@link https://talkjs.com/docs/Concepts/Message_Content/#sending-message-content | Message content}.
|
|
2306
|
+
* Specify either `text` or `content`, but not both.
|
|
2307
|
+
*/
|
|
2308
|
+
content?: ContentBlock[];
|
|
2309
|
+
/**
|
|
2310
|
+
* The ID of the sender of this message, or a complete UserSnapshot with the
|
|
2311
|
+
* sender's details.
|
|
2312
|
+
*
|
|
2313
|
+
* @remarks
|
|
2314
|
+
* When omitted, the message is rendered as a system message.
|
|
2315
|
+
*
|
|
2316
|
+
* When passing a UserSnapshot, this object is used in full and the user is
|
|
2317
|
+
* not loaded from the database, which means that you can also pass a fake
|
|
2318
|
+
* user that does not really exist.
|
|
2319
|
+
*/
|
|
2320
|
+
sender?: string | UserSnapshot;
|
|
2321
|
+
/**
|
|
2322
|
+
* Override the message's timestamp
|
|
2323
|
+
*
|
|
2324
|
+
* @remarks
|
|
2325
|
+
* Defaults to `-1`, which our preset themes interpret as "do not show a timestamp at all"
|
|
2326
|
+
*/
|
|
2327
|
+
createdAt?: number;
|
|
2328
|
+
/**
|
|
2329
|
+
* Control the message's delivery status
|
|
2330
|
+
*
|
|
2331
|
+
* @remarks
|
|
2332
|
+
* Defaults to "virtual", which make our preset themes not render status ticks
|
|
2333
|
+
* at all. Set it to eg `"sent"` to show a tickmark, or to `"everyoneRead"` to
|
|
2334
|
+
* show a double tickmark.
|
|
2335
|
+
*/
|
|
2336
|
+
status?: MessageStatus;
|
|
2337
|
+
/**
|
|
2338
|
+
* Custom data for the `message` object.
|
|
2339
|
+
*
|
|
2340
|
+
* @remarks
|
|
2341
|
+
* You can read this out in `message.custom` inside the Message theme component.
|
|
2342
|
+
*/
|
|
2343
|
+
custom?: Record<string, string>;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
1855
2346
|
export { VoiceBlock }
|
|
1856
2347
|
|
|
1857
2348
|
/**
|
|
@@ -1892,7 +2383,7 @@ export declare interface VoiceBlockProps {
|
|
|
1892
2383
|
* voice message currently being recorded.
|
|
1893
2384
|
*
|
|
1894
2385
|
* @remarks
|
|
1895
|
-
* Use {@link EditorController.recordVoiceMessage
|
|
2386
|
+
* Use {@link EditorController.recordVoiceMessage} to begin recording a voice
|
|
1896
2387
|
* message.
|
|
1897
2388
|
*
|
|
1898
2389
|
* @public
|
|
@@ -1984,14 +2475,20 @@ declare global {
|
|
|
1984
2475
|
type NullishConversationListProps = {
|
|
1985
2476
|
[K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
|
|
1986
2477
|
};
|
|
2478
|
+
type NullishInboxProps = {
|
|
2479
|
+
[K in keyof Omit<InboxProps, "className" | "style">]: InboxProps[K] | null | undefined;
|
|
2480
|
+
};
|
|
1987
2481
|
interface ChatboxElement extends HTMLElement, NullishChatboxProps, ChatboxController {
|
|
1988
2482
|
}
|
|
1989
2483
|
interface ConversationListElement extends HTMLElement, NullishConversationListProps, ConversationListController {
|
|
1990
2484
|
}
|
|
2485
|
+
interface InboxElement extends HTMLElement, NullishInboxProps, InboxController {
|
|
2486
|
+
}
|
|
1991
2487
|
}
|
|
1992
2488
|
interface HTMLElementTagNameMap {
|
|
1993
2489
|
"t-chatbox": TalkJS.ChatboxElement;
|
|
1994
2490
|
"t-conversation-list": TalkJS.ConversationListElement;
|
|
2491
|
+
"t-inbox": TalkJS.InboxElement;
|
|
1995
2492
|
}
|
|
1996
2493
|
}
|
|
1997
2494
|
|