easemob-websdk 4.14.0 → 4.15.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,5 +1,28 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ ## 4.15.0 (May 20, 2025)
4
+
5
+ ### 新增特性
6
+
7
+ 1. 获取群成员
8
+
9
+ 自 WEB SDK 4.15.0 开始,增加`getGroupMembers`方法,用来获取群成员, 同时返回成员角色, 原`listGroupMembers`方法废弃。
10
+
11
+ 2. 获取聊天室成员
12
+
13
+ 自 WEB SDK 4.15.0 开始,增加`getChatRoomMembers`方法,用来获取聊天室成员, 同时返回成员角色, 原`listChatRoomMembers`方法废弃。
14
+
15
+ 3. 当群组发生以下操作时,SDK 改为仅回调单条事件,事件中包含所有加入/退出的成员:
16
+
17
+ - 创建群组时拉多人入群
18
+ - 批量成员加入或退出群组
19
+ - 因解散群组导致用户退出
20
+ 调整前:SDK 会为每个加入/退出的成员单独回调一条事件。
21
+
22
+ 自 WEB SDK 4.15.0 开始,群组事件增加 `membersPresence`, `membersAbsence` 事件,表示多人加入群组、退出群组。
23
+
24
+ 4. 修改 token 将要过期事件 `onTokenWillExpire` 的触发时机,SDK 会在 Token 有效期达到 80% 时(之前版本为 50% )回调即将过期通知。
25
+
3
26
  ## 4.14.0 (Apr 18, 2025)
4
27
 
5
28
  ### 新增特性
