@talkjs/web-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
+
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.
@@ -159,6 +198,90 @@ export declare interface BrowserPermissionRequest {
159
198
  showPrompt(): Promise<"granted" | "denied">;
160
199
  }
161
200
 
201
+ /**
202
+ * A collection of actions available on the Chatbox UI.
203
+ *
204
+ * @public
205
+ */
206
+ export declare class ChatboxController {
207
+ #private;
208
+ /**
209
+ * Deletes the message with the given ID.
210
+ *
211
+ * @param messageId
212
+ */
213
+ deleteMessage(messageId: string): Promise<void>;
214
+ /**
215
+ * Enable/disable editing of a given message.
216
+ *
217
+ * @param messageId When `null` is provided, editing mode will be disabled
218
+ */
219
+ setEditing(messageId: string | null): void;
220
+ /**
221
+ * Edit the message with the given ID.
222
+ *
223
+ * @param messageId
224
+ * @param params
225
+ */
226
+ editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
227
+ /**
228
+ * Send a text message to the current conversation.
229
+ *
230
+ * @param params
231
+ */
232
+ sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
233
+ /**
234
+ * Send a file message to the current conversation.
235
+ *
236
+ * @param message
237
+ */
238
+ sendFileMessage(params: {
239
+ fileToken: FileToken;
240
+ custom?: Record<string, string>;
241
+ }): Promise<void>;
242
+ /**
243
+ * Send a location message to the current conversation.
244
+ *
245
+ * @param message
246
+ */
247
+ sendLocationMessage(message: {
248
+ location: Coordinates;
249
+ custom?: Record<string, string>;
250
+ }): Promise<void>;
251
+ /**
252
+ * Set/unset the message that's currently being replied to.
253
+ *
254
+ * @param messageId - When `null` is provided, the "replying to" message is cleared
255
+ */
256
+ setReferencedMessage(messageId: string | null): void;
257
+ /**
258
+ * Toggle the given emoji reaction for the given message. If the current user
259
+ * already added this reaction, it's removed, and otherwise, it's added.
260
+ *
261
+ * Called from the theme's Message component when the user clicks on an
262
+ * existing emoji reaction.
263
+ *
264
+ * @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
265
+ * @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
266
+ */
267
+ toggleReaction(messageId: string, emoji: string): Promise<void>;
268
+ /**
269
+ * Get the plaintext from the message field
270
+ *
271
+ * @returns The text
272
+ */
273
+ getMessageFieldText(): string;
274
+ /**
275
+ * Set the plaintext in the message field
276
+ * @param text
277
+ */
278
+ setMessageFieldText(text: string): void;
279
+ /**
280
+ * Focus the message field
281
+ */
282
+ focusMessageField(): void;
283
+ }
284
+
162
285
  /**
163
286
  * The
164
287
  * {@link https://talkjs.com/docs/Features/Chat_UIs/#chatbox | TalkJS Chatbox UI. }
@@ -166,10 +289,7 @@ export declare interface BrowserPermissionRequest {
166
289
  *
167
290
  * @public
168
291
  */
169
- export declare const ChatboxHTMLElement: new () => ChatboxHTMLElement_2;
170
-
171
- declare interface ChatboxHTMLElement_2 extends HTMLElement, NullishChatboxProps, ChatboxRef {
172
- }
292
+ export declare const ChatboxElement: new () => TalkJS.ChatboxElement;
173
293
 
174
294
  /**
175
295
  * @public
@@ -235,7 +355,7 @@ export declare interface ChatboxProps {
235
355
  *
236
356
  * @remarks
237
357
  * See
238
- * {@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 }
239
359
  * for more info.
240
360
  */
241
361
  theme?: Partial<Theme>;
