@tencentcloud/chat-uikit-react 1.0.3 → 1.1.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 (234) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +69 -83
  3. package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  4. package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
  5. package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  6. package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  7. package/dist/cjs/components/ConversationPreview/ConversationListContainer.d.ts +1 -1
  8. package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +1 -1
  9. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  10. package/dist/cjs/components/ConversationPreview/utils.js +1 -1
  11. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.d.ts +1 -1
  12. package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
  13. package/dist/cjs/components/TUIChat/TUIChat.d.ts +1 -1
  14. package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
  15. package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
  16. package/dist/cjs/components/TUIChat/hooks/useCreateMessage.d.ts +2 -2
  17. package/dist/cjs/components/TUIChat/hooks/useCreateMessage.js +1 -1
  18. package/dist/cjs/components/TUIChat/hooks/useCreateTUIChatStateContext.js +1 -1
  19. package/dist/cjs/components/TUIChat/hooks/useHandleMessage.d.ts +1 -1
  20. package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  21. package/dist/cjs/components/TUIChat/hooks/useMessageReceviedListener.js +1 -1
  22. package/dist/cjs/components/TUIChat/unitls.js +1 -1
  23. package/dist/cjs/components/TUIChatHeader/TUIChatHeader.d.ts +1 -1
  24. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +1 -1
  25. package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  26. package/dist/cjs/components/TUIConversation/TUIConversation.d.ts +1 -1
  27. package/dist/cjs/components/TUIConversation/TUIConversation.js +1 -1
  28. package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +1 -1
  29. package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
  30. package/dist/cjs/components/TUIConversationList/hooks/useConversationList.js +1 -1
  31. package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  32. package/dist/cjs/components/TUIKit/TUIKit.d.ts +2 -2
  33. package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
  34. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +5 -5
  35. package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
  36. package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +3 -3
  37. package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
  38. package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
  39. package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
  40. package/dist/cjs/components/TUIMessage/MessageContext.d.ts +1 -1
  41. package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
  42. package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
  43. package/dist/cjs/components/TUIMessage/MessageFile.js +1 -1
  44. package/dist/cjs/components/TUIMessage/MessageImage.js +1 -1
  45. package/dist/cjs/components/TUIMessage/MessageMerger.js +1 -1
  46. package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
  47. package/dist/cjs/components/TUIMessage/MessagePlugins.d.ts +2 -2
  48. package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
  49. package/dist/cjs/components/TUIMessage/MessageProgress.js +1 -1
  50. package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
  51. package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
  52. package/dist/cjs/components/TUIMessage/TUIMessage.d.ts +1 -1
  53. package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
  54. package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -1
  55. package/dist/cjs/components/TUIMessage/hooks/useMessageContextHandler.js +1 -1
  56. package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  57. package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -1
  58. package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
  59. package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
  60. package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  61. package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  62. package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  63. package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  64. package/dist/cjs/components/TUIMessageList/TUIMessageList.d.ts +1 -1
  65. package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
  66. package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  67. package/dist/cjs/components/TUIProfile/TUIProfileDefault.d.ts +1 -1
  68. package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
  69. package/dist/cjs/components/TUIProfile/hooks/useMyProfile.js +1 -1
  70. package/dist/cjs/components/untils.js +1 -1
  71. package/dist/cjs/constants.js +1 -1
  72. package/dist/cjs/context/TUIChatActionContext.d.ts +3 -3
  73. package/dist/cjs/context/TUIChatStateContext.d.ts +2 -2
  74. package/dist/cjs/context/TUIConversationContext.js +1 -1
  75. package/dist/cjs/context/TUIKitContext.d.ts +2 -2
  76. package/dist/cjs/context/TUIMessageContext.d.ts +1 -1
  77. package/dist/cjs/hooks/useConversation.d.ts +3 -3
  78. package/dist/cjs/hooks/useConversation.js +1 -1
  79. package/dist/cjs/hooks/useProfile.d.ts +1 -1
  80. package/dist/cjs/index.js +1 -1
  81. package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
  82. package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
  83. package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
  84. package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
  85. package/dist/esm/components/ConversationPreview/ConversationListContainer.d.ts +1 -1
  86. package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +1 -1
  87. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  88. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  89. package/dist/esm/components/ConversationSearch/ConversationSearchResult.d.ts +1 -1
  90. package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
  91. package/dist/esm/components/TUIChat/TUIChat.d.ts +1 -1
  92. package/dist/esm/components/TUIChat/TUIChat.js +1 -1
  93. package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
  94. package/dist/esm/components/TUIChat/hooks/useCreateMessage.d.ts +2 -2
  95. package/dist/esm/components/TUIChat/hooks/useCreateMessage.js +1 -1
  96. package/dist/esm/components/TUIChat/hooks/useCreateTUIChatStateContext.js +1 -1
  97. package/dist/esm/components/TUIChat/hooks/useHandleMessage.d.ts +1 -1
  98. package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
  99. package/dist/esm/components/TUIChat/hooks/useMessageReceviedListener.js +1 -1
  100. package/dist/esm/components/TUIChat/unitls.js +1 -1
  101. package/dist/esm/components/TUIChatHeader/TUIChatHeader.d.ts +1 -1
  102. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +1 -1
  103. package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
  104. package/dist/esm/components/TUIConversation/TUIConversation.d.ts +1 -1
  105. package/dist/esm/components/TUIConversation/TUIConversation.js +1 -1
  106. package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +1 -1
  107. package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
  108. package/dist/esm/components/TUIConversationList/hooks/useConversationList.js +1 -1
  109. package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
  110. package/dist/esm/components/TUIKit/TUIKit.d.ts +2 -2
  111. package/dist/esm/components/TUIKit/TUIKit.js +1 -1
  112. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +5 -5
  113. package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
  114. package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +3 -3
  115. package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
  116. package/dist/esm/components/TUIManage/TUIManage.js +1 -1
  117. package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
  118. package/dist/esm/components/TUIMessage/MessageContext.d.ts +1 -1
  119. package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
  120. package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
  121. package/dist/esm/components/TUIMessage/MessageFile.js +1 -1
  122. package/dist/esm/components/TUIMessage/MessageImage.js +1 -1
  123. package/dist/esm/components/TUIMessage/MessageMerger.js +1 -1
  124. package/dist/esm/components/TUIMessage/MessageName.js +1 -1
  125. package/dist/esm/components/TUIMessage/MessagePlugins.d.ts +2 -2
  126. package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
  127. package/dist/esm/components/TUIMessage/MessageProgress.js +1 -1
  128. package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
  129. package/dist/esm/components/TUIMessage/MessageText.js +1 -1
  130. package/dist/esm/components/TUIMessage/TUIMessage.d.ts +1 -1
  131. package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
  132. package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -1
  133. package/dist/esm/components/TUIMessage/hooks/useMessageContextHandler.js +1 -1
  134. package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
  135. package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -1
  136. package/dist/esm/components/TUIMessage/utils/index.js +1 -1
  137. package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
  138. package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
  139. package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -1
  140. package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
  141. package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
  142. package/dist/esm/components/TUIMessageList/TUIMessageList.d.ts +1 -1
  143. package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
  144. package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
  145. package/dist/esm/components/TUIProfile/TUIProfileDefault.d.ts +1 -1
  146. package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
  147. package/dist/esm/components/TUIProfile/hooks/useMyProfile.js +1 -1
  148. package/dist/esm/components/untils.js +1 -1
  149. package/dist/esm/constants.js +1 -1
  150. package/dist/esm/context/TUIChatActionContext.d.ts +3 -3
  151. package/dist/esm/context/TUIChatStateContext.d.ts +2 -2
  152. package/dist/esm/context/TUIConversationContext.js +1 -1
  153. package/dist/esm/context/TUIKitContext.d.ts +2 -2
  154. package/dist/esm/context/TUIMessageContext.d.ts +1 -1
  155. package/dist/esm/hooks/useConversation.d.ts +3 -3
  156. package/dist/esm/hooks/useConversation.js +1 -1
  157. package/dist/esm/hooks/useProfile.d.ts +1 -1
  158. package/dist/esm/index.js +1 -1
  159. package/package.json +2 -3
  160. package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +5 -2
  161. package/src/components/ConversationCreate/ConversationCreate.tsx +3 -3
  162. package/src/components/ConversationCreate/ConversationCreateSelectView.tsx +1 -1
  163. package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +4 -4
  164. package/src/components/ConversationCreate/ConversationGroupTypeInfo.tsx +5 -5
  165. package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +6 -6
  166. package/src/components/ConversationPreview/ConversationListContainer.tsx +1 -1
  167. package/src/components/ConversationPreview/ConversationPreview.tsx +1 -1
  168. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +2 -2
  169. package/src/components/ConversationPreview/utils.tsx +10 -10
  170. package/src/components/ConversationSearch/ConversationSearchResult.tsx +1 -1
  171. package/src/components/Profile/Profile.tsx +1 -1
  172. package/src/components/Profile/hooks/useProfile.tsx +5 -5
  173. package/src/components/TUIChat/TUIChat.tsx +23 -17
  174. package/src/components/TUIChat/TUIChatState.tsx +7 -7
  175. package/src/components/TUIChat/hooks/useCreateMessage.tsx +29 -29
  176. package/src/components/TUIChat/hooks/useCreateTUIChatStateContext.tsx +5 -5
  177. package/src/components/TUIChat/hooks/useHandleMessage.tsx +2 -2
  178. package/src/components/TUIChat/hooks/useHandleMessageList.tsx +28 -15
  179. package/src/components/TUIChat/hooks/useMessageReceviedListener.tsx +5 -5
  180. package/src/components/TUIChat/unitls.ts +3 -3
  181. package/src/components/TUIChatHeader/TUIChatHeader.tsx +1 -1
  182. package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +7 -7
  183. package/src/components/TUIConversation/TUIConversation.tsx +1 -1
  184. package/src/components/TUIConversationList/TUIConversationList.tsx +3 -3
  185. package/src/components/TUIConversationList/hooks/useConversationList.tsx +5 -5
  186. package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +6 -6
  187. package/src/components/TUIKit/TUIKit.tsx +5 -5
  188. package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +3 -3
  189. package/src/components/TUIKit/hooks/useTUIKit.tsx +8 -8
  190. package/src/components/TUIManage/TUIManage.tsx +2 -2
  191. package/src/components/TUIMessage/MessageAvatar.tsx +1 -1
  192. package/src/components/TUIMessage/MessageBubble.tsx +4 -4
  193. package/src/components/TUIMessage/MessageContext.tsx +19 -19
  194. package/src/components/TUIMessage/MessageCustom.tsx +2 -2
  195. package/src/components/TUIMessage/MessageFile.tsx +2 -2
  196. package/src/components/TUIMessage/MessageImage.tsx +2 -2
  197. package/src/components/TUIMessage/MessageMerger.tsx +2 -2
  198. package/src/components/TUIMessage/MessageName.tsx +2 -2
  199. package/src/components/TUIMessage/MessagePlugins.tsx +3 -3
  200. package/src/components/TUIMessage/MessageProgress.tsx +8 -8
  201. package/src/components/TUIMessage/MessageRevoke.tsx +2 -2
  202. package/src/components/TUIMessage/MessageStatus.tsx +1 -1
  203. package/src/components/TUIMessage/MessageText.tsx +2 -2
  204. package/src/components/TUIMessage/TUIMessage.tsx +1 -1
  205. package/src/components/TUIMessage/TUIMessageDefault.tsx +7 -8
  206. package/src/components/TUIMessage/hooks/useMessageContextHandler.ts +12 -12
  207. package/src/components/TUIMessage/hooks/useMessageHandler.ts +12 -12
  208. package/src/components/TUIMessage/hooks/useMessagePluginElement.tsx +2 -2
  209. package/src/components/TUIMessage/hooks/useMessageReply.ts +11 -11
  210. package/src/components/TUIMessage/utils/index.ts +16 -16
  211. package/src/components/TUIMessageInput/InputQuoteDefalut.tsx +1 -1
  212. package/src/components/TUIMessageInput/TUIForward.tsx +1 -1
  213. package/src/components/TUIMessageInput/TUIMessageInput.tsx +2 -2
  214. package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +5 -5
  215. package/src/components/TUIMessageInput/hooks/useHandleQuoteMessage.tsx +15 -15
  216. package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +2 -2
  217. package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +2 -2
  218. package/src/components/TUIMessageList/TUIMessageList.tsx +2 -2
  219. package/src/components/TUIMessageList/hooks/useEnrichedMessageList.tsx +1 -1
  220. package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +8 -11
  221. package/src/components/TUIProfile/TUIProfileDefault.tsx +6 -6
  222. package/src/components/TUIProfile/hooks/useMyProfile.tsx +9 -9
  223. package/src/components/untils.ts +4 -4
  224. package/src/constants.ts +1 -1
  225. package/src/context/TUIChatActionContext.tsx +3 -3
  226. package/src/context/TUIChatStateContext.tsx +2 -2
  227. package/src/context/TUIConversationContext.tsx +1 -1
  228. package/src/context/TUIKitContext.tsx +2 -2
  229. package/src/context/TUIMessageContext.tsx +1 -1
  230. package/src/hooks/useConversation.tsx +11 -11
  231. package/src/hooks/useProfile.tsx +2 -2
  232. package/readme.zh_cn.md +0 -60
  233. package/src/@types/index.d.ts +0 -1
  234. package/src/@types/index.js +0 -3
@@ -1 +1 @@
1
- import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as a,useEffect as o}from"react";import{Icon as t}from"../Icon/Icon.js";import{IconTypes as r}from"../Icon/type.js";import{Avatar as s}from"../Avatar/Avatar.js";import{defaultGroupAvatarWork as l,defaultUserAvatar as c}from"../Avatar/default.js";import{Switch as m}from"../Switch/Switch.js";import{useTUIKitContext as d}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{getMessageProfile as v}from"../ConversationPreview/utils.js";import{useConversationUpdate as u}from"../TUIConversationList/hooks/useConversationUpdate.js";import{useConversation as h}from"../../hooks/useConversation.js";function f(){var f=a(null),p=f[0],g=f[1],I=a(null),C=I[0],N=I[1],j=a(!1),k=j[0],x=j[1],D=a(0),U=D[0],w=D[1],T=d("TUIManage"),A=T.conversation,M=T.setActiveConversation,P=T.tim,S=T.TUIManageShow,b=T.setTUIManageShow;u(null,(function(){w((function(n){return n+1}))}));var y=h(P),L=y.pinConversation,z=y.deleteConversation;return o((function(){g(A),N(v(A)),x(!!A&&A.isPinned)}),[A,U]),S&&A&&e("div",n({className:"tui-manage"},{children:[e("div",n({className:"tui-manage-title"},{children:[i(t,{type:r.CANCEL,width:16,height:16,onClick:function(){b(!1)}}),i("span",{children:"Conversation Information"})]})),e("div",n({className:"tui-manage-container"},{children:[e("div",n({className:"tui-manage-info"},{children:[i("div",n({className:"info-avatar"},{children:i(s,{size:64,image:(null==C?void 0:C.avatar)||((null==C?void 0:C.groupID)?l:c)})})),i("div",n({className:"info-name"},{children:(null==C?void 0:C.nick)||(null==C?void 0:C.name)})),e("div",n({className:"info-id"},{children:["ID:",(null==C?void 0:C.userID)||(null==C?void 0:C.groupID)]}))]})),e("div",n({className:"tui-manage-handle"},{children:[e("div",n({className:"manage-handle-box"},{children:[i("div",n({className:"manage-handle-title"},{children:"Pin"})),i(m,{onChange:function(n){x(n.target.checked),L({conversationID:p.conversationID,isPinned:n.target.checked})},checked:k})]})),i("div",n({className:"manage-handle-box",role:"presentation",onClick:function(){z(p.conversationID),M(null)}},{children:i("div",n({className:"manage-handle-title red"},{children:"Delete"}))}))]}))]}))]}))}export{f as TUIManage};
1
+ import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as a,useEffect as o}from"react";import{Icon as t}from"../Icon/Icon.js";import{IconTypes as r}from"../Icon/type.js";import{Avatar as s}from"../Avatar/Avatar.js";import{defaultGroupAvatarWork as l,defaultUserAvatar as c}from"../Avatar/default.js";import{Switch as m}from"../Switch/Switch.js";import{useTUIKitContext as d}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{getMessageProfile as v}from"../ConversationPreview/utils.js";import{useConversationUpdate as h}from"../TUIConversationList/hooks/useConversationUpdate.js";import{useConversation as u}from"../../hooks/useConversation.js";function f(){var f=a(null),p=f[0],g=f[1],I=a(null),C=I[0],N=I[1],j=a(!1),k=j[0],x=j[1],D=a(0),U=D[0],w=D[1],T=d("TUIManage"),A=T.conversation,M=T.setActiveConversation,P=T.chat,S=T.TUIManageShow,b=T.setTUIManageShow;h(null,(function(){w((function(n){return n+1}))}));var y=u(P),L=y.pinConversation,z=y.deleteConversation;return o((function(){g(A),N(v(A)),x(!!A&&A.isPinned)}),[A,U]),S&&A&&e("div",n({className:"tui-manage"},{children:[e("div",n({className:"tui-manage-title"},{children:[i(t,{type:r.CANCEL,width:16,height:16,onClick:function(){b(!1)}}),i("span",{children:"Conversation Information"})]})),e("div",n({className:"tui-manage-container"},{children:[e("div",n({className:"tui-manage-info"},{children:[i("div",n({className:"info-avatar"},{children:i(s,{size:64,image:(null==C?void 0:C.avatar)||((null==C?void 0:C.groupID)?l:c)})})),i("div",n({className:"info-name"},{children:(null==C?void 0:C.nick)||(null==C?void 0:C.name)})),e("div",n({className:"info-id"},{children:["ID:",(null==C?void 0:C.userID)||(null==C?void 0:C.groupID)]}))]})),e("div",n({className:"tui-manage-handle"},{children:[e("div",n({className:"manage-handle-box"},{children:[i("div",n({className:"manage-handle-title"},{children:"Pin"})),i(m,{onChange:function(n){x(n.target.checked),L({conversationID:p.conversationID,isPinned:n.target.checked})},checked:k})]})),i("div",n({className:"manage-handle-box",role:"presentation",onClick:function(){z(p.conversationID),M(null)}},{children:i("div",n({className:"manage-handle-title red"},{children:"Delete"}))}))]}))]}))]}))}export{f as TUIManage};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as s,jsxs as t}from"react/jsx-runtime";import o,{useState as n}from"react";import i from"tim-js-sdk";import{MESSAGE_STATUS as l}from"../../constants.js";import{useTUIChatActionContext as a}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{Icon as m}from"../Icon/Icon.js";import{IconTypes as r}from"../Icon/type.js";import{useMessageReply as c}from"./hooks/useMessageReply.js";import{MessageProgress as u}from"./MessageProgress.js";function d(o){var d=o.message,g=o.children,p=o.Context,b=o.Plugins,f=n(!1),v=f[0],h=f[1],I=c({message:d}),N=I.messageReply,y=I.replyMessage,M=I.sender,x=a().setHighlightedMessageId;return t("div",e({className:"meesage-bubble"},{children:[t("div",e({className:"meesage-bubble-context ".concat(null==d?void 0:d.flow),onMouseEnter:function(){h(!0)},onMouseLeave:function(){h(!1)}},{children:[t("div",e({className:"message-context\n ".concat(N?"meesage-bubble-reply meesage-bubble-reply-".concat(null==d?void 0:d.flow):"","\n ").concat((null==d?void 0:d.type)!==i.TYPES.MSG_IMAGE&&(null==d?void 0:d.type)!==i.TYPES.MSG_VIDEO&&(null==d?void 0:d.type)!==i.TYPES.MSG_FILE||(null==d?void 0:d.status)!==l.UNSEND?"":"loading")},{children:[N&&t("div",e({className:"meesage-bubble-reply-main",role:"menuitem",tabIndex:0,onClick:function(){x(null==y?void 0:y.ID)}},{children:[s("header",e({className:"title"},{children:M})),p&&s(p,{message:y})]})),g,s(u,{message:d})]})),b&&s("div",e({className:"message-plugin"},{children:v&&s(b,{})}))]})),t("div",e({className:"message-bubble-status icon"},{children:[(null==d?void 0:d.status)===l.FAIL&&s("i",{className:"icon-fail"}),(null==d?void 0:d.status)===l.UNSEND&&s(m,{width:10,height:10,type:r.PROGRESS})]}))]}))}var g=o.memo(d);function p(t){return s(g,e({},t))}export{p as MessageBubble};
1
+ import{__assign as e}from"tslib";import{jsx as s,jsxs as t}from"react/jsx-runtime";import o,{useState as n}from"react";import l from"@tencentcloud/chat";import{MESSAGE_STATUS as i}from"../../constants.js";import{useTUIChatActionContext as a}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{Icon as r}from"../Icon/Icon.js";import{IconTypes as m}from"../Icon/type.js";import{useMessageReply as c}from"./hooks/useMessageReply.js";import{MessageProgress as u}from"./MessageProgress.js";function d(o){var d=o.message,g=o.children,p=o.Context,b=o.Plugins,f=n(!1),v=f[0],h=f[1],I=c({message:d}),N=I.messageReply,y=I.replyMessage,M=I.sender,x=a().setHighlightedMessageId;return t("div",e({className:"meesage-bubble"},{children:[t("div",e({className:"meesage-bubble-context ".concat(null==d?void 0:d.flow),onMouseEnter:function(){h(!0)},onMouseLeave:function(){h(!1)}},{children:[t("div",e({className:"message-context\n ".concat(N?"meesage-bubble-reply meesage-bubble-reply-".concat(null==d?void 0:d.flow):"","\n ").concat((null==d?void 0:d.type)!==l.TYPES.MSG_IMAGE&&(null==d?void 0:d.type)!==l.TYPES.MSG_VIDEO&&(null==d?void 0:d.type)!==l.TYPES.MSG_FILE||(null==d?void 0:d.status)!==i.UNSEND?"":"loading")},{children:[N&&t("div",e({className:"meesage-bubble-reply-main",role:"menuitem",tabIndex:0,onClick:function(){x(null==y?void 0:y.ID)}},{children:[s("header",e({className:"title"},{children:M})),p&&s(p,{message:y})]})),g,s(u,{message:d})]})),b&&s("div",e({className:"message-plugin"},{children:v&&s(b,{})}))]})),t("div",e({className:"message-bubble-status icon"},{children:[(null==d?void 0:d.status)===i.FAIL&&s("i",{className:"icon-fail"}),(null==d?void 0:d.status)===i.UNSEND&&s(r,{width:10,height:10,type:m.PROGRESS})]}))]}))}var g=o.memo(d);function p(t){return s(g,e({},t))}export{p as MessageBubble};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Message } from 'tim-js-sdk';
2
+ import { Message } from '@tencentcloud/chat';
3
3
 
