easemob-chat-uikit 2.0.1 → 2.1.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.
@@ -4,4 +4,5 @@ import type { CallKitProps, CallKitRef } from './types/index';
4
4
  * CallKit主组件
5
5
  */
6
6
  declare const CallKit: React.ForwardRefExoticComponent<CallKitProps & React.RefAttributes<CallKitRef>>;
7
+ export { CallKit };
7
8
  export default CallKit;
@@ -5,5 +5,5 @@ export declare const useFullscreen: (containerRef: React.RefObject<HTMLDivElemen
5
5
  isFullscreen: boolean;
6
6
  enterFullscreen: () => Promise<void>;
7
7
  exitFullscreen: () => Promise<void>;
8
- toggleFullscreen: () => void;
8
+ toggleFullscreen: (e: React.MouseEvent) => void;
9
9
  };
@@ -1,4 +1,4 @@
1
- import CallKit from './CallKit';
1
+ import { CallKit } from './CallKit';
2
2
  import VideoLayout from './VideoLayout';
3
3
  import CallControls from './components/CallControls';
4
4
  export type { CallKitProps, CallKitRef, VideoWindowProps, LayoutMode, InvitationInfo, InvitationNotificationProps, } from './types/index';
@@ -10,7 +10,6 @@ export { CallKit, VideoLayout, CallControls };
10
10
  export { MiniSizeWindow } from './components/MiniSizeWindow';
11
11
  export { default as InvitationContent } from './components/InvitationContent';
12
12
  export { MultiPartyLayout } from './layouts/MultiPartyLayout';
13
- export { PreviewLayout } from './layouts/PreviewLayout';
14
13
  export { FullLayoutManager } from './layouts/FullLayoutManager';
15
14
  export { OneToOneFullLayout } from './layouts/OneToOneFullLayout';
16
15
  export { MultiPartyFullLayout } from './layouts/MultiPartyFullLayout';
@@ -9,7 +9,7 @@ export declare class MultiPartyLayoutStrategy implements LayoutStrategy {
9
9
  renderLayout(videos: VideoWindowProps[], layoutConfig: LayoutConfig, videoSize: VideoSize, renderVideoWindow: (video: VideoWindowProps, index: number, windowSize?: {
10
10
  width: number;
11
11
  height: number;
12
- }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (videoId: string) => void, switchingState?: VideoSwitchingState): React.ReactNode;
12
+ }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (e: React.MouseEvent, videoId: string) => void, switchingState?: VideoSwitchingState): React.ReactNode;
13
13
  }
