@azure/communication-react 1.19.0-alpha-202409060015 → 1.19.0-alpha-202409100015

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.
Files changed (99) hide show
  1. package/dist/communication-react.d.ts +58 -41
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-d2PFi3-l.js → ChatMessageComponentAsRichTextEditBox-eCfb0qTc.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-d2PFi3-l.js.map → ChatMessageComponentAsRichTextEditBox-eCfb0qTc.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-DSiJTLwu.js → RichTextSendBoxWrapper-CrqNnQ4h.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-DSiJTLwu.js.map → RichTextSendBoxWrapper-CrqNnQ4h.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-CKU6pfS7.js → index-DSX_hUlh.js} +118 -134
  7. package/dist/dist-cjs/communication-react/index-DSX_hUlh.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +4 -0
  12. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  13. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +2 -2
  14. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/incomingCallStackSelector.d.ts +2 -2
  16. package/dist/dist-esm/calling-component-bindings/src/incomingCallStackSelector.js +1 -1
  17. package/dist/dist-esm/calling-component-bindings/src/incomingCallStackSelector.js.map +1 -1
  18. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +2 -2
  19. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -1
  21. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  22. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +1 -1
  23. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  24. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +1 -1
  25. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  26. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +1 -1
  27. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +1 -1
  28. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
  29. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +1 -1
  30. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +4 -5
  31. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  32. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +1 -1
  33. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  34. package/dist/dist-esm/react-components/src/components/HoldButton.d.ts +3 -3
  35. package/dist/dist-esm/react-components/src/components/HoldButton.js +1 -1
  36. package/dist/dist-esm/react-components/src/components/HoldButton.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/IncomingCallNotification.d.ts +4 -4
  38. package/dist/dist-esm/react-components/src/components/IncomingCallNotification.js +1 -1
  39. package/dist/dist-esm/react-components/src/components/IncomingCallNotification.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/IncomingCallStack.d.ts +3 -3
  41. package/dist/dist-esm/react-components/src/components/IncomingCallStack.js +1 -1
  42. package/dist/dist-esm/react-components/src/components/IncomingCallStack.js.map +1 -1
  43. package/dist/dist-esm/react-components/src/components/MicrophoneButton.d.ts +13 -8
  44. package/dist/dist-esm/react-components/src/components/MicrophoneButton.js +14 -16
  45. package/dist/dist-esm/react-components/src/components/MicrophoneButton.js.map +1 -1
  46. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +2 -14
  47. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +6 -21
  49. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.js +2 -14
  51. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.js.map +1 -1
  52. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js +6 -21
  53. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
  54. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +8 -0
  55. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +34 -0
  56. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  57. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +7 -0
  58. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +1 -1
  59. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js +3 -1
  60. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js.map +1 -1
  61. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -4
  62. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +1 -1
  63. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js.map +1 -1
  64. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +3 -2
  65. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +2 -2
  66. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  67. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +6 -6
  68. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  69. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.d.ts +1 -1
  70. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.js.map +1 -1
  71. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  72. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +1 -1
  73. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  74. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +1 -1
  75. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  76. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +2 -2
  77. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  78. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.d.ts +1 -0
  79. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js +1 -1
  80. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js.map +1 -1
  81. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SvgWithWordWrapping.d.ts +1 -0
  82. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SvgWithWordWrapping.js +2 -2
  83. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SvgWithWordWrapping.js.map +1 -1
  84. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +1 -1
  86. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  87. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -1
  88. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  89. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +4 -4
  90. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +11 -4
  92. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  93. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +1 -1
  94. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  95. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +1 -1
  96. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  97. package/dist/tsdoc-metadata.json +1 -1
  98. package/package.json +2 -1
  99. package/dist/dist-cjs/communication-react/index-CKU6pfS7.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAA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M,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.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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I,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,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ControlBarButtonProps } from './ControlBarButton';
3
3
  /**
4
- *@beta
4
+ *@public
5
5
  */
