@talkjs/web-components 0.1.5 → 0.1.6

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/default.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AudioBlock } from '@talkjs/core';
2
+ import { ContentBlock } from '@talkjs/core';
2
3
  import { ConversationSnapshot } from '@talkjs/core';
3
4
  import { EditMessageParams } from '@talkjs/core';
4
5
  import { EditTextMessageParams } from '@talkjs/core';
@@ -109,6 +110,8 @@ export declare interface AudioBlockProps {
109
110
  * Also, it has some additional settings that let us turn the sound wave display
110
111
  * into a series of nice rounded bars. Less signal, but also less distraction. I
111
112
  * kinda like it!
113
+ *
114
+ * @public
112
115
  */
113
116
  export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX_2.Element;
114
117
 
@@ -153,6 +156,218 @@ export declare interface AvatarProps {
153
156
  photoUrl: string;
154
157
  }
155
158
 
159
+ /**
160
+ * An event object dispatched by the
161
+ * {@link ChatboxProps.onBackButtonClick} event.
162
+ *
163
+ * @public
164
+ */
165
+ export declare interface BackButtonClickEvent {
166
+ currentUser: UserSnapshot;
167
+ }
168
+
169
+ /**
170
+ * @public
171
+ */
172
+ export declare interface BaseChatboxProps {
173
+ /**
174
+ * @hidden
175
+ */
176
+ className?: string;
177
+ /**
178
+ * @hidden
179
+ */
180
+ style?: React_2.CSSProperties;
181
+ /**
182
+ * Your app's unique TalkJS ID. You can find it on the Settings page of the
183
+ * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
184
+ */
185
+ appId: string;
186
+ /**
187
+ * The ID of the current user.
188
+ *
189
+ * @remarks
190
+ * If the given user ID doesn't exist, a "Something went wrong" message will
191
+ * be displayed.
192
+ */
193
+ userId: string;
194
+ /**
195
+ * Lets you override theme components with your own implementations to
196
+ * customize them.
197
+ *
198
+ * @remarks
199
+ * See
200
+ * {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
201
+ * for more info.
202
+ */
203
+ theme?: Partial<Theme>;
204
+ /**
205
+ * When true, pressing Enter will send a message.
206
+ *
207
+ * @remarks
208
+ * Defaults to `true`.
209
+ */
210
+ enterSendsMessage?: boolean;
211
+ /**
212
+ * Sets whether the chat header is visible.
213
+ *
214
+ * @remarks
215
+ * Defaults to `true`.
216
+ */
217
+ chatHeaderVisible?: boolean;
218
+ /**
219
+ * Sets whether the message input field is visible.
220
+ *
221
+ * @remarks
222
+ * Defaults to `true`.
223
+ */
224
+ messageFieldVisible?: boolean;
225
+ /**
226
+ * Sets whether spellcheck is enabled in the message field.
227
+ *
228
+ * @remarks
229
+ * Defaults to `false`.
230
+ */
231
+ messageFieldSpellcheck?: boolean;
232
+ /**
233
+ * Adds custom placeholder text for the message input field.
234
+ *
235
+ * @remarks
236
+ * The default placeholder text is `"Say something..."`
237
+ */
238
+ messageFieldPlaceholder?: string;
239
+ /**
240
+ * Callback that triggers when the user deletes a message with the TalkJS UI.
241
+ *
242
+ * @param event - Event object describing the message deletion
243
+ */
244
+ onDeleteMessage?: (event: DeleteMessageEvent) => void;
245
+ /**
246
+ * Callback that triggers when the user sends a message with the TalkJS UI.
247
+ *
248
+ * @param event - Event object describing the message sending action
249
+ */
250
+ onSendMessage?: (event: SendMessageEvent) => void;
251
+ /**
252
+ * Callback that triggers when the user initiates an action that will require
253
+ * a permissions request from the browser, but right before actually
254
+ * requesting the permission from the browser.
255
+ *
256
+ * @remarks
257
+ * You can use this callback to inform the user that they will need to grant a
258
+ * browser permission in order to perform an action.
259
+ *
260
+ * @param request - Object describing the permission request
261
+ */
262
+ beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
263
+ /**
264
+ * Callback that triggers when the user attempts to initiate an action that
265
+ * requires a specific browser permission, but that permission was not
266
+ * granted.
267
+ *
268
+ * @param event - Event object describing the missing permission
269
+ */
270
+ onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
271
+ /**
272
+ * This event fires when the user clicks an action button or an action Link
273
+ * inside a message.
274
+ *
275
+ * @remarks
276
+ * The event's `action` and `params` fields specify the name of action and its
277
+ * parameters, if any.
278
+ *
279
+ * See
280
+ * {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
281
+ * for more info.
282
+ */
283
+ onMessageAction?: (event: MessageActionEvent) => void;
284
+ /**
285
+ * Arbitrary custom data passed down to the theme.
286
+ *
287
+ * @remarks
288
+ * Whatever data you pass here will be made available for use in theme
289
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
290
+ * theme components and through
291
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
292
+ * theme components.
293
+ */
294
+ themeCustom?: any;
295
+ }
296
+
297
+ /**
298
+ * @public
299
+ */
300
+ export declare interface BaseConversationListProps {
301
+ /**
302
+ * @hidden
303
+ */
304
+ className?: string;
305
+ /**
306
+ * @hidden
307
+ */
308
+ style?: React_2.CSSProperties;
309
+ /**
310
+ * Your app's unique TalkJS ID. You can find it on the Settings page of the
311
+ * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
312
+ */
313
+ appId: string;
314
+ /**
315
+ * The ID of the current user.
316
+ *
317
+ * @remarks
318
+ * If the given user ID doesn't exist, a "Something went wrong" message will
319
+ * be displayed.
320
+ */
321
+ userId: string;
322
+ /**
323
+ * The ID of the conversation currently selected in the list.
324
+ *
325
+ * @remarks
326
+ *
327
+ * Changing the value of this prop will cause the ConversationList UI to
328
+ * update.
329
+ *
330
+ * Note that updating the selected conversation through this prop **will not**
331
+ * trigger the {@link onSelectConversation} callback.
332
+ */
333
+ selectedConversationId?: string;
334
+ /**
335
+ * Lets you override theme components with your own implementations to
336
+ * customize them.
337
+ *
338
+ * @remarks
339
+ * See
340
+ * {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
341
+ * for more info.
342
+ */
343
+ theme?: Partial<Theme>;
344
+ /**
345
+ * Callback that triggers when the user selects a conversation from the list.
346
+ *
347
+ * @param event - Event object containing the selected conversation
348
+ *
349
+ * @remarks
350
+ * Note that updating the selected conversation through the
351
+ * {@link selectedConversationId} prop **will not** trigger this callback.
352
+ *
353
+ * Use this callback to have an adjacent chatbox show the correct
354
+ * conversation. See
355
+ * {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
356
+ */
357
+ onSelectConversation?: (event: SelectConversationEvent) => void;
358
+ /**
359
+ * Arbitrary custom data passed down to the theme.
360
+ *
361
+ * @remarks
362
+ * Whatever data you pass here will be made available for use in theme
363
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
364
+ * theme components and through
365
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
366
+ * theme components.
367
+ */
368
+ themeCustom?: any;
369
+ }
370
+
156
371
  /**
157
372
  * @public
158
373
  */
@@ -229,33 +444,24 @@ export declare class ChatboxController {
229
444
  #private;
230
445
  /**
231
446
  * Deletes the message with the given ID.
232
- *
233
- * @param messageId
234
447
  */
235
448
  deleteMessage(messageId: string): Promise<void>;
236
449
  /**
237
450
  * Enable/disable editing of a given message.
238
451
  *
239
- * @param messageId When `null` is provided, editing mode will be disabled
452
+ * @param messageId - When `null` is provided, editing mode will be disabled
240
453
  */
241
454
  setEditing(messageId: string | null): void;
242
455
  /**
243
456
  * Edit the message with the given ID.
244
- *
245
- * @param messageId
246
- * @param params
247
457
  */
248
458
  editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
249
459
  /**
250
460
  * Send a text message to the current conversation.
251
- *
252
- * @param params
253
461
  */
254
462
  sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
255
463
  /**
256
464
  * Send a file message to the current conversation.
257
- *
258
- * @param message
259
465
  */
260
466
  sendFileMessage(params: {
261
467
  fileToken: FileToken;
@@ -263,8 +469,6 @@ export declare class ChatboxController {
263
469
  }): Promise<void>;
264
470
  /**
265
471
  * Send a location message to the current conversation.
266
- *
267
- * @param message
268
472
  */
269
473
  sendLocationMessage(message: {
270
474
  location: Coordinates;
@@ -295,183 +499,91 @@ export declare class ChatboxController {
295
499
  getMessageFieldText(): string;
296
500
  /**
297
501
  * Set the plaintext in the message field
298
- * @param text
299
502
  */
300
503
  setMessageFieldText(text: string): void;
301
- /**
302
- * Focus the message field
303
- */
304
- focusMessageField(): void;
305
- }
306
-
307
- /**
308
- * The
309
- * {@link https://talkjs.com/docs/Features/Chat_UIs/#chatbox | TalkJS Chatbox UI. }
310
- * Displays a single conversation.
311
- *
312
- * @public
313
- */
314
- export declare const ChatboxElement: new () => TalkJS.ChatboxElement;
315
-
316
- /**
317
- * @public
318
- */
319
- export declare interface ChatboxProps {
320
- /**
321
- * @hidden
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.
335
- *
336
- * @remarks
337
- * If the given user ID doesn't exist, a "Something went wrong" message will
338
- * be displayed.
339
- */
340
- userId: string;
341
- /**
342
- * The ID of the conversation to display.
343
- *
344
- * @remarks
345
- * If the conversation doesn't exist or if the current user isn't a
346
- * participant of the current conversation, a "Chat not found" message will be
347
- * displayed.
348
- */
349
- conversationId: string;
350
- /**
351
- * A token to authenticate the session with.
352
- *
353
- * @remarks
354
- * See the
355
- * {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide }
356
- * and
357
- * {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference }
358
- * for details and examples.
359
- *
360
- * Required when authentication is enabled, otherwise optional.
361
- */
362
- token?: string;
363
- /**
364
- * A function that fetches and returns a new authentication token from your
365
- * server.
366
- *
367
- * @remarks
368
- * TalkJS calls this function whenever the current token is about to expire.
369
- * This callback is designed to work with any backend setup. See
370
- * {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens }
371
- * for details and examples.
372
- */
373
- 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
504
+ /**
505
+ * Focus the message field
423
506
  */
424
- onDeleteMessage?: (event: DeleteMessageEvent) => void;
507
+ focusMessageField(): void;
425
508
  /**
426
- * Callback that triggers when the user sends a message with the TalkJS UI.
509
+ * Emits a {@link ChatboxController.onBackButtonClick} event.
427
510
  *
428
- * @param event Event object describing the message sending action
511
+ * @remarks
512
+ * Called from the default ChatHeader theme component for the "back" button
513
+ * which is shown when the chatbox is part of an inbox that's being rendered
514
+ * in mobile mode.
429
515
  */
430
- onSendMessage?: (event: SendMessageEvent) => void;
516
+ clickBackButton(): void;
517
+ }
518
+
519
+ /**
520
+ * The
521
+ * {@link https://talkjs.com/docs/Features/Chat_UIs/#chatbox | TalkJS Chatbox UI. }
522
+ * Displays a single conversation.
523
+ *
524
+ * @public
525
+ */
526
+ export declare const ChatboxElement: new () => TalkJS.ChatboxElement;
527
+
528
+ /**
529
+ * @public
530
+ */
531
+ export declare interface ChatboxProps extends BaseChatboxProps {
431
532
  /**
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.
533
+ * The ID of the conversation to display.
435
534
  *
436
535
  * @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.
536
+ * If the conversation doesn't exist or if the current user isn't a
537
+ * participant of the current conversation, a "Chat not found" message will be
538
+ * displayed (after a timeout). If you create the conversation in parallel (eg
539
+ * via the REST API or via the Data API), it will show in the chatbox
540
+ * automatically. This means that you can safely point a chatbox at a
541
+ * conversation that might not yet exist. This way the chatbox UI and the
542
+ * conversation can load in parallel, which results in snappier UX.
543
+ *
544
+ * Passing `null` deselects the current conversation and shows an empty panel.
545
+ * This may be useful for Inbox-like scenarios where you want to keep the
546
+ * chatbox loaded, without showing a conversation.
439
547
  *
440
- * @param request Object describing the permission request
548
+ * In the background, the Chatbox keeps active subscriptions to recent
549
+ * conversations, so that switching back and forth between conversations has
550
+ * snappy UX.
441
551
  */
442
- beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
552
+ conversationId: string | null;
443
553
  /**
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.
554
+ * Fired when the back button in the chat header is clicked.
555
+ *
556
+ * @remarks
557
+ * By default this back button is only shown inside an inbox on small screens.
558
+ * You can change this behavior in the ChatHeader theme.
447
559
  *
448
- * @param event Event object describing the missing permission
560
+ * @public
449
561
  */
450
- onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
562
+ onBackButtonClick?: (event: BackButtonClickEvent) => void;
451
563
  /**
452
- * This event fires when the user clicks an action button or an action Link
453
- * inside a message.
564
+ * A token to authenticate the session with.
454
565
  *
455
566
  * @remarks
456
- * The event's `action` and `params` fields specify the name of action and its
457
- * parameters, if any.
567
+ * See the
568
+ * {@link https://talkjs.com/docs/Features/Security/Authentication/ | Authentication guide }
569
+ * and
570
+ * {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#token-reference | Token reference }
571
+ * for details and examples.
458
572
  *
459
- * See
460
- * {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
461
- * for more info.
573
+ * Required when authentication is enabled, otherwise optional.
462
574
  */
463
- onMessageAction?: (event: MessageActionEvent) => void;
575
+ token?: string;
464
576
  /**
465
- * Arbitrary custom data passed down to the theme.
577
+ * A function that fetches and returns a new authentication token from your
578
+ * server.
466
579
  *
467
580
  * @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.
581
+ * TalkJS calls this function whenever the current token is about to expire.
582
+ * This callback is designed to work with any backend setup. See
583
+ * {@link https://talkjs.com/docs/Features/Security/Advanced_Authentication/#refreshable-tokens | Refreshable tokens }
584
+ * for details and examples.
473
585
  */
474
- themeCustom?: any;
586
+ tokenFetcher?: () => string | Promise<string>;
475
587
  }
476
588
 
477
589
  /**
@@ -533,6 +645,15 @@ export declare interface CommonChatboxProps {
533
645
  * The theme object that the chatbox's is currently using.
534
646
  */
535
647
  theme: Theme;
648
+ /**
649
+ * The ID of the conversation displayed in the chatbox.
650
+ *
651
+ * @remarks
652
+ * Prefer this field instead of `common.conversation.id` (which always has the
653
+ * same value), as this enables an optimization that prevents needless
654
+ * re-renders.
655
+ */
656
+ conversationId: string;
536
657
  /**
537
658
  * The conversation displayed in the chatbox.
538
659
  */
@@ -657,7 +778,7 @@ export declare class ConversationListController {
657
778
  * instead, as that lets you keep your local state in sync with the props
658
779
  * passed to the conversation list.
659
780
  */
660
- selectConversation(conversationId: string): void;
781
+ selectConversation(conversationId: string | null): void;
661
782
  }
662
783
 
663
784
  /**
@@ -671,6 +792,9 @@ export declare class ConversationListController {
671
792
  */
672
793
  export declare const ConversationListElement: new () => TalkJS.ConversationListElement;
673
794
 
795
+ /**
796
+ * @public
797
+ */
674
798
  export declare interface ConversationListItemProps {
675
799
  /**
676
800
  * A collection of objects which are passed to all ConversationList theme components.
@@ -690,40 +814,7 @@ export declare interface ConversationListItemProps {
690
814
  /**
691
815
  * @public
692
816
  */
693
- export declare interface ConversationListProps {
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;
707
- /**
708
- * The ID of the current user.
709
- *
710
- * @remarks
711
- * If the given user ID doesn't exist, a "Something went wrong" message will
712
- * be displayed.
713
- */
714
- userId: string;
715
- /**
716
- * The ID of the conversation currently selected in the list.
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.
725
- */
726
- selectedConversationId?: string;
817
+ export declare interface ConversationListProps extends BaseConversationListProps {
727
818
  /**
728
819
  * A token to authenticate the session with.
729
820
  *
@@ -748,41 +839,6 @@ export declare interface ConversationListProps {
748
839
  * for details and examples.
749
840
  */
750
841
  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
842
  }
787
843
 
788
844
  export { ConversationSnapshot }
@@ -838,8 +894,14 @@ export declare interface DeviceFeatures {
838
894
  isMobile: boolean;
839
895
  }
840
896
 
897
+ /**
898
+ * @public
899
+ */
841
900
  export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX_2.Element;
842
901
 
902
+ /**
903
+ * @public
904
+ */
843
905
  export declare interface EditorController {
844
906
  isTyping: boolean;
845
907
  atTextLimit: boolean;
@@ -888,6 +950,9 @@ export declare interface EditorProps {
888
950
  className?: string;
889
951
  }
890
952
 
953
+ /**
954
+ * @public
955
+ */
891
956
  export declare function EmojiPicker(props: EmojiPickerProps): JSX_2.Element;
892
957
 
893
958
  /**
@@ -901,9 +966,7 @@ export declare interface EmojiPickerProps {
901
966
  }
902
967
 
903
968
  /**
904
- * Shows a bar with emoji suggestions when the user types eg `:bla`. Shown if `query` is non-empty.
905
- *
906
- * Uses the IndexedDB-backed emoji database from "emoji-picker-element".
969
+ * @public
907
970
  */
908
971
  export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX_2.Element;
909
972
 
@@ -1084,6 +1147,62 @@ export declare interface ImageBlockProps {
1084
1147
  downloadUrl?: string;
1085
1148
  }
1086
1149
 
1150
+ /**
1151
+ * A collection of actions available on the Inbox UI
1152
+ *
1153
+ * @remarks
1154
+ * Exposes a `chatbox` field which, if a conversation is currently selected,
1155
+ * lets you control the chatbox encapsulated by this inbox.
1156
+ *
1157
+ * @public
1158
+ */
1159
+ export declare class InboxController {
1160
+ #private;
1161
+ /**
1162
+ * The {@link ChatboxController} object of the underlying chatbox
1163
+ *
1164
+ * @remarks
1165
+ * This lets you programmatically control the chatbox side of this inbox, ie
1166
+ * the right panel. For example, to control the message field text:
1167
+ *
1168
+ * ```js
1169
+ * // Obtain a reference to the inbox object, eg:
1170
+ * // const inbox = inboxRef.current; // react
1171
+ * // const inbox = document.querySelector("t-inbox") // web
1172
+ * // const inbox = inboxRef.value // vue
1173
+ * // etc
1174
+ *
1175
+ * inbox.chatbox.setMessageFieldText("Hey there");
1176
+ * ```
1177
+ */
1178
+ get chatbox(): ChatboxController;
1179
+ /**
1180
+ * Select a conversation.
1181
+ *
1182
+ * @remarks
1183
+ * This method is called from the theme's ConversationListItem component when
1184
+ * the user clicks on the given conversation. You can also call it
1185
+ * programmatically from elsewhere to simulate a user click.
1186
+ *
1187
+ * This method will trigger the {@link InboxProps.onSelectConversation} event.
1188
+ * In most cases, if you want to change the selected conversation
1189
+ * programmatically from outside the conversation list, it's better to pass a
1190
+ * different value to the {@link InboxProps.selectedConversationId} prop
1191
+ * instead, as that lets you keep your local state in sync with the props
1192
+ * passed to the conversation list.
1193
+ */
1194
+ selectConversation(conversationId: string): void;
1195
+ }
1196
+
1197
+ /**
1198
+ * The {@link https://talkjs.com/docs/Features/Chat_UIs/#inbox | Inbox UI. }
1199
+ * Combines a Conversation List with a Chatbox, responsively scaling down on
1200
+ * smaller screens.
1201
+ *
1202
+ * @public
1203
+ */
1204
+ export declare const InboxElement: new () => TalkJS.InboxElement;
1205
+
1087
1206
  export { LocationBlock }
1088
1207
 
1089
1208
  /**
@@ -1104,18 +1223,20 @@ export declare interface LocationBlockProps {
1104
1223
  block: LocationBlock;
1105
1224
  }
1106
1225
 
1226
+ /**
1227
+ * @public
1228
+ */
1107
1229
  export declare function MentionSuggestList(props: MentionSuggestListProps): JSX_2.Element | null;
1108
1230
 
1109
- export declare interface MentionSuggestList {
1110
- keydown(key: string): boolean;
1111
- }
1112
-
1113
1231
  /**
1114
1232
  * @public
1115
1233
  */
1116
1234
  export declare interface MentionSuggestListProps {
1117
1235
  }
1118
1236
 
1237
+ /**
1238
+ * @public
1239
+ */
1119
1240
  export declare function MenuItem(props: MenuItemProps): JSX_2.Element;
1120
1241
 
1121
1242
  /**
@@ -1170,6 +1291,9 @@ export declare interface MessageActionMenuProps {
1170
1291
  permissions: MessagePermissions;
1171
1292
  }
1172
1293
 
1294
+ /**
1295
+ * @public
1296
+ */
1173
1297
  export declare function MessageContent(props: MessageContentProps): JSX_2.Element;
1174
1298
 
1175
1299
  /**
@@ -1332,9 +1456,10 @@ export { MessageSnapshot }
1332
1456
  *
1333
1457
  * - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
1334
1458
  *
1459
+ * - `"virtual"` - a virtual message made with the <VirtualMessage> system component
1335
1460
  * @public
1336
1461
  */
1337
- export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1462
+ export declare type MessageStatus = "sending" | "sent" | "everyoneRead" | "virtual";
1338
1463
 
1339
1464
  /**
1340
1465
  * Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
@@ -1368,6 +1493,16 @@ export declare interface MissingBrowserPermissionEvent {
1368
1493
  type: BrowserPermission;
1369
1494
  }
1370
1495
 
1496
+ /**
1497
+ * @public
1498
+ */
1499
+ export declare interface NoConversationSelectedProps {
1500
+ /**
1501
+ * A collection of objects which are passed to all Chatbox theme components.
1502
+ */
1503
+ common: CommonChatboxProps;
1504
+ }
1505
+
1371
1506
  export { ParticipantSnapshot }
1372
1507
 
1373
1508
  /**
@@ -1427,6 +1562,9 @@ export declare interface PopoverButtonProps<T extends object> extends React_2.HT
1427
1562
 
1428
1563
  export { Preact }
1429
1564
 
1565
+ /**
1566
+ * @public
1567
+ */
1430
1568
  export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX_2.Element;
1431
1569
 
1432
1570
  /**
@@ -1490,13 +1628,15 @@ export declare interface ReplyBarProps {
1490
1628
  /**
1491
1629
  * An event object dispatched by the
1492
1630
  * {@link ConversationListProps.onSelectConversation} event.
1631
+ *
1632
+ * @public
1493
1633
  */
1494
1634
  export declare interface SelectConversationEvent {
1495
1635
  currentUser: UserSnapshot;
1496
1636
  /**
1497
1637
  * The newly-selected conversation.
1498
1638
  */
1499
- conversation: ConversationSnapshot;
1639
+ conversation: ConversationSnapshot | null;
1500
1640
  }
1501
1641
 
1502
1642
  /**
@@ -1599,6 +1739,7 @@ export declare interface Theme {
1599
1739
  MessageListFooter: React_2.ComponentType<MessageListFooterProps>;
1600
1740
  BeforeMessages: React_2.ComponentType<BeforeMessagesProps>;
1601
1741
  AfterMessages: React_2.ComponentType<AfterMessagesProps>;
1742
+ NoConversationSelected: React_2.ComponentType<NoConversationSelectedProps>;
1602
1743
  TextBlock: React_2.ComponentType<TextBlockProps>;
1603
1744
  FileBlock: React_2.ComponentType<FileBlockProps>;
1604
1745
  LocationBlock: React_2.ComponentType<LocationBlockProps>;
@@ -1655,7 +1796,10 @@ export declare interface Translation extends TranslationStrings {
1655
1796
  locale: string;
1656
1797
  }
1657
1798
 
1658
- declare interface TranslationStrings {
1799
+ /**
1800
+ * @public
1801
+ */
1802
+ export declare interface TranslationStrings {
1659
1803
  YESTERDAY: string;
1660
1804
  TODAY: string;
1661
1805
  DAYS: string;
@@ -1741,8 +1885,8 @@ export declare type UploadState = "pending" | "done" | "error";
1741
1885
  * It'll initially return an empty list, and re-render the calling component as data participants are loaded.
1742
1886
  * It'll also cause a re-render when any of those participants change, such as when a user's name or photoUrl changes.
1743
1887
  *
1744
- * @param conversationId ID of the conversation
1745
- * @param limit Maximum number of participants to subscribe to. Defaults to 10. The maximum is 100.
1888
+ * @param conversationId - ID of the conversation
1889
+ * @param limit - Maximum number of participants to subscribe to. Defaults to 10. The maximum is 100.
1746
1890
  * @returns List of participant snapshots.
1747
1891
  *
1748
1892
  * @public
@@ -1753,8 +1897,8 @@ export declare function useParticipants(conversationId: string, limit?: number):
1753
1897
  * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1754
1898
  * 2014", depending on which is most appropriate.
1755
1899
  *
1756
- * @param timestamp The timestamp of the event in milliseconds since Unix epoch.
1757
- * @param t Relevant translation object to get localized output
1900
+ * @param timestamp - The timestamp of the event in milliseconds since Unix epoch.
1901
+ * @param t - Relevant translation object to get localized output
1758
1902
  *
1759
1903
  * @public
1760
1904
  */
@@ -1852,6 +1996,87 @@ export declare interface VideoBlockProps {
1852
1996
  downloadUrl?: string;
1853
1997
  }
1854
1998
 
1999
+ /**
2000
+ * Lets you render a fake message with content and sender of your choice,
2001
+ * without having to compose a complete MessageSnapshot object.
2002
+ *
2003
+ * @remarks
2004
+ * This system component renders a fake message that looks and behaves like a
2005
+ * real chat message, but is never stored or sent through TalkJS. It is useful
2006
+ * for showing contextual prompts such as welcome messages at the top of a
2007
+ * conversation.
2008
+ *
2009
+ * Uses the provided props to compose a complete {@link MessageSnapshot} object,
2010
+ * which is then passed to the
2011
+ * {@link /UI_Components/Theme/Theme_components/Message | Message} component
2012
+ * from your theme.
2013
+ *
2014
+ * Because the message isn't a real, stored message, the message is rendered as
2015
+ * if the user has no permissions to perform any actions on this message (such
2016
+ * as reply, edit, etc). This means the built-in action menu will not be
2017
+ * accessible.
2018
+ *
2019
+ * @public
2020
+ */
2021
+ export declare function VirtualMessage(props: VirtualMessageProps): JSX_2.Element | null;
2022
+
2023
+ /**
2024
+ * @public
2025
+ */
2026
+ export declare interface VirtualMessageProps {
2027
+ /**
2028
+ * The text of the message. Accepts formatting markup like the chatbox message field does, eg `*this*` would become bold.
2029
+ *
2030
+ * @remarks
2031
+ * Specify either `text` or `content`, but not both.
2032
+ */
2033
+ text?: string;
2034
+ /**
2035
+ * The content of the message as a content block.
2036
+ *
2037
+ * @remarks
2038
+ * Lets you precisely control the formatting of the message, see
2039
+ * {@link https://talkjs.com/docs/Concepts/Message_Content/#sending-message-content | Message content}.
2040
+ * Specify either `text` or `content`, but not both.
2041
+ */
2042
+ content?: ContentBlock[];
2043
+ /**
2044
+ * The ID of the sender of this message, or a complete UserSnapshot with the
2045
+ * sender's details.
2046
+ *
2047
+ * @remarks
2048
+ * When omitted, the message is rendered as a system message.
2049
+ *
2050
+ * When passing a UserSnapshot, this object is used in full and the user is
2051
+ * not loaded from the database, which means that you can also pass a fake
2052
+ * user that does not really exist.
2053
+ */
2054
+ sender?: string | UserSnapshot;
2055
+ /**
2056
+ * Override the message's timestamp
2057
+ *
2058
+ * @remarks
2059
+ * Defaults to `-1`, which our preset themes interpret as "do not show a timestamp at all"
2060
+ */
2061
+ createdAt?: number;
2062
+ /**
2063
+ * Control the message's delivery status
2064
+ *
2065
+ * @remarks
2066
+ * Defaults to "virtual", which make our preset themes not render status ticks
2067
+ * at all. Set it to eg `"sent"` to show a tickmark, or to `"everyoneRead"` to
2068
+ * show a double tickmark.
2069
+ */
2070
+ status?: MessageStatus;
2071
+ /**
2072
+ * Custom data for the `message` object.
2073
+ *
2074
+ * @remarks
2075
+ * You can read this out in `message.custom` inside the Message theme component.
2076
+ */
2077
+ custom?: Record<string, string>;
2078
+ }
2079
+
1855
2080
  export { VoiceBlock }
1856
2081
 
1857
2082
  /**
@@ -1892,7 +2117,7 @@ export declare interface VoiceBlockProps {
1892
2117
  * voice message currently being recorded.
1893
2118
  *
1894
2119
  * @remarks
1895
- * Use {@link EditorController.recordVoiceMessage()} to begin recording a voice
2120
+ * Use {@link EditorController.recordVoiceMessage} to begin recording a voice
1896
2121
  * message.
1897
2122
  *
1898
2123
  * @public
@@ -1984,14 +2209,20 @@ declare global {
1984
2209
  type NullishConversationListProps = {
1985
2210
  [K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
1986
2211
  };
2212
+ type NullishInboxProps = {
2213
+ [K in keyof Omit<InboxProps, "className" | "style">]: InboxProps[K] | null | undefined;
2214
+ };
1987
2215
  interface ChatboxElement extends HTMLElement, NullishChatboxProps, ChatboxController {
1988
2216
  }
1989
2217
  interface ConversationListElement extends HTMLElement, NullishConversationListProps, ConversationListController {
1990
2218
  }
2219
+ interface InboxElement extends HTMLElement, NullishInboxProps, InboxController {
2220
+ }
1991
2221
  }
1992
2222
  interface HTMLElementTagNameMap {
1993
2223
  "t-chatbox": TalkJS.ChatboxElement;
1994
2224
  "t-conversation-list": TalkJS.ConversationListElement;
2225
+ "t-inbox": TalkJS.InboxElement;
1995
2226
  }
1996
2227
  }
1997
2228