easemob-websdk 4.1.7 → 4.2.0

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/CHANGELOG.md CHANGED
@@ -1,33 +1,43 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ # 4.2.0 (Jul 27, 2023)
4
+
5
+ - Adds editing message after sent function
6
+ - Adds message merging and forwarding function
7
+ - Fix sending unnecessary delivery messages
8
+
3
9
  # 4.1.7 (Jun 8, 2023)
10
+
4
11
  - Adds the `pinConversation` method to pin or unpin a conversation.
5
12
  - Adds the `getServerPinnedConversations` method to gets the list of pinned conversations from the server with pagination.
6
- - Adds the `getServerConversations` method to get the sorted list of conversations from the server with pagination.
13
+ - Adds the `getServerConversations` method to get the sorted list of conversations from the server with pagination.
7
14
  - Adds the feature of sending targeted messages in a group or chat room conversation by adding the `receiverList` parameter to the `create` method.
8
15
  - Adds the `isLast` parameter to the `getHistoryMessages` method to indicate whether the returned data is that of the last page.
9
16
  - Adds the `thumbnailWidth` and `thumbnailHeight` parameters to the `create` method to allow you to set the width and height of the thumbnail when sending an image.
10
- - Adds the following errors to error codes 2 (WEBIM_CONNCTION_AUTH_ERROR) and 50 (MAX_LIMIT) and to explain the reasons for SDK login failures on the console:
11
- - Error code 50: The number of daily active users (DAU) has exceeded the upper limit; the number of online users has exceeds the upper limit; the number of monthly active users (MAU) has exceeded the upper limit.
12
- - Error code 2: The token is invalid.
13
- - Adds success and failure callbacks (Promise) for the execution of the following methods:
14
- - addContact: Adds a contact.
15
- - deleteContact: Deletes a contact.
16
- - acceptContactInvite: Accepts a friend request.
17
- - declineContactInvite: Rejects a friend request.
18
- - addUsersToBlocklist: Adds a friend to the block list.
19
- - removeUserFromBlocklist: Removes a friend from the block list.
17
+ - Adds the following errors to error codes 2 (WEBIM_CONNCTION_AUTH_ERROR) and 50 (MAX_LIMIT) and to explain the reasons for SDK login failures on the console:
18
+ - Error code 50: The number of daily active users (DAU) has exceeded the upper limit; the number of online users has exceeds the upper limit; the number of monthly active users (MAU) has exceeded the upper limit.
19
+ - Error code 2: The token is invalid.
20
+ - Adds success and failure callbacks (Promise) for the execution of the following methods:
21
+ - addContact: Adds a contact.
22
+ - deleteContact: Deletes a contact.
23
+ - acceptContactInvite: Accepts a friend request.
24
+ - declineContactInvite: Rejects a friend request.
25
+ - addUsersToBlocklist: Adds a friend to the block list.
26
+ - removeUserFromBlocklist: Removes a friend from the block list.
27
+
20
28
  ## 4.1.5 (April 13, 2023)
21
29
 
22
- - Adds four parameters, `from`, `msgTypes`, `startTime`, and `endTime` in `searchOptions` in the ` getHistoryMessages` method to allow you to retrieve historical messages from the server by message sender, message type, or period.
30
+ - Adds four parameters, `from`, `msgTypes`, `startTime`, and `endTime` in `searchOptions` in the ` getHistoryMessages` method to allow you to retrieve historical messages from the server by message sender, message type, or period.
23
31
 
24
32
  Adds The error code 511, MESSAGE_SIZE_LIMIT, to notify you when the size of the message body exceeds the upper limit.
33
+
25
34
  ## 4.1.4 (Mar 16, 2023)
26
35
 
27
36
  - Add Group Member Attributes feature
28
37
  - Fix `getHistoryMessages` catch error failed
29
38
  - Optimize the implementation of chat room join and leave to improve performance
30
39
  - Add `deliverOnlineOnly` field in the message creation parameters
40
+
31
41
  ## 4.1.3 (Feb 20, 2023)
32
42
 
33
43
  - `getConversationlist` Getting the conversation list supports paging
package/Easemob-chat.d.ts CHANGED
@@ -57,6 +57,30 @@ export declare namespace EasemobChat {
57
57
  jid: Jid;
58
58
  }
59
59
 
