@talkjs/core 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +24 -223
- package/dist/talkSession.js +79 -64
- package/package.json +3 -2
package/dist/talkSession.d.ts
CHANGED
|
@@ -9,17 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare interface ActionButtonNode {
|
|
11
11
|
type: "actionButton";
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* The name of the custom action to invoke when the button is clicked.
|
|
15
14
|
*/
|
|
16
15
|
action: string;
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* The parameters to pass to the custom action when the button is clicked.
|
|
20
18
|
*/
|
|
21
19
|
params: Record<string, string>;
|
|
22
|
-
|
|
23
20
|
children: TextNode[];
|
|
24
21
|
}
|
|
25
22
|
|
|
@@ -34,17 +31,14 @@ export declare interface ActionButtonNode {
|
|
|
34
31
|
*/
|
|
35
32
|
export declare interface ActionLinkNode {
|
|
36
33
|
type: "actionLink";
|
|
37
|
-
|
|
38
34
|
/**
|
|
39
35
|
* The name of the custom action to invoke when the link is clicked.
|
|
40
36
|
*/
|
|
41
37
|
action: string;
|
|
42
|
-
|
|
43
38
|
/**
|
|
44
39
|
* The parameters to pass to the custom action when the link is clicked.
|
|
45
40
|
*/
|
|
46
41
|
params: Record<string, string>;
|
|
47
|
-
|
|
48
42
|
children: TextNode[];
|
|
49
43
|
}
|
|
50
44
|
|
|
@@ -67,29 +61,23 @@ export declare interface ActionLinkNode {
|
|
|
67
61
|
*/
|
|
68
62
|
export declare interface AudioBlock {
|
|
69
63
|
type: "file";
|
|
70
|
-
|
|
71
64
|
subtype: "audio";
|
|
72
|
-
|
|
73
65
|
/**
|
|
74
66
|
* An encoded identifier for this file. Use in {@link SendFileBlock} to send this file in another message.
|
|
75
67
|
*/
|
|
76
68
|
fileToken: FileToken;
|
|
77
|
-
|
|
78
69
|
/**
|
|
79
70
|
* The URL where you can fetch the file
|
|
80
71
|
*/
|
|
81
72
|
url: string;
|
|
82
|
-
|
|
83
73
|
/**
|
|
84
74
|
* The size of the file in bytes
|
|
85
75
|
*/
|
|
86
76
|
size: number;
|
|
87
|
-
|
|
88
77
|
/**
|
|
89
78
|
* The name of the audio file, including file extension
|
|
90
79
|
*/
|
|
91
80
|
filename: string;
|
|
92
|
-
|
|
93
81
|
/**
|
|
94
82
|
* The duration of the audio in seconds, if known
|
|
95
83
|
*/
|
|
@@ -143,12 +131,10 @@ declare interface AudioFileMetadata {
|
|
|
143
131
|
*/
|
|
144
132
|
export declare interface AutoLinkNode {
|
|
145
133
|
type: "autoLink";
|
|
146
|
-
|
|
147
134
|
/**
|
|
148
135
|
* The URL to open when a user clicks this node.
|
|
149
136
|
*/
|
|
150
137
|
url: string;
|
|
151
|
-
|
|
152
138
|
/**
|
|
153
139
|
* The text to display in the link.
|
|
154
140
|
*/
|
|
@@ -222,7 +208,6 @@ export declare type ContentBlock = TextBlock | FileBlock | LocationBlock;
|
|
|
222
208
|
*/
|
|
223
209
|
export declare interface ConversationActiveState {
|
|
224
210
|
type: "active";
|
|
225
|
-
|
|
226
211
|
/**
|
|
227
212
|
* The most recently received snapshot for the conversation, or `null` if you are not a participant in the conversation (including when the conversation does not exist).
|
|
228
213
|
*/
|
|
@@ -246,21 +231,18 @@ export declare interface ConversationRef {
|
|
|
246
231
|
* Immutable: if you want to reference a different conversation, get a new ConversationRef instead.
|
|
247
232
|
*/
|
|
248
233
|
readonly id: string;
|
|
249
|
-
|
|
250
234
|
/**
|
|
251
235
|
* Get a reference to a participant in this conversation
|
|
252
236
|
*
|
|
253
237
|
* @param user - the user's ID or a reference to the user
|
|
254
238
|
*/
|
|
255
239
|
participant(user: string | UserRef): ParticipantRef;
|
|
256
|
-
|
|
257
240
|
/**
|
|
258
241
|
* Get a reference to a message in this conversation
|
|
259
242
|
*
|
|
260
243
|
* @param user - the message ID
|
|
261
244
|
*/
|
|
262
245
|
message(id: string): MessageRef;
|
|
263
|
-
|
|
264
246
|
/**
|
|
265
247
|
* Fetches a snapshot of the conversation.
|
|
266
248
|
*
|
|
@@ -270,7 +252,6 @@ export declare interface ConversationRef {
|
|
|
270
252
|
* @returns A snapshot of the current user's view of the conversation, or null if the current user is not a participant (including if the conversation doesn't exist).
|
|
271
253
|
*/
|
|
272
254
|
get(): Promise<ConversationSnapshot | null>;
|
|
273
|
-
|
|
274
255
|
/**
|
|
275
256
|
* Sets properties of this conversation and your participation in it.
|
|
276
257
|
*
|
|
@@ -283,7 +264,6 @@ export declare interface ConversationRef {
|
|
|
283
264
|
* Everything else requires client-side conversation syncing to be enabled, and will cause the promise to reject.
|
|
284
265
|
*/
|
|
285
266
|
set(params: SetConversationParams): Promise<void>;
|
|
286
|
-
|
|
287
267
|
/**
|
|
288
268
|
* Creates this conversation if it does not already exist.
|
|
289
269
|
* Adds you as a participant in this conversation, if you are not already a participant.
|
|
@@ -294,30 +274,24 @@ export declare interface ConversationRef {
|
|
|
294
274
|
* @returns A promise that resolves when the operation completes. The promise rejects if you are not already a participant and client-side conversation syncing is disabled.
|
|
295
275
|
*/
|
|
296
276
|
createIfNotExists(params?: CreateConversationParams): Promise<void>;
|
|
297
|
-
|
|
298
277
|
/**
|
|
299
278
|
* Marks the conversation as read.
|
|
300
279
|
*
|
|
301
280
|
* @returns A promise that resolves when the operation completes. The promise rejects if you are not a participant in the conversation.
|
|
302
281
|
*/
|
|
303
282
|
markAsRead(): Promise<void>;
|
|
304
|
-
|
|
305
283
|
/**
|
|
306
284
|
* Marks the conversation as unread.
|
|
307
285
|
*
|
|
308
286
|
* @returns A promise that resolves when the operation completes. The promise rejects if you are not a participant in the conversation.
|
|
309
287
|
*/
|
|
310
288
|
markAsUnread(): Promise<void>;
|
|
311
|
-
|
|
312
289
|
/**
|
|
313
290
|
* Sends a message in the conversation
|
|
314
291
|
*
|
|
315
292
|
* @returns A promise that resolves with a reference to the newly created message. The promise will reject if you do not have permission to send the message.
|
|
316
293
|
*/
|
|
317
|
-
send(
|
|
318
|
-
params: string | SendTextMessageParams | SendMessageParams,
|
|
319
|
-
): Promise<MessageRef>;
|
|
320
|
-
|
|
294
|
+
send(params: string | SendTextMessageParams | SendMessageParams): Promise<MessageRef>;
|
|
321
295
|
/**
|
|
322
296
|
* Subscribes to the messages in the conversation.
|
|
323
297
|
*
|
|
@@ -330,13 +304,7 @@ export declare interface ConversationRef {
|
|
|
330
304
|
*
|
|
331
305
|
* The snapshot is null if you are not a participant in the conversation (including when the conversation doesn't exist)
|
|
332
306
|
*/
|
|
333
|
-
subscribeMessages(
|
|
334
|
-
onSnapshot?: (
|
|
335
|
-
snapshot: MessageSnapshot[] | null,
|
|
336
|
-
loadedAll: boolean,
|
|
337
|
-
) => void,
|
|
338
|
-
): MessageSubscription;
|
|
339
|
-
|
|
307
|
+
subscribeMessages(onSnapshot?: (snapshot: MessageSnapshot[] | null, loadedAll: boolean) => void): MessageSubscription;
|
|
340
308
|
/**
|
|
341
309
|
* Subscribes to the conversation.
|
|
342
310
|
*
|
|
@@ -346,9 +314,7 @@ export declare interface ConversationRef {
|
|
|
346
314
|
*
|
|
347
315
|
* The snapshot is null if you are not a participant in the conversation (including when the conversation doesn't exist)
|
|
348
316
|
*/
|
|
349
|
-
subscribe(
|
|
350
|
-
onSnapshot?: (snapshot: ConversationSnapshot | null) => void,
|
|
351
|
-
): ConversationSubscription;
|
|
317
|
+
subscribe(onSnapshot?: (snapshot: ConversationSnapshot | null) => void): ConversationSubscription;
|
|
352
318
|
}
|
|
353
319
|
|
|
354
320
|
/**
|
|
@@ -366,50 +332,42 @@ export declare interface ConversationSnapshot {
|
|
|
366
332
|
* The ID of the conversation
|
|
367
333
|
*/
|
|
368
334
|
id: string;
|
|
369
|
-
|
|
370
335
|
/**
|
|
371
336
|
* Contains the conversation subject if it was set using {@link ConversationBuilder.subject}.
|
|
372
337
|
*/
|
|
373
338
|
subject: string | null;
|
|
374
|
-
|
|
375
339
|
/**
|
|
376
340
|
* Contains the URL of a photo was set using {@link ConversationBuilder.subject}.
|
|
377
341
|
*/
|
|
378
342
|
photoUrl: string | null;
|
|
379
|
-
|
|
380
343
|
/**
|
|
381
344
|
* One or more welcome messages that will display to the user as a SystemMessage
|
|
382
345
|
*/
|
|
383
346
|
welcomeMessages: string[];
|
|
384
|
-
|
|
385
347
|
/**
|
|
386
348
|
* Custom metadata you have set on the conversation
|
|
387
349
|
*/
|
|
388
350
|
custom: Record<string, string>;
|
|
389
|
-
|
|
390
351
|
/**
|
|
391
352
|
* The date that the conversation was created, as a unix timestamp in milliseconds.
|
|
392
353
|
*/
|
|
393
354
|
createdAt: number;
|
|
394
|
-
|
|
395
355
|
/**
|
|
396
356
|
* The date that the current user joined the conversation, as a unix timestamp in milliseconds.
|
|
397
357
|
*/
|
|
398
358
|
joinedAt: number;
|
|
399
|
-
|
|
400
359
|
/**
|
|
401
360
|
* The last message sent in this conversation, or null if no messages have been sent.
|
|
402
361
|
*/
|
|
403
362
|
lastMessage: MessageSnapshot | null;
|
|
404
|
-
|
|
405
363
|
/**
|
|
406
364
|
* The number of messages in this conversation that the current user hasn't read.
|
|
407
365
|
*/
|
|
408
366
|
unreadMessageCount: number;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Timestamp of when the current user read a message
|
|
369
|
+
*/
|
|
370
|
+
readUntil: number;
|
|
413
371
|
/**
|
|
414
372
|
* Whether the conversation should be considered unread.
|
|
415
373
|
*
|
|
@@ -417,12 +375,10 @@ export declare interface ConversationSnapshot {
|
|
|
417
375
|
* This can be true even when `unreadMessageCount` is zero, if the user has manually marked the conversation as unread.
|
|
418
376
|
*/
|
|
419
377
|
isUnread: boolean;
|
|
420
|
-
|
|
421
378
|
/**
|
|
422
379
|
* The current user's permission level in this conversation.
|
|
423
380
|
*/
|
|
424
381
|
access: "Read" | "ReadWrite";
|
|
425
|
-
|
|
426
382
|
/**
|
|
427
383
|
* The current user's notification settings for this conversation.
|
|
428
384
|
*
|
|
@@ -454,17 +410,11 @@ export declare interface ConversationSubscription {
|
|
|
454
410
|
*
|
|
455
411
|
* When `type` is "error", includes the `error` field. It is a JS `Error` object explaining what caused the subscription to be terminated.
|
|
456
412
|
*/
|
|
457
|
-
state:
|
|
458
|
-
| PendingState
|
|
459
|
-
| ConversationActiveState
|
|
460
|
-
| UnsubscribedState
|
|
461
|
-
| ErrorState;
|
|
462
|
-
|
|
413
|
+
state: PendingState | ConversationActiveState | UnsubscribedState | ErrorState;
|
|
463
414
|
/**
|
|
464
415
|
* Resolves when the subscription starts receiving updates from the server.
|
|
465
416
|
*/
|
|
466
417
|
connected: Promise<ConversationActiveState>;
|
|
467
|
-
|
|
468
418
|
/**
|
|
469
419
|
* Resolves when the subscription permanently stops receiving updates from the server.
|
|
470
420
|
*
|
|
@@ -472,7 +422,6 @@ export declare interface ConversationSubscription {
|
|
|
472
422
|
* This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
|
|
473
423
|
*/
|
|
474
424
|
terminated: Promise<UnsubscribedState | ErrorState>;
|
|
475
|
-
|
|
476
425
|
/**
|
|
477
426
|
* Unsubscribe from this resource and stop receiving updates.
|
|
478
427
|
*
|
|
@@ -495,32 +444,27 @@ export declare interface CreateConversationParams {
|
|
|
495
444
|
* Default = no subject, list participant names instead.
|
|
496
445
|
*/
|
|
497
446
|
subject?: string;
|
|
498
|
-
|
|
499
447
|
/**
|
|
500
448
|
* The URL for the conversation photo to display in the chat header.
|
|
501
449
|
* Default = no photo, show a placeholder image.
|
|
502
450
|
*/
|
|
503
451
|
photoUrl?: string;
|
|
504
|
-
|
|
505
452
|
/**
|
|
506
453
|
* System messages which are sent at the beginning of a conversation.
|
|
507
454
|
* Default = no messages.
|
|
508
455
|
*/
|
|
509
456
|
welcomeMessages?: string[];
|
|
510
|
-
|
|
511
457
|
/**
|
|
512
458
|
* Custom metadata you have set on the conversation.
|
|
513
459
|
* This value acts as a patch. Remove specific properties by setting them to `null`.
|
|
514
460
|
* Default = no custom metadata
|
|
515
461
|
*/
|
|
516
462
|
custom?: Record<string, string>;
|
|
517
|
-
|
|
518
463
|
/**
|
|
519
464
|
* Your access to the conversation.
|
|
520
465
|
* Default = "ReadWrite" access.
|
|
521
466
|
*/
|
|
522
467
|
access?: "Read" | "ReadWrite";
|
|
523
|
-
|
|
524
468
|
/**
|
|
525
469
|
* Your notification settings.
|
|
526
470
|
* Default = `true`
|
|
@@ -542,7 +486,6 @@ export declare interface CreateParticipantParams {
|
|
|
542
486
|
* Default = "ReadWrite" access.
|
|
543
487
|
*/
|
|
544
488
|
access?: "ReadWrite" | "Read";
|
|
545
|
-
|
|
546
489
|
/**
|
|
547
490
|
* When the participant should be notified about new messages in this conversation.
|
|
548
491
|
* Default = `true`
|
|
@@ -566,51 +509,43 @@ export declare interface CreateUserParams {
|
|
|
566
509
|
* The user's name which is displayed on the TalkJS UI
|
|
567
510
|
*/
|
|
568
511
|
name: string;
|
|
569
|
-
|
|
570
512
|
/**
|
|
571
513
|
* Custom metadata you have set on the user.
|
|
572
514
|
* Default = no custom metadata
|
|
573
515
|
*/
|
|
574
516
|
custom?: Record<string, string>;
|
|
575
|
-
|
|
576
517
|
/**
|
|
577
518
|
* An {@link https://www.w3.org/International/articles/language-tags/ | IETF language tag}.
|
|
578
519
|
* See the {@link https://talkjs.com/docs/Features/Language_Support/Localization.html | localization documentation}
|
|
579
520
|
* Default = the locale selected on the dashboard
|
|
580
521
|
*/
|
|
581
522
|
locale?: string;
|
|
582
|
-
|
|
583
523
|
/**
|
|
584
524
|
* An optional URL to a photo that is displayed as the user's avatar.
|
|
585
525
|
* Default = no photo
|
|
586
526
|
*/
|
|
587
527
|
photoUrl?: string;
|
|
588
|
-
|
|
589
528
|
/**
|
|
590
529
|
* TalkJS supports multiple sets of settings, called "roles". These allow you to change the behavior of TalkJS for different users.
|
|
591
530
|
* You have full control over which user gets which configuration.
|
|
592
531
|
* Default = the `default` role
|
|
593
532
|
*/
|
|
594
533
|
role?: string;
|
|
595
|
-
|
|
596
534
|
/**
|
|
597
535
|
* The default message a person sees when starting a chat with this user.
|
|
598
536
|
* Default = no welcome message
|
|
599
537
|
*/
|
|
600
538
|
welcomeMessage?: string;
|
|
601
|
-
|
|
602
539
|
/**
|
|
603
|
-
*
|
|
540
|
+
* A single email address or an array of email addresses associated with the user.
|
|
604
541
|
* Default = no email addresses
|
|
605
542
|
*/
|
|
606
|
-
email?: string[];
|
|
607
|
-
|
|
543
|
+
email?: string | string[];
|
|
608
544
|
/**
|
|
609
|
-
*
|
|
545
|
+
* A single phone number or an array of phone numbers associated with the user.
|
|
610
546
|
* Default = no phone numbers
|
|
611
547
|
*/
|
|
612
|
-
phone?: string[];
|
|
613
|
-
|
|
548
|
+
phone?: string | string[];
|
|
614
549
|
/**
|
|
615
550
|
* An object of push registration tokens to use when notifying this user.
|
|
616
551
|
*
|
|
@@ -630,7 +565,6 @@ export declare interface CreateUserParams {
|
|
|
630
565
|
*/
|
|
631
566
|
export declare interface CustomEmojiNode {
|
|
632
567
|
type: "customEmoji";
|
|
633
|
-
|
|
634
568
|
/**
|
|
635
569
|
* The name of the custom emoji to show.
|
|
636
570
|
*/
|
|
@@ -656,7 +590,6 @@ export declare interface EditMessageParams {
|
|
|
656
590
|
* Default = no custom metadata
|
|
657
591
|
*/
|
|
658
592
|
custom?: Record<string, string | null> | null;
|
|
659
|
-
|
|
660
593
|
/**
|
|
661
594
|
* The new content for the message.
|
|
662
595
|
*
|
|
@@ -686,7 +619,6 @@ export declare interface EditTextMessageParams {
|
|
|
686
619
|
* Default = no custom metadata
|
|
687
620
|
*/
|
|
688
621
|
custom?: Record<string, string | null> | null;
|
|
689
|
-
|
|
690
622
|
/**
|
|
691
623
|
* The new text to set in the message body.
|
|
692
624
|
*
|
|
@@ -705,7 +637,6 @@ export declare interface EditTextMessageParams {
|
|
|
705
637
|
*/
|
|
706
638
|
export declare interface ErrorState {
|
|
707
639
|
type: "error";
|
|
708
|
-
|
|
709
640
|
/**
|
|
710
641
|
* The error that caused the subscription to be terminated
|
|
711
642
|
*/
|
|
@@ -733,12 +664,7 @@ export declare interface ErrorState {
|
|
|
733
664
|
*
|
|
734
665
|
* @public
|
|
735
666
|
*/
|
|
736
|
-
export declare type FileBlock =
|
|
737
|
-
| VideoBlock
|
|
738
|
-
| ImageBlock
|
|
739
|
-
| AudioBlock
|
|
740
|
-
| VoiceBlock
|
|
741
|
-
| GenericFileBlock;
|
|
667
|
+
export declare type FileBlock = VideoBlock | ImageBlock | AudioBlock | VoiceBlock | GenericFileBlock;
|
|
742
668
|
|
|
743
669
|
/**
|
|
744
670
|
* A token representing a file uploaded to TalkJS.
|
|
@@ -807,27 +733,22 @@ export declare type FileToken = string & {
|
|
|
807
733
|
*/
|
|
808
734
|
export declare interface GenericFileBlock {
|
|
809
735
|
type: "file";
|
|
810
|
-
|
|
811
736
|
/**
|
|
812
737
|
* Never set for generic file blocks.
|
|
813
738
|
*/
|
|
814
739
|
subtype?: undefined;
|
|
815
|
-
|
|
816
740
|
/**
|
|
817
741
|
* An encoded identifier for this file. Use in {@link SendFileBlock} to send this file in another message.
|
|
818
742
|
*/
|
|
819
743
|
fileToken: FileToken;
|
|
820
|
-
|
|
821
744
|
/**
|
|
822
745
|
* The URL where you can fetch the file
|
|
823
746
|
*/
|
|
824
747
|
url: string;
|
|
825
|
-
|
|
826
748
|
/**
|
|
827
749
|
* The size of the file in bytes
|
|
828
750
|
*/
|
|
829
751
|
size: number;
|
|
830
|
-
|
|
831
752
|
/**
|
|
832
753
|
* The name of the file, including file extension
|
|
833
754
|
*/
|
|
@@ -868,34 +789,27 @@ export declare function getTalkSession(options: TalkSessionOptions): TalkSession
|
|
|
868
789
|
*/
|
|
869
790
|
export declare interface ImageBlock {
|
|
870
791
|
type: "file";
|
|
871
|
-
|
|
872
792
|
subtype: "image";
|
|
873
|
-
|
|
874
793
|
/**
|
|
875
794
|
* An encoded identifier for this file. Use in {@link SendFileBlock} to send this image in another message.
|
|
876
795
|
*/
|
|
877
796
|
fileToken: FileToken;
|
|
878
|
-
|
|
879
797
|
/**
|
|
880
798
|
* The URL where you can fetch the file.
|
|
881
799
|
*/
|
|
882
800
|
url: string;
|
|
883
|
-
|
|
884
801
|
/**
|
|
885
802
|
* The size of the file in bytes.
|
|
886
803
|
*/
|
|
887
804
|
size: number;
|
|
888
|
-
|
|
889
805
|
/**
|
|
890
806
|
* The name of the image file, including file extension.
|
|
891
807
|
*/
|
|
892
808
|
filename: string;
|
|
893
|
-
|
|
894
809
|
/**
|
|
895
810
|
* The width of the image in pixels, if known.
|
|
896
811
|
*/
|
|
897
812
|
width?: number;
|
|
898
|
-
|
|
899
813
|
/**
|
|
900
814
|
* The height of the image in pixels, if known.
|
|
901
815
|
*/
|
|
@@ -927,12 +841,10 @@ declare interface ImageFileMetadata {
|
|
|
927
841
|
*/
|
|
928
842
|
export declare interface LinkNode {
|
|
929
843
|
type: "link";
|
|
930
|
-
|
|
931
844
|
/**
|
|
932
845
|
* The URL to open when the node is clicked.
|
|
933
846
|
*/
|
|
934
847
|
url: string;
|
|
935
|
-
|
|
936
848
|
children: TextNode[];
|
|
937
849
|
}
|
|
938
850
|
|
|
@@ -947,7 +859,6 @@ export declare interface LinkNode {
|
|
|
947
859
|
*/
|
|
948
860
|
export declare interface LocationBlock {
|
|
949
861
|
type: "location";
|
|
950
|
-
|
|
951
862
|
/**
|
|
952
863
|
* The north-south coordinate of the location.
|
|
953
864
|
*
|
|
@@ -957,7 +868,6 @@ export declare interface LocationBlock {
|
|
|
957
868
|
* Must be a number between -90 and 90
|
|
958
869
|
*/
|
|
959
870
|
latitude: number;
|
|
960
|
-
|
|
961
871
|
/**
|
|
962
872
|
* The east-west coordinate of the location.
|
|
963
873
|
*
|
|
@@ -985,7 +895,6 @@ export declare interface MarkupNode {
|
|
|
985
895
|
* - `type: "strikethrough"` is used when users type `~text~` and is rendered with HTML `<s>`
|
|
986
896
|
*/
|
|
987
897
|
type: "bold" | "italic" | "strikethrough";
|
|
988
|
-
|
|
989
898
|
children: TextNode[];
|
|
990
899
|
}
|
|
991
900
|
|
|
@@ -999,12 +908,10 @@ export declare interface MarkupNode {
|
|
|
999
908
|
*/
|
|
1000
909
|
export declare interface MentionNode {
|
|
1001
910
|
type: "mention";
|
|
1002
|
-
|
|
1003
911
|
/**
|
|
1004
912
|
* The ID of the user who is mentioned.
|
|
1005
913
|
*/
|
|
1006
914
|
id: string;
|
|
1007
|
-
|
|
1008
915
|
/**
|
|
1009
916
|
* The name of the user who is mentioned.
|
|
1010
917
|
*/
|
|
@@ -1018,12 +925,10 @@ export declare interface MentionNode {
|
|
|
1018
925
|
*/
|
|
1019
926
|
export declare interface MessageActiveState {
|
|
1020
927
|
type: "active";
|
|
1021
|
-
|
|
1022
928
|
/**
|
|
1023
929
|
* The most recently received snapshot for the user, or `null` if the user does not exist yet.
|
|
1024
930
|
*/
|
|
1025
931
|
latestSnapshot: MessageSnapshot[] | null;
|
|
1026
|
-
|
|
1027
932
|
/**
|
|
1028
933
|
* True if `latestSnapshot` contains all messages in the conversation.
|
|
1029
934
|
* Use `MessageSubscription.loadMore` to load more.
|
|
@@ -1048,7 +953,6 @@ export declare interface MessageRef {
|
|
|
1048
953
|
* Immutable: if you want to reference a different message, get a new MessageRef instead.
|
|
1049
954
|
*/
|
|
1050
955
|
readonly id: string;
|
|
1051
|
-
|
|
1052
956
|
/**
|
|
1053
957
|
* The ID of the conversation that the referenced message belongs to.
|
|
1054
958
|
*
|
|
@@ -1056,7 +960,6 @@ export declare interface MessageRef {
|
|
|
1056
960
|
* Immutable: if you want to reference a message from a different conversation, get a new MessageRef from that conversation.
|
|
1057
961
|
*/
|
|
1058
962
|
readonly conversationId: string;
|
|
1059
|
-
|
|
1060
963
|
/**
|
|
1061
964
|
* Fetches a snapshot of the message.
|
|
1062
965
|
*
|
|
@@ -1066,16 +969,12 @@ export declare interface MessageRef {
|
|
|
1066
969
|
* @returns A snapshot of the message's attributes, or null if the message doesn't exist, the conversation doesn't exist, or you're not a participant in the conversation.
|
|
1067
970
|
*/
|
|
1068
971
|
get(): Promise<MessageSnapshot | null>;
|
|
1069
|
-
|
|
1070
972
|
/**
|
|
1071
973
|
* Edits this message.
|
|
1072
974
|
*
|
|
1073
975
|
* @returns A promise that resolves when the operation completes. The promise will reject if the request is invalid, the message doesn't exist, or you do not have permission to edit that message.
|
|
1074
976
|
*/
|
|
1075
|
-
edit(
|
|
1076
|
-
params: string | EditTextMessageParams | EditMessageParams,
|
|
1077
|
-
): Promise<void>;
|
|
1078
|
-
|
|
977
|
+
edit(params: string | EditTextMessageParams | EditMessageParams): Promise<void>;
|
|
1079
978
|
/**
|
|
1080
979
|
* Deletes this message, or does nothing if they are already not a participant.
|
|
1081
980
|
*
|
|
@@ -1102,37 +1001,31 @@ export declare interface MessageSnapshot {
|
|
|
1102
1001
|
* The unique ID that is used to identify the message in TalkJS
|
|
1103
1002
|
*/
|
|
1104
1003
|
id: string;
|
|
1105
|
-
|
|
1106
1004
|
/**
|
|
1107
1005
|
* Whether this message was "from a user" or a general system message without a specific sender.
|
|
1108
1006
|
*
|
|
1109
1007
|
* The `sender` property is always present for "UserMessage" messages and never present for "SystemMessage" messages.
|
|
1110
1008
|
*/
|
|
1111
1009
|
type: "UserMessage" | "SystemMessage";
|
|
1112
|
-
|
|
1113
1010
|
/**
|
|
1114
1011
|
* A snapshot of the user who sent the message, or null if it is a system message.
|
|
1115
1012
|
* The user's attributes may have been updated since they sent the message, in which case this snapshot contains the updated data.
|
|
1116
1013
|
* It is not a historical snapshot.
|
|
1117
1014
|
*/
|
|
1118
1015
|
sender: UserSnapshot | null;
|
|
1119
|
-
|
|
1120
1016
|
/**
|
|
1121
1017
|
* Custom metadata you have set on the message
|
|
1122
1018
|
*/
|
|
1123
1019
|
custom: Record<string, string>;
|
|
1124
|
-
|
|
1125
1020
|
/**
|
|
1126
1021
|
* Time at which the message was sent, as a unix timestamp in milliseconds
|
|
1127
1022
|
*/
|
|
1128
1023
|
createdAt: number;
|
|
1129
|
-
|
|
1130
1024
|
/**
|
|
1131
1025
|
* Time at which the message was last edited, as a unix timestamp in milliseconds.
|
|
1132
1026
|
* `null` if the message has never been edited.
|
|
1133
1027
|
*/
|
|
1134
1028
|
editedAt: number | null;
|
|
1135
|
-
|
|
1136
1029
|
/**
|
|
1137
1030
|
* A snapshot of the message that this message is a reply to, or null if this message is not a reply.
|
|
1138
1031
|
*
|
|
@@ -1143,10 +1036,6 @@ export declare interface MessageSnapshot {
|
|
|
1143
1036
|
* This prevents TalkJS fetching an unlimited number of messages in a long chain of replies.
|
|
1144
1037
|
*/
|
|
1145
1038
|
referencedMessage: ReferencedMessageSnapshot | null;
|
|
1146
|
-
|
|
1147
|
-
// TODO-STEVEN `rest` also applies when messages are sent with DL, but that's not exposed yet
|
|
1148
|
-
// TODO-STEVEN Add components here
|
|
1149
|
-
// TODO-STEVEN we want to make this make more sense
|
|
1150
1039
|
/**
|
|
1151
1040
|
* Where this message originated from:
|
|
1152
1041
|
*
|
|
@@ -1159,13 +1048,11 @@ export declare interface MessageSnapshot {
|
|
|
1159
1048
|
* - "email" = Message sent by replying to an email notification
|
|
1160
1049
|
*/
|
|
1161
1050
|
origin: "web" | "rest" | "import" | "email";
|
|
1162
|
-
|
|
1163
1051
|
/**
|
|
1164
1052
|
* The contents of the message, as a plain text string without any formatting or attachments.
|
|
1165
1053
|
* Useful for showing in a conversation list or in notifications.
|
|
1166
1054
|
*/
|
|
1167
1055
|
plaintext: string;
|
|
1168
|
-
|
|
1169
1056
|
/**
|
|
1170
1057
|
* The main body of the message, as a list of blocks that are rendered top-to-bottom.
|
|
1171
1058
|
*/
|
|
@@ -1203,7 +1090,6 @@ export declare interface MessageSubscription {
|
|
|
1203
1090
|
* When `type` is "error", includes the `error` field. It is a JS `Error` object explaining what caused the subscription to be terminated.
|
|
1204
1091
|
*/
|
|
1205
1092
|
state: PendingState | MessageActiveState | UnsubscribedState | ErrorState;
|
|
1206
|
-
|
|
1207
1093
|
/**
|
|
1208
1094
|
* Resolves when the subscription starts receiving updates from the server.
|
|
1209
1095
|
*
|
|
@@ -1213,7 +1099,6 @@ export declare interface MessageSubscription {
|
|
|
1213
1099
|
* The promise rejects if the subscription is terminated before it connects.
|
|
1214
1100
|
*/
|
|
1215
1101
|
connected: Promise<MessageActiveState>;
|
|
1216
|
-
|
|
1217
1102
|
/**
|
|
1218
1103
|
* Resolves when the subscription permanently stops receiving updates from the server.
|
|
1219
1104
|
*
|
|
@@ -1221,7 +1106,6 @@ export declare interface MessageSubscription {
|
|
|
1221
1106
|
* This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
|
|
1222
1107
|
*/
|
|
1223
1108
|
terminated: Promise<UnsubscribedState | ErrorState>;
|
|
1224
|
-
|
|
1225
1109
|
/**
|
|
1226
1110
|
* Expand the window to include older messages
|
|
1227
1111
|
*
|
|
@@ -1232,7 +1116,6 @@ export declare interface MessageSubscription {
|
|
|
1232
1116
|
* @returns A promise that resolves once the additional messages have loaded
|
|
1233
1117
|
*/
|
|
1234
1118
|
loadMore: (count?: number) => Promise<void>;
|
|
1235
|
-
|
|
1236
1119
|
/**
|
|
1237
1120
|
* Unsubscribe from this resource and stop receiving updates.
|
|
1238
1121
|
*
|
|
@@ -1259,7 +1142,6 @@ export declare interface ParticipantRef {
|
|
|
1259
1142
|
* Immutable: if you want to reference a different participant, get a new ParticipantRef instead.
|
|
1260
1143
|
*/
|
|
1261
1144
|
readonly userId: string;
|
|
1262
|
-
|
|
1263
1145
|
/**
|
|
1264
1146
|
* The ID of the conversation the user is participating in.
|
|
1265
1147
|
*
|
|
@@ -1267,7 +1149,6 @@ export declare interface ParticipantRef {
|
|
|
1267
1149
|
* Immutable: if you want to reference the user in a different conversation, get a new ParticipantRef instead.
|
|
1268
1150
|
*/
|
|
1269
1151
|
readonly conversationId: string;
|
|
1270
|
-
|
|
1271
1152
|
/**
|
|
1272
1153
|
* Fetches a snapshot of the participant.
|
|
1273
1154
|
*
|
|
@@ -1277,7 +1158,6 @@ export declare interface ParticipantRef {
|
|
|
1277
1158
|
* @returns A snapshot of the participant's attributes, or null if the user is not a participant. The promise will reject if you are not a participant and try to read information about someone else.
|
|
1278
1159
|
*/
|
|
1279
1160
|
get(): Promise<ParticipantSnapshot | null>;
|
|
1280
|
-
|
|
1281
1161
|
/**
|
|
1282
1162
|
* Sets properties of this participant. If the user is not already a participant in the conversation, they will be added.
|
|
1283
1163
|
*
|
|
@@ -1289,7 +1169,6 @@ export declare interface ParticipantRef {
|
|
|
1289
1169
|
* Everything else requires client-side conversation syncing to be enabled, and will cause the promise to reject.
|
|
1290
1170
|
*/
|
|
1291
1171
|
set(params: SetParticipantParams): Promise<void>;
|
|
1292
|
-
|
|
1293
1172
|
/**
|
|
1294
1173
|
* Edits properties of a pre-existing participant. If the user is not already a participant in the conversation, the promise will reject.
|
|
1295
1174
|
*
|
|
@@ -1301,7 +1180,6 @@ export declare interface ParticipantRef {
|
|
|
1301
1180
|
* Everything else requires client-side conversation syncing to be enabled, and will cause the promise to reject.
|
|
1302
1181
|
*/
|
|
1303
1182
|
edit(params: SetParticipantParams): Promise<void>;
|
|
1304
|
-
|
|
1305
1183
|
/**
|
|
1306
1184
|
* Adds the user as a participant, or does nothing if they are already a participant.
|
|
1307
1185
|
*
|
|
@@ -1313,7 +1191,6 @@ export declare interface ParticipantRef {
|
|
|
1313
1191
|
* @returns A promise that resolves when the operation completes. The promise will reject if client-side conversation syncing is disabled and the user is not already a participant.
|
|
1314
1192
|
*/
|
|
1315
1193
|
createIfNotExists(params?: CreateParticipantParams): Promise<void>;
|
|
1316
|
-
|
|
1317
1194
|
/**
|
|
1318
1195
|
* Removes the user as a participant, or does nothing if they are already not a participant.
|
|
1319
1196
|
*
|
|
@@ -1340,12 +1217,10 @@ export declare interface ParticipantSnapshot {
|
|
|
1340
1217
|
* The user who this participant snapshot is referring to
|
|
1341
1218
|
*/
|
|
1342
1219
|
user: UserSnapshot;
|
|
1343
|
-
|
|
1344
1220
|
/**
|
|
1345
1221
|
* The level of access this participant has in the conversation.
|
|
1346
1222
|
*/
|
|
1347
1223
|
access: "ReadWrite" | "Read";
|
|
1348
|
-
|
|
1349
1224
|
/**
|
|
1350
1225
|
* When the participant will be notified about new messages in this conversation.
|
|
1351
1226
|
*
|
|
@@ -1353,13 +1228,10 @@ export declare interface ParticipantSnapshot {
|
|
|
1353
1228
|
* `false` means no notifications, `true` means notifications for all messages, and `"MentionsOnly"` means that the user will only be notified when they are mentioned with an `@`.
|
|
1354
1229
|
*/
|
|
1355
1230
|
notify: boolean | "MentionsOnly";
|
|
1356
|
-
|
|
1357
1231
|
/**
|
|
1358
1232
|
* The date that this user joined the conversation, as a unix timestamp in milliseconds.
|
|
1359
1233
|
*/
|
|
1360
1234
|
joinedAt: number;
|
|
1361
|
-
|
|
1362
|
-
// TODO-STEVEN readUntil
|
|
1363
1235
|
}
|
|
1364
1236
|
|
|
1365
1237
|
/**
|
|
@@ -1388,12 +1260,10 @@ export declare interface ReferencedMessageSnapshot {
|
|
|
1388
1260
|
* The unique ID that is used to identify the message in TalkJS
|
|
1389
1261
|
*/
|
|
1390
1262
|
id: string;
|
|
1391
|
-
|
|
1392
1263
|
/**
|
|
1393
1264
|
* Referenced messages are always "UserMessage" because you cannot reply to a system message.
|
|
1394
1265
|
*/
|
|
1395
1266
|
type: "UserMessage";
|
|
1396
|
-
|
|
1397
1267
|
/**
|
|
1398
1268
|
* A snapshot of the user who sent the message.
|
|
1399
1269
|
* The user's attributes may have been updated since they sent the message, in which case this snapshot contains the updated data.
|
|
@@ -1403,23 +1273,19 @@ export declare interface ReferencedMessageSnapshot {
|
|
|
1403
1273
|
* Guaranteed to be set, unlike in MessageSnapshot, because you cannot reference a SystemMessage
|
|
1404
1274
|
*/
|
|
1405
1275
|
sender: UserSnapshot;
|
|
1406
|
-
|
|
1407
1276
|
/**
|
|
1408
1277
|
* Custom metadata you have set on the message
|
|
1409
1278
|
*/
|
|
1410
1279
|
custom: Record<string, string>;
|
|
1411
|
-
|
|
1412
1280
|
/**
|
|
1413
1281
|
* Time at which the message was sent, as a unix timestamp in milliseconds
|
|
1414
1282
|
*/
|
|
1415
1283
|
createdAt: number;
|
|
1416
|
-
|
|
1417
1284
|
/**
|
|
1418
1285
|
* Time at which the message was last edited, as a unix timestamp in milliseconds.
|
|
1419
1286
|
* `null` if the message has never been edited.
|
|
1420
1287
|
*/
|
|
1421
1288
|
editedAt: number | null;
|
|
1422
|
-
|
|
1423
1289
|
/**
|
|
1424
1290
|
* The ID of the message that this message is a reply to, or null if this message is not a reply.
|
|
1425
1291
|
*
|
|
@@ -1428,10 +1294,6 @@ export declare interface ReferencedMessageSnapshot {
|
|
|
1428
1294
|
* The ID of its referenced message is provided here instead.
|
|
1429
1295
|
*/
|
|
1430
1296
|
referencedMessageId: string | null;
|
|
1431
|
-
|
|
1432
|
-
// TODO-STEVEN `rest` also applies when messages are sent with DL, but that's not exposed yet
|
|
1433
|
-
// TODO-STEVEN Add components here
|
|
1434
|
-
// TODO-STEVEN we want to make this make more sense
|
|
1435
1297
|
/**
|
|
1436
1298
|
* Where this message originated from:
|
|
1437
1299
|
*
|
|
@@ -1444,13 +1306,11 @@ export declare interface ReferencedMessageSnapshot {
|
|
|
1444
1306
|
* - "email" = Message sent by replying to an email notification
|
|
1445
1307
|
*/
|
|
1446
1308
|
origin: "web" | "rest" | "import" | "email";
|
|
1447
|
-
|
|
1448
1309
|
/**
|
|
1449
1310
|
* The contents of the message, as a plain text string without any formatting or attachments.
|
|
1450
1311
|
* Useful for showing in a conversation list or in notifications.
|
|
1451
1312
|
*/
|
|
1452
1313
|
plaintext: string;
|
|
1453
|
-
|
|
1454
1314
|
/**
|
|
1455
1315
|
* The main body of the message, as a list of blocks that are rendered top-to-bottom.
|
|
1456
1316
|
*/
|
|
@@ -1527,13 +1387,11 @@ export declare interface SendMessageParams {
|
|
|
1527
1387
|
* Default = no custom metadata
|
|
1528
1388
|
*/
|
|
1529
1389
|
custom?: Record<string, string>;
|
|
1530
|
-
|
|
1531
1390
|
/**
|
|
1532
1391
|
* The message that you are replying to.
|
|
1533
1392
|
* Default = not a reply
|
|
1534
1393
|
*/
|
|
1535
1394
|
referencedMessage?: string | MessageRef;
|
|
1536
|
-
|
|
1537
1395
|
/**
|
|
1538
1396
|
* The most important part of the message, either some text, a file attachment, or a location.
|
|
1539
1397
|
*
|
|
@@ -1559,13 +1417,11 @@ export declare interface SendTextMessageParams {
|
|
|
1559
1417
|
* Default = no custom metadata
|
|
1560
1418
|
*/
|
|
1561
1419
|
custom?: Record<string, string>;
|
|
1562
|
-
|
|
1563
1420
|
/**
|
|
1564
1421
|
* The message that you are replying to.
|
|
1565
1422
|
* Default = not a reply
|
|
1566
1423
|
*/
|
|
1567
1424
|
referencedMessage?: string | MessageRef;
|
|
1568
|
-
|
|
1569
1425
|
/**
|
|
1570
1426
|
* The text to send in the message.
|
|
1571
1427
|
*
|
|
@@ -1591,32 +1447,27 @@ export declare interface SetConversationParams {
|
|
|
1591
1447
|
* Default = no subject, list participant names instead.
|
|
1592
1448
|
*/
|
|
1593
1449
|
subject?: string | null;
|
|
1594
|
-
|
|
1595
1450
|
/**
|
|
1596
1451
|
* The URL for the conversation photo to display in the chat header.
|
|
1597
1452
|
* Default = no photo, show a placeholder image.
|
|
1598
1453
|
*/
|
|
1599
1454
|
photoUrl?: string | null;
|
|
1600
|
-
|
|
1601
1455
|
/**
|
|
1602
1456
|
* System messages which are sent at the beginning of a conversation.
|
|
1603
1457
|
* Default = no messages.
|
|
1604
1458
|
*/
|
|
1605
1459
|
welcomeMessages?: string[] | null;
|
|
1606
|
-
|
|
1607
1460
|
/**
|
|
1608
1461
|
* Custom metadata you have set on the conversation.
|
|
1609
1462
|
* This value acts as a patch. Remove specific properties by setting them to `null`.
|
|
1610
1463
|
* Default = no custom metadata
|
|
1611
1464
|
*/
|
|
1612
1465
|
custom?: Record<string, string | null> | null;
|
|
1613
|
-
|
|
1614
1466
|
/**
|
|
1615
1467
|
* Your access to the conversation.
|
|
1616
1468
|
* Default = "ReadWrite" access.
|
|
1617
1469
|
*/
|
|
1618
1470
|
access?: "Read" | "ReadWrite" | null;
|
|
1619
|
-
|
|
1620
1471
|
/**
|
|
1621
1472
|
* Your notification settings.
|
|
1622
1473
|
* Default = `true`
|
|
@@ -1639,7 +1490,6 @@ export declare interface SetParticipantParams {
|
|
|
1639
1490
|
* Default = "ReadWrite" access.
|
|
1640
1491
|
*/
|
|
1641
1492
|
access?: "ReadWrite" | "Read" | null;
|
|
1642
|
-
|
|
1643
1493
|
/**
|
|
1644
1494
|
* When the participant should be notified about new messages in this conversation.
|
|
1645
1495
|
* Default = `ReadWrite` access.
|
|
@@ -1664,52 +1514,44 @@ export declare interface SetUserParams {
|
|
|
1664
1514
|
* The user's name which will be displayed on the TalkJS UI
|
|
1665
1515
|
*/
|
|
1666
1516
|
name?: string;
|
|
1667
|
-
|
|
1668
1517
|
/**
|
|
1669
1518
|
* Custom metadata you have set on the user.
|
|
1670
1519
|
* This value acts as a patch. Remove specific properties by setting them to `null`.
|
|
1671
1520
|
* Default = no custom metadata
|
|
1672
1521
|
*/
|
|
1673
1522
|
custom?: Record<string, string | null> | null;
|
|
1674
|
-
|
|
1675
1523
|
/**
|
|
1676
1524
|
* An {@link https://www.w3.org/International/articles/language-tags/ | IETF language tag}.
|
|
1677
1525
|
* See the {@link https://talkjs.com/docs/Features/Language_Support/Localization.html | localization documentation}
|
|
1678
1526
|
* Default = the locale selected on the dashboard
|
|
1679
1527
|
*/
|
|
1680
1528
|
locale?: string;
|
|
1681
|
-
|
|
1682
1529
|
/**
|
|
1683
1530
|
* An optional URL to a photo which will be displayed as the user's avatar.
|
|
1684
1531
|
* Default = no photo
|
|
1685
1532
|
*/
|
|
1686
1533
|
photoUrl?: string | null;
|
|
1687
|
-
|
|
1688
1534
|
/**
|
|
1689
1535
|
* TalkJS supports multiple sets of settings, called "roles". These allow you to change the behavior of TalkJS for different users.
|
|
1690
1536
|
* You have full control over which user gets which configuration.
|
|
1691
1537
|
* Default = the `default` role
|
|
1692
1538
|
*/
|
|
1693
1539
|
role?: string | null;
|
|
1694
|
-
|
|
1695
1540
|
/**
|
|
1696
1541
|
* The default message a person sees when starting a chat with this user.
|
|
1697
1542
|
* Default = no welcome message
|
|
1698
1543
|
*/
|
|
1699
1544
|
welcomeMessage?: string | null;
|
|
1700
|
-
|
|
1701
1545
|
/**
|
|
1702
|
-
*
|
|
1546
|
+
* A single email address or an array of email addresses associated with the user.
|
|
1703
1547
|
* Default = no email addresses
|
|
1704
1548
|
*/
|
|
1705
|
-
email?: string[] | null;
|
|
1706
|
-
|
|
1549
|
+
email?: string | string[] | null;
|
|
1707
1550
|
/**
|
|
1708
|
-
*
|
|
1551
|
+
* A single phone number or an array of phone numbers associated with the user.
|
|
1709
1552
|
* Default = no phone numbers
|
|
1710
1553
|
*/
|
|
1711
|
-
phone?: string[] | null;
|
|
1712
|
-
|
|
1554
|
+
phone?: string | string[] | null;
|
|
1713
1555
|
/**
|
|
1714
1556
|
* An object of push registration tokens to use when notifying this user.
|
|
1715
1557
|
*
|
|
@@ -1788,7 +1630,7 @@ export declare interface TalkSession {
|
|
|
1788
1630
|
* Upload an image with image-specific metadata.
|
|
1789
1631
|
*
|
|
1790
1632
|
* @remarks
|
|
1791
|
-
* This is a variant of {@linkcode
|
|
1633
|
+
* This is a variant of {@linkcode uploadFile} used for images.
|
|
1792
1634
|
*
|
|
1793
1635
|
* @param data The binary image data. Usually a {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/File | File}.
|
|
1794
1636
|
* @param metadata Information about the image.
|
|
@@ -1799,7 +1641,7 @@ export declare interface TalkSession {
|
|
|
1799
1641
|
* Upload a video with video-specific metadata.
|
|
1800
1642
|
*
|
|
1801
1643
|
* @remarks
|
|
1802
|
-
* This is a variant of {@linkcode
|
|
1644
|
+
* This is a variant of {@linkcode uploadFile} used for videos.
|
|
1803
1645
|
*
|
|
1804
1646
|
* @param data The binary video data. Usually a {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/File | File}.
|
|
1805
1647
|
* @param metadata Information about the video.
|
|
@@ -1810,7 +1652,7 @@ export declare interface TalkSession {
|
|
|
1810
1652
|
* Upload an audio file with audio-specific metadata.
|
|
1811
1653
|
*
|
|
1812
1654
|
* @remarks
|
|
1813
|
-
* This is a variant of {@linkcode
|
|
1655
|
+
* This is a variant of {@linkcode uploadFile} used for audio files.
|
|
1814
1656
|
*
|
|
1815
1657
|
* @param data The binary audio data. Usually a {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/File | File}.
|
|
1816
1658
|
* @param metadata Information about the audio file.
|
|
@@ -1821,7 +1663,7 @@ export declare interface TalkSession {
|
|
|
1821
1663
|
* Upload a voice recording with voice-specific metadata.
|
|
1822
1664
|
*
|
|
1823
1665
|
* @remarks
|
|
1824
|
-
* This is a variant of {@linkcode
|
|
1666
|
+
* This is a variant of {@linkcode uploadFile} used for voice recordings.
|
|
1825
1667
|
*
|
|
1826
1668
|
* @param data The binary audio data. Usually a {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/File | File}.
|
|
1827
1669
|
* @param metadata Information about the voice recording.
|
|
@@ -1917,18 +1759,7 @@ export declare interface TextBlock {
|
|
|
1917
1759
|
*
|
|
1918
1760
|
* @public
|
|
1919
1761
|
*/
|
|
1920
|
-
export declare type TextNode =
|
|
1921
|
-
| string
|
|
1922
|
-
| MarkupNode
|
|
1923
|
-
| BulletListNode
|
|
1924
|
-
| BulletPointNode
|
|
1925
|
-
| CodeSpanNode
|
|
1926
|
-
| LinkNode
|
|
1927
|
-
| AutoLinkNode
|
|
1928
|
-
| ActionLinkNode
|
|
1929
|
-
| ActionButtonNode
|
|
1930
|
-
| CustomEmojiNode
|
|
1931
|
-
| MentionNode;
|
|
1762
|
+
export declare type TextNode = string | MarkupNode | BulletListNode | BulletPointNode | CodeSpanNode | LinkNode | AutoLinkNode | ActionLinkNode | ActionButtonNode | CustomEmojiNode | MentionNode;
|
|
1932
1763
|
|
|
1933
1764
|
/**
|
|
1934
1765
|
* The state of a subscription after you have manually unsubscribed
|
|
@@ -1946,7 +1777,6 @@ export declare interface UnsubscribedState {
|
|
|
1946
1777
|
*/
|
|
1947
1778
|
export declare interface UserActiveState {
|
|
1948
1779
|
type: "active";
|
|
1949
|
-
|
|
1950
1780
|
/**
|
|
1951
1781
|
* The most recently received snapshot for the user, or `null` if the user does not exist yet.
|
|
1952
1782
|
*/
|
|
@@ -1970,7 +1800,6 @@ export declare interface UserRef {
|
|
|
1970
1800
|
* Immutable: if you want to reference a different user, get a new UserRef instead.
|
|
1971
1801
|
*/
|
|
1972
1802
|
readonly id: string;
|
|
1973
|
-
|
|
1974
1803
|
/**
|
|
1975
1804
|
* Fetches a snapshot of the user.
|
|
1976
1805
|
*
|
|
@@ -1984,7 +1813,6 @@ export declare interface UserRef {
|
|
|
1984
1813
|
* @returns A snapshot of the user's public attributes, or null if the user doesn't exist.
|
|
1985
1814
|
*/
|
|
1986
1815
|
get(): Promise<UserSnapshot | null>;
|
|
1987
|
-
|
|
1988
1816
|
/**
|
|
1989
1817
|
* Sets properties of this user. The user is created if a user with this ID doesn't already exist.
|
|
1990
1818
|
*
|
|
@@ -1994,7 +1822,6 @@ export declare interface UserRef {
|
|
|
1994
1822
|
* @returns A promise that resolves when the operation completes. The promise will reject if the request is invalid or if client-side user syncing is disabled.
|
|
1995
1823
|
*/
|
|
1996
1824
|
set(params: SetUserParams): Promise<void>;
|
|
1997
|
-
|
|
1998
1825
|
/**
|
|
1999
1826
|
* Creates a user with this ID, or does nothing if a user with this ID already exists.
|
|
2000
1827
|
*
|
|
@@ -2004,7 +1831,6 @@ export declare interface UserRef {
|
|
|
2004
1831
|
* @returns A promise that resolves when the operation completes. The promise will reject if client-side user syncing is disabled and the user does not already exist.
|
|
2005
1832
|
*/
|
|
2006
1833
|
createIfNotExists(params: CreateUserParams): Promise<void>;
|
|
2007
|
-
|
|
2008
1834
|
/**
|
|
2009
1835
|
* Subscribe to this user's state.
|
|
2010
1836
|
*
|
|
@@ -2015,9 +1841,7 @@ export declare interface UserRef {
|
|
|
2015
1841
|
*
|
|
2016
1842
|
* @returns A subscription to the user
|
|
2017
1843
|
*/
|
|
2018
|
-
subscribe(
|
|
2019
|
-
onSnapshot?: (event: UserSnapshot | null) => void,
|
|
2020
|
-
): UserSubscription;
|
|
1844
|
+
subscribe(onSnapshot?: (event: UserSnapshot | null) => void): UserSubscription;
|
|
2021
1845
|
}
|
|
2022
1846
|
|
|
2023
1847
|
/**
|
|
@@ -2035,17 +1859,14 @@ export declare interface UserSnapshot {
|
|
|
2035
1859
|
* The unique ID that is used to identify the user in TalkJS
|
|
2036
1860
|
*/
|
|
2037
1861
|
id: string;
|
|
2038
|
-
|
|
2039
1862
|
/**
|
|
2040
1863
|
* The user's name, which is displayed on the TalkJS UI
|
|
2041
1864
|
*/
|
|
2042
1865
|
name: string;
|
|
2043
|
-
|
|
2044
1866
|
/**
|
|
2045
1867
|
* Custom metadata you have set on the user
|
|
2046
1868
|
*/
|
|
2047
1869
|
custom: Record<string, string>;
|
|
2048
|
-
|
|
2049
1870
|
/**
|
|
2050
1871
|
* An {@link https://www.w3.org/International/articles/language-tags/ | IETF language tag}.
|
|
2051
1872
|
* For more information, see: {@link https://talkjs.com/docs/Features/Language_Support/Localization.html | Localization}.
|
|
@@ -2053,18 +1874,15 @@ export declare interface UserSnapshot {
|
|
|
2053
1874
|
* When `locale` is null, the app's default locale will be used
|
|
2054
1875
|
*/
|
|
2055
1876
|
locale: string | null;
|
|
2056
|
-
|
|
2057
1877
|
/**
|
|
2058
1878
|
* An optional URL to a photo that is displayed as the user's avatar
|
|
2059
1879
|
*/
|
|
2060
1880
|
photoUrl: string | null;
|
|
2061
|
-
|
|
2062
1881
|
/**
|
|
2063
1882
|
* TalkJS supports multiple sets of settings for users, called "roles". Roles allow you to change the behavior of TalkJS for different users.
|
|
2064
1883
|
* You have full control over which user gets which configuration.
|
|
2065
1884
|
*/
|
|
2066
1885
|
role: string;
|
|
2067
|
-
|
|
2068
1886
|
/**
|
|
2069
1887
|
* The default message a person sees when starting a chat with this user
|
|
2070
1888
|
*/
|
|
@@ -2093,12 +1911,10 @@ export declare interface UserSubscription {
|
|
|
2093
1911
|
* When `type` is "error", includes the `error: Error` field. It is a JS `Error` object explaining what caused the subscription to be terminated.
|
|
2094
1912
|
*/
|
|
2095
1913
|
state: PendingState | UserActiveState | UnsubscribedState | ErrorState;
|
|
2096
|
-
|
|
2097
1914
|
/**
|
|
2098
1915
|
* Resolves when the subscription starts receiving updates from the server.
|
|
2099
1916
|
*/
|
|
2100
1917
|
connected: Promise<UserActiveState>;
|
|
2101
|
-
|
|
2102
1918
|
/**
|
|
2103
1919
|
* Resolves when the subscription permanently stops receiving updates from the server.
|
|
2104
1920
|
*
|
|
@@ -2106,7 +1922,6 @@ export declare interface UserSubscription {
|
|
|
2106
1922
|
* This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
|
|
2107
1923
|
*/
|
|
2108
1924
|
terminated: Promise<UnsubscribedState | ErrorState>;
|
|
2109
|
-
|
|
2110
1925
|
/**
|
|
2111
1926
|
* Unsubscribe from this resource and stop receiving updates.
|
|
2112
1927
|
*
|
|
@@ -2132,39 +1947,31 @@ export declare interface UserSubscription {
|
|
|
2132
1947
|
*/
|
|
2133
1948
|
export declare interface VideoBlock {
|
|
2134
1949
|
type: "file";
|
|
2135
|
-
|
|
2136
1950
|
subtype: "video";
|
|
2137
|
-
|
|
2138
1951
|
/**
|
|
2139
1952
|
* An encoded identifier for this file. Use in {@link SendFileBlock} to send this video in another message.
|
|
2140
1953
|
*/
|
|
2141
1954
|
fileToken: FileToken;
|
|
2142
|
-
|
|
2143
1955
|
/**
|
|
2144
1956
|
* The URL where you can fetch the file.
|
|
2145
1957
|
*/
|
|
2146
1958
|
url: string;
|
|
2147
|
-
|
|
2148
1959
|
/**
|
|
2149
1960
|
* The size of the file in bytes.
|
|
2150
1961
|
*/
|
|
2151
1962
|
size: number;
|
|
2152
|
-
|
|
2153
1963
|
/**
|
|
2154
1964
|
* The name of the video file, including file extension.
|
|
2155
1965
|
*/
|
|
2156
1966
|
filename: string;
|
|
2157
|
-
|
|
2158
1967
|
/**
|
|
2159
1968
|
* The width of the video in pixels, if known.
|
|
2160
1969
|
*/
|
|
2161
1970
|
width?: number;
|
|
2162
|
-
|
|
2163
1971
|
/**
|
|
2164
1972
|
* The height of the video in pixels, if known.
|
|
2165
1973
|
*/
|
|
2166
1974
|
height?: number;
|
|
2167
|
-
|
|
2168
1975
|
/**
|
|
2169
1976
|
* The duration of the video in seconds, if known.
|
|
2170
1977
|
*/
|
|
@@ -2211,29 +2018,23 @@ declare interface VideoFileMetadata {
|
|
|
2211
2018
|
*/
|
|
2212
2019
|
export declare interface VoiceBlock {
|
|
2213
2020
|
type: "file";
|
|
2214
|
-
|
|
2215
2021
|
subtype: "voice";
|
|
2216
|
-
|
|
2217
2022
|
/**
|
|
2218
2023
|
* An encoded identifier for this file. Use in {@link SendFileBlock} to send this voice recording in another message.
|
|
2219
2024
|
*/
|
|
2220
2025
|
fileToken: FileToken;
|
|
2221
|
-
|
|
2222
2026
|
/**
|
|
2223
2027
|
* The URL where you can fetch the file
|
|
2224
2028
|
*/
|
|
2225
2029
|
url: string;
|
|
2226
|
-
|
|
2227
2030
|
/**
|
|
2228
2031
|
* The size of the file in bytes
|
|
2229
2032
|
*/
|
|
2230
2033
|
size: number;
|
|
2231
|
-
|
|
2232
2034
|
/**
|
|
2233
2035
|
* The name of the file, including file extension
|
|
2234
2036
|
*/
|
|
2235
2037
|
filename: string;
|
|
2236
|
-
|
|
2237
2038
|
/**
|
|
2238
2039
|
* The duration of the voice recording in seconds, if known
|
|
2239
2040
|
*/
|