@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
Binary file
Binary file
Binary file
@@ -1,44 +0,0 @@
1
- @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
2
-
3
- .chat-header-actions {
4
- flex: 0 0 auto;
5
- display: flex;
6
- flex-direction: row;
7
- align-items: center;
8
- margin-left: auto;
9
- gap: 8px;
10
-
11
- &__button {
12
- @include theme() {
13
- color: get(text-color-link);
14
- }
15
- }
16
- }
17
-
18
- .icon-button {
19
- flex: 0 0 auto;
20
- border: none;
21
- padding: 4px;
22
- margin: 0;
23
- background: none;
24
- // inline-flex: keeps button width snug while aligning icon & text
25
- display: inline-flex;
26
- align-items: center;
27
- justify-content: center;
28
- border-radius: 8px;
29
- transition: background-color 0.2s ease;
30
- cursor: pointer;
31
-
32
- @include theme() {
33
- color: get(text-color-link);
34
- background-color: get(dropdown-color-default);
35
-
36
- &:hover {
37
- background-color: get(dropdown-color-hover);
38
- }
39
-
40
- &:active {
41
- background-color: get(dropdown-color-active);
42
- }
43
- }
44
- }
@@ -1,105 +0,0 @@
1
- import { useCallback, useMemo } from 'react';
2
- import { CallMediaType } from '@tencentcloud/call-uikit-react';
3
- import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
4
- import TUICore, { TUIConstants } from '@tencentcloud/tui-core';
5
- import { useUIKit, IconSearch, IconVideoDefault, IconCall1, IconHorizontalMoreTwo } from '@tencentcloud/uikit-base-component-react';
6
- import { useUIOpenControlState, View, useConversationListState, startCall } from 'tuikit-atomicx-react';
7
- import cs from 'classnames';
8
- import classes from './ChatHeaderActions.module.scss';
9
-
10
- interface IChatHeaderActionsProps {
11
- /** Whether to enable call features */
12
- chatHeaderActions?: Array<'videoCall' | 'audioCall' | 'chatSetting' | 'search'> | undefined;
13
- /** Additional class names */
14
- className?: string | undefined;
15
- /** Additional style */
16
- style?: React.CSSProperties | undefined;
17
- }
18
-
19
- const ChatHeaderActions = (props: IChatHeaderActionsProps) => {
20
- const {
21
- chatHeaderActions = ['videoCall', 'audioCall', 'search', 'chatSetting'],
22
- className,
23
- style,
24
- } = props;
25
-
26
- const { searchConfig } = useUIKit();
27
-
28
- const { toggleChatSetting, toggleChatSearch } = useUIOpenControlState();
29
- const { activeConversation } = useConversationListState();
30
-
31
- // Check if call feature is available
32
- // Check if TUICallKit service is available
33
- const isSupportCall: boolean = useMemo<boolean>(() => !!TUICore.getService(TUIConstants.TUICalling.SERVICE.NAME), []);
34
- const isGroup: boolean = activeConversation?.type === TUIChatEngine.TYPES.CONV_GROUP;
35
-
36
- // Handle call button click
37
- const startCalling = useCallback((callMediaType: CallMediaType) => {
38
- // Check if call is supported
39
- if (!isSupportCall) {
40
- return;
41
- }
42
-
43
- // Check if user is available
44
- if (!activeConversation?.userProfile?.userID) {
45
- throw new Error('User ID is not available in Call.');
46
- }
47
-
48
- startCall({
49
- callType: activeConversation.type,
50
- callMediaType,
51
- userIDList: [activeConversation.userProfile.userID],
52
- });
53
- }, [activeConversation, isSupportCall]);
54
-
55
- const actionButtons = useMemo(() => {
56
- const buttonConfig = {
57
- videoCall: {
58
- icon: <IconVideoDefault size="28px" />,
59
- onClick: () => startCalling(CallMediaType.VIDEO),
60
- show: isSupportCall && !isGroup,
61
- },
62
- audioCall: {
63
- icon: <IconCall1 size="28px" />,
64
- onClick: () => startCalling(CallMediaType.AUDIO),
65
- show: isSupportCall && !isGroup,
66
- },
67
- search: {
68
- icon: <IconSearch size="28px" />,
69
- onClick: toggleChatSearch,
70
- show: !searchConfig?.hideSearch,
71
- },
72
- chatSetting: {
73
- icon: <IconHorizontalMoreTwo size="28px" />,
74
- onClick: toggleChatSetting,
75
- show: true,
76
- },
77
- };
78
-
79
- return chatHeaderActions
80
- .filter(action => !!buttonConfig[action]?.show)
81
- .map((action) => {
82
- const config = buttonConfig[action];
83
- return (
84
- <button
85
- key={action}
86
- className={cs(classes['icon-button'])}
87
- onClick={config.onClick}
88
- >
89
- {config.icon}
90
- </button>
91
- );
92
- });
93
- }, [chatHeaderActions, isSupportCall, startCalling, isGroup, toggleChatSetting]);
94
-
95
- return (
96
- <View
97
- className={cs(classes['chat-header-actions'], className)}
98
- style={style}
99
- >
100
- {actionButtons}
101
- </View>
102
- );
103
- };
104
- export { ChatHeaderActions };
105
- export type { IChatHeaderActionsProps };
@@ -1 +0,0 @@
1
- export * from './ChatHeaderActions';
@@ -1,42 +0,0 @@
1
- @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
2
-
3
- .icon-font {
4
- font-family: iconfont, Arial, sans-serif !important;
5
- font-style: normal;
6
- font-weight: normal;
7
- font-variant: normal;
8
- text-transform: none;
9
- line-height: 1;
10
- vertical-align: middle;
11
- display: inline-block;
12
- user-select: none;
13
- -webkit-font-smoothing: antialiased;
14
- -moz-osx-font-smoothing: grayscale;
15
- }
16
-
17
- .icon-button {
18
- border: none;
19
- padding: 0;
20
- margin: 0;
21
- background: none;
22
- // inline-flex: keeps button width snug while aligning icon & text
23
- display: inline-flex;
24
- align-items: center;
25
- justify-content: center;
26
- border-radius: 8px;
27
- transition: background-color 0.2s ease;
28
- cursor: pointer;
29
-
30
- @include theme() {
31
- color: get(text-color-link);
32
- background-color: get(dropdown-color-default);
33
-
34
- &:hover {
35
- background-color: get(dropdown-color-hover);
36
- }
37
-
38
- &:active {
39
- background-color: get(dropdown-color-active);
40
- }
41
- }
42
- }
@@ -1,68 +0,0 @@
1
- import React from 'react';
2
- import { Button } from '@mui/base/Button';
3
- import cs from 'classnames';
4
- import classes from './Icon.module.scss';
5
-
6
- interface IBaseIconProps {
7
- name: string;
8
- size?: number | undefined;
9
- className?: string | undefined;
10
- style?: React.CSSProperties | undefined;
11
- }
12
-
13
- interface IPureIconProps extends IBaseIconProps {
14
- variant?: 'icon' | undefined;
15
- hotSize?: never;
16
- onClick?: never;
17
- }
18
-
19
- interface IButtonIconProps extends IBaseIconProps {
20
- variant: 'button';
21
- hotSize: number;
22
- borderRadius?: number | undefined;
23
- onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void | undefined;
24
- }
25
-
26
- type IconProps = IPureIconProps | IButtonIconProps;
27
-
28
- const Icon = React.forwardRef((props: IconProps, ref: React.Ref<HTMLButtonElement>) => {
29
- const {
30
- name,
31
- size = 20,
32
- variant = 'icon',
33
- hotSize = 0,
34
- onClick,
35
- className,
36
- style,
37
- } = props;
38
-
39
- if (variant === 'button') {
40
- const { borderRadius } = props as IButtonIconProps;
41
- return (
42
- <Button
43
- ref={ref}
44
- className={cs(classes['icon-button'], className)}
45
- style={{
46
- padding: hotSize,
47
- borderRadius,
48
- ...style,
49
- }}
50
- onClick={onClick}
51
- >
52
- <i
53
- className={cs(classes['icon-font'])}
54
- style={{ fontSize: size, width: size, height: size }}
55
- dangerouslySetInnerHTML={{ __html: name }}
56
- />
57
- </Button>
58
- );
59
- }
60
-
61
- const BasicIcon = <i ref={ref} className={cs(classes['icon-font'], className)} style={{ fontSize: size, width: size, height: size, ...style }} dangerouslySetInnerHTML={{ __html: name }} />;
62
-
63
- return BasicIcon;
64
- });
65
-
66
- Icon.displayName = 'Icon';
67
-
68
- export default Icon;
@@ -1,3 +0,0 @@
1
- import Icon from './Icon';
2
-
3
- export default Icon;
@@ -1,18 +0,0 @@
1
- @font-face {
2
- font-family: iconfont;
3
- src:
4
- url("../../assets/fonts/iconfont.woff2") format("woff2"),
5
- url("../../assets/fonts/iconfont.woff") format("woff"),
6
- url("../../assets/fonts/iconfont.ttf") format("truetype");
7
- }
8
-
9
- .iconfont {
10
- font-family: iconfont, Arial, sans-serif !important;
11
- font-size: 20px;
12
- font-style: normal;
13
- line-height: 1;
14
- vertical-align: bottom;
15
- -webkit-font-smoothing: antialiased;
16
- -webkit-text-stroke-width: 0.2px;
17
- -moz-osx-font-smoothing: grayscale;
18
- }