@tencentcloud/chat-uikit-react 1.2.1 → 2.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.
- package/.eslintrc.js +2 -1
- package/CHANGELOG.md +9 -3
- package/dist/cjs/components/Checkbox/index.d.ts +1 -2
- package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +2 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/cjs/components/ConversationPreview/utils.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.d.ts +1 -2
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/cjs/components/DivWithEdit/DivWithEdit.d.ts +1 -2
- package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +1 -2
- package/dist/cjs/components/Icon/Icon.d.ts +1 -2
- package/dist/cjs/components/Icon/config.js +1 -1
- package/dist/cjs/components/Icon/images/chats-selected.svg.js +1 -0
- package/dist/cjs/components/Icon/images/chats.svg.js +1 -0
- package/dist/cjs/components/Icon/images/contacts-selected.svg.js +1 -0
- package/dist/cjs/components/Icon/images/contacts.svg.js +1 -0
- package/dist/cjs/components/Icon/images/files.png.js +1 -0
- package/dist/cjs/components/Icon/images/image.png.js +1 -1
- package/dist/cjs/components/Icon/images/video.png.js +1 -1
- package/dist/cjs/components/Switch/Switch.d.ts +1 -2
- package/dist/cjs/components/TUIChat/TUIChat.d.ts +5 -0
- package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
- package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
- package/dist/cjs/components/TUIChat/hooks/useHandleMessage.js +1 -1
- package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
- package/dist/cjs/components/TUIChat/unitls.js +1 -1
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContact.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/blockInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendApplication.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
- package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -1
- package/dist/cjs/components/TUIConversation/TUIConversation.js +1 -1
- package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +1 -0
- package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
- package/dist/cjs/components/TUIManage/TUIManage.d.ts +1 -3
- package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageImage.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
- package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageText.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageTip.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageVideo.js +1 -1
- package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
- package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/cjs/components/untils.js +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/context/ComponentContext.d.ts +3 -2
- package/dist/cjs/context/TUIChatActionContext.d.ts +3 -14
- package/dist/cjs/context/TUIChatStateContext.d.ts +2 -0
- package/dist/cjs/context/TUIConversationContext.js +1 -1
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.d.css +240 -12
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/locales/en/TUIChat.js +1 -1
- package/dist/cjs/locales/en/TUIContact.js +1 -1
- package/dist/cjs/locales/en/TUIProfile.js +1 -1
- package/dist/cjs/locales/index.d.ts +6 -0
- package/dist/cjs/locales/index.js +1 -1
- package/dist/cjs/locales/zh_cn/TUIChat.js +1 -1
- package/dist/cjs/locales/zh_cn/TUIContact.js +1 -1
- package/dist/cjs/locales/zh_cn/TUIProfile.js +1 -1
- package/dist/cjs/server.js +1 -0
- package/dist/cjs/utils/env.js +1 -0
- package/dist/esm/components/Checkbox/index.d.ts +1 -2
- package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +2 -0
- package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/esm/components/ConversationPreview/utils.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +1 -2
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/esm/components/DivWithEdit/DivWithEdit.d.ts +1 -2
- package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +1 -2
- package/dist/esm/components/Icon/Icon.d.ts +1 -2
- package/dist/esm/components/Icon/config.js +1 -1
- package/dist/esm/components/Icon/images/chats-selected.svg.js +1 -0
- package/dist/esm/components/Icon/images/chats.svg.js +1 -0
- package/dist/esm/components/Icon/images/contacts-selected.svg.js +1 -0
- package/dist/esm/components/Icon/images/contacts.svg.js +1 -0
- package/dist/esm/components/Icon/images/files.png.js +1 -0
- package/dist/esm/components/Icon/images/image.png.js +1 -1
- package/dist/esm/components/Icon/images/video.png.js +1 -1
- package/dist/esm/components/Switch/Switch.d.ts +1 -2
- package/dist/esm/components/TUIChat/TUIChat.d.ts +5 -0
- package/dist/esm/components/TUIChat/TUIChat.js +1 -1
- package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
- package/dist/esm/components/TUIChat/hooks/useHandleMessage.js +1 -1
- package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
- package/dist/esm/components/TUIChat/unitls.js +1 -1
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/esm/components/TUIContact/TUIContact.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/blockInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/friendApplication.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
- package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -1
- package/dist/esm/components/TUIConversation/TUIConversation.js +1 -1
- package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +1 -0
- package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/esm/components/TUIKit/TUIKit.js +1 -1
- package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
- package/dist/esm/components/TUIManage/TUIManage.d.ts +1 -3
- package/dist/esm/components/TUIManage/TUIManage.js +1 -1
- package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
- package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
- package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
- package/dist/esm/components/TUIMessage/MessageImage.js +1 -1
- package/dist/esm/components/TUIMessage/MessageName.js +1 -1
- package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/esm/components/TUIMessage/MessageSystem.js +1 -1
- package/dist/esm/components/TUIMessage/MessageText.js +1 -1
- package/dist/esm/components/TUIMessage/MessageTip.js +1 -1
- package/dist/esm/components/TUIMessage/MessageVideo.js +1 -1
- package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/esm/components/TUIMessage/utils/index.js +1 -1
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +1 -1
- package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/esm/components/untils.js +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/context/ComponentContext.d.ts +3 -2
- package/dist/esm/context/TUIChatActionContext.d.ts +3 -14
- package/dist/esm/context/TUIChatStateContext.d.ts +2 -0
- package/dist/esm/context/TUIConversationContext.js +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.d.css +240 -12
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales/en/TUIChat.js +1 -1
- package/dist/esm/locales/en/TUIContact.js +1 -1
- package/dist/esm/locales/en/TUIProfile.js +1 -1
- package/dist/esm/locales/index.d.ts +6 -0
- package/dist/esm/locales/index.js +1 -1
- package/dist/esm/locales/zh_cn/TUIChat.js +1 -1
- package/dist/esm/locales/zh_cn/TUIContact.js +1 -1
- package/dist/esm/locales/zh_cn/TUIProfile.js +1 -1
- package/dist/esm/server.js +1 -0
- package/dist/esm/utils/env.js +1 -0
- package/package.json +7 -6
- package/rollup.config.js +1 -2
- package/scripts/publish-github.js +60 -0
- package/scripts/publish-intl-demo.js +14 -0
- package/scripts/publish-npm.js +22 -0
- package/src/components/Avatar/styles/index.scss +1 -0
- package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +6 -3
- package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +5 -1
- package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +7 -2
- package/src/components/ConversationCreate/styles/conversationGroupTypeInfo.scss +1 -0
- package/src/components/ConversationCreate/styles/index.scss +2 -0
- package/src/components/ConversationPreview/ConversationPreview.tsx +2 -0
- package/src/components/ConversationPreview/ConversationPreviewContent.tsx +57 -9
- package/src/components/ConversationPreview/styles/index.scss +4 -2
- package/src/components/ConversationPreview/utils.tsx +5 -1
- package/src/components/DivWithEdit/styles/index.scss +2 -1
- package/src/components/Icon/config.ts +1 -1
- package/src/components/Icon/images/chats-selected.svg +6 -0
- package/src/components/Icon/images/chats.svg +9 -0
- package/src/components/Icon/images/contacts-selected.svg +3 -0
- package/src/components/Icon/images/contacts.svg +6 -0
- package/src/components/Icon/images/files.png +0 -0
- package/src/components/Icon/images/image.png +0 -0
- package/src/components/Icon/images/language.svg +3 -0
- package/src/components/Icon/images/video.png +0 -0
- package/src/components/Model/styles/layout.scss +1 -1
- package/src/components/Profile/styles/index.scss +4 -0
- package/src/components/TUIChat/TUIChat.tsx +74 -120
- package/src/components/TUIChat/TUIChatState.tsx +18 -45
- package/src/components/TUIChat/hooks/useHandleMessage.tsx +8 -0
- package/src/components/TUIChat/hooks/useHandleMessageList.tsx +2 -41
- package/src/components/TUIChat/unitls.ts +0 -29
- package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +7 -1
- package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +4 -1
- package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +1 -1
- package/src/components/TUIConversation/TUIConversation.tsx +1 -4
- package/src/components/TUIConversationList/TUIConversationList.tsx +91 -65
- package/src/components/TUIConversationList/index.scss +5 -0
- package/src/components/TUIKit/TUIKit.tsx +133 -9
- package/src/components/TUIKit/styles/h5.scss +34 -0
- package/src/components/TUIKit/styles/index.scss +103 -0
- package/src/components/TUIKit/styles/reset.scss +20 -0
- package/src/components/TUIManage/TUIManage.tsx +59 -35
- package/src/components/TUIManage/styles/index.scss +15 -1
- package/src/components/TUIMessage/MessageBubble.tsx +20 -3
- package/src/components/TUIMessage/MessageCustom.tsx +11 -2
- package/src/components/TUIMessage/MessageImage.tsx +2 -1
- package/src/components/TUIMessage/MessageName.tsx +1 -1
- package/src/components/TUIMessage/MessagePlugins.tsx +4 -2
- package/src/components/TUIMessage/MessageRevoke.tsx +2 -2
- package/src/components/TUIMessage/MessageText.tsx +25 -3
- package/src/components/TUIMessage/MessageVideo.tsx +8 -5
- package/src/components/TUIMessage/hooks/useMessageHandler.ts +13 -33
- package/src/components/TUIMessage/styles/color.scss +1 -0
- package/src/components/TUIMessage/styles/layout.scss +33 -6
- package/src/components/TUIMessage/utils/index.ts +1 -1
- package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +2 -2
- package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +3 -7
- package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +4 -3
- package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +10 -3
- package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +10 -14
- package/src/components/TUIMessageInput/styles/color.scss +1 -1
- package/src/components/TUIMessageInput/styles/layout.scss +7 -2
- package/src/components/TUIMessageList/TUIMessageList.tsx +9 -13
- package/src/components/TUIMessageList/index.ts +0 -1
- package/src/components/TUIProfile/TUIProfileDefault.tsx +65 -51
- package/src/components/TUIProfile/styles/layout.scss +6 -0
- package/src/components/untils.ts +9 -0
- package/src/constants.ts +4 -1
- package/src/context/ComponentContext.tsx +2 -0
- package/src/context/TUIChatActionContext.tsx +3 -23
- package/src/context/TUIChatStateContext.tsx +2 -0
- package/src/context/TUIKitContext.tsx +0 -1
- package/src/index.ts +4 -0
- package/src/locales/en/TUIChat.ts +2 -1
- package/src/locales/en/TUIContact.ts +1 -1
- package/src/locales/en/TUIProfile.ts +5 -4
- package/src/locales/index.ts +5 -4
- package/src/locales/zh_cn/TUIChat.ts +1 -0
- package/src/locales/zh_cn/TUIContact.ts +1 -1
- package/src/locales/zh_cn/TUIProfile.ts +1 -0
- package/src/server.ts +44 -0
- package/src/utils/env.ts +5 -0
- package/tsconfig.json +1 -0
- package/dist/cjs/_virtual/extends.js +0 -1
- package/dist/cjs/components/Icon/images/document.png.js +0 -1
- package/dist/cjs/components/TUIChat/hooks/useCreateMessage.d.ts +0 -59
- package/dist/cjs/components/TUIChat/hooks/useCreateMessage.js +0 -1
- package/dist/cjs/components/TUIChat/hooks/useMessageReceviedListener.js +0 -1
- package/dist/cjs/components/TUIMessageList/hooks/useEnrichedMessageList.js +0 -1
- package/dist/esm/_virtual/extends.js +0 -1
- package/dist/esm/components/Icon/images/document.png.js +0 -1
- package/dist/esm/components/TUIChat/hooks/useCreateMessage.d.ts +0 -59
- package/dist/esm/components/TUIChat/hooks/useCreateMessage.js +0 -1
- package/dist/esm/components/TUIChat/hooks/useMessageReceviedListener.js +0 -1
- package/dist/esm/components/TUIMessageList/hooks/useEnrichedMessageList.js +0 -1
- package/src/components/TUIChat/hooks/useCreateMessage.tsx +0 -198
- package/src/components/TUIChat/hooks/useMessageReceviedListener.tsx +0 -26
- package/src/components/TUIMessageList/hooks/useEnrichedMessageList.tsx +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t,__awaiter as e,__generator as r}from"tslib";import{jsxs as
|
|
1
|
+
import{__assign as t,__awaiter as e,__generator as r}from"tslib";import{jsxs as n,jsx as o}from"react/jsx-runtime";import a,{useState as i}from"react";import{useTranslation as c}from"react-i18next";import{useTUIKitContext as s}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{useTUIContactContext as u}from"../../context/TUIContactContext.js";import m from"./hooks/useContactSearch.js";import{Icon as l}from"../Icon/Icon.js";import{IconTypes as d}from"../Icon/type.js";import{Avatar as v}from"../Avatar/Avatar.js";import{defaultUserAvatar as f}from"../Avatar/default.js";import{Input as h}from"../Input/Input.js";function p(){var a=this,p=s("TUIContactSearch");p.chat;var I=p.setActiveContact,C=c().t,x=u("TUIContactList"),j=x.friendList,g=x.setShowContactList,U=i(!1),T=U[0],b=U[1],k=m(),y=k.checkFriend,N=k.isBlock,A=k.getUserProfile,D=i(""),w=D[0],S=D[1],F=i([]),L=F[0],B=F[1];return n("div",t({className:"tui-contact-search"},{children:[o(h,{className:"tui-contact-search-input",placeholder:C("TUIContact.Enter a userID"),clearable:!0,value:w,onBlur:function(t){var e;S(null===(e=t.target)||void 0===e?void 0:e.value)},onFocus:function(){I()},onChange:function(t){var e,r;if(""===(null===(e=t.target)||void 0===e?void 0:e.value))return g(!0),b(!1),void B([]);b(!0),S(null===(r=t.target)||void 0===r?void 0:r.value),g(!1)},onKeyDown:function(){return e(a,void 0,void 0,(function(){return r(this,(function(t){return w&&A(w).then((function(t){var e=t.data;B(e)})),[2]}))}))},prefix:o(l,{type:d.SEARCH,height:16,width:16})}),T&&0===L.length?o("div",t({className:"tui-contact-search-item"},{children:C("TUIContact.No Result")})):L.map((function(i,c){var s=i.userID,u=i.avatar,m=i.nick;return n("div",t({className:"tui-contact-search-item",role:"button",tabIndex:0,onClick:function(){var t;t=i,e(a,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return[4,y(t)];case 1:return r.sent()?(e=j.find((function(t){return t.userID===w})),I({type:"friend",data:e}),[2]):N(t.userID)?(I({type:"block",data:t}),[2]):(I({type:"addFriend",data:t}),[2])}}))}))}},{children:[o(v,{size:30,image:u||f}),o("div",t({className:"search-item-name"},{children:m||s}))]}),s)}))]}))}var I=a.memo(p);export{I as TUIContactSearch,p as UnMemoizedTUIContactSearch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as o}from"react/jsx-runtime";import r,{useMemo as e}from"react";import{TUIConversationProvider as n}from"../../context/TUIConversationContext.js";import{TUIConversationList as i}from"../TUIConversationList/TUIConversationList.js";import"@tencentcloud/chat";function a(r){var a=r.children,s=r.createConversation,m=r.deleteConversation,c=r.filterConversation,v=e((function(){return{createConversation:s,deleteConversation:m,filterConversation:c}}),[s,m,c]);return o(n,t({value:v},{children:a||o(i,{})}))}var s=r.memo(a);export{s as TUIConversation,a as UnMemoizedTUIConversation};
|
|
@@ -4,6 +4,7 @@ import { ConversationPreviewUIComponentProps } from '../ConversationPreview/Conv
|
|
|
4
4
|
import { ConversationListContainerProps } from '../ConversationPreview/ConversationListContainer.js';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
+
componentVisibleOptions?: any;
|
|
7
8
|
filters?: object;
|
|
8
9
|
sort?: object;
|
|
9
10
|
options?: object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as o}from"tslib";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import i,{useState as r,useRef as s}from"react";import{useTranslation as a}from"react-i18next";import{useTUIKitContext as v}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{isH5 as c}from"../../utils/env.js";import l from"./hooks/useConversationList.js";import{ConversationPreview as m}from"../ConversationPreview/ConversationPreview.js";import"@tencentcloud/chat-uikit-engine";import{Icon as C}from"../Icon/Icon.js";import{IconTypes as u}from"../Icon/type.js";import"@tencentcloud/chat";import{useTUIConversationContext as h}from"../../context/TUIConversationContext.js";import{ConversationListContainer as p}from"../ConversationPreview/ConversationListContainer.js";import{ConversationSearchInput as f}from"../ConversationSearch/ConversationSearchInput.js";import{ConversationSearchResult as d}from"../ConversationSearch/ConversationSearchResult.js";import{ConversationCreate as w}from"../ConversationCreate/ConversationCreate.js";import"../ConversationCreate/ConversationGroupTypeInfo.js";import{getDisplayTitle as j}from"../ConversationPreview/utils.js";import{useConversationUpdate as I}from"./hooks/useConversationUpdate.js";function L(i){var L=i.Preview,S=i.Container,g=void 0===S?p:S,x=i.onConversationListUpdated,P=i.filterConversation,T=i.componentVisibleOptions,U=void 0===T?{isProfileShow:!0,isSearchInputShow:!0,isContainerShow:!0}:T;a().t;var N=v("TUIConversationList"),k=N.chat,y=N.customClasses,A=N.conversation,b=N.setActiveConversation;N.setTUIProfileShow;var D=h("TUIConversationList").filterConversation,E=P||D,R=r(0),F=R[0],O=R[1],V=l(k,(function(o,e){o.length&&b(A)}),E),G=V.conversationList,K=V.setConversationList;I(K,x,(function(){return O((function(o){return o+1}))}),E);var M=r(""),q=M[0],z=M[1],B=r(G),H=B[0],J=B[1],Q=r(!1),W=Q[0],X=Q[1],Y=r(""),Z=Y[0],$=Y[1],_=s(null);return e("div",o({className:"tui-conversation ".concat(c?"tui-conversation-h5":""," ").concat(y||""," "),ref:_},{children:W?e(w,{conversationList:G,setConversationCreated:X}):t(n,{children:[U.isSearchInputShow&&t("div",o({className:"tui-conversation-header"},{children:[e(f,{value:q,clearable:!0,onChange:function(o){var e,t;if(z(null===(e=o.target)||void 0===e?void 0:e.value),null===(t=o.target)||void 0===t?void 0:t.value){var n=G.filter((function(e){var t;return j(e).toLocaleLowerCase().includes(null===(t=o.target)||void 0===t?void 0:t.value.toLocaleLowerCase())}));J(n)}else J([])}}),e("div",o({className:"tui-conversation-create-icon"},{children:e(C,{onClick:function(){z(""),X(!0)},type:u.CREATE,height:24,width:24})}))]})),U.isContainerShow&&e(g,o({setConversationList:K},{children:0===G.length?t("div",o({className:"no-result"},{children:[e(C,{className:"no-result-icon",type:u.EFFORT,width:42,height:42}),e("div",o({className:"no-result-message"},{children:"No conversation"}))]})):q?e(d,{Preview:L,searchValue:q,result:H}):G.map((function(t){return e(m,o({},{activeConversation:A,conversation:t,setActiveConversation:b,Preview:L,conversationUpdateCount:F,activeConversationID:Z,setActiveConversationID:$}),t.conversationID)}))}))]})}))}var S=i.memo(L);export{S as TUIConversationList,L as UnMemoTUIConversationList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e,jsxs as o,Fragment as a}from"react/jsx-runtime";import{useState as n,useEffect as c}from"react";import{TUIStore as r,StoreName as i}from"@tencentcloud/chat-uikit-engine";import{useTranslation as s}from"react-i18next";import{isPC as m,isH5 as l}from"../../utils/env.js";import{useTUIKit as h}from"./hooks/useTUIKit.js";import{useCreateTUIKitContext as u}from"./hooks/useCreateTUIKitContext.js";import{TUIKitProvider as f}from"../../context/TUIKitContext.js";import{TUIConversation as I}from"../TUIConversation/TUIConversation.js";import{TUIChat as p}from"../TUIChat/TUIChat.js";import{TUIManage as v}from"../TUIManage/TUIManage.js";import{TUIProfile as d}from"../TUIProfile/TUIProfile.js";import"../TUIProfile/TUIProfileDefault.js";import"@tencentcloud/chat";import"../../context/TUIMessageContext.js";import"../Icon/config.js";import"../Icon/type.js";import{TUIContactInfo as C}from"../TUIContact/TUIContactInfo/TUIContactInfo.js";import{TUIContact as T}from"../TUIContact/TUIContact.js";import"../../locales/index.js";import U from"../Icon/images/chats.svg.js";import g from"../Icon/images/chats-selected.svg.js";import j from"../Icon/images/contacts.svg.js";import w from"../Icon/images/contacts-selected.svg.js";var x=[{id:1,name:"chats",icon:U,selectedIcon:g,value:"chats"},{id:2,name:"contacts",icon:j,selectedIcon:w,value:"contacts"}],N={className:"sample-h5-input",isTransmitter:!0};function M(n){var c=n.moduleValue,r=n.tabbarRender,i=n.setModuleValue;return o(a,{children:[o("div",t({className:"sample-chat-left-container"},{children:[e(d,{className:"sample-chat-profile"}),r,"chats"===c&&e(I,{}),"contacts"===c&&e(T,{})]})),"chats"===c&&o(a,{children:[e(p,{}),e(v,{})]}),"contacts"===c&&e(T,{children:e(C,{showChat:function(){i("chats")}})})]})}function P(n){var c=n.currentConversationID;return o(a,{children:[!c&&o("div",t({className:"sample-chat-h5-container"},{children:[e(d,{className:"sample-profile"}),e(I,{})]})),c&&o(a,{children:[e(p,{TUIMessageInputConfig:N}),e(v,{})]})]})}function b(a){var I=n(""),p=I[0],v=I[1],d=n("chats"),C=d[0],T=d[1],U=s().t,g=a.children,j=a.chat,w=a.customClasses,N=a.activeConversation,b=a.language,S=void 0===b?"en":b;window.tencent_cloud_im_csig_react_uikit_23F_xa=!0;var D=h({chat:j,activeConversation:N,language:S}),_=D.conversation,k=D.contactData,V=D.setActiveConversation,A=D.myProfile,y=D.TUIManageShow,K=D.setTUIManageShow,O=D.TUIProfileShow,R=D.setTUIProfileShow,F=D.setActiveContact,q=u({chat:j,language:S,conversation:_,contactData:k,setActiveConversation:V,customClasses:w,myProfile:A,TUIManageShow:y,setTUIManageShow:K,TUIProfileShow:O,setTUIProfileShow:R,setActiveContact:F});c((function(){return r.watch(i.CONV,{currentConversationID:z}),function(){r.unwatch(i.CONV,{currentConversationID:z})}}),[]);var z=function(t){v(t)},B=e("div",t({className:"sample-chat-tab"},{children:x.map((function(a){return o("div",t({className:"sample-chat-tab-container",role:"presentation",onClick:function(){var t;t=a.value,T(t)}},{children:[e("img",{src:C===a.value?a.selectedIcon:a.icon,alt:""}),e("p",t({className:"sample-chat-tab-text ".concat(C===a.value?"sample-chat-tab-active":"")},{children:U(a.name)}))]}),a.id)}))}));return e(f,t({value:q},{children:e("div",t({className:"tui-kit"},{children:g||m&&e(M,{moduleValue:C,tabbarRender:B,setModuleValue:T})||l&&e(P,{currentConversationID:p})}))}))}export{b as TUIKit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as n,__generator as t}from"tslib";import{useState as o,useEffect as e,useCallback as a}from"react";import{useTranslation as i}from"react-i18next";var r=function(r){var c=r.chat,s=r.activeConversation,v=r.language,u=i().i18n,f=o(s),l=f[0],g=f[1],h=o(),I=h[0],d=h[1],m=o(!1),w=m[0],D=m[1],p=o(!1),M=p[0],P=p[1],S=o(),T=S[0],U=S[1];e((function(){u.changeLanguage(v);n(void 0,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,null==c?void 0:c.getMyProfile()];case 1:return n=t.sent(),d(null==n?void 0:n.data),[2]}}))}))}),[c,v]);var C=a((function(n){n&&(null==c||c.setMessageRead({conversationID:n.conversationID})),l&&n.conversationID!==l.conversationID&&D(!1),g(n)}),[c]);return e((function(){g(s)}),[s]),{conversation:l,contactData:T,setActiveConversation:C,myProfile:I,TUIManageShow:w,setTUIManageShow:D,TUIProfileShow:M,setTUIProfileShow:P,setActiveContact:function(n){U(n)}}};export{r as useTUIKit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as o,useEffect as t}from"react";import{useTranslation as a}from"react-i18next";import{Icon as r}from"../Icon/Icon.js";import{IconTypes as s}from"../Icon/type.js";import{Avatar as l}from"../Avatar/Avatar.js";import{defaultGroupAvatarWork as c,defaultUserAvatar as m}from"../Avatar/default.js";import{Switch as d}from"../Switch/Switch.js";import{useTUIKitContext as v}from"../../context/TUIKitContext.js";import"../../context/TUIMessageContext.js";import{isH5 as h,isPC as u}from"../../utils/env.js";import{getMessageProfile as f}from"../ConversationPreview/utils.js";import{useConversationUpdate as p}from"../TUIConversationList/hooks/useConversationUpdate.js";import{useConversation as g}from"../../hooks/useConversation.js";function C(){var C=a().t,I=o(null),N=I[0],j=I[1],x=o(null),U=x[0],k=x[1],T=o(!1),D=T[0],w=T[1],A=o(0),y=A[0],M=A[1],P=v("TUIManage"),S=P.conversation,b=P.setActiveConversation,L=P.chat,K=P.TUIManageShow,z=P.setTUIManageShow;p(null,(function(){M((function(n){return n+1}))}));var B=g(L),E=B.pinConversation,q=B.deleteConversation,F=function(){z(!1)};return t((function(){j(S),k(f(S)),w(!!S&&S.isPinned)}),[S,y]),K&&S&&e("div",n({className:"tui-manage ".concat(h?"tui-h5-manage":"")},{children:[e("div",n({className:"tui-manage-title"},{children:[u&&i(r,{onClick:F,type:s.CANCEL,width:9,height:16}),h&&i(r,{onClick:F,type:s.BACK,width:9,height:16}),i("span",n({style:{marginLeft:"10px"}},{children:C("TUIConversation.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(l,{size:64,image:(null==U?void 0:U.avatar)||((null==U?void 0:U.groupID)?c:m)})})),i("div",n({className:"info-name"},{children:(null==U?void 0:U.nick)||(null==U?void 0:U.name)})),e("div",n({className:"info-id"},{children:["ID:",(null==U?void 0:U.userID)||(null==U?void 0:U.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:C("TUIConversation.Pin")})),i(d,{onChange:function(n){w(n.target.checked),E({conversationID:N.conversationID,isPinned:n.target.checked})},checked:D})]})),u&&i("div",n({className:"manage-handle-box",role:"presentation",onClick:function(){q(N.conversationID),b(null)}},{children:i("div",n({className:"manage-handle-title red"},{children:C("TUIConversation.Delete")}))}))]}))]}))]}))}export{C as TUIManage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t,jsxs as s}from"react/jsx-runtime";import o,{useState as n,useEffect as i}from"react";import a from"@tencentcloud/chat";import{MESSAGE_STATUS as l}from"../../constants.js";import{useTUIChatStateContext as c}from"../../context/TUIChatStateContext.js";import{useTUIChatActionContext as r}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{Icon as m}from"../Icon/Icon.js";import{IconTypes as u}from"../Icon/type.js";import{useMessageReply as d}from"./hooks/useMessageReply.js";import{MessageProgress as g}from"./MessageProgress.js";function p(o){var p=o.message,b=o.children,f=o.Context,v=o.Plugins,I=n(!1),h=I[0],x=I[1],M=d({message:p}),N=M.messageReply,y=M.replyMessage,S=M.sender,D=r(),E=D.setHighlightedMessageId,j=D.setActiveMessageID,C=c("MessageBubbleWithContext").activeMessageID;i((function(){C!==p.ID&&x(!1)}),[C]);return s("div",e({className:"meesage-bubble"},{children:[s("div",e({className:"meesage-bubble-context ".concat(null==p?void 0:p.flow),role:"button",tabIndex:0,onMouseEnter:function(){j(p.ID),x(!0)},onMouseLeave:function(){j(p.ID),x(!1)},onClick:function(){j(p.ID)}},{children:[s("div",e({className:"message-context\n ".concat(N?"meesage-bubble-reply meesage-bubble-reply-".concat(null==p?void 0:p.flow):"","\n ").concat((null==p?void 0:p.type)!==a.TYPES.MSG_IMAGE&&(null==p?void 0:p.type)!==a.TYPES.MSG_VIDEO&&(null==p?void 0:p.type)!==a.TYPES.MSG_FILE||(null==p?void 0:p.status)!==l.UNSEND?"":"loading")},{children:[N&&s("div",e({className:"meesage-bubble-reply-main",role:"menuitem",tabIndex:0,onClick:function(){E(null==y?void 0:y.ID)}},{children:[t("header",e({className:"title"},{children:S})),f&&t(f,{message:y})]})),b,t(g,{message:p})]})),v&&t("div",e({className:"message-plugin"},{children:h&&t(v,{message:p})}))]})),s("div",e({className:"message-bubble-status icon"},{children:[(null==p?void 0:p.status)===l.FAIL&&t("i",{className:"icon-fail"}),(null==p?void 0:p.status)===l.UNSEND&&t(m,{width:10,height:10,type:u.PROGRESS})]}))]}))}var b=o.memo(p);function f(s){return t(b,e({},s))}export{f as MessageBubble};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as t}from"react/jsx-runtime";import
|
|
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 i}from"./MessageFace.js";import{MessageFile as n}from"./MessageFile.js";import{MessageImage as E}from"./MessageImage.js";import{MessageLocation as M}from"./MessageLocation.js";import{MessageMerger as S}from"./MessageMerger.js";import{MessageText as a}from"./MessageText.js";import{MessageVideo as T}from"./MessageVideo.js";import"react-i18next";import"@tencentcloud/chat-uikit-engine";import"../../constants.js";import"date-fns";import"date-fns/locale";import"../Icon/config.js";import"../Icon/type.js";import{useTUIMessageContext as p}from"../../context/TUIMessageContext.js";import{useMessageContextHandler as c}from"./hooks/useMessageContextHandler.js";import{MessageStatus as g}from"./MessageStatus.js";var l,G=((l={})[s.TYPES.MSG_TEXT]=a,l[s.TYPES.MSG_FACE]=i,l[s.TYPES.MSG_IMAGE]=E,l[s.TYPES.MSG_AUDIO]=m,l[s.TYPES.MSG_VIDEO]=T,l[s.TYPES.MSG_FILE]=n,l[s.TYPES.MSG_CUSTOM]=r,l[s.TYPES.MSG_MERGER]=S,l[s.TYPES.MSG_LOCATION]=M,l);function f(o){var m,r=o.message,i=c({message:r}).context,n=p("MessageCustom"),E=n.CustemElement,M=n.TextElement,S=n.FaceElement,a=n.ImageElement,T=n.AudioElement,l=n.VideoElement,f=n.FileElement,P=n.MergerElement,Y=n.LocationElement,_=((m={})[s.TYPES.MSG_TEXT]=M,m[s.TYPES.MSG_FACE]=S,m[s.TYPES.MSG_IMAGE]=a,m[s.TYPES.MSG_AUDIO]=T,m[s.TYPES.MSG_VIDEO]=l,m[s.TYPES.MSG_FILE]=f,m[s.TYPES.MSG_CUSTOM]=E,m[s.TYPES.MSG_MERGER]=P,m[s.TYPES.MSG_LOCATION]=Y,m)[null==r?void 0:r.type]||G[null==r?void 0:r.type];return _&&t(_,e({context:i,message:r},{children:t(g,{message:r})}))}var P=o.memo(f);function Y(o){return t(P,e({},o))}export{Y as MessageContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t,jsxs as r,Fragment as n}from"react/jsx-runtime";import o from"react";import l from"@tencentcloud/chat";import{useTranslation as i}from"react-i18next";import{JSONStringToParse as a}from"../untils.js";import"../../context/TUIMessageContext.js";import{useComponentContext as u}from"../../context/ComponentContext.js";function c(o){var c=o.context,m=o.message,s=o.children,d=i().t,v=u().MessageCustomPlugins;return r("div",e({className:"bubble message-custom bubble-".concat(m.flow," ").concat((null==m?void 0:m.conversationType)===l.TYPES.CONV_GROUP?"group":"")},{children:[function(o){if("Hyperlink"===o.data){var l=a(null==o?void 0:o.extension);if(null==l?void 0:l.item)return null==l?void 0:l.item.map((function(r){return t("a",e({target:"_blank",href:r.value,rel:"noreferrer"},{children:r.value}),r.value)}));if(null==l?void 0:l.hyperlinks_text){var i=l.hyperlinks_text;return r(n,{children:[l.title," ",t("a",e({target:"_blank",href:null==i?void 0:i.value,rel:"noreferrer"},{children:i.key}),null==i?void 0:i.value)]})}}if("group_create"===o.data)return"".concat((null==m?void 0:m.nick)||(null==m?void 0:m.from)," Create a group");var u=a(o.data);return 1!==(null==u?void 0:u.chatbotPlugin)||15!==(null==u?void 0:u.src)||"welcome_msg"!==(null==u?void 0:u.subtype)&&"clarify_msg"!==(null==u?void 0:u.subtype)?"[".concat(d("TUIChat.Custom message"),"]"):t(v,{data:a(o.data).content})}(null==c?void 0:c.custom),s]}))}var m=o.memo(c);function s(r){return t(m,e({},r))}export{s as MessageCustom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as o}from"tslib";import{jsx as i,jsxs as n}from"react/jsx-runtime";import r,{useState as
|
|
1
|
+
import{__assign as o}from"tslib";import{jsx as i,jsxs as n}from"react/jsx-runtime";import r,{useState as t}from"react";import e from"@tencentcloud/chat";import{isH5 as l}from"../../utils/env.js";import{Model as c}from"../Model/index.js";function m(r){var m,a,u,d=r.context,s=r.message,f=r.children,v=t(!1),g=v[0],p=v[1],b=null===(a=null===(m=null==s?void 0:s.payload)||void 0===m?void 0:m.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(){p(!0)}},{children:i("img",{className:"img ".concat(l?"img-h5":""," bubble-").concat(s.flow," ").concat((null==s?void 0:s.conversationType)===e.TYPES.CONV_GROUP?"group":""),src:d.url,alt:""})})),f,g&&i(c,o({onClick:function(){p(!1)}},{children:i("img",{className:"big-image",src:null===(u=b[0])||void 0===u?void 0:u.url,alt:""})}))]}))}var a=r.memo(m);function u(n){return i(a,o({},n))}export{u as MessageImage};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 l}from"../../context/TUIMessageContext.js";function n(n){n.className;var r=n.CustomName,m=n.message,i=n.showType;return(i===l.ALL||(null==m?void 0:m.flow)===i)&&(null==m?void 0:m.conversationType)===e.TYPES.CONV_GROUP&&i!==l.NONE?r||t("label",o({htmlFor:"content",className:"text-ellipsis name"},{children:(null==m?void 0:m.nick)||(null==m?void 0:m.from)})):null}export{n as MessageName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as i,useRef as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as i,useRef as l}from"react";import{useTranslation as t}from"react-i18next";import n from"@tencentcloud/chat";import{Plugins as r}from"../Plugins/index.js";import{Icon as a}from"../Icon/Icon.js";import{IconTypes as d}from"../Icon/type.js";import{useTUIChatStateContext as c}from"../../context/TUIChatStateContext.js";import{useTUIMessageContext as h}from"../../context/TUIMessageContext.js";import{useMessageHandler as u}from"./hooks/useMessageHandler.js";import{MESSAGE_STATUS as g,MESSAGE_FLOW as p}from"../../constants.js";import"date-fns";import"date-fns/locale";import"@tencentcloud/chat-uikit-engine";import{useMessagePluginElement as m}from"./hooks/useMessagePluginElement.js";var v;function f(v){var f,S,w,y,M,C,T=v.plugins,U=v.showNumber,x=v.MoreIcon,E=v.config,I=t().t,N=i(""),R=N[0];N[1];var k=i({}),j=k[0],b=k[1],q=l(null),O=h("MessagePlugins"),P=O.message,D=O.plugin,F=c("MessageBubbleWithContext").messageListRef,L=u({message:P}),W=L.handleDelMessage,Y=L.handleRevokeMessage,A=L.handleReplyMessage,V=L.handleCopyMessage,B=L.handleResendMessage,G=L.handleForWardMessage,H={quote:e(e({isShow:!0},null==E?void 0:E.quote),null===(f=null==D?void 0:D.config)||void 0===f?void 0:f.quote),forward:e(e({isShow:!0},null==E?void 0:E.forward),null===(S=null==D?void 0:D.config)||void 0===S?void 0:S.forward),copy:e(e({isShow:!0,relateMessageType:[n.TYPES.MSG_TEXT]},null==E?void 0:E.copy),null===(w=null==D?void 0:D.config)||void 0===w?void 0:w.copy),delete:e(e({isShow:!0},null==E?void 0:E.delete),null===(y=null==D?void 0:D.config)||void 0===y?void 0:y.delete),revoke:e(e({isShow:!0},null==E?void 0:E.revoke),null===(M=null==D?void 0:D.config)||void 0===M?void 0:M.revoke),resend:e(e({isShow:!0},null==E?void 0:E.resend),null===(C=null==D?void 0:D.config)||void 0===C?void 0:C.resend)},Q=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:I("TUIChat.Recall")}),o(a,{width:20,height:20,type:d.REVOCATION})]})),handle:function(e){q.current.closeMore(),Y(e)},message:P,isShow:H.revoke.isShow&&(null==P?void 0:P.status)===g.SUCCESS&&P.flow===p.OUT,relateMessageType:H.revoke.relateMessageType}),X=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",e({className:"del"},{children:I("TUIChat.Delete")})),o(a,{width:20,height:20,type:d.DEL})]})),handle:function(e){q.current.closeMore(),W(e)},message:P,isShow:H.delete.isShow&&(null==P?void 0:P.status)===g.SUCCESS,relateMessageType:H.delete.relateMessageType}),_=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:I("TUIChat.Reference")}),o(a,{width:20,height:20,type:d.QUOTE})]})),handle:function(e){q.current.closeMore(),A(e)},message:P,isShow:H.quote.isShow&&(null==P?void 0:P.status)===g.SUCCESS,relateMessageType:H.quote.relateMessageType}),z=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:I("TUIChat.Copy")}),o(a,{width:20,height:20,type:d.COPY})]})),handle:function(e){q.current.closeMore(),V(e)},message:P,isShow:H.copy.isShow&&(null==P?void 0:P.status)===g.SUCCESS,relateMessageType:H.copy.relateMessageType}),J=m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:I("TUIChat.Resend")}),o(a,{width:20,height:20,type:d.REPLY})]})),handle:function(e){q.current.closeMore(),B(e)},message:P,isShow:H.resend.isShow&&(null==P?void 0:P.status)!==g.SUCCESS,relateMessageType:H.resend.relateMessageType}),K=[Q,_,m({children:s("div",e({className:"message-plugin-item"},{children:[o("span",{children:I("TUIChat.Forward")}),o(a,{width:20,height:20,type:d.FORWARD})]})),handle:function(e){q.current.closeMore(),G(e)},message:P,isShow:H.forward.isShow&&(null==P?void 0:P.status)===g.SUCCESS,relateMessageType:H.forward.relateMessageType}),X,J,z],Z=(T||(null==D?void 0:D.plugins)||K).filter((function(e){return e})),$=x||(null==D?void 0:D.MoreIcon)||o(a,{className:"icon-more",width:16,height:16,type:d.MORE}),ee=U||(null==D?void 0:D.showNumber)||0;return(null==P?void 0:P.status)!==g.UNSEND&&o(r,{className:"message-plugin",customClass:R,style:j,ref:q,plugins:Z,showNumber:ee,MoreIcon:$,root:null==F?void 0:F.current,handleVisible:function(e){if(e.x&&e.y){var s=e.y<e.height||e.top,o=e.x<e.width||e.left;b({position:"fixed",left:"".concat(o?e.x:e.x-e.width,"px"),top:"".concat(s?e.y:e.y-e.height,"px")})}}})}!function(e){e.quote="quote",e.forward="forward",e.copy="copy",e.delete="delete",e.resend="resend",e.revoke="revoke"}(v||(v={}));export{f as MessagePlugins};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e,jsxs as o}from"react/jsx-runtime";import n,{useCallback as r}from"react";import{useTranslation as i}from"react-i18next";import a from"@tencentcloud/chat";import{MESSAGE_OPERATE as l,MESSAGE_FLOW as s}from"../../constants.js";import{useTUIChatActionContext as m}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";function c(n){var c=n.message,d=i().t,p=m().operateMessage,u=r((function(){var t;p(((t={})[l.REVOKE]=c,t))}),[p]);return o("div",t({className:"bubble message-system message-revoke"},{children:[(null==c?void 0:c.flow)===s.IN&&e("span",{children:(null==c?void 0:c.nick)||(null==c?void 0:c.from)}),(null==c?void 0:c.flow)!==s.IN&&e("span",t({style:{marginRight:"5px"}},{children:d("TUIChat.You")})),e("span",t({style:{marginRight:"5px"}},{children:d("TUIChat.recalled a message")})),(null==c?void 0:c.flow)===s.OUT&&(null==c?void 0:c.type)===a.TYPES.MSG_TEXT&&e("span",t({className:"edit",role:"button",tabIndex:0,onClick:u},{children:d("TUIChat.Re-edit")}))]}))}var d=n.memo(c);function p(o){return e(d,t({},o))}export{p as MessageRevoke};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e}from"react/jsx-runtime";import o from"react";import"react-i18next";import"@tencentcloud/chat-uikit-engine";import"../../constants.js";import"date-fns";import"date-fns/locale";import"@tencentcloud/chat";import"../Icon/config.js";import"../Icon/type.js";import"../../context/TUIMessageContext.js";import{useMessageContextHandler as r}from"./hooks/useMessageContextHandler.js";function n(o){var n=o.message,s=r({message:n}).context;return e("div",t({className:"bubble message-system"},{children:e("div",{children:s})}))}var s=o.memo(n);function i(o){return e(s,t({},o))}export{i as MessageSystem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from"tslib";import{jsx as e,jsxs as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import r from"react";import o from"@tencentcloud/chat";import{useTUIChatStateContext as a}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as s}from"../../context/ComponentContext.js";function c(r){var c=r.context,i=r.message,l=r.children,m=s().MessageTextPlugins,u=a("MessageText").firstSendMessage;if(m&&"in"===i.flow&&(null==u?void 0:u.time)<=(null==i?void 0:i.time))return e("div",t({className:"bubble message-text bubble-".concat(i.flow," ").concat((null==i?void 0:i.conversationType)===o.TYPES.CONV_GROUP?"group":"")},{children:e(m,{data:i})}));var f=function(t){if(!t)return t;return t.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,(function(t){return"<a class='website' href='".concat(t,"' target='_blank'>").concat(t,"</a>")}))};return e("div",t({className:"bubble message-text bubble-".concat(i.flow," ").concat((null==i?void 0:i.conversationType)===o.TYPES.CONV_GROUP?"group":"")},{children:n("div",t({className:"message-text-content"},{children:[c.text.map((function(t,n){var r=i.ID+n;return"text"===t.name?e("p",{className:"message-text-content-p",dangerouslySetInnerHTML:{__html:f(t.text)}},t.src+r):e("img",{className:"text-img",src:t.src,alt:""},t.src+r)})),l]}))}))}var i=r.memo(c);function l(n){return e(i,t({},n))}export{l as MessageText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e}from"react/jsx-runtime";import o from"react";import"react-i18next";import"@tencentcloud/chat-uikit-engine";import"../../constants.js";import"date-fns";import"date-fns/locale";import"@tencentcloud/chat";import"../Icon/config.js";import"../Icon/type.js";import"../../context/TUIMessageContext.js";import{useMessageContextHandler as r}from"./hooks/useMessageContextHandler.js";function n(o){var n=o.message,i=r({message:n}).context;return e("div",t({className:"bubble message-tip"},{children:i.text}))}var i=o.memo(n);function s(o){return e(i,t({},o))}export{s as MessageTip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as o}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as o}from"tslib";import{jsx as t,jsxs as e}from"react/jsx-runtime";import r,{useState as s}from"react";import{MESSAGE_STATUS as i}from"../../constants.js";import{isH5 as n,isPC as a}from"../../utils/env.js";import{Model as c}from"../Model/index.js";function m(r){var m=r.context,l=r.message,d=r.children,p=s(!1),u=p[0],v=p[1];return e("div",o({className:"message-video ".concat(n?"message-video-h5":"")},{children:[e("div",o({className:"".concat((null==l?void 0:l.status)===i.SUCCESS?"snap-video":""),role:"button",tabIndex:0,onClick:function(){v(!0)}},{children:[a&&t("video",{muted:!0,controls:!1,src:m.url}),n&&t("img",{src:l.payload.snapshotUrl||"https://web.sdk.qcloud.com/im/assets/images/transparent.png",style:{maxHeight:"200px",maxWidth:"200px",borderRadius:"10px"}})]})),d,u&&t(c,o({onClick:function(o){o.stopPropagation(),v(!1)}},{children:t("video",{className:"play-video",autoPlay:!0,controls:!0,src:m.url})}))]}))}var l=r.memo(m);function d(e){return t(l,o({},e))}export{d as MessageVideo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t}from"react/jsx-runtime";import o from"react";import{useTUIChatStateContext as l}from"../../context/TUIChatStateContext.js";import{TUIMessageContextProvider as s}from"../../context/TUIMessageContext.js";import{useComponentContext as n}from"../../context/ComponentContext.js";import{useMessageHandler as i}from"./hooks/useMessageHandler.js";import"@tencentcloud/chat";import"../../constants.js";import"date-fns";import"date-fns/locale";import"@tencentcloud/chat-uikit-engine";import"../Icon/config.js";import"../Icon/type.js";import{TUIMessageDefault as m}from"./TUIMessageDefault.js";import{MessagePlugins as a}from"./MessagePlugins.js";import{MessageContext as r}from"./MessageContext.js";function u(o){var i=o.message,u=o.TUIMessage,d=o.MessagePlugins,g=o.MessageContext,v=o.handleDelete,c=o.CustemElement,f=o.TextElement,E=o.ImageElement,p=o.VideoElement,h=o.AudioElement,x=o.FileElement,M=o.MergerElement,w=o.LocationElement,C=o.FaceElement,j=o.className,T=o.filter,I=o.isShowTime,P=o.isShowRead,S=o.plugin,A=o.prefix,N=o.suffix,D=o.customName,F=o.showAvatar,U=o.showName,L=o.customAvatar,R=o.isShowProgress,V=o.Progress,k=n(),b=k.MessagePlugins,y=k.MessageContext,H=l("TUIMessage").messageConfig,q=u||m,z=d||b||a,B=g||y||r,G=T||(null==H?void 0:H.filter),J=i||(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 t(s,e({value:K},{children:t(q,{message:J,MessageContext:B,MessagePlugins:z,className:j||(null==H?void 0:H.className)})}))}var d=o.memo(u);function g(o){var l=o.message,s=i({message:l}).handleDelMessage;return t(d,e({handleDelete:s},o))}export{g as TUIMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from"tslib";import{useCallback as r}from"react";import"
|
|
1
|
+
import{__awaiter as e,__generator as t}from"tslib";import{useCallback as r}from"react";import{useTranslation as o}from"react-i18next";import{TUIStore as n}from"@tencentcloud/chat-uikit-engine";import{MESSAGE_FLOW as a,MESSAGE_OPERATE as i}from"../../../constants.js";import{enableSampleTaskStatus as s}from"../../untils.js";import{useTUIKitContext as u}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as d}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{Toast as l}from"../../Toast/index.js";var c=function(c){var v=c.message,f=c.handleError,m=d(),p=m.editLocalMessage,g=m.operateMessage;m.revokeMessage;var h=o().t,M=u("useDeleteHandler").chat,x=r((function(r){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return r.preventDefault(),v?(n.getMessageModel(null==v?void 0:v.ID).deleteMessage(),[2]):[2]}))}))}),[v]),y=r((function(r){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return r.preventDefault(),v?(n.getMessageModel(null==v?void 0:v.ID).revokeMessage().then((function(){p(v),s("revokeMessage")})).catch((function(e){if(!f){var t=v.flow===a.OUT?h("TUIChat.The message recall exceeded the time limit (default 2 minutes)"):h("TUIChat.Error revoke Message");throw l({text:t,type:"error"}),new Error(e)}f({functionName:"revokeMessage",error:e})})),[2]):[2]}))}))}),[v]),D=r((function(e){var t;e.preventDefault(),(null==v?void 0:v.ID)&&M&&g&&g(((t={})[i.QUOTE]=v,t))}),[v]),C=r((function(e){if(e.preventDefault(),navigator.clipboard)navigator.clipboard.writeText(v.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=v.payload.text,t.select(),document.execCommand("copy",!0),document.body.removeChild(t)}}),[v]),T=r((function(r){return e(void 0,void 0,void 0,(function(){var e,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,M.resendMessage(v)];case 1:return e=t.sent(),p(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.message),[3,3];case 2:if(r=t.sent(),!f)throw l({text:r,type:"error"}),new Error(r);return f({functionName:"resendMessage",error:r}),[3,3];case 3:return[2]}}))}))}),[v]),I=r((function(r){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){return r.preventDefault(),(null==v?void 0:v.ID)&&M&&g?(g(((e={})[i.FORWARD]=v,e)),[2]):[2]}))}))}),[v]);return{handleDelMessage:x,handleRevokeMessage:y,handleReplyMessage:D,handleCopyMessage:C,handleResendMessage:T,handleForWardMessage:I}};export{c as useMessageHandler};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
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 i,__spreadArray as
|
|
1
|
+
import{__assign as i,__spreadArray as o}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useRef as l}from"react";import{useTranslation as t}from"react-i18next";import{EmojiPicker as r}from"./EmojiPicker.js";import{Plugins as u}from"../Plugins/index.js";import{useUploadElement as s}from"./hooks/useUploadElement.js";import{MESSAGE_TYPE_NAME as c}from"../../constants.js";import{useTUIMessageInputContext as d}from"../../context/TUIMessageInputContext.js";import{Icon as p}from"../Icon/Icon.js";import{IconTypes as m}from"../Icon/type.js";import{useTUIChatStateContext as a}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";function g(){var g,f,v,h,I,C,M,j=d("TUIMessageInputDefault"),U=j.sendUploadMessage,k=j.pluginConfig,x=t().t,E=a("TUIMessageInput").TUIMessageInputConfig,P=(null==k?void 0:k.plugins)||(null===(g=null==E?void 0:E.pluginConfig)||void 0===g?void 0:g.plugins)||[],T=(null==k?void 0:k.showNumber)||(null===(f=null==E?void 0:E.pluginConfig)||void 0===f?void 0:f.showNumber)||1,y=(null==k?void 0:k.MoreIcon)||(null===(v=null==E?void 0:E.pluginConfig)||void 0===v?void 0:v.MoreIcon),N=function(i,o,e){return"boolean"==typeof i?i:"boolean"==typeof o?o:e},b=N(null==k?void 0:k.isEmojiPicker,null===(h=null==E?void 0:E.pluginConfig)||void 0===h?void 0:h.isEmojiPicker,!0),w=N(null==k?void 0:k.isImagePicker,null===(I=null==E?void 0:E.pluginConfig)||void 0===I?void 0:I.isImagePicker,!0),V=N(null==k?void 0:k.isVideoPicker,null===(C=null==E?void 0:E.pluginConfig)||void 0===C?void 0:C.isVideoPicker,!0),D=N(null==k?void 0:k.isFilePicker,null===(M=null==E?void 0:E.pluginConfig)||void 0===M?void 0:M.isFilePicker,!0),F=l(null),O=w&&s({children:e("div",i({className:"input-plugin-item"},{children:[n(p,{width:20,height:20,type:m.IMAGE}),n("span",{children:x("TUIChat.Image")})]})),type:"image",accept:"image/*",onChange:function(i){F.current.closeMore(),U({file:i},c.IMAGE)}}),A=V&&s({children:e("div",i({className:"input-plugin-item"},{children:[n(p,{width:20,height:20,type:m.VIDEO}),n("span",{children:x("TUIChat.Video")})]})),type:"video",accept:"video/*",onChange:function(i){F.current.closeMore(),U({file:i},c.VIDEO)}}),G=D&&s({children:e("div",i({className:"input-plugin-item"},{children:[n(p,{width:20,height:20,type:m.DOCUMENT}),n("span",{children:x("TUIChat.File")})]})),type:"file",accept:"file/*",onChange:function(i){F.current.closeMore(),U({file:i},c.FILE)}}),L=o([b&&n(r,{}),O,A,G],P,!0).filter((function(i){return i}));return n(u,{ref:F,plugins:L,showNumber:T,MoreIcon:y})}export{g as InputPluginsDefalut};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{__assign as e,__spreadArray as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as a,useCallback as i,useEffect as n}from"react";import{useTranslation as l}from"react-i18next";import{useTUIChatActionContext as s}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{Model as c}from"../Model/index.js";import{Icon as d}from"../Icon/Icon.js";import{IconTypes as m}from"../Icon/type.js";import{Input as u}from"../Input/Input.js";import{Checkbox as h}from"../Checkbox/index.js";import{Avatar as f}from"../Avatar/Avatar.js";import{getDisplayImage as v,getDisplayTitle as p}from"../ConversationPreview/utils.js";import{MESSAGE_OPERATE as g}from"../../constants.js";import"@tencentcloud/chat-uikit-engine";import"date-fns";import"date-fns/locale";import"@tencentcloud/chat";import"./hooks/useHandleQuoteMessage.js";import{useHandleForwardMessage as w}from"./hooks/useHandleForwardMessage.js";function C(C){var N,I=C.handleForward,j=l().t,x=a([]),b=x[0],k=x[1],F=a([]),D=F[0],A=F[1],L=a(""),M=L[0],T=L[1],U=s().operateMessage,R=w(),y=R.message,S=R.sendForwardMessage,H=R.conversationList,z=void 0===H?[]:H,E=i((function(e){var t;U(((t={})[g.FORWARD]=null,t))}),[U]),P=z,O=function(e){e.checked?k(t(t([],b,!0),[e.value],!1)):k(b.filter((function(t){return t!==e.value})))};return n((function(){k([]),A([]),T("")}),[y]),y&&z.length>0&&o(c,e({onClick:E},{children:r("div",e({role:"button",tabIndex:0,className:"tui-forward",onClick:function(e){e.stopPropagation()}},{children:[r("header",e({className:"tui-forward-header"},{children:[o(d,{type:m.CANCEL,width:16,height:16,onClick:E}),o("h2",e({className:"tui-forward-title"},{children:j("TUIChat.Forward to")}))]})),o("div",e({className:"tui-forward-search"},{children:o(u,{className:"tui-forward-search-input",placeholder:"Search",clearable:!0,value:M,onChange:function(e){var t,o;if(T(null===(t=e.target)||void 0===t?void 0:t.value),null===(o=e.target)||void 0===o?void 0:o.value){var r=z.filter((function(t){var o,r=p(t).toLocaleLowerCase(),a=null===(o=e.target)||void 0===o?void 0:o.value.toLocaleLowerCase();return r.includes(a)}));A(r)}else A([])},prefix:o(d,{type:m.SEARCH,height:16,width:16})})})),r("main",e({className:"tui-forward-main"},{children:[M&&r("ul",e({className:"tui-forward-list"},{children:[o("h3",e({className:"tui-forward-list-title"},{children:j("TUIChat.Search Result")})),D.length>0&&D.map((function(t){return r("li",e({className:"tui-forward-list-item"},{children:[r("label",e({htmlFor:"".concat(t.conversationID),className:"info"},{children:[o(f,{image:v(t),size:40}),o("div",e({className:"info-nick"},{children:p(t)}))]})),o(h,{onChange:O,id:"".concat(t.conversationID),value:t})]}),t.conversationID)})),0===D.length&&o("p",e({className:"no-result"},{children:j("TUIChat.No Result")}))]})),!M&&P.length>0&&o("ul",e({className:"tui-forward-list"},{children:P.map((function(t){return r("li",e({className:"tui-forward-list-item"},{children:[r("label",e({htmlFor:"".concat(t.conversationID),className:"info"},{children:[o(f,{image:v(t),size:40}),o("div",e({className:"info-nick"},{children:p(t)}))]})),o(h,{onChange:O,id:"".concat(t.conversationID),value:t})]}),t.conversationID)}))}))]})),r("footer",e({className:"tui-forward-footer"},{children:[o("div",e({className:"tui-forward-footer-name"},{children:b.length>0&&(N=b,(null==N?void 0:N.map((function(e){return p(e)}))).toString())})),o("button",e({type:"button",className:"button",onClick:function(){var e;e=b,I?I({list:b,message:y}):S(b),E(e)},disabled:0===b.length},{children:j("TUIChat.Forward")}))]}))]}))}))}export{C as TUIForward};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from"tslib";import{jsx as e,jsxs as
|
|
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 i}from"../../context/TUIMessageInputContext.js";import{useCreateMessageInputContext as r}from"./hooks/useCreateMessageInputContext.js";import{useMessageInputState as a}from"./hooks/useMessageInputState.js";import"@tencentcloud/chat-uikit-engine";import"../../constants.js";import{useTUIChatStateContext as m}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as u}from"../../context/ComponentContext.js";import"date-fns";import"date-fns/locale";import"../Icon/config.js";import"../Icon/type.js";import"./hooks/useHandleQuoteMessage.js";import"react-i18next";import{EmptyStateIndicator as p}from"../EmptyStateIndicator/EmptyStateIndicator.js";import{InputQuoteDefalut as l}from"./InputQuoteDefalut.js";import{TUIMessageInputDefault as c}from"./TUIMessageInputDefault.js";import{InputPluginsDefalut as f}from"./InputPluginsDefalut.js";import{TUIForward as I}from"./TUIForward.js";import{Transmitter as d}from"./Transmitter.js";function g(o){var s=o.children,u=o.disabled,p=o.focus,l=o.pluginConfig,c=o.textareaRef,f=a(o),I=m("TUIMessageInput"),d=I.textareaRef,g=I.conversation,j=(null==g?void 0:g.type)===n.TYPES.CONV_SYSTEM,x=m("TUIMessageInput").TUIMessageInputConfig,T=p||(null==x?void 0:x.focus),v=r(t(t(t({},f),o),{textareaRef:c||(null==x?void 0:x.textareaRef)||d,disabled:u||(null==x?void 0:x.disabled)||j,focus:"boolean"!=typeof T||T,pluginConfig:l}));return e(i,t({value:v},{children:s}))}function j(s){var n=s.TUIMessageInput,i=s.InputPlugins,r=s.InputQuote,a=s.isTransmitter,j=s.className,x=m("TUIMessageInput").TUIMessageInputConfig,T=j||(null==x?void 0:x.className),v=a||(null==x?void 0:x.isTransmitter)||!1,M=u(),C=M.TUIMessageInput,h=M.InputPlugins,U=M.InputQuote,S=n||C||c,b=i||h||f||p,N=r||U||l;return e("div",t({className:"tui-message-input ".concat(T)},{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(j);export{x as TUIMessageInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useEffect as o,useState as r}from"react";import
|
|
1
|
+
import{__assign as t}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import{useEffect as o,useState as r}from"react";import{useTranslation as a}from"react-i18next";import{MESSAGE_OPERATE as i}from"../../constants.js";import{useTUIChatStateContext as s}from"../../context/TUIChatStateContext.js";import"../../context/TUIMessageContext.js";import{useTUIMessageInputContext as u}from"../../context/TUIMessageInputContext.js";import{isPC as c}from"../../utils/env.js";import{formatEmojiString as l}from"../TUIMessage/utils/emojiMap.js";function m(){var m=u("TUIMessageInputDefault"),p=m.text,d=m.disabled,f=m.handleChange,v=m.handleKeyDown,x=m.handlePasete,g=m.textareaRef,h=m.focus,I=m.setText,b=m.setCursorPos,j=a().t,C=s("TUIMessageInputDefault").operateData;o((function(){C[i.REVOKE]&&I(l(C[i.REVOKE].payload.text,1))}),[C]),o((function(){var t,e;return h&&g.current&&(g.current.autofocus=!0,c&&(null===(t=null==g?void 0:g.current)||void 0===t||t.focus()),null===(e=null==g?void 0:g.current)||void 0===e||e.addEventListener("paste",x)),function(){var t;null===(t=null==g?void 0:g.current)||void 0===t||t.removeEventListener("paste",x)}}),[h]);var E=r(!1),T=E[0],U=E[1];return e("div",t({className:"input-box ".concat(d?"disabled":""," ").concat(T?"tui-kit-input-box--focus":"tui-kit-input-box--blur")},{children:[n("div",t({className:"input-visibility-content"},{children:p})),!d&&n("textarea",{placeholder:j("TUIChat.Enter a message"),rows:1,value:p,ref:g,onChange:f,onKeyDown:v,onFocus:function(t){U(!0)},onBlur:function(t){b({start:t.target.selectionStart,end:t.target.selectionEnd}),U(!1)}})]}))}export{m as TUIMessageInputDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e}from"react";import
|
|
1
|
+
import{useCallback as e}from"react";import{useTranslation as t}from"react-i18next";import{TUIChatService as a}from"@tencentcloud/chat-uikit-engine";import{emojiEnKey as n}from"../../TUIMessage/utils/emojiMap.js";function o(o){o.textareaRef;var i=o.insertText,r=t().i18n;return{onSelectEmoji:function(e){"zh"===r.language?i(e.data):i(n[e.data])},sendFaceMessage:e((function(e){a.sendFaceMessage({payload:e})}),[])}}export{o as useEmojiPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from"tslib";import{useState as
|
|
1
|
+
import{__awaiter as t,__generator as e}from"tslib";import{useState as n,useEffect as o}from"react";import r from"@tencentcloud/chat";import{TUIChatService as i}from"@tencentcloud/chat-uikit-engine";import{MESSAGE_OPERATE as s}from"../../../constants.js";import{useTUIKitContext as a}from"../../../context/TUIKitContext.js";import{useTUIChatStateContext as c}from"../../../context/TUIChatStateContext.js";import"react/jsx-runtime";import"../../../context/TUIMessageContext.js";function u(u){var m=this,f=c("TUIMessageInputDefault").operateData,p=n([]),d=p[0],l=p[1],v=a("TUIChat").chat,h=u||f[s.FORWARD];return o((function(){t(m,void 0,void 0,(function(){var t,n;return e(this,(function(e){switch(e.label){case 0:return[4,v.getConversationList()];case 1:return t=e.sent(),l(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.conversationList.filter((function(t){return t.type!==r.TYPES.CONV_SYSTEM}))),[2]}}))}))}),[v]),{message:h,conversationList:d,sendForwardMessage:function(t){t.map((function(t){return i.sendForwardMessage([t],[h]),t}))}}}export{u as useHandleForwardMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from"tslib";import{useCallback as n}from"react";import{CONSTANT_DISPATCH_TYPE as
|
|
1
|
+
import{__awaiter as t,__generator as e}from"tslib";import{useCallback as n}from"react";import{TUIChatService as r}from"@tencentcloud/chat-uikit-engine";import{CONSTANT_DISPATCH_TYPE as o,MESSAGE_TYPE_NAME as a,MESSAGE_OPERATE as i}from"../../../constants.js";import{useTUIKitContext as s}from"../../../context/TUIKitContext.js";import"react/jsx-runtime";import{useTUIChatActionContext as u}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";import{enableSampleTaskStatus as c}from"../../untils.js";import{formatEmojiString as l}from"../../TUIMessage/utils/emojiMap.js";import{useHandleQuoteMessage as d}from"./useHandleQuoteMessage.js";var f=function(f){var p=f.state,T=f.dispatch;f.focus;var m=f.textareaRef,v=f.sendUploadMessage,g=s("useMessageInputText").chat,x=u(),y=x.operateMessage,E=x.setFirstSendMessage,h=d().cloudCustomData,S=["Enter","NumpadEnter"],C=n((function(t){t.preventDefault(),t&&t.target&&T({type:o.SET_TEXT,getNewText:function(e){return t.target.value}})}),[g]),M=function(n){return t(void 0,void 0,void 0,(function(){var t,a;return e(this,(function(e){return null==n||n.preventDefault(),p.text?(t={payload:{text:l(p.text)}},h.messageReply&&(t.cloudCustomData=JSON.stringify(h)),r.sendTextMessage(t).then((function(t){var e=t.data.message;E(e)})),c("sendMessage"),T({getNewText:function(t){return""},type:o.SET_TEXT}),y(((a={})[i.QUOTE]=null,a)),[2]):[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(),M(t)),(null==t?void 0:t.ctrlKey)&&S.indexOf(null==t?void 0:t.code)>-1&&13===t.keyCode&&T({type:o.SET_TEXT,getNewText:function(t){return"".concat(t,"\n")}})}),[M,T]),_=n((function(n){return t(void 0,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){return n.preventDefault(),n.clipboardData&&n.clipboardData.items?(t=n.clipboardData,r=t.types,i=t.items,r.find((function(t,e){var n=i[e];switch(t){case"text/plain":return n.getAsString((function(t){T({type:o.SET_TEXT,getNewText:function(e){return"".concat(e).concat(t)}})})),!0;case"Files":var r=n.getAsFile();return n&&"file"===n.kind&&n.type.match(/^image\//i)&&v({file:r},a.IMAGE),!0;default:return!1}})),[2]):[2]}))}))}),[m]),j=n((function(t){var e;T({type:o.SET_TEXT,getNewText:function(e){return"".concat(e.slice(0,p.cursorPos.start)).concat(t).concat(e.slice(p.cursorPos.start))}}),T({type:o.SET_CURSOR_POS,value:{start:p.cursorPos.start+t.length,end:p.cursorPos.end+t.length}}),null===(e=null==m?void 0:m.current)||void 0===e||e.focus()}),[m,p]),w=n((function(t){var e;T({type:o.SET_TEXT,getNewText:function(){return"".concat(t)}}),null===(e=null==m?void 0:m.current)||void 0===e||e.focus()}),[m]),N=n((function(t){T({type:o.SET_CURSOR_POS,value:t})}),[m]);return{handleChange:C,handleSubmit:M,handleKeyDown:D,handlePasete:_,insertText:j,setText:w,setCursorPos:N}};export{f as useMessageInputText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e}from"react";import{
|
|
1
|
+
import{useCallback as e}from"react";import{TUIChatService as t}from"@tencentcloud/chat-uikit-engine";import{MESSAGE_TYPE_NAME as s}from"../../../constants.js";import{enableSampleTaskStatus as o}from"../../untils.js";import"tslib";import"react/jsx-runtime";import{useTUIChatActionContext as n}from"../../../context/TUIChatActionContext.js";import"../../../context/TUIMessageContext.js";function i(i){var r;n().updateUploadPendingMessageList;var a=((r={})[s.IMAGE]=t.sendImageMessage,r[s.VIDEO]=t.sendVideoMessage,r[s.FILE]=t.sendFileMessage,r);return{sendUploadMessage:e((function(e,t){a[t]({payload:e}),o("sendMessage")}),[])}}export{i as useUploadPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as o,jsxs as n}from"react/jsx-runtime";import s,{useState as l,useEffect as r}from"react";import{useTranslation as a}from"react-i18next";import{useTUIChatStateContext as c}from"../../context/TUIChatStateContext.js";import{useTUIChatActionContext as m}from"../../context/TUIChatActionContext.js";import"../../context/TUIMessageContext.js";import{useComponentContext as d}from"../../context/ComponentContext.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(s){var f=this,v=s.highlightedMessageId,p=s.loadMore,I=s.intervalsTimer,M=s.className,T=a().t,x=l(null),C=x[0],L=x[1],j=l(!1),S=j[0],U=j[1],E=c("TUIMessageList"),y=E.messageList,N=E.highlightedMessageId,b=E.isCompleted;E.isSameLastMessageID;var w=E.messageListRef,H=E.noMore,k=E.TUIMessageListConfig,V=m(),q=V.loadMore,A=V.setHighlightedMessageId,D=d(),P=D.TUIMessage,R=D.EmptyStateIndicator,z=void 0===R?u:R,B=v||(null==k?void 0:k.highlightedMessageId)||N,F=60*(I||(null==k?void 0:k.intervalsTimer)||30),G=p||(null==k?void 0:k.loadMore)||q,J=h({enrichedMessageList:y,TUIMessage:P,intervalsTimer:F});return r((function(){t(f,void 0,void 0,(function(){var e,t,o,n,s;return i(this,(function(i){switch(i.label){case 0:return e=null===(s=null==C?void 0:C.parentElement)||void 0===s?void 0:s.parentElement,!b&&(null==e?void 0:e.clientHeight)>=(null==C?void 0:C.clientHeight)?[4,G()]:[3,2];case 1:i.sent(),i.label=2;case 2:return(null==C?void 0:C.children)&&(t=(null==C?void 0:C.children)||[],o=t[t.length-1],n=setTimeout((function(){null==o||o.scrollIntoView(),U(!0),clearTimeout(n)}),100)),[2]}}))}))}),[J,S]),r((function(){if(B){var e=null==C?void 0:C.querySelector("[data-message-id='".concat(B,"']"));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),A("")}),1e3)}}),[B]),n("div",e({className:"message-list ".concat(M," ").concat(S?"":"hide"),ref:w},{children:[H,H&&o("p",e({className:"no-more"},{children:T("TUIChat.No More")})),o(g,e({className:"message-list-infinite-scroll",hasMore:!0,loadMore:G,threshold:1},{children:o("ul",e({ref:L},{children:(null==J?void 0:J.length)>0?J:o(z,{listType:"message"})}))}))]}))}var v=s.memo(f);function p(t){return o(v,e({},t))}export{p as TUIMessageList};
|