@tencentcloud/chat-uikit-react 2.1.2 → 2.1.4

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 (294) 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/Input/Input.js +1 -1
  21. package/dist/cjs/components/Model/index.d.ts +1 -1
  22. package/dist/cjs/components/Model/index.js +1 -1
  23. package/dist/cjs/components/Plugins/index.js +1 -1
  24. package/dist/cjs/components/Popup/index.d.ts +1 -1
  25. package/dist/cjs/components/Popup/index.js +1 -1
  26. package/dist/cjs/components/Switch/Switch.d.ts +2 -6
  27. package/dist/cjs/components/Switch/Switch.js +1 -1
  28. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  29. package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
  30. package/dist/cjs/components/TUIChat/hooks/useHandleMessage.js +1 -1
  31. package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  32. package/dist/cjs/components/TUIChat/unitls.js +1 -1
  33. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  34. package/dist/cjs/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
  35. package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  36. package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  37. package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -1
  38. package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  39. package/dist/cjs/components/TUIConversation/TUIConversation.js +1 -1
  40. package/dist/cjs/components/TUIConversationList/hooks/useConversationList.js +1 -1
  41. package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  42. package/dist/cjs/components/TUIKit/TUIKit.d.ts +2 -2
  43. package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
  44. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +7 -7
  45. package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +2 -2
  46. package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
  47. package/dist/cjs/components/TUIManage/TUIManage.d.ts +4 -1
  48. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  49. package/dist/cjs/components/TUIMessage/MessageAudio.js +1 -1
  50. package/dist/cjs/components/TUIMessage/MessageAvatar.js +1 -1
  51. package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
  52. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  53. package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
  54. package/dist/cjs/components/TUIMessage/MessageFace.js +1 -1
  55. package/dist/cjs/components/TUIMessage/MessageFile.js +1 -1
  56. package/dist/cjs/components/TUIMessage/MessageImage.js +1 -1
  57. package/dist/cjs/components/TUIMessage/MessageLocation.js +1 -1
  58. package/dist/cjs/components/TUIMessage/MessageMerger.js +1 -1
  59. package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
  60. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  61. package/dist/cjs/components/TUIMessage/MessageProgress.js +1 -1
  62. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  63. package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
  64. package/dist/cjs/components/TUIMessage/MessageVideo.js +1 -1
  65. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  66. package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -1
  67. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  68. package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -1
  69. package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
  70. package/dist/cjs/components/TUIMessageInput/EmojiPicker.js +1 -1
  71. package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  72. package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  73. package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
  74. package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  75. package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  76. package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  77. package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  78. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputState.d.ts +2 -2
  79. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  80. package/dist/cjs/components/TUIMessageInput/hooks/useUploadElement.js +1 -1
  81. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  82. package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  83. package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
  84. package/dist/cjs/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
  85. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  86. package/dist/cjs/components/TUIProfile/hooks/useMyProfile.js +1 -1
  87. package/dist/cjs/components/Toast/index.js +1 -1
  88. package/dist/cjs/context/ComponentContext.d.ts +3 -2
  89. package/dist/cjs/context/TUIChatActionContext.d.ts +1 -1
  90. package/dist/cjs/context/TUIChatStateContext.d.ts +4 -4
  91. package/dist/cjs/context/TUIContactContext.js +1 -1
  92. package/dist/cjs/context/TUIConversationContext.js +1 -1
  93. package/dist/cjs/context/TUIKitContext.d.ts +1 -1
  94. package/dist/cjs/context/TUIMessageContext.js +1 -1
  95. package/dist/cjs/context/TUIMessageInputContext.js +1 -1
  96. package/dist/cjs/hooks/useProfile.d.ts +1 -1
  97. package/dist/cjs/index.css +1 -1
  98. package/dist/cjs/index.d.css +3 -3
  99. package/dist/cjs/index.d.ts +1 -1
  100. package/dist/cjs/index.js +1 -1
  101. package/dist/esm/components/Avatar/Avatar.js +1 -1
  102. package/dist/esm/components/Checkbox/index.d.ts +2 -1
  103. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  104. package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
  105. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  106. package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
  107. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +4 -1
  108. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  109. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  110. package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
  111. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  112. package/dist/esm/components/DivWithEdit/DivWithEdit.d.ts +3 -2
  113. package/dist/esm/components/DivWithEdit/DivWithEdit.js +1 -1
  114. package/dist/esm/components/DivWithEdit/WithText.js +1 -1
  115. package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
  116. package/dist/esm/components/Icon/Icon.d.ts +2 -1
  117. package/dist/esm/components/Icon/Icon.js +1 -1
  118. package/dist/esm/components/Input/Input.js +1 -1
  119. package/dist/esm/components/Model/index.d.ts +1 -1
  120. package/dist/esm/components/Model/index.js +1 -1
  121. package/dist/esm/components/Plugins/index.js +1 -1
  122. package/dist/esm/components/Popup/index.d.ts +1 -1
  123. package/dist/esm/components/Popup/index.js +1 -1
  124. package/dist/esm/components/Switch/Switch.d.ts +2 -6
  125. package/dist/esm/components/Switch/Switch.js +1 -1
  126. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  127. package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
  128. package/dist/esm/components/TUIChat/hooks/useHandleMessage.js +1 -1
  129. package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  130. package/dist/esm/components/TUIChat/unitls.js +1 -1
  131. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  132. package/dist/esm/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
  133. package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
  134. package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
  135. package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -1
  136. package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
  137. package/dist/esm/components/TUIConversation/TUIConversation.js +1 -1
  138. package/dist/esm/components/TUIConversationList/hooks/useConversationList.js +1 -1
  139. package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  140. package/dist/esm/components/TUIKit/TUIKit.d.ts +2 -2
  141. package/dist/esm/components/TUIKit/TUIKit.js +1 -1
  142. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +7 -7
  143. package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +2 -2
  144. package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
  145. package/dist/esm/components/TUIManage/TUIManage.d.ts +4 -1
  146. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  147. package/dist/esm/components/TUIMessage/MessageAudio.js +1 -1
  148. package/dist/esm/components/TUIMessage/MessageAvatar.js +1 -1
  149. package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
  150. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  151. package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
  152. package/dist/esm/components/TUIMessage/MessageFace.js +1 -1
  153. package/dist/esm/components/TUIMessage/MessageFile.js +1 -1
  154. package/dist/esm/components/TUIMessage/MessageImage.js +1 -1
  155. package/dist/esm/components/TUIMessage/MessageLocation.js +1 -1
  156. package/dist/esm/components/TUIMessage/MessageMerger.js +1 -1
  157. package/dist/esm/components/TUIMessage/MessageName.js +1 -1
  158. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  159. package/dist/esm/components/TUIMessage/MessageProgress.js +1 -1
  160. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  161. package/dist/esm/components/TUIMessage/MessageText.js +1 -1
  162. package/dist/esm/components/TUIMessage/MessageVideo.js +1 -1
  163. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  164. package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -1
  165. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  166. package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -1
  167. package/dist/esm/components/TUIMessage/utils/index.js +1 -1
  168. package/dist/esm/components/TUIMessageInput/EmojiPicker.js +1 -1
  169. package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
  170. package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
  171. package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
  172. package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
  173. package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
  174. package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  175. package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  176. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputState.d.ts +2 -2
  177. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  178. package/dist/esm/components/TUIMessageInput/hooks/useUploadElement.js +1 -1
  179. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  180. package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  181. package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
  182. package/dist/esm/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
  183. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  184. package/dist/esm/components/TUIProfile/hooks/useMyProfile.js +1 -1
  185. package/dist/esm/components/Toast/index.js +1 -1
  186. package/dist/esm/context/ComponentContext.d.ts +3 -2
  187. package/dist/esm/context/TUIChatActionContext.d.ts +1 -1
  188. package/dist/esm/context/TUIChatStateContext.d.ts +4 -4
  189. package/dist/esm/context/TUIContactContext.js +1 -1
  190. package/dist/esm/context/TUIConversationContext.js +1 -1
  191. package/dist/esm/context/TUIKitContext.d.ts +1 -1
  192. package/dist/esm/context/TUIMessageContext.js +1 -1
  193. package/dist/esm/context/TUIMessageInputContext.js +1 -1
  194. package/dist/esm/hooks/useProfile.d.ts +1 -1
  195. package/dist/esm/index.css +1 -1
  196. package/dist/esm/index.d.css +3 -3
  197. package/dist/esm/index.d.ts +1 -1
  198. package/dist/esm/index.js +1 -1
  199. package/index.ts +1 -0
  200. package/package.json +7 -6
  201. package/rollup.config.js +2 -1
  202. package/src/components/Avatar/Avatar.tsx +7 -3
  203. package/src/components/Avatar/styles/index.scss +1 -1
  204. package/src/components/Checkbox/index.tsx +1 -1
  205. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +14 -7
  206. package/src/components/ConversationCreate/ConversationCreate.tsx +5 -1
  207. package/src/components/ConversationCreate/ConversationCreateSelectView.tsx +2 -2
  208. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +11 -10
  209. package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +14 -12
  210. package/src/components/ConversationPreview/ConversationPreview.tsx +3 -3
  211. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +9 -5
  212. package/src/components/ConversationPreview/utils.tsx +6 -3
  213. package/src/components/DivWithEdit/DivWithEdit.tsx +6 -5
  214. package/src/components/DivWithEdit/WithText.tsx +3 -1
  215. package/src/components/DivWithEdit/styles/index.scss +1 -1
  216. package/src/components/Icon/Icon.tsx +2 -2
  217. package/src/components/Input/Input.tsx +15 -12
  218. package/src/components/Model/index.tsx +2 -2
  219. package/src/components/Plugins/index.tsx +15 -12
  220. package/src/components/Popup/index.tsx +13 -9
  221. package/src/components/Profile/index.ts +1 -2
  222. package/src/components/Switch/Switch.tsx +5 -7
  223. package/src/components/TUIChat/TUIChat.tsx +20 -5
  224. package/src/components/TUIChat/TUIChatState.tsx +3 -3
  225. package/src/components/TUIChat/hooks/useHandleMessage.tsx +5 -5
  226. package/src/components/TUIChat/hooks/useHandleMessageList.tsx +2 -2
  227. package/src/components/TUIChat/unitls.ts +2 -2
  228. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +1 -1
  229. package/src/components/TUIContact/TUIContactInfo/addFriendInfo.tsx +2 -2
  230. package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +1 -2
  231. package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +0 -10
  232. package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +5 -3
  233. package/src/components/TUIContact/hooks/useTUIContact.tsx +3 -4
  234. package/src/components/TUIContactSearch/TUIContactSearch.tsx +6 -7
  235. package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +1 -3
  236. package/src/components/TUIConversationList/TUIConversationList.tsx +1 -1
  237. package/src/components/TUIConversationList/hooks/useConversationList.tsx +19 -24
  238. package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +2 -2
  239. package/src/components/TUIKit/TUIKit.tsx +31 -12
  240. package/src/components/TUIKit/hooks/useTUIKit.tsx +14 -10
  241. package/src/components/TUIManage/TUIManage.tsx +20 -13
  242. package/src/components/TUIMessage/MessageAudio.tsx +8 -6
  243. package/src/components/TUIMessage/MessageAvatar.tsx +2 -2
  244. package/src/components/TUIMessage/MessageBubble.tsx +7 -5
  245. package/src/components/TUIMessage/MessageContext.tsx +3 -3
  246. package/src/components/TUIMessage/MessageCustom.tsx +5 -3
  247. package/src/components/TUIMessage/MessageFace.tsx +2 -2
  248. package/src/components/TUIMessage/MessageFile.tsx +5 -5
  249. package/src/components/TUIMessage/MessageImage.tsx +4 -2
  250. package/src/components/TUIMessage/MessageLocation.tsx +3 -3
  251. package/src/components/TUIMessage/MessageMerger.tsx +3 -3
  252. package/src/components/TUIMessage/MessageName.tsx +1 -1
  253. package/src/components/TUIMessage/MessagePlugins.tsx +12 -10
  254. package/src/components/TUIMessage/MessageProgress.tsx +5 -4
  255. package/src/components/TUIMessage/MessageRevoke.tsx +1 -1
  256. package/src/components/TUIMessage/MessageText.tsx +4 -4
  257. package/src/components/TUIMessage/MessageVideo.tsx +3 -3
  258. package/src/components/TUIMessage/TUIMessage.tsx +1 -1
  259. package/src/components/TUIMessage/TUIMessageDefault.tsx +3 -1
  260. package/src/components/TUIMessage/hooks/useMessageHandler.ts +13 -13
  261. package/src/components/TUIMessage/hooks/useMessageReply.ts +6 -4
  262. package/src/components/TUIMessage/utils/decodeText.ts +2 -3
  263. package/src/components/TUIMessage/utils/index.ts +1 -2
  264. package/src/components/TUIMessageInput/EmojiPicker.tsx +4 -4
  265. package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +8 -8
  266. package/src/components/TUIMessageInput/InputQuoteDefalut.tsx +4 -2
  267. package/src/components/TUIMessageInput/TUIForward.tsx +22 -15
  268. package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +15 -9
  269. package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +2 -2
  270. package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +4 -4
  271. package/src/components/TUIMessageInput/hooks/useHandleQuoteMessage.tsx +5 -5
  272. package/src/components/TUIMessageInput/hooks/useMessageInputState.tsx +3 -3
  273. package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +12 -9
  274. package/src/components/TUIMessageInput/hooks/useUploadElement.tsx +2 -2
  275. package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +1 -1
  276. package/src/components/TUIMessageList/TUIMessageList.tsx +5 -6
  277. package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +5 -2
  278. package/src/components/TUIProfile/TUIProfile.tsx +3 -1
  279. package/src/components/TUIProfile/TUIProfileDefault.tsx +17 -17
  280. package/src/components/TUIProfile/hooks/useMyProfile.tsx +19 -37
  281. package/src/components/Toast/index.tsx +3 -3
  282. package/src/components/Toast/styles/layout.scss +1 -1
  283. package/src/components/untils.ts +1 -1
  284. package/src/context/TUIChatStateContext.tsx +4 -4
  285. package/src/context/TUIContactContext.tsx +1 -1
  286. package/src/context/TUIConversationContext.tsx +2 -2
  287. package/src/context/TUIMessageContext.tsx +1 -1
  288. package/src/context/TUIMessageInputContext.tsx +1 -1
  289. package/src/hooks/useConversation.tsx +1 -1
  290. package/src/hooks/useProfile.tsx +2 -2
  291. package/tsconfig.json +1 -0
  292. package/dist/cjs/components/TUIProfile/hooks/useMyProfile.d.ts +0 -17
  293. package/dist/esm/components/TUIProfile/hooks/useMyProfile.d.ts +0 -17
  294. package/src/components/Profile/hooks/useProfile.tsx +0 -28