60
+ interface SendMsgResult {
61
+ /** The message local ID. */
62
+ localMsgId: string;
63
+ /** The ID of the message on the server. */
64
+ serverMsgId: string;
65
+ }
66
+
67
+ /** The modified message. */
68
+ type ModifiedMsg = TextMsgBody;
69
+
70
+ interface ModifyMsgResult extends SendMsgResult {
71
+ /** The modified message. */
72
+ message: ModifiedMsg;
73
+ }
74
+
75
+ interface ModifiedMsgInfo {
76
+ /** Gets the user ID of the operator that modified the message last time. */
77
+ operatorId: string;
78
+ /** Gets the number of times a message is modified. A message can be modified at most five times.*/
79
+ operationCount: number;
80
+ /** Gets the UNIX timestamp of the last message modification, in milliseconds. */
81
+ operationTime: number;
82
+ }
83
+
60
84
  // eventHandle types
61
85
  type OnPresenceMsgType =
62
86
  | 'rmChatRoomMute'
@@ -1216,6 +1240,8 @@ export declare namespace EasemobChat {
1216
1240
  WEBIM_UPLOADFILE_NO_LOGIN = 102,
1217
1241
  /** File-downloading failed. */
1218
1242
  WEBIM_DOWNLOADFILE_ERROR = 200,
1243
+ /** Parse file failed. */
1244
+ PARSE_FILE_ERROR = 203,
1219
1245
  /** User does not found. */
1220
1246
  USER_NOT_FOUND = 204,
1221
1247
  /** The user is logged in on another device. */
@@ -4368,6 +4394,35 @@ export declare namespace EasemobChat {
4368
4394
  }
4369
4395
  ): Promise<SendMsgResult>;
4370
4396
 
4397
+ /**
4398
+ * Modifies a message on the server.
4399
+ *
4400
+ * This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.
4401
+ *
4402
+ * Upon a message modification, the callback `onModifiedMessage` will be received by the message recipient(s) and in multi-device login scenarios.
4403
+ *
4404
+ * ```typescript
4405
+ *
4406
+ * const textMessage = WebIM.message.create({
4407
+ * type: "txt",
4408
+ * msg: "message content",
4409
+ * to: "username",
4410
+ * chatType: "singleChat",
4411
+ * });
4412
+ *
4413
+ * connection.modifyMessage({ messageId: 'messageId', message: textMessage })
4414
+ * ```
4415
+ */
4416
+ modifyMessage(
4417
+ this: Connection,
4418
+ option: {
4419
+ /** The ID of the message to modify.*/
4420
+ messageId: string;
4421
+ /** The modified message.*/
4422
+ modifiedMessage: ModifiedMsg;
4423
+ }
4424
+ ): Promise<ModifyMsgResult>;
4425
+
4371
4426
  // listen @deprecated
4372
4427
  listen(this: Connection, parameters: ListenParameters): void;
4373
4428
 
