@tencentcloud/chat-uikit-react 3.0.0 → 3.0.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 (112) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +8 -8
  3. package/dist/{ChatSetting-C7QlwAiq.js → ChatSetting-BtQwjHr0.js} +4996 -4920
  4. package/dist/components/Chat/Chat.js +10 -9
  5. package/dist/components/ChatHeader/ChatHeader.js +12 -11
  6. package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.js +10 -9
  7. package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.js +10 -9
  8. package/dist/components/Checkbox/index.js +1 -1
  9. package/dist/components/IconFont/Icon.js +1 -1
  10. package/dist/components/Modal/Modal.js +1 -1
  11. package/dist/components/Model/index.js +1 -1
  12. package/dist/components/Plugins/index.js +1 -1
  13. package/dist/components/Popup/index.js +1 -1
  14. package/dist/components/PopupNew/Popup.js +1 -1
  15. package/dist/components/Profile/Profile.d.ts +1 -1
  16. package/dist/components/Profile/Profile.js +16 -16
  17. package/dist/components/Profile/ProfileDefault.js +39 -39
  18. package/dist/components/Profile/myProfile/MyProfile.js +10 -9
  19. package/dist/components/index.d.ts +0 -1
  20. package/dist/components/index.js +25 -33
  21. package/dist/constant/avatar.d.ts +2 -1
  22. package/dist/constant/avatar.js +2 -1
  23. package/dist/context/ChatContext.js +6 -5
  24. package/dist/external_modules/{mui-CbGEJVT2.js → mui-BcA3SBHM.js} +1 -1
  25. package/dist/external_modules/{zustand-Dvydplxp.js → zustand-CDmQR4co.js} +7 -7
  26. package/dist/hooks/index.js +0 -1
  27. package/dist/index.js +2950 -1530
  28. package/dist/locales/en-US/TUIContact.d.ts +44 -0
  29. package/dist/locales/en-US/TUIContact.js +46 -1
  30. package/dist/locales/en-US/index.d.ts +44 -0
  31. package/dist/locales/ja-JP/TUIContact.d.ts +44 -0
  32. package/dist/locales/ja-JP/TUIContact.js +46 -1
  33. package/dist/locales/ja-JP/index.d.ts +44 -0
  34. package/dist/locales/ko-KR/TUIContact.d.ts +44 -0
  35. package/dist/locales/ko-KR/TUIContact.js +46 -1
  36. package/dist/locales/ko-KR/index.d.ts +44 -0
  37. package/dist/locales/zh-CN/TUIContact.d.ts +44 -0
  38. package/dist/locales/zh-CN/TUIContact.js +46 -1
  39. package/dist/locales/zh-CN/index.d.ts +44 -0
  40. package/dist/locales/zh-TW/TUIContact.d.ts +44 -0
  41. package/dist/locales/zh-TW/TUIContact.js +46 -1
  42. package/dist/locales/zh-TW/index.d.ts +44 -0
  43. package/dist/states/ChatHeaderState.js +23 -22
  44. package/dist/states/UIManagerState.js +1 -1
  45. package/dist/styles/ChatSetting.css +1 -1
  46. package/dist/styles/index.css +1 -1
  47. package/dist/styles/index2.css +1 -1
  48. package/dist/styles/index3.css +1 -1
  49. package/dist/styles/index4.css +1 -1
  50. package/dist/styles/index5.css +1 -1
  51. package/package.json +3 -3
  52. package/src/components/Profile/Profile.tsx +20 -17
  53. package/src/components/Profile/ProfileDefault.tsx +4 -6
  54. package/src/components/index.ts +0 -1
  55. package/src/constant/avatar.ts +2 -1
  56. package/src/hooks/index.ts +0 -2
  57. package/src/locales/en-US/TUIContact.ts +45 -0
  58. package/src/locales/ja-JP/TUIContact.ts +45 -0
  59. package/src/locales/ko-KR/TUIContact.ts +45 -0
  60. package/src/locales/zh-CN/TUIContact.ts +45 -0
  61. package/src/locales/zh-TW/TUIContact.ts +46 -0
  62. package/src/states/ChatHeaderState.ts +2 -2
  63. package/dist/components/Contact/Contact.d.ts +0 -3
  64. package/dist/components/Contact/Contact.js +0 -81
  65. package/dist/components/Contact/ContactInfo/ContactInfo.d.ts +0 -8
  66. package/dist/components/Contact/ContactInfo/ContactInfo.js +0 -27
  67. package/dist/components/Contact/ContactInfo/addFriendInfo.d.ts +0 -8
  68. package/dist/components/Contact/ContactInfo/addFriendInfo.js +0 -61
  69. package/dist/components/Contact/ContactInfo/basicInfo.d.ts +0 -8
  70. package/dist/components/Contact/ContactInfo/basicInfo.js +0 -48
  71. package/dist/components/Contact/ContactInfo/blockInfo.d.ts +0 -8
  72. package/dist/components/Contact/ContactInfo/blockInfo.js +0 -33
  73. package/dist/components/Contact/ContactInfo/friendApplication.d.ts +0 -8
  74. package/dist/components/Contact/ContactInfo/friendApplication.js +0 -47
  75. package/dist/components/Contact/ContactInfo/friendInfo.d.ts +0 -9
  76. package/dist/components/Contact/ContactInfo/friendInfo.js +0 -83
  77. package/dist/components/Contact/ContactInfo/groupInfo.d.ts +0 -9
  78. package/dist/components/Contact/ContactInfo/groupInfo.js +0 -45
  79. package/dist/components/Contact/ContactInfo/hooks/useContactInfo.d.ts +0 -11
  80. package/dist/components/Contact/ContactInfo/hooks/useContactInfo.js +0 -84
  81. package/dist/components/Contact/ContactList/ContactList.d.ts +0 -4
  82. package/dist/components/Contact/ContactList/ContactList.js +0 -152
  83. package/dist/components/Contact/hooks/useTUIContact.d.ts +0 -12
  84. package/dist/components/Contact/hooks/useTUIContact.js +0 -58
  85. package/dist/components/Contact/index.d.ts +0 -3
  86. package/dist/components/Contact/index.js +0 -10
  87. package/dist/components/ContactSearch/ContactSearch.d.ts +0 -3
  88. package/dist/components/ContactSearch/ContactSearch.js +0 -85
  89. package/dist/components/ContactSearch/hooks/useContactSearch.d.ts +0 -6
  90. package/dist/components/ContactSearch/hooks/useContactSearch.js +0 -28
  91. package/dist/styles/ContactInfo.css +0 -1
  92. package/dist/styles/ContactList.css +0 -1
  93. package/dist/styles/ContactSearch.css +0 -1
  94. package/dist/styles/index6.css +0 -1
  95. package/src/components/Contact/Contact.tsx +0 -97
  96. package/src/components/Contact/ContactInfo/ContactInfo.tsx +0 -36
  97. package/src/components/Contact/ContactInfo/addFriendInfo.tsx +0 -88
  98. package/src/components/Contact/ContactInfo/basicInfo.tsx +0 -52
  99. package/src/components/Contact/ContactInfo/blockInfo.tsx +0 -45
  100. package/src/components/Contact/ContactInfo/friendApplication.tsx +0 -68
  101. package/src/components/Contact/ContactInfo/friendInfo.tsx +0 -101
  102. package/src/components/Contact/ContactInfo/groupInfo.tsx +0 -62
  103. package/src/components/Contact/ContactInfo/hooks/useContactInfo.tsx +0 -101
  104. package/src/components/Contact/ContactInfo/index.scss +0 -136
  105. package/src/components/Contact/ContactList/ContactList.tsx +0 -174
  106. package/src/components/Contact/ContactList/index.scss +0 -111
  107. package/src/components/Contact/hooks/useTUIContact.tsx +0 -88
  108. package/src/components/Contact/index.scss +0 -91
  109. package/src/components/Contact/index.ts +0 -3
  110. package/src/components/ContactSearch/ContactSearch.tsx +0 -102
  111. package/src/components/ContactSearch/hooks/useContactSearch.tsx +0 -31
  112. package/src/components/ContactSearch/index.scss +0 -33
