@tencentcloud/chat-uikit-react 2.2.5 → 2.2.7
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 +16 -12
- package/.lintstagedrc.json +1 -1
- package/CHANGELOG.md +18 -0
- package/dist/cjs/assets/fonts/iconfont.ttf +0 -0
- package/dist/cjs/assets/fonts/iconfont.woff +0 -0
- package/dist/cjs/assets/fonts/iconfont.woff2 +0 -0
- package/dist/cjs/components/Avatar/Avatar.d.ts +4 -4
- package/dist/cjs/components/Checkbox/index.d.ts +2 -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/hooks/useConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationListContainer.d.ts +2 -2
- package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +8 -8
- package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.d.ts +2 -2
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/cjs/components/ConversationPreview/utils.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.d.ts +3 -3
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/cjs/components/Icon/Icon.d.ts +3 -3
- package/dist/cjs/components/Icon/config.js +1 -1
- package/dist/cjs/components/Icon/images/video-call.svg.js +1 -0
- package/dist/cjs/components/Icon/images/voice-call.svg.js +1 -0
- package/dist/cjs/components/Icon/type.d.ts +3 -1
- package/dist/cjs/components/Icon/type.js +1 -1
- package/dist/cjs/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +4 -4
- package/dist/cjs/components/Input/Input.d.ts +4 -4
- package/dist/cjs/components/Model/index.d.ts +2 -2
- package/dist/cjs/components/Plugins/index.d.ts +4 -4
- package/dist/cjs/components/Popup/index.d.ts +2 -2
- package/dist/cjs/components/Switch/Switch.d.ts +2 -2
- package/dist/cjs/components/TUIChat/TUIChat.d.ts +15 -14
- package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
- package/dist/cjs/components/TUIChat/TUIChatState.js +1 -1
- package/dist/cjs/components/TUIChat/index.js +1 -0
- package/dist/cjs/components/TUIChat/server.js +1 -0
- package/dist/cjs/components/TUIChat/utils.js +1 -0
- package/dist/cjs/components/TUIChatHeader/TUIChatHeader.d.ts +6 -5
- package/dist/cjs/components/TUIChatHeader/TUIChatHeader.js +1 -1
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +6 -5
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContact.d.ts +3 -3
- package/dist/cjs/components/TUIContact/TUIContact.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +3 -3
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.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/TUIContactInfo/groupInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.d.ts +3 -3
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
- package/dist/cjs/components/TUIContact/hooks/useTUIContact.js +1 -1
- package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -1
- package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
- package/dist/cjs/components/TUIConversation/TUIConversation.d.ts +2 -2
- package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +6 -6
- package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
- package/dist/cjs/components/TUIManage/TUIManage.d.ts +2 -2
- package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageAudio.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageAvatar.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageContext.d.ts +2 -2
- package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageName.js +1 -1
- package/dist/cjs/components/TUIMessage/MessagePlugins.d.ts +4 -4
- package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageProgress.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageStatus.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/TUIMessage.d.ts +19 -19
- package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -1
- package/dist/cjs/components/TUIMessage/utils/index.js +1 -1
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.d.ts +2 -2
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.d.ts +7 -7
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.d.ts +2 -2
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.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.d.ts +2 -2
- package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
- package/dist/cjs/components/TUIProfile/TUIProfile.d.ts +3 -3
- package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/cjs/components/Toast/index.d.ts +2 -2
- package/dist/cjs/components/{untils.js → utils.js} +1 -1
- package/dist/cjs/context/ComponentContext.d.ts +12 -12
- package/dist/cjs/context/LanguageContext.js +1 -0
- package/dist/cjs/context/TUIChatActionContext.d.ts +5 -4
- package/dist/cjs/context/TUIChatStateContext.d.ts +5 -5
- package/dist/cjs/context/TUIContactContext.d.ts +4 -4
- package/dist/cjs/context/TUIConversationContext.js +1 -1
- package/dist/cjs/context/TUIMessageContext.d.ts +17 -17
- package/dist/cjs/context/TUIMessageInputContext.d.ts +4 -4
- package/dist/cjs/context/ThemeContext.js +1 -0
- package/dist/cjs/context/UIKitContext.d.ts +25 -0
- package/dist/cjs/context/UIKitContext.js +1 -0
- package/dist/cjs/context/UIManagerContext.d.ts +46 -0
- package/dist/cjs/context/UIManagerContext.js +1 -0
- package/dist/cjs/hooks/useConversation.d.ts +2 -2
- package/dist/cjs/index.css +1 -2
- package/dist/cjs/index.d.css +1345 -1547
- package/dist/cjs/index.d.ts +2 -4
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/locales/en-US/index.js +1 -1
- package/dist/cjs/locales/index.js +1 -1
- package/dist/cjs/locales/zh-CN/index.js +1 -1
- package/dist/cjs/locales/zh-TW/TUIChat.js +1 -0
- package/dist/cjs/locales/zh-TW/TUIContact.js +1 -0
- package/dist/cjs/locales/zh-TW/TUIConversation.js +1 -0
- package/dist/cjs/locales/zh-TW/TUIProfile.js +1 -0
- package/dist/cjs/locales/zh-TW/index.js +1 -0
- package/dist/esm/assets/fonts/iconfont.ttf +0 -0
- package/dist/esm/assets/fonts/iconfont.woff +0 -0
- package/dist/esm/assets/fonts/iconfont.woff2 +0 -0
- package/dist/esm/components/Avatar/Avatar.d.ts +4 -4
- package/dist/esm/components/Checkbox/index.d.ts +2 -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/hooks/useConversationCreate.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationListContainer.d.ts +2 -2
- package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +8 -8
- package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +2 -2
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/esm/components/ConversationPreview/utils.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.d.ts +3 -3
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/esm/components/Icon/Icon.d.ts +3 -3
- package/dist/esm/components/Icon/config.js +1 -1
- package/dist/esm/components/Icon/images/video-call.svg.js +1 -0
- package/dist/esm/components/Icon/images/voice-call.svg.js +1 -0
- package/dist/esm/components/Icon/type.d.ts +3 -1
- package/dist/esm/components/Icon/type.js +1 -1
- package/dist/esm/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +4 -4
- package/dist/esm/components/Input/Input.d.ts +4 -4
- package/dist/esm/components/Model/index.d.ts +2 -2
- package/dist/esm/components/Plugins/index.d.ts +4 -4
- package/dist/esm/components/Popup/index.d.ts +2 -2
- package/dist/esm/components/Switch/Switch.d.ts +2 -2
- package/dist/esm/components/TUIChat/TUIChat.d.ts +15 -14
- package/dist/esm/components/TUIChat/TUIChat.js +1 -1
- package/dist/esm/components/TUIChat/TUIChatState.js +1 -1
- package/dist/esm/components/TUIChat/index.js +1 -0
- package/dist/esm/components/TUIChat/server.js +1 -0
- package/dist/esm/components/TUIChat/utils.js +1 -0
- package/dist/esm/components/TUIChatHeader/TUIChatHeader.d.ts +6 -5
- package/dist/esm/components/TUIChatHeader/TUIChatHeader.js +1 -1
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +6 -5
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/esm/components/TUIContact/TUIContact.d.ts +3 -3
- package/dist/esm/components/TUIContact/TUIContact.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +3 -3
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.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/TUIContactInfo/groupInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -1
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.d.ts +3 -3
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -1
- package/dist/esm/components/TUIContact/hooks/useTUIContact.js +1 -1
- package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -1
- package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -1
- package/dist/esm/components/TUIConversation/TUIConversation.d.ts +2 -2
- package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +6 -6
- package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -1
- package/dist/esm/components/TUIManage/TUIManage.d.ts +2 -2
- package/dist/esm/components/TUIManage/TUIManage.js +1 -1
- package/dist/esm/components/TUIMessage/MessageAudio.js +1 -1
- package/dist/esm/components/TUIMessage/MessageAvatar.js +1 -1
- package/dist/esm/components/TUIMessage/MessageBubble.js +1 -1
- package/dist/esm/components/TUIMessage/MessageContext.d.ts +2 -2
- package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
- package/dist/esm/components/TUIMessage/MessageCustom.js +1 -1
- package/dist/esm/components/TUIMessage/MessageName.js +1 -1
- package/dist/esm/components/TUIMessage/MessagePlugins.d.ts +4 -4
- package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/esm/components/TUIMessage/MessageProgress.js +1 -1
- package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/esm/components/TUIMessage/MessageStatus.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/TUIMessage.d.ts +19 -19
- package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -1
- package/dist/esm/components/TUIMessage/utils/index.js +1 -1
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.d.ts +2 -2
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.d.ts +7 -7
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.d.ts +2 -2
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.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.d.ts +2 -2
- package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
- package/dist/esm/components/TUIProfile/TUIProfile.d.ts +3 -3
- package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
- package/dist/esm/components/TUIProfile/TUIProfileDefault.d.ts +2 -2
- package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/esm/components/Toast/index.d.ts +2 -2
- package/dist/esm/components/utils.js +1 -0
- package/dist/esm/context/ComponentContext.d.ts +12 -12
- package/dist/esm/context/LanguageContext.js +1 -0
- package/dist/esm/context/TUIChatActionContext.d.ts +5 -4
- package/dist/esm/context/TUIChatStateContext.d.ts +5 -5
- package/dist/esm/context/TUIContactContext.d.ts +4 -4
- package/dist/esm/context/TUIConversationContext.js +1 -1
- package/dist/esm/context/TUIMessageContext.d.ts +17 -17
- package/dist/esm/context/TUIMessageInputContext.d.ts +4 -4
- package/dist/esm/context/ThemeContext.js +1 -0
- package/dist/esm/context/UIKitContext.d.ts +25 -0
- package/dist/esm/context/UIKitContext.js +1 -0
- package/dist/esm/context/UIManagerContext.d.ts +46 -0
- package/dist/esm/context/UIManagerContext.js +1 -0
- package/dist/esm/hooks/useConversation.d.ts +2 -2
- package/dist/esm/index.css +1 -2
- package/dist/esm/index.d.css +1345 -1547
- package/dist/esm/index.d.ts +2 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales/en-US/index.js +1 -1
- package/dist/esm/locales/index.js +1 -1
- package/dist/esm/locales/zh-CN/index.js +1 -1
- package/dist/esm/locales/zh-TW/TUIChat.js +1 -0
- package/dist/esm/locales/zh-TW/TUIContact.js +1 -0
- package/dist/esm/locales/zh-TW/TUIConversation.js +1 -0
- package/dist/esm/locales/zh-TW/TUIProfile.js +1 -0
- package/dist/esm/locales/zh-TW/index.js +1 -0
- package/package.json +5 -3
- package/rollup.config.js +1 -1
- package/src/assets/fonts/iconfont.ttf +0 -0
- package/src/assets/fonts/iconfont.woff +0 -0
- package/src/assets/fonts/iconfont.woff2 +0 -0
- package/src/components/Avatar/styles/index.scss +11 -4
- package/src/components/Checkbox/styles/color.scss +17 -6
- package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +4 -4
- package/src/components/ConversationCreate/ConversationCreate.tsx +2 -2
- package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +3 -2
- package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +5 -5
- package/src/components/ConversationCreate/styles/ConversationCreatGroupDetail.scss +7 -16
- package/src/components/ConversationCreate/styles/conversationCreateSelectView.scss +13 -8
- package/src/components/ConversationCreate/styles/conversationGroupTypeInfo.scss +20 -21
- package/src/components/ConversationCreate/styles/index.scss +30 -17
- package/src/components/ConversationPreview/ConversationPreview.tsx +21 -21
- package/src/components/ConversationPreview/ConversationPreviewContent.tsx +4 -2
- package/src/components/ConversationPreview/styles/index.scss +20 -20
- package/src/components/ConversationPreview/utils.tsx +3 -2
- package/src/components/DivWithEdit/styles/index.scss +30 -10
- package/src/components/Icon/config.ts +14 -4
- package/src/components/Icon/images/video-call.svg +3 -0
- package/src/components/Icon/images/voice-call.svg +3 -0
- package/src/components/Icon/type.ts +2 -0
- package/src/components/Input/styles/index.scss +22 -6
- package/src/components/Plugins/styles/color.scss +3 -11
- package/src/components/Profile/styles/index.scss +12 -3
- package/src/components/TUIChat/TUIChat.tsx +40 -35
- package/src/components/TUIChat/TUIChatState.tsx +41 -41
- package/src/components/TUIChat/index.ts +3 -0
- package/src/components/TUIChat/server.ts +44 -0
- package/src/components/TUIChat/styles/layout.scss +7 -2
- package/src/components/TUIChat/utils.ts +72 -0
- package/src/components/TUIChatHeader/TUIChatHeader.tsx +10 -7
- package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +74 -31
- package/src/components/TUIChatHeader/styles/layout.scss +16 -9
- package/src/components/TUIContact/TUIContact.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/blockInfo.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/friendApplication.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +4 -3
- package/src/components/TUIContact/TUIContactInfo/groupInfo.tsx +3 -3
- package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +2 -2
- package/src/components/TUIContact/TUIContactInfo/index.scss +44 -21
- package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +80 -76
- package/src/components/TUIContact/TUIContactList/index.scss +40 -20
- package/src/components/TUIContact/hooks/useTUIContact.tsx +5 -5
- package/src/components/TUIContact/index.scss +30 -11
- package/src/components/TUIContactSearch/TUIContactSearch.tsx +2 -2
- package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +2 -2
- package/src/components/TUIContactSearch/index.scss +12 -3
- package/src/components/TUIConversationList/TUIConversationList.tsx +3 -4
- package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +2 -2
- package/src/components/TUIConversationList/index.scss +3 -4
- package/src/components/TUIManage/TUIManage.tsx +3 -3
- package/src/components/TUIManage/styles/index.scss +20 -14
- package/src/components/TUIMessage/MessageAvatar.tsx +7 -7
- package/src/components/TUIMessage/MessageBubble.tsx +22 -21
- package/src/components/TUIMessage/MessageCustom.tsx +26 -5
- package/src/components/TUIMessage/MessageStatus.tsx +7 -7
- package/src/components/TUIMessage/MessageText.tsx +16 -15
- package/src/components/TUIMessage/hooks/useMessageHandler.ts +8 -8
- package/src/components/TUIMessage/hooks/useMessageReply.ts +8 -7
- package/src/components/TUIMessage/styles/color.scss +6 -5
- package/src/components/TUIMessage/styles/layout.scss +111 -42
- package/src/components/TUIMessage/utils/index.ts +23 -12
- package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +12 -12
- package/src/components/TUIMessageInput/TUIMessageInput.tsx +1 -1
- package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +7 -6
- package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +14 -14
- package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +4 -4
- package/src/components/TUIMessageInput/styles/color.scss +15 -11
- package/src/components/TUIMessageInput/styles/layout.scss +33 -17
- package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +15 -11
- package/src/components/TUIMessageList/styles/layout.scss +16 -9
- package/src/components/TUIProfile/TUIProfile.tsx +3 -3
- package/src/components/TUIProfile/TUIProfileDefault.tsx +14 -13
- package/src/components/TUIProfile/styles/color.scss +6 -5
- package/src/components/TUIProfile/styles/layout.scss +16 -14
- package/src/components/index.ts +0 -1
- package/src/components/{untils.ts → utils.ts} +5 -4
- package/src/context/LanguageContext.tsx +60 -0
- package/src/context/TUIChatActionContext.tsx +14 -13
- package/src/context/ThemeContext.tsx +68 -0
- package/src/context/UIKitContext.tsx +76 -0
- package/src/context/UIManagerContext.tsx +163 -0
- package/src/context/index.ts +3 -2
- package/src/locales/en-US/index.ts +0 -3
- package/src/locales/index.ts +6 -2
- package/src/locales/zh-CN/index.ts +0 -2
- package/src/locales/zh-TW/TUIChat.ts +27 -0
- package/src/locales/zh-TW/TUIContact.ts +29 -0
- package/src/locales/zh-TW/TUIConversation.ts +32 -0
- package/src/locales/zh-TW/TUIProfile.ts +15 -0
- package/src/locales/zh-TW/index.ts +11 -0
- package/src/styles/colors/_color-dark.scss +31 -21
- package/src/styles/colors/_color-light.scss +31 -21
- package/src/styles/colors/_color-theme.scss +33 -22
- package/src/styles/normalize.scss +6 -0
- package/dist/cjs/components/Icon/images/chats-selected.svg.js +0 -1
- package/dist/cjs/components/Icon/images/chats.svg.js +0 -1
- package/dist/cjs/components/Icon/images/contacts-selected.svg.js +0 -1
- package/dist/cjs/components/Icon/images/contacts.svg.js +0 -1
- package/dist/cjs/components/Icon/images/down-arrow.png.js +0 -1
- package/dist/cjs/components/Icon/images/right-arrow.svg.js +0 -1
- package/dist/cjs/components/TUIChat/unitls.js +0 -1
- package/dist/cjs/components/TUIKit/TUIKit.d.ts +0 -12
- package/dist/cjs/components/TUIKit/TUIKit.js +0 -1
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +0 -21
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +0 -1
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +0 -43
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +0 -1
- package/dist/cjs/context/TUIKitContext.d.ts +0 -25
- package/dist/cjs/context/TUIKitContext.js +0 -1
- package/dist/esm/components/Icon/images/chats-selected.svg.js +0 -1
- package/dist/esm/components/Icon/images/chats.svg.js +0 -1
- package/dist/esm/components/Icon/images/contacts-selected.svg.js +0 -1
- package/dist/esm/components/Icon/images/contacts.svg.js +0 -1
- package/dist/esm/components/Icon/images/down-arrow.png.js +0 -1
- package/dist/esm/components/Icon/images/right-arrow.svg.js +0 -1
- package/dist/esm/components/TUIChat/unitls.js +0 -1
- package/dist/esm/components/TUIKit/TUIKit.d.ts +0 -12
- package/dist/esm/components/TUIKit/TUIKit.js +0 -1
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +0 -21
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +0 -1
- package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +0 -43
- package/dist/esm/components/TUIKit/hooks/useTUIKit.js +0 -1
- package/dist/esm/components/untils.js +0 -1
- package/dist/esm/context/TUIKitContext.d.ts +0 -25
- package/dist/esm/context/TUIKitContext.js +0 -1
- package/scripts/publish-github.js +0 -60
- package/scripts/publish-intl-demo.js +0 -14
- package/scripts/publish-intl-experience-demo.js +0 -14
- package/src/components/TUIChat/unitls.ts +0 -39
- package/src/components/TUIKit/TUIKit.tsx +0 -229
- package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +0 -48
- package/src/components/TUIKit/hooks/useTUIKit.tsx +0 -99
- package/src/components/TUIKit/index.ts +0 -3
- package/src/components/TUIKit/styles/h5.scss +0 -34
- package/src/components/TUIKit/styles/index.scss +0 -132
- package/src/context/TUIKitContext.tsx +0 -44
- package/src/locales/en-US/TUIGlobal.ts +0 -6
- package/src/locales/ja-JP/TUIGlobal.ts +0 -6
- package/src/locales/ko-KR/TUIGlobal.ts +0 -6
- package/src/locales/zh-CN/TUIGlobal.ts +0 -6
|
@@ -9,8 +9,8 @@ import TUIChatEngine, {
|
|
|
9
9
|
TUIStore,
|
|
10
10
|
StoreName,
|
|
11
11
|
} from '@tencentcloud/chat-uikit-engine';
|
|
12
|
-
import { JSONStringToParse } from '../
|
|
13
|
-
import {
|
|
12
|
+
import { JSONStringToParse } from '../utils';
|
|
13
|
+
import { useUIKit, useUIManager } from '../../context';
|
|
14
14
|
import { TUIChatStateContextProvider } from '../../context/TUIChatStateContext';
|
|
15
15
|
import { TUIChatActionProvider } from '../../context/TUIChatActionContext';
|
|
16
16
|
import { ComponentProvider, UnknowPorps } from '../../context/ComponentContext';
|
|
@@ -39,47 +39,49 @@ import { TUIMessageInput as TUIMessageInputElement, TUIMessageInputBasicProps }
|
|
|
39
39
|
import { EmptyStateIndicator } from '../EmptyStateIndicator';
|
|
40
40
|
|
|
41
41
|
interface TUIChatProps {
|
|
42
|
-
className?: string
|
|
43
|
-
conversation?: Conversation
|
|
44
|
-
EmptyPlaceholder?: React.ReactElement
|
|
45
|
-
TUIMessage?: React.ComponentType<TUIMessageProps | UnknowPorps
|
|
46
|
-
TUIChatHeader?: React.ComponentType<TUIChatHeaderDefaultProps
|
|
47
|
-
MessageContext?: React.ComponentType<MessageContextProps
|
|
48
|
-
TUIMessageInput?: React.ComponentType<UnknowPorps
|
|
49
|
-
InputPlugins?: React.ComponentType<UnknowPorps
|
|
50
|
-
InputQuote?: React.ComponentType<UnknowPorps
|
|
51
|
-
MessagePlugins?: React.ComponentType<UnknowPorps
|
|
52
|
-
MessageCustomPlugins?: React.ComponentType<UnknowPorps
|
|
53
|
-
MessageTextPlugins?: React.ComponentType<UnknowPorps
|
|
42
|
+
className?: string;
|
|
43
|
+
conversation?: Conversation;
|
|
44
|
+
EmptyPlaceholder?: React.ReactElement;
|
|
45
|
+
TUIMessage?: React.ComponentType<TUIMessageProps | UnknowPorps>;
|
|
46
|
+
TUIChatHeader?: React.ComponentType<TUIChatHeaderDefaultProps>;
|
|
47
|
+
MessageContext?: React.ComponentType<MessageContextProps>;
|
|
48
|
+
TUIMessageInput?: React.ComponentType<UnknowPorps>;
|
|
49
|
+
InputPlugins?: React.ComponentType<UnknowPorps>;
|
|
50
|
+
InputQuote?: React.ComponentType<UnknowPorps>;
|
|
51
|
+
MessagePlugins?: React.ComponentType<UnknowPorps>;
|
|
52
|
+
MessageCustomPlugins?: React.ComponentType<UnknowPorps>;
|
|
53
|
+
MessageTextPlugins?: React.ComponentType<UnknowPorps>;
|
|
54
54
|
onMessageRecevied?: (
|
|
55
|
-
updateMessage: (event?:
|
|
55
|
+
updateMessage: (event?: Message[]) => void,
|
|
56
56
|
event: any,
|
|
57
|
-
) => void
|
|
58
|
-
sendMessage?: (message:Message, options?:any) => Promise<Message
|
|
59
|
-
revokeMessage?: (message:Message) => Promise<Message
|
|
60
|
-
selectedConversation?: (conversation:Conversation) => Promise<Conversation
|
|
61
|
-
filterMessage?: (messageList:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
) => void;
|
|
58
|
+
sendMessage?: (message: Message, options?: any) => Promise<Message>;
|
|
59
|
+
revokeMessage?: (message: Message) => Promise<Message>;
|
|
60
|
+
selectedConversation?: (conversation: Conversation) => Promise<Conversation>;
|
|
61
|
+
filterMessage?: (messageList: IMessageModel[]) => IMessageModel[];
|
|
62
|
+
callButtonClicked?: (callMediaType?: number, callType?: any) => void;
|
|
63
|
+
messageConfig?: TUIMessageProps;
|
|
64
|
+
cloudCustomData?: string;
|
|
65
|
+
TUIMessageInputConfig?: TUIMessageInputBasicProps;
|
|
66
|
+
TUIMessageListConfig?: MessageListProps;
|
|
67
|
+
[propName: string]: any;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
interface TUIChatInnerProps extends TUIChatProps {
|
|
70
|
-
chat?: ChatSDK
|
|
71
|
+
chat?: ChatSDK;
|
|
71
72
|
key?: string;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function UnMemoizedTUIChat
|
|
75
|
+
function UnMemoizedTUIChat<T extends TUIChatProps>(
|
|
75
76
|
props: PropsWithChildren<T>,
|
|
76
|
-
):React.ReactElement {
|
|
77
|
+
): React.ReactElement {
|
|
77
78
|
const {
|
|
78
79
|
conversation: propsConversation,
|
|
79
80
|
EmptyPlaceholder = <EmptyStateIndicator listType="chat" />,
|
|
80
81
|
} = props;
|
|
81
82
|
|
|
82
|
-
const {
|
|
83
|
+
const { chat } = useUIKit();
|
|
84
|
+
const { conversation: contextConversation } = useUIManager('TUIChat');
|
|
83
85
|
|
|
84
86
|
const conversation = propsConversation || contextConversation;
|
|
85
87
|
|
|
@@ -95,9 +97,9 @@ function UnMemoizedTUIChat <T extends TUIChatProps>(
|
|
|
95
97
|
);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
function TUIChatInner
|
|
100
|
+
function TUIChatInner<T extends TUIChatInnerProps>(
|
|
99
101
|
props: PropsWithChildren<T>,
|
|
100
|
-
):React.ReactElement {
|
|
102
|
+
): React.ReactElement {
|
|
101
103
|
const {
|
|
102
104
|
chat,
|
|
103
105
|
conversation,
|
|
@@ -121,6 +123,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
121
123
|
cloudCustomData,
|
|
122
124
|
TUIMessageInputConfig,
|
|
123
125
|
TUIMessageListConfig,
|
|
126
|
+
callButtonClicked,
|
|
124
127
|
} = props;
|
|
125
128
|
|
|
126
129
|
const [state, dispatch] = useReducer<any>(chatReducer, {
|
|
@@ -162,7 +165,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
162
165
|
setHighlightedMessageId,
|
|
163
166
|
setActiveMessageID,
|
|
164
167
|
} = useHandleMessage({
|
|
165
|
-
// eslint-disable-next-line
|
|
168
|
+
// eslint-disable-next-line
|
|
166
169
|
// @ts-ignore
|
|
167
170
|
state,
|
|
168
171
|
dispatch,
|
|
@@ -182,7 +185,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
182
185
|
}, []);
|
|
183
186
|
|
|
184
187
|
const onMessageListUpdated = (list: IMessageModel[]) => {
|
|
185
|
-
const messageList = list.filter(
|
|
188
|
+
const messageList = list.filter(message => !message.isDeleted);
|
|
186
189
|
// eslint-disable-next-line
|
|
187
190
|
// @ts-ignore
|
|
188
191
|
dispatch({
|
|
@@ -222,7 +225,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
222
225
|
});
|
|
223
226
|
}
|
|
224
227
|
};
|
|
225
|
-
|
|
228
|
+
// eslint-disable-next-line
|
|
226
229
|
// @ts-ignore
|
|
227
230
|
const chatActionContextValue: TUIChatActionContextValue = useMemo(
|
|
228
231
|
() => ({
|
|
@@ -236,6 +239,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
236
239
|
setActiveMessageID,
|
|
237
240
|
updateUploadPendingMessageList,
|
|
238
241
|
setFirstSendMessage,
|
|
242
|
+
callButtonClicked,
|
|
239
243
|
}),
|
|
240
244
|
[
|
|
241
245
|
editLocalMessage,
|
|
@@ -248,6 +252,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
248
252
|
setActiveMessageID,
|
|
249
253
|
updateUploadPendingMessageList,
|
|
250
254
|
setFirstSendMessage,
|
|
255
|
+
callButtonClicked,
|
|
251
256
|
],
|
|
252
257
|
);
|
|
253
258
|
|
|
@@ -268,7 +273,7 @@ function TUIChatInner <T extends TUIChatInnerProps>(
|
|
|
268
273
|
|
|
269
274
|
return (
|
|
270
275
|
<div className={`chat ${className}`}>
|
|
271
|
-
|
|
276
|
+
{/* // eslint-disable-next-line
|
|
272
277
|
// @ts-ignore */}
|
|
273
278
|
<TUIChatStateContextProvider value={chatStateContextValue}>
|
|
274
279
|
<TUIChatActionProvider value={chatActionContextValue}>
|
|
@@ -7,61 +7,61 @@ import { OperateMessageParams } from './hooks/useHandleMessage';
|
|
|
7
7
|
import {
|
|
8
8
|
handleEditMessage,
|
|
9
9
|
handleUploadPendingMessage,
|
|
10
|
-
} from './
|
|
10
|
+
} from './utils';
|
|
11
11
|
|
|
12
12
|
export type ChatStateReducerAction =
|
|
13
13
|
| {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
type: CONSTANT_DISPATCH_TYPE.SET_CONVERSATION_PRPFILE;
|
|
15
|
+
value?: Conversation;
|
|
16
|
+
}
|
|
17
17
|
| {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
type: CONSTANT_DISPATCH_TYPE.SET_MESSAGELIST;
|
|
19
|
+
value?: IMessageModel[];
|
|
20
|
+
}
|
|
21
21
|
| {
|
|
22
|
-
type: CONSTANT_DISPATCH_TYPE.SET_EDIT_MESSAGE
|
|
23
|
-
value?: Message
|
|
24
|
-
index?: number
|
|
22
|
+
type: CONSTANT_DISPATCH_TYPE.SET_EDIT_MESSAGE;
|
|
23
|
+
value?: Message;
|
|
24
|
+
index?: number;
|
|
25
25
|
}
|
|
26
26
|
| {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
type: CONSTANT_DISPATCH_TYPE.SET_IS_COMPLETE;
|
|
28
|
+
value?: boolean;
|
|
29
|
+
}
|
|
30
30
|
| {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
type: CONSTANT_DISPATCH_TYPE.RESET;
|
|
32
|
+
}
|
|
33
33
|
| {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
type: CONSTANT_DISPATCH_TYPE.SET_HIGH_LIGHTED_MESSAGE_ID;
|
|
35
|
+
value?: string;
|
|
36
|
+
}
|
|
37
37
|
| {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
type: CONSTANT_DISPATCH_TYPE.OPERATE_MESSAGE;
|
|
39
|
+
value?: OperateMessageParams;
|
|
40
|
+
}
|
|
41
41
|
| {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
type: CONSTANT_DISPATCH_TYPE.SET_NO_MORE;
|
|
43
|
+
value?: boolean;
|
|
44
|
+
}
|
|
45
45
|
| {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
type: CONSTANT_DISPATCH_TYPE.SET_AUDIO_SOURCE;
|
|
47
|
+
value?: HTMLAudioElement | null;
|
|
48
|
+
}
|
|
49
49
|
| {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
type: CONSTANT_DISPATCH_TYPE.SET_VIDEO_SOURCE;
|
|
51
|
+
value?: HTMLVideoElement | null;
|
|
52
|
+
}
|
|
53
53
|
| {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
type: CONSTANT_DISPATCH_TYPE.UPDATE_UPLOAD_PENDING_MESSAGE_LIST;
|
|
55
|
+
value?: Message;
|
|
56
|
+
}
|
|
57
57
|
| {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
type: CONSTANT_DISPATCH_TYPE.SET_FIRST_SEND_MESSAGE;
|
|
59
|
+
value?: Message;
|
|
60
|
+
}
|
|
61
61
|
| {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
type: CONSTANT_DISPATCH_TYPE.SET_ACTIVE_MESSAGE_ID;
|
|
63
|
+
value?: string;
|
|
64
|
+
};
|
|
65
65
|
export type ChatStateReducer = Reducer<TUIChatStateContextValue, ChatStateReducerAction>;
|
|
66
66
|
|
|
67
67
|
export const chatReducer = (
|
|
@@ -78,7 +78,7 @@ export const chatReducer = (
|
|
|
78
78
|
messageList: action.value,
|
|
79
79
|
};
|
|
80
80
|
case CONSTANT_DISPATCH_TYPE.SET_EDIT_MESSAGE:
|
|
81
|
-
return state.messageList &&
|
|
81
|
+
return state.messageList && action.value && {
|
|
82
82
|
...state,
|
|
83
83
|
messageList: [...handleEditMessage(state.messageList, action.value)],
|
|
84
84
|
};
|
|
@@ -110,7 +110,7 @@ export const chatReducer = (
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
export const initialState:TUIChatStateContextValue = {
|
|
113
|
+
export const initialState: TUIChatStateContextValue = {
|
|
114
114
|
conversation: {} as Conversation,
|
|
115
115
|
messageList: [],
|
|
116
116
|
nextReqMessageID: '',
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import TUICore, { TUIConstants } from '@tencentcloud/tui-core';
|
|
2
|
+
import {
|
|
3
|
+
IMessageModel,
|
|
4
|
+
TUIStore,
|
|
5
|
+
StoreName,
|
|
6
|
+
TUIChatService,
|
|
7
|
+
} from '@tencentcloud/chat-uikit-engine';
|
|
8
|
+
|
|
9
|
+
export default class TUIChatServer {
|
|
10
|
+
public currentConversationID = '';
|
|
11
|
+
public currentMessageList: IMessageModel[] = [];
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
// register service
|
|
15
|
+
TUICore.registerService(TUIConstants.TUIChat.SERVICE.NAME, this);
|
|
16
|
+
// watch current conversationID
|
|
17
|
+
TUIStore.watch(StoreName.CONV, {
|
|
18
|
+
currentConversationID: (id: string) => {
|
|
19
|
+
this.currentConversationID = id;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public onCall(method: string, params: Record<string, any>, callback: void): any {
|
|
25
|
+
let message;
|
|
26
|
+
switch (method) {
|
|
27
|
+
case TUIConstants.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST:
|
|
28
|
+
message = params.message;
|
|
29
|
+
// Two screen-up situations
|
|
30
|
+
// 1. If the call message conversationID is currentConversation,
|
|
31
|
+
// You need to use UPDATE_MESSAGE_LIST to update the messageList of TUIStore in the engine to display it on the screen
|
|
32
|
+
// (because you cannot get the messages you sent at this time)
|
|
33
|
+
// 2. If the call message conversationID is not currentConversation,
|
|
34
|
+
// The next time you switch to the conversation where the call message is located, getMessageList can get all the call messages you sent
|
|
35
|
+
// No need to process here
|
|
36
|
+
if (message?.conversationID === this.currentConversationID) {
|
|
37
|
+
TUIChatService.updateMessageList([message], 'push');
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "../../../styles/colors/color-theme" as *;
|
|
2
|
+
|
|
1
3
|
.chat {
|
|
2
4
|
flex: 1;
|
|
3
5
|
width: 100%;
|
|
@@ -6,5 +8,8 @@
|
|
|
6
8
|
display: flex;
|
|
7
9
|
flex-direction: column;
|
|
8
10
|
position: relative;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
@include theme() {
|
|
13
|
+
background-color: get(bg-color-operate);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import TencentCloudChat, { Message, Conversation } from '@tencentcloud/chat';
|
|
2
|
+
import TUICore, { TUIConstants } from '@tencentcloud/tui-core';
|
|
3
|
+
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
4
|
+
import { useTUIChatActionContext } from '../../context';
|
|
5
|
+
import constant from '../../constants';
|
|
6
|
+
import { JSONStringToParse } from '../utils';
|
|
7
|
+
|
|
8
|
+
export const handleMessage = (messageList: Message[]): Message[] => {
|
|
9
|
+
let customPayloadData: any = null;
|
|
10
|
+
return messageList.filter((item) => {
|
|
11
|
+
if (item.type === TencentCloudChat.TYPES.MSG_CUSTOM) {
|
|
12
|
+
customPayloadData = JSONStringToParse(item?.payload?.data);
|
|
13
|
+
}
|
|
14
|
+
if (customPayloadData && customPayloadData?.businessID === constant.TYPE_TYPING) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const handleEditMessage = (
|
|
22
|
+
messageList: Message[],
|
|
23
|
+
message: Message,
|
|
24
|
+
) => {
|
|
25
|
+
const list = [...messageList];
|
|
26
|
+
const index = list.findIndex(item => item?.ID === message?.ID);
|
|
27
|
+
list[index] = message;
|
|
28
|
+
return list;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const handleUploadPendingMessage = (
|
|
32
|
+
messageList: Message[],
|
|
33
|
+
message: Message,
|
|
34
|
+
) => {
|
|
35
|
+
const list = [...messageList];
|
|
36
|
+
if (!list.some((item: Message) => item.ID === message?.ID)) {
|
|
37
|
+
list.push(message);
|
|
38
|
+
}
|
|
39
|
+
const index = list.findIndex(item => item?.ID === message?.ID);
|
|
40
|
+
list[index] = message;
|
|
41
|
+
return list;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
interface IStartCallParams {
|
|
45
|
+
callType: any;
|
|
46
|
+
callMediaType: number;
|
|
47
|
+
userIDList: string[];
|
|
48
|
+
callButtonClicked?: (callMediaType?: number, callType?: any) => void;
|
|
49
|
+
}
|
|
50
|
+
export const startCall = (params: IStartCallParams) => {
|
|
51
|
+
const { callType, callMediaType, userIDList, callButtonClicked } = params;
|
|
52
|
+
if (callType === TUIChatEngine.TYPES.CONV_C2C) {
|
|
53
|
+
callButtonClicked && callButtonClicked(callMediaType, callType);
|
|
54
|
+
TUICore.callService({
|
|
55
|
+
serviceName: TUIConstants.TUICalling.SERVICE.NAME,
|
|
56
|
+
method: TUIConstants.TUICalling.SERVICE.METHOD.START_CALL,
|
|
57
|
+
params: {
|
|
58
|
+
userIDList,
|
|
59
|
+
type: callMediaType,
|
|
60
|
+
callParams: {
|
|
61
|
+
// doc: https://cloud.tencent.com/document/product/269/105713
|
|
62
|
+
offlinePushInfo: {
|
|
63
|
+
title: 'call',
|
|
64
|
+
description: 'you have a call',
|
|
65
|
+
androidSound: 'private_ring',
|
|
66
|
+
iOSSound: '01.caf',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -8,29 +8,31 @@ import './styles/index.scss';
|
|
|
8
8
|
import { useComponentContext } from '../../context';
|
|
9
9
|
|
|
10
10
|
interface TUIChatHeaderProps {
|
|
11
|
-
title?: string
|
|
12
|
-
TUIChatHeader?: React.ComponentType<TUIChatHeaderDefaultProps
|
|
13
|
-
conversation?: Conversation
|
|
14
|
-
avatar?: React.ReactElement | string
|
|
15
|
-
headerOpateIcon?: React.ReactElement | string
|
|
11
|
+
title?: string;
|
|
12
|
+
TUIChatHeader?: React.ComponentType<TUIChatHeaderDefaultProps>;
|
|
13
|
+
conversation?: Conversation;
|
|
14
|
+
avatar?: React.ReactElement | string;
|
|
15
|
+
headerOpateIcon?: React.ReactElement | string;
|
|
16
|
+
enableCall?: boolean;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function UnMemoizedTUIChatHeader<T extends TUIChatHeaderProps>(
|
|
19
20
|
props: PropsWithChildren<T>,
|
|
20
|
-
):React.ReactElement {
|
|
21
|
+
): React.ReactElement {
|
|
21
22
|
const {
|
|
22
23
|
title,
|
|
23
24
|
conversation: propsConversation,
|
|
24
25
|
TUIChatHeader: propTUIChatHeader,
|
|
25
26
|
avatar,
|
|
26
27
|
headerOpateIcon,
|
|
28
|
+
enableCall,
|
|
27
29
|
} = props;
|
|
28
30
|
|
|
29
31
|
const { conversation: contextConversation } = useTUIChatStateContext('TUIChatHeader');
|
|
30
32
|
const { TUIChatHeader: ContextTUIChatHeader } = useComponentContext('TUIChatHeader');
|
|
31
33
|
|
|
32
34
|
const TUIChatHeaderUIComponent = propTUIChatHeader
|
|
33
|
-
|
|
35
|
+
|| ContextTUIChatHeader || TUIChatHeaderDefault;
|
|
34
36
|
const conversation = propsConversation || contextConversation;
|
|
35
37
|
|
|
36
38
|
return (
|
|
@@ -39,6 +41,7 @@ function UnMemoizedTUIChatHeader<T extends TUIChatHeaderProps>(
|
|
|
39
41
|
conversation={conversation}
|
|
40
42
|
avatar={avatar}
|
|
41
43
|
opateIcon={headerOpateIcon}
|
|
44
|
+
enableCall={enableCall}
|
|
42
45
|
/>
|
|
43
46
|
);
|
|
44
47
|
}
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import TUICore, { TUIConstants } from '@tencentcloud/tui-core';
|
|
2
3
|
import TencentCloudChat, { Conversation, Group, Profile } from '@tencentcloud/chat';
|
|
3
4
|
import { TUIConversationService } from '@tencentcloud/chat-uikit-engine';
|
|
4
5
|
import { Avatar } from '../Avatar';
|
|
5
|
-
import { handleDisplayAvatar } from '../
|
|
6
|
+
import { handleDisplayAvatar } from '../utils';
|
|
6
7
|
import { isH5 } from '../../utils/env';
|
|
7
8
|
import './styles/index.scss';
|
|
8
9
|
import { Icon, IconTypes } from '../Icon';
|
|
9
|
-
import {
|
|
10
|
+
import { useUIManager, useTUIChatActionContext } from '../../context';
|
|
11
|
+
import { startCall } from '../TUIChat/utils';
|
|
10
12
|
|
|
11
13
|
export interface TUIChatHeaderDefaultProps {
|
|
12
|
-
title?: string
|
|
13
|
-
avatar?: React.ReactElement | string
|
|
14
|
-
isOnline?: boolean
|
|
15
|
-
conversation?: Conversation
|
|
16
|
-
pluginComponentList?:
|
|
14
|
+
title?: string;
|
|
15
|
+
avatar?: React.ReactElement | string;
|
|
16
|
+
isOnline?: boolean;
|
|
17
|
+
conversation?: Conversation;
|
|
18
|
+
pluginComponentList?: React.ComponentType[];
|
|
19
|
+
enableCall?: boolean;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export interface TUIChatHeaderBasicProps extends TUIChatHeaderDefaultProps {
|
|
20
|
-
isLive?: boolean
|
|
21
|
-
opateIcon?: React.ReactElement | string
|
|
23
|
+
isLive?: boolean;
|
|
24
|
+
opateIcon?: React.ReactElement | string;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
function TUIChatHeaderDefaultWithContext
|
|
27
|
+
function TUIChatHeaderDefaultWithContext<T extends TUIChatHeaderBasicProps>(
|
|
25
28
|
props: PropsWithChildren<T>,
|
|
26
|
-
):React.ReactElement {
|
|
29
|
+
): React.ReactElement {
|
|
27
30
|
const {
|
|
28
31
|
title: propTitle = '',
|
|
29
32
|
avatar: propAvatar,
|
|
@@ -31,11 +34,13 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
|
|
|
31
34
|
conversation,
|
|
32
35
|
isLive,
|
|
33
36
|
opateIcon,
|
|
37
|
+
enableCall: propCallEnabled = false,
|
|
34
38
|
} = props;
|
|
35
|
-
const {
|
|
39
|
+
const { callButtonClicked } = useTUIChatActionContext('TUIChat');
|
|
40
|
+
const { setActiveContact } = useUIManager('TUIContact');
|
|
36
41
|
const [title, setTitle] = useState(propTitle);
|
|
37
42
|
const [avatar, setAvatar] = useState<React.ReactElement | string>('');
|
|
38
|
-
|
|
43
|
+
const [isShowCallIcon, setIsShowCallIcon] = useState<boolean>(false);
|
|
39
44
|
useEffect(() => {
|
|
40
45
|
setTitle(propTitle);
|
|
41
46
|
if (propAvatar) {
|
|
@@ -44,6 +49,8 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
|
|
|
44
49
|
switch (conversation?.type) {
|
|
45
50
|
case TencentCloudChat.TYPES.CONV_C2C:
|
|
46
51
|
handleC2C(conversation.userProfile, conversation?.remark);
|
|
52
|
+
const isCalling = TUICore.getService(TUIConstants.TUICalling.SERVICE.NAME) ? true : false;
|
|
53
|
+
setIsShowCallIcon(isCalling && propCallEnabled);
|
|
47
54
|
break;
|
|
48
55
|
case TencentCloudChat.TYPES.CONV_GROUP:
|
|
49
56
|
handleGroup(conversation.groupProfile);
|
|
@@ -57,58 +64,95 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
|
|
|
57
64
|
}
|
|
58
65
|
}, [conversation]);
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
function handleC2C(userProfile: Profile, remark?: string) {
|
|
61
68
|
if (!title) {
|
|
62
69
|
setTitle(remark || userProfile?.nick || userProfile?.userID);
|
|
63
70
|
}
|
|
64
71
|
if (!propAvatar) {
|
|
65
72
|
setAvatar(<Avatar size={32} image={handleDisplayAvatar(userProfile.avatar)} />);
|
|
66
73
|
}
|
|
67
|
-
}
|
|
74
|
+
}
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
function handleGroup(groupProfile: Group) {
|
|
70
77
|
if (!title) {
|
|
71
78
|
setTitle(groupProfile?.name || groupProfile?.groupID);
|
|
72
79
|
}
|
|
73
80
|
if (!propAvatar) {
|
|
74
|
-
setAvatar(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
setAvatar(
|
|
82
|
+
<Avatar
|
|
83
|
+
size={32}
|
|
84
|
+
image={handleDisplayAvatar(groupProfile.avatar, TencentCloudChat.TYPES.CONV_GROUP)}
|
|
85
|
+
/>,
|
|
86
|
+
);
|
|
78
87
|
}
|
|
79
|
-
}
|
|
88
|
+
}
|
|
80
89
|
|
|
81
90
|
const back = () => {
|
|
82
91
|
TUIConversationService.switchConversation('');
|
|
83
92
|
setActiveContact();
|
|
84
93
|
};
|
|
85
|
-
const { setTUIManageShow } =
|
|
94
|
+
const { setTUIManageShow } = useUIManager();
|
|
86
95
|
const openTUIManage = () => {
|
|
87
96
|
setTUIManageShow && setTUIManageShow(true);
|
|
88
97
|
};
|
|
89
|
-
|
|
98
|
+
const handleCall = (callMediaType: number) => {
|
|
99
|
+
const userID = conversation?.userProfile?.userID || '';
|
|
100
|
+
const callType = conversation?.type || TencentCloudChat.TYPES.CONV_C2C;
|
|
101
|
+
startCall({ callType, callMediaType, userIDList: [userID], callButtonClicked });
|
|
102
|
+
};
|
|
90
103
|
return (
|
|
91
104
|
<header
|
|
92
105
|
className={`tui-chat-header ${isLive ? 'tui-chat-live-header' : ''}`}
|
|
93
106
|
key={conversation?.conversationID}
|
|
94
107
|
>
|
|
95
|
-
{isH5 && (
|
|
108
|
+
{isH5 && (
|
|
109
|
+
<div style={{ paddingRight: '10px' }}>
|
|
110
|
+
<Icon onClick={back} type={IconTypes.BACK} width={9} height={16} />
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
96
113
|
<div
|
|
97
|
-
className={`tui-chat-header-left ${
|
|
114
|
+
className={`tui-chat-header-left ${
|
|
115
|
+
conversation?.type === TencentCloudChat.TYPES.CONV_SYSTEM
|
|
116
|
+
? 'system'
|
|
117
|
+
: ''
|
|
118
|
+
}`}
|
|
98
119
|
>
|
|
99
120
|
{conversation?.type !== TencentCloudChat.TYPES.CONV_SYSTEM && avatar}
|
|
100
121
|
</div>
|
|
101
122
|
<div className="header-content">
|
|
102
123
|
<h3 className="title">{title}</h3>
|
|
103
124
|
</div>
|
|
125
|
+
{isShowCallIcon && (
|
|
126
|
+
<div className="call-btn-container">
|
|
127
|
+
<Icon
|
|
128
|
+
className="call-btn"
|
|
129
|
+
onClick={() =>
|
|
130
|
+
handleCall(2)}
|
|
131
|
+
type={IconTypes.VIDEOCALL}
|
|
132
|
+
width={24}
|
|
133
|
+
/>
|
|
134
|
+
<Icon
|
|
135
|
+
className="call-btn"
|
|
136
|
+
onClick={() =>
|
|
137
|
+
handleCall(1)}
|
|
138
|
+
type={IconTypes.VOICECALL}
|
|
139
|
+
width={20}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
104
143
|
<div className="tui-chat-header-right">
|
|
105
144
|
<div className="header-handle">
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
145
|
+
{opateIcon || (
|
|
146
|
+
<Icon
|
|
147
|
+
className="header-handle-more"
|
|
148
|
+
onClick={openTUIManage}
|
|
149
|
+
type={IconTypes.ELLIPSE}
|
|
150
|
+
width={18}
|
|
151
|
+
height={5}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
109
154
|
</div>
|
|
110
155
|
</div>
|
|
111
|
-
|
|
112
156
|
</header>
|
|
113
157
|
);
|
|
114
158
|
}
|
|
@@ -116,8 +160,7 @@ function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderBasicProps>(
|
|
|
116
160
|
const MemoizedTUIChatHeaderDefault = React.memo(TUIChatHeaderDefaultWithContext) as
|
|
117
161
|
typeof TUIChatHeaderDefaultWithContext;
|
|
118
162
|
|
|
119
|
-
export function TUIChatHeaderDefault(props: TUIChatHeaderBasicProps)
|
|
120
|
-
:React.ReactElement {
|
|
163
|
+
export function TUIChatHeaderDefault(props: TUIChatHeaderBasicProps): React.ReactElement {
|
|
121
164
|
const options = { ...props };
|
|
122
165
|
return <MemoizedTUIChatHeaderDefault {...options} />;
|
|
123
166
|
}
|