@azure/communication-react 1.4.3-alpha-202212140016.0 → 1.4.3-alpha-202212150014.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist-cjs/communication-react/index.js +409 -382
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +5 -0
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +7 -0
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +4 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +11 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +9 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +14 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/package.json +8 -8
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.4.3-alpha-
|
1
|
+
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.4.3-alpha-202212150014.0';\n"]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { DominantSpeakersInfo } from '@azure/communication-calling';
|
2
|
+
import { EnvironmentInfo } from '@azure/communication-calling';
|
2
3
|
import { ParticipantRole } from '@azure/communication-calling';
|
3
4
|
import { CallClientState, DeviceManagerState, RemoteParticipantState, LocalVideoStreamState, CallErrors, DiagnosticsCallFeatureState } from "../../calling-stateful-client/src";
|
4
5
|
/**
|
@@ -67,4 +68,8 @@ export declare const getDiagnostics: (state: CallClientState, props: CallingBase
|
|
67
68
|
* @private
|
68
69
|
*/
|
69
70
|
export declare const getCallState: (state: CallClientState, props: CallingBaseSelectorProps) => string;
|
71
|
+
/**
|
72
|
+
* @private
|
73
|
+
*/
|
74
|
+
export declare const getEnvironmentInfo: (state: CallClientState) => EnvironmentInfo | undefined;
|
70
75
|
//# sourceMappingURL=baseSelectors.d.ts.map
|
@@ -60,4 +60,11 @@ export const getDiagnostics = (state, props) => { var _a; return (_a = state.cal
|
|
60
60
|
* @private
|
61
61
|
*/
|
62
62
|
export const getCallState = (state, props) => { var _a; return (_a = state.calls[props.callId]) === null || _a === void 0 ? void 0 : _a.state; };
|
63
|
+
/* @conditional-compile-remove(unsupported-browser) */
|
64
|
+
/**
|
65
|
+
* @private
|
66
|
+
*/
|
67
|
+
export const getEnvironmentInfo = (state) => {
|
68
|
+
return state.environmentInfo;
|
69
|
+
};
|
63
70
|
//# sourceMappingURL=baseSelectors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"baseSelectors.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/baseSelectors.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"baseSelectors.js","sourceRoot":"","sources":["../../../../../calling-component-bindings/src/baseSelectors.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAmBxE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAsB,EAAsB,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC;AAEpG,wCAAwC;AACxC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAsB,EAAE,KAA+B,EAA+B,EAAE,WAC9G,OAAA,MAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAAA,EAAA,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAsB,EAAE,KAA+B,EAAW,EAAE,CAChG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAsB,EACtB,KAA+B,EACG,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,gBAAgB,CAAA,EAAA,CAAC;AAEnF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAsB,EACtB,KAA+B,EAKnB,EAAE;;IACd,OAAO,MAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,kBAAkB,CAAC;AACvD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAsB,EAAE,KAA+B,EAAuB,EAAE,W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6C;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAsB,EAAE,KAA+B,EAAU,EAAE,WAC9F,OAAA,MAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAA,EAAA,CAAC;AAEnC,sDAAsD;AACtD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAsB,EAA+B,EAAE;IACxF,OAAO,KAAK,CAAC,eAAe,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { DominantSpeakersInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(rooms) */\nimport { ParticipantRole } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallClientState,\n DeviceManagerState,\n RemoteParticipantState,\n LocalVideoStreamState,\n CallErrors,\n DiagnosticsCallFeatureState\n} from '@internal/calling-stateful-client';\n\n/**\n * Common props used to reference calling declarative client state.\n *\n * @public\n */\nexport type CallingBaseSelectorProps = {\n callId: string;\n};\n\n/**\n * @private\n */\nexport const getDeviceManager = (state: CallClientState): DeviceManagerState => state.deviceManager;\n\n/* @conditional-compile-remove(rooms) */\n/**\n * @private\n */\nexport const getRole = (state: CallClientState, props: CallingBaseSelectorProps): ParticipantRole | undefined =>\n state.calls[props.callId]?.role;\n\n/**\n * @private\n */\nexport const getCallExists = (state: CallClientState, props: CallingBaseSelectorProps): boolean =>\n !!state.calls[props.callId];\n\n/**\n * @private\n */\nexport const getDominantSpeakers = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): undefined | DominantSpeakersInfo => state.calls[props.callId]?.dominantSpeakers;\n\n/**\n * @private\n */\nexport const getRemoteParticipants = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n):\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined => {\n return state.calls[props.callId]?.remoteParticipants;\n};\n\n/**\n * @private\n */\nexport const getIsScreenSharingOn = (state: CallClientState, props: CallingBaseSelectorProps): boolean | undefined =>\n state.calls[props.callId]?.isScreenSharingOn;\n\n/**\n * @private\n */\nexport const getIsMuted = (state: CallClientState, props: CallingBaseSelectorProps): boolean | undefined =>\n state.calls[props.callId]?.isMuted;\n\n/**\n * @private\n */\nexport const getLocalVideoStreams = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): LocalVideoStreamState[] | undefined => state.calls[props.callId]?.localVideoStreams;\n\n/**\n * @private\n */\nexport const getScreenShareRemoteParticipant = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): string | undefined => state.calls[props.callId]?.screenShareRemoteParticipant;\n\n/**\n * @private\n */\nexport const getDisplayName = (state: CallClientState): string | undefined => state.callAgent?.displayName;\n\n/**\n * @private\n */\nexport const getIdentifier = (state: CallClientState): string => toFlatCommunicationIdentifier(state.userId);\n\n/**\n * @private\n */\nexport const getLatestErrors = (state: CallClientState): CallErrors => state.latestErrors;\n\n/**\n * @private\n */\nexport const getDiagnostics = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): DiagnosticsCallFeatureState | undefined => state.calls[props.callId]?.diagnostics;\n\n/* @conditional-compile-remove(PSTN-calls) */\n/**\n * @private\n */\nexport const getCallState = (state: CallClientState, props: CallingBaseSelectorProps): string =>\n state.calls[props.callId]?.state;\n\n/* @conditional-compile-remove(unsupported-browser) */\n/**\n * @private\n */\nexport const getEnvironmentInfo = (state: CallClientState): EnvironmentInfo | undefined => {\n return state.environmentInfo;\n};\n\"../../acs-ui-common/src\"\"../../calling-stateful-client/src\""]}
|
@@ -16,7 +16,7 @@ import { _isTeamsCallAgent } from "../../../../../calling-stateful-client/src";
|
|
16
16
|
/* @conditional-compile-remove(unsupported-browser) */
|
17
17
|
import { Features } from '@azure/communication-calling';
|
18
18
|
import { EventEmitter } from 'events';
|
19
|
-
import { getCallCompositePage, IsCallEndedPage, isCameraOn } from '../utils';
|
19
|
+
import { getCallCompositePage, IsCallEndedPage, isCameraOn, isValidIdentifier } from '../utils';
|
20
20
|
import { toFlatCommunicationIdentifier, _toCommunicationIdentifier } from "../../../../../acs-ui-common/src";
|
21
21
|
import { isCommunicationUserIdentifier, isPhoneNumberIdentifier } from '@azure/communication-common';
|
22
22
|
import { ParticipantSubscriber } from './ParticipantSubcriber';
|
@@ -601,6 +601,9 @@ export class AzureCommunicationCallAdapter {
|
|
601
601
|
export const createAzureCommunicationCallAdapter = ({ userId, displayName, credential, locator,
|
602
602
|
/* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
|
603
603
|
/* @conditional-compile-remove(rooms) */ options }) => __awaiter(void 0, void 0, void 0, function* () {
|
604
|
+
if (!isValidIdentifier(userId)) {
|
605
|
+
throw new Error('Invalid identifier. Please provide valid identifier object.');
|
606
|
+
}
|
604
607
|
const callClient = createStatefulCallClient({
|
605
608
|
userId,
|
606
609
|
/* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AzureCommunicationCallAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,SAAS,EAA0B,sDAA6C;AACzF,OAAO,EAIL,wBAAwB,EAKzB,mDAA0C;AAC3C,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,mDAA0C;AAqBtE,sDAAsD;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAoBtC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI7E,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,yCAAgC;AACp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AAC7C,MAAM,cAAc,GAAG,CAAC,WAA+B,EAA0C,EAAE;IACjG,OAAO,gBAAgB,IAAI,WAAW,CAAC;AACzC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { _isInCall, _isInLobbyOrConnecting } from '@internal/calling-component-bindings';\nimport {\n CallClientState,\n CallError,\n CallState,\n createStatefulCallClient,\n StatefulCallClient,\n StatefulDeviceManager,\n TeamsCall,\n TeamsCallAgent as BetaTeamsCallAgent\n} from '@internal/calling-stateful-client';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { _isTeamsCallAgent } from '@internal/calling-stateful-client';\nimport { CallCommon } from '@internal/calling-stateful-client';\nimport {\n AudioOptions,\n CallAgent,\n GroupCallLocator,\n TeamsMeetingLinkLocator,\n LocalVideoStream as SDKLocalVideoStream,\n AudioDeviceInfo,\n VideoDeviceInfo,\n RemoteParticipant,\n PermissionConstraints,\n PropertyChangedEvent,\n StartCallOptions,\n VideoOptions,\n Call\n} from '@azure/communication-calling';\n/* @conditional-compile-remove(teams-identity-support)) */\nimport { TeamsCallAgent } from '@azure/communication-calling';\n/* @conditional-compile-remove(rooms) */\nimport { RoomCallLocator } from '@azure/communication-calling';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { Features } from '@azure/communication-calling';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { AddPhoneNumberOptions, DtmfTone } from '@azure/communication-calling';\nimport { EventEmitter } from 'events';\nimport {\n CommonCallAdapter,\n CallEndedListener,\n CallIdChangedListener,\n CallAdapterState,\n DisplayNameChangedListener,\n IsMutedChangedListener,\n IsLocalScreenSharingActiveChangedListener,\n IsSpeakingChangedListener,\n ParticipantsJoinedListener,\n ParticipantsLeftListener,\n DiagnosticChangedEventListner,\n CallAdapterCallEndedEvent,\n CallAdapter\n} from './CallAdapter';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { CallAdapterOptionalFeatures } from './CallAdapter';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { TeamsCallAdapter } from './CallAdapter';\nimport { getCallCompositePage, IsCallEndedPage, isCameraOn } from '../utils';\nimport { CreateVideoStreamViewResult, VideoStreamOptions } from '@internal/react-components';\n/* @conditional-compile-remove(rooms) */\nimport { Role } from '@internal/react-components';\nimport { toFlatCommunicationIdentifier, _toCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CommunicationTokenCredential,\n CommunicationUserIdentifier,\n isCommunicationUserIdentifier,\n isPhoneNumberIdentifier,\n UnknownIdentifier,\n PhoneNumberIdentifier,\n CommunicationIdentifier\n} from '@azure/communication-common';\nimport { ParticipantSubscriber } from './ParticipantSubcriber';\nimport { AdapterError } from '../../common/adapters';\nimport { DiagnosticsForwarder } from './DiagnosticsForwarder';\nimport { useEffect, useRef, useState } from 'react';\nimport { CallHandlersOf, createHandlers } from './createHandlers';\n\ntype CallTypeOf<AgentType extends CallAgent | BetaTeamsCallAgent> = AgentType extends CallAgent ? Call : TeamsCall;\n\n/** Context of call, which is a centralized context for all state updates */\nclass CallContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: CallAdapterState;\n private callId: string | undefined;\n\n constructor(\n clientState: CallClientState,\n isTeamsCall: boolean,\n options?: {\n /* @conditional-compile-remove(rooms) */ roleHint?: Role;\n /* @conditional-compile-remove(unsupported-browser) */ features?: CallAdapterOptionalFeatures;\n maxListeners?: number;\n }\n ) {\n this.state = {\n isLocalPreviewMicrophoneEnabled: false,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n devices: clientState.deviceManager,\n call: undefined,\n page: 'configuration',\n latestErrors: clientState.latestErrors,\n isTeamsCall,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId,\n /* @conditional-compile-remove(unsupported-browser) */ environmentInfo: clientState.environmentInfo,\n /* @conditional-compile-remove(unsupported-browser) */ unsupportedBrowserVersionsAllowed: false,\n /* @conditional-compile-remove(unsupported-browser) */ features: options?.features,\n /* @conditional-compile-remove(rooms) */ roleHint: options?.roleHint\n };\n this.emitter.setMaxListeners(options?.maxListeners ?? 50);\n }\n\n public onStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: CallAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): CallAdapterState {\n return this.state;\n }\n\n public setIsLocalMicrophoneEnabled(isLocalPreviewMicrophoneEnabled: boolean): void {\n this.setState({ ...this.state, isLocalPreviewMicrophoneEnabled });\n }\n\n // This is the key to find current call object in client state\n public setCurrentCallId(callId: string | undefined): void {\n this.callId = callId;\n }\n\n public onCallEnded(handler: (callEndedData: CallAdapterCallEndedEvent) => void): void {\n this.emitter.on('callEnded', handler);\n }\n\n public offCallEnded(handler: (callEndedData: CallAdapterCallEndedEvent) => void): void {\n this.emitter.off('callEnded', handler);\n }\n\n public updateClientState(clientState: CallClientState): void {\n let call = this.callId ? clientState.calls[this.callId] : undefined;\n const latestEndedCall = clientState.callsEnded ? findLatestEndedCall(clientState.callsEnded) : undefined;\n // As the state is transitioning to a new state, trigger appropriate callback events.\n const oldPage = this.state.page;\n /* @conditional-compile-remove(unsupported-browser) */\n const environmentInfo = {\n environmentInfo: this.state.environmentInfo,\n features: this.state.features,\n unsupportedBrowserVersionOptedIn: this.state.unsupportedBrowserVersionsAllowed\n };\n const newPage = getCallCompositePage(\n call,\n latestEndedCall,\n /* @conditional-compile-remove(unsupported-browser) */ environmentInfo\n );\n if (!IsCallEndedPage(oldPage) && IsCallEndedPage(newPage)) {\n this.emitter.emit('callEnded', { callId: this.callId });\n // Reset the callId to undefined as the call has ended.\n this.setCurrentCallId(undefined);\n // Make sure that the call is set to undefined in the state.\n call = undefined;\n }\n\n if (this.state.page) {\n this.setState({\n ...this.state,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n call,\n page: newPage,\n endedCall: latestEndedCall,\n devices: clientState.deviceManager,\n latestErrors: clientState.latestErrors\n });\n }\n }\n\n /* @conditional-compile-remove(unsupported-browser) */\n public setAllowedUnsupportedBrowser(): void {\n this.setState({ ...this.state, unsupportedBrowserVersionsAllowed: true });\n }\n}\n\nconst findLatestEndedCall = (calls: { [key: string]: CallState }): CallState | undefined => {\n const callStates = Object.values(calls);\n if (callStates.length === 0) {\n return undefined;\n }\n let latestCall = callStates[0];\n for (const call of callStates.slice(1)) {\n if ((call.endTime?.getTime() ?? 0) > (latestCall.endTime?.getTime() ?? 0)) {\n latestCall = call;\n }\n }\n return latestCall;\n};\n\n/**\n * @private\n */\nexport class AzureCommunicationCallAdapter<AgentType extends CallAgent | BetaTeamsCallAgent = CallAgent>\n implements CommonCallAdapter\n{\n private callClient: StatefulCallClient;\n private callAgent: AgentType;\n private deviceManager: StatefulDeviceManager;\n private localStream: SDKLocalVideoStream | undefined;\n private locator: CallAdapterLocator;\n // Never use directly, even internally. Use `call` property instead.\n private _call?: CallCommon;\n private context: CallContext;\n private diagnosticsForwarder?: DiagnosticsForwarder;\n private handlers: CallHandlersOf<AgentType>;\n private participantSubscribers = new Map<string, ParticipantSubscriber>();\n private emitter: EventEmitter = new EventEmitter();\n private onClientStateChange: (clientState: CallClientState) => void;\n\n private get call(): CallCommon | undefined {\n return this._call;\n }\n\n private set call(newCall: CallCommon | undefined) {\n this.resetDiagnosticsForwarder(newCall);\n this._call = newCall;\n }\n\n constructor(\n callClient: StatefulCallClient,\n locator: CallAdapterLocator,\n callAgent: AgentType,\n deviceManager: StatefulDeviceManager,\n options?: AzureCommunicationCallAdapterOptions\n ) {\n this.bindPublicMethods();\n this.callClient = callClient;\n this.callAgent = callAgent;\n this.locator = locator;\n this.deviceManager = deviceManager;\n const isTeamsMeeting = 'meetingLink' in this.locator;\n this.context = new CallContext(callClient.getState(), isTeamsMeeting, options);\n\n this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));\n\n const onStateChange = (clientState: CallClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n callClient.offStateChange(onStateChange);\n return;\n }\n\n // `updateClientState` searches for the current call from all the calls in the state using a cached `call.id`\n // from the call object. `call.id` can change during a call. We must update the cached `call.id` before\n // calling `updateClientState` so that we find the correct state object for the call even when `call.id`\n // has changed.\n // https://github.com/Azure/communication-ui-library/pull/1820\n if (this.call?.id) {\n this.context.setCurrentCallId(this.call.id);\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createHandlers(callClient, callAgent, deviceManager, undefined);\n\n this.onClientStateChange = onStateChange;\n\n this.subscribeDeviceManagerEvents();\n\n this.callClient.onStateChange(onStateChange);\n }\n\n // TODO: update this to include the 'selectedCameraChanged' when calling adds it to the device manager\n private subscribeDeviceManagerEvents(): void {\n this.deviceManager.on('selectedMicrophoneChanged', () => {\n this.emitter.emit('selectedMicrophoneChanged');\n });\n this.deviceManager.on('selectedSpeakerChanged', () => {\n this.emitter.emit('selectedSpeakerChanged');\n });\n }\n\n private bindPublicMethods(): void {\n this.onStateChange.bind(this);\n this.offStateChange.bind(this);\n this.getState.bind(this);\n this.dispose.bind(this);\n this.joinCall.bind(this);\n this.leaveCall.bind(this);\n this.setCamera.bind(this);\n this.setMicrophone.bind(this);\n this.setSpeaker.bind(this);\n this.askDevicePermission.bind(this);\n this.queryCameras.bind(this);\n this.queryMicrophones.bind(this);\n this.querySpeakers.bind(this);\n this.startCamera.bind(this);\n this.stopCamera.bind(this);\n this.mute.bind(this);\n this.unmute.bind(this);\n this.startCall.bind(this);\n this.startScreenShare.bind(this);\n this.stopScreenShare.bind(this);\n this.removeParticipant.bind(this);\n this.createStreamView.bind(this);\n this.disposeStreamView.bind(this);\n this.on.bind(this);\n this.off.bind(this);\n this.processNewCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.addParticipant.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.holdCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.resumeCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.sendDtmfTone.bind(this);\n /* @conditional-compile-remove(unsupported-browser) */\n this.allowUnsupportedBrowserVersion.bind(this);\n }\n\n public dispose(): void {\n this.resetDiagnosticsForwarder();\n this.callClient.offStateChange(this.onClientStateChange);\n this.callAgent.dispose();\n }\n\n public async queryCameras(): Promise<VideoDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getCameras();\n });\n }\n\n public async queryMicrophones(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getMicrophones();\n });\n }\n\n public async querySpeakers(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.isSpeakerSelectionAvailable ? this.deviceManager.getSpeakers() : [];\n });\n }\n\n public async askDevicePermission(constrain: PermissionConstraints): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.deviceManager.askDevicePermission(constrain);\n });\n }\n\n public joinCall(microphoneOn?: boolean): CallTypeOf<AgentType> | undefined {\n if (_isInCall(this.getState().call?.state ?? 'None')) {\n throw new Error('You are already in the call!');\n }\n\n return this.teeErrorToEventEmitter(() => {\n const audioOptions: AudioOptions = { muted: !(microphoneOn ?? this.getState().isLocalPreviewMicrophoneEnabled) };\n // TODO: find a way to expose stream to here\n const videoOptions = { localVideoStreams: this.localStream ? [this.localStream] : undefined };\n /* @conditional-compile-remove(teams-adhoc-call) */\n /* @conditional-compile-remove(PSTN-calls) */\n if (isOutboundCall(this.locator)) {\n const phoneNumber = this.getState().alternateCallerId;\n return this.startCall(this.locator.participantIds, {\n alternateCallerId: phoneNumber ? { phoneNumber: phoneNumber } : undefined,\n audioOptions,\n videoOptions\n });\n }\n const call = this._joinCall(audioOptions, videoOptions);\n\n this.processNewCall(call);\n return call;\n });\n }\n\n private _joinCall(audioOptions: AudioOptions, videoOptions: VideoOptions): CallTypeOf<AgentType> {\n const isTeamsMeeting = 'meetingLink' in this.locator;\n /* @conditional-compile-remove(rooms) */\n const isRoomsCall = 'roomId' in this.locator;\n\n /* @conditional-compile-remove(teams-identity-support) */\n if (_isTeamsCallAgent(this.callAgent)) {\n if (!isTeamsMeeting) {\n throw new Error('Locator not supported by TeamsCallAgent');\n }\n\n return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n if (isTeamsMeeting) {\n return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n /* @conditional-compile-remove(rooms) */\n if (isRoomsCall) {\n return this.callAgent.join(this.locator as RoomCallLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n return this.callAgent.join(this.locator as GroupCallLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n\n public async createStreamView(\n remoteUserId?: string,\n options?: VideoStreamOptions\n ): Promise<void | CreateVideoStreamViewResult> {\n if (remoteUserId === undefined) {\n return await this.handlers.onCreateLocalStreamView(options);\n } else {\n return await this.handlers.onCreateRemoteStreamView(remoteUserId, options);\n }\n }\n\n public async disposeStreamView(remoteUserId?: string): Promise<void> {\n if (remoteUserId === undefined) {\n await this.handlers.onDisposeLocalStreamView();\n } else {\n await this.handlers.onDisposeRemoteStreamView(remoteUserId);\n }\n }\n\n public async leaveCall(forEveryone?: boolean): Promise<void> {\n await this.handlers.onHangUp(forEveryone);\n this.unsubscribeCallEvents();\n this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);\n // We set the adapter.call object to undefined immediately when a call is ended.\n // We do not set the context.callId to undefined because it is a part of the immutable data flow loop.\n this.call = undefined;\n this.stopCamera();\n this.mute();\n }\n\n public async setCamera(device: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectCamera(device, options);\n });\n }\n\n public async setMicrophone(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectMicrophone(device);\n });\n }\n\n public async setSpeaker(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectSpeaker(device);\n });\n }\n\n public async startCamera(options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!isCameraOn(this.getState())) {\n await this.handlers.onToggleCamera(options);\n }\n });\n }\n\n public async stopCamera(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (isCameraOn(this.getState())) {\n await this.handlers.onToggleCamera();\n }\n });\n }\n\n public async mute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n this.context.setIsLocalMicrophoneEnabled(false);\n if (_isInCall(this.call?.state) && !this.call?.isMuted) {\n await this.handlers.onToggleMicrophone();\n }\n });\n }\n\n public async unmute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n this.context.setIsLocalMicrophoneEnabled(true);\n if (_isInCall(this.call?.state) && this.call?.isMuted) {\n await this.handlers.onToggleMicrophone();\n }\n });\n }\n\n public async startScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.call?.isScreenSharingOn) {\n await this.handlers.onToggleScreenShare();\n }\n });\n }\n\n public async stopScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (this.call?.isScreenSharingOn) {\n await this.handlers.onToggleScreenShare();\n }\n });\n }\n\n /* @conditional-compile-remove(unsupported-browser) */\n public allowUnsupportedBrowserVersion(): void {\n this.context.setAllowedUnsupportedBrowser();\n }\n\n public startCall(\n participants:\n | string[]\n /* @conditional-compile-remove(PSTN-calls) */\n | CommunicationIdentifier[],\n options?: StartCallOptions\n ): CallTypeOf<AgentType> | undefined {\n if (_isInCall(this.getState().call?.state ?? 'None')) {\n throw new Error('You are already in the call.');\n }\n\n const idsToAdd = participants.map((participant) => {\n // FIXME: `onStartCall` does not allow a Teams user.\n // Need some way to return an error if a Teams user is provided.\n const backendId: CommunicationIdentifier = _toCommunicationIdentifier(participant);\n if (isPhoneNumberIdentifier(backendId)) {\n if (options?.alternateCallerId === undefined) {\n throw new Error('Unable to start call, PSTN user present with no alternateCallerId.');\n }\n return backendId as PhoneNumberIdentifier;\n } else if (isCommunicationUserIdentifier(backendId)) {\n return backendId as CommunicationUserIdentifier;\n }\n return backendId as UnknownIdentifier;\n });\n\n const call = this.handlers.onStartCall(idsToAdd, options) as CallTypeOf<AgentType>;\n if (!call) {\n throw new Error('Unable to start call.');\n }\n this.processNewCall(call);\n\n return call;\n }\n\n private processNewCall(call: CallCommon): void {\n this.call = call;\n this.context.setCurrentCallId(call.id);\n\n // Resync state after callId is set\n this.context.updateClientState(this.callClient.getState());\n this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);\n this.subscribeCallEvents();\n }\n\n public async removeParticipant(\n userId: string | /* @conditional-compile-remove(PSTN-calls) */ CommunicationIdentifier\n ): Promise<void> {\n let participant = userId;\n /* @conditional-compile-remove(PSTN-calls) */\n participant = _toCommunicationIdentifier(userId);\n this.handlers.onRemoveParticipant(participant);\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(participant: PhoneNumberIdentifier, options?: AddPhoneNumberOptions): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(participant: CommunicationUserIdentifier): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(\n participant: PhoneNumberIdentifier | CommunicationUserIdentifier,\n options?: AddPhoneNumberOptions\n ): Promise<void> {\n if (isPhoneNumberIdentifier(participant) && options) {\n this.handlers.onAddParticipant(participant, options);\n } else if (isCommunicationUserIdentifier(participant)) {\n this.handlers.onAddParticipant(participant);\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async holdCall(): Promise<void> {\n if (this.call?.state !== 'LocalHold') {\n this.handlers.onToggleHold();\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async resumeCall(): Promise<void> {\n if (this.call?.state === 'LocalHold') {\n this.handlers.onToggleHold();\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async sendDtmfTone(dtmfTone: DtmfTone): Promise<void> {\n this.handlers.onSendDtmfTone(dtmfTone);\n }\n\n public getState(): CallAdapterState {\n return this.context.getState();\n }\n\n public onStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n public offStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n on(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;\n on(event: 'participantsLeft', listener: ParticipantsLeftListener): void;\n on(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n on(event: 'callEnded', listener: CallEndedListener): void;\n on(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;\n on(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n on(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n on(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n private subscribeCallEvents(): void {\n this.call?.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.on('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.on('idChanged', this.callIdChanged.bind(this));\n }\n\n private unsubscribeCallEvents(): void {\n for (const subscriber of this.participantSubscribers.values()) {\n subscriber.unsubscribeAll();\n }\n this.participantSubscribers.clear();\n this.call?.off('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.off('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.off('idChanged', this.callIdChanged.bind(this));\n }\n\n private isMyMutedChanged = (): void => {\n this.emitter.emit('isMutedChanged', {\n participantId: this.getState().userId,\n isMuted: this.call?.isMuted\n });\n };\n\n private onRemoteParticipantsUpdated({\n added,\n removed\n }: {\n added: RemoteParticipant[];\n removed: RemoteParticipant[];\n }): void {\n if (added && added.length > 0) {\n this.emitter.emit('participantsJoined', added);\n }\n if (removed && removed.length > 0) {\n this.emitter.emit('participantsLeft', removed);\n }\n\n added.forEach((participant) => {\n this.participantSubscribers.set(\n toFlatCommunicationIdentifier(participant.identifier),\n new ParticipantSubscriber(participant, this.emitter)\n );\n });\n\n removed.forEach((participant) => {\n const subscriber = this.participantSubscribers.get(toFlatCommunicationIdentifier(participant.identifier));\n subscriber && subscriber.unsubscribeAll();\n this.participantSubscribers.delete(toFlatCommunicationIdentifier(participant.identifier));\n });\n }\n\n private isScreenSharingOnChanged(): void {\n this.emitter.emit('isLocalScreenSharingActiveChanged', { isScreenSharingOn: this.call?.isScreenSharingOn });\n }\n\n private callIdChanged(): void {\n this.call?.id && this.emitter.emit('callIdChanged', { callId: this.call.id });\n }\n\n private resetDiagnosticsForwarder(newCall?: CallCommon): void {\n if (this.diagnosticsForwarder) {\n this.diagnosticsForwarder.unsubscribe();\n }\n if (newCall) {\n this.diagnosticsForwarder = new DiagnosticsForwarder(this.emitter, newCall);\n }\n }\n\n off(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;\n off(event: 'participantsLeft', listener: ParticipantsLeftListener): void;\n off(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n off(event: 'callEnded', listener: CallEndedListener): void;\n off(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;\n off(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n off(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n off(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isCallError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n\n private teeErrorToEventEmitter<T>(f: () => T): T {\n try {\n return f();\n } catch (error) {\n if (isCallError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\n/* @conditional-compile-remove(teams-adhoc-call) */\n/* @conditional-compile-remove(PSTN-calls) */\n/**\n * Locator used by {@link createAzureCommunicationCallAdapter} to call one or more participants\n *\n * @remarks\n * This is currently in beta and only supports calling one Teams User.\n *\n * @example\n * ```\n * ['8:orgid:ab220efe-5725-4742-9792-9fba7c9ac458']\n * ```\n *\n * @beta\n */\nexport type CallParticipantsLocator = {\n participantIds: string[];\n};\n\n/**\n * Locator used by {@link createAzureCommunicationCallAdapter} to locate the call to join\n *\n * @public\n */\nexport type CallAdapterLocator =\n | TeamsMeetingLinkLocator\n | GroupCallLocator\n | /* @conditional-compile-remove(rooms) */ RoomCallLocator\n | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;\n\n/**\n * Optional parameters to create {@link AzureCommunicationCallAdapter}\n *\n * @beta\n */\nexport type AzureCommunicationCallAdapterOptions = {\n /* @conditional-compile-remove(rooms) */\n /**\n * Use this to hint the role of the user when the role is not available before a Rooms call is started. This value\n * should be obtained using the Rooms API. This role will determine permissions in the configuration page of the\n * {@link CallComposite}. The true role of the user will be synced with ACS services when a Rooms call starts.\n */\n roleHint?: Role;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Optional feature flags to be enabled in the CallAdapter.\n */\n features?: CallAdapterOptionalFeatures;\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link CallAdapter}.\n *\n * Note: `displayName` can be a maximum of 256 characters.\n *\n * @public\n */\nexport type AzureCommunicationCallAdapterArgs = {\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n locator: CallAdapterLocator;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * A phone number in E.164 format procured using Azure Communication Services that will be used to represent callers identity.\n * E.164 numbers are formatted as [+] [country code] [phone number including area code]. For example, +14255550123 for a US phone number.\n */\n alternateCallerId?: string;\n /* @conditional-compile-remove(rooms) */\n /**\n * Optional parameters for the {@link AzureCommunicationCallAdapter} created\n */\n options?: AzureCommunicationCallAdapterOptions;\n};\n\n/**\n * Create a {@link CallAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link CallAdapter} provided by this library.\n *\n * Note: `displayName` can be a maximum of 256 characters.\n *\n * @public\n */\nexport const createAzureCommunicationCallAdapter = async ({\n userId,\n displayName,\n credential,\n locator,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /* @conditional-compile-remove(rooms) */ options\n}: AzureCommunicationCallAdapterArgs): Promise<CallAdapter> => {\n const callClient = createStatefulCallClient({\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n });\n const callAgent = await callClient.createCallAgent(credential, {\n displayName\n });\n const adapter = createAzureCommunicationCallAdapterFromClient(\n callClient,\n callAgent,\n locator,\n /* @conditional-compile-remove(rooms) */ options\n );\n return adapter;\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * @beta\n */\nexport const createAzureCommunicationTeamsCallAdapter = async ({\n userId,\n credential,\n locator,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n}: AzureCommunicationCallAdapterArgs): Promise<TeamsCallAdapter> => {\n const callClient = createStatefulCallClient({\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n });\n const callAgent = await callClient.createTeamsCallAgent(credential, {\n undefined\n });\n const adapter = createAzureCommunicationTeamsCallAdapterFromClient(callClient, callAgent, locator);\n return adapter;\n};\n\n/**\n * @private\n */\nconst useAzureCommunicationCallAdapterGeneric = <\n AdapterType extends CallAdapter | /* @conditional-compile-remove(teams-identity-support) */ TeamsCallAdapter\n>(\n args: Partial<AzureCommunicationCallAdapterArgs>,\n createAzureCommunicationCallAdapter: (args: AzureCommunicationCallAdapterArgs) => Promise<AdapterType>,\n afterCreate?: (adapter: AdapterType) => Promise<AdapterType>,\n beforeDispose?: (adapter: AdapterType) => Promise<void>\n): AdapterType | undefined => {\n const {\n credential,\n displayName,\n locator,\n userId,\n /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /*@conditional-compile-remove(rooms) */ options\n } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<AdapterType | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<AdapterType | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: AdapterType) => Promise<AdapterType>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: AdapterType) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !locator || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationCallAdapter({\n credential,\n displayName,\n locator,\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /* @conditional-compile-remove(rooms) */ options\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [\n adapterRef,\n afterCreateRef,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n beforeDisposeRef,\n createAzureCommunicationCallAdapter,\n credential,\n displayName,\n locator,\n /* @conditional-compile-remove(rooms) */ options,\n userId\n ]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * A custom React hook to simplify the creation of {@link CallAdapter}.\n *\n * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationCallAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationCallAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: CallAdapter) => Promise<CallAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: CallAdapter) => Promise<void>\n): CallAdapter | undefined => {\n return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose);\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.\n *\n * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @beta\n */\nexport const useAzureCommunicationTeamsCallAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationCallAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: TeamsCallAdapter) => Promise<TeamsCallAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: TeamsCallAdapter) => Promise<void>\n): TeamsCallAdapter | undefined => {\n return useAzureCommunicationCallAdapterGeneric(\n args,\n createAzureCommunicationTeamsCallAdapter,\n afterCreate,\n beforeDispose\n );\n};\n\n/**\n * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulCallClient}.\n * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.\n *\n * @public\n */\nexport const createAzureCommunicationCallAdapterFromClient: (\n callClient: StatefulCallClient,\n callAgent: CallAgent,\n locator: CallAdapterLocator,\n /* @conditional-compile-remove(rooms) */ options?: AzureCommunicationCallAdapterOptions\n) => Promise<CallAdapter> = async (\n callClient: StatefulCallClient,\n callAgent: CallAgent,\n locator: CallAdapterLocator,\n options?\n): Promise<CallAdapter> => {\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\n /* @conditional-compile-remove(unsupported-browser) */\n await callClient.feature(Features.DebugInfo).getEnvironmentInfo();\n return new AzureCommunicationCallAdapter(\n callClient,\n locator,\n callAgent,\n deviceManager,\n /* @conditional-compile-remove(rooms) */ options\n );\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulCallClient}.\n * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.\n *\n * @beta\n */\nexport const createAzureCommunicationTeamsCallAdapterFromClient = async (\n callClient: StatefulCallClient,\n callAgent: TeamsCallAgent,\n locator: CallAdapterLocator\n): Promise<TeamsCallAdapter> => {\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\n /* @conditional-compile-remove(unsupported-browser) */\n await callClient.feature(Features.DebugInfo).getEnvironmentInfo();\n return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);\n};\n\nconst isCallError = (e: Error): e is CallError => {\n return e['target'] !== undefined && e['innerError'] !== undefined;\n};\n\n/* @conditional-compile-remove(teams-adhoc-call) */\n/* @conditional-compile-remove(PSTN-calls) */\nconst isOutboundCall = (callLocator: CallAdapterLocator): callLocator is CallParticipantsLocator => {\n return 'participantIds' in callLocator;\n};\n\"../../../../../calling-component-bindings/src\"\"../../../../../calling-stateful-client/src\"\"../../../../../react-components/src\"\"../../../../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"AzureCommunicationCallAdapter.js","sourceRoot":"","sources":["../../../../../../../../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CAAC;AAEF,yDAAyD;AACzD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kDAAkD,GAAG,CAChE,UAA8B,EAC9B,SAAyB,EACzB,OAA2B,EACA,EAAE;IAC7B,MAAM,aAAa,GAAG,CAAC,MAAM,UAAU,CAAC,gBAAgB,EAAE,CAA0B,CAAC;IACrF,sDAAsD;IACtD,MAAM,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAClE,OAAO,IAAI,6BAA6B,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAC1F,CAAC,CAAA,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAkB,EAAE;IAC/C,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AACpE,CAAC,CAAC;AAEF,mDAAmD;AACnD,6CAA6C;AAC7C,MAAM,cAAc,GAAG,CAAC,WAA+B,EAA0C,EAAE;IACjG,OAAO,gBAAgB,IAAI,WAAW,CAAC;AACzC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { _isInCall, _isInLobbyOrConnecting } from '@internal/calling-component-bindings';\nimport {\n CallClientState,\n CallError,\n CallState,\n createStatefulCallClient,\n StatefulCallClient,\n StatefulDeviceManager,\n TeamsCall,\n TeamsCallAgent as BetaTeamsCallAgent\n} from '@internal/calling-stateful-client';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { _isTeamsCallAgent } from '@internal/calling-stateful-client';\nimport { CallCommon } from '@internal/calling-stateful-client';\nimport {\n AudioOptions,\n CallAgent,\n GroupCallLocator,\n TeamsMeetingLinkLocator,\n LocalVideoStream as SDKLocalVideoStream,\n AudioDeviceInfo,\n VideoDeviceInfo,\n RemoteParticipant,\n PermissionConstraints,\n PropertyChangedEvent,\n StartCallOptions,\n VideoOptions,\n Call\n} from '@azure/communication-calling';\n/* @conditional-compile-remove(teams-identity-support)) */\nimport { TeamsCallAgent } from '@azure/communication-calling';\n/* @conditional-compile-remove(rooms) */\nimport { RoomCallLocator } from '@azure/communication-calling';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { Features } from '@azure/communication-calling';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { AddPhoneNumberOptions, DtmfTone } from '@azure/communication-calling';\nimport { EventEmitter } from 'events';\nimport {\n CommonCallAdapter,\n CallEndedListener,\n CallIdChangedListener,\n CallAdapterState,\n DisplayNameChangedListener,\n IsMutedChangedListener,\n IsLocalScreenSharingActiveChangedListener,\n IsSpeakingChangedListener,\n ParticipantsJoinedListener,\n ParticipantsLeftListener,\n DiagnosticChangedEventListner,\n CallAdapterCallEndedEvent,\n CallAdapter\n} from './CallAdapter';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { CallAdapterOptionalFeatures } from './CallAdapter';\n/* @conditional-compile-remove(teams-identity-support) */\nimport { TeamsCallAdapter } from './CallAdapter';\nimport { getCallCompositePage, IsCallEndedPage, isCameraOn, isValidIdentifier } from '../utils';\nimport { CreateVideoStreamViewResult, VideoStreamOptions } from '@internal/react-components';\n/* @conditional-compile-remove(rooms) */\nimport { Role } from '@internal/react-components';\nimport { toFlatCommunicationIdentifier, _toCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CommunicationTokenCredential,\n CommunicationUserIdentifier,\n isCommunicationUserIdentifier,\n isPhoneNumberIdentifier,\n UnknownIdentifier,\n PhoneNumberIdentifier,\n CommunicationIdentifier\n} from '@azure/communication-common';\nimport { ParticipantSubscriber } from './ParticipantSubcriber';\nimport { AdapterError } from '../../common/adapters';\nimport { DiagnosticsForwarder } from './DiagnosticsForwarder';\nimport { useEffect, useRef, useState } from 'react';\nimport { CallHandlersOf, createHandlers } from './createHandlers';\n\ntype CallTypeOf<AgentType extends CallAgent | BetaTeamsCallAgent> = AgentType extends CallAgent ? Call : TeamsCall;\n\n/** Context of call, which is a centralized context for all state updates */\nclass CallContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: CallAdapterState;\n private callId: string | undefined;\n\n constructor(\n clientState: CallClientState,\n isTeamsCall: boolean,\n options?: {\n /* @conditional-compile-remove(rooms) */ roleHint?: Role;\n /* @conditional-compile-remove(unsupported-browser) */ features?: CallAdapterOptionalFeatures;\n maxListeners?: number;\n }\n ) {\n this.state = {\n isLocalPreviewMicrophoneEnabled: false,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n devices: clientState.deviceManager,\n call: undefined,\n page: 'configuration',\n latestErrors: clientState.latestErrors,\n isTeamsCall,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId,\n /* @conditional-compile-remove(unsupported-browser) */ environmentInfo: clientState.environmentInfo,\n /* @conditional-compile-remove(unsupported-browser) */ unsupportedBrowserVersionsAllowed: false,\n /* @conditional-compile-remove(unsupported-browser) */ features: options?.features,\n /* @conditional-compile-remove(rooms) */ roleHint: options?.roleHint\n };\n this.emitter.setMaxListeners(options?.maxListeners ?? 50);\n }\n\n public onStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: CallAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): CallAdapterState {\n return this.state;\n }\n\n public setIsLocalMicrophoneEnabled(isLocalPreviewMicrophoneEnabled: boolean): void {\n this.setState({ ...this.state, isLocalPreviewMicrophoneEnabled });\n }\n\n // This is the key to find current call object in client state\n public setCurrentCallId(callId: string | undefined): void {\n this.callId = callId;\n }\n\n public onCallEnded(handler: (callEndedData: CallAdapterCallEndedEvent) => void): void {\n this.emitter.on('callEnded', handler);\n }\n\n public offCallEnded(handler: (callEndedData: CallAdapterCallEndedEvent) => void): void {\n this.emitter.off('callEnded', handler);\n }\n\n public updateClientState(clientState: CallClientState): void {\n let call = this.callId ? clientState.calls[this.callId] : undefined;\n const latestEndedCall = clientState.callsEnded ? findLatestEndedCall(clientState.callsEnded) : undefined;\n // As the state is transitioning to a new state, trigger appropriate callback events.\n const oldPage = this.state.page;\n /* @conditional-compile-remove(unsupported-browser) */\n const environmentInfo = {\n environmentInfo: this.state.environmentInfo,\n features: this.state.features,\n unsupportedBrowserVersionOptedIn: this.state.unsupportedBrowserVersionsAllowed\n };\n const newPage = getCallCompositePage(\n call,\n latestEndedCall,\n /* @conditional-compile-remove(unsupported-browser) */ environmentInfo\n );\n if (!IsCallEndedPage(oldPage) && IsCallEndedPage(newPage)) {\n this.emitter.emit('callEnded', { callId: this.callId });\n // Reset the callId to undefined as the call has ended.\n this.setCurrentCallId(undefined);\n // Make sure that the call is set to undefined in the state.\n call = undefined;\n }\n\n if (this.state.page) {\n this.setState({\n ...this.state,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n call,\n page: newPage,\n endedCall: latestEndedCall,\n devices: clientState.deviceManager,\n latestErrors: clientState.latestErrors\n });\n }\n }\n\n /* @conditional-compile-remove(unsupported-browser) */\n public setAllowedUnsupportedBrowser(): void {\n this.setState({ ...this.state, unsupportedBrowserVersionsAllowed: true });\n }\n}\n\nconst findLatestEndedCall = (calls: { [key: string]: CallState }): CallState | undefined => {\n const callStates = Object.values(calls);\n if (callStates.length === 0) {\n return undefined;\n }\n let latestCall = callStates[0];\n for (const call of callStates.slice(1)) {\n if ((call.endTime?.getTime() ?? 0) > (latestCall.endTime?.getTime() ?? 0)) {\n latestCall = call;\n }\n }\n return latestCall;\n};\n\n/**\n * @private\n */\nexport class AzureCommunicationCallAdapter<AgentType extends CallAgent | BetaTeamsCallAgent = CallAgent>\n implements CommonCallAdapter\n{\n private callClient: StatefulCallClient;\n private callAgent: AgentType;\n private deviceManager: StatefulDeviceManager;\n private localStream: SDKLocalVideoStream | undefined;\n private locator: CallAdapterLocator;\n // Never use directly, even internally. Use `call` property instead.\n private _call?: CallCommon;\n private context: CallContext;\n private diagnosticsForwarder?: DiagnosticsForwarder;\n private handlers: CallHandlersOf<AgentType>;\n private participantSubscribers = new Map<string, ParticipantSubscriber>();\n private emitter: EventEmitter = new EventEmitter();\n private onClientStateChange: (clientState: CallClientState) => void;\n\n private get call(): CallCommon | undefined {\n return this._call;\n }\n\n private set call(newCall: CallCommon | undefined) {\n this.resetDiagnosticsForwarder(newCall);\n this._call = newCall;\n }\n\n constructor(\n callClient: StatefulCallClient,\n locator: CallAdapterLocator,\n callAgent: AgentType,\n deviceManager: StatefulDeviceManager,\n options?: AzureCommunicationCallAdapterOptions\n ) {\n this.bindPublicMethods();\n this.callClient = callClient;\n this.callAgent = callAgent;\n this.locator = locator;\n this.deviceManager = deviceManager;\n const isTeamsMeeting = 'meetingLink' in this.locator;\n this.context = new CallContext(callClient.getState(), isTeamsMeeting, options);\n\n this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));\n\n const onStateChange = (clientState: CallClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n callClient.offStateChange(onStateChange);\n return;\n }\n\n // `updateClientState` searches for the current call from all the calls in the state using a cached `call.id`\n // from the call object. `call.id` can change during a call. We must update the cached `call.id` before\n // calling `updateClientState` so that we find the correct state object for the call even when `call.id`\n // has changed.\n // https://github.com/Azure/communication-ui-library/pull/1820\n if (this.call?.id) {\n this.context.setCurrentCallId(this.call.id);\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createHandlers(callClient, callAgent, deviceManager, undefined);\n\n this.onClientStateChange = onStateChange;\n\n this.subscribeDeviceManagerEvents();\n\n this.callClient.onStateChange(onStateChange);\n }\n\n // TODO: update this to include the 'selectedCameraChanged' when calling adds it to the device manager\n private subscribeDeviceManagerEvents(): void {\n this.deviceManager.on('selectedMicrophoneChanged', () => {\n this.emitter.emit('selectedMicrophoneChanged');\n });\n this.deviceManager.on('selectedSpeakerChanged', () => {\n this.emitter.emit('selectedSpeakerChanged');\n });\n }\n\n private bindPublicMethods(): void {\n this.onStateChange.bind(this);\n this.offStateChange.bind(this);\n this.getState.bind(this);\n this.dispose.bind(this);\n this.joinCall.bind(this);\n this.leaveCall.bind(this);\n this.setCamera.bind(this);\n this.setMicrophone.bind(this);\n this.setSpeaker.bind(this);\n this.askDevicePermission.bind(this);\n this.queryCameras.bind(this);\n this.queryMicrophones.bind(this);\n this.querySpeakers.bind(this);\n this.startCamera.bind(this);\n this.stopCamera.bind(this);\n this.mute.bind(this);\n this.unmute.bind(this);\n this.startCall.bind(this);\n this.startScreenShare.bind(this);\n this.stopScreenShare.bind(this);\n this.removeParticipant.bind(this);\n this.createStreamView.bind(this);\n this.disposeStreamView.bind(this);\n this.on.bind(this);\n this.off.bind(this);\n this.processNewCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.addParticipant.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.holdCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.resumeCall.bind(this);\n /* @conditional-compile-remove(PSTN-calls) */\n this.sendDtmfTone.bind(this);\n /* @conditional-compile-remove(unsupported-browser) */\n this.allowUnsupportedBrowserVersion.bind(this);\n }\n\n public dispose(): void {\n this.resetDiagnosticsForwarder();\n this.callClient.offStateChange(this.onClientStateChange);\n this.callAgent.dispose();\n }\n\n public async queryCameras(): Promise<VideoDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getCameras();\n });\n }\n\n public async queryMicrophones(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getMicrophones();\n });\n }\n\n public async querySpeakers(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.isSpeakerSelectionAvailable ? this.deviceManager.getSpeakers() : [];\n });\n }\n\n public async askDevicePermission(constrain: PermissionConstraints): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.deviceManager.askDevicePermission(constrain);\n });\n }\n\n public joinCall(microphoneOn?: boolean): CallTypeOf<AgentType> | undefined {\n if (_isInCall(this.getState().call?.state ?? 'None')) {\n throw new Error('You are already in the call!');\n }\n\n return this.teeErrorToEventEmitter(() => {\n const audioOptions: AudioOptions = { muted: !(microphoneOn ?? this.getState().isLocalPreviewMicrophoneEnabled) };\n // TODO: find a way to expose stream to here\n const videoOptions = { localVideoStreams: this.localStream ? [this.localStream] : undefined };\n /* @conditional-compile-remove(teams-adhoc-call) */\n /* @conditional-compile-remove(PSTN-calls) */\n if (isOutboundCall(this.locator)) {\n const phoneNumber = this.getState().alternateCallerId;\n return this.startCall(this.locator.participantIds, {\n alternateCallerId: phoneNumber ? { phoneNumber: phoneNumber } : undefined,\n audioOptions,\n videoOptions\n });\n }\n const call = this._joinCall(audioOptions, videoOptions);\n\n this.processNewCall(call);\n return call;\n });\n }\n\n private _joinCall(audioOptions: AudioOptions, videoOptions: VideoOptions): CallTypeOf<AgentType> {\n const isTeamsMeeting = 'meetingLink' in this.locator;\n /* @conditional-compile-remove(rooms) */\n const isRoomsCall = 'roomId' in this.locator;\n\n /* @conditional-compile-remove(teams-identity-support) */\n if (_isTeamsCallAgent(this.callAgent)) {\n if (!isTeamsMeeting) {\n throw new Error('Locator not supported by TeamsCallAgent');\n }\n\n return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n if (isTeamsMeeting) {\n return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n /* @conditional-compile-remove(rooms) */\n if (isRoomsCall) {\n return this.callAgent.join(this.locator as RoomCallLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n return this.callAgent.join(this.locator as GroupCallLocator, {\n audioOptions,\n videoOptions\n }) as CallTypeOf<AgentType>;\n }\n\n public async createStreamView(\n remoteUserId?: string,\n options?: VideoStreamOptions\n ): Promise<void | CreateVideoStreamViewResult> {\n if (remoteUserId === undefined) {\n return await this.handlers.onCreateLocalStreamView(options);\n } else {\n return await this.handlers.onCreateRemoteStreamView(remoteUserId, options);\n }\n }\n\n public async disposeStreamView(remoteUserId?: string): Promise<void> {\n if (remoteUserId === undefined) {\n await this.handlers.onDisposeLocalStreamView();\n } else {\n await this.handlers.onDisposeRemoteStreamView(remoteUserId);\n }\n }\n\n public async leaveCall(forEveryone?: boolean): Promise<void> {\n await this.handlers.onHangUp(forEveryone);\n this.unsubscribeCallEvents();\n this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);\n // We set the adapter.call object to undefined immediately when a call is ended.\n // We do not set the context.callId to undefined because it is a part of the immutable data flow loop.\n this.call = undefined;\n this.stopCamera();\n this.mute();\n }\n\n public async setCamera(device: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectCamera(device, options);\n });\n }\n\n public async setMicrophone(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectMicrophone(device);\n });\n }\n\n public async setSpeaker(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectSpeaker(device);\n });\n }\n\n public async startCamera(options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!isCameraOn(this.getState())) {\n await this.handlers.onToggleCamera(options);\n }\n });\n }\n\n public async stopCamera(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (isCameraOn(this.getState())) {\n await this.handlers.onToggleCamera();\n }\n });\n }\n\n public async mute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n this.context.setIsLocalMicrophoneEnabled(false);\n if (_isInCall(this.call?.state) && !this.call?.isMuted) {\n await this.handlers.onToggleMicrophone();\n }\n });\n }\n\n public async unmute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n this.context.setIsLocalMicrophoneEnabled(true);\n if (_isInCall(this.call?.state) && this.call?.isMuted) {\n await this.handlers.onToggleMicrophone();\n }\n });\n }\n\n public async startScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.call?.isScreenSharingOn) {\n await this.handlers.onToggleScreenShare();\n }\n });\n }\n\n public async stopScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (this.call?.isScreenSharingOn) {\n await this.handlers.onToggleScreenShare();\n }\n });\n }\n\n /* @conditional-compile-remove(unsupported-browser) */\n public allowUnsupportedBrowserVersion(): void {\n this.context.setAllowedUnsupportedBrowser();\n }\n\n public startCall(\n participants:\n | string[]\n /* @conditional-compile-remove(PSTN-calls) */\n | CommunicationIdentifier[],\n options?: StartCallOptions\n ): CallTypeOf<AgentType> | undefined {\n if (_isInCall(this.getState().call?.state ?? 'None')) {\n throw new Error('You are already in the call.');\n }\n\n const idsToAdd = participants.map((participant) => {\n // FIXME: `onStartCall` does not allow a Teams user.\n // Need some way to return an error if a Teams user is provided.\n const backendId: CommunicationIdentifier = _toCommunicationIdentifier(participant);\n if (isPhoneNumberIdentifier(backendId)) {\n if (options?.alternateCallerId === undefined) {\n throw new Error('Unable to start call, PSTN user present with no alternateCallerId.');\n }\n return backendId as PhoneNumberIdentifier;\n } else if (isCommunicationUserIdentifier(backendId)) {\n return backendId as CommunicationUserIdentifier;\n }\n return backendId as UnknownIdentifier;\n });\n\n const call = this.handlers.onStartCall(idsToAdd, options) as CallTypeOf<AgentType>;\n if (!call) {\n throw new Error('Unable to start call.');\n }\n this.processNewCall(call);\n\n return call;\n }\n\n private processNewCall(call: CallCommon): void {\n this.call = call;\n this.context.setCurrentCallId(call.id);\n\n // Resync state after callId is set\n this.context.updateClientState(this.callClient.getState());\n this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);\n this.subscribeCallEvents();\n }\n\n public async removeParticipant(\n userId: string | /* @conditional-compile-remove(PSTN-calls) */ CommunicationIdentifier\n ): Promise<void> {\n let participant = userId;\n /* @conditional-compile-remove(PSTN-calls) */\n participant = _toCommunicationIdentifier(userId);\n this.handlers.onRemoveParticipant(participant);\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(participant: PhoneNumberIdentifier, options?: AddPhoneNumberOptions): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(participant: CommunicationUserIdentifier): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n public async addParticipant(\n participant: PhoneNumberIdentifier | CommunicationUserIdentifier,\n options?: AddPhoneNumberOptions\n ): Promise<void> {\n if (isPhoneNumberIdentifier(participant) && options) {\n this.handlers.onAddParticipant(participant, options);\n } else if (isCommunicationUserIdentifier(participant)) {\n this.handlers.onAddParticipant(participant);\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async holdCall(): Promise<void> {\n if (this.call?.state !== 'LocalHold') {\n this.handlers.onToggleHold();\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async resumeCall(): Promise<void> {\n if (this.call?.state === 'LocalHold') {\n this.handlers.onToggleHold();\n }\n }\n\n /* @conditional-compile-remove(PSTN-calls) */\n public async sendDtmfTone(dtmfTone: DtmfTone): Promise<void> {\n this.handlers.onSendDtmfTone(dtmfTone);\n }\n\n public getState(): CallAdapterState {\n return this.context.getState();\n }\n\n public onStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n public offStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n on(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;\n on(event: 'participantsLeft', listener: ParticipantsLeftListener): void;\n on(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n on(event: 'callEnded', listener: CallEndedListener): void;\n on(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;\n on(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n on(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n on(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n private subscribeCallEvents(): void {\n this.call?.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.on('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.on('idChanged', this.callIdChanged.bind(this));\n }\n\n private unsubscribeCallEvents(): void {\n for (const subscriber of this.participantSubscribers.values()) {\n subscriber.unsubscribeAll();\n }\n this.participantSubscribers.clear();\n this.call?.off('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.off('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.off('idChanged', this.callIdChanged.bind(this));\n }\n\n private isMyMutedChanged = (): void => {\n this.emitter.emit('isMutedChanged', {\n participantId: this.getState().userId,\n isMuted: this.call?.isMuted\n });\n };\n\n private onRemoteParticipantsUpdated({\n added,\n removed\n }: {\n added: RemoteParticipant[];\n removed: RemoteParticipant[];\n }): void {\n if (added && added.length > 0) {\n this.emitter.emit('participantsJoined', added);\n }\n if (removed && removed.length > 0) {\n this.emitter.emit('participantsLeft', removed);\n }\n\n added.forEach((participant) => {\n this.participantSubscribers.set(\n toFlatCommunicationIdentifier(participant.identifier),\n new ParticipantSubscriber(participant, this.emitter)\n );\n });\n\n removed.forEach((participant) => {\n const subscriber = this.participantSubscribers.get(toFlatCommunicationIdentifier(participant.identifier));\n subscriber && subscriber.unsubscribeAll();\n this.participantSubscribers.delete(toFlatCommunicationIdentifier(participant.identifier));\n });\n }\n\n private isScreenSharingOnChanged(): void {\n this.emitter.emit('isLocalScreenSharingActiveChanged', { isScreenSharingOn: this.call?.isScreenSharingOn });\n }\n\n private callIdChanged(): void {\n this.call?.id && this.emitter.emit('callIdChanged', { callId: this.call.id });\n }\n\n private resetDiagnosticsForwarder(newCall?: CallCommon): void {\n if (this.diagnosticsForwarder) {\n this.diagnosticsForwarder.unsubscribe();\n }\n if (newCall) {\n this.diagnosticsForwarder = new DiagnosticsForwarder(this.emitter, newCall);\n }\n }\n\n off(event: 'participantsJoined', listener: ParticipantsJoinedListener): void;\n off(event: 'participantsLeft', listener: ParticipantsLeftListener): void;\n off(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n off(event: 'callEnded', listener: CallEndedListener): void;\n off(event: 'diagnosticChanged', listener: DiagnosticChangedEventListner): void;\n off(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n off(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n off(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isCallError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n\n private teeErrorToEventEmitter<T>(f: () => T): T {\n try {\n return f();\n } catch (error) {\n if (isCallError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\n/* @conditional-compile-remove(teams-adhoc-call) */\n/* @conditional-compile-remove(PSTN-calls) */\n/**\n * Locator used by {@link createAzureCommunicationCallAdapter} to call one or more participants\n *\n * @remarks\n * This is currently in beta and only supports calling one Teams User.\n *\n * @example\n * ```\n * ['8:orgid:ab220efe-5725-4742-9792-9fba7c9ac458']\n * ```\n *\n * @beta\n */\nexport type CallParticipantsLocator = {\n participantIds: string[];\n};\n\n/**\n * Locator used by {@link createAzureCommunicationCallAdapter} to locate the call to join\n *\n * @public\n */\nexport type CallAdapterLocator =\n | TeamsMeetingLinkLocator\n | GroupCallLocator\n | /* @conditional-compile-remove(rooms) */ RoomCallLocator\n | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;\n\n/**\n * Optional parameters to create {@link AzureCommunicationCallAdapter}\n *\n * @beta\n */\nexport type AzureCommunicationCallAdapterOptions = {\n /* @conditional-compile-remove(rooms) */\n /**\n * Use this to hint the role of the user when the role is not available before a Rooms call is started. This value\n * should be obtained using the Rooms API. This role will determine permissions in the configuration page of the\n * {@link CallComposite}. The true role of the user will be synced with ACS services when a Rooms call starts.\n */\n roleHint?: Role;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Optional feature flags to be enabled in the CallAdapter.\n */\n features?: CallAdapterOptionalFeatures;\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link CallAdapter}.\n *\n * Note: `displayName` can be a maximum of 256 characters.\n *\n * @public\n */\nexport type AzureCommunicationCallAdapterArgs = {\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n locator: CallAdapterLocator;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * A phone number in E.164 format procured using Azure Communication Services that will be used to represent callers identity.\n * E.164 numbers are formatted as [+] [country code] [phone number including area code]. For example, +14255550123 for a US phone number.\n */\n alternateCallerId?: string;\n /* @conditional-compile-remove(rooms) */\n /**\n * Optional parameters for the {@link AzureCommunicationCallAdapter} created\n */\n options?: AzureCommunicationCallAdapterOptions;\n};\n\n/**\n * Create a {@link CallAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link CallAdapter} provided by this library.\n *\n * Note: `displayName` can be a maximum of 256 characters.\n *\n * @public\n */\nexport const createAzureCommunicationCallAdapter = async ({\n userId,\n displayName,\n credential,\n locator,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /* @conditional-compile-remove(rooms) */ options\n}: AzureCommunicationCallAdapterArgs): Promise<CallAdapter> => {\n if (!isValidIdentifier(userId)) {\n throw new Error('Invalid identifier. Please provide valid identifier object.');\n }\n\n const callClient = createStatefulCallClient({\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n });\n const callAgent = await callClient.createCallAgent(credential, {\n displayName\n });\n const adapter = createAzureCommunicationCallAdapterFromClient(\n callClient,\n callAgent,\n locator,\n /* @conditional-compile-remove(rooms) */ options\n );\n return adapter;\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * @beta\n */\nexport const createAzureCommunicationTeamsCallAdapter = async ({\n userId,\n credential,\n locator,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n}: AzureCommunicationCallAdapterArgs): Promise<TeamsCallAdapter> => {\n const callClient = createStatefulCallClient({\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId\n });\n const callAgent = await callClient.createTeamsCallAgent(credential, {\n undefined\n });\n const adapter = createAzureCommunicationTeamsCallAdapterFromClient(callClient, callAgent, locator);\n return adapter;\n};\n\n/**\n * @private\n */\nconst useAzureCommunicationCallAdapterGeneric = <\n AdapterType extends CallAdapter | /* @conditional-compile-remove(teams-identity-support) */ TeamsCallAdapter\n>(\n args: Partial<AzureCommunicationCallAdapterArgs>,\n createAzureCommunicationCallAdapter: (args: AzureCommunicationCallAdapterArgs) => Promise<AdapterType>,\n afterCreate?: (adapter: AdapterType) => Promise<AdapterType>,\n beforeDispose?: (adapter: AdapterType) => Promise<void>\n): AdapterType | undefined => {\n const {\n credential,\n displayName,\n locator,\n userId,\n /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /*@conditional-compile-remove(rooms) */ options\n } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<AdapterType | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<AdapterType | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: AdapterType) => Promise<AdapterType>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: AdapterType) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !locator || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationCallAdapter({\n credential,\n displayName,\n locator,\n userId,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n /* @conditional-compile-remove(rooms) */ options\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [\n adapterRef,\n afterCreateRef,\n /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,\n beforeDisposeRef,\n createAzureCommunicationCallAdapter,\n credential,\n displayName,\n locator,\n /* @conditional-compile-remove(rooms) */ options,\n userId\n ]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * A custom React hook to simplify the creation of {@link CallAdapter}.\n *\n * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationCallAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationCallAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: CallAdapter) => Promise<CallAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: CallAdapter) => Promise<void>\n): CallAdapter | undefined => {\n return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose);\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.\n *\n * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @beta\n */\nexport const useAzureCommunicationTeamsCallAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationCallAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: TeamsCallAdapter) => Promise<TeamsCallAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: TeamsCallAdapter) => Promise<void>\n): TeamsCallAdapter | undefined => {\n return useAzureCommunicationCallAdapterGeneric(\n args,\n createAzureCommunicationTeamsCallAdapter,\n afterCreate,\n beforeDispose\n );\n};\n\n/**\n * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulCallClient}.\n * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.\n *\n * @public\n */\nexport const createAzureCommunicationCallAdapterFromClient: (\n callClient: StatefulCallClient,\n callAgent: CallAgent,\n locator: CallAdapterLocator,\n /* @conditional-compile-remove(rooms) */ options?: AzureCommunicationCallAdapterOptions\n) => Promise<CallAdapter> = async (\n callClient: StatefulCallClient,\n callAgent: CallAgent,\n locator: CallAdapterLocator,\n options?\n): Promise<CallAdapter> => {\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\n /* @conditional-compile-remove(unsupported-browser) */\n await callClient.feature(Features.DebugInfo).getEnvironmentInfo();\n return new AzureCommunicationCallAdapter(\n callClient,\n locator,\n callAgent,\n deviceManager,\n /* @conditional-compile-remove(rooms) */ options\n );\n};\n\n/* @conditional-compile-remove(teams-identity-support) */\n/**\n * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulCallClient}.\n * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.\n *\n * @beta\n */\nexport const createAzureCommunicationTeamsCallAdapterFromClient = async (\n callClient: StatefulCallClient,\n callAgent: TeamsCallAgent,\n locator: CallAdapterLocator\n): Promise<TeamsCallAdapter> => {\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\n /* @conditional-compile-remove(unsupported-browser) */\n await callClient.feature(Features.DebugInfo).getEnvironmentInfo();\n return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);\n};\n\nconst isCallError = (e: Error): e is CallError => {\n return e['target'] !== undefined && e['innerError'] !== undefined;\n};\n\n/* @conditional-compile-remove(teams-adhoc-call) */\n/* @conditional-compile-remove(PSTN-calls) */\nconst isOutboundCall = (callLocator: CallAdapterLocator): callLocator is CallParticipantsLocator => {\n return 'participantIds' in callLocator;\n};\n\"../../../../../calling-component-bindings/src\"\"../../../../../calling-stateful-client/src\"\"../../../../../react-components/src\"\"../../../../../acs-ui-common/src\""]}
|
package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js
CHANGED
@@ -49,7 +49,7 @@ export const useSelectorWithAdaptation = (selector, adaptState, selectorProps) =
|
|
49
49
|
}, [adaptState, adapter, selector, selectorProps, callConfigProps]);
|
50
50
|
return props;
|
51
51
|
};
|
52
|
-
const memoizeState = memoizeOne((userId, deviceManager, calls, latestErrors, displayName) => ({
|
52
|
+
const memoizeState = memoizeOne((userId, deviceManager, calls, latestErrors, displayName, alternateCallerId, environmentInfo) => ({
|
53
53
|
userId,
|
54
54
|
incomingCalls: {},
|
55
55
|
incomingCallsEnded: {},
|
@@ -57,7 +57,11 @@ const memoizeState = memoizeOne((userId, deviceManager, calls, latestErrors, dis
|
|
57
57
|
deviceManager,
|
58
58
|
callAgent: { displayName },
|
59
59
|
calls,
|
60
|
-
latestErrors
|
60
|
+
latestErrors,
|
61
|
+
/* @conditional-compile-remove(PSTN-calls) */
|
62
|
+
alternateCallerId,
|
63
|
+
/* @conditional-compile-remove(unsupported-browser) */
|
64
|
+
environmentInfo
|
61
65
|
}));
|
62
66
|
const memoizeCalls = memoizeOne((call) => (call ? { [call.id]: call } : {}));
|
63
67
|
const adaptCompositeState = (compositeState) => {
|
@@ -75,6 +79,10 @@ const adaptCompositeState = (compositeState) => {
|
|
75
79
|
// that are unknown to the UI component and data binding libraries. Generic handling of the errors (e.g.,
|
76
80
|
// just displaying them in some UI surface) will continue to work for these operations. Handling of
|
77
81
|
// specific operations (e.g., acting on errors related to permission issues) will ignore these operations.
|
78
|
-
compositeState.latestErrors, compositeState.displayName
|
82
|
+
compositeState.latestErrors, compositeState.displayName,
|
83
|
+
/* @conditional-compile-remove(PSTN-calls) */
|
84
|
+
compositeState.alternateCallerId,
|
85
|
+
/* @conditional-compile-remove(unsupported-browser) */
|
86
|
+
compositeState.environmentInfo);
|
79
87
|
};
|
80
88
|
//# sourceMappingURL=useAdaptedSelector.js.map
|
package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAdaptedSelector.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AAEvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;
|
1
|
+
{"version":3,"file":"useAdaptedSelector.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AAEvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,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AE;IAChF,OAAO,YAAY,CACjB,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,OAAO,EACtB,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC;IACjC,oCAAoC;IACpC,uFAAuF;IACvF,EAAE;IACF,oEAAoE;IACpE,6FAA6F;IAC7F,sEAAsE;IACtE,qGAAqG;IACrG,mEAAmE;IACnE,EAAE;IACF,6GAA6G;IAC7G,yGAAyG;IACzG,mGAAmG;IACnG,0GAA0G;IAC1G,cAAc,CAAC,YAA0B,EACzC,cAAc,CAAC,WAAW;IAC1B,6CAA6C;IAC7C,cAAc,CAAC,iBAAiB;IAChC,sDAAsD;IACtD,cAAc,CAAC,eAAe,CAC/B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useState, useEffect, useRef, useMemo } from 'react';\n\nimport memoizeOne from 'memoize-one';\nimport { useAdapter } from '../adapter/CallAdapterProvider';\nimport { CallAdapterState } from '../adapter/CallAdapter';\nimport { CallErrors, CallState, CallClientState, DeviceManagerState } from '@internal/calling-stateful-client';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\n/**\n * @private\n */\nexport const useAdaptedSelector = <SelectorT extends (state: CallClientState, props: any) => any>(\n selector: SelectorT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n return useSelectorWithAdaptation(selector, adaptCompositeState, selectorProps);\n};\n\n/**\n * @private\n */\nexport const useSelectorWithAdaptation = <\n SelectorT extends (state: ReturnType<AdaptFuncT>, props: any) => any,\n AdaptFuncT extends (state: CallAdapterState) => any\n>(\n selector: SelectorT,\n adaptState: AdaptFuncT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n const adapter = useAdapter();\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const callId = adapter.getState().call?.id;\n const callConfigProps = useMemo(\n () => ({\n callId\n }),\n [callId]\n );\n\n const [props, setProps] = useState(selector(adaptState(adapter.getState()), selectorProps ?? callConfigProps));\n const propRef = useRef(props);\n propRef.current = props;\n\n useEffect(() => {\n const onStateChange = (state: CallAdapterState): void => {\n if (!mounted.current) {\n return;\n }\n const newProps = selector(adaptState(state), selectorProps ?? callConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n adapter.onStateChange(onStateChange);\n return () => {\n adapter.offStateChange(onStateChange);\n };\n }, [adaptState, adapter, selector, selectorProps, callConfigProps]);\n return props;\n};\n\nconst memoizeState = memoizeOne(\n (\n userId: CommunicationIdentifierKind,\n deviceManager: DeviceManagerState,\n calls: { [key: string]: CallState },\n latestErrors: CallErrors,\n displayName?: string,\n alternateCallerId?: string,\n environmentInfo?: undefined | /* @conditional-compile-remove(unsupported-browser) */ EnvironmentInfo\n ): CallClientState => ({\n userId,\n incomingCalls: {},\n incomingCallsEnded: {},\n callsEnded: {},\n deviceManager,\n callAgent: { displayName },\n calls,\n latestErrors,\n /* @conditional-compile-remove(PSTN-calls) */\n alternateCallerId,\n /* @conditional-compile-remove(unsupported-browser) */\n environmentInfo\n })\n);\n\nconst memoizeCalls = memoizeOne((call?: CallState): { [key: string]: CallState } => (call ? { [call.id]: call } : {}));\n\nconst adaptCompositeState = (compositeState: CallAdapterState): CallClientState => {\n return memoizeState(\n compositeState.userId,\n compositeState.devices,\n memoizeCalls(compositeState.call),\n // This is an unsafe type expansion.\n // compositeState.latestErrors can contain properties that are not valid in CallErrors.\n //\n // But there is no way to check for valid property names at runtime:\n // - The set of valid property names is built from types in the @azure/communication-calling.\n // Thus we don't have a literal array of allowed strings at runtime.\n // - Due to minification / uglification, the property names from the objects at runtime can't be used\n // to compare against permissible values inferred from the types.\n //\n // This is not a huge problem -- it simply means that our adapted selector will include some extra operations\n // that are unknown to the UI component and data binding libraries. Generic handling of the errors (e.g.,\n // just displaying them in some UI surface) will continue to work for these operations. Handling of\n // specific operations (e.g., acting on errors related to permission issues) will ignore these operations.\n compositeState.latestErrors as CallErrors,\n compositeState.displayName,\n /* @conditional-compile-remove(PSTN-calls) */\n compositeState.alternateCallerId,\n /* @conditional-compile-remove(unsupported-browser) */\n compositeState.environmentInfo\n );\n};\n\"../../../../../calling-stateful-client/src\""]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { CallAdapterState, CallCompositePage } from '../adapter/CallAdapter';
|
2
2
|
import { CallControlOptions } from '../types/CallControlOptions';
|
3
3
|
import { CallState } from "../../../../../calling-stateful-client/src";
|
4
|
+
import { CommunicationIdentifier } from '@azure/communication-common';
|
4
5
|
import { EnvironmentInfo } from '@azure/communication-calling';
|
5
6
|
import { CallAdapterOptionalFeatures } from '../adapter/CallAdapter';
|
6
7
|
/**
|
@@ -67,5 +68,13 @@ export declare const isDisabled: (option: boolean | {
|
|
67
68
|
* @private
|
68
69
|
*/
|
69
70
|
export declare const getDevicePermissionState: (setVideoState: (state: PermissionState | 'unsupported') => void, setAudioState: (state: PermissionState | 'unsupported') => void) => void;
|
71
|
+
/**
|
72
|
+
* Check if an object is identifier.
|
73
|
+
*
|
74
|
+
* @param identifier
|
75
|
+
* @returns whether an identifier is one of identifier types (for runtime validation)
|
76
|
+
* @private
|
77
|
+
*/
|
78
|
+
export declare const isValidIdentifier: (identifier: CommunicationIdentifier) => boolean;
|
70
79
|
export {};
|
71
80
|
//# sourceMappingURL=Utils.d.ts.map
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { END_CALL_PAGES } from '../adapter/CallAdapter';
|
4
4
|
import { _isInCall, _isPreviewOn, _isInLobbyOrConnecting } from "../../../../../calling-component-bindings/src";
|
5
|
-
import { isPhoneNumberIdentifier } from '@azure/communication-common';
|
5
|
+
import { isCommunicationUserIdentifier, isMicrosoftTeamsUserIdentifier, isPhoneNumberIdentifier, isUnknownIdentifier } from '@azure/communication-common';
|
6
6
|
const ACCESS_DENIED_TEAMS_MEETING_SUB_CODE = 5854;
|
7
7
|
const REMOTE_PSTN_USER_HUNG_UP = 560000;
|
8
8
|
const REMOVED_FROM_CALL_SUB_CODES = [5000, 5300, REMOTE_PSTN_USER_HUNG_UP];
|
@@ -247,4 +247,17 @@ const isUnsupportedEnvironment = (features, environmentInfo, unsupportedBrowserV
|
|
247
247
|
((environmentInfo === null || environmentInfo === void 0 ? void 0 : environmentInfo.isSupportedBrowserVersion) === false && !unsupportedBrowserVersionOptedIn) ||
|
248
248
|
(environmentInfo === null || environmentInfo === void 0 ? void 0 : environmentInfo.isSupportedPlatform) === false));
|
249
249
|
};
|
250
|
+
/**
|
251
|
+
* Check if an object is identifier.
|
252
|
+
*
|
253
|
+
* @param identifier
|
254
|
+
* @returns whether an identifier is one of identifier types (for runtime validation)
|
255
|
+
* @private
|
256
|
+
*/
|
257
|
+
export const isValidIdentifier = (identifier) => {
|
258
|
+
return (isCommunicationUserIdentifier(identifier) ||
|
259
|
+
isPhoneNumberIdentifier(identifier) ||
|
260
|
+
isMicrosoftTeamsUserIdentifier(identifier) ||
|
261
|
+
isUnknownIdentifier(identifier));
|
262
|
+
};
|
250
263
|
//# sourceMappingURL=Utils.js.map
|