@@ -1,111 +0,0 @@
1
- @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
2
-
3
- .tui-contacts-list {
4
- flex: 1 1 auto;
5
- min-width: 360px;
6
- max-width: 360px;
7
- display: flex;
8
- flex-direction: column;
9
- position: relative;
10
- text-align: initial;
11
- overflow: hidden scroll;
12
-
13
- @include theme() {
14
- color: get(text-color-primary);
15
- }
16
-
17
- .tui-contacts-title {
18
- display: flex;
19
- justify-content: space-between;
20
- }
21
-
22
- .tui-contacts-list-title {
23
- display: flex;
24
- padding: 10px 20px;
25
- cursor: pointer;
26
- }
27
-
28
- .tui-contacts-list-icon {
29
- display: flex;
30
- align-items: center;
31
- justify-content: center;
32
- margin-right: 20px;
33
-
34
- .contacts-list-icon {
35
- font-size: 12px;
36
-
37
- @include theme() {
38
- color: get(text-color-primary);
39
- }
40
- }
41
- }
42
-
43
- .tui-contacts-list-item {
44
- align-items: center;
45
- cursor: pointer;
46
- display: flex;
47
- padding: 10px 20px;
48
- text-align: center;
49
- font-size: 14px;
50
-
51
- .tui-contacts-list-item-card {
52
- display: flex;
53
- padding: 0 10px;
54
- overflow: hidden;
55
- align-items: center;
56
- justify-content: space-between;
57
- flex: 1;
58
- }
59
-
60
- .tui-contacts-list-item-container {
61
- margin-left: 10px;
62
- }
63
-
64
- .text-ellipsis {
65
- overflow: hidden;
66
- text-overflow: ellipsis;
67
- white-space: nowrap;
68
- }
69
-
70
- .tui-contacts-list-item-text {
71
- color: #999;
72
- font-size: 12px;
73
- text-align: left;
74
-
75
- @extend .text-ellipsis;
76
- }
77
-
78
- .tui-contacts-list-btn-text {
79
- color: #999;
80
- font-size: 12px;
81
- text-align: left;
82
- }
83
-
84
- .tui-contacts-list-item-name {
85
- @extend .text-ellipsis;
86
- }
87
- }
88
-
89
- .application-btn {
90
- width: 30px;
91
- height: 14px;
92
- padding: 5px;
93
- border-radius: 15px;
94
- font-size: 10px;
95
- text-align: center;
96
- line-height: 14px;
97
- letter-spacing: 0;
98
- cursor: pointer;
99
- -webkit-user-select: none;
100
- user-select: none;
101
- border: 1px solid #006eff;
102
- background: #006eff;
103
- color: #fff;
104
- }
105
- }
106
-
107
- .tui-contacts-list-h5 {
108
- min-width: 100%;
109
- width: 100%;
110
- max-width: 100%;
111
- }
@@ -1,88 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import TUIChatEngine, {
3
- TUIStore,
4
- StoreName,
5
- IGroupModel,
6
- } from '@tencentcloud/chat-uikit-engine';
7
- import { useUIManagerState } from '../../../states';
8
-
9
- function useTUIContact() {
10
- const { chat } = useUIManagerState();
11
- const [friendList, setFriendList] = useState([]);
12
- const [blockList, setBlockList] = useState([]);
13
- const [friendApplicationList, setFriendApplicationList] = useState([]);
14
- const [blocklistProfile, setBlocklistProfile] = useState([]);
15
- const [groupList, setGroupList] = useState<IGroupModel[]>();
16
-
17
- const [isShowContactList, setShowContactList] = useState(true);
18
-
19
- useEffect(() => {
20
- TUIStore.watch(StoreName.GRP, {
21
- groupList: onGroupListUpdated,
22
- });
23
- getFriendList();
24
- getBlocklist();
25
- getFriendApplicationList();
26
- }, [chat]);
27
-
28
- const onGroupListUpdated = (list: IGroupModel[]) => {
29
- setGroupList(list);
30
- };
31
- useEffect(() => {
32
- chat?.on(TUIChatEngine.EVENT.BLACKLIST_UPDATED, onBlocklistUpdated);
33
- chat?.on(TUIChatEngine.EVENT.FRIEND_LIST_UPDATED, onFriendListUpdated);
34
- chat?.on(
35
- TUIChatEngine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,
36
- onFriendApplicationListUpdated,
37
- );
38
- }, [chat]);
39
- const getFriendApplicationList = async () => {
40
- const { data } = await chat.getFriendApplicationList();
41
- setFriendApplicationList(data?.friendApplicationList);
42
- };
43
-
44
- const getFriendList = async () => {
45
- const { code, data } = await chat?.getFriendList();
46
- if (code === 0) {
47
- setFriendList(data);
48
- }
49
- };
50
- const getBlocklist = async () => {
51
- const { data: _blocklist } = await chat?.getBlacklist();
52
- if (_blocklist.length === 0) {
53
- return;
54
- }
55
- setBlockList(_blocklist);
56
- getBlocklistProfile(_blocklist);
57
- };
58
-
59
- const getBlocklistProfile = async (_blocklist: string[]) => {
60
- const { data } = await chat.getUserProfile({
61
- userIDList: _blocklist,
62
- });
63
- setBlocklistProfile(data);
64
- };
65
- const onFriendApplicationListUpdated = (event: any) => {
66
- setFriendApplicationList(event?.data?.friendApplicationList);
67
- };
68
- const onBlocklistUpdated = (event: any) => {
69
- setBlockList(event.data);
70
- getBlocklistProfile(event.data);
71
- };
72
-
73
- const onFriendListUpdated = (event: any) => {
74
- setFriendList(event.data);
75
- };
76
-
77
- return {
78
- friendList,
79
- groupList,
80
- blocklistProfile,
81
- friendApplicationList,
82
- blockList,
83
- isShowContactList,
84
- setShowContactList,
85
- };
86
- }
87
-
88
- export default useTUIContact;
@@ -1,91 +0,0 @@
1
- @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
2
-
3
- .tui-contacts {
4
- height: 100%;
5
- min-width: 360px;
6
- max-width: 360px;
7
- display: flex;
8
- flex-direction: column;
9
- position: relative;
10
- text-align: initial;
11
- overflow: hidden;
12
-
13
- @include theme() {
14
- background-color: get(bg-color-operate);
15
- }
16
-
17
- .tui-contacts-header {
18
- position: relative;
19
- display: flex;
20
- align-items: center;
21
- padding: 10px 20px 10px 10px;
22
- }
23
-
24
- .tui-contact-input {
25
- width: 100%;
26
- }
27
-
28
- .tui-contacts-add {
29
- color: #147aff;
30
- font-size: 20px;
31
- align-items: center;
32
- cursor: pointer;
33
- display: flex;
34
- text-align: center;
35
-
36
- .tui-conversation-create-icon {
37
- display: flex;
38
- align-items: center;
39
- justify-content: center;
40
- }
41
- }
42
-
43
- .tui-contacts-add-header {
44
- align-items: center;
45
- display: flex;
46
- flex-direction: row;
47
- padding: 16px 20px;
48
- text-align: center;
49
- margin-bottom: 10px;
50
-
51
- @include theme() {
52
- background-color: get(bg-color-operate);
53
- }
54
-
55
- .tui-contacts-add-header-title {
56
- font-size: 20px;
57
- font-weight: 600;
58
- margin-left: 10px;
59
-
60
- @include theme() {
61
- color: get(text-color-primary);
62
- }
63
- }
64
- }
65
-
66
- .no-result {
67
- padding: 0 20px;
68
- display: flex;
69
- flex-direction: column;
70
- align-items: center;
71
-
72
- &-icon {
73
- margin: 100px auto 50px;
74
- }
75
-
76
- &-message {
77
- font-size: 16px;
78
- line-height: 22px;
79
-
80
- @include theme() {
81
- color: get(text-color-secondary);
82
- }
83
- }
84
- }
85
- }
86
-
87
- .tui-contacts-h5 {
88
- min-width: 100%;
89
- width: 100%;
90
- max-width: 100%;
91
- }
@@ -1,3 +0,0 @@
1
- export * from './ContactList/ContactList';
2
- export * from './ContactInfo/ContactInfo';
3
- export * from './Contact';
@@ -1,102 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { useUIKit } from '@tencentcloud/uikit-base-component-react';
3
- import { defaultUserAvatar } from '../../constant/avatar';
4
- import { useTUIContactContext } from '../../context';
5
- import { useUIManagerState } from '../../states';
6
- import { Icon, IconTypes } from '../Icon';
7
- import { Input } from '../Input';
8
- import useContactSearch from './hooks/useContactSearch';
9
- import './index.scss';
10
- import { Avatar } from 'tuikit-atomicx-react';
11
-
12
- export function UnMemoizedContactSearch<T>(): React.ReactElement {
13
- const { setActiveContact } = useUIManagerState('TUIContactSearch');
14
- const { t } = useUIKit();
15
- const { friendList, setShowContactList } = useTUIContactContext('TUIContactList');
16
- const [isShowSearchResult, setShowSearchResult] = useState(false);
17
- const { checkFriend, isBlock, getUserProfile } = useContactSearch();
18
- const [searchedValue, setSearchedValue] = useState('');
19
- const [searchResult, setSearchResult] = useState([]);
20
-
21
- const searchValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
22
- if (e.target?.value === '') {
23
- setShowContactList && setShowContactList(true);
24
- setShowSearchResult(false);
25
- setSearchResult([]);
26
- return;
27
- }
28
- setShowSearchResult(true);
29
- setSearchedValue(e.target?.value);
30
- setShowContactList && setShowContactList(false);
31
- };
32
-
33
- const searchValueBlur = (e: React.ChangeEvent<HTMLInputElement>) => {
34
- setSearchedValue(e.target?.value);
35
- };
36
-
37
- const onFocusSearch = () => {
38
- setActiveContact();
39
- };
40
-
41
- const getUserProfileHandler = async () => {
42
- if (searchedValue) {
43
- getUserProfile(searchedValue).then((res: any) => {
44
- const { data: userProfile } = res;
45
- setSearchResult(userProfile);
46
- });
47
- }
48
- };
49
- const setContactProfile = async (profile: any) => {
50
- const isFriend = await checkFriend(profile);
51
- if (isFriend) {
52
- const friendProfile = friendList?.find(item => item.userID === searchedValue);
53
- friendProfile && setActiveContact({ type: 'friend', data: friendProfile });
54
- return;
55
- }
56
- if (isBlock(profile.userID)) {
57
- setActiveContact({ type: 'block', data: profile });
58
- return;
59
- }
60
- setActiveContact({ type: 'addFriend', data: profile });
61
- };
62
- return (
63
- <div className="tui-contact-search">
64
- <Input
65
- className="tui-contact-search-input"
66
- placeholder={t('TUIContact.Enter a userID')}
67
- clearable
68
- value={searchedValue}
69
- onBlur={searchValueBlur}
70
- onFocus={onFocusSearch}
71
- onChange={searchValueChange}
72
- onKeyDown={getUserProfileHandler}
73
- prefix={<Icon type={IconTypes.SEARCH} height={16} width={16} />}
74
- />
75
- {isShowSearchResult && searchResult.length === 0
76
- ? (
77
- <div className="tui-contact-search-item">
78
- {t('TUIContact.No Result')}
79
-
80
- </div>
81
- )
82
- : searchResult.map((item, index) => {
83
- const { userID, avatar, nick } = item;
84
- return (
85
- <div
86
- className="tui-contact-search-item"
87
- role="button"
88
- tabIndex={0}
89
- key={userID}
90
- onClick={() => {
91
- setContactProfile(item);
92
- }}
93
- >
94
- <Avatar src={avatar || defaultUserAvatar} />
95
- <div className="search-item-name">{nick || userID}</div>
96
- </div>
97
- );
98
- })}
99
- </div>
100
- );
101
- }
102
- export const ContactSearch = React.memo(UnMemoizedContactSearch);
@@ -1,31 +0,0 @@
1
- import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
2
- import { useTUIContactContext } from '../../../context';
3
- import { useUIManagerState } from '../../../states';
4
-
5
- function useContactSearch() {
6
- const { blockList } = useTUIContactContext('TUIContactList');
7
- const { chat } = useUIManagerState();
8
-
9
- const checkFriend = (info: any): Promise<any> => chat.checkFriend({
10
- userIDList: [info?.userID],
11
- type: TUIChatEngine.TYPES.SNS_CHECK_TYPE_BOTH,
12
- }).then((res: any) => res?.data?.successUserIDList[0]?.relation
13
- === TUIChatEngine.TYPES.SNS_TYPE_BOTH_WAY);
14
-
15
- const isBlock = (userID: string) => (
16
- blockList?.includes(userID)
17
- );
18
- const getUserProfile = (userID: string) => (
19
- chat.getUserProfile({
20
- userIDList: [userID],
21
- })
22
- );
23
-
24
- return {
25
- checkFriend,
26
- isBlock,
27
- getUserProfile,
28
- };
29
- }
30
-
31
- export default useContactSearch;
@@ -1,33 +0,0 @@
1
- @use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
2
-
3
- .tui-contact-search {
4
- width: 100%;
5
- position: relative;
6
- text-align: initial;
7
- align-items: center;
8
- justify-content: space-between;
9
-
10
- .tui-contact-search-input {
11
- margin: 0 10px;
12
- }
13
-
14
- .tui-contact-search-text {
15
- color: #147aff;
16
- font-size: 14px;
17
- }
18
-
19
- .tui-contact-search-item {
20
- position: absolute;
21
- margin: 10px 20px;
22
- display: flex;
23
- align-items: center;
24
-
25
- @include theme() {
26
- color: get(text-color-primary);
27
- }
28
-
29
- .search-item-name {
30
- padding-left: 10px;
31
- }
32
- }
33
- }