import { AudioDeviceInfo , VideoDeviceInfo } from '@azure/communication-calling' ; import { CallClientState } from '@internal/calling-stateful-client' ; import * as reselect from 'reselect' ; import { CallingBaseSelectorProps , getCallExists , getDeviceManager , getIsMuted , getIsScreenSharingOn , getLocalVideoStreams } from './baseSelectors' ; import { _isPreviewOn } from './callUtils' ; /**
 * Selector type for  MicrophoneButton component.
 *
 *  public export type MicrophoneButtonSelector = ( state : CallClientState , props : CallingBaseSelectorProps ) => { disabled : boolean ; checked : boolean ; } ; /**
 * Selector for  MicrophoneButton component.
 *
 *  public export const microphoneButtonSelector = reselect . createSelector ( [ getCallExists , getIsMuted , getDeviceManager ] , ( callExists , isMuted , deviceManager ) => { const permission = deviceManager . deviceAccess ? deviceManager . deviceAccess . audio : true ; return { disabled : ! callExists || ! permission , checked : callExists ? ! isMuted : false } ; } ) ; /**
 * Selector type for  CameraButton component.
 *
 *  public export type CameraButtonSelector = ( state : CallClientState , props : CallingBaseSelectorProps ) => { disabled : boolean ; checked : boolean ; } ; /**
 * Selector for  CameraButton component.
 *
 *  public export const cameraButtonSelector = reselect . createSelector ( [ getLocalVideoStreams , getDeviceManager ] , ( localVideoStreams , deviceManager ) => { const previewOn = _isPreviewOn ( deviceManager ) ; const localVideoFromCall = localVideoStreams ?. find ( ( stream ) => stream . mediaStreamType === 'Video' ) ; const permission = deviceManager . deviceAccess ? deviceManager . deviceAccess . video : true ; return { disabled : ! deviceManager . selectedCamera || ! permission , checked : localVideoStreams !== undefined && localVideoStreams . length > 0 ? ! ! localVideoFromCall : previewOn } ; } ) ; /**
 * Selector type for  ScreenShareButton component.
 *
 *  public export type ScreenShareButtonSelector = ( state : CallClientState , props : CallingBaseSelectorProps ) => { checked ? : boolean ; } ; /**
 * Selector for  ScreenShareButton component.
 *
 *  public export const screenShareButtonSelector = reselect . createSelector ( [ getIsScreenSharingOn ] , ( isScreenSharingOn ) => { return { checked : isScreenSharingOn } ; } ) ; /**
 * Selector type for  DevicesButton component.
 *
 *  public export type DevicesButtonSelector = ( state : CallClientState , props : CallingBaseSelectorProps ) => { microphones : AudioDeviceInfo [ ] ; speakers : AudioDeviceInfo [ ] ; cameras : VideoDeviceInfo [ ] ; selectedMicrophone ? : AudioDeviceInfo ; selectedSpeaker ? : AudioDeviceInfo ; selectedCamera ? : VideoDeviceInfo ; } ; /**
 * Selector for  DevicesButton component.
 *
 *  public export const devicesButtonSelector = reselect . createSelector ( [ getDeviceManager ] , ( deviceManager ) => { return { microphones : deviceManager . microphones , speakers : deviceManager . speakers , cameras : deviceManager . cameras , selectedMicrophone : deviceManager . selectedMicrophone , selectedSpeaker : deviceManager . selectedSpeaker , selectedCamera : deviceManager . selectedCamera } ; } ) ;