@trtc/calls-uikit-react 4.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/README-zh_CN.md +97 -0
- package/README.md +104 -0
- package/debug/GenerateTestUserSig-es.js +26 -0
- package/debug/lib-generate-test-usersig-es.min.js +2 -0
- package/package.json +42 -0
- package/src/Components/TUICallKit/TUICallKit.module.scss +21 -0
- package/src/Components/TUICallKit/TUICallKit.tsx +267 -0
- package/src/Components/TUICallKit/index.ts +3 -0
- package/src/Components/assets/base/close.svg +1 -0
- package/src/Components/assets/base/error.svg +1 -0
- package/src/Components/assets/base/info.svg +1 -0
- package/src/Components/assets/base/loading-circle.svg +1 -0
- package/src/Components/assets/base/success.svg +1 -0
- package/src/Components/assets/base/waring.svg +1 -0
- package/src/Components/assets/button/accept.svg +10 -0
- package/src/Components/assets/button/backgroundBlurClose.svg +3 -0
- package/src/Components/assets/button/backgroundBlurOpen.svg +3 -0
- package/src/Components/assets/button/camera-close.svg +8 -0
- package/src/Components/assets/button/camera-open.svg +3 -0
- package/src/Components/assets/button/desktop/arrow.png +0 -0
- package/src/Components/assets/button/desktop/fullScreen.svg +4 -0
- package/src/Components/assets/button/desktop/minimize.svg +6 -0
- package/src/Components/assets/button/hangup.svg +3 -0
- package/src/Components/assets/button/microphone-close.svg +4 -0
- package/src/Components/assets/button/microphone-open.svg +4 -0
- package/src/Components/assets/button/mobile/down.svg +4 -0
- package/src/Components/assets/button/mobile/minimize.svg +4 -0
- package/src/Components/assets/button/mobile/switch-camera.svg +3 -0
- package/src/Components/assets/button/mobile/up.svg +4 -0
- package/src/Components/assets/button/speaker-close.svg +4 -0
- package/src/Components/assets/button/speaker-open.svg +3 -0
- package/src/Components/assets/button/switch-audio.svg +3 -0
- package/src/Components/assets/callMessage/audioCall.svg +3 -0
- package/src/Components/assets/callMessage/videoCall.svg +3 -0
- package/src/Components/assets/common/defaultAvatar.svg +11 -0
- package/src/Components/assets/common/microphone-volumn-close.svg +9 -0
- package/src/Components/assets/floatingWindow/desktop/floatCallEnd.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatFullScreen.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophone.svg +4 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophoneClosed.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/camera-close.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/camera-open.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/earphone.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-close.svg +4 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-open.svg +4 -0
- package/src/Components/assets/permission/desktop/index.ts +11 -0
- package/src/Components/assets/permission/desktop/mac/permit-en.jpg +0 -0
- package/src/Components/assets/permission/desktop/mac/permit-zh.jpg +0 -0
- package/src/Components/assets/permission/desktop/win/permit-en.png +0 -0
- package/src/Components/assets/permission/desktop/win/permit-zh.png +0 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-group.svg +19 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-single.svg +6 -0
- package/src/Components/assets/streamInfo/mobile/volumn.svg +20 -0
- package/src/Components/assets/streamInfo/networkStatus.svg +22 -0
- package/src/Components/components/GroupCall/GroupCall.module.scss +13 -0
- package/src/Components/components/GroupCall/GroupCall.tsx +82 -0
- package/src/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.tsx +41 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.module.scss +74 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.tsx +138 -0
- package/src/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.tsx +48 -0
- package/src/Components/components/GroupCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.module.scss +44 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.tsx +89 -0
- package/src/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.tsx +86 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.module.scss +33 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.tsx +121 -0
- package/src/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.ts +29 -0
- package/src/Components/components/SingleCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/SingleCall/SingleCall.module.scss +28 -0
- package/src/Components/components/SingleCall/SingleCall.tsx +54 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.module.scss +3 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.tsx +45 -0
- package/src/Components/components/base/Avatar/Avatar.scss +28 -0
- package/src/Components/components/base/Avatar/Avatar.tsx +52 -0
- package/src/Components/components/base/Avatar/index.ts +3 -0
- package/src/Components/components/base/Button/Button.scss +122 -0
- package/src/Components/components/base/Button/Button.tsx +107 -0
- package/src/Components/components/base/Button/index.ts +3 -0
- package/src/Components/components/base/Drag/Drag.tsx +155 -0
- package/src/Components/components/base/Drag/index.tsx +3 -0
- package/src/Components/components/base/Grid/Col/Col.scss +31 -0
- package/src/Components/components/base/Grid/Col/Col.tsx +52 -0
- package/src/Components/components/base/Grid/Col/index.ts +3 -0
- package/src/Components/components/base/Grid/Row/Row.scss +27 -0
- package/src/Components/components/base/Grid/Row/Row.tsx +51 -0
- package/src/Components/components/base/Grid/Row/index.ts +5 -0
- package/src/Components/components/base/Grid/style/mixin.scss +61 -0
- package/src/Components/components/base/GridLayout/GridLayout.tsx +189 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.scss +11 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.tsx +37 -0
- package/src/Components/components/base/GridLayout/index.ts +7 -0
- package/src/Components/components/base/Icon/Icon.tsx +25 -0
- package/src/Components/components/base/Loading/Circle/Cilrcle.tsx +20 -0
- package/src/Components/components/base/Loading/Circle/Circle.scss +29 -0
- package/src/Components/components/base/Loading/Dot/Dot.scss +69 -0
- package/src/Components/components/base/Loading/Dot/Dot.tsx +21 -0
- package/src/Components/components/base/Loading/Loading.scss +22 -0
- package/src/Components/components/base/Loading/Loading.tsx +47 -0
- package/src/Components/components/base/Loading/index.ts +3 -0
- package/src/Components/components/base/Message/Message.scss +61 -0
- package/src/Components/components/base/Message/Message.tsx +94 -0
- package/src/Components/components/base/Message/MessageIcon/Error.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Info.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Success.tsx +8 -0
- package/src/Components/components/base/Message/MessageIcon/Warning.tsx +7 -0
- package/src/Components/components/base/Message/MessagePlugin.tsx +148 -0
- package/src/Components/components/base/Overlayer/Overlayer.scss +17 -0
- package/src/Components/components/base/Overlayer/Overlayer.tsx +49 -0
- package/src/Components/components/base/Popup/Popup.scss +34 -0
- package/src/Components/components/base/Popup/Popup.tsx +91 -0
- package/src/Components/components/base/Popup/hooks/useTrigger.tsx +67 -0
- package/src/Components/components/base/Portal/Portal.tsx +74 -0
- package/src/Components/components/base/Text/Text.scss +15 -0
- package/src/Components/components/base/Text/Text.tsx +30 -0
- package/src/Components/components/base/Time/Time.scss +14 -0
- package/src/Components/components/base/Time/Time.tsx +13 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.scss +9 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.tsx +83 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.scss +51 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.tsx +50 -0
- package/src/Components/components/base/ToggleWindow/index.ts +7 -0
- package/src/Components/components/base/common.ts +13 -0
- package/src/Components/components/base/hooks/useControlled.ts +31 -0
- package/src/Components/components/base/hooks/useDrag.ts +96 -0
- package/src/Components/components/base/hooks/useListenerEvent.ts +37 -0
- package/src/Components/components/base/hooks/useMutationObserver.ts +38 -0
- package/src/Components/components/base/hooks/useOnClickOutSide.ts +24 -0
- package/src/Components/components/base/util/index.ts +26 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanel.tsx +127 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.module.scss +67 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.tsx +153 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.module.scss +9 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.module.scss +15 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.tsx +46 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Camera.tsx +81 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.module.scss +13 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.tsx +26 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.tsx +42 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Microphone.tsx +78 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.module.scss +23 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.tsx +35 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Speaker.tsx +75 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchAudioCall.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchCamera.tsx +19 -0
- package/src/Components/components/common/ButtonPanel/button/common.module.scss +51 -0
- package/src/Components/components/common/ButtonPanel/config.ts +505 -0
- package/src/Components/components/common/ButtonPanel/index.ts +3 -0
- package/src/Components/components/common/CallMessage/CallMessage.tsx +18 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.module.scss +19 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.tsx +84 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.module.scss +5 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.tsx +37 -0
- package/src/Components/components/common/CallMessage/index.ts +3 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.module.scss +62 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.tsx +105 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindow.tsx +37 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.tsx +97 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/FloatingWindowGroupCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/mobile.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/pc.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.tsx +75 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/FloatingWindowSingleCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/mobile.module.scss +117 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/pc.module.scss +123 -0
- package/src/Components/components/common/FloatingWindow/index.ts +3 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.module.scss +9 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.tsx +50 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.module.scss +165 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.tsx +119 -0
- package/src/Components/components/common/Player/Player.module.scss +11 -0
- package/src/Components/components/common/Player/Player.tsx +75 -0
- package/src/Components/components/common/Pusher/Pusher.module.scss +10 -0
- package/src/Components/components/common/Pusher/Pusher.tsx +96 -0
- package/src/Components/components/common/StreamInfo/StreamInfo.tsx +10 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.module.scss +21 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.tsx +95 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.module.scss +38 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.tsx +35 -0
- package/src/Components/components/common/StreamInfo/index.ts +3 -0
- package/src/Components/components/common/Tip/Tip.tsx +68 -0
- package/src/Components/components/common/TopBar/TopBar.tsx +17 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.module.scss +12 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.tsx +40 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.module.scss +8 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.tsx +36 -0
- package/src/Components/const/common.ts +15 -0
- package/src/Components/context/CallUserInfoContext.ts +21 -0
- package/src/Components/context/CallerUserInfoContext.ts +11 -0
- package/src/Components/context/CustomUIConfigContext.ts +6 -0
- package/src/Components/context/FocusItemContext.ts +13 -0
- package/src/Components/context/IsClickableContext.ts +5 -0
- package/src/Components/context/TranslateContext.ts +6 -0
- package/src/Components/context/UserInfoContext.ts +9 -0
- package/src/Components/context/index.ts +17 -0
- package/src/Components/hooks/index.ts +9 -0
- package/src/Components/hooks/useCallDuration.ts +34 -0
- package/src/Components/hooks/useCustomButtonUIConfig.ts +27 -0
- package/src/Components/hooks/useDeviceList.ts +53 -0
- package/src/Components/hooks/useGetSpeakers.ts +69 -0
- package/src/Components/hooks/useGetVolumeMap.ts +67 -0
- package/src/Components/hooks/useNetWorkStatus.ts +34 -0
- package/src/Components/hooks/useTranslate.ts +7 -0
- package/src/Components/hooks/useViewBackgroundConfig.ts +8 -0
- package/src/Components/style/common/mixin.scss +22 -0
- package/src/Components/style/common/var.scss +21 -0
- package/src/Components/style/index.scss +5 -0
- package/src/Components/style/theme/_dark.scss +56 -0
- package/src/Components/style/theme/_light.scss +56 -0
- package/src/Components/style/theme/_util.scss +79 -0
- package/src/Components/style/theme/color.scss +23 -0
- package/src/Components/util/classnames.ts +35 -0
- package/src/Components/util/index.ts +138 -0
- package/src/Components/util/uiDesign.ts +45 -0
- package/src/TUICallService/CallService/UIDesign.ts +174 -0
- package/src/TUICallService/CallService/bellContext.ts +88 -0
- package/src/TUICallService/CallService/chatCombine.ts +313 -0
- package/src/TUICallService/CallService/engineEventHandler.ts +404 -0
- package/src/TUICallService/CallService/index.ts +797 -0
- package/src/TUICallService/CallService/miniProgram.ts +65 -0
- package/src/TUICallService/CallService/utils.ts +281 -0
- package/src/TUICallService/TUIGlobal/tuiGlobal.ts +43 -0
- package/src/TUICallService/TUIStore/callStore.ts +93 -0
- package/src/TUICallService/TUIStore/tuiStore.ts +167 -0
- package/src/TUICallService/assets/phone_dialing.mp3 +0 -0
- package/src/TUICallService/assets/phone_ringing.mp3 +0 -0
- package/src/TUICallService/const/call.ts +157 -0
- package/src/TUICallService/const/error.ts +20 -0
- package/src/TUICallService/const/index.ts +103 -0
- package/src/TUICallService/const/log.ts +9 -0
- package/src/TUICallService/index.ts +37 -0
- package/src/TUICallService/interface/ICallService.ts +70 -0
- package/src/TUICallService/interface/ICallStore.ts +55 -0
- package/src/TUICallService/interface/ITUIGlobal.ts +36 -0
- package/src/TUICallService/interface/ITUIStore.ts +87 -0
- package/src/TUICallService/interface/index.ts +4 -0
- package/src/TUICallService/locales/en.ts +135 -0
- package/src/TUICallService/locales/index.ts +61 -0
- package/src/TUICallService/locales/ja_JP.ts +134 -0
- package/src/TUICallService/locales/zh-cn.ts +130 -0
- package/src/TUICallService/serve/callManager.ts +109 -0
- package/src/TUICallService/utils/common-utils.ts +269 -0
- package/src/TUICallService/utils/decorators/promise-retry.ts +51 -0
- package/src/TUICallService/utils/env.ts +51 -0
- package/src/TUICallService/utils/index.ts +32 -0
- package/src/TUICallService/utils/is-empty.ts +31 -0
- package/src/TUICallService/utils/retry.ts +88 -0
- package/src/TUICallService/utils/timer.ts +162 -0
- package/src/TUICallService/utils/validate/avoidRepeatedCall.ts +39 -0
- package/src/TUICallService/utils/validate/index.ts +7 -0
- package/src/TUICallService/utils/validate/validateConfig.ts +188 -0
- package/src/TUICallService/utils/validate/validateParams.ts +88 -0
- package/src/TUICallService/utils/validate/validateStatus.ts +26 -0
- package/src/image.d.ts +8 -0
- package/src/index.ts +63 -0
- package/src/style.d.ts +1 -0
- package/tuicall-uikit-react.es.js +13177 -0
- package/tuicall-uikit-react.umd.js +133 -0
- package/types/Components/TUICallKit/TUICallKit.d.ts +15 -0
- package/types/Components/TUICallKit/index.d.ts +2 -0
- package/types/Components/assets/permission/desktop/index.d.ts +5 -0
- package/types/Components/components/GroupCall/GroupCall.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.d.ts +10 -0
- package/types/Components/components/GroupCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.d.ts +7 -0
- package/types/Components/components/GroupCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/GroupCall/Waiting/Waiting.d.ts +8 -0
- package/types/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.d.ts +11 -0
- package/types/Components/components/SingleCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.d.ts +3 -0
- package/types/Components/components/SingleCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/SingleCall/SingleCall.d.ts +3 -0
- package/types/Components/components/SingleCall/Waiting/Waiting.d.ts +9 -0
- package/types/Components/components/base/Avatar/Avatar.d.ts +12 -0
- package/types/Components/components/base/Avatar/index.d.ts +2 -0
- package/types/Components/components/base/Button/Button.d.ts +25 -0
- package/types/Components/components/base/Button/index.d.ts +2 -0
- package/types/Components/components/base/Drag/Drag.d.ts +14 -0
- package/types/Components/components/base/Drag/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Col/Col.d.ts +14 -0
- package/types/Components/components/base/Grid/Col/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Row/Row.d.ts +14 -0
- package/types/Components/components/base/Grid/Row/index.d.ts +3 -0
- package/types/Components/components/base/GridLayout/GridLayout.d.ts +11 -0
- package/types/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.d.ts +14 -0
- package/types/Components/components/base/GridLayout/index.d.ts +3 -0
- package/types/Components/components/base/Icon/Icon.d.ts +9 -0
- package/types/Components/components/base/Loading/Circle/Cilrcle.d.ts +6 -0
- package/types/Components/components/base/Loading/Dot/Dot.d.ts +6 -0
- package/types/Components/components/base/Loading/Loading.d.ts +14 -0
- package/types/Components/components/base/Loading/index.d.ts +2 -0
- package/types/Components/components/base/Message/Message.d.ts +16 -0
- package/types/Components/components/base/Message/MessageIcon/Error.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Info.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Success.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Warning.d.ts +1 -0
- package/types/Components/components/base/Message/MessagePlugin.d.ts +14 -0
- package/types/Components/components/base/Overlayer/Overlayer.d.ts +14 -0
- package/types/Components/components/base/Popup/Popup.d.ts +13 -0
- package/types/Components/components/base/Popup/hooks/useTrigger.d.ts +10 -0
- package/types/Components/components/base/Portal/Portal.d.ts +19 -0
- package/types/Components/components/base/Text/Text.d.ts +10 -0
- package/types/Components/components/base/Time/Time.d.ts +7 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindow.d.ts +15 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.d.ts +14 -0
- package/types/Components/components/base/ToggleWindow/index.d.ts +3 -0
- package/types/Components/components/base/common.d.ts +7 -0
- package/types/Components/components/base/hooks/useControlled.d.ts +8 -0
- package/types/Components/components/base/hooks/useDrag.d.ts +6 -0
- package/types/Components/components/base/hooks/useListenerEvent.d.ts +13 -0
- package/types/Components/components/base/hooks/useMutationObserver.d.ts +4 -0
- package/types/Components/components/base/hooks/useOnClickOutSide.d.ts +1 -0
- package/types/Components/components/base/util/index.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanel.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.d.ts +8 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.d.ts +6 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/Accept.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Camera.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/Hangup.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Microphone.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/Minimize.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/Reject.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Speaker.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchAudioCall.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchCamera.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/config.d.ts +254 -0
- package/types/Components/components/common/ButtonPanel/index.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessage.d.ts +10 -0
- package/types/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.d.ts +2 -0
- package/types/Components/components/common/CallMessage/index.d.ts +2 -0
- package/types/Components/components/common/DeviceSelector/DeviceSelector.d.ts +7 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindow.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.d.ts +9 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/index.d.ts +2 -0
- package/types/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.d.ts +8 -0
- package/types/Components/components/common/OverlayStream/OverlayStream.d.ts +28 -0
- package/types/Components/components/common/Player/Player.d.ts +15 -0
- package/types/Components/components/common/Pusher/Pusher.d.ts +13 -0
- package/types/Components/components/common/StreamInfo/StreamInfo.d.ts +1 -0
- package/types/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.d.ts +10 -0
- package/types/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.d.ts +9 -0
- package/types/Components/components/common/StreamInfo/index.d.ts +2 -0
- package/types/Components/components/common/Tip/Tip.d.ts +7 -0
- package/types/Components/components/common/TopBar/TopBar.d.ts +1 -0
- package/types/Components/components/common/TopBar/h5/TopBarH5.d.ts +5 -0
- package/types/Components/components/common/TopBar/pc/TopBarPC.d.ts +5 -0
- package/types/Components/const/common.d.ts +11 -0
- package/types/Components/context/CallUserInfoContext.d.ts +17 -0
- package/types/Components/context/CallerUserInfoContext.d.ts +7 -0
- package/types/Components/context/CustomUIConfigContext.d.ts +3 -0
- package/types/Components/context/FocusItemContext.d.ts +8 -0
- package/types/Components/context/IsClickableContext.d.ts +2 -0
- package/types/Components/context/TranslateContext.d.ts +4 -0
- package/types/Components/context/UserInfoContext.d.ts +6 -0
- package/types/Components/context/index.d.ts +8 -0
- package/types/Components/hooks/index.d.ts +4 -0
- package/types/Components/hooks/useCallDuration.d.ts +1 -0
- package/types/Components/hooks/useCustomButtonUIConfig.d.ts +1 -0
- package/types/Components/hooks/useDeviceList.d.ts +8 -0
- package/types/Components/hooks/useGetSpeakers.d.ts +1 -0
- package/types/Components/hooks/useGetVolumeMap.d.ts +3 -0
- package/types/Components/hooks/useNetWorkStatus.d.ts +1 -0
- package/types/Components/hooks/useTranslate.d.ts +3 -0
- package/types/Components/hooks/useViewBackgroundConfig.d.ts +1 -0
- package/types/Components/util/classnames.d.ts +1 -0
- package/types/Components/util/index.d.ts +15 -0
- package/types/Components/util/uiDesign.d.ts +2 -0
- package/types/TUICallService/CallService/UIDesign.d.ts +28 -0
- package/types/TUICallService/CallService/bellContext.d.ts +19 -0
- package/types/TUICallService/CallService/chatCombine.d.ts +50 -0
- package/types/TUICallService/CallService/engineEventHandler.d.ts +35 -0
- package/types/TUICallService/CallService/index.d.ts +98 -0
- package/types/TUICallService/CallService/miniProgram.d.ts +7 -0
- package/types/TUICallService/CallService/utils.d.ts +42 -0
- package/types/TUICallService/TUIGlobal/tuiGlobal.d.ts +21 -0
- package/types/TUICallService/TUIStore/callStore.d.ts +10 -0
- package/types/TUICallService/TUIStore/tuiStore.d.ts +57 -0
- package/types/TUICallService/const/call.d.ts +141 -0
- package/types/TUICallService/const/error.d.ts +2 -0
- package/types/TUICallService/const/index.d.ts +27 -0
- package/types/TUICallService/const/log.d.ts +7 -0
- package/types/TUICallService/index.d.ts +5 -0
- package/types/TUICallService/interface/ICallService.d.ts +69 -0
- package/types/TUICallService/interface/ICallStore.d.ts +47 -0
- package/types/TUICallService/interface/ITUIGlobal.d.ts +36 -0
- package/types/TUICallService/interface/ITUIStore.d.ts +83 -0
- package/types/TUICallService/interface/index.d.ts +4 -0
- package/types/TUICallService/locales/en.d.ts +128 -0
- package/types/TUICallService/locales/index.d.ts +10 -0
- package/types/TUICallService/locales/ja_JP.d.ts +127 -0
- package/types/TUICallService/locales/zh-cn.d.ts +123 -0
- package/types/TUICallService/serve/callManager.d.ts +11 -0
- package/types/TUICallService/utils/common-utils.d.ts +62 -0
- package/types/TUICallService/utils/decorators/promise-retry.d.ts +32 -0
- package/types/TUICallService/utils/env.d.ts +10 -0
- package/types/TUICallService/utils/index.d.ts +2 -0
- package/types/TUICallService/utils/is-empty.d.ts +2 -0
- package/types/TUICallService/utils/retry.d.ts +36 -0
- package/types/TUICallService/utils/timer.d.ts +63 -0
- package/types/TUICallService/utils/validate/avoidRepeatedCall.d.ts +10 -0
- package/types/TUICallService/utils/validate/index.d.ts +2 -0
- package/types/TUICallService/utils/validate/validateConfig.d.ts +173 -0
- package/types/TUICallService/utils/validate/validateParams.d.ts +1 -0
- package/types/TUICallService/utils/validate/validateStatus.d.ts +5 -0
- package/types/index.d.ts +11 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { TUICore, TUILogin, TUIConstants, ExtensionInfo } from '@tencentcloud/tui-core';
|
|
2
|
+
import { CallMediaType, AudioCallIcon, VideoCallIcon, LOG_LEVEL, COMPONENT, StoreName, NAME, CallStatus, CallType, ACTION_TYPE } from '../const/index';
|
|
3
|
+
import { isUndefined, formatTime, JSONToObject } from '../utils/common-utils';
|
|
4
|
+
import { getRemoteUserProfile } from './utils';
|
|
5
|
+
import { ITUIStore } from '../interface/ITUIStore';
|
|
6
|
+
import TuiStore from '../TUIStore/tuiStore';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import TencentCloudChat from '@tencentcloud/lite-chat/basic'; // 仅支持 calls 接口
|
|
9
|
+
import { t } from '../locales/index';
|
|
10
|
+
const TUIStore: ITUIStore = TuiStore.getInstance();
|
|
11
|
+
|
|
12
|
+
const cmd2messageCardContentMap = {
|
|
13
|
+
audioCall: () => 'Voice call',
|
|
14
|
+
videoCall: () => 'Video call',
|
|
15
|
+
switchToAudio: () => 'Switch audio call',
|
|
16
|
+
switchToVideo: () => 'Switch video call',
|
|
17
|
+
hangup: ({ callDuration }) => `${t('Call duration')}:${callDuration}`,
|
|
18
|
+
};
|
|
19
|
+
export default class ChatCombine {
|
|
20
|
+
static instance: ChatCombine;
|
|
21
|
+
private _callService: any;
|
|
22
|
+
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this._callService = options.callService;
|
|
25
|
+
|
|
26
|
+
// 下面:TUICore注册事件,注册组件服务,注册界面拓展
|
|
27
|
+
TUICore.registerEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS, this); // onNotifyEvent
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
if (TUIConstants.TUIChat?.EVENT) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
TUICore.registerEvent(TUIConstants.TUIChat.EVENT?.CHAT_STATE_CHANGED, TUIConstants.TUIChat.EVENT_SUB_KEY?.CHAT_OPENED, this); // onNotifyEvent
|
|
32
|
+
}
|
|
33
|
+
TUICore.registerService(TUIConstants.TUICalling.SERVICE.NAME, this); // onCall
|
|
34
|
+
TUICore.registerExtension(TUIConstants.TUIChat.EXTENSION.INPUT_MORE.EXT_ID, this); // onGetExtension
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static getInstance(options) {
|
|
38
|
+
if (!ChatCombine.instance) {
|
|
39
|
+
ChatCombine.instance = new ChatCombine(options);
|
|
40
|
+
}
|
|
41
|
+
return ChatCombine.instance;
|
|
42
|
+
}
|
|
43
|
+
// ================ 【】 ================
|
|
44
|
+
/**
|
|
45
|
+
* message on screen
|
|
46
|
+
* @param {Any} params Parameters for message up-screening
|
|
47
|
+
*/
|
|
48
|
+
public callTUIService(params) {
|
|
49
|
+
const { message } = params || {};
|
|
50
|
+
TUICore.callService({
|
|
51
|
+
serviceName: TUIConstants.TUIChat.SERVICE.NAME,
|
|
52
|
+
method: TUIConstants.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST,
|
|
53
|
+
params: { message },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* tuicore getExtension
|
|
58
|
+
* @param {String} extensionID extension id
|
|
59
|
+
* @param {Any} params tuicore pass parameters
|
|
60
|
+
* @returns {Any[]} return extension
|
|
61
|
+
*/
|
|
62
|
+
public onGetExtension(extensionID: string, params: any) {
|
|
63
|
+
if (extensionID === TUIConstants.TUIChat.EXTENSION.INPUT_MORE.EXT_ID) {
|
|
64
|
+
this._callService.getTUICallEngineInstance()?.reportLog?.({ name: 'TUICallKit.onGetExtension', data: { extensionID, params } });
|
|
65
|
+
|
|
66
|
+
if (isUndefined(params)) return [];
|
|
67
|
+
// room and customer_service ChatType not show audio and video icon.
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
if ([TUIConstants.TUIChat.TYPE.ROOM, TUIConstants.TUIChat.TYPE.CUSTOMER_SERVICE].includes(params.chatType)) return [];
|
|
70
|
+
|
|
71
|
+
let list = [];
|
|
72
|
+
const audioCallExtension: ExtensionInfo = {
|
|
73
|
+
weight: 1000,
|
|
74
|
+
text: '语音通话',
|
|
75
|
+
icon: AudioCallIcon,
|
|
76
|
+
data: {
|
|
77
|
+
name: 'voiceCall',
|
|
78
|
+
},
|
|
79
|
+
listener: {
|
|
80
|
+
onClicked: async options => await this._handleTUICoreOnClick(options, options.type || CallMediaType.AUDIO),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
const videoCallExtension: ExtensionInfo = {
|
|
84
|
+
weight: 900,
|
|
85
|
+
text: '视频通话',
|
|
86
|
+
icon: VideoCallIcon,
|
|
87
|
+
data: {
|
|
88
|
+
name: 'videoCall',
|
|
89
|
+
},
|
|
90
|
+
listener: {
|
|
91
|
+
onClicked: async options => await this._handleTUICoreOnClick(options, options.type || CallMediaType.VIDEO),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
if (params?.chatType) {
|
|
96
|
+
list = [audioCallExtension, videoCallExtension];
|
|
97
|
+
} else {
|
|
98
|
+
!params?.filterVoice && list.push(audioCallExtension);
|
|
99
|
+
!params?.filterVideo && list.push(videoCallExtension);
|
|
100
|
+
}
|
|
101
|
+
return list;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
public async onCall(method: String, params: any) {
|
|
105
|
+
if (method === TUIConstants.TUICalling.SERVICE.METHOD.START_CALL) {
|
|
106
|
+
await this._handleTUICoreOnClick(params, params.type);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* tuicore notify event manager
|
|
111
|
+
* @param {String} eventName event name
|
|
112
|
+
* @param {String} subKey sub key
|
|
113
|
+
* @param {Any} options tuicore event parameters
|
|
114
|
+
*/
|
|
115
|
+
public async onNotifyEvent(eventName: string, subKey: string, options?: any) {
|
|
116
|
+
try {
|
|
117
|
+
if (eventName === TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED) {
|
|
118
|
+
// TUICallkit executes its own business logic when it receives a successful login.
|
|
119
|
+
if (subKey === TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS) {
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
const { chat, userID, userSig, SDKAppID } = TUILogin.getContext();
|
|
122
|
+
|
|
123
|
+
await this._callService?.init({ tim: chat, userID, userSig, sdkAppID: SDKAppID, isFromChat: true, component: COMPONENT.TIM_CALL_KIT });
|
|
124
|
+
this._callService?.setIsFromChat(true);
|
|
125
|
+
this._callService?.setLogLevel(LOG_LEVEL.NORMAL); // setLogLevel to 0 in tuikit. easy to find out problem via logs.
|
|
126
|
+
this._addListenChatEvent();
|
|
127
|
+
} else if (subKey === TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS) {
|
|
128
|
+
this._removeListenChatEvent();
|
|
129
|
+
await this._callService?.destroyed();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
if (TUIConstants.TUIChat?.EVENT && eventName === TUIConstants.TUIChat.EVENT.CHAT_STATE_CHANGED) {
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
if (subKey === TUIConstants.TUIChat.EVENT_SUB_KEY.CHAT_OPENED) {
|
|
136
|
+
this._callService?.setCurrentGroupId(options?.groupID || '');
|
|
137
|
+
if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) return;
|
|
138
|
+
|
|
139
|
+
const currentGroupId = this._callService?.getCurrentGroupId();
|
|
140
|
+
const groupAttributes = currentGroupId ? await this.getGroupAttributes(this._callService?.getTim(), currentGroupId) : {};
|
|
141
|
+
await this.updateStoreBasedOnGroupAttributes(groupAttributes);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error(`${NAME.PREFIX}TUICore onNotifyEvent failed, error: ${error}.`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Handling the chat+call scenario, data required for the joinInGroupCall API: update store / clear relevant store data
|
|
149
|
+
public async updateStoreBasedOnGroupAttributes(groupAttributes: any) {
|
|
150
|
+
this._callService?.getTUICallEngineInstance()?.reportLog?.({
|
|
151
|
+
name: 'TUICallKit.getJoinGroupCallInfo.success',
|
|
152
|
+
data: { groupAttributes },
|
|
153
|
+
});
|
|
154
|
+
try {
|
|
155
|
+
const {
|
|
156
|
+
call_id: callId = '', // callEngine v3.1 support
|
|
157
|
+
group_id: groupId = '',
|
|
158
|
+
room_id: roomId = 0,
|
|
159
|
+
room_id_type: roomIdType = 0,
|
|
160
|
+
call_media_type: callType = NAME.UNKNOWN,
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
user_list: userList, // The default value of the user list returned by the background is null
|
|
163
|
+
} = groupAttributes[NAME.INNER_ATTR_KIT_INFO] ? JSON.parse(groupAttributes[NAME.INNER_ATTR_KIT_INFO]) : {};
|
|
164
|
+
|
|
165
|
+
let userListInfo = (userList || []).map(user => user.userid);
|
|
166
|
+
if (userListInfo.length > 0) {
|
|
167
|
+
userListInfo = await getRemoteUserProfile(userListInfo, this._callService?.getTim());
|
|
168
|
+
}
|
|
169
|
+
const updateStoreParams = {
|
|
170
|
+
[NAME.CALL_ID]: callId,
|
|
171
|
+
[NAME.GROUP_ID]: groupId,
|
|
172
|
+
[NAME.GROUP_CALL_MEMBERS]: userListInfo,
|
|
173
|
+
[NAME.ROOM_ID]: roomId,
|
|
174
|
+
[NAME.CALL_MEDIA_TYPE]: CallType[callType],
|
|
175
|
+
[NAME.ROOM_ID_TYPE]: roomIdType,
|
|
176
|
+
};
|
|
177
|
+
TUIStore.updateStore(updateStoreParams, StoreName.CALL);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.warn(`${NAME.PREFIX}updateStoreBasedOnGroupAttributes fail, error: ${error}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Get group attribute
|
|
183
|
+
public async getGroupAttributes(tim: any, groupId: string) {
|
|
184
|
+
if (!groupId) return {};
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
const { data } = await tim.getGroupAttributes({
|
|
188
|
+
groupID: groupId,
|
|
189
|
+
keyList: []
|
|
190
|
+
});
|
|
191
|
+
return data?.groupAttributes || {};
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.warn(`${NAME.PREFIX}getGroupAttributes fail: ${error}`);
|
|
194
|
+
return {};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
isLineBusy(message) {
|
|
198
|
+
const callMessage: any = JSONToObject(message.payload.data);
|
|
199
|
+
const objectData = JSONToObject(callMessage?.data);
|
|
200
|
+
|
|
201
|
+
return objectData?.line_busy === 'line_busy' || objectData?.line_busy === '' || objectData?.data?.message === 'lineBusy';
|
|
202
|
+
}
|
|
203
|
+
async getCallKitMessage(message: any, tim: any) {
|
|
204
|
+
const callMessage: any = JSONToObject(message.payload.data);
|
|
205
|
+
if (callMessage?.businessID !== 1) {
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let messageCardContent = '';
|
|
210
|
+
const objectData = JSONToObject(callMessage?.data);
|
|
211
|
+
const callMediaType = objectData.call_type;
|
|
212
|
+
const inviteeList = callMessage.inviteeList;
|
|
213
|
+
const inviter = objectData?.data?.inviter;
|
|
214
|
+
const localUserId = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO).userId;
|
|
215
|
+
const isInviter = inviter === localUserId;
|
|
216
|
+
|
|
217
|
+
const cmd = objectData?.data?.cmd;
|
|
218
|
+
switch (callMessage?.actionType) {
|
|
219
|
+
case ACTION_TYPE.INVITE: {
|
|
220
|
+
messageCardContent = cmd2messageCardContentMap[cmd]({ callDuration: formatTime(objectData?.call_end) });
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case ACTION_TYPE.CANCEL_INVITE:
|
|
224
|
+
messageCardContent = isInviter ? 'Call Cancel' : 'Other Side Cancel';
|
|
225
|
+
break;
|
|
226
|
+
case ACTION_TYPE.ACCEPT_INVITE:
|
|
227
|
+
if (['switchToAudio', 'switchToVideo'].includes(cmd)) {
|
|
228
|
+
messageCardContent = cmd2messageCardContentMap?.[cmd]?.();
|
|
229
|
+
} else {
|
|
230
|
+
messageCardContent = t('Answered');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
break;
|
|
234
|
+
case ACTION_TYPE.REJECT_INVITE:
|
|
235
|
+
if (this.isLineBusy(message)) {
|
|
236
|
+
messageCardContent = isInviter ? 'Line Busy' : 'Other Side Line Busy';
|
|
237
|
+
} else {
|
|
238
|
+
messageCardContent = isInviter ? 'Other Side Decline' : 'Decline';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
break;
|
|
242
|
+
case ACTION_TYPE.INVITE_TIMEOUT:
|
|
243
|
+
if (['switchToAudio', 'switchToVideo'].includes(cmd)) {
|
|
244
|
+
messageCardContent = cmd2messageCardContentMap?.[cmd]?.();
|
|
245
|
+
} else {
|
|
246
|
+
messageCardContent = isInviter ? 'Other Side No Answer' : 'No answer';
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return { messageCardContent, callMediaType, inviteeList };
|
|
253
|
+
}
|
|
254
|
+
// =========================【chat: event listening】=========================
|
|
255
|
+
private _addListenChatEvent() {
|
|
256
|
+
if (!this._callService?.getTim()) {
|
|
257
|
+
console.warn(`${NAME.PREFIX}add tim event listener failed, tim is empty.`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
this._callService?.getTim().on(TencentCloudChat.EVENT.GROUP_ATTRIBUTES_UPDATED, this._handleGroupAttributesUpdated, this);
|
|
261
|
+
}
|
|
262
|
+
private _removeListenChatEvent() {
|
|
263
|
+
if (!this._callService?.getTim()) {
|
|
264
|
+
console.warn(`${NAME.PREFIX}remove tim event listener failed, tim is empty.`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
this._callService?.getTim().off(TencentCloudChat.EVENT.GROUP_ATTRIBUTES_UPDATED, this._handleGroupAttributesUpdated, this);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* chat start audio/video call via click
|
|
271
|
+
* @param {Any} options Parameters passed in when clicking on an audio/video call from chat
|
|
272
|
+
* @param {CallMediaType} type call media type. 0 - audio; 1 - video.
|
|
273
|
+
*
|
|
274
|
+
* priority: isForceUseV2API > version
|
|
275
|
+
*/
|
|
276
|
+
private async _handleTUICoreOnClick(options, type: CallMediaType) {
|
|
277
|
+
try {
|
|
278
|
+
const isForceUseV2API = TUIStore.getData(StoreName.CALL, NAME.IS_FORCE_USE_V2_API);
|
|
279
|
+
const { groupID, userIDList = [], version = '', ...rest } = options;
|
|
280
|
+
|
|
281
|
+
if (isForceUseV2API) {
|
|
282
|
+
await this._useV2API({ ...options, type });
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (version === 'v3') {
|
|
286
|
+
await this._callService?.calls({ chatGroupID: groupID, userIDList, type, ...rest });
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
await this._useV2API({ ...options, type });
|
|
290
|
+
} catch (error: any) {
|
|
291
|
+
console.debug(error);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
private async _useV2API(options) {
|
|
295
|
+
const { groupID, userIDList = [], type, ...rest } = options || {};
|
|
296
|
+
|
|
297
|
+
if (groupID) {
|
|
298
|
+
await this._callService?.groupCall({ groupID, userIDList, type, ...rest });
|
|
299
|
+
} else if (userIDList.length === 1) {
|
|
300
|
+
await this._callService?.call({ userID: userIDList[0], type, ...rest });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
private async _handleGroupAttributesUpdated(event) {
|
|
304
|
+
if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) return;
|
|
305
|
+
|
|
306
|
+
const data = event?.data || {};
|
|
307
|
+
const { groupID: groupId = '', groupAttributes = {} } = data;
|
|
308
|
+
|
|
309
|
+
if (groupId !== this._callService?.getCurrentGroupId()) return;
|
|
310
|
+
|
|
311
|
+
await this.updateStoreBasedOnGroupAttributes(groupAttributes);
|
|
312
|
+
}
|
|
313
|
+
}
|