@@ -306,80 +426,36 @@ export declare interface ChatboxProps {
306
426
  * @param event Event object describing the missing permission
307
427
  */
308
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;
309
442
  /**
310
443
  * Arbitrary custom data passed down to the theme.
311
444
  *
312
445
  * @remarks
313
446
  * Whatever data you pass here will be made available for use in theme
314
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
447
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
315
448
  * theme components and through
316
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
449
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
317
450
  * theme components.
318
451
  */
319
452
  themeCustom?: any;
320
453
  }
321
454
 
322
455
  /**
323
- * A collection of actions available on the Chatbox UI.
324
- *
325
456
  * @public
326
457
  */
327
- export declare interface ChatboxRef {
328
- /**
329
- * Deletes the message with the given ID.
330
- *
331
- * @param messageId
332
- */
333
- deleteMessage(messageId: string): Promise<void>;
334
- /**
335
- * Enable/disable editing of a given message.
336
- *
337
- * @param messageId When `null` is provided, editing mode will be disabled
338
- */
339
- setEditing(messageId: string | null): void;
340
- /**
341
- * Edit the message with the given ID.
342
- *
343
- * @param messageId
344
- * @param params
345
- */
346
- editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
347
- /**
348
- * Send a text message to the current conversation.
349
- *
350
- * @param params
351
- */
352
- sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
353
- /**
354
- * Send a file message to the current conversation.
355
- *
356
- * @param message
357
- */
358
- sendFileMessage(params: {
359
- fileToken: FileToken;
360
- custom?: Record<string, string>;
361
- }): Promise<void>;
362
- /**
363
- * Send a location message to the current conversation.
364
- *
365
- * @param message
366
- */
367
- sendLocationMessage(message: {
368
- location: Coordinates;
369
- custom?: Record<string, string>;
370
- }): Promise<void>;
371
- /**
372
- * Set/unset the message that's currently being replied to.
373
- *
374
- * @param messageId When `null` is provided, the "replying to" message is cleared
375
- */
376
- setReferencedMessage(messageId: string | null): void;
377
- }
378
-
379
- /**
380
- * @public
381
- */
382
- declare interface ChatHeaderProps {
458
+ export declare interface ChatHeaderProps {
383
459
  /**
384
460
  * A collection of objects which are passed to all Chatbox theme components.
385
461
  */
@@ -401,7 +477,7 @@ declare interface ChatHeaderProps {
401
477
  *
402
478
  * @public
403
479
  */
404
- declare interface CommonChatboxProps {
480
+ export declare interface CommonChatboxProps {
405
481
  /**
406
482
  * Holds information about your TalkJS app.
407
483
  */
@@ -416,9 +492,9 @@ declare interface CommonChatboxProps {
416
492
  */
417
493
  t: Translation;
418
494
  /**
419
- * The chatbox instance itself.
495
+ * Public interface of the chatbox instance.
420
496
  */
421
- chatbox: ChatboxRef;
497
+ chatbox: ChatboxController;
422
498
  /**
423
499
  * Arbitrary custom data passed down to the theme.
424
500
  *
@@ -459,7 +535,7 @@ declare interface CommonChatboxProps {
459
535
  *
460
536
  * @public
461
537
  */
462
- declare interface CommonConversationListProps {
538
+ export declare interface CommonConversationListProps {
463
539
  /**
464
540
  * Holds information about your TalkJS app.
465
541
  */
@@ -490,9 +566,9 @@ declare interface CommonConversationListProps {
490
566
  */
491
567
  theme: Theme;
492
568
  /**
493
- * The conversation list instance itself.
569
+ * Public interface of the conversation list instance.
494
570
  */
495
- conversationList: ConversationListRef;
571
+ conversationList: ConversationListController;
496
572
  /**
497
573
  * The underlying TalkJS session object that handles sending and receiving chat data.
498
574
  */
@@ -502,7 +578,7 @@ declare interface CommonConversationListProps {
502
578
  /**
503
579
  * @public
504
580
  */
505
- declare interface CompactMessageContentProps {
581
+ export declare interface CompactMessageContentProps {
506
582
  /**
507
583
  * A collection of objects which are passed to all Chatbox/ConversationList
508
584
  * theme components.
@@ -521,7 +597,7 @@ declare interface CompactMessageContentProps {
521
597
  /**
522
598
  * @public
523
599
  */
524
- declare interface ConversationImageProps {
600
+ export declare interface ConversationImageProps {
525
601
  /**
526
602
  * A collection of objects which are passed to all Chatbox/ConversationList
527
603
  * theme components.
@@ -541,6 +617,32 @@ declare interface ConversationImageProps {
541
617
  participants: ParticipantSnapshot[];
542
618
  }
543
619
 
620
+ /**
621
+ * A collection of actions available on the ConversationList UI.
622
+ *
623
+ * @public
624
+ */
625
+ export declare class ConversationListController {
626
+ #private;
627
+ /**
628
+ * Select a conversation.
629
+ *
630
+ * @remarks
631
+ * This method is called from the theme's ConversationListItem component when
632
+ * the user clicks on the given conversation. You can also call it
633
+ * programmatically from elsewhere to simulate a user click.
634
+ *
635
+ * This method will trigger the
636
+ * {@link ConversationListProps.onSelectConversation} event. In most
637
+ * cases, if you want to change the selected conversation programmatically
638
+ * from outside the conversation list, it's better to pass a different value
639
+ * to the {@link ConversationListProps.selectedConversationId} prop
640
+ * instead, as that lets you keep your local state in sync with the props
641
+ * passed to the conversation list.
642
+ */
643
+ selectConversation(conversationId: string): void;
644
+ }
645
+
544
646
  /**
545
647
  * The
546
648
  * {@link https://talkjs.com/docs/Features/Chat_UIs/#conversation-list | Conversation List UI. }
@@ -550,12 +652,9 @@ declare interface ConversationImageProps {
550
652
  *
551
653
  * @public
552
654
  */
553
- export declare const ConversationListHTMLElement: new () => ConversationListHTMLElement_2;
655
+ export declare const ConversationListElement: new () => TalkJS.ConversationListElement;
554
656
 
555
- declare interface ConversationListHTMLElement_2 extends HTMLElement, NullishConversationListProps, ConversationListRef {
556
- }
557
-
558
- declare interface ConversationListItemProps {
657
+ export declare interface ConversationListItemProps {
559
658
  /**
560
659
  * A collection of objects which are passed to all ConversationList theme components.
561
660
  */
@@ -609,7 +708,7 @@ export declare interface ConversationListProps {
609
708
  * update.
610
709
  *
611
710
  * Note that updating the selected conversation through this prop **will not**
612
- * trigger the {@linkcode onSelectConversation} callback.
711
+ * trigger the {@link onSelectConversation} callback.
613
712
  */
614
713
  selectedConversationId?: string;
615
714
  /**
@@ -642,7 +741,7 @@ export declare interface ConversationListProps {
642
741
  *
643
742
  * @remarks
644
743
  * See
645
- * {@link https://talkjs.com/docs/SDKs/React/Customization/#custom-theme-components | Custom theme components }
744
+ * {@link https://talkjs.com/docs/UI_Components/React/Customization/#custom-theme-components | Custom theme components }
646
745
  * for more info.
647
746
  */
648
747
  theme?: Partial<Theme>;
@@ -653,11 +752,11 @@ export declare interface ConversationListProps {
653
752
  *
654
753
  * @remarks
655
754
  * Note that updating the selected conversation through the
656
- * {@linkcode selectedConversationId} prop **will not** trigger this callback.
755
+ * {@link selectedConversationId} prop **will not** trigger this callback.
657
756
  *
658
757
  * Use this callback to have an adjacent chatbox show the correct
659
758
  * conversation. See
660
- * {@link https://talkjs.com/docs/SDKs/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
759
+ * {@link https://talkjs.com/docs/UI_Components/React/ConversationList/#respond-to-a-select-conversation-event | Respond to a select conversation event.}
661
760
  */
662
761
  onSelectConversation?: (event: SelectConversationEvent) => void;
663
762
  /**
@@ -665,36 +764,20 @@ export declare interface ConversationListProps {
665
764
  *
666
765
  * @remarks
667
766
  * Whatever data you pass here will be made available for use in theme
668
- * components through {@linkcode CommonChatboxProps.themeCustom} for Chatbox
767
+ * components through {@link CommonChatboxProps.themeCustom} for Chatbox
669
768
  * theme components and through
670
- * {@linkcode CommonConversationListProps.themeCustom} for ConversationList
769
+ * {@link CommonConversationListProps.themeCustom} for ConversationList
671
770
  * theme components.
672
771
  */
673
772
  themeCustom?: any;
674
773
  }
675
774
 
676
- /**
677
- * A collection of actions available on the ConversationList UI.
678
- *
679
- * @public
680
- */
681
- export declare interface ConversationListRef {
682
- /**
683
- * Programatically select a conversation.
684
- *
685
- * @param conversationId
686
- *
687
- * @remarks
688
- * Note that this **will not** trigger the
689
- * {@linkcode ConversationListProps.onSelectConversation} callback.
690
- */
691
- selectConversation(conversationId: string): void;
692
- }
775
+ export { ConversationSnapshot }
693
776
 
694
777
  /**
695
778
  * @public
696
779
  */
697
- declare interface Coordinates {
780
+ export declare interface Coordinates {
698
781
  latitude: number;
699
782
  longitude: number;
700
783
  }
@@ -731,7 +814,7 @@ export declare interface DeleteMessageEvent {
731
814
  *
732
815
  * @public
733
816
  */
734
- declare interface DeviceFeatures {
817
+ export declare interface DeviceFeatures {
735
818
  /**
736
819
  * True if the browser supports IndexedDB, which the emoji picker depends on.
737
820
  */
@@ -742,10 +825,86 @@ declare interface DeviceFeatures {
742
825
  isMobile: boolean;
743
826
  }
744
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
+
745
842
  /**
746
843
  * @public
747
844
  */
748
- 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 {
749
908
  /**
750
909
  * A collection of objects which are passed to all Chatbox theme components.
751
910
  */
@@ -776,9 +935,53 @@ declare interface FileBlockProps {
776
935
  }
777
936
 
778
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
+ *
779
948
  * @public
780
949
  */
781
- declare interface GroupChatImageProps {
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
+
981
+ /**
982
+ * @public
983
+ */
984
+ export declare interface GroupChatImageProps {
782
985
  /**
783
986
  * A collection of objects which are passed to all Chatbox/ConversationList
784
987
  * theme components.
@@ -795,9 +998,24 @@ declare interface GroupChatImageProps {
795
998
  }
796
999
 
797
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
+ *
798
1007
  * @public
1008
+ *
1009
+ * @privateRemarks
1010
+ * Adapted from:
1011
+ * https://github.com/developit/htm/issues/175#issuecomment-773755560
799
1012
  */
800
- declare interface IconProps {
1013
+ export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
1014
+
1015
+ /**
1016
+ * @public
1017
+ */
1018
+ export declare interface IconProps {
801
1019
  /**
802
1020
  * A collection of objects which are passed to all Chatbox/ConversationList
803
1021
  * theme components.
@@ -817,22 +1035,12 @@ declare interface IconProps {
817
1035
  className?: string;
818
1036
  }
819
1037
 
820
- declare interface IEditorController {
821
- isTyping: boolean;
822
- atTextLimit: boolean;
823
- isEmpty: boolean;
824
- characterCount: number;
825
- showEmojiPicker: boolean;
826
- send(): void;
827
- shareLocation(): void;
828
- attachFile(): void;
829
- toggleEmojiPicker(): void;
830
- }
1038
+ export { ImageBlock }
831
1039
 
832
1040
  /**
833
1041
  * @public
834
1042
  */
835
- declare interface ImageBlockProps {
1043
+ export declare interface ImageBlockProps {
836
1044
  /**
837
1045
  * A collection of objects which are passed to all Chatbox theme components.
838
1046
  */
@@ -862,10 +1070,12 @@ declare interface ImageBlockProps {
862
1070
  downloadUrl?: string;
863
1071
  }
864
1072
 
1073
+ export { LocationBlock }
1074
+
865
1075
  /**
866
1076
  * @public
867
1077
  */
868
- declare interface LocationBlockProps {
1078
+ export declare interface LocationBlockProps {
869
1079
  /**
870
1080
  * A collection of objects which are passed to all Chatbox theme components.
871
1081
  */
@@ -880,10 +1090,58 @@ declare interface LocationBlockProps {
880
1090
  block: LocationBlock;
881
1091
  }
882
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
+
1117
+ /**
1118
+ * An event object dispatched by the {@link ChatboxProps.onMessageAction} event.
1119
+ *
1120
+ * @public
1121
+ */
1122
+ export declare interface MessageActionEvent {
1123
+ /**
1124
+ * The name of the action that was triggered.
1125
+ */
1126
+ action: string;
1127
+ /**
1128
+ * The parameters of the action that was triggered, if any.
1129
+ */
1130
+ params: Record<string, string>;
1131
+ /**
1132
+ * The message that contained the action link or action button.
1133
+ */
1134
+ message: MessageSnapshot;
1135
+ /**
1136
+ * The current conversation.
1137
+ */
1138
+ conversation: ConversationSnapshot;
1139
+ }
1140
+
883
1141
  /**
884
1142
  * @public
885
1143
  */
886
- declare interface MessageActionMenuProps {
1144
+ export declare interface MessageActionMenuProps {
887
1145
  /**
888
1146
  * A collection of objects which are passed to all Chatbox theme components.
889
1147
  */
@@ -898,10 +1156,34 @@ declare interface MessageActionMenuProps {
898
1156
  permissions: MessagePermissions;
899
1157
  }
900
1158
 
1159
+ export declare function MessageContent(props: MessageContentProps): JSX.Element;
1160
+
1161
+ /**
1162
+ * @public
1163
+ */
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
+
901
1183
  /**
902
1184
  * @public
903
1185
  */
904
- declare interface MessageDividerProps {
1186
+ export declare interface MessageDividerProps {
905
1187
  /**
906
1188
  * A collection of objects which are passed to all Chatbox theme components.
907
1189
  */
@@ -924,7 +1206,7 @@ declare interface MessageDividerProps {
924
1206
  /**
925
1207
  * @public
926
1208
  */
927
- declare interface MessageFieldProps {
1209
+ export declare interface MessageFieldProps {
928
1210
  /**
929
1211
  * A collection of objects which are passed to all Chatbox theme components.
930
1212
  */
@@ -940,7 +1222,7 @@ declare interface MessageFieldProps {
940
1222
  /**
941
1223
  * An object holding the state of the message field.
942
1224
  */
943
- editor: IEditorController;
1225
+ editor: EditorController;
944
1226
  /**
945
1227
  * When a message is being edited its ID will be stored here.
946
1228
  */
@@ -950,7 +1232,7 @@ declare interface MessageFieldProps {
950
1232
  /**
951
1233
  * @public
952
1234
  */
953
- declare interface MessageListFooterProps {
1235
+ export declare interface MessageListFooterProps {
954
1236
  /**
955
1237
  * A collection of objects which are passed to all Chatbox theme components.
956
1238
  */
@@ -965,7 +1247,7 @@ declare interface MessageListFooterProps {
965
1247
  *
966
1248
  * @public
967
1249
  */
968
- declare interface MessagePermissions extends UserPermissions {
1250
+ export declare interface MessagePermissions extends UserPermissions {
969
1251
  /**
970
1252
  * True if the user has the ability to delete the given message.
971
1253
  */
@@ -987,7 +1269,7 @@ declare interface MessagePermissions extends UserPermissions {
987
1269
  /**
988
1270
  * @public
989
1271
  */
990
- declare interface MessageProps {
1272
+ export declare interface MessageProps {
991
1273
  /**
992
1274
  * A collection of objects which are passed to all Chatbox theme components.
993
1275
  */
@@ -1006,6 +1288,8 @@ declare interface MessageProps {
1006
1288
  permissions: MessagePermissions;
1007
1289
  }
1008
1290
 
1291
+ export { MessageSnapshot }
1292
+
1009
1293
  /**
1010
1294
  * The current status of the message.
1011
1295
  *
@@ -1020,7 +1304,7 @@ declare interface MessageProps {
1020
1304
  *
1021
1305
  * @public
1022
1306
  */
1023
- declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1307
+ export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
1024
1308
 
1025
1309
  /**
1026
1310
  * Sent by {@link ChatboxProps.onMissingBrowserPermission} when the user
@@ -1054,18 +1338,75 @@ export declare interface MissingBrowserPermissionEvent {
1054
1338
  type: BrowserPermission;
1055
1339
  }
1056
1340
 
1057
- declare type NullishChatboxProps = {
1058
- [K in keyof Omit<ChatboxProps, "className" | "style">]: ChatboxProps[K] | null | undefined;
1059
- };
1341
+ export { ParticipantSnapshot }
1060
1342
 
1061
- declare type NullishConversationListProps = {
1062
- [K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
1063
- };
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;
1064
1360
 
1065
1361
  /**
1066
1362
  * @public
1067
1363
  */
1068
- declare interface ReferencedMessageProps {
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;
1391
+
1392
+ /**
1393
+ * @public
1394
+ */
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 {
1069
1410
  /**
1070
1411
  * A collection of objects which are passed to all Chatbox theme components.
1071
1412
  */
@@ -1076,10 +1417,12 @@ declare interface ReferencedMessageProps {
1076
1417
  referencedMessage: ReferencedMessageSnapshot;
1077
1418
  }
1078
1419
 
1420
+ export { ReferencedMessageSnapshot }
1421
+
1079
1422
  /**
1080
1423
  * @public
1081
1424
  */
1082
- declare interface ReplyBarProps {
1425
+ export declare interface ReplyBarProps {
1083
1426
  /**
1084
1427
  * A collection of objects which are passed to all Chatbox theme components.
1085
1428
  */
@@ -1119,10 +1462,22 @@ export declare interface SendMessageEvent {
1119
1462
  conversation: ConversationSnapshot;
1120
1463
  }
1121
1464
 
1465
+ export { TalkSession }
1466
+
1122
1467
  /**
1468
+ * Displays rich text
1469
+ *
1123
1470
  * @public
1124
1471
  */
1125
- declare interface TextBlockProps {
1472
+ declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
1473
+ export { Text_2 as Text }
1474
+
1475
+ export { TextBlock }
1476
+
1477
+ /**
1478
+ * @public
1479
+ */
1480
+ export declare interface TextBlockProps {
1126
1481
  /**
1127
1482
  * A collection of objects which are passed to all Chatbox theme components.
1128
1483
  */
@@ -1137,6 +1492,31 @@ declare interface TextBlockProps {
1137
1492
  block: TextBlock;
1138
1493
  }
1139
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
+
1140
1520
  /**
1141
1521
  * A theme can be used to customize the appearance & behavior of your TalkJS
1142
1522
  * Chatbox and/or ConversationList.
@@ -1172,10 +1552,31 @@ export declare interface Theme {
1172
1552
  ConversationListItem: React.ComponentType<ConversationListItemProps>;
1173
1553
  }
1174
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
+
1175
1576
  /**
1176
1577
  * @public
1177
1578
  */
1178
- declare interface TimeAgoProps {
1579
+ export declare interface TimeAgoProps {
1179
1580
  /**
1180
1581
  * A collection of objects which are passed to all Chatbox theme components.
1181
1582
  */
@@ -1191,7 +1592,7 @@ declare interface TimeAgoProps {
1191
1592
  *
1192
1593
  * @public
1193
1594
  */
1194
- declare interface Translation extends TranslationStrings {
1595
+ export declare interface Translation extends TranslationStrings {
1195
1596
  locale: string;
1196
1597
  }
1197
1598
 
@@ -1255,6 +1656,19 @@ declare interface TranslationStrings {
1255
1656
  CONTACT_INFORMATION_HIDDEN: string;
1256
1657
  }
1257
1658
 
1659
+ export { TypingSnapshot }
1660
+
1661
+ /**
1662
+ * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1663
+ * 2014", depending on which is most appropriate.
1664
+ *
1665
+ * @param timestamp The timestamp of the event in milliseconds since Unix epoch.
1666
+ * @param t Relevant translation object to get localized output
1667
+ *
1668
+ * @public
1669
+ */
1670
+ export declare function userFriendlyDate(timestamp: number, t: Translation): string;
1671
+
1258
1672
  /**
1259
1673
  * A set of permissions for the current user.
1260
1674
  *
@@ -1263,7 +1677,7 @@ declare interface TranslationStrings {
1263
1677
  *
1264
1678
  * @public
1265
1679
  */
1266
- declare interface UserPermissions {
1680
+ export declare interface UserPermissions {
1267
1681
  /**
1268
1682
  * True if typing indicators are enabled.
1269
1683
  */
@@ -1300,10 +1714,24 @@ declare interface UserPermissions {
1300
1714
  canMarkConversationAsUnread: boolean;
1301
1715
  }
1302
1716
 
1717
+ export { UserSnapshot }
1718
+
1303
1719
  /**
1720
+ *
1721
+ * This hooks triggers only when a human-readable timestamp needs to be updated.
1722
+ * For example, you could use it to display that a messages was updated X
1723
+ * minutes or Y hours ago.
1724
+ *
1304
1725
  * @public
1305
1726
  */
1306
- declare interface VideoBlockProps {
1727
+ export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
1728
+
1729
+ export { VideoBlock }
1730
+
1731
+ /**
1732
+ * @public
1733
+ */
1734
+ export declare interface VideoBlockProps {
1307
1735
  /**
1308
1736
  * A collection of objects which are passed to all Chatbox theme components.
1309
1737
  */
@@ -1333,10 +1761,12 @@ declare interface VideoBlockProps {
1333
1761
  downloadUrl?: string;
1334
1762
  }
1335
1763
 
1764
+ export { VoiceBlock }
1765
+
1336
1766
  /**
1337
1767
  * @public
1338
1768
  */
1339
- declare interface VoiceBlockProps {
1769
+ export declare interface VoiceBlockProps {
1340
1770
  /**
1341
1771
  * A collection of objects which are passed to all Chatbox theme components.
1342
1772
  */
@@ -1370,9 +1800,21 @@ export { }
1370
1800
 
1371
1801
 
1372
1802
  declare global {
1803
+ namespace TalkJS {
1804
+ type NullishChatboxProps = {
1805
+ [K in keyof Omit<ChatboxProps, "className" | "style">]: ChatboxProps[K] | null | undefined;
1806
+ };
1807
+ type NullishConversationListProps = {
1808
+ [K in keyof Omit<ConversationListProps, "className" | "style">]: ConversationListProps[K] | null | undefined;
1809
+ };
1810
+ interface ChatboxElement extends HTMLElement, NullishChatboxProps, ChatboxController {
1811
+ }
1812
+ interface ConversationListElement extends HTMLElement, NullishConversationListProps, ConversationListController {
1813
+ }
1814
+ }
1373
1815
  interface HTMLElementTagNameMap {
1374
- "t-chatbox": ChatboxHTMLElement;
1375
- "t-conversation-list": ConversationListHTMLElement;
1816
+ "t-chatbox": TalkJS.ChatboxElement;
1817
+ "t-conversation-list": TalkJS.ConversationListElement;
1376
1818
  }
1377
1819
  }
1378
1820