import { createDefaultChatHandlersForComponent } from '../handlers/createHandlers' ; import { ChatClientContext } from '../providers/ChatClientProvider' ; import { ChatThreadClientContext } from '../providers/ChatThreadClientProvider' ; import { ReactElement , useContext } from 'react' ; import { Common } from '@internal/acs-ui-common' ; import { ChatHandlers } from '../handlers/createHandlers' ; public export const useHandlers = < PropsT > ( component ) : Common < ChatHandlers , PropsT > | undefined => { const chatClient = useContext ( ChatClientContext ) ; const chatThreadClient = useContext ( ChatThreadClientContext ) ; if ( ! chatThreadClient || ! chatClient ) { return undefined ; } return createDefaultChatHandlersForComponent ( chatClient , chatThreadClient , component ) ; } ;