@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
1,478 lines (1,436 loc) • 434 kB
TypeScript
/// <reference types="react" />
import { AddPhoneNumberOptions } from '@azure/communication-calling';
import { AudioDeviceInfo } from '@azure/communication-calling';
import { AudioEffectsStartConfig } from '@azure/communication-calling';
import { BackgroundBlurConfig } from '@azure/communication-calling';
import { BackgroundBlurEffect } from '@azure/communication-calling';
import { BackgroundReplacementConfig } from '@azure/communication-calling';
import { BackgroundReplacementEffect } from '@azure/communication-calling';
import { BreakoutRoom } from '@azure/communication-calling';
import { BreakoutRoomsSettings } from '@azure/communication-calling';
import { BreakoutRoomsUpdatedListener } from '@azure/communication-calling';
import { Call } from '@azure/communication-calling';
import { CallAgent } from '@azure/communication-calling';
import { CallClient } from '@azure/communication-calling';
import { CallClientOptions } from '@azure/communication-calling';
import { CallDirection } from '@azure/communication-calling';
import { CallEndReason } from '@azure/communication-calling';
import { CallerInfo } from '@azure/communication-calling';
import { CallKind } from '@azure/communication-calling';
import { CallState as CallState_2 } from '@azure/communication-calling';
import { CallSurvey } from '@azure/communication-calling';
import { CallSurveyResponse } from '@azure/communication-calling';
import { CapabilitiesChangeInfo } from '@azure/communication-calling';
import { CaptionsKind } from '@azure/communication-calling';
import { CaptionsResultType } from '@azure/communication-calling';
import { ChatClient } from '@azure/communication-chat';
import { ChatClientOptions } from '@azure/communication-chat';
import { ChatMessage as ChatMessage_2 } from '@azure/communication-chat';
import { ChatMessageReadReceipt } from '@azure/communication-chat';
import { ChatParticipant } from '@azure/communication-chat';
import { ChatThreadClient } from '@azure/communication-chat';
import { CommunicationIdentifier } from '@azure/communication-common';
import { CommunicationIdentifierKind } from '@azure/communication-common';
import { CommunicationTokenCredential } from '@azure/communication-common';
import { CommunicationUserIdentifier } from '@azure/communication-common';
import type { CommunicationUserKind } from '@azure/communication-common';
import { CreateViewOptions } from '@azure/communication-calling';
import { DeviceAccess } from '@azure/communication-calling';
import { DeviceManager } from '@azure/communication-calling';
import { DominantSpeakersInfo } from '@azure/communication-calling';
import { DtmfTone as DtmfTone_2 } from '@azure/communication-calling';
import { EnvironmentInfo } from '@azure/communication-calling';
import { GroupCallLocator } from '@azure/communication-calling';
import { IButtonProps } from '@fluentui/react';
import { IButtonStyles } from '@fluentui/react';
import { IContextualMenuItem } from '@fluentui/react';
import { IContextualMenuItemStyles } from '@fluentui/react';
import { IContextualMenuProps } from '@fluentui/react';
import { IContextualMenuStyles } from '@fluentui/react';
import { IIconProps } from '@fluentui/react';
import { IIconStyles } from '@fluentui/react';
import { IMessageBarProps } from '@fluentui/react';
import { IncomingCall } from '@azure/communication-calling';
import { IncomingCallKind } from '@azure/communication-calling';
import { IPersonaStyleProps } from '@fluentui/react';
import { IPersonaStyles } from '@fluentui/react';
import { IRawStyle } from '@fluentui/react';
import { IRenderFunction } from '@fluentui/react';
import { IStackStyles } from '@fluentui/react';
import { IStyle } from '@fluentui/react';
import { IStyleFunctionOrObject } from '@fluentui/react';
import { ITextFieldStyles } from '@fluentui/react';
import { LatestMediaDiagnostics } from '@azure/communication-calling';
import { LatestNetworkDiagnostics } from '@azure/communication-calling';
import { LocalVideoStream } from '@azure/communication-calling';
import type { MediaDiagnosticChangedEventArgs } from '@azure/communication-calling';
import { MediaStreamType } from '@azure/communication-calling';
import { MicrosoftTeamsAppIdentifier } from '@azure/communication-common';
import { MicrosoftTeamsUserIdentifier } from '@azure/communication-common';
import type { NetworkDiagnosticChangedEventArgs } from '@azure/communication-calling';
import { PartialTheme } from '@fluentui/react';
import { ParticipantCapabilities } from '@azure/communication-calling';
import { ParticipantInfo } from '@azure/communication-calling';
import { ParticipantRole } from '@azure/communication-calling';
import { PermissionConstraints } from '@azure/communication-calling';
import { PersonaInitialsColor } from '@fluentui/react';
import { PersonaPresence } from '@fluentui/react';
import { PersonaSize } from '@fluentui/react';
import { PhoneNumberIdentifier } from '@azure/communication-common';
import { PropertyChangedEvent } from '@azure/communication-calling';
import { default as React_2 } from 'react';
import { Reaction as Reaction_2 } from '@azure/communication-calling';
import { ReactionMessage } from '@azure/communication-calling';
import { RealTimeTextInfo as RealTimeTextInfo_2 } from '@azure/communication-calling';
import { RealTimeTextResultType } from '@azure/communication-calling';
import type { RemoteParticipant } from '@azure/communication-calling';
import { RemoteParticipantState as RemoteParticipantState_2 } from '@azure/communication-calling';
import { RoomCallLocator } from '@azure/communication-calling';
import { ScalingMode } from '@azure/communication-calling';
import { SendMessageOptions } from '@azure/communication-chat';
import { SpotlightedParticipant } from '@azure/communication-calling';
import { StartCallOptions } from '@azure/communication-calling';
import { StartCaptionsOptions } from '@azure/communication-calling';
import { TeamsCall } from '@azure/communication-calling';
import { TeamsCallAgent } from '@azure/communication-calling';
import { TeamsCallInfo } from '@azure/communication-calling';
import { TeamsExtensionUserIdentifier } from '@azure/communication-common';
import { TeamsIncomingCall } from '@azure/communication-calling';
import { TeamsMeetingIdLocator } from '@azure/communication-calling';
import { TeamsMeetingLinkLocator } from '@azure/communication-calling';
import { Theme } from '@fluentui/react';
import { TransferEventArgs } from '@azure/communication-calling';
import { TypingIndicatorReceivedEvent } from '@azure/communication-chat';
import { UnknownIdentifier } from '@azure/communication-common';
import { VideoDeviceInfo } from '@azure/communication-calling';
import { VideoEffectName } from '@azure/communication-calling';
import { VideoStreamRenderer } from '@azure/communication-calling';
import { VideoStreamRendererView } from '@azure/communication-calling';
/**
* Transfer feature state
*
* @public
*/
export declare interface AcceptedTransfer {
/**
* Stores call id of accepted transfer
*/
callId: string;
/**
* Stores timestamp when transfer was accepted
*/
timestamp: Date;
}
/**
* Active error messages to be shown via {@link ErrorBar}.
*
* @public
*/
export declare interface ActiveErrorMessage {
/**
* Type of error that is active.
*/
type: ErrorType;
/**
* The latest timestamp when this error was observed.
*
* When available, this is used to track errors that have already been seen and dismissed
* by the user.
*/
timestamp?: Date;
}
/**
* Active notifications to be shown via {@link NotificationStack}.
*
* @public
*/
export declare interface ActiveNotification {
/**
* Type of error that is active.
*/
type: NotificationType;
/**
* Callback called when the primary button inside notification bar is clicked.
*/
onClickPrimaryButton?: () => void;
/**
* Callback called when the primary button inside notification bar is clicked.
*/
onClickSecondaryButton?: () => void;
/**
* Callback called when the notification is dismissed.
*/
onDismiss?: () => void;
/**
* If set, notification will automatically dismiss after 5 seconds
*/
autoDismiss?: boolean;
/**
* The latest timestamp when this notification was observed.
*
* When available, this is used to track notifications that have already been seen and dismissed
* by the user.
*/
timestamp?: Date;
/**
* Aria-live property for the notification.
* @defaultValue polite
*/
ariaLive?: 'assertive' | 'off' | 'polite';
}
/**
* Error reported via error events and stored in adapter state.
*
* @public
*/
export declare interface AdapterError extends Error {
/**
* The operation that failed.
*/
target: string;
/**
* Error thrown by the failed operation.
*/
innerError: Error;
/**
* Timestamp added to the error in the adapter implementation.
*/
timestamp: Date;
}
/**
* Adapters stores the latest error for each operation in the state.
*
* `target` is an adapter defined string for each unique operation performed by the adapter.
*
* @public
*/
export declare type AdapterErrors = {
[target: string]: AdapterError;
};
/**
* Notification from call client state stored in adapter state.
*
* @public
*/
export declare interface AdapterNotification {
/**
* Target of notification. There should only one notification per target.
*/
target: string;
/**
* Timestamp added to the notification in the adapter implementation.
*/
timestamp: Date;
}
/**
* Adapters stores the latest notification for each target.
*
* @public
*/
export declare type AdapterNotifications = {
[target: string]: AdapterNotification;
};
/**
* Functionality for interfacing with Composite adapter state.
*
* @public
*/
export declare interface AdapterState<TState> {
/** Subscribes the handler to stateChanged events. */
onStateChange(handler: (state: TState) => void): void;
/** Unsubscribes the handler to stateChanged events. */
offStateChange(handler: (state: TState) => void): void;
/** Get the current State */
getState(): TState;
}
/**
* Compare if 2 react components are exact equal, result type will be true/false
*
* @public
*/
export declare type AreEqual<A extends (props: any) => JSX.Element | undefined, B extends (props: any) => JSX.Element | undefined> = true extends AreTypeEqual<A, B> & AreParamEqual<A, B> ? true : false;
/**
* Compare if props of 2 react components are equal, result type will be true/false
*
* @public
*/
export declare type AreParamEqual<A extends (props: any) => JSX.Element | undefined, B extends (props: any) => JSX.Element | undefined> = AreTypeEqual<Required<Parameters<A>[0]>, Required<Parameters<B>[0]>>;
/**
* Compare if two types are equal, result type will be true/false
*
* @public
*/
export declare type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;
/**
* Data model that represents a chat message attachment
* where it contains an ID to uniquely identify the attachment,
* a name that represents the name of file, and
* a URL to download the attachment.
*
* @public
*/
export declare interface AttachmentMetadata {
/**
* Unique ID of the attachment.
*/
id: string;
/**
* Attachment name to be displayed.
*/
name: string;
/**
* Download URL for the attachment.
*/
url: string;
}
/**
* Custom data attributes for displaying avatar for a user.
*
* @public
*/
export declare type AvatarPersonaData = {
/**
* Primary text to display, usually the name of the person.
*/
text?: string;
/**
* Image URL to use, should be a square aspect ratio and big enough to fit in the image area.
*/
imageUrl?: string;
/**
* The user's initials to display in the image area when there is no image.
* @defaultvalue Derived from `text`
*/
imageInitials?: string;
/**
* The background color when the user's initials are displayed.
* @defaultvalue Derived from `text`
*/
initialsColor?: PersonaInitialsColor | string;
/**
* The text color when the user's initials are displayed
* @defaultvalue `white`
*/
initialsTextColor?: string;
/**
* If true, show the special coin for unknown persona.
* It has '?' in place of initials, with static font and background colors
*/
showUnknownPersonaCoin?: boolean;
};
/**
* Callback function used to provide custom data to build an avatar for a user.
*
* @public
*/
export declare type AvatarPersonaDataCallback = (userId: string) => Promise<AvatarPersonaData>;
/**
* Arguments for creating the Azure Communication Services implementation of {@link CallAdapter}.
*
* Note: `displayName` can be a maximum of 256 characters.
*
* @public
*/
export declare type AzureCommunicationCallAdapterArgs = {
userId: CommunicationUserIdentifier;
displayName: string;
credential: CommunicationTokenCredential;
locator: CallAdapterLocator;
/**
* Optional parameters for the {@link AzureCommunicationCallAdapter} created
*/
options?: AzureCommunicationCallAdapterOptions;
};
/**
* Optional parameters to create {@link AzureCommunicationCallAdapter}
*
* @public
*/
export declare type AzureCommunicationCallAdapterOptions = CommonCallAdapterOptions;
/**
* Arguments for {@link createAzureCommunicationCallWithChatAdapter}
*
* @public
*/
export declare type AzureCommunicationCallWithChatAdapterArgs = {
endpoint: string;
userId: CommunicationUserIdentifier;
displayName: string;
credential: CommunicationTokenCredential;
locator: CallAndChatLocator | TeamsMeetingLinkLocator | TeamsMeetingIdLocator;
alternateCallerId?: string;
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
};
/**
* Arguments for {@link createAzureCommunicationCallWithChatAdapterFromClient}
*
* @public
*/
export declare type AzureCommunicationCallWithChatAdapterFromClientArgs = {
callLocator: CallAdapterLocator | TeamsMeetingLinkLocator;
callAgent: CallAgent;
callClient: StatefulCallClient;
chatClient: StatefulChatClient;
chatThreadClient: ChatThreadClient;
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
};
/**
* Arguments for creating the Azure Communication Services implementation of {@link ChatAdapter}.
*
* @public
*/
export declare type AzureCommunicationChatAdapterArgs = {
endpoint: string;
userId: CommunicationUserIdentifier;
displayName: string;
credential: CommunicationTokenCredential;
threadId: string;
chatAdapterOptions?: ChatAdapterOptions;
};
/**
* Arguments for creating the Azure Communication Services implementation of {@link CallAdapter}.
*
* These arguments are used to create an outbound call scenarios.
*
* Note: `displayName` can be a maximum of 256 characters.
*
* @public
*/
export declare type AzureCommunicationOutboundCallAdapterArgs = {
userId: CommunicationUserIdentifier;
displayName: string;
credential: CommunicationTokenCredential;
targetCallees: StartCallIdentifier[];
/**
* A phone number in E.164 format procured using Azure Communication Services that will be used to represent callers identity.
* E.164 numbers are formatted as [+] [country code] [phone number including area code]. For example, +14255550123 for a US phone number.
*/
alternateCallerId?: string;
/**
* Optional parameters for the {@link AzureCommunicationCallAdapter} created
*/
options?: AzureCommunicationCallAdapterOptions;
};
/**
* Properties common to all composites exported from this library.
*
* @public
*/
export declare interface BaseCompositeProps<TIcons extends Record<string, JSX.Element>> {
/**
* Fluent theme for the composite.
*
* @defaultValue light theme
*/
fluentTheme?: PartialTheme | Theme;
/**
* Custom Icon override for the composite.
* A JSX element can be provided to override the default icon.
*/
icons?: TIcons;
/**
* Locale for the composite.
*
* @defaultValue English (US)
*/
locale?: CompositeLocale;
/**
* Whether composite is displayed right-to-left.
*
* @defaultValue false
*/
rtl?: boolean;
/**
* A callback function that can be used to provide custom data to Avatars rendered
* in Composite.
*
* This will not affect the displayName shown in the composite.
* The displayName throughout the composite will be what is provided to the adapter when the adapter is created.
* will be what is provided to the adapter when the adapter is created.
*/
onFetchAvatarPersonaData?: AvatarPersonaDataCallback;
/**
* A callback function that can be used to provide custom menu items for a participant in
* participant list.
*/
onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;
}
/**
* Basic fluent styles props for all components exported from this libray.
*
* @public
*/
export declare interface BaseCustomStyles {
/** Styles for the root container. */
root?: IStyle;
}
/**
* Breakout rooms state
*
* @public
*/
export declare interface BreakoutRoomsState {
/** Breakout room assigned to local user in call */
assignedBreakoutRoom?: BreakoutRoom;
/** Breakout room settings of call. This is defined when call is a breakout room. */
breakoutRoomSettings?: BreakoutRoomsSettings;
/** Display name of breakout room. This is defined when call is a breakout room. */
breakoutRoomDisplayName?: string;
}
/**
* An Adapter interface specific for Azure Communication identity which extends {@link CommonCallAdapter}.
*
* @public
*/
export declare interface CallAdapter extends CommonCallAdapter {
/**
* Join the call with microphone initially on/off.
* @deprecated Use joinCall(options?:JoinCallOptions) instead.
* @param microphoneOn - Whether microphone is initially enabled
*
* @public
*/
joinCall(microphoneOn?: boolean): Call | undefined;
/**
* Join the call with options bag to set microphone/camera initial state when joining call
* true = turn on the device when joining call
* false = turn off the device when joining call
* 'keep'/undefined = retain devices' precall state
*
* @param options - param to set microphone/camera initially on/off/use precall state.
*
* @public
*/
joinCall(options?: JoinCallOptions): Call | undefined;
/**
* Start the call.
*
* @param participants - An array of participant ids to join
*
* @public
*/
startCall(participants: string[], options?: StartCallOptions): Call | undefined;
/**
* Start the call.
* @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
* @public
*/
startCall(participants: StartCallIdentifier[], options?: StartCallOptions): Call | undefined;
}
/**
* Payload for {@link CallEndedListener} containing details on the ended call.
*
* @public
*/
export declare type CallAdapterCallEndedEvent = {
callId: string;
code?: number;
subCode?: number;
};
/**
* Functionality for managing the current call or start a new call
* @deprecated CallAdapter interface will be flatten, consider using CallAdapter directly
* @public
*/
export declare interface CallAdapterCallManagement extends CallAdapterCallOperations {
/**
* Join the call with microphone initially on/off.
* @deprecated Use joinCall(options?:JoinCallOptions) instead.
* @param microphoneOn - Whether microphone is initially enabled
*
* @public
*/
joinCall(microphoneOn?: boolean): Call | undefined;
/**
* Join the call with options bag to set microphone/camera initial state when joining call
* true = turn on the device when joining call
* false = turn off the device when joining call
* 'keep'/undefined = retain devices' precall state
*
* @param options - param to set microphone/camera initially on/off/use precall state.
*
* @public
*/
joinCall(options?: JoinCallOptions): Call | undefined;
/**
* Start the call.
*
* @param participants - An array of participant ids to join
*
* @public
*/
startCall(participants: string[], options?: StartCallOptions): Call | undefined;
/**
* Start the call.
* @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
* @public
*/
startCall(participants: StartCallIdentifier[], options?: StartCallOptions): Call | undefined;
}
/**
* Functionality for managing the current call.
*
* @public
*/
export declare interface CallAdapterCallOperations {
/**
* Leave the call
*
* @param forEveryone - Whether to remove all participants when leaving
*
* @public
*/
leaveCall(forEveryone?: boolean): Promise<void>;
/**
* Start the camera
* This method will start rendering a local camera view when the call is not active
*
* @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }
*
* @public
*/
startCamera(options?: VideoStreamOptions): Promise<void>;
/**
* Stop the camera
* This method will stop rendering a local camera view when the call is not active
*
* @public
*/
stopCamera(): Promise<void>;
/**
* Mute the current user during the call or disable microphone locally
*
* @public
*/
mute(): Promise<void>;
/**
* Unmute the current user during the call or enable microphone locally
*
* @public
*/
unmute(): Promise<void>;
/**
* Start sharing the screen during a call.
*
* @public
*/
startScreenShare(): Promise<void>;
/**
* Raise hand for current user
*
* @public
*/
raiseHand(): Promise<void>;
/**
* lower hand for current user
*
* @public
*/
lowerHand(): Promise<void>;
/**
* Send reaction emoji
*
* @public
*/
onReactionClick(reaction: Reaction_2): Promise<void>;
/**
* Stop sharing the screen
*
* @public
*/
stopScreenShare(): Promise<void>;
/**
* Remove a participant from the call.
*
* @param userId - Id of the participant to be removed
*
* @public
*/
removeParticipant(userId: string): Promise<void>;
/**
* Remove a participant from the call.
* @param participant - {@link @azure/communication-common#CommunicationIdentifier} of the participant to be removed
* @public
*/
removeParticipant(participant: CommunicationIdentifier): Promise<void>;
/**
* Create the html view for a stream.
*
* @remarks
* This method is implemented for composite
*
* @param remoteUserId - Id of the participant to render, leave it undefined to create the local camera view
* @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }
*
* @public
*/
createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void | CreateVideoStreamViewResult>;
/**
* Dispose the html view for a stream.
*
* @remarks
* This method is implemented for composite
*
* @deprecated Use {@link disposeRemoteVideoStreamView}, {@link disposeLocalVideoStreamView} and {@link disposeRemoteVideoStreamView} instead.
*
* @param remoteUserId - Id of the participant to render, leave it undefined to dispose the local camera view
* @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }
*
* @public
*/
disposeStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void>;
/**
* Create the html view for a stream.
*
* @remarks
* This method is implemented for composite
*
* @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }
*
* @public
*/
createTogetherModeStreamView(options?: TogetherModeStreamOptions): Promise<void | TogetherModeStreamViewResult>;
/**
* Start Together mode.
*
* @public
*/
startTogetherMode(): Promise<void>;
/**
* Recalculate the seating positions for together mode.
*
* @remarks
* This method is implemented for composite
*
* @param width - Width of the container
* @param height - Height of the container
*
* @public
*/
setTogetherModeSceneSize(width: number, height: number): void;
/**
* Dispose the html view for a stream.
*
* @remarks
* This method is implemented for composite
*
*
* @public
*/
disposeTogetherModeStreamView(): Promise<void>;
/**
* Dispose the html view for a screen share stream
*
* @remarks
* this method is implemented for composite
*
* @param remoteUserId - Id of the participant to dispose the screen share stream view for.
*
* @public
*/
disposeScreenShareStreamView(remoteUserId: string): Promise<void>;
/**
* Dispose the html view for a remote video stream
*
* @param remoteUserId - Id of the participant to dispose
*
* @public
*/
disposeRemoteVideoStreamView(remoteUserId: string): Promise<void>;
/**
* Dispose the html view for a local video stream
*
* @public
*/
disposeLocalVideoStreamView(): Promise<void>;
/**
* Holds the call.
*
* @public
*/
holdCall(): Promise<void>;
/**
* Resumes the call from a `LocalHold` state.
*
* @public
*/
resumeCall(): Promise<void>;
/**
* Add a participant to the call.
*
* @public
*/
addParticipant(participant: PhoneNumberIdentifier, options?: AddPhoneNumberOptions): Promise<void>;
addParticipant(participant: CommunicationUserIdentifier): Promise<void>;
/**
* send dtmf tone to another participant in a 1:1 PSTN call
*
* @public
*/
sendDtmfTone(dtmfTone: DtmfTone_2): Promise<void>;
/**
* Function to Start captions
* @param options - options for start captions
*/
startCaptions(options?: StartCaptionsAdapterOptions): Promise<void>;
/**
* Function to set caption language
* @param language - language set for caption
*/
setCaptionLanguage(language: string): Promise<void>;
/**
* Function to set spoken language
* @param language - spoken language
*/
setSpokenLanguage(language: string): Promise<void>;
/**
* Funtion to stop captions
*/
stopCaptions(options?: StopCaptionsAdapterOptions): Promise<void>;
/**
* Start the video background effect.
*
* @public
*/
startVideoBackgroundEffect(videoBackgroundEffect: VideoBackgroundEffect): Promise<void>;
/**
* Stop the video background effect.
*
* @public
*/
stopVideoBackgroundEffects(): Promise<void>;
/**
* Override the background picker images for background replacement effect.
*
* @param backgroundImages - Array of custom background images.
*
* @public
*/
updateBackgroundPickerImages(backgroundImages: VideoBackgroundImage[]): void;
/**
* Update the selected video background effect.
*
* @public
*/
updateSelectedVideoBackgroundEffect(selectedVideoBackground: VideoBackgroundEffect): void;
/**
* Start the noise suppression effect.
*
*/
startNoiseSuppressionEffect(): Promise<void>;
/**
* Stop the noise suppression effect.
*
*/
stopNoiseSuppressionEffect(): Promise<void>;
/**
* Send the end of call survey result
*
* @public
*/
submitSurvey(survey: CallSurvey): Promise<CallSurveyResponse | undefined>;
/**
* Start spotlight for local and remote participants by their user ids.
* If no array of user ids is passed then action is performed on local participant.
*/
startSpotlight(userIds?: string[]): Promise<void>;
/**
* Stop spotlight for local and remote participants by their user ids.
* If no array of user ids is passed then action is performed on local participant.
*/
stopSpotlight(userIds?: string[]): Promise<void>;
/**
* Stop all spotlights
*/
stopAllSpotlight(): Promise<void>;
/**
* Mute a participant
*
* @param userId - Id of the participant to mute
*/
muteParticipant(userId: string): Promise<void>;
/**
* Mute All participants
*/
muteAllRemoteParticipants(): Promise<void>;
/**
* Return to origin call of breakout room
*/
returnFromBreakoutRoom(): Promise<void>;
/**
* Forbid Teams meeting attendees audio by their user ids.
*/
forbidAudio(userIds: string[]): Promise<void>;
/**
* Permit Teams meeting attendees audio by their user ids.
*/
permitAudio(userIds: string[]): Promise<void>;
/**
* Forbid Teams meeting audio.
*/
forbidOthersAudio(): Promise<void>;
/**
* Permit Teams meeting audio.
*/
permitOthersAudio(): Promise<void>;
/**
* Forbid Teams meeting attendees video by their user ids.
*/
forbidVideo(userIds: string[]): Promise<void>;
/**
* Permit Teams meeting attendees audio by their user ids.
*/
permitVideo(userIds: string[]): Promise<void>;
/**
* Forbid Teams meeting video.
*/
forbidOthersVideo(): Promise<void>;
/**
* Permit Teams meeting video.
*/
permitOthersVideo(): Promise<void>;
/**
* Send real time text
* @param text - real time text content
* @param finalized - Boolean to indicate if the real time text is final
*/
sendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
}
/**
* {@link CommonCallAdapter} state inferred from Azure Communication Services backend.
*
* @public
*/
export declare type CallAdapterClientState = {
userId: CommunicationIdentifierKind;
displayName?: string;
call?: CallState;
/**
* State to track who the original call went out to. will be undefined the call is not a outbound
* modality. This includes, groupCalls, Rooms calls, and Teams InteropMeetings.
*/
targetCallees?: CommunicationIdentifier[];
devices: DeviceManagerState;
endedCall?: CallState;
/**
* State to track whether the call is a teams call.
*/
isTeamsCall: boolean;
/**
* State to track whether the call is a teams meeting.
*/
isTeamsMeeting: boolean;
/**
* State to track whether the call is a rooms call.
*/
isRoomsCall: boolean;
/**
* Latest error encountered for each operation performed via the adapter.
*/
latestErrors: AdapterErrors;
/**
* Latest notifications from call client state.
*/
latestNotifications: AdapterNotifications;
/**
* Azure communications Phone number to make PSTN calls with.
*/
alternateCallerId?: string;
/**
* Environment information about system the adapter is made on
*/
environmentInfo?: EnvironmentInfo;
/**
* State to track whether the local participant's camera is on. To be used when creating a custom
* control bar with the CallComposite.
*/
cameraStatus?: 'On' | 'Off';
/**
* Default set of background images for background replacement effect.
*/
videoBackgroundImages?: VideoBackgroundImage[];
/**
* Dependency to be injected for video background effect.
*/
onResolveVideoEffectDependency?: () => Promise<VideoBackgroundEffectsDependency>;
/**
* Dependency to be injected for deep noise suppression effect.
*/
onResolveDeepNoiseSuppressionDependency?: () => Promise<DeepNoiseSuppressionEffectDependency>;
/**
* State to track whether the noise suppression should be on by default.
* @default true
*/
deepNoiseSuppressionOnByDefault?: boolean;
/**
* State to track whether to hide the noise suppression button.
* @default false
*/
hideDeepNoiseSuppressionButton?: boolean;
/**
* State to track the selected video background effect.
*/
selectedVideoBackgroundEffect?: VideoBackgroundEffect;
/**
* Call from transfer request accepted by local user
*/
acceptedTransferCallState?: CallState;
/**
* Hide attendee names in teams meeting
*/
hideAttendeeNames?: boolean;
/**
* State to track the sounds to be used in the call.
*/
sounds?: CallingSounds;
/**
* State to track the reactions to be used.
* @public
*/
reactions?: ReactionResources;
};
/**
* Functionality for managing devices within a call.
*
* @public
*/
export declare interface CallAdapterDeviceManagement {
/**
* Ask for permissions of devices.
*
* @remarks
* Browser permission window will pop up if permissions are not granted yet
*
* @param constrain - Define constraints for accessing local devices {@link @azure/communication-calling#PermissionConstraints }
*
* @public
*/
askDevicePermission(constrain: PermissionConstraints): Promise<DeviceAccess>;
/**
* Query for available camera devices.
*
* @remarks
* This method should be called after askDevicePermission()
*
* @return An array of video device information entities {@link @azure/communication-calling#VideoDeviceInfo }
*
* @public
*/
queryCameras(): Promise<VideoDeviceInfo[]>;
/**
* Query for available microphone devices.
*
* @remarks
* This method should be called after askDevicePermission()
*
* @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }
*
* @public
*/
queryMicrophones(): Promise<AudioDeviceInfo[]>;
/**
* Query for available speaker devices.
*
* @remarks
* This method should be called after askDevicePermission()
*
* @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }
*
* @public
*/
querySpeakers(): Promise<AudioDeviceInfo[]>;
/**
* Set the camera to use in the call.
*
* @param sourceInfo - Camera device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryCameras }
* @param options - Options to control how the camera stream is rendered {@link @azure/communication-calling#VideoStreamOptions }
*
* @public
*/
setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>;
/**
* Set the microphone to use in the call.
*
* @param sourceInfo - Microphone device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryMicrophones }
*
* @public
*/
setMicrophone(sourceInfo: AudioDeviceInfo): Promise<void>;
/**
* Set the speaker to use in the call.
*
* @param sourceInfo - Speaker device to choose, pick one returned by {@link CallAdapterDeviceManagement#querySpeakers }
*
* @public
*/
setSpeaker(sourceInfo: AudioDeviceInfo): Promise<void>;
}
/**
* Locator used by {@link createAzureCommunicationCallAdapter} to locate the call to join
*
* @public
*/
export declare type CallAdapterLocator = TeamsMeetingLinkLocator | GroupCallLocator | RoomCallLocator | TeamsMeetingIdLocator;
/**
* {@link CommonCallAdapter} state.
*
* @public
*/
export declare type CallAdapterState = CallAdapterUiState & CallAdapterClientState;
/**
* Call composite events that can be subscribed to.
*
* @public
*/
export declare interface CallAdapterSubscribers {
/**
* Subscribe function for 'participantsJoined' event.
*/
on(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;
/**
* Subscribe function for 'participantsLeft' event.
*/
on(event: 'participantsLeft', listener: ParticipantsLeftListener): void;
/**
* Subscribe function for 'isMutedChanged' event.
*
* @remarks
* The event will be triggered whenever current user or remote user mute state changed
*
*/
on(event: 'isMutedChanged', listener: IsMutedChangedListener): void;
/**
* Subscribe function for 'callIdChanged' event.
*
* @remarks
* The event will be triggered when callId of current user changed.
*
*/
on(event: 'callIdChanged', listener: CallIdChangedListener): void;
/**
* Subscribe function for 'isLocalScreenSharingActiveChanged' event.
*/
on(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;
/**
* Subscribe function for 'displayNameChanged' event.
*/
on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;
/**
* Subscribe function for 'isSpeakingChanged' event.
*/
on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;
/**
* Subscribe function for 'callEnded' event.
*/
on(event: 'callEnded', listener: CallEndedListener): void;
/**
* Subscribe function for 'diagnosticChanged' event.
*
* This event fires whenever there is a change in user facing diagnostics about the ongoing call.
*/
on(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;
/**
* Subscribe function for 'selectedMicrophoneChanged' event.
*
* This event fires whenever the user selects a new microphone device.
*/
on(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;
/**
* Subscribe function for 'selectedSpeakerChanged' event.
*
* This event fires whenever the user selects a new speaker device.
*/
on(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;
/**
* Subscribe function for 'error' event.
*/
on(event: 'error', listener: (e: AdapterError) => void): void;
/**
* Subscribe function for 'captionsReceived' event.
*/
on(event: 'captionsReceived', listener: CaptionsReceivedListener): void;
/**
* Subscribe function for 'isCaptionsActiveChanged' event.
*/
on(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
/**
* Subscribe function for 'isCaptionLanguageChanged' event.
*/
on(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;
/**
* Subscribe function for 'isSpokenLanguageChanged' event.
*/
on(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;
/**
* Subscribe function for 'realTimeTextReceived' event.
*/
on(event: 'realTimeTextReceived', listener: RealTimeTextReceivedListener): void;
/**
* Subscribe function for 'transferRequested' event.
*/
on(event: 'transferAccepted', listener: TransferAcceptedListener): void;
/**
* Subscribe function for 'capabilitiesChanged' event.
*/
on(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;
/**
* Subscribe function for 'roleChanged' event.
*/
on(event: 'roleChanged', listener: PropertyChangedEvent): void;
/**
* Subscribe function for 'spotlightChanged' event.
*/
on(event: 'spotlightChanged', listener: SpotlightChangedListener): void;
/**
* Subscribe function for 'mutedByOthers' event.
*/
on(event: 'mutedByOthers', listener: PropertyChangedEvent): void;
/**
* Subscribe function for 'breakoutRoomsUpdated' event.
*/
on(event: 'breakoutRoomsUpdated', listener: BreakoutRoomsUpdatedListener): void;
/**
* Unsubscribe function for 'participantsJoined' event.
*/
off(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;
/**
* Unsubscribe function for 'participantsLeft' event.
*/
off(event: 'participantsLeft', listener: ParticipantsLeftListener): void;
/**
* Unsubscribe function for 'isMutedChanged' event.
*/
off(event: 'isMutedChanged', listener: IsMutedChangedListener): void;
/**
* Unsubscribe function for 'callIdChanged' event.
*/
off(event: 'callIdChanged', listener: CallIdChangedListener): void;
/**
* Unsubscribe function for 'isLocalScreenSharingActiveChanged' event.
*/
off(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;
/**
* Unsubscribe function for 'displayNameChanged' event.
*/
off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;
/**
* Unsubscribe function for 'isSpeakingChanged' event.
*/
off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;
/**
* Unsubscribe function for 'callEnded' event.
*/
off(event: 'callEnded', listener: CallEndedListener): void;
/**
* Unsubscribe function for 'diagnosticChanged' event.
*/
off(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;
/**
* Unsubscribe function for 'selectedMicrophoneChanged' event.
*/
off(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;
/**
* Unsubscribe function for 'selectedSpeakerChanged' event.
*/
off(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;
/**
* Unsubscribe function for 'error' event.
*/
off(event: 'error', listener: (e: AdapterError) => void): void;
/**
* Unsubscribe function for 'captionsReceived' event.
*/
off(event: 'captionsReceived', listener: CaptionsReceivedListener): void;
/**
* Unsubscribe function for 'isCaptionsActiveChanged' event.
*/
off(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
/**
* Unsubscribe function for 'isCaptionLanguageChanged' event.
*/
off(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;
/**
* Unsubscribe function for 'isSpokenLanguageChanged' event.
*/
off(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;
/**
* Unsubscribe function for 'realTimeTextReceived' event.
*/
off(event: 'realTimeTextReceived', listener: RealTimeTextReceivedListener): void;
/**
* Unsubscribe function for 'transferRequested' event.
*/
off(event: 'transferAccepted', listener: TransferAcceptedListener): void;
/**
* Unsubscribe function for 'capabilitiesChanged' event.
*/
off(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;
/**
* Unsubscribe function for 'roleChanged' event.
*/
off(event: 'roleChanged', listener: PropertyChangedEvent): void;
/**
* Unsubscribe function for 'spotlightChanged' event.
*/
off(event: 'spotlightChanged', listener: SpotlightChangedListener): void;
/**
* Unsubscribe function for 'mutedByOthers' event.
*/
off(event: 'mutedByOthers', listener: PropertyChangedEvent): void;
/**
* Unsubscribe function for 'breakoutRoomsUpdated' event.
*/
off(event: 'breakoutRoomsUpdated', listener: BreakoutRoomsUpdatedListener): void;
}
/**
* {@link CommonCallAdapter} state for pure UI purposes.
*
* @public
*/
export declare type CallAdapterUiState = {
isLocalPreviewMicrophoneEnabled: boolean;
page: CallCompositePage;
};
/**
* A {@link React.Context} that stores a {@link @azure/communication-calling#CallAgent}.
*
* Calling components from this package must be wrapped with a {@link CallAgentProvider}.
*
* @public
*/
export declare const CallAgentProvider: (props: CallAgentProviderProps) => JSX.Element;
/**
* Arguments to initialize a {@link CallAgentProvider}.
*
* @public
*/
export declare interface CallAgentProviderProps {
children: React_2.ReactNode;
callAgent?: CallAgent | TeamsCallAgent;
}
/**
* State only version of {@link @azure/communication-calling#CallAgent} except calls is moved to be a child directly of
* {@link CallClientState} and not included here. The reason to have CallAgent's state proxied is to provide access to
* displayName. We don't flatten CallAgent.displayName and put it in CallClientState because it would be ambiguious that
* displayName is actually reliant on the creation/existence of CallAgent to be available.
*
* @public
*/
export declare interface CallAgentState {
/**
* Proxy of {@link @azure/communication-calling#CallAgent.displayName}.
*/
displayName?: string;
}
/**
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Call with an associated Chat thread.
*
* @public
*/
export declare interface CallAndChatLocator {
/** Locator used by {@link createAzureCommunicationCallWithChatAdapter} to locate the call to join */
callLocator: GroupCallLocator;
/** Chat thread ID used by {@link createAzureCommunicationCallWithChatAdapter} to locate the chat thread to join */
chatThreadId: string;
}
/**
* A {@link React.Context} that stores a {@link StatefulCallClient}.
*
* Calling components from this package must be wrapped with a {@link CallClientProvider}.
*
* @public
*/
export declare const CallClientProvider: (props: CallClientProviderProps) => JSX.Element;
/**
* Arguments to initialize a {@link CallClientProvider}.
*
* @public
*/
export declare interface CallClientProviderProps {
children: React_2.ReactNode;
callClient: StatefulCallClient;
}
/**
* Container for all of the state data proxied by {@link StatefulCallClient}. The calls, callsEnded, incomingCalls, and
* incomingCallsEnded states will be automatically provided if a callAgent has been created. The deviceManager will be
* empty initially until populated see {@link DeviceManagerState}. The userId state is provided as a convenience for the
* developer and is completely controled and set by the developer.
*
* @public
*/
export declare interface CallClientState {
/**
* Proxy of {@link @azure/communication-calling#CallAgent.calls} as an object with CallState {@link CallState} fields.
* It is keyed by {@link @azure/communication-calling#Call.id}. Please note that
* {@link @azure/communication-calling#Call.id} could change. You should not cache the id itself but the entire
* {@link @azure/communication-calling#Call} and then use the id contained to look up data in this map.
*/
calls: {
[key: string]: CallState;
};
/**
* Calls that have ended are stored here so the callEndReason could be checked.
* It is an object with {@link @azure/communication-calling#Call.id} keys and {@link CallState} values.
*
* Only {@link MAX_CALL_HISTORY_LENGTH} Calls are kept in the history. Oldest calls are evicted if required.
*/
callsEnded: {
[key: string]: CallState;
};
/**
* Proxy of {@link @azure/communication-calling#IncomingCall} as an object with {@link IncomingCall} fields.
* It is keyed by {@link @azure/communication-calling#IncomingCall.id}.
*/
incomingCalls: {
[key: string]: IncomingCallState | TeamsIncomingCallState;
};
/**
* Incoming Calls that have ended are stored here so the callEndReason could be checked.
* It is an as an object with {@link @azure/communication-calling#Call.id} keys and {@link IncomingCall} values.
*
* Only {@link MAX_CALL_HISTORY_LENGTH} Calls are kept in the history. Oldest calls are evicted if required.
*/
incomingCallsEnded: {
[key: string]: IncomingCallState | TeamsIncomingCallState;
};
/**
* Proxy of {@link @azure/communication-calling#DeviceManager}. Please review {@link DeviceManagerState}.
*/
deviceManager: DeviceManagerState;
/**
* Proxy of {@link @azure/communication-calling#CallAgent}. Please review {@link CallAgentState}.
*/
callAgent?: CallAgentState;
/**
* Stores a userId. This is not used by the {@link StatefulCallClient} and is provided here as a convenience for the
* developer for easier access to userId. Must be passed in at initialization of the {@link StatefulCallClient}.
* Completely controlled by the developer.
*/
userId: CommunicationIdentifierKind;
/**
* Stores the latest error for each API method.
*
* See documentation of {@Link CallErrors} for details.
*/
latestErrors: CallErrors;
/**
* Stores the latest notifications.
*
* See documentation of {@Link CallNotifications} for details.
*/
latestNotifications: CallNotifications;
/**
* A phone number in E.164 format that will be used to represent callers identity.
* For example, using the alternateCallerId to add a participant using PSTN, this number will
* be used as the caller id in the PSTN call.
*/
alternateCallerId?: string;
/**
* state to track the environment that the stateful client was made in is supported
*/
environmentInfo?: EnvironmentInfo;
}
/**
* A customizable UI composite for calling experience.
*
* @remarks Call composite