@tencentcloud/chat-uikit-react 1.1.1 → 1.2.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.
Files changed (272) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/_virtual/extends.js +1 -0
  3. package/dist/cjs/components/Checkbox/index.d.ts +2 -1
  4. package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  5. package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
  6. package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  7. package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
  8. package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  9. package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
  10. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  11. package/dist/cjs/components/ConversationPreview/utils.js +1 -1
  12. package/dist/cjs/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
  13. package/dist/cjs/components/ConversationSearch/ConversationSearchInput.js +1 -1
  14. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
  15. package/dist/cjs/components/DivWithEdit/DivWithEdit.d.ts +2 -1
  16. package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
  17. package/dist/cjs/components/Icon/Icon.d.ts +2 -1
  18. package/dist/cjs/components/Icon/config.js +1 -1
  19. package/dist/cjs/components/Icon/images/add-friend.svg.js +1 -0
  20. package/dist/cjs/components/Icon/images/down-arrow.png.js +1 -0
  21. package/dist/cjs/components/Icon/images/right-arrow.svg.js +1 -0
  22. package/dist/cjs/components/Icon/type.d.ts +2 -1
  23. package/dist/cjs/components/Icon/type.js +1 -1
  24. package/dist/cjs/components/Input/Input.d.ts +1 -0
  25. package/dist/cjs/components/Input/Input.js +1 -1
  26. package/dist/cjs/components/Plugins/index.d.ts +1 -0
  27. package/dist/cjs/components/Plugins/index.js +1 -1
  28. package/dist/cjs/components/Popup/index.d.ts +1 -0
  29. package/dist/cjs/components/Popup/index.js +1 -1
  30. package/dist/cjs/components/Switch/Switch.d.ts +2 -1
  31. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  32. package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  33. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  34. package/dist/cjs/components/TUIContact/TUIContact.d.ts +6 -0
  35. package/dist/cjs/components/TUIContact/TUIContact.js +1 -0
  36. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +10 -0
  37. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -0
  38. package/dist/cjs/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -0
  39. package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -0
  40. package/dist/cjs/components/TUIContact/TUIContactInfo/blockInfo.js +1 -0
  41. package/dist/cjs/components/TUIContact/TUIContactInfo/friendApplication.js +1 -0
  42. package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -0
  43. package/dist/cjs/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -0
  44. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.d.ts +6 -0
  45. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -0
  46. package/dist/cjs/components/TUIContact/hooks/useTUIContact.js +1 -0
  47. package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -0
  48. package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -0
  49. package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
  50. package/dist/cjs/components/TUIKit/TUIKit.d.ts +1 -0
  51. package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
  52. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +4 -0
  53. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
  54. package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +23 -3
  55. package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
  56. package/dist/cjs/components/TUIManage/TUIManage.d.ts +3 -1
  57. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  58. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  59. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  60. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  61. package/dist/cjs/components/TUIMessage/MessageStatus.js +1 -1
  62. package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -1
  63. package/dist/cjs/components/TUIMessage/MessageTip.js +1 -1
  64. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  65. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  66. package/dist/cjs/components/TUIMessage/utils/emojiMap.js +1 -1
  67. package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  68. package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
  69. package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
  70. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  71. package/dist/cjs/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -1
  72. package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  73. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  74. package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  75. package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
  76. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  77. package/dist/cjs/components/untils.js +1 -1
  78. package/dist/cjs/context/ComponentContext.d.ts +2 -1
  79. package/dist/cjs/context/TUIContactContext.d.ts +18 -0
  80. package/dist/cjs/context/TUIContactContext.js +1 -0
  81. package/dist/cjs/context/TUIConversationContext.js +1 -1
  82. package/dist/cjs/context/TUIKitContext.d.ts +4 -0
  83. package/dist/cjs/index.css +1 -1
  84. package/dist/cjs/index.d.css +266 -13
  85. package/dist/cjs/index.d.ts +5 -1
  86. package/dist/cjs/index.js +1 -1
  87. package/dist/cjs/locales/en/TUIChat.js +1 -0
  88. package/dist/cjs/locales/en/TUIContact.js +1 -0
  89. package/dist/cjs/locales/en/TUIConversation.js +1 -0
  90. package/dist/cjs/locales/en/TUIProfile.js +1 -0
  91. package/dist/cjs/locales/en/index.js +1 -0
  92. package/dist/cjs/locales/index.js +1 -0
  93. package/dist/cjs/locales/zh_cn/TUIChat.js +1 -0
  94. package/dist/cjs/locales/zh_cn/TUIContact.js +1 -0
  95. package/dist/cjs/locales/zh_cn/TUIConversation.js +1 -0
  96. package/dist/cjs/locales/zh_cn/TUIProfile.js +1 -0
  97. package/dist/cjs/locales/zh_cn/index.js +1 -0
  98. package/dist/esm/_virtual/extends.js +1 -0
  99. package/dist/esm/components/Checkbox/index.d.ts +2 -1
  100. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  101. package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
  102. package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  103. package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
  104. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  105. package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
  106. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  107. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  108. package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
  109. package/dist/esm/components/ConversationSearch/ConversationSearchInput.js +1 -1
  110. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  111. package/dist/esm/components/DivWithEdit/DivWithEdit.d.ts +2 -1
  112. package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
  113. package/dist/esm/components/Icon/Icon.d.ts +2 -1
  114. package/dist/esm/components/Icon/config.js +1 -1
  115. package/dist/esm/components/Icon/images/add-friend.svg.js +1 -0
  116. package/dist/esm/components/Icon/images/down-arrow.png.js +1 -0
  117. package/dist/esm/components/Icon/images/right-arrow.svg.js +1 -0
  118. package/dist/esm/components/Icon/type.d.ts +2 -1
  119. package/dist/esm/components/Icon/type.js +1 -1
  120. package/dist/esm/components/Input/Input.d.ts +1 -0
  121. package/dist/esm/components/Input/Input.js +1 -1
  122. package/dist/esm/components/Plugins/index.d.ts +1 -0
  123. package/dist/esm/components/Plugins/index.js +1 -1
  124. package/dist/esm/components/Popup/index.d.ts +1 -0
  125. package/dist/esm/components/Popup/index.js +1 -1
  126. package/dist/esm/components/Switch/Switch.d.ts +2 -1
  127. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  128. package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  129. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  130. package/dist/esm/components/TUIContact/TUIContact.d.ts +6 -0
  131. package/dist/esm/components/TUIContact/TUIContact.js +1 -0
  132. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +10 -0
  133. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -0
  134. package/dist/esm/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -0
  135. package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -0
  136. package/dist/esm/components/TUIContact/TUIContactInfo/blockInfo.js +1 -0
  137. package/dist/esm/components/TUIContact/TUIContactInfo/friendApplication.js +1 -0
  138. package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -0
  139. package/dist/esm/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -0
  140. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.d.ts +6 -0
  141. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -0
  142. package/dist/esm/components/TUIContact/hooks/useTUIContact.js +1 -0
  143. package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -0
  144. package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -0
  145. package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
  146. package/dist/esm/components/TUIKit/TUIKit.d.ts +1 -0
  147. package/dist/esm/components/TUIKit/TUIKit.js +1 -1
  148. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +4 -0
  149. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
  150. package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +23 -3
  151. package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
  152. package/dist/esm/components/TUIManage/TUIManage.d.ts +3 -1
  153. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  154. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  155. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  156. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  157. package/dist/esm/components/TUIMessage/MessageStatus.js +1 -1
  158. package/dist/esm/components/TUIMessage/MessageSystem.js +1 -1
  159. package/dist/esm/components/TUIMessage/MessageTip.js +1 -1
  160. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  161. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  162. package/dist/esm/components/TUIMessage/utils/emojiMap.js +1 -1
  163. package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  164. package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
  165. package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
  166. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  167. package/dist/esm/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -1
  168. package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  169. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  170. package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  171. package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
  172. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  173. package/dist/esm/components/untils.js +1 -1
  174. package/dist/esm/context/ComponentContext.d.ts +2 -1
  175. package/dist/esm/context/TUIContactContext.d.ts +18 -0
  176. package/dist/esm/context/TUIContactContext.js +1 -0
  177. package/dist/esm/context/TUIConversationContext.js +1 -1
  178. package/dist/esm/context/TUIKitContext.d.ts +4 -0
  179. package/dist/esm/index.css +1 -1
  180. package/dist/esm/index.d.css +266 -13
  181. package/dist/esm/index.d.ts +5 -1
  182. package/dist/esm/index.js +1 -1
  183. package/dist/esm/locales/en/TUIChat.js +1 -0
  184. package/dist/esm/locales/en/TUIContact.js +1 -0
  185. package/dist/esm/locales/en/TUIConversation.js +1 -0
  186. package/dist/esm/locales/en/TUIProfile.js +1 -0
  187. package/dist/esm/locales/en/index.js +1 -0
  188. package/dist/esm/locales/index.js +1 -0
  189. package/dist/esm/locales/zh_cn/TUIChat.js +1 -0
  190. package/dist/esm/locales/zh_cn/TUIContact.js +1 -0
  191. package/dist/esm/locales/zh_cn/TUIConversation.js +1 -0
  192. package/dist/esm/locales/zh_cn/TUIProfile.js +1 -0
  193. package/dist/esm/locales/zh_cn/index.js +1 -0
  194. package/package.json +5 -1
  195. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +10 -8
  196. package/src/components/ConversationCreate/ConversationCreate.tsx +4 -1
  197. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +6 -4
  198. package/src/components/ConversationCreate/ConversationGroupTypeInfo.tsx +7 -3
  199. package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +0 -1
  200. package/src/components/ConversationPreview/ConversationPreview.tsx +6 -5
  201. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +4 -2
  202. package/src/components/ConversationPreview/utils.tsx +12 -27
  203. package/src/components/ConversationSearch/ConversationSearchInput.tsx +3 -1
  204. package/src/components/Icon/config.ts +5 -0
  205. package/src/components/Icon/images/add-friend.svg +15 -0
  206. package/src/components/Icon/images/down-arrow.png +0 -0
  207. package/src/components/Icon/images/right-arrow.svg +3 -0
  208. package/src/components/Icon/styles/index.scss +0 -1
  209. package/src/components/Icon/type.ts +1 -0
  210. package/src/components/Input/Input.tsx +11 -2
  211. package/src/components/Plugins/index.tsx +26 -2
  212. package/src/components/Popup/index.tsx +20 -2
  213. package/src/components/TUIChat/hooks/useHandleMessageList.tsx +3 -8
  214. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +3 -3
  215. package/src/components/TUIContact/TUIContact.tsx +96 -0
  216. package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +32 -0
  217. package/src/components/TUIContact/TUIContactInfo/addFriendInfo.tsx +86 -0
  218. package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +34 -0
  219. package/src/components/TUIContact/TUIContactInfo/blockInfo.tsx +45 -0
  220. package/src/components/TUIContact/TUIContactInfo/friendApplication.tsx +66 -0
  221. package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +103 -0
  222. package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +112 -0
  223. package/src/components/TUIContact/TUIContactInfo/index.scss +108 -0
  224. package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +162 -0
  225. package/src/components/TUIContact/TUIContactList/index.scss +90 -0
  226. package/src/components/TUIContact/hooks/useTUIContact.tsx +76 -0
  227. package/src/components/TUIContact/index.scss +67 -0
  228. package/src/components/TUIContact/index.ts +3 -0
  229. package/src/components/TUIContactSearch/TUIContactSearch.tsx +100 -0
  230. package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +32 -0
  231. package/src/components/TUIContactSearch/index.scss +24 -0
  232. package/src/components/TUIConversationList/TUIConversationList.tsx +3 -4
  233. package/src/components/TUIConversationList/index.scss +2 -2
  234. package/src/components/TUIKit/TUIKit.tsx +9 -2
  235. package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +8 -0
  236. package/src/components/TUIKit/hooks/useTUIKit.tsx +43 -4
  237. package/src/components/TUIManage/TUIManage.tsx +5 -3
  238. package/src/components/TUIMessage/MessagePlugins.tsx +17 -7
  239. package/src/components/TUIMessage/MessageRevoke.tsx +5 -4
  240. package/src/components/TUIMessage/MessageStatus.tsx +3 -3
  241. package/src/components/TUIMessage/hooks/useMessageHandler.ts +4 -2
  242. package/src/components/TUIMessage/styles/layout.scss +2 -9
  243. package/src/components/TUIMessage/utils/emojiMap.ts +6 -2
  244. package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +5 -3
  245. package/src/components/TUIMessageInput/TUIForward.tsx +8 -27
  246. package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +3 -1
  247. package/src/components/TUIMessageInput/hooks/useCreateMessageInputContext.ts +3 -3
  248. package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +7 -1
  249. package/src/components/TUIMessageInput/styles/layout.scss +0 -1
  250. package/src/components/TUIMessageList/TUIMessageList.tsx +3 -1
  251. package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +3 -2
  252. package/src/components/TUIProfile/TUIProfile.tsx +18 -7
  253. package/src/components/TUIProfile/TUIProfileDefault.tsx +64 -6
  254. package/src/components/TUIProfile/styles/layout.scss +1 -1
  255. package/src/components/index.ts +1 -0
  256. package/src/components/untils.ts +26 -6
  257. package/src/context/TUIContactContext.tsx +32 -0
  258. package/src/context/TUIKitContext.tsx +5 -0
  259. package/src/context/index.ts +1 -0
  260. package/src/hooks/useConversation.tsx +3 -3
  261. package/src/locales/en/TUIChat.ts +27 -0
  262. package/src/locales/en/TUIContact.ts +28 -0
  263. package/src/locales/en/TUIConversation.ts +34 -0
  264. package/src/locales/en/TUIProfile.ts +14 -0
  265. package/src/locales/en/index.ts +11 -0
  266. package/src/locales/index.ts +23 -0
  267. package/src/locales/zh_cn/TUIChat.ts +27 -0
  268. package/src/locales/zh_cn/TUIContact.ts +29 -0
  269. package/src/locales/zh_cn/TUIConversation.ts +33 -0
  270. package/src/locales/zh_cn/TUIProfile.ts +14 -0
  271. package/src/locales/zh_cn/index.ts +11 -0
  272. package/tsconfig.json +1 -0