@@ -5261,6 +5316,7 @@ export declare namespace EasemobChat {
5261
5316
  | 'onContactChange'
5262
5317
  | 'onPresenceStatusChange'
5263
5318
  | 'onReactionChange'
5319
+ | 'onModifiedMessage'
5264
5320
  | 'onChatThreadChange'
5265
5321
  | 'onMultiDeviceEvent'
5266
5322
  | 'onGroupEvent'
@@ -5421,6 +5477,8 @@ export declare namespace EasemobChat {
5421
5477
  onRecallMessage?: (msg: RecallMsgBody) => void;
5422
5478
  /** The callback to receive a session read ack. */
5423
5479
  onChannelMessage?: (msg: ChannelMsgBody) => void;
5480
+ /** Occurs when the message content is modified. */
5481
+ onModifiedMessage?: (msg: ModifiedMsg) => void;
5424
5482
  /** The callback to receive error. */
5425
5483
  onError?: (error: ErrorEvent) => void;
5426
5484
  /** The callback for network disconnection. */
@@ -5945,7 +6003,7 @@ export declare namespace EasemobChat {
5945
6003
  /** Whether the message is a thread message. */
5946
6004
  isChatThread?: boolean;
5947
6005
  /** The reaction to be added to the message. The length is limited to 128 characters. */
5948
- reactions?: Reaction;
6006
+ reactions?: Reaction[];
5949
6007
  /** The message thread. */
5950
6008
  chatThread?: ChatThread;
5951
6009
  /** The message thread overview. */
@@ -5959,8 +6017,9 @@ export declare namespace EasemobChat {
5959
6017
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
5960
6018
  */
5961
6019
  deliverOnlineOnly?: boolean;
6020
+ /** Message modified info. */
6021
+ modifiedInfo?: ModifiedMsgInfo;
5962
6022
  /** The list of message recipients. */
5963
- /** 消息接收方列表。 */
5964
6023
  receiverList?: string[];
5965
6024
  }
5966
6025
 
@@ -5989,10 +6048,113 @@ export declare namespace EasemobChat {
5989
6048
  */
5990
6049
  deliverOnlineOnly?: boolean;
5991
6050
  /** The list of message recipients. */
5992
- /** 消息接收方列表。 */
5993
6051
  receiverList?: string[];
5994
6052
  }
5995
6053
 
6054
+ interface CombineMsgBody {
6055
+ /** The message ID. */
6056
+ id: string;
6057
+ /** The session type. */
6058
+ chatType: ChatType;
6059
+ /** The message type. */
6060
+ type: 'combine';
6061
+ /** The recipient. */
6062
+ to: string;
6063
+ /** The sender, which can only be the current user and can not be changed.*/
6064
+ from?: string;
6065
+ /** Message extension. */
6066
+ ext?: { [key: string]: any };
6067
+ /** Whether read receipts are required during a group session. */
6068
+ msgConfig?: {
6069
+ allowGroupAck?: boolean;
6070
+ languages?: string[];
6071
+ };
6072
+ /** Time. */
6073
+ time: number;
6074
+ /** Whether the message is a thread message. */
6075
+ isChatThread?: boolean;
6076
+ /** Message priority. */
6077
+ priority?: MessagePriority;
6078
+ /** Whether the message is delivered only when the recipient(s) is/are online:
6079
+ * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6080
+ * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
6081
+ */
6082
+ deliverOnlineOnly?: boolean;
6083
+ /** The list of message recipients. */
6084
+ receiverList?: string[];
6085
+ /** The file URL. */
6086
+ url?: string;
6087
+ /** The secret key required to download the file. */
6088
+ secret?: string;
6089
+ /** The size of the file. */
6090
+ file_length?: number;
6091
+ /** The file type. */
6092
+ filename: string;
6093
+ /** The title of the merged messages. */
6094
+ title: string;
6095
+ /** The summary list of merged messages. */
6096
+ summary: string;
6097
+ /** The reactions list of the message. */
6098
+ reactions?: Reaction[];
6099
+ /** The information of thread message. */
6100
+ chatThread?: ChatThread;
6101
+ /** The overview of thread message. */
6102
+ chatThreadOverview?: ChatThreadOverview;
6103
+ /** The online state. */
6104
+ onlineState?: ONLINESTATETYPE;
6105
+ /** Compatibility information for merging messages. */
6106
+ compatibleText: string;
6107
+ /** The level of the merged message. */
6108
+ combineLevel: number;
6109
+ /** The callback of a file upload error. */
6110
+ onFileUploadError?: (error: any) => void;
6111
+ /** The callback of file upload completion. */
6112
+ onFileUploadComplete?: (data: { url: string; secret: string }) => void;
6113
+ }
6114
+
6115
+ type CombineMsgList = Exclude<
6116
+ MessagesType,
6117
+ DeliveryMsgBody | ReadMsgBody | ChannelMsgBody
6118
+ >[];
6119
+
6120
+ interface CreateCombineMsgParameters {
6121
+ /** The conversation type. */
6122
+ chatType: ChatType;
6123
+ /** The message type. */
6124
+ type: 'combine';
6125
+ /** The recipient. */
6126
+ to: string;
6127
+ /** The sender, which can only be the current user and can not be changed. */
6128
+ from?: string;
6129
+ /** The message extension. */
6130
+ ext?: { [key: string]: any };
6131
+ /** Whether read receipts are required during a group session. */
6132
+ msgConfig?: { allowGroupAck?: boolean; languages?: string[] };
6133
+ /** Whether the message is a thread message. */
6134
+ isChatThread?: boolean;
6135
+ /** Message priority. */
6136
+ priority?: MessagePriority;
6137
+ /** Whether the message is delivered only when the recipient(s) is/are online:
6138
+ * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6139
+ * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
6140
+ */
6141
+ deliverOnlineOnly?: boolean;
6142
+ /** The list of message recipients. */
6143
+ receiverList?: string[];
6144
+ /** Compatibility information for merging messages. */
6145
+ compatibleText: string;
6146
+ /** The title of the merged messages. */
6147
+ title: string;
6148
+ /** The summary list of merged messages. */
6149
+ summary: string;
6150
+ /** The list of merged messages. */
6151
+ messageList: CombineMsgList;
6152
+ /** The callback of a file upload error. */
6153
+ onFileUploadError?: (error: any) => void;
6154
+ /** The callback of file upload completion. */
6155
+ onFileUploadComplete?: (data: { url: string; secret: string }) => void;
6156
+ }
6157
+
5996
6158
  interface CmdParameters {
5997
6159
  /** The message type. */
5998
6160
  type: 'cmd';
@@ -6048,7 +6210,7 @@ export declare namespace EasemobChat {
6048
6210
  /** Whether the message is a thread message. */
6049
6211
  isChatThread?: boolean;
6050
6212
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6051
- reactions?: Reaction;
6213
+ reactions?: Reaction[];
6052
6214
  /** The message thread. */
6053
6215
  chatThread?: ChatThread;
6054
6216
  /** The message thread overview. */
@@ -6158,7 +6320,7 @@ export declare namespace EasemobChat {
6158
6320
  /** Whether the message is a thread message. */
6159
6321
  isChatThread?: boolean;
6160
6322
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6161
- reactions?: Reaction;
6323
+ reactions?: Reaction[];
6162
6324
  /** The message thread. */
6163
6325
  chatThread?: ChatThread;
6164
6326
  /** The message thread overview. */
@@ -6276,7 +6438,7 @@ export declare namespace EasemobChat {
6276
6438
  /** Whether the message is a thread message. */
6277
6439
  isChatThread?: boolean;
6278
6440
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6279
- reactions?: Reaction;
6441
+ reactions?: Reaction[];
6280
6442
  /** The message thread. */
6281
6443
  chatThread?: ChatThread;
6282
6444
  /** The message thread overview. */
@@ -6418,7 +6580,7 @@ export declare namespace EasemobChat {
6418
6580
  /** Time. */
6419
6581
  time: number;
6420
6582
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6421
- reactions?: Reaction;
6583
+ reactions?: Reaction[];
6422
6584
  /** The message thread. */
6423
6585
  chatThread?: ChatThread;
6424
6586
  /** The message thread overview. */
@@ -6557,7 +6719,7 @@ export declare namespace EasemobChat {
6557
6719
  /** Whether the message is a thread message. */
6558
6720
  isChatThread?: boolean;
6559
6721
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6560
- reactions?: Reaction;
6722
+ reactions?: Reaction[];
6561
6723
  /** The message thread. */
6562
6724
  chatThread?: ChatThread;
6563
6725
  /** The message thread overview. */
@@ -6706,7 +6868,7 @@ export declare namespace EasemobChat {
6706
6868
  /** Whether the message is a thread message. */
6707
6869
  isChatThread?: boolean;
6708
6870
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6709
- reactions?: Reaction;
6871
+ reactions?: Reaction[];
6710
6872
  /** The message thread. */
6711
6873
  chatThread?: ChatThread;
6712
6874
  /** The message thread overview. */
@@ -6849,7 +7011,7 @@ export declare namespace EasemobChat {
6849
7011
  /** Whether the message is a thread message. */
6850
7012
  isChatThread?: boolean;
6851
7013
  /** The reaction to be added to the message. The length is limited to 128 characters. */
6852
- reactions?: Reaction;
7014
+ reactions?: Reaction[];
6853
7015
  /** The message thread. */
6854
7016
  chatThread?: ChatThread;
6855
7017
  /** The message thread overview. */
@@ -6979,7 +7141,8 @@ export declare namespace EasemobChat {
6979
7141
  | AudioMsgBody
6980
7142
  | VideoMsgBody
6981
7143
  | FileMsgBody
6982
- | ReadMsgBody;
7144
+ | ReadMsgBody
7145
+ | CombineMsgBody;
6983
7146
 
6984
7147
  type MessageSetParameters =
6985
7148
  | ReadMsgSetParameters
@@ -7005,7 +7168,8 @@ export declare namespace EasemobChat {
7005
7168
  | CreateChannelMsgParameters
7006
7169
  | CreateDeliveryMsgParameters
7007
7170
  | CreateReadMsgParameters
7008
- | CreateAudioMsgParameters;
7171
+ | CreateAudioMsgParameters
7172
+ | CreateCombineMsgParameters;
7009
7173
 
7010
7174
  type MessageBody =
7011
7175
  | ReadMsgBody
@@ -7018,7 +7182,9 @@ export declare namespace EasemobChat {
7018
7182
  | ImgMsgBody
7019
7183
  | AudioMsgBody
7020
7184
  | VideoMsgBody
7021
- | FileMsgBody;
7185
+ | FileMsgBody
7186
+ | CombineMsgBody;
7187
+
7022
7188
  type MessagePriority = 'high' | 'normal' | 'low';
7023
7189
  interface PriorityExt {
7024
7190
  chatroom_msg_tag: number;