@tencentcloud/chat-uikit-react 3.0.2 → 3.4.2
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/.eslintrc.cjs +5 -4
- package/CHANGELOG.md +9 -0
- package/debug/GenerateTestUserSig-es.js +26 -0
- package/debug/lib-generate-test-usersig-es.min.js +2 -0
- package/dist/components/Chat/Chat.d.ts +1 -1
- package/dist/components/Chat/Chat.js +18 -23
- package/dist/components/ChatHeader/AudioCallPicker/AudioCallPicker.d.ts +30 -0
- package/dist/components/ChatHeader/AudioCallPicker/AudioCallPicker.js +135 -0
- package/dist/components/ChatHeader/AudioCallPicker/index.d.ts +1 -0
- package/dist/components/ChatHeader/AudioCallPicker/index.js +4 -0
- package/dist/components/ChatHeader/ChatHeader.d.ts +6 -0
- package/dist/components/ChatHeader/ChatHeader.js +43 -41
- package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.d.ts +14 -9
- package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.js +47 -65
- package/dist/components/ChatHeader/VideoCallPicker/VideoCallPicker.d.ts +30 -0
- package/dist/components/ChatHeader/VideoCallPicker/VideoCallPicker.js +135 -0
- package/dist/components/ChatHeader/VideoCallPicker/index.d.ts +1 -0
- package/dist/components/ChatHeader/VideoCallPicker/index.js +4 -0
- package/dist/components/ChatHeader/index.d.ts +2 -1
- package/dist/components/ChatHeader/index.js +4 -2
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Model/index.js +1 -1
- package/dist/components/Plugins/index.js +1 -1
- package/dist/components/Popup/index.js +1 -1
- package/dist/components/PopupNew/Popup.js +1 -1
- package/dist/components/Profile/Profile.js +20 -22
- package/dist/components/Profile/ProfileDefault.d.ts +3 -2
- package/dist/components/Profile/ProfileDefault.js +55 -56
- package/dist/components/Profile/hooks/useMyProfile.d.ts +2 -3
- package/dist/components/Profile/hooks/useMyProfile.js +1 -1
- package/dist/components/Profile/myProfile/MyProfile.d.ts +1 -1
- package/dist/components/Profile/myProfile/MyProfile.js +12 -16
- package/dist/components/index.js +27 -25
- package/dist/context/ChatContext.d.ts +1 -1
- package/dist/context/ChatContext.js +11 -16
- package/dist/context/ContactContext.d.ts +1 -1
- package/dist/external_modules/mui-BhvHeL5-.js +2253 -0
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +2 -2
- package/dist/{states/ChatHeaderState.d.ts → hooks/useChatHeader.d.ts} +6 -6
- package/dist/hooks/useChatHeader.js +41 -0
- package/dist/index-UBuvRM8r-DTXQB6zV.js +34000 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +93 -4129
- package/dist/server/mainServer.js +2 -2
- package/dist/states/UIManagerState.d.ts +5 -5
- package/dist/states/UIManagerState.js +2 -2
- package/dist/states/index.d.ts +0 -1
- package/dist/states/index.js +2 -4
- package/dist/styles/AudioCallPicker.css +1 -0
- package/dist/styles/ChatHeaderUI.css +1 -1
- package/dist/styles/VideoCallPicker.css +1 -0
- package/dist/styles/index-UBuvRM8r.css +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/styles/index2.css +1 -1
- package/dist/styles/index3.css +1 -1
- package/dist/styles/index4.css +1 -1
- package/dist/styles/index5.css +1 -1
- package/dist/types/message.d.ts +1 -1
- package/dist/types/user.d.ts +4 -4
- package/package.json +12 -20
- package/src/components/ChatHeader/AudioCallPicker/AudioCallPicker.module.scss +57 -0
- package/src/components/ChatHeader/AudioCallPicker/AudioCallPicker.tsx +234 -0
- package/src/components/ChatHeader/AudioCallPicker/index.ts +1 -0
- package/src/components/ChatHeader/ChatHeader.tsx +15 -3
- package/src/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.tsx +33 -40
- package/src/components/ChatHeader/VideoCallPicker/VideoCallPicker.module.scss +57 -0
- package/src/components/ChatHeader/VideoCallPicker/VideoCallPicker.tsx +233 -0
- package/src/components/ChatHeader/VideoCallPicker/index.ts +1 -0
- package/src/components/ChatHeader/index.ts +2 -1
- package/src/components/Profile/Profile.tsx +7 -6
- package/src/components/Profile/ProfileDefault.tsx +8 -8
- package/src/components/Profile/hooks/useMyProfile.tsx +2 -3
- package/src/components/Profile/myProfile/MyProfile.tsx +1 -1
- package/src/context/ChatContext.tsx +1 -1
- package/src/context/ContactContext.tsx +1 -1
- package/src/hooks/index.ts +2 -2
- package/src/{states/ChatHeaderState.ts → hooks/useChatHeader.ts} +19 -22
- package/src/index.ts +3 -5
- package/src/server/mainServer.ts +2 -2
- package/src/states/UIManagerState.ts +9 -9
- package/src/states/index.ts +0 -2
- package/src/styles/index.scss +0 -1
- package/src/types/message.ts +1 -1
- package/src/types/user.ts +4 -4
- package/vite.config.ts +4 -25
- package/dist/ChatSetting-BtQwjHr0.js +0 -28525
- package/dist/assets/fonts/iconfont.ttf +0 -0
- package/dist/assets/fonts/iconfont.woff +0 -0
- package/dist/assets/fonts/iconfont.woff2 +0 -0
- package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.d.ts +0 -11
- package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.js +0 -79
- package/dist/components/ChatHeader/ChatHeaderActions/index.d.ts +0 -1
- package/dist/components/ChatHeader/ChatHeaderActions/index.js +0 -4
- package/dist/components/IconFont/Icon.d.ts +0 -21
- package/dist/components/IconFont/Icon.js +0 -47
- package/dist/components/IconFont/index.d.ts +0 -2
- package/dist/components/IconFont/index.js +0 -4
- package/dist/external_modules/lodash-vwDjcXxQ.js +0 -0
- package/dist/external_modules/mui-BcA3SBHM.js +0 -2473
- package/dist/states/ChatHeaderState.js +0 -48
- package/dist/styles/ChatHeaderActions.css +0 -1
- package/dist/styles/ChatSetting.css +0 -1
- package/dist/styles/Icon2.css +0 -1
- package/src/assets/fonts/iconfont.ttf +0 -0
- package/src/assets/fonts/iconfont.woff +0 -0
- package/src/assets/fonts/iconfont.woff2 +0 -0
- package/src/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.module.scss +0 -44
- package/src/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.tsx +0 -105
- package/src/components/ChatHeader/ChatHeaderActions/index.ts +0 -1
- package/src/components/IconFont/Icon.module.scss +0 -42
- package/src/components/IconFont/Icon.tsx +0 -68
- package/src/components/IconFont/index.ts +0 -3
- package/src/styles/fonts/icon-font.scss +0 -18
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type { IUserStatus } from '../types/user';
|
|
7
|
-
import type { IConversationModel } from '@tencentcloud/chat-uikit-engine';
|
|
2
|
+
import { useConversationListState, ConversationType } from 'tuikit-atomicx-react';
|
|
3
|
+
import { useUIManagerState } from '../states';
|
|
4
|
+
import type { UserStatus } from '../types/user';
|
|
5
|
+
import type { ConversationModel } from 'tuikit-atomicx-react';
|
|
8
6
|
|
|
9
7
|
interface UseChatHeaderStoreReturn {
|
|
10
8
|
/** im avatar can't be undefined */
|
|
@@ -16,19 +14,19 @@ interface UseChatHeaderStoreReturn {
|
|
|
16
14
|
/** im title */
|
|
17
15
|
title: string | undefined;
|
|
18
16
|
/** current conversation */
|
|
19
|
-
conversation:
|
|
17
|
+
conversation: ConversationModel | undefined;
|
|
20
18
|
/** user status */
|
|
21
|
-
userStatus:
|
|
19
|
+
userStatus: UserStatus | undefined;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
function
|
|
22
|
+
function useChatHeader(): UseChatHeaderStoreReturn {
|
|
25
23
|
const { userStatusMap } = useUIManagerState();
|
|
26
24
|
|
|
27
25
|
const { activeConversation } = useConversationListState();
|
|
28
26
|
|
|
29
27
|
const isSystemConversation = !activeConversation
|
|
30
28
|
? undefined
|
|
31
|
-
: activeConversation.type ===
|
|
29
|
+
: activeConversation.type === ConversationType.SYSTEM;
|
|
32
30
|
|
|
33
31
|
const title = useMemo<string | undefined>(() => {
|
|
34
32
|
if (!activeConversation) {
|
|
@@ -46,11 +44,11 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
|
|
|
46
44
|
groupProfile,
|
|
47
45
|
} = activeConversation;
|
|
48
46
|
|
|
49
|
-
if (type ===
|
|
47
|
+
if (type === ConversationType.C2C) {
|
|
50
48
|
return remark || userProfile?.nick || userProfile?.userID || '';
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
if (type ===
|
|
51
|
+
if (type === ConversationType.GROUP) {
|
|
54
52
|
return groupProfile?.name || groupProfile?.groupID || '';
|
|
55
53
|
}
|
|
56
54
|
|
|
@@ -59,25 +57,24 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
|
|
|
59
57
|
|
|
60
58
|
const avatar = useMemo<string>(() => {
|
|
61
59
|
if (!activeConversation) {
|
|
62
|
-
return
|
|
60
|
+
return '';
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
if (isSystemConversation) {
|
|
66
|
-
return
|
|
64
|
+
return '';
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
const {
|
|
70
68
|
type,
|
|
71
69
|
userProfile,
|
|
72
|
-
groupProfile,
|
|
73
70
|
} = activeConversation;
|
|
74
71
|
|
|
75
|
-
if (type ===
|
|
76
|
-
return userProfile?.avatar
|
|
72
|
+
if (type === ConversationType.C2C) {
|
|
73
|
+
return userProfile?.avatar;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
if (type ===
|
|
80
|
-
return
|
|
76
|
+
if (type === ConversationType.GROUP) {
|
|
77
|
+
return activeConversation.getAvatar();
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
return '';
|
|
@@ -92,7 +89,7 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
|
|
|
92
89
|
return undefined;
|
|
93
90
|
}
|
|
94
91
|
|
|
95
|
-
if (activeConversation.type ===
|
|
92
|
+
if (activeConversation.type === ConversationType.GROUP) {
|
|
96
93
|
return undefined;
|
|
97
94
|
}
|
|
98
95
|
|
|
@@ -100,7 +97,7 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
|
|
|
100
97
|
}, [activeConversation, userStatusMap, isSystemConversation]);
|
|
101
98
|
|
|
102
99
|
const isGroup = useMemo(() => {
|
|
103
|
-
if (activeConversation?.type ===
|
|
100
|
+
if (activeConversation?.type === ConversationType.GROUP) {
|
|
104
101
|
return true;
|
|
105
102
|
}
|
|
106
103
|
return false;
|
|
@@ -117,5 +114,5 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
|
|
|
117
114
|
}
|
|
118
115
|
|
|
119
116
|
export {
|
|
120
|
-
|
|
117
|
+
useChatHeader,
|
|
121
118
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { UIKitProvider, useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
2
2
|
import './locales';
|
|
3
3
|
import './styles/index.scss';
|
|
4
|
-
import Server from './server/mainServer';
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-new
|
|
7
|
-
new Server();
|
|
8
4
|
|
|
9
5
|
export * from './components';
|
|
10
6
|
export * from './context';
|
|
11
7
|
export * from './hooks';
|
|
12
8
|
export * from './states';
|
|
13
|
-
export * from 'tuikit-atomicx-react';
|
|
9
|
+
export * from 'tuikit-atomicx-react/chat';
|
|
10
|
+
export * from 'tuikit-atomicx-react/types';
|
|
11
|
+
export { Avatar, useLoginState, LoginStatus, startCall } from 'tuikit-atomicx-react';
|
|
14
12
|
|
|
15
13
|
export {
|
|
16
14
|
UIKitProvider,
|
package/src/server/mainServer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
3
|
-
import TUICore, { TUILogin, TUIConstants } from '@tencentcloud/tui-core';
|
|
2
|
+
import TUIChatEngine from '@tencentcloud/chat-uikit-engine-lite';
|
|
3
|
+
import TUICore, { TUILogin, TUIConstants } from '@tencentcloud/tui-core-lite';
|
|
4
4
|
|
|
5
5
|
export default class MainServer {
|
|
6
6
|
constructor() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TUIStore, StoreName, TUIConversationService } from '@tencentcloud/chat-uikit-engine';
|
|
2
|
-
import { TUILogin } from '@tencentcloud/tui-core';
|
|
1
|
+
import { TUIStore, StoreName, TUIConversationService } from '@tencentcloud/chat-uikit-engine-lite';
|
|
2
|
+
import { TUILogin } from '@tencentcloud/tui-core-lite';
|
|
3
3
|
import { useStore } from 'zustand';
|
|
4
4
|
import { createStore } from 'zustand/vanilla';
|
|
5
|
-
import type {
|
|
6
|
-
import type { Profile, Friend, FriendApplication } from '@tencentcloud/chat';
|
|
7
|
-
import type { IConversationModel, IGroupModel } from '@tencentcloud/chat-uikit-engine';
|
|
5
|
+
import type { UserStatusMap } from '../types/user';
|
|
6
|
+
import type { Profile, Friend, FriendApplication } from '@tencentcloud/lite-chat';
|
|
7
|
+
import type { IConversationModel, IGroupModel } from '@tencentcloud/chat-uikit-engine-lite';
|
|
8
8
|
|
|
9
9
|
type BlockData = {
|
|
10
10
|
type: 'block';
|
|
@@ -54,7 +54,7 @@ interface IUIManagerState {
|
|
|
54
54
|
/** TUIManageShow */
|
|
55
55
|
TUIManageShow: boolean;
|
|
56
56
|
/** userStatusMap */
|
|
57
|
-
userStatusMap:
|
|
57
|
+
userStatusMap: UserStatusMap | undefined;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -98,7 +98,7 @@ interface IUIManagerAction {
|
|
|
98
98
|
/** Set the user status map
|
|
99
99
|
* @param userStatusMap - The user status map to set, undefined to clear
|
|
100
100
|
*/
|
|
101
|
-
setUserStatusMap: (userStatusMap?:
|
|
101
|
+
setUserStatusMap: (userStatusMap?: UserStatusMap) => void;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
@@ -186,11 +186,11 @@ function onConversationListUpdated(conversationList: IConversationModel[]) {
|
|
|
186
186
|
uiManagerStore.getState().setConversationList(conversationList);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
function onUserStatusListUpdated(userStatusMap: Map<number,
|
|
189
|
+
function onUserStatusListUpdated(userStatusMap: Map<number, UserStatusMap>) {
|
|
190
190
|
if (userStatusMap?.size <= 0) {
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
const userOnlineStatusMap = Object.fromEntries(userStatusMap) as unknown as
|
|
193
|
+
const userOnlineStatusMap = Object.fromEntries(userStatusMap) as unknown as UserStatusMap;
|
|
194
194
|
uiManagerStore.getState().setUserStatusMap(userOnlineStatusMap);
|
|
195
195
|
}
|
|
196
196
|
|
package/src/states/index.ts
CHANGED
package/src/styles/index.scss
CHANGED
package/src/types/message.ts
CHANGED
package/src/types/user.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface UserStatus {
|
|
2
2
|
/**
|
|
3
3
|
* user status type
|
|
4
4
|
* 0: unknown
|
|
@@ -13,8 +13,8 @@ interface IUserStatus {
|
|
|
13
13
|
customStatus: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
interface
|
|
17
|
-
[userID: string]:
|
|
16
|
+
interface UserStatusMap {
|
|
17
|
+
[userID: string]: UserStatus;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type {
|
|
20
|
+
export type { UserStatus, UserStatusMap };
|
package/vite.config.ts
CHANGED
|
@@ -2,12 +2,10 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { extname, relative, resolve } from 'path';
|
|
3
3
|
import react from '@vitejs/plugin-react';
|
|
4
4
|
import { glob } from 'glob';
|
|
5
|
-
import postcssUrl from 'postcss-url';
|
|
6
5
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
7
6
|
import { defineConfig } from 'vite';
|
|
8
7
|
import dts from 'vite-plugin-dts';
|
|
9
8
|
import { libInjectCss } from 'vite-plugin-lib-inject-css';
|
|
10
|
-
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
11
9
|
|
|
12
10
|
// https://vite.dev/config/
|
|
13
11
|
export default defineConfig(({ mode }) => {
|
|
@@ -26,10 +24,10 @@ export default defineConfig(({ mode }) => {
|
|
|
26
24
|
'react/jsx-runtime',
|
|
27
25
|
'react-dom',
|
|
28
26
|
'react-dom/client',
|
|
29
|
-
'@tencentcloud/chat',
|
|
30
|
-
'@tencentcloud/tui-core',
|
|
27
|
+
'@tencentcloud/lite-chat',
|
|
28
|
+
'@tencentcloud/tui-core-lite',
|
|
31
29
|
'@tencentcloud/universal-api',
|
|
32
|
-
'@tencentcloud/chat-uikit-engine',
|
|
30
|
+
'@tencentcloud/chat-uikit-engine-lite',
|
|
33
31
|
'@tencentcloud/call-uikit-react',
|
|
34
32
|
'@tencentcloud/uikit-base-component-react',
|
|
35
33
|
],
|
|
@@ -50,9 +48,6 @@ export default defineConfig(({ mode }) => {
|
|
|
50
48
|
'external_modules/mui': [
|
|
51
49
|
'@mui/base',
|
|
52
50
|
],
|
|
53
|
-
'external_modules/lodash': [
|
|
54
|
-
'lodash-es',
|
|
55
|
-
],
|
|
56
51
|
'external_modules/zustand': [
|
|
57
52
|
'zustand',
|
|
58
53
|
],
|
|
@@ -73,12 +68,6 @@ export default defineConfig(({ mode }) => {
|
|
|
73
68
|
outDir: 'dist',
|
|
74
69
|
entryRoot: 'src',
|
|
75
70
|
}),
|
|
76
|
-
viteStaticCopy({
|
|
77
|
-
targets: [{
|
|
78
|
-
src: 'src/assets/fonts',
|
|
79
|
-
dest: 'assets',
|
|
80
|
-
}],
|
|
81
|
-
}),
|
|
82
71
|
enableBuildStats(!isDevelopment),
|
|
83
72
|
],
|
|
84
73
|
css: {
|
|
@@ -86,17 +75,7 @@ export default defineConfig(({ mode }) => {
|
|
|
86
75
|
generateScopedName: name => `uikit-${name}`,
|
|
87
76
|
},
|
|
88
77
|
postcss: {
|
|
89
|
-
plugins: [
|
|
90
|
-
postcssUrl({
|
|
91
|
-
url: (asset) => {
|
|
92
|
-
if (!/\.(woff|woff2|ttf)$/.test(asset.pathname || '')) {
|
|
93
|
-
return asset.url;
|
|
94
|
-
}
|
|
95
|
-
// ensure paths are correct in npm publish
|
|
96
|
-
return `"../assets/fonts/${asset.url.split('/').pop()}"`;
|
|
97
|
-
},
|
|
98
|
-
}),
|
|
99
|
-
],
|
|
78
|
+
plugins: [],
|
|
100
79
|
},
|
|
101
80
|
preprocessorOptions: {
|
|
102
81
|
scss: {
|