easemob-chat-uikit 2.4.2 → 3.0.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/ChatUI.esm.js +80679 -76023
- package/ChatUI.js +109 -118
- package/ChatUI.umd.js +109 -118
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/eventHandler/index.d.ts +4 -5
- package/types/index.d.ts +15 -0
- package/types/local/resource.d.ts +10 -0
- package/types/module/SDK.d.ts +15 -2
- package/types/module/baseMessage/BaseMessage.d.ts +29 -6
- package/types/module/baseMessage/index.d.ts +1 -0
- package/types/module/callkit/index.d.ts +1 -1
- package/types/module/callkit/services/CallService.d.ts +21 -19
- package/types/module/callkit/services/CallTimerService.d.ts +12 -0
- package/types/module/callkit/types/index.d.ts +21 -4
- package/types/module/callkit/utils/ringtoneManager.d.ts +38 -0
- package/types/module/chat/Chat.d.ts +2 -2
- package/types/module/chat/MessageList.d.ts +7 -6
- package/types/module/chatroom/Chatroom.d.ts +2 -2
- package/types/module/chatroomMessage/ChatroomMessage.d.ts +4 -6
- package/types/module/combinedMessage/CombinedMessage.d.ts +1 -1
- package/types/module/contactList/ContactList.d.ts +3 -4
- package/types/module/fileMessage/FileMessage.d.ts +3 -2
- package/types/module/hooks/chat.d.ts +1 -1
- package/types/module/hooks/useAddress.d.ts +1 -1
- package/types/module/hooks/useAddressContext.d.ts +12 -2
- package/types/module/hooks/useChatContext.d.ts +5 -5
- package/types/module/hooks/usePinnedMessage.d.ts +2 -2
- package/types/module/hooks/useSDK.d.ts +13 -3
- package/types/module/hooks/useThreadContext.d.ts +4 -2
- package/types/module/imageMessage/ImageMessage.d.ts +4 -3
- package/types/module/imageMessage/imageCache.d.ts +5 -0
- package/types/module/index.d.ts +2 -2
- package/types/module/messageInput/MessageInput.d.ts +4 -3
- package/types/module/messageInput/constants.d.ts +1 -0
- package/types/module/messageInput/gift/GiftKeyboard.d.ts +4 -6
- package/types/module/messageInput/moreAction/MoreAction.d.ts +2 -2
- package/types/module/messageInput/recorder/Recorder.d.ts +4 -3
- package/types/module/messageInput/selectedControls/SelectedControls.d.ts +2 -2
- package/types/module/messageInput/sendTypes.d.ts +25 -0
- package/types/module/messageInput/suggestList/SuggestList.d.ts +0 -1
- package/types/module/messageInput/textarea/Textarea.d.ts +4 -3
- package/types/module/pinnedTextMessage/PinnedTextMessage.d.ts +2 -2
- package/types/module/repliedMessage/RepliedMsg.d.ts +4 -3
- package/types/module/store/AddressStore.d.ts +58 -13
- package/types/module/store/ConversationStore.d.ts +53 -6
- package/types/module/store/ConversationSyncService.d.ts +15 -0
- package/types/module/store/MessageStore.d.ts +56 -21
- package/types/module/store/PinnedMessagesStore.d.ts +3 -3
- package/types/module/store/Provider.d.ts +41 -18
- package/types/module/store/ThreadStore.d.ts +18 -12
- package/types/module/store/UserInfoSyncService.d.ts +9 -0
- package/types/module/store/index.d.ts +13 -5
- package/types/module/store/rootContext.d.ts +6 -16
- package/types/module/textMessage/TextMessage.d.ts +3 -3
- package/types/module/thread/ThreadList.d.ts +2 -2
- package/types/module/types/messageType.d.ts +82 -60
- package/types/module/userCardMessage/UserCardMessage.d.ts +3 -2
- package/types/module/utils/conversation.d.ts +26 -0
- package/types/module/utils/index.d.ts +20 -7
- package/types/module/utils/message.d.ts +49 -0
- package/types/module/utils/thread.d.ts +10 -0
- package/types/module/videoMessage/VideoMessage.d.ts +3 -3
- package/types/react-photo-view.d.ts +90 -0
- package/README.md +0 -390
- package/types/demo/ react-app-env.d.ts +0 -76
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatClient, ChatManager, ChatRoomManager, ChatThreadManager, ContactManager, GroupManager, PresenceManager, PushManager, UserInfoManager } from '../SDK';
|
|
2
2
|
declare const useSDK: () => {
|
|
3
|
-
ChatSDK:
|
|
4
|
-
|
|
3
|
+
ChatSDK: {
|
|
4
|
+
ChatClient: typeof ChatClient;
|
|
5
|
+
ChatManager: typeof ChatManager;
|
|
6
|
+
ChatRoomManager: typeof ChatRoomManager;
|
|
7
|
+
ChatThreadManager: typeof ChatThreadManager;
|
|
8
|
+
ContactManager: typeof ContactManager;
|
|
9
|
+
GroupManager: typeof GroupManager;
|
|
10
|
+
PresenceManager: typeof PresenceManager;
|
|
11
|
+
PushManager: typeof PushManager;
|
|
12
|
+
UserInfoManager: typeof UserInfoManager;
|
|
13
|
+
};
|
|
14
|
+
ChatSDKType: typeof import("easemob-websdk");
|
|
5
15
|
};
|
|
6
16
|
export { useSDK };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const useThreadContext: () => {
|
|
2
2
|
currentThread: import("..").CurrentThread;
|
|
3
3
|
threadList: {
|
|
4
|
-
[key: string]: (import("easemob-websdk").
|
|
4
|
+
[key: string]: (import("easemob-websdk").ChatThreadSummary & {
|
|
5
5
|
members?: string[] | undefined;
|
|
6
6
|
})[];
|
|
7
7
|
};
|
|
@@ -9,7 +9,9 @@ declare const useThreadContext: () => {
|
|
|
9
9
|
setCurrentThread: (thread: import("..").CurrentThread) => void;
|
|
10
10
|
setThreadVisible: (visible: boolean) => void;
|
|
11
11
|
getGroupChatThreads: (parentId: string, cursor?: string | undefined) => Promise<string | null>;
|
|
12
|
-
getThreadMembers: (parentId: string, threadId: string, cursor?: string | undefined) => Promise<string[]
|
|
12
|
+
getThreadMembers: (parentId: string, threadId: string, cursor?: string | undefined) => Promise<string[] & {
|
|
13
|
+
cursor?: string | undefined;
|
|
14
|
+
}>;
|
|
13
15
|
removeChatThreadMember: (parentId: string, threadId: string, userId: string) => any;
|
|
14
16
|
getCurrentChatThreadDetail: (threadId: string) => Promise<void>;
|
|
15
17
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
3
|
import type { ImageMessageType } from '../types/messageType';
|
|
4
|
+
import type { ChatSDK } from 'module/SDK';
|
|
4
5
|
export interface ImageMessageProps extends BaseMessageProps {
|
|
5
|
-
imageMessage: ImageMessageType;
|
|
6
|
+
imageMessage: ImageMessageType | ChatSDK.Message;
|
|
6
7
|
prefix?: string;
|
|
7
8
|
style?: React.CSSProperties;
|
|
8
9
|
className?: string;
|
|
@@ -17,7 +18,7 @@ export interface ImageMessageProps extends BaseMessageProps {
|
|
|
17
18
|
visible: boolean;
|
|
18
19
|
imageUrl: string;
|
|
19
20
|
onClose: () => void;
|
|
20
|
-
message:
|
|
21
|
+
message: ChatSDK.Message;
|
|
21
22
|
}) => React.ReactNode;
|
|
22
23
|
}
|
|
23
24
|
export interface ImagePreviewProps {
|
|
@@ -27,7 +28,7 @@ export interface ImagePreviewProps {
|
|
|
27
28
|
onCancel?: () => void;
|
|
28
29
|
}
|
|
29
30
|
export declare const ImagePreview: (props: ImagePreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
declare const _default: ((props: ImageMessageProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
31
|
+
declare const _default: ((props: ImageMessageProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
31
32
|
displayName: string;
|
|
32
33
|
};
|
|
33
34
|
export default _default;
|
package/types/module/index.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ import Chatroom from './chatroom';
|
|
|
42
42
|
import ChatroomMember from './chatroomMember';
|
|
43
43
|
import ChatroomMessage from './chatroomMessage';
|
|
44
44
|
import CallKit from './callkit';
|
|
45
|
-
import { CallKitProps, CallInfo, CallErrorCode, CallError } from './callkit';
|
|
45
|
+
import { CallKitProps, CallInfo, CallErrorCode, CallError, CallKitRTCProvider, RTCTokenInfo, RTCUidUserIdMap } from './callkit';
|
|
46
46
|
import { CallKitRef } from './callkit/types/index';
|
|
47
|
-
export type { AudioMessageProps, BaseMessageProps, FileMessageProps, ImageMessageProps, ImagePreviewProps, NoticeMessageProps, TextMessageProps, VideoMessageProps, MessageStatusProps, CombinedMessageProps, PinnedMessageProps, RepliedMsgProps, UnsentRepliedMsgProps, ChatProps, MsgListProps, ConversationItemProps, ConversationListProps, ConversationData, MessageInputProps, MoreActionProps, RecorderProps, EmojiProps, SelectedControlsProps, SuggestListProps, TextareaProps, HeaderProps, EmptyProps, RecalledMessageProps, RootStore, InitConfig, MessageStore, Message, SelectedMessage, Typing, ConversationStore, AT_TYPE, Conversation, CurrentConversation, ById, AddressStore, MemberRole, MemberItem, GroupItem, AppUserInfo, ThreadStore, ThreadData, CurrentThread, ProviderProps, ContextProps, ThreadProps, UserProfileProps, BlocklistProps, ContactListProps, ContactDetailProps, GroupDetailProps, GroupMemberProps, UserCardMessageProps, UserSelectProps, CallKitProps, CallKitRef, CallInfo, CallErrorCode, CallError, MessageRenderContext, MessageRenderer, MessageType, };
|
|
47
|
+
export type { AudioMessageProps, BaseMessageProps, FileMessageProps, ImageMessageProps, ImagePreviewProps, NoticeMessageProps, TextMessageProps, VideoMessageProps, MessageStatusProps, CombinedMessageProps, PinnedMessageProps, RepliedMsgProps, UnsentRepliedMsgProps, ChatProps, MsgListProps, ConversationItemProps, ConversationListProps, ConversationData, MessageInputProps, MoreActionProps, RecorderProps, EmojiProps, SelectedControlsProps, SuggestListProps, TextareaProps, HeaderProps, EmptyProps, RecalledMessageProps, RootStore, InitConfig, MessageStore, Message, SelectedMessage, Typing, ConversationStore, AT_TYPE, Conversation, CurrentConversation, ById, AddressStore, MemberRole, MemberItem, GroupItem, AppUserInfo, ThreadStore, ThreadData, CurrentThread, ProviderProps, ContextProps, ThreadProps, UserProfileProps, BlocklistProps, ContactListProps, ContactDetailProps, GroupDetailProps, GroupMemberProps, UserCardMessageProps, UserSelectProps, CallKitProps, CallKitRef, CallInfo, CallErrorCode, CallError, CallKitRTCProvider, RTCTokenInfo, RTCUidUserIdMap, MessageRenderContext, MessageRenderer, MessageType, };
|
|
48
48
|
declare const UIKitProvider: import("react").NamedExoticComponent<ProviderProps>;
|
|
49
49
|
export { AudioMessage, BaseMessage, FileMessage, ImageMessage, NoticeMessage, TextMessage, VideoMessage, CombinedMessage, PinnedMessage, RepliedMsg, UnsentRepliedMsg, MessageStatus, Chat, MessageList, ContactList, ConversationList, ConversationItem, MessageInput, Header, Empty, RecalledMessage, rootStore, RootContext, RootProvider, RootConsumer, Provider, UIKitProvider, Thread, UserProfile, Blocklist, useClient, useConversations, usePinnedMessage, useHistoryMessages, useSDK, useIsMobile, useScreen, useConversationContext, useChatContext, useAddressContext, useThreadContext, useChatroomContext, Chatroom, ChatroomMember, ChatroomMessage, ContactItem, ContactDetail, GroupDetail, GroupMember, UserCardMessage, UserSelect, CallKit, };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { MoreActionProps } from './moreAction';
|
|
3
|
-
import { ChatSDK } from '../SDK';
|
|
3
|
+
import type { ChatSDK } from '../SDK';
|
|
4
4
|
import { CurrentConversation } from '../store/ConversationStore';
|
|
5
5
|
import { GiftKeyboardProps } from './gift/GiftKeyboard';
|
|
6
|
+
import type { BeforeSendMessage } from './sendTypes';
|
|
6
7
|
export type Actions = {
|
|
7
8
|
name: string;
|
|
8
9
|
visible: boolean;
|
|
@@ -24,9 +25,9 @@ export interface MessageInputProps {
|
|
|
24
25
|
disabled?: boolean;
|
|
25
26
|
isChatThread?: boolean;
|
|
26
27
|
enabledMention?: boolean;
|
|
27
|
-
onSendMessage?: (message: ChatSDK.
|
|
28
|
+
onSendMessage?: (message: ChatSDK.Message) => void;
|
|
28
29
|
conversation?: CurrentConversation;
|
|
29
|
-
onBeforeSendMessage?:
|
|
30
|
+
onBeforeSendMessage?: BeforeSendMessage;
|
|
30
31
|
giftKeyboardProps?: GiftKeyboardProps;
|
|
31
32
|
onChange?: (value: string) => void;
|
|
32
33
|
onFocus?: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AT_ALL = "ALL";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ChatSDK } from '../../SDK';
|
|
2
|
+
import type { ChatSDK } from '../../SDK';
|
|
3
3
|
import { CurrentConversation } from '../../store/ConversationStore';
|
|
4
4
|
import giftConfig from './giftConfig';
|
|
5
|
+
import type { BeforeSendMessage } from '../sendTypes';
|
|
5
6
|
export interface GiftKeyboardProps {
|
|
6
7
|
prefix?: string;
|
|
7
8
|
className?: string;
|
|
@@ -12,11 +13,8 @@ export interface GiftKeyboardProps {
|
|
|
12
13
|
onClick?: (e: React.MouseEvent<Element, MouseEvent>) => void;
|
|
13
14
|
conversation?: CurrentConversation;
|
|
14
15
|
gifts?: ReactNode[];
|
|
15
|
-
onSendMessage?: (message: ChatSDK.
|
|
16
|
-
onBeforeSendMessage?:
|
|
17
|
-
chatType: 'chatRoom';
|
|
18
|
-
conversationId: string;
|
|
19
|
-
} | void>;
|
|
16
|
+
onSendMessage?: (message: ChatSDK.Message) => void;
|
|
17
|
+
onBeforeSendMessage?: BeforeSendMessage;
|
|
20
18
|
giftConfig?: typeof giftConfig;
|
|
21
19
|
closeAfterClick?: boolean;
|
|
22
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ChatSDK } from '../../SDK';
|
|
3
2
|
import { CurrentConversation } from '../../store/ConversationStore';
|
|
3
|
+
import type { BeforeSendMessage } from '../sendTypes';
|
|
4
4
|
export interface MoreActionProps {
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
className?: string;
|
|
@@ -14,7 +14,7 @@ export interface MoreActionProps {
|
|
|
14
14
|
}>;
|
|
15
15
|
conversation?: CurrentConversation;
|
|
16
16
|
isChatThread?: boolean;
|
|
17
|
-
onBeforeSendMessage?:
|
|
17
|
+
onBeforeSendMessage?: BeforeSendMessage;
|
|
18
18
|
}
|
|
19
19
|
declare let MoreAction: (props: MoreActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export { MoreAction };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ChatSDK } from '../../SDK';
|
|
2
|
+
import type { ChatSDK } from '../../SDK';
|
|
3
3
|
import { CurrentConversation } from '../../store/ConversationStore';
|
|
4
|
+
import type { BeforeSendMessage } from '../sendTypes';
|
|
4
5
|
export interface RecorderProps {
|
|
5
6
|
prefix?: string;
|
|
6
7
|
className?: string;
|
|
@@ -10,9 +11,9 @@ export interface RecorderProps {
|
|
|
10
11
|
cancelBtnShape?: 'circle' | 'square';
|
|
11
12
|
onShow?: () => void;
|
|
12
13
|
onHide?: () => void;
|
|
13
|
-
onSend?: (message: ChatSDK.
|
|
14
|
+
onSend?: (message: ChatSDK.Message) => void;
|
|
14
15
|
conversation?: CurrentConversation;
|
|
15
|
-
onBeforeSendMessage?:
|
|
16
|
+
onBeforeSendMessage?: BeforeSendMessage;
|
|
16
17
|
isChatThread?: boolean;
|
|
17
18
|
disabled?: boolean;
|
|
18
19
|
disabledTitle?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ChatSDK } from '../../SDK';
|
|
2
|
+
import type { ChatSDK } from '../../SDK';
|
|
3
3
|
import { CurrentConversation } from '../../store/ConversationStore';
|
|
4
4
|
export interface SelectedControlsProps {
|
|
5
5
|
prefix?: string;
|
|
@@ -7,7 +7,7 @@ export interface SelectedControlsProps {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
onHide?: () => void;
|
|
9
9
|
conversation?: CurrentConversation;
|
|
10
|
-
onSendMessage?: (message: ChatSDK.
|
|
10
|
+
onSendMessage?: (message: ChatSDK.Message) => void;
|
|
11
11
|
}
|
|
12
12
|
declare const SelectedControls: (props: SelectedControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export { SelectedControls };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
|
+
import type { CurrentConversation } from '../store/ConversationStore';
|
|
3
|
+
export type SendMessageKind = 'text' | 'image' | 'file' | 'voice' | 'video' | 'custom' | 'combine';
|
|
4
|
+
export interface SendMessageRoute {
|
|
5
|
+
conversationId: string;
|
|
6
|
+
conversationType: ChatSDK.ChatConversationType;
|
|
7
|
+
/** 定向消息接收者列表 */
|
|
8
|
+
receiverList?: string[];
|
|
9
|
+
/** 是否仅投递给在线用户 */
|
|
10
|
+
deliverOnlineOnly?: boolean;
|
|
11
|
+
/** 消息优先级 */
|
|
12
|
+
priority?: 'high' | 'normal' | 'low';
|
|
13
|
+
}
|
|
14
|
+
export interface BeforeSendMessageContext<Body = unknown> {
|
|
15
|
+
kind: SendMessageKind;
|
|
16
|
+
route: SendMessageRoute;
|
|
17
|
+
body: Body;
|
|
18
|
+
ext?: Record<string, unknown>;
|
|
19
|
+
isChatThread?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type BeforeSendMessage = (context: BeforeSendMessageContext) => Promise<CurrentConversation | SendMessageRoute | void>;
|
|
22
|
+
export declare function toSendMessageRoute(cvs: CurrentConversation): SendMessageRoute;
|
|
23
|
+
/** Message-level read receipts are only requested for single chat. */
|
|
24
|
+
export declare function shouldEnableReadReceipt(conversationType?: string): boolean;
|
|
25
|
+
export declare function resolveBeforeSendRoute(onBeforeSendMessage: BeforeSendMessage | undefined, context: BeforeSendMessageContext): Promise<SendMessageRoute>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ChatSDK } from '../../SDK';
|
|
2
|
+
import type { ChatSDK } from '../../SDK';
|
|
3
3
|
import { CurrentConversation } from '../../store/ConversationStore';
|
|
4
|
+
import type { BeforeSendMessage } from '../sendTypes';
|
|
4
5
|
export interface TextareaProps {
|
|
5
6
|
prefix?: string;
|
|
6
7
|
className?: string;
|
|
@@ -12,9 +13,9 @@ export interface TextareaProps {
|
|
|
12
13
|
enabledMention?: boolean;
|
|
13
14
|
enabledTyping?: boolean;
|
|
14
15
|
isChatThread?: boolean;
|
|
15
|
-
onSendMessage?: (message: ChatSDK.
|
|
16
|
+
onSendMessage?: (message: ChatSDK.Message) => void;
|
|
16
17
|
conversation?: CurrentConversation;
|
|
17
|
-
onBeforeSendMessage?:
|
|
18
|
+
onBeforeSendMessage?: BeforeSendMessage;
|
|
18
19
|
onChange?: (value: string) => void;
|
|
19
20
|
onFocus?: () => void;
|
|
20
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
export interface PinnedTextMessageProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
message: ChatSDK.
|
|
7
|
+
message: ChatSDK.PinnedMessageSummary;
|
|
8
8
|
}
|
|
9
9
|
declare const PinnedTextMessage: (props: PinnedTextMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export { PinnedTextMessage };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
import { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
4
|
+
type QuoteMessageType = 'text' | 'txt' | 'file' | 'image' | 'img' | 'voice' | 'audio' | 'custom' | 'video' | 'combine' | 'loc' | 'recall';
|
|
4
5
|
export interface CustomMessageQuoteContext {
|
|
5
|
-
message: ChatSDK.
|
|
6
|
+
message: ChatSDK.Message;
|
|
6
7
|
msgQuote?: {
|
|
7
8
|
msgID: string;
|
|
8
9
|
msgPreview: string;
|
|
9
10
|
msgSender: string;
|
|
10
|
-
msgType:
|
|
11
|
+
msgType: QuoteMessageType;
|
|
11
12
|
};
|
|
12
13
|
prefixCls: string;
|
|
13
14
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChatSDK } from '../SDK';
|
|
2
1
|
export type MemberRole = 'member' | 'owner' | 'admin';
|
|
3
2
|
export interface ContactRequest {
|
|
4
3
|
from: string;
|
|
@@ -8,30 +7,47 @@ export interface ContactRequest {
|
|
|
8
7
|
requestStatus: 'pending' | 'accepted' | 'read';
|
|
9
8
|
}
|
|
10
9
|
export interface MemberItem {
|
|
11
|
-
userId:
|
|
10
|
+
userId: string;
|
|
12
11
|
role: MemberRole;
|
|
13
|
-
attributes?:
|
|
12
|
+
attributes?: Record<string, string>;
|
|
14
13
|
silent?: boolean;
|
|
15
14
|
initial?: string;
|
|
16
15
|
name?: string;
|
|
17
16
|
}
|
|
18
|
-
export interface GroupItem
|
|
17
|
+
export interface GroupItem {
|
|
18
|
+
groupId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
groupName?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
memberCount?: number;
|
|
23
|
+
public?: boolean;
|
|
24
|
+
joinApprovalRequired?: boolean;
|
|
25
|
+
allowInvites?: boolean;
|
|
26
|
+
maxMembers?: number;
|
|
27
|
+
role?: MemberRole;
|
|
19
28
|
disabled?: boolean;
|
|
20
|
-
info?:
|
|
29
|
+
info?: Record<string, any>;
|
|
21
30
|
members?: MemberItem[];
|
|
22
31
|
hasMembersNext?: boolean;
|
|
23
|
-
admins?:
|
|
32
|
+
admins?: string[];
|
|
24
33
|
silent?: boolean;
|
|
25
34
|
initial?: string;
|
|
26
|
-
name?: string;
|
|
27
35
|
avatarUrl?: string;
|
|
28
36
|
}
|
|
29
|
-
export type AppUserInfo =
|
|
37
|
+
export type AppUserInfo = Record<string, any> & {
|
|
30
38
|
userId: string;
|
|
39
|
+
nickname?: string;
|
|
40
|
+
avatarUrl?: string;
|
|
41
|
+
/** @deprecated Use avatarUrl instead. Kept for compatibility with older UIKit integrations. */
|
|
42
|
+
avatarurl?: string;
|
|
31
43
|
isOnline?: boolean;
|
|
32
44
|
presenceExt?: string;
|
|
33
45
|
};
|
|
34
|
-
export type
|
|
46
|
+
export type AppUserInfoMap = Record<string, AppUserInfo>;
|
|
47
|
+
export type AppUserInfoProviderResult = AppUserInfo[] | AppUserInfoMap;
|
|
48
|
+
export type AppUserInfoProvider = (userIds: string[]) => Promise<AppUserInfoProviderResult> | AppUserInfoProviderResult;
|
|
49
|
+
export type ChatroomInfo = Record<string, any> & {
|
|
50
|
+
id: string;
|
|
35
51
|
membersId?: string[];
|
|
36
52
|
admins?: string[];
|
|
37
53
|
muteList?: string[];
|
|
@@ -50,11 +66,18 @@ declare class AddressStore {
|
|
|
50
66
|
searchList: any;
|
|
51
67
|
requests: ContactRequest[];
|
|
52
68
|
thread: {
|
|
53
|
-
[key: string]:
|
|
69
|
+
[key: string]: any[];
|
|
54
70
|
};
|
|
55
71
|
blockList: string[];
|
|
56
72
|
constructor();
|
|
57
73
|
setAppUserInfo: (appUsersInfo: Record<string, AppUserInfo>) => void;
|
|
74
|
+
mergeAppUserInfo: (appUsersInfo: Record<string, AppUserInfo> | AppUserInfo[]) => void;
|
|
75
|
+
resolveUserInfo: (userId?: string) => AppUserInfo;
|
|
76
|
+
hasUserInfo: (userId: string) => boolean;
|
|
77
|
+
ensureUserInfos: (userIds: string[], options?: {
|
|
78
|
+
withPresence?: boolean;
|
|
79
|
+
force?: boolean;
|
|
80
|
+
}) => Promise<unknown>;
|
|
58
81
|
setContacts(contacts: any): void;
|
|
59
82
|
setContactRemark(userId: string, remark: string): void;
|
|
60
83
|
deleteContact(userId: string): void;
|
|
@@ -64,14 +87,36 @@ declare class AddressStore {
|
|
|
64
87
|
updateGroupAvatar(groupId: string, avatar: string): void;
|
|
65
88
|
updateGroupName(groupId: string, groupName: string): void;
|
|
66
89
|
setHasGroupsNext(hasNext: boolean): void;
|
|
67
|
-
|
|
90
|
+
/** Ensure a joined group exists locally (e.g. invitee onMembersJoined before getGroupInfo). */
|
|
91
|
+
ensureGroupInList(groupId: string, groupName?: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* Upsert local groups from SDK getJoinedGroupList().
|
|
94
|
+
* ContactList watches addressStore.groups by reference; always reassign the array.
|
|
95
|
+
*/
|
|
96
|
+
syncJoinedGroupsFromSdk(): void;
|
|
97
|
+
/** Normalize SDK4/SDK5 group member payloads to MemberItem.userId + role. */
|
|
98
|
+
private normalizeGroupMemberEntry;
|
|
99
|
+
setGroupMembers(groupId: string, membersList: Array<{
|
|
100
|
+
userId?: string;
|
|
101
|
+
member?: string;
|
|
102
|
+
owner?: string;
|
|
103
|
+
role?: MemberRole;
|
|
104
|
+
} | {
|
|
105
|
+
user?: {
|
|
106
|
+
userId?: string;
|
|
107
|
+
};
|
|
108
|
+
role?: MemberRole;
|
|
109
|
+
}>): void;
|
|
68
110
|
removeGroupMember(groupId: string, userId: string): void;
|
|
69
111
|
setGroupItemHasMembersNext(groupId: string, hasNext: boolean): void;
|
|
70
|
-
setGroupMemberAttributesAsync: (groupId: string, userId: string, attributes:
|
|
71
|
-
setGroupMemberAttributes(groupId: string, userId: string, attributes:
|
|
112
|
+
setGroupMemberAttributesAsync: (groupId: string, userId: string, attributes: Record<string, string>) => void;
|
|
113
|
+
setGroupMemberAttributes(groupId: string, userId: string, attributes: Record<string, string>): void;
|
|
72
114
|
setGroupAdmins: (groupId: string, admins: string[]) => void;
|
|
73
115
|
getUserInfo: (userId: string, withPresence?: boolean, force?: boolean) => Promise<void | AppUserInfo>;
|
|
74
116
|
getUserInfoWithPresence: (userIdList: string[]) => void;
|
|
117
|
+
normalizeAppUsersInfo: (appUsersInfo: Record<string, AppUserInfo> | AppUserInfo[]) => AppUserInfoMap;
|
|
118
|
+
normalizeAppUsersInfoMap: (appUsersInfo: Record<string, AppUserInfo>) => AppUserInfoMap;
|
|
119
|
+
normalizeAppUserInfo: (userInfo: AppUserInfo, fallbackUserId?: string) => AppUserInfo;
|
|
75
120
|
setChatroom(chatroom: any): void;
|
|
76
121
|
updateChatroomMemberCount(roomId: string, count: number): void;
|
|
77
122
|
setChatroomAdmins: (chatroomId: string, admins: string[]) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ChatType } from '../types/messageType';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
export type AT_TYPE = 'NONE' | 'ALL' | 'ME';
|
|
4
4
|
export interface Conversation {
|
|
5
5
|
chatType: ChatType;
|
|
6
6
|
conversationId: string;
|
|
7
|
-
lastMessage:
|
|
7
|
+
lastMessage: ChatSDK.Message | Record<string, unknown>;
|
|
8
8
|
unreadCount: number;
|
|
9
9
|
name?: string;
|
|
10
10
|
atType?: AT_TYPE;
|
|
@@ -25,19 +25,66 @@ export interface ById {
|
|
|
25
25
|
declare class ConversationStore {
|
|
26
26
|
rootStore: any;
|
|
27
27
|
currentCvs: CurrentConversation;
|
|
28
|
-
|
|
28
|
+
/** Normalized map: source of truth */
|
|
29
|
+
byId: ById;
|
|
30
|
+
/** Ordered keys into byId, sorted by pinned + lastMessage time */
|
|
31
|
+
orderedIds: string[];
|
|
29
32
|
searchList: Conversation[];
|
|
30
33
|
hasConversationNext: boolean;
|
|
31
|
-
byId: ById;
|
|
32
34
|
constructor(rootStore: any);
|
|
35
|
+
/** Computed getter: backward-compatible array derived from byId + orderedIds */
|
|
36
|
+
get conversationList(): Conversation[];
|
|
37
|
+
private resortIds;
|
|
38
|
+
private syncSdkCurrentConversation;
|
|
33
39
|
setCurrentCvs: (currentCvs: CurrentConversation) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve display name from SDK conversation update.
|
|
42
|
+
* SDK may set conversationName === conversationId as a placeholder; keep local/group name then.
|
|
43
|
+
*/
|
|
44
|
+
private resolveSyncedConversationName;
|
|
45
|
+
/** Sync unreadCount (and optional fields) from SDK conversation list updates. */
|
|
46
|
+
syncUnreadFromSdkItems(items: ReadonlyArray<{
|
|
47
|
+
conversationId: string;
|
|
48
|
+
conversationType: ChatType | string;
|
|
49
|
+
unreadCount: number;
|
|
50
|
+
isPinned?: boolean;
|
|
51
|
+
conversationName?: string;
|
|
52
|
+
conversationAvatar?: string;
|
|
53
|
+
lastMessage?: any;
|
|
54
|
+
}>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Apply SDK `onConversationListUpdate`:
|
|
57
|
+
* - remove conversations from `patch.removed`
|
|
58
|
+
* - on `patch.reset`, treat `items` as the authoritative snapshot and drop local extras
|
|
59
|
+
* - upsert unread/name/avatar/lastMessage from `items`
|
|
60
|
+
*/
|
|
61
|
+
syncFromSdkConversationListUpdate(payload: {
|
|
62
|
+
items?: ReadonlyArray<{
|
|
63
|
+
conversationId: string;
|
|
64
|
+
conversationType: ChatType | string;
|
|
65
|
+
unreadCount: number;
|
|
66
|
+
isPinned?: boolean;
|
|
67
|
+
conversationName?: string;
|
|
68
|
+
conversationAvatar?: string;
|
|
69
|
+
lastMessage?: any;
|
|
70
|
+
}>;
|
|
71
|
+
patch?: {
|
|
72
|
+
reset?: boolean;
|
|
73
|
+
removed?: ReadonlyArray<{
|
|
74
|
+
conversationId: string;
|
|
75
|
+
conversationType: ChatType | string;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
}): void;
|
|
79
|
+
clearUnreadForConversation(chatType: ChatType, conversationId: string): void;
|
|
80
|
+
clearAllUnreadCounts(): void;
|
|
34
81
|
setConversation(conversations: Conversation[]): void;
|
|
35
82
|
addConversation(conversation: Conversation): void;
|
|
36
83
|
setSearchList(conversations: Conversation[]): void;
|
|
37
84
|
deleteConversation(conversation: CurrentConversation): void;
|
|
38
85
|
modifyConversation(conversation: Conversation): void;
|
|
39
86
|
topConversation(conversation: Conversation): void;
|
|
40
|
-
getConversation(chatType: ChatType, cvsId: string):
|
|
87
|
+
getConversation(chatType: ChatType, cvsId: string): Conversation;
|
|
41
88
|
setAtType(chatType: ChatType, cvsId: string, atType: AT_TYPE): void;
|
|
42
89
|
setHasConversationNext(hasNext: boolean): void;
|
|
43
90
|
updateConversationName(chatType: ChatType, cvsId: string): void;
|
|
@@ -48,7 +95,7 @@ declare class ConversationStore {
|
|
|
48
95
|
setSilentModeForConversation(cvs: CurrentConversation): void;
|
|
49
96
|
clearRemindTypeForConversation(cvs: CurrentConversation): void;
|
|
50
97
|
getSilentModeForConversations(cvs: CurrentConversation[]): void;
|
|
51
|
-
setOnlineStatus(result: ChatSDK.
|
|
98
|
+
setOnlineStatus(result: readonly ChatSDK.PresenceInfo[]): void;
|
|
52
99
|
clear(): void;
|
|
53
100
|
}
|
|
54
101
|
export default ConversationStore;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
2
|
+
import type { RootStore } from './index';
|
|
3
|
+
declare class ConversationSyncService {
|
|
4
|
+
private rootStore;
|
|
5
|
+
constructor(rootStore: RootStore);
|
|
6
|
+
/**
|
|
7
|
+
* Resolve display name for a newly created conversation.
|
|
8
|
+
* Prefer addressStore, then SDK conversation list / joined groups (SDK 0.20.29+ may already
|
|
9
|
+
* enrich group name after onMembersJoined).
|
|
10
|
+
*/
|
|
11
|
+
private resolveConversationDisplayName;
|
|
12
|
+
/** Sync conversation list when a non-chatRoom message is received */
|
|
13
|
+
syncOnMessageReceived(message: BaseMessageType, conversationId: string, conversationType: string, currentUserId: string): void;
|
|
14
|
+
}
|
|
15
|
+
export default ConversationSyncService;
|