@tencentcloud/chat-uikit-react 2.1.0 → 2.1.3

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 (302) hide show
  1. package/.eslintrc.js +0 -1
  2. package/CHANGELOG.md +10 -0
  3. package/dist/cjs/components/Avatar/Avatar.js +1 -1
  4. package/dist/cjs/components/Checkbox/index.d.ts +2 -1
  5. package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  6. package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
  7. package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  8. package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
  9. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.d.ts +4 -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/ConversationSearchResult.js +1 -1
  14. package/dist/cjs/components/DivWithEdit/DivWithEdit.d.ts +3 -2
  15. package/dist/cjs/components/DivWithEdit/DivWithEdit.js +1 -1
  16. package/dist/cjs/components/DivWithEdit/WithText.js +1 -1
  17. package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
  18. package/dist/cjs/components/Icon/Icon.d.ts +2 -1
  19. package/dist/cjs/components/Icon/Icon.js +1 -1
  20. package/dist/cjs/components/Icon/config.js +1 -1
  21. package/dist/cjs/components/Input/Input.js +1 -1
  22. package/dist/cjs/components/Model/index.d.ts +1 -1
  23. package/dist/cjs/components/Model/index.js +1 -1
  24. package/dist/cjs/components/Plugins/index.js +1 -1
  25. package/dist/cjs/components/Popup/index.d.ts +1 -1
  26. package/dist/cjs/components/Popup/index.js +1 -1
  27. package/dist/cjs/components/Switch/Switch.d.ts +2 -6
  28. package/dist/cjs/components/Switch/Switch.js +1 -1
  29. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  30. package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
  31. package/dist/cjs/components/TUIChat/hooks/useHandleMessage.js +1 -1
  32. package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  33. package/dist/cjs/components/TUIChat/unitls.js +1 -1
  34. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  35. package/dist/cjs/components/TUIContact/TUIContact.js +1 -1
  36. package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  37. package/dist/cjs/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
  38. package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  39. package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  40. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  41. package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -1
  42. package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  43. package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  44. package/dist/cjs/components/TUIKit/TUIKit.d.ts +2 -2
  45. package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
  46. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +7 -7
  47. package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +2 -2
  48. package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
  49. package/dist/cjs/components/TUIManage/TUIManage.d.ts +4 -1
  50. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  51. package/dist/cjs/components/TUIMessage/MessageAudio.js +1 -1
  52. package/dist/cjs/components/TUIMessage/MessageAvatar.js +1 -1
  53. package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
  54. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  55. package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
  56. package/dist/cjs/components/TUIMessage/MessageFace.js +1 -1
  57. package/dist/cjs/components/TUIMessage/MessageFile.js +1 -1
  58. package/dist/cjs/components/TUIMessage/MessageImage.js +1 -1
  59. package/dist/cjs/components/TUIMessage/MessageLocation.js +1 -1
  60. package/dist/cjs/components/TUIMessage/MessageMerger.js +1 -1
  61. package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
  62. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  63. package/dist/cjs/components/TUIMessage/MessageProgress.js +1 -1
  64. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  65. package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
  66. package/dist/cjs/components/TUIMessage/MessageVideo.js +1 -1
  67. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  68. package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -1
  69. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  70. package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -1
  71. package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
  72. package/dist/cjs/components/TUIMessageInput/EmojiPicker.js +1 -1
  73. package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  74. package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  75. package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
  76. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  77. package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  78. package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  79. package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  80. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputState.d.ts +2 -2
  81. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  82. package/dist/cjs/components/TUIMessageInput/hooks/useUploadElement.js +1 -1
  83. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  84. package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  85. package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
  86. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  87. package/dist/cjs/components/TUIProfile/hooks/useMyProfile.js +1 -1
  88. package/dist/cjs/components/Toast/index.js +1 -1
  89. package/dist/cjs/constants.js +1 -1
  90. package/dist/cjs/context/ComponentContext.d.ts +3 -2
  91. package/dist/cjs/context/TUIChatActionContext.d.ts +1 -1
  92. package/dist/cjs/context/TUIChatStateContext.d.ts +4 -4
  93. package/dist/cjs/context/TUIContactContext.js +1 -1
  94. package/dist/cjs/context/TUIConversationContext.js +1 -1
  95. package/dist/cjs/context/TUIKitContext.d.ts +1 -1
  96. package/dist/cjs/context/TUIMessageContext.js +1 -1
  97. package/dist/cjs/context/TUIMessageInputContext.js +1 -1
  98. package/dist/cjs/hooks/useProfile.d.ts +1 -1
  99. package/dist/cjs/index.css +1 -1
  100. package/dist/cjs/index.d.css +20 -3
  101. package/dist/cjs/index.d.ts +1 -1
  102. package/dist/esm/components/Avatar/Avatar.js +1 -1
  103. package/dist/esm/components/Checkbox/index.d.ts +2 -1
  104. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  105. package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
  106. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  107. package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
  108. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +4 -1
  109. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  110. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  111. package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
  112. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  113. package/dist/esm/components/DivWithEdit/DivWithEdit.d.ts +3 -2
  114. package/dist/esm/components/DivWithEdit/DivWithEdit.js +1 -1
  115. package/dist/esm/components/DivWithEdit/WithText.js +1 -1
  116. package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
  117. package/dist/esm/components/Icon/Icon.d.ts +2 -1
  118. package/dist/esm/components/Icon/Icon.js +1 -1
  119. package/dist/esm/components/Icon/config.js +1 -1
  120. package/dist/esm/components/Input/Input.js +1 -1
  121. package/dist/esm/components/Model/index.d.ts +1 -1
  122. package/dist/esm/components/Model/index.js +1 -1
  123. package/dist/esm/components/Plugins/index.js +1 -1
  124. package/dist/esm/components/Popup/index.d.ts +1 -1
  125. package/dist/esm/components/Popup/index.js +1 -1
  126. package/dist/esm/components/Switch/Switch.d.ts +2 -6
  127. package/dist/esm/components/Switch/Switch.js +1 -1
  128. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  129. package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
  130. package/dist/esm/components/TUIChat/hooks/useHandleMessage.js +1 -1
  131. package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  132. package/dist/esm/components/TUIChat/unitls.js +1 -1
  133. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  134. package/dist/esm/components/TUIContact/TUIContact.js +1 -1
  135. package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -1
  136. package/dist/esm/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
  137. package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
  138. package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  139. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  140. package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -1
  141. package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  142. package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  143. package/dist/esm/components/TUIKit/TUIKit.d.ts +2 -2
  144. package/dist/esm/components/TUIKit/TUIKit.js +1 -1
  145. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +7 -7
  146. package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +2 -2
  147. package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
  148. package/dist/esm/components/TUIManage/TUIManage.d.ts +4 -1
  149. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  150. package/dist/esm/components/TUIMessage/MessageAudio.js +1 -1
  151. package/dist/esm/components/TUIMessage/MessageAvatar.js +1 -1
  152. package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
  153. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  154. package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
  155. package/dist/esm/components/TUIMessage/MessageFace.js +1 -1
  156. package/dist/esm/components/TUIMessage/MessageFile.js +1 -1
  157. package/dist/esm/components/TUIMessage/MessageImage.js +1 -1
  158. package/dist/esm/components/TUIMessage/MessageLocation.js +1 -1
  159. package/dist/esm/components/TUIMessage/MessageMerger.js +1 -1
  160. package/dist/esm/components/TUIMessage/MessageName.js +1 -1
  161. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  162. package/dist/esm/components/TUIMessage/MessageProgress.js +1 -1
  163. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  164. package/dist/esm/components/TUIMessage/MessageText.js +1 -1
  165. package/dist/esm/components/TUIMessage/MessageVideo.js +1 -1
  166. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  167. package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -1
  168. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  169. package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -1
  170. package/dist/esm/components/TUIMessage/utils/index.js +1 -1
  171. package/dist/esm/components/TUIMessageInput/EmojiPicker.js +1 -1
  172. package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  173. package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  174. package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
  175. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  176. package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  177. package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  178. package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  179. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputState.d.ts +2 -2
  180. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  181. package/dist/esm/components/TUIMessageInput/hooks/useUploadElement.js +1 -1
  182. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  183. package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  184. package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
  185. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  186. package/dist/esm/components/TUIProfile/hooks/useMyProfile.js +1 -1
  187. package/dist/esm/components/Toast/index.js +1 -1
  188. package/dist/esm/constants.js +1 -1
  189. package/dist/esm/context/ComponentContext.d.ts +3 -2
  190. package/dist/esm/context/TUIChatActionContext.d.ts +1 -1
  191. package/dist/esm/context/TUIChatStateContext.d.ts +4 -4
  192. package/dist/esm/context/TUIContactContext.js +1 -1
  193. package/dist/esm/context/TUIConversationContext.js +1 -1
  194. package/dist/esm/context/TUIKitContext.d.ts +1 -1
  195. package/dist/esm/context/TUIMessageContext.js +1 -1
  196. package/dist/esm/context/TUIMessageInputContext.js +1 -1
  197. package/dist/esm/hooks/useProfile.d.ts +1 -1
  198. package/dist/esm/index.css +1 -1
  199. package/dist/esm/index.d.css +20 -3
  200. package/dist/esm/index.d.ts +1 -1
  201. package/index.ts +1 -0
  202. package/package.json +7 -6
  203. package/rollup.config.js +2 -1
  204. package/src/components/Avatar/Avatar.tsx +7 -3
  205. package/src/components/Avatar/styles/index.scss +1 -1
  206. package/src/components/Checkbox/index.tsx +1 -1
  207. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +14 -7
  208. package/src/components/ConversationCreate/ConversationCreate.tsx +5 -1
  209. package/src/components/ConversationCreate/ConversationCreateSelectView.tsx +2 -2
  210. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +11 -10
  211. package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +14 -12
  212. package/src/components/ConversationPreview/ConversationPreview.tsx +3 -3
  213. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +9 -5
  214. package/src/components/ConversationPreview/utils.tsx +6 -3
  215. package/src/components/DivWithEdit/DivWithEdit.tsx +6 -5
  216. package/src/components/DivWithEdit/WithText.tsx +3 -1
  217. package/src/components/DivWithEdit/styles/index.scss +1 -1
  218. package/src/components/Icon/Icon.tsx +2 -2
  219. package/src/components/Icon/config.ts +3 -4
  220. package/src/components/Input/Input.tsx +15 -12
  221. package/src/components/Model/index.tsx +2 -2
  222. package/src/components/Plugins/index.tsx +15 -12
  223. package/src/components/Popup/index.tsx +13 -9
  224. package/src/components/Switch/Switch.tsx +5 -7
  225. package/src/components/TUIChat/TUIChat.tsx +20 -5
  226. package/src/components/TUIChat/TUIChatState.tsx +3 -3
  227. package/src/components/TUIChat/hooks/useHandleMessage.tsx +5 -5
  228. package/src/components/TUIChat/hooks/useHandleMessageList.tsx +2 -2
  229. package/src/components/TUIChat/unitls.ts +2 -2
  230. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +3 -2
  231. package/src/components/TUIContact/TUIContact.tsx +2 -1
  232. package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +2 -1
  233. package/src/components/TUIContact/TUIContactInfo/addFriendInfo.tsx +2 -2
  234. package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +18 -0
  235. package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +1 -2
  236. package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +0 -10
  237. package/src/components/TUIContact/TUIContactInfo/index.scss +5 -0
  238. package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +7 -4
  239. package/src/components/TUIContact/TUIContactList/index.scss +5 -0
  240. package/src/components/TUIContact/hooks/useTUIContact.tsx +3 -4
  241. package/src/components/TUIContact/index.scss +5 -0
  242. package/src/components/TUIContactSearch/TUIContactSearch.tsx +6 -7
  243. package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +1 -3
  244. package/src/components/TUIConversationList/TUIConversationList.tsx +1 -1
  245. package/src/components/TUIConversationList/hooks/useConversationList.tsx +1 -1
  246. package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +2 -2
  247. package/src/components/TUIKit/TUIKit.tsx +35 -17
  248. package/src/components/TUIKit/hooks/useTUIKit.tsx +4 -4
  249. package/src/components/TUIManage/TUIManage.tsx +20 -13
  250. package/src/components/TUIMessage/MessageAudio.tsx +8 -6
  251. package/src/components/TUIMessage/MessageAvatar.tsx +2 -2
  252. package/src/components/TUIMessage/MessageBubble.tsx +7 -5
  253. package/src/components/TUIMessage/MessageContext.tsx +3 -3
  254. package/src/components/TUIMessage/MessageCustom.tsx +5 -3
  255. package/src/components/TUIMessage/MessageFace.tsx +2 -2
  256. package/src/components/TUIMessage/MessageFile.tsx +5 -5
  257. package/src/components/TUIMessage/MessageImage.tsx +4 -2
  258. package/src/components/TUIMessage/MessageLocation.tsx +3 -3
  259. package/src/components/TUIMessage/MessageMerger.tsx +3 -3
  260. package/src/components/TUIMessage/MessageName.tsx +1 -1
  261. package/src/components/TUIMessage/MessagePlugins.tsx +12 -10
  262. package/src/components/TUIMessage/MessageProgress.tsx +5 -4
  263. package/src/components/TUIMessage/MessageRevoke.tsx +1 -1
  264. package/src/components/TUIMessage/MessageText.tsx +4 -4
  265. package/src/components/TUIMessage/MessageVideo.tsx +3 -3
  266. package/src/components/TUIMessage/TUIMessage.tsx +1 -1
  267. package/src/components/TUIMessage/TUIMessageDefault.tsx +3 -1
  268. package/src/components/TUIMessage/hooks/useMessageHandler.ts +13 -13
  269. package/src/components/TUIMessage/hooks/useMessageReply.ts +6 -4
  270. package/src/components/TUIMessage/utils/decodeText.ts +2 -3
  271. package/src/components/TUIMessage/utils/index.ts +1 -2
  272. package/src/components/TUIMessageInput/EmojiPicker.tsx +4 -4
  273. package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +8 -8
  274. package/src/components/TUIMessageInput/InputQuoteDefalut.tsx +4 -2
  275. package/src/components/TUIMessageInput/TUIForward.tsx +22 -15
  276. package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +15 -9
  277. package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +2 -2
  278. package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +4 -4
  279. package/src/components/TUIMessageInput/hooks/useHandleQuoteMessage.tsx +5 -5
  280. package/src/components/TUIMessageInput/hooks/useMessageInputState.tsx +3 -3
  281. package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +12 -9
  282. package/src/components/TUIMessageInput/hooks/useUploadElement.tsx +2 -2
  283. package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +1 -1
  284. package/src/components/TUIMessageList/TUIMessageList.tsx +5 -6
  285. package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +5 -2
  286. package/src/components/TUIProfile/TUIProfile.tsx +3 -1
  287. package/src/components/TUIProfile/TUIProfileDefault.tsx +15 -15
  288. package/src/components/TUIProfile/hooks/useMyProfile.tsx +6 -6
  289. package/src/components/Toast/index.tsx +3 -3
  290. package/src/components/Toast/styles/layout.scss +1 -1
  291. package/src/components/untils.ts +1 -1
  292. package/src/constants.ts +5 -0
  293. package/src/context/TUIChatStateContext.tsx +4 -4
  294. package/src/context/TUIContactContext.tsx +1 -1
  295. package/src/context/TUIConversationContext.tsx +2 -2
  296. package/src/context/TUIMessageContext.tsx +1 -1
  297. package/src/context/TUIMessageInputContext.tsx +1 -1
  298. package/src/hooks/useConversation.tsx +1 -1
  299. package/src/hooks/useProfile.tsx +2 -2
  300. package/tsconfig.json +1 -0
  301. package/dist/cjs/components/Icon/images/create.png.js +0 -1
  302. package/dist/esm/components/Icon/images/create.png.js +0 -1