6
6
  export interface HoldButtonProps extends ControlBarButtonProps {
7
7
  /**
@@ -16,7 +16,7 @@ export interface HoldButtonProps extends ControlBarButtonProps {
16
16
  }
17
17
  /**
18
18
  * Strings for the hold button labels
19
- * @beta
19
+ * @public
20
20
  */
21
21
  export interface HoldButtonStrings {
22
22
  /**
@@ -43,7 +43,7 @@ export interface HoldButtonStrings {
43
43
  *
44
44
  * @param props - properties for the hold button.
45
45
  * @returns
46
- * @beta
46
+ * @public
47
47
  */
48
48
  export declare const HoldButton: (props: HoldButtonProps) => JSX.Element;
49
49
  //# sourceMappingURL=HoldButton.d.ts.map
@@ -10,7 +10,7 @@ import { _HighContrastAwareIcon } from './HighContrastAwareIcon';
10
10
  *
11
11
  * @param props - properties for the hold button.
12
12
  * @returns
13
- * @beta
13
+ * @public
14
14
  */
15
15
  export const HoldButton = (props) => {
16
16
  const { onToggleHold, strings } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"HoldButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/HoldButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAwCjE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAe,EAAE;IAChE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,gBAAgB,GAAG,GAAgB,EAAE;QACzC,OAAO,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAC,gBAAgB,GAAG,CAAC;IACxF,CAAC,CAAC;IACF,MAAM,kBAAkB,GAAG,GAAgB,EAAE;QAC3C,OAAO,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAC,YAAY,GAAG,CAAC;IACpF,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,oBACX,KAAK,IACT,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,KAAK,CAAC,OAAO,EACtC,cAAc,EAAE,kBAAkB,EAClC,eAAe,EAAE,gBAAgB,IACjC,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport React from 'react';\nimport { _HighContrastAwareIcon } from './HighContrastAwareIcon';\n\n/**\n *@beta\n */\nexport interface HoldButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with communication react handlers\n * Holds the call or resumes it based on call state.\n */\n onToggleHold: () => Promise<void>;\n /**\n * Optional strings to override in component\n */\n strings?: HoldButtonStrings;\n}\n\n/**\n * Strings for the hold button labels\n * @beta\n */\nexport interface HoldButtonStrings {\n /**\n * Label for when action is to resume call.\n */\n onLabel?: string;\n /**\n * Label for when action is to hold call.\n */\n offLabel?: string;\n /**\n * Content for when button is checked\n */\n tooltipOnContent?: string;\n /**\n * Content for when button is unchecked\n */\n tooltipOffContent?: string;\n}\n\n/**\n * a button to hold or resume a ongoing call.\n *\n * Can be used with {@link ControlBar}\n *\n * @param props - properties for the hold button.\n * @returns\n * @beta\n */\nexport const HoldButton = (props: HoldButtonProps): JSX.Element => {\n const { onToggleHold, strings } = props;\n\n const onRenderHoldIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={props.disabled} iconName=\"HoldCallButton\" />;\n };\n const onRenderResumeIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={props.disabled} iconName=\"ResumeCall\" />;\n };\n\n return (\n <ControlBarButton\n {...props}\n strings={strings}\n onClick={onToggleHold ?? props.onClick}\n onRenderOnIcon={onRenderResumeIcon}\n onRenderOffIcon={onRenderHoldIcon}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"HoldButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/HoldButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAwCjE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAe,EAAE;IAChE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,gBAAgB,GAAG,GAAgB,EAAE;QACzC,OAAO,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAC,gBAAgB,GAAG,CAAC;IACxF,CAAC,CAAC;IACF,MAAM,kBAAkB,GAAG,GAAgB,EAAE;QAC3C,OAAO,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAC,YAAY,GAAG,CAAC;IACpF,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,oBACX,KAAK,IACT,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,KAAK,CAAC,OAAO,EACtC,cAAc,EAAE,kBAAkB,EAClC,eAAe,EAAE,gBAAgB,IACjC,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport React from 'react';\nimport { _HighContrastAwareIcon } from './HighContrastAwareIcon';\n\n/**\n *@public\n */\nexport interface HoldButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with communication react handlers\n * Holds the call or resumes it based on call state.\n */\n onToggleHold: () => Promise<void>;\n /**\n * Optional strings to override in component\n */\n strings?: HoldButtonStrings;\n}\n\n/**\n * Strings for the hold button labels\n * @public\n */\nexport interface HoldButtonStrings {\n /**\n * Label for when action is to resume call.\n */\n onLabel?: string;\n /**\n * Label for when action is to hold call.\n */\n offLabel?: string;\n /**\n * Content for when button is checked\n */\n tooltipOnContent?: string;\n /**\n * Content for when button is unchecked\n */\n tooltipOffContent?: string;\n}\n\n/**\n * a button to hold or resume a ongoing call.\n *\n * Can be used with {@link ControlBar}\n *\n * @param props - properties for the hold button.\n * @returns\n * @public\n */\nexport const HoldButton = (props: HoldButtonProps): JSX.Element => {\n const { onToggleHold, strings } = props;\n\n const onRenderHoldIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={props.disabled} iconName=\"HoldCallButton\" />;\n };\n const onRenderResumeIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={props.disabled} iconName=\"ResumeCall\" />;\n };\n\n return (\n <ControlBarButton\n {...props}\n strings={strings}\n onClick={onToggleHold ?? props.onClick}\n onRenderOnIcon={onRenderResumeIcon}\n onRenderOffIcon={onRenderHoldIcon}\n />\n );\n};\n"]}
@@ -3,7 +3,7 @@ import { IButtonStyles, IStackStyles } from '@fluentui/react';
3
3
  /**
4
4
  * Strings for the incoming call notification component.
5
5
  *
6
- * @beta
6
+ * @public
7
7
  */
8
8
  export interface IncomingCallNotificationStrings {
9
9
  /**
@@ -46,7 +46,7 @@ export interface IncomingCallNotificationStrings {
46
46
  /**
47
47
  * Styles for the incoming call notification component.
48
48
  *
49
- * @beta
49
+ * @public
50
50
  */
51
51
  export interface IncomingCallNotificationStyles {
52
52
  /**
@@ -69,7 +69,7 @@ export interface IncomingCallNotificationStyles {
69
69
  /**
70
70
  * Properties for the incoming call notification component.
71
71
  *
72
- * @beta
72
+ * @public
73
73
  */
74
74
  export interface IncomingCallNotificationProps {
75
75
  /**
@@ -126,7 +126,7 @@ export interface IncomingCallNotificationProps {
126
126
  /**
127
127
  * A Notification component that is to be used to represent incoming calls to the end user.
128
128
  * Allows the user to accept or reject the incoming call.
129
- * @beta
129
+ * @public
130
130
  */
131
131
  export declare const IncomingCallNotification: (props: IncomingCallNotificationProps) => JSX.Element;
132
132
  //# sourceMappingURL=IncomingCallNotification.d.ts.map
@@ -8,7 +8,7 @@ import { _formatString } from "../../../acs-ui-common/src";
8
8
  /**
9
9
  * A Notification component that is to be used to represent incoming calls to the end user.
10
10
  * Allows the user to accept or reject the incoming call.
11
- * @beta
11
+ * @public
12
12
  */
13
13
  export const IncomingCallNotification = (props) => {
14
14
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -1 +1 @@
1
- {"version":3,"file":"IncomingCallNotification.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/IncomingCallNotification.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,aAAa,EAEb,UAAU,EAEV,OAAO,EACP,WAAW,EACX,aAAa,EACb,KAAK,EACL,IAAI,EAEJ,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,mDAAmD;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,mCAAgC;AAgIxD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,iBAAiB;IACjB,mDAAmD;IACnD,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,OAAO;IACP,mDAAmD;IACnD,aAAa,EACd,GAAG,KAAK,CAAC;IACV,MAAM,KA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EAAE,KAAK,CAAC,OAAO,CAAC,UAAU;YACnC,OAAO,EAAE,MAAM;SAChB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,qCAAqC,GAAiB;IAC1D,IAAI,EAAE;QACJ,WAAW,EAAE,QAAQ;KACtB;CACF,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAiB,EAAE;IACzD,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YACnC,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;SACjC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,KAAY,EAAiB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;YAC1B,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAC1C,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,UAAU;SACrB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;SAC3B;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,KAAY,EAAiB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE;YACJ,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAC1C,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;SACd;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DefaultButton,\n IButtonStyles,\n IconButton,\n IStackStyles,\n Persona,\n PersonaSize,\n PrimaryButton,\n Stack,\n Text,\n Theme,\n useTheme\n} from '@fluentui/react';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { IContextualMenuProps } from '@fluentui/react';\nimport React from 'react';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { useLocale } from '../localization';\nimport { _formatString } from '@internal/acs-ui-common';\n\n/**\n * Strings for the incoming call notification component.\n *\n * @beta\n */\nexport interface IncomingCallNotificationStrings {\n /**\n * Placeholder CallerID for the incoming call notification.\n */\n incomingCallNotificationPlaceholderId?: string;\n /**\n * Placeholder Alert for the incoming call notification.\n */\n incomingCallNotificationPlaceholderAlert?: string;\n /**\n * Aria label for the accept with audio button in the incoming call notification.\n */\n incomingCallNoticicationAcceptWithAudioAriaLabel?: string;\n /**\n * Aria label for the accept with video button in the incoming call notification.\n */\n incomingCallNoticicationAcceptWithVideoAriaLabel?: string;\n /**\n * Aria label for the reject button in the incoming call notification.\n */\n incomingCallNoticicationRejectAriaLabel?: string;\n /**\n * Label for the accept button in the incoming call notification.\n */\n incomingCallNotificationAcceptButtonLabel?: string;\n /**\n * Label for the accept with video button in the incoming call notification.\n */\n incomingCallNotificationAccceptWithVideoButtonLabel?: string;\n /**\n * label for the reject button in the incoming call notification.\n */\n incomingCallNotificationRejectButtonLabel?: string;\n /**\n * Aria label for the incoming call dismiss button\n */\n incomingCallNotificationDismissButtonAriaLabel?: string;\n}\n\n/**\n * Styles for the incoming call notification component.\n *\n * @beta\n */\nexport interface IncomingCallNotificationStyles {\n /**\n * Styles for the accept buttons.\n */\n acceptButton?: IButtonStyles;\n /**\n * Styles for the reject button.\n */\n rejectButton?: IButtonStyles;\n /**\n * Styles for the root container.\n */\n root?: IStackStyles;\n /**\n * Styles for the avatar container.\n */\n avatarContainer?: IStackStyles;\n}\n\n/**\n * Properties for the incoming call notification component.\n *\n * @beta\n */\nexport interface IncomingCallNotificationProps {\n /**\n * Caller's Name\n */\n callerName?: string;\n /**\n * Alert Text\"\n */\n alertText?: string;\n /**\n * URL to the avatar image for the user\n */\n avatarImage?: string;\n /**\n * Size of the persona coin\n */\n personaSize?: number;\n /**\n * Callback to render the avatar\n */\n onRenderAvatar?: () => JSX.Element;\n /**\n * Callback to accept the call with audio\n */\n onAcceptWithAudio: () => void;\n /**\n * Callback to accept the call with Video\n */\n onAcceptWithVideo: () => void;\n /**\n * Callback to reject the call\n */\n onReject: () => void;\n /**\n * Callback when the notification is dismissed\n */\n onDismiss?: () => void;\n /**\n * Styles for the incoming call notification component.\n */\n styles?: IncomingCallNotificationStyles;\n /**\n * Strings for the incoming call notification component.\n */\n strings?: IncomingCallNotificationStrings;\n /**\n * Options for whether to show the accept with video button\n */\n acceptOptions: {\n showAcceptWithVideo: boolean;\n };\n}\n\n/**\n * A Notification component that is to be used to represent incoming calls to the end user.\n * Allows the user to accept or reject the incoming call.\n * @beta\n */\nexport const IncomingCallNotification = (props: IncomingCallNotificationProps): JSX.Element => {\n const {\n callerName,\n alertText,\n avatarImage,\n onAcceptWithAudio,\n /* @conditional-compile-remove(one-to-n-calling) */\n onAcceptWithVideo,\n onReject,\n onDismiss,\n personaSize,\n styles,\n strings,\n /* @conditional-compile-remove(one-to-n-calling) */\n acceptOptions\n } = props;\n const theme = useTheme();\n /* @conditional-compile-remove(one-to-n-calling) */\n const localeStrings = useLocale().strings.IncomingCallNotification;\n /* @conditional-compile-remove(one-to-n-calling) */\n const formattedMessageString =\n localeStrings.incomingCallNotificationPlaceholderAlert && callerName\n ? _formatString(localeStrings.incomingCallNotificationPlaceholderAlert, { callerName: callerName })\n : callerName;\n\n /* @conditional-compile-remove(one-to-n-calling) */\n const acceptManuOptions: IContextualMenuProps | undefined = acceptOptions.showAcceptWithVideo\n ? {\n items: [\n {\n key: 'audio',\n text:\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAcceptButtonLabel ??\n localeStrings.incomingCallNotificationAcceptButtonLabel,\n onClick: () => onAcceptWithAudio()\n },\n {\n key: 'video',\n text:\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAccceptWithVideoButtonLabel ??\n localeStrings.incomingCallNotificationAccceptWithVideoButtonLabel,\n onClick: () => onAcceptWithVideo()\n }\n ]\n }\n : undefined;\n\n return (\n <Stack\n tokens={{ childrenGap: '0.5rem' }}\n verticalAlign=\"center\"\n styles={styles?.root ? styles.root : incomingCallToastStyle(theme)}\n >\n <Stack horizontal verticalAlign=\"center\" tokens={{ childrenGap: personaSize ? '0.5rem' : '0rem' }}>\n <Stack\n horizontalAlign=\"start\"\n styles={styles?.avatarContainer ? styles.avatarContainer : incomingCallToastAvatarContainerStyle}\n >\n <Persona\n imageUrl={avatarImage}\n text={callerName}\n size={PersonaSize.size24}\n coinSize={personaSize}\n hidePersonaDetails={true}\n aria-label={callerName}\n />\n </Stack>\n\n <Stack grow horizontalAlign=\"center\" style={{ alignItems: 'flex-start', fontFamily: 'Segoe UI' }}>\n <Text\n tabIndex={0}\n aria-live={'assertive'}\n aria-label={alertText ?? /* @conditional-compile-remove(one-to-n-calling) */ formattedMessageString}\n >\n {alertText ??\n strings?.incomingCallNotificationPlaceholderAlert ??\n /* @conditional-compile-remove(one-to-n-calling) */ formattedMessageString}\n </Text>\n </Stack>\n <IconButton\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNotificationDismissButtonAriaLabel ??\n localeStrings.incomingCallNotificationDismissButtonAriaLabel\n }\n iconProps={{ iconName: 'cancel' }}\n onClick={onDismiss}\n styles={dismissButtonStyle(theme)}\n />\n </Stack>\n\n <Stack horizontal horizontalAlign={'center'} tokens={{ childrenGap: '0.5rem' }}>\n <PrimaryButton\n styles={styles?.acceptButton ? styles.acceptButton : incomingCallAcceptButtonStyle(theme)}\n onClick={() => onAcceptWithAudio()}\n iconProps={{ iconName: 'IncomingCallNotificationAcceptIcon', style: { lineHeight: '1rem' } }}\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNoticicationAcceptWithAudioAriaLabel ??\n localeStrings.incomingCallNoticicationAcceptWithAudioAriaLabel\n }\n /* @conditional-compile-remove(one-to-n-calling) */\n menuProps={acceptManuOptions}\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAcceptButtonLabel ??\n localeStrings.incomingCallNotificationAcceptButtonLabel\n }\n </PrimaryButton>\n <DefaultButton\n styles={styles?.rejectButton ? styles.rejectButton : incomingCallRejectButtonStyle(theme)}\n onClick={() => onReject()}\n iconProps={{ iconName: 'IncomingCallNotificationRejectIcon' }}\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNoticicationRejectAriaLabel ?? localeStrings.incomingCallNoticicationRejectAriaLabel\n }\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationRejectButtonLabel ??\n localeStrings.incomingCallNotificationRejectButtonLabel\n }\n </DefaultButton>\n </Stack>\n </Stack>\n );\n};\n\nconst incomingCallToastStyle = (theme: Theme): IStackStyles => {\n return {\n root: {\n width: '20rem',\n background: theme.palette.white,\n opacity: 0.95,\n borderRadius: '0.5rem',\n boxShadow: theme.effects.elevation8,\n padding: '1rem'\n }\n };\n};\n\nconst incomingCallToastAvatarContainerStyle: IStackStyles = {\n root: {\n marginRight: '0.5rem'\n }\n};\n\nconst dismissButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.neutralPrimary,\n width: '1rem',\n height: '1rem'\n },\n rootHovered: {\n color: theme.palette.neutralDark\n }\n };\n};\n\nconst incomingCallAcceptButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.white,\n border: 'none',\n borderRadius: theme.effects.roundedCorner4,\n width: '100%',\n maxWidth: '8.875rem'\n },\n rootHovered: {\n color: theme.palette.white\n },\n icon: {\n height: '1.25rem'\n }\n };\n};\n\nconst incomingCallRejectButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n borderRadius: theme.effects.roundedCorner4,\n maxWidth: '8.875rem',\n width: '100%'\n },\n icon: {\n height: '1.25rem'\n }\n };\n};\n"]}
1
+ {"version":3,"file":"IncomingCallNotification.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/IncomingCallNotification.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,aAAa,EAEb,UAAU,EAEV,OAAO,EACP,WAAW,EACX,aAAa,EACb,KAAK,EACL,IAAI,EAEJ,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,mDAAmD;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,mCAAgC;AAgIxD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,iBAAiB;IACjB,mDAAmD;IACnD,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,OAAO;IACP,mDAAmD;IACnD,aAAa,EACd,GAAG,KAAK,CAAC;IACV,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,mDAAmD;IACnD,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,wBAAwB,CAAC;IACnE,mDAAmD;IACnD,MAAM,sBAAsB,GAC1B,aAAa,CAAC,wCAAwC,IAAI,UAAU;QAClE,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,wCAAwC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QACnG,CAAC,CAAC,UAAU,CAAC;IAEjB,mDAAmD;IACnD,MAAM,iBAAiB,GAAqC,aAAa,CAAC,mBAAmB;QAC3F,CAAC,CAAC;YACE,KAAK,EAAE;gBACL;oBACE,GAAG,EAAE,OAAO;oBACZ,IAAI;oBACF,mDAAmD,CAAC,MAAA,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A6B,GAAG,CAAC,KAAY,EAAiB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;YAC1B,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAC1C,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,UAAU;SACrB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;SAC3B;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,KAAY,EAAiB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE;YACJ,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YAC1C,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;SACd;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n DefaultButton,\n IButtonStyles,\n IconButton,\n IStackStyles,\n Persona,\n PersonaSize,\n PrimaryButton,\n Stack,\n Text,\n Theme,\n useTheme\n} from '@fluentui/react';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { IContextualMenuProps } from '@fluentui/react';\nimport React from 'react';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { useLocale } from '../localization';\nimport { _formatString } from '@internal/acs-ui-common';\n\n/**\n * Strings for the incoming call notification component.\n *\n * @public\n */\nexport interface IncomingCallNotificationStrings {\n /**\n * Placeholder CallerID for the incoming call notification.\n */\n incomingCallNotificationPlaceholderId?: string;\n /**\n * Placeholder Alert for the incoming call notification.\n */\n incomingCallNotificationPlaceholderAlert?: string;\n /**\n * Aria label for the accept with audio button in the incoming call notification.\n */\n incomingCallNoticicationAcceptWithAudioAriaLabel?: string;\n /**\n * Aria label for the accept with video button in the incoming call notification.\n */\n incomingCallNoticicationAcceptWithVideoAriaLabel?: string;\n /**\n * Aria label for the reject button in the incoming call notification.\n */\n incomingCallNoticicationRejectAriaLabel?: string;\n /**\n * Label for the accept button in the incoming call notification.\n */\n incomingCallNotificationAcceptButtonLabel?: string;\n /**\n * Label for the accept with video button in the incoming call notification.\n */\n incomingCallNotificationAccceptWithVideoButtonLabel?: string;\n /**\n * label for the reject button in the incoming call notification.\n */\n incomingCallNotificationRejectButtonLabel?: string;\n /**\n * Aria label for the incoming call dismiss button\n */\n incomingCallNotificationDismissButtonAriaLabel?: string;\n}\n\n/**\n * Styles for the incoming call notification component.\n *\n * @public\n */\nexport interface IncomingCallNotificationStyles {\n /**\n * Styles for the accept buttons.\n */\n acceptButton?: IButtonStyles;\n /**\n * Styles for the reject button.\n */\n rejectButton?: IButtonStyles;\n /**\n * Styles for the root container.\n */\n root?: IStackStyles;\n /**\n * Styles for the avatar container.\n */\n avatarContainer?: IStackStyles;\n}\n\n/**\n * Properties for the incoming call notification component.\n *\n * @public\n */\nexport interface IncomingCallNotificationProps {\n /**\n * Caller's Name\n */\n callerName?: string;\n /**\n * Alert Text\"\n */\n alertText?: string;\n /**\n * URL to the avatar image for the user\n */\n avatarImage?: string;\n /**\n * Size of the persona coin\n */\n personaSize?: number;\n /**\n * Callback to render the avatar\n */\n onRenderAvatar?: () => JSX.Element;\n /**\n * Callback to accept the call with audio\n */\n onAcceptWithAudio: () => void;\n /**\n * Callback to accept the call with Video\n */\n onAcceptWithVideo: () => void;\n /**\n * Callback to reject the call\n */\n onReject: () => void;\n /**\n * Callback when the notification is dismissed\n */\n onDismiss?: () => void;\n /**\n * Styles for the incoming call notification component.\n */\n styles?: IncomingCallNotificationStyles;\n /**\n * Strings for the incoming call notification component.\n */\n strings?: IncomingCallNotificationStrings;\n /**\n * Options for whether to show the accept with video button\n */\n acceptOptions: {\n showAcceptWithVideo: boolean;\n };\n}\n\n/**\n * A Notification component that is to be used to represent incoming calls to the end user.\n * Allows the user to accept or reject the incoming call.\n * @public\n */\nexport const IncomingCallNotification = (props: IncomingCallNotificationProps): JSX.Element => {\n const {\n callerName,\n alertText,\n avatarImage,\n onAcceptWithAudio,\n /* @conditional-compile-remove(one-to-n-calling) */\n onAcceptWithVideo,\n onReject,\n onDismiss,\n personaSize,\n styles,\n strings,\n /* @conditional-compile-remove(one-to-n-calling) */\n acceptOptions\n } = props;\n const theme = useTheme();\n /* @conditional-compile-remove(one-to-n-calling) */\n const localeStrings = useLocale().strings.IncomingCallNotification;\n /* @conditional-compile-remove(one-to-n-calling) */\n const formattedMessageString =\n localeStrings.incomingCallNotificationPlaceholderAlert && callerName\n ? _formatString(localeStrings.incomingCallNotificationPlaceholderAlert, { callerName: callerName })\n : callerName;\n\n /* @conditional-compile-remove(one-to-n-calling) */\n const acceptManuOptions: IContextualMenuProps | undefined = acceptOptions.showAcceptWithVideo\n ? {\n items: [\n {\n key: 'audio',\n text:\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAcceptButtonLabel ??\n localeStrings.incomingCallNotificationAcceptButtonLabel,\n onClick: () => onAcceptWithAudio()\n },\n {\n key: 'video',\n text:\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAccceptWithVideoButtonLabel ??\n localeStrings.incomingCallNotificationAccceptWithVideoButtonLabel,\n onClick: () => onAcceptWithVideo()\n }\n ]\n }\n : undefined;\n\n return (\n <Stack\n tokens={{ childrenGap: '0.5rem' }}\n verticalAlign=\"center\"\n styles={styles?.root ? styles.root : incomingCallToastStyle(theme)}\n >\n <Stack horizontal verticalAlign=\"center\" tokens={{ childrenGap: personaSize ? '0.5rem' : '0rem' }}>\n <Stack\n horizontalAlign=\"start\"\n styles={styles?.avatarContainer ? styles.avatarContainer : incomingCallToastAvatarContainerStyle}\n >\n <Persona\n imageUrl={avatarImage}\n text={callerName}\n size={PersonaSize.size24}\n coinSize={personaSize}\n hidePersonaDetails={true}\n aria-label={callerName}\n />\n </Stack>\n\n <Stack grow horizontalAlign=\"center\" style={{ alignItems: 'flex-start', fontFamily: 'Segoe UI' }}>\n <Text\n tabIndex={0}\n aria-live={'assertive'}\n aria-label={alertText ?? /* @conditional-compile-remove(one-to-n-calling) */ formattedMessageString}\n >\n {alertText ??\n strings?.incomingCallNotificationPlaceholderAlert ??\n /* @conditional-compile-remove(one-to-n-calling) */ formattedMessageString}\n </Text>\n </Stack>\n <IconButton\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNotificationDismissButtonAriaLabel ??\n localeStrings.incomingCallNotificationDismissButtonAriaLabel\n }\n iconProps={{ iconName: 'cancel' }}\n onClick={onDismiss}\n styles={dismissButtonStyle(theme)}\n />\n </Stack>\n\n <Stack horizontal horizontalAlign={'center'} tokens={{ childrenGap: '0.5rem' }}>\n <PrimaryButton\n styles={styles?.acceptButton ? styles.acceptButton : incomingCallAcceptButtonStyle(theme)}\n onClick={() => onAcceptWithAudio()}\n iconProps={{ iconName: 'IncomingCallNotificationAcceptIcon', style: { lineHeight: '1rem' } }}\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNoticicationAcceptWithAudioAriaLabel ??\n localeStrings.incomingCallNoticicationAcceptWithAudioAriaLabel\n }\n /* @conditional-compile-remove(one-to-n-calling) */\n menuProps={acceptManuOptions}\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationAcceptButtonLabel ??\n localeStrings.incomingCallNotificationAcceptButtonLabel\n }\n </PrimaryButton>\n <DefaultButton\n styles={styles?.rejectButton ? styles.rejectButton : incomingCallRejectButtonStyle(theme)}\n onClick={() => onReject()}\n iconProps={{ iconName: 'IncomingCallNotificationRejectIcon' }}\n /* @conditional-compile-remove(one-to-n-calling) */\n ariaLabel={\n strings?.incomingCallNoticicationRejectAriaLabel ?? localeStrings.incomingCallNoticicationRejectAriaLabel\n }\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ strings?.incomingCallNotificationRejectButtonLabel ??\n localeStrings.incomingCallNotificationRejectButtonLabel\n }\n </DefaultButton>\n </Stack>\n </Stack>\n );\n};\n\nconst incomingCallToastStyle = (theme: Theme): IStackStyles => {\n return {\n root: {\n width: '20rem',\n background: theme.palette.white,\n opacity: 0.95,\n borderRadius: '0.5rem',\n boxShadow: theme.effects.elevation8,\n padding: '1rem'\n }\n };\n};\n\nconst incomingCallToastAvatarContainerStyle: IStackStyles = {\n root: {\n marginRight: '0.5rem'\n }\n};\n\nconst dismissButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.neutralPrimary,\n width: '1rem',\n height: '1rem'\n },\n rootHovered: {\n color: theme.palette.neutralDark\n }\n };\n};\n\nconst incomingCallAcceptButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n color: theme.palette.white,\n border: 'none',\n borderRadius: theme.effects.roundedCorner4,\n width: '100%',\n maxWidth: '8.875rem'\n },\n rootHovered: {\n color: theme.palette.white\n },\n icon: {\n height: '1.25rem'\n }\n };\n};\n\nconst incomingCallRejectButtonStyle = (theme: Theme): IButtonStyles => {\n return {\n root: {\n borderRadius: theme.effects.roundedCorner4,\n maxWidth: '8.875rem',\n width: '100%'\n },\n icon: {\n height: '1.25rem'\n }\n };\n};\n"]}
@@ -2,7 +2,7 @@
2
2
  import { IncomingCallNotificationStyles, IncomingCallNotificationStrings } from './IncomingCallNotification';
3
3
  /**
4
4
  * Represents an active incoming call.
5
- * @beta
5
+ * @public
6
6
  */
7
7
  export interface IncomingCallStackCall {
8
8
  /**
@@ -25,7 +25,7 @@ export interface IncomingCallStackCall {
25
25
  }
26
26
  /**
27
27
  * Props for the IncomingCallManager component.
28
- * @beta
28
+ * @public
29
29
  */
30
30
  export interface IncomingCallStackProps {
31
31
  /**
@@ -67,7 +67,7 @@ export interface IncomingCallStackProps {
67
67
  * Wrapper to manage multiple incoming calls
68
68
  * @param props - {@link IncomingCallManagerProps}
69
69
  * @returns
70
- * @beta
70
+ * @public
71
71
  */
72
72
  export declare const IncomingCallStack: (props: IncomingCallStackProps) => JSX.Element;
73
73
  //# sourceMappingURL=IncomingCallStack.d.ts.map
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  * Wrapper to manage multiple incoming calls
9
9
  * @param props - {@link IncomingCallManagerProps}
10
10
  * @returns
11
- * @beta
11
+ * @public
12
12
  */
13
13
  export const IncomingCallStack = (props) => {
14
14
  /* @conditional-compile-remove(one-to-n-calling) */
@@ -1 +1 @@
1
- {"version":3,"file":"IncomingCallStack.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/IncomingCallStack.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,mDAAmD;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAkE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAe,EAAE;IAC9E,mDAAmD;IACnD,MAAM,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACnH,OAAO,CACL,oBAAC,KAAK,IACJ,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAClC,IAAI,EAAE,OAAO;QACb,mDAAmD,CAAC,QAAQ,EAAE,QAAQ;IAGpE,mDAAmD,CAAC,mBAAmB;SACpE,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;SAC3F,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;QACpB,OAAO,CACL,oBAAC,wBAAwB,IACvB,GAAG,EAAE,YAAY,CAAC,EAAE,EACpB,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,WAAW,EAC/C,iBAAiB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC,EACtD,iBAAiB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,EAC5D,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC,EAC7C,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC,EAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,EAAE,mBAAmB,EAAE,YAAY,CAAC,cAAc,EAAE,GACzC,CAC7B,CAAC;IACJ,CAAC,CAAC,CAEA,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { IncomingCallNotification } from './IncomingCallNotification';\nimport { IncomingCallNotificationStyles, IncomingCallNotificationStrings } from './IncomingCallNotification';\nimport { Stack } from '@fluentui/react';\nimport React from 'react';\n\n/**\n * Represents an active incoming call.\n * @beta\n */\nexport interface IncomingCallStackCall {\n /**\n * Unique identifier for the incoming call.\n */\n id: string;\n /**\n * Information about the caller.\n */\n callerInfo: {\n /**\n * Display name of the caller.\n */\n displayName?: string;\n };\n /**\n * Whether or not the call is a voip capable call.\n */\n videoAvailable: boolean;\n}\n/**\n * Props for the IncomingCallManager component.\n * @beta\n */\nexport interface IncomingCallStackProps {\n /**\n * List of incoming calls.\n */\n activeIncomingCalls: IncomingCallStackCall[];\n /**\n * List of incoming calls that have ended.\n */\n removedIncomingCalls: IncomingCallStackCall[];\n /**\n * Handler to accept the incoming call.\n * @param incomingCallId - Id of the incoming call to accept.\n * @param useVideo - Whether to accept with video.\n * @returns void\n */\n onAcceptCall: (incomingCallId: string, useVideo?: boolean) => void;\n /**\n * Handler to reject the incoming call.\n * @param incomingCallId - id of the incoming call to reject\n * @returns - void\n */\n onRejectCall: (incomingCallId: string) => void;\n /**\n * Styles for the incoming call notifications.\n */\n styles?: IncomingCallNotificationStyles;\n /**\n * Strings for the incoming call notifications.\n */\n strings?: IncomingCallNotificationStrings;\n /**\n * Tab index for the incoming Call stack, this will set the tab order of the\n * incoming call notifications in your application.\n */\n tabIndex?: number;\n}\n\n/**\n * Wrapper to manage multiple incoming calls\n * @param props - {@link IncomingCallManagerProps}\n * @returns\n * @beta\n */\nexport const IncomingCallStack = (props: IncomingCallStackProps): JSX.Element => {\n /* @conditional-compile-remove(one-to-n-calling) */\n const { activeIncomingCalls, removedIncomingCalls, onAcceptCall, onRejectCall, styles, strings, tabIndex } = props;\n return (\n <Stack\n tokens={{ childrenGap: '0.25rem' }}\n role={'group'}\n /* @conditional-compile-remove(one-to-n-calling) */ tabIndex={tabIndex}\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ activeIncomingCalls\n .filter((incomingCall) => !removedIncomingCalls.some((call) => call.id === incomingCall.id))\n .map((incomingCall) => {\n return (\n <IncomingCallNotification\n key={incomingCall.id}\n callerName={incomingCall.callerInfo.displayName}\n onAcceptWithAudio={() => onAcceptCall(incomingCall.id)}\n onAcceptWithVideo={() => onAcceptCall(incomingCall.id, true)}\n onReject={() => onRejectCall(incomingCall.id)}\n onDismiss={() => onRejectCall(incomingCall.id)}\n styles={styles}\n strings={strings}\n acceptOptions={{ showAcceptWithVideo: incomingCall.videoAvailable }}\n ></IncomingCallNotification>\n );\n })\n }\n </Stack>\n );\n};\n"]}
1
+ {"version":3,"file":"IncomingCallStack.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/IncomingCallStack.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,mDAAmD;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC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ACzC,CAC7B,CAAC;IACJ,CAAC,CAAC,CAEA,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { IncomingCallNotification } from './IncomingCallNotification';\nimport { IncomingCallNotificationStyles, IncomingCallNotificationStrings } from './IncomingCallNotification';\nimport { Stack } from '@fluentui/react';\nimport React from 'react';\n\n/**\n * Represents an active incoming call.\n * @public\n */\nexport interface IncomingCallStackCall {\n /**\n * Unique identifier for the incoming call.\n */\n id: string;\n /**\n * Information about the caller.\n */\n callerInfo: {\n /**\n * Display name of the caller.\n */\n displayName?: string;\n };\n /**\n * Whether or not the call is a voip capable call.\n */\n videoAvailable: boolean;\n}\n/**\n * Props for the IncomingCallManager component.\n * @public\n */\nexport interface IncomingCallStackProps {\n /**\n * List of incoming calls.\n */\n activeIncomingCalls: IncomingCallStackCall[];\n /**\n * List of incoming calls that have ended.\n */\n removedIncomingCalls: IncomingCallStackCall[];\n /**\n * Handler to accept the incoming call.\n * @param incomingCallId - Id of the incoming call to accept.\n * @param useVideo - Whether to accept with video.\n * @returns void\n */\n onAcceptCall: (incomingCallId: string, useVideo?: boolean) => void;\n /**\n * Handler to reject the incoming call.\n * @param incomingCallId - id of the incoming call to reject\n * @returns - void\n */\n onRejectCall: (incomingCallId: string) => void;\n /**\n * Styles for the incoming call notifications.\n */\n styles?: IncomingCallNotificationStyles;\n /**\n * Strings for the incoming call notifications.\n */\n strings?: IncomingCallNotificationStrings;\n /**\n * Tab index for the incoming Call stack, this will set the tab order of the\n * incoming call notifications in your application.\n */\n tabIndex?: number;\n}\n\n/**\n * Wrapper to manage multiple incoming calls\n * @param props - {@link IncomingCallManagerProps}\n * @returns\n * @public\n */\nexport const IncomingCallStack = (props: IncomingCallStackProps): JSX.Element => {\n /* @conditional-compile-remove(one-to-n-calling) */\n const { activeIncomingCalls, removedIncomingCalls, onAcceptCall, onRejectCall, styles, strings, tabIndex } = props;\n return (\n <Stack\n tokens={{ childrenGap: '0.25rem' }}\n role={'group'}\n /* @conditional-compile-remove(one-to-n-calling) */ tabIndex={tabIndex}\n >\n {\n /* @conditional-compile-remove(one-to-n-calling) */ activeIncomingCalls\n .filter((incomingCall) => !removedIncomingCalls.some((call) => call.id === incomingCall.id))\n .map((incomingCall) => {\n return (\n <IncomingCallNotification\n key={incomingCall.id}\n callerName={incomingCall.callerInfo.displayName}\n onAcceptWithAudio={() => onAcceptCall(incomingCall.id)}\n onAcceptWithVideo={() => onAcceptCall(incomingCall.id, true)}\n onReject={() => onRejectCall(incomingCall.id)}\n onDismiss={() => onRejectCall(incomingCall.id)}\n styles={styles}\n strings={strings}\n acceptOptions={{ showAcceptWithVideo: incomingCall.videoAvailable }}\n ></IncomingCallNotification>\n );\n })\n }\n </Stack>\n );\n};\n"]}
@@ -72,21 +72,20 @@ export interface MicrophoneButtonStrings {
72
72
  */
73
73
  microphoneAriaDescription?: string;
74
74
  /**
75
- * Title when deep noise suppression is on
75
+ * Title for deep noise suppression button
76
+ * @beta
76
77
  */
77
- deepNoiseSuppresionOnTitle?: string;
78
- /**
79
- * Title when deep noise suppression is off
80
- */
81
- deepNoiseSuppresionOffTitle?: string;
78
+ deepNoiseSuppressionTitle?: string;
82
79
  /**
83
80
  * Noise Suppression turned on string for announcer
81
+ * @beta
84
82
  */
85
- deepNoiseSuppresionOnAnnouncement?: string;
83
+ deepNoiseSuppressionOnAnnouncement?: string;
86
84
  /**
87
85
  * Noise Suppression turned off string for announcer
86
+ * @beta
88
87
  */
89
- deepNoiseSuppresionOffAnnouncement?: string;
88
+ deepNoiseSuppressionOffAnnouncement?: string;
90
89
  }
91
90
  /**
92
91
  * Styles for {@link MicrophoneButton}
@@ -161,14 +160,20 @@ export interface MicrophoneButtonProps extends ControlBarButtonProps {
161
160
  styles?: Partial<MicrophoneButtonStyles>;
162
161
  /**
163
162
  * Whether the deep noise suppression is on or off
163
+ *
164
+ * @beta
164
165
  */
165
166
  isDeepNoiseSuppressionOn?: boolean;
166
167
  /**
167
168
  * Callback when noise suppression is clicked
169
+ *
170
+ * @beta
168
171
  */
169
172
  onClickNoiseSuppression?: () => void;
170
173
  /**
171
174
  * Show/Hide the deep noise suppression button
175
+ *
176
+ * @beta
172
177
  */
173
178
  showNoiseSuppressionButton?: boolean;
174
179
  }
@@ -73,17 +73,6 @@ export const MicrophoneButton = (props) => {
73
73
  label: { fontWeight: 400 }
74
74
  };
75
75
  const splitButtonMenuItems = [];
76
- splitButtonMenuItems.push({
77
- key: 'microphonePrimaryAction',
78
- text: props.checked ? strings.onSplitButtonMicrophonePrimaryAction : strings.offSplitButtonMicrophonePrimaryAction,
79
- onClick: () => {
80
- onToggleClick();
81
- },
82
- iconProps: {
83
- iconName: props.checked ? 'SplitButtonPrimaryActionMicUnmuted' : 'SplitButtonPrimaryActionMicMuted',
84
- styles: { root: { lineHeight: 0 } }
85
- }
86
- });
87
76
  /* @conditional-compile-remove(DNS) */
88
77
  if (props.showNoiseSuppressionButton) {
89
78
  splitButtonMenuItems.push({
@@ -93,15 +82,24 @@ export const MicrophoneButton = (props) => {
93
82
  var _a;
94
83
  yield ((_a = props.onClickNoiseSuppression) === null || _a === void 0 ? void 0 : _a.call(props));
95
84
  setAnnouncerString(props.isDeepNoiseSuppressionOn
96
- ? strings.deepNoiseSuppresionOnAnnouncement
97
- : strings.deepNoiseSuppresionOffAnnouncement);
85
+ ? strings.deepNoiseSuppressionOnAnnouncement
86
+ : strings.deepNoiseSuppressionOffAnnouncement);
98
87
  }) },
99
- React.createElement(Toggle, { label: props.isDeepNoiseSuppressionOn
100
- ? strings.deepNoiseSuppresionOnTitle
101
- : strings.deepNoiseSuppresionOffTitle, checked: props.isDeepNoiseSuppressionOn, inlineLabel: true, styles: deepNoiseSuppressionToggleStyles })));
88
+ React.createElement(Toggle, { label: strings.deepNoiseSuppressionTitle, checked: props.isDeepNoiseSuppressionOn, inlineLabel: true, styles: deepNoiseSuppressionToggleStyles })));
102
89
  }