@@ -22,3 +22,4 @@ export * from './Plugins';
22
22
  export * from './Switch';
23
23
  export * from './Toast';
24
24
  export * from './Popup';
25
+ export * from './TUIContact';
@@ -6,6 +6,7 @@ import {
6
6
  isToday,
7
7
  isYesterday,
8
8
  } from 'date-fns';
9
+ import { enGB, zhCN } from 'date-fns/locale';
9
10
  import TencentCloudChat from '@tencentcloud/chat';
10
11
  import { defaultGroupAvatarWork, defaultUserAvatar } from './Avatar';
11
12
 
@@ -50,21 +51,40 @@ export const handleDisplayAvatar = (avatar: string, type:string = TencentCloudCh
50
51
  return displayImage;
51
52
  };
52
53
 
53
- export const getTimeStamp = (time: number) => {
54
+ export const getTimeStamp = (time: number, language?: string) => {
55
+ const locales = { enGB, zhCN };
56
+ let lng = '';
57
+ if (language === 'zh') {
58
+ lng = 'zhCN';
59
+ }
60
+ if (language === 'en') {
61
+ lng = 'enGB';
62
+ }
63
+
54
64
  if (!time) {
55
65
  return '';
56
66
  }
57
67
  if (!isThisYear(time)) {
58
- return format(time, 'yyyy MMM dd');
68
+ return format(time, 'yyyy MMM dd', {
69
+ locale: locales[lng],
70
+ });
59
71
  }
60
72
  if (isToday(time)) {
61
- return format(time, 'p');
73
+ return format(time, 'p', {
74
+ locale: locales[lng],
75
+ });
62
76
  }
63
77
  if (isYesterday(time)) {
64
- return formatDistance(time, new Date());
78
+ return formatDistance(time, new Date(), {
79
+ locale: locales[lng],
80
+ });
65
81
  }
66
82
  if (isThisWeek(time)) {
67
- return format(time, 'eeee');
83
+ return format(time, 'eeee', {
84
+ locale: locales[lng],
85
+ });
68
86
  }
69
- return format(time, 'MMM dd');
87
+ return format(time, 'MMM dd', {
88
+ locale: locales[lng],
89
+ });
70
90
  };
@@ -0,0 +1,32 @@
1
+ import React, {
2
+ PropsWithChildren, useContext,
3
+ } from 'react';
4
+ import { Friend, Profile, FriendApplication } from '@tencentcloud/chat';
5
+
6
+ export interface TUIContactContextValue {
7
+ friendList?: Array<Friend>,
8
+ blocklistProfile?: Array<Profile>,
9
+ friendApplicationList?: Array<FriendApplication>,
10
+ blockList?: Array<string>,
11
+ isShowContactList?: boolean,
12
+ setShowContactList?: React.Dispatch<React.SetStateAction<boolean>>
13
+ }
14
+ export const TUIContactContext = React.createContext<TUIContactContextValue>(null);
15
+ export function TUIContactContextProvider({ children, value }:PropsWithChildren<{
16
+ value: TUIContactContextValue
17
+ }>):React.ReactElement {
18
+ return (
19
+ <TUIContactContext.Provider value={value}>
20
+ {children}
21
+ </TUIContactContext.Provider>
22
+ );
23
+ }
24
+
25
+ export function useTUIContactContext(componentName?:string)
26
+ :TUIContactContextValue {
27
+ const contextValue = useContext(TUIContactContext);
28
+ if (!contextValue && componentName) {
29
+ return {} as TUIContactContextValue;
30
+ }
31
+ return (contextValue as unknown) as TUIContactContextValue;
32
+ }
@@ -4,16 +4,21 @@ import {
4
4
  Conversation,
5
5
  Profile,
6
6
  } from '@tencentcloud/chat';
7
+ import { UseContactParams } from '../components/TUIKit/hooks/useTUIKit';
7
8
 
8
9
  export interface TUIKitContextValue {
9
10
  chat: ChatSDK,
11
+ language: string,
10
12
  conversation?: Conversation,
13
+ contactData?: UseContactParams,
11
14
  setActiveConversation: (conversation?: Conversation) => void,
12
15
  customClasses?: unknown,
13
16
  myProfile?: Profile,
14
17
  TUIManageShow?: boolean,
15
18
  setTUIManageShow?: React.Dispatch<React.SetStateAction<boolean>>,
16
19
  TUIProfileShow?: boolean,
20
+ // 激活 contact 列表数据,右侧显示数据,无参数时,右侧数据默认为空
21
+ setActiveContact: (UseContactParams?: UseContactParams) => void,
17
22
  setTUIProfileShow?: React.Dispatch<React.SetStateAction<boolean>>,
18
23
  }
19
24
  export const TUIKitContext = React.createContext<TUIKitContextValue | undefined>(undefined);
@@ -4,3 +4,4 @@ export * from './TUIChatActionContext';
4
4
  export * from './TUIMessageContext';
5
5
  export * from './ComponentContext';
6
6
  export * from './TUIMessageInputContext';
7
+ export * from './TUIContactContext';
@@ -55,14 +55,14 @@ export const useConversation = (chat) => {
55
55
  groupCustomField,
56
56
  isSupportTopic,
57
57
  });