4
4
  interface MessageContextProps {
5
5
  message?: Message;
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as s}from"react/jsx-runtime";import t from"react";import o from"tim-js-sdk";import{MessageAudio as m}from"./MessageAudio.js";import{MessageCustom as r}from"./MessageCustom.js";import{MessageFace as E}from"./MessageFace.js";import{MessageFile as M}from"./MessageFile.js";import{MessageImage as S}from"./MessageImage.js";import{MessageLocation as i}from"./MessageLocation.js";import{MessageMerger as a}from"./MessageMerger.js";import{MessageText as n}from"./MessageText.js";import{MessageVideo as T}from"./MessageVideo.js";import"../../constants.js";import{useTUIMessageContext as G}from"../../context/TUIMessageContext.js";import{useMessageContextHandler as g}from"./hooks/useMessageContextHandler.js";import{MessageStatus as p}from"./MessageStatus.js";var f,l=((f={})[o.TYPES.MSG_TEXT]=n,f[o.TYPES.MSG_FACE]=E,f[o.TYPES.MSG_IMAGE]=S,f[o.TYPES.MSG_AUDIO]=m,f[o.TYPES.MSG_VIDEO]=T,f[o.TYPES.MSG_FILE]=M,f[o.TYPES.MSG_CUSTOM]=r,f[o.TYPES.MSG_MERGER]=a,f[o.TYPES.MSG_LOCATION]=i,f);function P(t){var m,r=t.message,E=g({message:r}).context,M=G("MessageCustom"),S=M.CustemElement,i=M.TextElement,a=M.FaceElement,n=M.ImageElement,T=M.AudioElement,f=M.VideoElement,P=M.FileElement,Y=M.MergerElement,_=M.LocationElement,j=((m={})[o.TYPES.MSG_TEXT]=i,m[o.TYPES.MSG_FACE]=a,m[o.TYPES.MSG_IMAGE]=n,m[o.TYPES.MSG_AUDIO]=T,m[o.TYPES.MSG_VIDEO]=f,m[o.TYPES.MSG_FILE]=P,m[o.TYPES.MSG_CUSTOM]=S,m[o.TYPES.MSG_MERGER]=Y,m[o.TYPES.MSG_LOCATION]=_,m)[null==r?void 0:r.type]||l[null==r?void 0:r.type];return j&&s(j,e({context:E,message:r},{children:s(p,{message:r})}))}var Y=t.memo(P);function _(t){return s(Y,e({},t))}export{_ as MessageContext};
1
+ import{__assign as e}from"tslib";import{jsx as t}from"react/jsx-runtime";import o from"react";import s from"@tencentcloud/chat";import{MessageAudio as m}from"./MessageAudio.js";import{MessageCustom as r}from"./MessageCustom.js";import{MessageFace as E}from"./MessageFace.js";import{MessageFile as M}from"./MessageFile.js";import{MessageImage as S}from"./MessageImage.js";import{MessageLocation as a}from"./MessageLocation.js";import{MessageMerger as i}from"./MessageMerger.js";import{MessageText as n}from"./MessageText.js";import{MessageVideo as T}from"./MessageVideo.js";import"../../constants.js";import{useTUIMessageContext as G}from"../../context/TUIMessageContext.js";import{useMessageContextHandler as g}from"./hooks/useMessageContextHandler.js";import{MessageStatus as p}from"./MessageStatus.js";var l,f=((l={})[s.TYPES.MSG_TEXT]=n,l[s.TYPES.MSG_FACE]=E,l[s.TYPES.MSG_IMAGE]=S,l[s.TYPES.MSG_AUDIO]=m,l[s.TYPES.MSG_VIDEO]=T,l[s.TYPES.MSG_FILE]=M,l[s.TYPES.MSG_CUSTOM]=r,l[s.TYPES.MSG_MERGER]=i,l[s.TYPES.MSG_LOCATION]=a,l);function P(o){var m,r=o.message,E=g({message:r}).context,M=G("MessageCustom"),S=M.CustemElement,a=M.TextElement,i=M.FaceElement,n=M.ImageElement,T=M.AudioElement,l=M.VideoElement,P=M.FileElement,Y=M.MergerElement,_=M.LocationElement,c=((m={})[s.TYPES.MSG_TEXT]=a,m[s.TYPES.MSG_FACE]=i,m[s.TYPES.MSG_IMAGE]=n,m[s.TYPES.MSG_AUDIO]=T,m[s.TYPES.MSG_VIDEO]=l,m[s.TYPES.MSG_FILE]=P,m[s.TYPES.MSG_CUSTOM]=S,m[s.TYPES.MSG_MERGER]=Y,m[s.TYPES.MSG_LOCATION]=_,m)[null==r?void 0:r.type]||f[null==r?void 0:r.type];return c&&t(c,e({context:E,message:r},{children:t(p,{message:r})}))}var Y=o.memo(P);function _(o){return t(Y,e({},o))}export{_ as MessageContext};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as r,jsxs as n,Fragment as t}from"react/jsx-runtime";import l from"react";import o from"tim-js-sdk";import{JSONStringToParse as i}from"../untils.js";function u(l){var u=l.context,a=l.message,c=l.children;return n("div",e({className:"bubble message-custom bubble-".concat(a.flow," ").concat((null==a?void 0:a.conversationType)===o.TYPES.CONV_GROUP?"group":"")},{children:[function(l){if("Hyperlink"===l.data){var o=i(null==l?void 0:l.extension);if(null==o?void 0:o.item)return null==o?void 0:o.item.map((function(n){return r("a",e({target:"_blank",href:n.value,rel:"noreferrer"},{children:n.value}),n.value)}));if(null==o?void 0:o.hyperlinks_text){var u=o.hyperlinks_text;return n(t,{children:[o.title," ",r("a",e({target:"_blank",href:null==u?void 0:u.value,rel:"noreferrer"},{children:u.key}),null==u?void 0:u.value)]})}}return"group_create"===l.data?"".concat((null==a?void 0:a.nick)||(null==a?void 0:a.from)," Create a group"):l.extension}(null==u?void 0:u.custom),c]}))}var a=l.memo(u);function c(n){return r(a,e({},n))}export{c as MessageCustom};
1
+ import{__assign as e}from"tslib";import{jsx as r,jsxs as n,Fragment as t}from"react/jsx-runtime";import l from"react";import o from"@tencentcloud/chat";import{JSONStringToParse as i}from"../untils.js";function u(l){var u=l.context,a=l.message,c=l.children;return n("div",e({className:"bubble message-custom bubble-".concat(a.flow," ").concat((null==a?void 0:a.conversationType)===o.TYPES.CONV_GROUP?"group":"")},{children:[function(l){if("Hyperlink"===l.data){var o=i(null==l?void 0:l.extension);if(null==o?void 0:o.item)return null==o?void 0:o.item.map((function(n){return r("a",e({target:"_blank",href:n.value,rel:"noreferrer"},{children:n.value}),n.value)}));if(null==o?void 0:o.hyperlinks_text){var u=o.hyperlinks_text;return n(t,{children:[o.title," ",r("a",e({target:"_blank",href:null==u?void 0:u.value,rel:"noreferrer"},{children:u.key}),null==u?void 0:u.value)]})}}return"group_create"===l.data?"".concat((null==a?void 0:a.nick)||(null==a?void 0:a.from)," Create a group"):l.extension}(null==u?void 0:u.custom),c]}))}var a=l.memo(u);function c(n){return r(a,e({},n))}export{c as MessageCustom};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as r,jsxs as o}from"react/jsx-runtime";import a from"react";import i from"tim-js-sdk";import{Icon as m}from"../Icon/Icon.js";import{IconTypes as s}from"../Icon/type.js";function n(a){var n=a.context,t=a.message,l=a.children;return o("a",e({href:n.url,download:n.name,target:"_parent",className:"bubble message-file bubble-".concat(t.flow," ").concat((null==t?void 0:t.conversationType)===i.TYPES.CONV_GROUP?"group":""),rel:"noreferrer"},{children:[o("main",e({className:"message-file-main"},{children:[r(m,{className:"icon",width:15,height:20,type:s.FILE}),r("label",e({htmlFor:"message-file"},{children:n.name}))]})),o("div",e({className:"message-file-footer"},{children:[r("span",e({className:"message-file-size"},{children:n.size})),l]}))]}))}var t=a.memo(n);function l(o){return r(t,e({},o))}export{l as MessageFile};
1
+ import{__assign as e}from"tslib";import{jsx as r,jsxs as o}from"react/jsx-runtime";import a from"react";import n from"@tencentcloud/chat";import{Icon as t}from"../Icon/Icon.js";import{IconTypes as i}from"../Icon/type.js";function m(a){var m=a.context,s=a.message,l=a.children;return o("a",e({href:m.url,download:m.name,target:"_parent",className:"bubble message-file bubble-".concat(s.flow," ").concat((null==s?void 0:s.conversationType)===n.TYPES.CONV_GROUP?"group":""),rel:"noreferrer"},{children:[o("main",e({className:"message-file-main"},{children:[r(t,{className:"icon",width:15,height:20,type:i.FILE}),r("label",e({htmlFor:"message-file"},{children:m.name}))]})),o("div",e({className:"message-file-footer"},{children:[r("span",e({className:"message-file-size"},{children:m.size})),l]}))]}))}var s=a.memo(m);function l(o){return r(s,e({},o))}export{l as MessageFile};
@@ -1 +1 @@
1
- import{__assign as i}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import n,{useState as e}from"react";import t from"tim-js-sdk";import{Model as l}from"../Model/index.js";function m(n){var m,a,c,d=n.context,u=n.message,s=n.children,f=e(!1),v=f[0],g=f[1],p=null===(a=null===(m=null==u?void 0:u.payload)||void 0===m?void 0:m.imageInfoArray)||void 0===a?void 0:a.filter((function(i){return 0===i.type}));return r("div",i({className:"message-image"},{children:[o("div",i({role:"button",tabIndex:0,onClick:function(){g(!0)}},{children:o("img",{className:"img bubble-".concat(u.flow," ").concat((null==u?void 0:u.conversationType)===t.TYPES.CONV_GROUP?"group":""),src:d.url,alt:""})})),s,v&&o(l,i({onClick:function(){g(!1)}},{children:o("img",{className:"big-image",src:null===(c=p[0])||void 0===c?void 0:c.url,alt:""})}))]}))}var a=n.memo(m);function c(r){return o(a,i({},r))}export{c as MessageImage};
1
+ import{__assign as o}from"tslib";import{jsx as i,jsxs as n}from"react/jsx-runtime";import r,{useState as e}from"react";import t from"@tencentcloud/chat";import{Model as l}from"../Model/index.js";function c(r){var c,a,m,u=r.context,d=r.message,s=r.children,f=e(!1),v=f[0],g=f[1],p=null===(a=null===(c=null==d?void 0:d.payload)||void 0===c?void 0:c.imageInfoArray)||void 0===a?void 0:a.filter((function(o){return 0===o.type}));return n("div",o({className:"message-image"},{children:[i("div",o({role:"button",tabIndex:0,onClick:function(){g(!0)}},{children:i("img",{className:"img bubble-".concat(d.flow," ").concat((null==d?void 0:d.conversationType)===t.TYPES.CONV_GROUP?"group":""),src:u.url,alt:""})})),s,v&&i(l,o({onClick:function(){g(!1)}},{children:i("img",{className:"big-image",src:null===(m=p[0])||void 0===m?void 0:m.url,alt:""})}))]}))}var a=r.memo(c);function m(n){return i(a,o({},n))}export{m as MessageImage};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as r,jsxs as t}from"react/jsx-runtime";import i from"react";import m from"tim-js-sdk";function s(i){var s=i.context,a=i.message,n=i.children;return t("div",e({className:"bubble message-merger bubble-".concat(a.flow," ").concat((null==a?void 0:a.conversationType)===m.TYPES.CONV_GROUP?"group":"")},{children:[r("h3",{children:s.title}),r("ul",e({className:"message-merger-list"},{children:(null==s?void 0:s.abstractList.length)>0&&s.abstractList.map((function(t,i){var m=t+i;return r("li",e({className:"message-merger-item"},{children:t}),m)}))})),n]}))}var a=i.memo(s);function n(t){return r(a,e({},t))}export{n as MessageMerger};
1
+ import{__assign as e}from"tslib";import{jsx as r,jsxs as t}from"react/jsx-runtime";import n from"react";import a from"@tencentcloud/chat";function c(n){var c=n.context,i=n.message,m=n.children;return t("div",e({className:"bubble message-merger bubble-".concat(i.flow," ").concat((null==i?void 0:i.conversationType)===a.TYPES.CONV_GROUP?"group":"")},{children:[r("h3",{children:c.title}),r("ul",e({className:"message-merger-list"},{children:(null==c?void 0:c.abstractList.length)>0&&c.abstractList.map((function(t,n){var a=t+n;return r("li",e({className:"message-merger-item"},{children:t}),a)}))})),m]}))}var i=n.memo(c);function m(t){return r(i,e({},t))}export{m as MessageMerger};
@@ -1 +1 @@
1
- import{__assign as o}from"tslib";import{jsx as t}from"react/jsx-runtime";import e from"tim-js-sdk";import"react";import{messageShowType as r}from"../../context/TUIMessageContext.js";function m(m){m.className;var l=m.CustomName,n=m.message,i=m.showType;return(i===r.ALL||(null==n?void 0:n.flow)===i)&&(null==n?void 0:n.conversationType)===e.TYPES.CONV_GROUP&&i!==r.NONE?l||t("label",o({htmlFor:"content",className:"name"},{children:(null==n?void 0:n.nick)||(null==n?void 0:n.from)})):null}export{m as MessageName};
1
+ import{__assign as o}from"tslib";import{jsx as t}from"react/jsx-runtime";import e from"@tencentcloud/chat";import"react";import{messageShowType as n}from"../../context/TUIMessageContext.js";function r(r){r.className;var l=r.CustomName,m=r.message,i=r.showType;return(i===n.ALL||(null==m?void 0:m.flow)===i)&&(null==m?void 0:m.conversationType)===e.TYPES.CONV_GROUP&&i!==n.NONE?l||t("label",o({htmlFor:"content",className:"name"},{children:(null==m?void 0:m.nick)||(null==m?void 0:m.from)})):null}export{r as MessageName};
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import tim_js_sdk__default from 'tim-js-sdk';
2
+ import _tencentcloud_chat__default from '@tencentcloud/chat';
3
3
  import { PluginsProps } from '../Plugins/index.js';
