@azure/communication-react 1.20.0-alpha-202410160016 → 1.20.0-alpha-202410170016
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/communication-react.d.ts +10 -10
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-NQBARXtW.js → ChatMessageComponentAsRichTextEditBox-Dg2BkrN6.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-NQBARXtW.js.map → ChatMessageComponentAsRichTextEditBox-Dg2BkrN6.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-Se_hHkKE.js → RichTextSendBoxWrapper-D4pLWFtj.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-Se_hHkKE.js.map → RichTextSendBoxWrapper-D4pLWFtj.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-CtfGMAPa.js → index-BlNmEm_b.js} +72 -68
- package/dist/dist-cjs/communication-react/{index-CtfGMAPa.js.map → index-BlNmEm_b.js.map} +1 -1
- package/dist/dist-cjs/communication-react/index.js +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/acs-ui-javascript-loaders/src/callCompositeLoader.d.ts +3 -2
- package/dist/dist-esm/acs-ui-javascript-loaders/src/callCompositeLoader.js +3 -5
- package/dist/dist-esm/acs-ui-javascript-loaders/src/callCompositeLoader.js.map +1 -1
- package/dist/dist-esm/acs-ui-javascript-loaders/src/callWithChatCompositeLoader.d.ts +3 -2
- package/dist/dist-esm/acs-ui-javascript-loaders/src/callWithChatCompositeLoader.js +3 -5
- package/dist/dist-esm/acs-ui-javascript-loaders/src/callWithChatCompositeLoader.js.map +1 -1
- package/dist/dist-esm/acs-ui-javascript-loaders/src/chatCompositeLoader.d.ts +3 -2
- package/dist/dist-esm/acs-ui-javascript-loaders/src/chatCompositeLoader.js +3 -5
- package/dist/dist-esm/acs-ui-javascript-loaders/src/chatCompositeLoader.js.map +1 -1
- package/dist/dist-esm/acs-ui-javascript-loaders/src/outboundCallCompositeLoader.d.ts +3 -2
- package/dist/dist-esm/acs-ui-javascript-loaders/src/outboundCallCompositeLoader.js +3 -4
- package/dist/dist-esm/acs-ui-javascript-loaders/src/outboundCallCompositeLoader.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.js +10 -14
- package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +2 -2
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.js +2 -2
- package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +6 -8
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +4 -3
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +13 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +2 -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/adapter/CallAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +4 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cy-GB/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +1 -0
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +2 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +2 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAA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C,CAAC;IAC5C,CAAC;IAEM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { EventEmitter } from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(maxListeners?: number, credential?: CommunicationTokenCredential, endpoint?: string) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n this._inlineImageQueue?.cancelAllRequests();\n this._fullsizeImageQueue?.cancelAllRequests();\n Object.keys(draft.threads).forEach((threadId) => {\n const thread = draft.threads[threadId];\n Object.keys(thread.chatMessages).forEach((messageId) => {\n const cache = thread.chatMessages[messageId].resourceCache;\n if (cache) {\n Object.keys(cache).forEach((resourceUrl) => {\n const resource = cache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n });\n }\n thread.chatMessages[messageId].resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = { ...message, resourceCache: {} };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue && this._fullsizeImageQueue.containsMessageWithSameAttachments(message)) {\n this._fullsizeImageQueue?.cancelRequest(resourceUrl);\n } else if (\n message &&\n this._inlineImageQueue &&\n this._inlineImageQueue.containsMessageWithSameAttachments(message)\n ) {\n this._inlineImageQueue?.cancelRequest(resourceUrl);\n }\n if (message && message.resourceCache && message.resourceCache[resourceUrl]) {\n const resource = message.resourceCache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n this.parseAttachments(threadId, message);\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (\n this._inlineImageQueue &&\n !this._inlineImageQueue.containsMessageWithSameAttachments(message) &&\n message.resourceCache === undefined\n ) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\n }\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n"]}
|
1
|
+
{"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAElF,YAAY,EAAE,CAAC;AACf,qDAAqD;AACrD,aAAa,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,OAAO,WAAW;IAatB,YAAY,YAAqB,EAAE,UAAyC,EAAE,QAAiB;QAZvF,WAAM,GAAoB;YAChC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAA2B;YAC3C,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAgB;SAC/B,CAAC;QACM,eAAU,GAAG,KAAK,CAAC;QAGnB,4BAAuB,GAAuB,SAAS,CAAC;QACxD,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,CAAC;YACH,UAAU,EAAE,CAAC;YACb,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;YACzB,IAAI,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC/E,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IAEM,aAAa,CAAC,OAAyC;QAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { EventEmitter } from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(maxListeners?: number, credential?: CommunicationTokenCredential, endpoint?: string) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, { credential, endpoint: endpoint ?? '' });\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n this._inlineImageQueue?.cancelAllRequests();\n this._fullsizeImageQueue?.cancelAllRequests();\n Object.values(draft.threads).forEach((thread) => {\n Object.values(thread.chatMessages).forEach((message) => {\n const cache = message.resourceCache;\n if (cache) {\n Object.values(cache).forEach((resource) => {\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n });\n }\n message.resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = { ...message, resourceCache: {} };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue && this._fullsizeImageQueue.containsMessageWithSameAttachments(message)) {\n this._fullsizeImageQueue?.cancelRequest(resourceUrl);\n } else if (\n message &&\n this._inlineImageQueue &&\n this._inlineImageQueue.containsMessageWithSameAttachments(message)\n ) {\n this._inlineImageQueue?.cancelRequest(resourceUrl);\n }\n if (message && message.resourceCache && message.resourceCache[resourceUrl]) {\n const resource = message.resourceCache[resourceUrl];\n if (resource?.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n this.parseAttachments(threadId, message);\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (\n this._inlineImageQueue &&\n !this._inlineImageQueue.containsMessageWithSameAttachments(message) &&\n message.resourceCache === undefined\n ) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\n }\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n"]}
|
@@ -64,14 +64,15 @@ export class ResourceDownloadQueue {
|
|
64
64
|
});
|
65
65
|
}
|
66
66
|
cancelAllRequests() {
|
67
|
-
for (const
|
68
|
-
|
67
|
+
for (const cancelation of Object.values(this._requestsToCancel)) {
|
68
|
+
cancelation.abortController.abort();
|
69
69
|
}
|
70
70
|
this._requestsToCancel = {};
|
71
71
|
}
|
72
72
|
cancelRequest(url) {
|
73
|
+
var _a;
|
73
74
|
if (this._requestsToCancel[url]) {
|
74
|
-
this._requestsToCancel[url].abortController.abort();
|
75
|
+
(_a = this._requestsToCancel[url]) === null || _a === void 0 ? void 0 : _a.abortController.abort();
|
75
76
|
delete this._requestsToCancel[url];
|
76
77
|
}
|
77
78
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAOA;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,OAAoB,EAAE,cAA8E;QAPxG,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAGlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAEM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAAC;gBACvD,MAAM,kBAAkB,GAAG,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;gBACxD,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC/F,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,UAAU,CAAC,OAA8B;QAC9C,0CAA0C;QAC1C,MAAM,IAAI,qBAAQ,OAAO,CAAE,CAAC;QAC5B,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,IAAI,CA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,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChatContext } from './ChatContext';\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n\n if (response.status >= 400) {\n throw new Error(`Failed to fetch image source. Status code: ${response.status}`);\n }\n\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
|
1
|
+
{"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAOA;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,OAAoB,EAAE,cAA8E;QAPxG,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAGlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,cAAc,C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AAC;YAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;YAEZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,eAAe,CAAC,MAAM,IAC9B,CAAC;YACH,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9E,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAEpE,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,8CAA8C,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChatContext } from './ChatContext';\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\ndeclare type CancellationDetails = { src: string; abortController: AbortController };\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n\n constructor(context: ChatContext, authentication: { credential: CommunicationTokenCredential; endpoint: string }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n public cancelAllRequests(): void {\n for (const cancelation of Object.values(this._requestsToCancel)) {\n cancelation.abortController.abort();\n }\n this._requestsToCancel = {};\n }\n\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url]?.abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[resourceUrl];\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(\n operation: ImageRequest,\n url: string,\n abortController: AbortController\n ): Promise<string> {\n this._requestsToCancel[url] = { src: url, abortController };\n const blobUrl = await operation(\n url,\n { credential: this._credential, endpoint: this._endpoint },\n { abortController }\n );\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/**\n * @private\n */\nexport const fetchImageSource = async (\n src: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n): Promise<string> => {\n async function fetchWithAuthentication(\n url: string,\n token: string,\n options: { abortController: AbortController; timeout?: number }\n ): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n\n const response = await fetchWithAuthentication(src, token, options);\n\n if (response.status >= 400) {\n throw new Error(`Failed to fetch image source. Status code: ${response.status}`);\n }\n\n const blob = await response.blob();\n\n return URL.createObjectURL(blob);\n};\ninterface ImageRequest {\n (\n request: string,\n authentication: { credential: CommunicationTokenCredential; endpoint: string },\n options: { abortController: AbortController; timeout?: number }\n ): Promise<string>;\n}\n"]}
|
@@ -20,7 +20,7 @@ export const SMALL_FLOATING_MODAL_SIZE_REM = { width: 3.625, height: 6.5 };
|
|
20
20
|
* Large floating modal width and height in rem for large screen
|
21
21
|
* Aspect ratio: 16:9
|
22
22
|
*/
|
23
|
-
export const LARGE_FLOATING_MODAL_SIZE_REM = { width: 13.
|
23
|
+
export const LARGE_FLOATING_MODAL_SIZE_REM = { width: 13.75, height: 7.5 };
|
24
24
|
/**
|
25
25
|
* Vertical gallery floating modal width and height in rem
|
26
26
|
* Aspect ratio: 16:9
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FloatingLocalVideo.styles.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EAOf,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,yCAAgC;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAE9G;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAiB;IACtD,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;CACjF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"FloatingLocalVideo.styles.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EAOf,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,yCAAgC;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAE9G;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAiB;IACtD,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;CACjF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,8CAA8C,GAAG,EAAE,KAAK,EAAE,C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ACnB,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;YACpB,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS,EAAE,4EAA4E;YAC9F,MAAM,EAAE,CAAC,EAAE,uDAAuD;YAClE,UAAU,EAAE,iBAAiB;YAC7B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;SAC3C;QACD,WAAW,EAAE;YACX,yFAAyF;YACzF,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,iBAAiB,CAAC,6EAA6E;SAC5G;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;YACxB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;YACzB,MAAM,EAAE,CAAC;SACV;QACD,aAAa,EAAE;YACb,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC3B;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D,yBAAyB,EAAE;QACzB,MAAM,EAAE,uBAAuB,GAAG,CAAC,CAAC,qFAAqF;KAC1H;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n concatStyleSets,\n IButtonStyles,\n IModalStyleProps,\n IModalStyles,\n IStackStyles,\n IStyle,\n IStyleFunctionOrObject,\n mergeStyles,\n Theme\n} from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { VideoTileStylesProps } from '../../VideoTile';\n\n/**\n * @private\n */\nexport const videoGalleryOuterDivStyle = mergeStyles({ position: 'relative', width: '100%', height: '100%' });\n\n/**\n * @private\n */\nexport const videoGalleryContainerStyle: IStackStyles = {\n root: { position: 'relative', height: '100%', width: '100%', padding: '0.5rem' }\n};\n\n/**\n * Small floating modal width and height in rem for small screen\n */\nexport const SMALL_FLOATING_MODAL_SIZE_REM = { width: 3.625, height: 6.5 };\n\n/**\n * Large floating modal width and height in rem for large screen\n * Aspect ratio: 16:9\n */\nexport const LARGE_FLOATING_MODAL_SIZE_REM = { width: 13.75, height: 7.5 };\n\n/**\n * Vertical gallery floating modal width and height in rem\n * Aspect ratio: 16:9\n */\nexport const SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM = { width: 9, height: 5.063 };\n\n/**\n * Vertical gallery floating modal width and height in rem\n * Aspect ratio: 16:9\n */\nexport const VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM = { width: 11, height: 6.25 };\n/**\n * @private\n * z-index to ensure that the local video tile is above the video gallery.\n */\nexport const LOCAL_VIDEO_TILE_ZINDEX = 2;\n\n/**\n * @private\n */\nexport const localVideoTileContainerStyle = (\n theme: Theme,\n localVideoTileSizeRem: { width: number; height: number },\n screenSharePresent?: boolean,\n overflowGalleryPosition?: 'horizontalBottom' | 'verticalRight' | 'horizontalTop'\n): IStyle => {\n return {\n width: screenSharePresent ? `${localVideoTileSizeRem.width}rem` : '',\n height: screenSharePresent ? `${localVideoTileSizeRem.height}rem` : '',\n minWidth: screenSharePresent ? '' : `${localVideoTileSizeRem.width}rem`,\n minHeight: screenSharePresent ? '' : `${localVideoTileSizeRem.height}rem`,\n position: 'absolute',\n bottom: overflowGalleryPosition !== 'horizontalTop' ? `${dockedlocalVideoTileContainerPaddingRem}rem` : 'unset',\n top: overflowGalleryPosition === 'horizontalTop' ? `${dockedlocalVideoTileContainerPaddingRem}rem` : 'unset',\n borderRadius: theme.effects.roundedCorner4,\n overflow: 'hidden',\n right: `${dockedlocalVideoTileContainerPaddingRem}rem`\n };\n};\n\n/**\n * @private\n */\nexport const localVideoTileWithControlsContainerStyle = (\n theme: Theme,\n localVideoTileSizeRem: { width: number; height: number }\n): IStackStyles => {\n return concatStyleSets(localVideoTileContainerStyle(theme, localVideoTileSizeRem), {\n root: { boxShadow: theme.effects.elevation8 }\n });\n};\n\n/**\n * @private\n */\nexport const floatingLocalVideoModalStyle = (\n theme: Theme,\n modalSizeRem: { width: number; height: number }\n): IStyleFunctionOrObject<IModalStyleProps, IModalStyles> => {\n return concatStyleSets(\n {\n main: mergeStyles(localVideoTileContainerStyle(theme, modalSizeRem), {\n bottom: `${floatinglocalVideoModalInitialPositionGapRem}rem`,\n right: `${floatinglocalVideoModalInitialPositionGapRem}rem`\n })\n },\n {\n main: {\n boxShadow: theme.effects.elevation8,\n ':focus-within': {\n boxShadow: theme.effects.elevation16,\n border: `${_pxToRem(2)} solid ${theme.palette.neutralPrimary}`\n }\n }\n },\n localVideoModalStyles\n );\n};\n\n/**\n * Initial position gap of the floating local video modal.\n * ie. if this is 1rem, then floating local video modal would initially be positioned 1rem from\n * the bottom and 1rem from the right.\n * @private\n */\nexport const floatinglocalVideoModalInitialPositionGapRem = 1;\n\n/**\n * Padding of the docked local video tile container.\n * @private\n */\nexport const dockedlocalVideoTileContainerPaddingRem = 0.5;\n\n/**\n * @private\n */\nexport const floatingLocalVideoTileStyle: VideoTileStylesProps = {\n root: {\n position: 'absolute',\n zIndex: LOCAL_VIDEO_TILE_ZINDEX,\n height: '100%',\n width: '100%'\n }\n};\n\n/**\n * @private\n */\nexport const localVideoCameraCycleButtonStyles = (theme: Theme): IButtonStyles => {\n return {\n root: {\n position: 'absolute',\n width: _pxToRem(32),\n height: _pxToRem(32),\n right: '0rem',\n top: '0rem',\n color: '#FFFFFF', // only shows up on running video feed to we want to force specific colours.\n zIndex: 2, // shows the button directly over the local video feed.\n background: 'rgba(0,0,0,0.4)',\n borderRadius: theme.effects.roundedCorner2\n },\n rootFocused: {\n // styles to remove the unwanted white highlight and blue colour after tapping on button.\n color: '#FFFFFF',\n background: 'rgba(0,0,0,0.4)' // sets opacity of background to be visible on all backdrops in video stream.\n },\n icon: {\n paddingLeft: _pxToRem(3),\n paddingRight: _pxToRem(3),\n margin: 0\n },\n flexContainer: {\n paddingBottom: _pxToRem(8)\n }\n };\n};\n\n/**\n * Styles for the local video tile modal when it is focused, will cause keyboard move icon to appear over video\n * @private\n */\nexport const localVideoModalStyles: Partial<IModalStyles> = {\n keyboardMoveIconContainer: {\n zIndex: LOCAL_VIDEO_TILE_ZINDEX + 1 // zIndex to set the keyboard movement Icon above the other layers in the video tile.\n }\n};\n"]}
|
@@ -42,6 +42,7 @@ import { useEndedCallConsoleErrors } from './utils/useConsoleErrors';
|
|
42
42
|
import { SurveyPage } from './pages/SurveyPage';
|
43
43
|
import { useAudio } from '../common/AudioProvider';
|
44
44
|
import { complianceBannerSelector } from './selectors/complianceBannerSelector';
|
45
|
+
import { devicePermissionSelector } from './selectors/devicePermissionSelector';
|
45
46
|
const isShowing = (overrideSidePane) => {
|
46
47
|
return !!(overrideSidePane === null || overrideSidePane === void 0 ? void 0 : overrideSidePane.isActive);
|
47
48
|
};
|
@@ -52,6 +53,7 @@ const MainScreen = (props) => {
|
|
52
53
|
const hasCameras = camerasCount > 0;
|
53
54
|
const hasMicrophones = microphonesCount > 0;
|
54
55
|
const role = useSelector(getRole);
|
56
|
+
const { video: cameraHasPermission, audio: micHasPermission } = useSelector(devicePermissionSelector);
|
55
57
|
useEffect(() => {
|
56
58
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
57
59
|
var _a, _b, _c, _d;
|
@@ -61,9 +63,13 @@ const MainScreen = (props) => {
|
|
61
63
|
constrain.audio = ((_b = (_a = props.options) === null || _a === void 0 ? void 0 : _a.deviceChecks) === null || _b === void 0 ? void 0 : _b.microphone) === 'doNotPrompt' ? false : constrain.audio;
|
62
64
|
constrain.video = ((_d = (_c = props.options) === null || _c === void 0 ? void 0 : _c.deviceChecks) === null || _d === void 0 ? void 0 : _d.camera) === 'doNotPrompt' ? false : constrain.video;
|
63
65
|
}
|
64
|
-
yield adapter.askDevicePermission(constrain);
|
65
|
-
|
66
|
-
|
66
|
+
const permissionsResult = yield adapter.askDevicePermission(constrain);
|
67
|
+
if (permissionsResult === null || permissionsResult === void 0 ? void 0 : permissionsResult.audio) {
|
68
|
+
adapter.queryMicrophones();
|
69
|
+
}
|
70
|
+
if (permissionsResult === null || permissionsResult === void 0 ? void 0 : permissionsResult.video) {
|
71
|
+
adapter.queryCameras();
|
72
|
+
}
|
67
73
|
adapter.querySpeakers();
|
68
74
|
}))();
|
69
75
|
}, [
|
@@ -74,7 +80,10 @@ const MainScreen = (props) => {
|
|
74
80
|
// Ensure we re-ask for permissions if the number of devices goes from 0 -> n during a call
|
75
81
|
// as we cannot request permissions when there are no devices.
|
76
82
|
hasCameras,
|
77
|
-
hasMicrophones
|
83
|
+
hasMicrophones,
|
84
|
+
// Ensure we re-query for devices when permission for the device is granted.
|
85
|
+
cameraHasPermission,
|
86
|
+
micHasPermission
|
78
87
|
]);
|
79
88
|
const { callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems } = props;
|
80
89
|
const page = useSelector(getPage);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallComposite.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/CallComposite/CallComposite.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,EAEL,QAAQ,EAER,QAAQ,EAET,yCAAmC;AAEpC,OAAO,EAAsB,iBAAiB,EAAE,yCAAmC;AAEnF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAA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ation.\n// Licensed under the MIT License.\n\nimport { _isInCall } from '@internal/calling-component-bindings';\nimport {\n ActiveErrorMessage,\n ErrorBar,\n ParticipantMenuItemsCallback,\n useTheme,\n VideoTilesOptions\n} from '@internal/react-components';\n\nimport { ActiveNotification, NotificationStack } from '@internal/react-components';\nimport { CallSurveyImprovementSuggestions } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { AvatarPersonaDataCallback } from '../common/AvatarPersona';\nimport { BaseProvider, BaseCompositeProps } from '../common/BaseComposite';\nimport { CallCompositeIcons } from '../common/icons';\nimport { useLocale } from '../localization';\nimport { CommonCallAdapter, StartCallIdentifier } from './adapter/CallAdapter';\nimport { CallAdapterProvider, useAdapter } from './adapter/CallAdapterProvider';\nimport { CallPage } from './pages/CallPage';\nimport { ConfigurationPage } from './pages/ConfigurationPage';\nimport { NoticePage } from './pages/NoticePage';\nimport { useSelector } from './hooks/useSelector';\nimport { getAlternateCallerId, getEndedCall, getPage, getRole, getTargetCallees } from './selectors/baseSelectors';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { getEnvironmentInfo } from './selectors/baseSelectors';\nimport { LobbyPage } from './pages/LobbyPage';\nimport { TransferPage } from './pages/TransferPage';\nimport {\n leavingPageStyle,\n mainScreenContainerStyleDesktop,\n mainScreenContainerStyleMobile\n} from './styles/CallComposite.styles';\nimport { CallControlOptions } from './types/CallControlOptions';\n\nimport { LayerHost, mergeStyles } from '@fluentui/react';\nimport { modalLayerHostStyle } from '../common/styles/ModalLocalAndRemotePIP.styles';\nimport { useId } from '@fluentui/react-hooks';\nimport { HoldPage } from './pages/HoldPage';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { UnsupportedBrowserPage } from './pages/UnsupportedBrowser';\nimport { CallSurvey } from '@azure/communication-calling';\nimport { ParticipantRole, PermissionConstraints } from '@azure/communication-calling';\nimport { MobileChatSidePaneTabHeaderProps } from '../common/TabHeader';\nimport { InjectedSidePaneProps, SidePaneProvider, SidePaneRenderer } from './components/SidePane/SidePaneProvider';\nimport {\n filterLatestNotifications,\n getEndedCallPageProps,\n trackNotificationAsDismissed,\n updateTrackedNotificationsWithActiveNotifications\n} from './utils';\n\nimport { CachedComplianceNotificationProps, computeComplianceNotification } from './utils';\nimport { TrackedNotifications } from './types/ErrorTracking';\nimport { usePropsFor } from './hooks/usePropsFor';\nimport { deviceCountSelector } from './selectors/deviceCountSelector';\nimport { VideoGalleryLayout } from '@internal/react-components';\nimport { capabilitiesChangedInfoAndRoleSelector } from './selectors/capabilitiesChangedInfoAndRoleSelector';\nimport { useTrackedCapabilityChangedNotifications } from './utils/TrackCapabilityChangedNotifications';\nimport { useEndedCallConsoleErrors } from './utils/useConsoleErrors';\nimport { SurveyPage } from './pages/SurveyPage';\nimport { useAudio } from '../common/AudioProvider';\n\nimport { complianceBannerSelector } from './selectors/complianceBannerSelector';\n\n/**\n * Props for {@link CallComposite}.\n *\n * @public\n */\nexport interface CallCompositeProps extends BaseCompositeProps<CallCompositeIcons> {\n /**\n * An adapter provides logic and data to the composite.\n * Composite can also be controlled using the adapter.\n */\n adapter: CommonCallAdapter;\n /**\n * Optimizes the composite form factor for either desktop or mobile.\n * @remarks `mobile` is currently only optimized for Portrait mode on mobile devices and does not support landscape.\n * @defaultValue 'desktop'\n */\n formFactor?: 'desktop' | 'mobile';\n /**\n * URL to invite new participants to the current call. If this is supplied, a button appears in the Participants\n * Button flyout menu.\n */\n callInvitationUrl?: string;\n /**\n * Flags to enable/disable or customize UI elements of the {@link CallComposite}.\n */\n options?: CallCompositeOptions;\n}\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * Device Checks.\n * Choose whether or not to block starting a call depending on camera and microphone permission options.\n *\n * @beta\n */\nexport interface DeviceCheckOptions {\n /**\n * Camera Permission prompts for your call.\n * 'required' - requires the permission to be allowed before permitting the user join the call.\n * 'optional' - permission can be disallowed and the user is still permitted to join the call.\n * 'doNotPrompt' - permission is not required and the user is not prompted to allow the permission.\n */\n camera: 'required' | 'optional' | 'doNotPrompt';\n /**\n * Microphone permission prompts for your call.\n * 'required' - requires the permission to be allowed before permitting the user join the call.\n * 'optional' - permission can be disallowed and the user is still permitted to join the call.\n * 'doNotPrompt' - permission is not required and the user is not prompted to allow the permission.\n */\n microphone: 'required' | 'optional' | 'doNotPrompt';\n}\n\n/**\n * Menu options for remote video tiles in {@link VideoGallery}.\n *\n * @public\n */\nexport interface RemoteVideoTileMenuOptions {\n /**\n * If set to true, remote video tiles in the VideoGallery will not have menu options\n *\n * @defaultValue false\n */\n isHidden?: boolean;\n}\n\n/**\n * Options for the local video tile in the Call composite.\n *\n * @public\n */\nexport interface LocalVideoTileOptions {\n /**\n * Position of the local video tile. If unset will render the local tile in the floating local position.\n *\n * @defaultValue 'floating'\n * @remarks 'grid' - local video tile will be rendered in the grid view of the videoGallery.\n * 'floating' - local video tile will be rendered in the floating position and will observe overflow gallery\n * local video tile rules and be docked in the bottom corner.\n * This does not affect the Configuration screen or the side pane Picture in Picture in Picture view.\n */\n position?: 'grid' | 'floating';\n}\n/**\n * Optional features of the {@link CallComposite}.\n *\n * @public\n */\nexport type CallCompositeOptions = {\n captionsBanner?: {\n height: 'full' | 'default';\n };\n /**\n * Surface Azure Communication Services backend errors in the UI with {@link @azure/communication-react#ErrorBar}.\n * Hide or show the error bar.\n * @defaultValue true\n */\n errorBar?: boolean;\n /**\n * Hide or Customize the control bar element.\n * Can be customized by providing an object of type {@link @azure/communication-react#CallControlOptions}.\n * @defaultValue true\n */\n callControls?: boolean | CallControlOptions;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Device permissions check options for your call.\n * Here you can choose what device permissions you prompt the user for,\n * as well as what device permissions must be accepted before starting a call.\n */\n deviceChecks?: DeviceCheckOptions;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Callback you may provide to supply users with further steps to troubleshoot why they have been\n * unable to grant your site the required permissions for the call.\n *\n * @example\n * ```ts\n * onPermissionsTroubleshootingClick: () =>\n * window.open('https://contoso.com/permissions-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a 'further troubleshooting' link.\n */\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Callback you may provide to supply users with further steps to troubleshoot why they have been\n * having network issues when connecting to the call.\n *\n * @example\n * ```ts\n * onNetworkingTroubleShootingClick?: () =>\n * window.open('https://contoso.com/network-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a 'network troubleshooting' link.\n */\n onNetworkingTroubleShootingClick?: () => void;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Callback you may provide to supply users with a provided page to showcase supported browsers by ACS.\n *\n * @example\n * ```ts\n * onBrowserTroubleShootingClick?: () =>\n * window.open('https://contoso.com/browser-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a unsupported browser page.\n */\n onEnvironmentInfoTroubleshootingClick?: () => void;\n /**\n * Remote participant video tile menu options\n */\n remoteVideoTileMenuOptions?: RemoteVideoTileMenuOptions;\n /**\n * Options for controlling the local video tile.\n *\n * @remarks if 'false' the local video tile will not be rendered.\n */\n localVideoTile?: boolean | LocalVideoTileOptions;\n /**\n * Options for controlling video tile.\n */\n videoTilesOptions?: VideoTilesOptions;\n /**\n * Whether to auto show the DTMF Dialer when the call starts in supported scenarios.\n * - Teams Voice Application like Call queue or Auto Attendant\n * - PSTN Calls\n * @defaultValue false\n */\n disableAutoShowDtmfDialer?: boolean;\n /**\n * Options for controlling the starting layout of the composite's video gallery\n */\n galleryOptions?: {\n /**\n * Layout for the gallery when the call starts\n */\n layout?: VideoGalleryLayout;\n };\n /**\n * Options for end of call survey\n */\n surveyOptions?: {\n /**\n * Disable call survey at the end of a call.\n * @defaultValue false\n */\n disableSurvey?: boolean;\n /**\n * Optional callback to redirect users to custom screens when survey is done, note that default end call screen will be shown if this callback is not provided\n * This callback can be used to redirect users to different screens depending on survey state, whether it is submitted, skipped or has a problem when submitting the survey\n */\n onSurveyClosed?: (surveyState: 'sent' | 'skipped' | 'error', surveyError?: string) => void;\n /**\n * Optional callback to handle survey data including free form text response\n * Note that free form text response survey option is only going to be enabled when this callback is provided\n * User will need to handle all free form text response on their own\n */\n onSurveySubmitted?: (\n callId: string,\n surveyId: string,\n /**\n * This is the survey results containing star survey data and API tag survey data.\n * This part of the result will always be sent to the calling sdk\n * This callback provides user with the ability to gain access to survey data\n */\n submittedSurvey: CallSurvey,\n /**\n * This is the survey results containing free form text\n * This part of the result will not be handled by composites\n * User will need to collect and handle this information 100% on their own\n * Free form text survey is not going to show in the UI if onSurveySubmitted is not populated\n */\n improvementSuggestions: CallSurveyImprovementSuggestions\n ) => Promise<void>;\n };\n /**\n * Options for setting additional customizations related to personalized branding.\n */\n branding?: {\n /**\n * Logo displayed on the configuration page.\n */\n logo?: {\n /**\n * URL for the logo image.\n *\n * @remarks\n * Recommended size is 80x80 pixels.\n */\n url: string;\n /**\n * Alt text for the logo image.\n */\n alt?: string;\n /**\n * The logo can be displayed as a circle.\n *\n * @defaultValue 'unset'\n */\n shape?: 'unset' | 'circle';\n };\n /**\n * Background image displayed on the configuration page.\n */\n backgroundImage?: {\n /**\n * URL for the background image.\n *\n * @remarks\n * Background image should be larger than 576x567 pixels and smaller than 2048x2048 pixels pixels.\n */\n url: string;\n };\n };\n /**\n * Options for settings related to spotlight.\n */\n spotlight?: {\n /**\n * Flag to hide the menu buttons to start and stop spotlight for remote participants and the local participant.\n * @defaultValue false\n */\n hideSpotlightButtons?: boolean;\n };\n};\n\ntype MainScreenProps = {\n mobileView: boolean;\n modalLayerHostId: string;\n callInvitationUrl?: string;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n options?: CallCompositeOptions;\n overrideSidePane?: InjectedSidePaneProps;\n onSidePaneIdChange?: (sidePaneId: string | undefined) => void;\n mobileChatTabHeader?: MobileChatSidePaneTabHeaderProps;\n onCloseChatPane?: () => void;\n};\n\nconst isShowing = (overrideSidePane?: InjectedSidePaneProps): boolean => {\n return !!overrideSidePane?.isActive;\n};\n\nconst MainScreen = (props: MainScreenProps): JSX.Element => {\n const adapter = useAdapter();\n const { camerasCount, microphonesCount } = useSelector(deviceCountSelector);\n const hasCameras = camerasCount > 0;\n const hasMicrophones = microphonesCount > 0;\n\n const role = useSelector(getRole);\n\n useEffect(() => {\n (async () => {\n const constrain = getQueryOptions({ role });\n /* @conditional-compile-remove(call-readiness) */\n {\n constrain.audio = props.options?.deviceChecks?.microphone === 'doNotPrompt' ? false : constrain.audio;\n constrain.video = props.options?.deviceChecks?.camera === 'doNotPrompt' ? false : constrain.video;\n }\n await adapter.askDevicePermission(constrain);\n adapter.queryCameras();\n adapter.queryMicrophones();\n adapter.querySpeakers();\n })();\n }, [\n adapter,\n role,\n /* @conditional-compile-remove(call-readiness) */\n props.options?.deviceChecks,\n // Ensure we re-ask for permissions if the number of devices goes from 0 -> n during a call\n // as we cannot request permissions when there are no devices.\n hasCameras,\n hasMicrophones\n ]);\n\n const { callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems } = props;\n const page = useSelector(getPage);\n const endedCall = useSelector(getEndedCall);\n\n const [sidePaneRenderer, setSidePaneRenderer] = React.useState<SidePaneRenderer | undefined>();\n const [injectedSidePaneProps, setInjectedSidePaneProps] = React.useState<InjectedSidePaneProps>();\n const [userSetGalleryLayout, setUserSetGalleryLayout] = useState<VideoGalleryLayout>(\n props.options?.galleryOptions?.layout ?? 'floatingLocalVideo'\n );\n const [userSetOverflowGalleryPosition, setUserSetOverflowGalleryPosition] = useState<'Responsive' | 'horizontalTop'>(\n 'Responsive'\n );\n\n const overridePropsRef = useRef<InjectedSidePaneProps | undefined>(props.overrideSidePane);\n useEffect(() => {\n setInjectedSidePaneProps(props.overrideSidePane);\n // When the injected side pane is opened, clear the previous side pane active state.\n // this ensures when the injected side pane is \"closed\", the previous side pane is not \"re-opened\".\n if (!isShowing(overridePropsRef.current) && isShowing(props.overrideSidePane)) {\n setSidePaneRenderer(undefined);\n }\n overridePropsRef.current = props.overrideSidePane;\n }, [props.overrideSidePane]);\n\n const onSidePaneIdChange = props.onSidePaneIdChange;\n useEffect(() => {\n onSidePaneIdChange?.(sidePaneRenderer?.id);\n }, [sidePaneRenderer?.id, onSidePaneIdChange]);\n\n // When the call ends ensure the side pane is set to closed to prevent the side pane being open if the call is re-joined.\n useEffect(() => {\n const closeSidePane = (): void => {\n setSidePaneRenderer(undefined);\n };\n adapter.on('callEnded', closeSidePane);\n return () => {\n adapter.off('callEnded', closeSidePane);\n };\n }, [adapter]);\n\n const compositeAudioContext = useAudio();\n\n const capabilitiesChangedInfoAndRole = useSelector(capabilitiesChangedInfoAndRoleSelector);\n\n const capabilitiesChangedNotificationBarProps =\n useTrackedCapabilityChangedNotifications(capabilitiesChangedInfoAndRole);\n\n // Track the last dismissed errors of any error kind to prevent errors from re-appearing on subsequent page navigation\n // This works by tracking the most recent timestamp of any active error type.\n // And then tracking when that error type was last dismissed.\n const activeErrors = usePropsFor(ErrorBar).activeErrorMessages;\n\n const activeInCallErrors = usePropsFor(NotificationStack).activeErrorMessages;\n\n const activeNotifications = usePropsFor(NotificationStack).activeNotifications;\n\n const complianceProps = useSelector(complianceBannerSelector);\n\n const cachedProps = useRef<CachedComplianceNotificationProps>({\n latestBooleanState: {\n callTranscribeState: false,\n callRecordState: false\n },\n latestStringState: {\n callTranscribeState: 'off',\n callRecordState: 'off'\n },\n lastUpdated: Date.now()\n });\n\n const complianceNotification: ActiveNotification | undefined = useMemo(() => {\n return computeComplianceNotification(complianceProps, cachedProps);\n }, [complianceProps, cachedProps]);\n\n useEffect(() => {\n if (complianceNotification) {\n activeNotifications.forEach((notification, index) => {\n if (\n [\n 'recordingStarted',\n 'transcriptionStarted',\n 'recordingStopped',\n 'transcriptionStopped',\n 'recordingAndTranscriptionStarted',\n 'recordingAndTranscriptionStopped',\n 'recordingStoppedStillTranscribing',\n 'transcriptionStoppedStillRecording'\n ].includes(notification.type)\n ) {\n activeNotifications.splice(index, 1);\n }\n });\n activeNotifications.push(complianceNotification);\n }\n setTrackedNotifications((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeNotifications));\n }, [complianceNotification, activeNotifications]);\n\n const [trackedErrors, setTrackedErrors] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n const [trackedInCallErrors, setTrackedInCallErrors] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n const [trackedNotifications, setTrackedNotifications] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n useEffect(() => {\n setTrackedErrors((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeErrors));\n\n setTrackedInCallErrors((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeInCallErrors));\n }, [activeErrors, activeInCallErrors]);\n\n const onDismissError = useCallback((error: ActiveErrorMessage | ActiveNotification) => {\n setTrackedErrors((prev) => trackNotificationAsDismissed(error.type, prev));\n\n setTrackedInCallErrors((prev) => trackNotificationAsDismissed(error.type, prev));\n }, []);\n\n const onDismissNotification = useCallback((notification: ActiveNotification) => {\n setTrackedNotifications((prev) => trackNotificationAsDismissed(notification.type, prev));\n }, []);\n const latestErrors = useMemo(\n () => filterLatestNotifications(activeErrors, trackedErrors),\n [activeErrors, trackedErrors]\n );\n\n const latestInCallErrors = useMemo(\n () => filterLatestNotifications(activeInCallErrors, trackedInCallErrors),\n [activeInCallErrors, trackedInCallErrors]\n ) as ActiveNotification[];\n\n const latestNotifications = useMemo(() => {\n const result = filterLatestNotifications(activeNotifications, trackedNotifications);\n // sort notifications by timestamp from earliest to latest\n result.sort(\n (a, b) => (a.timestamp ?? new Date(Date.now())).getTime() - (b.timestamp ?? new Date(Date.now())).getTime()\n );\n return result;\n }, [activeNotifications, trackedNotifications]) as ActiveNotification[];\n\n const callees = useSelector(getTargetCallees) as StartCallIdentifier[];\n const locale = useLocale();\n const palette = useTheme().palette;\n const alternateCallerId = useSelector(getAlternateCallerId);\n const leavePageStyle = useMemo(() => leavingPageStyle(palette), [palette]);\n let pageElement: JSX.Element | undefined;\n const [pinnedParticipants, setPinnedParticipants] = useState<string[]>([]);\n switch (page) {\n case 'configuration':\n pageElement = (\n <ConfigurationPage\n mobileView={props.mobileView}\n startCallHandler={(): void => {\n if (callees) {\n adapter.startCall(\n callees,\n alternateCallerId ? { alternateCallerId: { phoneNumber: alternateCallerId } } : {}\n );\n } else {\n adapter.joinCall({\n microphoneOn: 'keep',\n cameraOn: 'keep'\n });\n }\n }}\n updateSidePaneRenderer={setSidePaneRenderer}\n latestErrors={latestErrors as ActiveErrorMessage[]}\n onDismissError={onDismissError}\n modalLayerHostId={props.modalLayerHostId}\n /* @conditional-compile-remove(call-readiness) */\n deviceChecks={props.options?.deviceChecks}\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick={props.options?.onPermissionsTroubleshootingClick}\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick={props.options?.onNetworkingTroubleShootingClick}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n logo={props.options?.branding?.logo}\n backgroundImage={props.options?.branding?.backgroundImage}\n />\n );\n break;\n case 'accessDeniedTeamsMeeting':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageAccessDeniedTeamsMeeting\"\n title={locale.strings.call.failedToJoinTeamsMeetingReasonAccessDeniedTitle}\n moreDetails={locale.strings.call.failedToJoinTeamsMeetingReasonAccessDeniedMoreDetails}\n dataUiId={'access-denied-teams-meeting-page'}\n />\n );\n break;\n case 'removedFromCall':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageRemovedFromCall\"\n title={locale.strings.call.removedFromCallTitle}\n moreDetails={locale.strings.call.removedFromCallMoreDetails}\n dataUiId={'removed-from-call-page'}\n />\n );\n break;\n case 'joinCallFailedDueToNoNetwork':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageJoinCallFailedDueToNoNetwork\"\n title={locale.strings.call.failedToJoinCallDueToNoNetworkTitle}\n moreDetails={locale.strings.call.failedToJoinCallDueToNoNetworkMoreDetails}\n dataUiId={'join-call-failed-due-to-no-network-page'}\n />\n );\n break;\n case 'leaving':\n pageElement = (\n <NoticePage\n title={locale.strings.call.leavingCallTitle ?? 'Leaving...'}\n dataUiId={'leaving-page'}\n pageStyle={leavePageStyle}\n disableStartCallButton={true}\n />\n );\n break;\n case 'badRequest': {\n const { title, moreDetails, disableStartCallButton, iconName } = getEndedCallPageProps(locale, endedCall);\n pageElement = (\n <NoticePage\n iconName={iconName}\n title={title}\n moreDetails={callees ? '' : moreDetails}\n dataUiId={'left-call-page'}\n disableStartCallButton={disableStartCallButton}\n />\n );\n break;\n }\n case 'leftCall': {\n const { title, moreDetails, disableStartCallButton, iconName } = getEndedCallPageProps(locale, endedCall);\n if (!props.options?.surveyOptions?.disableSurvey) {\n pageElement = (\n <SurveyPage\n dataUiId={'left-call-page'}\n surveyOptions={props.options?.surveyOptions}\n iconName={iconName}\n title={title}\n moreDetails={moreDetails}\n disableStartCallButton={disableStartCallButton}\n mobileView={props.mobileView}\n />\n );\n break;\n }\n pageElement = (\n <NoticePage\n iconName={iconName}\n title={title}\n moreDetails={callees ? '' : moreDetails}\n dataUiId={'left-call-page'}\n disableStartCallButton={disableStartCallButton}\n />\n );\n\n break;\n }\n case 'lobby':\n pageElement = (\n <LobbyPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n );\n break;\n case 'transferring':\n pageElement = (\n <TransferPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n );\n break;\n case 'call':\n pageElement = (\n <CallPage\n callInvitationURL={callInvitationUrl}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={onFetchParticipantMenuItems}\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onCloseChatPane={props.onCloseChatPane}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n galleryLayout={userSetGalleryLayout}\n onUserSetGalleryLayoutChange={setUserSetGalleryLayout}\n onSetUserSetOverflowGalleryPosition={setUserSetOverflowGalleryPosition}\n userSetOverflowGalleryPosition={userSetOverflowGalleryPosition}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n pinnedParticipants={pinnedParticipants}\n setPinnedParticipants={setPinnedParticipants}\n compositeAudioContext={compositeAudioContext}\n disableAutoShowDtmfDialer={props.options?.disableAutoShowDtmfDialer}\n />\n );\n break;\n case 'hold':\n pageElement = (\n <>\n {\n <HoldPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n }\n </>\n );\n break;\n }\n\n useEndedCallConsoleErrors(endedCall);\n\n /* @conditional-compile-remove(unsupported-browser) */\n const environmentInfo = useSelector(getEnvironmentInfo);\n\n /* @conditional-compile-remove(unsupported-browser) */\n switch (page) {\n case 'unsupportedEnvironment':\n pageElement = (\n <>\n {\n /* @conditional-compile-remove(unsupported-browser) */\n <UnsupportedBrowserPage\n onTroubleshootingClick={props.options?.onEnvironmentInfoTroubleshootingClick}\n environmentInfo={environmentInfo}\n />\n }\n </>\n );\n break;\n }\n\n if (!pageElement) {\n throw new Error('Invalid call composite page');\n }\n\n return (\n <SidePaneProvider sidePaneRenderer={sidePaneRenderer} overrideSidePane={injectedSidePaneProps}>\n {pageElement}\n </SidePaneProvider>\n );\n};\n\n/**\n * A customizable UI composite for calling experience.\n *\n * @remarks Call composite min width/height are as follow:\n * - mobile: 17.5rem x 21rem (280px x 336px, with default rem at 16px)\n * - desktop: 30rem x 22rem (480px x 352px, with default rem at 16px)\n *\n * @public\n */\nexport const CallComposite = (props: CallCompositeProps): JSX.Element => <CallCompositeInner {...props} />;\n\n/**\n * @private\n */\nexport interface InternalCallCompositeProps {\n overrideSidePane?: InjectedSidePaneProps;\n onSidePaneIdChange?: (sidePaneId: string | undefined) => void;\n onCloseChatPane?: () => void;\n // legacy property to avoid breaking change\n mobileChatTabHeader?: MobileChatSidePaneTabHeaderProps;\n}\n\n/** @private */\nexport const CallCompositeInner = (props: CallCompositeProps & InternalCallCompositeProps): JSX.Element => {\n const {\n adapter,\n callInvitationUrl,\n onFetchAvatarPersonaData,\n onFetchParticipantMenuItems,\n options,\n formFactor = 'desktop'\n } = props;\n\n const mobileView = formFactor === 'mobile';\n\n const modalLayerHostId = useId('modalLayerhost');\n const mainScreenContainerClassName = useMemo(() => {\n return mobileView ? mainScreenContainerStyleMobile : mainScreenContainerStyleDesktop;\n }, [mobileView]);\n\n return (\n <div className={mainScreenContainerClassName}>\n <BaseProvider {...props}>\n <CallAdapterProvider adapter={adapter}>\n <MainScreen\n callInvitationUrl={callInvitationUrl}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={onFetchParticipantMenuItems}\n mobileView={mobileView}\n modalLayerHostId={modalLayerHostId}\n options={options}\n onSidePaneIdChange={props.onSidePaneIdChange}\n overrideSidePane={props.overrideSidePane}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onCloseChatPane={props.onCloseChatPane}\n />\n {\n // This layer host is for ModalLocalAndRemotePIP in SidePane. This LayerHost cannot be inside the SidePane\n // because when the SidePane is hidden, ie. style property display is 'none', it takes up no space. This causes problems when dragging\n // the Modal because the draggable bounds thinks it has no space and will always return to its initial position after dragging.\n // Additionally, this layer host cannot be in the Call Arrangement as it needs to be rendered before useMinMaxDragPosition() in\n // common/utils useRef is called.\n // Warning: this is fragile and works because the call arrangement page is only rendered after the call has connected and thus this\n // LayerHost will be guaranteed to have rendered (and subsequently mounted in the DOM). This ensures the DOM element will be available\n // before the call to `document.getElementById(modalLayerHostId)` is made.\n <LayerHost id={modalLayerHostId} className={mergeStyles(modalLayerHostStyle)} />\n }\n </CallAdapterProvider>\n </BaseProvider>\n </div>\n );\n};\n\nconst getQueryOptions = (options: { role?: ParticipantRole }): PermissionConstraints => {\n if (options.role === 'Consumer') {\n return {\n video: false,\n audio: true\n };\n }\n return { video: true, audio: true };\n};\n"]}
|
1
|
+
{"version":3,"file":"CallComposite.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/CallComposite/CallComposite.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,EAEL,QAAQ,EAER,QAAQ,EAET,yCAAmC;AAEpC,OAAO,EAAsB,iBAAiB,EAAE,yCAAmC;AAEnF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,mBAAmB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AmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,eAAe,EAAE,KAAK,CAAC,eAAe,GACtC;gBAEA,0GAA0G;gBAC1G,sIAAsI;gBACtI,+HAA+H;gBAC/H,+HAA+H;gBAC/H,iCAAiC;gBACjC,mIAAmI;gBACnI,sIAAsI;gBACtI,0EAA0E;gBAC1E,oBAAC,SAAS,IAAC,EAAE,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,CAAC,mBAAmB,CAAC,GAAI,CAE9D,CACT,CACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,OAAmC,EAAyB,EAAE;IACrF,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,IAAI;SACZ,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { _isInCall } from '@internal/calling-component-bindings';\nimport {\n ActiveErrorMessage,\n ErrorBar,\n ParticipantMenuItemsCallback,\n useTheme,\n VideoTilesOptions\n} from '@internal/react-components';\n\nimport { ActiveNotification, NotificationStack } from '@internal/react-components';\nimport { CallSurveyImprovementSuggestions } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { AvatarPersonaDataCallback } from '../common/AvatarPersona';\nimport { BaseProvider, BaseCompositeProps } from '../common/BaseComposite';\nimport { CallCompositeIcons } from '../common/icons';\nimport { useLocale } from '../localization';\nimport { CommonCallAdapter, StartCallIdentifier } from './adapter/CallAdapter';\nimport { CallAdapterProvider, useAdapter } from './adapter/CallAdapterProvider';\nimport { CallPage } from './pages/CallPage';\nimport { ConfigurationPage } from './pages/ConfigurationPage';\nimport { NoticePage } from './pages/NoticePage';\nimport { useSelector } from './hooks/useSelector';\nimport { getAlternateCallerId, getEndedCall, getPage, getRole, getTargetCallees } from './selectors/baseSelectors';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { getEnvironmentInfo } from './selectors/baseSelectors';\nimport { LobbyPage } from './pages/LobbyPage';\nimport { TransferPage } from './pages/TransferPage';\nimport {\n leavingPageStyle,\n mainScreenContainerStyleDesktop,\n mainScreenContainerStyleMobile\n} from './styles/CallComposite.styles';\nimport { CallControlOptions } from './types/CallControlOptions';\n\nimport { LayerHost, mergeStyles } from '@fluentui/react';\nimport { modalLayerHostStyle } from '../common/styles/ModalLocalAndRemotePIP.styles';\nimport { useId } from '@fluentui/react-hooks';\nimport { HoldPage } from './pages/HoldPage';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { UnsupportedBrowserPage } from './pages/UnsupportedBrowser';\nimport { CallSurvey } from '@azure/communication-calling';\nimport { ParticipantRole, PermissionConstraints } from '@azure/communication-calling';\nimport { MobileChatSidePaneTabHeaderProps } from '../common/TabHeader';\nimport { InjectedSidePaneProps, SidePaneProvider, SidePaneRenderer } from './components/SidePane/SidePaneProvider';\nimport {\n filterLatestNotifications,\n getEndedCallPageProps,\n trackNotificationAsDismissed,\n updateTrackedNotificationsWithActiveNotifications\n} from './utils';\n\nimport { CachedComplianceNotificationProps, computeComplianceNotification } from './utils';\nimport { TrackedNotifications } from './types/ErrorTracking';\nimport { usePropsFor } from './hooks/usePropsFor';\nimport { deviceCountSelector } from './selectors/deviceCountSelector';\nimport { VideoGalleryLayout } from '@internal/react-components';\nimport { capabilitiesChangedInfoAndRoleSelector } from './selectors/capabilitiesChangedInfoAndRoleSelector';\nimport { useTrackedCapabilityChangedNotifications } from './utils/TrackCapabilityChangedNotifications';\nimport { useEndedCallConsoleErrors } from './utils/useConsoleErrors';\nimport { SurveyPage } from './pages/SurveyPage';\nimport { useAudio } from '../common/AudioProvider';\n\nimport { complianceBannerSelector } from './selectors/complianceBannerSelector';\nimport { devicePermissionSelector } from './selectors/devicePermissionSelector';\n\n/**\n * Props for {@link CallComposite}.\n *\n * @public\n */\nexport interface CallCompositeProps extends BaseCompositeProps<CallCompositeIcons> {\n /**\n * An adapter provides logic and data to the composite.\n * Composite can also be controlled using the adapter.\n */\n adapter: CommonCallAdapter;\n /**\n * Optimizes the composite form factor for either desktop or mobile.\n * @remarks `mobile` is currently only optimized for Portrait mode on mobile devices and does not support landscape.\n * @defaultValue 'desktop'\n */\n formFactor?: 'desktop' | 'mobile';\n /**\n * URL to invite new participants to the current call. If this is supplied, a button appears in the Participants\n * Button flyout menu.\n */\n callInvitationUrl?: string;\n /**\n * Flags to enable/disable or customize UI elements of the {@link CallComposite}.\n */\n options?: CallCompositeOptions;\n}\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * Device Checks.\n * Choose whether or not to block starting a call depending on camera and microphone permission options.\n *\n * @beta\n */\nexport interface DeviceCheckOptions {\n /**\n * Camera Permission prompts for your call.\n * 'required' - requires the permission to be allowed before permitting the user join the call.\n * 'optional' - permission can be disallowed and the user is still permitted to join the call.\n * 'doNotPrompt' - permission is not required and the user is not prompted to allow the permission.\n */\n camera: 'required' | 'optional' | 'doNotPrompt';\n /**\n * Microphone permission prompts for your call.\n * 'required' - requires the permission to be allowed before permitting the user join the call.\n * 'optional' - permission can be disallowed and the user is still permitted to join the call.\n * 'doNotPrompt' - permission is not required and the user is not prompted to allow the permission.\n */\n microphone: 'required' | 'optional' | 'doNotPrompt';\n}\n\n/**\n * Menu options for remote video tiles in {@link VideoGallery}.\n *\n * @public\n */\nexport interface RemoteVideoTileMenuOptions {\n /**\n * If set to true, remote video tiles in the VideoGallery will not have menu options\n *\n * @defaultValue false\n */\n isHidden?: boolean;\n}\n\n/**\n * Options for the local video tile in the Call composite.\n *\n * @public\n */\nexport interface LocalVideoTileOptions {\n /**\n * Position of the local video tile. If unset will render the local tile in the floating local position.\n *\n * @defaultValue 'floating'\n * @remarks 'grid' - local video tile will be rendered in the grid view of the videoGallery.\n * 'floating' - local video tile will be rendered in the floating position and will observe overflow gallery\n * local video tile rules and be docked in the bottom corner.\n * This does not affect the Configuration screen or the side pane Picture in Picture in Picture view.\n */\n position?: 'grid' | 'floating';\n}\n/**\n * Optional features of the {@link CallComposite}.\n *\n * @public\n */\nexport type CallCompositeOptions = {\n captionsBanner?: {\n height: 'full' | 'default';\n };\n /**\n * Surface Azure Communication Services backend errors in the UI with {@link @azure/communication-react#ErrorBar}.\n * Hide or show the error bar.\n * @defaultValue true\n */\n errorBar?: boolean;\n /**\n * Hide or Customize the control bar element.\n * Can be customized by providing an object of type {@link @azure/communication-react#CallControlOptions}.\n * @defaultValue true\n */\n callControls?: boolean | CallControlOptions;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Device permissions check options for your call.\n * Here you can choose what device permissions you prompt the user for,\n * as well as what device permissions must be accepted before starting a call.\n */\n deviceChecks?: DeviceCheckOptions;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Callback you may provide to supply users with further steps to troubleshoot why they have been\n * unable to grant your site the required permissions for the call.\n *\n * @example\n * ```ts\n * onPermissionsTroubleshootingClick: () =>\n * window.open('https://contoso.com/permissions-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a 'further troubleshooting' link.\n */\n onPermissionsTroubleshootingClick?: (permissionsState: {\n camera: PermissionState;\n microphone: PermissionState;\n }) => void;\n /* @conditional-compile-remove(call-readiness) */\n /**\n * Callback you may provide to supply users with further steps to troubleshoot why they have been\n * having network issues when connecting to the call.\n *\n * @example\n * ```ts\n * onNetworkingTroubleShootingClick?: () =>\n * window.open('https://contoso.com/network-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a 'network troubleshooting' link.\n */\n onNetworkingTroubleShootingClick?: () => void;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Callback you may provide to supply users with a provided page to showcase supported browsers by ACS.\n *\n * @example\n * ```ts\n * onBrowserTroubleShootingClick?: () =>\n * window.open('https://contoso.com/browser-troubleshooting', '_blank');\n * ```\n *\n * @remarks\n * if this is not supplied, the composite will not show a unsupported browser page.\n */\n onEnvironmentInfoTroubleshootingClick?: () => void;\n /**\n * Remote participant video tile menu options\n */\n remoteVideoTileMenuOptions?: RemoteVideoTileMenuOptions;\n /**\n * Options for controlling the local video tile.\n *\n * @remarks if 'false' the local video tile will not be rendered.\n */\n localVideoTile?: boolean | LocalVideoTileOptions;\n /**\n * Options for controlling video tile.\n */\n videoTilesOptions?: VideoTilesOptions;\n /**\n * Whether to auto show the DTMF Dialer when the call starts in supported scenarios.\n * - Teams Voice Application like Call queue or Auto Attendant\n * - PSTN Calls\n * @defaultValue false\n */\n disableAutoShowDtmfDialer?: boolean;\n /**\n * Options for controlling the starting layout of the composite's video gallery\n */\n galleryOptions?: {\n /**\n * Layout for the gallery when the call starts\n */\n layout?: VideoGalleryLayout;\n };\n /**\n * Options for end of call survey\n */\n surveyOptions?: {\n /**\n * Disable call survey at the end of a call.\n * @defaultValue false\n */\n disableSurvey?: boolean;\n /**\n * Optional callback to redirect users to custom screens when survey is done, note that default end call screen will be shown if this callback is not provided\n * This callback can be used to redirect users to different screens depending on survey state, whether it is submitted, skipped or has a problem when submitting the survey\n */\n onSurveyClosed?: (surveyState: 'sent' | 'skipped' | 'error', surveyError?: string) => void;\n /**\n * Optional callback to handle survey data including free form text response\n * Note that free form text response survey option is only going to be enabled when this callback is provided\n * User will need to handle all free form text response on their own\n */\n onSurveySubmitted?: (\n callId: string,\n surveyId: string,\n /**\n * This is the survey results containing star survey data and API tag survey data.\n * This part of the result will always be sent to the calling sdk\n * This callback provides user with the ability to gain access to survey data\n */\n submittedSurvey: CallSurvey,\n /**\n * This is the survey results containing free form text\n * This part of the result will not be handled by composites\n * User will need to collect and handle this information 100% on their own\n * Free form text survey is not going to show in the UI if onSurveySubmitted is not populated\n */\n improvementSuggestions: CallSurveyImprovementSuggestions\n ) => Promise<void>;\n };\n /**\n * Options for setting additional customizations related to personalized branding.\n */\n branding?: {\n /**\n * Logo displayed on the configuration page.\n */\n logo?: {\n /**\n * URL for the logo image.\n *\n * @remarks\n * Recommended size is 80x80 pixels.\n */\n url: string;\n /**\n * Alt text for the logo image.\n */\n alt?: string;\n /**\n * The logo can be displayed as a circle.\n *\n * @defaultValue 'unset'\n */\n shape?: 'unset' | 'circle';\n };\n /**\n * Background image displayed on the configuration page.\n */\n backgroundImage?: {\n /**\n * URL for the background image.\n *\n * @remarks\n * Background image should be larger than 576x567 pixels and smaller than 2048x2048 pixels pixels.\n */\n url: string;\n };\n };\n /**\n * Options for settings related to spotlight.\n */\n spotlight?: {\n /**\n * Flag to hide the menu buttons to start and stop spotlight for remote participants and the local participant.\n * @defaultValue false\n */\n hideSpotlightButtons?: boolean;\n };\n};\n\ntype MainScreenProps = {\n mobileView: boolean;\n modalLayerHostId: string;\n callInvitationUrl?: string;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n options?: CallCompositeOptions;\n overrideSidePane?: InjectedSidePaneProps;\n onSidePaneIdChange?: (sidePaneId: string | undefined) => void;\n mobileChatTabHeader?: MobileChatSidePaneTabHeaderProps;\n onCloseChatPane?: () => void;\n};\n\nconst isShowing = (overrideSidePane?: InjectedSidePaneProps): boolean => {\n return !!overrideSidePane?.isActive;\n};\n\nconst MainScreen = (props: MainScreenProps): JSX.Element => {\n const adapter = useAdapter();\n const { camerasCount, microphonesCount } = useSelector(deviceCountSelector);\n const hasCameras = camerasCount > 0;\n const hasMicrophones = microphonesCount > 0;\n\n const role = useSelector(getRole);\n const { video: cameraHasPermission, audio: micHasPermission } = useSelector(devicePermissionSelector);\n\n useEffect(() => {\n (async () => {\n const constrain = getQueryOptions({ role });\n /* @conditional-compile-remove(call-readiness) */\n {\n constrain.audio = props.options?.deviceChecks?.microphone === 'doNotPrompt' ? false : constrain.audio;\n constrain.video = props.options?.deviceChecks?.camera === 'doNotPrompt' ? false : constrain.video;\n }\n const permissionsResult = await adapter.askDevicePermission(constrain);\n if (permissionsResult?.audio) {\n adapter.queryMicrophones();\n }\n if (permissionsResult?.video) {\n adapter.queryCameras();\n }\n adapter.querySpeakers();\n })();\n }, [\n adapter,\n role,\n /* @conditional-compile-remove(call-readiness) */\n props.options?.deviceChecks,\n // Ensure we re-ask for permissions if the number of devices goes from 0 -> n during a call\n // as we cannot request permissions when there are no devices.\n hasCameras,\n hasMicrophones,\n // Ensure we re-query for devices when permission for the device is granted.\n cameraHasPermission,\n micHasPermission\n ]);\n\n const { callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems } = props;\n const page = useSelector(getPage);\n const endedCall = useSelector(getEndedCall);\n\n const [sidePaneRenderer, setSidePaneRenderer] = React.useState<SidePaneRenderer | undefined>();\n const [injectedSidePaneProps, setInjectedSidePaneProps] = React.useState<InjectedSidePaneProps>();\n const [userSetGalleryLayout, setUserSetGalleryLayout] = useState<VideoGalleryLayout>(\n props.options?.galleryOptions?.layout ?? 'floatingLocalVideo'\n );\n const [userSetOverflowGalleryPosition, setUserSetOverflowGalleryPosition] = useState<'Responsive' | 'horizontalTop'>(\n 'Responsive'\n );\n\n const overridePropsRef = useRef<InjectedSidePaneProps | undefined>(props.overrideSidePane);\n useEffect(() => {\n setInjectedSidePaneProps(props.overrideSidePane);\n // When the injected side pane is opened, clear the previous side pane active state.\n // this ensures when the injected side pane is \"closed\", the previous side pane is not \"re-opened\".\n if (!isShowing(overridePropsRef.current) && isShowing(props.overrideSidePane)) {\n setSidePaneRenderer(undefined);\n }\n overridePropsRef.current = props.overrideSidePane;\n }, [props.overrideSidePane]);\n\n const onSidePaneIdChange = props.onSidePaneIdChange;\n useEffect(() => {\n onSidePaneIdChange?.(sidePaneRenderer?.id);\n }, [sidePaneRenderer?.id, onSidePaneIdChange]);\n\n // When the call ends ensure the side pane is set to closed to prevent the side pane being open if the call is re-joined.\n useEffect(() => {\n const closeSidePane = (): void => {\n setSidePaneRenderer(undefined);\n };\n adapter.on('callEnded', closeSidePane);\n return () => {\n adapter.off('callEnded', closeSidePane);\n };\n }, [adapter]);\n\n const compositeAudioContext = useAudio();\n\n const capabilitiesChangedInfoAndRole = useSelector(capabilitiesChangedInfoAndRoleSelector);\n\n const capabilitiesChangedNotificationBarProps =\n useTrackedCapabilityChangedNotifications(capabilitiesChangedInfoAndRole);\n\n // Track the last dismissed errors of any error kind to prevent errors from re-appearing on subsequent page navigation\n // This works by tracking the most recent timestamp of any active error type.\n // And then tracking when that error type was last dismissed.\n const activeErrors = usePropsFor(ErrorBar).activeErrorMessages;\n\n const activeInCallErrors = usePropsFor(NotificationStack).activeErrorMessages;\n\n const activeNotifications = usePropsFor(NotificationStack).activeNotifications;\n\n const complianceProps = useSelector(complianceBannerSelector);\n\n const cachedProps = useRef<CachedComplianceNotificationProps>({\n latestBooleanState: {\n callTranscribeState: false,\n callRecordState: false\n },\n latestStringState: {\n callTranscribeState: 'off',\n callRecordState: 'off'\n },\n lastUpdated: Date.now()\n });\n\n const complianceNotification: ActiveNotification | undefined = useMemo(() => {\n return computeComplianceNotification(complianceProps, cachedProps);\n }, [complianceProps, cachedProps]);\n\n useEffect(() => {\n if (complianceNotification) {\n activeNotifications.forEach((notification, index) => {\n if (\n [\n 'recordingStarted',\n 'transcriptionStarted',\n 'recordingStopped',\n 'transcriptionStopped',\n 'recordingAndTranscriptionStarted',\n 'recordingAndTranscriptionStopped',\n 'recordingStoppedStillTranscribing',\n 'transcriptionStoppedStillRecording'\n ].includes(notification.type)\n ) {\n activeNotifications.splice(index, 1);\n }\n });\n activeNotifications.push(complianceNotification);\n }\n setTrackedNotifications((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeNotifications));\n }, [complianceNotification, activeNotifications]);\n\n const [trackedErrors, setTrackedErrors] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n const [trackedInCallErrors, setTrackedInCallErrors] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n const [trackedNotifications, setTrackedNotifications] = useState<TrackedNotifications>({} as TrackedNotifications);\n\n useEffect(() => {\n setTrackedErrors((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeErrors));\n\n setTrackedInCallErrors((prev) => updateTrackedNotificationsWithActiveNotifications(prev, activeInCallErrors));\n }, [activeErrors, activeInCallErrors]);\n\n const onDismissError = useCallback((error: ActiveErrorMessage | ActiveNotification) => {\n setTrackedErrors((prev) => trackNotificationAsDismissed(error.type, prev));\n\n setTrackedInCallErrors((prev) => trackNotificationAsDismissed(error.type, prev));\n }, []);\n\n const onDismissNotification = useCallback((notification: ActiveNotification) => {\n setTrackedNotifications((prev) => trackNotificationAsDismissed(notification.type, prev));\n }, []);\n const latestErrors = useMemo(\n () => filterLatestNotifications(activeErrors, trackedErrors),\n [activeErrors, trackedErrors]\n );\n\n const latestInCallErrors = useMemo(\n () => filterLatestNotifications(activeInCallErrors, trackedInCallErrors),\n [activeInCallErrors, trackedInCallErrors]\n ) as ActiveNotification[];\n\n const latestNotifications = useMemo(() => {\n const result = filterLatestNotifications(activeNotifications, trackedNotifications);\n // sort notifications by timestamp from earliest to latest\n result.sort(\n (a, b) => (a.timestamp ?? new Date(Date.now())).getTime() - (b.timestamp ?? new Date(Date.now())).getTime()\n );\n return result;\n }, [activeNotifications, trackedNotifications]) as ActiveNotification[];\n\n const callees = useSelector(getTargetCallees) as StartCallIdentifier[];\n const locale = useLocale();\n const palette = useTheme().palette;\n const alternateCallerId = useSelector(getAlternateCallerId);\n const leavePageStyle = useMemo(() => leavingPageStyle(palette), [palette]);\n let pageElement: JSX.Element | undefined;\n const [pinnedParticipants, setPinnedParticipants] = useState<string[]>([]);\n switch (page) {\n case 'configuration':\n pageElement = (\n <ConfigurationPage\n mobileView={props.mobileView}\n startCallHandler={(): void => {\n if (callees) {\n adapter.startCall(\n callees,\n alternateCallerId ? { alternateCallerId: { phoneNumber: alternateCallerId } } : {}\n );\n } else {\n adapter.joinCall({\n microphoneOn: 'keep',\n cameraOn: 'keep'\n });\n }\n }}\n updateSidePaneRenderer={setSidePaneRenderer}\n latestErrors={latestErrors as ActiveErrorMessage[]}\n onDismissError={onDismissError}\n modalLayerHostId={props.modalLayerHostId}\n /* @conditional-compile-remove(call-readiness) */\n deviceChecks={props.options?.deviceChecks}\n /* @conditional-compile-remove(call-readiness) */\n onPermissionsTroubleshootingClick={props.options?.onPermissionsTroubleshootingClick}\n /* @conditional-compile-remove(call-readiness) */\n onNetworkingTroubleShootingClick={props.options?.onNetworkingTroubleShootingClick}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n logo={props.options?.branding?.logo}\n backgroundImage={props.options?.branding?.backgroundImage}\n />\n );\n break;\n case 'accessDeniedTeamsMeeting':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageAccessDeniedTeamsMeeting\"\n title={locale.strings.call.failedToJoinTeamsMeetingReasonAccessDeniedTitle}\n moreDetails={locale.strings.call.failedToJoinTeamsMeetingReasonAccessDeniedMoreDetails}\n dataUiId={'access-denied-teams-meeting-page'}\n />\n );\n break;\n case 'removedFromCall':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageRemovedFromCall\"\n title={locale.strings.call.removedFromCallTitle}\n moreDetails={locale.strings.call.removedFromCallMoreDetails}\n dataUiId={'removed-from-call-page'}\n />\n );\n break;\n case 'joinCallFailedDueToNoNetwork':\n pageElement = (\n <NoticePage\n iconName=\"NoticePageJoinCallFailedDueToNoNetwork\"\n title={locale.strings.call.failedToJoinCallDueToNoNetworkTitle}\n moreDetails={locale.strings.call.failedToJoinCallDueToNoNetworkMoreDetails}\n dataUiId={'join-call-failed-due-to-no-network-page'}\n />\n );\n break;\n case 'leaving':\n pageElement = (\n <NoticePage\n title={locale.strings.call.leavingCallTitle ?? 'Leaving...'}\n dataUiId={'leaving-page'}\n pageStyle={leavePageStyle}\n disableStartCallButton={true}\n />\n );\n break;\n case 'badRequest': {\n const { title, moreDetails, disableStartCallButton, iconName } = getEndedCallPageProps(locale, endedCall);\n pageElement = (\n <NoticePage\n iconName={iconName}\n title={title}\n moreDetails={callees ? '' : moreDetails}\n dataUiId={'left-call-page'}\n disableStartCallButton={disableStartCallButton}\n />\n );\n break;\n }\n case 'leftCall': {\n const { title, moreDetails, disableStartCallButton, iconName } = getEndedCallPageProps(locale, endedCall);\n if (!props.options?.surveyOptions?.disableSurvey) {\n pageElement = (\n <SurveyPage\n dataUiId={'left-call-page'}\n surveyOptions={props.options?.surveyOptions}\n iconName={iconName}\n title={title}\n moreDetails={moreDetails}\n disableStartCallButton={disableStartCallButton}\n mobileView={props.mobileView}\n />\n );\n break;\n }\n pageElement = (\n <NoticePage\n iconName={iconName}\n title={title}\n moreDetails={callees ? '' : moreDetails}\n dataUiId={'left-call-page'}\n disableStartCallButton={disableStartCallButton}\n />\n );\n\n break;\n }\n case 'lobby':\n pageElement = (\n <LobbyPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n );\n break;\n case 'transferring':\n pageElement = (\n <TransferPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n );\n break;\n case 'call':\n pageElement = (\n <CallPage\n callInvitationURL={callInvitationUrl}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={onFetchParticipantMenuItems}\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onCloseChatPane={props.onCloseChatPane}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n galleryLayout={userSetGalleryLayout}\n onUserSetGalleryLayoutChange={setUserSetGalleryLayout}\n onSetUserSetOverflowGalleryPosition={setUserSetOverflowGalleryPosition}\n userSetOverflowGalleryPosition={userSetOverflowGalleryPosition}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n pinnedParticipants={pinnedParticipants}\n setPinnedParticipants={setPinnedParticipants}\n compositeAudioContext={compositeAudioContext}\n disableAutoShowDtmfDialer={props.options?.disableAutoShowDtmfDialer}\n />\n );\n break;\n case 'hold':\n pageElement = (\n <>\n {\n <HoldPage\n mobileView={props.mobileView}\n modalLayerHostId={props.modalLayerHostId}\n options={props.options}\n updateSidePaneRenderer={setSidePaneRenderer}\n mobileChatTabHeader={props.mobileChatTabHeader}\n latestErrors={latestInCallErrors}\n latestNotifications={latestNotifications}\n onDismissError={onDismissError}\n onDismissNotification={onDismissNotification}\n capabilitiesChangedNotificationBarProps={capabilitiesChangedNotificationBarProps}\n />\n }\n </>\n );\n break;\n }\n\n useEndedCallConsoleErrors(endedCall);\n\n /* @conditional-compile-remove(unsupported-browser) */\n const environmentInfo = useSelector(getEnvironmentInfo);\n\n /* @conditional-compile-remove(unsupported-browser) */\n switch (page) {\n case 'unsupportedEnvironment':\n pageElement = (\n <>\n {\n /* @conditional-compile-remove(unsupported-browser) */\n <UnsupportedBrowserPage\n onTroubleshootingClick={props.options?.onEnvironmentInfoTroubleshootingClick}\n environmentInfo={environmentInfo}\n />\n }\n </>\n );\n break;\n }\n\n if (!pageElement) {\n throw new Error('Invalid call composite page');\n }\n\n return (\n <SidePaneProvider sidePaneRenderer={sidePaneRenderer} overrideSidePane={injectedSidePaneProps}>\n {pageElement}\n </SidePaneProvider>\n );\n};\n\n/**\n * A customizable UI composite for calling experience.\n *\n * @remarks Call composite min width/height are as follow:\n * - mobile: 17.5rem x 21rem (280px x 336px, with default rem at 16px)\n * - desktop: 30rem x 22rem (480px x 352px, with default rem at 16px)\n *\n * @public\n */\nexport const CallComposite = (props: CallCompositeProps): JSX.Element => <CallCompositeInner {...props} />;\n\n/**\n * @private\n */\nexport interface InternalCallCompositeProps {\n overrideSidePane?: InjectedSidePaneProps;\n onSidePaneIdChange?: (sidePaneId: string | undefined) => void;\n onCloseChatPane?: () => void;\n // legacy property to avoid breaking change\n mobileChatTabHeader?: MobileChatSidePaneTabHeaderProps;\n}\n\n/** @private */\nexport const CallCompositeInner = (props: CallCompositeProps & InternalCallCompositeProps): JSX.Element => {\n const {\n adapter,\n callInvitationUrl,\n onFetchAvatarPersonaData,\n onFetchParticipantMenuItems,\n options,\n formFactor = 'desktop'\n } = props;\n\n const mobileView = formFactor === 'mobile';\n\n const modalLayerHostId = useId('modalLayerhost');\n const mainScreenContainerClassName = useMemo(() => {\n return mobileView ? mainScreenContainerStyleMobile : mainScreenContainerStyleDesktop;\n }, [mobileView]);\n\n return (\n <div className={mainScreenContainerClassName}>\n <BaseProvider {...props}>\n <CallAdapterProvider adapter={adapter}>\n <MainScreen\n callInvitationUrl={callInvitationUrl}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={onFetchParticipantMenuItems}\n mobileView={mobileView}\n modalLayerHostId={modalLayerHostId}\n options={options}\n onSidePaneIdChange={props.onSidePaneIdChange}\n overrideSidePane={props.overrideSidePane}\n mobileChatTabHeader={props.mobileChatTabHeader}\n onCloseChatPane={props.onCloseChatPane}\n />\n {\n // This layer host is for ModalLocalAndRemotePIP in SidePane. This LayerHost cannot be inside the SidePane\n // because when the SidePane is hidden, ie. style property display is 'none', it takes up no space. This causes problems when dragging\n // the Modal because the draggable bounds thinks it has no space and will always return to its initial position after dragging.\n // Additionally, this layer host cannot be in the Call Arrangement as it needs to be rendered before useMinMaxDragPosition() in\n // common/utils useRef is called.\n // Warning: this is fragile and works because the call arrangement page is only rendered after the call has connected and thus this\n // LayerHost will be guaranteed to have rendered (and subsequently mounted in the DOM). This ensures the DOM element will be available\n // before the call to `document.getElementById(modalLayerHostId)` is made.\n <LayerHost id={modalLayerHostId} className={mergeStyles(modalLayerHostStyle)} />\n }\n </CallAdapterProvider>\n </BaseProvider>\n </div>\n );\n};\n\nconst getQueryOptions = (options: { role?: ParticipantRole }): PermissionConstraints => {\n if (options.role === 'Consumer') {\n return {\n video: false,\n audio: true\n };\n }\n return { video: true, audio: true };\n};\n"]}
|
@@ -3,6 +3,7 @@ import { _TelemetryImplementationHint } from "../../../../../acs-ui-common/src";
|
|
3
3
|
import { CallAgent, GroupCallLocator, TeamsMeetingLinkLocator, AudioDeviceInfo, VideoDeviceInfo, PermissionConstraints, PropertyChangedEvent, RoomCallLocator, StartCallOptions, Call } from '@azure/communication-calling';
|
4
4
|
import { TeamsMeetingIdLocator } from '@azure/communication-calling';
|
5
5
|
import { Reaction } from '@azure/communication-calling';
|
6
|
+
import type { DeviceAccess } from '@azure/communication-calling';
|
6
7
|
import { TeamsCallAgent } from '@azure/communication-calling';
|
7
8
|
import { AddPhoneNumberOptions } from '@azure/communication-calling';
|
8
9
|
import { DtmfTone } from '@azure/communication-calling';
|
@@ -59,7 +60,7 @@ export declare class AzureCommunicationCallAdapter<AgentType extends CallAgent |
|
|
59
60
|
queryCameras(): Promise<VideoDeviceInfo[]>;
|
60
61
|
queryMicrophones(): Promise<AudioDeviceInfo[]>;
|
61
62
|
querySpeakers(): Promise<AudioDeviceInfo[]>;
|
62
|
-
askDevicePermission(constrain: PermissionConstraints): Promise<
|
63
|
+
askDevicePermission(constrain: PermissionConstraints): Promise<DeviceAccess>;
|
63
64
|
joinCall(options?: boolean | JoinCallOptions): CallTypeOf<AgentType> | undefined;
|
64
65
|
private _joinCall;
|
65
66
|
createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void | CreateVideoStreamViewResult>;
|