58
- const { groupID: createdGroupId } = res.data.group;
58
+ const { groupID: createdGroupID } = res.data.group;
59
59
  if (type === TencentCloudChat.TYPES.GRP_AVCHATROOM) {
60
60
  await chat.joinGroup({
61
- groupID: createdGroupId,
61
+ groupID: createdGroupID,
62
62
  type: TencentCloudChat.TYPES.GRP_AVCHATROOM,
63
63
  });
64
64
  }
65
- const { data } = await chat.getConversationProfile(`GROUP${createdGroupId}`);
65
+ const { data } = await chat.getConversationProfile(`GROUP${createdGroupID}`);
66
66
  return data.conversation;
67
67
  };
68
68
  const pinConversation = (options: {
@@ -0,0 +1,27 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIChat = {
3
+ 'TUIChat': 'TUIChat',
4
+ 'Recall': 'Recall',
5
+ 'Reference': 'Reference',
6
+ 'Forward': 'Forward',
7
+ 'Copy': 'Copy',
8
+ 'Delete': 'Delete',
9
+ 'Forward to': 'Forward to',
10
+ 'recalled a message': 'recalled a message',
11
+ 'Re-edit': 'Re-edit',
12
+ 'Resend': 'Resend',
13
+ 'You': 'You',
14
+ 'Recent Chats': 'Recent Chats',
15
+ 'Frequently Contacted': 'Frequently Contacted',
16
+ 'No Result': 'No Result',
17
+ 'Search Result': 'Search Result',
18
+ 'Image': 'Image',
19
+ 'Video': 'Video',
20
+ 'File': 'File',
21
+ 'Enter a message': 'Enter a message',
22
+ 'No More': 'No More',
23
+ 'Error deleting message': 'Error deleting message',
24
+ 'The message recall exceeded the time limit (default 2 minutes)': 'The message recall exceeded the time limit (default 2 minutes)',
25
+ 'Error revoke Message': 'Error revoke Message',
26
+ };
27
+ export default TUIChat;
@@ -0,0 +1,28 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIContact = {
3
+ 'Enter a userID': 'Enter a userID',
4
+ 'Enter the verification info': 'Enter the verification info',
5
+ 'Request to join': 'Request to join',
6
+ 'Requested': 'Requested',
7
+ 'Accept': 'Accept',
8
+ 'Refuse': 'Refuse',
9
+ 'Handled': 'Handled',
10
+ 'Friend': 'Friend',
11
+ 'Send Message': 'Send Message',
12
+ 'Signature': 'Signature',
13
+ 'New Contacts': 'New Contacts',
14
+ 'Blocked List': 'Blocked List',
15
+ 'No Result': 'No Result',
16
+ 'ID': 'ID',
17
+ 'User': 'User',
18
+ 'Add Friend': 'Add Friend',
19
+ 'remark': 'remark',
20
+ 'block': 'block',
21
+ 'Delete friend': 'Delete friend',
22
+ 'waiting for verification': 'waiting for verification',
23
+ 'verification info': 'verification info',
24
+ 'Send application': 'Send application',
25
+ 'Agree': 'Agree',
26
+ };
27
+
28
+ export default TUIContact;
@@ -0,0 +1,34 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIConversation = {
3
+ 'Start chat': 'Start chat',
4
+ 'New one-to-one chat': 'New one-to-one chat',
5
+ 'New group chat': 'New group chat',
6
+ 'Enter a user ID': 'Enter a user ID',
7
+ 'Delete': 'Delete',
8
+ 'Conversation Information': 'Conversation Information',
9
+ 'Pin': 'Pin',
10
+ 'Unpin': 'Unpin',
11
+ 'Search': 'Search',
12
+ 'Add Participants': 'Add Participants',
13
+ 'No conversation': 'No conversation',
14
+ 'Next': 'Next',
15
+ 'Group Name': 'Group Name',
16
+ 'Group ID': 'Group ID',
17
+ 'Group Type': 'Group Type',
18
+ 'Participants': 'Participants',
19
+ 'Create': 'Create',
20
+ 'Details': 'Details',
21
+ 'Work': 'Work',
22
+ 'Public': 'Public',
23
+ 'Meeting': 'Meeting',
24
+ 'AVChatRoom': 'AVChatRoom',
25
+ 'Community': 'Community',
26
+ 'Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details.': 'Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details.',
27
+ 'After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details.': 'After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details.',
28
+ 'After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details.': 'After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details.',
29
+ 'After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details.': 'After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details.',
30
+ 'After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details.': 'After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details.',
31
+ 'Participant cannot be empty': 'Participant cannot be empty',
32
+ };
33
+
34
+ export default TUIConversation;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIProfile = {
3
+ 'Personal information': 'Personal information',
4
+ 'Signature': 'Signature',
5
+ 'Gender': 'Gender',
6
+ 'Male': 'Male',
7
+ 'Female': 'Female',
8
+ 'AllowType': 'AllowType',
9
+ 'NeedConfirm': 'NeedConfirm',
10
+ 'AllowAny': 'AllowAny',
11
+ 'DenyAny': 'DenyAny',
12
+ 'Birthday': 'Birthday',
13
+ };
14
+ export default TUIProfile;
@@ -0,0 +1,11 @@
1
+ import TUIChat from './TUIChat';
2
+ import TUIConversation from './TUIConversation';
3
+ import TUIContact from './TUIContact';
4
+ import TUIProfile from './TUIProfile';
5
+
6
+ export const message = {
7
+ TUIChat,
8
+ TUIConversation,
9
+ TUIContact,
10
+ TUIProfile,
11
+ };
@@ -0,0 +1,23 @@
1
+ import i18n from 'i18next';
2
+ import { initReactI18next } from 'react-i18next';
3
+ import { message as enUSMessage } from './en/index';
4
+ import { message as zhCNMessage } from './zh_cn/index';
5
+
6
+ const resources = {
7
+ en: {
8
+ translation: enUSMessage,
9
+ },
10
+ zh: {
11
+ translation: zhCNMessage,
12
+ },
13
+ };
14
+
15
+ i18n.use(initReactI18next).init({
16
+ resources,
17
+ lng: 'zh',
18
+ interpolation: {
19
+ escapeValue: false,
20
+ },
21
+ });
22
+
23
+ export default i18n;
@@ -0,0 +1,27 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIChat = {
3
+ 'Recall': '撤回',
4
+ 'Reference': '引用',
5
+ 'Forward': '转发',
6
+ 'Copy': '复制',
7
+ 'Delete': '删除',
8
+ 'Forward to': '转发给',
9
+ 'recalled a message': '撤回了一条消息',
10
+ 'Re-edit': '重新编辑',
11
+ 'Resend': '重新发送',
12
+ 'You': '您',
13
+ 'Recent Chats': '会话',
14
+ 'Frequently Contacted': '最近的会话',
15
+ 'No Result': '无搜索结果',
16
+ 'Search Result': '搜索结果',
17
+ 'Image': '图片',
18
+ 'Video': '视频',
19
+ 'File': '文件',
20
+ 'Enter a message': '请输入消息',
21
+ 'No More': '没有更多',
22
+ 'Error deleting message': '消息删除失败',
23
+ 'The message recall exceeded the time limit (default 2 minutes)': '消息已超过 2 分钟',
24
+ 'Error revoke Message': '消息撤回失败',
25
+ };
26
+
27
+ export default TUIChat;
@@ -0,0 +1,29 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIContact = {
3
+ 'Enter a userID': '请输入用户 ID,回车搜索',
4
+ 'Enter the verification info': '请填写验证信息',
5
+ 'Request to join': '申请加入',
6
+ 'Requested': '已申请',
7
+ 'Accept': '接受',
8
+ 'Refuse': '拒绝',
9
+ 'Handled': '已处理',
10
+ 'Friend': '我的好友',
11
+ 'Send Message': '发送消息',
12
+ 'Signature': '个性签名',
13
+ 'Successful application, waiting for the administrator to agree to join the group application': '等待管理员同意',
14
+ 'New Contacts': '新的联系人',
15
+ 'Blocked List': '黑名单',
16
+ 'No Result': '无搜索结果',
17
+ 'ID': 'ID',
18
+ 'User': '联系人',
19
+ 'Add Friend': '添加好友',
20
+ 'remark': '备注',
21
+ 'block': '加入黑名单',
22
+ 'Delete friend': '删除好友',
23
+ 'waiting for verification': '等待验证',
24
+ 'verification info': '验证信息',
25
+ 'Send application': '发送申请',
26
+ 'Agree': '同意',
27
+ };
28
+
29
+ export default TUIContact;
@@ -0,0 +1,33 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIConversation = {
3
+ 'Start chat': '发起会话',
4
+ 'New one-to-one chat': '发起单聊',
5
+ 'New group chat': '发起群聊',
6
+ 'Delete': '删除会话',
7
+ 'Pin': '置顶会话',
8
+ 'Unpin': '取消置顶',
9
+ 'Conversation Information': '会话信息',
10
+ 'Search': '搜索',
11
+ 'Add Participants': '创建群聊',
12
+ 'No conversation': '无会话',
13
+ 'Next': '下一步',
14
+ 'Group Name': '群名称',
15
+ 'Group ID': '群 ID',
16
+ 'Group Type': '群类型',
17
+ 'Participants': '成员',
18
+ 'Create': '创建',
19
+ 'Details': '详情',
20
+ 'Work': '好友工作群(Work)',
21
+ 'Public': '陌生人社交群(Public)',
22
+ 'Meeting': '临时会议群(Meeting)',
23
+ 'AVChatRoom': '直播群(AVChatroom)',
24
+ 'Community': '社群(Community)',
25
+ 'Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details.': '类似普通微信群,创建后仅支持已在群内的好友邀请加群,且无需被邀请方同意或群主同意。',
26
+ 'After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details.': '类似 QQ 群,创建后群主可以指定群管理员,用户搜索群 ID 发起加群申请后,需要群主或管理员审批通过才能入群。',
27
+ 'After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details.': '创建后可以随意进出,且支持查看入群前消息;适合用于音视频会议场景、在线教育场景等与实时音视频产品结合的场景。',
28
+ 'After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details.': '创建后可以随意进出,没有群成员数量上限,但不支持历史消息存储;适合与直播产品结合,用于弹幕聊天场景。',
29
+ 'After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details.': '创建后可以随意进出,最多支持100000人,支持历史消息存储,用户搜索群 ID 发起加群申请后,无需管理员审批即可进群。',
30
+ 'Participant cannot be empty': '不能为空',
31
+ };
32
+
33
+ export default TUIConversation;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable quote-props */
2
+ const TUIProfile = {
3
+ 'Personal information': '个人信息',
4
+ 'Signature': '个性签名',
5
+ 'Gender': '性别',
6
+ 'Male': '男',
7
+ 'Female': '女',
8
+ 'AllowType': '加好友验证方式',
9
+ 'NeedConfirm': '需要验证',
10
+ 'AllowAny': '同意任何用户加好友',
11
+ 'DenyAny': '拒绝任何用户加好友',
12
+ 'Birthday': '生日',
13
+ };
14
+ export default TUIProfile;
@@ -0,0 +1,11 @@
1
+ import TUIChat from './TUIChat';
2
+ import TUIConversation from './TUIConversation';
3
+ import TUIContact from './TUIContact';
4
+ import TUIProfile from './TUIProfile';
5
+
6
+ export const message = {
7
+ TUIChat,
8
+ TUIConversation,
9
+ TUIContact,
10
+ TUIProfile,
11
+ };
package/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "allowSyntheticDefaultImports": true,
6
6
  "moduleResolution": "node",
7
7
  "jsx": "react-jsx",
8
+ "lib": ["es6", "dom", "es2016"],
8
9
  },
9
10
  "include": [
10
11
  "src"