@@ -23,12 +23,14 @@ export function InputQuoteDefalut <T extends InputQuoteProps>(
23
23
  const { cloudCustomData, message } = useHandleQuoteMessage(propsMessage);
24
24
 
25
25
  const handleClose = useCallback(() => {
26
- operateMessage({
26
+ operateMessage && operateMessage({
27
+ // eslint-disable-next-line
28
+ // @ts-ignore
27
29
  [MESSAGE_OPERATE.QUOTE]: null,
28
30
  });
29
31
  }, [operateMessage]);
30
32
 
31
- const context = cloudCustomData?.messageReply;
33
+ const context: any = cloudCustomData?.messageReply;
32
34
 
33
35
  return context && (
34
36
  <div className="input-quote">
@@ -38,8 +38,11 @@ export function TUIForward <T extends TUIForwardToProps>(
38
38
 
39
39
  const { message, sendForwardMessage, conversationList = [] } = useHandleForwardMessage();
40
40
 
41
- const handleClose = useCallback((e) => {
42
- operateMessage({
41
+ const handleClose = useCallback(() => {
42
+
43
+ operateMessage && operateMessage({
44
+ // eslint-disable-next-line
45
+ // @ts-ignore
43
46
  [MESSAGE_OPERATE.FORWARD]: null,
44
47
  });
45
48
  }, [operateMessage]);
@@ -47,7 +50,7 @@ export function TUIForward <T extends TUIForwardToProps>(
47
50
  //const FrequentlyList = conversationList.slice(0, 2);
48
51
  const RecentList = conversationList;
49
52
 
50
- const handleInputChange = (e) => {
53
+ const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
51
54
  setSearchValue(e.target?.value);
52
55
  if (e.target?.value) {
53
56
  const result = conversationList.filter((item) => {
@@ -61,20 +64,22 @@ export function TUIForward <T extends TUIForwardToProps>(
61
64
  }
62
65
  };
63
66
 
64
- const handleCheckboxChange = (e) => {
67
+ const handleCheckboxChange = (e: any) => {
65
68
  if (e.checked) {
69
+ // eslint-disable-next-line
70
+ // @ts-ignore
66
71
  setSelectList([...selectList, e.value]);
67
72
  } else {
68
73
  setSelectList(selectList.filter((item) => item !== e.value));
69
74
  }
70
75
  };
71
76
 
72
- const handleDisplayForwardName = (value) => {
73
- const listName = value?.map((item) => getDisplayTitle(item));
77
+ const handleDisplayForwardName = (value: any) => {
78
+ const listName = value?.map((item: any) => getDisplayTitle(item));
74
79
  return listName.toString();
75
80
  };
76
81
 
77
- const handleForward = (e) => {
82
+ const handleForward = () => {
78
83
  if (propsHandleForward) {
79
84
  propsHandleForward({
80
85
  list: selectList,
@@ -83,10 +88,10 @@ export function TUIForward <T extends TUIForwardToProps>(
83
88
  } else {
84
89
  sendForwardMessage(selectList);
85
90
  }
86
- handleClose(e);
91
+ handleClose();
87
92
  };
88
93
 
89
- const stopPropagation = (e) => {
94
+ const stopPropagation = (e: any) => {
90
95
  e.stopPropagation();
91
96
  };
92
97
 
@@ -95,10 +100,11 @@ export function TUIForward <T extends TUIForwardToProps>(
95
100
  setSearchResult([]);
96
101
  setSearchValue('');
97
102
  }, [message]);
98
-
103
+ // eslint-disable-next-line
104
+ // @ts-ignore
99
105
  return message && conversationList.length > 0 && (
100
106
  <Model onClick={handleClose}>
101
- <div role="button" tabIndex={0} className="tui-forward" onClick={stopPropagation}>
107
+ <div role="button" tabIndex={0} className="tui-forward" onClick={(e) => {stopPropagation(e)}}>
102
108
  <header className="tui-forward-header">
103
109
  <Icon
104
110
  type={IconTypes.CANCEL}
@@ -124,14 +130,14 @@ export function TUIForward <T extends TUIForwardToProps>(
124
130
  <ul className="tui-forward-list">
125
131
  <h3 className="tui-forward-list-title">{t('TUIChat.Search Result')}</h3>
126
132
  {
127
- searchResult.length > 0 && searchResult.map((item) => (
133
+ searchResult.length > 0 && searchResult.map((item: any) => (
128
134
  <li key={item.conversationID} className="tui-forward-list-item">
129
135
  <label htmlFor={`${item.conversationID}`} className="info">
130
136
  <Avatar image={getDisplayImage(item)} size={40} />
131
137
  <div className="info-nick">{getDisplayTitle(item)}</div>
132
138
  </label>
133
139
  <Checkbox
134
- onChange={handleCheckboxChange}
140
+ onChange={(e) => {handleCheckboxChange(e)}}
135
141
  id={`${item.conversationID}`}
136
142
  value={item}
137
143
  />
@@ -148,7 +154,7 @@ export function TUIForward <T extends TUIForwardToProps>(
148
154
  { !searchValue && RecentList.length > 0 && (
149
155
  <ul className="tui-forward-list">
150
156
  {
151
- RecentList.map((item) => (
157
+ RecentList.map((item: any) => (
152
158
  <li key={item.conversationID} className="tui-forward-list-item">
153
159
  <label htmlFor={`${item.conversationID}`} className="info">
154
160
  <Avatar image={getDisplayImage(item)} size={40} />
@@ -167,7 +173,8 @@ export function TUIForward <T extends TUIForwardToProps>(
167
173
  </main>
168
174
  <footer className="tui-forward-footer">
169
175
  <div className="tui-forward-footer-name">{selectList.length > 0 && handleDisplayForwardName(selectList)}</div>
170
- <button type="button" className="button" onClick={() => { handleForward(selectList); }} disabled={selectList.length === 0}>{t('TUIChat.Forward')}</button>
176
+ <button type="button" className="button" onClick={handleForward}
177
+ disabled={selectList.length === 0}>{t('TUIChat.Forward')}</button>
171
178
  </footer>
172
179
  </div>
173
180
  </Model>
@@ -25,31 +25,35 @@ export function TUIMessageInputDefault():React.ReactElement {
25
25
 
26
26
  // operateData
27
27
  useEffect(() => {
28
- if (operateData[MESSAGE_OPERATE.REVOKE]) {
29
- setText(formatEmojiString(operateData[MESSAGE_OPERATE.REVOKE].payload.text, 1));
28
+ if (operateData && operateData[MESSAGE_OPERATE.REVOKE]) {
29
+ setText && setText(formatEmojiString(operateData[MESSAGE_OPERATE.REVOKE].payload.text, 1));
30
30
  }
31
31
  }, [operateData]);
32
32
 
33
33
  // Focus
34
34
  useEffect(() => {
35
- if (focus && textareaRef.current) {
35
+ if (focus && textareaRef && textareaRef.current) {
36
36
  textareaRef.current.autofocus = true;
37
37
  isPC && textareaRef?.current?.focus();
38
+ // eslint-disable-next-line
39
+ // @ts-ignore
38
40
  textareaRef?.current?.addEventListener('paste', handlePasete);
39
41
  }
40
42
  return () => {
43
+ // eslint-disable-next-line
44
+ // @ts-ignore
41
45
  textareaRef?.current?.removeEventListener('paste', handlePasete);
42
46
  };
43
- }, [focus]);
47
+ }, [focus, textareaRef]);
44
48
 
45
49
  const [focused, setFocused] = useState<boolean>(false);
46
50
 
47
- const handleFocus = (e) => {
51
+ const handleFocus = () => {
48
52
  setFocused(true);
49
53
  };
50
- const handleBlur = (e) => {
51
- setCursorPos({
52
- start: e.target.selectionStart,
54
+ const handleBlur = (e: React.ChangeEvent<HTMLInputElement>) => {
55
+ setCursorPos && setCursorPos({
56
+ start: e?.target?.selectionStart,
53
57
  end: e.target.selectionEnd,
54
58
  });
55
59
  setFocused(false);
@@ -65,11 +69,13 @@ export function TUIMessageInputDefault():React.ReactElement {
65
69
  placeholder={t('TUIChat.Enter a message')}
66
70
  rows={1}
67
71
  value={text}
72
+ // eslint-disable-next-line
73
+ // @ts-ignore
68
74
  ref={textareaRef}
69
75
  onChange={handleChange}
70
76
  onKeyDown={handleKeyDown}
71
77
  onFocus={handleFocus}
72
- onBlur={handleBlur}
78
+ onBlur={(e:any) => {handleBlur(e)}}
73
79
  />
74
80
  )
75
81
  }
@@ -28,9 +28,9 @@ export function useEmojiPicker<T extends useEmojiPickerProps>(props:PropsWithChi
28
28
 
29
29
  const onSelectEmoji = (emoji:EmojiData) => {
30
30
  if (i18n.language === 'zh') {
31
- insertText(emoji.data);
31
+ insertText && insertText(emoji.data);
32
32
  } else {
33
- insertText(emojiEnKey[emoji.data]);
33
+ insertText && insertText(emojiEnKey[emoji.data]);
34
34
  }
35
35
  };
36
36
 
@@ -5,7 +5,7 @@ import {
5
5
  } from '@tencentcloud/chat-uikit-engine';
6
6
  import { MESSAGE_OPERATE } from '../../../constants';
7
7
  import {
8
- useTUIChatActionContext, useTUIChatStateContext, useTUIKitContext,
8
+ useTUIChatStateContext, useTUIKitContext,
9
9
  } from '../../../context';
10
10
 
11
11
  export function useHandleForwardMessage(msg?:Message) {
@@ -16,11 +16,11 @@ export function useHandleForwardMessage(msg?:Message) {
16
16
  const [conversationList, setConversationList] = useState([]);
17
17
  const { chat } = useTUIKitContext('TUIChat');
18
18
 
19
- const message = msg || operateData[MESSAGE_OPERATE.FORWARD];
19
+ const message = msg || (operateData && operateData[MESSAGE_OPERATE.FORWARD]);
20
20
 
21
21
  const sendForwardMessage = (list:Array<Conversation>) => {
22
22
  list.map((item:Conversation) => {
23
- TUIChatService.sendForwardMessage([item], [message]);
23
+ message && TUIChatService.sendForwardMessage([item], [message]);
24
24
  return item;
25
25
  });
26
26
  };
@@ -29,7 +29,7 @@ export function useHandleForwardMessage(msg?:Message) {
29
29
  (async () => {
30
30
  const res = await chat.getConversationList();
31
31
  setConversationList(res?.data?.conversationList.filter(
32
- (item) => item.type !== TencentCloudChat.TYPES.CONV_SYSTEM,
32
+ (item: any) => item.type !== TencentCloudChat.TYPES.CONV_SYSTEM,
33
33
  ));
34
34
  })();
35
35
  }, [chat]);
@@ -3,7 +3,7 @@ import TencentCloudChat, { Message } from '@tencentcloud/chat';
3
3
  import { MESSAGE_OPERATE } from '../../../constants';
4
4
  import { useTUIChatStateContext } from '../../../context';
5
5
 
6
- const quoteConfigType = {
6
+ const quoteConfigType: any = {
7
7
  [TencentCloudChat.TYPES.MSG_TEXT]: 1,
8
8
  [TencentCloudChat.TYPES.MSG_CUSTOM]: 2,
9
9
  [TencentCloudChat.TYPES.MSG_IMAGE]: 3,
@@ -13,7 +13,7 @@ const quoteConfigType = {
13
13
  [TencentCloudChat.TYPES.MSG_FACE]: 8,
14
14
  };
15
15
 
16
- const quoteConfigForShow = {
16
+ const quoteConfigForShow: any = {
17
17
  [TencentCloudChat.TYPES.MSG_CUSTOM]: '[custom]',
18
18
  [TencentCloudChat.TYPES.MSG_IMAGE]: '[image]',
19
19
  [TencentCloudChat.TYPES.MSG_AUDIO]: '[audio]',
@@ -27,7 +27,7 @@ export function useHandleQuoteMessage(msg?:Message) {
27
27
  operateData,
28
28
  } = useTUIChatStateContext('TUIMessageInputDefault');
29
29
 
30
- const [cloudCustomData, setCloudCustomData] = useState({ messageReply: null });
30
+ const [cloudCustomData, setCloudCustomData] = useState<any>({ messageReply: null });
31
31
 
32
32
  const handleQuoteMessage = (message: Message) => {
33
33
  const messageType = quoteConfigType[message?.type];
@@ -46,7 +46,7 @@ export function useHandleQuoteMessage(msg?:Message) {
46
46
 
47
47
  useEffect(
48
48
  () => {
49
- const message = msg || operateData[MESSAGE_OPERATE.QUOTE];
49
+ const message = msg || (operateData &&operateData[MESSAGE_OPERATE.QUOTE]);
50
50
  setCloudCustomData(
51
51
  {
52
52
  messageReply: message ? handleQuoteMessage(message) : null,
@@ -59,6 +59,6 @@ export function useHandleQuoteMessage(msg?:Message) {
59
59
  return {
60
60
  cloudCustomData,
61
61
  handleQuoteMessage,
62
- message: msg || operateData[MESSAGE_OPERATE.QUOTE],
62
+ message: msg || (operateData &&operateData[MESSAGE_OPERATE.QUOTE]),
63
63
  };
64
64
  }
@@ -16,8 +16,8 @@ export interface IinitState {
16
16
  }
17
17
 
18
18
  export interface ICursorPos {
19
- start?: number,
20
- end?: number,
19
+ start?: number | null,
20
+ end?: number | null,
21
21
  }
22
22
 
23
23
  export type MessageInputReducerAction =
@@ -38,7 +38,7 @@ const initState:IinitState = {
38
38
  },
39
39
  };
40
40
 
41
- const reducer = (state:IinitState, action) => {
41
+ const reducer = (state:IinitState, action: any) => {
42
42
  switch (action.type) {
43
43
  case CONSTANT_DISPATCH_TYPE.SET_TEXT:
44
44
  return { ...state, text: action?.getNewText(state.text) };
@@ -16,6 +16,7 @@ import { formatEmojiString } from '../../TUIMessage/utils/emojiMap';
16
16
  import { useHandleQuoteMessage } from './useHandleQuoteMessage';
17
17
  import type { IbaseStateProps, ICursorPos } from './useMessageInputState';
18
18
  import { filesData } from './useUploadPicker';
19
+ import { de } from 'date-fns/locale';
19
20
 
20
21
  interface useMessageInputTextProps extends IbaseStateProps {
21
22
  focus?: boolean,
@@ -70,21 +71,23 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
70
71
  }
71
72
  TUIChatService.sendTextMessage(options).then((res: any) => {
72
73
  const { message } = res.data;
73
- setFirstSendMessage(message);
74
+ setFirstSendMessage && setFirstSendMessage(message);
74
75
  });
75
76
  enableSampleTaskStatus('sendMessage');
76
77
  dispatch({
77
78
  getNewText: (text:string) => '',
78
79
  type: CONSTANT_DISPATCH_TYPE.SET_TEXT,
79
80
  });
80
- operateMessage({
81
+ operateMessage && operateMessage({
82
+ // eslint-disable-next-line
83
+ // @ts-ignore
81
84
  [MESSAGE_OPERATE.QUOTE]: null,
82
85
  });
83
86
  };
84
87
 
85
88
  const handleKeyDown = useCallback(
86
89
  (event?:React.KeyboardEvent<EventTarget>) => {
87
- if (!event?.ctrlKey && enterCodeList.indexOf(event?.code) > -1 && event.keyCode === 13) {
90
+ if (!event?.ctrlKey && event?.code && enterCodeList.indexOf(event?.code) > -1 && event.keyCode === 13) {
88
91
  event?.preventDefault();
89
92
  handleSubmit(event);
90
93
  }
@@ -105,11 +108,11 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
105
108
  return;
106
109
  }
107
110
  const { types, items } = e.clipboardData;
108
- types.find((type, index) => {
111
+ types.find((type: string, index: number) => {
109
112
  const item = items[index];
110
113
  switch (type) {
111
114
  case 'text/plain':
112
- item.getAsString((str) => {
115
+ item.getAsString((str: string) => {
113
116
  dispatch({
114
117
  type: CONSTANT_DISPATCH_TYPE.SET_TEXT,
115
118
  getNewText: (text:string) => `${text}${str}`,
@@ -119,7 +122,7 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
119
122
  case 'Files': {
120
123
  const file = item.getAsFile();
121
124
  if (item && item.kind === 'file' && item.type.match(/^image\//i)) {
122
- sendUploadMessage({ file }, MESSAGE_TYPE_NAME.IMAGE);
125
+ sendUploadMessage && sendUploadMessage({ file }, MESSAGE_TYPE_NAME.IMAGE);
123
126
  }
124
127
  return true;
125
128
  }
@@ -135,13 +138,13 @@ export const useMessageInputText = (props:useMessageInputTextProps) => {
135
138
  (textToInsert: string) => {
136
139
  dispatch({
137
140
  type: CONSTANT_DISPATCH_TYPE.SET_TEXT,
138
- getNewText: (text:string) => `${text.slice(0, state.cursorPos.start)}${textToInsert}${text.slice(state.cursorPos.start)}`,
141
+ getNewText: (text:string) => `${text.slice(0, state?.cursorPos?.start || 0)}${textToInsert}${text.slice(state?.cursorPos?.start || 0)}`,
139
142
  });
140
143
  dispatch({
141
144
  type: CONSTANT_DISPATCH_TYPE.SET_CURSOR_POS,
142
145
  value: {
143
- start: state.cursorPos.start + textToInsert.length,
144
- end: state.cursorPos.end + textToInsert.length,
146
+ start: state?.cursorPos?.start && state.cursorPos.start + textToInsert.length,
147
+ end: state?.cursorPos?.end && state.cursorPos.end + textToInsert.length,
145
148
  },
146
149
  });
147
150
  textareaRef?.current?.focus();
@@ -16,13 +16,13 @@ export function useUploadElement<
16
16
  onChange,
17
17
  } = props;
18
18
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
19
- if (e.target.files.length > 0) {
19
+ if (e.target.files && e.target.files.length > 0) {
20
20
  const { files } = e.target;
21
21
  const options = {
22
22
  type: files[0].type,
23
23
  };
24
24
  const file = new File(files as any, files[0].name, options);
25
- onChange(file);
25
+ onChange && onChange(file);
26
26
  }
27
27
  e.target.value = '';
28
28
  };
@@ -19,7 +19,7 @@ export function useUploadPicker<T extends IbaseStateProps>(props:PropsWithChildr
19
19
  updateUploadPendingMessageList,
20
20
  } = useTUIChatActionContext('useUploadPicker');
21
21
 
22
- const creatUploadMessage = {
22
+ const creatUploadMessage: any = {
23
23
  [MESSAGE_TYPE_NAME.IMAGE]: TUIChatService.sendImageMessage,
24
24
  [MESSAGE_TYPE_NAME.VIDEO]: TUIChatService.sendVideoMessage,
25
25
  [MESSAGE_TYPE_NAME.FILE]: TUIChatService.sendFileMessage,
@@ -53,20 +53,19 @@ function TUIMessageListWithContext <T extends MessageListProps>(
53
53
 
54
54
  const loadMore = propsLoadMore || TUIMessageListConfig?.loadMore || contextLoadMore;
55
55
 
56
- const elements = useMessageListElement({
56
+ const elements = contextMessageList && useMessageListElement({
57
57
  enrichedMessageList: contextMessageList,
58
58
  TUIMessage,
59
59
  intervalsTimer,
60
60
  });
61
61
  useEffect(() => {
62
- // messageList 滑动到底部
63
62
  (async () => {
64
63
  const parentElement = ulElement?.parentElement?.parentElement;
65
64
  if (
66
65
  !isCompleted
67
- && parentElement?.clientHeight >= ulElement?.clientHeight
66
+ && parentElement && parentElement?.clientHeight >= ulElement?.clientHeight
68
67
  ) {
69
- await loadMore();
68
+ loadMore && await loadMore();
70
69
  }
71
70
  if (ulElement?.children) {
72
71
  const HTMLCollection = ulElement?.children || [];
@@ -92,7 +91,7 @@ function TUIMessageListWithContext <T extends MessageListProps>(
92
91
  const timer = setTimeout(() => {
93
92
  children[children.length - 1].classList.remove('high-lighted');
94
93
  clearTimeout(timer);
95
- setHighlightedMessageId('');
94
+ setHighlightedMessageId && setHighlightedMessageId('');
96
95
  }, 1000);
97
96
  }
98
97
  }, [highlightedMessageId]);
@@ -109,7 +108,7 @@ function TUIMessageListWithContext <T extends MessageListProps>(
109
108
  >
110
109
  <ul ref={setUlElement}>
111
110
  {
112
- elements?.length > 0 ? elements : <EmptyStateIndicator listType="message" />
111
+ elements?.length && elements.length > 0 ? elements : <EmptyStateIndicator listType="message" />
113
112
  }
114
113
  </ul>
115
114
  </InfiniteScroll>
@@ -26,13 +26,16 @@ function useMessageListElement <T extends MessageListElementProps>(
26
26
  const key = `${item.ID}-${index}`;
27
27
  const preMessageTImer = index > 0 ? enrichedMessageList[index - 1]?.time : -1;
28
28
  const currrentTimer = item?.time || 0;
29
- const isShowIntervalsTimer = preMessageTImer !== -1
29
+ const isShowIntervalsTimer = intervalsTimer && preMessageTImer !== -1
30
30
  ? (currrentTimer - preMessageTImer) >= intervalsTimer : false;
31
31
  return (
32
32
  <li className="message-list-item" key={key}>
33
33
  {
34
- isShowIntervalsTimer && <div className="message-list-time" key={`${currrentTimer + index}`}>{currrentTimer ? getTimeStamp(currrentTimer * 1000, language) : 0}</div>
34
+ isShowIntervalsTimer && <div className="message-list-time" key={`${currrentTimer + index}`}>
35
+ {currrentTimer ? getTimeStamp(currrentTimer * 1000, language) : 0}</div>
35
36
  }
37
+ {/* // eslint-disable-next-line
38
+ // @ts-ignore */}
36
39
  <TUIMessage message={item} />
37
40
  </li>
38
41
  );
@@ -27,10 +27,12 @@ function UnMemoizedTUIProfile<T extends TUIProfileProps>(
27
27
 
28
28
  return (
29
29
  <>
30
+ {/* //eslint-disable-next-line
31
+ @ts-ignore */}
30
32
  <Profile
31
33
  profile={myProfile}
32
34
  handleAvatar={() => {
33
- setTUIProfileShow(true);
35
+ setTUIProfileShow && setTUIProfileShow(true);
34
36
  }}
35
37
  />
36
38
  {TUIProfileShow && (
@@ -2,6 +2,7 @@ import React, { PropsWithChildren, useEffect, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import DatePicker from 'react-date-picker';
4
4
  import TencentCloudChat, { Profile } from '@tencentcloud/chat';
5
+ import { UpdateMyProfileParams } from "@tencentcloud/chat-uikit-engine";
5
6
  import { isH5 } from '../../utils/env';
6
7
  import { useTUIKitContext } from '../../context';
7
8
 
@@ -9,14 +10,13 @@ import { Avatar } from '../Avatar';
9
10
  import { DivWithEdit } from '../DivWithEdit';
10
11
  import { Icon, IconTypes } from '../Icon';
11
12
  import { handleDisplayAvatar } from '../untils';
12
- import { ProfileParams } from './hooks';
13
13
 
14
- const gender = {
14
+ const gender: any = {
15
15
  [TencentCloudChat.TYPES.GENDER_UNKNOWN]: 'unknow',
16
16
  [TencentCloudChat.TYPES.GENDER_MALE]: 'male',
17
17
  [TencentCloudChat.TYPES.GENDER_FEMALE]: 'female',
18
18
  };
19
- const allowType = {
19
+ const allowType: any = {
20
20
  [TencentCloudChat.TYPES.ALLOW_TYPE_ALLOW_ANY]: 'allowAny',
21
21
  [TencentCloudChat.TYPES.ALLOW_TYPE_NEED_CONFIRM]: 'needConfirm',
22
22
  [TencentCloudChat.TYPES.ALLOW_TYPE_DENY_ANY]: 'denyAny',
@@ -59,7 +59,7 @@ const allowTypeList = [
59
59
 
60
60
  export interface TUIProfileDefaultProps {
61
61
  userInfo?: Profile,
62
- update?: (option: ProfileParams) => void,
62
+ update?: (option: UpdateMyProfileParams) => void,
63
63
  className?: string,
64
64
  }
65
65
 
@@ -108,7 +108,7 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
108
108
  return `${year}${month}${day}`;
109
109
  };
110
110
 
111
- let editListMap = [
111
+ let editListMap: any = [
112
112
  {
113
113
  name: 'Signature',
114
114
  value: userInfo?.selfSignature,
@@ -117,7 +117,7 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
117
117
  },
118
118
  {
119
119
  name: 'Gender',
120
- value: t(gender[userInfo?.gender]?.replace(
120
+ value: t( userInfo?.gender && gender[userInfo?.gender]?.replace(
121
121
  gender[userInfo?.gender][0],
122
122
  gender[userInfo?.gender][0]?.toLocaleUpperCase(),
123
123
  ) ? `TUIProfile.${gender[userInfo?.gender]?.replace(
@@ -148,9 +148,9 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
148
148
  },
149
149
  {
150
150
  name: 'AllowType',
151
- value: t(`TUIProfile.${allowType[userInfo?.allowType]?.replace(
152
- allowType[userInfo?.allowType][0],
153
- allowType[userInfo?.allowType][0]?.toLocaleUpperCase(),
151
+ value: t(`TUIProfile.${allowType[userInfo?.allowType || '']?.replace(
152
+ userInfo && allowType[userInfo?.allowType][0],
153
+ userInfo && allowType[userInfo?.allowType][0]?.toLocaleUpperCase(),
154
154
  )}`),
155
155
  type: 'select',
156
156
  children: (
@@ -191,14 +191,14 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
191
191
  },
192
192
  ];
193
193
  if (isH5) {
194
- editListMap = editListMap.filter((item) => item.name !== 'Birthday');
194
+ editListMap = editListMap.filter((item: any) => item.name !== 'Birthday');
195
195
  }
196
196
  const handleSetEditName = (name:string) => {
197
197
  setIsEditName(name);
198
198
  };
199
199
 
200
- const confirm = (options) => {
201
- update(options);
200
+ const confirm = (options: any) => {
201
+ update && update(options);
202
202
  setIsEditName('');
203
203
  };
204
204
 
@@ -228,12 +228,12 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
228
228
  };
229
229
 
230
230
  // edit gender
231
- const editGender = (data) => {
231
+ const editGender = (data: any) => {
232
232
  confirm({ gender: data.value });
233
233
  };
234
234
 
235
235
  // edit allowType
236
- const editAllowType = (data) => {
236
+ const editAllowType = (data: any) => {
237
237
  confirm({ allowType: data.value });
238
238
  };
239
239
 
@@ -251,14 +251,14 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
251
251
  width={9}
252
252
  height={16}
253
253
  type={IconTypes.BACK}
254
- onClick={() => { setTUIProfileShow(false); }}
254
+ onClick={() => { setTUIProfileShow && setTUIProfileShow(false); }}
255
255
  />
256
256
  <h1>{t('TUIProfile.Personal information')}</h1>
257
257
  </header>
258
258
  <main className="tui-profile-main">
259
259
  <div className="tui-profile-avatar">
260
260
  <Avatar
261
- image={handleDisplayAvatar(userInfo?.avatar)}
261
+ image={userInfo && handleDisplayAvatar(userInfo?.avatar)}
262
262
  size={94}
263
263
  update={editAvatar}
264
264
  list={avatarList}
@@ -281,7 +281,7 @@ function TUIProfileDefaultWithContext<T extends TUIProfileDefaultProps>(
281
281
  </main>
282
282
  <ul className="tui-profile-list">
283
283
  {
284
- editListMap.map((item) => {
284
+ editListMap.map((item: any) => {
285
285
  const key = `${item.name}`;
286
286
  return (
287
287
  <li className="tui-profile-list-item" key={key}>
@@ -1,7 +1,11 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import TencentCloudChat from '@tencentcloud/chat';
3
- import { useTUIKitContext } from '../../../context';
4
-
1
+ import { useEffect, useState } from 'react';
2
+ import { Profile } from '@tencentcloud/chat';
3
+ import {
4
+ TUIUserService,
5
+ TUIStore,
6
+ StoreName,
7
+ UpdateMyProfileParams,
8
+ } from "@tencentcloud/chat-uikit-engine";
5
9
  export interface ProfileParams {
6
10
  nick?: string,
7
11
  avatar?: string,
@@ -19,43 +23,21 @@ export interface ProfileParams {
19
23
  }
20
24
 
21
25
  export function useMyProfile() {
22
- const [myProfile, setMyPofile] = useState(null);
23
- const { chat, myProfile: contextProfile } = useTUIKitContext('useMyProfile');
24
-
25
- const getMyProfile = useCallback(async () => {
26
- if (contextProfile) {
27
- setMyPofile(contextProfile);
28
- } else {
29
- const res = await chat?.getMyProfile();
30
- setMyPofile(res?.data);
31
- }
32
- }, [chat]);
26
+ const [myProfile, setMyProfile] = useState<Profile>();
33
27
 
34
- const updateMyProfile = useCallback(async (options) => {
35
- const res = await chat?.updateMyProfile(options);
36
- const userInfo = { ...myProfile };
37
- const keys = Object.keys(res.data);
38
- keys.map((name) => {
39
- userInfo[name] = res.data[name];
40
- return name;
41
- });
42
- setMyPofile(userInfo);
43
- return res;
44
- }, [chat]);
45
-
46
- const onProfileUpdated = (event) => {
47
- console.log('onProfileUpdated', event.data); // 包含 Profile 对象的数组
28
+ const updateMyProfile = (options: UpdateMyProfileParams) => {
29
+ TUIUserService.updateMyProfile(options);
30
+ const userInfo: any = { ...myProfile };
31
+ setMyProfile(userInfo);
48
32
  };
49
33
 
50
34
  useEffect(() => {
51
- (async () => {
52
- await getMyProfile();
53
- })();
54
- chat?.on(TencentCloudChat.EVENT.PROFILE_UPDATED, onProfileUpdated);
55
- return () => {
56
- chat?.off(TencentCloudChat.EVENT.PROFILE_UPDATED, onProfileUpdated);
57
- };
58
- }, [chat]);
35
+ TUIStore.watch(StoreName.USER, {
36
+ userProfile: (userProfileData: any) => {
37
+ setMyProfile(userProfileData);
38
+ },
39
+ });
40
+ }, []);
59
41
 
60
42
  return {
61
43
  myProfile,