@talkjs/react-components 0.0.29 → 0.0.31

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
@@ -2,13 +2,14 @@ import { AudioBlock } from '@talkjs/core';
2
2
  import { ConversationSnapshot } from '@talkjs/core';
3
3
  import { EditMessageParams } from '@talkjs/core';
4
4
  import { EditTextMessageParams } from '@talkjs/core';
5
+ import { FileBlock } from '@talkjs/core';
5
6
  import { FileToken } from '@talkjs/core';
6
7
  import { GenericFileBlock } from '@talkjs/core';
7
8
  import { ImageBlock } from '@talkjs/core';
8
9
  import { LocationBlock } from '@talkjs/core';
9
10
  import { MessageSnapshot } from '@talkjs/core';
10
11
  import { ParticipantSnapshot } from '@talkjs/core';
11
- import type * as React from 'react';
12
+ import * as React from 'react';
12
13
  import { ReferencedMessageSnapshot } from '@talkjs/core';
13
14
  import { SendMessageParams } from '@talkjs/core';
14
15
  import { SendTextMessageParams } from '@talkjs/core';
@@ -24,7 +25,7 @@ import { VoiceBlock } from '@talkjs/core';
24
25
  *
25
26
  * @public
26
27
  */
27
- declare interface App {
28
+ export declare interface App {
28
29
  /**
29
30
  * Your app's unique TalkJS ID. You can find it on the Settings page of the
30
31
  * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
@@ -50,10 +51,12 @@ declare interface App {
50
51
  custom: Record<string, string>;
51
52
  }
52
53
 
54
+ export { AudioBlock }
55
+
53
56
  /**
54
57
  * @public
55
58
  */
56
- declare interface AudioBlockProps {
59
+ export declare interface AudioBlockProps {
57
60
  /**
58
61
  * A collection of objects which are passed to all Chatbox theme components.
59
62
  */
@@ -83,10 +86,46 @@ declare interface AudioBlockProps {
83
86
  downloadUrl?: string;
84
87
  }
85
88
 
89
+ /**
90
+ * Audio player based on wavesurfer.
91
+ *
92
+ * @remarks
93
+ * Wavesurfer is designed to make SoundCloud-style sound wave players. It has no
94
+ * UI elements other than the actual sound waves, but it does abstract away all
95
+ * the audio playing browser internals very nicely.
96
+ *
97
+ * Also, it has some additional settings that let us turn the sound wave display
98
+ * into a series of nice rounded bars. Less signal, but also less distraction. I
99
+ * kinda like it!
100
+ */
101
+ export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX.Element;
102
+
103
+ /**
104
+ * @public
105
+ */
106
+ export declare interface AudioPlayerProps {
107
+ /**
108
+ * Source of the audio that's being played.
109
+ */
110
+ src: string;
111
+ /**
112
+ * Name of the audio file that's being played.
113
+ */
114
+ filename: string;
115
+ /**
116
+ * Callback that runs when an error is encountered during playback.
117
+ */
118
+ onError?: () => void;
119
+ /**
120
+ * @hidden
121
+ */
122
+ className?: string;
123
+ }
124
+
86
125
  /**
87
126
  * @public
88
127
  */
89
- declare interface AvatarProps {
128
+ export declare interface AvatarProps {
90
129
  /**
91
130
  * A collection of objects which are passed to all Chatbox/ConversationList
92
131
  * theme components.
@@ -166,7 +205,91 @@ export declare interface BrowserPermissionRequest {
166
205
  *
167
206
  * @public
168
207
  */
169
- export declare const Chatbox: React.ComponentType<ChatboxProps & React.RefAttributes<ChatboxRef>>;
208
+ export declare const Chatbox: React.ForwardRefExoticComponent<ChatboxProps & React.RefAttributes<ChatboxController>>;
209
+
210
+ /**
211
+ * A collection of actions available on the Chatbox UI.
212
+ *
213
+ * @public
214
+ */
215
+ export declare class ChatboxController {
216
+ #private;
217
+ /**
218
+ * Deletes the message with the given ID.
219
+ *
220
+ * @param messageId
221
+ */
222
+ deleteMessage(messageId: string): Promise<void>;
223
+ /**
224
+ * Enable/disable editing of a given message.
225
+ *
226
+ * @param messageId When `null` is provided, editing mode will be disabled
227
+ */
228
+ setEditing(messageId: string | null): void;
229
+ /**
230
+ * Edit the message with the given ID.
231
+ *
232
+ * @param messageId
233
+ * @param params
234
+ */
235
+ editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
236
+ /**
237
+ * Send a text message to the current conversation.
238
+ *
239
+ * @param params
240
+ */
241
+ sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
242
+ /**
243
+ * Send a file message to the current conversation.
244
+ *
245
+ * @param message
246
+ */
247
+ sendFileMessage(params: {
248
+ fileToken: FileToken;
249
+ custom?: Record<string, string>;
250
+ }): Promise<void>;
251
+ /**
252
+ * Send a location message to the current conversation.
253
+ *
254
+ * @param message
255
+ */
256
+ sendLocationMessage(message: {
257
+ location: Coordinates;
258
+ custom?: Record<string, string>;
259
+ }): Promise<void>;
260
+ /**
261
+ * Set/unset the message that's currently being replied to.
262
+ *
263
+ * @param messageId - When `null` is provided, the "replying to" message is cleared
264
+ */
265
+ setReferencedMessage(messageId: string | null): void;
266
+ /**
267
+ * Toggle the given emoji reaction for the given message. If the current user
268
+ * already added this reaction, it's removed, and otherwise, it's added.
269
+ *
270
+ * Called from the theme's Message component when the user clicks on an
271
+ * existing emoji reaction.
272
+ *
273
+ * @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
274
+ * @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
275
+ */
276
+ toggleReaction(messageId: string, emoji: string): Promise<void>;
277
+ /**
278
+ * Get the plaintext from the message field
279
+ *
280
+ * @returns The text
281
+ */
282
+ getMessageFieldText(): string;
283
+ /**
284
+ * Set the plaintext in the message field
285
+ * @param text
286
+ */
287
+ setMessageFieldText(text: string): void;
288
+ /**
289
+ * Focus the message field
290
+ */
291
+ focusMessageField(): void;
292
+ }
170
293
 
171
294
  /**
172
295
  * @public
@@ -232,7 +355,7 @@ export declare interface ChatboxProps {
232
355
  *
233
356
  * @remarks
234
357
  * See
235
- * {@link https://talkjs.com/docs/SDKs/React/Customization/#custom-theme-components | Custom theme components }
358
+ * {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
236
359
  * for more info.
237
360
  */
238
361
  theme?: Partial<Theme>;
@@ -303,80 +426,36 @@ export declare interface ChatboxProps {
303
426
  * @param event Event object describing the missing permission
304
427
  */
305
428
  onMissingBrowserPermission?: (event: MissingBrowserPermissionEvent) => void;
429
+ /**
430
+ * This event fires when the user clicks an action button or an action Link
431
+ * inside a message.
432
+ *
433
+ * @remarks
434
+ * The event's `action` and `params` fields specify the name of action and its
435
+ * parameters, if any.
436
+ *
437
+ * See
438
+ * {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
439
+ * for more info.
440
+ */
441
+ onMessageAction?: (event: MessageActionEvent) => void;
306
442
  /**
307
443
  * Arbitrary custom data passed down to the theme.
308
444
  *
309
445
  * @remarks
310
446
  * Whatever data you pass here will be made available for use in theme
311
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
447
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
312
448
  * theme components and through
313
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
449
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
314
450
  * theme components.
315
451
  */
316
452
  themeCustom?: any;
317
453
  }
318
454
 
319
- /**
320
- * A collection of actions available on the Chatbox UI.
321
- *
322
- * @public
323
- */
324
- export declare interface ChatboxRef {
325
- /**
326
- * Deletes the message with the given ID.
327
- *
328
- * @param messageId
329
- */
330
- deleteMessage(messageId: string): Promise<void>;
331
- /**
332
- * Enable/disable editing of a given message.
333
- *
334
- * @param messageId When `null` is provided, editing mode will be disabled
335
- */
336
- setEditing(messageId: string | null): void;
337
- /**
338
- * Edit the message with the given ID.
339
- *
340
- * @param messageId
341
- * @param params
342
- */
343
- editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
344
- /**
345
- * Send a text message to the current conversation.
346
- *
347
- * @param params
348
- */
349
- sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
350
- /**
351
- * Send a file message to the current conversation.
352
- *
353
- * @param message
354
- */
355
- sendFileMessage(params: {
356
- fileToken: FileToken;
357
- custom?: Record<string, string>;
358
- }): Promise<void>;
359
- /**
360
- * Send a location message to the current conversation.
361
- *
362
- * @param message
363
- */
364
- sendLocationMessage(message: {
365
- location: Coordinates;
366
- custom?: Record<string, string>;
367
- }): Promise<void>;
368
- /**
369
- * Set/unset the message that's currently being replied to.
370
- *
371
- * @param messageId When `null` is provided, the "replying to" message is cleared
372
- */
373
- setReferencedMessage(messageId: string | null): void;
374
- }
375
-
376
455
  /**
377
456
  * @public
378
457
  */
379
- declare interface ChatHeaderProps {
458
+ export declare interface ChatHeaderProps {
380
459
  /**
381
460
  * A collection of objects which are passed to all Chatbox theme components.
382
461
  */
@@ -398,7 +477,7 @@ declare interface ChatHeaderProps {
398
477
  *
399
478
  * @public
400
479
  */
401
- declare interface CommonChatboxProps {
480
+ export declare interface CommonChatboxProps {
402
481
  /**
403
482
  * Holds information about your TalkJS app.
404
483
  */
@@ -413,9 +492,9 @@ declare interface CommonChatboxProps {
413
492
  */
414
493
  t: Translation;
415
494
  /**
416
- * The chatbox instance itself.
495
+ * Public interface of the chatbox instance.
417
496
  */
418
- chatbox: ChatboxRef;
497
+ chatbox: ChatboxController;
419
498
  /**
420
499
  * Arbitrary custom data passed down to the theme.
421
500
  *
@@ -456,7 +535,7 @@ declare interface CommonChatboxProps {
456
535
  *
457
536
  * @public
458
537
  */
459
- declare interface CommonConversationListProps {
538
+ export declare interface CommonConversationListProps {
460
539
  /**
461
540
  * Holds information about your TalkJS app.
462
541
  */
@@ -487,9 +566,9 @@ declare interface CommonConversationListProps {
487
566
  */
488
567
  theme: Theme;
489
568
  /**
490
- * The conversation list instance itself.
569
+ * Public interface of the conversation list instance.
491
570
  */
492
- conversationList: ConversationListRef;
571
+ conversationList: ConversationListController;
493
572
  /**
494
573
  * The underlying TalkJS session object that handles sending and receiving chat data.
495
574
  */
@@ -499,7 +578,7 @@ declare interface CommonConversationListProps {
499
578
  /**
500
579
  * @public
501
580
  */
502
- declare interface CompactMessageContentProps {
581
+ export declare interface CompactMessageContentProps {
503
582
  /**
504
583
  * A collection of objects which are passed to all Chatbox/ConversationList
505
584
  * theme components.
@@ -518,7 +597,7 @@ declare interface CompactMessageContentProps {
518
597
  /**
519
598
  * @public
520
599
  */
521
- declare interface ConversationImageProps {
600
+ export declare interface ConversationImageProps {
522
601
  /**
523
602
  * A collection of objects which are passed to all Chatbox/ConversationList
524
603
  * theme components.
@@ -538,18 +617,35 @@ declare interface ConversationImageProps {
538
617
  participants: ParticipantSnapshot[];
539
618
  }
540
619
 
620
+ export declare const ConversationList: React.ForwardRefExoticComponent<ConversationListProps & React.RefAttributes<ConversationListController>>;
621
+
541
622
  /**
542
- * The
543
- * {@link https://talkjs.com/docs/Features/Chat_UIs/#conversation-list | Conversation List UI. }
544
- * Displays a list of a user's conversations. You can use a conversation list on
545
- * its own on a page, or combine it with a {@link Chatbox} to build a complete message
546
- * center.
623
+ * A collection of actions available on the ConversationList UI.
547
624
  *
548
625
  * @public
549
626
  */
550
- export declare const ConversationList: React.ComponentType<ConversationListProps & React.RefAttributes<ConversationListRef>>;
627
+ export declare class ConversationListController {
628
+ #private;
629
+ /**
630
+ * Select a conversation.
631
+ *
632
+ * @remarks
633
+ * This method is called from the theme's ConversationListItem component when
634
+ * the user clicks on the given conversation. You can also call it
635
+ * programmatically from elsewhere to simulate a user click.
636
+ *
637
+ * This method will trigger the
638
+ * {@link ConversationListProps.onSelectConversation} event. In most
639
+ * cases, if you want to change the selected conversation programmatically
640
+ * from outside the conversation list, it's better to pass a different value
641
+ * to the {@link ConversationListProps.selectedConversationId} prop
642
+ * instead, as that lets you keep your local state in sync with the props
643
+ * passed to the conversation list.
644
+ */
645
+ selectConversation(conversationId: string): void;
646
+ }
551
647
 
552
- declare interface ConversationListItemProps {
648
+ export declare interface ConversationListItemProps {
553
649
  /**
554
650
  * A collection of objects which are passed to all ConversationList theme components.
555
651
  */
@@ -603,7 +699,7 @@ export declare interface ConversationListProps {
603
699
  * update.
604
700
  *
605
701
  * Note that updating the selected conversation through this prop **will not**
606
- * trigger the {@linkcode onSelectConversation} callback.
702
+ * trigger the {@link onSelectConversation} callback.
607
703
  */
608
704
  selectedConversationId?: string;
609
705
  /**
@@ -636,7 +732,7 @@ export declare interface ConversationListProps {
636
732
  *
637
733
  * @remarks
638
734
  * See
639
- * {@link https://talkjs.com/docs/SDKs/React/Customization/#custom-theme-components | Custom theme components }
735
+ * {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
640
736
  * for more info.
641
737
  */
642
738
  theme?: Partial<Theme>;
@@ -647,11 +743,11 @@ export declare interface ConversationListProps {
647
743
  *
648
744
  * @remarks
649
745
  * Note that updating the selected conversation through the
650
- * {@linkcode selectedConversationId} prop **will not** trigger this callback.
746
+ * {@link selectedConversationId} prop **will not** trigger this callback.
651
747
  *
652
748
  * Use this callback to have an adjacent chatbox show the correct
653
749
  * conversation. See
654
- * {@link https://talkjs.com/docs/SDKs/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
750
+ * {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
655
751
  */
656
752
  onSelectConversation?: (event: SelectConversationEvent) => void;
657
753
  /**
@@ -659,36 +755,20 @@ export declare interface ConversationListProps {
659
755
  *
660
756
  * @remarks
661
757
  * Whatever data you pass here will be made available for use in theme
662
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
758
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
663
759
  * theme components and through
664
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
760
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
665
761
  * theme components.
666
762
  */
667
763
  themeCustom?: any;
668
764
  }
669
765
 
670
- /**
671
- * A collection of actions available on the ConversationList UI.
672
- *
673
- * @public
674
- */
675
- export declare interface ConversationListRef {
676
- /**
677
- * Programatically select a conversation.
678
- *
679
- * @param conversationId
680
- *
681
- * @remarks
682
- * Note that this **will not** trigger the
683
- * {@linkcode ConversationListProps.onSelectConversation} callback.
684
- */
685
- selectConversation(conversationId: string): void;
686
- }
766
+ export { ConversationSnapshot }
687
767
 
688
768
  /**
689
769
  * @public
690
770
  */
691
- declare interface Coordinates {
771
+ export declare interface Coordinates {
692
772
  latitude: number;
693
773
  longitude: number;
694
774
  }
@@ -725,7 +805,7 @@ export declare interface DeleteMessageEvent {
725
805
  *
726
806
  * @public
727
807
  */
728
- declare interface DeviceFeatures {
808
+ export declare interface DeviceFeatures {
729
809
  /**
730
810
  * True if the browser supports IndexedDB, which the emoji picker depends on.
731
811
  */
@@ -736,10 +816,86 @@ declare interface DeviceFeatures {
736
816
  isMobile: boolean;
737
817
  }
738
818
 
819
+ export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX.Element;
820
+
821
+ export declare interface EditorController {
822
+ isTyping: boolean;
823
+ atTextLimit: boolean;
824
+ isEmpty: boolean;
825
+ characterCount: number;
826
+ showEmojiPicker: boolean;
827
+ send(): void;
828
+ shareLocation(): void;
829
+ attachFile(): void;
830
+ toggleEmojiPicker(): void;
831
+ }
832
+
833
+ /**
834
+ * @public
835
+ */
836
+ export declare interface EditorProps {
837
+ /**
838
+ * The maximum allowed character length.
839
+ *
840
+ * @remarks
841
+ * The default is `10000`
842
+ */
843
+ characterLimit?: number;
844
+ /**
845
+ * Determines if the Editor can be interacted with or not.
846
+ */
847
+ disabled?: boolean;
848
+ /**
849
+ * Placeholder text when the input is empty to encourage the user to write.
850
+ *
851
+ * @remarks
852
+ * The default is `"Say something..."`
853
+ */
854
+ placeholder?: string;
855
+ /**
856
+ * If true, spell-checking is enabled.
857
+ *
858
+ * @remarks
859
+ * The default is `false`
860
+ */
861
+ spellcheck?: boolean;
862
+ /**
863
+ * @hidden
864
+ */
865
+ className?: string;
866
+ }
867
+
868
+ export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
869
+
870
+ /**
871
+ * @public
872
+ */
873
+ export declare interface EmojiPickerProps {
874
+ /**
875
+ * Display the emoji picker in light mode or dark mode.
876
+ */
877
+ colorScheme: "light" | "dark";
878
+ }
879
+
880
+ /**
881
+ * Shows a bar with emoji suggestions when the user types eg `:bla`. Shown if `query` is non-empty.
882
+ *
883
+ * Uses the IndexedDB-backed emoji database from "emoji-picker-element".
884
+ */
885
+ export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
886
+
887
+ /**
888
+ * @public
889
+ */
890
+ export declare interface EmojiSuggestBarProps {
891
+ }
892
+
893
+ export { FileBlock }
894
+
739
895
  /**
740
896
  * @public
741
897
  */
742
- declare interface FileBlockProps {
898
+ export declare interface FileBlockProps {
743
899
  /**
744
900
  * A collection of objects which are passed to all Chatbox theme components.
745
901
  */
@@ -770,9 +926,53 @@ declare interface FileBlockProps {
770
926
  }
771
927
 
772
928
  /**
929
+ * Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
930
+ * format; whichever's shorter.
931
+ *
932
+ * @public
933
+ */
934
+ export declare function formatDuration(seconds: number): string;
935
+
936
+ /**
937
+ * Returns a human-readable filesize count.
938
+ *
939
+ * @public
940
+ */
941
+ export declare function formatFilesize(bytes: number): string;
942
+
943
+ export { GenericFileBlock }
944
+
945
+ /**
946
+ * Given a coordinate, returns an `imageUrl` used to display a Google Maps
947
+ * preview image and a `linkUrl` which points to the given location on Google
948
+ * Maps.
949
+ *
950
+ * @public
951
+ */
952
+ export declare function getGoogleMapsUrls({ latitude, longitude }: Coordinates): {
953
+ imageUrl: string;
954
+ linkUrl: string;
955
+ };
956
+
957
+ /**
958
+ * Returns the given user's `photoUrl` if available. If not, returns a `data:`
959
+ * URL of a fallback SVG which shows the user's initials.
960
+ *
961
+ * @public
962
+ */
963
+ export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
964
+
965
+ /**
966
+ * Generates a random color in hex format.
967
+ *
773
968
  * @public
774
969
  */
775
- declare interface GroupChatImageProps {
970
+ export declare function getRandomColor(id: string): string;
971
+
972
+ /**
973
+ * @public
974
+ */
975
+ export declare interface GroupChatImageProps {
776
976
  /**
777
977
  * A collection of objects which are passed to all Chatbox/ConversationList
778
978
  * theme components.
@@ -789,9 +989,24 @@ declare interface GroupChatImageProps {
789
989
  }
790
990
 
791
991
  /**
992
+ * Parses a JSX-like React string into a React element tree.
993
+ *
994
+ * @remarks
995
+ * Uses the {@link https://github.com/developit/htm | `htm`} library under the
996
+ * hood.
997
+ *
792
998
  * @public
999
+ *
1000
+ * @privateRemarks
1001
+ * Adapted from:
1002
+ * https://github.com/developit/htm/issues/175#issuecomment-773755560
793
1003
  */
794
- declare interface IconProps {
1004
+ export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
1005
+
1006
+ /**
1007
+ * @public
1008
+ */
1009
+ export declare interface IconProps {
795
1010
  /**
796
1011
  * A collection of objects which are passed to all Chatbox/ConversationList
797
1012
  * theme components.
@@ -811,22 +1026,12 @@ declare interface IconProps {
811
1026
  className?: string;
812
1027
  }
813
1028
 
814
- declare interface IEditorController {
815
- isTyping: boolean;
816
- atTextLimit: boolean;
817
- isEmpty: boolean;
818
- characterCount: number;
819
- showEmojiPicker: boolean;
820
- send(): void;
821
- shareLocation(): void;
822
- attachFile(): void;
823
- toggleEmojiPicker(): void;
824
- }
1029
+ export { ImageBlock }
825
1030
 
826
1031
  /**
827
1032
  * @public
828
1033
  */
829
- declare interface ImageBlockProps {
1034
+ export declare interface ImageBlockProps {
830
1035
  /**
831
1036
  * A collection of objects which are passed to all Chatbox theme components.
832
1037
  */
@@ -856,10 +1061,12 @@ declare interface ImageBlockProps {
856
1061
  downloadUrl?: string;
857
1062
  }
858
1063
 
1064
+ export { LocationBlock }
1065
+
859
1066
  /**
860
1067
  * @public
861
1068
  */
862
- declare interface LocationBlockProps {
1069
+ export declare interface LocationBlockProps {
863
1070
  /**
864
1071
  * A collection of objects which are passed to all Chatbox theme components.
865
1072
  */
@@ -874,10 +1081,58 @@ declare interface LocationBlockProps {
874
1081
  block: LocationBlock;
875
1082
  }
876
1083
 
1084
+ export declare function MentionSuggestList(props: MentionSuggestListProps): JSX.Element | null;
1085
+
1086
+ export declare interface MentionSuggestList {
1087
+ keydown(key: string): boolean;
1088
+ }
1089
+
877
1090
  /**
878
1091
  * @public
879
1092
  */
880
- declare interface MessageActionMenuProps {
1093
+ export declare interface MentionSuggestListProps {
1094
+ }
1095
+
1096
+ export declare function MenuItem(props: MenuItemProps): JSX.Element;
1097
+
1098
+ /**
1099
+ * @public
1100
+ */
1101
+ export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
1102
+ /**
1103
+ * When a callback is passed, it will be called when the menu item is selected.
1104
+ */
1105
+ onSelect?: () => void;
1106
+ }
1107
+
1108
+ /**
1109
+ * An event object dispatched by the {@link ChatboxProps.onMessageAction} event.
1110
+ *
1111
+ * @public
1112
+ */
1113
+ export declare interface MessageActionEvent {
1114
+ /**
1115
+ * The name of the action that was triggered.
1116
+ */
1117
+ action: string;
1118
+ /**
1119
+ * The parameters of the action that was triggered, if any.
1120
+ */
1121
+ params: Record<string, string>;
1122
+ /**
1123
+ * The message that contained the action link or action button.
1124
+ */
1125
+ message: MessageSnapshot;
1126
+ /**
1127
+ * The current conversation.
1128
+ */
1129
+ conversation: ConversationSnapshot;
1130
+ }
1131
+
1132
+ /**
1133
+ * @public
1134
+ */
1135
+ export declare interface MessageActionMenuProps {
881
1136
  /**
882
1137
  * A collection of objects which are passed to all Chatbox theme components.
883
1138
  */
@@ -892,10 +1147,34 @@ declare interface MessageActionMenuProps {
892
1147
  permissions: MessagePermissions;
893
1148
  }
894
1149
 
1150
+ export declare function MessageContent(props: MessageContentProps): JSX.Element;
1151
+
1152
+ /**
1153
+ * @public
1154
+ */
1155
+ export declare interface MessageContentProps {
1156
+ /**
1157
+ * A collection of objects which are passed to all Chatbox theme components.
1158
+ */
1159
+ common: CommonChatboxProps;
1160
+ /**
1161
+ * The message whose contents are being displayed
1162
+ */
1163
+ message: MessageSnapshot;
1164
+ /**
1165
+ * The current status of the given message.
1166
+ */
1167
+ messageStatus: MessageStatus;
1168
+ /**
1169
+ * @hidden
1170
+ */
1171
+ className?: string;
1172
+ }
1173
+
895
1174
  /**
896
1175
  * @public
897
1176
  */
898
- declare interface MessageDividerProps {
1177
+ export declare interface MessageDividerProps {
899
1178
  /**
900
1179
  * A collection of objects which are passed to all Chatbox theme components.
901
1180
  */
@@ -918,7 +1197,7 @@ declare interface MessageDividerProps {
918
1197
  /**
919
1198
  * @public
920
1199
  */
921
- declare interface MessageFieldProps {
1200
+ export declare interface MessageFieldProps {
922
1201
  /**
923
1202
  * A collection of objects which are passed to all Chatbox theme components.
924
1203
  */
@@ -934,7 +1213,7 @@ declare interface MessageFieldProps {
934
1213
  /**
935
1214
  * An object holding the state of the message field.
936
1215
  */
937
- editor: IEditorController;
1216
+ editor: EditorController;
938
1217
  /**
939
1218
  * When a message is being edited its ID will be stored here.
940
1219
  */
@@ -944,7 +1223,7 @@ declare interface MessageFieldProps {
944
1223
  /**
945
1224
  * @public
946
1225
  */
947
- declare interface MessageListFooterProps {
1226
+ export declare interface MessageListFooterProps {
948
1227
  /**
949
1228
  * A collection of objects which are passed to all Chatbox theme components.
950
1229
  */
@@ -959,7 +1238,7 @@ declare interface MessageListFooterProps {
959
1238
  *
960
1239
  * @public
961
1240
  */
962
- declare interface MessagePermissions extends UserPermissions {
1241
+ export declare interface MessagePermissions extends UserPermissions {
963
1242
  /**
964
1243
  * True if the user has the ability to delete the given message.
965
1244
  */
@@ -981,7 +1260,7 @@ declare interface MessagePermissions extends UserPermissions {
981
1260
  /**
982
1261
  * @public
983
1262
  */
984
- declare interface MessageProps {
1263
+ export declare interface MessageProps {
985
1264
  /**
986
1265
  * A collection of objects which are passed to all Chatbox theme components.
987
1266
  */
@@ -1000,6 +1279,8 @@ declare interface MessageProps {
1000
1279
  permissions: MessagePermissions;
1001
1280
  }
1002
1281
 
1282
+ export { MessageSnapshot }
1283
+
1003
1284
  /**
1004
1285
  * The current status of the message.
1005
1286
  *
@@ -1014,7 +1295,7 @@ declare interface MessageProps {
1014
1295
  *
1015
1296
  * @public
1016
1297
  */
1017
- declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1298
+ export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1018
1299
 
1019
1300
  /**
1020
1301
  * Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
@@ -1048,10 +1329,75 @@ export declare interface MissingBrowserPermissionEvent {
1048
1329
  type: BrowserPermission;
1049
1330
  }
1050
1331
 
1332
+ export { ParticipantSnapshot }
1333
+
1334
+ /**
1335
+ * PopoverButton component that renders a popover triggered by a button.
1336
+ *
1337
+ * Usage:
1338
+ * <PopoverButton
1339
+ * popoverComponent={YourMenuComponent}
1340
+ * popoverProps={{ prop1: value1, prop2: value2 }}
1341
+ * aria-label="..."
1342
+ * >
1343
+ * <Icon type="horizontalDots" />
1344
+ * </MenuButton>
1345
+ *
1346
+ * All props except for menuComponent and popoverProps are passed to the button element.
1347
+ *
1348
+ * the popoverComponent will also receive a closePopover prop. It's a function you can call to close the popover.
1349
+ */
1350
+ export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
1351
+
1352
+ /**
1353
+ * @public
1354
+ */
1355
+ export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
1356
+ /**
1357
+ * Whether to display a menu or a popover when the button is clicked.
1358
+ *
1359
+ * @remarks
1360
+ * Default value is `"popover"`.
1361
+ */
1362
+ type?: "menu" | "popover";
1363
+ /**
1364
+ * The popover component to render in response to the button click.
1365
+ */
1366
+ popoverComponent: React.ComponentType<T>;
1367
+ /**
1368
+ * Props passed to the popover component.
1369
+ */
1370
+ popoverProps: T;
1371
+ /**
1372
+ * Children nodes rendered inside the button.
1373
+ */
1374
+ children: React.ReactNode;
1375
+ /**
1376
+ * The element to focus when the popover is opened. Can be an element or a selector. Ignored if type is "menu".
1377
+ */
1378
+ initialFocus?: string | HTMLElement;
1379
+ }
1380
+
1381
+ export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
1382
+
1383
+ /**
1384
+ * @public
1385
+ */
1386
+ export declare interface ReactionPickerProps {
1387
+ /**
1388
+ * The ID of the message that's being reacted to.
1389
+ */
1390
+ messageId: string;
1391
+ /**
1392
+ * Display the emoji reaction picker in light mode or dark mode.
1393
+ */
1394
+ colorScheme: "light" | "dark";
1395
+ }
1396
+
1051
1397
  /**
1052
1398
  * @public
1053
1399
  */
1054
- declare interface ReferencedMessageProps {
1400
+ export declare interface ReferencedMessageProps {
1055
1401
  /**
1056
1402
  * A collection of objects which are passed to all Chatbox theme components.
1057
1403
  */
@@ -1062,10 +1408,12 @@ declare interface ReferencedMessageProps {
1062
1408
  referencedMessage: ReferencedMessageSnapshot;
1063
1409
  }
1064
1410
 
1411
+ export { ReferencedMessageSnapshot }
1412
+
1065
1413
  /**
1066
1414
  * @public
1067
1415
  */
1068
- declare interface ReplyBarProps {
1416
+ export declare interface ReplyBarProps {
1069
1417
  /**
1070
1418
  * A collection of objects which are passed to all Chatbox theme components.
1071
1419
  */
@@ -1105,10 +1453,22 @@ export declare interface SendMessageEvent {
1105
1453
  conversation: ConversationSnapshot;
1106
1454
  }
1107
1455
 
1456
+ export { TalkSession }
1457
+
1108
1458
  /**
1459
+ * Displays rich text
1460
+ *
1109
1461
  * @public
1110
1462
  */
1111
- declare interface TextBlockProps {
1463
+ declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
1464
+ export { Text_2 as Text }
1465
+
1466
+ export { TextBlock }
1467
+
1468
+ /**
1469
+ * @public
1470
+ */
1471
+ export declare interface TextBlockProps {
1112
1472
  /**
1113
1473
  * A collection of objects which are passed to all Chatbox theme components.
1114
1474
  */
@@ -1123,6 +1483,31 @@ declare interface TextBlockProps {
1123
1483
  block: TextBlock;
1124
1484
  }
1125
1485
 
1486
+ /**
1487
+ * @public
1488
+ */
1489
+ export declare interface TextProps {
1490
+ /**
1491
+ * The block of formatted text to display.
1492
+ */
1493
+ block: TextBlock;
1494
+ /**
1495
+ * If true, links and action buttons/links won't be rendered.
1496
+ *
1497
+ * @remarks
1498
+ * The default is `false`
1499
+ */
1500
+ nonInteractive?: boolean;
1501
+ /**
1502
+ * @hidden
1503
+ */
1504
+ className?: string;
1505
+ /**
1506
+ * The message that this text block belongs to.
1507
+ */
1508
+ message: MessageSnapshot | ReferencedMessageSnapshot;
1509
+ }
1510
+
1126
1511
  /**
1127
1512
  * A theme can be used to customize the appearance & behavior of your TalkJS
1128
1513
  * Chatbox and/or ConversationList.
@@ -1159,9 +1544,30 @@ export declare interface Theme {
1159
1544
  }
1160
1545
 
1161
1546
  /**
1547
+ * An object describing a human-readable tim
1548
+ *
1162
1549
  * @public
1163
1550
  */
1164
- declare interface TimeAgoProps {
1551
+ export declare interface TimeAgo {
1552
+ /**
1553
+ * An amount of milliseconds after which the values in {@link TimeAgo.long} and {@link TimeAgo.short} _may_ have changed.
1554
+ * If undefined, the values will not change within any meaningful period.
1555
+ */
1556
+ changeTimeout?: number | undefined;
1557
+ /**
1558
+ * A precise time description containing the exact date and time.
1559
+ */
1560
+ long: string;
1561
+ /**
1562
+ * A short human-friendly time description, such as "2 minutes ago"
1563
+ */
1564
+ short: string;
1565
+ }
1566
+
1567
+ /**
1568
+ * @public
1569
+ */
1570
+ export declare interface TimeAgoProps {
1165
1571
  /**
1166
1572
  * A collection of objects which are passed to all Chatbox theme components.
1167
1573
  */
@@ -1177,7 +1583,7 @@ declare interface TimeAgoProps {
1177
1583
  *
1178
1584
  * @public
1179
1585
  */
1180
- declare interface Translation extends TranslationStrings {
1586
+ export declare interface Translation extends TranslationStrings {
1181
1587
  locale: string;
1182
1588
  }
1183
1589
 
@@ -1241,6 +1647,19 @@ declare interface TranslationStrings {
1241
1647
  CONTACT_INFORMATION_HIDDEN: string;
1242
1648
  }
1243
1649
 
1650
+ export { TypingSnapshot }
1651
+
1652
+ /**
1653
+ * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1654
+ * 2014", depending on which is most appropriate.
1655
+ *
1656
+ * @param timestamp The timestamp of the event in milliseconds since Unix epoch.
1657
+ * @param t Relevant translation object to get localized output
1658
+ *
1659
+ * @public
1660
+ */
1661
+ export declare function userFriendlyDate(timestamp: number, t: Translation): string;
1662
+
1244
1663
  /**
1245
1664
  * A set of permissions for the current user.
1246
1665
  *
@@ -1249,7 +1668,7 @@ declare interface TranslationStrings {
1249
1668
  *
1250
1669
  * @public
1251
1670
  */
1252
- declare interface UserPermissions {
1671
+ export declare interface UserPermissions {
1253
1672
  /**
1254
1673
  * True if typing indicators are enabled.
1255
1674
  */
@@ -1286,10 +1705,24 @@ declare interface UserPermissions {
1286
1705
  canMarkConversationAsUnread: boolean;
1287
1706
  }
1288
1707
 
1708
+ export { UserSnapshot }
1709
+
1710
+ /**
1711
+ *
1712
+ * This hooks triggers only when a human-readable timestamp needs to be updated.
1713
+ * For example, you could use it to display that a messages was updated X
1714
+ * minutes or Y hours ago.
1715
+ *
1716
+ * @public
1717
+ */
1718
+ export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
1719
+
1720
+ export { VideoBlock }
1721
+
1289
1722
  /**
1290
1723
  * @public
1291
1724
  */
1292
- declare interface VideoBlockProps {
1725
+ export declare interface VideoBlockProps {
1293
1726
  /**
1294
1727
  * A collection of objects which are passed to all Chatbox theme components.
1295
1728
  */
@@ -1319,10 +1752,12 @@ declare interface VideoBlockProps {
1319
1752
  downloadUrl?: string;
1320
1753
  }
1321
1754
 
1755
+ export { VoiceBlock }
1756
+
1322
1757
  /**
1323
1758
  * @public
1324
1759
  */
1325
- declare interface VoiceBlockProps {
1760
+ export declare interface VoiceBlockProps {
1326
1761
  /**
1327
1762
  * A collection of objects which are passed to all Chatbox theme components.
1328
1763
  */
@@ -1353,12 +1788,3 @@ declare interface VoiceBlockProps {
1353
1788
  }
1354
1789
 
1355
1790
  export { }
1356
-
1357
-
1358
- declare global {
1359
- interface HTMLElementTagNameMap {
1360
- "t-chatbox": ChatboxHTMLElement;
1361
- "t-conversation-list": ConversationListHTMLElement;
1362
- }
1363
- }
1364
-