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,4 +1,4 @@
|
|
|
1
|
-
import { ChatSDK } from '../SDK';
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
2
|
import { CurrentConversation } from './ConversationStore';
|
|
3
3
|
import type { ReactionData } from '../reaction/ReactionMessage';
|
|
4
4
|
import { RootStore } from './index';
|
|
@@ -6,28 +6,28 @@ import { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
|
6
6
|
import { NoticeMessageBody } from '../noticeMessage/NoticeMessage';
|
|
7
7
|
export interface Message {
|
|
8
8
|
singleChat: {
|
|
9
|
-
[key: string]: (ChatSDK.
|
|
9
|
+
[key: string]: (ChatSDK.Message | NoticeMessageBody)[];
|
|
10
10
|
};
|
|
11
11
|
groupChat: {
|
|
12
|
-
[key: string]: (ChatSDK.
|
|
12
|
+
[key: string]: (ChatSDK.Message | NoticeMessageBody)[];
|
|
13
13
|
};
|
|
14
14
|
chatRoom: {
|
|
15
|
-
[key: string]: (ChatSDK.
|
|
15
|
+
[key: string]: (ChatSDK.Message | NoticeMessageBody)[];
|
|
16
16
|
};
|
|
17
|
-
byId: Map<string, ChatSDK.
|
|
18
|
-
broadcast: ChatSDK.
|
|
17
|
+
byId: Map<string, ChatSDK.Message | NoticeMessageBody>;
|
|
18
|
+
broadcast: ChatSDK.Message[];
|
|
19
19
|
}
|
|
20
20
|
export interface SelectedMessage {
|
|
21
21
|
singleChat: {
|
|
22
22
|
[key: string]: {
|
|
23
23
|
selectable: boolean;
|
|
24
|
-
selectedMessage: (ChatSDK.
|
|
24
|
+
selectedMessage: (ChatSDK.Message | NoticeMessageBody)[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
groupChat: {
|
|
28
28
|
[key: string]: {
|
|
29
29
|
selectable: boolean;
|
|
30
|
-
selectedMessage: (ChatSDK.
|
|
30
|
+
selectedMessage: (ChatSDK.Message | NoticeMessageBody)[];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -39,29 +39,60 @@ declare class MessageStore {
|
|
|
39
39
|
message: Message;
|
|
40
40
|
selectedMessage: SelectedMessage;
|
|
41
41
|
currentCVS: CurrentConversation;
|
|
42
|
-
repliedMessage: ChatSDK.
|
|
42
|
+
repliedMessage: ChatSDK.Message | null;
|
|
43
43
|
typing: Typing;
|
|
44
44
|
holding: boolean;
|
|
45
45
|
unreadMessageCount: number;
|
|
46
46
|
constructor(rootStore: RootStore);
|
|
47
|
-
get currentCvsMsgs(): (
|
|
48
|
-
setKeyValue(key: string, value: ChatSDK.
|
|
47
|
+
get currentCvsMsgs(): (NoticeMessageBody | ChatSDK.Message)[];
|
|
48
|
+
setKeyValue(key: string, value: ChatSDK.Message | NoticeMessageBody): void;
|
|
49
49
|
setCurrentCVS(currentCVS: CurrentConversation): void;
|
|
50
|
-
addMessage(message: ChatSDK.
|
|
50
|
+
addMessage(message: ChatSDK.Message, chatType: 'singleChat' | 'groupChat', to: string): void;
|
|
51
51
|
updateMessage(params: {
|
|
52
52
|
messageId: string;
|
|
53
53
|
chatType: 'singleChat' | 'groupChat';
|
|
54
54
|
to: string;
|
|
55
55
|
msg: string;
|
|
56
56
|
}): void;
|
|
57
|
-
sendMessage(message: ChatSDK.
|
|
57
|
+
sendMessage(message: ChatSDK.Message): Promise<void>;
|
|
58
|
+
private getSdkConversationType;
|
|
59
|
+
private sendSdk5Message;
|
|
58
60
|
receiveMessage(message: BaseMessageType): void;
|
|
59
|
-
modifyMessage(id: string, message: ChatSDK.
|
|
60
|
-
|
|
61
|
+
modifyMessage(id: string, message: ChatSDK.Message | NoticeMessageBody): void;
|
|
62
|
+
/**
|
|
63
|
+
* Clear unread count for a conversation (SDK 0.20+).
|
|
64
|
+
* Does not notify the peer; other devices receive onMultiDeviceConversation.
|
|
65
|
+
* Resolves true on success, false when skipped/failed.
|
|
66
|
+
*/
|
|
67
|
+
sendChannelAck(cvs: CurrentConversation): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Update send lifecycle status. Prefer sendStatus; keep legacy status for UI overlay.
|
|
70
|
+
*/
|
|
61
71
|
updateMessageStatus(msgId: string, status: string): void;
|
|
62
|
-
|
|
72
|
+
/** Apply peer read receipts from onMessageReadReceipts. */
|
|
73
|
+
applyMessageReadReceipts(events: ReadonlyArray<{
|
|
74
|
+
conversationId: string;
|
|
75
|
+
conversationType: 'singleChat' | 'groupChat';
|
|
76
|
+
messageIds: ReadonlyArray<string>;
|
|
77
|
+
receiptDetails?: ReadonlyArray<{
|
|
78
|
+
messageId: string;
|
|
79
|
+
count: number;
|
|
80
|
+
}>;
|
|
81
|
+
}>): void;
|
|
82
|
+
private isVoiceMessageType;
|
|
83
|
+
private shouldSendReadReceiptForMessage;
|
|
84
|
+
/**
|
|
85
|
+
* Mark received messages as locally receipt-sent via isPeerRead to avoid duplicate sends.
|
|
86
|
+
*/
|
|
87
|
+
private markLocalReadReceiptSent;
|
|
88
|
+
/**
|
|
89
|
+
* Send message read receipts for received single-chat messages (batch, max 50).
|
|
90
|
+
* Skips voice (play-to-ack), already-acked (isPeerRead), and group/chatroom.
|
|
91
|
+
*/
|
|
92
|
+
sendReadReceiptsForConversation(cvs: CurrentConversation): Promise<void>;
|
|
93
|
+
addHistoryMsgs(cvs: CurrentConversation, msgs: any): Promise<void> | undefined;
|
|
63
94
|
clearMessage(cvs: CurrentConversation): void;
|
|
64
|
-
setRepliedMessage(message: ChatSDK.
|
|
95
|
+
setRepliedMessage(message: ChatSDK.Message | null): void;
|
|
65
96
|
deleteMessage(cvs: CurrentConversation, messageId: string | string[]): void | Promise<void>;
|
|
66
97
|
recallMessage(cvs: CurrentConversation, messageId: string, isChatThread?: boolean, recallMySelfMsg?: boolean): Promise<void> | undefined;
|
|
67
98
|
addReaction(cvs: CurrentConversation, messageId: string, emoji: string): Promise<void> | undefined;
|
|
@@ -69,18 +100,22 @@ declare class MessageStore {
|
|
|
69
100
|
updateReactions(cvs: CurrentConversation, messageId: string, reactions: ReactionData[]): void;
|
|
70
101
|
getReactionUserList(cvs: CurrentConversation, messageId: string, reaction: string): Promise<void> | undefined;
|
|
71
102
|
translateMessage(cvs: CurrentConversation, messageId: string, language: string): Promise<unknown>;
|
|
72
|
-
modifyLocalMessage(messageId: string, msg: ChatSDK.
|
|
73
|
-
modifyServerMessage(messageId: string, msg: ChatSDK.
|
|
103
|
+
modifyLocalMessage(messageId: string, msg: ChatSDK.Message, isReceivedModify?: boolean): void;
|
|
104
|
+
modifyServerMessage(messageId: string, msg: ChatSDK.Message): Promise<void>;
|
|
74
105
|
setSelectedMessage(cvs: CurrentConversation, selectedData: {
|
|
75
106
|
selectable: boolean;
|
|
76
|
-
selectedMessage: (ChatSDK.
|
|
107
|
+
selectedMessage: (ChatSDK.Message | NoticeMessageBody)[];
|
|
77
108
|
}): void;
|
|
78
109
|
setTyping(cvs: CurrentConversation, typing: boolean): void;
|
|
79
110
|
sendTypingCmd(cvs: CurrentConversation): void;
|
|
80
111
|
setHoldingStatus(status: boolean): void;
|
|
81
112
|
setUnreadMessageCount(count: number): void;
|
|
82
113
|
shiftBroadcastMessage(): void;
|
|
83
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Send a message-level read receipt (SDK 0.20+: sendMessageReadReceipts).
|
|
116
|
+
* Single chat only. `to` is kept for backward-compatible call sites and is unused.
|
|
117
|
+
*/
|
|
118
|
+
sendReadAck(messageId: string, to?: string): void | Promise<void>;
|
|
84
119
|
clear(): void;
|
|
85
120
|
}
|
|
86
121
|
export default MessageStore;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChatSDK } from '../SDK';
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
2
|
import { ChatType } from 'module/types/messageType';
|
|
3
|
-
export type PinnedMessage = ChatSDK.
|
|
3
|
+
export type PinnedMessage = ChatSDK.PinnedMessageSummary;
|
|
4
4
|
export interface PinnedMessageInfo {
|
|
5
5
|
list: PinnedMessage[];
|
|
6
6
|
cursor: string | null;
|
|
@@ -20,7 +20,7 @@ declare class PinnedMessagesStore {
|
|
|
20
20
|
deletePinnedMessage(conversationType: ChatType, conversationId: string, messageId: string): void;
|
|
21
21
|
setPinnedMessageCursor(conversationType: ChatType, conversationId: string, cursor: string | null): void;
|
|
22
22
|
updatePinnedMessage(conversationType: ChatType, conversationId: string, messageId: string, pinnedTime: number, operatorId?: string): void;
|
|
23
|
-
modifyPinnedMessage(conversationType: ChatType, conversationId: string, message: ChatSDK.
|
|
23
|
+
modifyPinnedMessage(conversationType: ChatType, conversationId: string, message: ChatSDK.Message): void;
|
|
24
24
|
changeVisible(visible: boolean): void;
|
|
25
25
|
pushPinNoticeMessage(params: {
|
|
26
26
|
conversationType: ChatType;
|
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { AppUserInfoProvider } from './AddressStore';
|
|
3
|
+
export type GroupInfo = {
|
|
4
|
+
groupId: string;
|
|
5
|
+
groupName?: string;
|
|
6
|
+
groupAvatar?: string;
|
|
7
|
+
};
|
|
8
|
+
export type GroupInfoProviderResult = GroupInfo[] | Record<string, GroupInfo>;
|
|
9
|
+
export type GroupInfoProvider = (groupIds: string[]) => Promise<GroupInfoProviderResult> | GroupInfoProviderResult;
|
|
10
|
+
export interface UIKitDataProviders {
|
|
11
|
+
userInfo?: AppUserInfoProvider;
|
|
12
|
+
groupInfo?: GroupInfoProvider;
|
|
13
|
+
}
|
|
14
|
+
export interface ProviderInitConfig {
|
|
15
|
+
appKey?: string;
|
|
16
|
+
userId?: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
password?: string;
|
|
19
|
+
translationTargetLanguage?: string;
|
|
20
|
+
useUserInfo?: boolean;
|
|
21
|
+
/** 登录后自动同步的数据类型(对应 SDK enableSyncData),默认 ['contact', 'group', 'conversation'] */
|
|
22
|
+
enableSyncData?: readonly ('contact' | 'group' | 'conversation')[];
|
|
23
|
+
/** 是否启用用户资料同步增强(对应 SDK enableUserInfoSync),默认 false */
|
|
24
|
+
enableUserInfoSync?: boolean;
|
|
25
|
+
msyncUrl?: string;
|
|
26
|
+
restUrl?: string;
|
|
27
|
+
isHttpDNS?: boolean;
|
|
28
|
+
useReplacedMessageContents?: boolean;
|
|
29
|
+
deviceId?: string;
|
|
30
|
+
maxMessages?: number;
|
|
31
|
+
isFixedDeviceId?: boolean;
|
|
32
|
+
useOwnUploadFun?: boolean;
|
|
33
|
+
countMemberJoinToUnread?: boolean;
|
|
34
|
+
}
|
|
2
35
|
export interface ProviderProps {
|
|
3
|
-
initConfig:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
restUrl?: string;
|
|
12
|
-
isHttpDNS?: boolean;
|
|
13
|
-
useReplacedMessageContents?: boolean;
|
|
14
|
-
deviceId?: string;
|
|
15
|
-
maxMessages?: number;
|
|
16
|
-
isFixedDeviceId?: boolean;
|
|
17
|
-
useOwnUploadFun?: boolean;
|
|
18
|
-
countMemberJoinToUnread?: boolean;
|
|
19
|
-
};
|
|
36
|
+
initConfig: ProviderInitConfig;
|
|
37
|
+
/**
|
|
38
|
+
* 用户信息提供器。业务方只需要根据 userId 批量返回用户信息,UIKit 会自动按需调用并缓存。
|
|
39
|
+
* 返回值支持数组或以 userId 为 key 的对象;avatarurl 仍兼容,但推荐使用 avatarUrl。
|
|
40
|
+
* @deprecated Prefer `providers.userInfo`.
|
|
41
|
+
*/
|
|
42
|
+
userInfoProvider?: AppUserInfoProvider;
|
|
43
|
+
providers?: UIKitDataProviders;
|
|
20
44
|
local?: {
|
|
21
45
|
fallbackLng?: string;
|
|
22
46
|
lng?: string;
|
|
@@ -52,7 +76,6 @@ export interface ProviderProps {
|
|
|
52
76
|
edit?: boolean;
|
|
53
77
|
select?: boolean;
|
|
54
78
|
forward?: boolean;
|
|
55
|
-
report?: boolean;
|
|
56
79
|
pin?: boolean;
|
|
57
80
|
};
|
|
58
81
|
messageInput?: {
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { ChatSDK } from '../SDK';
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
|
+
import { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
3
|
+
type ThreadChangeInfo = Partial<ChatSDK.ChatThreadSummary> & {
|
|
4
|
+
id?: string;
|
|
5
|
+
chatThreadId?: string;
|
|
6
|
+
operator?: string;
|
|
7
|
+
operation?: 'create' | 'update' | 'destroy' | 'userRemove';
|
|
8
|
+
members?: string[];
|
|
9
|
+
owner?: string;
|
|
10
|
+
};
|
|
2
11
|
export interface ThreadData {
|
|
3
12
|
[key: string]: {
|
|
4
13
|
[key: string]: {
|
|
5
|
-
info?:
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
originalMessage: ChatSDK.MessageBody;
|
|
14
|
+
info?: ThreadChangeInfo;
|
|
15
|
+
originalMessage: BaseMessageType;
|
|
9
16
|
};
|
|
10
17
|
};
|
|
11
18
|
}
|
|
12
19
|
export interface CurrentThread {
|
|
13
20
|
visible: boolean;
|
|
14
21
|
creating: boolean;
|
|
15
|
-
info?:
|
|
16
|
-
|
|
17
|
-
members?: string[];
|
|
18
|
-
};
|
|
19
|
-
originalMessage: ChatSDK.MessageBody;
|
|
22
|
+
info?: ThreadChangeInfo;
|
|
23
|
+
originalMessage: BaseMessageType;
|
|
20
24
|
}
|
|
21
25
|
declare class ThreadStore {
|
|
22
26
|
rootStore: any;
|
|
@@ -32,10 +36,12 @@ declare class ThreadStore {
|
|
|
32
36
|
setThread(thread: ThreadData): void;
|
|
33
37
|
setCurrentThread(thread: CurrentThread): void;
|
|
34
38
|
setThreadVisible(visible: boolean): void;
|
|
35
|
-
updateThreadInfo(threadInfo:
|
|
39
|
+
updateThreadInfo(threadInfo: ThreadChangeInfo): void;
|
|
36
40
|
updateMultiDeviceEvent(msg: any): void;
|
|
37
41
|
getChatThreadDetail(threadId: string): Promise<void>;
|
|
38
|
-
getThreadMembers(parentId: string, threadId: string, cursor?: string): Promise<string[]
|
|
42
|
+
getThreadMembers(parentId: string, threadId: string, cursor?: string): Promise<string[] & {
|
|
43
|
+
cursor?: string;
|
|
44
|
+
}>;
|
|
39
45
|
removeChatThreadMember(parentId: string, threadId: string, userId: string): any;
|
|
40
46
|
joinChatThread(chatThreadId: string): any;
|
|
41
47
|
getGroupChatThreads(parentId: string, cursor?: string): Promise<string | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
2
|
+
import type { RootStore } from './index';
|
|
3
|
+
declare class UserInfoSyncService {
|
|
4
|
+
private rootStore;
|
|
5
|
+
constructor(rootStore: RootStore);
|
|
6
|
+
/** Extract user info from message ext and sync to addressStore */
|
|
7
|
+
syncOnMessageReceived(message: BaseMessageType, conversationType: string): void;
|
|
8
|
+
}
|
|
9
|
+
export default UserInfoSyncService;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import MessageStore, { Message, SelectedMessage, Typing } from './MessageStore';
|
|
2
2
|
import ConversationStore, { AT_TYPE, Conversation, CurrentConversation, ById } from './ConversationStore';
|
|
3
3
|
import AddressStore, { MemberRole, MemberItem, GroupItem, AppUserInfo } from './AddressStore';
|
|
4
|
+
import type { AppUserInfoProvider } from './AddressStore';
|
|
4
5
|
import ThreadStore, { ThreadData, CurrentThread } from './ThreadStore';
|
|
5
6
|
import PinnedMessagesStore from './PinnedMessagesStore';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
7
|
+
import UserInfoSyncService from './UserInfoSyncService';
|
|
8
|
+
import ConversationSyncService from './ConversationSyncService';
|
|
9
|
+
import type { UIKitChatClient } from 'module/SDK';
|
|
10
|
+
import { ProviderInitConfig } from '../store/Provider';
|
|
8
11
|
type InitConfig = {
|
|
9
12
|
appKey?: string;
|
|
10
13
|
appId?: string;
|
|
@@ -15,13 +18,18 @@ declare class RootStore {
|
|
|
15
18
|
addressStore: AddressStore;
|
|
16
19
|
threadStore: ThreadStore;
|
|
17
20
|
pinnedMessagesStore: PinnedMessagesStore;
|
|
18
|
-
|
|
21
|
+
userInfoSyncService: UserInfoSyncService;
|
|
22
|
+
conversationSyncService: ConversationSyncService;
|
|
23
|
+
client: UIKitChatClient;
|
|
24
|
+
userInfoProvider?: AppUserInfoProvider;
|
|
19
25
|
loginState: boolean;
|
|
20
|
-
initConfig:
|
|
26
|
+
initConfig: ProviderInitConfig;
|
|
21
27
|
constructor();
|
|
22
|
-
setClient(client:
|
|
28
|
+
setClient(client: UIKitChatClient): void;
|
|
23
29
|
setLoginState(state: boolean): void;
|
|
24
30
|
setInitConfig(initConfig: InitConfig): void;
|
|
31
|
+
setUserInfoProvider(userInfoProvider?: AppUserInfoProvider): void;
|
|
32
|
+
shouldAutoFetchUserInfo(): boolean;
|
|
25
33
|
clear(): void;
|
|
26
34
|
}
|
|
27
35
|
export declare function getStore(): RootStore;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { UIKitChatClient } from 'module/SDK';
|
|
3
3
|
import { RootStore } from './index';
|
|
4
|
+
import type { ProviderInitConfig, UIKitDataProviders } from './Provider';
|
|
4
5
|
export interface RootConsumerProps {
|
|
5
6
|
rootStore: RootStore;
|
|
6
|
-
client:
|
|
7
|
+
client: UIKitChatClient;
|
|
7
8
|
}
|
|
8
9
|
export interface ContextProps {
|
|
9
10
|
rootStore: RootStore;
|
|
10
|
-
initConfig:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
token?: string;
|
|
14
|
-
userId?: string;
|
|
15
|
-
translationTargetLanguage?: string;
|
|
16
|
-
useUserInfo?: boolean;
|
|
17
|
-
maxMessages?: number;
|
|
18
|
-
isFixedDeviceId?: boolean;
|
|
19
|
-
useOwnUploadFun?: boolean;
|
|
20
|
-
};
|
|
21
|
-
client: ChatSDK.Connection;
|
|
11
|
+
initConfig: ProviderInitConfig;
|
|
12
|
+
client: UIKitChatClient;
|
|
13
|
+
providers?: UIKitDataProviders;
|
|
22
14
|
features?: {
|
|
23
15
|
chat?: {
|
|
24
16
|
header?: {
|
|
@@ -42,7 +34,6 @@ export interface ContextProps {
|
|
|
42
34
|
edit?: boolean;
|
|
43
35
|
select?: boolean;
|
|
44
36
|
forward?: boolean;
|
|
45
|
-
report?: boolean;
|
|
46
37
|
pin?: boolean;
|
|
47
38
|
};
|
|
48
39
|
messageInput?: {
|
|
@@ -72,7 +63,6 @@ export interface ContextProps {
|
|
|
72
63
|
moreAction?: boolean;
|
|
73
64
|
delete?: boolean;
|
|
74
65
|
translate?: boolean;
|
|
75
|
-
report?: boolean;
|
|
76
66
|
};
|
|
77
67
|
messageInput?: {
|
|
78
68
|
emoji?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
3
|
import type { TextMessageType } from '../types/messageType';
|
|
4
|
-
import { ChatSDK } from '../SDK';
|
|
4
|
+
import type { ChatSDK } from '../SDK';
|
|
5
5
|
export interface TextMessageProps extends BaseMessageProps {
|
|
6
|
-
textMessage: TextMessageType;
|
|
6
|
+
textMessage: TextMessageType | ChatSDK.Message;
|
|
7
7
|
type?: 'primary' | 'secondly';
|
|
8
8
|
prefix?: string;
|
|
9
9
|
nickName?: string;
|
|
@@ -13,7 +13,7 @@ export interface TextMessageProps extends BaseMessageProps {
|
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
15
15
|
onCreateThread?: () => void;
|
|
16
|
-
onTranslateTextMessage?: (textMessage: ChatSDK.
|
|
16
|
+
onTranslateTextMessage?: (textMessage: ChatSDK.Message) => boolean;
|
|
17
17
|
targetLanguage?: string;
|
|
18
18
|
showTranslation?: boolean;
|
|
19
19
|
onlyContent?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ChatSDK } from 'module/SDK';
|
|
2
|
+
import type { ChatSDK } from 'module/SDK';
|
|
3
3
|
export interface ThreadListProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
prefix?: string;
|
|
@@ -8,7 +8,7 @@ export interface ThreadListProps {
|
|
|
8
8
|
onClear?: () => void;
|
|
9
9
|
headerContent?: React.ReactNode;
|
|
10
10
|
onClose?: () => void;
|
|
11
|
-
onClickItem?: (data: ChatSDK.
|
|
11
|
+
onClickItem?: (data: ChatSDK.ChatThreadSummary) => void;
|
|
12
12
|
renderHeader?: () => React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
declare const _default: ((props: ThreadListProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
@@ -1,5 +1,45 @@
|
|
|
1
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
-
export type ChatType =
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
|
+
export type ChatType = ChatSDK.ChatConversationType;
|
|
3
|
+
type TextBody = {
|
|
4
|
+
content: string;
|
|
5
|
+
targetLanguages?: string[];
|
|
6
|
+
translations?: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
type ImageBody = {
|
|
9
|
+
localUrl?: string;
|
|
10
|
+
filename?: string;
|
|
11
|
+
filetype?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
isGif?: boolean;
|
|
15
|
+
isOriginalImage?: boolean;
|
|
16
|
+
originalImageUrl?: string;
|
|
17
|
+
bigImageUrl?: string;
|
|
18
|
+
secret?: string;
|
|
19
|
+
fileLength?: number;
|
|
20
|
+
thumbnailUrl?: string;
|
|
21
|
+
};
|
|
22
|
+
type FileBody = {
|
|
23
|
+
url?: string;
|
|
24
|
+
filename?: string;
|
|
25
|
+
filetype?: string;
|
|
26
|
+
fileSize?: number;
|
|
27
|
+
fileLength?: number;
|
|
28
|
+
secret?: string;
|
|
29
|
+
};
|
|
30
|
+
type VoiceBody = FileBody & {
|
|
31
|
+
duration: number;
|
|
32
|
+
};
|
|
33
|
+
type VideoBody = VoiceBody & {
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
thumbnailUrl?: string;
|
|
37
|
+
};
|
|
38
|
+
type CustomBody = {
|
|
39
|
+
event: string;
|
|
40
|
+
params?: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
type LocalMessageType = 'text' | 'image' | 'file' | 'voice' | 'video' | 'location' | 'cmd' | 'custom' | 'combine';
|
|
3
43
|
export type MessageStatus = 'received' | 'read' | 'unread' | 'sent' | 'failed' | 'sending' | 'default';
|
|
4
44
|
export interface FileObj {
|
|
5
45
|
url: string;
|
|
@@ -65,11 +105,16 @@ declare enum ONLINESTATETYPE {
|
|
|
65
105
|
NONE = 3
|
|
66
106
|
}
|
|
67
107
|
interface BaseMessage {
|
|
68
|
-
|
|
108
|
+
msgLocalId: string;
|
|
109
|
+
msgServerId: string;
|
|
69
110
|
to: string;
|
|
70
111
|
from: string;
|
|
71
|
-
|
|
72
|
-
|
|
112
|
+
sender: ChatSDK.Sender;
|
|
113
|
+
conversationId: string;
|
|
114
|
+
conversationType: ChatType;
|
|
115
|
+
timestamp: number;
|
|
116
|
+
type: LocalMessageType;
|
|
117
|
+
body: ChatSDK.MessageBody;
|
|
73
118
|
ext?: {
|
|
74
119
|
[key: string]: any;
|
|
75
120
|
};
|
|
@@ -82,64 +127,51 @@ interface BaseMessage {
|
|
|
82
127
|
reactions?: Reaction[];
|
|
83
128
|
chatThreadOverview?: ChatThreadOverview;
|
|
84
129
|
onlineState?: ONLINESTATETYPE;
|
|
85
|
-
|
|
86
|
-
|
|
130
|
+
/** @deprecated Prefer sendStatus + isPeerRead / groupReadCount / isDelivered */
|
|
131
|
+
status?: MessageStatus;
|
|
132
|
+
/** SDK 0.20+: sending | sent | failed */
|
|
133
|
+
sendStatus?: 'sending' | 'sent' | 'failed';
|
|
134
|
+
/** SDK 0.20+: whether peer has read an outgoing single-chat message */
|
|
135
|
+
isPeerRead?: boolean;
|
|
136
|
+
/** SDK 0.20+: cumulative group read count */
|
|
137
|
+
groupReadCount?: number;
|
|
138
|
+
/** UIKit overlay from onMessageDelivered */
|
|
139
|
+
isDelivered?: boolean;
|
|
140
|
+
bySelf?: boolean;
|
|
141
|
+
chatThread?: {
|
|
142
|
+
parentId?: string;
|
|
143
|
+
};
|
|
87
144
|
}
|
|
88
145
|
export interface FileMessageType extends BaseMessage {
|
|
89
146
|
type: 'file';
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
file_length: number;
|
|
93
|
-
url: string;
|
|
94
|
-
body?: {
|
|
95
|
-
url: string;
|
|
96
|
-
type: string;
|
|
97
|
-
filename: string;
|
|
98
|
-
};
|
|
147
|
+
body: FileBody;
|
|
148
|
+
file?: FileObj;
|
|
99
149
|
}
|
|
100
150
|
export interface TextMessageType extends BaseMessage {
|
|
101
|
-
type: '
|
|
102
|
-
|
|
103
|
-
modifiedInfo
|
|
151
|
+
type: 'text';
|
|
152
|
+
body: TextBody;
|
|
153
|
+
modifiedInfo?: {
|
|
154
|
+
operationTime?: number;
|
|
155
|
+
operatorId?: string;
|
|
156
|
+
operationCount?: number;
|
|
157
|
+
};
|
|
104
158
|
}
|
|
105
159
|
export interface CustomMessageType extends BaseMessage {
|
|
106
160
|
type: 'custom';
|
|
107
|
-
|
|
108
|
-
customExts: {
|
|
109
|
-
[key: string]: any;
|
|
110
|
-
};
|
|
161
|
+
body: CustomBody;
|
|
111
162
|
}
|
|
112
163
|
export interface ImageMessageType extends BaseMessage {
|
|
113
|
-
type: '
|
|
114
|
-
|
|
164
|
+
type: 'image';
|
|
165
|
+
body: ImageBody;
|
|
166
|
+
file?: FileObj;
|
|
115
167
|
width?: number;
|
|
116
168
|
height?: number;
|
|
117
|
-
file_length?: number;
|
|
118
169
|
fileInputId?: string;
|
|
119
|
-
thumb?: string;
|
|
120
|
-
thumb_secret?: string;
|
|
121
|
-
secret?: string;
|
|
122
|
-
url: string;
|
|
123
|
-
body?: {
|
|
124
|
-
url: string;
|
|
125
|
-
type: string;
|
|
126
|
-
filename: string;
|
|
127
|
-
};
|
|
128
170
|
}
|
|
129
171
|
export interface AudioMessageType extends BaseMessage {
|
|
130
|
-
type: '
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
file_length: number;
|
|
134
|
-
url?: string;
|
|
135
|
-
secret?: string;
|
|
136
|
-
filetype?: string;
|
|
137
|
-
body?: {
|
|
138
|
-
url: string;
|
|
139
|
-
type: string;
|
|
140
|
-
filename: string;
|
|
141
|
-
};
|
|
142
|
-
file: {
|
|
172
|
+
type: 'voice';
|
|
173
|
+
body: VoiceBody;
|
|
174
|
+
file?: {
|
|
143
175
|
url: string;
|
|
144
176
|
filename: string;
|
|
145
177
|
filetype: 'audio';
|
|
@@ -150,17 +182,7 @@ export interface AudioMessageType extends BaseMessage {
|
|
|
150
182
|
}
|
|
151
183
|
export interface VideoMessageType extends BaseMessage {
|
|
152
184
|
type: 'video';
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
length: number;
|
|
156
|
-
file_length: number;
|
|
157
|
-
url?: string;
|
|
158
|
-
secret?: string;
|
|
159
|
-
filetype?: string;
|
|
160
|
-
body?: {
|
|
161
|
-
url: string;
|
|
162
|
-
type: string;
|
|
163
|
-
filename: string;
|
|
164
|
-
};
|
|
185
|
+
body: VideoBody;
|
|
186
|
+
file?: object;
|
|
165
187
|
}
|
|
166
188
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
3
|
import type { CustomMessageType } from '../types/messageType';
|
|
4
|
+
import type { ChatSDK } from 'module/SDK';
|
|
4
5
|
export interface UserCardMessageProps extends BaseMessageProps {
|
|
5
|
-
customMessage: CustomMessageType;
|
|
6
|
+
customMessage: CustomMessageType | ChatSDK.Message;
|
|
6
7
|
prefix?: string;
|
|
7
8
|
style?: React.CSSProperties;
|
|
8
9
|
className?: string;
|
|
@@ -12,5 +13,5 @@ export interface UserCardMessageProps extends BaseMessageProps {
|
|
|
12
13
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
13
14
|
onUserIdCopied?: (userId: string) => void;
|
|
14
15
|
}
|
|
15
|
-
declare let UserCardMessage: (props: UserCardMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare let UserCardMessage: (props: UserCardMessageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
17
|
export { UserCardMessage };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChatType } from '../types/messageType';
|
|
2
|
+
import { type MessageLike } from './message';
|
|
3
|
+
export type ConversationLike = (Record<string, any> & {
|
|
4
|
+
chatType?: ChatType;
|
|
5
|
+
conversationType?: ChatType;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
lastMessage?: MessageLike;
|
|
9
|
+
latestMessage?: MessageLike;
|
|
10
|
+
unreadCount?: number;
|
|
11
|
+
unreadNum?: number;
|
|
12
|
+
name?: string;
|
|
13
|
+
conversationName?: string;
|
|
14
|
+
isPinned?: boolean;
|
|
15
|
+
pinned?: boolean;
|
|
16
|
+
silent?: boolean;
|
|
17
|
+
}) | null | undefined;
|
|
18
|
+
export declare const getConversationId: (conversation?: ConversationLike) => any;
|
|
19
|
+
export declare const getConversationChatType: (conversation?: ConversationLike) => ChatType | undefined;
|
|
20
|
+
export declare const getConversationName: (conversation?: ConversationLike) => any;
|
|
21
|
+
export declare const getConversationUnreadCount: (conversation?: ConversationLike) => any;
|
|
22
|
+
export declare const isConversationPinned: (conversation?: ConversationLike) => boolean;
|
|
23
|
+
export declare const isConversationSilent: (conversation?: ConversationLike) => boolean;
|
|
24
|
+
export declare const getConversationLastMessage: (conversation?: ConversationLike) => MessageLike;
|
|
25
|
+
export declare const getConversationLastMessageTime: (conversation?: ConversationLike) => any;
|
|
26
|
+
export declare const toConversationKey: (conversation?: ConversationLike) => string;
|