easemob-chat-uikit 2.4.3 → 3.0.1
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 +80678 -76026
- 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 +44 -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/types/demo/ react-app-env.d.ts +0 -76
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { ChatType } from '../types/messageType';
|
|
2
|
-
import { ChatSDK } from '../SDK';
|
|
2
|
+
import type { ChatSDK } from '../SDK';
|
|
3
3
|
import { GroupItem, MemberItem } from '../store/AddressStore';
|
|
4
4
|
import { AppUserInfo } from '../store/AddressStore';
|
|
5
5
|
import { CurrentConversation } from '../store/ConversationStore';
|
|
6
6
|
import type { BaseMessageType } from '../baseMessage/BaseMessage';
|
|
7
7
|
import { NoticeMessageBody } from '../noticeMessage/NoticeMessage';
|
|
8
|
+
export * from './message';
|
|
9
|
+
export * from './conversation';
|
|
10
|
+
export * from './thread';
|
|
8
11
|
export declare function getConversationTime(time: number): string | undefined;
|
|
9
12
|
export declare function parseChannel(channelId: string): {
|
|
10
13
|
chatType: ChatType;
|
|
11
14
|
conversationId: string;
|
|
12
15
|
};
|
|
13
|
-
export declare function getCvsIdFromMessage(message: BaseMessageType | NoticeMessageBody):
|
|
16
|
+
export declare function getCvsIdFromMessage(message: Partial<ChatSDK.Message> | BaseMessageType | NoticeMessageBody): any;
|
|
14
17
|
export declare function getEmojiHtml({ src, dataKey, alt }: {
|
|
15
18
|
src?: string | undefined;
|
|
16
19
|
dataKey?: string | undefined;
|
|
@@ -20,16 +23,26 @@ export declare const renderHtml: (txt: string) => string;
|
|
|
20
23
|
export declare function getUsersInfo(props: {
|
|
21
24
|
userIdList: string[];
|
|
22
25
|
withPresence?: boolean;
|
|
26
|
+
force?: boolean;
|
|
23
27
|
}): Promise<unknown>;
|
|
24
28
|
export declare const formatHtmlString: (str: string) => string;
|
|
25
29
|
export declare function getGroupItemFromGroupsById(groupId: string): GroupItem | undefined;
|
|
26
30
|
export declare function getGroupItemIndexFromGroupsById(groupId: string): number;
|
|
27
31
|
export declare function getGroupMemberIndexByUserId(group: GroupItem, userId: string): number | undefined;
|
|
28
|
-
export declare function getGroupMemberNickName(member: MemberItem):
|
|
32
|
+
export declare function getGroupMemberNickName(member: MemberItem): string;
|
|
29
33
|
export declare function getAppUserInfo(userId: string): AppUserInfo;
|
|
30
|
-
export declare function getMessages(cvs: CurrentConversation): (
|
|
31
|
-
export declare function getMessageIndex(messages: (ChatSDK.
|
|
32
|
-
export declare function getReactionByEmoji(message: ChatSDK.
|
|
33
|
-
export declare const getMsgSenderNickname: (msg:
|
|
34
|
+
export declare function getMessages(cvs: CurrentConversation): (NoticeMessageBody | ChatSDK.Message)[];
|
|
35
|
+
export declare function getMessageIndex(messages: (ChatSDK.Message | NoticeMessageBody)[], messageId: string): number;
|
|
36
|
+
export declare function getReactionByEmoji(message: ChatSDK.Message | NoticeMessageBody, emoji: string): any;
|
|
37
|
+
export declare const getMsgSenderNickname: (msg: {
|
|
38
|
+
from?: string | undefined;
|
|
39
|
+
to?: string | undefined;
|
|
40
|
+
conversationId?: string | undefined;
|
|
41
|
+
conversationType?: "singleChat" | "groupChat" | "chatRoom" | undefined;
|
|
42
|
+
chatType?: "singleChat" | "groupChat" | "chatRoom" | undefined;
|
|
43
|
+
chatThread?: {
|
|
44
|
+
parentId?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
}, parentId?: string) => string;
|
|
34
47
|
export declare function sortByPinned(a: any, b: any): 1 | 0 | -1;
|
|
35
48
|
export declare function checkCharacter(character: string): "zh" | "en" | "unknown";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ChatSDK, UIKitChatClient } from '../SDK';
|
|
2
|
+
import type { ChatType } from '../types/messageType';
|
|
3
|
+
import type { NoticeMessageBody } from '../noticeMessage/NoticeMessage';
|
|
4
|
+
export type UIKitMessage = ChatSDK.Message & {
|
|
5
|
+
bySelf?: boolean;
|
|
6
|
+
chatThreadOverview?: unknown;
|
|
7
|
+
isChatThread?: boolean;
|
|
8
|
+
/** UIKit-only: peer delivery ack received for an outgoing single-chat message. */
|
|
9
|
+
isDelivered?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type MessageDisplayStatus = 'sending' | 'sent' | 'received' | 'read' | 'failed' | 'unread' | 'default';
|
|
12
|
+
/**
|
|
13
|
+
* Derive UI message status from SDK 0.20 fields:
|
|
14
|
+
* - sendStatus: sending | sent | failed
|
|
15
|
+
* - isPeerRead: single-chat peer read
|
|
16
|
+
* - groupReadCount: group cumulative read count
|
|
17
|
+
* - isDelivered: UIKit overlay from onMessageDelivered
|
|
18
|
+
*/
|
|
19
|
+
export declare const getMessageDisplayStatus: (message?: MessageLike) => MessageDisplayStatus;
|
|
20
|
+
export type MessageLike = Record<string, any> | NoticeMessageBody | null | undefined;
|
|
21
|
+
export declare const isSdk5Message: (message: unknown) => message is ChatSDK.Message;
|
|
22
|
+
export declare const getCurrentUserId: (client?: Partial<UIKitChatClient> | null) => string;
|
|
23
|
+
export declare const getMessageId: (message?: MessageLike) => any;
|
|
24
|
+
export declare const getMessageLocalId: (message?: MessageLike) => any;
|
|
25
|
+
export declare const getMessageServerId: (message?: MessageLike) => any;
|
|
26
|
+
export declare const getMessageTime: (message?: MessageLike) => any;
|
|
27
|
+
export declare const getMessageChatType: (message?: MessageLike) => ChatType | undefined;
|
|
28
|
+
export declare const getMessageConversationId: (message: MessageLike, currentUserId?: string) => any;
|
|
29
|
+
export declare const isMessageFromCurrentUser: (message: MessageLike, currentUserId: string) => boolean;
|
|
30
|
+
export declare const getTextContent: (message: MessageLike) => any;
|
|
31
|
+
export declare const getCustomEvent: (message: MessageLike) => any;
|
|
32
|
+
export declare const getCustomParams: (message: MessageLike) => any;
|
|
33
|
+
export declare const getAttachmentUrl: (message: MessageLike) => any;
|
|
34
|
+
export declare const getThreadId: (thread?: unknown) => any;
|
|
35
|
+
export declare const getMessageType: (message: MessageLike) => any;
|
|
36
|
+
export declare const getSnippetText: (message: MessageLike) => any;
|
|
37
|
+
export type MessagePreviewTokenStyle = 'slash' | 'bracket';
|
|
38
|
+
export type MessagePreviewData = {
|
|
39
|
+
mode: 'renderText' | 'plainText' | 'empty';
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
type MessagePreviewOptions = {
|
|
43
|
+
tokenStyle?: MessagePreviewTokenStyle;
|
|
44
|
+
combineLabelKey?: string;
|
|
45
|
+
mapUserCardToContact?: boolean;
|
|
46
|
+
mapCombinedTextSentinel?: boolean;
|
|
47
|
+
};
|
|
48
|
+
export declare const getMessagePreviewData: (message: MessageLike, t: (key: string) => string, options?: MessagePreviewOptions) => MessagePreviewData;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatSDK } from '../SDK';
|
|
2
|
+
import type { MessageLike } from './message';
|
|
3
|
+
export type ThreadLike = Partial<ChatSDK.ChatThreadSummary> & Partial<ChatSDK.ChatThreadDetail> & Record<string, any>;
|
|
4
|
+
export declare const getThreadSummaryId: (thread?: ThreadLike) => any;
|
|
5
|
+
export declare const getThreadParentId: (thread?: ThreadLike) => any;
|
|
6
|
+
export declare const getThreadName: (thread?: ThreadLike) => any;
|
|
7
|
+
export declare const getThreadOwnerId: (thread?: ThreadLike) => any;
|
|
8
|
+
export declare const getThreadMessageId: (thread?: ThreadLike) => any;
|
|
9
|
+
export declare const getThreadMessageCount: (thread?: ThreadLike) => any;
|
|
10
|
+
export declare const getThreadLastMessage: (thread?: ThreadLike) => MessageLike;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseMessageProps, renderUserProfileProps } from '../baseMessage';
|
|
3
3
|
import type { VideoMessageType } from '../types/messageType';
|
|
4
|
-
import { ChatSDK } from '../SDK';
|
|
4
|
+
import type { ChatSDK } from '../SDK';
|
|
5
5
|
export interface VideoMessageProps extends BaseMessageProps {
|
|
6
|
-
videoMessage: ChatSDK.
|
|
6
|
+
videoMessage: VideoMessageType | ChatSDK.Message;
|
|
7
7
|
prefix?: string;
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
nickName?: string;
|
|
@@ -13,7 +13,7 @@ export interface VideoMessageProps extends BaseMessageProps {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
videoProps?: React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
15
15
|
}
|
|
16
|
-
declare const VideoMessageOut: ((props: VideoMessageProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
16
|
+
declare const VideoMessageOut: ((props: VideoMessageProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
19
19
|
export default VideoMessageOut;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
declare module 'react-photo-view' {
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface DataType {
|
|
5
|
+
src: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
originRef?: React.MutableRefObject<HTMLElement | null>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PhotoSliderProps {
|
|
11
|
+
images: DataType[];
|
|
12
|
+
visible: boolean;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
index?: number;
|
|
15
|
+
onIndexChange?: (index: number) => void;
|
|
16
|
+
loop?: boolean | number;
|
|
17
|
+
speed?: (type: number) => number;
|
|
18
|
+
easing?: (type: number) => string;
|
|
19
|
+
toolbarRender?: (params: {
|
|
20
|
+
images: DataType[];
|
|
21
|
+
index: number;
|
|
22
|
+
onIndexChange: (index: number) => void;
|
|
23
|
+
visible: boolean;
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
overlayVisible: boolean;
|
|
26
|
+
overlay: ReactNode;
|
|
27
|
+
rotate: number;
|
|
28
|
+
onRotate: (rotate: number) => void;
|
|
29
|
+
scale: number;
|
|
30
|
+
onScale: (scale: number) => void;
|
|
31
|
+
}) => ReactNode;
|
|
32
|
+
overlayRender?: (params: {
|
|
33
|
+
images: DataType[];
|
|
34
|
+
index: number;
|
|
35
|
+
onIndexChange: (index: number) => void;
|
|
36
|
+
visible: boolean;
|
|
37
|
+
onClose: () => void;
|
|
38
|
+
overlayVisible: boolean;
|
|
39
|
+
overlay: ReactNode;
|
|
40
|
+
rotate: number;
|
|
41
|
+
onRotate: (rotate: number) => void;
|
|
42
|
+
scale: number;
|
|
43
|
+
onScale: (scale: number) => void;
|
|
44
|
+
}) => ReactNode;
|
|
45
|
+
maskOpacity?: number;
|
|
46
|
+
pullClosable?: boolean;
|
|
47
|
+
maskClosable?: boolean;
|
|
48
|
+
bannerVisible?: boolean;
|
|
49
|
+
afterClose?: () => void;
|
|
50
|
+
className?: string;
|
|
51
|
+
loadingElement?: ReactNode;
|
|
52
|
+
brokenElement?: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const PhotoSlider: React.FC<PhotoSliderProps>;
|
|
56
|
+
|
|
57
|
+
export interface PhotoProviderProps {
|
|
58
|
+
children?: ReactNode;
|
|
59
|
+
speed?: (type: number) => number;
|
|
60
|
+
easing?: (type: number) => string;
|
|
61
|
+
toolbarRender?: PhotoSliderProps['toolbarRender'];
|
|
62
|
+
overlayRender?: PhotoSliderProps['overlayRender'];
|
|
63
|
+
maskOpacity?: number;
|
|
64
|
+
pullClosable?: boolean;
|
|
65
|
+
maskClosable?: boolean;
|
|
66
|
+
bannerVisible?: boolean;
|
|
67
|
+
loop?: boolean | number;
|
|
68
|
+
className?: string;
|
|
69
|
+
loadingElement?: ReactNode;
|
|
70
|
+
brokenElement?: ReactNode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const PhotoProvider: React.FC<PhotoProviderProps>;
|
|
74
|
+
|
|
75
|
+
export interface PhotoViewProps {
|
|
76
|
+
src?: string;
|
|
77
|
+
width?: number;
|
|
78
|
+
height?: number;
|
|
79
|
+
render?: (params: {
|
|
80
|
+
scale: number;
|
|
81
|
+
attrs: React.HTMLAttributes<HTMLDivElement>;
|
|
82
|
+
}) => ReactNode;
|
|
83
|
+
children?: ReactNode;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const PhotoView: React.FC<PhotoViewProps>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare module 'react-photo-view/dist/react-photo-view.css';
|
|
90
|
+
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
/// <reference types="react-dom" />
|
|
4
|
-
|
|
5
|
-
declare namespace NodeJS {
|
|
6
|
-
interface ProcessEnv {
|
|
7
|
-
readonly NODE_ENV: 'development' | 'production' | 'test';
|
|
8
|
-
readonly PUBLIC_URL: string;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare module '*.avif' {
|
|
13
|
-
const src: string;
|
|
14
|
-
export default src;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare module '*.bmp' {
|
|
18
|
-
const src: string;
|
|
19
|
-
export default src;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare module '*.gif' {
|
|
23
|
-
const src: string;
|
|
24
|
-
export default src;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare module '*.jpg' {
|
|
28
|
-
const src: string;
|
|
29
|
-
export default src;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare module '*.jpeg' {
|
|
33
|
-
const src: string;
|
|
34
|
-
export default src;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare module '*.png' {
|
|
38
|
-
const src: string;
|
|
39
|
-
export default src;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare module '*.webp' {
|
|
43
|
-
const src: string;
|
|
44
|
-
export default src;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare module '*.mp4' {
|
|
48
|
-
const src: string;
|
|
49
|
-
export default src;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
declare module '*.svg' {
|
|
53
|
-
import * as React from 'react';
|
|
54
|
-
|
|
55
|
-
export const ReactComponent: React.FunctionComponent<
|
|
56
|
-
React.SVGProps<SVGSVGElement> & { title?: string }
|
|
57
|
-
>;
|
|
58
|
-
|
|
59
|
-
const src: string;
|
|
60
|
-
export default src;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare module '*.module.css' {
|
|
64
|
-
const classes: { readonly [key: string]: string };
|
|
65
|
-
export default classes;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
declare module '*.module.scss' {
|
|
69
|
-
const classes: { readonly [key: string]: string };
|
|
70
|
-
export default classes;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
declare module '*.module.sass' {
|
|
74
|
-
const classes: { readonly [key: string]: string };
|
|
75
|
-
export default classes;
|
|
76
|
-
}
|