@talkjs/core 1.5.3 → 1.5.5

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.
@@ -8,16 +8,16 @@
8
8
  * @public
9
9
  */
10
10
  export declare interface ActionButtonNode {
11
- type: "actionButton";
11
+ readonly type: "actionButton";
12
12
  /**
13
13
  * The name of the custom action to invoke when the button is clicked.
14
14
  */
15
- action: string;
15
+ readonly action: string;
16
16
  /**
17
17
  * The parameters to pass to the custom action when the button is clicked.
18
18
  */
19
- params: Record<string, string>;
20
- children: TextNode[];
19
+ readonly params: Record<string, string>;
20
+ readonly children: TextNode[];
21
21
  }
22
22
 
23
23
  /**
@@ -30,16 +30,16 @@ export declare interface ActionButtonNode {
30
30
  * @public
31
31
  */
32
32
  export declare interface ActionLinkNode {
33
- type: "actionLink";
33
+ readonly type: "actionLink";
34
34
  /**
35
35
  * The name of the custom action to invoke when the link is clicked.
36
36
  */
37
- action: string;
37
+ readonly action: string;
38
38
  /**
39
39
  * The parameters to pass to the custom action when the link is clicked.
40
40
  */
41
- params: Record<string, string>;
42
- children: TextNode[];
41
+ readonly params: Record<string, string>;
42
+ readonly children: TextNode[];
43
43
  }
44
44
 
45
45
  /**
@@ -60,28 +60,28 @@ export declare interface ActionLinkNode {
60
60
  * @public
61
61
  */
62
62
  export declare interface AudioBlock {
63
- type: "file";
64
- subtype: "audio";
63
+ readonly type: "file";
64
+ readonly subtype: "audio";
65
65
  /**
66
66
  * An encoded identifier for this file. Use in {@link SendFileBlock} to send this file in another message.
67
67
  */
68
- fileToken: FileToken;
68
+ readonly fileToken: FileToken;
69
69
  /**
70
70
  * The URL where you can fetch the file
71
71
  */
72
- url: string;
72
+ readonly url: string;
73
73
  /**
74
74
  * The size of the file in bytes
75
75
  */
76
- size: number;
76
+ readonly size: number;
77
77
  /**
78
78
  * The name of the audio file, including file extension
79
79
  */
80
- filename: string;
80
+ readonly filename: string;
81
81
  /**
82
82
  * The duration of the audio in seconds, if known
83
83
  */
84
- duration?: number;
84
+ readonly duration?: number;
85
85
  }
86
86
 
