import { CommonProperties } from '@internal/acs-ui-common' ; import { ChatHandlers } from '@internal/chat-component-bindings' ; import { ReactElement } from 'react' ; import memoizeOne from 'memoize-one' ; import { ChatAdapter } from '../adapter/ChatAdapter' ; import { useAdapter } from '../adapter/ChatAdapterProvider' ; private export const useHandlers = < PropsT > ( _component ) : Pick < ChatHandlers , CommonProperties < ChatHandlers , PropsT > > => { return createCompositeHandlers ( useAdapter ( ) ) ; } ; const createCompositeHandlers = memoizeOne ( ( adapter ) : ChatHandlers => ( { onSendMessage : adapter . sendMessage , onLoadPreviousChatMessages : adapter . loadPreviousChatMessages , onMessageSeen : adapter . sendReadReceipt , onTyping : adapter . sendTypingIndicator , onRemoveParticipant : adapter . removeParticipant , updateThreadTopicName : adapter . setTopic , onUpdateMessage : adapter . updateMessage , onDeleteMessage : adapter . deleteMessage } ) ) ;