4
4
 
5
5
  declare enum PluginsNameEnum {
@@ -13,7 +13,7 @@ declare enum PluginsNameEnum {
13
13
  type MessagePluginConfigProps = {
14
14
  [propsName in PluginsNameEnum]?: {
15
15
  isShow?: boolean;
16
- relateMessageType?: tim_js_sdk__default.TYPES[];
16
+ relateMessageType?: _tencentcloud_chat__default.TYPES[];
17
17
  };
18
18
  };
19
19
  interface MessagePluginsProps extends PluginsProps {
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as l,useRef as i}from"react";import n from"tim-js-sdk";import{Plugins as t}from"../Plugins/index.js";import{Icon as r}from"../Icon/Icon.js";import{IconTypes as a}from"../Icon/type.js";import{useTUIChatStateContext as d}from"../../context/TUIChatStateContext.js";import{useTUIMessageContext as u}from"../../context/TUIMessageContext.js";import{useMessageHandler as c}from"./hooks/useMessageHandler.js";import{MESSAGE_STATUS as h,MESSAGE_FLOW as g}from"../../constants.js";import"date-fns";import{useMessagePluginElement as m}from"./hooks/useMessagePluginElement.js";var p;function v(p){var v,f,S,w,M,y,C=p.plugins,T=p.showNumber,E=p.MoreIcon,N=p.config,k=l(""),R=k[0],U=k[1],j=i(null),I=u("MessagePlugins"),x=I.message,b=I.plugin,q=d("MessageBubbleWithContext").messageListRef,O=c({message:x}),P=O.handleDelMessage,D=O.handleRevokeMessage,F=O.handleReplyMessage,L=O.handleCopyMessage,W=O.handleResendMessage,Y=O.handleForWardMessage,A={quote:e(e({isShow:!0},null==N?void 0:N.quote),null===(v=null==b?void 0:b.config)||void 0===v?void 0:v.quote),forward:e(e({isShow:!0},null==N?void 0:N.forward),null===(f=null==b?void 0:b.config)||void 0===f?void 0:f.forward),copy:e(e({isShow:!0,relateMessageType:[n.TYPES.MSG_TEXT]},null==N?void 0:N.copy),null===(S=null==b?void 0:b.config)||void 0===S?void 0:S.copy),delete:e(e({isShow:!0},null==N?void 0:N.delete),null===(w=null==b?void 0:b.config)||void 0===w?void 0:w.delete),revoke:e(e({isShow:!0},null==N?void 0:N.revoke),null===(M=null==b?void 0:b.config)||void 0===M?void 0:M.revoke),resend:e(e({isShow:!0},null==N?void 0:N.resend),null===(y=null==b?void 0:b.config)||void 0===y?void 0:y.resend)},Q=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Recall"}),o(r,{width:20,height:20,type:a.REVOCATION})]})),handle:function(e){j.current.closeMore(),D(e)},message:x,isShow:A.revoke.isShow&&(null==x?void 0:x.status)===h.SUCCESS&&x.flow===g.OUT,relateMessageType:A.revoke.relateMessageType}),V=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",e({className:"del"},{children:"Delete"})),o(r,{width:20,height:20,type:a.DEL})]})),handle:function(e){j.current.closeMore(),P(e)},message:x,isShow:A.delete.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.delete.relateMessageType}),B=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Quote"}),o(r,{width:20,height:20,type:a.QUOTE})]})),handle:function(e){j.current.closeMore(),F(e)},message:x,isShow:A.quote.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.quote.relateMessageType}),G=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Copy"}),o(r,{width:20,height:20,type:a.COPY})]})),handle:function(e){j.current.closeMore(),L(e)},message:x,isShow:A.copy.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.copy.relateMessageType}),H=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Resend"}),o(r,{width:20,height:20,type:a.REPLY})]})),handle:function(e){j.current.closeMore(),W(e)},message:x,isShow:A.resend.isShow&&(null==x?void 0:x.status)!==h.SUCCESS,relateMessageType:A.resend.relateMessageType}),X=[Q,B,m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Forward"}),o(r,{width:20,height:20,type:a.FORWARD})]})),handle:function(e){j.current.closeMore(),Y(e)},message:x,isShow:A.forward.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.forward.relateMessageType}),V,H,G],_=(C||(null==b?void 0:b.plugins)||X).filter((function(e){return e})),z=E||(null==b?void 0:b.MoreIcon)||o(r,{className:"icon-more",width:16,height:16,type:a.MORE}),J=T||(null==b?void 0:b.showNumber)||0;return(null==x?void 0:x.status)!==h.UNSEND&&o(t,{className:"message-plugin",customClass:R,ref:j,plugins:_,showNumber:J,MoreIcon:z,root:null==q?void 0:q.current,handleVisible:function(e){U("".concat(!e.top&&"message-plugin-top"," ").concat(!e.left&&"message-plugin-left"))}})}!function(e){e.quote="quote",e.forward="forward",e.copy="copy",e.delete="delete",e.resend="resend",e.revoke="revoke"}(p||(p={}));export{v as MessagePlugins};
1
+ import{__assign as e}from"tslib";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as l,useRef as i}from"react";import n from"@tencentcloud/chat";import{Plugins as t}from"../Plugins/index.js";import{Icon as r}from"../Icon/Icon.js";import{IconTypes as a}from"../Icon/type.js";import{useTUIChatStateContext as d}from"../../context/TUIChatStateContext.js";import{useTUIMessageContext as u}from"../../context/TUIMessageContext.js";import{useMessageHandler as c}from"./hooks/useMessageHandler.js";import{MESSAGE_STATUS as h,MESSAGE_FLOW as g}from"../../constants.js";import"date-fns";import{useMessagePluginElement as p}from"./hooks/useMessagePluginElement.js";var m;function v(m){var v,f,S,w,M,y,C=m.plugins,T=m.showNumber,E=m.MoreIcon,N=m.config,R=l(""),U=R[0],k=R[1],j=i(null),I=u("MessagePlugins"),x=I.message,b=I.plugin,q=d("MessageBubbleWithContext").messageListRef,O=c({message:x}),P=O.handleDelMessage,D=O.handleRevokeMessage,F=O.handleReplyMessage,L=O.handleCopyMessage,W=O.handleResendMessage,Y=O.handleForWardMessage,A={quote:e(e({isShow:!0},null==N?void 0:N.quote),null===(v=null==b?void 0:b.config)||void 0===v?void 0:v.quote),forward:e(e({isShow:!0},null==N?void 0:N.forward),null===(f=null==b?void 0:b.config)||void 0===f?void 0:f.forward),copy:e(e({isShow:!0,relateMessageType:[n.TYPES.MSG_TEXT]},null==N?void 0:N.copy),null===(S=null==b?void 0:b.config)||void 0===S?void 0:S.copy),delete:e(e({isShow:!0},null==N?void 0:N.delete),null===(w=null==b?void 0:b.config)||void 0===w?void 0:w.delete),revoke:e(e({isShow:!0},null==N?void 0:N.revoke),null===(M=null==b?void 0:b.config)||void 0===M?void 0:M.revoke),resend:e(e({isShow:!0},null==N?void 0:N.resend),null===(y=null==b?void 0:b.config)||void 0===y?void 0:y.resend)},Q=p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Recall"}),o(r,{width:20,height:20,type:a.REVOCATION})]})),handle:function(e){j.current.closeMore(),D(e)},message:x,isShow:A.revoke.isShow&&(null==x?void 0:x.status)===h.SUCCESS&&x.flow===g.OUT,relateMessageType:A.revoke.relateMessageType}),V=p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",e({className:"del"},{children:"Delete"})),o(r,{width:20,height:20,type:a.DEL})]})),handle:function(e){j.current.closeMore(),P(e)},message:x,isShow:A.delete.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.delete.relateMessageType}),B=p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Quote"}),o(r,{width:20,height:20,type:a.QUOTE})]})),handle:function(e){j.current.closeMore(),F(e)},message:x,isShow:A.quote.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.quote.relateMessageType}),G=p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Copy"}),o(r,{width:20,height:20,type:a.COPY})]})),handle:function(e){j.current.closeMore(),L(e)},message:x,isShow:A.copy.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.copy.relateMessageType}),H=p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Resend"}),o(r,{width:20,height:20,type:a.REPLY})]})),handle:function(e){j.current.closeMore(),W(e)},message:x,isShow:A.resend.isShow&&(null==x?void 0:x.status)!==h.SUCCESS,relateMessageType:A.resend.relateMessageType}),X=[Q,B,p({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:"Forward"}),o(r,{width:20,height:20,type:a.FORWARD})]})),handle:function(e){j.current.closeMore(),Y(e)},message:x,isShow:A.forward.isShow&&(null==x?void 0:x.status)===h.SUCCESS,relateMessageType:A.forward.relateMessageType}),V,H,G],_=(C||(null==b?void 0:b.plugins)||X).filter((function(e){return e})),z=E||(null==b?void 0:b.MoreIcon)||o(r,{className:"icon-more",width:16,height:16,type:a.MORE}),J=T||(null==b?void 0:b.showNumber)||0;return(null==x?void 0:x.status)!==h.UNSEND&&o(t,{className:"message-plugin",customClass:U,ref:j,plugins:_,showNumber:J,MoreIcon:z,root:null==q?void 0:q.current,handleVisible:function(e){k("".concat(!e.top&&"message-plugin-top"," ").concat(!e.left&&"message-plugin-left"))}})}!function(e){e.quote="quote",e.forward="forward",e.copy="copy",e.delete="delete",e.resend="resend",e.revoke="revoke"}(m||(m={}));export{v as MessagePlugins};
@@ -1 +1 @@
1
- import{__assign as o}from"tslib";import{jsx as t,jsxs as s}from"react/jsx-runtime";import e,{useState as r,useEffect as n}from"react";import i from"tim-js-sdk";import{MESSAGE_STATUS as l}from"../../constants.js";import{useTUIChatStateContext as m}from"../../context/TUIChatStateContext.js";import{useTUIMessageContext as a}from"../../context/TUIMessageContext.js";function u(e){var u=e.message,d=e.children,p=e.Progress,g=e.isShow,c=void 0!==g&&g,v=r(),f=v[0],S=v[1],h=r(0),x=h[0],P=h[1],M=m("MessageProgressWithContext").uploadPenddingMessageList,E=a("MessageProgressWithContext"),I=E.isShowProgress,j=void 0!==I&&I,C=E.Progress,T=p||C,y=c||j;return n((function(){M&&M.length>0&&M.map((function(o){return(null==o?void 0:o.ID)===(null==u?void 0:u.ID)&&(S(o),P(null==o?void 0:o.progress)),o}))}),[M]),y?T?t(T,{message:f}):!((null==u?void 0:u.type)!==i.TYPES.MSG_IMAGE&&(null==u?void 0:u.type)!==i.TYPES.MSG_VIDEO&&(null==u?void 0:u.type)!==i.TYPES.MSG_FILE||(null==u?void 0:u.status)!==l.UNSEND)&&s("div",o({className:"progress-box"},{children:[t("span",{className:"progress",style:{width:"".concat(100*x,"%")}}),d]})):null}var d=e.memo(u);function p(s){return t(d,o({},s))}export{p as MessageProgress};
1
+ import{__assign as t}from"tslib";import{jsx as o,jsxs as e}from"react/jsx-runtime";import s,{useState as r,useEffect as n}from"react";import i from"@tencentcloud/chat";import{MESSAGE_STATUS as l}from"../../constants.js";import{useTUIChatStateContext as a}from"../../context/TUIChatStateContext.js";import{useTUIMessageContext as m}from"../../context/TUIMessageContext.js";function u(s){var u=s.message,c=s.children,p=s.Progress,d=s.isShow,g=void 0!==d&&d,v=r(),f=v[0],h=v[1],S=r(0),x=S[0],P=S[1],M=a("MessageProgressWithContext").uploadPendingMessageList,E=m("MessageProgressWithContext"),I=E.isShowProgress,C=void 0!==I&&I,T=E.Progress,j=p||T,y=g||C;return n((function(){M&&M.length>0&&M.map((function(t){return(null==t?void 0:t.ID)===(null==u?void 0:u.ID)&&(h(t),P(null==t?void 0:t.progress)),t}))}),[M]),y?j?o(j,{message:f}):!((null==u?void 0:u.type)!==i.TYPES.MSG_IMAGE&&(null==u?void 0:u.type)!==i.TYPES.MSG_VIDEO&&(null==u?void 0:u.type)!==i.TYPES.MSG_FILE||(null==u?void 0:u.status)!==l.UNSEND)&&e("div",t({className:"progress-box"},{children:[o("span",{className:"progress",style:{width:"".concat(100*x,"%")}}),c]})):null}var c=s.memo(u);function p(e){return o(c,t({},e))}export{p as MessageProgress};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import n,{useCallback as r}from"react";import s from"tim-js-sdk";import{MESSAGE_OPERATE as i,MESSAGE_FLOW as l}from"../../constants.js";import{useTUIChatActionContext as a}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";function m(n){var m=n.message,c=a().operateMessage,d=r((function(){var e;c(((e={})[i.REVOKE]=m,e))}),[c]);return t("div",e({className:"bubble message-system message-revoke"},{children:[(null==m?void 0:m.flow)===l.IN&&o("span",{children:(null==m?void 0:m.nick)||(null==m?void 0:m.from)}),(null==m?void 0:m.flow)!==l.IN&&o("span",{children:"you "}),o("span",{children:" recalled a message"}),(null==m?void 0:m.flow)===l.OUT&&(null==m?void 0:m.type)===s.TYPES.MSG_TEXT&&o("span",e({className:"edit",role:"button",tabIndex:0,onClick:d},{children:" Re-edit"}))]}))}var c=n.memo(m);function d(t){return o(c,e({},t))}export{d as MessageRevoke};
1
+ import{__assign as e}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import n,{useCallback as r}from"react";import i from"@tencentcloud/chat";import{MESSAGE_OPERATE as l,MESSAGE_FLOW as s}from"../../constants.js";import{useTUIChatActionContext as a}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";function m(n){var m=n.message,c=a().operateMessage,d=r((function(){var e;c(((e={})[l.REVOKE]=m,e))}),[c]);return t("div",e({className:"bubble message-system message-revoke"},{children:[(null==m?void 0:m.flow)===s.IN&&o("span",{children:(null==m?void 0:m.nick)||(null==m?void 0:m.from)}),(null==m?void 0:m.flow)!==s.IN&&o("span",{children:"you "}),o("span",{children:" recalled a message"}),(null==m?void 0:m.flow)===s.OUT&&(null==m?void 0:m.type)===i.TYPES.MSG_TEXT&&o("span",e({className:"edit",role:"button",tabIndex:0,onClick:d},{children:" Re-edit"}))]}))}var c=n.memo(m);function d(t){return o(c,e({},t))}export{d as MessageRevoke};
@@ -1 +1 @@
1
- import{__assign as t}from"tslib";import{jsx as e,jsxs as r}from"react/jsx-runtime";import c from"react";import n from"tim-js-sdk";function s(c){var s=c.context,m=c.message,a=c.children;return e("div",t({className:"bubble message-text bubble-".concat(m.flow," ").concat((null==m?void 0:m.conversationType)===n.TYPES.CONV_GROUP?"group":"")},{children:r("div",t({className:"message-text-content"},{children:[s.text.map((function(r,c){var n=m.ID+c;return"text"===r.name?e("p",t({className:"message-text-content-p"},{children:r.text}),r.src+n):e("img",{className:"text-img",src:r.src,alt:""},r.src+n)})),a]}))}))}var m=c.memo(s);function a(r){return e(m,t({},r))}export{a as MessageText};
1
+ import{__assign as t}from"tslib";import{jsx as e,jsxs as r}from"react/jsx-runtime";import c from"react";import n from"@tencentcloud/chat";function a(c){var a=c.context,o=c.message,m=c.children;return e("div",t({className:"bubble message-text bubble-".concat(o.flow," ").concat((null==o?void 0:o.conversationType)===n.TYPES.CONV_GROUP?"group":"")},{children:r("div",t({className:"message-text-content"},{children:[a.text.map((function(r,c){var n=o.ID+c;return"text"===r.name?e("p",t({className:"message-text-content-p"},{children:r.text}),r.src+n):e("img",{className:"text-img",src:r.src,alt:""},r.src+n)})),m]}))}))}var o=c.memo(a);function m(r){return e(o,t({},r))}export{m as MessageText};
@@ -1,5 +1,5 @@
1
1
  import React, { ReactEventHandler } from 'react';
2
- import { Message } from 'tim-js-sdk';
2
+ import { Message } from '@tencentcloud/chat';
3
3
  import { UnknowPorps } from '../../context/ComponentContext.js';
4
4
  import { messageShowType } from '../../context/TUIMessageContext.js';