14
14
  /**
15
15
  * 主要视频 + 缩略图布局策略
@@ -20,7 +20,7 @@ export declare class MainVideoLayoutStrategy implements LayoutStrategy {
20
20
  renderLayout(videos: VideoWindowProps[], layoutConfig: LayoutConfig, videoSize: VideoSize, renderVideoWindow: (video: VideoWindowProps, index: number, windowSize?: {
21
21
  width: number;
22
22
  height: number;
23
- }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (videoId: string) => void, switchingState?: VideoSwitchingState, onExitMainVideoMode?: () => void): React.ReactNode;
23
+ }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (e: React.MouseEvent, videoId: string) => void, switchingState?: VideoSwitchingState, onExitMainVideoMode?: () => void): React.ReactNode;
24
24
  }
25
25
  /**
26
26
  * 多人布局组件
@@ -85,6 +85,8 @@ export interface CallServiceConfig {
85
85
  onRtcEngineCreated?: (rtc: any) => void;
86
86
  onInvitedUserRemoved?: (userId: string, reason: 'refused' | 'cancelled' | 'timeout') => void;
87
87
  encoderConfig?: VideoEncoderConfigurationPreset;
88
+ onRingtoneStart?: (type: 'outgoing' | 'incoming') => void;
89
+ onRingtoneEnd?: (type: 'outgoing' | 'incoming') => void;
88
90
  }
89
91
  export declare class CallService {
90
92
  private client;
@@ -127,6 +129,8 @@ export declare class CallService {
127
129
  private onRemoteUserLeft?;
128
130
  private onRtcEngineCreated?;
129
131
  private onCallError?;
132
+ private onRingtoneStart?;
133
+ private onRingtoneEnd?;
130
134
  private cachedGroupInfos;
131
135
  private speakingVolumeThreshold;
132
136
  private outgoingRingtoneAudio;
@@ -142,6 +146,7 @@ export declare class CallService {
142
146
  private encoderConfig?;
143
147
  private creatingAudioTrack;
144
148
  private UIdToUserIdMap;
149
+ private enableMic;
145
150
  constructor(config: CallServiceConfig);
146
151
  setUIdToUserIdMap(uid: string, userId: string): void;
147
152
  getAccessToken(): Promise<string | null>;
@@ -186,7 +191,7 @@ export declare class CallService {
186
191
  private handleConfirmCalleeMessage;
187
192
  private handleCancelCallMessage;
188
193
  private handleLeaveCallMessage;
189
- toggleMute(): boolean;
194
+ toggleMute(): Promise<boolean>;
190
195
  toggleCamera(): Promise<boolean>;
191
196
  private toggleCameraInPreview;
192
197
  private speakerEnabled;
@@ -51,7 +51,7 @@ export interface LayoutStrategy {
51
51
  renderLayout(videos: VideoWindowProps[], layoutConfig: LayoutConfig, videoSize: VideoSize, renderVideoWindow: (video: VideoWindowProps, index: number, windowSize?: {
52
52
  width: number;
53
53
  height: number;
54
- }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (videoId: string) => void, switchingState?: VideoSwitchingState, onExitMainVideoMode?: () => void): React.ReactNode;
54
+ }) => React.ReactNode, prefixCls: string, gap: number, selectedVideoId?: string, onVideoClick?: (e: React.MouseEvent, videoId: string) => void, switchingState?: VideoSwitchingState, onExitMainVideoMode?: () => void): React.ReactNode;
55
55
  }
56
56
  export interface LayoutOptions {
57
57
  aspectRatio: number;
@@ -109,7 +109,7 @@ export interface CallKitRef {
109
109
  setUserInfo: (userInfo: {
110
110
  [key: string]: any;
111
111
  }) => void;
112
- toggleMute: () => boolean;
112
+ toggleMute: () => Promise<boolean>;
113
113
  toggleCamera: () => Promise<boolean>;
114
114
  isMuted: () => boolean;
115
115
  isCameraEnabled: () => boolean;
@@ -211,7 +211,7 @@ export interface CallKitProps {
211
211
  onSpeakerToggle?: (enabled: boolean) => void;
212
212
  onScreenShareToggle?: (sharing: boolean) => void;
213
213
  onHangup?: () => void;
214
- onAddParticipant?: () => void;
214
+ onAddParticipant?: (event: React.MouseEvent) => void;
215
215
  onInvitationAccept?: (invitation: InvitationInfo) => void;
216
216
  onInvitationReject?: (invitation: InvitationInfo) => void;
217
217
  logLevel?: 'error' | 'warn' | 'info' | 'debug' | 'verbose';
@@ -229,6 +229,9 @@ export interface CallKitProps {
229
229
  onRemoteUserLeft?: (userId: string, callType: 'video' | 'audio' | 'group') => void;
230
230
  onRtcEngineCreated?: (rtc: any) => void;
231
231
  onEndCallWithReason?: (reason: string, callInfo: CallInfo) => void;
232
+ onRingtoneStart?: (type: 'outgoing' | 'incoming') => void;
233
+ onRingtoneEnd?: () => void;
234
+ onCallStatusChanged?: (status: 'idle' | 'calling' | 'ringing' | 'connected' | 'disconnected') => void;
232
235
  }
233
236
  import type React from 'react';
234
237
  export interface CustomIconProps {
@@ -29,9 +29,9 @@ export interface FullLayoutProps extends BaseLayoutProps {
29
29
  callStatus?: 'idle' | 'calling' | 'ringing' | 'connected';
30
30
  isShowingPreview?: boolean;
31
31
  isFullscreen?: boolean;
32
- onFullscreenToggle?: () => void;
32
+ onFullscreenToggle?: (e: React.MouseEvent) => void;
33
33
  isMinimized?: boolean;
34
- onMinimizedToggle?: () => void;
34
+ onMinimizedToggle?: (e: React.MouseEvent) => void;
35
35
  showControls?: boolean;
36
36
  muted?: boolean;
37
37
  cameraEnabled?: boolean;
@@ -42,7 +42,7 @@ export interface FullLayoutProps extends BaseLayoutProps {
42
42
  onSpeakerToggle?: (enabled: boolean) => void;
43
43
  onScreenShareToggle?: (sharing: boolean) => void;
44
44
  onHangup?: () => void;
45
- onAddParticipant?: () => void;
45
+ onAddParticipant?: (event: React.MouseEvent) => void;
46
46
  onPreviewAccept?: () => void;
47
47
  onPreviewReject?: () => void;
48
48
  onMinimizedClick?: (event?: React.MouseEvent) => void;
@@ -65,6 +65,8 @@ export interface FullLayoutProps extends BaseLayoutProps {
65
65
  }>;
66
66
  customIcons?: CallKitIconMap;
67
67
  iconRenderer?: (iconType: string, defaultIcon: React.ReactElement, context?: any) => React.ReactElement;
68
+ isDragging?: boolean;
69
+ justFinishedDrag?: boolean;
68
70
  }
69
71
  /**
70
72
  * 布局组件的工厂函数类型
@@ -1,4 +1,6 @@
1
+ import { ChatSDK } from '../SDK';
1
2
  declare const useSDK: () => {
2
3
  ChatSDK: import("easemob-websdk").EasemobChatStatic;
4
+ ChatSDKType: typeof ChatSDK;
3
5
  };
4
6
  export { useSDK };
@@ -30,11 +30,11 @@ export interface MessageInputProps {
30
30
  giftKeyboardProps?: GiftKeyboardProps;
31
31
  onChange?: (value: string) => void;
32
32
  onFocus?: () => void;
33
+ disableRecorder?: boolean;
34
+ disableRecorderTitle?: string;
33
35
  }
34
- declare const _default: {
35
- (props: MessageInputProps): import("react/jsx-runtime").JSX.Element;
36
- defaultActions: Actions;
37
- } & {
38
- displayName: string;
39
- };
36
+ export interface MessageInputRef {
37
+ stopRecording: () => void;
38
+ }
39
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<MessageInputProps & React.RefAttributes<MessageInputRef>, "ref"> & React.RefAttributes<MessageInputRef>>>;
40
40
  export default _default;
@@ -6,4 +6,5 @@ export type { EmojiProps } from './emoji';
6
6
  export type { SelectedControlsProps } from './selectedControls';
7
7
  export type { SuggestListProps } from './suggestList';
8
8
  export type { TextareaProps } from './textarea';
9
+ export type { MessageInputRef } from './MessageInput';
9
10
  export default MessageInput;
@@ -14,6 +14,11 @@ export interface RecorderProps {
14
14
  conversation?: CurrentConversation;
15
15
  onBeforeSendMessage?: (message: ChatSDK.MessageBody) => Promise<CurrentConversation | void>;
16
16
  isChatThread?: boolean;
17
+ disabled?: boolean;
18
+ disabledTitle?: string;
17
19
  }
18
- declare const Recorder: React.FC<RecorderProps>;
20
+ export interface RecorderRef {
21
+ stopRecording: () => void;
22
+ }
23
+ declare const Recorder: React.ForwardRefExoticComponent<RecorderProps & React.RefAttributes<RecorderRef>>;
19
24
  export { Recorder };
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  export interface ProviderProps {
3
3
  initConfig: {
4
- appKey: string;
4
+ appKey?: string;
5
5
  userId?: string;
6
6
  token?: string;
7
7
  password?: string;
@@ -6,11 +6,8 @@ import PinnedMessagesStore from './PinnedMessagesStore';
6
6
  import { ChatSDK } from 'module/SDK';
7
7
  import { ProviderProps } from '../store/Provider';
8
8
  type InitConfig = {
9
- appKey: string;
10
- appId?: string;
11
- } | {
12
9
  appKey?: string;
13
- appId: string;
10
+ appId?: string;
14
11
  };
15
12
  declare class RootStore {
16
13
  messageStore: MessageStore;
@@ -8,6 +8,8 @@ export interface RootConsumerProps {
8
8
  export interface ContextProps {
9
9
  rootStore: RootStore;
10
10
  initConfig: {
11
+ appKey?: string;
12
+ appId?: string;
11
13
  token?: string;
12
14
  userId?: string;
13
15
  translationTargetLanguage?: string;
@@ -15,13 +17,7 @@ export interface ContextProps {
15
17
  maxMessages?: number;
16
18
  isFixedDeviceId?: boolean;
17
19
  useOwnUploadFun?: boolean;
18
- } & ({
19
- appKey: string;
20
- appId?: string;
21
- } | {
22
- appKey?: string;
23
- appId: string;
24
- });
20
+ };
25
21
  client: ChatSDK.Connection;
26
22
  features?: {
27
23
  chat?: {
@@ -31,5 +31,5 @@ export declare function getMessages(cvs: CurrentConversation): (ChatSDK.MessageB
31
31
  export declare function getMessageIndex(messages: (ChatSDK.MessageBody | NoticeMessageBody)[], messageId: string): number;
32
32
  export declare function getReactionByEmoji(message: ChatSDK.MessageBody | NoticeMessageBody, emoji: string): any;
33
33
  export declare const getMsgSenderNickname: (msg: BaseMessageType, parentId?: string) => any;
34
- export declare function sortByPinned(a: any, b: any): 0 | 1 | -1;
34
+ export declare function sortByPinned(a: any, b: any): 1 | 0 | -1;
35
35
  export declare function checkCharacter(character: string): "zh" | "en" | "unknown";
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import type { LayoutStrategy, LayoutConfig, VideoSize, ContainerSize, LayoutOptions, VideoWindowProps } from '../types/index';
3
- /**
4
- * 预览布局策略(竖屏布局,用于接通前预览自己画面)
5
- */
6
- export declare class PreviewLayoutStrategy implements LayoutStrategy {
7
- calculateLayout(videoCount: number, containerSize: ContainerSize): LayoutConfig;
8
- calculateVideoSize(layoutConfig: LayoutConfig, containerSize: ContainerSize, options: LayoutOptions): VideoSize;
9
- renderLayout(videos: VideoWindowProps[], layoutConfig: LayoutConfig, videoSize: VideoSize, renderVideoWindow: (video: VideoWindowProps, index: number, windowSize?: {
10
- width: number;
11
- height: number;
12
- }) => React.ReactNode, prefixCls: string, gap: number): React.ReactNode;
13
- }
14
- /**
15
- * 预览布局组件
16
- */
17
- interface PreviewLayoutProps {
18
- videos: VideoWindowProps[];
19
- containerSize: ContainerSize;
20
- layoutOptions: LayoutOptions;
21
- renderVideoWindow: (video: VideoWindowProps, index: number) => React.ReactNode;
22
- prefixCls: string;
23
- }
24
- export declare const PreviewLayout: React.FC<PreviewLayoutProps>;
25
- export {};