@@ -6,7 +6,7 @@ interface PopupProps {
6
6
  className?: string,
7
7
  style?: any,
8
8
  show?: boolean,
9
- close?: (e) => void,
9
+ close: (e: any) => void,
10
10
  root?: any,
11
11
  handleVisible?: (isVisible:any) => void,
12
12
  }
@@ -49,7 +49,7 @@ T extends PopupProps
49
49
  rootBounds: changeRootBounds,
50
50
  intersectionRatio,
51
51
  } = change;
52
- const popupBoundingClientRect = popup.current.getBoundingClientRect() || {};
52
+ const popupBoundingClientRect = popup.current?.getBoundingClientRect() || {};
53
53
  const rootRootBounds = root?.getBoundingClientRect() || {};
54
54
  const boundingClientRect = {
55
55
  ...changeBoundingClientRec,
@@ -73,7 +73,7 @@ T extends PopupProps
73
73
  threshold: [1],
74
74
  });
75
75
 
76
- if (popup && show) {
76
+ if (popup?.current && show) {
77
77
  io.observe(popup?.current);
78
78
  }
79
79
  return () => {
@@ -82,13 +82,17 @@ T extends PopupProps
82
82
  };
83
83
  }, [popup, show]);
84
84
 
85
- const stopImmediatePropagation = (e) => {
85
+ const stopImmediatePropagation = (e: Event) => {
86
86
  e.stopPropagation();
87
87
  };
88
88
 
89
- return show && (
90
- <div role="button" tabIndex={0} style={style} className={`popup ${className} ${isSetPos && 'popup-show'}`} ref={popup}>
91
- {children}
92
- </div>
93
- );
89
+ return (
90
+ <>{show && (
91
+ // eslint-disable-next-line
92
+ // @ts-ignore
93
+ <div role="button" tabIndex={0} style={style} className={`popup ${className} ${isSetPos && 'popup-show'}`} ref={popup}>
94
+ {children}
95
+ </div>)}
96
+ </>
97
+ )
94
98
  }
