@talkjs/react-components 0.0.30 → 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/theming.d.ts DELETED
@@ -1,1351 +0,0 @@
1
- import { AudioBlock } from '@talkjs/core';
2
- import { ConversationSnapshot } from '@talkjs/core';
3
- import { EditMessageParams } from '@talkjs/core';
4
- import { EditTextMessageParams } from '@talkjs/core';
5
- import { FileBlock } from '@talkjs/core';
6
- import { FileToken } from '@talkjs/core';
7
- import { GenericFileBlock } from '@talkjs/core';
8
- import { ImageBlock } from '@talkjs/core';
9
- import { LocationBlock } from '@talkjs/core';
10
- import { MessageSnapshot } from '@talkjs/core';
11
- import { ParticipantSnapshot } from '@talkjs/core';
12
- import * as React from 'react';
13
- import { ReferencedMessageSnapshot } from '@talkjs/core';
14
- import { SendMessageParams } from '@talkjs/core';
15
- import { SendTextMessageParams } from '@talkjs/core';
16
- import { TalkSession } from '@talkjs/core';
17
- import { TextBlock } from '@talkjs/core';
18
- import { TypingSnapshot } from '@talkjs/core';
19
- import { UserSnapshot } from '@talkjs/core';
20
- import { VideoBlock } from '@talkjs/core';
21
- import { VoiceBlock } from '@talkjs/core';
22
-
23
- /**
24
- * Holds information about your TalkJS app.
25
- *
26
- * @public
27
- */
28
- export declare interface App {
29
- /**
30
- * Your app's unique TalkJS ID. You can find it on the Settings page of the
31
- * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
32
- */
33
- id: string;
34
- /**
35
- * The name of your app.
36
- */
37
- name: string;
38
- /**
39
- * The default locale.
40
- *
41
- * @remarks
42
- * This can be configured from your TalkJS dashboard.
43
- */
44
- defaultLocale: string;
45
- /**
46
- * Custom data set for this app.
47
- *
48
- * @remarks
49
- * This can be configured from your TalkJS dashboard.
50
- */
51
- custom: Record<string, string>;
52
- }
53
-
54
- export { AudioBlock }
55
-
56
- /**
57
- * @public
58
- */
59
- export declare interface AudioBlockProps {
60
- /**
61
- * A collection of objects which are passed to all Chatbox theme components.
62
- */
63
- common: CommonChatboxProps;
64
- /**
65
- * The message that this content block belongs to.
66
- */
67
- message: MessageSnapshot;
68
- /**
69
- * The audio block to display.
70
- */
71
- block: AudioBlock;
72
- /**
73
- * The URL used to download the file.
74
- *
75
- * @remarks
76
- * This URL is not the same as `block.url`. When the current user sends a file
77
- * message, the `block.url` will hold a temporary `blob:` URL until that file
78
- * is uploaded to TalkJS. The user can immediately see their file present in
79
- * the chat, which makes for a smoother user experience.
80
- *
81
- * The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
82
- * such, this property will be `undefined` until the upload is completed,
83
- * while `block.url` will always be defined and should be used for preview
84
- * purposes.
85
- */
86
- downloadUrl?: string;
87
- }
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
-
125
- /**
126
- * @public
127
- */
128
- export declare interface AvatarProps {
129
- /**
130
- * A collection of objects which are passed to all Chatbox/ConversationList
131
- * theme components.
132
- *
133
- * @remarks
134
- * Because this particular theme component can show up in both a `<Chatbox>`
135
- * and a `<ConversationList>`, this prop has a union type.
136
- */
137
- common: CommonChatboxProps | CommonConversationListProps;
138
- /**
139
- * The URL of the image that's to be displayed.
140
- */
141
- photoUrl: string;
142
- }
143
-
144
- /**
145
- * A collection of actions available on the Chatbox UI.
146
- *
147
- * @public
148
- */
149
- export declare class ChatboxController {
150
- #private;
151
- /**
152
- * Deletes the message with the given ID.
153
- *
154
- * @param messageId
155
- */
156
- deleteMessage(messageId: string): Promise<void>;
157
- /**
158
- * Enable/disable editing of a given message.
159
- *
160
- * @param messageId When `null` is provided, editing mode will be disabled
161
- */
162
- setEditing(messageId: string | null): void;
163
- /**
164
- * Edit the message with the given ID.
165
- *
166
- * @param messageId
167
- * @param params
168
- */
169
- editMessage(messageId: string, params: EditTextMessageParams | EditMessageParams): Promise<void>;
170
- /**
171
- * Send a text message to the current conversation.
172
- *
173
- * @param params
174
- */
175
- sendMessage(params: SendTextMessageParams | SendMessageParams): Promise<void>;
176
- /**
177
- * Send a file message to the current conversation.
178
- *
179
- * @param message
180
- */
181
- sendFileMessage(params: {
182
- fileToken: FileToken;
183
- custom?: Record<string, string>;
184
- }): Promise<void>;
185
- /**
186
- * Send a location message to the current conversation.
187
- *
188
- * @param message
189
- */
190
- sendLocationMessage(message: {
191
- location: Coordinates;
192
- custom?: Record<string, string>;
193
- }): Promise<void>;
194
- /**
195
- * Set/unset the message that's currently being replied to.
196
- *
197
- * @param messageId - When `null` is provided, the "replying to" message is cleared
198
- */
199
- setReferencedMessage(messageId: string | null): void;
200
- /**
201
- * Toggle the given emoji reaction for the given message. If the current user
202
- * already added this reaction, it's removed, and otherwise, it's added.
203
- *
204
- * Called from the theme's Message component when the user clicks on an
205
- * existing emoji reaction.
206
- *
207
- * @param messageId - The ID of the message you want to toggle the reaction on. This message must exist in the current conversation.
208
- * @param emoji - The emoji you want to toggle. Must be a string of a single unicode emoji glyph, eg `"🎉"`.
209
- */
210
- toggleReaction(messageId: string, emoji: string): Promise<void>;
211
- /**
212
- * Get the plaintext from the message field
213
- *
214
- * @returns The text
215
- */
216
- getMessageFieldText(): string;
217
- /**
218
- * Set the plaintext in the message field
219
- * @param text
220
- */
221
- setMessageFieldText(text: string): void;
222
- /**
223
- * Focus the message field
224
- */
225
- focusMessageField(): void;
226
- }
227
-
228
- /**
229
- * @public
230
- */
231
- export declare interface ChatHeaderProps {
232
- /**
233
- * A collection of objects which are passed to all Chatbox theme components.
234
- */
235
- common: CommonChatboxProps;
236
- /**
237
- * A record of user IDs and their connection status.
238
- */
239
- isUserConnected: {
240
- [userId: string]: boolean;
241
- };
242
- /**
243
- * The current user's permissions.
244
- */
245
- permissions: UserPermissions;
246
- }
247
-
248
- /**
249
- * A collection of props that's shared by every themed component used in the Chatbox UI.
250
- *
251
- * @public
252
- */
253
- export declare interface CommonChatboxProps {
254
- /**
255
- * Holds information about your TalkJS app.
256
- */
257
- app: App;
258
- /**
259
- * The user that mounted this chatbox.
260
- */
261
- currentUser: UserSnapshot;
262
- /**
263
- * A translation object which holds localized strings for internationalization
264
- * purposes.
265
- */
266
- t: Translation;
267
- /**
268
- * Public interface of the chatbox instance.
269
- */
270
- chatbox: ChatboxController;
271
- /**
272
- * Arbitrary custom data passed down to the theme.
273
- *
274
- * @remarks
275
- * The data that you pass to {@link ChatboxProps.themeCustom} will show up
276
- * here so that you can use it from within theme components.
277
- */
278
- themeCustom?: any;
279
- /**
280
- * Describes the capabilities of the current device.
281
- */
282
- device: DeviceFeatures;
283
- /**
284
- * The theme object that the chatbox's is currently using.
285
- */
286
- theme: Theme;
287
- /**
288
- * The conversation displayed in the chatbox.
289
- */
290
- conversation: ConversationSnapshot;
291
- /**
292
- * A list of participants that are part of the conversation that's currently
293
- * being shown.
294
- */
295
- participants: ParticipantSnapshot[];
296
- /**
297
- * Tells you which participants are currently typing
298
- */
299
- typing: TypingSnapshot;
300
- /**
301
- * The underlying TalkJS session object that handles sending and receiving chat data.
302
- */
303
- session: TalkSession;
304
- }
305
-
306
- /**
307
- * A collection of props that's shared by every themed component used in the ConversationList UI.
308
- *
309
- * @public
310
- */
311
- export declare interface CommonConversationListProps {
312
- /**
313
- * Holds information about your TalkJS app.
314
- */
315
- app: App;
316
- /**
317
- * The user that mounted this chatbox.
318
- */
319
- currentUser: UserSnapshot;
320
- /**
321
- * A translation object which holds localized strings for internationalization
322
- * purposes.
323
- */
324
- t: Translation;
325
- /**
326
- * Arbitrary custom data passed down to the theme.
327
- *
328
- * @remarks
329
- * The data that you pass to {@link ConversationListProps.themeCustom} will show up
330
- * here so that you can use it from within theme components.
331
- */
332
- themeCustom?: any;
333
- /**
334
- * Describes the capabilities of the current device.
335
- */
336
- device: DeviceFeatures;
337
- /**
338
- * The theme object that the chatbox's is currently using.
339
- */
340
- theme: Theme;
341
- /**
342
- * Public interface of the conversation list instance.
343
- */
344
- conversationList: ConversationListController;
345
- /**
346
- * The underlying TalkJS session object that handles sending and receiving chat data.
347
- */
348
- session: TalkSession;
349
- }
350
-
351
- /**
352
- * @public
353
- */
354
- export declare interface CompactMessageContentProps {
355
- /**
356
- * A collection of objects which are passed to all Chatbox/ConversationList
357
- * theme components.
358
- *
359
- * @remarks
360
- * Because this particular theme component can show up in both a `<Chatbox>`
361
- * and a `<ConversationList>`, this prop has a union type.
362
- */
363
- common: CommonChatboxProps | CommonConversationListProps;
364
- /**
365
- * The message that's being displayed.
366
- */
367
- message: MessageSnapshot | ReferencedMessageSnapshot;
368
- }
369
-
370
- /**
371
- * @public
372
- */
373
- export declare interface ConversationImageProps {
374
- /**
375
- * A collection of objects which are passed to all Chatbox/ConversationList
376
- * theme components.
377
- *
378
- * @remarks
379
- * Because this particular theme component can show up in both a `<Chatbox>`
380
- * and a `<ConversationList>`, this prop has a union type.
381
- */
382
- common: CommonChatboxProps | CommonConversationListProps;
383
- /**
384
- * The conversation that's being displayed.
385
- */
386
- conversation: ConversationSnapshot;
387
- /**
388
- * A list of participants that are a part of the conversation.
389
- */
390
- participants: ParticipantSnapshot[];
391
- }
392
-
393
- /**
394
- * A collection of actions available on the ConversationList UI.
395
- *
396
- * @public
397
- */
398
- export declare class ConversationListController {
399
- #private;
400
- /**
401
- * Select a conversation.
402
- *
403
- * @remarks
404
- * This method is called from the theme's ConversationListItem component when
405
- * the user clicks on the given conversation. You can also call it
406
- * programmatically from elsewhere to simulate a user click.
407
- *
408
- * This method will trigger the
409
- * {@linkcode ConversationListProps.onSelectConversation} event. In most
410
- * cases, if you want to change the selected conversation programmatically
411
- * from outside the conversation list, it's better to pass a different value
412
- * to the {@linkcode ConversationListProps.selectedConversationId} prop
413
- * instead, as that lets you keep your local state in sync with the props
414
- * passed to the conversation list.
415
- */
416
- selectConversation(conversationId: string): void;
417
- }
418
-
419
- export declare interface ConversationListItemProps {
420
- /**
421
- * A collection of objects which are passed to all ConversationList theme components.
422
- */
423
- common: CommonConversationListProps;
424
- /**
425
- * The conversation that's being displayed.
426
- */
427
- conversation: ConversationSnapshot;
428
- /**
429
- * The list of participants that are part of the given conversation.
430
- */
431
- participants: ParticipantSnapshot[];
432
- /**
433
- * If `true`, this conversation is the currently selected one in the
434
- * conversation list.
435
- */
436
- isSelected: boolean;
437
- }
438
-
439
- export { ConversationSnapshot }
440
-
441
- /**
442
- * @public
443
- */
444
- export declare interface Coordinates {
445
- latitude: number;
446
- longitude: number;
447
- }
448
-
449
- /**
450
- * Describes the capabilities of the current device.
451
- *
452
- * @public
453
- */
454
- export declare interface DeviceFeatures {
455
- /**
456
- * True if the browser supports IndexedDB, which the emoji picker depends on.
457
- */
458
- supportsEmojiPicker: boolean;
459
- /**
460
- * True if the user agents reports the current device as a mobile/tablet.
461
- */
462
- isMobile: boolean;
463
- }
464
-
465
- export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX.Element;
466
-
467
- export declare interface EditorController {
468
- isTyping: boolean;
469
- atTextLimit: boolean;
470
- isEmpty: boolean;
471
- characterCount: number;
472
- showEmojiPicker: boolean;
473
- send(): void;
474
- shareLocation(): void;
475
- attachFile(): void;
476
- toggleEmojiPicker(): void;
477
- }
478
-
479
- /**
480
- * @public
481
- */
482
- export declare interface EditorProps {
483
- /**
484
- * The maximum allowed character length.
485
- *
486
- * @remarks
487
- * The default is `10000`
488
- */
489
- characterLimit?: number;
490
- /**
491
- * Determines if the Editor can be interacted with or not.
492
- */
493
- disabled?: boolean;
494
- /**
495
- * Placeholder text when the input is empty to encourage the user to write.
496
- *
497
- * @remarks
498
- * The default is `"Say something..."`
499
- */
500
- placeholder?: string;
501
- /**
502
- * If true, spell-checking is enabled.
503
- *
504
- * @remarks
505
- * The default is `false`
506
- */
507
- spellcheck?: boolean;
508
- /**
509
- * @hidden
510
- */
511
- className?: string;
512
- }
513
-
514
- export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
515
-
516
- /**
517
- * @public
518
- */
519
- export declare interface EmojiPickerProps {
520
- /**
521
- * Display the emoji picker in light mode or dark mode.
522
- */
523
- colorScheme: "light" | "dark";
524
- }
525
-
526
- /**
527
- * Shows a bar with emoji suggestions when the user types eg `:bla`. Shown if `query` is non-empty.
528
- *
529
- * Uses the IndexedDB-backed emoji database from "emoji-picker-element".
530
- */
531
- export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
532
-
533
- /**
534
- * @public
535
- */
536
- export declare interface EmojiSuggestBarProps {
537
- }
538
-
539
- export { FileBlock }
540
-
541
- /**
542
- * @public
543
- */
544
- export declare interface FileBlockProps {
545
- /**
546
- * A collection of objects which are passed to all Chatbox theme components.
547
- */
548
- common: CommonChatboxProps;
549
- /**
550
- * The message that this content block belongs to.
551
- */
552
- message: MessageSnapshot;
553
- /**
554
- * The generic file block to display.
555
- */
556
- block: GenericFileBlock;
557
- /**
558
- * The URL used to download the file.
559
- *
560
- * @remarks
561
- * This URL is not the same as `block.url`. When the current user sends a file
562
- * message, the `block.url` will hold a temporary `blob:` URL until that file
563
- * is uploaded to TalkJS. The user can immediately see their file present in
564
- * the chat, which makes for a smoother user experience.
565
- *
566
- * The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
567
- * such, this property will be `undefined` until the upload is completed,
568
- * while `block.url` will always be defined and should be used for preview
569
- * purposes.
570
- */
571
- downloadUrl?: string;
572
- }
573
-
574
- /**
575
- * Displays the given number of seconds in a human-friendly MM:SS or HH:MM:SS
576
- * format; whichever's shorter.
577
- *
578
- * @public
579
- */
580
- export declare function formatDuration(seconds: number): string;
581
-
582
- /**
583
- * Returns a human-readable filesize count.
584
- *
585
- * @public
586
- */
587
- export declare function formatFilesize(bytes: number): string;
588
-
589
- export { GenericFileBlock }
590
-
591
- /**
592
- * Given a coordinate, returns an `imageUrl` used to display a Google Maps
593
- * preview image and a `linkUrl` which points to the given location on Google
594
- * Maps.
595
- *
596
- * @public
597
- */
598
- export declare function getGoogleMapsUrls({ latitude, longitude }: Coordinates): {
599
- imageUrl: string;
600
- linkUrl: string;
601
- };
602
-
603
- /**
604
- * Returns the given user's `photoUrl` if available. If not, returns a `data:`
605
- * URL of a fallback SVG which shows the user's initials.
606
- *
607
- * @public
608
- */
609
- export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
610
-
611
- /**
612
- * Generates a random color in hex format.
613
- *
614
- * @public
615
- */
616
- export declare function getRandomColor(id: string): string;
617
-
618
- /**
619
- * @public
620
- */
621
- export declare interface GroupChatImageProps {
622
- /**
623
- * A collection of objects which are passed to all Chatbox/ConversationList
624
- * theme components.
625
- *
626
- * @remarks
627
- * Because this particular theme component can show up in both a `<Chatbox>`
628
- * and a `<ConversationList>`, this prop has a union type.
629
- */
630
- common: CommonChatboxProps | CommonConversationListProps;
631
- /**
632
- * A list of participants that are a part of the conversation.
633
- */
634
- participants: ParticipantSnapshot[];
635
- }
636
-
637
- /**
638
- * Parses a JSX-like React string into a React element tree.
639
- *
640
- * @remarks
641
- * Uses the {@link https://github.com/developit/htm | `htm`} library under the
642
- * hood.
643
- *
644
- * @public
645
- *
646
- * @privateRemarks
647
- * Adapted from:
648
- * https://github.com/developit/htm/issues/175#issuecomment-773755560
649
- */
650
- export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
651
-
652
- /**
653
- * @public
654
- */
655
- export declare interface IconProps {
656
- /**
657
- * A collection of objects which are passed to all Chatbox/ConversationList
658
- * theme components.
659
- *
660
- * @remarks
661
- * Because this particular theme component can show up in both a `<Chatbox>`
662
- * and a `<ConversationList>`, this prop has a union type.
663
- */
664
- common: CommonChatboxProps | CommonConversationListProps;
665
- /**
666
- * The name of the icon to display.
667
- */
668
- type: "attach" | "chevronLeft" | "left" | "chevronRight" | "right" | "chevronUp" | "up" | "chevronDown" | "down" | "close" | "emoji" | "locationPin" | "more" | "plus" | "search" | "send" | "spinner" | "play" | "pause" | "updown" | "addEmoji" | "microphone" | "mic" | "stop" | "download" | "location" | "email" | "movie" | "image" | "attachment" | "horizontalDots" | "verticalDots" | "reply" | "back";
669
- /**
670
- * @hidden
671
- */
672
- className?: string;
673
- }
674
-
675
- export { ImageBlock }
676
-
677
- /**
678
- * @public
679
- */
680
- export declare interface ImageBlockProps {
681
- /**
682
- * A collection of objects which are passed to all Chatbox theme components.
683
- */
684
- common: CommonChatboxProps;
685
- /**
686
- * The message that this content block belongs to.
687
- */
688
- message: MessageSnapshot;
689
- /**
690
- * The image block to display.
691
- */
692
- block: ImageBlock;
693
- /**
694
- * The URL used to download the file.
695
- *
696
- * @remarks
697
- * This URL is not the same as `block.url`. When the current user sends a file
698
- * message, the `block.url` will hold a temporary `blob:` URL until that file
699
- * is uploaded to TalkJS. The user can immediately see their file present in
700
- * the chat, which makes for a smoother user experience.
701
- *
702
- * The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
703
- * such, this property will be `undefined` until the upload is completed,
704
- * while `block.url` will always be defined and should be used for preview
705
- * purposes.
706
- */
707
- downloadUrl?: string;
708
- }
709
-
710
- export { LocationBlock }
711
-
712
- /**
713
- * @public
714
- */
715
- export declare interface LocationBlockProps {
716
- /**
717
- * A collection of objects which are passed to all Chatbox theme components.
718
- */
719
- common: CommonChatboxProps;
720
- /**
721
- * The message that this content block belongs to.
722
- */
723
- message: MessageSnapshot;
724
- /**
725
- * The location block to display.
726
- */
727
- block: LocationBlock;
728
- }
729
-
730
- export declare function MentionSuggestList(props: MentionSuggestListProps): JSX.Element | null;
731
-
732
- export declare interface MentionSuggestList {
733
- keydown(key: string): boolean;
734
- }
735
-
736
- /**
737
- * @public
738
- */
739
- export declare interface MentionSuggestListProps {
740
- }
741
-
742
- export declare function MenuItem(props: MenuItemProps): JSX.Element;
743
-
744
- /**
745
- * @public
746
- */
747
- export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
748
- /**
749
- * When a callback is passed, it will be called when the menu item is selected.
750
- */
751
- onSelect?: () => void;
752
- }
753
-
754
- /**
755
- * @public
756
- */
757
- export declare interface MessageActionMenuProps {
758
- /**
759
- * A collection of objects which are passed to all Chatbox theme components.
760
- */
761
- common: CommonChatboxProps;
762
- /**
763
- * The message that's attached to the action menu.
764
- */
765
- message: MessageSnapshot;
766
- /**
767
- * The current user's permissions relating to the given message.
768
- */
769
- permissions: MessagePermissions;
770
- }
771
-
772
- export declare function MessageContent(props: MessageContentProps): JSX.Element;
773
-
774
- /**
775
- * @public
776
- */
777
- export declare interface MessageContentProps {
778
- /**
779
- * A collection of objects which are passed to all Chatbox theme components.
780
- */
781
- common: CommonChatboxProps;
782
- /**
783
- * The message whose contents are being displayed
784
- */
785
- message: MessageSnapshot;
786
- /**
787
- * The current status of the given message.
788
- */
789
- messageStatus: MessageStatus;
790
- /**
791
- * @hidden
792
- */
793
- className?: string;
794
- }
795
-
796
- /**
797
- * @public
798
- */
799
- export declare interface MessageDividerProps {
800
- /**
801
- * A collection of objects which are passed to all Chatbox theme components.
802
- */
803
- common: CommonChatboxProps;
804
- /**
805
- * If true, this divider separates unread messages from read ones.
806
- */
807
- isReadMarker: boolean;
808
- /**
809
- * If true, this divider separates messages sent on two different dates.
810
- */
811
- isDayMarker: boolean;
812
- /**
813
- * The date timestamp when {@link MessageDividerProps.isDayMarker} is `true`. Holds the number of
814
- * milliseconds passed since the Unix Epoch.
815
- */
816
- timestamp?: number;
817
- }
818
-
819
- /**
820
- * @public
821
- */
822
- export declare interface MessageFieldProps {
823
- /**
824
- * A collection of objects which are passed to all Chatbox theme components.
825
- */
826
- common: CommonChatboxProps;
827
- /**
828
- * The message that's currently being replied to, if any.
829
- */
830
- referencedMessage: MessageSnapshot | undefined;
831
- /**
832
- * The current user's permissions.
833
- */
834
- permissions: UserPermissions;
835
- /**
836
- * An object holding the state of the message field.
837
- */
838
- editor: EditorController;
839
- /**
840
- * When a message is being edited its ID will be stored here.
841
- */
842
- editMessageId: string | undefined;
843
- }
844
-
845
- /**
846
- * @public
847
- */
848
- export declare interface MessageListFooterProps {
849
- /**
850
- * A collection of objects which are passed to all Chatbox theme components.
851
- */
852
- common: CommonChatboxProps;
853
- }
854
-
855
- /**
856
- * A set of permissions the current user has for a given message.
857
- *
858
- * @remarks
859
- * The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
860
- *
861
- * @public
862
- */
863
- export declare interface MessagePermissions extends UserPermissions {
864
- /**
865
- * True if the user has the ability to delete the given message.
866
- */
867
- canDeleteMessage: boolean;
868
- /**
869
- * True if the user has the ability to reply to the given message.
870
- */
871
- canReplyToMessage: boolean;
872
- /**
873
- * True if the user has the ability to edit the given message.
874
- */
875
- canEditMessage: boolean;
876
- /**
877
- * True if the user has the ability to add an {@link https://talkjs.com/docs/Features/Messages/Emojis/#emoji-reactions | emoji reaction} to the given message.
878
- */
879
- canAddReaction: boolean;
880
- }
881
-
882
- /**
883
- * @public
884
- */
885
- export declare interface MessageProps {
886
- /**
887
- * A collection of objects which are passed to all Chatbox theme components.
888
- */
889
- common: CommonChatboxProps;
890
- /**
891
- * The message that's being displayed.
892
- */
893
- message: MessageSnapshot;
894
- /**
895
- * The current status of the message.
896
- */
897
- messageStatus: MessageStatus;
898
- /**
899
- * The current user's permissions relating to the given message.
900
- */
901
- permissions: MessagePermissions;
902
- }
903
-
904
- export { MessageSnapshot }
905
-
906
- /**
907
- * The current status of the message.
908
- *
909
- * @remarks
910
- * This type can have one of these values:
911
- *
912
- * - `"sending"` - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.
913
- *
914
- * - `"sent"` - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.
915
- *
916
- * - `"everyoneRead"` - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.
917
- *
918
- * @public
919
- */
920
- export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
921
-
922
- export { ParticipantSnapshot }
923
-
924
- /**
925
- * PopoverButton component that renders a popover triggered by a button.
926
- *
927
- * Usage:
928
- * <PopoverButton
929
- * popoverComponent={YourMenuComponent}
930
- * popoverProps={{ prop1: value1, prop2: value2 }}
931
- * aria-label="..."
932
- * >
933
- * <Icon type="horizontalDots" />
934
- * </MenuButton>
935
- *
936
- * All props except for menuComponent and popoverProps are passed to the button element.
937
- *
938
- * the popoverComponent will also receive a closePopover prop. It's a function you can call to close the popover.
939
- */
940
- export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
941
-
942
- /**
943
- * @public
944
- */
945
- export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
946
- /**
947
- * Whether to display a menu or a popover when the button is clicked.
948
- *
949
- * @remarks
950
- * Default value is `"popover"`.
951
- */
952
- type?: "menu" | "popover";
953
- /**
954
- * The popover component to render in response to the button click.
955
- */
956
- popoverComponent: React.ComponentType<T>;
957
- /**
958
- * Props passed to the popover component.
959
- */
960
- popoverProps: T;
961
- /**
962
- * Children nodes rendered inside the button.
963
- */
964
- children: React.ReactNode;
965
- }
966
-
967
- export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
968
-
969
- /**
970
- * @public
971
- */
972
- export declare interface ReactionPickerProps {
973
- /**
974
- * The ID of the message that's being reacted to.
975
- */
976
- messageId: string;
977
- /**
978
- * Display the emoji reaction picker in light mode or dark mode.
979
- */
980
- colorScheme: "light" | "dark";
981
- }
982
-
983
- /**
984
- * @public
985
- */
986
- export declare interface ReferencedMessageProps {
987
- /**
988
- * A collection of objects which are passed to all Chatbox theme components.
989
- */
990
- common: CommonChatboxProps;
991
- /**
992
- * The message that's being referenced.
993
- */
994
- referencedMessage: ReferencedMessageSnapshot;
995
- }
996
-
997
- export { ReferencedMessageSnapshot }
998
-
999
- /**
1000
- * @public
1001
- */
1002
- export declare interface ReplyBarProps {
1003
- /**
1004
- * A collection of objects which are passed to all Chatbox theme components.
1005
- */
1006
- common: CommonChatboxProps;
1007
- /**
1008
- * The message that's being replied to.
1009
- */
1010
- referencedMessage: MessageSnapshot;
1011
- }
1012
-
1013
- export { TalkSession }
1014
-
1015
- declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
1016
- export { Text_2 as Text }
1017
-
1018
- export { TextBlock }
1019
-
1020
- /**
1021
- * @public
1022
- */
1023
- export declare interface TextBlockProps {
1024
- /**
1025
- * A collection of objects which are passed to all Chatbox theme components.
1026
- */
1027
- common: CommonChatboxProps;
1028
- /**
1029
- * The message that this content block belongs to.
1030
- */
1031
- message: MessageSnapshot;
1032
- /**
1033
- * The text block to display.
1034
- */
1035
- block: TextBlock;
1036
- }
1037
-
1038
- /**
1039
- * @public
1040
- */
1041
- export declare interface TextProps {
1042
- /**
1043
- * The block of formatted text to display.
1044
- */
1045
- block: TextBlock;
1046
- /**
1047
- * If true, links and action buttons/links won't be rendered.
1048
- *
1049
- * @remarks
1050
- * The default is `false`
1051
- */
1052
- nonInteractive?: boolean;
1053
- /**
1054
- * @hidden
1055
- */
1056
- className?: string;
1057
- /**
1058
- * The message that this text block belongs to.
1059
- */
1060
- message: MessageSnapshot | ReferencedMessageSnapshot;
1061
- }
1062
-
1063
- /**
1064
- * A theme can be used to customize the appearance & behavior of your TalkJS
1065
- * Chatbox and/or ConversationList.
1066
- *
1067
- * @remarks
1068
- * The implementation of TalkJS's default theme is open-source and
1069
- * {@link https://github.com/talkjs/theme-default | available on Github. }
1070
- *
1071
- * @public
1072
- */
1073
- export declare interface Theme {
1074
- Avatar: React.ComponentType<AvatarProps>;
1075
- ConversationImage: React.ComponentType<ConversationImageProps>;
1076
- GroupChatImage: React.ComponentType<GroupChatImageProps>;
1077
- ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
1078
- ReplyBar: React.ComponentType<ReplyBarProps>;
1079
- TimeAgo: React.ComponentType<TimeAgoProps>;
1080
- MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
1081
- CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
1082
- ChatHeader: React.ComponentType<ChatHeaderProps>;
1083
- Message: React.ComponentType<MessageProps>;
1084
- MessageField: React.ComponentType<MessageFieldProps>;
1085
- Icon: React.ComponentType<IconProps>;
1086
- MessageDivider: React.ComponentType<MessageDividerProps>;
1087
- MessageListFooter: React.ComponentType<MessageListFooterProps>;
1088
- TextBlock: React.ComponentType<TextBlockProps>;
1089
- FileBlock: React.ComponentType<FileBlockProps>;
1090
- LocationBlock: React.ComponentType<LocationBlockProps>;
1091
- ImageBlock: React.ComponentType<ImageBlockProps>;
1092
- AudioBlock: React.ComponentType<AudioBlockProps>;
1093
- VoiceBlock: React.ComponentType<VoiceBlockProps>;
1094
- VideoBlock: React.ComponentType<VideoBlockProps>;
1095
- ConversationListItem: React.ComponentType<ConversationListItemProps>;
1096
- }
1097
-
1098
- /**
1099
- * An object describing a human-readable tim
1100
- *
1101
- * @public
1102
- */
1103
- export declare interface TimeAgo {
1104
- /**
1105
- * An amount of milliseconds after which the values in {@link TimeAgo.long} and {@link TimeAgo.short} _may_ have changed.
1106
- * If undefined, the values will not change within any meaningful period.
1107
- */
1108
- changeTimeout?: number | undefined;
1109
- /**
1110
- * A precise time description containing the exact date and time.
1111
- */
1112
- long: string;
1113
- /**
1114
- * A short human-friendly time description, such as "2 minutes ago"
1115
- */
1116
- short: string;
1117
- }
1118
-
1119
- /**
1120
- * @public
1121
- */
1122
- export declare interface TimeAgoProps {
1123
- /**
1124
- * A collection of objects which are passed to all Chatbox theme components.
1125
- */
1126
- common: CommonChatboxProps;
1127
- /**
1128
- * The timestamp of when the message was sent. Holds the number of milliseconds passed since the Unix Epoch.
1129
- */
1130
- timestamp: number;
1131
- }
1132
-
1133
- /**
1134
- * Translation object
1135
- *
1136
- * @public
1137
- */
1138
- export declare interface Translation extends TranslationStrings {
1139
- locale: string;
1140
- }
1141
-
1142
- declare interface TranslationStrings {
1143
- YESTERDAY: string;
1144
- TODAY: string;
1145
- DAYS: string;
1146
- HOURS: string;
1147
- MINUTES: string;
1148
- JUST_NOW: string;
1149
- LOCATION: string;
1150
- CANCEL: string;
1151
- INBOX: string;
1152
- DESKTOP_NOTIFICATIONS: string;
1153
- DESKTOP_NOTIFICATIONS_ERROR: string;
1154
- DESKTOP_NOTIFICATIONS_DEMO_TITLE: (appName: string) => string;
1155
- DESKTOP_NOTIFICATIONS_DEMO_BODY: string;
1156
- SEND_BUTTON_TEXT: string;
1157
- ENTRYBOX_TEXT_LIMIT: string;
1158
- ENTRYBOX_PLACEHOLDER: string;
1159
- ENTRYBOX_PLACEHOLDER_CHAT_CLOSED: string;
1160
- ENTRYBOX_PLACEHOLDER_CHAT_READONLY: string;
1161
- MESSAGELIST_LOADING_OLDER: string;
1162
- MESSAGELIST_SHOW_OLDER: string;
1163
- MESSAGELIST_NEW_MARKER: string;
1164
- MESSAGE_SENT_VIA_EMAIL: string;
1165
- YOU_MARKER: string;
1166
- UPLOAD_IN_PROGRESS: string;
1167
- UPLOAD_SEND_FILE: string;
1168
- UPLOAD_SHARE_LOCATION: string;
1169
- UPLOAD_ERROR: string;
1170
- SHARE_LOCATION_ERROR: string;
1171
- LOADING: string;
1172
- HUB_EMPTY: string;
1173
- HUB_SHOW_EARLIER: string;
1174
- INBOX_NO_CHATS_TITLE: string;
1175
- INBOX_NO_CHATS_BODY: string;
1176
- ENABLE_TRANSLATION: string;
1177
- DISABLE_TRANSLATION: string;
1178
- SEARCH_PLACEHOLDER_TEXT: string;
1179
- SEARCH_SEARCHING: string;
1180
- SEARCH_NO_RESULTS: string;
1181
- SEARCH_NO_MORE_RESULTS: string;
1182
- CHAT_NOT_FOUND: string;
1183
- DELETE_MESSAGE: string;
1184
- DELETION_EXPLANATION: string;
1185
- EDIT_MESSAGE: string;
1186
- SAVE: string;
1187
- EDITED_INDICATOR: string;
1188
- REPLY_TO_MESSAGE: string;
1189
- REPLY_TO_ARIA_LABEL: (senderName: string, content: string) => string;
1190
- REPLY_MODE_LEAVE_ARIA_LABEL: string;
1191
- ADD_REACTION: string;
1192
- AUTH_EXPIRED_OVERLAY_TITLE: string;
1193
- AUTH_EXPIRED_OVERLAY_DESCRIPTION: string;
1194
- VOICE_MESSAGE: string;
1195
- LEAVE_CONVERSATION: string;
1196
- MARK_CONVERSATION_AS_UNREAD: string;
1197
- STATUS_INDICATOR_ONLINE: string;
1198
- STATUS_INDICATOR_OFFLINE: string;
1199
- CONTACT_INFORMATION_HIDDEN: string;
1200
- }
1201
-
1202
- export { TypingSnapshot }
1203
-
1204
- /**
1205
- * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1206
- * 2014", depending on which is most appropriate.
1207
- *
1208
- * @param timestamp The timestamp of the event in milliseconds since Unix epoch.
1209
- * @param t Relevant translation object to get localized output
1210
- *
1211
- * @public
1212
- */
1213
- export declare function userFriendlyDate(timestamp: number, t: Translation): string;
1214
-
1215
- /**
1216
- * A set of permissions for the current user.
1217
- *
1218
- * @remarks
1219
- * The values of these permissions come from the user's {@link https://talkjs.com/docs/Concepts/Roles/ | role}.
1220
- *
1221
- * @public
1222
- */
1223
- export declare interface UserPermissions {
1224
- /**
1225
- * True if typing indicators are enabled.
1226
- */
1227
- showTypingIndicator: boolean;
1228
- /**
1229
- * True if {@link https://talkjs.com/docs/Features/Messages/File_Sharing/ | file sharing} is enabled.
1230
- */
1231
- canShareFile: boolean;
1232
- /**
1233
- * True if location sharing is enabled.
1234
- */
1235
- canShareLocation: boolean;
1236
- /**
1237
- * True if {@link https://talkjs.com/docs/Features/Messages/Mentions/ | mentions} are enabled.
1238
- */
1239
- canMention: boolean;
1240
- /**
1241
- * True if
1242
- * {@link https://talkjs.com/docs/Features/Conversations/Status_Indicator/ | online status indicators }
1243
- * are enabled.
1244
- */
1245
- showOnlineStatus: boolean;
1246
- /**
1247
- * True if {@link https://talkjs.com/docs/Features/Messages/Voice_Messages/ | voice messages} are enabled.
1248
- */
1249
- canSendVoiceMessage: boolean;
1250
- /**
1251
- * True if the user has the permission to leave a given conversation.
1252
- */
1253
- canLeaveConversation: boolean;
1254
- /**
1255
- * True if the user has the permission to mark the given conversation as unread.
1256
- */
1257
- canMarkConversationAsUnread: boolean;
1258
- }
1259
-
1260
- export { UserSnapshot }
1261
-
1262
- /**
1263
- *
1264
- * This hooks triggers only when a human-readable timestamp needs to be updated.
1265
- * For example, you could use it to display that a messages was updated X
1266
- * minutes or Y hours ago.
1267
- *
1268
- * @public
1269
- */
1270
- export declare function useTimeAgo(timestamp: number, t: Translation): TimeAgo;
1271
-
1272
- export { VideoBlock }
1273
-
1274
- /**
1275
- * @public
1276
- */
1277
- export declare interface VideoBlockProps {
1278
- /**
1279
- * A collection of objects which are passed to all Chatbox theme components.
1280
- */
1281
- common: CommonChatboxProps;
1282
- /**
1283
- * The message that this content block belongs to.
1284
- */
1285
- message: MessageSnapshot;
1286
- /**
1287
- * The video block to display.
1288
- */
1289
- block: VideoBlock;
1290
- /**
1291
- * The URL used to download the file.
1292
- *
1293
- * @remarks
1294
- * This URL is not the same as `block.url`. When the current user sends a file
1295
- * message, the `block.url` will hold a temporary `blob:` URL until that file
1296
- * is uploaded to TalkJS. The user can immediately see their file present in
1297
- * the chat, which makes for a smoother user experience.
1298
- *
1299
- * The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
1300
- * such, this property will be `undefined` until the upload is completed,
1301
- * while `block.url` will always be defined and should be used for preview
1302
- * purposes.
1303
- */
1304
- downloadUrl?: string;
1305
- }
1306
-
1307
- export { VoiceBlock }
1308
-
1309
- /**
1310
- * @public
1311
- */
1312
- export declare interface VoiceBlockProps {
1313
- /**
1314
- * A collection of objects which are passed to all Chatbox theme components.
1315
- */
1316
- common: CommonChatboxProps;
1317
- /**
1318
- * The message that this content block belongs to.
1319
- */
1320
- message: MessageSnapshot;
1321
- /**
1322
- * The voice block to display.
1323
- */
1324
- block: VoiceBlock;
1325
- /**
1326
- * The URL used to download the file.
1327
- *
1328
- * @remarks
1329
- * This URL is not the same as `block.url`. When the current user sends a file
1330
- * message, the `block.url` will hold a temporary `blob:` URL until that file
1331
- * is uploaded to TalkJS. The user can immediately see their file present in
1332
- * the chat, which makes for a smoother user experience.
1333
- *
1334
- * The `downloadUrl` is the URL of the file once it is uploaded to TalkJS. As
1335
- * such, this property will be `undefined` until the upload is completed,
1336
- * while `block.url` will always be defined and should be used for preview
1337
- * purposes.
1338
- */
1339
- downloadUrl?: string;
1340
- }
1341
-
1342
- export { }
1343
-
1344
-
1345
- declare global {
1346
- interface HTMLElementTagNameMap {
1347
- "t-chatbox": ChatboxElement;
1348
- "t-conversation-list": ConversationListElement;
1349
- }
1350
- }
1351
-