@azure/communication-react 1.16.0-alpha-202405132107 → 1.16.0-alpha-202405132302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +96 -113
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js → ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js} +23 -14
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js.map +1 -0
- package/dist/dist-cjs/communication-react/{index-W6o1SuXO.js → index-DdWRffLC.js} +647 -869
- package/dist/dist-cjs/communication-react/index-DdWRffLC.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/common.d.ts +74 -0
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
- package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -6
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +43 -26
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +0 -2
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +5 -3
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.d.ts → Attachment/AttachmentCard.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.js → Attachment/AttachmentCard.js} +17 -16
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.js → Attachment/AttachmentCardGroup.js} +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.d.ts → Attachment/AttachmentDownloadCards.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.js → Attachment/AttachmentDownloadCards.js} +2 -2
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.d.ts → Attachment/AttachmentUploadCards.d.ts} +3 -3
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.js → Attachment/AttachmentUploadCards.js} +3 -3
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +21 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -14
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +6 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +31 -13
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -7
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +30 -23
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +43 -27
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +4 -4
- package/dist/dist-esm/react-components/src/components/SendBox.js +42 -17
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/index.js +3 -3
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +0 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +27 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +14 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +6 -5
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +18 -18
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +38 -19
- package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +18 -18
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +21 -49
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +3 -14
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -76
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -23
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -11
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +22 -40
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -9
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +73 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +3 -16
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -89
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +6 -19
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +0 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -31
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +66 -61
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +33 -44
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +22 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-W6o1SuXO.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCardGroup.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +0 -188
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +0 -29
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
- /package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.d.ts → Attachment/AttachmentCardGroup.d.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallWithChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/adjacent-overload-signatures */\n\nimport {\n CallIdChangedListener,\n DisplayNameChangedListener,\n IsMutedChangedListener,\n IsLocalScreenSharingActiveChangedListener,\n IsSpeakingChangedListener,\n ParticipantsJoinedListener,\n ParticipantsLeftListener,\n CallEndedListener\n} from '../../CallComposite';\nimport {\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n MessageSentListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener\n} from '../../ChatComposite';\nimport { ResourceDetails } from '../../ChatComposite';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\nimport type { AdapterError, AdapterState, Disposable } from '../../common/adapters';\nimport {\n AudioDeviceInfo,\n Call,\n PermissionConstraints,\n PropertyChangedEvent,\n StartCallOptions,\n VideoDeviceInfo\n} from '@azure/communication-calling';\nimport { Reaction } from '@azure/communication-calling';\nimport { StartCaptionsOptions } from '@azure/communication-calling';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { AddPhoneNumberOptions } from '@azure/communication-calling';\nimport { DtmfTone } from '@azure/communication-calling';\nimport { CreateVideoStreamViewResult, VideoStreamOptions } from '@internal/react-components';\nimport { SendMessageOptions } from '@azure/communication-chat';\nimport { JoinCallOptions } from '../../CallComposite/adapter/CallAdapter';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata, AttachmentUploadTask } from '@internal/react-components';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { PhoneNumberIdentifier } from '@azure/communication-common';\nimport { UnknownIdentifier, MicrosoftTeamsAppIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { CommunicationUserIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-adhoc-call) */\nimport { MicrosoftTeamsUserIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { CommunicationIdentifier } from '@azure/communication-common';\nimport {\n CaptionsReceivedListener,\n IsCaptionsActiveChangedListener,\n IsCaptionLanguageChangedListener,\n IsSpokenLanguageChangedListener\n} from '../../CallComposite/adapter/CallAdapter';\n\nimport { CapabilitiesChangedListener } from '../../CallComposite/adapter/CallAdapter';\n/* @conditional-compile-remove(spotlight) */\nimport { SpotlightChangedListener } from '../../CallComposite/adapter/CallAdapter';\n\nimport { VideoBackgroundImage, VideoBackgroundEffect } from '../../CallComposite';\n\n/* @conditional-compile-remove(end-of-call-survey) */\nimport { CallSurvey, CallSurveyResponse } from '@azure/communication-calling';\n\n/**\n * Functionality for managing the current call with chat.\n * @public\n */\nexport interface CallWithChatAdapterManagement {\n // CallWithChat-specific Interface methods\n /**\n * Remove a participant from a Call.\n *\n * @param userId - UserId of the participant to remove.\n *\n * @public\n */\n removeParticipant(userId: string): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Remove a participant from the call.\n * @param participant - {@link @azure/communication-common#CommunicationIdentifier} of the participant to be removed\n * @beta\n */\n removeParticipant(participant: CommunicationIdentifier): Promise<void>;\n\n // Call Interface Methods\n /**\n * Join the call with microphone initially on/off.\n * @deprecated Use joinCall(options?:JoinCallOptions) instead.\n * @param microphoneOn - Whether microphone is initially enabled\n *\n * @public\n */\n joinCall(microphoneOn?: boolean): Call | undefined;\n /**\n * Join the call with options bag to set microphone/camera initial state when joining call\n * true = turn on the device when joining call\n * false = turn off the device when joining call\n * 'keep'/undefined = retain devices' precall state\n *\n * @param options - param to set microphone/camera initially on/off/use precall state.\n *\n * @public\n */\n joinCall(options?: JoinCallOptions): Call | undefined;\n /**\n * Leave the call.\n *\n * @param forEveryone - Whether to remove all participants when leaving\n *\n * @public\n */\n leaveCall(forEveryone?: boolean): Promise<void>;\n /**\n * Start the camera.\n *\n * This method will start rendering a local camera view when the call is not active.\n *\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n startCamera(options?: VideoStreamOptions): Promise<void>;\n /**\n * Stop the camera.\n *\n * This method will stop rendering a local camera view when the call is not active.\n *\n * @public\n */\n stopCamera(): Promise<void>;\n /**\n * Mute the current user during the call or disable microphone locally.\n *\n * @public\n */\n mute(): Promise<void>;\n /**\n * Unmute the current user during the call or enable microphone locally.\n *\n * @public\n */\n unmute(): Promise<void>;\n /**\n * Start the call.\n *\n * @param participants - An array of participant ids to join\n *\n * @public\n */\n startCall(participants: string[], options?: StartCallOptions): Call | undefined;\n /**\n * Start the call.\n * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called\n * @public\n */\n startCall(\n participants: (\n | MicrosoftTeamsAppIdentifier\n | /* @conditional-compile-remove(PSTN-calls) */ PhoneNumberIdentifier\n | /* @conditional-compile-remove(one-to-n-calling) */ CommunicationUserIdentifier\n | /* @conditional-compile-remove(teams-adhoc-call) */ MicrosoftTeamsUserIdentifier\n | UnknownIdentifier\n )[],\n options?: StartCallOptions\n ): Call | undefined;\n /**\n * Start sharing the screen during a call.\n *\n * @public\n */\n startScreenShare(): Promise<void>;\n /**\n * Stop sharing the screen.\n *\n * @public\n */\n stopScreenShare(): Promise<void>;\n /**\n * Raise hand for local user.\n *\n * @public\n */\n raiseHand(): Promise<void>;\n /**\n * Lower hand for local user.\n *\n * @public\n */\n lowerHand(): Promise<void>;\n /**\n * Send Reaction to ongoing meeting.\n * @param reaction - A value of type {@link @azure/communication-calling#Reaction}\n *\n * @public\n */\n onReactionClick(reaction: Reaction): Promise<void>;\n /**\n * Create the html view for a stream.\n *\n * @remarks\n * This method is implemented for composite.\n *\n * @param remoteUserId - Id of the participant to render, leave it undefined to create the local camera view\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void | CreateVideoStreamViewResult>;\n /**\n * Dispose the html view for a stream.\n *\n * @remarks\n * This method is implemented for composite.\n *\n * @param remoteUserId - Id of the participant to render, leave it undefined to dispose the local camera view\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n disposeStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void>;\n /**\n * Dispose the html view for a screen share stream\n *\n * @remarks\n * this method is implemented for composite\n *\n * @param remoteUserId - Id of the participant to dispose the screen share stream view for.\n *\n * @public\n */\n disposeScreenShareStreamView(remoteUserId: string): Promise<void>;\n /**\n * Dispose the html view for a remote video stream\n *\n * @param remoteUserId - Id of the participant to dispose\n *\n * @public\n */\n disposeRemoteVideoStreamView(remoteUserId: string): Promise<void>;\n /**\n * Dispose the html view for a local video stream\n *\n * @public\n */\n disposeLocalVideoStreamView(): Promise<void>;\n /**\n * Ask for permissions of devices.\n *\n * @remarks\n * Browser permission window will pop up if permissions are not granted yet.\n *\n * @param constrain - Define constraints for accessing local devices {@link @azure/communication-calling#PermissionConstraints }\n *\n * @public\n */\n askDevicePermission(constrain: PermissionConstraints): Promise<void>;\n /**\n * Query for available camera devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of video device information entities {@link @azure/communication-calling#VideoDeviceInfo }\n *\n * @public\n */\n queryCameras(): Promise<VideoDeviceInfo[]>;\n /**\n * Query for available microphone devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }\n *\n * @public\n */\n queryMicrophones(): Promise<AudioDeviceInfo[]>;\n /**\n * Query for available microphone devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }\n *\n * @public\n */\n querySpeakers(): Promise<AudioDeviceInfo[]>;\n /**\n * Set the camera to use in the call.\n *\n * @param sourceInfo - Camera device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryCameras }\n * @param options - Options to control how the camera stream is rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>;\n /**\n * Set the microphone to use in the call.\n *\n * @param sourceInfo - Microphone device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryMicrophones }\n *\n * @public\n */\n setMicrophone(sourceInfo: AudioDeviceInfo): Promise<void>;\n /**\n * Set the speaker to use in the call.\n *\n * @param sourceInfo - Speaker device to choose, pick one returned by {@link CallAdapterDeviceManagement#querySpeakers }\n *\n * @public\n */\n setSpeaker(sourceInfo: AudioDeviceInfo): Promise<void>;\n\n // Chat Interface Methods\n /**\n * Fetch initial state for the Chat adapter.\n *\n * Performs the minimal fetch necessary for ChatComposite and API methods.\n *\n * @public\n */\n fetchInitialData(): Promise<void>;\n /**\n * Send a message in the thread.\n *\n * @public\n */\n sendMessage(content: string, options?: SendMessageOptions): Promise<void>;\n /* @conditional-compile-remove(attachment-upload) */\n /**\n * Send a message with attachments in the chat thread.\n *\n * @beta\n */\n sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void>;\n /**\n * Send a read receipt for a message.\n *\n * @public\n */\n sendReadReceipt(chatMessageId: string): Promise<void>;\n /**\n * Send typing indicator in the thread.\n *\n * @public\n */\n sendTypingIndicator(): Promise<void>;\n /**\n * Update a message content.\n *\n * @public\n */\n updateMessage(messageId: string, content: string, metadata?: Record<string, string>): Promise<void>;\n /**\n * Delete a message in the thread.\n *\n * @public\n */\n deleteMessage(messageId: string): Promise<void>;\n /**\n * Load more previous messages in the chat thread history.\n *\n * @remarks\n * This method is usually used to control incremental fetch/infinite scroll.\n *\n * @public\n */\n loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n registerActiveUploads: (files: File[]) => AttachmentUploadTask[];\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n clearUploads: () => void;\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n cancelUpload: (id: string) => void;\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n updateUploadProgress: (id: string, progress: number) => void;\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n updateUploadStatusMessage: (id: string, errorMessage: string) => void;\n /* @conditional-compile-remove(attachment-upload) */\n /** @internal */\n updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;\n /** @public */\n downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;\n /** @public */\n removeResourceFromCache(resourceDetails: ResourceDetails): void;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Puts the Call in a Localhold.\n *\n * @beta\n */\n holdCall: () => Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Resumes the call from a LocalHold state.\n *\n * @beta\n */\n resumeCall: () => Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Adds a new Participant to the call.\n *\n * @beta\n */\n addParticipant(participant: PhoneNumberIdentifier, options?: AddPhoneNumberOptions): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n addParticipant(participant: CommunicationUserIdentifier): Promise<void>;\n /**\n * send dtmf tone to another participant in the call in 1:1 calls\n *\n * @public\n */\n sendDtmfTone: (dtmfTone: DtmfTone) => Promise<void>;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Continues into a call when the browser version is not supported.\n */\n allowUnsupportedBrowserVersion(): void;\n /**\n * Function to Start captions\n * @param options - options for start captions\n */\n startCaptions(options?: StartCaptionsOptions): Promise<void>;\n /**\n * Function to set caption language\n * @param language - language set for caption\n */\n setCaptionLanguage(language: string): Promise<void>;\n /**\n * Function to set spoken language\n * @param language - spoken language\n */\n setSpokenLanguage(language: string): Promise<void>;\n /**\n * Funtion to stop captions\n */\n stopCaptions(): Promise<void>;\n\n /**\n * Start the video background effect.\n *\n * @public\n */\n startVideoBackgroundEffect(videoBackgroundEffect: VideoBackgroundEffect): Promise<void>;\n\n /**\n * Stop the video background effect.\n *\n * @public\n */\n stopVideoBackgroundEffects(): Promise<void>;\n\n /**\n * Override the background picker images for background replacement effect.\n *\n * @param backgroundImages - Array of custom background images.\n *\n * @public\n */\n updateBackgroundPickerImages(backgroundImages: VideoBackgroundImage[]): void;\n\n /**\n * Update the selected video background effect\n *\n * @public\n */\n updateSelectedVideoBackgroundEffect(selectedVideoBackground: VideoBackgroundEffect): void;\n /* @conditional-compile-remove(end-of-call-survey) */\n /**\n * Send the end of call survey result\n *\n * @public\n */\n submitSurvey(survey: CallSurvey): Promise<CallSurveyResponse | undefined>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Start spotlight\n */\n startSpotlight(userIds?: string[]): Promise<void>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Stop spotlight\n */\n stopSpotlight(userIds?: string[]): Promise<void>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Stop all spotlights\n */\n stopAllSpotlight(): Promise<void>;\n}\n\n/**\n * Call and Chat events that can be subscribed to in the {@link CallWithChatAdapter}.\n * @public\n */\nexport interface CallWithChatAdapterSubscriptions {\n // Call subscriptions\n on(event: 'callEnded', listener: CallEndedListener): void;\n on(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n on(event: 'callParticipantsJoined', listener: ParticipantsJoinedListener): void;\n on(event: 'callParticipantsLeft', listener: ParticipantsLeftListener): void;\n on(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n on(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n on(event: 'callError', listener: (e: AdapterError) => void): void;\n on(event: 'captionsReceived', listener: CaptionsReceivedListener): void;\n on(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;\n on(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;\n on(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;\n on(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;\n /* @conditional-compile-remove(spotlight) */\n on(event: 'spotlightChanged', listener: SpotlightChangedListener): void;\n off(event: 'callEnded', listener: CallEndedListener): void;\n off(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n off(event: 'callParticipantsJoined', listener: ParticipantsJoinedListener): void;\n off(event: 'callParticipantsLeft', listener: ParticipantsLeftListener): void;\n off(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n off(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n off(event: 'callError', listener: (e: AdapterError) => void): void;\n off(event: 'captionsReceived', listener: CaptionsReceivedListener): void;\n off(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;\n off(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;\n off(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;\n off(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;\n /* @conditional-compile-remove(spotlight) */\n off(event: 'spotlightChanged', listener: SpotlightChangedListener): void;\n\n // Chat subscriptions\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageSentListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'chatParticipantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'chatParticipantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'chatError', listener: (e: AdapterError) => void): void;\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageSentListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'chatParticipantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'chatParticipantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'chatError', listener: (e: AdapterError) => void): void;\n\n // CallWithChat subscriptions\n on(event: 'chatInitialized', listener: ChatInitializedListener): void;\n off(event: 'chatInitialized', listener: ChatInitializedListener): void;\n}\n\n/**\n * Callback for {@link CallWithChatAdapterSubscribers} 'chatInitialized' event.\n *\n * @public\n */\nexport type ChatInitializedListener = (event: { adapter: CallWithChatAdapter }) => void;\n\n/**\n * {@link CallWithChatComposite} Adapter interface.\n *\n * @public\n */\nexport interface CallWithChatAdapter\n extends CallWithChatAdapterManagement,\n AdapterState<CallWithChatAdapterState>,\n Disposable,\n CallWithChatAdapterSubscriptions {}\n\n/**\n * Events fired off by the {@link CallWithChatAdapter}.\n *\n * @public\n */\nexport type CallWithChatEvent =\n | 'callError'\n | 'chatError'\n | 'callEnded'\n | 'isMutedChanged'\n | 'callIdChanged'\n | 'isLocalScreenSharingActiveChanged'\n | 'displayNameChanged'\n | 'isSpeakingChanged'\n | 'callParticipantsJoined'\n | 'callParticipantsLeft'\n | 'selectedMicrophoneChanged'\n | 'selectedSpeakerChanged'\n | 'isCaptionsActiveChanged'\n | 'captionsReceived'\n | 'isCaptionLanguageChanged'\n | 'isSpokenLanguageChanged'\n | 'capabilitiesChanged'\n | /* @conditional-compile-remove(spotlight) */ 'spotlightChanged'\n | 'messageReceived'\n | 'messageEdited'\n | 'messageDeleted'\n | 'messageSent'\n | 'messageRead'\n | 'chatParticipantsAdded'\n | 'chatParticipantsRemoved'\n | 'chatInitialized';\n"]}
|
1
|
+
{"version":3,"file":"CallWithChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/adjacent-overload-signatures */\n\nimport {\n CallIdChangedListener,\n DisplayNameChangedListener,\n IsMutedChangedListener,\n IsLocalScreenSharingActiveChangedListener,\n IsSpeakingChangedListener,\n ParticipantsJoinedListener,\n ParticipantsLeftListener,\n CallEndedListener\n} from '../../CallComposite';\nimport {\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n MessageSentListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener\n} from '../../ChatComposite';\nimport { ResourceDetails } from '../../ChatComposite';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\nimport type { AdapterError, AdapterState, Disposable } from '../../common/adapters';\nimport {\n AudioDeviceInfo,\n Call,\n PermissionConstraints,\n PropertyChangedEvent,\n StartCallOptions,\n VideoDeviceInfo\n} from '@azure/communication-calling';\nimport { Reaction } from '@azure/communication-calling';\nimport { StartCaptionsOptions } from '@azure/communication-calling';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { AddPhoneNumberOptions } from '@azure/communication-calling';\nimport { DtmfTone } from '@azure/communication-calling';\nimport { CreateVideoStreamViewResult, VideoStreamOptions } from '@internal/react-components';\nimport { SendMessageOptions } from '@azure/communication-chat';\nimport { JoinCallOptions } from '../../CallComposite/adapter/CallAdapter';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { PhoneNumberIdentifier } from '@azure/communication-common';\nimport { UnknownIdentifier, MicrosoftTeamsAppIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(one-to-n-calling) */\nimport { CommunicationUserIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-adhoc-call) */\nimport { MicrosoftTeamsUserIdentifier } from '@azure/communication-common';\n/* @conditional-compile-remove(PSTN-calls) */\nimport { CommunicationIdentifier } from '@azure/communication-common';\nimport {\n CaptionsReceivedListener,\n IsCaptionsActiveChangedListener,\n IsCaptionLanguageChangedListener,\n IsSpokenLanguageChangedListener\n} from '../../CallComposite/adapter/CallAdapter';\n\nimport { CapabilitiesChangedListener } from '../../CallComposite/adapter/CallAdapter';\n/* @conditional-compile-remove(spotlight) */\nimport { SpotlightChangedListener } from '../../CallComposite/adapter/CallAdapter';\n\nimport { VideoBackgroundImage, VideoBackgroundEffect } from '../../CallComposite';\n\n/* @conditional-compile-remove(end-of-call-survey) */\nimport { CallSurvey, CallSurveyResponse } from '@azure/communication-calling';\n\n/**\n * Functionality for managing the current call with chat.\n * @public\n */\nexport interface CallWithChatAdapterManagement {\n // CallWithChat-specific Interface methods\n /**\n * Remove a participant from a Call.\n *\n * @param userId - UserId of the participant to remove.\n *\n * @public\n */\n removeParticipant(userId: string): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Remove a participant from the call.\n * @param participant - {@link @azure/communication-common#CommunicationIdentifier} of the participant to be removed\n * @beta\n */\n removeParticipant(participant: CommunicationIdentifier): Promise<void>;\n\n // Call Interface Methods\n /**\n * Join the call with microphone initially on/off.\n * @deprecated Use joinCall(options?:JoinCallOptions) instead.\n * @param microphoneOn - Whether microphone is initially enabled\n *\n * @public\n */\n joinCall(microphoneOn?: boolean): Call | undefined;\n /**\n * Join the call with options bag to set microphone/camera initial state when joining call\n * true = turn on the device when joining call\n * false = turn off the device when joining call\n * 'keep'/undefined = retain devices' precall state\n *\n * @param options - param to set microphone/camera initially on/off/use precall state.\n *\n * @public\n */\n joinCall(options?: JoinCallOptions): Call | undefined;\n /**\n * Leave the call.\n *\n * @param forEveryone - Whether to remove all participants when leaving\n *\n * @public\n */\n leaveCall(forEveryone?: boolean): Promise<void>;\n /**\n * Start the camera.\n *\n * This method will start rendering a local camera view when the call is not active.\n *\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n startCamera(options?: VideoStreamOptions): Promise<void>;\n /**\n * Stop the camera.\n *\n * This method will stop rendering a local camera view when the call is not active.\n *\n * @public\n */\n stopCamera(): Promise<void>;\n /**\n * Mute the current user during the call or disable microphone locally.\n *\n * @public\n */\n mute(): Promise<void>;\n /**\n * Unmute the current user during the call or enable microphone locally.\n *\n * @public\n */\n unmute(): Promise<void>;\n /**\n * Start the call.\n *\n * @param participants - An array of participant ids to join\n *\n * @public\n */\n startCall(participants: string[], options?: StartCallOptions): Call | undefined;\n /**\n * Start the call.\n * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called\n * @public\n */\n startCall(\n participants: (\n | MicrosoftTeamsAppIdentifier\n | /* @conditional-compile-remove(PSTN-calls) */ PhoneNumberIdentifier\n | /* @conditional-compile-remove(one-to-n-calling) */ CommunicationUserIdentifier\n | /* @conditional-compile-remove(teams-adhoc-call) */ MicrosoftTeamsUserIdentifier\n | UnknownIdentifier\n )[],\n options?: StartCallOptions\n ): Call | undefined;\n /**\n * Start sharing the screen during a call.\n *\n * @public\n */\n startScreenShare(): Promise<void>;\n /**\n * Stop sharing the screen.\n *\n * @public\n */\n stopScreenShare(): Promise<void>;\n /**\n * Raise hand for local user.\n *\n * @public\n */\n raiseHand(): Promise<void>;\n /**\n * Lower hand for local user.\n *\n * @public\n */\n lowerHand(): Promise<void>;\n /**\n * Send Reaction to ongoing meeting.\n * @param reaction - A value of type {@link @azure/communication-calling#Reaction}\n *\n * @public\n */\n onReactionClick(reaction: Reaction): Promise<void>;\n /**\n * Create the html view for a stream.\n *\n * @remarks\n * This method is implemented for composite.\n *\n * @param remoteUserId - Id of the participant to render, leave it undefined to create the local camera view\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void | CreateVideoStreamViewResult>;\n /**\n * Dispose the html view for a stream.\n *\n * @remarks\n * This method is implemented for composite.\n *\n * @param remoteUserId - Id of the participant to render, leave it undefined to dispose the local camera view\n * @param options - Options to control how video streams are rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n disposeStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void>;\n /**\n * Dispose the html view for a screen share stream\n *\n * @remarks\n * this method is implemented for composite\n *\n * @param remoteUserId - Id of the participant to dispose the screen share stream view for.\n *\n * @public\n */\n disposeScreenShareStreamView(remoteUserId: string): Promise<void>;\n /**\n * Dispose the html view for a remote video stream\n *\n * @param remoteUserId - Id of the participant to dispose\n *\n * @public\n */\n disposeRemoteVideoStreamView(remoteUserId: string): Promise<void>;\n /**\n * Dispose the html view for a local video stream\n *\n * @public\n */\n disposeLocalVideoStreamView(): Promise<void>;\n /**\n * Ask for permissions of devices.\n *\n * @remarks\n * Browser permission window will pop up if permissions are not granted yet.\n *\n * @param constrain - Define constraints for accessing local devices {@link @azure/communication-calling#PermissionConstraints }\n *\n * @public\n */\n askDevicePermission(constrain: PermissionConstraints): Promise<void>;\n /**\n * Query for available camera devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of video device information entities {@link @azure/communication-calling#VideoDeviceInfo }\n *\n * @public\n */\n queryCameras(): Promise<VideoDeviceInfo[]>;\n /**\n * Query for available microphone devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }\n *\n * @public\n */\n queryMicrophones(): Promise<AudioDeviceInfo[]>;\n /**\n * Query for available microphone devices.\n *\n * @remarks\n * This method should be called after askDevicePermission()\n *\n * @return An array of audio device information entities {@link @azure/communication-calling#AudioDeviceInfo }\n *\n * @public\n */\n querySpeakers(): Promise<AudioDeviceInfo[]>;\n /**\n * Set the camera to use in the call.\n *\n * @param sourceInfo - Camera device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryCameras }\n * @param options - Options to control how the camera stream is rendered {@link @azure/communication-calling#VideoStreamOptions }\n *\n * @public\n */\n setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>;\n /**\n * Set the microphone to use in the call.\n *\n * @param sourceInfo - Microphone device to choose, pick one returned by {@link CallAdapterDeviceManagement#queryMicrophones }\n *\n * @public\n */\n setMicrophone(sourceInfo: AudioDeviceInfo): Promise<void>;\n /**\n * Set the speaker to use in the call.\n *\n * @param sourceInfo - Speaker device to choose, pick one returned by {@link CallAdapterDeviceManagement#querySpeakers }\n *\n * @public\n */\n setSpeaker(sourceInfo: AudioDeviceInfo): Promise<void>;\n\n // Chat Interface Methods\n /**\n * Fetch initial state for the Chat adapter.\n *\n * Performs the minimal fetch necessary for ChatComposite and API methods.\n *\n * @public\n */\n fetchInitialData(): Promise<void>;\n /**\n * Send a message in the thread.\n *\n * @public\n */\n sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void>;\n /**\n * Send a read receipt for a message.\n *\n * @public\n */\n sendReadReceipt(chatMessageId: string): Promise<void>;\n /**\n * Send typing indicator in the thread.\n *\n * @public\n */\n sendTypingIndicator(): Promise<void>;\n /**\n * Update a message content.\n *\n * @public\n */\n updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void>;\n /**\n * Delete a message in the thread.\n *\n * @public\n */\n deleteMessage(messageId: string): Promise<void>;\n /**\n * Load more previous messages in the chat thread history.\n *\n * @remarks\n * This method is usually used to control incremental fetch/infinite scroll.\n *\n * @public\n */\n loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;\n /** @public */\n downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;\n /** @public */\n removeResourceFromCache(resourceDetails: ResourceDetails): void;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Puts the Call in a Localhold.\n *\n * @beta\n */\n holdCall: () => Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Resumes the call from a LocalHold state.\n *\n * @beta\n */\n resumeCall: () => Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n /**\n * Adds a new Participant to the call.\n *\n * @beta\n */\n addParticipant(participant: PhoneNumberIdentifier, options?: AddPhoneNumberOptions): Promise<void>;\n /* @conditional-compile-remove(PSTN-calls) */\n addParticipant(participant: CommunicationUserIdentifier): Promise<void>;\n /**\n * send dtmf tone to another participant in the call in 1:1 calls\n *\n * @public\n */\n sendDtmfTone: (dtmfTone: DtmfTone) => Promise<void>;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * Continues into a call when the browser version is not supported.\n */\n allowUnsupportedBrowserVersion(): void;\n /**\n * Function to Start captions\n * @param options - options for start captions\n */\n startCaptions(options?: StartCaptionsOptions): Promise<void>;\n /**\n * Function to set caption language\n * @param language - language set for caption\n */\n setCaptionLanguage(language: string): Promise<void>;\n /**\n * Function to set spoken language\n * @param language - spoken language\n */\n setSpokenLanguage(language: string): Promise<void>;\n /**\n * Funtion to stop captions\n */\n stopCaptions(): Promise<void>;\n\n /**\n * Start the video background effect.\n *\n * @public\n */\n startVideoBackgroundEffect(videoBackgroundEffect: VideoBackgroundEffect): Promise<void>;\n\n /**\n * Stop the video background effect.\n *\n * @public\n */\n stopVideoBackgroundEffects(): Promise<void>;\n\n /**\n * Override the background picker images for background replacement effect.\n *\n * @param backgroundImages - Array of custom background images.\n *\n * @public\n */\n updateBackgroundPickerImages(backgroundImages: VideoBackgroundImage[]): void;\n\n /**\n * Update the selected video background effect\n *\n * @public\n */\n updateSelectedVideoBackgroundEffect(selectedVideoBackground: VideoBackgroundEffect): void;\n /* @conditional-compile-remove(end-of-call-survey) */\n /**\n * Send the end of call survey result\n *\n * @public\n */\n submitSurvey(survey: CallSurvey): Promise<CallSurveyResponse | undefined>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Start spotlight\n */\n startSpotlight(userIds?: string[]): Promise<void>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Stop spotlight\n */\n stopSpotlight(userIds?: string[]): Promise<void>;\n /* @conditional-compile-remove(spotlight) */\n /**\n * Stop all spotlights\n */\n stopAllSpotlight(): Promise<void>;\n}\n\n/**\n * Call and Chat events that can be subscribed to in the {@link CallWithChatAdapter}.\n * @public\n */\nexport interface CallWithChatAdapterSubscriptions {\n // Call subscriptions\n on(event: 'callEnded', listener: CallEndedListener): void;\n on(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n on(event: 'callParticipantsJoined', listener: ParticipantsJoinedListener): void;\n on(event: 'callParticipantsLeft', listener: ParticipantsLeftListener): void;\n on(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n on(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n on(event: 'callError', listener: (e: AdapterError) => void): void;\n on(event: 'captionsReceived', listener: CaptionsReceivedListener): void;\n on(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;\n on(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;\n on(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;\n on(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;\n /* @conditional-compile-remove(spotlight) */\n on(event: 'spotlightChanged', listener: SpotlightChangedListener): void;\n off(event: 'callEnded', listener: CallEndedListener): void;\n off(event: 'isMutedChanged', listener: IsMutedChangedListener): void;\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsLocalScreenSharingActiveChangedListener): void;\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n off(event: 'callParticipantsJoined', listener: ParticipantsJoinedListener): void;\n off(event: 'callParticipantsLeft', listener: ParticipantsLeftListener): void;\n off(event: 'selectedMicrophoneChanged', listener: PropertyChangedEvent): void;\n off(event: 'selectedSpeakerChanged', listener: PropertyChangedEvent): void;\n off(event: 'callError', listener: (e: AdapterError) => void): void;\n off(event: 'captionsReceived', listener: CaptionsReceivedListener): void;\n off(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;\n off(event: 'isCaptionLanguageChanged', listener: IsCaptionLanguageChangedListener): void;\n off(event: 'isSpokenLanguageChanged', listener: IsSpokenLanguageChangedListener): void;\n off(event: 'capabilitiesChanged', listener: CapabilitiesChangedListener): void;\n /* @conditional-compile-remove(spotlight) */\n off(event: 'spotlightChanged', listener: SpotlightChangedListener): void;\n\n // Chat subscriptions\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageSentListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'chatParticipantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'chatParticipantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'chatError', listener: (e: AdapterError) => void): void;\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageSentListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'chatParticipantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'chatParticipantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'chatError', listener: (e: AdapterError) => void): void;\n\n // CallWithChat subscriptions\n on(event: 'chatInitialized', listener: ChatInitializedListener): void;\n off(event: 'chatInitialized', listener: ChatInitializedListener): void;\n}\n\n/**\n * Callback for {@link CallWithChatAdapterSubscribers} 'chatInitialized' event.\n *\n * @public\n */\nexport type ChatInitializedListener = (event: { adapter: CallWithChatAdapter }) => void;\n\n/**\n * {@link CallWithChatComposite} Adapter interface.\n *\n * @public\n */\nexport interface CallWithChatAdapter\n extends CallWithChatAdapterManagement,\n AdapterState<CallWithChatAdapterState>,\n Disposable,\n CallWithChatAdapterSubscriptions {}\n\n/**\n * Events fired off by the {@link CallWithChatAdapter}.\n *\n * @public\n */\nexport type CallWithChatEvent =\n | 'callError'\n | 'chatError'\n | 'callEnded'\n | 'isMutedChanged'\n | 'callIdChanged'\n | 'isLocalScreenSharingActiveChanged'\n | 'displayNameChanged'\n | 'isSpeakingChanged'\n | 'callParticipantsJoined'\n | 'callParticipantsLeft'\n | 'selectedMicrophoneChanged'\n | 'selectedSpeakerChanged'\n | 'isCaptionsActiveChanged'\n | 'captionsReceived'\n | 'isCaptionLanguageChanged'\n | 'isSpokenLanguageChanged'\n | 'capabilitiesChanged'\n | /* @conditional-compile-remove(spotlight) */ 'spotlightChanged'\n | 'messageReceived'\n | 'messageEdited'\n | 'messageDeleted'\n | 'messageSent'\n | 'messageRead'\n | 'chatParticipantsAdded'\n | 'chatParticipantsRemoved'\n | 'chatInitialized';\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CallWithChatAdapter } from './CallWithChatAdapter';
|
2
2
|
import { ChatAdapter, ChatAdapterState } from '../../ChatComposite';
|
3
3
|
import { ResourceDetails } from '../../ChatComposite';
|
4
|
-
import {
|
4
|
+
import { MessageOptions } from "../../../../../acs-ui-common/src";
|
5
5
|
import { ErrorBarStrings } from "../../../../../react-components/src";
|
6
6
|
/**
|
7
7
|
* Facade around the CallWithChatAdapter to satisfy the chat adapter interface.
|
@@ -13,8 +13,8 @@ export declare class CallWithChatBackedChatAdapter implements ChatAdapter {
|
|
13
13
|
private eventStore;
|
14
14
|
constructor(callWithChatAdapter: CallWithChatAdapter);
|
15
15
|
fetchInitialData: () => Promise<void>;
|
16
|
-
|
17
|
-
|
16
|
+
sendMessageHandler: (this: CallWithChatBackedChatAdapter, content: string, options?: MessageOptions) => Promise<void>;
|
17
|
+
sendMessage: (content: string, options?: MessageOptions | undefined) => Promise<void>;
|
18
18
|
sendReadReceipt: (chatMessageId: string) => Promise<void>;
|
19
19
|
sendTypingIndicator: () => Promise<void>;
|
20
20
|
removeParticipant: (userId: string) => Promise<void>;
|
@@ -25,17 +25,11 @@ export declare class CallWithChatBackedChatAdapter implements ChatAdapter {
|
|
25
25
|
getState: () => ChatAdapterState;
|
26
26
|
on: (event: any, listener: any) => void;
|
27
27
|
off: (event: any, listener: any) => void;
|
28
|
-
|
28
|
+
updateMessageHandler: (this: CallWithChatBackedChatAdapter, messageId: string, content: string, options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions) => Promise<void>;
|
29
|
+
updateMessage: (messageId: string, content: string, options?: Record<string, string> | MessageOptions | undefined) => Promise<void>;
|
29
30
|
deleteMessage: (messageId: string) => Promise<void>;
|
30
31
|
clearErrors: (errorTypes: (keyof ErrorBarStrings)[]) => void;
|
31
32
|
setTopic: (topicName: string) => Promise<void>;
|
32
|
-
registerActiveUploads: (files: File[]) => AttachmentUploadTask[];
|
33
|
-
registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];
|
34
|
-
clearUploads: () => void;
|
35
|
-
cancelUpload: (id: string) => void;
|
36
|
-
updateUploadProgress: (id: string, progress: number) => void;
|
37
|
-
updateUploadStatusMessage: (id: string, errorMessage: string) => void;
|
38
|
-
updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
39
33
|
downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;
|
40
34
|
removeResourceFromCache(resourceDetails: ResourceDetails): void;
|
41
35
|
}
|
@@ -23,7 +23,17 @@ export class CallWithChatBackedChatAdapter {
|
|
23
23
|
// In order to unsubscribe the handler when offStateChange is called we must have a mapping of the original handler to the newly created handler.
|
24
24
|
this.eventStore = new Map();
|
25
25
|
this.fetchInitialData = () => __awaiter(this, void 0, void 0, function* () { return yield this.callWithChatAdapter.fetchInitialData(); });
|
26
|
-
|
26
|
+
// due to a bug in babel, we can't use arrow function here
|
27
|
+
// affecting conditional-compile-remove(attachment-upload)
|
28
|
+
// have to bind this since the scope of 'this' is lost when the function is passed as a callback
|
29
|
+
this.sendMessageHandler = function (content,
|
30
|
+
/* @conditional-compile-remove(attachment-upload) */
|
31
|
+
options) {
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
33
|
+
yield this.callWithChatAdapter.sendMessage(content, /* @conditional-compile-remove(attachment-upload) */ options);
|
34
|
+
});
|
35
|
+
};
|
36
|
+
this.sendMessage = this.sendMessageHandler.bind(this);
|
27
37
|
this.sendReadReceipt = (chatMessageId) => __awaiter(this, void 0, void 0, function* () { return yield this.callWithChatAdapter.sendReadReceipt(chatMessageId); });
|
28
38
|
this.sendTypingIndicator = () => __awaiter(this, void 0, void 0, function* () { return yield this.callWithChatAdapter.sendTypingIndicator(); });
|
29
39
|
this.removeParticipant = (userId) => __awaiter(this, void 0, void 0, function* () { return yield this.callWithChatAdapter.removeParticipant(userId); });
|
@@ -66,7 +76,15 @@ export class CallWithChatBackedChatAdapter {
|
|
66
76
|
return this.callWithChatAdapter.off(event, listener);
|
67
77
|
}
|
68
78
|
};
|
69
|
-
|
79
|
+
// due to a bug in babel, we can't use arrow function here
|
80
|
+
// affecting conditional-compile-remove(attachment-upload)
|
81
|
+
// have to bind this since the scope of 'this' is lost when the function is passed as a callback
|
82
|
+
this.updateMessageHandler = function (messageId, content, options) {
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
84
|
+
yield this.callWithChatAdapter.updateMessage(messageId, content, options);
|
85
|
+
});
|
86
|
+
};
|
87
|
+
this.updateMessage = this.updateMessageHandler.bind(this);
|
70
88
|
this.deleteMessage = (messageId) => __awaiter(this, void 0, void 0, function* () { return yield this.callWithChatAdapter.deleteMessage(messageId); });
|
71
89
|
this.clearErrors = (errorTypes) => {
|
72
90
|
throw new Error(`Method not supported in CallWithChatComposite.`);
|
@@ -74,40 +92,8 @@ export class CallWithChatBackedChatAdapter {
|
|
74
92
|
this.setTopic = (topicName) => __awaiter(this, void 0, void 0, function* () {
|
75
93
|
throw new Error(`Chat Topics are not supported in CallWithChatComposite.`);
|
76
94
|
});
|
77
|
-
/* @conditional-compile-remove(attachment-upload) */
|
78
|
-
this.registerActiveUploads = (files) => {
|
79
|
-
return this.callWithChatAdapter.registerActiveUploads(files);
|
80
|
-
};
|
81
|
-
/* @conditional-compile-remove(attachment-upload) */
|
82
|
-
this.registerCompletedUploads = (metadata) => {
|
83
|
-
return this.callWithChatAdapter.registerCompletedUploads(metadata);
|
84
|
-
};
|
85
|
-
/* @conditional-compile-remove(attachment-upload) */
|
86
|
-
this.clearUploads = () => {
|
87
|
-
this.callWithChatAdapter.clearUploads();
|
88
|
-
};
|
89
|
-
/* @conditional-compile-remove(attachment-upload) */
|
90
|
-
this.cancelUpload = (id) => {
|
91
|
-
this.callWithChatAdapter.cancelUpload(id);
|
92
|
-
};
|
93
|
-
/* @conditional-compile-remove(attachment-upload) */
|
94
|
-
this.updateUploadProgress = (id, progress) => {
|
95
|
-
this.callWithChatAdapter.updateUploadProgress(id, progress);
|
96
|
-
};
|
97
|
-
/* @conditional-compile-remove(attachment-upload) */
|
98
|
-
this.updateUploadStatusMessage = (id, errorMessage) => {
|
99
|
-
this.callWithChatAdapter.updateUploadStatusMessage(id, errorMessage);
|
100
|
-
};
|
101
|
-
/* @conditional-compile-remove(attachment-upload) */
|
102
|
-
this.updateUploadMetadata = (id, metadata) => {
|
103
|
-
this.callWithChatAdapter.updateUploadMetadata(id, metadata);
|
104
|
-
};
|
105
95
|
this.callWithChatAdapter = callWithChatAdapter;
|
106
96
|
}
|
107
|
-
/* @conditional-compile-remove(attachment-upload) */
|
108
|
-
sendMessageWithAttachments(content, attachments) {
|
109
|
-
return this.callWithChatAdapter.sendMessageWithAttachments(content, attachments);
|
110
|
-
}
|
111
97
|
downloadResourceToCache(resourceDetails) {
|
112
98
|
return __awaiter(this, void 0, void 0, function* () {
|
113
99
|
this.callWithChatAdapter.downloadResourceToCache(resourceDetails);
|
@@ -135,18 +121,14 @@ function chatAdapterStateFromCallWithChatAdapterState(callWithChatAdapterState)
|
|
135
121
|
typingIndicators: [],
|
136
122
|
latestReadTime: new Date()
|
137
123
|
},
|
138
|
-
latestErrors: callWithChatAdapterState.latestChatErrors
|
139
|
-
/* @conditional-compile-remove(attachment-upload) */
|
140
|
-
_attachmentUploads: callWithChatAdapterState._attachmentUploads
|
124
|
+
latestErrors: callWithChatAdapterState.latestChatErrors
|
141
125
|
};
|
142
126
|
}
|
143
127
|
return {
|
144
128
|
userId: callWithChatAdapterState.userId,
|
145
129
|
displayName: callWithChatAdapterState.displayName || '',
|
146
130
|
thread: callWithChatAdapterState.chat,
|
147
|
-
latestErrors: callWithChatAdapterState.latestChatErrors
|
148
|
-
/* @conditional-compile-remove(attachment-upload) */
|
149
|
-
_attachmentUploads: callWithChatAdapterState._attachmentUploads
|
131
|
+
latestErrors: callWithChatAdapterState.latestChatErrors
|
150
132
|
};
|
151
133
|
}
|
152
134
|
//# sourceMappingURL=CallWithChatBackedChatAdapter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallWithChatBackedChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AASlC,OAAO,EAAE,6BAA6B,EAAE,yCAAgC;AAExE,uDAAuD;AACvD,sDAAsD;AAEtD;;;;GAIG;AACH,MAAM,OAAO,6BAA6B;IAOxC,YAAY,mBAAwC;QAJpD,gJAAgJ;QAChJ,iJAAiJ;QACzI,eAAU,GAAsF,IAAI,GAAG,EAAE,CAAC;QAM3G,qBAAgB,GAAG,GAAwB,EAAE,gDAAC,OAAA,MAAM,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,CAAA,GAAA,CAAC;QAChG,gBAAW,GAAG,CAAO,OAAe,EAAiB,EAAE,gDAAC,OAAA,MAAM,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA,GAAA,CAAC;QAK5G,oBAAe,GAAG,CAAO,aAAqB,EAAiB,EAAE,gDACtE,OAAA,MAAM,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAA,GAAA,CAAC;QACzD,wBAAmB,GAAG,GAAwB,EAAE,gDAAC,OAAA,MAAM,IAAI,CAAC,mBAAmB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,IAAI,EAAE;QACvD,MAAM,EAAE,wBAAwB,CAAC,IAAI;QACrC,YAAY,EAAE,wBAAwB,CAAC,gBAAgB;QACvD,oDAAoD;QACpD,kBAAkB,EAAE,wBAAwB,CAAC,kBAAkB;KAChE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallWithChatAdapter } from './CallWithChatAdapter';\nimport { ChatAdapter, ChatAdapterState } from '../../ChatComposite';\nimport { ResourceDetails } from '../../ChatComposite';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata, AttachmentUploadTask } from '@internal/react-components';\nimport { ErrorBarStrings } from '@internal/react-components';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/**\n * Facade around the CallWithChatAdapter to satisfy the chat adapter interface.\n *\n * @private\n */\nexport class CallWithChatBackedChatAdapter implements ChatAdapter {\n private callWithChatAdapter: CallWithChatAdapter;\n\n // For onStateChange we must convert CallWithChat state to chat state. This involves creating a new handler to be passed into the onStateChange.\n // In order to unsubscribe the handler when offStateChange is called we must have a mapping of the original handler to the newly created handler.\n private eventStore: Map<(state: ChatAdapterState) => void, (state: CallWithChatAdapterState) => void> = new Map();\n\n constructor(callWithChatAdapter: CallWithChatAdapter) {\n this.callWithChatAdapter = callWithChatAdapter;\n }\n\n public fetchInitialData = async (): Promise<void> => await this.callWithChatAdapter.fetchInitialData();\n public sendMessage = async (content: string): Promise<void> => await this.callWithChatAdapter.sendMessage(content);\n /* @conditional-compile-remove(attachment-upload) */\n public sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void> {\n return this.callWithChatAdapter.sendMessageWithAttachments(content, attachments);\n }\n public sendReadReceipt = async (chatMessageId: string): Promise<void> =>\n await this.callWithChatAdapter.sendReadReceipt(chatMessageId);\n public sendTypingIndicator = async (): Promise<void> => await this.callWithChatAdapter.sendTypingIndicator();\n public removeParticipant = async (userId: string): Promise<void> =>\n await this.callWithChatAdapter.removeParticipant(userId);\n public loadPreviousChatMessages = async (messagesToLoad: number): Promise<boolean> =>\n await this.callWithChatAdapter.loadPreviousChatMessages(messagesToLoad);\n public dispose = (): void => this.callWithChatAdapter.dispose();\n\n public onStateChange = (handler: (state: ChatAdapterState) => void): void => {\n const convertedHandler = (state: CallWithChatAdapterState): void => {\n !!state.chat && handler(chatAdapterStateFromCallWithChatAdapterState(state));\n };\n this.callWithChatAdapter.onStateChange(convertedHandler);\n this.eventStore.set(handler, convertedHandler);\n };\n public offStateChange = (handler: (state: ChatAdapterState) => void): void => {\n const convertedHandler = this.eventStore.get(handler);\n convertedHandler && this.callWithChatAdapter.offStateChange(convertedHandler);\n };\n public getState = (): ChatAdapterState =>\n chatAdapterStateFromCallWithChatAdapterState(this.callWithChatAdapter.getState());\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n public on = (event: any, listener: any): void => {\n switch (event) {\n case 'error':\n return this.callWithChatAdapter.on('chatError', listener);\n case 'participantsAdded':\n return this.callWithChatAdapter.on('chatParticipantsAdded', listener);\n case 'participantsRemoved':\n return this.callWithChatAdapter.on('chatParticipantsRemoved', listener);\n default:\n return this.callWithChatAdapter.on(event, listener);\n }\n };\n public off = (event: any, listener: any): void => {\n switch (event) {\n case 'error':\n return this.callWithChatAdapter.off('chatError', listener);\n case 'participantsAdded':\n return this.callWithChatAdapter.off('chatParticipantsAdded', listener);\n case 'participantsRemoved':\n return this.callWithChatAdapter.off('chatParticipantsRemoved', listener);\n default:\n return this.callWithChatAdapter.off(event, listener);\n }\n };\n public updateMessage = async (messageId: string, content: string, metadata?: Record<string, string>): Promise<void> =>\n await this.callWithChatAdapter.updateMessage(messageId, content, metadata);\n public deleteMessage = async (messageId: string): Promise<void> =>\n await this.callWithChatAdapter.deleteMessage(messageId);\n\n public clearErrors = (errorTypes: (keyof ErrorBarStrings)[]): void => {\n throw new Error(`Method not supported in CallWithChatComposite.`);\n };\n\n public setTopic = async (topicName: string): Promise<void> => {\n throw new Error(`Chat Topics are not supported in CallWithChatComposite.`);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public registerActiveUploads = (files: File[]): AttachmentUploadTask[] => {\n return this.callWithChatAdapter.registerActiveUploads(files);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public registerCompletedUploads = (metadata: AttachmentMetadata[]): AttachmentUploadTask[] => {\n return this.callWithChatAdapter.registerCompletedUploads(metadata);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public clearUploads = (): void => {\n this.callWithChatAdapter.clearUploads();\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public cancelUpload = (id: string): void => {\n this.callWithChatAdapter.cancelUpload(id);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public updateUploadProgress = (id: string, progress: number): void => {\n this.callWithChatAdapter.updateUploadProgress(id, progress);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public updateUploadStatusMessage = (id: string, errorMessage: string): void => {\n this.callWithChatAdapter.updateUploadStatusMessage(id, errorMessage);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public updateUploadMetadata = (id: string, metadata: AttachmentMetadata): void => {\n this.callWithChatAdapter.updateUploadMetadata(id, metadata);\n };\n\n public async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.callWithChatAdapter.downloadResourceToCache(resourceDetails);\n }\n public removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.callWithChatAdapter.removeResourceFromCache(resourceDetails);\n }\n}\n\nfunction chatAdapterStateFromCallWithChatAdapterState(\n callWithChatAdapterState: CallWithChatAdapterState\n): ChatAdapterState {\n if (!callWithChatAdapterState.chat) {\n // Return some empty state if chat is not initialized yet\n return {\n userId: callWithChatAdapterState.userId,\n displayName: callWithChatAdapterState.displayName || '',\n thread: {\n chatMessages: {},\n participants: {\n [toFlatCommunicationIdentifier(callWithChatAdapterState.userId)]: {\n id: callWithChatAdapterState.userId\n }\n },\n threadId: '',\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date()\n },\n latestErrors: callWithChatAdapterState.latestChatErrors,\n /* @conditional-compile-remove(attachment-upload) */\n _attachmentUploads: callWithChatAdapterState._attachmentUploads\n };\n }\n\n return {\n userId: callWithChatAdapterState.userId,\n displayName: callWithChatAdapterState.displayName || '',\n thread: callWithChatAdapterState.chat,\n latestErrors: callWithChatAdapterState.latestChatErrors,\n /* @conditional-compile-remove(attachment-upload) */\n _attachmentUploads: callWithChatAdapterState._attachmentUploads\n };\n}\n"]}
|
1
|
+
{"version":3,"file":"CallWithChatBackedChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AASlC,OAAO,EAAE,6BAA6B,EAAE,yCAAgC;AAExE,uDAAuD;AACvD,sDAAsD;AAEtD;;;;GAIG;AACH,MAAM,OAAO,6BAA6B;IAOxC,YAAY,mBAAwC;QAJpD,gJAAgJ;QAChJ,iJAAiJ;QACzI,eAAU,GAAsF,IAAI,GAAG,EAAE,CAAC;QAM3G,qBAAgB,GAAG,GAAwB,EAAE,gDAAC,OAAA,MAAM,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,CAAA,GAAA,CAAC;QACvG,0DAA0D;QAC1D,0DAA0D;QAC1D,gGAAgG;QAChG,uBAAkB,GAAG,UAEnB,OAAe;QACf,oDAAoD;QACpD,OAAwB;;gBAExB,MAAM,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,OAAO,EAAE,oDAAoD,CAAC,OAAO,CAAC,CAAC;YACpH,CAAC;SAAA,CAAC;QACK,gBAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,oBAAe,GAAG,CAAO,aA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YAAY,EAAE,EAAE;gBAChB,gBAAgB,EAAE,EAAE;gBACpB,cAAc,EAAE,IAAI,IAAI,EAAE;aAC3B;YACD,YAAY,EAAE,wBAAwB,CAAC,gBAAgB;SACxD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,wBAAwB,CAAC,MAAM;QACvC,WAAW,EAAE,wBAAwB,CAAC,WAAW,IAAI,EAAE;QACvD,MAAM,EAAE,wBAAwB,CAAC,IAAI;QACrC,YAAY,EAAE,wBAAwB,CAAC,gBAAgB;KACxD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallWithChatAdapter } from './CallWithChatAdapter';\nimport { ChatAdapter, ChatAdapterState } from '../../ChatComposite';\nimport { ResourceDetails } from '../../ChatComposite';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\nimport { ErrorBarStrings } from '@internal/react-components';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/**\n * Facade around the CallWithChatAdapter to satisfy the chat adapter interface.\n *\n * @private\n */\nexport class CallWithChatBackedChatAdapter implements ChatAdapter {\n private callWithChatAdapter: CallWithChatAdapter;\n\n // For onStateChange we must convert CallWithChat state to chat state. This involves creating a new handler to be passed into the onStateChange.\n // In order to unsubscribe the handler when offStateChange is called we must have a mapping of the original handler to the newly created handler.\n private eventStore: Map<(state: ChatAdapterState) => void, (state: CallWithChatAdapterState) => void> = new Map();\n\n constructor(callWithChatAdapter: CallWithChatAdapter) {\n this.callWithChatAdapter = callWithChatAdapter;\n }\n\n public fetchInitialData = async (): Promise<void> => await this.callWithChatAdapter.fetchInitialData();\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n // have to bind this since the scope of 'this' is lost when the function is passed as a callback\n sendMessageHandler = async function (\n this: CallWithChatBackedChatAdapter,\n content: string,\n /* @conditional-compile-remove(attachment-upload) */\n options?: MessageOptions\n ): Promise<void> {\n await this.callWithChatAdapter.sendMessage(content, /* @conditional-compile-remove(attachment-upload) */ options);\n };\n public sendMessage = this.sendMessageHandler.bind(this);\n public sendReadReceipt = async (chatMessageId: string): Promise<void> =>\n await this.callWithChatAdapter.sendReadReceipt(chatMessageId);\n public sendTypingIndicator = async (): Promise<void> => await this.callWithChatAdapter.sendTypingIndicator();\n public removeParticipant = async (userId: string): Promise<void> =>\n await this.callWithChatAdapter.removeParticipant(userId);\n public loadPreviousChatMessages = async (messagesToLoad: number): Promise<boolean> =>\n await this.callWithChatAdapter.loadPreviousChatMessages(messagesToLoad);\n public dispose = (): void => this.callWithChatAdapter.dispose();\n\n public onStateChange = (handler: (state: ChatAdapterState) => void): void => {\n const convertedHandler = (state: CallWithChatAdapterState): void => {\n !!state.chat && handler(chatAdapterStateFromCallWithChatAdapterState(state));\n };\n this.callWithChatAdapter.onStateChange(convertedHandler);\n this.eventStore.set(handler, convertedHandler);\n };\n public offStateChange = (handler: (state: ChatAdapterState) => void): void => {\n const convertedHandler = this.eventStore.get(handler);\n convertedHandler && this.callWithChatAdapter.offStateChange(convertedHandler);\n };\n public getState = (): ChatAdapterState =>\n chatAdapterStateFromCallWithChatAdapterState(this.callWithChatAdapter.getState());\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n public on = (event: any, listener: any): void => {\n switch (event) {\n case 'error':\n return this.callWithChatAdapter.on('chatError', listener);\n case 'participantsAdded':\n return this.callWithChatAdapter.on('chatParticipantsAdded', listener);\n case 'participantsRemoved':\n return this.callWithChatAdapter.on('chatParticipantsRemoved', listener);\n default:\n return this.callWithChatAdapter.on(event, listener);\n }\n };\n public off = (event: any, listener: any): void => {\n switch (event) {\n case 'error':\n return this.callWithChatAdapter.off('chatError', listener);\n case 'participantsAdded':\n return this.callWithChatAdapter.off('chatParticipantsAdded', listener);\n case 'participantsRemoved':\n return this.callWithChatAdapter.off('chatParticipantsRemoved', listener);\n default:\n return this.callWithChatAdapter.off(event, listener);\n }\n };\n\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n // have to bind this since the scope of 'this' is lost when the function is passed as a callback\n updateMessageHandler = async function (\n this: CallWithChatBackedChatAdapter,\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void> {\n await this.callWithChatAdapter.updateMessage(messageId, content, options);\n };\n\n public updateMessage = this.updateMessageHandler.bind(this);\n public deleteMessage = async (messageId: string): Promise<void> =>\n await this.callWithChatAdapter.deleteMessage(messageId);\n\n public clearErrors = (errorTypes: (keyof ErrorBarStrings)[]): void => {\n throw new Error(`Method not supported in CallWithChatComposite.`);\n };\n\n public setTopic = async (topicName: string): Promise<void> => {\n throw new Error(`Chat Topics are not supported in CallWithChatComposite.`);\n };\n\n public async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.callWithChatAdapter.downloadResourceToCache(resourceDetails);\n }\n public removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.callWithChatAdapter.removeResourceFromCache(resourceDetails);\n }\n}\n\nfunction chatAdapterStateFromCallWithChatAdapterState(\n callWithChatAdapterState: CallWithChatAdapterState\n): ChatAdapterState {\n if (!callWithChatAdapterState.chat) {\n // Return some empty state if chat is not initialized yet\n return {\n userId: callWithChatAdapterState.userId,\n displayName: callWithChatAdapterState.displayName || '',\n thread: {\n chatMessages: {},\n participants: {\n [toFlatCommunicationIdentifier(callWithChatAdapterState.userId)]: {\n id: callWithChatAdapterState.userId\n }\n },\n threadId: '',\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date()\n },\n latestErrors: callWithChatAdapterState.latestChatErrors\n };\n }\n\n return {\n userId: callWithChatAdapterState.userId,\n displayName: callWithChatAdapterState.displayName || '',\n thread: callWithChatAdapterState.chat,\n latestErrors: callWithChatAdapterState.latestChatErrors\n };\n}\n"]}
|
@@ -5,7 +5,6 @@ import { CallAdapter, CallAdapterState, CallCompositePage } from '../../CallComp
|
|
5
5
|
import { VideoBackgroundImage, VideoBackgroundEffect } from '../../CallComposite';
|
6
6
|
import { VideoBackgroundEffectsDependency } from "../../../../../calling-component-bindings/src";
|
7
7
|
import { ChatAdapterState } from '../../ChatComposite';
|
8
|
-
import { _AttachmentUploadsUiState } from '../../ChatComposite';
|
9
8
|
import { AdapterErrors } from '../../common/adapters';
|
10
9
|
import { EnvironmentInfo } from '@azure/communication-calling';
|
11
10
|
import { ReactionResources } from "../../../../../react-components/src";
|
@@ -27,14 +26,6 @@ export interface CallWithChatAdapterUiState {
|
|
27
26
|
* @public
|
28
27
|
*/
|
29
28
|
page: CallCompositePage;
|
30
|
-
/**
|
31
|
-
* Files being uploaded by a user in the current thread.
|
32
|
-
* Should be set to null once the upload is complete.
|
33
|
-
* Array of type {@link _AttachmentUploadsUiState}
|
34
|
-
*
|
35
|
-
* @internal
|
36
|
-
*/
|
37
|
-
_attachmentUploads?: _AttachmentUploadsUiState;
|
38
29
|
/**
|
39
30
|
* State to track whether the end user has opted in to using a
|
40
31
|
* out of date version of a supported browser. Allows the user
|
@@ -17,8 +17,6 @@ export function callWithChatAdapterStateFromBackingStates(callAdapter) {
|
|
17
17
|
isTeamsMeeting: callAdapterState.isTeamsMeeting,
|
18
18
|
latestCallErrors: callAdapterState.latestErrors,
|
19
19
|
latestChatErrors: {},
|
20
|
-
/* @conditional-compile-remove(attachment-upload) */
|
21
|
-
_attachmentUploads: {},
|
22
20
|
/* @conditional-compile-remove(PSTN-calls) */
|
23
21
|
alternateCallerId: callAdapterState.alternateCallerId,
|
24
22
|
/* @conditional-compile-remove(unsupported-browser) */
|
@@ -36,9 +34,7 @@ export function callWithChatAdapterStateFromBackingStates(callAdapter) {
|
|
36
34
|
* @private
|
37
35
|
*/
|
38
36
|
export function mergeChatAdapterStateIntoCallWithChatAdapterState(existingCallWithChatAdapterState, chatAdapterState) {
|
39
|
-
return Object.assign(Object.assign({}, existingCallWithChatAdapterState), { chat: chatAdapterState.thread, latestChatErrors: chatAdapterState.latestErrors
|
40
|
-
/* @conditional-compile-remove(attachment-upload) */
|
41
|
-
_attachmentUploads: chatAdapterState._attachmentUploads });
|
37
|
+
return Object.assign(Object.assign({}, existingCallWithChatAdapterState), { chat: chatAdapterState.thread, latestChatErrors: chatAdapterState.latestErrors });
|
42
38
|
}
|
43
39
|
/**
|
44
40
|
* @private
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallWithChatAdapterState.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
1
|
+
{"version":3,"file":"CallWithChatAdapterState.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqGlC;;GAEG;AACH,MAAM,UAAU,yCAAyC,CAAC,WAAwB;IAChF,MAAM,gBAAgB,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAEhD,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,IAAI;QAC3B,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,gBAAgB,CAAC,MAAM;QAC/B,IAAI,EAAE,gBAAgB,CAAC,IAAI;QAC3B,WAAW,EAAE,gBAAgB,CAAC,WAAW;QACzC,OAAO,EAAE,gBAAgB,CAAC,OAAO;QACjC,+BAA+B,EAAE,gBAAgB,CAAC,+BAA+B;QACjF,WAAW,EAAE,gBAAgB,CAAC,WAAW;QACzC,cAAc,EAAE,gBAAgB,CAAC,cAAc;QAC/C,gBAAgB,EAAE,gBAAgB,CAAC,YAAY;QAC/C,gBAAgB,EAAE,EAAE;QACpB,6CAA6C;QAC7C,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB;QACrD,sDAAsD;QACtD,eAAe,EAAE,gBAAgB,CAAC,eAAe;QACjD,qBAAqB,EAAE,gBAAgB,CAAC,qBAAqB;QAC7D,8BAA8B,EAAE,gBAAgB,CAAC,8BAA8B;QAC/E,6BAA6B,EAAE,gBAAgB,CAAC,6BAA6B;QAC7E,qDAAqD;QACrD,2CAA2C;QAC3C,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB;QACrD,SAAS,EAAE,gBAAgB,CAAC,SAAS;KACtC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iDAAiD,CAC/D,gCAA0D,EAC1D,gBAAkC;IAElC,uCACK,gCAAgC,KACnC,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAC7B,gBAAgB,EAAE,gBAAgB,CAAC,YAAY,IAC/C;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iDAAiD,CAC/D,gCAA0D,EAC1D,gBAAkC;IAElC,uCACK,gCAAgC,KACnC,MAAM,EAAE,gBAAgB,CAAC,MAAM,EAC/B,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAC3B,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EACjC,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAC3B,+BAA+B,EAAE,gBAAgB,CAAC,+BAA+B,EACjF,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,gBAAgB,EAAE,gBAAgB,CAAC,YAAY,EAE/C,qBAAqB,EAAE,gBAAgB,CAAC,qBAAqB,EAE7D,8BAA8B,EAAE,gBAAgB,CAAC,8BAA8B,EAE/E,6BAA6B,EAAE,gBAAgB,CAAC,6BAA6B,IAC7E;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { CallState, DeviceManagerState } from '@internal/calling-stateful-client';\nimport { ChatThreadClientState } from '@internal/chat-stateful-client';\nimport { CallAdapter, CallAdapterState, CallCompositePage } from '../../CallComposite';\n\nimport { VideoBackgroundImage, VideoBackgroundEffect } from '../../CallComposite';\n\nimport { VideoBackgroundEffectsDependency } from '@internal/calling-component-bindings';\nimport { ChatAdapterState } from '../../ChatComposite';\nimport { AdapterErrors } from '../../common/adapters';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\nimport { ReactionResources } from '@internal/react-components';\n\n/**\n * UI state pertaining to the {@link CallWithChatComposite}.\n *\n * @public\n */\nexport interface CallWithChatAdapterUiState {\n /**\n * Microphone state before a call has joined.\n *\n * @public\n */\n isLocalPreviewMicrophoneEnabled: boolean;\n /**\n * Current page of the Composite.\n *\n * @public\n */\n page: CallCompositePage;\n /* @conditional-compile-remove(unsupported-browser) */\n /**\n * State to track whether the end user has opted in to using a\n * out of date version of a supported browser. Allows the user\n * to start a call in this state.\n *\n * @beta\n */\n unsupportedBrowserVersionsAllowed?: boolean;\n}\n\n/**\n * State from the backend services that drives {@link CallWithChatComposite}.\n *\n * @public\n */\nexport interface CallWithChatClientState {\n /** ID of the call participant using this CallWithChatAdapter. */\n userId: CommunicationIdentifierKind;\n /** Display name of the participant using this CallWithChatAdapter. */\n displayName: string | undefined;\n /** State of the current call. */\n call?: CallState;\n /** State of the current chat. */\n chat?: ChatThreadClientState;\n /** Latest call error encountered for each operation performed via the adapter. */\n latestCallErrors: AdapterErrors;\n /** Latest chat error encountered for each operation performed via the adapter. */\n latestChatErrors: AdapterErrors;\n /** State of available and currently selected devices */\n devices: DeviceManagerState;\n /** State of whether the active call is a Teams interop call */\n isTeamsCall: boolean;\n /** State of whether the active call is a Teams interop meeting */\n isTeamsMeeting: boolean;\n /* @conditional-compile-remove(PSTN-calls) */\n /** alternateCallerId for PSTN call */\n alternateCallerId?: string | undefined;\n /* @conditional-compile-remove(unsupported-browser) */\n /** Environment information for system adapter is made on */\n environmentInfo?: EnvironmentInfo;\n\n /** Default set of background images for background replacement effect */\n videoBackgroundImages?: VideoBackgroundImage[];\n\n /** Dependency to be injected for video background effects */\n onResolveVideoEffectDependency?: () => Promise<VideoBackgroundEffectsDependency>;\n\n /** State to track the selected video background effect */\n selectedVideoBackgroundEffect?: VideoBackgroundEffect;\n /* @conditional-compile-remove(hide-attendee-name) */\n /** Hide attendee names in teams meeting */\n hideAttendeeNames?: boolean;\n /**\n * Reaction resources to render in meetings\n * */\n reactions?: ReactionResources;\n}\n\n/**\n * CallWithChat State is a combination of Stateful Chat and Stateful Calling clients with some\n * state specific to the CallWithChat Composite only.\n *\n * @public\n */\nexport interface CallWithChatAdapterState extends CallWithChatAdapterUiState, CallWithChatClientState {}\n\n/**\n * @private\n */\nexport function callWithChatAdapterStateFromBackingStates(callAdapter: CallAdapter): CallWithChatAdapterState {\n const callAdapterState = callAdapter.getState();\n\n return {\n call: callAdapterState.call,\n chat: undefined,\n userId: callAdapterState.userId,\n page: callAdapterState.page,\n displayName: callAdapterState.displayName,\n devices: callAdapterState.devices,\n isLocalPreviewMicrophoneEnabled: callAdapterState.isLocalPreviewMicrophoneEnabled,\n isTeamsCall: callAdapterState.isTeamsCall,\n isTeamsMeeting: callAdapterState.isTeamsMeeting,\n latestCallErrors: callAdapterState.latestErrors,\n latestChatErrors: {},\n /* @conditional-compile-remove(PSTN-calls) */\n alternateCallerId: callAdapterState.alternateCallerId,\n /* @conditional-compile-remove(unsupported-browser) */\n environmentInfo: callAdapterState.environmentInfo,\n videoBackgroundImages: callAdapterState.videoBackgroundImages,\n onResolveVideoEffectDependency: callAdapterState.onResolveVideoEffectDependency,\n selectedVideoBackgroundEffect: callAdapterState.selectedVideoBackgroundEffect,\n /* @conditional-compile-remove(hide-attendee-name) */\n /** Hide attendee names in teams meeting */\n hideAttendeeNames: callAdapterState.hideAttendeeNames,\n reactions: callAdapterState.reactions\n };\n}\n\n/**\n * @private\n */\nexport function mergeChatAdapterStateIntoCallWithChatAdapterState(\n existingCallWithChatAdapterState: CallWithChatAdapterState,\n chatAdapterState: ChatAdapterState\n): CallWithChatAdapterState {\n return {\n ...existingCallWithChatAdapterState,\n chat: chatAdapterState.thread,\n latestChatErrors: chatAdapterState.latestErrors\n };\n}\n\n/**\n * @private\n */\nexport function mergeCallAdapterStateIntoCallWithChatAdapterState(\n existingCallWithChatAdapterState: CallWithChatAdapterState,\n callAdapterState: CallAdapterState\n): CallWithChatAdapterState {\n return {\n ...existingCallWithChatAdapterState,\n userId: callAdapterState.userId,\n page: callAdapterState.page,\n displayName: callAdapterState.displayName,\n devices: callAdapterState.devices,\n call: callAdapterState.call,\n isLocalPreviewMicrophoneEnabled: callAdapterState.isLocalPreviewMicrophoneEnabled,\n isTeamsCall: callAdapterState.isTeamsCall,\n isTeamsMeeting: callAdapterState.isTeamsMeeting,\n latestCallErrors: callAdapterState.latestErrors,\n\n videoBackgroundImages: callAdapterState.videoBackgroundImages,\n\n onResolveVideoEffectDependency: callAdapterState.onResolveVideoEffectDependency,\n\n selectedVideoBackgroundEffect: callAdapterState.selectedVideoBackgroundEffect\n };\n}\n"]}
|
@@ -14,10 +14,13 @@ import { mergeStyles, Stack } from '@fluentui/react';
|
|
14
14
|
import { PersonaSize } from '@fluentui/react';
|
15
15
|
import { ErrorBar, MessageThread, TypingIndicator, useTheme } from "../../../../react-components/src";
|
16
16
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
17
|
+
/* @conditional-compile-remove(attachment-upload) */
|
18
|
+
import { useReducer } from 'react';
|
17
19
|
import { useState } from 'react';
|
18
20
|
import { AvatarPersona } from '../common/AvatarPersona';
|
19
21
|
import { useAdapter } from './adapter/ChatAdapterProvider';
|
20
22
|
import { ChatHeader, getHeaderProps } from './ChatHeader';
|
23
|
+
/* @conditional-compile-remove(attachment-upload) */
|
21
24
|
import { AttachmentUploadButtonWrapper as AttachmentUploadButton } from './file-sharing';
|
22
25
|
import { useAdaptedSelector } from './hooks/useAdaptedSelector';
|
23
26
|
import { usePropsFor } from './hooks/usePropsFor';
|
@@ -32,9 +35,9 @@ import { _AttachmentDownloadCards } from "../../../../react-components/src";
|
|
32
35
|
import { ImageOverlay } from "../../../../react-components/src";
|
33
36
|
import { SendBox } from "../../../../react-components/src";
|
34
37
|
/* @conditional-compile-remove(attachment-upload) */
|
35
|
-
import {
|
38
|
+
import { nanoid } from 'nanoid';
|
36
39
|
/* @conditional-compile-remove(attachment-upload) */
|
37
|
-
import {
|
40
|
+
import { AttachmentUploadActionType, AttachmentUploadReducer } from './file-sharing/AttachmentUpload';
|
38
41
|
/**
|
39
42
|
* @private
|
40
43
|
*/
|
@@ -46,6 +49,8 @@ export const ChatScreen = (props) => {
|
|
46
49
|
const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');
|
47
50
|
const [overlayImageItem, setOverlayImageItem] = useState();
|
48
51
|
const [isImageOverlayOpen, setIsImageOverlayOpen] = useState(false);
|
52
|
+
/* @conditional-compile-remove(attachment-upload) */
|
53
|
+
const [uploads, handleUploadAction] = useReducer(AttachmentUploadReducer, []);
|
49
54
|
const adapter = useAdapter();
|
50
55
|
const theme = useTheme();
|
51
56
|
useEffect(() => {
|
@@ -105,18 +110,44 @@ export const ChatScreen = (props) => {
|
|
105
110
|
return Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.sendBox);
|
106
111
|
}, [styles === null || styles === void 0 ? void 0 : styles.sendBox]);
|
107
112
|
const userId = toFlatCommunicationIdentifier(adapter.getState().userId);
|
113
|
+
/* @conditional-compile-remove(attachment-upload) */
|
108
114
|
const attachmentUploadButtonOnChange = useCallback((files) => {
|
109
115
|
var _a;
|
110
116
|
if (!files) {
|
111
117
|
return;
|
112
118
|
}
|
113
|
-
|
114
|
-
const
|
115
|
-
|
116
|
-
|
117
|
-
|
119
|
+
// Get files, change to tasks, store locally and pass back to Contoso
|
120
|
+
const newUploads = Array.from(files).map((file) => {
|
121
|
+
const taskId = nanoid();
|
122
|
+
return {
|
123
|
+
file,
|
124
|
+
taskId,
|
125
|
+
metadata: {
|
126
|
+
id: taskId,
|
127
|
+
name: file.name,
|
128
|
+
progress: 0
|
129
|
+
},
|
130
|
+
notifyUploadProgressChanged: (value) => {
|
131
|
+
handleUploadAction({ type: AttachmentUploadActionType.Progress, taskId, progress: value });
|
132
|
+
},
|
133
|
+
notifyUploadCompleted: (id, url) => {
|
134
|
+
handleUploadAction({ type: AttachmentUploadActionType.Completed, taskId, id, url });
|
135
|
+
},
|
136
|
+
notifyUploadFailed: (message) => {
|
137
|
+
handleUploadAction({ type: AttachmentUploadActionType.Failed, taskId, message });
|
138
|
+
// remove the failed upload task when error banner is auto dismissed after 10 seconds
|
139
|
+
// so the banner won't be shown again on UI re-rendering.
|
140
|
+
setTimeout(() => {
|
141
|
+
handleUploadAction({ type: AttachmentUploadActionType.Remove, id: taskId });
|
142
|
+
}, 10 * 1000);
|
143
|
+
}
|
144
|
+
};
|
145
|
+
});
|
146
|
+
handleUploadAction({ type: AttachmentUploadActionType.Set, newUploads });
|
147
|
+
(_a = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _a === void 0 ? void 0 : _a.handleAttachmentSelection(newUploads);
|
148
|
+
}, [attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions]);
|
118
149
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
119
|
-
const onRenderAttachmentDownloads = useCallback((
|
150
|
+
const onRenderAttachmentDownloads = useCallback((message) => {
|
120
151
|
var _a, _b, _c;
|
121
152
|
return ((_b = (_a = message === null || message === void 0 ? void 0 : message.attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? (React.createElement(_AttachmentDownloadCards, { attachments: message.attachments, message: message, actionsForAttachment: (_c = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.downloadOptions) === null || _c === void 0 ? void 0 : _c.actionsForAttachment, onActionHandlerFailed: (errorMessage) => {
|
122
153
|
setDownloadErrorMessage(errorMessage);
|
@@ -212,18 +243,46 @@ export const ChatScreen = (props) => {
|
|
212
243
|
}, [overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.attachmentId]);
|
213
244
|
const AttachmentButton = useCallback(() => {
|
214
245
|
var _a, _b, _c;
|
246
|
+
/* @conditional-compile-remove(attachment-upload) */
|
215
247
|
if (!((_a = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _a === void 0 ? void 0 : _a.handleAttachmentSelection)) {
|
216
248
|
return null;
|
217
249
|
}
|
250
|
+
/* @conditional-compile-remove(attachment-upload) */
|
218
251
|
return (React.createElement(AttachmentUploadButton, { supportedMediaTypes: (_b = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _b === void 0 ? void 0 : _b.supportedMediaTypes, disableMultipleUploads: (_c = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _c === void 0 ? void 0 : _c.disableMultipleUploads, onChange: attachmentUploadButtonOnChange }));
|
252
|
+
return React.createElement(React.Fragment, null);
|
219
253
|
}, [
|
220
254
|
(_b = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _b === void 0 ? void 0 : _b.handleAttachmentSelection,
|
221
255
|
(_c = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _c === void 0 ? void 0 : _c.supportedMediaTypes,
|
222
256
|
(_d = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _d === void 0 ? void 0 : _d.disableMultipleUploads,
|
257
|
+
/* @conditional-compile-remove(attachment-upload) */
|
223
258
|
attachmentUploadButtonOnChange
|
224
259
|
]);
|
225
260
|
/* @conditional-compile-remove(attachment-upload) */
|
226
|
-
const
|
261
|
+
const attachments = useMemo(() => {
|
262
|
+
return uploads === null || uploads === void 0 ? void 0 : uploads.map((v) => v.metadata);
|
263
|
+
}, [uploads]);
|
264
|
+
const onSendMessageHandler = useCallback(function (content, /* @conditional-compile-remove(attachment-upload) */ options) {
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
266
|
+
var _a;
|
267
|
+
/* @conditional-compile-remove(attachment-upload) */
|
268
|
+
const attachments = (_a = options === null || options === void 0 ? void 0 : options.attachments) !== null && _a !== void 0 ? _a : [];
|
269
|
+
/* @conditional-compile-remove(attachment-upload) */
|
270
|
+
handleUploadAction({ type: AttachmentUploadActionType.Clear });
|
271
|
+
/* @conditional-compile-remove(attachment-upload) */
|
272
|
+
yield adapter.sendMessage(content, {
|
273
|
+
attachments: attachments
|
274
|
+
});
|
275
|
+
/* @conditional-compile-remove(attachment-upload) */
|
276
|
+
return;
|
277
|
+
yield adapter.sendMessage(content);
|
278
|
+
});
|
279
|
+
}, [adapter]);
|
280
|
+
/* @conditional-compile-remove(attachment-upload) */
|
281
|
+
const onCancelUploadHandler = useCallback((id) => {
|
282
|
+
var _a, _b;
|
283
|
+
handleUploadAction({ type: AttachmentUploadActionType.Remove, id });
|
284
|
+
(_b = (_a = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _a === void 0 ? void 0 : _a.handleAttachmentRemoval) === null || _b === void 0 ? void 0 : _b.call(_a, id);
|
285
|
+
}, [attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions]);
|
227
286
|
return (React.createElement(Stack, { className: chatContainer, grow: true },
|
228
287
|
(options === null || options === void 0 ? void 0 : options.topic) !== false && React.createElement(ChatHeader, Object.assign({}, headerProps)),
|
229
288
|
React.createElement(Stack, { className: chatArea, tokens: participantListContainerPadding, horizontal: true, grow: true },
|
@@ -244,13 +303,12 @@ export const ChatScreen = (props) => {
|
|
244
303
|
React.createElement(Stack, { grow: true },
|
245
304
|
React.createElement(SendBox, Object.assign({}, sendBoxProps, { autoFocus: options === null || options === void 0 ? void 0 : options.autoFocus, styles: sendBoxStyles,
|
246
305
|
/* @conditional-compile-remove(attachment-upload) */
|
247
|
-
|
306
|
+
attachments: attachments,
|
248
307
|
/* @conditional-compile-remove(attachment-upload) */
|
249
|
-
onCancelAttachmentUpload:
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
} }))),
|
308
|
+
onCancelAttachmentUpload: onCancelUploadHandler,
|
309
|
+
// we need to overwrite onSendMessage for SendBox because we need to clear attachment state
|
310
|
+
// when submit button is clicked
|
311
|
+
onSendMessage: onSendMessageHandler }))),
|
254
312
|
formFactor !== 'mobile' && React.createElement(AttachmentButton, null)))),
|
255
313
|
/* @conditional-compile-remove(chat-composite-participant-pane) */
|
256
314
|
(options === null || options === void 0 ? void 0 : options.participantPane) === true && (React.createElement(ChatScreenPeoplePane, { onFetchAvatarPersonaData: onFetchAvatarPersonaData, onFetchParticipantMenuItems: props.onFetchParticipantMenuItems, isMobile: formFactor === 'mobile' }))),
|