@talkjs/web-components 0.0.30 → 0.0.32

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
+
86
103
  /**
87
104
  * @public
88
105
  */
89
- declare interface AvatarProps {
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
+
125
+ /**
126
+ * @public
127
+ */
128
+ export declare interface AvatarProps {
90
129
  /**
91
130
  * A collection of objects which are passed to all Chatbox/ConversationList
92
131
  * theme components.
@@ -164,7 +203,7 @@ export declare interface BrowserPermissionRequest {
164
203
  *
165
204
  * @public
166
205
  */
167
- declare class ChatboxController {
206
+ export declare class ChatboxController {
168
207
  #private;
169
208
  /**
170
209
  * Deletes the message with the given ID.
@@ -250,15 +289,12 @@ declare class ChatboxController {
250
289
  *
251
290
  * @public
252
291
  */
253
- export declare const ChatboxElement: new () => ChatboxElement_2;
254
-
255
- declare interface ChatboxElement_2 extends HTMLElement, NullishChatboxProps, ChatboxController {
256
- }
292
+ export declare const ChatboxElement: new () => TalkJS.ChatboxElement;
257
293
 
258
294
  /**
259
295
  * @public
260
296
  */
261
- declare interface ChatboxProps {
297
+ export declare interface ChatboxProps {
262
298
  /**
263
299
  * @hidden
264
300
  */
@@ -394,10 +430,13 @@ declare interface ChatboxProps {
394
430
  * This event fires when the user clicks an action button or an action Link
395
431
  * inside a message.
396
432
  *
433
+ * @remarks
397
434
  * The event's `action` and `params` fields specify the name of action and its
398
435
  * parameters, if any.
399
436
  *
400
- * @see {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links}
437
+ * See
438
+ * {@link https://talkjs.com/docs/Guides/Web_Components/Action_Buttons_Links/ | Action Buttons and Links }
439
+ * for more info.
401
440
  */
402
441
  onMessageAction?: (event: MessageActionEvent) => void;
403
442
  /**
@@ -405,9 +444,9 @@ declare interface ChatboxProps {
405
444
  *
406
445
  * @remarks
407
446
  * Whatever data you pass here will be made available for use in theme
408
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
447
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
409
448
  * theme components and through
410
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
449
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
411
450
  * theme components.
412
451
  */
413
452
  themeCustom?: any;
@@ -416,7 +455,7 @@ declare interface ChatboxProps {
416
455
  /**
417
456
  * @public
418
457
  */
419
- declare interface ChatHeaderProps {
458
+ export declare interface ChatHeaderProps {
420
459
  /**
421
460
  * A collection of objects which are passed to all Chatbox theme components.
422
461
  */
@@ -438,7 +477,7 @@ declare interface ChatHeaderProps {
438
477
  *
439
478
  * @public
440
479
  */
441
- declare interface CommonChatboxProps {
480
+ export declare interface CommonChatboxProps {
442
481
  /**
443
482
  * Holds information about your TalkJS app.
444
483
  */
@@ -496,7 +535,7 @@ declare interface CommonChatboxProps {
496
535
  *
497
536
  * @public
498
537
  */
499
- declare interface CommonConversationListProps {
538
+ export declare interface CommonConversationListProps {
500
539
  /**
501
540
  * Holds information about your TalkJS app.
502
541
  */
@@ -539,7 +578,7 @@ declare interface CommonConversationListProps {
539
578
  /**
540
579
  * @public
541
580
  */
542
- declare interface CompactMessageContentProps {
581
+ export declare interface CompactMessageContentProps {
543
582
  /**
544
583
  * A collection of objects which are passed to all Chatbox/ConversationList
545
584
  * theme components.
@@ -558,7 +597,7 @@ declare interface CompactMessageContentProps {
558
597
  /**
559
598
  * @public
560
599
  */
561
- declare interface ConversationImageProps {
600
+ export declare interface ConversationImageProps {
562
601
  /**
563
602
  * A collection of objects which are passed to all Chatbox/ConversationList
564
603
  * theme components.
@@ -583,7 +622,7 @@ declare interface ConversationImageProps {
583
622
  *
584
623
  * @public
585
624
  */
586
- declare class ConversationListController {
625
+ export declare class ConversationListController {
587
626
  #private;
588
627
  /**
589
628
  * Select a conversation.
@@ -594,10 +633,10 @@ declare class ConversationListController {
594
633
  * programmatically from elsewhere to simulate a user click.
595
634
  *
596
635
  * This method will trigger the
597
- * {@linkcode ConversationListProps.onSelectConversation} event. In most
636
+ * {@link ConversationListProps.onSelectConversation} event. In most
598
637
  * cases, if you want to change the selected conversation programmatically
599
638
  * from outside the conversation list, it's better to pass a different value
600
- * to the {@linkcode ConversationListProps.selectedConversationId} prop
639
+ * to the {@link ConversationListProps.selectedConversationId} prop
601
640
  * instead, as that lets you keep your local state in sync with the props
602
641
  * passed to the conversation list.
603
642
  */
@@ -613,12 +652,9 @@ declare class ConversationListController {
613
652
  *
614
653
  * @public
615
654
  */
616
- export declare const ConversationListElement: new () => ConversationListElement_2;
617
-
618
- declare interface ConversationListElement_2 extends HTMLElement, NullishConversationListProps, ConversationListController {
619
- }
655
+ export declare const ConversationListElement: new () => TalkJS.ConversationListElement;
620
656
 
621
- declare interface ConversationListItemProps {
657
+ export declare interface ConversationListItemProps {
622
658
  /**
623
659
  * A collection of objects which are passed to all ConversationList theme components.
624
660
  */
@@ -641,7 +677,7 @@ declare interface ConversationListItemProps {
641
677
  /**
642
678
  * @public
643
679
  */
644
- declare interface ConversationListProps {
680
+ export declare interface ConversationListProps {
645
681
  /**
646
682
  * @hidden
647
683
  */
@@ -672,7 +708,7 @@ declare interface ConversationListProps {
672
708
  * update.
673
709
  *
674
710
  * Note that updating the selected conversation through this prop **will not**
675
- * trigger the {@linkcode onSelectConversation} callback.
711
+ * trigger the {@link onSelectConversation} callback.
676
712
  */
677
713
  selectedConversationId?: string;
678
714
  /**
@@ -716,7 +752,7 @@ declare interface ConversationListProps {
716
752
  *
717
753
  * @remarks
718
754
  * Note that updating the selected conversation through the
719
- * {@linkcode selectedConversationId} prop **will not** trigger this callback.
755
+ * {@link selectedConversationId} prop **will not** trigger this callback.
720
756
  *
721
757
  * Use this callback to have an adjacent chatbox show the correct
722
758
  * conversation. See
@@ -728,18 +764,20 @@ declare interface ConversationListProps {
728
764
  *
729
765
  * @remarks
730
766
  * Whatever data you pass here will be made available for use in theme
731
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
767
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
732
768
  * theme components and through
733
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
769
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
734
770
  * theme components.
735
771
  */
736
772
  themeCustom?: any;
737
773
  }
738
774
 
775
+ export { ConversationSnapshot }
776
+
739
777
  /**
740
778
  * @public
741
779
  */
742
- declare interface Coordinates {
780
+ export declare interface Coordinates {
743
781
  latitude: number;
744
782
  longitude: number;
745
783
  }
@@ -776,7 +814,7 @@ export declare interface DeleteMessageEvent {
776
814
  *
777
815
  * @public
778
816
  */
779
- declare interface DeviceFeatures {
817
+ export declare interface DeviceFeatures {
780
818
  /**
781
819
  * True if the browser supports IndexedDB, which the emoji picker depends on.
782
820
  */
@@ -787,10 +825,86 @@ declare interface DeviceFeatures {
787
825
  isMobile: boolean;
788
826
  }
789
827
 
828
+ export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX.Element;
829
+
830
+ export declare interface EditorController {
831
+ isTyping: boolean;
832
+ atTextLimit: boolean;
833
+ isEmpty: boolean;
834
+ characterCount: number;
835
+ showEmojiPicker: boolean;
836
+ send(): void;
837
+ shareLocation(): void;
838
+ attachFile(): void;
839
+ toggleEmojiPicker(): void;
840
+ }
841
+
790
842
  /**
791
843
  * @public
792
844
  */
793
- declare interface FileBlockProps {
845
+ export declare interface EditorProps {
846
+ /**
847
+ * The maximum allowed character length.
848
+ *
849
+ * @remarks
850
+ * The default is `10000`
851
+ */
852
+ characterLimit?: number;
853
+ /**
854
+ * Determines if the Editor can be interacted with or not.
855
+ */
856
+ disabled?: boolean;
857
+ /**
858
+ * Placeholder text when the input is empty to encourage the user to write.
859
+ *
860
+ * @remarks
861
+ * The default is `"Say something..."`
862
+ */
863
+ placeholder?: string;
864
+ /**
865
+ * If true, spell-checking is enabled.
866
+ *
867
+ * @remarks
868
+ * The default is `false`
869
+ */
870
+ spellcheck?: boolean;
871
+ /**
872
+ * @hidden
873
+ */
874
+ className?: string;
875
+ }
876
+
877
+ export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
878
+
879
+ /**
880
+ * @public
881
+ */
882
+ export declare interface EmojiPickerProps {
883
+ /**
884
+ * Display the emoji picker in light mode or dark mode.
885
+ */
886
+ colorScheme: "light" | "dark";
887
+ }
888
+
889
+ /**
890
+ * Shows a bar with emoji suggestions when the user types eg `:bla`. Shown if `query` is non-empty.
891
+ *
892
+ * Uses the IndexedDB-backed emoji database from "emoji-picker-element".
893
+ */
894
+ export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
895
+
896
+ /**
897
+ * @public
898
+ */
899
+ export declare interface EmojiSuggestBarProps {
900
+ }
901
+
902
+ export { FileBlock }
903
+
904
+ /**
905
+ * @public
906
+ */
907
+ export declare interface FileBlockProps {
794
908
  /**
795
909
  * A collection of objects which are passed to all Chatbox theme components.
796
910
  */
@@ -820,10 +934,54 @@ declare interface FileBlockProps {
820
934
  downloadUrl?: string;
821
935
  }
822
936
 
937
+ /**
938
+ * Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
939
+ * format; whichever's shorter.
940
+ *
941
+ * @public
942
+ */
943
+ export declare function formatDuration(seconds: number): string;
944
+
945
+ /**
946
+ * Returns a human-readable filesize count.
947
+ *
948
+ * @public
949
+ */
950
+ export declare function formatFilesize(bytes: number): string;
951
+
952
+ export { GenericFileBlock }
953
+
954
+ /**
955
+ * Given a coordinate, returns an `imageUrl` used to display a Google Maps
956
+ * preview image and a `linkUrl` which points to the given location on Google
957
+ * Maps.
958
+ *
959
+ * @public
960
+ */
961
+ export declare function getGoogleMapsUrls({ latitude, longitude }: Coordinates): {
962
+ imageUrl: string;
963
+ linkUrl: string;
964
+ };
965
+
966
+ /**
967
+ * Returns the given user's `photoUrl` if available. If not, returns a `data:`
968
+ * URL of a fallback SVG which shows the user's initials.
969
+ *
970
+ * @public
971
+ */
972
+ export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
973
+
974
+ /**
975
+ * Generates a random color in hex format.
976
+ *
977
+ * @public
978
+ */
979
+ export declare function getRandomColor(id: string): string;
980
+
823
981
  /**
824
982
  * @public
825
983
  */
826
- declare interface GroupChatImageProps {
984
+ export declare interface GroupChatImageProps {
827
985
  /**
828
986
  * A collection of objects which are passed to all Chatbox/ConversationList
829
987
  * theme components.
@@ -839,10 +997,25 @@ declare interface GroupChatImageProps {
839
997
  participants: ParticipantSnapshot[];
840
998
  }
841
999
 
1000
+ /**
1001
+ * Parses a JSX-like React string into a React element tree.
1002
+ *
1003
+ * @remarks
1004
+ * Uses the {@link https://github.com/developit/htm | `htm`} library under the
1005
+ * hood.
1006
+ *
1007
+ * @public
1008
+ *
1009
+ * @privateRemarks
1010
+ * Adapted from:
1011
+ * https://github.com/developit/htm/issues/175#issuecomment-773755560
1012
+ */
1013
+ export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
1014
+
842
1015
  /**
843
1016
  * @public
844
1017
  */
845
- declare interface IconProps {
1018
+ export declare interface IconProps {
846
1019
  /**
847
1020
  * A collection of objects which are passed to all Chatbox/ConversationList
848
1021
  * theme components.
@@ -862,22 +1035,12 @@ declare interface IconProps {
862
1035
  className?: string;
863
1036
  }
864
1037
 
865
- declare interface IEditorController {
866
- isTyping: boolean;
867
- atTextLimit: boolean;
868
- isEmpty: boolean;
869
- characterCount: number;
870
- showEmojiPicker: boolean;
871
- send(): void;
872
- shareLocation(): void;
873
- attachFile(): void;
874
- toggleEmojiPicker(): void;
875
- }
1038
+ export { ImageBlock }
876
1039
 
877
1040
  /**
878
1041
  * @public
879
1042
  */
880
- declare interface ImageBlockProps {
1043
+ export declare interface ImageBlockProps {
881
1044
  /**
882
1045
  * A collection of objects which are passed to all Chatbox theme components.
883
1046
  */
@@ -907,10 +1070,12 @@ declare interface ImageBlockProps {
907
1070
  downloadUrl?: string;
908
1071
  }
909
1072
 
1073
+ export { LocationBlock }
1074
+
910
1075
  /**
911
1076
  * @public
912
1077
  */
913
- declare interface LocationBlockProps {
1078
+ export declare interface LocationBlockProps {
914
1079
  /**
915
1080
  * A collection of objects which are passed to all Chatbox theme components.
916
1081
  */
@@ -925,6 +1090,30 @@ declare interface LocationBlockProps {
925
1090
  block: LocationBlock;
926
1091
  }
927
1092
 
1093
+ export declare function MentionSuggestList(props: MentionSuggestListProps): JSX.Element | null;
1094
+
1095
+ export declare interface MentionSuggestList {
1096
+ keydown(key: string): boolean;
1097
+ }
1098
+
1099
+ /**
1100
+ * @public
1101
+ */
1102
+ export declare interface MentionSuggestListProps {
1103
+ }
1104
+
1105
+ export declare function MenuItem(props: MenuItemProps): JSX.Element;
1106
+
1107
+ /**
1108
+ * @public
1109
+ */
1110
+ export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
1111
+ /**
1112
+ * When a callback is passed, it will be called when the menu item is selected.
1113
+ */
1114
+ onSelect?: () => void;
1115
+ }
1116
+
928
1117
  /**
929
1118
  * An event object dispatched by the {@link ChatboxProps.onMessageAction} event.
930
1119
  *
@@ -952,7 +1141,7 @@ export declare interface MessageActionEvent {
952
1141
  /**
953
1142
  * @public
954
1143
  */
955
- declare interface MessageActionMenuProps {
1144
+ export declare interface MessageActionMenuProps {
956
1145
  /**
957
1146
  * A collection of objects which are passed to all Chatbox theme components.
958
1147
  */
@@ -967,10 +1156,34 @@ declare interface MessageActionMenuProps {
967
1156
  permissions: MessagePermissions;
968
1157
  }
969
1158
 
1159
+ export declare function MessageContent(props: MessageContentProps): JSX.Element;
1160
+
970
1161
  /**
971
1162
  * @public
972
1163
  */
973
- declare interface MessageDividerProps {
1164
+ export declare interface MessageContentProps {
1165
+ /**
1166
+ * A collection of objects which are passed to all Chatbox theme components.
1167
+ */
1168
+ common: CommonChatboxProps;
1169
+ /**
1170
+ * The message whose contents are being displayed
1171
+ */
1172
+ message: MessageSnapshot;
1173
+ /**
1174
+ * The current status of the given message.
1175
+ */
1176
+ messageStatus: MessageStatus;
1177
+ /**
1178
+ * @hidden
1179
+ */
1180
+ className?: string;
1181
+ }
1182
+
1183
+ /**
1184
+ * @public
1185
+ */
1186
+ export declare interface MessageDividerProps {
974
1187
  /**
975
1188
  * A collection of objects which are passed to all Chatbox theme components.
976
1189
  */
@@ -993,7 +1206,7 @@ declare interface MessageDividerProps {
993
1206
  /**
994
1207
  * @public
995
1208
  */
996
- declare interface MessageFieldProps {
1209
+ export declare interface MessageFieldProps {
997
1210
  /**
998
1211
  * A collection of objects which are passed to all Chatbox theme components.
999
1212
  */
@@ -1009,7 +1222,7 @@ declare interface MessageFieldProps {
1009
1222
  /**
1010
1223
  * An object holding the state of the message field.
1011
1224
  */
1012
- editor: IEditorController;
1225
+ editor: EditorController;
1013
1226
  /**
1014
1227
  * When a message is being edited its ID will be stored here.
1015
1228
  */
@@ -1019,7 +1232,7 @@ declare interface MessageFieldProps {
1019
1232
  /**
1020
1233
  * @public
1021
1234
  */
1022
- declare interface MessageListFooterProps {
1235
+ export declare interface MessageListFooterProps {
1023
1236
  /**
1024
1237
  * A collection of objects which are passed to all Chatbox theme components.
1025
1238
  */
@@ -1034,7 +1247,7 @@ declare interface MessageListFooterProps {
1034
1247
  *
1035
1248
  * @public
1036
1249
  */
1037
- declare interface MessagePermissions extends UserPermissions {
1250
+ export declare interface MessagePermissions extends UserPermissions {
1038
1251
  /**
1039
1252
  * True if the user has the ability to delete the given message.
1040
1253
  */
@@ -1056,7 +1269,7 @@ declare interface MessagePermissions extends UserPermissions {
1056
1269
  /**
1057
1270
  * @public
1058
1271
  */
1059
- declare interface MessageProps {
1272
+ export declare interface MessageProps {
1060
1273
  /**
1061
1274
  * A collection of objects which are passed to all Chatbox theme components.
1062
1275
  */
@@ -1075,6 +1288,8 @@ declare interface MessageProps {
1075
1288
  permissions: MessagePermissions;
1076
1289
  }
1077
1290
 
1291
+ export { MessageSnapshot }
1292
+
1078
1293
  /**
1079
1294
  * The current status of the message.
1080
1295
  *
@@ -1089,7 +1304,7 @@ declare interface MessageProps {
1089
1304
  *
1090
1305
  * @public
1091
1306
  */
1092
- declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1307
+ export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1093
1308
 
1094
1309
  /**
1095
1310
  * Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
@@ -1123,18 +1338,75 @@ export declare interface MissingBrowserPermissionEvent {
1123
1338
  type: BrowserPermission;
1124
1339
  }
1125
1340
 
1126
- declare type NullishChatboxProps = {
1127
- [K in keyof Omit<ChatboxProps, "className" | "style">]: ChatboxProps[K] | null | undefined;
1128
- };
1341
+ export { ParticipantSnapshot }
1129
1342
 
1130
- declare type NullishConversationListProps = {
1131
- [K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
1132
- };
1343
+ /**
1344
+ * PopoverButton component that renders a popover triggered by a button.
1345
+ *
1346
+ * Usage:
1347
+ * <PopoverButton
1348
+ * popoverComponent={YourMenuComponent}
1349
+ * popoverProps={{ prop1: value1, prop2: value2 }}
1350
+ * aria-label="..."
1351
+ * >
1352
+ * <Icon type="horizontalDots" />
1353
+ * </MenuButton>
1354
+ *
1355
+ * All props except for menuComponent and popoverProps are passed to the button element.
1356
+ *
1357
+ * the popoverComponent will also receive a closePopover prop. It's a function you can call to close the popover.
1358
+ */
1359
+ export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
1360
+
1361
+ /**
1362
+ * @public
1363
+ */
1364
+ export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
1365
+ /**
1366
+ * Whether to display a menu or a popover when the button is clicked.
1367
+ *
1368
+ * @remarks
1369
+ * Default value is `"popover"`.
1370
+ */
1371
+ type?: "menu" | "popover";
1372
+ /**
1373
+ * The popover component to render in response to the button click.
1374
+ */
1375
+ popoverComponent: React.ComponentType<T>;
1376
+ /**
1377
+ * Props passed to the popover component.
1378
+ */
1379
+ popoverProps: T;
1380
+ /**
1381
+ * Children nodes rendered inside the button.
1382
+ */
1383
+ children: React.ReactNode;
1384
+ /**
1385
+ * The element to focus when the popover is opened. Can be an element or a selector. Ignored if type is "menu".
1386
+ */
1387
+ initialFocus?: string | HTMLElement;
1388
+ }
1389
+
1390
+ export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
1133
1391
 
1134
1392
  /**
1135
1393
  * @public
1136
1394
  */
1137
- declare interface ReferencedMessageProps {
1395
+ export declare interface ReactionPickerProps {
1396
+ /**
1397
+ * The ID of the message that's being reacted to.
1398
+ */
1399
+ messageId: string;
1400
+ /**
1401
+ * Display the emoji reaction picker in light mode or dark mode.
1402
+ */
1403
+ colorScheme: "light" | "dark";
1404
+ }
1405
+
1406
+ /**
1407
+ * @public
1408
+ */
1409
+ export declare interface ReferencedMessageProps {
1138
1410
  /**
1139
1411
  * A collection of objects which are passed to all Chatbox theme components.
1140
1412
  */
@@ -1145,10 +1417,12 @@ declare interface ReferencedMessageProps {
1145
1417
  referencedMessage: ReferencedMessageSnapshot;
1146
1418
  }
1147
1419
 
1420
+ export { ReferencedMessageSnapshot }
1421
+
1148
1422
  /**
1149
1423
  * @public
1150
1424
  */
1151
- declare interface ReplyBarProps {
1425
+ export declare interface ReplyBarProps {
1152
1426
  /**
1153
1427
  * A collection of objects which are passed to all Chatbox theme components.
1154
1428
  */
@@ -1188,10 +1462,22 @@ export declare interface SendMessageEvent {
1188
1462
  conversation: ConversationSnapshot;
1189
1463
  }
1190
1464
 
1465
+ export { TalkSession }
1466
+
1467
+ /**
1468
+ * Displays rich text
1469
+ *
1470
+ * @public
1471
+ */
1472
+ declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
1473
+ export { Text_2 as Text }
1474
+
1475
+ export { TextBlock }
1476
+
1191
1477
  /**
1192
1478
  * @public
1193
1479
  */
1194
- declare interface TextBlockProps {
1480
+ export declare interface TextBlockProps {
1195
1481
  /**
1196
1482
  * A collection of objects which are passed to all Chatbox theme components.
1197
1483
  */
@@ -1206,6 +1492,31 @@ declare interface TextBlockProps {
1206
1492
  block: TextBlock;
1207
1493
  }
1208
1494
 
1495
+ /**
1496
+ * @public
1497
+ */
1498
+ export declare interface TextProps {
1499
+ /**
1500
+ * The block of formatted text to display.
1501
+ */
1502
+ block: TextBlock;
1503
+ /**
1504
+ * If true, links and action buttons/links won't be rendered.
1505
+ *
1506
+ * @remarks
1507
+ * The default is `false`
1508
+ */
1509
+ nonInteractive?: boolean;
1510
+ /**
1511
+ * @hidden
1512
+ */
1513
+ className?: string;
1514
+ /**
1515
+ * The message that this text block belongs to.
1516
+ */
1517
+ message: MessageSnapshot | ReferencedMessageSnapshot;
1518
+ }
1519
+
1209
1520
  /**
1210
1521
  * A theme can be used to customize the appearance & behavior of your TalkJS
1211
1522
  * Chatbox and/or ConversationList.
@@ -1241,10 +1552,31 @@ export declare interface Theme {
1241
1552
  ConversationListItem: React.ComponentType<ConversationListItemProps>;
1242
1553
  }
1243
1554
 
1555
+ /**
1556
+ * An object describing a human-readable tim
1557
+ *
1558
+ * @public
1559
+ */
1560
+ export declare interface TimeAgo {
1561
+ /**
1562
+ * An amount of milliseconds after which the values in {@link TimeAgo.long} and {@link TimeAgo.short} _may_ have changed.
1563
+ * If undefined, the values will not change within any meaningful period.
1564
+ */
1565
+ changeTimeout?: number | undefined;
1566
+ /**
1567
+ * A precise time description containing the exact date and time.
1568
+ */
1569
+ long: string;
1570
+ /**
1571
+ * A short human-friendly time description, such as "2 minutes ago"
1572
+ */
1573
+ short: string;
1574
+ }
1575
+
1244
1576
  /**
1245
1577
  * @public
1246
1578
  */
1247
- declare interface TimeAgoProps {
1579
+ export declare interface TimeAgoProps {
1248
1580
  /**
1249
1581
  * A collection of objects which are passed to all Chatbox theme components.
1250
1582
  */
@@ -1260,7 +1592,7 @@ declare interface TimeAgoProps {
1260
1592
  *
1261
1593
  * @public
1262
1594
  */
1263
- declare interface Translation extends TranslationStrings {
1595
+ export declare interface Translation extends TranslationStrings {
1264
1596
  locale: string;
1265
1597
  }
1266
1598
 
@@ -1311,8 +1643,6 @@ declare interface TranslationStrings {
1311
1643
  SAVE: string;
1312
1644
  EDITED_INDICATOR: string;
1313
1645
  REPLY_TO_MESSAGE: string;
1314
- REPLY_TO_ARIA_LABEL: (senderName: string, content: string) => string;
1315
- REPLY_MODE_LEAVE_ARIA_LABEL: string;
1316
1646
  ADD_REACTION: string;
1317
1647
  AUTH_EXPIRED_OVERLAY_TITLE: string;
1318
1648
  AUTH_EXPIRED_OVERLAY_DESCRIPTION: string;
@@ -1322,8 +1652,39 @@ declare interface TranslationStrings {
1322
1652
  STATUS_INDICATOR_ONLINE: string;
1323
1653
  STATUS_INDICATOR_OFFLINE: string;
1324
1654
  CONTACT_INFORMATION_HIDDEN: string;
1655
+ ARIA_LEAVE_SEARCH_MODE: string;
1656
+ ARIA_SEARCH_UP: string;
1657
+ ARIA_SEARCH_DOWN: string;
1658
+ ARIA_CLOSE_CHAT_POPUP: string;
1659
+ ARIA_SEARCH_INSIDE_CONVERSATION: string;
1660
+ ARIA_SEARCH: string;
1661
+ ARIA_CHAT: string;
1662
+ ARIA_SET_PLAYBACK_SPEED: string;
1663
+ ARIA_CANCEL_UPLOAD: string;
1664
+ ARIA_STOP_RECORDING: string;
1665
+ ARIA_CANCEL_RECORDING: string;
1666
+ ARIA_INSERT_EMOJI: string;
1667
+ ARIA_PLAY_AUDIO: string;
1668
+ ARIA_PAUSE_AUDIO: string;
1669
+ ARIA_REACTION_COUNT: (numReactions: number, emoji: string) => string;
1670
+ ARIA_MORE_ACTIONS: string;
1671
+ ARIA_REPLYING_TO: (senderName: string, content: string) => string;
1672
+ REPLY_MODE_LEAVE_ARIA_LABEL: string;
1325
1673
  }
1326
1674
 
1675
+ export { TypingSnapshot }
1676
+
1677
+ /**
1678
+ * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1679
+ * 2014", depending on which is most appropriate.
1680
+ *
1681
+ * @param timestamp The timestamp of the event in milliseconds since Unix epoch.
1682
+ * @param t Relevant translation object to get localized output
1683
+ *
1684
+ * @public
1685
+ */
1686
+ export declare function userFriendlyDate(timestamp: number, t: Translation): string;
1687
+
1327
1688
  /**
1328
1689
  * A set of permissions for the current user.
1329
1690
  *
@@ -1332,7 +1693,7 @@ declare interface TranslationStrings {
1332
1693
  *
1333
1694
  * @public
1334
1695
  */
1335
- declare interface UserPermissions {
1696
+ export declare interface UserPermissions {
1336
1697
  /**
1337
1698
  * True if typing indicators are enabled.
1338
1699
  */
@@ -1369,10 +1730,24 @@ declare interface UserPermissions {
1369
1730
  canMarkConversationAsUnread: boolean;
1370
1731
  }
1371
1732
 
1733
+ export { UserSnapshot }
1734
+
1735
+ /**
1736
+ *
1737
+ * This hooks triggers only when a human-readable timestamp needs to be updated.
1738
+ * For example, you could use it to display that a messages was updated X
1739
+ * minutes or Y hours ago.
1740
+ *
1741
+ * @public
1742
+ */
1743
+ export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
1744
+
1745
+ export { VideoBlock }
1746
+
1372
1747
  /**
1373
1748
  * @public
1374
1749
  */
1375
- declare interface VideoBlockProps {
1750
+ export declare interface VideoBlockProps {
1376
1751
  /**
1377
1752
  * A collection of objects which are passed to all Chatbox theme components.
1378
1753
  */
@@ -1402,10 +1777,12 @@ declare interface VideoBlockProps {
1402
1777
  downloadUrl?: string;
1403
1778
  }
1404
1779
 
1780
+ export { VoiceBlock }
1781
+
1405
1782
  /**
1406
1783
  * @public
1407
1784
  */
1408
- declare interface VoiceBlockProps {
1785
+ export declare interface VoiceBlockProps {
1409
1786
  /**
1410
1787
  * A collection of objects which are passed to all Chatbox theme components.
1411
1788
  */
@@ -1439,9 +1816,21 @@ export { }
1439
1816
 
1440
1817
 
1441
1818
  declare global {
1819
+ namespace TalkJS {
1820
+ type NullishChatboxProps = {
1821
+ [K in keyof Omit<ChatboxProps, "className" | "style">]: ChatboxProps[K] | null | undefined;
1822
+ };
1823
+ type NullishConversationListProps = {
1824
+ [K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
1825
+ };
1826
+ interface ChatboxElement extends HTMLElement, NullishChatboxProps, ChatboxController {
1827
+ }
1828
+ interface ConversationListElement extends HTMLElement, NullishConversationListProps, ConversationListController {
1829
+ }
1830
+ }
1442
1831
  interface HTMLElementTagNameMap {
1443
- "t-chatbox": ChatboxElement;
1444
- "t-conversation-list": ConversationListElement;
1832
+ "t-chatbox": TalkJS.ChatboxElement;
1833
+ "t-conversation-list": TalkJS.ConversationListElement;
1445
1834
  }
1446
1835
  }
1447
1836