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,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export type EventName = 'joinChatRoom' | 'leaveChatRoom' | 'reportMessage' | 'getChatRoomDetails' | 'sendMessage' | 'fetchUserInfoById' | 'translateMessage' | 'recallMessage' | 'deleteConversation' | 'modifyMessage' | 'createChatThread' | 'destroyChatThread' | 'leaveChatThread' | 'setGroupMemberAttributes' | 'muteChatRoomMember' | 'getChatRoomMutelist' | 'unmuteChatRoomMember' | 'removeChatRoomMember' | 'getSilentModeForConversations' | 'setSilentModeForConversation' | 'clearRemindTypeForConversation' | 'getGroupInfo' | 'modifyGroup' | 'destroyGroup' | 'leaveGroup' | 'createGroup' | 'inviteToGroup' | 'removeGroupMembers' | 'changeGroupOwner' | 'pinConversation' | 'getServerPinnedConversations' | 'removeHistoryMessages' | 'addReaction' | 'deleteReaction' | 'getReactionDetail' | 'joinChatThread' | 'getChatThreads' | 'getChatThreadLastMessage' | 'getAllContacts' | 'getJoinedGroups' | 'open' | 'setContactRemark' | 'addContact' | 'deleteContact' | 'getPinnedMessages' | 'pinMessage' | 'unpinMessage' | 'jumpToPinnedMessage' | 'addUsersToBlocklist' | 'removeUserFromBlocklist' | 'publishPresence' | 'getBlockList' | 'getConversationlist';
|
|
1
|
+
export type EventName = 'joinChatRoom' | 'leaveChatRoom' | 'getChatRoomDetails' | 'sendMessage' | 'fetchUserInfoById' | 'translateMessage' | 'recallMessage' | 'deleteConversation' | 'modifyMessage' | 'createChatThread' | 'destroyChatThread' | 'leaveChatThread' | 'setGroupMemberAttributes' | 'muteChatRoomMember' | 'getChatRoomMutelist' | 'unmuteChatRoomMember' | 'removeChatRoomMember' | 'getSilentModeForConversations' | 'setSilentModeForConversation' | 'clearRemindTypeForConversation' | 'getGroupInfo' | 'modifyGroup' | 'destroyGroup' | 'leaveGroup' | 'createGroup' | 'inviteToGroup' | 'removeGroupMembers' | 'changeGroupOwner' | 'pinConversation' | 'getServerPinnedConversations' | 'removeHistoryMessages' | 'addReaction' | 'deleteReaction' | 'getReactionDetail' | 'joinChatThread' | 'getChatThreads' | 'getChatThreadLastMessage' | 'getAllContacts' | 'getJoinedGroups' | 'open' | 'setContactRemark' | 'addContact' | 'deleteContact' | 'getPinnedMessages' | 'pinMessage' | 'unpinMessage' | 'jumpToPinnedMessage' | 'addUsersToBlocklist' | 'removeUserFromBlocklist' | 'publishPresence' | 'getBlockList' | 'getConversationlist' | 'clearConversationUnreadMessageCount';
|
|
3
2
|
export type EventHandlerData = {
|
|
4
3
|
[key in EventName]?: {
|
|
5
4
|
success?: () => void;
|
|
6
|
-
error?: (err:
|
|
5
|
+
error?: (err: unknown) => void;
|
|
7
6
|
};
|
|
8
7
|
} & {
|
|
9
|
-
onError: (err:
|
|
8
|
+
onError: (err: unknown) => void;
|
|
10
9
|
};
|
|
11
10
|
export declare class EventHandler {
|
|
12
11
|
handlerData: {
|
|
@@ -18,6 +17,6 @@ export declare class EventHandler {
|
|
|
18
17
|
addEventHandler(eventHandlerId: string, eventHandler: EventHandlerData): void;
|
|
19
18
|
removeEventHandler(eventHandlerId: string): void;
|
|
20
19
|
dispatchSuccess(eventName: EventName): void;
|
|
21
|
-
dispatchError(eventName: EventName, error:
|
|
20
|
+
dispatchError(eventName: EventName, error: unknown): void;
|
|
22
21
|
}
|
|
23
22
|
export declare const eventHandler: EventHandler;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AudioMessage, BaseMessage, FileMessage, ImageMessage, NoticeMessage, TextMessage, VideoMessage, CombinedMessage, RepliedMsg, UnsentRepliedMsg, MessageStatus, Chat, MessageList, ContactList, ConversationList, ConversationItem, MessageInput, Header, Empty, RecalledMessage, rootStore, RootContext, RootProvider, RootConsumer, Provider, useClient, useConversations, useHistoryMessages, useSDK, useIsMobile, useScreen, useConversationContext, useChatroomContext, useChatContext, useAddressContext, useThreadContext, Thread, UserProfile, Blocklist, Chatroom, ChatroomMember, ChatroomMessage, ContactDetail, ContactItem, GroupDetail, GroupMember, UserCardMessage, UserSelect, usePinnedMessage, PinnedMessage } from './module/index';
|
|
3
|
+
import CallKit, { InvitationInfo, InvitationNotificationProps, CallKitProps, VideoWindowProps, LayoutMode, InvitationContent, CallKitRef, CallKitRTCProvider, RTCTokenInfo, RTCUidUserIdMap } from './module/callkit';
|
|
4
|
+
declare const UIKitProvider: import("react").NamedExoticComponent<import("./module/index").ProviderProps>;
|
|
5
|
+
import { Avatar, Button, Input, Badge, Checkbox, Dropdown, Icon, List, Modal, Popover, Switch, Tooltip, ScrollList, Collapse, UserItem } from './component/entry';
|
|
6
|
+
import { eventHandler, EventHandlerData, EventName } from './eventHandler';
|
|
7
|
+
import { MessageInputProps } from './module/index';
|
|
8
|
+
declare const MessageEditor: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<MessageInputProps & import("react").RefAttributes<import("./module/messageInput").MessageInputRef>, "ref"> & import("react").RefAttributes<import("./module/messageInput").MessageInputRef>>>;
|
|
9
|
+
type MessageEditorProps = MessageInputProps;
|
|
10
|
+
export type { MessageEditorProps };
|
|
11
|
+
export { AudioMessage, BaseMessage, FileMessage, ImageMessage, NoticeMessage, TextMessage, VideoMessage, CombinedMessage, RepliedMsg, UnsentRepliedMsg, MessageStatus, Chat, MessageList, ContactList, ConversationList, ConversationItem, MessageInput, MessageEditor, Header, Empty, PinnedMessage, RecalledMessage, rootStore, RootContext, RootProvider, RootConsumer, Provider, useClient, useConversations, useHistoryMessages, useSDK, useConversationContext, useChatroomContext, useChatContext, useAddressContext, useThreadContext, usePinnedMessage, useIsMobile, useScreen, Avatar, Button, Input, Badge, Checkbox, Dropdown, Icon, List, Modal, Popover, UIKitProvider, Switch, Tooltip, ScrollList, Collapse, Thread, UserProfile, Blocklist, Chatroom, ChatroomMember, ChatroomMessage, eventHandler, ContactDetail, ContactItem, GroupDetail, GroupMember, UserCardMessage, UserItem, UserSelect, CallKit, InvitationContent, };
|
|
12
|
+
export type { AvatarProps, ButtonProps, ButtonShape, ButtonSize, ButtonType, InputProps, BadgeProps, CheckboxProps, DropdownProps, IconProps, ICON_TYPES, ListProps, ModalProps, PopoverProps, SwitchProps, ScrollListProps, CollapseProps, UserItemProps, } from './component/entry';
|
|
13
|
+
export type { AudioMessageProps, BaseMessageProps, FileMessageProps, ImageMessageProps, ImagePreviewProps, NoticeMessageProps, TextMessageProps, VideoMessageProps, MessageStatusProps, CombinedMessageProps, 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, PinnedMessageProps, } from './module/index';
|
|
14
|
+
export type { InvitationInfo, InvitationNotificationProps, CallKitProps, VideoWindowProps, LayoutMode, CallKitRef, CallKitRTCProvider, RTCTokenInfo, RTCUidUserIdMap, };
|
|
15
|
+
export type { EventHandlerData, EventName };
|
package/types/module/SDK.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ChatClient, ChatManager, ChatRoomManager, ChatThreadManager, ContactManager, GroupManager, PresenceManager, PushManager, UserInfoManager } from 'easemob-websdk';
|
|
2
|
+
import type * as ChatSDK from 'easemob-websdk';
|
|
3
|
+
export declare const UIKitManagers: readonly [typeof ChatManager, typeof ContactManager, typeof GroupManager, typeof ChatRoomManager, typeof PresenceManager, typeof PushManager, typeof UserInfoManager, typeof ChatThreadManager];
|
|
4
|
+
export { ChatClient, ChatManager, ChatRoomManager, ChatThreadManager, ContactManager, GroupManager, PresenceManager, PushManager, UserInfoManager, };
|
|
5
|
+
export type UIKitChatClient = ChatClient & {
|
|
6
|
+
readonly chatManager: ChatManager;
|
|
7
|
+
readonly contactManager: ContactManager;
|
|
8
|
+
readonly groupManager: GroupManager;
|
|
9
|
+
readonly chatRoomManager: ChatRoomManager;
|
|
10
|
+
readonly presenceManager: PresenceManager;
|
|
11
|
+
readonly pushManager: PushManager;
|
|
12
|
+
readonly userInfoManager: UserInfoManager;
|
|
13
|
+
readonly chatThreadManager: ChatThreadManager;
|
|
14
|
+
};
|
|
15
|
+
export type { ChatSDK };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { MessageStatusProps } from '../messageStatus';
|
|
3
3
|
import { CustomMessageQuoteRenderer } from '../repliedMessage';
|
|
4
|
-
import { ChatSDK } from '../SDK';
|
|
4
|
+
import type { ChatSDK } from '../SDK';
|
|
5
5
|
import { ReactionData, ReactionMessageProps } from '../reaction';
|
|
6
6
|
interface CustomAction {
|
|
7
7
|
visible: boolean;
|
|
@@ -13,7 +13,31 @@ interface CustomAction {
|
|
|
13
13
|
onClick?: (message: BaseMessageType) => void;
|
|
14
14
|
}[];
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type BaseSdkMessageFields = Omit<Partial<ChatSDK.Message>, 'body' | 'status' | 'type' | 'chatThreadOverview' | 'chatThread'>;
|
|
17
|
+
export type BaseMessageType = BaseSdkMessageFields & {
|
|
18
|
+
msgLocalId?: string;
|
|
19
|
+
msgServerId?: string;
|
|
20
|
+
from?: string;
|
|
21
|
+
to?: string;
|
|
22
|
+
sender?: ChatSDK.Sender;
|
|
23
|
+
conversationId?: string;
|
|
24
|
+
conversationType?: ChatSDK.ChatConversationType;
|
|
25
|
+
type?: string;
|
|
26
|
+
body?: Record<string, any>;
|
|
27
|
+
ext?: Record<string, any>;
|
|
28
|
+
status?: string;
|
|
29
|
+
timestamp?: number;
|
|
30
|
+
bySelf?: boolean;
|
|
31
|
+
isChatThread?: boolean;
|
|
32
|
+
chatThread?: {
|
|
33
|
+
parentId?: string;
|
|
34
|
+
};
|
|
35
|
+
chatThreadOverview?: ChatSDK.ChatThreadSummary | Record<string, any>;
|
|
36
|
+
chatType?: ChatSDK.ChatConversationType;
|
|
37
|
+
id?: string;
|
|
38
|
+
mid?: string;
|
|
39
|
+
msg?: string;
|
|
40
|
+
};
|
|
17
41
|
export interface renderUserProfileProps {
|
|
18
42
|
userId: string;
|
|
19
43
|
}
|
|
@@ -37,7 +61,7 @@ export interface BaseMessageProps {
|
|
|
37
61
|
style?: React.CSSProperties;
|
|
38
62
|
time?: number;
|
|
39
63
|
hasRepliedMsg?: boolean;
|
|
40
|
-
repliedMessage?:
|
|
64
|
+
repliedMessage?: BaseMessageType;
|
|
41
65
|
customAction?: CustomAction;
|
|
42
66
|
reaction?: boolean;
|
|
43
67
|
select?: boolean;
|
|
@@ -55,18 +79,17 @@ export interface BaseMessageProps {
|
|
|
55
79
|
onSelectMessage?: () => void;
|
|
56
80
|
onResendMessage?: () => void;
|
|
57
81
|
onForwardMessage?: (message: BaseMessageType) => void;
|
|
58
|
-
onReportMessage?: (message: BaseMessageType) => void;
|
|
59
82
|
onPinMessage?: () => void;
|
|
60
83
|
onMessageCheckChange?: (checked: boolean) => void;
|
|
61
84
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
62
85
|
onCreateThread?: () => void;
|
|
63
86
|
thread?: boolean;
|
|
64
|
-
chatThreadOverview?: ChatSDK.
|
|
87
|
+
chatThreadOverview?: ChatSDK.ChatThreadSummary;
|
|
65
88
|
showNicknamesForAllMessages?: boolean;
|
|
66
89
|
onClickThreadTitle?: () => void;
|
|
67
90
|
reactionConfig?: ReactionMessageProps['reactionConfig'];
|
|
68
91
|
formatDateTime?: (time: number) => string;
|
|
69
|
-
onClick?: (message:
|
|
92
|
+
onClick?: (message: BaseMessageType) => boolean;
|
|
70
93
|
/** 自定义消息被引用时的渲染器 */
|
|
71
94
|
renderCustomMessageQuote?: CustomMessageQuoteRenderer;
|
|
72
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CallKit } from './CallKit';
|
|
2
2
|
import VideoLayout from './VideoLayout';
|
|
3
3
|
import CallControls from './components/CallControls';
|
|
4
|
-
export type { CallKitProps, CallKitRef, VideoWindowProps, LayoutMode, InvitationInfo, InvitationNotificationProps, } from './types/index';
|
|
4
|
+
export type { CallKitProps, CallKitRef, VideoWindowProps, LayoutMode, InvitationInfo, InvitationNotificationProps, CallKitRTCProvider, RTCTokenInfo, RTCUidUserIdMap, } from './types/index';
|
|
5
5
|
export type { CallError, CallErrorCode } from './services/CallError';
|
|
6
6
|
export type { CallInfo } from './services/CallService';
|
|
7
7
|
export type { VideoLayoutProps } from './VideoLayout';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { VideoEncoderConfigurationPreset } from 'agora-rtc-sdk-ng';
|
|
2
|
-
import { VideoWindowProps } from '../types/index';
|
|
2
|
+
import type { CallKitRTCProvider, VideoWindowProps } from '../types/index';
|
|
3
3
|
import CallError from './CallError';
|
|
4
|
-
import { ChatSDK } from 'module/SDK';
|
|
5
4
|
export declare enum CALL_STATUS {
|
|
6
5
|
IDLE = 0,
|
|
7
6
|
INVITING = 1,
|
|
@@ -88,6 +87,7 @@ export interface CallServiceConfig {
|
|
|
88
87
|
onRingtoneStart?: (type: 'outgoing' | 'incoming') => void;
|
|
89
88
|
onRingtoneEnd?: (type: 'outgoing' | 'incoming') => void;
|
|
90
89
|
useRTCToken?: boolean;
|
|
90
|
+
rtcProvider?: CallKitRTCProvider;
|
|
91
91
|
}
|
|
92
92
|
export declare class CallService {
|
|
93
93
|
private client;
|
|
@@ -97,11 +97,11 @@ export declare class CallService {
|
|
|
97
97
|
private userId;
|
|
98
98
|
private connection;
|
|
99
99
|
private accessToken?;
|
|
100
|
+
private rtcTokenChannelName;
|
|
100
101
|
private currentCallInfo;
|
|
101
102
|
private callStatus;
|
|
102
|
-
private
|
|
103
|
+
private callTimer;
|
|
103
104
|
private timer;
|
|
104
|
-
private intervalTimer;
|
|
105
105
|
private joinedMembers;
|
|
106
106
|
private invitedMembers;
|
|
107
107
|
private userInfos;
|
|
@@ -135,27 +135,33 @@ export declare class CallService {
|
|
|
135
135
|
private onRingtoneEnd?;
|
|
136
136
|
private cachedGroupInfos;
|
|
137
137
|
private speakingVolumeThreshold;
|
|
138
|
-
private
|
|
139
|
-
private incomingRingtoneAudio;
|
|
140
|
-
private outgoingRingtoneSrc?;
|
|
141
|
-
private incomingRingtoneSrc?;
|
|
142
|
-
private enableRingtone;
|
|
143
|
-
private ringtoneVolume;
|
|
144
|
-
private ringtoneLoop;
|
|
145
|
-
private isRingtonePlaying;
|
|
146
|
-
private currentRingtoneType;
|
|
138
|
+
private ringtoneManager;
|
|
147
139
|
private creatingVideoTrack;
|
|
148
140
|
private encoderConfig?;
|
|
149
141
|
private creatingAudioTrack;
|
|
150
142
|
private UIdToUserIdMap;
|
|
151
143
|
private enableMic;
|
|
152
144
|
private useRTCToken;
|
|
145
|
+
private rtcProvider?;
|
|
153
146
|
constructor(config: CallServiceConfig);
|
|
154
147
|
setUIdToUserIdMap(uid: string, userId: string): void;
|
|
155
|
-
|
|
148
|
+
private toUidKey;
|
|
149
|
+
private getUserIdFromUid;
|
|
150
|
+
private mapUidToUserId;
|
|
151
|
+
/** 1v1 场景:映射失败时回退到通话对端 IM userId */
|
|
152
|
+
private get1v1PeerUserId;
|
|
153
|
+
/** Provider 优先,否则使用 SDK5 connection.getUserIdsWithRTCUids。 */
|
|
154
|
+
private resolveUserIdByRtcUid;
|
|
155
|
+
private getCurrentUserId;
|
|
156
|
+
private getClientResource;
|
|
157
|
+
private createCallCmdMessage;
|
|
158
|
+
private sendCallMessage;
|
|
159
|
+
getAccessToken(channelName?: string): Promise<string | null>;
|
|
160
|
+
private hasValidRTCJoinInfo;
|
|
156
161
|
setUserInfo(userInfo: {
|
|
157
162
|
[key: string]: any;
|
|
158
163
|
}): void;
|
|
164
|
+
getCachedUserInfo(userId: string): any;
|
|
159
165
|
getCallStatus(): CALL_STATUS;
|
|
160
166
|
getCurrentCallInfo(): CallInfo | null;
|
|
161
167
|
startCall(options: {
|
|
@@ -171,7 +177,7 @@ export declare class CallService {
|
|
|
171
177
|
groupAvatar?: string;
|
|
172
178
|
members?: string[];
|
|
173
179
|
ext?: Record<string, any>;
|
|
174
|
-
}): Promise<
|
|
180
|
+
}): Promise<any>;
|
|
175
181
|
private sendInvitationMessage;
|
|
176
182
|
answerCall(result: boolean): Promise<void>;
|
|
177
183
|
private sendAlertingMessage;
|
|
@@ -180,7 +186,6 @@ export declare class CallService {
|
|
|
180
186
|
hangup(reason?: string, isCancel?: boolean): Promise<void>;
|
|
181
187
|
private sendCancelMessage;
|
|
182
188
|
sendHangupMessage(): void;
|
|
183
|
-
private startCallTimer;
|
|
184
189
|
private addAgoraRTCListeners;
|
|
185
190
|
private handleUserLeft;
|
|
186
191
|
private addMessageListener;
|
|
@@ -238,9 +243,6 @@ export declare class CallService {
|
|
|
238
243
|
setVideoElementReadyCallback(callback: (videoId: string) => void): void;
|
|
239
244
|
notifyVideoElementReady(videoId: string): void;
|
|
240
245
|
private waitForVideoElement;
|
|
241
|
-
private initRingtone;
|
|
242
|
-
private playRingtone;
|
|
243
|
-
private stopRingtone;
|
|
244
246
|
setRingtoneConfig(config: {
|
|
245
247
|
outgoingRingtoneSrc?: string;
|
|
246
248
|
incomingRingtoneSrc?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CallError from '../services/CallError';
|
|
2
2
|
import { VideoEncoderConfigurationPreset } from 'agora-rtc-sdk-ng';
|
|
3
3
|
import { CallInfo } from '../services/CallService';
|
|
4
|
-
import { ChatSDK } from 'module/SDK';
|
|
4
|
+
import type { ChatSDK, UIKitChatClient } from 'module/SDK';
|
|
5
5
|
export interface VideoWindowProps {
|
|
6
6
|
id: string;
|
|
7
7
|
stream?: MediaStream;
|
|
@@ -98,12 +98,12 @@ export interface CallKitRef {
|
|
|
98
98
|
groupId: string;
|
|
99
99
|
msg: string;
|
|
100
100
|
ext?: Record<string, any>;
|
|
101
|
-
}) => Promise<ChatSDK.
|
|
101
|
+
}) => Promise<ChatSDK.Message | null>;
|
|
102
102
|
startSingleCall: (options: {
|
|
103
103
|
to: string;
|
|
104
104
|
callType: 'video' | 'audio';
|
|
105
105
|
msg: string;
|
|
106
|
-
}) => Promise<ChatSDK.
|
|
106
|
+
}) => Promise<ChatSDK.Message | null>;
|
|
107
107
|
answerCall: (result: boolean) => void;
|
|
108
108
|
exitCall: (reason?: string) => void;
|
|
109
109
|
setUserInfo: (userInfo: {
|
|
@@ -124,6 +124,22 @@ export interface CallKitRef {
|
|
|
124
124
|
height: number;
|
|
125
125
|
}) => void;
|
|
126
126
|
}
|
|
127
|
+
export interface RTCTokenInfo {
|
|
128
|
+
appId: string;
|
|
129
|
+
rtcToken: string;
|
|
130
|
+
rtcUid: number;
|
|
131
|
+
}
|
|
132
|
+
export type RTCUidUserIdMap = Record<string, string>;
|
|
133
|
+
/**
|
|
134
|
+
* RTC 数据提供器。方法签名和返回值与 IM SDK 的同名方法保持一致。
|
|
135
|
+
* 配置某个方法后 CallKit 会优先使用该方法,否则回退到 IM SDK。
|
|
136
|
+
*/
|
|
137
|
+
export interface CallKitRTCProvider {
|
|
138
|
+
getRTCTokenInfo?: (params: {
|
|
139
|
+
channelName: string;
|
|
140
|
+
}) => Promise<RTCTokenInfo>;
|
|
141
|
+
getUserIdsWithRTCUids?: (rtcUids: number[]) => Promise<RTCUidUserIdMap>;
|
|
142
|
+
}
|
|
127
143
|
export interface CallKitProps {
|
|
128
144
|
className?: string;
|
|
129
145
|
style?: React.CSSProperties;
|
|
@@ -139,9 +155,10 @@ export interface CallKitProps {
|
|
|
139
155
|
cameraEnabled?: boolean;
|
|
140
156
|
speakerEnabled?: boolean;
|
|
141
157
|
screenSharing?: boolean;
|
|
142
|
-
chatClient?:
|
|
158
|
+
chatClient?: UIKitChatClient;
|
|
143
159
|
enableRealCall?: boolean;
|
|
144
160
|
useRTCToken?: boolean;
|
|
161
|
+
rtcProvider?: CallKitRTCProvider;
|
|
145
162
|
outgoingRingtoneSrc?: string;
|
|
146
163
|
incomingRingtoneSrc?: string;
|
|
147
164
|
enableRingtone?: boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 铃声管理器
|
|
3
|
+
*/
|
|
4
|
+
export declare class RingtoneManager {
|
|
5
|
+
private outgoingRingtoneAudio;
|
|
6
|
+
private incomingRingtoneAudio;
|
|
7
|
+
private outgoingRingtoneSrc?;
|
|
8
|
+
private incomingRingtoneSrc?;
|
|
9
|
+
private enableRingtone;
|
|
10
|
+
private ringtoneVolume;
|
|
11
|
+
private ringtoneLoop;
|
|
12
|
+
private isRingtonePlaying;
|
|
13
|
+
private currentRingtoneType;
|
|
14
|
+
private onStart?;
|
|
15
|
+
private onEnd?;
|
|
16
|
+
constructor(config?: {
|
|
17
|
+
outgoingRingtoneSrc?: string;
|
|
18
|
+
incomingRingtoneSrc?: string;
|
|
19
|
+
enableRingtone?: boolean;
|
|
20
|
+
ringtoneVolume?: number;
|
|
21
|
+
ringtoneLoop?: boolean;
|
|
22
|
+
onStart?: (type: 'outgoing' | 'incoming') => void;
|
|
23
|
+
onEnd?: (type: 'outgoing' | 'incoming') => void;
|
|
24
|
+
});
|
|
25
|
+
private init;
|
|
26
|
+
playRingtone(type: 'outgoing' | 'incoming'): Promise<void>;
|
|
27
|
+
stopRingtone(): void;
|
|
28
|
+
setConfig(config: {
|
|
29
|
+
outgoingRingtoneSrc?: string;
|
|
30
|
+
incomingRingtoneSrc?: string;
|
|
31
|
+
enableRingtone?: boolean;
|
|
32
|
+
ringtoneVolume?: number;
|
|
33
|
+
ringtoneLoop?: boolean;
|
|
34
|
+
}): void;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
get isPlaying(): boolean;
|
|
37
|
+
get currentType(): 'outgoing' | 'incoming' | null;
|
|
38
|
+
}
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { HeaderProps } from '../header';
|
|
3
3
|
import { MessageInputProps } from '../messageInput';
|
|
4
4
|
import { MsgListProps } from './MessageList';
|
|
5
|
-
import { ChatSDK } from 'module/SDK';
|
|
5
|
+
import type { ChatSDK } from 'module/SDK';
|
|
6
6
|
import { CallKitProps } from '../callkit';
|
|
7
7
|
export interface RtcRoomInfo {
|
|
8
8
|
callId: string;
|
|
@@ -34,7 +34,7 @@ export interface ChatProps {
|
|
|
34
34
|
renderMessageList?: () => ReactNode;
|
|
35
35
|
renderMessageInput?: () => ReactNode;
|
|
36
36
|
renderEmpty?: () => ReactNode;
|
|
37
|
-
renderRepliedMessage?: (repliedMessage: ChatSDK.
|
|
37
|
+
renderRepliedMessage?: (repliedMessage: ChatSDK.Message | null) => ReactNode;
|
|
38
38
|
headerProps?: Omit<HeaderProps, 'suffixIcon'> & {
|
|
39
39
|
suffixIcon?: ('PIN' | 'THREAD' | 'AUDIO' | 'VIDEO' | ReactNode)[];
|
|
40
40
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from 'react';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
import { renderUserProfileProps } from '../baseMessage';
|
|
4
4
|
import { CurrentConversation } from '../store/ConversationStore';
|
|
5
5
|
import { BaseMessageProps } from '../baseMessage';
|
|
6
6
|
import { NoticeMessageBody } from '../noticeMessage/NoticeMessage';
|
|
7
|
+
export type MessageListItem = ChatSDK.Message | NoticeMessageBody;
|
|
7
8
|
export interface MessageRenderContext {
|
|
8
|
-
message:
|
|
9
|
+
message: MessageListItem;
|
|
9
10
|
style: React.CSSProperties;
|
|
10
11
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
11
12
|
isThread?: boolean;
|
|
12
13
|
messageProps?: BaseMessageProps;
|
|
13
14
|
onOpenThreadPanel?: (threadId: string) => void;
|
|
14
|
-
onRtcInviteMessageClick?: (message: ChatSDK.
|
|
15
|
+
onRtcInviteMessageClick?: (message: ChatSDK.Message) => void;
|
|
15
16
|
scrollToBottom?: () => void;
|
|
16
17
|
}
|
|
17
|
-
export type MessageType = 'txt' | 'img' | 'audio' | 'video' | 'file' | 'loc' | 'combine' | 'custom' | 'notice' | 'recall';
|
|
18
|
+
export type MessageType = 'txt' | 'text' | 'img' | 'image' | 'audio' | 'voice' | 'video' | 'file' | 'loc' | 'location' | 'combine' | 'custom' | 'cmd' | 'notice' | 'recall';
|
|
18
19
|
export type MessageRenderer = (context: MessageRenderContext) => ReactNode;
|
|
19
20
|
export interface MsgListProps {
|
|
20
21
|
prefix?: string;
|
|
@@ -22,14 +23,14 @@ export interface MsgListProps {
|
|
|
22
23
|
style?: React.CSSProperties;
|
|
23
24
|
isThread?: boolean;
|
|
24
25
|
/** @deprecated 使用 customRenderers 替代,支持按类型自定义 */
|
|
25
|
-
renderMessage?: (message:
|
|
26
|
+
renderMessage?: (message: MessageListItem) => ReactNode;
|
|
26
27
|
/** 按消息类型自定义渲染器,只需要传入想自定义的类型即可,其他类型会使用默认渲染 */
|
|
27
28
|
customRenderers?: Partial<Record<MessageType, MessageRenderer>>;
|
|
28
29
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
29
30
|
conversation?: CurrentConversation;
|
|
30
31
|
messageProps?: BaseMessageProps;
|
|
31
32
|
onOpenThreadPanel?: (threadId: string) => void;
|
|
32
|
-
onRtcInviteMessageClick?: (message: ChatSDK.
|
|
33
|
+
onRtcInviteMessageClick?: (message: ChatSDK.Message) => void;
|
|
33
34
|
}
|
|
34
35
|
declare let MessageList: FC<MsgListProps>;
|
|
35
36
|
export { MessageList };
|
|
@@ -6,7 +6,6 @@ import { ChatroomMessageActionConfig } from '../chatroomMessage';
|
|
|
6
6
|
import { BroadcastProps } from '../../component/broadcast';
|
|
7
7
|
import { ChatroomInfo } from '../store/AddressStore';
|
|
8
8
|
import { MessageRenderer } from '../chat/MessageList';
|
|
9
|
-
export declare let reportType: Record<string, string>;
|
|
10
9
|
export interface ChatroomProps {
|
|
11
10
|
prefix?: string;
|
|
12
11
|
className?: string;
|
|
@@ -26,9 +25,10 @@ export interface ChatroomProps {
|
|
|
26
25
|
renderBroadcast?: () => ReactNode;
|
|
27
26
|
broadcastProps?: BroadcastProps;
|
|
28
27
|
chatroomId: string;
|
|
29
|
-
reportType?: Record<string, string>;
|
|
30
28
|
messageActionConfig?: ChatroomMessageActionConfig;
|
|
31
29
|
customMessageRenderers?: {
|
|
30
|
+
text?: MessageRenderer;
|
|
31
|
+
/** @deprecated SDK5 文本消息类型为 text */
|
|
32
32
|
txt?: MessageRenderer;
|
|
33
33
|
custom?: MessageRenderer;
|
|
34
34
|
};
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
export interface ChatroomMessageActionConfig {
|
|
4
4
|
recall?: boolean;
|
|
5
5
|
translate?: boolean;
|
|
6
6
|
mute?: boolean;
|
|
7
|
-
report?: boolean;
|
|
8
7
|
pin?: boolean;
|
|
9
8
|
customActions?: Array<{
|
|
10
9
|
content: string | ReactNode;
|
|
11
10
|
icon?: ReactNode;
|
|
12
|
-
onClick: (message: ChatSDK.
|
|
13
|
-
visible?: (message: ChatSDK.
|
|
11
|
+
onClick: (message: ChatSDK.Message) => void;
|
|
12
|
+
visible?: (message: ChatSDK.Message) => boolean;
|
|
14
13
|
}>;
|
|
15
14
|
}
|
|
16
15
|
export interface ChatroomMessageProps {
|
|
17
16
|
prefix?: string;
|
|
18
17
|
className?: string;
|
|
19
18
|
style?: React.CSSProperties;
|
|
20
|
-
message: ChatSDK.
|
|
19
|
+
message: ChatSDK.Message;
|
|
21
20
|
targetLanguage?: string;
|
|
22
|
-
onReport?: (message: ChatSDK.MessageBody) => void;
|
|
23
21
|
actionConfig?: ChatroomMessageActionConfig;
|
|
24
22
|
}
|
|
25
23
|
declare const ChatroomMessageOut: ((props: ChatroomMessageProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
|
-
import { ChatSDK } from '../SDK';
|
|
3
|
+
import type { ChatSDK } from '../SDK';
|
|
4
4
|
import { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
5
5
|
export interface CombinedMessageProps extends BaseMessageProps {
|
|
6
6
|
prefix?: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { UserInfoData } from '../../component/userItem';
|
|
3
|
+
import type { GroupItem } from '../store/AddressStore';
|
|
4
|
+
type ContactListGroupItem = Pick<GroupItem, 'groupId' | 'name' | 'groupName' | 'avatarUrl'>;
|
|
3
5
|
export interface ContactListProps {
|
|
4
6
|
style?: React.CSSProperties;
|
|
5
7
|
className?: string;
|
|
@@ -15,10 +17,7 @@ export interface ContactListProps {
|
|
|
15
17
|
data: ({
|
|
16
18
|
remark?: string;
|
|
17
19
|
userId: string;
|
|
18
|
-
} |
|
|
19
|
-
groupname: string;
|
|
20
|
-
groupid: string;
|
|
21
|
-
})[];
|
|
20
|
+
} | ContactListGroupItem)[];
|
|
22
21
|
})[];
|
|
23
22
|
hasMenu?: boolean;
|
|
24
23
|
checkable?: boolean;
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
3
|
import { IconProps } from '../../component/icon';
|
|
4
4
|
import type { FileMessageType } from '../types/messageType';
|
|
5
|
+
import type { ChatSDK } from '../SDK';
|
|
5
6
|
export interface FileMessageProps extends BaseMessageProps {
|
|
6
|
-
fileMessage: FileMessageType;
|
|
7
|
+
fileMessage: FileMessageType | ChatSDK.Message;
|
|
7
8
|
iconType?: IconProps['type'];
|
|
8
9
|
prefix?: string;
|
|
9
10
|
className?: string;
|
|
@@ -13,7 +14,7 @@ export interface FileMessageProps extends BaseMessageProps {
|
|
|
13
14
|
type?: 'primary' | 'secondly';
|
|
14
15
|
renderUserProfile?: (props: renderUserProfileProps) => React.ReactNode;
|
|
15
16
|
}
|
|
16
|
-
declare const FileMessageOut: ((props: FileMessageProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
17
|
+
declare const FileMessageOut: ((props: FileMessageProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
17
18
|
displayName: string;
|
|
18
19
|
};
|
|
19
20
|
export default FileMessageOut;
|
|
@@ -2,7 +2,7 @@ declare const useContacts: () => {
|
|
|
2
2
|
userId: string;
|
|
3
3
|
nickname: string;
|
|
4
4
|
}[];
|
|
5
|
-
declare const useUserInfo: (userList: 'conversation' | 'contacts' | 'blocklist', withPresence?: boolean) => void;
|
|
5
|
+
declare const useUserInfo: (userList: 'conversation' | 'contacts' | 'blocklist' | null, withPresence?: boolean) => void;
|
|
6
6
|
declare const useGroups: () => {
|
|
7
7
|
getJoinedGroupList: () => void;
|
|
8
8
|
};
|
|
@@ -4,9 +4,19 @@ declare const useAddressContext: () => {
|
|
|
4
4
|
setAppUserInfo: (appUsersInfo: Record<string, import("..").AppUserInfo>) => void;
|
|
5
5
|
setGroups: (groups: import("..").GroupItem[]) => void;
|
|
6
6
|
updateGroupName: (groupId: string, groupName: string) => void;
|
|
7
|
-
setGroupMembers: (groupId: string, membersList:
|
|
7
|
+
setGroupMembers: (groupId: string, membersList: ({
|
|
8
|
+
userId?: string | undefined;
|
|
9
|
+
member?: string | undefined;
|
|
10
|
+
owner?: string | undefined;
|
|
11
|
+
role?: import("..").MemberRole | undefined;
|
|
12
|
+
} | {
|
|
13
|
+
user?: {
|
|
14
|
+
userId?: string | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
role?: import("..").MemberRole | undefined;
|
|
17
|
+
})[]) => void;
|
|
8
18
|
removeGroupMember: (groupId: string, userId: string) => void;
|
|
9
|
-
setGroupMemberAttributes: (groupId: string, userId: string, attributes:
|
|
19
|
+
setGroupMemberAttributes: (groupId: string, userId: string, attributes: Record<string, string>) => void;
|
|
10
20
|
setGroupAdmins: (groupId: string, admins: string[]) => void;
|
|
11
21
|
getGroupMembers: (groupId: string, withUserInfo: boolean) => Promise<void> | undefined;
|
|
12
22
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
declare const useChatContext: () => {
|
|
2
2
|
messages: import("..").Message;
|
|
3
|
-
repliedMessage: import("easemob-websdk").
|
|
3
|
+
repliedMessage: import("easemob-websdk").Message | null;
|
|
4
4
|
typing: import("..").Typing;
|
|
5
|
-
sendMessage: (message: import("easemob-websdk").
|
|
5
|
+
sendMessage: (message: import("easemob-websdk").Message) => Promise<void>;
|
|
6
6
|
deleteMessage: (cvs: import("..").CurrentConversation, messageId: string | string[]) => void | Promise<void>;
|
|
7
7
|
recallMessage: (cvs: import("..").CurrentConversation, messageId: string, isChatThread?: boolean, recallMySelfMsg?: boolean) => Promise<void> | undefined;
|
|
8
8
|
addReaction: (cvs: import("..").CurrentConversation, messageId: string, emoji: string) => Promise<void> | undefined;
|
|
9
9
|
deleteReaction: (cvs: import("..").CurrentConversation, messageId: string, emoji: string) => Promise<void>;
|
|
10
10
|
translateMessage: (cvs: import("..").CurrentConversation, messageId: string, language: string) => Promise<unknown>;
|
|
11
|
-
modifyMessage: (messageId: string, msg: import("easemob-websdk").
|
|
12
|
-
modifyLocalMessage: (id: string, message: import("
|
|
11
|
+
modifyMessage: (messageId: string, msg: import("easemob-websdk").Message) => Promise<void>;
|
|
12
|
+
modifyLocalMessage: (id: string, message: import("../noticeMessage/NoticeMessage").NoticeMessageBody | import("easemob-websdk").Message) => void;
|
|
13
13
|
updateMessageStatus: (msgId: string, status: string) => void;
|
|
14
14
|
sendTypingCommand: (cvs: import("..").CurrentConversation) => void;
|
|
15
|
-
setRepliedMessage: (message: import("easemob-websdk").
|
|
15
|
+
setRepliedMessage: (message: import("easemob-websdk").Message | null) => void;
|
|
16
16
|
clearMessages: (cvs: import("..").CurrentConversation) => void;
|
|
17
17
|
};
|
|
18
18
|
export { useChatContext };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChatType } from '../../module/types/messageType';
|
|
2
2
|
declare const usePinnedMessage: (params?: {
|
|
3
3
|
conversation?: {
|
|
4
|
-
conversationType?:
|
|
4
|
+
conversationType?: "singleChat" | "groupChat" | "chatRoom" | undefined;
|
|
5
5
|
conversationId?: string | undefined;
|
|
6
6
|
} | undefined;
|
|
7
7
|
pageSize?: number | undefined;
|
|
8
8
|
} | undefined) => {
|
|
9
|
-
list: import("easemob-websdk").
|
|
9
|
+
list: import("easemob-websdk").PinnedMessageSummary[];
|
|
10
10
|
cursor: string | null;
|
|
11
11
|
pageSize: number;
|
|
12
12
|
visible: boolean;
|