103
90
  });
104
91
  }
92
+ splitButtonMenuItems.push({
93
+ key: 'microphonePrimaryAction',
94
+ text: props.checked ? strings.onSplitButtonMicrophonePrimaryAction : strings.offSplitButtonMicrophonePrimaryAction,
95
+ onClick: () => {
96
+ onToggleClick();
97
+ },
98
+ iconProps: {
99
+ iconName: props.checked ? 'SplitButtonPrimaryActionMicUnmuted' : 'SplitButtonPrimaryActionMicMuted',
100
+ styles: { root: { lineHeight: 0 } }
101
+ }
102
+ });
105
103
  /**
106
104
  * We need to also include the primary action of the button to the
107
105
  * split button for mobile devices.
@@ -1 +1 @@
1
- {"version":3,"file":"MicrophoneButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MicrophoneButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EACL,sBAAsB,EAIvB,MAAM,iBAAiB,CAAC;AACzB,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAA4D,MAAM,iBAAiB,CAAC;AAE1G,OAAO,EAAiB,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsLxC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAe,EAAE;;IAC5E,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC3D,MAAM,OAAO,mCAAQ,aAAa,GAAK,KAAK,CAAC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AAC,cAAc,mCAAI,iBAAiB,EACzD,eAAe,EAAE,MAAA,KAAK,CAAC,eAAe,mCAAI,kBAAkB,EAC5D,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,uBAAuB,EACnD,SAAS,EACP,MAAA,KAAK,CAAC,SAAS,mCACf,CAAC,KAAK,CAAC,yBAAyB;gBAC9B,CAAC,CAAC,8BAA8B,iCACvB,KAAK,KAAE,MAAM,EAAE,MAAA,KAAK,CAAC,MAAM,0CAAE,UAAU,KAC5C,OAAO,EACP,wBAAwB,CACzB;gBACH,CAAC,CAAC,SAAS,CAAC,EAEhB,aAAa,EAAE,CAAA,MAAA,KAAK,CAAC,aAAa,mCAAI,CAAC,KAAK,CAAC,yBAAyB,EAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EACrG,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,yBAAyB,0BAEnD,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC,CAAC,SAAS,sBAE1E,OAAO,CAAC,yBAAyB,EACnD,oBAAoB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACzF,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,IAChC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useCallback } from 'react';\nimport { useLocale } from '../localization';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport { _HighContrastAwareIcon } from './HighContrastAwareIcon';\n\nimport {\n ContextualMenuItemType,\n IContextualMenuItem,\n IContextualMenuItemStyles,\n IContextualMenuStyles\n} from '@fluentui/react';\n/* @conditional-compile-remove(DNS) */\nimport { Toggle, Stack, IStyleFunctionOrObject, IToggleStyleProps, IToggleStyles } from '@fluentui/react';\nimport { ControlBarButtonStyles } from './ControlBarButton';\nimport { OptionsDevice, generateDefaultDeviceMenuProps } from './DevicesButton';\nimport { Announcer } from './Announcer';\n\n/**\n * Strings of {@link MicrophoneButton} that can be overridden.\n *\n * @public\n */\nexport interface MicrophoneButtonStrings {\n /** Label when button is on. */\n onLabel: string;\n /** Label when button is off. */\n offLabel: string;\n /** * Tooltip content when the button is disabled. */\n tooltipDisabledContent?: string;\n /** Tooltip content when the button is on. */\n tooltipOnContent?: string;\n /** Tooltip content when the button is off. */\n tooltipOffContent?: string;\n /**\n * Title of microphone menu\n */\n microphoneMenuTitle?: string;\n /**\n * Title of speaker menu\n */\n speakerMenuTitle?: string;\n /**\n * Tooltip of microphone menu\n */\n microphoneMenuTooltip?: string;\n /**\n * Tooltip of speaker menu\n */\n speakerMenuTooltip?: string;\n /**\n * Description of microphone button split button role\n */\n microphoneButtonSplitRoleDescription?: string;\n /**\n * Microphone split button aria label when mic is enabled.\n */\n onSplitButtonAriaLabel?: string;\n /**\n * Microphone split button aria label when mic is disabled.\n */\n offSplitButtonAriaLabel?: string;\n /**\n * Microphone action turned on string for announcer\n */\n microphoneActionTurnedOnAnnouncement?: string;\n /**\n * Microphone action turned off string for announcer\n */\n microphoneActionTurnedOffAnnouncement?: string;\n /**\n * Primary action for the microphone when microphone is live.\n */\n onSplitButtonMicrophonePrimaryAction?: string;\n /**\n * Primary action for the microphone when the microphone is muted.\n */\n offSplitButtonMicrophonePrimaryAction?: string;\n /**\n * Title for primary action section of split button\n */\n microphonePrimaryActionSplitButtonTitle?: string;\n /**\n * Aria description for the microphone button\n */\n microphoneAriaDescription?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Title when deep noise suppression is on\n */\n deepNoiseSuppresionOnTitle?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Title when deep noise suppression is off\n */\n deepNoiseSuppresionOffTitle?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Noise Suppression turned on string for announcer\n */\n deepNoiseSuppresionOnAnnouncement?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Noise Suppression turned off string for announcer\n */\n deepNoiseSuppresionOffAnnouncement?: string;\n}\n\n/**\n * Styles for {@link MicrophoneButton}\n *\n * @public\n */\nexport interface MicrophoneButtonStyles extends ControlBarButtonStyles {\n /**\n * Styles for the {@link MicrophoneButton} menu.\n */\n menuStyles?: Partial<MicrophoneButtonContextualMenuStyles>;\n}\n\n/**\n * Styles for the {@link MicrophoneButton} menu.\n *\n * @public\n */\nexport interface MicrophoneButtonContextualMenuStyles extends IContextualMenuStyles {\n /**\n * Styles for the items inside the {@link MicrophoneButton} button menu.\n */\n menuItemStyles?: IContextualMenuItemStyles;\n}\n\n/**\n * Props for {@link MicrophoneButton}.\n *\n * @public\n */\nexport interface MicrophoneButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onToggleMicrophone?: () => Promise<void>;\n /**\n * Available microphones for selection\n */\n microphones?: OptionsDevice[];\n /**\n * Available speakers for selection\n */\n speakers?: OptionsDevice[];\n /**\n * Microphone that is shown as currently selected\n */\n selectedMicrophone?: OptionsDevice;\n /**\n * Speaker that is shown as currently selected\n */\n selectedSpeaker?: OptionsDevice;\n /**\n * Callback when a microphone is selected\n */\n onSelectMicrophone?: (device: OptionsDevice) => Promise<void>;\n /**\n * Speaker when a speaker is selected\n */\n onSelectSpeaker?: (device: OptionsDevice) => Promise<void>;\n /**\n * Whether to use a {@link SplitButton} with a {@link IContextualMenu} for device selection.\n *\n * default: false\n */\n enableDeviceSelectionMenu?: boolean;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MicrophoneButtonStrings>;\n /**\n * Styles for {@link MicrophoneButton} and the device selection flyout.\n */\n styles?: Partial<MicrophoneButtonStyles>;\n /* @conditional-compile-remove(DNS) */\n /**\n * Whether the deep noise suppression is on or off\n */\n isDeepNoiseSuppressionOn?: boolean;\n /* @conditional-compile-remove(DNS) */\n /**\n * Callback when noise suppression is clicked\n */\n onClickNoiseSuppression?: () => void;\n /* @conditional-compile-remove(DNS) */\n /**\n * Show/Hide the deep noise suppression button\n */\n showNoiseSuppressionButton?: boolean;\n}\n\n/**\n * A button to turn microphone on / off.\n *\n * Can be used with {@link ControlBar}.\n *\n * @public\n */\nexport const MicrophoneButton = (props: MicrophoneButtonProps): JSX.Element => {\n const { onToggleMicrophone } = props;\n const localeStrings = useLocale().strings.microphoneButton;\n const strings = { ...localeStrings, ...props.strings };\n const [announcerString, setAnnouncerString] = useState<string | undefined>(undefined);\n\n const isSplit = props.split ?? props.enableDeviceSelectionMenu;\n\n // The button should be disabled when there are no mics. However if the button is a split button, if there are\n // no mics but there are speakers, then only the primary part of the button should be disabled to allow for\n // speaker change.\n const primaryDisabled = props.primaryDisabled || (isSplit && !props.microphones?.length ? true : undefined);\n const disabled =\n props.disabled ||\n (isSplit && !props.microphones?.length && !props.speakers?.length) ||\n (!isSplit && props.microphones && props.microphones?.length === 0);\n\n const onRenderMicOnIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={disabled} iconName=\"ControlButtonMicOn\" />;\n };\n const onRenderMicOffIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={disabled} iconName=\"ControlButtonMicOff\" />;\n };\n\n const isMicOn = props.checked;\n\n const splitButtonAriaString = isMicOn ? strings.onSplitButtonAriaLabel : strings.offSplitButtonAriaLabel;\n\n const toggleAnnouncerString = useCallback(\n (isMicOn: boolean) => {\n setAnnouncerString(\n !isMicOn ? strings.microphoneActionTurnedOffAnnouncement : strings.microphoneActionTurnedOnAnnouncement\n );\n },\n [strings.microphoneActionTurnedOffAnnouncement, strings.microphoneActionTurnedOnAnnouncement]\n );\n\n const onToggleClick = useCallback(async () => {\n if (onToggleMicrophone) {\n try {\n await onToggleMicrophone();\n // allows for the setting of narrator strings triggering the announcer when microphone is turned on or off.\n toggleAnnouncerString(!isMicOn);\n // eslint-disable-next-line no-empty\n } finally {\n }\n }\n }, [isMicOn, onToggleMicrophone, toggleAnnouncerString]);\n\n /* @conditional-compile-remove(DNS) */\n const deepNoiseSuppressionToggleStyles: IStyleFunctionOrObject<IToggleStyleProps, IToggleStyles> = {\n root: {\n margin: '4px',\n padding: '0px 12px',\n flexFlow: 'row-reverse',\n justifyContent: 'space-between'\n },\n label: { fontWeight: 400 }\n };\n\n const splitButtonMenuItems: IContextualMenuItem[] = [];\n\n splitButtonMenuItems.push({\n key: 'microphonePrimaryAction',\n text: props.checked ? strings.onSplitButtonMicrophonePrimaryAction : strings.offSplitButtonMicrophonePrimaryAction,\n onClick: () => {\n onToggleClick();\n },\n iconProps: {\n iconName: props.checked ? 'SplitButtonPrimaryActionMicUnmuted' : 'SplitButtonPrimaryActionMicMuted',\n styles: { root: { lineHeight: 0 } }\n }\n });\n\n /* @conditional-compile-remove(DNS) */\n if (props.showNoiseSuppressionButton) {\n splitButtonMenuItems.push({\n key: 'microphoneDNSToggle',\n onRender: () => {\n return (\n <Stack\n onClick={async () => {\n await props.onClickNoiseSuppression?.();\n setAnnouncerString(\n props.isDeepNoiseSuppressionOn\n ? strings.deepNoiseSuppresionOnAnnouncement\n : strings.deepNoiseSuppresionOffAnnouncement\n );\n }}\n >\n <Toggle\n label={\n props.isDeepNoiseSuppressionOn\n ? strings.deepNoiseSuppresionOnTitle\n : strings.deepNoiseSuppresionOffTitle\n }\n checked={props.isDeepNoiseSuppressionOn}\n inlineLabel\n styles={deepNoiseSuppressionToggleStyles}\n />\n </Stack>\n );\n }\n });\n }\n /**\n * We need to also include the primary action of the button to the\n * split button for mobile devices.\n */\n const splitButtonPrimaryAction: IContextualMenuItem = {\n key: 'primaryAction',\n title: 'toggle mic',\n itemType: ContextualMenuItemType.Section,\n sectionProps: {\n topDivider: true,\n items: splitButtonMenuItems\n }\n };\n\n return (\n <>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <ControlBarButton\n {...props}\n onClick={props.onToggleMicrophone ? onToggleClick : props.onClick}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderMicOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderMicOffIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'microphoneButtonLabel'}\n menuProps={\n props.menuProps ??\n (props.enableDeviceSelectionMenu\n ? generateDefaultDeviceMenuProps(\n { ...props, styles: props.styles?.menuStyles },\n strings,\n splitButtonPrimaryAction\n )\n : undefined)\n }\n menuIconProps={props.menuIconProps ?? !props.enableDeviceSelectionMenu ? { hidden: true } : undefined}\n split={props.split ?? props.enableDeviceSelectionMenu}\n aria-roledescription={\n props.enableDeviceSelectionMenu ? strings.microphoneButtonSplitRoleDescription : undefined\n }\n aria-description={strings.microphoneAriaDescription}\n splitButtonAriaLabel={props.enableDeviceSelectionMenu ? splitButtonAriaString : undefined}\n disabled={disabled}\n primaryDisabled={primaryDisabled}\n />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"MicrophoneButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MicrophoneButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EACL,sBAAsB,EAIvB,MAAM,iBAAiB,CAAC;AACzB,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAA4D,MAAM,iBAAiB,CAAC;AAE1G,OAAO,EAAiB,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA0LxC;;;;;;GAMG;AACH,MAAM,CA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BACX,KAAK,IACT,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EACjE,cAAc,EAAE,MAAA,KAAK,CAAC,cAAc,mCAAI,iBAAiB,EACzD,eAAe,EAAE,MAAA,KAAK,CAAC,eAAe,mCAAI,kBAAkB,EAC5D,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,uBAAuB,EACnD,SAAS,EACP,MAAA,KAAK,CAAC,SAAS,mCACf,CAAC,KAAK,CAAC,yBAAyB;gBAC9B,CAAC,CAAC,8BAA8B,iCACvB,KAAK,KAAE,MAAM,EAAE,MAAA,KAAK,CAAC,MAAM,0CAAE,UAAU,KAC5C,OAAO,EACP,wBAAwB,CACzB;gBACH,CAAC,CAAC,SAAS,CAAC,EAEhB,aAAa,EAAE,CAAA,MAAA,KAAK,CAAC,aAAa,mCAAI,CAAC,KAAK,CAAC,yBAAyB,EAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EACrG,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,yBAAyB,0BAEnD,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC,CAAC,SAAS,sBAE1E,OAAO,CAAC,yBAAyB,EACnD,oBAAoB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACzF,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,IAChC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useCallback } from 'react';\nimport { useLocale } from '../localization';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport { _HighContrastAwareIcon } from './HighContrastAwareIcon';\n\nimport {\n ContextualMenuItemType,\n IContextualMenuItem,\n IContextualMenuItemStyles,\n IContextualMenuStyles\n} from '@fluentui/react';\n/* @conditional-compile-remove(DNS) */\nimport { Toggle, Stack, IStyleFunctionOrObject, IToggleStyleProps, IToggleStyles } from '@fluentui/react';\nimport { ControlBarButtonStyles } from './ControlBarButton';\nimport { OptionsDevice, generateDefaultDeviceMenuProps } from './DevicesButton';\nimport { Announcer } from './Announcer';\n\n/**\n * Strings of {@link MicrophoneButton} that can be overridden.\n *\n * @public\n */\nexport interface MicrophoneButtonStrings {\n /** Label when button is on. */\n onLabel: string;\n /** Label when button is off. */\n offLabel: string;\n /** * Tooltip content when the button is disabled. */\n tooltipDisabledContent?: string;\n /** Tooltip content when the button is on. */\n tooltipOnContent?: string;\n /** Tooltip content when the button is off. */\n tooltipOffContent?: string;\n /**\n * Title of microphone menu\n */\n microphoneMenuTitle?: string;\n /**\n * Title of speaker menu\n */\n speakerMenuTitle?: string;\n /**\n * Tooltip of microphone menu\n */\n microphoneMenuTooltip?: string;\n /**\n * Tooltip of speaker menu\n */\n speakerMenuTooltip?: string;\n /**\n * Description of microphone button split button role\n */\n microphoneButtonSplitRoleDescription?: string;\n /**\n * Microphone split button aria label when mic is enabled.\n */\n onSplitButtonAriaLabel?: string;\n /**\n * Microphone split button aria label when mic is disabled.\n */\n offSplitButtonAriaLabel?: string;\n /**\n * Microphone action turned on string for announcer\n */\n microphoneActionTurnedOnAnnouncement?: string;\n /**\n * Microphone action turned off string for announcer\n */\n microphoneActionTurnedOffAnnouncement?: string;\n /**\n * Primary action for the microphone when microphone is live.\n */\n onSplitButtonMicrophonePrimaryAction?: string;\n /**\n * Primary action for the microphone when the microphone is muted.\n */\n offSplitButtonMicrophonePrimaryAction?: string;\n /**\n * Title for primary action section of split button\n */\n microphonePrimaryActionSplitButtonTitle?: string;\n /**\n * Aria description for the microphone button\n */\n microphoneAriaDescription?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Title for deep noise suppression button\n * @beta\n */\n deepNoiseSuppressionTitle?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Noise Suppression turned on string for announcer\n * @beta\n */\n deepNoiseSuppressionOnAnnouncement?: string;\n /* @conditional-compile-remove(DNS) */\n /**\n * Noise Suppression turned off string for announcer\n * @beta\n */\n deepNoiseSuppressionOffAnnouncement?: string;\n}\n\n/**\n * Styles for {@link MicrophoneButton}\n *\n * @public\n */\nexport interface MicrophoneButtonStyles extends ControlBarButtonStyles {\n /**\n * Styles for the {@link MicrophoneButton} menu.\n */\n menuStyles?: Partial<MicrophoneButtonContextualMenuStyles>;\n}\n\n/**\n * Styles for the {@link MicrophoneButton} menu.\n *\n * @public\n */\nexport interface MicrophoneButtonContextualMenuStyles extends IContextualMenuStyles {\n /**\n * Styles for the items inside the {@link MicrophoneButton} button menu.\n */\n menuItemStyles?: IContextualMenuItemStyles;\n}\n\n/**\n * Props for {@link MicrophoneButton}.\n *\n * @public\n */\nexport interface MicrophoneButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onToggleMicrophone?: () => Promise<void>;\n /**\n * Available microphones for selection\n */\n microphones?: OptionsDevice[];\n /**\n * Available speakers for selection\n */\n speakers?: OptionsDevice[];\n /**\n * Microphone that is shown as currently selected\n */\n selectedMicrophone?: OptionsDevice;\n /**\n * Speaker that is shown as currently selected\n */\n selectedSpeaker?: OptionsDevice;\n /**\n * Callback when a microphone is selected\n */\n onSelectMicrophone?: (device: OptionsDevice) => Promise<void>;\n /**\n * Speaker when a speaker is selected\n */\n onSelectSpeaker?: (device: OptionsDevice) => Promise<void>;\n /**\n * Whether to use a {@link SplitButton} with a {@link IContextualMenu} for device selection.\n *\n * default: false\n */\n enableDeviceSelectionMenu?: boolean;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MicrophoneButtonStrings>;\n /**\n * Styles for {@link MicrophoneButton} and the device selection flyout.\n */\n styles?: Partial<MicrophoneButtonStyles>;\n /* @conditional-compile-remove(DNS) */\n /**\n * Whether the deep noise suppression is on or off\n *\n * @beta\n */\n isDeepNoiseSuppressionOn?: boolean;\n /* @conditional-compile-remove(DNS) */\n /**\n * Callback when noise suppression is clicked\n *\n * @beta\n */\n onClickNoiseSuppression?: () => void;\n /* @conditional-compile-remove(DNS) */\n /**\n * Show/Hide the deep noise suppression button\n *\n * @beta\n */\n showNoiseSuppressionButton?: boolean;\n}\n\n/**\n * A button to turn microphone on / off.\n *\n * Can be used with {@link ControlBar}.\n *\n * @public\n */\nexport const MicrophoneButton = (props: MicrophoneButtonProps): JSX.Element => {\n const { onToggleMicrophone } = props;\n const localeStrings = useLocale().strings.microphoneButton;\n const strings = { ...localeStrings, ...props.strings };\n const [announcerString, setAnnouncerString] = useState<string | undefined>(undefined);\n\n const isSplit = props.split ?? props.enableDeviceSelectionMenu;\n\n // The button should be disabled when there are no mics. However if the button is a split button, if there are\n // no mics but there are speakers, then only the primary part of the button should be disabled to allow for\n // speaker change.\n const primaryDisabled = props.primaryDisabled || (isSplit && !props.microphones?.length ? true : undefined);\n const disabled =\n props.disabled ||\n (isSplit && !props.microphones?.length && !props.speakers?.length) ||\n (!isSplit && props.microphones && props.microphones?.length === 0);\n\n const onRenderMicOnIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={disabled} iconName=\"ControlButtonMicOn\" />;\n };\n const onRenderMicOffIcon = (): JSX.Element => {\n return <_HighContrastAwareIcon disabled={disabled} iconName=\"ControlButtonMicOff\" />;\n };\n\n const isMicOn = props.checked;\n\n const splitButtonAriaString = isMicOn ? strings.onSplitButtonAriaLabel : strings.offSplitButtonAriaLabel;\n\n const toggleAnnouncerString = useCallback(\n (isMicOn: boolean) => {\n setAnnouncerString(\n !isMicOn ? strings.microphoneActionTurnedOffAnnouncement : strings.microphoneActionTurnedOnAnnouncement\n );\n },\n [strings.microphoneActionTurnedOffAnnouncement, strings.microphoneActionTurnedOnAnnouncement]\n );\n\n const onToggleClick = useCallback(async () => {\n if (onToggleMicrophone) {\n try {\n await onToggleMicrophone();\n // allows for the setting of narrator strings triggering the announcer when microphone is turned on or off.\n toggleAnnouncerString(!isMicOn);\n // eslint-disable-next-line no-empty\n } finally {\n }\n }\n }, [isMicOn, onToggleMicrophone, toggleAnnouncerString]);\n\n /* @conditional-compile-remove(DNS) */\n const deepNoiseSuppressionToggleStyles: IStyleFunctionOrObject<IToggleStyleProps, IToggleStyles> = {\n root: {\n margin: '4px',\n padding: '0px 12px',\n flexFlow: 'row-reverse',\n justifyContent: 'space-between'\n },\n label: { fontWeight: 400 }\n };\n\n const splitButtonMenuItems: IContextualMenuItem[] = [];\n\n /* @conditional-compile-remove(DNS) */\n if (props.showNoiseSuppressionButton) {\n splitButtonMenuItems.push({\n key: 'microphoneDNSToggle',\n onRender: () => {\n return (\n <Stack\n onClick={async () => {\n await props.onClickNoiseSuppression?.();\n setAnnouncerString(\n props.isDeepNoiseSuppressionOn\n ? strings.deepNoiseSuppressionOnAnnouncement\n : strings.deepNoiseSuppressionOffAnnouncement\n );\n }}\n >\n <Toggle\n label={strings.deepNoiseSuppressionTitle}\n checked={props.isDeepNoiseSuppressionOn}\n inlineLabel\n styles={deepNoiseSuppressionToggleStyles}\n />\n </Stack>\n );\n }\n });\n }\n\n splitButtonMenuItems.push({\n key: 'microphonePrimaryAction',\n text: props.checked ? strings.onSplitButtonMicrophonePrimaryAction : strings.offSplitButtonMicrophonePrimaryAction,\n onClick: () => {\n onToggleClick();\n },\n iconProps: {\n iconName: props.checked ? 'SplitButtonPrimaryActionMicUnmuted' : 'SplitButtonPrimaryActionMicMuted',\n styles: { root: { lineHeight: 0 } }\n }\n });\n\n /**\n * We need to also include the primary action of the button to the\n * split button for mobile devices.\n */\n const splitButtonPrimaryAction: IContextualMenuItem = {\n key: 'primaryAction',\n title: 'toggle mic',\n itemType: ContextualMenuItemType.Section,\n sectionProps: {\n topDivider: true,\n items: splitButtonMenuItems\n }\n };\n\n return (\n <>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <ControlBarButton\n {...props}\n onClick={props.onToggleMicrophone ? onToggleClick : props.onClick}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderMicOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderMicOffIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'microphoneButtonLabel'}\n menuProps={\n props.menuProps ??\n (props.enableDeviceSelectionMenu\n ? generateDefaultDeviceMenuProps(\n { ...props, styles: props.styles?.menuStyles },\n strings,\n splitButtonPrimaryAction\n )\n : undefined)\n }\n menuIconProps={props.menuIconProps ?? !props.enableDeviceSelectionMenu ? { hidden: true } : undefined}\n split={props.split ?? props.enableDeviceSelectionMenu}\n aria-roledescription={\n props.enableDeviceSelectionMenu ? strings.microphoneButtonSplitRoleDescription : undefined\n }\n aria-description={strings.microphoneAriaDescription}\n splitButtonAriaLabel={props.enableDeviceSelectionMenu ? splitButtonAriaString : undefined}\n disabled={disabled}\n primaryDisabled={primaryDisabled}\n />\n </>\n );\n};\n"]}