5
5
  import { MessagePluginsProps } from './MessagePlugins.js';
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import s from"react";import{useTUIChatStateContext as t}from"../../context/TUIChatStateContext.js";import{TUIMessageContextProvider as l}from"../../context/TUIMessageContext.js";import{useComponentContext as n}from"../../context/ComponentContext.js";import{useMessageHandler as m}from"./hooks/useMessageHandler.js";import"tim-js-sdk";import"../../constants.js";import"date-fns";import"../Icon/config.js";import"../Icon/type.js";import{TUIMessageDefault as i}from"./TUIMessageDefault.js";import{MessagePlugins as a}from"./MessagePlugins.js";import{MessageContext as r}from"./MessageContext.js";function u(s){var m=s.message,u=s.TUIMessage,d=s.MessagePlugins,g=s.MessageContext,v=s.handleDelete,c=s.CustemElement,f=s.TextElement,E=s.ImageElement,p=s.VideoElement,h=s.AudioElement,x=s.FileElement,M=s.MergerElement,w=s.LocationElement,C=s.FaceElement,j=s.className,T=s.filter,I=s.isShowTime,P=s.isShowRead,S=s.plugin,A=s.prefix,N=s.suffix,D=s.customName,F=s.showAvatar,U=s.showName,L=s.customAvatar,R=s.isShowProgress,V=s.Progress,k=n(),b=k.MessagePlugins,y=k.MessageContext,H=t("TUIMessage").messageConfig,q=u||i,z=d||b||a,B=g||y||r,G=T||(null==H?void 0:H.filter),J=m||(null==H?void 0:H.message);G&&G(J);var K={message:J,handleDelete:v||(null==H?void 0:H.handleDelete),CustemElement:c||(null==H?void 0:H.CustemElement),TextElement:f||(null==H?void 0:H.TextElement),ImageElement:E||(null==H?void 0:H.ImageElement),VideoElement:p||(null==H?void 0:H.VideoElement),AudioElement:h||(null==H?void 0:H.AudioElement),FileElement:x||(null==H?void 0:H.FileElement),MergerElement:M||(null==H?void 0:H.MergerElement),LocationElement:w||(null==H?void 0:H.LocationElement),FaceElement:C||(null==H?void 0:H.FaceElement),isShowTime:I||(null==H?void 0:H.isShowTime),isShowRead:P||(null==H?void 0:H.isShowRead),plugin:S||(null==H?void 0:H.plugin),prefix:A||(null==H?void 0:H.prefix),suffix:N||(null==H?void 0:H.suffix),customName:D||(null==H?void 0:H.customName),showAvatar:F||(null==H?void 0:H.showAvatar),showName:U||(null==H?void 0:H.showName),customAvatar:L||(null==H?void 0:H.customAvatar),isShowProgress:R||(null==H?void 0:H.isShowProgress),Progress:V||(null==H?void 0:H.Progress)};return o(l,e({value:K},{children:o(q,{message:J,MessageContext:B,MessagePlugins:z,className:j||(null==H?void 0:H.className)})}))}var d=s.memo(u);function g(s){var t=s.message,l=m({message:t}).handleDelMessage;return o(d,e({handleDelete:l},s))}export{g as TUIMessage};
1
+ import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import t from"react";import{useTUIChatStateContext as s}from"../../context/TUIChatStateContext.js";import{TUIMessageContextProvider as l}from"../../context/TUIMessageContext.js";import{useComponentContext as n}from"../../context/ComponentContext.js";import{useMessageHandler as m}from"./hooks/useMessageHandler.js";import"@tencentcloud/chat";import"../../constants.js";import"date-fns";import"../Icon/config.js";import"../Icon/type.js";import{TUIMessageDefault as i}from"./TUIMessageDefault.js";import{MessagePlugins as a}from"./MessagePlugins.js";import{MessageContext as r}from"./MessageContext.js";function u(t){var m=t.message,u=t.TUIMessage,d=t.MessagePlugins,g=t.MessageContext,v=t.handleDelete,c=t.CustemElement,f=t.TextElement,E=t.ImageElement,h=t.VideoElement,p=t.AudioElement,x=t.FileElement,M=t.MergerElement,w=t.LocationElement,C=t.FaceElement,j=t.className,T=t.filter,I=t.isShowTime,P=t.isShowRead,S=t.plugin,A=t.prefix,N=t.suffix,D=t.customName,F=t.showAvatar,U=t.showName,L=t.customAvatar,R=t.isShowProgress,V=t.Progress,b=n(),k=b.MessagePlugins,y=b.MessageContext,H=s("TUIMessage").messageConfig,q=u||i,z=d||k||a,B=g||y||r,G=T||(null==H?void 0:H.filter),J=m||(null==H?void 0:H.message);G&&G(J);var K={message:J,handleDelete:v||(null==H?void 0:H.handleDelete),CustemElement:c||(null==H?void 0:H.CustemElement),TextElement:f||(null==H?void 0:H.TextElement),ImageElement:E||(null==H?void 0:H.ImageElement),VideoElement:h||(null==H?void 0:H.VideoElement),AudioElement:p||(null==H?void 0:H.AudioElement),FileElement:x||(null==H?void 0:H.FileElement),MergerElement:M||(null==H?void 0:H.MergerElement),LocationElement:w||(null==H?void 0:H.LocationElement),FaceElement:C||(null==H?void 0:H.FaceElement),isShowTime:I||(null==H?void 0:H.isShowTime),isShowRead:P||(null==H?void 0:H.isShowRead),plugin:S||(null==H?void 0:H.plugin),prefix:A||(null==H?void 0:H.prefix),suffix:N||(null==H?void 0:H.suffix),customName:D||(null==H?void 0:H.customName),showAvatar:F||(null==H?void 0:H.showAvatar),showName:U||(null==H?void 0:H.showName),customAvatar:L||(null==H?void 0:H.customAvatar),isShowProgress:R||(null==H?void 0:H.isShowProgress),Progress:V||(null==H?void 0:H.Progress)};return o(l,e({value:K},{children:o(q,{message:J,MessageContext:B,MessagePlugins:z,className:j||(null==H?void 0:H.className)})}))}var d=t.memo(u);function g(t){var s=t.message,l=m({message:s}).handleDelMessage;return o(d,e({handleDelete:l},t))}export{g as TUIMessage};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as s,jsxs as o}from"react/jsx-runtime";import t from"react";import a from"tim-js-sdk";import{MessageBubble as m}from"./MessageBubble.js";import{MessageTip as i}from"./MessageTip.js";import{useTUIMessageContext as n,messageShowType as r}from"../../context/TUIMessageContext.js";import{useComponentContext as l}from"../../context/ComponentContext.js";import{MessageSystem as d}from"./MessageSystem.js";import{MessageRevoke as u}from"./MessageRevoke.js";import{MessageName as g}from"./MessageName.js";import{MessageAvatar as v}from"./MessageAvatar.js";function p(t){var p=t.message,c=t.MessageContext,f=t.MessagePlugins,M=t.className,P=l(),S=P.MessageContext,T=P.MessagePlugins,N=n("TUIMessage"),_=N.prefix,x=N.suffix,I=N.customName,j=N.showAvatar,C=void 0===j?r.IN:j,G=N.showName,R=void 0===G?r.IN:G,h=N.customAvatar,y=c||S,E=f||T;return o("div",e({className:"message-default\n ".concat((null==p?void 0:p.type)===a.TYPES.MSG_GRP_TIP||(null==p?void 0:p.isRevoked)?"tip":null==p?void 0:p.flow,"\n ").concat(M,"\n ")},{children:[(null==p?void 0:p.type)===a.TYPES.MSG_GRP_TIP&&s(i,{message:p}),(null==p?void 0:p.type)===a.TYPES.MSG_GRP_SYS_NOTICE&&s(d,{message:p}),(null==p?void 0:p.isRevoked)&&s(u,{message:p}),(null==p?void 0:p.type)!==a.TYPES.MSG_GRP_TIP&&(null==p?void 0:p.type)!==a.TYPES.MSG_GRP_SYS_NOTICE&&!(null==p?void 0:p.isRevoked)&&o("div",e({className:"".concat(null==p?void 0:p.flow),"data-message-id":null==p?void 0:p.ID},{children:[_,s(v,{message:p,CustomAvatar:h,showType:C}),o("main",e({className:"content"},{children:[s(g,{message:p,CustomName:I,showType:R}),s(m,e({message:p,Context:y,Plugins:E},{children:s(y,{message:p})}))]})),x]}),null==p?void 0:p.ID)]}))}var c=t.memo(p);function f(o){return o.message,s(c,e({},o))}export{f as TUIMessageDefault};
1
+ import{__assign as e}from"tslib";import{jsx as s,jsxs as o}from"react/jsx-runtime";import t from"react";import a from"@tencentcloud/chat";import{MessageBubble as m}from"./MessageBubble.js";import{MessageTip as i}from"./MessageTip.js";import{useTUIMessageContext as n,messageShowType as r}from"../../context/TUIMessageContext.js";import{useComponentContext as l}from"../../context/ComponentContext.js";import{MessageSystem as u}from"./MessageSystem.js";import{MessageRevoke as d}from"./MessageRevoke.js";import{MessageName as c}from"./MessageName.js";import{MessageAvatar as g}from"./MessageAvatar.js";function v(t){var v=t.message,p=t.MessageContext,f=t.MessagePlugins,M=t.className,P=l(),S=P.MessageContext,T=P.MessagePlugins,N=n("TUIMessage"),_=N.prefix,x=N.suffix,I=N.customName,C=N.showAvatar,G=void 0===C?r.IN:C,h=N.showName,j=void 0===h?r.IN:h,R=N.customAvatar,y=p||S,E=f||T;return o("div",e({className:"message-default\n ".concat((null==v?void 0:v.type)===a.TYPES.MSG_GRP_TIP||(null==v?void 0:v.isRevoked)?"tip":null==v?void 0:v.flow,"\n ").concat(M,"\n ")},{children:[(null==v?void 0:v.type)===a.TYPES.MSG_GRP_TIP&&s(i,{message:v}),(null==v?void 0:v.type)===a.TYPES.MSG_GRP_SYS_NOTICE&&s(u,{message:v}),(null==v?void 0:v.isRevoked)&&s(d,{message:v}),(null==v?void 0:v.type)!==a.TYPES.MSG_GRP_TIP&&(null==v?void 0:v.type)!==a.TYPES.MSG_GRP_SYS_NOTICE&&!(null==v?void 0:v.isRevoked)&&o("div",e({className:"".concat(null==v?void 0:v.flow)},{children:[_,s(g,{message:v,CustomAvatar:R,showType:G}),o("main",e({"data-message-id":null==v?void 0:v.ID,className:"content"},{children:[s(c,{message:v,CustomName:I,showType:j}),s(m,e({message:v,Context:y,Plugins:E},{children:s(y,{message:v})}))]})),x]}),null==v?void 0:v.ID)]}))}var p=t.memo(v);function f(o){return o.message,s(p,e({},o))}export{f as TUIMessageDefault};
@@ -1 +1 @@
1
- import e from"tim-js-sdk";import{translateGroupSystemNotice as a,handleTipMessageShowContext as S,handleLocationMessageShowContext as s,handleMergerMessageShowContext as r,handleCustomMessageShowContext as E,handleFileMessageShowContext as T,handleVideoMessageShowContext as G,handleAudioMessageShowContext as c,handleImageMessageShowContext as M,handleFaceMessageShowContext as P,handleTextMessageShowContext as _}from"../utils/index.js";var Y=function(Y){var k,t=Y.message;if(t)switch(null==t?void 0:t.type){case e.TYPES.MSG_TEXT:k=_(t);break;case e.TYPES.MSG_FACE:k=P(t);break;case e.TYPES.MSG_IMAGE:k=M(t);break;case e.TYPES.MSG_AUDIO:k=c(t);break;case e.TYPES.MSG_VIDEO:k=G(t);break;case e.TYPES.MSG_FILE:k=T(t);break;case e.TYPES.MSG_CUSTOM:k=E(t);break;case e.TYPES.MSG_MERGER:k=r(t);break;case e.TYPES.MSG_LOCATION:k=s(t);break;case e.TYPES.MSG_GRP_TIP:k=S(t);break;case e.TYPES.MSG_GRP_SYS_NOTICE:k=a(t)}return{context:k,message:t}};export{Y as useMessageContextHandler};
1
+ import e from"@tencentcloud/chat";import{translateGroupSystemNotice as a,handleTipMessageShowContext as S,handleLocationMessageShowContext as r,handleMergerMessageShowContext as E,handleCustomMessageShowContext as s,handleFileMessageShowContext as c,handleVideoMessageShowContext as T,handleAudioMessageShowContext as G,handleImageMessageShowContext as M,handleFaceMessageShowContext as P,handleTextMessageShowContext as _}from"../utils/index.js";var t=function(t){var Y,b=t.message;if(b)switch(null==b?void 0:b.type){case e.TYPES.MSG_TEXT:Y=_(b);break;case e.TYPES.MSG_FACE:Y=P(b);break;case e.TYPES.MSG_IMAGE:Y=M(b);break;case e.TYPES.MSG_AUDIO:Y=G(b);break;case e.TYPES.MSG_VIDEO:Y=T(b);break;case e.TYPES.MSG_FILE:Y=c(b);break;case e.TYPES.MSG_CUSTOM:Y=s(b);break;case e.TYPES.MSG_MERGER:Y=E(b);break;case e.TYPES.MSG_LOCATION:Y=r(b);break;case e.TYPES.MSG_GRP_TIP:Y=S(b);break;case e.TYPES.MSG_GRP_SYS_NOTICE:Y=a(b)}return{context:Y,message:b}};export{t as useMessageContextHandler};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from"tslib";import{useCallback as r}from"react";import{MESSAGE_FLOW as n,MESSAGE_OPERATE as o}from"../../../constants.js";import{useTUIKitContext as s}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as a}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{Toast as i}from"../../Toast/index.js";var u=function(u){var l=u.message,c=u.handleError,d=a(),v=d.removeMessage,f=d.editLocalmessage,m=d.operateMessage,p=d.revokeMessage,g=s("useDeleteHandler").tim,h=r((function(r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(r.preventDefault(),!(null==l?void 0:l.ID)||!g||!v)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,g.deleteMessage([l])];case 2:return t.sent(),v(l),[3,4];case 3:if(e=t.sent(),!c)throw i({text:"Error deleting message",type:"error"}),new Error(e);return c({functionName:"deleteMessage",error:e}),[3,4];case 4:return[2]}}))}))}),[l]),x=r((function(r){return e(void 0,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:if(r.preventDefault(),!(null==l?void 0:l.ID)||!g||!f)return[2];t.label=1;case 1:return t.trys.push([1,6,,7]),p?[4,p(l)]:[3,3];case 2:return t.sent(),[3,5];case 3:return[4,g.revokeMessage(l)];case 4:t.sent(),t.label=5;case 5:return f(l),[3,7];case 6:if(e=t.sent(),!c)throw o=l.flow===n.OUT?"The message recall exceeded the time limit (default 2 minutes)":"Error revoke Message",i({text:o,type:"error"}),new Error(e);return c({functionName:"revokeMessage",error:e}),[3,7];case 7:return[2]}}))}))}),[l]),M=r((function(e){var t;e.preventDefault(),(null==l?void 0:l.ID)&&g&&m&&m(((t={})[o.QUOTE]=l,t))}),[l]),y=r((function(e){if(e.preventDefault(),navigator.clipboard)navigator.clipboard.writeText(l.payload.text);else{var t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.value=l.payload.text,t.select(),document.execCommand("copy",!0),document.body.removeChild(t)}}),[l]),D=r((function(r){return e(void 0,void 0,void 0,(function(){var e,r,n;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,g.resendMessage(l)];case 1:return e=t.sent(),f(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.message),[3,3];case 2:if(r=t.sent(),!c)throw i({text:r,type:"error"}),new Error(r);return c({functionName:"resendMessage",error:r}),[3,3];case 3:return[2]}}))}))}),[l]),b=r((function(r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){return r.preventDefault(),(null==l?void 0:l.ID)&&g&&m?(m(((e={})[o.FORWARD]=l,e)),[2]):[2]}))}))}),[l]);return{handleDelMessage:h,handleRevokeMessage:x,handleReplyMessage:M,handleCopyMessage:y,handleResendMessage:D,handleForWardMessage:b}};export{u as useMessageHandler};
1
+ import{__awaiter as e,__generator as t}from"tslib";import{useCallback as r}from"react";import{MESSAGE_FLOW as n,MESSAGE_OPERATE as o}from"../../../constants.js";import{useTUIKitContext as s}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as a}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{Toast as i}from"../../Toast/index.js";var u=function(u){var l=u.message,c=u.handleError,d=a(),v=d.removeMessage,f=d.editLocalMessage,m=d.operateMessage,p=d.revokeMessage,h=s("useDeleteHandler").chat,g=r((function(r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(r.preventDefault(),!(null==l?void 0:l.ID)||!h||!v)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h.deleteMessage([l])];case 2:return t.sent(),v(l),[3,4];case 3:if(e=t.sent(),!c)throw i({text:"Error deleting message",type:"error"}),new Error(e);return c({functionName:"deleteMessage",error:e}),[3,4];case 4:return[2]}}))}))}),[l]),x=r((function(r){return e(void 0,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:if(r.preventDefault(),!(null==l?void 0:l.ID)||!h||!f)return[2];t.label=1;case 1:return t.trys.push([1,6,,7]),p?[4,p(l)]:[3,3];case 2:return t.sent(),[3,5];case 3:return[4,h.revokeMessage(l)];case 4:t.sent(),t.label=5;case 5:return f(l),[3,7];case 6:if(e=t.sent(),!c)throw o=l.flow===n.OUT?"The message recall exceeded the time limit (default 2 minutes)":"Error revoke Message",i({text:o,type:"error"}),new Error(e);return c({functionName:"revokeMessage",error:e}),[3,7];case 7:return[2]}}))}))}),[l]),M=r((function(e){var t;e.preventDefault(),(null==l?void 0:l.ID)&&h&&m&&m(((t={})[o.QUOTE]=l,t))}),[l]),y=r((function(e){if(e.preventDefault(),navigator.clipboard)navigator.clipboard.writeText(l.payload.text);else{var t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.value=l.payload.text,t.select(),document.execCommand("copy",!0),document.body.removeChild(t)}}),[l]),D=r((function(r){return e(void 0,void 0,void 0,(function(){var e,r,n;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,h.resendMessage(l)];case 1:return e=t.sent(),f(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.message),[3,3];case 2:if(r=t.sent(),!c)throw i({text:r,type:"error"}),new Error(r);return c({functionName:"resendMessage",error:r}),[3,3];case 3:return[2]}}))}))}),[l]),b=r((function(r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){return r.preventDefault(),(null==l?void 0:l.ID)&&h&&m?(m(((e={})[o.FORWARD]=l,e)),[2]):[2]}))}))}),[l]);return{handleDelMessage:g,handleRevokeMessage:x,handleReplyMessage:M,handleCopyMessage:y,handleResendMessage:D,handleForWardMessage:b}};export{u as useMessageHandler};
@@ -1 +1 @@
1
- import{useState as e,useLayoutEffect as t}from"react";import s from"tim-js-sdk";import{useTUIKitContext as o}from"../../../context/TUIKitContext.js";import{useTUIChatStateContext as a}from"../../../context/TUIChatStateContext.js";import"tslib";import"react/jsx-runtime";import"../../../context/TUIMessageContext.js";import{JSONStringToParse as r}from"../../untils.js";var i,m=((i={})[s.TYPES.MSG_TEXT]=1,i[s.TYPES.MSG_FACE]=8,i[s.TYPES.MSG_IMAGE]=3,i[s.TYPES.MSG_AUDIO]=4,i[s.TYPES.MSG_VIDEO]=5,i[s.TYPES.MSG_FILE]=6,i[s.TYPES.MSG_CUSTOM]=2,i),n=function(i){var n=i.message,l=e(null),u=l[0],S=l[1],T=e(""),p=T[0],g=T[1],d=e(null),E=d[0],M=d[1],f=e(""),v=f[0],I=f[1],c=o("TUIChat").tim,x=a("useMessageReply").messageList;t((function(){C(n)}),[n]);var C=function(e){if(null==e?void 0:e.cloudCustomData){var t=r(null==n?void 0:n.cloudCustomData),o=(null==t?void 0:t.messageReply)||"";if(o){S(o),g(null==o?void 0:o.messageSender),I(null==o?void 0:o.messageID);var a=x.filter((function(e){var t=e.ID===(null==o?void 0:o.messageID),a=t&&m[e.type]===o.messageType,r=e.type!==s.TYPES.MSG_TEXT||e.payload.text===o.messageAbstract;return t&&a&&r}));M(a[0]||c.findMessage(null==o?void 0:o.messageID))}}};return{messageReply:u,sender:p,replyMessage:E,messageID:v,message:n}};export{n as useMessageReply};
1
+ import{useState as e,useLayoutEffect as t}from"react";import s from"@tencentcloud/chat";import{useTUIKitContext as o}from"../../../context/TUIKitContext.js";import{useTUIChatStateContext as a}from"../../../context/TUIChatStateContext.js";import"tslib";import"react/jsx-runtime";import"../../../context/TUIMessageContext.js";import{JSONStringToParse as n}from"../../untils.js";var r,l=((r={})[s.TYPES.MSG_TEXT]=1,r[s.TYPES.MSG_FACE]=8,r[s.TYPES.MSG_IMAGE]=3,r[s.TYPES.MSG_AUDIO]=4,r[s.TYPES.MSG_VIDEO]=5,r[s.TYPES.MSG_FILE]=6,r[s.TYPES.MSG_CUSTOM]=2,r),i=function(r){var i=r.message,m=e(null),u=m[0],S=m[1],T=e(""),p=T[0],c=T[1],g=e(null),d=g[0],E=g[1],M=e(""),f=M[0],v=M[1],I=o("TUIChat").chat,x=a("useMessageReply").messageList;t((function(){C(i)}),[i]);var C=function(e){if(null==e?void 0:e.cloudCustomData){var t=n(null==i?void 0:i.cloudCustomData),o=(null==t?void 0:t.messageReply)||"";if(o){S(o),c(null==o?void 0:o.messageSender),v(null==o?void 0:o.messageID);var a=x.filter((function(e){var t=e.ID===(null==o?void 0:o.messageID),a=t&&l[e.type]===o.messageType,n=e.type!==s.TYPES.MSG_TEXT||e.payload.text===o.messageAbstract;return t&&a&&n}));E(a[0]||I.findMessage(null==o?void 0:o.messageID))}}};return{messageReply:u,sender:p,replyMessage:d,messageID:f,message:i}};export{i as useMessageReply};
@@ -1 +1 @@
1
- import{__assign as a}from"tslib";import t from"tim-js-sdk";import{decodeText as e}from"./decodeText.js";import{MESSAGE_STATUS as c}from"../../../constants.js";import{JSONStringToParse as o}from"../../untils.js";function n(a){var t=a.split(".");return t[t.length-1]}function s(a){var e,c,o,s,r,i={message:a,text:""},p=a.nick||(null===(e=null==a?void 0:a.payload)||void 0===e?void 0:e.userIDList.join(","));switch((null===(o=null===(c=null==a?void 0:a.payload)||void 0===c?void 0:c.memberList)||void 0===o?void 0:o.length)>0&&(p="",null===(r=null===(s=null==a?void 0:a.payload)||void 0===s?void 0:s.memberList)||void 0===r||r.map((function(a){return p+="".concat((null==a?void 0:a.nick)||(null==a?void 0:a.userID),","),a})),p=p.slice(0,-1)),a.payload.operationType){case t.TYPES.GRP_TIP_MBR_JOIN:i.text="".concat(p," ").concat(n("message.tip.Join in group"));break;case t.TYPES.GRP_TIP_MBR_QUIT:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.quit group"));break;case t.TYPES.GRP_TIP_MBR_KICKED_OUT:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.by")).concat(a.payload.operatorID).concat(n("message.tip.kicked out of group"));break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.become admin"));break;case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.by revoked administrator"));break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:i.text=function(a){var t=a.payload,e=t.newGroupProfile,c=t.operatorID,o="",s=Object.keys(e)[0];switch(s){case"muteAllMembers":o=e[s]?"".concat(n("message.tip.admin")," ").concat(c," ").concat(n("message.tip.enable all staff mute")):"".concat(n("message.tip.admin")," ").concat(c," ").concat(n("message.tip.unmute everyone"));break;case"ownerID":o="".concat(e[s]," ").concat(n("message.tip.become the new owner"));break;case"groupName":o="".concat(c," ").concat(n("message.tip.modify group name")," ").concat(e[s]);break;case"notification":o="".concat(c," ").concat(n("message.tip.post a new announcement"))}return o}(a);break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:a.payload.memberList.map((function(a){return a.muteTime>0?i.text="".concat(n("message.tip.member"),":").concat(a.userID).concat(n("message.tip.muted")):i.text="".concat(n("message.tip.member"),":").concat(a.userID).concat(n("message.tip.unmuted")),a}));break;default:i.text="[".concat(n("message.tip.reminder message"),"]")}return i}function r(a){return{text:e(a.payload)}}function i(a){var t={message:a,name:"",url:""};return t.name=a.payload.data,a.payload.data.indexOf("@2x")<0&&(t.name="".concat(t.name,"@2x")),t.url="https://web.sdk.qcloud.com/im/assets/face-elem/".concat(t.name,".png"),t}function p(a){var t={lon:"",lat:"",href:"",url:"",description:"",message:a};return t.lon=a.payload.longitude.toFixed(6),t.lat=a.payload.latitude.toFixed(6),t.href="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&"+"pointx=".concat(t.lon,"&pointy=").concat(t.lat,"&name=").concat(a.payload.description),t.url="https://apis.map.qq.com/ws/staticmap/v2/?"+"center=".concat(t.lat,",").concat(t.lon,"&zoom=10&size=300*150&maptype=roadmap&")+"markers=size:large|color:0xFFCCFF|label:k|".concat(t.lat,",").concat(t.lon,"&")+"key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD",t.description=a.payload.description,t}function m(a){return{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.imageInfoArray[1].url,message:a}}function l(a){var t,e;return{progress:(null==a?void 0:a.status)===c.UNSEND&&(null==a?void 0:a.progress),url:null===(t=null==a?void 0:a.payload)||void 0===t?void 0:t.videoUrl,snapshotUrl:null===(e=null==a?void 0:a.payload)||void 0===e?void 0:e.snapshotUrl,message:a}}function u(a){return{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.url,message:a,second:a.payload.second}}function d(a){var t="";return t=a.payload.fileSize>=1048576?"".concat((a.payload.fileSize/1048576).toFixed(2)," Mb"):a.payload.fileSize>=1024?"".concat((a.payload.fileSize/1024).toFixed(2)," Kb"):"".concat(a.payload.fileSize.toFixed(2),"B"),{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.fileUrl,message:a,name:a.payload.fileName,size:t}}function g(t){return a({message:t},t.payload)}function y(a){var t={},e={};try{t=o(a.payload.data)}catch(a){t={}}if(1!==t.businessID)return"";try{e=o(t.data)}catch(a){e={}}switch(t.actionType){case 1:return e.call_end>=0&&!t.groupID?"".concat(n("message.custom.talkTime"),":").concat(v(e.call_end)):t.groupID?"".concat(n("message.custom.groupCallEnd")):e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.all"));case 2:return"".concat(n("message.custom.cancel"));case 3:return e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.accepted"));case 4:return"".concat(n("message.custom.rejected"));case 5:return e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.noResp"));default:return""}}function f(a){return{message:a,custom:y(a)||(null==a?void 0:a.payload)||"[".concat(n("message.custom.custom"),"]")}}function I(a){var t=a.payload.groupProfile.name||a.payload.groupProfile.groupID;switch(a.payload.operationType){case 1:return"".concat(a.payload.operatorID," ").concat(n("message.tip.申请加入群组"),":").concat(t);case 2:return"".concat(n("message.tip.成功加入群组"),":").concat(t);case 3:return"".concat(n("message.tip.申请加入群组"),":").concat(t," ").concat(n("message.tip.被拒绝"));case 4:return"".concat(n("message.tip.你被管理员")).concat(a.payload.operatorID," ").concat(n("message.tip.踢出群组"),":").concat(t);case 5:return"".concat(n("message.tip.群"),":").concat(t," ").concat(n("message.tip.被")," ").concat(a.payload.operatorID," ").concat(n("message.tip.解散"));case 6:return"".concat(a.payload.operatorID," ").concat(n("message.tip.创建群"),":").concat(t);case 7:case 12:return"".concat(a.payload.operatorID," ").concat(n("message.tip.邀请你加群"),":").concat(t);case 8:return"".concat(n("message.tip.你退出群组"),":").concat(t);case 9:return"".concat(n("message.tip.你被")).concat(a.payload.operatorID," ").concat(n("message.tip.设置为群"),":").concat(t," ").concat(n("message.tip.的管理员"));case 10:return"".concat(n("message.tip.你被")).concat(a.payload.operatorID," ").concat(n("message.tip.撤销群"),":").concat(t," ").concat(n("message.tip.的管理员身份"));case 13:return"".concat(a.payload.operatorID," ").concat(n("message.tip.同意加群"),":").concat(t);case 14:return"".concat(a.payload.operatorID," ").concat(n("message.tip.拒接加群"),":").concat(t);case 255:return"".concat(n("message.tip.自定义群系统通知"),": ").concat(a.payload.userDefinedField);default:return""}}function v(a){var t,e,c,o,n=a;return n>=3600?(e=parseInt("".concat(n/3600),10)<10?"0".concat(parseInt("".concat(n/3600),10)):parseInt("".concat(n/3600),10),c=parseInt("".concat(n%60/60),10)<10?"0".concat(parseInt("".concat(n%60/60),10)):parseInt("".concat(n%60/60),10),(o=n%3600<10?"0".concat(n%3600):n%3600)>60&&(c=parseInt("".concat(o/60),10)<10?"0".concat(parseInt("".concat(o/60),10)):parseInt("".concat(o/60),10),o=o%60<10?"0".concat(o%60):o%60),t="".concat(e,":").concat(c,":").concat(o)):n>=60&&n<3600?(c=parseInt("".concat(n/60),10)<10?"0".concat(parseInt("".concat(n/60),10)):parseInt("".concat(n/60),10),o=n%60<10?"0".concat(n%60):n%60,t="00:".concat(c,":").concat(o)):n<60&&(o=n<10?"0".concat(n):n,t="00:00:".concat(o)),t}export{y as extractCallingInfoFromMessage,v as formatTime,u as handleAudioMessageShowContext,f as handleCustomMessageShowContext,i as handleFaceMessageShowContext,d as handleFileMessageShowContext,m as handleImageMessageShowContext,p as handleLocationMessageShowContext,g as handleMergerMessageShowContext,r as handleTextMessageShowContext,s as handleTipMessageShowContext,l as handleVideoMessageShowContext,I as translateGroupSystemNotice};
1
+ import{__assign as a}from"tslib";import t from"@tencentcloud/chat";import{decodeText as e}from"./decodeText.js";import{MESSAGE_STATUS as c}from"../../../constants.js";import{JSONStringToParse as o}from"../../untils.js";function n(a){var t=a.split(".");return t[t.length-1]}function s(a){var e,c,o,s,r,i={message:a,text:""},p=a.nick||(null===(e=null==a?void 0:a.payload)||void 0===e?void 0:e.userIDList.join(","));switch((null===(o=null===(c=null==a?void 0:a.payload)||void 0===c?void 0:c.memberList)||void 0===o?void 0:o.length)>0&&(p="",null===(r=null===(s=null==a?void 0:a.payload)||void 0===s?void 0:s.memberList)||void 0===r||r.map((function(a){return p+="".concat((null==a?void 0:a.nick)||(null==a?void 0:a.userID),","),a})),p=p.slice(0,-1)),a.payload.operationType){case t.TYPES.GRP_TIP_MBR_JOIN:i.text="".concat(p," ").concat(n("message.tip.Join in group"));break;case t.TYPES.GRP_TIP_MBR_QUIT:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.quit group"));break;case t.TYPES.GRP_TIP_MBR_KICKED_OUT:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.by")).concat(a.payload.operatorID).concat(n("message.tip.kicked out of group"));break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.become admin"));break;case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:i.text="".concat(n("message.tip.member"),":").concat(p," ").concat(n("message.tip.by revoked administrator"));break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:i.text=function(a){var t=a.payload,e=t.newGroupProfile,c=t.operatorID,o="",s=Object.keys(e)[0];switch(s){case"muteAllMembers":o=e[s]?"".concat(n("message.tip.admin")," ").concat(c," ").concat(n("message.tip.enable all staff mute")):"".concat(n("message.tip.admin")," ").concat(c," ").concat(n("message.tip.unmute everyone"));break;case"ownerID":o="".concat(e[s]," ").concat(n("message.tip.become the new owner"));break;case"groupName":o="".concat(c," ").concat(n("message.tip.modify group name")," ").concat(e[s]);break;case"notification":o="".concat(c," ").concat(n("message.tip.post a new announcement"))}return o}(a);break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:a.payload.memberList.map((function(a){return a.muteTime>0?i.text="".concat(n("message.tip.member"),":").concat(a.userID).concat(n("message.tip.muted")):i.text="".concat(n("message.tip.member"),":").concat(a.userID).concat(n("message.tip.unmuted")),a}));break;default:i.text="[".concat(n("message.tip.reminder message"),"]")}return i}function r(a){return{text:e(a.payload)}}function i(a){var t={message:a,name:"",url:""};return t.name=a.payload.data,a.payload.data.indexOf("@2x")<0&&(t.name="".concat(t.name,"@2x")),t.url="https://web.sdk.qcloud.com/im/assets/face-elem/".concat(t.name,".png"),t}function p(a){var t={lon:"",lat:"",href:"",url:"",description:"",message:a};return t.lon=a.payload.longitude.toFixed(6),t.lat=a.payload.latitude.toFixed(6),t.href="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&"+"pointx=".concat(t.lon,"&pointy=").concat(t.lat,"&name=").concat(a.payload.description),t.url="https://apis.map.qq.com/ws/staticmap/v2/?"+"center=".concat(t.lat,",").concat(t.lon,"&zoom=10&size=300*150&maptype=roadmap&")+"markers=size:large|color:0xFFCCFF|label:k|".concat(t.lat,",").concat(t.lon,"&")+"key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD",t.description=a.payload.description,t}function m(a){return{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.imageInfoArray[1].url,message:a}}function l(a){var t,e;return{progress:(null==a?void 0:a.status)===c.UNSEND&&(null==a?void 0:a.progress),url:null===(t=null==a?void 0:a.payload)||void 0===t?void 0:t.videoUrl,snapshotUrl:null===(e=null==a?void 0:a.payload)||void 0===e?void 0:e.snapshotUrl,message:a}}function u(a){return{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.url,message:a,second:a.payload.second}}function d(a){var t="";return t=a.payload.fileSize>=1048576?"".concat((a.payload.fileSize/1048576).toFixed(2)," Mb"):a.payload.fileSize>=1024?"".concat((a.payload.fileSize/1024).toFixed(2)," Kb"):"".concat(a.payload.fileSize.toFixed(2),"B"),{progress:(null==a?void 0:a.status)===c.UNSEND&&a.progress,url:a.payload.fileUrl,message:a,name:a.payload.fileName,size:t}}function g(t){return a({message:t},t.payload)}function y(a){var t={},e={};try{t=o(a.payload.data)}catch(a){t={}}if(1!==t.businessID)return"";try{e=o(t.data)}catch(a){e={}}switch(t.actionType){case 1:return e.call_end>=0&&!t.groupID?"".concat(n("message.custom.talkTime"),":").concat(v(e.call_end)):t.groupID?"".concat(n("message.custom.groupCallEnd")):e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.all"));case 2:return"".concat(n("message.custom.cancel"));case 3:return e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.accepted"));case 4:return"".concat(n("message.custom.rejected"));case 5:return e.data&&"switchToAudio"===e.data.cmd?"".concat(n("message.custom.switchToAudioCall")):e.data&&"switchToVideo"===e.data.cmd?"".concat(n("message.custom.switchToVideoCall")):"".concat(n("message.custom.noResp"));default:return""}}function f(a){return{message:a,custom:y(a)||(null==a?void 0:a.payload)||"[".concat(n("message.custom.custom"),"]")}}function I(a){var t=a.payload.groupProfile.name||a.payload.groupProfile.groupID;switch(a.payload.operationType){case 1:return"".concat(a.payload.operatorID," ").concat(n("message.tip.申请加入群组"),":").concat(t);case 2:return"".concat(n("message.tip.成功加入群组"),":").concat(t);case 3:return"".concat(n("message.tip.申请加入群组"),":").concat(t," ").concat(n("message.tip.被拒绝"));case 4:return"".concat(n("message.tip.你被管理员")).concat(a.payload.operatorID," ").concat(n("message.tip.踢出群组"),":").concat(t);case 5:return"".concat(n("message.tip.群"),":").concat(t," ").concat(n("message.tip.被")," ").concat(a.payload.operatorID," ").concat(n("message.tip.解散"));case 6:return"".concat(a.payload.operatorID," ").concat(n("message.tip.创建群"),":").concat(t);case 7:case 12:return"".concat(a.payload.operatorID," ").concat(n("message.tip.邀请你加群"),":").concat(t);case 8:return"".concat(n("message.tip.你退出群组"),":").concat(t);case 9:return"".concat(n("message.tip.你被")).concat(a.payload.operatorID," ").concat(n("message.tip.设置为群"),":").concat(t," ").concat(n("message.tip.的管理员"));case 10:return"".concat(n("message.tip.你被")).concat(a.payload.operatorID," ").concat(n("message.tip.撤销群"),":").concat(t," ").concat(n("message.tip.的管理员身份"));case 13:return"".concat(a.payload.operatorID," ").concat(n("message.tip.同意加群"),":").concat(t);case 14:return"".concat(a.payload.operatorID," ").concat(n("message.tip.拒接加群"),":").concat(t);case 255:return"".concat(n("message.tip.自定义群系统通知"),": ").concat(a.payload.userDefinedField);default:return""}}function v(a){var t,e,c,o,n=a;return n>=3600?(e=parseInt("".concat(n/3600),10)<10?"0".concat(parseInt("".concat(n/3600),10)):parseInt("".concat(n/3600),10),c=parseInt("".concat(n%60/60),10)<10?"0".concat(parseInt("".concat(n%60/60),10)):parseInt("".concat(n%60/60),10),(o=n%3600<10?"0".concat(n%3600):n%3600)>60&&(c=parseInt("".concat(o/60),10)<10?"0".concat(parseInt("".concat(o/60),10)):parseInt("".concat(o/60),10),o=o%60<10?"0".concat(o%60):o%60),t="".concat(e,":").concat(c,":").concat(o)):n>=60&&n<3600?(c=parseInt("".concat(n/60),10)<10?"0".concat(parseInt("".concat(n/60),10)):parseInt("".concat(n/60),10),o=n%60<10?"0".concat(n%60):n%60,t="00:".concat(c,":").concat(o)):n<60&&(o=n<10?"0".concat(n):n,t="00:00:".concat(o)),t}export{y as extractCallingInfoFromMessage,v as formatTime,u as handleAudioMessageShowContext,f as handleCustomMessageShowContext,i as handleFaceMessageShowContext,d as handleFileMessageShowContext,m as handleImageMessageShowContext,p as handleLocationMessageShowContext,g as handleMergerMessageShowContext,r as handleTextMessageShowContext,s as handleTipMessageShowContext,l as handleVideoMessageShowContext,I as translateGroupSystemNotice};
@@ -1 +1 @@
1
- import{__assign as t}from"tslib";import{jsx as e,jsxs as s}from"react/jsx-runtime";import o from"react";import n from"tim-js-sdk";import{TUIMessageInputContextProvider as r}from"../../context/TUIMessageInputContext.js";import{useCreateMessageInputContext as i}from"./hooks/useCreateMessageInputContext.js";import{useMessageInputState as a}from"./hooks/useMessageInputState.js";import"../../constants.js";import{useTUIChatStateContext as u}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as m}from"../../context/ComponentContext.js";import"./hooks/useHandleQuoteMessage.js";import{EmptyStateIndicator as p}from"../EmptyStateIndicator/EmptyStateIndicator.js";import{InputQuoteDefalut as l}from"./InputQuoteDefalut.js";import{TUIMessageInputDefault as f}from"./TUIMessageInputDefault.js";import{InputPluginsDefalut as I}from"./InputPluginsDefalut.js";import{TUIForward as c}from"./TUIForward.js";import{Transmitter as d}from"./Transmitter.js";function g(s){var o=s.children,m=s.disabled,p=s.focus,l=s.pluginConfig,f=s.textareaRef,I=a(s),c=u("TUIMessageInput"),d=c.textareaRef,g=c.conversation,T=(null==g?void 0:g.type)===n.TYPES.CONV_SYSTEM,j=u("TUIMessageInput").TUIMessageInputConfig,x=p||(null==j?void 0:j.focus),v=i(t(t(t({},I),s),{textareaRef:f||(null==j?void 0:j.textareaRef)||d,disabled:m||(null==j?void 0:j.disabled)||T,focus:"boolean"!=typeof x||x,pluginConfig:l}));return e(r,t({value:v},{children:o}))}function T(o){var n=o.TUIMessageInput,r=o.InputPlugins,i=o.InputQuote,a=o.isTransmitter,T=o.className,j=u("TUIMessageInput").TUIMessageInputConfig,x=T||(null==j?void 0:j.className),v=a||(null==j?void 0:j.isTransmitter)||!1,M=m(),C=M.TUIMessageInput,U=M.InputPlugins,h=M.InputQuote,S=n||C||f,b=r||U||I||p,N=i||h||l;return e("div",t({className:"tui-message-input ".concat(x)},{children:s(g,t({},o,{children:[e(c,{}),e(N,{}),s("div",t({className:"tui-message-input-main"},{children:[s("div",t({className:"tui-message-input-box"},{children:[e(b,{}),e(S,{})]})),v&&e(d,{})]}))]}))}))}var j=o.memo(T);export{j as TUIMessageInput};
1
+ import{__assign as t}from"tslib";import{jsx as e,jsxs as o}from"react/jsx-runtime";import s from"react";import n from"@tencentcloud/chat";import{TUIMessageInputContextProvider as r}from"../../context/TUIMessageInputContext.js";import{useCreateMessageInputContext as a}from"./hooks/useCreateMessageInputContext.js";import{useMessageInputState as i}from"./hooks/useMessageInputState.js";import"../../constants.js";import{useTUIChatStateContext as u}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as m}from"../../context/ComponentContext.js";import"./hooks/useHandleQuoteMessage.js";import{EmptyStateIndicator as p}from"../EmptyStateIndicator/EmptyStateIndicator.js";import{InputQuoteDefalut as l}from"./InputQuoteDefalut.js";import{TUIMessageInputDefault as f}from"./TUIMessageInputDefault.js";import{InputPluginsDefalut as c}from"./InputPluginsDefalut.js";import{TUIForward as I}from"./TUIForward.js";import{Transmitter as d}from"./Transmitter.js";function g(o){var s=o.children,m=o.disabled,p=o.focus,l=o.pluginConfig,f=o.textareaRef,c=i(o),I=u("TUIMessageInput"),d=I.textareaRef,g=I.conversation,T=(null==g?void 0:g.type)===n.TYPES.CONV_SYSTEM,x=u("TUIMessageInput").TUIMessageInputConfig,j=p||(null==x?void 0:x.focus),v=a(t(t(t({},c),o),{textareaRef:f||(null==x?void 0:x.textareaRef)||d,disabled:m||(null==x?void 0:x.disabled)||T,focus:"boolean"!=typeof j||j,pluginConfig:l}));return e(r,t({value:v},{children:s}))}function T(s){var n=s.TUIMessageInput,r=s.InputPlugins,a=s.InputQuote,i=s.isTransmitter,T=s.className,x=u("TUIMessageInput").TUIMessageInputConfig,j=T||(null==x?void 0:x.className),v=i||(null==x?void 0:x.isTransmitter)||!1,M=m(),C=M.TUIMessageInput,U=M.InputPlugins,h=M.InputQuote,S=n||C||f,b=r||U||c||p,N=a||h||l;return e("div",t({className:"tui-message-input ".concat(j)},{children:o(g,t({},s,{children:[e(I,{}),e(N,{}),o("div",t({className:"tui-message-input-main"},{children:[o("div",t({className:"tui-message-input-box"},{children:[e(b,{}),e(S,{})]})),v&&e(d,{})]}))]}))}))}var x=s.memo(T);export{x as TUIMessageInput};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from"tslib";import{useState as o,useEffect as n}from"react";import r from"tim-js-sdk";import{MESSAGE_OPERATE as s}from"../../../constants.js";import{useTUIKitContext as i}from"../../../context/TUIKitContext.js";import{useTUIChatStateContext as a}from"../../../context/TUIChatStateContext.js";import{useTUIChatActionContext as c}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import"react/jsx-runtime";function m(m){var u=this,f=a("TUIMessageInputDefault").operateData,p=o([]),v=p[0],d=p[1],x=c(),l=x.sendMessage,C=x.createForwardMessage,g=i("TUIChat").tim,T=m||f[s.FORWARD];return n((function(){t(u,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,g.getConversationList()];case 1:return t=e.sent(),d(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.conversationList.filter((function(t){return t.type!==r.TYPES.CONV_SYSTEM}))),[2]}}))}))}),[g]),{message:T,conversationList:v,sendForwardMessage:function(t){t.map((function(t){var e=C({conversation:t,message:T});return l(e),t}))}}}export{m as useHandleForwardMessage};
1
+ import{__awaiter as t,__generator as e}from"tslib";import{useState as o,useEffect as n}from"react";import r from"@tencentcloud/chat";import{MESSAGE_OPERATE as s}from"../../../constants.js";import{useTUIKitContext as a}from"../../../context/TUIKitContext.js";import{useTUIChatStateContext as i}from"../../../context/TUIChatStateContext.js";import{useTUIChatActionContext as c}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import"react/jsx-runtime";function m(m){var u=this,f=i("TUIMessageInputDefault").operateData,p=o([]),v=p[0],d=p[1],l=c(),x=l.sendMessage,C=l.createForwardMessage,g=a("TUIChat").chat,h=m||f[s.FORWARD];return n((function(){t(u,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,g.getConversationList()];case 1:return t=e.sent(),d(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.conversationList.filter((function(t){return t.type!==r.TYPES.CONV_SYSTEM}))),[2]}}))}))}),[g]),{message:h,conversationList:v,sendForwardMessage:function(t){t.map((function(t){var e=C({conversation:t,message:h});return x(e),t}))}}}export{m as useHandleForwardMessage};
@@ -1 +1 @@
1
- import{useState as e,useEffect as t}from"react";import o from"tim-js-sdk";import{MESSAGE_OPERATE as s}from"../../../constants.js";import"tslib";import"react/jsx-runtime";import{useTUIChatStateContext as a}from"../../../context/TUIChatStateContext.js";import"../../../context/TUIMessageContext.js";var S,n,i=((S={})[o.TYPES.MSG_TEXT]=1,S[o.TYPES.MSG_CUSTOM]=2,S[o.TYPES.MSG_IMAGE]=3,S[o.TYPES.MSG_AUDIO]=4,S[o.TYPES.MSG_VIDEO]=5,S[o.TYPES.MSG_FILE]=6,S[o.TYPES.MSG_FACE]=8,S),l=((n={})[o.TYPES.MSG_CUSTOM]="[custom]",n[o.TYPES.MSG_IMAGE]="[image]",n[o.TYPES.MSG_AUDIO]="[audio]",n[o.TYPES.MSG_VIDEO]="[video]",n[o.TYPES.MSG_FILE]="[file]",n[o.TYPES.MSG_FACE]="[face]",n);function r(S){var n=a("TUIMessageInputDefault").operateData,r=e({messageReply:null}),E=r[0],T=r[1],m=function(e){var t,s=i[null==e?void 0:e.type];return{messageAbstract:(null==e?void 0:e.type)===o.TYPES.MSG_TEXT?null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text:l[null==e?void 0:e.type],messageSender:(null==e?void 0:e.nick)||(null==e?void 0:e.from),messageID:null==e?void 0:e.ID,messageType:s,version:1}};return t((function(){var e=S||n[s.QUOTE];T({messageReply:e?m(e):null})}),[n,S]),{cloudCustomData:E,handleQuoteMessage:m,message:S||n[s.QUOTE]}}export{r as useHandleQuoteMessage};
1
+ import{useState as e,useEffect as t}from"react";import o from"@tencentcloud/chat";import{MESSAGE_OPERATE as a}from"../../../constants.js";import"tslib";import"react/jsx-runtime";import{useTUIChatStateContext as n}from"../../../context/TUIChatStateContext.js";import"../../../context/TUIMessageContext.js";var S,s,l=((S={})[o.TYPES.MSG_TEXT]=1,S[o.TYPES.MSG_CUSTOM]=2,S[o.TYPES.MSG_IMAGE]=3,S[o.TYPES.MSG_AUDIO]=4,S[o.TYPES.MSG_VIDEO]=5,S[o.TYPES.MSG_FILE]=6,S[o.TYPES.MSG_FACE]=8,S),r=((s={})[o.TYPES.MSG_CUSTOM]="[custom]",s[o.TYPES.MSG_IMAGE]="[image]",s[o.TYPES.MSG_AUDIO]="[audio]",s[o.TYPES.MSG_VIDEO]="[video]",s[o.TYPES.MSG_FILE]="[file]",s[o.TYPES.MSG_FACE]="[face]",s);function i(S){var s=n("TUIMessageInputDefault").operateData,i=e({messageReply:null}),E=i[0],T=i[1],u=function(e){var t,a=l[null==e?void 0:e.type];return{messageAbstract:(null==e?void 0:e.type)===o.TYPES.MSG_TEXT?null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text:r[null==e?void 0:e.type],messageSender:(null==e?void 0:e.nick)||(null==e?void 0:e.from),messageID:null==e?void 0:e.ID,messageType:a,version:1}};return t((function(){var e=S||s[a.QUOTE];T({messageReply:e?u(e):null})}),[s,S]),{cloudCustomData:E,handleQuoteMessage:u,message:S||s[a.QUOTE]}}export{i as useHandleQuoteMessage};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from"tslib";import{useCallback as n}from"react";import{CONSTANT_DISPATCH_TYPE as r,MESSAGE_TYPE_NAME as o,MESSAGE_OPERATE as a}from"../../../constants.js";import{useTUIKitContext as i}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as u}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{formatEmojiString as s}from"../../TUIMessage/utils/emojiMap.js";import{useHandleQuoteMessage as c}from"./useHandleQuoteMessage.js";var l=function(l){var f=l.state,d=l.dispatch;l.focus;var p=l.textareaRef,T=l.sendUploadMessage,v=i("useMessageInputText").tim,m=u(),g=m.sendMessage,x=m.createTextMessage,y=m.operateMessage,E=c().cloudCustomData,S=["Enter","NumpadEnter"],h=n((function(t){t.preventDefault(),t&&t.target&&d({type:r.SET_TEXT,getNewText:function(e){return t.target.value}})}),[v]),C=function(n){return t(void 0,void 0,void 0,(function(){var t,o,i;return e(this,(function(e){switch(e.label){case 0:return null==n||n.preventDefault(),f.text?(t={payload:{text:s(f.text)}},E.messageReply&&(t.cloudCustomData=JSON.stringify(E)),o=x(t),[4,g(o)]):[2];case 1:return e.sent(),d({getNewText:function(t){return""},type:r.SET_TEXT}),y(((i={})[a.QUOTE]=null,i)),[2]}}))}))},D=n((function(t){!(null==t?void 0:t.ctrlKey)&&S.indexOf(null==t?void 0:t.code)>-1&&13===t.keyCode&&(null==t||t.preventDefault(),C(t)),(null==t?void 0:t.ctrlKey)&&S.indexOf(null==t?void 0:t.code)>-1&&13===t.keyCode&&d({type:r.SET_TEXT,getNewText:function(t){return"".concat(t,"\n")}})}),[C,d]),M=n((function(n){return t(void 0,void 0,void 0,(function(){var t,a,i;return e(this,(function(e){return n.preventDefault(),n.clipboardData&&n.clipboardData.items?(t=n.clipboardData,a=t.types,i=t.items,a.find((function(t,e){var n=i[e];switch(t){case"text/plain":return n.getAsString((function(t){d({type:r.SET_TEXT,getNewText:function(e){return"".concat(e).concat(t)}})})),!0;case"Files":var a=n.getAsFile();return n&&"file"===n.kind&&n.type.match(/^image\//i)&&T({file:a},o.IMAGE),!0;default:return!1}})),[2]):[2]}))}))}),[p]),_=n((function(t){var e;d({type:r.SET_TEXT,getNewText:function(e){return"".concat(e.slice(0,f.cursorPos.start)).concat(t).concat(e.slice(f.cursorPos.start))}}),d({type:r.SET_CURSOR_POS,value:{start:f.cursorPos.start+t.length,end:f.cursorPos.end+t.length}}),null===(e=null==p?void 0:p.current)||void 0===e||e.focus()}),[p,f]),w=n((function(t){var e;d({type:r.SET_TEXT,getNewText:function(){return"".concat(t)}}),null===(e=null==p?void 0:p.current)||void 0===e||e.focus()}),[p]),j=n((function(t){d({type:r.SET_CURSOR_POS,value:t})}),[p]);return{handleChange:h,handleSubmit:C,handleKeyDown:D,handlePasete:M,insertText:_,setText:w,setCursorPos:j}};export{l as useMessageInputText};
1
+ import{__awaiter as t,__generator as e}from"tslib";import{useCallback as n}from"react";import{CONSTANT_DISPATCH_TYPE as r,MESSAGE_TYPE_NAME as o,MESSAGE_OPERATE as a}from"../../../constants.js";import{useTUIKitContext as u}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as i}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{formatEmojiString as s}from"../../TUIMessage/utils/emojiMap.js";import{useHandleQuoteMessage as c}from"./useHandleQuoteMessage.js";var l=function(l){var f=l.state,d=l.dispatch;l.focus;var p=l.textareaRef,T=l.sendUploadMessage,v=u("useMessageInputText").chat,m=i(),g=m.sendMessage,x=m.createTextMessage,y=m.operateMessage,E=c().cloudCustomData,h=["Enter","NumpadEnter"],S=n((function(t){t.preventDefault(),t&&t.target&&d({type:r.SET_TEXT,getNewText:function(e){return t.target.value}})}),[v]),C=function(n){return t(void 0,void 0,void 0,(function(){var t,o,u;return e(this,(function(e){switch(e.label){case 0:return null==n||n.preventDefault(),f.text?(t={payload:{text:s(f.text)}},E.messageReply&&(t.cloudCustomData=JSON.stringify(E)),o=x(t),[4,g(o)]):[2];case 1:return e.sent(),d({getNewText:function(t){return""},type:r.SET_TEXT}),y(((u={})[a.QUOTE]=null,u)),[2]}}))}))},D=n((function(t){!(null==t?void 0:t.ctrlKey)&&h.indexOf(null==t?void 0:t.code)>-1&&13===t.keyCode&&(null==t||t.preventDefault(),C(t)),(null==t?void 0:t.ctrlKey)&&h.indexOf(null==t?void 0:t.code)>-1&&13===t.keyCode&&d({type:r.SET_TEXT,getNewText:function(t){return"".concat(t,"\n")}})}),[C,d]),M=n((function(n){return t(void 0,void 0,void 0,(function(){var t,a,u;return e(this,(function(e){return n.preventDefault(),n.clipboardData&&n.clipboardData.items?(t=n.clipboardData,a=t.types,u=t.items,a.find((function(t,e){var n=u[e];switch(t){case"text/plain":return n.getAsString((function(t){d({type:r.SET_TEXT,getNewText:function(e){return"".concat(e).concat(t)}})})),!0;case"Files":var a=n.getAsFile();return n&&"file"===n.kind&&n.type.match(/^image\//i)&&T({file:a},o.IMAGE),!0;default:return!1}})),[2]):[2]}))}))}),[p]),_=n((function(t){var e;d({type:r.SET_TEXT,getNewText:function(e){return"".concat(e.slice(0,f.cursorPos.start)).concat(t).concat(e.slice(f.cursorPos.start))}}),d({type:r.SET_CURSOR_POS,value:{start:f.cursorPos.start+t.length,end:f.cursorPos.end+t.length}}),null===(e=null==p?void 0:p.current)||void 0===e||e.focus()}),[p,f]),w=n((function(t){var e;d({type:r.SET_TEXT,getNewText:function(){return"".concat(t)}}),null===(e=null==p?void 0:p.current)||void 0===e||e.focus()}),[p]),j=n((function(t){d({type:r.SET_CURSOR_POS,value:t})}),[p]);return{handleChange:S,handleSubmit:C,handleKeyDown:D,handlePasete:M,insertText:_,setText:w,setCursorPos:j}};export{l as useMessageInputText};
@@ -1 +1 @@
1
- import{useCallback as e}from"react";import{MESSAGE_TYPE_NAME as t}from"../../../constants.js";import"tslib";import"react/jsx-runtime";import{useTUIChatActionContext as s}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";function o(o){var r,a=s(),n=a.sendMessage,i=a.createImageMessage,c=a.createVideoMessage,p=a.createFileMessage,g=a.updataUploadPenddingMessageList,m=((r={})[t.IMAGE]=i,r[t.VIDEO]=c,r[t.FILE]=p,r);return{sendUploadMessage:e((function(e,t){var s=m[t]({payload:e,onProgress:function(e){s.progress=e,g(s)}});n(s)}),[n])}}export{o as useUploadPicker};
1
+ import{useCallback as e}from"react";import{MESSAGE_TYPE_NAME as t}from"../../../constants.js";import"tslib";import"react/jsx-runtime";import{useTUIChatActionContext as s}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";function o(o){var r,a=s(),n=a.sendMessage,i=a.createImageMessage,c=a.createVideoMessage,p=a.createFileMessage,g=a.updateUploadPendingMessageList,m=((r={})[t.IMAGE]=i,r[t.VIDEO]=c,r[t.FILE]=p,r);return{sendUploadMessage:e((function(e,t){var s=m[t]({payload:e,onProgress:function(e){s.progress=e,g(s)}});n(s)}),[n])}}export{o as useUploadPicker};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Message } from 'tim-js-sdk';
2
+ import { Message } from '@tencentcloud/chat';
3
3
  import { InfiniteScrollProps } from '../InfiniteScrollPaginator/InfiniteScroll.js';
4
4
 
5
5
  interface MessageListProps extends InfiniteScrollProps {
@@ -1 +1 @@
1
- import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as s,jsxs as o}from"react/jsx-runtime";import n,{useState as l,useEffect as r}from"react";import{useTUIChatStateContext as a}from"../../context/TUIChatStateContext.js";import{useTUIChatActionContext as c}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as m}from"../../context/ComponentContext.js";import d from"./hooks/useEnrichedMessageList.js";import h from"./hooks/useMessageListElement.js";import{InfiniteScroll as g}from"../InfiniteScrollPaginator/InfiniteScroll.js";import{EmptyStateIndicator as u}from"../EmptyStateIndicator/EmptyStateIndicator.js";function f(n){var f=this,v=n.messageList,p=n.highlightedMessageId,M=n.loadMore,I=n.intervalsTimer,T=n.className,L=l(null),x=L[0],j=L[1],C=l(!1),S=C[0],E=C[1],U=a("TUIMessageList"),b=U.messageList,y=U.highlightedMessageId,N=U.isCompleted,k=U.isSameLastMessageID,w=U.messageListRef,H=U.noMore,V=U.TUIMessageListConfig,q=c(),A=q.loadMore,D=q.setHighlightedMessageId,P=m(),R=P.TUIMessage,z=P.EmptyStateIndicator,B=void 0===z?u:z,F=p||(null==V?void 0:V.highlightedMessageId)||y,G=60*(I||(null==V?void 0:V.intervalsTimer)||30),J=d({messageList:v||(null==V?void 0:V.messageList)||b}).messageList,K=M||(null==V?void 0:V.loadMore)||A,O=h({enrichedMessageList:J,TUIMessage:R,intervalsTimer:G});return r((function(){t(f,void 0,void 0,(function(){var e,t,s,o,n;return i(this,(function(i){switch(i.label){case 0:return e=null===(n=null==x?void 0:x.parentElement)||void 0===n?void 0:n.parentElement,!N&&(null==e?void 0:e.clientHeight)>=(null==x?void 0:x.clientHeight)?[4,K()]:[3,2];case 1:i.sent(),i.label=2;case 2:return!(null==x?void 0:x.children)||S&&k||(t=(null==x?void 0:x.children)||[],s=t[t.length-1],o=setTimeout((function(){null==s||s.scrollIntoView({block:"end"}),E(!0),clearTimeout(o)}),100)),[2]}}))}))}),[O,S]),r((function(){if(F){var e=null==x?void 0:x.querySelector("[data-message-id='".concat(F,"']"));if(!e)return;var t=e.children[1].children;t[t.length-1].classList.add("high-lighted"),null==e||e.scrollIntoView({block:"center"});var i=setTimeout((function(){t[t.length-1].classList.remove("high-lighted"),clearTimeout(i),D("")}),1e3)}}),[F]),o("div",e({className:"message-list ".concat(T," ").concat(S?"":"hide"),ref:w},{children:[H,H&&s("p",e({className:"no-more"},{children:"No More"})),s(g,e({className:"message-list-infinite-scroll",hasMore:!0,loadMore:K,threshold:1},{children:s("ul",e({ref:j},{children:(null==O?void 0:O.length)>0?O:s(B,{listType:"message"})}))}))]}))}var v=n.memo(f);function p(t){return s(v,e({},t))}export{p as TUIMessageList};
1
+ import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as s,jsxs as o}from"react/jsx-runtime";import n,{useState as l,useEffect as r}from"react";import{useTUIChatStateContext as a}from"../../context/TUIChatStateContext.js";import{useTUIChatActionContext as c}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as m}from"../../context/ComponentContext.js";import d from"./hooks/useEnrichedMessageList.js";import g from"./hooks/useMessageListElement.js";import{InfiniteScroll as h}from"../InfiniteScrollPaginator/InfiniteScroll.js";import{EmptyStateIndicator as u}from"../EmptyStateIndicator/EmptyStateIndicator.js";function f(n){var f=this,v=n.messageList,p=n.highlightedMessageId,M=n.loadMore,I=n.intervalsTimer,T=n.className,L=l(null),x=L[0],j=L[1],C=l(!1),S=C[0],E=C[1],U=a("TUIMessageList"),b=U.messageList,y=U.highlightedMessageId,N=U.isCompleted,k=U.isSameLastMessageID,w=U.messageListRef,H=U.noMore,V=U.TUIMessageListConfig,q=c(),A=q.loadMore,D=q.setHighlightedMessageId,P=m(),R=P.TUIMessage,z=P.EmptyStateIndicator,B=void 0===z?u:z,F=p||(null==V?void 0:V.highlightedMessageId)||y,G=60*(I||(null==V?void 0:V.intervalsTimer)||30),J=d({messageList:v||(null==V?void 0:V.messageList)||b}).messageList,K=M||(null==V?void 0:V.loadMore)||A,O=g({enrichedMessageList:J,TUIMessage:R,intervalsTimer:G});return r((function(){t(f,void 0,void 0,(function(){var e,t,s,o,n;return i(this,(function(i){switch(i.label){case 0:return e=null===(n=null==x?void 0:x.parentElement)||void 0===n?void 0:n.parentElement,!N&&(null==e?void 0:e.clientHeight)>=(null==x?void 0:x.clientHeight)?[4,K()]:[3,2];case 1:i.sent(),i.label=2;case 2:return!(null==x?void 0:x.children)||S&&k||(t=(null==x?void 0:x.children)||[],s=t[t.length-1],o=setTimeout((function(){null==s||s.scrollIntoView({block:"end"}),E(!0),clearTimeout(o)}),100)),[2]}}))}))}),[O,S]),r((function(){if(F){var e=null==x?void 0:x.querySelector("[data-message-id='".concat(F,"']"));if(!e)return;var t=e.children;t[t.length-1].classList.add("high-lighted"),null==e||e.scrollIntoView({block:"center"});var i=setTimeout((function(){t[t.length-1].classList.remove("high-lighted"),clearTimeout(i),D("")}),1e3)}}),[F]),o("div",e({className:"message-list ".concat(T," ").concat(S?"":"hide"),ref:w},{children:[H,H&&s("p",e({className:"no-more"},{children:"No More"})),s(h,e({className:"message-list-infinite-scroll",hasMore:!0,loadMore:K,threshold:1},{children:s("ul",e({ref:j},{children:(null==O?void 0:O.length)>0?O:s(B,{listType:"message"})}))}))]}))}var v=n.memo(f);function p(t){return s(v,e({},t))}export{p as TUIMessageList};
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsxs as i,Fragment as t,jsx as r}from"react/jsx-runtime";import{useMemo as s}from"react";import{getTimeStamp as n}from"../../untils.js";function a(a){var m=a.enrichedMessageList,o=a.TUIMessage,l=a.intervalsTimer;return s((function(){return null==m?void 0:m.map((function(s,a){var c,u="".concat(JSON.stringify(s)).concat(a),d=a>0?null===(c=m[a-1])||void 0===c?void 0:c.time:-1,f=(null==s?void 0:s.time)||0;return i(t,{children:[-1!==d&&f-d>=l&&r("div",e({className:"message-list-time"},{children:f?n(1e3*f):0}),"".concat(f+a)),r("li",e({className:"message-list-item"},{children:r(o,{message:s},u)}),u)]})}))}),[m])}export{a as default};
1
+ import{__assign as e}from"tslib";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{getTimeStamp as s}from"../../untils.js";function n(n){var a=n.enrichedMessageList,m=n.TUIMessage,o=n.intervalsTimer;return r((function(){return null==a?void 0:a.map((function(r,n){var l,c="".concat(r.ID,"-").concat(n),u=n>0?null===(l=a[n-1])||void 0===l?void 0:l.time:-1,d=(null==r?void 0:r.time)||0;return i("li",e({className:"message-list-item"},{children:[-1!==u&&d-u>=o&&t("div",e({className:"message-list-time"},{children:d?s(1e3*d):0}),"".concat(d+n)),t(m,{message:r})]}),c)}))}),[a])}export{n as default};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Profile } from 'tim-js-sdk';
2
+ import { Profile } from '@tencentcloud/chat';
3
3
  import { ProfileParams } from './hooks/useMyProfile.js';
4
4
 
5
5
  interface TUIProfileDefaultProps {
@@ -1 +1 @@
1
- import{__assign as e}from"tslib";import{jsx as t,jsxs as a}from"react/jsx-runtime";import i,{useState as n}from"react";import l from"react-date-picker";import r from"tim-js-sdk";import{useTUIKitContext as o}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{Avatar as c}from"../Avatar/Avatar.js";import{DivWithEdit as u}from"../DivWithEdit/DivWithEdit.js";import{Icon as d}from"../Icon/Icon.js";import{IconTypes as s}from"../Icon/type.js";import{handleDisplayAvatar as m}from"../untils.js";var v,p=((v={})[r.TYPES.GENDER_UNKNOWN]="unknow",v[r.TYPES.GENDER_MALE]="male",v[r.TYPES.GENDER_FEMALE]="female",v),f=["https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_1.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_2.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_4.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_5.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_6.png"],h=[{label:"Male",value:r.TYPES.GENDER_MALE},{label:"Female",value:r.TYPES.GENDER_FEMALE}];function g(i){var r,v,g=i.userInfo,N=i.className,E=i.update,k=o("TUIProfileDefault").setTUIProfileShow,b=n(""),D=b[0],y=b[1],w=[{name:"Signature",value:null==g?void 0:g.selfSignature,type:"text",children:null},{name:"Gender",value:null===(r=p[null==g?void 0:g.gender])||void 0===r?void 0:r.replace(p[null==g?void 0:g.gender][0],null===(v=p[null==g?void 0:g.gender][0])||void 0===v?void 0:v.toLocaleUpperCase()),type:"select",children:t("ul",e({className:"select-list"},{children:null==h?void 0:h.map((function(a,i){var n="".concat(a.value).concat(i);return t("li",e({className:"select-list-item",role:"menuitem",tabIndex:i,onClick:function(){S(a)}},{children:a.label}),n)}))}))},{name:"Birthday",value:null==g?void 0:g.birthday,type:"select",children:t(l,{className:"tui-profile-birthday",calendarClassName:"tui-profile-birthday-calendar",isOpen:!0,format:"y-MM-dd",onChange:function(e){j(e)},value:function(e){if(8===(null==e?void 0:e.length)){var t=Number(e.slice(0,4)),a=Number(e.slice(4,6)),i=Number(e.slice(-2));return new Date(t,a-1,i)}return new Date}("".concat(null==g?void 0:g.birthday))})}],I=function(e){y(e)},M=function(e){E(e),y("")},_=function(e){var t,a="";switch(null==e?void 0:e.name){case"nick":a="nick";break;case"Signature":a="selfSignature";break;default:return void y("")}var i=((t={})[a]=e.value,t);M(i)},S=function(e){M({gender:e.value})},j=function(e){var t,a,i,n;M({birthday:Number((t=e,a=t.getDate()>9?t.getDate():"0".concat(t.getDate()),i=t.getMonth()>8?t.getMonth()+1:"0".concat(t.getMonth()+1),n=t.getFullYear(),"".concat(n).concat(i).concat(a)))})};return a("div",e({className:"".concat(N," tui-profile")},{children:[a("header",e({className:"tui-profile-header"},{children:[t(d,{width:9,height:16,type:s.BACK,onClick:function(){k(!1)}}),t("h1",{children:"Personal information"})]})),a("main",e({className:"tui-profile-main"},{children:[t("div",e({className:"tui-profile-avatar"},{children:t(c,{image:m(null==g?void 0:g.avatar),size:94,update:function(e){M({avatar:e})},list:f})})),t(u,{name:"nick",className:"tui-profile-nick",value:null==g?void 0:g.nick,type:"text",toggle:I,isEdit:"nick"===D,confirm:_,close:function(){y("")}}),a("div",e({className:"tui-profile-ID"},{children:[t("h5",{children:"ID:"}),t("span",{children:null==g?void 0:g.userID})]}))]})),t("ul",e({className:"tui-profile-list"},{children:w.map((function(i){var n="".concat(i.name);return a("li",e({className:"tui-profile-list-item"},{children:[t("h4",{children:i.name}),t(u,e({className:"tui-profile-div-with-edit",classEditName:"tui-profile-edit",name:i.name,value:null==i?void 0:i.value,type:i.type,toggle:I,isEdit:D===i.name,confirm:_,close:function(){y("")}},{children:null==i?void 0:i.children}))]}),n)}))}))]}))}var N=i.memo(g);function E(a){var i=e({},a);return t(N,e({},i))}export{E as TUIProfileDefault};
1
+ import{__assign as e}from"tslib";import{jsx as t,jsxs as a}from"react/jsx-runtime";import i,{useState as n}from"react";import l from"react-date-picker";import r from"@tencentcloud/chat";import{useTUIKitContext as o}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{Avatar as c}from"../Avatar/Avatar.js";import{DivWithEdit as u}from"../DivWithEdit/DivWithEdit.js";import{Icon as d}from"../Icon/Icon.js";import{IconTypes as s}from"../Icon/type.js";import{handleDisplayAvatar as m}from"../untils.js";var v,p=((v={})[r.TYPES.GENDER_UNKNOWN]="unknow",v[r.TYPES.GENDER_MALE]="male",v[r.TYPES.GENDER_FEMALE]="female",v),f=["https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_1.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_2.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_3.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_4.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_5.png","https://im.sdk.qcloud.com/download/tuikit-resource/avatar/avatar_6.png"],h=[{label:"Male",value:r.TYPES.GENDER_MALE},{label:"Female",value:r.TYPES.GENDER_FEMALE}];function g(i){var r,v,g=i.userInfo,N=i.className,E=i.update,k=o("TUIProfileDefault").setTUIProfileShow,b=n(""),D=b[0],y=b[1],w=[{name:"Signature",value:null==g?void 0:g.selfSignature,type:"text",children:null},{name:"Gender",value:null===(r=p[null==g?void 0:g.gender])||void 0===r?void 0:r.replace(p[null==g?void 0:g.gender][0],null===(v=p[null==g?void 0:g.gender][0])||void 0===v?void 0:v.toLocaleUpperCase()),type:"select",children:t("ul",e({className:"select-list"},{children:null==h?void 0:h.map((function(a,i){var n="".concat(a.value).concat(i);return t("li",e({className:"select-list-item",role:"menuitem",tabIndex:i,onClick:function(){S(a)}},{children:a.label}),n)}))}))},{name:"Birthday",value:null==g?void 0:g.birthday,type:"select",children:t(l,{className:"tui-profile-birthday",calendarClassName:"tui-profile-birthday-calendar",isOpen:!0,format:"y-MM-dd",onChange:function(e){x(e)},value:function(e){if(8===(null==e?void 0:e.length)){var t=Number(e.slice(0,4)),a=Number(e.slice(4,6)),i=Number(e.slice(-2));return new Date(t,a-1,i)}return new Date}("".concat(null==g?void 0:g.birthday))})}],I=function(e){y(e)},M=function(e){E(e),y("")},_=function(e){var t,a="";switch(null==e?void 0:e.name){case"nick":a="nick";break;case"Signature":a="selfSignature";break;default:return void y("")}var i=((t={})[a]=e.value,t);M(i)},S=function(e){M({gender:e.value})},x=function(e){var t,a,i,n;M({birthday:Number((t=e,a=t.getDate()>9?t.getDate():"0".concat(t.getDate()),i=t.getMonth()>8?t.getMonth()+1:"0".concat(t.getMonth()+1),n=t.getFullYear(),"".concat(n).concat(i).concat(a)))})};return a("div",e({className:"".concat(N," tui-profile")},{children:[a("header",e({className:"tui-profile-header"},{children:[t(d,{width:9,height:16,type:s.BACK,onClick:function(){k(!1)}}),t("h1",{children:"Personal information"})]})),a("main",e({className:"tui-profile-main"},{children:[t("div",e({className:"tui-profile-avatar"},{children:t(c,{image:m(null==g?void 0:g.avatar),size:94,update:function(e){M({avatar:e})},list:f})})),t(u,{name:"nick",className:"tui-profile-nick",value:null==g?void 0:g.nick,type:"text",toggle:I,isEdit:"nick"===D,confirm:_,close:function(){y("")}}),a("div",e({className:"tui-profile-ID"},{children:[t("h5",{children:"ID:"}),t("span",{children:null==g?void 0:g.userID})]}))]})),t("ul",e({className:"tui-profile-list"},{children:w.map((function(i){var n="".concat(i.name);return a("li",e({className:"tui-profile-list-item"},{children:[t("h4",{children:i.name}),t(u,e({className:"tui-profile-div-with-edit",classEditName:"tui-profile-edit",name:i.name,value:null==i?void 0:i.value,type:i.type,toggle:I,isEdit:D===i.name,confirm:_,close:function(){y("")}},{children:null==i?void 0:i.children}))]}),n)}))}))]}))}var N=i.memo(g);function E(a){var i=e({},a);return t(N,e({},i))}export{E as TUIProfileDefault};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as n,__assign as e}from"tslib";import{useState as r,useCallback as o,useEffect as i}from"react";import u from"tim-js-sdk";import{useTUIKitContext as a}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import"../../../context/TUIMessageContext.js";function c(){var c=this,l=r(null),s=l[0],f=l[1],d=a("useMyProfile"),m=d.tim,v=d.myProfile,p=o((function(){return t(c,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return v?(f(v),[3,3]):[3,1];case 1:return[4,null==m?void 0:m.getMyProfile()];case 2:t=n.sent(),f(null==t?void 0:t.data),n.label=3;case 3:return[2]}}))}))}),[m]),P=o((function(r){return t(c,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return[4,null==m?void 0:m.updateMyProfile(r)];case 1:return t=n.sent(),o=e({},s),Object.keys(t.data).map((function(n){return o[n]=t.data[n],n})),f(o),[2,t]}}))}))}),[m]),E=function(t){console.log("onProfileUpdated",t.data)};return i((function(){return t(c,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,p()];case 1:return t.sent(),[2]}}))})),null==m||m.on(u.EVENT.PROFILE_UPDATED,E),function(){null==m||m.off(u.EVENT.PROFILE_UPDATED,E)}}),[m]),{myProfile:s,updateMyProfile:P}}export{c as useMyProfile};
1
+ import{__awaiter as t,__generator as n,__assign as e}from"tslib";import{useState as r,useCallback as o,useEffect as i}from"react";import u from"@tencentcloud/chat";import{useTUIKitContext as c}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import"../../../context/TUIMessageContext.js";function a(){var a=this,l=r(null),s=l[0],f=l[1],d=c("useMyProfile"),m=d.chat,v=d.myProfile,p=o((function(){return t(a,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return v?(f(v),[3,3]):[3,1];case 1:return[4,null==m?void 0:m.getMyProfile()];case 2:t=n.sent(),f(null==t?void 0:t.data),n.label=3;case 3:return[2]}}))}))}),[m]),P=o((function(r){return t(a,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return[4,null==m?void 0:m.updateMyProfile(r)];case 1:return t=n.sent(),o=e({},s),Object.keys(t.data).map((function(n){return o[n]=t.data[n],n})),f(o),[2,t]}}))}))}),[m]),h=function(t){console.log("onProfileUpdated",t.data)};return i((function(){return t(a,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,p()];case 1:return t.sent(),[2]}}))})),null==m||m.on(u.EVENT.PROFILE_UPDATED,h),function(){null==m||m.off(u.EVENT.PROFILE_UPDATED,h)}}),[m]),{myProfile:s,updateMyProfile:P}}export{a as useMyProfile};
@@ -1 +1 @@
1
- import{isThisYear as r,format as t,isToday as e,isYesterday as i,formatDistance as n,isThisWeek as o}from"date-fns";import a from"tim-js-sdk";import"tslib";import"react/jsx-runtime";import"react";import"./Icon/config.js";import"./Icon/type.js";import{defaultGroupAvatarWork as c,defaultUserAvatar as f}from"./Avatar/default.js";function p(r){if("string"==typeof r)try{return!!JSON.parse(r)}catch(r){return!1}return!1}function s(r){return p(r)?JSON.parse(r):r}var m=function(r,t){void 0===t&&(t=a.TYPES.CONV_C2C);var e=r;if(!r)switch(t){case a.TYPES.CONV_C2C:e=f;break;case a.TYPES.CONV_GROUP:default:e=c}return e},u=function(a){return a?r(a)?e(a)?t(a,"p"):i(a)?n(a,new Date):o(a)?t(a,"eeee"):t(a,"MMM dd"):t(a,"yyyy MMM dd"):""};export{s as JSONStringToParse,u as getTimeStamp,m as handleDisplayAvatar,p as isJSON};
1
+ import{isThisYear as t,format as r,isToday as e,isYesterday as n,formatDistance as o,isThisWeek as i}from"date-fns";import a from"@tencentcloud/chat";import"tslib";import"react/jsx-runtime";import"react";import"./Icon/config.js";import"./Icon/type.js";import{defaultGroupAvatarWork as c,defaultUserAvatar as f}from"./Avatar/default.js";function p(t){if("string"==typeof t)try{return!!JSON.parse(t)}catch(t){return!1}return!1}function u(t){return p(t)?JSON.parse(t):t}var m=function(t,r){void 0===r&&(r=a.TYPES.CONV_C2C);var e=t;if(!t)switch(r){case a.TYPES.CONV_C2C:e=f;break;case a.TYPES.CONV_GROUP:default:e=c}return e},s=function(a){return a?t(a)?e(a)?r(a,"p"):n(a)?o(a,new Date):i(a)?r(a,"eeee"):r(a,"MMM dd"):r(a,"yyyy MMM dd"):""};export{u as JSONStringToParse,s as getTimeStamp,m as handleDisplayAvatar,p as isJSON};
@@ -1 +1 @@
1
- var e,t,E,S,s,o,T={typeC2C:"isC2C",typeGroup:"isGroup",cancel:"cancel",group:"GROUP",handleMessage:{revoke:"revoke",copy:"copy",delete:"delete",forward:"forward",reply:"reply"},at:"@",all:"所有人",typeForward:"forward",typeMute:"mute",typeOrder:"order",typeService:"consultion",typeReply:"quick_reply",typeEvaluate:"evaluation",typeTextLink:"text_link",typeAndroid:"android",typeIphone:"iphone",typeMini:"miniprogram",TYPE_TYPING:"user_typing_status",typeInputStatusIng:"EIMAMSG_InputStatus_Ing",typeInputStatusEnd:"EIMAMSG_InputStatus_End"};!function(e){e.RESET="reset",e.SET_CONVERSATION_PRPFILE="setConversationProfile",e.SET_MESSAGELIST="setMessageList",e.SET_UPDATE_MESSAGE="setUpdateMessage",e.SET_EDIT_MESSAGE="setEditMessage",e.SET_REMOVE_MESSAGE="setRemoveMessage",e.SET_HISTORY_MESSAGELIST="setHistoryMessageList",e.SET_NEXT_REQ_MESSAGE_ID="setNextReqMessageID",e.SET_IS_COMPLETE="setIsComplete",e.SET_TEXT="setText",e.SET_HIGH_LIGHTED_MESSAGE_ID="setHightLightedMessageID",e.OPERATE_MESSAGE="operateMessage",e.SET_NO_MORE="setNoMore",e.SET_CURSOR_POS="setCursorPos",e.SET_AUDIO_SOURCE="setAudioSource",e.SET_VIDEO_SOURCE="setVideoSource",e.UPDATE_UPLOAD_PENDDING_MESSAGE_LIST="updateUploadPenddingMessageList"}(e||(e={})),function(e){e[e.TEXT=1]="TEXT",e[e.CUSTOM=2]="CUSTOM",e[e.IMAGE=3]="IMAGE",e[e.AUDIO=4]="AUDIO",e[e.VIDEO=5]="VIDEO",e[e.FILE=6]="FILE",e[e.FACE=8]="FACE"}(t||(t={})),function(e){e.UNSEND="unSend",e.SUCCESS="success",e.FAIL="fail"}(E||(E={})),function(e){e.IN="in",e.OUT="out"}(S||(S={})),function(e){e.TEXT="text",e.CUSTOM="custom",e.IMAGE="image",e.AUDIO="audio",e.VIDEO="video",e.FILE="file",e.FACE="face"}(s||(s={})),function(e){e.REVOKE="revoke",e.QUOTE="quote",e.FORWARD="forward"}(o||(o={}));export{e as CONSTANT_DISPATCH_TYPE,S as MESSAGE_FLOW,o as MESSAGE_OPERATE,E as MESSAGE_STATUS,t as MESSAGE_TYPE,s as MESSAGE_TYPE_NAME,T as default};
1
+ var e,t,E,S,s,o,T={typeC2C:"isC2C",typeGroup:"isGroup",cancel:"cancel",group:"GROUP",handleMessage:{revoke:"revoke",copy:"copy",delete:"delete",forward:"forward",reply:"reply"},at:"@",all:"所有人",typeForward:"forward",typeMute:"mute",typeOrder:"order",typeService:"consultion",typeReply:"quick_reply",typeEvaluate:"evaluation",typeTextLink:"text_link",typeAndroid:"android",typeIphone:"iphone",typeMini:"miniprogram",TYPE_TYPING:"user_typing_status",typeInputStatusIng:"EIMAMSG_InputStatus_Ing",typeInputStatusEnd:"EIMAMSG_InputStatus_End"};!function(e){e.RESET="reset",e.SET_CONVERSATION_PRPFILE="setConversationProfile",e.SET_MESSAGELIST="setMessageList",e.SET_UPDATE_MESSAGE="setUpdateMessage",e.SET_EDIT_MESSAGE="setEditMessage",e.SET_REMOVE_MESSAGE="setRemoveMessage",e.SET_HISTORY_MESSAGELIST="setHistoryMessageList",e.SET_NEXT_REQ_MESSAGE_ID="setNextReqMessageID",e.SET_IS_COMPLETE="setIsComplete",e.SET_TEXT="setText",e.SET_HIGH_LIGHTED_MESSAGE_ID="setHightLightedMessageID",e.OPERATE_MESSAGE="operateMessage",e.SET_NO_MORE="setNoMore",e.SET_CURSOR_POS="setCursorPos",e.SET_AUDIO_SOURCE="setAudioSource",e.SET_VIDEO_SOURCE="setVideoSource",e.UPDATE_UPLOAD_PENDING_MESSAGE_LIST="updateUploadPendingMessageList"}(e||(e={})),function(e){e[e.TEXT=1]="TEXT",e[e.CUSTOM=2]="CUSTOM",e[e.IMAGE=3]="IMAGE",e[e.AUDIO=4]="AUDIO",e[e.VIDEO=5]="VIDEO",e[e.FILE=6]="FILE",e[e.FACE=8]="FACE"}(t||(t={})),function(e){e.UNSEND="unSend",e.SUCCESS="success",e.FAIL="fail"}(E||(E={})),function(e){e.IN="in",e.OUT="out"}(S||(S={})),function(e){e.TEXT="text",e.CUSTOM="custom",e.IMAGE="image",e.AUDIO="audio",e.VIDEO="video",e.FILE="file",e.FACE="face"}(s||(s={})),function(e){e.REVOKE="revoke",e.QUOTE="quote",e.FORWARD="forward"}(o||(o={}));export{e as CONSTANT_DISPATCH_TYPE,S as MESSAGE_FLOW,o as MESSAGE_OPERATE,E as MESSAGE_STATUS,t as MESSAGE_TYPE,s as MESSAGE_TYPE_NAME,T as default};
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Message } from 'tim-js-sdk';
2
+ import { Message } from '@tencentcloud/chat';
3
3
  import { CreateTextMessageProps, CreateFaceMessageProps, CreateUploadMessageProps, CreateForwardMessageProps, CreateCustomMessageProps, CreateTextAtMessageProps, CreateLocationMessageProps, CreateMergerMessageProps } from '../components/TUIChat/hooks/useCreateMessage.js';