@@ -1,7 +1,8 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- // Switch样式的大概逻辑:
3
- // 隐藏input,然后将通过label标签和label里的span来控制样式,并通过伪元素选择器:checked来为选中情况添加样式
4
- // 需要注意:设置display: inline;属性后,最好添加vertical-align:top;,否则会出现一些莫名其妙的bug
2
+ // The general logic of Switch style:
3
+ // Hide the input, then control the style through the label label and the span in the label, and add styles to the selected situation through
4
+ // the pseudo-element selector: checked
5
+ // Note: After setting the display: inline; attribute, it is best to add vertical-align:top;, otherwise some inexplicable bugs will appear
5
6
  import './Switch.scss';
6
7
  import { creteNewId } from './utils/newId';
7
8
 
@@ -14,7 +15,7 @@ interface Props {
14
15
  // : React.FunctionComponent<Props>
15
16
  export function Switch(props:Props) {
16
17
  const {
17
- checked, onChange, checkedColor, className,
18
+ checked, onChange, checkedColor = '#34C759', className,
18
19
  } = props;
19
20
  const idRef = useRef<string>(creteNewId());
20
21
  return (
@@ -36,6 +37,3 @@ export function Switch(props:Props) {
36
37
  </div>
37
38
  );
38
39
  }
39
- Switch.defaultProps = {
40
- checkedColor: '#34C759',
41
- };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/display-name */
1
2
  import React, {
2
3
  PropsWithChildren, useEffect, useMemo, useReducer, useRef, useState,
3
4
  } from 'react';
@@ -122,14 +123,14 @@ function TUIChatInner <T extends TUIChatInnerProps>(
122
123
  TUIMessageListConfig,
123
124
  } = props;
124
125
 
125
- const [state, dispatch] = useReducer<ChatStateReducer>(chatReducer, {
126
+ const [state, dispatch] = useReducer<any>(chatReducer, {
126
127
  ...initialState,
127
128
  conversation,
128
129
  });
129
130
 
130
131
  const messageListRef = useRef(null);
131
132
  const textareaRef = useRef<HTMLTextAreaElement>();
132
- const chatStateContextValue = useCreateTUIChatStateContext({
133
+ const chatStateContextValue = state && useCreateTUIChatStateContext({
133
134
  chat,
134
135
  conversation,
135
136
  messageListRef,
@@ -147,6 +148,8 @@ function TUIChatInner <T extends TUIChatInnerProps>(
147
148
  } = useHandleMessageList({
148
149
  chat,
149
150
  conversation,
151
+ // eslint-disable-next-line
152
+ // @ts-ignore
150
153
  state,
151
154
  dispatch,
152
155
  filterMessage,
@@ -159,11 +162,12 @@ function TUIChatInner <T extends TUIChatInnerProps>(
159
162
  setHighlightedMessageId,
160
163
  setActiveMessageID,
161
164
  } = useHandleMessage({
165
+ // eslint-disable-next-line
166
+ // @ts-ignore
162
167
  state,
163
168
  dispatch,
164
169
  });
165
170
 
166
- // 消息 messageList
167
171
  useEffect(() => {
168
172
  TUIStore.watch(StoreName.CHAT, {
169
173
  messageList: onMessageListUpdated,
@@ -179,6 +183,8 @@ function TUIChatInner <T extends TUIChatInnerProps>(
179
183
 
180
184
  const onMessageListUpdated = (list: IMessageModel[]) => {
181
185
  const messageList = list.filter((message) => !message.isDeleted);
186
+ // eslint-disable-next-line
187
+ // @ts-ignore
182
188
  dispatch({
183
189
  type: CONSTANT_DISPATCH_TYPE.SET_MESSAGELIST,
184
190
  value: filterMessage ? filterMessage(messageList) : messageList,
@@ -187,6 +193,8 @@ function TUIChatInner <T extends TUIChatInnerProps>(
187
193
 
188
194
  const isCompletedUpdated = (flag: boolean) => {
189
195
  if (flag) {
196
+ // eslint-disable-next-line
197
+ // @ts-ignore
190
198
  dispatch({
191
199
  type: CONSTANT_DISPATCH_TYPE.SET_NO_MORE,
192
200
  value: flag,
@@ -194,7 +202,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
194
202
  }
195
203
  };
196
204
 
197
- // 加载历史消息 | Load historical messages
205
+ // Load historical messages
198
206
  const loadMore = async () => {
199
207
  TUIChatService.getMessageList();
200
208
  };
@@ -202,15 +210,20 @@ function TUIChatInner <T extends TUIChatInnerProps>(
202
210
  const setFirstSendMessage = async (message: any) => {
203
211
  if (
204
212
  !(message.type === 'TIMCustomElem' && JSONStringToParse(message.payload.data)?.src === 7)
213
+ // eslint-disable-next-line
214
+ // @ts-ignore
205
215
  && !state.firstSendMessage
206
216
  ) {
217
+ // eslint-disable-next-line
218
+ // @ts-ignore
207
219
  dispatch({
208
220
  type: CONSTANT_DISPATCH_TYPE.SET_FIRST_SEND_MESSAGE,
209
221
  value: message,
210
222
  });
211
223
  }
212
224
  };
213
-
225
+ // eslint-disable-next-line
226
+ // @ts-ignore
214
227
  const chatActionContextValue: TUIChatActionContextValue = useMemo(
215
228
  () => ({
216
229
  editLocalMessage,
@@ -255,6 +268,8 @@ function TUIChatInner <T extends TUIChatInnerProps>(
255
268
 
256
269
  return (
257
270
  <div className={`chat ${className}`}>
271
+ {/* // eslint-disable-next-line
272
+ // @ts-ignore */}
258
273
  <TUIChatStateContextProvider value={chatStateContextValue}>
259
274
  <TUIChatActionProvider value={chatActionContextValue}>
260
275
  <ComponentProvider value={componentContextValue}>
@@ -71,14 +71,14 @@ export const chatReducer = (
71
71
  switch (action?.type) {
72
72
  case CONSTANT_DISPATCH_TYPE.SET_CONVERSATION_PRPFILE:
73
73
  return { ...state, conversation: action.value };
74
- // messageList 设置
74
+ // messageList set
75
75
  case CONSTANT_DISPATCH_TYPE.SET_MESSAGELIST:
76
76
  return {
77
77
  ...state,
78
78
  messageList: action.value,
79
79
  };
80
80
  case CONSTANT_DISPATCH_TYPE.SET_EDIT_MESSAGE:
81
- return {
81
+ return state.messageList && action.value && {
82
82
  ...state,
83
83
  messageList: [...handleEditMessage(state.messageList, action.value)],
84
84
  };
@@ -97,7 +97,7 @@ export const chatReducer = (
97
97
  case CONSTANT_DISPATCH_TYPE.SET_VIDEO_SOURCE:
98
98
  return { ...state, vidoeSource: action.value };
99
99
  case CONSTANT_DISPATCH_TYPE.UPDATE_UPLOAD_PENDING_MESSAGE_LIST:
100
- return {
100
+ return state?.uploadPendingMessageList && action.value && {
101
101
  ...state,
102
102
  uploadPendingMessageList: [
103
103
  ...handleUploadPendingMessage(state.uploadPendingMessageList, action.value),
@@ -21,35 +21,35 @@ export function useHandleMessage<T extends CreateMessageProps>(props:T) {
21
21
  } = props;
22
22
 
23
23
  const operateMessage = useCallback((data: OperateMessageParams) => {
24
- dispatch({
24
+ dispatch && dispatch({
25
25
  type: CONSTANT_DISPATCH_TYPE.OPERATE_MESSAGE,
26
26
  value: data,
27
27
  });
28
28
  }, [dispatch]);
29
29
 
30
30
  const setAudioSource = useCallback((data: HTMLAudioElement | null) => {
31
- dispatch({
31
+ dispatch && dispatch({
32
32
  type: CONSTANT_DISPATCH_TYPE.SET_AUDIO_SOURCE,
33
33
  value: data,
34
34
  });
35
35
  }, [dispatch]);
36
36
 
37
37
  const setVideoSource = useCallback((data: HTMLVideoElement | null) => {
38
- dispatch({
38
+ dispatch && dispatch({
39
39
  type: CONSTANT_DISPATCH_TYPE.SET_VIDEO_SOURCE,
40
40
  value: data,
41
41
  });
42
42
  }, [dispatch]);
43
43
 
44
44
  const setHighlightedMessageId = useCallback((highlightedMessageId: string) => {
45
- dispatch({
45
+ dispatch && dispatch({
46
46
  type: CONSTANT_DISPATCH_TYPE.SET_HIGH_LIGHTED_MESSAGE_ID,
47
47
  value: highlightedMessageId,
48
48
  });
49
49
  }, [dispatch]);
50
50
 
51
51
  const setActiveMessageID = useCallback((messageID: string) => {
52
- dispatch({
52
+ dispatch && dispatch({
53
53
  type: CONSTANT_DISPATCH_TYPE.SET_ACTIVE_MESSAGE_ID,
54
54
  value: messageID,
55
55
  });
@@ -27,14 +27,14 @@ export function useHandleMessageList<T extends CreateMessageProps>(props:T) {
27
27
  } = props;
28
28
 
29
29
  const editLocalMessage = useCallback((message: Message) => {
30
- dispatch({
30
+ dispatch && dispatch({
31
31
  type: CONSTANT_DISPATCH_TYPE.SET_EDIT_MESSAGE,
32
32
  value: message,
33
33
  });
34
34
  }, [dispatch]);
35
35
 
36
36
  const updateUploadPendingMessageList = useCallback((message: Message) => {
37
- dispatch({
37
+ dispatch && dispatch({
38
38
  type: CONSTANT_DISPATCH_TYPE.UPDATE_UPLOAD_PENDING_MESSAGE_LIST,
39
39
  value: message,
40
40
  });
@@ -3,7 +3,7 @@ import constant from '../../constants';
3
3
  import { JSONStringToParse } from '../untils';
4
4
 
5
5
  export const handleMessage = (messageList:Array<Message>):Array<Message> => {
6
- let customPayloadData = null;
6
+ let customPayloadData: any = null;
7
7
  return messageList.filter((item) => {
8
8
  if (item.type === TencentCloudChat.TYPES.MSG_CUSTOM) {
9
9
  customPayloadData = JSONStringToParse(item?.payload?.data);
@@ -30,7 +30,7 @@ export const handleUploadPendingMessage = (
30
30
  message: Message,
31
31
  ) => {
32
32
  const list = [...messageList];
33
- if (!list.some((item:Message) => item.ID === message.ID)) {
33
+ if (!list.some((item:Message) => item.ID === message?.ID)) {
34
34
  list.push(message);
35
35
  }
36
36
  const index = list.findIndex((item) => item?.ID === message?.ID);
@@ -32,7 +32,7 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
32
32
  isLive,
33
33
  opateIcon,
34
34
  } = props;
35
-
35
+ const { setActiveContact } = useTUIKitContext('TUIContact');
36
36
  const [title, setTitle] = useState(propTitle);
37
37
  const [avatar, setAvatar] = useState<React.ReactElement | string>('');
38
38
 
@@ -80,10 +80,11 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
80
80
 
81
81
  const back = () => {
82
82
  TUIConversationService.switchConversation('');
83
+ setActiveContact();
83
84
  };
84
85
  const { setTUIManageShow } = useTUIKitContext();
85
86
  const openTUIManage = () => {
86
- setTUIManageShow(true);
87
+ setTUIManageShow && setTUIManageShow(true);
87
88
  };
88
89
 
89
90
  return (
@@ -4,6 +4,7 @@ import {
4
4
  TUIContactContextProvider,
5
5
  TUIContactContextValue,
6
6
  } from '../../context/TUIContactContext';
7
+ import { isH5 } from '../../utils/env';
7
8
  import { useTUIKitContext } from '../../context';
8
9
  import useTUIContact from './hooks/useTUIContact';
9
10
  import { TUIContactList } from './TUIContactList/TUIContactList';
@@ -55,7 +56,7 @@ export function UnMemoizedTUIContact<T>(
55
56
  return (
56
57
  <TUIContactContextProvider value={TUIContactValue}>
57
58
  {children || (
58
- <div className="tui-contacts">
59
+ <div className={`tui-contacts ${isH5 ? 'tui-contacts-h5' : ''} `}>
59
60
  {!isShowAddFriend && (
60
61
  <>
61
62
  <div className="tui-contacts-header">
@@ -2,6 +2,7 @@ import React, {
2
2
  PropsWithChildren,
3
3
  } from 'react';
4
4
  import { useTUIKitContext } from '../../../context';
5
+ import { isH5 } from '../../../utils/env';
5
6
  import { FriendInfo } from './friendInfo';
6
7
  import { BlockInfo } from './blockInfo';
7
8
  import { AddFriendInfo } from './addFriendInfo';
@@ -21,7 +22,7 @@ export function UnMemoizedTUIContactInfo<T extends TUIContactInfoProps>(
21
22
  return (<> </>);
22
23
  }
23
24
  return (
24
- <div className="tui-contact-info">
25
+ <div className={`tui-contact-info ${isH5 ? 'tui-contact-info-h5' : ''} `}>
25
26
  {contactData?.type === 'addFriend' && (<AddFriendInfo profile={contactData?.data} />)}
26
27
  {contactData?.type === 'friend' && (<FriendInfo openChat={showChat} friend={contactData?.data} />)}
27
28
  {contactData?.type === 'block' && (<BlockInfo profile={contactData?.data} />)}
@@ -41,7 +41,7 @@ export function UnMemoizedAddFriendInfo<T extends Props>(
41
41
  setIsEditRemark('');
42
42
  };
43
43
 
44
- const handleChange = (e) => {
44
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
45
45
  setWording(e.target.value);
46
46
  };
47
47
  return (
@@ -51,7 +51,7 @@ export function UnMemoizedAddFriendInfo<T extends Props>(
51
51
  <div className="tui-contact-info-content">
52
52
  <div className="content-item-wording">
53
53
  <p className="content-item-label">{t('TUIContact.Enter the verification info')}</p>
54
- <textarea className="content-item-wording-text" value={wording} onChange={handleChange} />
54
+ <textarea className="content-item-wording-text" value={wording} onChange={(e: any) => {handleChange(e)}} />
55
55
  </div>
56
56
  <div className="content-item">
57
57
  <p className="content-item-label">{t('TUIContact.remark')}</p>
@@ -1,6 +1,11 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Profile } from '@tencentcloud/chat';
4
+ import { TUIConversationService } from '@tencentcloud/chat-uikit-engine';
5
+ import { useTUIKitContext } from '../../../context';
6
+ import { Icon, IconTypes } from '../../Icon';
7
+ import { isH5 } from '../../../utils/env';
8
+
4
9
  import { Avatar, defaultUserAvatar } from '../../Avatar';
5
10
 
6
11
  interface Props {
@@ -14,8 +19,21 @@ export function UnMemoizedBasicInfo<T extends Props>(
14
19
  const {
15
20
  userID, nick, selfSignature, avatar,
16
21
  } = profile;
22
+ const { setActiveContact } = useTUIKitContext('TUIContact');
23
+ const back = () => {
24
+ TUIConversationService.switchConversation('');
25
+ setActiveContact();
26
+ };
17
27
  return (
18
28
  <div className="tui-contact-info-header">
29
+ {isH5 && (
30
+ <Icon
31
+ width={9}
32
+ height={16}
33
+ type={IconTypes.BACK}
34
+ onClick={back}
35
+ />
36
+ )}
19
37
  <div className="header-container">
20
38
  <div className="header-container-avatar">
21
39
  <Avatar size={60} image={avatar || defaultUserAvatar} />
@@ -52,7 +52,6 @@ export function UnMemoizedFriendInfo<T extends Props>(
52
52
  const addToBlocklistHandler = async () => {
53
53
  await addToBlocklist(userID);
54
54
  setIsAddToBlocklist(true);
55
- // 清空右侧 container 内容
56
55
  setActiveContact();
57
56
  };
58
57
 
@@ -65,7 +64,7 @@ export function UnMemoizedFriendInfo<T extends Props>(
65
64
  const conversation = await createConversation(conversationID);
66
65
  TUIConversationService.switchConversation(conversationID);
67
66
  setActiveConversation(conversation);
68
- openChat();
67
+ openChat && openChat();
69
68
  };
70
69
 
71
70
  return (
@@ -6,14 +6,12 @@ import { useTUIKitContext } from '../../../../context';
6
6
  function useContactInfo() {
7
7
  const { chat } = useTUIKitContext('useContactInfo');
8
8
 
9
- // 移除黑名单
10
9
  const removeFromBlocklist = useCallback((userID: string) => {
11
10
  chat.removeFromBlacklist({
12
11
  userIDList: [userID],
13
12
  });
14
13
  }, [chat]);
15
14
 
16
- // 添加好友
17
15
  const addFriend = useCallback((param: any) => {
18
16
  chat.addFriend({
19
17
  to: param?.userID,
@@ -29,14 +27,12 @@ function useContactInfo() {
29
27
  });
30
28
  }, [chat]);
31
29
 
32
- // 删除好友
33
30
  const deleteFriend = useCallback((userID: string) => {
34
31
  chat.deleteFriend({
35
32
  userIDList: [userID],
36
33
  });
37
34
  }, [chat]);
38
35
 
39
- // 添加黑名单
40
36
  const addToBlocklist = useCallback((userID: string) => {
41
37
  chat.addToBlacklist({
42
38
  userIDList: [userID],
@@ -55,8 +51,6 @@ function useContactInfo() {
55
51
  userID,
56
52
  });
57
53
  }, [chat]);
58
- // 好友相关
59
- // 判断是否为双向好友关系
60
54
  const isFriend = (info: any): Promise<boolean> => (
61
55
  new Promise((resolve, reject) => {
62
56
  chat.checkFriend({
@@ -65,19 +59,15 @@ function useContactInfo() {
65
59
  })
66
60
  .then((res: any) => {
67
61
  switch (res?.data?.successUserIDList[0]?.relation) {
68
- // 无好友关系:A 的好友表中没有 B,B 的好友表中也没有 A
69
62
  case TencentCloudChat.TYPES.SNS_TYPE_NO_RELATION:
70
63
  resolve(false);
71
64
  break;
72
- // 单项好友:A 的好友表中有 B,但 B 的好友表中没有 A
73
65
  case TencentCloudChat.TYPES.SNS_TYPE_A_WITH_B:
74
66
  resolve(false);
75
67
  break;
76
- // 单项好友:A 的好友表中没有 B,但 B 的好友表中有 A
77
68
  case TencentCloudChat.TYPES.SNS_TYPE_B_WITH_A:
78
69
  resolve(false);
79
70
  break;
80
- // 双向好友关系
81
71
  case TencentCloudChat.TYPES.SNS_TYPE_BOTH_WAY:
82
72
  resolve(true);
83
73
  break;
@@ -28,6 +28,7 @@
28
28
  line-height: 50px;
29
29
  font-weight: 400;
30
30
  color: #999999;
31
+ word-break: break-all;
31
32
  }
32
33
  }
33
34
  }
@@ -106,3 +107,7 @@
106
107
  }
107
108
  }
108
109
  }
110
+ .tui-contact-info-h5 {
111
+ padding: 8px;
112
+
113
+ }
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import TencentCloudChat from '@tencentcloud/chat';
4
+ import { isH5 } from '../../../utils/env';
4
5
  import { useTUIKitContext, useTUIContactContext } from '../../../context';
5
6
  import useContactInfo from '../TUIContactInfo/hooks/useContactInfo';
6
7
 
@@ -29,9 +30,11 @@ function UnMemoizedTUIContactList<T>(): React.ReactElement {
29
30
  acceptFriendApplication(userID);
30
31
  setActiveContact();
31
32
  };
33
+ // eslint-disable-next-line
34
+ // @ts-ignore
32
35
  return (
33
36
  isShowContactList && (
34
- <div className="tui-contacts-list">
37
+ <div className={`tui-contacts-list ${isH5 ? 'tui-contacts-list-h5' : ''} `}>
35
38
  <div
36
39
  className="tui-contacts-title"
37
40
  role="button"
@@ -44,7 +47,7 @@ function UnMemoizedTUIContactList<T>(): React.ReactElement {
44
47
  </div>
45
48
  </div>
46
49
  {iShowFriendApplication
47
- && friendApplicationList.map((item, index) => {
50
+ && friendApplicationList?.map((item, index) => {
48
51
  const {
49
52
  userID, avatar, nick, wording, type,
50
53
  } = item;
@@ -105,7 +108,7 @@ function UnMemoizedTUIContactList<T>(): React.ReactElement {
105
108
  </div>
106
109
  </div>
107
110
  {isShowBlocklist
108
- && blocklistProfile.map((item, index) => {
111
+ && blocklistProfile?.map((item, index) => {
109
112
  const { userID, avatar, nick } = item;
110
113
  return (
111
114
  <div
@@ -136,7 +139,7 @@ function UnMemoizedTUIContactList<T>(): React.ReactElement {
136
139
  </div>
137
140
  </div>
138
141
  {iShowFriends
139
- && friendList.map((item, index) => {
142
+ && friendList?.map((item, index) => {
140
143
  const { userID, avatar, nick } = item.profile;
141
144
  return (
142
145
  <div
@@ -88,3 +88,8 @@
88
88
  ::-webkit-scrollbar {
89
89
  display: none;
90
90
  }
91
+ .tui-contacts-list-h5 {
92
+ min-width: 100%;
93
+ width: 100%;
94
+ max-width: 100%;
95
+ }
@@ -35,7 +35,6 @@ function useTUIContact() {
35
35
  setFriendList(data);
36
36
  }
37
37
  };
38
- // todo: 获取 100个
39
38
  const getBlocklist = async () => {
40
39
  const { data: _blocklist } = await chat.getBlacklist();
41
40
  if (_blocklist.length === 0) {
@@ -51,15 +50,15 @@ function useTUIContact() {
51
50
  });
52
51
  setBlocklistProfile(data);
53
52
  };
54
- const onFriendApplicationListUpdated = (event) => {
53
+ const onFriendApplicationListUpdated = (event: any) => {
55
54
  setFriendApplicationList(event?.data?.friendApplicationList);
56
55
  };
57
- const onBlocklistUpdated = (event) => {
56
+ const onBlocklistUpdated = (event: any) => {
58
57
  setBlockList(event.data);
59
58
  getBlocklistProfile(event.data);
60
59
  };
61
60
 
62
- const onFriendListUpdated = (event) => {
61
+ const onFriendListUpdated = (event: any) => {
63
62
  setFriendList(event.data);
64
63
  };
65
64
 
@@ -65,3 +65,8 @@
65
65
  }
66
66
  }
67
67
  }
68
+ .tui-contacts-h5 {
69
+ min-width: 100%;
70
+ width: 100%;
71
+ max-width: 100%;
72
+ }
@@ -16,19 +16,19 @@ export function UnMemoizedTUIContactSearch<T>(): React.ReactElement {
16
16
  const [searchedValue, setSearchedValue] = useState('');
17
17
  const [searchResult, setSearchResult] = useState([]);
18
18
 
19
- const searchValueChange = (e) => {
19
+ const searchValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
20
20
  if (e.target?.value === '') {
21
- setShowContactList(true);
21
+ setShowContactList && setShowContactList(true);
22
22
  setShowSearchResult(false);
23
23
  setSearchResult([]);
24
24
  return;
25
25
  }
26
26
  setShowSearchResult(true);
27
27
  setSearchedValue(e.target?.value);
28
- setShowContactList(false);
28
+ setShowContactList && setShowContactList(false);
29
29
  };
30
30
 
31
- const searchValueBlur = (e) => {
31
+ const searchValueBlur = (e: React.ChangeEvent<HTMLInputElement>) => {
32
32
  setSearchedValue(e.target?.value);
33
33
  };
34
34
 
@@ -47,15 +47,14 @@ export function UnMemoizedTUIContactSearch<T>(): React.ReactElement {
47
47
  const setContactProfile = async (profile: any) => {
48
48
  const isFriend = await checkFriend(profile);
49
49
  if (isFriend) {
50
- const friendProfile = friendList.find((item) => item.userID === searchedValue);
51
- setActiveContact({ type: 'friend', data: friendProfile });
50
+ const friendProfile = friendList?.find((item) => item.userID === searchedValue);
51
+ friendProfile && setActiveContact({ type: 'friend', data: friendProfile });
52
52
  return;
53
53
  }
54
54
  if (isBlock(profile.userID)) {
55
55
  setActiveContact({ type: 'block', data: profile });
56
56
  return;
57
57
  }
58
- // set 数据
59
58
  setActiveContact({ type: 'addFriend', data: profile });
60
59
  };
61
60
  return (
@@ -5,8 +5,6 @@ function useContactSearch() {
5
5
  const { blockList } = useTUIContactContext('TUIContactList');
6
6
  const { chat } = useTUIKitContext('TUIContactSearch');
7
7
 
8
- // 好友相关
9
- // 判断是否为双向好友关系
10
8
  const checkFriend = (info: any): Promise<any> => chat.checkFriend({
11
9
  userIDList: [info?.userID],
12
10
  type: TencentCloudChat.TYPES.SNS_CHECK_TYPE_BOTH,
@@ -14,7 +12,7 @@ function useContactSearch() {
14
12
  === TencentCloudChat.TYPES.SNS_TYPE_BOTH_WAY);
15
13
 
16
14
  const isBlock = (userID: string) => (
17
- blockList.includes(userID)
15
+ blockList?.includes(userID)
18
16
  );
19
17
  const getUserProfile = (userID: string) => (
20
18
  chat.getUserProfile({
@@ -82,7 +82,7 @@ export function UnMemoTUIConversationList<T extends Props>(props: T):React.React
82
82
  const [conversationCreated, setConversationCreated] = useState(false);
83
83
  const [activeConversationID, setActiveConversationID] = useState('');
84
84
 
85
- const handleSearchValueChange = (e) => {
85
+ const handleSearchValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
86
86
  setSearchValue(e.target?.value);
87
87
  if (e.target?.value) {
88
88
  const result = conversationList.filter(
@@ -23,7 +23,7 @@ function useConversationList(
23
23
  resConversationList = filterConversation(res.data.conversationList);
24
24
  } else {
25
25
  resConversationList = res.data.conversationList.filter(
26
- (item) => item.type !== TencentCloudChat.TYPES.CONV_SYSTEM,
26
+ (item: any) => item.type !== TencentCloudChat.TYPES.CONV_SYSTEM,
27
27
  );
28
28
  }
29
29
  const newConversationList = queryType === 'reload'