All files / src/Onboarding/hooks useOnboarding.js

77.77% Statements 7/9
100% Branches 0/0
33.33% Functions 1/3
77.77% Lines 7/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36        1x   40x 40x 40x             40x               40x       40x                
import { useRef } from 'react';
import useMergeState from '@zohodesk/hooks/es/utils/useMergeState';
import useDragger from '../../Hooks/Dragger/useDragger';
 
const useOnboarding = ({ dragBoundaryLimit,isDraggable }) => {
 
    const dragRef = useRef(null);
    useDragger({ isActive: isDraggable, ChildRef: dragRef, boundaryLimit: dragBoundaryLimit });
    const [state, setState] = useMergeState({
        videoLookupLink: '',
        isVideoLookupOpen: false,
        isEmbeddedLink: false,
        videoLookupFormat: ''
    });
 
    const openVideoLookup = (videoLookupSourceLink,isEmbeddedvideoLookupSource,videoLookupSourceFormat) => {
        setState({ 
            videoLookupLink: videoLookupSourceLink,
            isVideoLookupOpen:true,
            isEmbeddedLink:isEmbeddedvideoLookupSource,
            videoLookupFormat:videoLookupSourceFormat
        })
    }
    const closeVideoLookup = () => {
        setState({videoLookupLink:'',isVideoLookupOpen:false})
    }
 
    return {
        state,
        dragRef,
        openVideoLookup,
        closeVideoLookup
    };
};
 
export default useOnboarding;