87
87
  export declare interface AudioFileMetadata {
@@ -130,15 +130,15 @@ export declare interface AudioFileMetadata {
130
130
  * @public
131
131
  */
132
132
  export declare interface AutoLinkNode {
133
- type: "autoLink";
133
+ readonly type: "autoLink";
134
134
  /**
135
135
  * The URL to open when a user clicks this node.
136
136
  */
137
- url: string;
137
+ readonly url: string;
138
138
  /**
139
139
  * The text to display in the link.
140
140
  */
141
- text: string;
141
+ readonly text: string;
142
142
  }
143
143
 
144
144
  /**
@@ -150,8 +150,8 @@ export declare interface AutoLinkNode {
150
150
  * @public
151
151
  */
152
152
  export declare interface BulletListNode {
153
- type: "bulletList";
154
- children: TextNode[];
153
+ readonly type: "bulletList";
154
+ readonly children: TextNode[];
155
155
  }
156
156
 
157
157
  /**
@@ -163,8 +163,8 @@ export declare interface BulletListNode {
163
163
  * @public
164
164
  */
165
165
  export declare interface BulletPointNode {
166
- type: "bulletPoint";
167
- children: TextNode[];
166
+ readonly type: "bulletPoint";
167
+ readonly children: TextNode[];
168
168
  }
169
169
 
170
170
  /**
@@ -176,8 +176,8 @@ export declare interface BulletPointNode {
176
176
  * @public
177
177
  */
178
178
  export declare interface CodeSpanNode {
179
- type: "codeSpan";
180
- text: string;
179
+ readonly type: "codeSpan";
180
+ readonly text: string;
181
181
  }
182
182
 
183
183
  /**
@@ -207,11 +207,11 @@ export declare type ContentBlock = TextBlock | FileBlock | LocationBlock;
207
207
  * @public
208
208
  */
209
209
  export declare interface ConversationActiveState {
210
- type: "active";
210
+ readonly type: "active";
211
211
  /**
212
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).
213
213
  */
214
- latestSnapshot: ConversationSnapshot | null;
214
+ readonly latestSnapshot: ConversationSnapshot | null;
215
215
  }
216
216
 
217
217
  /**
@@ -220,16 +220,16 @@ export declare interface ConversationActiveState {
220
220
  * @public
221
221
  */
222
222
  export declare interface ConversationListActiveState {
223
- type: "active";
223
+ readonly type: "active";
224
224
  /**
225
225
  * The most recently received snapshot for the conversations
226
226
  */
227
- latestSnapshot: ConversationSnapshot[];
227
+ readonly latestSnapshot: ConversationSnapshot[];
228
228
  /**
229
229
  * True if `latestSnapshot` contains all conversations you are in.
230
230
  * Use {@link ConversationListSubscription.loadMore} to load more.
231
231
  */
232
- loadedAll: boolean;
232
+ readonly loadedAll: boolean;
233
233
  }
234
234
 
235
235
  /**
@@ -275,14 +275,14 @@ export declare interface ConversationListSubscription {
275
275
  *
276
276
  * The promise rejects if the subscription is terminated before it connects.
277
277
  */
278
- connected: Promise<ConversationListActiveState>;
278
+ readonly connected: Promise<ConversationListActiveState>;
279
279
  /**
280
280
  * Resolves when the subscription permanently stops receiving updates from the server.
281
281
  *
282
282
  * @remarks
283
283
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
284
284
  */
285
- terminated: Promise<UnsubscribedState | ErrorState>;
285
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
286
286
  /**
287
287
  * Expand the window to include older conversations
288
288
  *
@@ -307,12 +307,19 @@ export declare interface ConversationListSubscription {
307
307
  }
308
308
 
309
309
  /**
310
- * References the conversation with a given conversation ID, from the perspective of the current user.
310
+ * References the current user's view of the conversation with a given conversation ID.
311
311
  *
312
312
  * @remarks
313
313
  * Used in all Data API operations affecting that conversation, such as fetching or updating conversation attributes.
314
314
  * Created via {@link Session.conversation|Session.conversation()}.
315
315
  *
316
+ * Important note: ConversationRef is a reference to *the current user's view* of the conversation.
317
+ *
318
+ * If they are not a participant, "their view" of the conversation does not exist.
319
+ * This means that {@link ConversationRef.get|ConversationRef.get()} will return null.
320
+ * Additionally, it means that {@link ConversationRef.set|set()} and {@link ConversationRef.createIfNotExists|createIfNotExists()} will add the current user as a participant, in order to create "their view" of the conversation.
321
+ * For more details, see the documentation for those methods.
322
+ *
316
323
  * @public
317
324
  */
318
325
  export declare interface ConversationRef {
@@ -358,6 +365,7 @@ export declare interface ConversationRef {
358
365
  * @remarks
359
366
  * Use this if you need to fetch, delete, or edit a specific message in this conversation, and you know its message ID.
360
367
  * To fetch the most recent messages in this conversation, use {@link ConversationRef.subscribeMessages} instead.
368
+ * To send a message, use {@link ConversationRef.send}.
361
369
  *
362
370
  * @param id - The ID of the message that you want to reference
363
371
  * @returns A {@linkcode MessageRef} for the message with that ID in this conversation
@@ -375,11 +383,12 @@ export declare interface ConversationRef {
375
383
  */
376
384
  get(): Promise<ConversationSnapshot | null>;
377
385
  /**
378
- * Sets properties of this conversation and your participation in it.
386
+ * Sets properties of this conversation and the current user's participation.
379
387
  *
380
388
  * @remarks
381
- * The conversation is created if a conversation with this ID doesn't already exist.
382
- * You are added as a participant if you are not already a participant in the conversation.
389
+ * If this conversation does not already exist, it will be created.
390
+ *
391
+ * If the user is not currently a participant in this conversation, they will be added.
383
392
  *
384
393
  * @returns A promise that resolves when the operation completes.
385
394
  * When client-side conversation syncing is disabled, you must already be a participant and you cannot set anything except the `notify` property.
@@ -587,39 +596,43 @@ export declare interface ConversationSnapshot {
587
596
  /**
588
597
  * The ID of the conversation
589
598
  */
590
- id: string;
599
+ readonly id: string;
591
600
  /**
592
601
  * Contains the conversation subject, or `null` if the conversation does not have a subject specified.
593
602
  */
594
- subject: string | null;
603
+ readonly subject: string | null;
595
604
  /**
596
605
  * Contains the URL of a photo to represent the topic of the conversation or `null` if the conversation does not have a photo specified.
597
606
  */
598
- photoUrl: string | null;
607
+ readonly photoUrl: string | null;
599
608
  /**
600
- * One or more welcome messages that will display to the user as a SystemMessage
609
+ * One or more welcome messages that will be rendered at the start of this conversation as system messages.
610
+ *
611
+ * @remarks
612
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
613
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
601
614
  */
602
- welcomeMessages: string[];
615
+ readonly welcomeMessages: string[];
603
616
  /**
604
617
  * Custom metadata you have set on the conversation
605
618
  */
606
- custom: Record<string, string>;
619
+ readonly custom: Record<string, string>;
607
620
  /**
608
621
  * The date that the conversation was created, as a unix timestamp in milliseconds.
609
622
  */
610
- createdAt: number;
623
+ readonly createdAt: number;
611
624
  /**
612
625
  * The date that the current user joined the conversation, as a unix timestamp in milliseconds.
613
626
  */
614
- joinedAt: number;
627
+ readonly joinedAt: number;
615
628
  /**
616
629
  * The last message sent in this conversation, or null if no messages have been sent.
617
630
  */
618
- lastMessage: MessageSnapshot | null;
631
+ readonly lastMessage: MessageSnapshot | null;
619
632
  /**
620
633
  * The number of messages in this conversation that the current user hasn't read.
621
634
  */
622
- unreadMessageCount: number;
635
+ readonly unreadMessageCount: number;
623
636
  /**
624
637
  * The most recent date that the current user read the conversation.
625
638
  *
@@ -628,7 +641,7 @@ export declare interface ConversationSnapshot {
628
641
  *
629
642
  * Any messages sent after this timestamp are unread messages.
630
643
  */
631
- readUntil: number;
644
+ readonly readUntil: number;
632
645
  /**
633
646
  * Everyone in the conversation has read any messages sent on or before this date.
634
647
  *
@@ -639,25 +652,25 @@ export declare interface ConversationSnapshot {
639
652
  * This value will rarely change in very large conversations.
640
653
  * If just one person stops checking their messages, `everyoneReadUntil` will never update.
641
654
  */
642
- everyoneReadUntil: number;
655
+ readonly everyoneReadUntil: number;
643
656
  /**
644
657
  * Whether the conversation should be considered unread.
645
658
  *
646
659
  * @remarks
647
660
  * This can be true even when `unreadMessageCount` is zero, if the user has manually marked the conversation as unread.
648
661
  */
649
- isUnread: boolean;
662
+ readonly isUnread: boolean;
650
663
  /**
651
664
  * The current user's permission level in this conversation.
652
665
  */
653
- access: "Read" | "ReadWrite";
666
+ readonly access: "Read" | "ReadWrite";
654
667
  /**
655
668
  * The current user's notification settings for this conversation.
656
669
  *
657
670
  * @remarks
658
671
  * `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 `@`.
659
672
  */
660
- notify: boolean | "MentionsOnly";
673
+ readonly notify: boolean | "MentionsOnly";
661
674
  }
662
675
 
663
676
  /**
@@ -688,14 +701,14 @@ export declare interface ConversationSubscription {
688
701
  /**
689
702
  * Resolves when the subscription starts receiving updates from the server.
690
703
  */
691
- connected: Promise<ConversationActiveState>;
704
+ readonly connected: Promise<ConversationActiveState>;
692
705
  /**
693
706
  * Resolves when the subscription permanently stops receiving updates from the server.
694
707
  *
695
708
  * @remarks
696
709
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
697
710
  */
698
- terminated: Promise<UnsubscribedState | ErrorState>;
711
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
699
712
  /**
700
713
  * Unsubscribe from this resource and stop receiving updates.
701
714
  *
@@ -726,6 +739,10 @@ export declare interface CreateConversationParams {
726
739
  /**
727
740
  * System messages which are sent at the beginning of a conversation.
728
741
  * Default = no messages.
742
+ *
743
+ * @remarks
744
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
745
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
729
746
  */
730
747
  welcomeMessages?: string[];
731
748
  /**
@@ -807,6 +824,10 @@ export declare interface CreateUserParams {
807
824
  /**
808
825
  * The default message a person sees when starting a chat with this user.
809
826
  * Default = no welcome message
827
+ *
828
+ * @remarks
829
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
830
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
810
831
  */
811
832
  welcomeMessage?: string;
812
833
  /**
@@ -837,11 +858,11 @@ export declare interface CreateUserParams {
837
858
  * @public
838
859
  */
839
860
  export declare interface CustomEmojiNode {
840
- type: "customEmoji";
861
+ readonly type: "customEmoji";
841
862
  /**
842
863
  * The name (including colons at the start and end) of the custom emoji to show.
843
864
  */
844
- text: string;
865
+ readonly text: string;
845
866
  }
846
867
 
847
868
  /**
@@ -909,11 +930,11 @@ export declare interface EditTextMessageParams {
909
930
  * @public
910
931
  */
911
932
  export declare interface ErrorState {
912
- type: "error";
933
+ readonly type: "error";
913
934
  /**
914
935
  * The error that caused the subscription to be terminated
915
936
  */
916
- error: Error;
937
+ readonly error: Error;
917
938
  }
918
939
 
919
940
  /**
@@ -926,7 +947,7 @@ export declare interface FewTypingSnapshot {
926
947
  * @remarks
927
948
  * When `false`, you can see the list of users who are typing in the `users` property.
928
949
  */
929
- many: false;
950
+ readonly many: false;
930
951
  /**
931
952
  * The users who are currently typing in this conversation.
932
953
  *
@@ -934,7 +955,7 @@ export declare interface FewTypingSnapshot {
934
955
  * The list is in chronological order, starting with the users who have been typing the longest.
935
956
  * The current user is never contained in the list, only other users.
936
957
  */
937
- users: UserSnapshot[];
958
+ readonly users: UserSnapshot[];
938
959
  }
939
960
 
940
961
  /**
@@ -997,7 +1018,7 @@ export declare type FileBlock = VideoBlock | ImageBlock | AudioBlock | VoiceBloc
997
1018
  * @public
998
1019
  */
999
1020
  export declare type FileToken = string & {
1000
- __tag: Record<"TalkJS Encoded File Token", true>;
1021
+ readonly __tag: Record<"TalkJS Encoded File Token", true>;
1001
1022
  };
1002
1023
 
1003
1024
  /**
@@ -1025,27 +1046,27 @@ export declare type FileToken = string & {
1025
1046
  * @public
1026
1047
  */
1027
1048
  export declare interface GenericFileBlock {
1028
- type: "file";
1049
+ readonly type: "file";
1029
1050
  /**
1030
1051
  * Never set for generic file blocks.
1031
1052
  */
1032
- subtype?: never;
1053
+ readonly subtype?: never;
1033
1054
  /**
1034
1055
  * An encoded identifier for this file. Use in {@link SendFileBlock} to send this file in another message.
1035
1056
  */
1036
- fileToken: FileToken;
1057
+ readonly fileToken: FileToken;
1037
1058
  /**
1038
1059
  * The URL where you can fetch the file
1039
1060
  */
1040
- url: string;
1061
+ readonly url: string;
1041
1062
  /**
1042
1063
  * The size of the file in bytes
1043
1064
  */
1044
- size: number;
1065
+ readonly size: number;
1045
1066
  /**
1046
1067
  * The name of the file, including file extension
1047
1068
  */
1048
- filename: string;
1069
+ readonly filename: string;
1049
1070
  }
1050
1071
 
1051
1072
  export declare interface GenericFileMetadata {
@@ -1081,32 +1102,32 @@ export declare function getTalkSession(options: TalkSessionOptions): TalkSession
1081
1102
  * @public
1082
1103
  */
1083
1104
  export declare interface ImageBlock {
1084
- type: "file";
1085
- subtype: "image";
1105
+ readonly type: "file";
1106
+ readonly subtype: "image";
1086
1107
  /**
1087
1108
  * An encoded identifier for this file. Use in {@link SendFileBlock} to send this image in another message.
1088
1109
  */
1089
- fileToken: FileToken;
1110
+ readonly fileToken: FileToken;
1090
1111
  /**
1091
1112
  * The URL where you can fetch the file.
1092
1113
  */
1093
- url: string;
1114
+ readonly url: string;
1094
1115
  /**
1095
1116
  * The size of the file in bytes.
1096
1117
  */
1097
- size: number;
1118
+ readonly size: number;
1098
1119
  /**
1099
1120
  * The name of the image file, including file extension.
1100
1121
  */
1101
- filename: string;
1122
+ readonly filename: string;
1102
1123
  /**
1103
1124
  * The width of the image in pixels, if known.
1104
1125
  */
1105
- width?: number;
1126
+ readonly width?: number;
1106
1127
  /**
1107
1128
  * The height of the image in pixels, if known.
1108
1129
  */
1109
- height?: number;
1130
+ readonly height?: number;
1110
1131
  }
1111
1132
 
1112
1133
  export declare interface ImageFileMetadata {
@@ -1133,12 +1154,12 @@ export declare interface ImageFileMetadata {
1133
1154
  * @public
1134
1155
  */
1135
1156
  export declare interface LinkNode {
1136
- type: "link";
1157
+ readonly type: "link";
1137
1158
  /**
1138
1159
  * The URL to open when the node is clicked.
1139
1160
  */
1140
- url: string;
1141
- children: TextNode[];
1161
+ readonly url: string;
1162
+ readonly children: TextNode[];
1142
1163
  }
1143
1164
 
1144
1165
  /**
@@ -1151,7 +1172,7 @@ export declare interface LinkNode {
1151
1172
  * @public
1152
1173
  */
1153
1174
  export declare interface LocationBlock {
1154
- type: "location";
1175
+ readonly type: "location";
1155
1176
  /**
1156
1177
  * The north-south coordinate of the location.
1157
1178
  *
@@ -1160,7 +1181,7 @@ export declare interface LocationBlock {
1160
1181
  *
1161
1182
  * Must be a number between -90 and 90
1162
1183
  */
1163
- latitude: number;
1184
+ readonly latitude: number;
1164
1185
  /**
1165
1186
  * The east-west coordinate of the location.
1166
1187
  *
@@ -1169,7 +1190,7 @@ export declare interface LocationBlock {
1169
1190
  *
1170
1191
  * Must be a number between -180 and 180
1171
1192
  */
1172
- longitude: number;
1193
+ readonly longitude: number;
1173
1194
  }
1174
1195
 
1175
1196
  /**
@@ -1183,7 +1204,7 @@ export declare interface ManyTypingSnapshot {
1183
1204
  * When `true`, you do not receive a list of users who are typing.
1184
1205
  * You should show a message like "several people are typing" instead.
1185
1206
  */
1186
- many: true;
1207
+ readonly many: true;
1187
1208
  }
1188
1209
 
1189
1210
  /**
@@ -1201,8 +1222,8 @@ export declare interface MarkupNode {
1201
1222
  *
1202
1223
  * - `type: "strikethrough"` is used when users type `~text~` and is rendered with HTML `<s>`
1203
1224
  */
1204
- type: "bold" | "italic" | "strikethrough";
1205
- children: TextNode[];
1225
+ readonly type: "bold" | "italic" | "strikethrough";
1226
+ readonly children: TextNode[];
1206
1227
  }
1207
1228
 
1208
1229
  /**
@@ -1214,15 +1235,15 @@ export declare interface MarkupNode {
1214
1235
  * @public
1215
1236
  */
1216
1237
  export declare interface MentionNode {
1217
- type: "mention";
1238
+ readonly type: "mention";
1218
1239
  /**
1219
1240
  * The ID of the user who is mentioned.
1220
1241
  */
1221
- id: string;
1242
+ readonly id: string;
1222
1243
  /**
1223
1244
  * The name of the user who is mentioned.
1224
1245
  */
1225
- text: string;
1246
+ readonly text: string;
1226
1247
  }
1227
1248
 
1228
1249
  /**
@@ -1231,16 +1252,16 @@ export declare interface MentionNode {
1231
1252
  * @public
1232
1253
  */
1233
1254
  export declare interface MessageActiveState {
1234
- type: "active";
1255
+ readonly type: "active";
1235
1256
  /**
1236
1257
  * The most recently received snapshot for the messages, or `null` if you're not a participant in the conversation.
1237
1258
  */
1238
- latestSnapshot: MessageSnapshot[] | null;
1259
+ readonly latestSnapshot: MessageSnapshot[] | null;
1239
1260
  /**
1240
1261
  * True if `latestSnapshot` contains all messages in the conversation.
1241
1262
  * Use {@link MessageSubscription.loadMore} to load more.
1242
1263
  */
1243
- loadedAll: boolean;
1264
+ readonly loadedAll: boolean;
1244
1265
  }
1245
1266
 
1246
1267
  /**
@@ -1295,9 +1316,6 @@ export declare interface MessageRef {
1295
1316
  /**
1296
1317
  * Fetches a snapshot of the message.
1297
1318
  *
1298
- * @remarks
1299
- * Supports {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#cached-fetch | Cached Fetch}
1300
- *
1301
1319
  * @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.
1302
1320
  */
1303
1321
  get(): Promise<MessageSnapshot | null>;
@@ -1332,32 +1350,32 @@ export declare interface MessageSnapshot {
1332
1350
  /**
1333
1351
  * The unique ID that is used to identify the message in TalkJS
1334
1352
  */
1335
- id: string;
1353
+ readonly id: string;
1336
1354
  /**
1337
1355
  * Whether this message was "from a user" or a general system message without a specific sender.
1338
1356
  *
1339
1357
  * The `sender` property is always present for "UserMessage" messages and never present for "SystemMessage" messages.
1340
1358
  */
1341
- type: "UserMessage" | "SystemMessage";
1359
+ readonly type: "UserMessage" | "SystemMessage";
1342
1360
  /**
1343
1361
  * A snapshot of the user who sent the message, or null if it is a system message.
1344
1362
  * The user's attributes may have been updated since they sent the message, in which case this snapshot contains the updated data.
1345
1363
  * It is not a historical snapshot.
1346
1364
  */
1347
- sender: UserSnapshot | null;
1365
+ readonly sender: UserSnapshot | null;
1348
1366
  /**
1349
1367
  * Custom metadata you have set on the message
1350
1368
  */
1351
- custom: Record<string, string>;
1369
+ readonly custom: Record<string, string>;
1352
1370
  /**
1353
1371
  * Time at which the message was sent, as a unix timestamp in milliseconds
1354
1372
  */
1355
- createdAt: number;
1373
+ readonly createdAt: number;
1356
1374
  /**
1357
1375
  * Time at which the message was last edited, as a unix timestamp in milliseconds.
1358
1376
  * `null` if the message has never been edited.
1359
1377
  */
1360
- editedAt: number | null;
1378
+ readonly editedAt: number | null;
1361
1379
  /**
1362
1380
  * A snapshot of the message that this message is a reply to, or null if this message is not a reply.
1363
1381
  *
@@ -1367,7 +1385,7 @@ export declare interface MessageSnapshot {
1367
1385
  * Instead, it has `referencedMessageId`.
1368
1386
  * This prevents TalkJS fetching an unlimited number of messages in a long chain of replies.
1369
1387
  */
1370
- referencedMessage: ReferencedMessageSnapshot | null;
1388
+ readonly referencedMessage: ReferencedMessageSnapshot | null;
1371
1389
  /**
1372
1390
  * Where this message originated from:
1373
1391
  *
@@ -1379,23 +1397,23 @@ export declare interface MessageSnapshot {
1379
1397
  *
1380
1398
  * - "email" = Message sent by replying to an email notification
1381
1399
  */
1382
- origin: "web" | "rest" | "import" | "email";
1400
+ readonly origin: "web" | "rest" | "import" | "email";
1383
1401
  /**
1384
1402
  * The contents of the message, as a plain text string without any formatting or attachments.
1385
1403
  * Useful for showing in a conversation list or in notifications.
1386
1404
  */
1387
- plaintext: string;
1405
+ readonly plaintext: string;
1388
1406
  /**
1389
1407
  * The main body of the message, as a list of blocks that are rendered top-to-bottom.
1390
1408
  */
1391
- content: ContentBlock[];
1409
+ readonly content: ContentBlock[];
1392
1410
  /**
1393
1411
  * All the emoji reactions that have been added to this message.
1394
1412
  *
1395
1413
  * @remarks
1396
1414
  * There can be up to 50 different reactions on each message.
1397
1415
  */
1398
- reactions: ReactionSnapshot[];
1416
+ readonly reactions: ReactionSnapshot[];
1399
1417
  }
1400
1418
 
1401
1419
  /**
@@ -1439,14 +1457,14 @@ export declare interface MessageSubscription {
1439
1457
  *
1440
1458
  * The promise rejects if the subscription is terminated before it connects.
1441
1459
  */
1442
- connected: Promise<MessageActiveState>;
1460
+ readonly connected: Promise<MessageActiveState>;
1443
1461
  /**
1444
1462
  * Resolves when the subscription permanently stops receiving updates from the server.
1445
1463
  *
1446
1464
  * @remarks
1447
1465
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
1448
1466
  */
1449
- terminated: Promise<UnsubscribedState | ErrorState>;
1467
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
1450
1468
  /**
1451
1469
  * Expand the window to include older messages
1452
1470
  *
@@ -1475,16 +1493,16 @@ export declare interface MessageSubscription {
1475
1493
  * @public
1476
1494
  */
1477
1495
  export declare interface ParticipantActiveState {
1478
- type: "active";
1496
+ readonly type: "active";
1479
1497
  /**
1480
1498
  * The most recently received snapshot for the participants, or `null` if you are not a participant in that conversation.
1481
1499
  */
1482
- latestSnapshot: ParticipantSnapshot[] | null;
1500
+ readonly latestSnapshot: ParticipantSnapshot[] | null;
1483
1501
  /**
1484
1502
  * True if `latestSnapshot` contains all participants in the conversation.
1485
1503
  * Use {@link ParticipantSubscription.loadMore} to load more.
1486
1504
  */
1487
- loadedAll: boolean;
1505
+ readonly loadedAll: boolean;
1488
1506
  }
1489
1507
 
1490
1508
  /**
@@ -1523,9 +1541,6 @@ export declare interface ParticipantRef {
1523
1541
  /**
1524
1542
  * Sets properties of this participant. If the user is not already a participant in the conversation, they will be added.
1525
1543
  *
1526
- * @remarks
1527
- * Supports {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#automatic-batching | Automatic Batching}
1528
- *
1529
1544
  * @returns A promise that resolves when the operation completes.
1530
1545
  * When client-side conversation syncing is disabled, you must already be a participant and you cannot set anything except the `notify` property.
1531
1546
  * Everything else requires client-side conversation syncing to be enabled, and will cause the promise to reject.
@@ -1534,9 +1549,6 @@ export declare interface ParticipantRef {
1534
1549
  /**
1535
1550
  * Edits properties of a pre-existing participant. If the user is not already a participant in the conversation, the promise will reject.
1536
1551
  *
1537
- * @remarks
1538
- * Supports {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#automatic-batching | Automatic Batching}
1539
- *
1540
1552
  * @returns A promise that resolves when the operation completes.
1541
1553
  * When client-side conversation syncing is disabled, you must already be a participant and you cannot set anything except the `notify` property.
1542
1554
  * Everything else requires client-side conversation syncing to be enabled, and will cause the promise to reject.
@@ -1548,8 +1560,6 @@ export declare interface ParticipantRef {
1548
1560
  * @remarks
1549
1561
  * If the participant already exists, this operation is still considered successful and the promise will still resolve.
1550
1562
  *
1551
- * Supports {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#automatic-batching | Automatic Batching}
1552
- *
1553
1563
  * @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.
1554
1564
  */
1555
1565
  createIfNotExists(params?: CreateParticipantParams): Promise<void>;
@@ -1578,22 +1588,22 @@ export declare interface ParticipantSnapshot {
1578
1588
  /**
1579
1589
  * The user who this participant snapshot is referring to
1580
1590
  */
1581
- user: UserSnapshot;
1591
+ readonly user: UserSnapshot;
1582
1592
  /**
1583
1593
  * The level of access this participant has in the conversation.
1584
1594
  */
1585
- access: "ReadWrite" | "Read";
1595
+ readonly access: "ReadWrite" | "Read";
1586
1596
  /**
1587
1597
  * When the participant will be notified about new messages in this conversation.
1588
1598
  *
1589
1599
  * @remarks
1590
1600
  * `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 `@`.
1591
1601
  */
1592
- notify: boolean | "MentionsOnly";
1602
+ readonly notify: boolean | "MentionsOnly";
1593
1603
  /**
1594
1604
  * The date that this user joined the conversation, as a unix timestamp in milliseconds.
1595
1605
  */
1596
- joinedAt: number;
1606
+ readonly joinedAt: number;
1597
1607
  }
1598
1608
 
1599
1609
  /**
@@ -1638,14 +1648,14 @@ export declare interface ParticipantSubscription {
1638
1648
  *
1639
1649
  * The promise rejects if the subscription is terminated before it connects.
1640
1650
  */
1641
- connected: Promise<ParticipantActiveState>;
1651
+ readonly connected: Promise<ParticipantActiveState>;
1642
1652
  /**
1643
1653
  * Resolves when the subscription permanently stops receiving updates from the server.
1644
1654
  *
1645
1655
  * @remarks
1646
1656
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
1647
1657
  */
1648
- terminated: Promise<UnsubscribedState | ErrorState>;
1658
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
1649
1659
  /**
1650
1660
  * Expand the window to include older participants
1651
1661
  *
@@ -1674,7 +1684,7 @@ export declare interface ParticipantSubscription {
1674
1684
  * @public
1675
1685
  */
1676
1686
  export declare interface PendingState {
1677
- type: "pending";
1687
+ readonly type: "pending";
1678
1688
  }
1679
1689
 
1680
1690
  /**
@@ -1776,15 +1786,15 @@ export declare interface ReactionSnapshot {
1776
1786
  * @example Custom emoji
1777
1787
  * ":cat-roomba:"
1778
1788
  */
1779
- emoji: string;
1789
+ readonly emoji: string;
1780
1790
  /**
1781
1791
  * The number of times this emoji has been added to the message.
1782
1792
  */
1783
- count: number;
1793
+ readonly count: number;
1784
1794
  /**
1785
1795
  * Whether the current user has reacted to the message with this emoji.
1786
1796
  */
1787
- currentUserReacted: boolean;
1797
+ readonly currentUserReacted: boolean;
1788
1798
  }
1789
1799
 
1790
1800
  /**
@@ -1803,11 +1813,11 @@ export declare interface ReferencedMessageSnapshot {
1803
1813
  /**
1804
1814
  * The unique ID that is used to identify the message in TalkJS
1805
1815
  */
1806
- id: string;
1816
+ readonly id: string;
1807
1817
  /**
1808
1818
  * Referenced messages are always "UserMessage" because you cannot reply to a system message.
1809
1819
  */
1810
- type: "UserMessage";
1820
+ readonly type: "UserMessage";
1811
1821
  /**
1812
1822
  * A snapshot of the user who sent the message.
1813
1823
  * The user's attributes may have been updated since they sent the message, in which case this snapshot contains the updated data.
@@ -1816,20 +1826,20 @@ export declare interface ReferencedMessageSnapshot {
1816
1826
  * @remarks
1817
1827
  * Guaranteed to be set, unlike in MessageSnapshot, because you cannot reference a SystemMessage
1818
1828
  */
1819
- sender: UserSnapshot;
1829
+ readonly sender: UserSnapshot;
1820
1830
  /**
1821
1831
  * Custom metadata you have set on the message
1822
1832
  */
1823
- custom: Record<string, string>;
1833
+ readonly custom: Record<string, string>;
1824
1834
  /**
1825
1835
  * Time at which the message was sent, as a unix timestamp in milliseconds
1826
1836
  */
1827
- createdAt: number;
1837
+ readonly createdAt: number;
1828
1838
  /**
1829
1839
  * Time at which the message was last edited, as a unix timestamp in milliseconds.
1830
1840
  * `null` if the message has never been edited.
1831
1841
  */
1832
- editedAt: number | null;
1842
+ readonly editedAt: number | null;
1833
1843
  /**
1834
1844
  * The ID of the message that this message is a reply to, or null if this message is not a reply.
1835
1845
  *
@@ -1837,7 +1847,7 @@ export declare interface ReferencedMessageSnapshot {
1837
1847
  * Since this is a snapshot of a referenced message, we do not automatically expand its referenced message.
1838
1848
  * The ID of its referenced message is provided here instead.
1839
1849
  */
1840
- referencedMessageId: string | null;
1850
+ readonly referencedMessageId: string | null;
1841
1851
  /**
1842
1852
  * Where this message originated from:
1843
1853
  *
@@ -1849,20 +1859,20 @@ export declare interface ReferencedMessageSnapshot {
1849
1859
  *
1850
1860
  * - "email" = Message sent by replying to an email notification
1851
1861
  */
1852
- origin: "web" | "rest" | "import" | "email";
1862
+ readonly origin: "web" | "rest" | "import" | "email";
1853
1863
  /**
1854
1864
  * The contents of the message, as a plain text string without any formatting or attachments.
1855
1865
  * Useful for showing in a conversation list or in notifications.
1856
1866
  */
1857
- plaintext: string;
1867
+ readonly plaintext: string;
1858
1868
  /**
1859
1869
  * The main body of the message, as a list of blocks that are rendered top-to-bottom.
1860
1870
  */
1861
- content: ContentBlock[];
1871
+ readonly content: ContentBlock[];
1862
1872
  /**
1863
1873
  * All the emoji reactions that have been added to this message.
1864
1874
  */
1865
- reactions: ReactionSnapshot[];
1875
+ readonly reactions: ReactionSnapshot[];
1866
1876
  }
1867
1877
 
1868
1878
  export declare function registerPolyfills({ WebSocket }: {
@@ -2005,6 +2015,10 @@ export declare interface SetConversationParams {
2005
2015
  /**
2006
2016
  * System messages which are sent at the beginning of a conversation.
2007
2017
  * Default = no messages.
2018
+ *
2019
+ * @remarks
2020
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
2021
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
2008
2022
  */
2009
2023
  welcomeMessages?: string[] | null;
2010
2024
  /**
@@ -2090,6 +2104,10 @@ export declare interface SetUserParams {
2090
2104
  /**
2091
2105
  * The default message a person sees when starting a chat with this user.
2092
2106
  * Default = no welcome message
2107
+ *
2108
+ * @remarks
2109
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
2110
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
2093
2111
  */
2094
2112
  welcomeMessage?: string | null;
2095
2113
  /**
@@ -2347,8 +2365,8 @@ export declare interface TalkSessionOptions {
2347
2365
  * @public
2348
2366
  */
2349
2367
  export declare interface TextBlock {
2350
- type: "text";
2351
- children: TextNode[];
2368
+ readonly type: "text";
2369
+ readonly children: TextNode[];
2352
2370
  }
2353
2371
 
2354
2372
  /**
@@ -2395,11 +2413,11 @@ export declare type TextNode = string | MarkupNode | BulletListNode | BulletPoin
2395
2413
  * @public
2396
2414
  */
2397
2415
  export declare interface TypingActiveState {
2398
- type: "active";
2416
+ readonly type: "active";
2399
2417
  /**
2400
2418
  * The most recently received typing indicator snapshot, or `null` if you are not a participant in the conversation (including when the conversation does not exist).
2401
2419
  */
2402
- latestSnapshot: TypingSnapshot | null;
2420
+ readonly latestSnapshot: TypingSnapshot | null;
2403
2421
  }
2404
2422
 
2405
2423
  /**
@@ -2474,14 +2492,14 @@ export declare interface TypingSubscription {
2474
2492
  *
2475
2493
  * The promise rejects if the subscription is terminated before it connects.
2476
2494
  */
2477
- connected: Promise<TypingActiveState>;
2495
+ readonly connected: Promise<TypingActiveState>;
2478
2496
  /**
2479
2497
  * Resolves when the subscription permanently stops receiving updates from the server.
2480
2498
  *
2481
2499
  * @remarks
2482
2500
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
2483
2501
  */
2484
- terminated: Promise<UnsubscribedState | ErrorState>;
2502
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
2485
2503
  /**
2486
2504
  * Unsubscribe from this resource and stop receiving updates.
2487
2505
  *
@@ -2497,7 +2515,7 @@ export declare interface TypingSubscription {
2497
2515
  * @public
2498
2516
  */
2499
2517
  export declare interface UnsubscribedState {
2500
- type: "unsubscribed";
2518
+ readonly type: "unsubscribed";
2501
2519
  }
2502
2520
 
2503
2521
  /**
@@ -2506,11 +2524,11 @@ export declare interface UnsubscribedState {
2506
2524
  * @public
2507
2525
  */
2508
2526
  export declare interface UserActiveState {
2509
- type: "active";
2527
+ readonly type: "active";
2510
2528
  /**
2511
2529
  * The most recently received snapshot for the user, or `null` if the user does not exist yet.
2512
2530
  */
2513
- latestSnapshot: UserSnapshot | null;
2531
+ readonly latestSnapshot: UserSnapshot | null;
2514
2532
  }
2515
2533
 
2516
2534
  /**
@@ -2519,11 +2537,11 @@ export declare interface UserActiveState {
2519
2537
  * @public
2520
2538
  */
2521
2539
  export declare interface UserOnlineActiveState {
2522
- type: "active";
2540
+ readonly type: "active";
2523
2541
  /**
2524
2542
  * The most recently received snapshot
2525
2543
  */
2526
- latestSnapshot: UserOnlineSnapshot | null;
2544
+ readonly latestSnapshot: UserOnlineSnapshot | null;
2527
2545
  }
2528
2546
 
2529
2547
  /**
@@ -2538,7 +2556,7 @@ export declare interface UserOnlineSnapshot {
2538
2556
  /**
2539
2557
  * The user this snapshot relates to
2540
2558
  */
2541
- user: UserSnapshot;
2559
+ readonly user: UserSnapshot;
2542
2560
  /**
2543
2561
  * Whether the user is connected right now
2544
2562
  *
@@ -2553,7 +2571,7 @@ export declare interface UserOnlineSnapshot {
2553
2571
  *
2554
2572
  * People using the {@link https://talkjs.com/docs/Reference/JavaScript_Chat_SDK/ | JavaScript SDK}, {@link https://talkjs.com/docs/Reference/React_SDK/Installation/ | React SDK}, {@link https://talkjs.com/docs/Reference/React_Native_SDK/Installation/ | React Native SDK}, or {@link https://talkjs.com/docs/Reference/Flutter_SDK/Installation/ | Flutter SDK} are considered connected whenever they have an active `Session` object.
2555
2573
  */
2556
- isConnected: boolean;
2574
+ readonly isConnected: boolean;
2557
2575
  }
2558
2576
 
2559
2577
  /**
@@ -2589,14 +2607,14 @@ export declare interface UserOnlineSubscription {
2589
2607
  *
2590
2608
  * The promise rejects if the subscription is terminated before it connects.
2591
2609
  */
2592
- connected: Promise<UserOnlineActiveState>;
2610
+ readonly connected: Promise<UserOnlineActiveState>;
2593
2611
  /**
2594
2612
  * Resolves when the subscription permanently stops receiving updates from the server.
2595
2613
  *
2596
2614
  * @remarks
2597
2615
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
2598
2616
  */
2599
- terminated: Promise<UnsubscribedState | ErrorState>;
2617
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
2600
2618
  /**
2601
2619
  * Unsubscribe from this resource and stop receiving updates.
2602
2620
  *
@@ -2631,8 +2649,6 @@ export declare interface UserRef {
2631
2649
  * Fetching a user snapshot doesn't require any permissions. You can read the public information of any user.
2632
2650
  * Private information, such as email addresses and phone numbers, aren't included in the response.
2633
2651
  *
2634
- * Supports {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#automatic-batching | Automatic Batching} and {@link https://talkjs.com/docs/Reference/JavaScript_Data_API/Performance/#cached-fetch | Cached Fetch}
2635
- *
2636
2652
  * @returns A snapshot of the user's public attributes, or null if the user doesn't exist.
2637
2653
  */
2638
2654
  get(): Promise<UserSnapshot | null>;
@@ -2692,35 +2708,39 @@ export declare interface UserSnapshot {
2692
2708
  /**
2693
2709
  * The unique ID that is used to identify the user in TalkJS
2694
2710
  */
2695
- id: string;
2711
+ readonly id: string;
2696
2712
  /**
2697
2713
  * The user's name, which is displayed on the TalkJS UI
2698
2714
  */
2699
- name: string;
2715
+ readonly name: string;
2700
2716
  /**
2701
2717
  * Custom metadata you have set on the user
2702
2718
  */
2703
- custom: Record<string, string>;
2719
+ readonly custom: Record<string, string>;
2704
2720
  /**
2705
2721
  * An {@link https://www.w3.org/International/articles/language-tags/ | IETF language tag}.
2706
2722
  * For more information, see: {@link https://talkjs.com/docs/Features/Language_Support/Localization.html | Localization}.
2707
2723
  *
2708
2724
  * When `locale` is null, the app's default locale will be used
2709
2725
  */
2710
- locale: string | null;
2726
+ readonly locale: string | null;
2711
2727
  /**
2712
2728
  * An optional URL to a photo that is displayed as the user's avatar
2713
2729
  */
2714
- photoUrl: string | null;
2730
+ readonly photoUrl: string | null;
2715
2731
  /**
2716
2732
  * TalkJS supports multiple sets of settings for users, called "roles". Roles allow you to change the behavior of TalkJS for different users.
2717
2733
  * You have full control over which user gets which configuration.
2718
2734
  */
2719
- role: string;
2735
+ readonly role: string;
2720
2736
  /**
2721
2737
  * The default message a person sees when starting a chat with this user
2738
+ *
2739
+ * @remarks
2740
+ * Welcome messages are rendered in the UI as messages, but they are not real messages.
2741
+ * This means they do not appear when you list messages using the REST API or JS Data API, and you cannot reply or react to them.
2722
2742
  */
2723
- welcomeMessage: string | null;
2743
+ readonly welcomeMessage: string | null;
2724
2744
  }
2725
2745
 
2726
2746
  /**
@@ -2750,14 +2770,14 @@ export declare interface UserSubscription {
2750
2770
  /**
2751
2771
  * Resolves when the subscription starts receiving updates from the server.
2752
2772
  */
2753
- connected: Promise<UserActiveState>;
2773
+ readonly connected: Promise<UserActiveState>;
2754
2774
  /**
2755
2775
  * Resolves when the subscription permanently stops receiving updates from the server.
2756
2776
  *
2757
2777
  * @remarks
2758
2778
  * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
2759
2779
  */
2760
- terminated: Promise<UnsubscribedState | ErrorState>;
2780
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
2761
2781
  /**
2762
2782
  * Unsubscribe from this resource and stop receiving updates.
2763
2783
  *
@@ -2782,36 +2802,36 @@ export declare interface UserSubscription {
2782
2802
  * @public
2783
2803
  */
2784
2804
  export declare interface VideoBlock {
2785
- type: "file";
2786
- subtype: "video";
2805
+ readonly type: "file";
2806
+ readonly subtype: "video";
2787
2807
  /**
2788
2808
  * An encoded identifier for this file. Use in {@link SendFileBlock} to send this video in another message.
2789
2809
  */
2790
- fileToken: FileToken;
2810
+ readonly fileToken: FileToken;
2791
2811
  /**
2792
2812
  * The URL where you can fetch the file.
2793
2813
  */
2794
- url: string;
2814
+ readonly url: string;
2795
2815
  /**
2796
2816
  * The size of the file in bytes.
2797
2817
  */
2798
- size: number;
2818
+ readonly size: number;
2799
2819
  /**
2800
2820
  * The name of the video file, including file extension.
2801
2821
  */
2802
- filename: string;
2822
+ readonly filename: string;
2803
2823
  /**
2804
2824
  * The width of the video in pixels, if known.
2805
2825
  */
2806
- width?: number;
2826
+ readonly width?: number;
2807
2827
  /**
2808
2828
  * The height of the video in pixels, if known.
2809
2829
  */
2810
- height?: number;
2830
+ readonly height?: number;
2811
2831
  /**
2812
2832
  * The duration of the video in seconds, if known.
2813
2833
  */
2814
- duration?: number;
2834
+ readonly duration?: number;
2815
2835
  }
2816
2836
 
2817
2837
  export declare interface VideoFileMetadata {
@@ -2853,28 +2873,28 @@ export declare interface VideoFileMetadata {
2853
2873
  * @public
2854
2874
  */
2855
2875
  export declare interface VoiceBlock {
2856
- type: "file";
2857
- subtype: "voice";
2876
+ readonly type: "file";
2877
+ readonly subtype: "voice";
2858
2878
  /**
2859
2879
  * An encoded identifier for this file. Use in {@link SendFileBlock} to send this voice recording in another message.
2860
2880
  */
2861
- fileToken: FileToken;
2881
+ readonly fileToken: FileToken;
2862
2882
  /**
2863
2883
  * The URL where you can fetch the file
2864
2884
  */
2865
- url: string;
2885
+ readonly url: string;
2866
2886
  /**
2867
2887
  * The size of the file in bytes
2868
2888
  */
2869
- size: number;
2889
+ readonly size: number;
2870
2890
  /**
2871
2891
  * The name of the file, including file extension
2872
2892
  */
2873
- filename: string;
2893
+ readonly filename: string;
2874
2894
  /**
2875
2895
  * The duration of the voice recording in seconds, if known
2876
2896
  */
2877
- duration?: number;
2897
+ readonly duration?: number;
2878
2898
  }
2879
2899
 
2880
2900
  export declare interface VoiceRecordingFileMetadata {