4
4
  import { OperateMessageParams } from '../components/TUIChat/hooks/useHandleMessage.js';
5
5
 
@@ -18,14 +18,14 @@ interface TUIChatActionContextValue {
18
18
  createTextAtMessage?: (options: CreateTextAtMessageProps) => Message;
19
19
  createLocationMessage?: (options: CreateLocationMessageProps) => Message;
20
20
  createMergerMessage?: (options: CreateMergerMessageProps) => Message;
21
- editLocalmessage?: (message: Message) => void;
21
+ editLocalMessage?: (message: Message) => void;
22
22
  operateMessage?: (data?: OperateMessageParams) => void;
23
23
  loadMore?: () => Promise<void>;
24
24
  revokeMessage?: (message: Message) => Promise<Message>;
25
25
  setAudioSource?: (source: HTMLAudioElement | null) => void;
26
26
  setVideoSource?: (source: HTMLVideoElement | null) => void;
27
27
  setHighlightedMessageId?: (highlightedMessageId: string) => void;
28
- updataUploadPenddingMessageList?: (message?: Message) => void;
28
+ updateUploadPendingMessageList?: (message?: Message) => void;
29
29
  }
30
30
  declare const TUIChatActionContext: React.Context<TUIChatActionContextValue>;
31
31
  declare function TUIChatActionProvider({ children, value, }: PropsWithChildren<{
@@ -1,5 +1,5 @@
1
1
  import React, { RefObject, MutableRefObject, PropsWithChildren } from 'react';
2
- import { Conversation, Message } from 'tim-js-sdk';
2
+ import { Conversation, Message } from '@tencentcloud/chat';
3
3
  import { OperateMessageParams } from '../components/TUIChat/hooks/useHandleMessage.js';
4
4
  import { TUIMessageProps } from '../components/TUIMessage/TUIMessage.js';
5
5
  import { TUIMessageInputBasicProps } from '../components/TUIMessageInput/TUIMessageInput.js';
@@ -24,7 +24,7 @@ interface TUIChatStateContextValue {
24
24
  audioSource?: HTMLAudioElement;
25
25
  vidoeSource?: HTMLVideoElement;
26
26
  TUIMessageListConfig?: MessageListProps;
27
- uploadPenddingMessageList?: Array<Message>;
27
+ uploadPendingMessageList?: Array<Message>;
28
28
  }
29
29
  declare const TUIChatStateContext: React.Context<TUIChatStateContextValue>;
30
30
  declare function TUIChatStateContextProvider({ children, value }: PropsWithChildren<{
@@ -1 +1 @@
1
- import{__assign as o}from"tslib";import{jsx as e}from"react/jsx-runtime";import t,{useContext as s}from"react";import{TUIConversationList as n}from"../components/TUIConversationList/TUIConversationList.js";import"tim-js-sdk";import"./TUIMessageContext.js";import"../components/TUIProfile/TUIProfileDefault.js";import"../constants.js";import"date-fns";import"../components/Icon/config.js";import"../components/Icon/type.js";import"../components/TUIMessage/hooks/useMessageReply.js";import"../components/TUIMessage/MessagePlugins.js";import"../components/TUIMessage/MessageContext.js";import"../components/TUIMessageInput/hooks/useHandleQuoteMessage.js";import"../components/Switch/Switch.js";var r=t.createContext(void 0);function i(t){var s=t.children,i=t.value;return e(r.Provider,o({value:i},{children:s||e(n,{})}))}var m=function(o){var e=s(r);return!e&&o?{}:e};export{r as TUIConversationContext,i as TUIConversationProvider,m as useTUIConversationContext};
1
+ import{__assign as o}from"tslib";import{jsx as e}from"react/jsx-runtime";import t,{useContext as s}from"react";import{TUIConversationList as n}from"../components/TUIConversationList/TUIConversationList.js";import"@tencentcloud/chat";import"./TUIMessageContext.js";import"../components/TUIProfile/TUIProfileDefault.js";import"../constants.js";import"date-fns";import"../components/Icon/config.js";import"../components/Icon/type.js";import"../components/TUIMessage/hooks/useMessageReply.js";import"../components/TUIMessage/MessagePlugins.js";import"../components/TUIMessage/MessageContext.js";import"../components/TUIMessageInput/hooks/useHandleQuoteMessage.js";import"../components/Switch/Switch.js";var r=t.createContext(void 0);function i(t){var s=t.children,i=t.value;return e(r.Provider,o({value:i},{children:s||e(n,{})}))}var m=function(o){var e=s(r);return!e&&o?{}:e};export{r as TUIConversationContext,i as TUIConversationProvider,m as useTUIConversationContext};
@@ -1,8 +1,8 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { ChatSDK, Conversation, Profile } from 'tim-js-sdk';
2
+ import { ChatSDK, Conversation, Profile } from '@tencentcloud/chat';
3
3
 
4
4
  interface TUIKitContextValue {
5
- tim: ChatSDK;
5
+ chat: ChatSDK;
6
6
  conversation?: Conversation;
7
7
  setActiveConversation: (conversation?: Conversation) => void;
8
8
  customClasses?: unknown;
@@ -1,5 +1,5 @@
1
1
  import React, { ReactEventHandler, PropsWithChildren } from 'react';
2
- import { Message } from 'tim-js-sdk';
2
+ import { Message } from '@tencentcloud/chat';
3
3
  import { MessagePluginsProps } from '../components/TUIMessage/MessagePlugins.js';
4
4
 
5
5
  declare enum messageShowType {
@@ -1,8 +1,8 @@
1
- import tim_js_sdk__default from 'tim-js-sdk';
1
+ import _tencentcloud_chat__default from '@tencentcloud/chat';
2
2
 
3
3
  interface CreateGroupConversationParams {
4
4
  name: string;
5
- type?: tim_js_sdk__default.TYPES;
5
+ type?: _tencentcloud_chat__default.TYPES;
6
6
  groupID?: string;
7
7
  introduction?: string;
8
8
  notification?: string;
@@ -13,7 +13,7 @@ interface CreateGroupConversationParams {
13
13
  groupCustomField?: Array<object>;
14
14
  isSupportTopic?: boolean;
15
15
  }
16
- declare const useConversation: (tim: any) => {
16
+ declare const useConversation: (chat: any) => {
17
17
  createConversation: (conversationID: string) => Promise<any>;
18
18
  pinConversation: (options: {
19
19
  conversationID: string;