@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,138 @@
|
|
|
1
|
+
/* eslint-disable no-useless-concat */
|
|
2
|
+
const MAX_MEMOIZE_SIZE = 500;
|
|
3
|
+
|
|
4
|
+
function memoize(func, resolver) {
|
|
5
|
+
// eslint-disable-next-line eqeqeq
|
|
6
|
+
if (typeof func !== 'function' || (resolver != null && typeof resolver !== 'function')) {
|
|
7
|
+
throw new TypeError('Expected a function');
|
|
8
|
+
}
|
|
9
|
+
const memoized = (...args) => {
|
|
10
|
+
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
11
|
+
const { cache } = memoized;
|
|
12
|
+
|
|
13
|
+
if (cache.has(key)) {
|
|
14
|
+
return cache.get(key);
|
|
15
|
+
}
|
|
16
|
+
const result = func.apply(this, args);
|
|
17
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
memoized.cache = new (memoize.Cache || Map)();
|
|
21
|
+
return memoized;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
memoize.Cache = Map;
|
|
25
|
+
|
|
26
|
+
function memoizeCapped(func) {
|
|
27
|
+
const result = memoize(func, (key) => {
|
|
28
|
+
const { cache } = result;
|
|
29
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
30
|
+
cache.clear();
|
|
31
|
+
}
|
|
32
|
+
return key;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const charCodeOfDot = '.'.charCodeAt(0);
|
|
39
|
+
const reEscapeChar = /\\(\\)?/g;
|
|
40
|
+
const rePropName = RegExp(
|
|
41
|
+
// Match anything that isn't a dot or bracket.
|
|
42
|
+
'[^.[\\]]+' + '|'
|
|
43
|
+
// Or match property names within brackets.
|
|
44
|
+
+ '\\[(?:'
|
|
45
|
+
// Match a non-string expression.
|
|
46
|
+
+ '([^"\'][^[]*)' + '|'
|
|
47
|
+
// Or match strings (supports escaping characters).
|
|
48
|
+
+ '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2'
|
|
49
|
+
+ ')\\]' + '|'
|
|
50
|
+
// Or match "" as the space between consecutive dots or empty brackets.
|
|
51
|
+
+ '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))',
|
|
52
|
+
'g',
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Converts `string` to a property path array.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param {string} string The string to convert.
|
|
60
|
+
* @returns {Array} Returns the property path array.
|
|
61
|
+
*/
|
|
62
|
+
export const stringToPath = memoizeCapped((string) => {
|
|
63
|
+
const result = [];
|
|
64
|
+
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
65
|
+
result.push('');
|
|
66
|
+
}
|
|
67
|
+
string.replace(rePropName, (match, expression, quote, subString) => {
|
|
68
|
+
let key = match;
|
|
69
|
+
if (quote) {
|
|
70
|
+
key = subString.replace(reEscapeChar, '$1');
|
|
71
|
+
} else if (expression) {
|
|
72
|
+
key = expression.trim();
|
|
73
|
+
}
|
|
74
|
+
result.push(key);
|
|
75
|
+
});
|
|
76
|
+
return result;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export function isEmpty(obj) {
|
|
80
|
+
if (obj === null || obj === undefined) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (typeof obj === 'string' && obj.trim().length === 0) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (Array.isArray(obj) || typeof obj === 'object') {
|
|
89
|
+
return Object.keys(obj).length === 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function findValues(obj, condition, path, results, formatResults) {
|
|
96
|
+
Object.keys(obj).forEach((key) => {
|
|
97
|
+
const value = obj[key];
|
|
98
|
+
const currentPath = isEmpty(path) ? key : `${path}.${key}`;
|
|
99
|
+
if (typeof value === 'object') {
|
|
100
|
+
if (Array.isArray(value)) {
|
|
101
|
+
for (let i = 0; i < value.length; i++) {
|
|
102
|
+
const itemPath = `${currentPath}[${i}]`;
|
|
103
|
+
findValues(value[i], condition, itemPath, results, formatResults);
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
findValues(value, condition, currentPath, results, formatResults);
|
|
107
|
+
}
|
|
108
|
+
} else if (condition(value)) {
|
|
109
|
+
const result = typeof formatResults === 'function' ? formatResults({ key: value, value: currentPath }) : currentPath;
|
|
110
|
+
results.push(result);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function deepClone(obj) {
|
|
116
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
117
|
+
return obj;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const clone = Array.isArray(obj) ? [] : {};
|
|
121
|
+
|
|
122
|
+
Object.keys(obj).forEach((key) => {
|
|
123
|
+
clone[key] = deepClone(obj[key]);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return clone;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function clearPropsValues(obj, value) {
|
|
130
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
131
|
+
return obj;
|
|
132
|
+
}
|
|
133
|
+
if (value in obj) {
|
|
134
|
+
const newObj = deepClone(obj);
|
|
135
|
+
delete newObj[value];
|
|
136
|
+
return newObj;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { stringToPath } from './index';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
4
|
+
export function modify(config, path, value) {
|
|
5
|
+
if (typeof config !== 'object') {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const paths = stringToPath(path);
|
|
10
|
+
let oldVal = config;
|
|
11
|
+
|
|
12
|
+
for (let index = 0; index < paths.length; index++) {
|
|
13
|
+
// eslint-disable-next-line eqeqeq
|
|
14
|
+
if (oldVal == null) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const key = paths[index];
|
|
18
|
+
if (index !== paths.length - 1) {
|
|
19
|
+
oldVal = oldVal?.[key];
|
|
20
|
+
} else {
|
|
21
|
+
Object.assign(oldVal, { [key]: value });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function add(config, path, value) {
|
|
27
|
+
if (typeof config !== 'object') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const paths = stringToPath(path);
|
|
32
|
+
let oldVal = config;
|
|
33
|
+
for (let index = 0; index < paths.length; index++) {
|
|
34
|
+
// eslint-disable-next-line eqeqeq
|
|
35
|
+
if (oldVal == null) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const key = paths[index];
|
|
39
|
+
if (index !== paths.length - 1) {
|
|
40
|
+
oldVal = oldVal?.[key];
|
|
41
|
+
} else if (Array.isArray(oldVal)) {
|
|
42
|
+
oldVal.splice(key, 0, value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ButtonState, FeatureButton, LayoutMode, NAME, StoreName } from "../const/index";
|
|
2
|
+
import { deepClone } from "../utils/index";
|
|
3
|
+
import isEmpty from "../utils/is-empty";
|
|
4
|
+
export interface IUIDesign {
|
|
5
|
+
updateViewBackgroundUserId: (viewType: 'local' | 'remote') => void;
|
|
6
|
+
hideFeatureButton: (buttonName: FeatureButton) => void;
|
|
7
|
+
setLocalViewBackgroundImage: (url: string) => void;
|
|
8
|
+
setRemoteViewBackgroundImage: (userId: string, url: string) => void;
|
|
9
|
+
setLayoutMode: (layoutMode: LayoutMode) => void;
|
|
10
|
+
setCameraDefaultState: (isOpen: boolean) => void;
|
|
11
|
+
setEngineInstance: (engineInstance: any) => void;
|
|
12
|
+
setTUIStore: (tuiStore: any) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DEFAULT_LOCAL_USER_ID = '_local_user_id';
|
|
16
|
+
|
|
17
|
+
export class UIDesign implements IUIDesign {
|
|
18
|
+
static instance: IUIDesign;
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!UIDesign.instance) {
|
|
21
|
+
UIDesign.instance = new UIDesign();
|
|
22
|
+
}
|
|
23
|
+
return UIDesign.instance;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private _viewConfig = {
|
|
27
|
+
viewBackground: {
|
|
28
|
+
local: {},
|
|
29
|
+
remote: {},
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
private _isSetViewBackgroundConfig = { remote: false, local: false };
|
|
33
|
+
private _tuiCallEngine = null;
|
|
34
|
+
private _tuiStore = null;
|
|
35
|
+
private _updateViewBackground() {
|
|
36
|
+
const customUIConfig = this._tuiStore?.getData(StoreName.CALL, NAME.CUSTOM_UI_CONFIG);
|
|
37
|
+
const { userId } = this._tuiStore?.getData(StoreName.CALL, NAME.LOCAL_USER_INFO);
|
|
38
|
+
|
|
39
|
+
if (Object.keys(this._viewConfig.viewBackground.remote).includes(userId)) {
|
|
40
|
+
delete this._viewConfig.viewBackground.remote[userId];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this._tuiStore?.update(
|
|
44
|
+
StoreName.CALL,
|
|
45
|
+
NAME.CUSTOM_UI_CONFIG,
|
|
46
|
+
{
|
|
47
|
+
...customUIConfig,
|
|
48
|
+
viewBackground: {
|
|
49
|
+
...this._viewConfig.viewBackground.remote,
|
|
50
|
+
...this._viewConfig.viewBackground.local,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setEngineInstance(engineInstance) {
|
|
57
|
+
this._tuiCallEngine = engineInstance;
|
|
58
|
+
}
|
|
59
|
+
setTUIStore(tuiStore) {
|
|
60
|
+
this._tuiStore = tuiStore;
|
|
61
|
+
}
|
|
62
|
+
public updateViewBackgroundUserId(name) {
|
|
63
|
+
if (name === 'local') {
|
|
64
|
+
const { userId } = this._tuiStore?.getData(StoreName.CALL, NAME.LOCAL_USER_INFO);
|
|
65
|
+
|
|
66
|
+
if (Object.keys(this._viewConfig.viewBackground.remote).includes(userId)) {
|
|
67
|
+
delete this._viewConfig.viewBackground.remote[userId];
|
|
68
|
+
this._updateViewBackground();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!this._isSetViewBackgroundConfig.local) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const localViewBackgroundConfig = this._viewConfig.viewBackground.local;
|
|
76
|
+
const url = localViewBackgroundConfig[userId] || localViewBackgroundConfig[DEFAULT_LOCAL_USER_ID];
|
|
77
|
+
localViewBackgroundConfig[userId] = localViewBackgroundConfig[DEFAULT_LOCAL_USER_ID];
|
|
78
|
+
this._viewConfig.viewBackground.local = { [userId]: url };
|
|
79
|
+
|
|
80
|
+
this._updateViewBackground();
|
|
81
|
+
} else {
|
|
82
|
+
let remoteViewBackgroundConfig = this._viewConfig.viewBackground.remote;
|
|
83
|
+
|
|
84
|
+
if (this._isSetViewBackgroundConfig.remote && Object.keys(remoteViewBackgroundConfig).includes('*')) {
|
|
85
|
+
const remoteUserInfoList = this._tuiStore?.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST);
|
|
86
|
+
const remoteUserIdList = remoteUserInfoList.map((item) => item.userId);
|
|
87
|
+
remoteUserIdList.forEach((userId) => {
|
|
88
|
+
if (!Object.keys(remoteViewBackgroundConfig).includes(userId)) {
|
|
89
|
+
remoteViewBackgroundConfig[userId] = remoteViewBackgroundConfig['*'];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
this._viewConfig.viewBackground.remote = remoteViewBackgroundConfig;
|
|
94
|
+
this._updateViewBackground();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
public hideFeatureButton(buttonName: FeatureButton) {
|
|
99
|
+
this._tuiCallEngine?.reportLog?.({
|
|
100
|
+
name: 'TUICallKit.hideFeatureButton.start',
|
|
101
|
+
data: { buttonName },
|
|
102
|
+
});
|
|
103
|
+
const customUIConfig = this._tuiStore?.getData(StoreName.CALL, NAME.CUSTOM_UI_CONFIG);
|
|
104
|
+
this._tuiStore?.update(
|
|
105
|
+
StoreName.CALL,
|
|
106
|
+
NAME.CUSTOM_UI_CONFIG,
|
|
107
|
+
{
|
|
108
|
+
...customUIConfig,
|
|
109
|
+
button: {
|
|
110
|
+
...customUIConfig.button,
|
|
111
|
+
[buttonName]: { ...(customUIConfig.button?.[buttonName] || {}), show: false, },
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
public setLocalViewBackgroundImage(url: string) {
|
|
117
|
+
this._tuiCallEngine?.reportLog?.({
|
|
118
|
+
name: 'TUICallKit.setLocalViewBackgroundImage.start',
|
|
119
|
+
data: { url },
|
|
120
|
+
});
|
|
121
|
+
this._isSetViewBackgroundConfig.local = true;
|
|
122
|
+
let { userId } = this._tuiStore?.getData(StoreName.CALL, NAME.LOCAL_USER_INFO);
|
|
123
|
+
|
|
124
|
+
if (isEmpty(userId)) {
|
|
125
|
+
userId = DEFAULT_LOCAL_USER_ID;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this._viewConfig.viewBackground.local = { [userId]: url };
|
|
129
|
+
this._updateViewBackground();
|
|
130
|
+
}
|
|
131
|
+
public setRemoteViewBackgroundImage(userId: string, url:string) {
|
|
132
|
+
this._tuiCallEngine?.reportLog?.({
|
|
133
|
+
name: 'TUICallKit.setRemoteViewBackgroundImage.start',
|
|
134
|
+
data: { userId, url },
|
|
135
|
+
});
|
|
136
|
+
this._isSetViewBackgroundConfig.remote = true;
|
|
137
|
+
if (userId === '*') {
|
|
138
|
+
this._viewConfig.viewBackground.remote = {};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this._viewConfig.viewBackground.remote[userId] = url;
|
|
142
|
+
this._updateViewBackground();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public setLayoutMode(layoutMode: LayoutMode) {
|
|
146
|
+
this._tuiCallEngine?.reportLog?.({
|
|
147
|
+
name: 'TUICallKit.setLayoutMode.start',
|
|
148
|
+
data: { layoutMode },
|
|
149
|
+
});
|
|
150
|
+
const customUIConfig = this._tuiStore.getData(StoreName.CALL, NAME.CUSTOM_UI_CONFIG);
|
|
151
|
+
this._tuiStore.update(
|
|
152
|
+
StoreName.CALL,
|
|
153
|
+
NAME.CUSTOM_UI_CONFIG,
|
|
154
|
+
{
|
|
155
|
+
...customUIConfig,
|
|
156
|
+
layoutMode,
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public setCameraDefaultState(isOpen: boolean) {
|
|
162
|
+
this._tuiCallEngine?.reportLog?.({
|
|
163
|
+
name: 'TUICallKit.setCameraDefaultState.start',
|
|
164
|
+
data: { isOpen },
|
|
165
|
+
});
|
|
166
|
+
const customUIConfig = deepClone(this._tuiStore.getData(StoreName.CALL, NAME.CUSTOM_UI_CONFIG));
|
|
167
|
+
|
|
168
|
+
if (!Object.keys(customUIConfig.button).includes(FeatureButton.Camera)) {
|
|
169
|
+
customUIConfig.button[FeatureButton.Camera] = {};
|
|
170
|
+
}
|
|
171
|
+
customUIConfig.button[FeatureButton.Camera].state = isOpen ? ButtonState.Open : ButtonState.Close;
|
|
172
|
+
this._tuiStore.update(StoreName.CALL, NAME.CUSTOM_UI_CONFIG, customUIConfig);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CallStatus, NAME, CallRole } from '../const/index';
|
|
2
|
+
import { IBellParams } from '../interface/index';
|
|
3
|
+
import { isUndefined } from '../utils/common-utils';
|
|
4
|
+
import DEFAULT_CALLER_BELL_FILEPATH from '../assets/phone_dialing.mp3';
|
|
5
|
+
import DEFAULT_CALLEE_BELL_FILEPATH from '../assets/phone_ringing.mp3';
|
|
6
|
+
|
|
7
|
+
export class BellContext {
|
|
8
|
+
private _bellContext: any = null;
|
|
9
|
+
private _isMuteBell: boolean = false;
|
|
10
|
+
private _calleeBellFilePath: string = DEFAULT_CALLEE_BELL_FILEPATH;
|
|
11
|
+
private _callRole: string = CallRole.UNKNOWN;
|
|
12
|
+
private _callStatus: string = CallStatus.IDLE;
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this._bellContext = new Audio();
|
|
16
|
+
this._bellContext.loop = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
setBellSrc() {
|
|
20
|
+
try {
|
|
21
|
+
let playBellFilePath = DEFAULT_CALLER_BELL_FILEPATH;
|
|
22
|
+
if (this._callRole === CallRole.CALLEE) {
|
|
23
|
+
playBellFilePath = this._calleeBellFilePath || DEFAULT_CALLEE_BELL_FILEPATH;
|
|
24
|
+
}
|
|
25
|
+
this._bellContext.src = playBellFilePath;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.warn(`${NAME.PREFIX}Failed to setBellSrc, ${error}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setBellProperties(bellParams: IBellParams) {
|
|
32
|
+
this._callRole = bellParams.callRole || this._callRole;
|
|
33
|
+
this._callStatus = bellParams.callStatus || this._callStatus;
|
|
34
|
+
this._calleeBellFilePath = bellParams.calleeBellFilePath || this._calleeBellFilePath;
|
|
35
|
+
// undefined/false || isMuteBell => isMuteBell (不符合预期)
|
|
36
|
+
this._isMuteBell = isUndefined(bellParams.isMuteBell) ? this._isMuteBell : bellParams.isMuteBell;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async play() {
|
|
40
|
+
try {
|
|
41
|
+
if (this._callStatus !== CallStatus.CALLING) {
|
|
42
|
+
return ;
|
|
43
|
+
}
|
|
44
|
+
this.setBellSrc();
|
|
45
|
+
if (this._callRole === CallRole.CALLEE && !this._isMuteBell) {
|
|
46
|
+
await this._bellContext.play();
|
|
47
|
+
}
|
|
48
|
+
if (this._callRole === CallRole.CALLER) {
|
|
49
|
+
await this._bellContext.play();
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.warn(`${NAME.PREFIX}Failed to play audio file, ${error}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async stop() {
|
|
57
|
+
try {
|
|
58
|
+
await this._bellContext.pause();
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.warn(`${NAME.PREFIX}Failed to stop audio file, ${error}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async setBellMute(enable: boolean) {
|
|
65
|
+
if (this._callStatus !== CallStatus.CALLING && this._callRole !== CallRole.CALLEE) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (enable) {
|
|
69
|
+
await this.stop();
|
|
70
|
+
} else {
|
|
71
|
+
await this.play();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
destroy() {
|
|
76
|
+
try {
|
|
77
|
+
this._isMuteBell = false;
|
|
78
|
+
this._calleeBellFilePath = '';
|
|
79
|
+
this._callRole = CallRole.UNKNOWN;
|
|
80
|
+
this._callStatus = CallStatus.IDLE;
|
|
81
|
+
this._bellContext.pause();
|
|
82
|
+
this._bellContext = null;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.warn(`${NAME.PREFIX}Failed to destroy, ${error}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|