package/Easemob-chat.d.ts CHANGED
@@ -742,6 +742,13 @@ export declare namespace EasemobChat {
742
742
 
743
743
  type GetGroupMembersAttributesResult = Record<UserId, MemberAttributes>;
744
744
 
745
+ type GroupMemberRole = 'owner' | 'admin' | 'member';
746
+ interface FetchedGroupMember {
747
+ role: GroupMemberRole;
748
+ userId: UserId;
749
+ joinedTime: number;
750
+ }
751
+
745
752
  interface GroupModifyInfo {
746
753
  /** The name of a group. */
747
754
  name?: string;
@@ -1926,6 +1933,8 @@ export declare namespace EasemobChat {
1926
1933
  /**
1927
1934
  * Lists all chat room members with pagination.
1928
1935
  *
1936
+ * @deprecated Use {@link getChatRoomMembers} instead.
1937
+ *
1929
1938
  * ```typescript
1930
1939
  * connection.listChatRoomMembers({pageNum: 1, pageSize: 20, chatRoomId: 'chatRoomId'})
1931
1940
  * ```
@@ -1944,6 +1953,30 @@ export declare namespace EasemobChat {
1944
1953
  }
1945
1954
  ): Promise<AsyncResult<{ member: string }[]>>;
1946
1955
 
1956
+ /**
1957
+ * Gets the list chat room members with pagination.
1958
+ *
1959
+ * ```typescript
1960
+ * connection.getChatRoomMembers({cursor: '', limit: 50, chatRoomId: 'chatRoomId'})
1961
+ * ```
1962
+ */
1963
+ getChatRoomMembers(
1964
+ this: Connection,
1965
+ params: {
1966
+ /** The chat room ID. */
1967
+ chatRoomId: string;
1968
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be fetched. */
1969
+ cursor?: string;
1970
+ /** The number of members retrieved per page. The value range is [1,50], with 50 as the default.*/
1971
+ limit?: number;
1972
+ }
1973
+ ): Promise<
1974
+ AsyncResult<{
1975
+ cursor: string | undefined;
1976
+ members: FetchedGroupMember[];
1977
+ }>
1978
+ >;
1979
+
1947
1980
  /**
1948
1981
  * Gets all admins of the chat room.
1949
1982
  *
@@ -3007,6 +3040,7 @@ export declare namespace EasemobChat {
3007
3040
 
3008
3041
  /**
3009
3042
  * Lists all members of the group with pagination.
3043
+ * @deprecated use {@link getGroupMembers} instead.
3010
3044
  *
3011
3045
  * ```typescript
3012
3046
  * connection.listGroupMembers({pageNum: 1, pageSize: 20, groupId: 'groupId'})
@@ -3026,6 +3060,30 @@ export declare namespace EasemobChat {
3026
3060
  }
3027
3061
  ): Promise<AsyncResult<GroupMember[]>>;
3028
3062
 
3063
+ /**
3064
+ * Gets the list group members with pagination.
3065
+ *
3066
+ * ```typescript
3067
+ * connection.getGroupMembers({cursor: '', limit: 50, groupId: 'groupId'})
3068
+ * ```
3069
+ */
3070
+ getGroupMembers(
3071
+ this: Connection,
3072
+ params: {
3073
+ /** The group ID. */
3074
+ groupId: string;
3075
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be fetched. */
3076
+ cursor?: string;
3077
+ /** The number of members retrieved per page. The value range is [1,50], with 50 as the default.*/
3078
+ limit?: number;
3079
+ }
3080
+ ): Promise<
3081
+ AsyncResult<{
3082
+ cursor: string | undefined;
3083
+ members: FetchedGroupMember[];
3084
+ }>
3085
+ >;
3086
+
3029
3087
  /**
3030
3088
  * Gets all admins in the group.
3031
3089
  * ```typescript
@@ -5767,7 +5825,7 @@ export declare namespace EasemobChat {
5767
5825
  /** The ID of a group or chatroom. */
5768
5826
  id: string;
5769
5827
  /** Message sender. */
5770
- from: string;
5828
+ from?: string;
5771
5829
  /** The modified group info. */
5772
5830
  detail?: GroupModifyInfo;
5773
5831
  /** The name of a group or chatroom. */
@@ -5786,6 +5844,8 @@ export declare namespace EasemobChat {
5786
5844
  announcement?: string;
5787
5845
  /** Expiration time for user mute. */
5788
5846
  muteTimestamp?: { [key: string]: number };
5847
+ /** User IDs of group members. */
5848
+ members?: Array<string>;
5789
5849
  }
5790
5850
 
5791
5851
  interface GetChatroomAttributesResult {
@@ -5862,8 +5922,10 @@ export declare namespace EasemobChat {
5862
5922
  * removeMember: Occurs when you are removed from a group or added to block list. Only the removed person receives this event.<br/>
5863
5923
  * unblockMember: Occurs when being removed from the block list. Only the removed person receives this event.<br/>
5864
5924
  * updateInfo: Occurs when modifying group. <br/>
5865
- * memberPresence: Occurs when someone joined the group. <br/>
5866
- * memberAbsence: Occurs when someone leaved the group. <br/>
5925
+ * memberPresence: Occurs when a user joined the group. <br/>
5926
+ * membersPresence: Occurs when more than one user joined the group. <br/>
5927
+ * memberAbsence: Occurs when a user leaved the group.<br/>
5928
+ * membersAbsence: Occurs when more than one user leaved the group. <br/>
5867
5929
  * directJoined: Occurs when you are directly pulled into the group and no consent is required. <br/>
5868
5930
  * changeOwner: Occurs when transferring group. Only new and old group owners can receive this event. <br/>
5869
5931
  * setAdmin: Occurs when being set as administrator. Only the person who is set to administrator can receive this event.<br/>
@@ -5893,7 +5955,9 @@ export declare namespace EasemobChat {
5893
5955
  | 'unblockMember'
5894
5956
  | 'updateInfo'
5895
5957
  | 'memberPresence'
5958
+ | 'membersPresence'
5896
5959
  | 'memberAbsence'
5960
+ | 'membersAbsence'
5897
5961
  | 'directJoined'
5898
5962
  | 'changeOwner'
5899
5963
  | 'setAdmin'
@@ -5934,7 +5998,7 @@ export declare namespace EasemobChat {
5934
5998
  * unblockMember: Occurs when being removed from the block list. Only the removed person receives this event.<br/>
5935
5999
  * updateInfo: Occurs when modifying chat room. <br/>
5936
6000
  * memberPresence: Occurs when someone joined the chat room. <br/>
5937
- * memberAbsence: Occurs when someone leaved the chat room. <br/>
6001
+ * memberAbsence: Occurs when someone leaved the chat room. <br/>
5938
6002
  * setAdmin: Occurs when being set as administrator. Only the person who is set to administrator can receive this event.<br/>
5939
6003
  * removeAdmin: Occurs when you are removed as an administrator. Only the removed person can receive this event. <br/>
5940
6004
  * muteMember: Occurs when you are muted. Only the person who is muted can receive this event. <br/>
@@ -6063,7 +6127,7 @@ export declare namespace EasemobChat {
6063
6127
  onContactDeleted?: (msg: ContactMsgBody) => void;
6064
6128
  /** The callback to added a contact. */
6065
6129
  onContactAdded?: (msg: ContactMsgBody) => void;
6066
- /** The callback whose token is about to expire. */
6130
+ /** Occurs when the token is about to expire. This event is triggered from when 20% of the validity period is left.*/
6067
6131
  onTokenWillExpire?: () => void;
6068
6132
  /** The callback whose token has expired. */
6069
6133
  onTokenExpired?: () => void;
@@ -6291,7 +6355,8 @@ export declare namespace EasemobChat {
6291
6355
  | 'img'
6292
6356
  | 'audio'
6293
6357
  | 'file'
6294
- | 'video';
6358
+ | 'video'
6359
+ | 'combine';
6295
6360
 
6296
6361
  type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
6297
6362
  interface FileObj {