@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.
Files changed (115) hide show
  1. package/.eslintrc.cjs +5 -4
  2. package/CHANGELOG.md +9 -0
  3. package/debug/GenerateTestUserSig-es.js +26 -0
  4. package/debug/lib-generate-test-usersig-es.min.js +2 -0
  5. package/dist/components/Chat/Chat.d.ts +1 -1
  6. package/dist/components/Chat/Chat.js +18 -23
  7. package/dist/components/ChatHeader/AudioCallPicker/AudioCallPicker.d.ts +30 -0
  8. package/dist/components/ChatHeader/AudioCallPicker/AudioCallPicker.js +135 -0
  9. package/dist/components/ChatHeader/AudioCallPicker/index.d.ts +1 -0
  10. package/dist/components/ChatHeader/AudioCallPicker/index.js +4 -0
  11. package/dist/components/ChatHeader/ChatHeader.d.ts +6 -0
  12. package/dist/components/ChatHeader/ChatHeader.js +43 -41
  13. package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.d.ts +14 -9
  14. package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.js +47 -65
  15. package/dist/components/ChatHeader/VideoCallPicker/VideoCallPicker.d.ts +30 -0
  16. package/dist/components/ChatHeader/VideoCallPicker/VideoCallPicker.js +135 -0
  17. package/dist/components/ChatHeader/VideoCallPicker/index.d.ts +1 -0
  18. package/dist/components/ChatHeader/VideoCallPicker/index.js +4 -0
  19. package/dist/components/ChatHeader/index.d.ts +2 -1
  20. package/dist/components/ChatHeader/index.js +4 -2
  21. package/dist/components/Checkbox/index.js +1 -1
  22. package/dist/components/Modal/Modal.js +1 -1
  23. package/dist/components/Model/index.js +1 -1
  24. package/dist/components/Plugins/index.js +1 -1
  25. package/dist/components/Popup/index.js +1 -1
  26. package/dist/components/PopupNew/Popup.js +1 -1
  27. package/dist/components/Profile/Profile.js +20 -22
  28. package/dist/components/Profile/ProfileDefault.d.ts +3 -2
  29. package/dist/components/Profile/ProfileDefault.js +55 -56
  30. package/dist/components/Profile/hooks/useMyProfile.d.ts +2 -3
  31. package/dist/components/Profile/hooks/useMyProfile.js +1 -1
  32. package/dist/components/Profile/myProfile/MyProfile.d.ts +1 -1
  33. package/dist/components/Profile/myProfile/MyProfile.js +12 -16
  34. package/dist/components/index.js +27 -25
  35. package/dist/context/ChatContext.d.ts +1 -1
  36. package/dist/context/ChatContext.js +11 -16
  37. package/dist/context/ContactContext.d.ts +1 -1
  38. package/dist/external_modules/mui-BhvHeL5-.js +2253 -0
  39. package/dist/hooks/index.d.ts +2 -2
  40. package/dist/hooks/index.js +2 -2
  41. package/dist/{states/ChatHeaderState.d.ts → hooks/useChatHeader.d.ts} +6 -6
  42. package/dist/hooks/useChatHeader.js +41 -0
  43. package/dist/index-UBuvRM8r-DTXQB6zV.js +34000 -0
  44. package/dist/index.d.ts +3 -1
  45. package/dist/index.js +93 -4129
  46. package/dist/server/mainServer.js +2 -2
  47. package/dist/states/UIManagerState.d.ts +5 -5
  48. package/dist/states/UIManagerState.js +2 -2
  49. package/dist/states/index.d.ts +0 -1
  50. package/dist/states/index.js +2 -4
  51. package/dist/styles/AudioCallPicker.css +1 -0
  52. package/dist/styles/ChatHeaderUI.css +1 -1
  53. package/dist/styles/VideoCallPicker.css +1 -0
  54. package/dist/styles/index-UBuvRM8r.css +1 -0
  55. package/dist/styles/index.css +1 -1
  56. package/dist/styles/index2.css +1 -1
  57. package/dist/styles/index3.css +1 -1
  58. package/dist/styles/index4.css +1 -1
  59. package/dist/styles/index5.css +1 -1
  60. package/dist/types/message.d.ts +1 -1
  61. package/dist/types/user.d.ts +4 -4
  62. package/package.json +12 -20
  63. package/src/components/ChatHeader/AudioCallPicker/AudioCallPicker.module.scss +57 -0
  64. package/src/components/ChatHeader/AudioCallPicker/AudioCallPicker.tsx +234 -0
  65. package/src/components/ChatHeader/AudioCallPicker/index.ts +1 -0
  66. package/src/components/ChatHeader/ChatHeader.tsx +15 -3
  67. package/src/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.tsx +33 -40
  68. package/src/components/ChatHeader/VideoCallPicker/VideoCallPicker.module.scss +57 -0
  69. package/src/components/ChatHeader/VideoCallPicker/VideoCallPicker.tsx +233 -0
  70. package/src/components/ChatHeader/VideoCallPicker/index.ts +1 -0
  71. package/src/components/ChatHeader/index.ts +2 -1
  72. package/src/components/Profile/Profile.tsx +7 -6
  73. package/src/components/Profile/ProfileDefault.tsx +8 -8
  74. package/src/components/Profile/hooks/useMyProfile.tsx +2 -3
  75. package/src/components/Profile/myProfile/MyProfile.tsx +1 -1
  76. package/src/context/ChatContext.tsx +1 -1
  77. package/src/context/ContactContext.tsx +1 -1
  78. package/src/hooks/index.ts +2 -2
  79. package/src/{states/ChatHeaderState.ts → hooks/useChatHeader.ts} +19 -22
  80. package/src/index.ts +3 -5
  81. package/src/server/mainServer.ts +2 -2
  82. package/src/states/UIManagerState.ts +9 -9
  83. package/src/states/index.ts +0 -2
  84. package/src/styles/index.scss +0 -1
  85. package/src/types/message.ts +1 -1
  86. package/src/types/user.ts +4 -4
  87. package/vite.config.ts +4 -25
  88. package/dist/ChatSetting-BtQwjHr0.js +0 -28525
  89. package/dist/assets/fonts/iconfont.ttf +0 -0
  90. package/dist/assets/fonts/iconfont.woff +0 -0
  91. package/dist/assets/fonts/iconfont.woff2 +0 -0
  92. package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.d.ts +0 -11
  93. package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.js +0 -79
  94. package/dist/components/ChatHeader/ChatHeaderActions/index.d.ts +0 -1
  95. package/dist/components/ChatHeader/ChatHeaderActions/index.js +0 -4
  96. package/dist/components/IconFont/Icon.d.ts +0 -21
  97. package/dist/components/IconFont/Icon.js +0 -47
  98. package/dist/components/IconFont/index.d.ts +0 -2
  99. package/dist/components/IconFont/index.js +0 -4
  100. package/dist/external_modules/lodash-vwDjcXxQ.js +0 -0
  101. package/dist/external_modules/mui-BcA3SBHM.js +0 -2473
  102. package/dist/states/ChatHeaderState.js +0 -48
  103. package/dist/styles/ChatHeaderActions.css +0 -1
  104. package/dist/styles/ChatSetting.css +0 -1
  105. package/dist/styles/Icon2.css +0 -1
  106. package/src/assets/fonts/iconfont.ttf +0 -0
  107. package/src/assets/fonts/iconfont.woff +0 -0
  108. package/src/assets/fonts/iconfont.woff2 +0 -0
  109. package/src/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.module.scss +0 -44
  110. package/src/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.tsx +0 -105
  111. package/src/components/ChatHeader/ChatHeaderActions/index.ts +0 -1
  112. package/src/components/IconFont/Icon.module.scss +0 -42
  113. package/src/components/IconFont/Icon.tsx +0 -68
  114. package/src/components/IconFont/index.ts +0 -3
  115. package/src/styles/fonts/icon-font.scss +0 -18
