import { ReactElement , useContext } from 'react' ; import { StatefulCallClient } from '@internal/calling-stateful-client' ; import { createDefaultCallingHandlersForComponent } from '../handlers/createHandlers' ; import { CallClientContext , useCall , useCallAgent , useDeviceManager } from '../providers' ; public export const useHandlers = < PropsT > ( component ) => { const callClient = ( useContext ( CallClientContext ) as any ) ?. callClient ; const callAgent = useCallAgent ( ) ; const deviceManager = useDeviceManager ( ) ; const call = useCall ( ) ; if ( ! callClient ) { return undefined ; } return createDefaultCallingHandlersForComponent ( callClient , callAgent , deviceManager , call , component ) ; } ;