@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,96 @@
|
|
|
1
|
+
import React, { CSSProperties, useContext, useMemo } from 'react';
|
|
2
|
+
import { UserInfoContext, CallInfoContext, CustomUIConfigContext } from '../../../context';
|
|
3
|
+
import useNetWorkStatus from '../../../hooks/useNetWorkStatus';
|
|
4
|
+
import StreamInfo from '../StreamInfo';
|
|
5
|
+
import { classNames } from '../../../util/classnames';
|
|
6
|
+
import useGetVolumeMap from '../../../hooks/useGetVolumeMap';
|
|
7
|
+
import { TUIGlobal } from '../../../../TUICallService';
|
|
8
|
+
import pusherStyle from './Pusher.module.scss';
|
|
9
|
+
|
|
10
|
+
interface IPusher {
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
showStreamInfo?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
renderLoading?: Function;
|
|
15
|
+
renderAudioStream?: any;
|
|
16
|
+
isSpkear?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
isLargeView?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Pusher = React.memo((props: IPusher) => {
|
|
22
|
+
const {
|
|
23
|
+
loading = true,
|
|
24
|
+
renderLoading,
|
|
25
|
+
renderAudioStream,
|
|
26
|
+
isSpkear,
|
|
27
|
+
className,
|
|
28
|
+
showStreamInfo = true,
|
|
29
|
+
isLargeView = false,
|
|
30
|
+
} = props;
|
|
31
|
+
const {
|
|
32
|
+
localUserInfo: {
|
|
33
|
+
domId,
|
|
34
|
+
nick,
|
|
35
|
+
userId,
|
|
36
|
+
isAudioAvailable,
|
|
37
|
+
isVideoAvailable,
|
|
38
|
+
},
|
|
39
|
+
} = useContext(UserInfoContext);
|
|
40
|
+
const customUI = useContext(CustomUIConfigContext);
|
|
41
|
+
const { isGroupCall } = useContext(CallInfoContext);
|
|
42
|
+
const netWorkQualityList = useNetWorkStatus();
|
|
43
|
+
|
|
44
|
+
const showNetWorkStatus = useMemo(() => {
|
|
45
|
+
if (!netWorkQualityList) return;
|
|
46
|
+
const targetNetwork = netWorkQualityList.find((item) => item.userId === userId);
|
|
47
|
+
if (targetNetwork && targetNetwork.quality >= 4) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}, [netWorkQualityList]);
|
|
52
|
+
|
|
53
|
+
const displayUserInfo = nick || userId;
|
|
54
|
+
|
|
55
|
+
const volumnMap = useGetVolumeMap();
|
|
56
|
+
const classnames = classNames([
|
|
57
|
+
className,
|
|
58
|
+
pusherStyle['pusher-container'],
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
const showUserName = useMemo(() => {
|
|
62
|
+
if (isGroupCall) {
|
|
63
|
+
return TUIGlobal.isPC
|
|
64
|
+
? true
|
|
65
|
+
: !!isLargeView;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return false;
|
|
69
|
+
}, [isLargeView, isGroupCall]);
|
|
70
|
+
const showSwitchCamera = !TUIGlobal.isPC
|
|
71
|
+
&& isVideoAvailable
|
|
72
|
+
&& isGroupCall
|
|
73
|
+
&& isLargeView
|
|
74
|
+
&& customUI?.button?.switchCamera?.show !== false;
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div id={domId} key={domId} className={classnames}>
|
|
78
|
+
{!loading && renderAudioStream?.()}
|
|
79
|
+
{loading && renderLoading?.()}
|
|
80
|
+
{showStreamInfo && (
|
|
81
|
+
<StreamInfo
|
|
82
|
+
volume={volumnMap[domId]}
|
|
83
|
+
isSpkear={isSpkear}
|
|
84
|
+
isMute={!isAudioAvailable}
|
|
85
|
+
displayName={displayUserInfo}
|
|
86
|
+
isMe
|
|
87
|
+
showUserName={showUserName}
|
|
88
|
+
showSwitchCamera={showSwitchCamera}
|
|
89
|
+
showNetWorkStatus={showNetWorkStatus}
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export default Pusher;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TUIGlobal } from '../../../../TUICallService';
|
|
3
|
+
import StreamInfoH5 from './StreamInfoH5/StreamInfoH5';
|
|
4
|
+
import StreamInfoPC from './StreamInfoPC/StreamInfoPC';
|
|
5
|
+
|
|
6
|
+
export default function StreamInfo(props: any) {
|
|
7
|
+
return TUIGlobal.isPC
|
|
8
|
+
? <StreamInfoPC {...props} />
|
|
9
|
+
: <StreamInfoH5 {...props} />;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use "../../../../style/theme/util" as *;
|
|
2
|
+
|
|
3
|
+
.stream-info-container-h5 {
|
|
4
|
+
width: calc(100% - 16px);
|
|
5
|
+
display: flex;
|
|
6
|
+
z-index: 1;
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
text-wrap: nowrap;
|
|
11
|
+
margin: 8px 8px;
|
|
12
|
+
background: none;
|
|
13
|
+
|
|
14
|
+
@include theme() {
|
|
15
|
+
color: get(white-1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.single {
|
|
19
|
+
height: 20px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import Icon from '../../../base/Icon/Icon';
|
|
3
|
+
import { classNames } from '../../../../util/classnames';
|
|
4
|
+
import Row from '../../../base/Grid/Row';
|
|
5
|
+
import Col from '../../../base/Grid/Col';
|
|
6
|
+
import Text from '../../../base/Text/Text';
|
|
7
|
+
import { CallInfoContext } from '../../../../context';
|
|
8
|
+
import VolumnSrc from '../../../../assets/streamInfo/mobile/volumn.svg';
|
|
9
|
+
import MicrophoneCloseGroupSrc from '../../../../assets/streamInfo/mobile/microphone-close-group.svg';
|
|
10
|
+
import Button from '../../../base/Button';
|
|
11
|
+
import { TUICallKitAPI } from '../../../../../TUICallService';
|
|
12
|
+
import SwitchCameraSrc from '../../../../assets/button/mobile/switch-camera.svg';
|
|
13
|
+
import MicrophoneCloseSingleSrc from '../../../../assets/streamInfo/mobile/microphone-close-single.svg';
|
|
14
|
+
import networkStatusSrc from '../../../../assets/streamInfo/networkStatus.svg';
|
|
15
|
+
import streamInfoH5Style from './StreamInfoH5.module.scss';
|
|
16
|
+
|
|
17
|
+
interface IStreamInfoH5Props {
|
|
18
|
+
isSpkear?: boolean;
|
|
19
|
+
isMute?: boolean;
|
|
20
|
+
displayName?: string;
|
|
21
|
+
showUserName?: boolean;
|
|
22
|
+
showSwitchCamera?: boolean;
|
|
23
|
+
showNetWorkStatus?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function StreamInfoH5(props: IStreamInfoH5Props) {
|
|
27
|
+
const {
|
|
28
|
+
isSpkear,
|
|
29
|
+
isMute,
|
|
30
|
+
displayName,
|
|
31
|
+
showUserName = false,
|
|
32
|
+
showSwitchCamera = false,
|
|
33
|
+
showNetWorkStatus = false,
|
|
34
|
+
} = props;
|
|
35
|
+
const { isGroupCall } = useContext(CallInfoContext);
|
|
36
|
+
const classnames = classNames(
|
|
37
|
+
[
|
|
38
|
+
streamInfoH5Style['stream-info-container-h5'],
|
|
39
|
+
{
|
|
40
|
+
[streamInfoH5Style.group]: isGroupCall,
|
|
41
|
+
[streamInfoH5Style.single]: !isGroupCall,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const ButtonStyle = {
|
|
47
|
+
width: '30px',
|
|
48
|
+
height: '30px',
|
|
49
|
+
background: '#22262e80',
|
|
50
|
+
borderRadius: '50%',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleSwitchCamera = async () => {
|
|
57
|
+
await TUICallKitAPI.switchCamera();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const renderGroupCallStreamInfo = () => (
|
|
61
|
+
<Row>
|
|
62
|
+
<Col span={6} align='center' justify='start'>
|
|
63
|
+
{showUserName && <Text maxWidth='100px' truncated>{displayName}</Text>}
|
|
64
|
+
{isSpkear && <Icon style={{ width: 'fit-content' }} url={VolumnSrc} />}
|
|
65
|
+
{isMute && <Icon style={{ width: 'fit-content' }} url={MicrophoneCloseGroupSrc} />}
|
|
66
|
+
</Col>
|
|
67
|
+
<Col span={6} align='center' justify='end'>
|
|
68
|
+
{showNetWorkStatus && <Icon style={{ width: '24px', height: '24px', marginRight: '12px' }} url={networkStatusSrc} />}
|
|
69
|
+
{showSwitchCamera && (
|
|
70
|
+
<Button
|
|
71
|
+
showText={false}
|
|
72
|
+
icon={<Icon url={SwitchCameraSrc} />}
|
|
73
|
+
style={ButtonStyle}
|
|
74
|
+
iconSize='15px'
|
|
75
|
+
isStopPropagation
|
|
76
|
+
onClick={handleSwitchCamera}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
</Col>
|
|
80
|
+
</Row>
|
|
81
|
+
);
|
|
82
|
+
const renderSingleCallStreamInfo = () => (
|
|
83
|
+
<Row>
|
|
84
|
+
<Col span={12} justify='start'>
|
|
85
|
+
{isMute && <Icon style={{ width: 'fit-content' }} url={MicrophoneCloseSingleSrc} />}
|
|
86
|
+
</Col>
|
|
87
|
+
</Row>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className={classnames}>
|
|
92
|
+
{isGroupCall ? renderGroupCallStreamInfo() : renderSingleCallStreamInfo()}
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@use "../../../../style/theme/util" as *;
|
|
2
|
+
|
|
3
|
+
.stream-info-container-pc {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 25px;
|
|
6
|
+
display: flex;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
position: absolute;
|
|
9
|
+
left: 0;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
@include theme() {
|
|
12
|
+
color: get(white-1);
|
|
13
|
+
}
|
|
14
|
+
text-wrap: nowrap;
|
|
15
|
+
background: none;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
.stream-info-content {
|
|
18
|
+
display: flex;
|
|
19
|
+
max-width: 60%;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
align-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 2px 10px;
|
|
24
|
+
|
|
25
|
+
@include theme() {
|
|
26
|
+
background-color: get(black-5);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nick {
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.stream-info-netWork {
|
|
35
|
+
width: 20px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MicrophoneVolumn from '../../MicrophoneVolumn/MicrophoneVolumn';
|
|
3
|
+
import Icon from '../../../base/Icon/Icon';
|
|
4
|
+
import { useTranslate } from '../../../../hooks';
|
|
5
|
+
import networkStatusSrc from '../../../../assets/streamInfo/networkStatus.svg';
|
|
6
|
+
import streamInfoPCStyle from './StreamInfoPC.module.scss';
|
|
7
|
+
|
|
8
|
+
interface IStreamInfoPCProps {
|
|
9
|
+
isMute?: boolean;
|
|
10
|
+
displayName?: string;
|
|
11
|
+
volume?: number;
|
|
12
|
+
isMe?: boolean;
|
|
13
|
+
showNetWorkStatus?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function StreamInfoPC(props: IStreamInfoPCProps) {
|
|
17
|
+
const {
|
|
18
|
+
isMute, displayName, volume, isMe, showNetWorkStatus = false,
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const { t } = useTranslate();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={streamInfoPCStyle['stream-info-container-pc']}>
|
|
25
|
+
<div className={streamInfoPCStyle['stream-info-content']}>
|
|
26
|
+
<MicrophoneVolumn volume={volume} close={isMute} />
|
|
27
|
+
<div className={streamInfoPCStyle.nick}>{displayName}</div>
|
|
28
|
+
{isMe && <div>{(t('you'))}</div>}
|
|
29
|
+
</div>
|
|
30
|
+
<div className='stream-info-netWork'>
|
|
31
|
+
{showNetWorkStatus && <Icon style={{ width: '20px', height: '20px' }} url={networkStatusSrc} />}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { CSSProperties, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Message } from '../../base/Message/Message';
|
|
3
|
+
import { classNames } from '../../../util/classnames';
|
|
4
|
+
import { useTranslate } from '../../../hooks';
|
|
5
|
+
import { NAME, StoreName, TUIStore } from '../../../../TUICallService';
|
|
6
|
+
|
|
7
|
+
interface ITipProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Tip(props: ITipProps) {
|
|
13
|
+
const { className, style } = props;
|
|
14
|
+
const [tip, setTip] = useState(null);
|
|
15
|
+
const [show, setShow] = useState(true);
|
|
16
|
+
const [showDuration, setShowDuration] = useState(0);
|
|
17
|
+
const { t } = useTranslate();
|
|
18
|
+
const classnames = classNames([
|
|
19
|
+
className,
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
function handleCallTipsChange(value) {
|
|
23
|
+
if (typeof value === 'object') {
|
|
24
|
+
const { text = '', duration = 0 } = value;
|
|
25
|
+
setTip(text);
|
|
26
|
+
setShowDuration(duration);
|
|
27
|
+
} else {
|
|
28
|
+
setTip(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const messageContent = useMemo(() => {
|
|
33
|
+
if (typeof t === 'function' && tip !== null) {
|
|
34
|
+
return t(tip);
|
|
35
|
+
}
|
|
36
|
+
}, [t, tip]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
TUIStore.watch(
|
|
40
|
+
StoreName.CALL,
|
|
41
|
+
{
|
|
42
|
+
[NAME.CALL_TIPS]: handleCallTipsChange,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
notifyRangeWhenWatch: NAME.MYSELF,
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
TUIStore.unwatch(
|
|
51
|
+
StoreName.CALL,
|
|
52
|
+
{
|
|
53
|
+
[NAME.CALL_TIPS]: handleCallTipsChange,
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className={classnames} style={style}>
|
|
61
|
+
{show && (
|
|
62
|
+
<Message style={{ whiteSpace: 'nowrap' }} duration={showDuration} onClose={() => setShow(false)} plaintext>
|
|
63
|
+
{messageContent}
|
|
64
|
+
</Message>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import TopBarH5 from './h5/TopBarH5';
|
|
3
|
+
import TopBarPC from './pc/TopBarPC';
|
|
4
|
+
import { TUIGlobal } from '../../../../TUICallService';
|
|
5
|
+
import useCallDuration from '../../../hooks/useCallDuration';
|
|
6
|
+
|
|
7
|
+
export default function TopBar() {
|
|
8
|
+
const isMobile = !TUIGlobal.isPC;
|
|
9
|
+
const callDuration = useCallDuration();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
{isMobile && <TopBarH5 callDuration={callDuration} />}
|
|
14
|
+
{!isMobile && <TopBarPC callDuration={callDuration} />}
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import Time from '../../../base/Time/Time';
|
|
3
|
+
import Col from '../../../base/Grid/Col';
|
|
4
|
+
import Row from '../../../base/Grid/Row';
|
|
5
|
+
import Minimize from '../../ButtonPanel/button/Minimize';
|
|
6
|
+
import { CallRole, CallStatus } from '../../../../../TUICallService';
|
|
7
|
+
import Tip from '../../Tip/Tip';
|
|
8
|
+
import { CallInfoContext } from '../../../../context';
|
|
9
|
+
import topBarH5Style from './TopBarH5.module.scss';
|
|
10
|
+
|
|
11
|
+
interface ITopBarH5Props {
|
|
12
|
+
callDuration?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function TopBarH5(props: ITopBarH5Props) {
|
|
16
|
+
const { callDuration } = props;
|
|
17
|
+
const {
|
|
18
|
+
isGroupCall, callStatus, callRole, allowedMinimized,
|
|
19
|
+
} = useContext(CallInfoContext);
|
|
20
|
+
const showTip = (isGroupCall
|
|
21
|
+
&& (callStatus === CallStatus.CONNECTED || callRole === CallRole.CALLER));
|
|
22
|
+
return (
|
|
23
|
+
<div className={topBarH5Style['top-bar-container']}>
|
|
24
|
+
<Row className={topBarH5Style['top-bar']}>
|
|
25
|
+
<Col justify='start' span={4}>
|
|
26
|
+
{allowedMinimized && <Minimize />}
|
|
27
|
+
</Col>
|
|
28
|
+
<Col align='center' span={4}>
|
|
29
|
+
{callStatus === CallStatus.CONNECTED
|
|
30
|
+
? (
|
|
31
|
+
<Time callDuration={callDuration} />
|
|
32
|
+
) : (
|
|
33
|
+
showTip && <Tip />
|
|
34
|
+
)}
|
|
35
|
+
</Col>
|
|
36
|
+
<Col span={4} />
|
|
37
|
+
</Row>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import Time from '../../../base/Time/Time';
|
|
3
|
+
import Col from '../../../base/Grid/Col';
|
|
4
|
+
import Row from '../../../base/Grid/Row';
|
|
5
|
+
import Minimize from '../../ButtonPanel/button/Minimize/Minimize';
|
|
6
|
+
import FullScreen from '../../ButtonPanel/button/FullScreen';
|
|
7
|
+
import { CallStatus } from '../../../../../TUICallService';
|
|
8
|
+
import { CallInfoContext } from '../../../../context';
|
|
9
|
+
import topBarPCStyle from './TopBarPC.module.scss';
|
|
10
|
+
|
|
11
|
+
interface ITopBarPCProps {
|
|
12
|
+
callDuration?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function TopBarPC(props: ITopBarPCProps) {
|
|
16
|
+
const { callDuration } = props;
|
|
17
|
+
const {
|
|
18
|
+
isGroupCall,
|
|
19
|
+
callStatus,
|
|
20
|
+
allowedMinimized,
|
|
21
|
+
allowedFullScreen,
|
|
22
|
+
} = useContext(CallInfoContext);
|
|
23
|
+
const showTime = callStatus === CallStatus.CONNECTED && !isGroupCall;
|
|
24
|
+
return (
|
|
25
|
+
<Row className={topBarPCStyle['single-top-bar']}>
|
|
26
|
+
<Col span={4} />
|
|
27
|
+
<Col span={4}>
|
|
28
|
+
{showTime && <Time callDuration={callDuration} />}
|
|
29
|
+
</Col>
|
|
30
|
+
<Col span={4} justify='end'>
|
|
31
|
+
{allowedMinimized && <Minimize />}
|
|
32
|
+
{allowedFullScreen && <FullScreen domID='tuicallkit-id' />}
|
|
33
|
+
</Col>
|
|
34
|
+
</Row>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
export const classPrefix = 'tk';
|
|
4
|
+
|
|
5
|
+
export type TButton = {
|
|
6
|
+
component: FunctionComponent,
|
|
7
|
+
props: {
|
|
8
|
+
show: boolean,
|
|
9
|
+
[key: string]: any,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type TButtons = TButton[][];
|
|
14
|
+
|
|
15
|
+
export type TObjectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import { CallStatus, CallMediaType, CallRole } from '../../TUICallService';
|
|
3
|
+
|
|
4
|
+
interface ICallInfoContext {
|
|
5
|
+
callStatus?: CallStatus;
|
|
6
|
+
callRole?: CallRole;
|
|
7
|
+
callType?: CallMediaType;
|
|
8
|
+
isEarPhone?: boolean;
|
|
9
|
+
isClickable?: boolean;
|
|
10
|
+
isGroupCall?: boolean;
|
|
11
|
+
isFloat?: boolean;
|
|
12
|
+
allowedMinimized?: boolean;
|
|
13
|
+
allowedFullScreen?: boolean;
|
|
14
|
+
enableVirtualBackground?: boolean;
|
|
15
|
+
isShowEnableVirtualBackground?: boolean;
|
|
16
|
+
isMuteSpeaker?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const CallInfoContext = createContext<ICallInfoContext>({});
|
|
20
|
+
|
|
21
|
+
export default CallInfoContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ICallerUserInfoContext {
|
|
4
|
+
avatar?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
displayUserInfo?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const CallerUserInfoContext = createContext<ICallerUserInfoContext>({});
|
|
10
|
+
|
|
11
|
+
export default CallerUserInfoContext;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export type TFocusItem = string | number | null;
|
|
4
|
+
interface IFocusItemContext {
|
|
5
|
+
focusItem: TFocusItem;
|
|
6
|
+
setFocusItem: React.Dispatch<TFocusItem>;
|
|
7
|
+
}
|
|
8
|
+
const FocusItemContext = createContext<IFocusItemContext>({
|
|
9
|
+
focusItem: null,
|
|
10
|
+
setFocusItem: () => {},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default FocusItemContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import { IUserInfo } from '../../TUICallService/interface';
|
|
3
|
+
|
|
4
|
+
const UserInfoContext = createContext<{ localUserInfo: IUserInfo, remoteList: IUserInfo[] }>({
|
|
5
|
+
localUserInfo: { userId: '' },
|
|
6
|
+
remoteList: [],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export default UserInfoContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import CallInfoContext from './CallUserInfoContext';
|
|
2
|
+
import CallerUserInfoContext from './CallerUserInfoContext';
|
|
3
|
+
import FocusItemContext from './FocusItemContext';
|
|
4
|
+
import UserInfoContext from './UserInfoContext';
|
|
5
|
+
import IsClickableContext from './IsClickableContext';
|
|
6
|
+
import CustomUIConfigContext from './CustomUIConfigContext';
|
|
7
|
+
import TranslateContext from './TranslateContext';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
CallInfoContext,
|
|
11
|
+
CallerUserInfoContext,
|
|
12
|
+
FocusItemContext,
|
|
13
|
+
UserInfoContext,
|
|
14
|
+
IsClickableContext,
|
|
15
|
+
CustomUIConfigContext,
|
|
16
|
+
TranslateContext,
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { NAME, StoreName, TUIStore } from '../../TUICallService';
|
|
3
|
+
|
|
4
|
+
export default function useCallDuration() {
|
|
5
|
+
const [
|
|
6
|
+
callDuration,
|
|
7
|
+
setCallDuration,
|
|
8
|
+
] = useState(TUIStore.getData(StoreName.CALL, NAME.CALL_DURATION));
|
|
9
|
+
const handleCallDurationChange = (value) => {
|
|
10
|
+
setCallDuration(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const watchOptions = {
|
|
14
|
+
[NAME.CALL_DURATION]: handleCallDurationChange,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
TUIStore.watch(
|
|
19
|
+
StoreName.CALL,
|
|
20
|
+
watchOptions,
|
|
21
|
+
{
|
|
22
|
+
notifyRangeWhenWatch: NAME.MYSELF,
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
TUIStore.unwatch(
|
|
28
|
+
StoreName.CALL,
|
|
29
|
+
watchOptions,
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return callDuration;
|
|
34
|
+
}
|