easemob-websdk 4.8.1 → 4.9.0-beta

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,5 +1,15 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ # 4.9.0 (August 29, 2024)
4
+
5
+ - Add `onOfflineMessageSyncStart` and `onOfflineMessageSyncFinish` event.
6
+ - Add multi device events `setSilentModeForConversation` and `removeSilentModeForConversation`.
7
+ - Fix `ChatroomEvent` and `GroupEvent` missed `reason` field.
8
+ - PIN message support single chat.
9
+ - Add callback error when get DNS failed
10
+ - Remove redundant judgment at reconnecting.
11
+ - chore: fix type errors and debug logs
12
+
3
13
  # 4.8.1 (Jul 15, 2024)
4
14
 
5
15
  - Fix uploading logs takes too much time
package/Easemob-chat.d.ts CHANGED
@@ -154,7 +154,10 @@ export declare namespace EasemobChat {
154
154
  | 'chatThreadDestroy'
155
155
  | 'chatThreadJoin'
156
156
  | 'chatThreadLeave'
157
- | 'chatThreadNameUpdate';
157
+ | 'chatThreadNameUpdate'
158
+ | 'setSilentModeForUser'
159
+ | 'removeSilentModeForConversation'
160
+ | 'setSilentModeForConversation';
158
161
 
159
162
  interface ThreadMultiDeviceInfo {
160
163
  /** Event name of thread multi device event. */
@@ -211,11 +214,37 @@ export declare namespace EasemobChat {
211
214
  timestamp: number;
212
215
  }
213
216
 
217
+ interface NotificationConMultiDeviceInfo {
218
+ operation:
219
+ | 'setSilentModeForConversation'
220
+ | 'removeSilentModeForConversation';
221
+ resource: string;
222
+ conversationId: string;
223
+ type: 'singleChat' | 'groupChat';
224
+ data: {
225
+ type?: 'AT' | 'NONE' | 'ALL';
226
+ ignoreDuration?: number;
227
+ };
228
+ }
229
+ interface NotificationUserMultiDeviceInfo {
230
+ operation: 'setSilentModeForUser';
231
+ resource: string;
232
+ // user: string;
233
+ data: {
234
+ ignoreInterval: string;
235
+ };
236
+ }
237
+
238
+ type NotificationMultiDeviceInfo =
239
+ | NotificationConMultiDeviceInfo
240
+ | NotificationUserMultiDeviceInfo;
241
+
214
242
  type MultiDeviceEvent =
215
243
  | ThreadMultiDeviceInfo
216
244
  | ConversationChangedInfo
217
245
  | RoamingDeleteMultiDeviceInfo
218
- | GroupMemberAttributesUpdateMultiDeviceInfo;
246
+ | GroupMemberAttributesUpdateMultiDeviceInfo
247
+ | NotificationMultiDeviceInfo;
219
248
 
220
249
  interface ConnectionParameters {
221
250
  /** The unique application key registered in console. */
@@ -1230,6 +1259,22 @@ export declare namespace EasemobChat {
1230
1259
  | SilentModeDuration
1231
1260
  | SilentModeInterval;
1232
1261
 
1262
+ interface ConversationWithRemindType {
1263
+ /** Conversation id. */
1264
+ conversationId: string;
1265
+ /** Conversation type. */
1266
+ type: 'singleChat' | 'groupChat';
1267
+ /** Silent mode type. */
1268
+ remindType: SILENTMODETYPE;
1269
+ }
1270
+
1271
+ interface GetSilentModeRemindTypeConversationsResult {
1272
+ /** The cursor that specifies where to start to get data. */
1273
+ cursor: string;
1274
+ /** conversations with remind type. */
1275
+ conversations: ConversationWithRemindType[];
1276
+ }
1277
+
1233
1278
  interface GetReactionDetailResult {
1234
1279
  /** The reaction to be added to the message. The length is limited to 128 characters. */
1235
1280
  reaction: string;
@@ -1358,6 +1403,9 @@ export declare namespace EasemobChat {
1358
1403
  */
1359
1404
  USER_NOT_FRIEND = 221,
1360
1405
 
1406
+ /** get DNS failed */
1407
+ SERVER_GET_DNSLIST_FAILED = 304,
1408
+
1361
1409
  /** The server is busy. */
1362
1410
  SERVER_BUSY = 500,
1363
1411
  /** The message content contains illegal or sensitive words. */
@@ -1642,10 +1690,12 @@ export declare namespace EasemobChat {
1642
1690
  params: {
1643
1691
  /** The chat room ID. */
1644
1692
  chatRoomId: string;
1645
- success?: (res: AsyncResult<GetChatRoomDetailsResult>) => void;
1693
+ success?: (
1694
+ res: AsyncResult<Array<GetChatRoomDetailsResult>>
1695
+ ) => void;
1646
1696
  error?: (error: ErrorEvent) => void;
1647
1697
  }
1648
- ): Promise<AsyncResult<GetChatRoomDetailsResult>>;
1698
+ ): Promise<AsyncResult<Array<GetChatRoomDetailsResult>>>;
1649
1699
 
1650
1700
  /**
1651
1701
  * Modifies the specifications of the chat room.
@@ -5110,7 +5160,7 @@ export declare namespace EasemobChat {
5110
5160
  /** The conversation ID. */
5111
5161
  conversationId: string;
5112
5162
  /** The conversation type. */
5113
- conversationType: 'groupChat' | 'chatRoom';
5163
+ conversationType: ChatType;
5114
5164
  /** The ID of the message to be pinned. */
5115
5165
  messageId: string;
5116
5166
  }
@@ -5131,7 +5181,7 @@ export declare namespace EasemobChat {
5131
5181
  /** The conversation ID. */
5132
5182
  conversationId: string;
5133
5183
  /** The conversation type. */
5134
- conversationType: 'groupChat' | 'chatRoom';
5184
+ conversationType: ChatType;
5135
5185
  /** The ID of the message to be unpinned. */
5136
5186
  messageId: string;
5137
5187
  }
@@ -5153,7 +5203,7 @@ export declare namespace EasemobChat {
5153
5203
  /** The conversation ID. */
5154
5204
  conversationId: string;
5155
5205
  /** The conversation type. */
5156
- conversationType: 'groupChat' | 'chatRoom';
5206
+ conversationType: ChatType;
5157
5207
  /** The number of pinned messages to retrieve on each page. The value range is [1,50] and the default value is `10`. */
5158
5208
  pageSize?: number;
5159
5209
  /** The position from which to start getting data. For the first call of the method, an empty string ('') is passed in and the SDK returns the list of pinned messages in the descending order of when they are pinned. */
@@ -5608,6 +5658,8 @@ export declare namespace EasemobChat {
5608
5658
  memberCount?: number;
5609
5659
  /** The extension fields. */
5610
5660
  ext?: string;
5661
+ /** The reason for the event. */
5662
+ reason?: string;
5611
5663
  }
5612
5664
 
5613
5665
  interface GetChatroomAttributesResult {
@@ -5655,6 +5707,7 @@ export declare namespace EasemobChat {
5655
5707
  | 'onTokenExpired'
5656
5708
  | 'onContactInvited'
5657
5709
  | 'onConnected'
5710
+ | 'onReconnecting'
5658
5711
  | 'onDisconnected'
5659
5712
  | 'onGroupChange'
5660
5713
  | 'onChatroomChange'
@@ -5666,7 +5719,9 @@ export declare namespace EasemobChat {
5666
5719
  | 'onMultiDeviceEvent'
5667
5720
  | 'onGroupEvent'
5668
5721
  | 'onChatroomEvent'
5669
- | 'onMessagePinEvent';
5722
+ | 'onMessagePinEvent'
5723
+ | 'onOfflineMessageSyncStart'
5724
+ | 'onOfflineMessageSyncFinish';
5670
5725
 
5671
5726
  interface GroupEvent {
5672
5727
  /** The type of operation. <br/>
@@ -5732,12 +5787,16 @@ export declare namespace EasemobChat {
5732
5787
  id: string;
5733
5788
  /** Message sender. */
5734
5789
  from: string;
5790
+ /** The userId of a group event. */
5791
+ userId?: string;
5735
5792
  /** The name of a group. */
5736
5793
  name?: string;
5737
5794
  /** The modified group info. */
5738
5795
  detail?: GroupModifyInfo;
5739
5796
  /** The member count. */
5740
5797
  memberCount?: number;
5798
+ /** The reason for the event. */
5799
+ reason?: string;
5741
5800
  }
5742
5801
 
5743
5802
  interface ChatroomEvent {
@@ -5796,11 +5855,13 @@ export declare namespace EasemobChat {
5796
5855
  memberCount?: number;
5797
5856
  /** The extension fields. */
5798
5857
  ext?: string;
5858
+ /** The reason for the event. */
5859
+ reason?: string;
5799
5860
  }
5800
5861
 
5801
5862
  interface MessagePinEvent {
5802
5863
  /** The conversation type. */
5803
- conversationType: 'groupChat' | 'chatRoom';
5864
+ conversationType: ChatType;
5804
5865
  /** The conversation ID. */
5805
5866
  conversationId: string;
5806
5867
  /** The ID of the message that is pinned or unpinned. */
@@ -5880,6 +5941,8 @@ export declare namespace EasemobChat {
5880
5941
  onContactInvited?: (msg: ContactMsgBody) => void;
5881
5942
  /** The callback for successful connection. */
5882
5943
  onConnected?: () => void;
5944
+ /** The callback for reconnecting. */
5945
+ onReconnecting?: () => void;
5883
5946
  /** The callback for disconnected. */
5884
5947
  onDisconnected?: (error?: ErrorEvent) => void;
5885
5948
  /** @deprecated Use { onGroupEvent } instead. */
@@ -5902,6 +5965,10 @@ export declare namespace EasemobChat {
5902
5965
  onChatroomEvent?: (eventData: ChatroomEvent) => void;
5903
5966
  /** The callback to receive a pin message event. */
5904
5967
  onMessagePinEvent?: (eventData: MessagePinEvent) => void;
5968
+ /** Occurs when the SDK starts pulling offline messages from the server. */
5969
+ onOfflineMessageSyncStart?: () => void;
5970
+ /** Occurs when the SDK finishes pulling offline messages from the server.*/
5971
+ onOfflineMessageSyncFinish?: () => void;
5905
5972
  }
5906
5973
 
5907
5974
  interface HandlerData {
@@ -6149,6 +6216,7 @@ export declare namespace EasemobChat {
6149
6216
  reason?: string;
6150
6217
  kicked?: string;
6151
6218
  detail?: GroupModifyInfo;
6219
+ ext?: string;
6152
6220
  }
6153
6221
 
6154
6222
  interface ReadMsgSetParameters {
@@ -7633,6 +7701,9 @@ export declare namespace EasemobChat {
7633
7701
  static createOldMsg(options: NewMessageParamters): MessageBody;
7634
7702
  /** Create messages. */
7635
7703
  static create(options: CreateMsgType): MessageBody;
7704
+ /** When sending attachment messages, use this method to obtain the file path. */
7705
+ static getFileUrl: (fileInputId: string | HTMLInputElement) => FileObj;
7706
+
7636
7707
  /** @deprecated */
7637
7708
  set(options: MessageSetParameters): void;
7638
7709
  }