@@ -1,10 +1,8 @@
1
1
  import { useMemo } from 'react';
2
- import { TUIChatEngine } from '@tencentcloud/chat-uikit-engine';
3
- import { useConversationListState } from 'tuikit-atomicx-react';
4
- import { defaultUserAvatar, DEFAULT_GROUP_COMMON_AVATAR } from '../constant/avatar';
5
- import { useUIManagerState } from './UIManagerState';
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: IConversationModel | undefined;
17
+ conversation: ConversationModel | undefined;
20
18
  /** user status */
21
- userStatus: IUserStatus | undefined;
19
+ userStatus: UserStatus | undefined;
22
20
  }
23
21
 
24
- function useChatHeaderState(): UseChatHeaderStoreReturn {
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 === TUIChatEngine.TYPES.CONV_SYSTEM;
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 === TUIChatEngine.TYPES.CONV_C2C) {
47
+ if (type === ConversationType.C2C) {
50
48
  return remark || userProfile?.nick || userProfile?.userID || '';
51
49
  }
52
50
 
53
- if (type === TUIChatEngine.TYPES.CONV_GROUP) {
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 undefined;
60
+ return '';
63
61
  }
64
62
 
65
63
  if (isSystemConversation) {
66
- return undefined;
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 === TUIChatEngine.TYPES.CONV_C2C) {
76
- return userProfile?.avatar || defaultUserAvatar;
72
+ if (type === ConversationType.C2C) {
73
+ return userProfile?.avatar;
77
74
  }
78
75
 
79
- if (type === TUIChatEngine.TYPES.CONV_GROUP) {
80
- return groupProfile?.avatar || DEFAULT_GROUP_COMMON_AVATAR;
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 === TUIChatEngine.TYPES.CONV_GROUP) {
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 === TUIChatEngine.TYPES.CONV_GROUP) {
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
- useChatHeaderState,
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,
@@ -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 { IUserStatusMap } from '../types/user';
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: IUserStatusMap | undefined;
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?: IUserStatusMap) => void;
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, IUserStatusMap>) {
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 IUserStatusMap;
193
+ const userOnlineStatusMap = Object.fromEntries(userStatusMap) as unknown as UserStatusMap;
194
194
  uiManagerStore.getState().setUserStatusMap(userOnlineStatusMap);
195
195
  }
196
196
 
@@ -1,3 +1 @@
1
1
  export { useUIManagerState } from './UIManagerState';
2
-
3
- export { useChatHeaderState } from './ChatHeaderState';
@@ -1,2 +1 @@
1
1
  @forward "./normalize";
2
- @forward "./fonts/icon-font";
@@ -1,4 +1,4 @@
1
- import type { IMessageModel } from '@tencentcloud/chat-uikit-engine';
1
+ import type { IMessageModel } from '@tencentcloud/chat-uikit-engine-lite';
2
2
 
3
3
  interface IScrollPosition {
4
4
  /** The target scroll position from the top */
package/src/types/user.ts CHANGED
@@ -1,4 +1,4 @@
1
- interface IUserStatus {
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 IUserStatusMap {
17
- [userID: string]: IUserStatus;
16
+ interface UserStatusMap {
17
+ [userID: string]: UserStatus;
18
18
  }
19
19
 
20
- export type { IUserStatus, IUserStatusMap };
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: {