import { ChatClientState , ChatErrors , ChatMessageWithStatus } from '@internal/chat-stateful-client' ; import { ChatParticipant } from '@azure/communication-chat' ; import { TypingIndicatorReceivedEvent } from '@azure/communication-signaling' ; import { toFlatCommunicationIdentifier } from '@internal/acs-ui-common' ; /**
 * Common props for selectors for  ChatClientState .
 *
 *  public export type ChatBaseSelectorProps = { threadId : string ; } ; private export const getUserId = ( state ) : string => toFlatCommunicationIdentifier ( state . userId ) ; private export const getDisplayName = ( state ) : string => state . displayName ; private export const getChatMessages = ( state , props ) : { [ key ] : ChatMessageWithStatus ; } => ( props . threadId && state . threads [ props . threadId ] ?. chatMessages ) || { } ; private export const getParticipants = ( state , props ) : { [ key ] : ChatParticipant ; } => ( props . threadId && state . threads [ props . threadId ] ?. participants ) || { } ; private export const getIsLargeGroup = ( state , props ) : boolean => { const participants = state . threads [ props . threadId ] ?. participants ; return ! ! participants && Object . values ( participants ) . length > 20 ; } ; private export const getLatestReadTime = ( state , props ) : Date => ( props . threadId && state . threads [ props . threadId ] ?. latestReadTime ) || new Date ( 0 ) ; private export const getTypingIndicators = ( state , props ) : TypingIndicatorReceivedEvent [ ] => { return ( props . threadId && state . threads [ props . threadId ] ?. typingIndicators ) || [ ] ; } ; private export const getLatestErrors = ( state ) : ChatErrors => state . latestErrors ;