@azure/communication-react 1.15.0-alpha-202404030013 → 1.15.0-alpha-202404040013
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 +11 -18
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-ButXxDca.js +122 -0
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-ButXxDca.js.map +1 -0
- package/dist/dist-cjs/communication-react/{index-aOBAWcNI.js → index-BK44EyzL.js} +443 -467
- package/dist/dist-cjs/communication-react/index-BK44EyzL.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -2
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +0 -1
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +5 -35
- package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +0 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +0 -3
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CapabilitiesSubscriber.js +0 -1
- package/dist/dist-esm/calling-stateful-client/src/CapabilitiesSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +16 -9
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +2 -1
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +8 -8
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js +5 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +23 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +24 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +7 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +11 -4
- 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/FluentChatMyMessageComponent.js +9 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/ReactionDrawerMenuItem.js +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/ReactionDrawerMenuItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MeetingReactionOverlay.js +1 -1
- package/dist/dist-esm/react-components/src/components/MeetingReactionOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -0
- package/dist/dist-esm/react-components/src/components/MessageThread.js +6 -2
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.js +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.js +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js +1 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +5 -5
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +25 -25
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js +6 -6
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.js +18 -18
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js +14 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/reactionUtils.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/reactionUtils.js +3 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/reactionUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +21 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js +4 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +2 -3
- 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.d.ts +4 -3
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +13 -19
- 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.js +5 -6
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +2 -2
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +5 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +4 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +0 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +7 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CapabilitiesChangedNotificationBar.js +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CapabilitiesChangedNotificationBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js +0 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +2 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +3 -14
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +0 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/capabilitiesChangedInfoAndRoleSelector.js +0 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/capabilitiesChangedInfoAndRoleSelector.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CapabilityChangedNotificationTracking.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js +0 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +1 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +15 -15
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +2 -3
- 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 +1 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +8 -8
- 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.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +0 -14
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +18 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +6 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +22 -22
- 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.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +1 -1
- 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/AttachmentUploadButton.js +4 -4
- 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/hooks/useHandlers.js +9 -5
- 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 +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +7 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.js +2 -5
- package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-B8qxZi1I.js +0 -54
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-B8qxZi1I.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-aOBAWcNI.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +0 -9
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +0 -20
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.d.ts +0 -17
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js +0 -45
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallWithChatBackedChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAYlC,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;QAC5G,oBAAe,GAAG,CAAO,aAAqB,EAAiB,EAAE,gDACtE,OAAA,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CAAC,CAAC;QACvE,CAAC,CAAC;QAEF,qGAAqG;QAC9F,yBAAoB,GAAG,CAAC,EAAU,EAAE,QAA4B,EAAQ,EAAE;YAC/E,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC9D,CAAC,CAAC;QAnGA,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;IAoGY,uBAAuB,CAAC,eAAgC;;YACnE,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;QACpE,CAAC;KAAA;IACM,uBAAuB,CAAC,eAAgC;QAC7D,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;IACpE,CAAC;CACF;AAED,SAAS,4CAA4C,CACnD,wBAAkD;IAElD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,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;QACvD,qGAAqG;QACrG,iBAAiB,EAAE,wBAAwB,CAAC,iBAAiB;KAC9D,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-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadManager } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/react-components';\nimport { ErrorBarStrings } from '@internal/react-components';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\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 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 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-download) @conditional-compile-remove(attachment-upload) */\n public registerActiveUploads = (files: File[]): AttachmentUploadManager[] => {\n return this.callWithChatAdapter.registerActiveUploads(files);\n };\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n public registerCompletedUploads = (metadata: AttachmentMetadata[]): AttachmentUploadManager[] => {\n return this.callWithChatAdapter.registerCompletedUploads(metadata);\n };\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n public clearUploads = (): void => {\n this.callWithChatAdapter.clearUploads();\n };\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n public cancelUpload = (id: string): void => {\n this.callWithChatAdapter.cancelUpload(id);\n };\n\n /* @conditional-compile-remove(attachment-download) @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-download) @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-download) @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 throw new Error('Chat thread state id undefined.');\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-download) @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;;;;;;;;;;AAUlC,uDAAuD;AACvD,sDAAsD;AAEtD;;;;GAIG;AACH,MAAM,OAAO,6BAA6B;IAOxC,YAAY,mBAAwC;QAJpD,gJAAgJ;QAChJ,iJAAiJ;QACzI,eAAU,GAAsF,IAAI,GAAG,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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, AttachmentUploadManager } from '@internal/react-components';\nimport { ErrorBarStrings } from '@internal/react-components';\nimport { CallWithChatAdapterState } from '../state/CallWithChatAdapterState';\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 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 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[]): AttachmentUploadManager[] => {\n return this.callWithChatAdapter.registerActiveUploads(files);\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n public registerCompletedUploads = (metadata: AttachmentMetadata[]): AttachmentUploadManager[] => {\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 throw new Error('Chat thread state id undefined.');\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"]}
|
@@ -16,7 +16,7 @@ export function callWithChatAdapterStateFromBackingStates(callAdapter) {
|
|
16
16
|
isTeamsCall: callAdapterState.isTeamsCall,
|
17
17
|
latestCallErrors: callAdapterState.latestErrors,
|
18
18
|
latestChatErrors: {},
|
19
|
-
/* @conditional-compile-remove(attachment-
|
19
|
+
/* @conditional-compile-remove(attachment-upload) */
|
20
20
|
attachmentUploads: {},
|
21
21
|
/* @conditional-compile-remove(PSTN-calls) */
|
22
22
|
alternateCallerId: callAdapterState.alternateCallerId,
|
@@ -37,7 +37,7 @@ export function callWithChatAdapterStateFromBackingStates(callAdapter) {
|
|
37
37
|
*/
|
38
38
|
export function mergeChatAdapterStateIntoCallWithChatAdapterState(existingCallWithChatAdapterState, chatAdapterState) {
|
39
39
|
return Object.assign(Object.assign({}, existingCallWithChatAdapterState), { chat: chatAdapterState.thread, latestChatErrors: chatAdapterState.latestErrors,
|
40
|
-
/* @conditional-compile-remove(attachment-
|
40
|
+
/* @conditional-compile-remove(attachment-upload) */
|
41
41
|
attachmentUploads: chatAdapterState.attachmentUploads });
|
42
42
|
}
|
43
43
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CallWithChatAdapterState.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiHlC;;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,gBAAgB,EAAE,gBAAgB,CAAC,YAAY;QAC/C,gBAAgB,EAAE,EAAE;QACpB,
|
1
|
+
{"version":3,"file":"CallWithChatAdapterState.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.ts"],"names":[],"mappings":"AAAA,uCAAuC;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C/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,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';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadsUiState } from '../../ChatComposite';\nimport { AdapterErrors } from '../../common/adapters';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\n/* @conditional-compile-remove(reaction) */\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(attachment-upload) */\n /**\n * Files being uploaded by a user in the current thread.\n * Should be set to null once the upload is complete.\n * Array of type {@link AttachmentUploadsUiState}\n *\n * @beta\n */\n attachmentUploads?: AttachmentUploadsUiState;\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 /* @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 /* @conditional-compile-remove(reaction) */\n /**\n * Reaction resources to render in meetings\n * @beta\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 latestCallErrors: callAdapterState.latestErrors,\n latestChatErrors: {},\n /* @conditional-compile-remove(attachment-upload) */\n attachmentUploads: {},\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 /* @conditional-compile-remove(reaction) */\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 /* @conditional-compile-remove(attachment-upload) */\n attachmentUploads: chatAdapterState.attachmentUploads\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 latestCallErrors: callAdapterState.latestErrors,\n\n videoBackgroundImages: callAdapterState.videoBackgroundImages,\n\n onResolveVideoEffectDependency: callAdapterState.onResolveVideoEffectDependency,\n\n selectedVideoBackgroundEffect: callAdapterState.selectedVideoBackgroundEffect\n };\n}\n"]}
|
@@ -71,21 +71,7 @@ export type ChatCompositeOptions = {
|
|
71
71
|
* @beta
|
72
72
|
*/
|
73
73
|
attachmentOptions?: AttachmentOptions;
|
74
|
-
/**
|
75
|
-
* Properties for configuring the richTextEditor feature.
|
76
|
-
* @defaultValue false
|
77
|
-
*
|
78
|
-
* @beta
|
79
|
-
*/
|
80
|
-
richTextEditor?: boolean | RichTextEditorOptions;
|
81
74
|
};
|
82
|
-
/**
|
83
|
-
* Options for configuring the rich text editor.
|
84
|
-
*
|
85
|
-
* @beta
|
86
|
-
*/
|
87
|
-
export interface RichTextEditorOptions {
|
88
|
-
}
|
89
75
|
/**
|
90
76
|
* A customizable UI composite for the chat experience.
|
91
77
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatComposite.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatComposite.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"ChatComposite.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatComposite.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8E1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;IACtE,MAAM,EACJ,OAAO,EACP,OAAO,EACP,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,2BAA2B,EAC5B,GAAG,KAAK,CAAC;IAEV,qGAAqG;IACrG,MAAM,UAAU,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC;IAEpD,OAAO,CACL,6BAAK,SAAS,EAAE,wBAAwB;QACtC,oBAAC,YAAY,oBAAK,KAAK;YACrB,oBAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO;gBACnC,oBAAC,UAAU;gBACT,qGAAqG;;oBAArG,qGAAqG;oBACrG,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,wBAAwB,EAAE,wBAAwB,EAClD,uBAAuB,EAAE,uBAAuB,EAChD,eAAe,EAAE,eAAe,EAChC,2BAA2B,EAAE,2BAA2B;oBACxD,qGAAqG;oBACrG,iBAAiB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,GAC7C,CACkB,CACT,CACX,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommunicationParticipant, MessageRenderer, MessageProps } from '@internal/react-components';\nimport React from 'react';\nimport { BaseProvider, BaseCompositeProps } from '../common/BaseComposite';\nimport { ChatCompositeIcons } from '../common/icons';\nimport { ChatAdapter } from './adapter/ChatAdapter';\nimport { ChatAdapterProvider } from './adapter/ChatAdapterProvider';\nimport { chatScreenContainerStyle } from './styles/Chat.styles';\nimport { ChatScreen } from './ChatScreen';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentOptions } from '@internal/react-components';\n\n/**\n * Props for {@link ChatComposite}.\n *\n * @public\n */\nexport interface ChatCompositeProps extends BaseCompositeProps<ChatCompositeIcons> {\n /**\n * An adapter provides logic and data to the composite.\n * Composite can also be controlled using the adapter.\n */\n adapter: ChatAdapter;\n /**\n * `(messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element`\n * A callback for customizing the message renderer.\n */\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element;\n /**\n * `(typingUsers: CommunicationParticipant[]) => JSX.Element`\n * A callback for customizing the typing indicator renderer.\n */\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n /**\n * Flags to enable/disable visual elements of the {@link ChatComposite}.\n */\n options?: ChatCompositeOptions;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optimizes the composite form factor for either desktop or mobile.\n * @remarks `mobile` is currently only optimized for Portrait mode on mobile devices and does not support landscape.\n * @defaultValue 'desktop'\n */\n formFactor?: 'desktop' | 'mobile';\n}\n\n/**\n * Optional features of the {@link ChatComposite}.\n *\n * @public\n */\nexport type ChatCompositeOptions = {\n /**\n * Surface Azure Communication Services backend errors in the UI with {@link @azure/communication-react#ErrorBar}.\n * Hide or show the error bar.\n * @defaultValue true\n */\n errorBar?: boolean;\n /* @conditional-compile-remove(chat-composite-participant-pane) */\n /**\n * Show or hide the participant pane. This feature is in beta and not supported on mobile or narrow screen views.\n * @defaultValue false\n *\n * @beta\n */\n participantPane?: boolean;\n /**\n * Show or hide the topic at the top of the chat. Hidden if set to `false`\n * @defaultValue true\n */\n topic?: boolean;\n /**\n * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Properties for configuring the File Sharing feature.\n * If undefined, file sharing feature will be disabled.\n * @beta\n */\n attachmentOptions?: AttachmentOptions;\n};\n\n/**\n * A customizable UI composite for the chat experience.\n *\n * @remarks Chat composite min width and height are respectively 17.5rem and 20rem (280px and 320px, with default rem at 16px)\n *\n * @public\n */\nexport const ChatComposite = (props: ChatCompositeProps): JSX.Element => {\n const {\n adapter,\n options,\n onFetchAvatarPersonaData,\n onRenderTypingIndicator,\n onRenderMessage,\n onFetchParticipantMenuItems\n } = props;\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const formFactor = props['formFactor'] || 'desktop';\n\n return (\n <div className={chatScreenContainerStyle}>\n <BaseProvider {...props}>\n <ChatAdapterProvider adapter={adapter}>\n <ChatScreen\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n formFactor={formFactor}\n options={options}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onRenderTypingIndicator={onRenderTypingIndicator}\n onRenderMessage={onRenderMessage}\n onFetchParticipantMenuItems={onFetchParticipantMenuItems}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentOptions={options?.attachmentOptions}\n />\n </ChatAdapterProvider>\n </BaseProvider>\n </div>\n );\n};\n"]}
|
@@ -30,7 +30,11 @@ import { toFlatCommunicationIdentifier } from "../../../../acs-ui-common/src";
|
|
30
30
|
import { AttachmentDownloadErrorBar } from './AttachmentDownloadErrorBar';
|
31
31
|
import { _AttachmentDownloadCards } from "../../../../react-components/src";
|
32
32
|
import { ImageOverlay } from "../../../../react-components/src";
|
33
|
-
import { SendBox } from
|
33
|
+
import { SendBox } from "../../../../react-components/src";
|
34
|
+
/* @conditional-compile-remove(attachment-upload) */
|
35
|
+
import { useSelector } from './hooks/useSelector';
|
36
|
+
/* @conditional-compile-remove(attachment-upload) */
|
37
|
+
import { attachmentUploadsSelector } from './selectors/attachmentUploadsSelector';
|
34
38
|
/**
|
35
39
|
* @private
|
36
40
|
*/
|
@@ -55,6 +59,7 @@ export const ChatScreen = (props) => {
|
|
55
59
|
fetchData();
|
56
60
|
}, [adapter]);
|
57
61
|
const messageThreadProps = usePropsFor(MessageThread);
|
62
|
+
const sendBoxProps = usePropsFor(SendBox);
|
58
63
|
const typingIndicatorProps = usePropsFor(TypingIndicator);
|
59
64
|
const headerProps = useAdaptedSelector(getHeaderProps);
|
60
65
|
const errorBarProps = usePropsFor(ErrorBar);
|
@@ -96,15 +101,18 @@ export const ChatScreen = (props) => {
|
|
96
101
|
const typingIndicatorStyles = useMemo(() => {
|
97
102
|
return Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.typingIndicator);
|
98
103
|
}, [styles === null || styles === void 0 ? void 0 : styles.typingIndicator]);
|
104
|
+
const sendBoxStyles = useMemo(() => {
|
105
|
+
return Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.sendBox);
|
106
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.sendBox]);
|
99
107
|
const userId = toFlatCommunicationIdentifier(adapter.getState().userId);
|
100
108
|
const attachmentUploadButtonOnChange = useCallback((files) => {
|
101
109
|
var _a;
|
102
110
|
if (!files) {
|
103
111
|
return;
|
104
112
|
}
|
105
|
-
/* @conditional-compile-remove(attachment-
|
113
|
+
/* @conditional-compile-remove(attachment-upload) */
|
106
114
|
const attachmentUploads = adapter.registerActiveUploads(Array.from(files));
|
107
|
-
/* @conditional-compile-remove(attachment-
|
115
|
+
/* @conditional-compile-remove(attachment-upload) */
|
108
116
|
(_a = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _a === void 0 ? void 0 : _a.handler(attachmentUploads);
|
109
117
|
}, [adapter, attachmentOptions]);
|
110
118
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
@@ -213,6 +221,8 @@ export const ChatScreen = (props) => {
|
|
213
221
|
(_d = attachmentOptions === null || attachmentOptions === void 0 ? void 0 : attachmentOptions.uploadOptions) === null || _d === void 0 ? void 0 : _d.disableMultipleUploads,
|
214
222
|
attachmentUploadButtonOnChange
|
215
223
|
]);
|
224
|
+
/* @conditional-compile-remove(attachment-upload) */
|
225
|
+
const activeAttachmentUploads = useSelector(attachmentUploadsSelector).attachments;
|
216
226
|
return (React.createElement(Stack, { className: chatContainer, grow: true },
|
217
227
|
(options === null || options === void 0 ? void 0 : options.topic) !== false && React.createElement(ChatHeader, Object.assign({}, headerProps)),
|
218
228
|
React.createElement(Stack, { className: chatArea, tokens: participantListContainerPadding, horizontal: true, grow: true },
|
@@ -231,9 +241,11 @@ export const ChatScreen = (props) => {
|
|
231
241
|
formFactor === 'mobile' && (React.createElement(Stack, { verticalAlign: "center" },
|
232
242
|
React.createElement(AttachmentButton, null))),
|
233
243
|
React.createElement(Stack, { grow: true },
|
234
|
-
React.createElement(SendBox, {
|
235
|
-
/* @conditional-compile-remove(attachment-
|
236
|
-
|
244
|
+
React.createElement(SendBox, Object.assign({}, sendBoxProps, { autoFocus: options === null || options === void 0 ? void 0 : options.autoFocus, styles: sendBoxStyles,
|
245
|
+
/* @conditional-compile-remove(attachment-upload) */
|
246
|
+
activeAttachmentUploads: activeAttachmentUploads,
|
247
|
+
/* @conditional-compile-remove(attachment-upload) */
|
248
|
+
onCancelAttachmentUpload: adapter.cancelUpload }))),
|
237
249
|
formFactor !== 'mobile' && React.createElement(AttachmentButton, null)))),
|
238
250
|
/* @conditional-compile-remove(chat-composite-participant-pane) */
|
239
251
|
(options === null || options === void 0 ? void 0 : options.participantPane) === true && (React.createElement(ChatScreenPeoplePane, { onFetchAvatarPersonaData: onFetchAvatarPersonaData, onFetchParticipantMenuItems: props.onFetchParticipantMenuItems, isMobile: formFactor === 'mobile' }))),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatScreen.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAEL,QAAQ,EAGR,aAAa,EAIb,eAAe,EAEf,QAAQ,EACT,yCAAmC;AAGpC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAiD,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,6BAA6B,IAAI,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,WAAW,EACX,gCAAgC,EAChC,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,kEAAkE;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,sCAAgC;AACxE,qGAAqG;AACrG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8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BAAoB,IACnB,wBAAwB,EAAE,wBAAwB,EAClD,2BAA2B,EAAE,KAAK,CAAC,2BAA2B,EAC9D,QAAQ,EAAE,UAAU,KAAK,QAAQ,GACjC,CACH,CAEG;QACP,gBAAgB,IAAI,CACnB,oBAAC,YAAY,oBACP,gBAAgB,IACpB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,GAAG,EAAE;gBACd,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAC/B,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAC7B,OAAO,CAAC,uBAAuB,CAAC;oBAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ;oBAC5C,SAAS,EAAE,gBAAgB,CAAC,SAAS;oBACrC,WAAW,EAAE,gBAAgB,CAAC,QAAQ;iBACvC,CAAC,CAAC;YACL,CAAC,EACD,uBAAuB,EAAE,uBAAuB,IAChD,CACH,CACK,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isIOS } from '@fluentui/react';\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { PersonaSize } from '@fluentui/react';\nimport {\n CommunicationParticipant,\n ErrorBar,\n MessageProps,\n MessageRenderer,\n MessageThread,\n MessageThreadStyles,\n ParticipantMenuItemsCallback,\n SendBoxStylesProps,\n TypingIndicator,\n TypingIndicatorStylesProps,\n useTheme\n} from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatMessage } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useState } from 'react';\nimport { AvatarPersona, AvatarPersonaDataCallback, AvatarPersonaProps } from '../common/AvatarPersona';\nimport { useAdapter } from './adapter/ChatAdapterProvider';\nimport { ChatCompositeOptions } from './ChatComposite';\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\nimport { AttachmentUploadButtonWrapper as AttachmentUploadButton } from './file-sharing';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nimport {\n chatArea,\n chatContainer,\n chatWrapper,\n messageThreadChatCompositeStyles,\n sendboxContainerStyles,\n typingIndicatorContainerStyles\n} from './styles/Chat.styles';\nimport { participantListContainerPadding } from '../common/styles/ParticipantContainer.styles';\n/* @conditional-compile-remove(chat-composite-participant-pane) */\nimport { ChatScreenPeoplePane } from './ChatScreenPeoplePane';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentDownloadErrorBar } from './AttachmentDownloadErrorBar';\nimport { _AttachmentDownloadCards } from '@internal/react-components';\nimport { ImageOverlay } from '@internal/react-components';\nimport { InlineImage } from '@internal/react-components';\nimport { SendBox } from '../common/SendBox';\nimport { ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { AttachmentOptions } from '@internal/react-components';\n\n/**\n * @private\n */\nexport type ChatScreenProps = {\n options?: ChatCompositeOptions;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element;\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n styles?: ChatScreenStyles;\n attachmentOptions?: AttachmentOptions;\n formFactor?: 'desktop' | 'mobile';\n};\n\n/**\n * @private\n */\nexport type ChatScreenStyles = {\n messageThread?: MessageThreadStyles;\n sendBox?: SendBoxStylesProps;\n typingIndicator?: TypingIndicatorStylesProps;\n};\n\n/**\n * @private\n */\ninterface OverlayImageItem {\n imageSrc: string;\n title: string;\n titleIcon: JSX.Element;\n attachmentId: string;\n messageId: string;\n imageUrl: string;\n}\n\n/**\n * @private\n */\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\n const {\n onFetchAvatarPersonaData,\n onRenderMessage,\n onRenderTypingIndicator,\n options,\n styles,\n attachmentOptions,\n formFactor\n } = props;\n\n const defaultNumberOfChatMessagesToReload = 5;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');\n const [overlayImageItem, setOverlayImageItem] = useState<OverlayImageItem>();\n const [isImageOverlayOpen, setIsImageOverlayOpen] = useState<boolean>(false);\n\n const adapter = useAdapter();\n const theme = useTheme();\n\n useEffect(() => {\n // Initial data should be always fetched by the composite(or external caller) instead of the adapter\n const fetchData: () => Promise<void> = async () => {\n // Fetch initial data for adapter\n await adapter.fetchInitialData();\n // Fetch initial set of messages. Without fetching messages here, if the Composite's adapter is changed the message thread does not load new messages.\n await adapter.loadPreviousChatMessages(defaultNumberOfChatMessagesToReload);\n };\n fetchData();\n }, [adapter]);\n\n const messageThreadProps = usePropsFor(MessageThread);\n const typingIndicatorProps = usePropsFor(TypingIndicator);\n const headerProps = useAdaptedSelector(getHeaderProps);\n const errorBarProps = usePropsFor(ErrorBar);\n\n useEffect(() => {\n if (overlayImageItem === undefined) {\n return;\n }\n const message = adapter.getState().thread.chatMessages[overlayImageItem.messageId];\n if (message === undefined) {\n return;\n }\n const resourceCache = message.resourceCache;\n if (overlayImageItem.imageSrc === '' && resourceCache && resourceCache[overlayImageItem.imageUrl]) {\n const fullSizeImageSrc = getResourceSourceUrl(resourceCache[overlayImageItem.imageUrl]);\n if (fullSizeImageSrc === undefined || fullSizeImageSrc === '' || overlayImageItem.imageSrc === fullSizeImageSrc) {\n return;\n }\n setOverlayImageItem({\n ...overlayImageItem,\n imageSrc: fullSizeImageSrc\n });\n }\n // Disable eslint because we are using the overlayImageItem in this effect but don't want to have it as a dependency, as it will cause an infinite loop.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageThreadProps.messages]);\n\n const getResourceSourceUrl = (result: ResourceFetchResult): string => {\n let src = '';\n if (result.error || !result.sourceUrl) {\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n\n return src;\n };\n\n const onRenderAvatarCallback = useCallback(\n (userId?: string, defaultOptions?: AvatarPersonaProps) => {\n return (\n <AvatarPersona\n userId={userId}\n hidePersonaDetails={true}\n {...defaultOptions}\n dataProvider={onFetchAvatarPersonaData}\n />\n );\n },\n [onFetchAvatarPersonaData]\n );\n\n const messageThreadStyles = useMemo(() => {\n return Object.assign(\n {},\n messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground),\n styles?.messageThread\n );\n }, [styles?.messageThread, theme.semanticColors.bodyBackground]);\n\n const typingIndicatorStyles = useMemo(() => {\n return Object.assign({}, styles?.typingIndicator);\n }, [styles?.typingIndicator]);\n\n const userId = toFlatCommunicationIdentifier(adapter.getState().userId);\n\n const attachmentUploadButtonOnChange = useCallback(\n (files: FileList | null): void => {\n if (!files) {\n return;\n }\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const attachmentUploads = adapter.registerActiveUploads(Array.from(files));\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentOptions?.uploadOptions?.handler(attachmentUploads);\n },\n [adapter, attachmentOptions]\n );\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentDownloads = useCallback(\n (userId: string, message: ChatMessage) =>\n message?.attachments?.length ?? 0 > 0 ? (\n <_AttachmentDownloadCards\n attachments={message.attachments}\n message={message}\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n onActionHandlerFailed={(errorMessage: string) => {\n setDownloadErrorMessage(errorMessage);\n }}\n />\n ) : (\n <></>\n ),\n [attachmentOptions?.downloadOptions?.actionsForAttachment]\n );\n\n const onInlineImageClicked = useCallback(\n (attachmentId: string, messageId: string) => {\n const message = adapter.getState().thread.chatMessages[messageId];\n const inlinedImages = message.content?.attachments?.filter((attachment) => {\n return attachment.attachmentType === 'image' && attachment.id === attachmentId;\n });\n\n if (!inlinedImages || inlinedImages.length <= 0) {\n return;\n }\n\n const attachment = inlinedImages[0];\n\n const resourceCache = message.resourceCache;\n let imageSrc = '';\n\n if (attachment.url) {\n if (resourceCache && resourceCache[attachment.url]) {\n imageSrc = getResourceSourceUrl(resourceCache[attachment.url]);\n } else {\n adapter.downloadResourceToCache({\n threadId: adapter.getState().thread.threadId,\n messageId: messageId,\n resourceUrl: attachment.url\n });\n }\n }\n\n const titleIconRenderOptions = {\n text: message.senderDisplayName,\n size: PersonaSize.size32,\n showOverflowTooltip: false,\n imageAlt: message.senderDisplayName\n };\n\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(messageSenderId, titleIconRenderOptions);\n const overlayImage: OverlayImageItem = {\n title: message.senderDisplayName || '',\n titleIcon: titleIcon,\n attachmentId: attachment.id,\n imageSrc: imageSrc,\n messageId: messageId,\n imageUrl: attachment.url || ''\n };\n\n setIsImageOverlayOpen(true);\n setOverlayImageItem(overlayImage);\n },\n [adapter, onRenderAvatarCallback, userId]\n );\n\n const inlineImageOptions = {\n onRenderInlineImage: (\n inlineImage: InlineImage,\n defaultOnRender: (inlineImage: InlineImage) => JSX.Element\n ): JSX.Element => {\n const message = adapter.getState().thread.chatMessages[inlineImage.messageId];\n const attachment = message?.content?.attachments?.find(\n (attachment) => attachment.id === inlineImage.imageAttributes.id\n );\n\n if (attachment === undefined) {\n return defaultOnRender(inlineImage);\n }\n\n let pointerEvents: 'none' | 'auto' = inlineImage.imageAttributes.src === '' ? 'none' : 'auto';\n const resourceCache = message.resourceCache;\n if (\n resourceCache &&\n attachment.previewUrl &&\n resourceCache[attachment.previewUrl] &&\n resourceCache[attachment.previewUrl].error\n ) {\n pointerEvents = 'none';\n }\n\n return (\n <span\n key={inlineImage.imageAttributes.id}\n onClick={() => onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId)}\n tabIndex={0}\n role=\"button\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId);\n }\n }}\n style={{ cursor: 'pointer', pointerEvents }}\n >\n {defaultOnRender(inlineImage)}\n </span>\n );\n }\n };\n\n const onDownloadButtonClicked = useCallback(\n (imageSrc: string): void => {\n if (imageSrc === '') {\n return;\n }\n if (isIOS()) {\n window.open(imageSrc, '_blank');\n } else {\n // Create a new anchor element\n const a = document.createElement('a');\n // Set the href and download attributes for the anchor element\n a.href = imageSrc;\n a.download = overlayImageItem?.attachmentId || '';\n a.rel = 'noopener noreferrer';\n a.target = '_blank';\n\n // Programmatically click the anchor element to trigger the download\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n }\n },\n [overlayImageItem?.attachmentId]\n );\n\n const AttachmentButton = useCallback(() => {\n if (!attachmentOptions?.uploadOptions?.handler) {\n return null;\n }\n return (\n <AttachmentUploadButton\n supportedMediaTypes={attachmentOptions?.uploadOptions?.supportedMediaTypes}\n disableMultipleUploads={attachmentOptions?.uploadOptions?.disableMultipleUploads}\n onChange={attachmentUploadButtonOnChange}\n />\n );\n }, [\n attachmentOptions?.uploadOptions?.handler,\n attachmentOptions?.uploadOptions?.supportedMediaTypes,\n attachmentOptions?.uploadOptions?.disableMultipleUploads,\n attachmentUploadButtonOnChange\n ]);\n\n return (\n <Stack className={chatContainer} grow>\n {options?.topic !== false && <ChatHeader {...headerProps} />}\n <Stack className={chatArea} tokens={participantListContainerPadding} horizontal grow>\n <Stack className={chatWrapper} grow>\n {options?.errorBar !== false && <ErrorBar {...errorBarProps} />}\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n <AttachmentDownloadErrorBar\n onDismissDownloadErrorMessage={useCallback(() => {\n setDownloadErrorMessage('');\n }, [])}\n attachmentDownloadErrorMessage={downloadErrorMessage || ''}\n />\n }\n <MessageThread\n {...messageThreadProps}\n onRenderAvatar={onRenderAvatarCallback}\n onRenderMessage={onRenderMessage}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n inlineImageOptions={inlineImageOptions}\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\n styles={messageThreadStyles}\n />\n <Stack className={mergeStyles(sendboxContainerStyles)}>\n <div className={mergeStyles(typingIndicatorContainerStyles)}>\n {onRenderTypingIndicator ? (\n onRenderTypingIndicator(typingIndicatorProps.typingUsers)\n ) : (\n <TypingIndicator {...typingIndicatorProps} styles={typingIndicatorStyles} />\n )}\n </div>\n <Stack horizontal={formFactor === 'mobile'}>\n {formFactor === 'mobile' && (\n <Stack verticalAlign=\"center\">\n <AttachmentButton />\n </Stack>\n )}\n <Stack grow>\n <SendBox\n options={options}\n styles={styles?.sendBox}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n adapter={adapter}\n />\n </Stack>\n {formFactor !== 'mobile' && <AttachmentButton />}\n </Stack>\n </Stack>\n </Stack>\n {\n /* @conditional-compile-remove(chat-composite-participant-pane) */\n options?.participantPane === true && (\n <ChatScreenPeoplePane\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={props.onFetchParticipantMenuItems}\n isMobile={formFactor === 'mobile'}\n />\n )\n }\n </Stack>\n {overlayImageItem && (\n <ImageOverlay\n {...overlayImageItem}\n isOpen={isImageOverlayOpen}\n onDismiss={() => {\n setOverlayImageItem(undefined);\n setIsImageOverlayOpen(false);\n adapter.removeResourceFromCache({\n threadId: adapter.getState().thread.threadId,\n messageId: overlayImageItem.messageId,\n resourceUrl: overlayImageItem.imageUrl\n });\n }}\n onDownloadButtonClicked={onDownloadButtonClicked}\n />\n )}\n </Stack>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"ChatScreen.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,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OAAO,oBACF,YAAY,IAChB,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAC7B,MAAM,EAAE,aAAa;gCACrB,oDAAoD;gCACpD,uBAAuB,EAAE,uBAAuB;gCAChD,oDAAoD;gCACpD,wBAAwB,EAAE,OAAO,CAAC,YAAY,IAC9C,CACI;wBACP,UAAU,KAAK,QAAQ,IAAI,oBAAC,gBAAgB,OAAG,CAC1C,CACF,CACF;YAEN,kEAAkE;YAClE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,MAAK,IAAI,IAAI,CACnC,oBAAC,oBAAoB,IACnB,wBAAwB,EAAE,wBAAwB,EAClD,2BAA2B,EAAE,KAAK,CAAC,2BAA2B,EAC9D,QAAQ,EAAE,UAAU,KAAK,QAAQ,GACjC,CACH,CAEG;QACP,gBAAgB,IAAI,CACnB,oBAAC,YAAY,oBACP,gBAAgB,IACpB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,GAAG,EAAE;gBACd,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAC/B,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAC7B,OAAO,CAAC,uBAAuB,CAAC;oBAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ;oBAC5C,SAAS,EAAE,gBAAgB,CAAC,SAAS;oBACrC,WAAW,EAAE,gBAAgB,CAAC,QAAQ;iBACvC,CAAC,CAAC;YACL,CAAC,EACD,uBAAuB,EAAE,uBAAuB,IAChD,CACH,CACK,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isIOS } from '@fluentui/react';\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { PersonaSize } from '@fluentui/react';\nimport {\n CommunicationParticipant,\n ErrorBar,\n MessageProps,\n MessageRenderer,\n MessageThread,\n MessageThreadStyles,\n ParticipantMenuItemsCallback,\n SendBoxStylesProps,\n TypingIndicator,\n TypingIndicatorStylesProps,\n useTheme\n} from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatMessage } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useState } from 'react';\nimport { AvatarPersona, AvatarPersonaDataCallback, AvatarPersonaProps } from '../common/AvatarPersona';\nimport { useAdapter } from './adapter/ChatAdapterProvider';\nimport { ChatCompositeOptions } from './ChatComposite';\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\nimport { AttachmentUploadButtonWrapper as AttachmentUploadButton } from './file-sharing';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nimport {\n chatArea,\n chatContainer,\n chatWrapper,\n messageThreadChatCompositeStyles,\n sendboxContainerStyles,\n typingIndicatorContainerStyles\n} from './styles/Chat.styles';\nimport { participantListContainerPadding } from '../common/styles/ParticipantContainer.styles';\n/* @conditional-compile-remove(chat-composite-participant-pane) */\nimport { ChatScreenPeoplePane } from './ChatScreenPeoplePane';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentDownloadErrorBar } from './AttachmentDownloadErrorBar';\nimport { _AttachmentDownloadCards } from '@internal/react-components';\nimport { ImageOverlay } from '@internal/react-components';\nimport { InlineImage } from '@internal/react-components';\nimport { ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { AttachmentOptions } from '@internal/react-components';\nimport { SendBox } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useSelector } from './hooks/useSelector';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadsSelector } from './selectors/attachmentUploadsSelector';\n\n/**\n * @private\n */\nexport type ChatScreenProps = {\n options?: ChatCompositeOptions;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element;\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n styles?: ChatScreenStyles;\n attachmentOptions?: AttachmentOptions;\n formFactor?: 'desktop' | 'mobile';\n};\n\n/**\n * @private\n */\nexport type ChatScreenStyles = {\n messageThread?: MessageThreadStyles;\n sendBox?: SendBoxStylesProps;\n typingIndicator?: TypingIndicatorStylesProps;\n};\n\n/**\n * @private\n */\ninterface OverlayImageItem {\n imageSrc: string;\n title: string;\n titleIcon: JSX.Element;\n attachmentId: string;\n messageId: string;\n imageUrl: string;\n}\n\n/**\n * @private\n */\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\n const {\n onFetchAvatarPersonaData,\n onRenderMessage,\n onRenderTypingIndicator,\n options,\n styles,\n attachmentOptions,\n formFactor\n } = props;\n\n const defaultNumberOfChatMessagesToReload = 5;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');\n const [overlayImageItem, setOverlayImageItem] = useState<OverlayImageItem>();\n const [isImageOverlayOpen, setIsImageOverlayOpen] = useState<boolean>(false);\n\n const adapter = useAdapter();\n const theme = useTheme();\n\n useEffect(() => {\n // Initial data should be always fetched by the composite(or external caller) instead of the adapter\n const fetchData: () => Promise<void> = async () => {\n // Fetch initial data for adapter\n await adapter.fetchInitialData();\n // Fetch initial set of messages. Without fetching messages here, if the Composite's adapter is changed the message thread does not load new messages.\n await adapter.loadPreviousChatMessages(defaultNumberOfChatMessagesToReload);\n };\n fetchData();\n }, [adapter]);\n\n const messageThreadProps = usePropsFor(MessageThread);\n const sendBoxProps = usePropsFor(SendBox);\n const typingIndicatorProps = usePropsFor(TypingIndicator);\n const headerProps = useAdaptedSelector(getHeaderProps);\n const errorBarProps = usePropsFor(ErrorBar);\n\n useEffect(() => {\n if (overlayImageItem === undefined) {\n return;\n }\n const message = adapter.getState().thread.chatMessages[overlayImageItem.messageId];\n if (message === undefined) {\n return;\n }\n const resourceCache = message.resourceCache;\n if (overlayImageItem.imageSrc === '' && resourceCache && resourceCache[overlayImageItem.imageUrl]) {\n const fullSizeImageSrc = getResourceSourceUrl(resourceCache[overlayImageItem.imageUrl]);\n if (fullSizeImageSrc === undefined || fullSizeImageSrc === '' || overlayImageItem.imageSrc === fullSizeImageSrc) {\n return;\n }\n setOverlayImageItem({\n ...overlayImageItem,\n imageSrc: fullSizeImageSrc\n });\n }\n // Disable eslint because we are using the overlayImageItem in this effect but don't want to have it as a dependency, as it will cause an infinite loop.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageThreadProps.messages]);\n\n const getResourceSourceUrl = (result: ResourceFetchResult): string => {\n let src = '';\n if (result.error || !result.sourceUrl) {\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n\n return src;\n };\n\n const onRenderAvatarCallback = useCallback(\n (userId?: string, defaultOptions?: AvatarPersonaProps) => {\n return (\n <AvatarPersona\n userId={userId}\n hidePersonaDetails={true}\n {...defaultOptions}\n dataProvider={onFetchAvatarPersonaData}\n />\n );\n },\n [onFetchAvatarPersonaData]\n );\n\n const messageThreadStyles = useMemo(() => {\n return Object.assign(\n {},\n messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground),\n styles?.messageThread\n );\n }, [styles?.messageThread, theme.semanticColors.bodyBackground]);\n\n const typingIndicatorStyles = useMemo(() => {\n return Object.assign({}, styles?.typingIndicator);\n }, [styles?.typingIndicator]);\n\n const sendBoxStyles = useMemo(() => {\n return Object.assign({}, styles?.sendBox);\n }, [styles?.sendBox]);\n\n const userId = toFlatCommunicationIdentifier(adapter.getState().userId);\n\n const attachmentUploadButtonOnChange = useCallback(\n (files: FileList | null): void => {\n if (!files) {\n return;\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n const attachmentUploads = adapter.registerActiveUploads(Array.from(files));\n /* @conditional-compile-remove(attachment-upload) */\n attachmentOptions?.uploadOptions?.handler(attachmentUploads);\n },\n [adapter, attachmentOptions]\n );\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentDownloads = useCallback(\n (userId: string, message: ChatMessage) =>\n message?.attachments?.length ?? 0 > 0 ? (\n <_AttachmentDownloadCards\n attachments={message.attachments}\n message={message}\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n onActionHandlerFailed={(errorMessage: string) => {\n setDownloadErrorMessage(errorMessage);\n }}\n />\n ) : (\n <></>\n ),\n [attachmentOptions?.downloadOptions?.actionsForAttachment]\n );\n\n const onInlineImageClicked = useCallback(\n (attachmentId: string, messageId: string) => {\n const message = adapter.getState().thread.chatMessages[messageId];\n const inlinedImages = message.content?.attachments?.filter((attachment) => {\n return attachment.attachmentType === 'image' && attachment.id === attachmentId;\n });\n\n if (!inlinedImages || inlinedImages.length <= 0) {\n return;\n }\n\n const attachment = inlinedImages[0];\n\n const resourceCache = message.resourceCache;\n let imageSrc = '';\n\n if (attachment.url) {\n if (resourceCache && resourceCache[attachment.url]) {\n imageSrc = getResourceSourceUrl(resourceCache[attachment.url]);\n } else {\n adapter.downloadResourceToCache({\n threadId: adapter.getState().thread.threadId,\n messageId: messageId,\n resourceUrl: attachment.url\n });\n }\n }\n\n const titleIconRenderOptions = {\n text: message.senderDisplayName,\n size: PersonaSize.size32,\n showOverflowTooltip: false,\n imageAlt: message.senderDisplayName\n };\n\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(messageSenderId, titleIconRenderOptions);\n const overlayImage: OverlayImageItem = {\n title: message.senderDisplayName || '',\n titleIcon: titleIcon,\n attachmentId: attachment.id,\n imageSrc: imageSrc,\n messageId: messageId,\n imageUrl: attachment.url || ''\n };\n\n setIsImageOverlayOpen(true);\n setOverlayImageItem(overlayImage);\n },\n [adapter, onRenderAvatarCallback, userId]\n );\n\n const inlineImageOptions = {\n onRenderInlineImage: (\n inlineImage: InlineImage,\n defaultOnRender: (inlineImage: InlineImage) => JSX.Element\n ): JSX.Element => {\n const message = adapter.getState().thread.chatMessages[inlineImage.messageId];\n const attachment = message?.content?.attachments?.find(\n (attachment) => attachment.id === inlineImage.imageAttributes.id\n );\n\n if (attachment === undefined) {\n return defaultOnRender(inlineImage);\n }\n\n let pointerEvents: 'none' | 'auto' = inlineImage.imageAttributes.src === '' ? 'none' : 'auto';\n const resourceCache = message.resourceCache;\n if (\n resourceCache &&\n attachment.previewUrl &&\n resourceCache[attachment.previewUrl] &&\n resourceCache[attachment.previewUrl].error\n ) {\n pointerEvents = 'none';\n }\n\n return (\n <span\n key={inlineImage.imageAttributes.id}\n onClick={() => onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId)}\n tabIndex={0}\n role=\"button\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId);\n }\n }}\n style={{ cursor: 'pointer', pointerEvents }}\n >\n {defaultOnRender(inlineImage)}\n </span>\n );\n }\n };\n\n const onDownloadButtonClicked = useCallback(\n (imageSrc: string): void => {\n if (imageSrc === '') {\n return;\n }\n if (isIOS()) {\n window.open(imageSrc, '_blank');\n } else {\n // Create a new anchor element\n const a = document.createElement('a');\n // Set the href and download attributes for the anchor element\n a.href = imageSrc;\n a.download = overlayImageItem?.attachmentId || '';\n a.rel = 'noopener noreferrer';\n a.target = '_blank';\n\n // Programmatically click the anchor element to trigger the download\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n }\n },\n [overlayImageItem?.attachmentId]\n );\n\n const AttachmentButton = useCallback(() => {\n if (!attachmentOptions?.uploadOptions?.handler) {\n return null;\n }\n return (\n <AttachmentUploadButton\n supportedMediaTypes={attachmentOptions?.uploadOptions?.supportedMediaTypes}\n disableMultipleUploads={attachmentOptions?.uploadOptions?.disableMultipleUploads}\n onChange={attachmentUploadButtonOnChange}\n />\n );\n }, [\n attachmentOptions?.uploadOptions?.handler,\n attachmentOptions?.uploadOptions?.supportedMediaTypes,\n attachmentOptions?.uploadOptions?.disableMultipleUploads,\n attachmentUploadButtonOnChange\n ]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const activeAttachmentUploads = useSelector(attachmentUploadsSelector).attachments;\n\n return (\n <Stack className={chatContainer} grow>\n {options?.topic !== false && <ChatHeader {...headerProps} />}\n <Stack className={chatArea} tokens={participantListContainerPadding} horizontal grow>\n <Stack className={chatWrapper} grow>\n {options?.errorBar !== false && <ErrorBar {...errorBarProps} />}\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n <AttachmentDownloadErrorBar\n onDismissDownloadErrorMessage={useCallback(() => {\n setDownloadErrorMessage('');\n }, [])}\n attachmentDownloadErrorMessage={downloadErrorMessage || ''}\n />\n }\n <MessageThread\n {...messageThreadProps}\n onRenderAvatar={onRenderAvatarCallback}\n onRenderMessage={onRenderMessage}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n inlineImageOptions={inlineImageOptions}\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\n styles={messageThreadStyles}\n />\n <Stack className={mergeStyles(sendboxContainerStyles)}>\n <div className={mergeStyles(typingIndicatorContainerStyles)}>\n {onRenderTypingIndicator ? (\n onRenderTypingIndicator(typingIndicatorProps.typingUsers)\n ) : (\n <TypingIndicator {...typingIndicatorProps} styles={typingIndicatorStyles} />\n )}\n </div>\n <Stack horizontal={formFactor === 'mobile'}>\n {formFactor === 'mobile' && (\n <Stack verticalAlign=\"center\">\n <AttachmentButton />\n </Stack>\n )}\n <Stack grow>\n <SendBox\n {...sendBoxProps}\n autoFocus={options?.autoFocus}\n styles={sendBoxStyles}\n /* @conditional-compile-remove(attachment-upload) */\n activeAttachmentUploads={activeAttachmentUploads}\n /* @conditional-compile-remove(attachment-upload) */\n onCancelAttachmentUpload={adapter.cancelUpload}\n />\n </Stack>\n {formFactor !== 'mobile' && <AttachmentButton />}\n </Stack>\n </Stack>\n </Stack>\n {\n /* @conditional-compile-remove(chat-composite-participant-pane) */\n options?.participantPane === true && (\n <ChatScreenPeoplePane\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={props.onFetchParticipantMenuItems}\n isMobile={formFactor === 'mobile'}\n />\n )\n }\n </Stack>\n {overlayImageItem && (\n <ImageOverlay\n {...overlayImageItem}\n isOpen={isImageOverlayOpen}\n onDismiss={() => {\n setOverlayImageItem(undefined);\n setIsImageOverlayOpen(false);\n adapter.removeResourceFromCache({\n threadId: adapter.getState().thread.threadId,\n messageId: overlayImageItem.messageId,\n resourceUrl: overlayImageItem.imageUrl\n });\n }}\n onDownloadButtonClicked={onDownloadButtonClicked}\n />\n )}\n </Stack>\n );\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Strings.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/Strings.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Strings used by the {@link ChatComposite} directly.\n *\n * This strings are in addition to those used by the components from the component library.\n *\n * @public\n */\nexport interface ChatCompositeStrings {\n /**\n * Chat list header text\n */\n chatListHeader: string;\n\n /* @conditional-compile-remove(attachment-
|
1
|
+
{"version":3,"file":"Strings.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/Strings.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Strings used by the {@link ChatComposite} directly.\n *\n * This strings are in addition to those used by the components from the component library.\n *\n * @public\n */\nexport interface ChatCompositeStrings {\n /**\n * Chat list header text\n */\n chatListHeader: string;\n\n /* @conditional-compile-remove(attachment-upload) */\n /**\n * Upload Attachment Button text\n */\n uploadAttachment: string;\n}\n"]}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
/* @conditional-compile-remove(attachment-
|
3
|
+
/* @conditional-compile-remove(attachment-upload) */
|
4
4
|
import { produce } from 'immer';
|
5
|
-
/* @conditional-compile-remove(attachment-
|
5
|
+
/* @conditional-compile-remove(attachment-upload) */
|
6
6
|
import { AttachmentUpload } from '../file-sharing';
|
7
|
-
/* @conditional-compile-remove(attachment-
|
7
|
+
/* @conditional-compile-remove(attachment-upload) */
|
8
8
|
/**
|
9
9
|
* @internal
|
10
10
|
*/
|
@@ -51,7 +51,7 @@ class AttachmentUploadContext {
|
|
51
51
|
}));
|
52
52
|
}
|
53
53
|
}
|
54
|
-
/* @conditional-compile-remove(attachment-
|
54
|
+
/* @conditional-compile-remove(attachment-upload) */
|
55
55
|
/**
|
56
56
|
* @internal
|
57
57
|
*/
|
@@ -135,7 +135,7 @@ export class AzureCommunicationAttachmentUploadAdapter {
|
|
135
135
|
attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.off('uploadFail', this.updateUploadStatusMessage.bind(this));
|
136
136
|
}
|
137
137
|
}
|
138
|
-
/* @conditional-compile-remove(attachment-
|
138
|
+
/* @conditional-compile-remove(attachment-upload) */
|
139
139
|
/**
|
140
140
|
* @param attachmentUploadUiState {@link AttachmentUploadsUiState}
|
141
141
|
* @private
|
@@ -161,7 +161,7 @@ export const convertAttachmentUploadsUiStateToMessageMetadata = (attachmentUploa
|
|
161
161
|
}
|
162
162
|
return undefined;
|
163
163
|
};
|
164
|
-
/* @conditional-compile-remove(attachment-
|
164
|
+
/* @conditional-compile-remove(attachment-upload) */
|
165
165
|
/**
|
166
166
|
* @private
|
167
167
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AzureCommunicationAttachmentUploadAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,qGAAqG;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,qGAAqG;AACrG,OAAO,EAAuB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAyBxE,qGAAqG;AACrG;;GAEG;AACH,MAAM,uBAAuB;IAG3B,YAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,oBAAoB;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,iBAAiB,CAAC;IACvD,CAAC;IAEM,oBAAoB,CAAC,iBAAqC;QAC/D,MAAM,oBAAoB,GAAG,2DAA2D,CAAC,iBAAiB,CAAC,CAAC;QAC5G,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;YAC7C,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC;YACxD,KAAK,CAAC,iBAAiB,mCAAQ,KAAK,CAAC,iBAAiB,GAAK,oBAAoB,CAAE,CAAC;QACpF,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,YAAY;QACjB,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAuB,EAAE,EAAE;YAC/D,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,sBAAsB,CAC3B,EAAU,EACV,IAAyG;QAEzG,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,Q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,gBAAgB,CAAC,EAAE;YACvB,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE;SACxD,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AttachmentUploadManager, AttachmentMetadata } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { produce } from 'immer';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FileSharingMetadata, AttachmentUpload } from '../file-sharing';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatContext } from './AzureCommunicationChatAdapter';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatAdapterState } from './ChatAdapter';\n\n/**\n * A record containing {@link AttachmentMetadata} mapped to unique ids.\n * @beta\n */\nexport type AttachmentUploadsUiState = Record<string, AttachmentMetadata>;\n\n/**\n * @beta\n */\nexport interface AttachmentUploadAdapter {\n registerActiveUploads: (files: File[]) => AttachmentUploadManager[];\n registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadManager[];\n clearUploads: () => void;\n cancelUpload: (id: string) => void;\n updateUploadProgress: (id: string, progress: number) => void;\n updateUploadStatusMessage: (id: string, errorMessage: string) => void;\n updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;\n}\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nclass AttachmentUploadContext {\n private chatContext: ChatContext;\n\n constructor(chatContext: ChatContext) {\n this.chatContext = chatContext;\n }\n\n public getAttachmentUploads(): AttachmentUploadsUiState | undefined {\n return this.chatContext.getState().attachmentUploads;\n }\n\n public addAttachmentUploads(attachmentUploads: AttachmentUpload[]): void {\n const attachmentUploadsMap = convertObservableAttachmentUploadToAttachmentUploadsUiState(attachmentUploads);\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft) => {\n draft.attachmentUploads = draft.attachmentUploads || {};\n draft.attachmentUploads = { ...draft.attachmentUploads, ...attachmentUploadsMap };\n })\n );\n }\n\n public clearUploads(): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n draft.attachmentUploads = {};\n })\n );\n }\n\n public updateAttachmentUpload(\n id: string,\n data: Partial<Pick<AttachmentMetadata, 'progress' | 'id' | 'name' | 'extension' | 'uploadError' | 'url'>>\n ): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n if (draft.attachmentUploads?.[id]) {\n draft.attachmentUploads[data.id ?? id] = {\n ...draft.attachmentUploads?.[id],\n ...data\n };\n if (data.id) {\n delete draft.attachmentUploads?.[id];\n }\n }\n })\n );\n }\n\n public deleteAttachmentUploads(ids: string[]): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n ids.forEach((id) => {\n const keys = Object.keys(draft?.attachmentUploads ?? []).filter(\n (rawID) => draft.attachmentUploads?.[rawID].id === id\n );\n keys.forEach((key) => {\n delete draft.attachmentUploads?.[key];\n });\n });\n })\n );\n }\n}\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nexport class AzureCommunicationAttachmentUploadAdapter implements AttachmentUploadAdapter {\n private context: AttachmentUploadContext;\n private attachmentUploads: AttachmentUpload[] = [];\n\n constructor(chatContext: ChatContext) {\n this.context = new AttachmentUploadContext(chatContext);\n }\n\n private findAttachmentUpload(id: string): AttachmentUpload | undefined {\n return this.attachmentUploads.find((attachmentUpload) => attachmentUpload.id === id);\n }\n\n private deleteAttachmentUploads(ids: string[]): void {\n this.attachmentUploads = this.attachmentUploads.filter((attachmentUpload) => !ids.includes(attachmentUpload.id));\n this.context.deleteAttachmentUploads(ids);\n }\n\n private deleteErroneousAttachmentUploads(): void {\n const attachmentUploads = this.context.getAttachmentUploads() || {};\n const ids = Object.values(attachmentUploads)\n .filter((item: AttachmentMetadata) => item.uploadError)\n .map((item: AttachmentMetadata) => item.id);\n\n ids.forEach((id) => {\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n });\n\n this.deleteAttachmentUploads(ids);\n }\n\n private registerAttachmentUploads(files: File[] | AttachmentMetadata[]): AttachmentUploadManager[] {\n this.deleteErroneousAttachmentUploads();\n const attachmentUploads: AttachmentUpload[] = [];\n files.forEach((file) => attachmentUploads.push(new AttachmentUpload(file)));\n attachmentUploads.forEach((attachmentUpload) => this.subscribeAllEvents(attachmentUpload));\n this.attachmentUploads = this.attachmentUploads.concat(attachmentUploads);\n this.context.addAttachmentUploads(attachmentUploads);\n return attachmentUploads;\n }\n\n registerActiveUploads(files: File[]): AttachmentUploadManager[] {\n return this.registerAttachmentUploads(files);\n }\n\n registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadManager[] {\n return this.registerAttachmentUploads(metadata);\n }\n\n clearUploads(): void {\n this.context.clearUploads();\n this.attachmentUploads.forEach((attachmentUpload) => this.unsubscribeAllEvents(attachmentUpload));\n this.attachmentUploads = [];\n }\n\n cancelUpload(id: string): void {\n this.deleteErroneousAttachmentUploads();\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n this.deleteAttachmentUploads([id]);\n }\n\n updateUploadProgress(id: string, progress: number): void {\n this.context.updateAttachmentUpload(id, { progress });\n }\n\n updateUploadStatusMessage(id: string, errorMessage: string): void {\n this.context.updateAttachmentUpload(id, {\n uploadError: {\n message: errorMessage,\n timestamp: Date.now()\n }\n });\n }\n\n updateUploadMetadata(id: string, metadata: AttachmentMetadata): void {\n this.context.updateAttachmentUpload(id, {\n progress: 1,\n id: metadata.id,\n name: metadata.name,\n url: metadata.url,\n extension: metadata.extension\n });\n }\n\n private subscribeAllEvents(attachmentUpload: AttachmentUpload): void {\n attachmentUpload.on('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload.on('uploadComplete', this.updateUploadMetadata.bind(this));\n attachmentUpload.on('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n\n private unsubscribeAllEvents(attachmentUpload?: AttachmentUpload): void {\n attachmentUpload?.off('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload?.off('uploadComplete', this.updateUploadMetadata.bind(this));\n attachmentUpload?.off('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n}\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n/**\n * @param attachmentUploadUiState {@link AttachmentUploadsUiState}\n * @private\n */\nexport const convertAttachmentUploadsUiStateToMessageMetadata = (\n attachmentUploads?: AttachmentUploadsUiState\n): FileSharingMetadata | undefined => {\n if (attachmentUploads) {\n const attachmentMetadata: AttachmentMetadata[] = [];\n Object.keys(attachmentUploads).forEach((key) => {\n const attachment = attachmentUploads[key];\n if (attachment && !attachment.uploadError) {\n attachmentMetadata.push({\n id: attachment.id,\n name: attachment.name,\n extension: attachment.extension,\n url: attachment.url,\n progress: attachment.progress\n });\n }\n });\n if (attachmentMetadata.length > 0) {\n return { fileSharingMetadata: JSON.stringify(attachmentMetadata) };\n }\n }\n return undefined;\n};\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n/**\n * @private\n */\nconst convertObservableAttachmentUploadToAttachmentUploadsUiState = (\n attachmentUploads: AttachmentUpload[]\n): AttachmentUploadsUiState => {\n return attachmentUploads.reduce((map: AttachmentUploadsUiState, attachmentUpload) => {\n map[attachmentUpload.id] = {\n id: attachmentUpload.id,\n name: attachmentUpload.name,\n progress: 0,\n extension: attachmentUpload.name.split('.').pop() || ''\n };\n return map;\n }, {});\n};\n"]}
|
1
|
+
{"version":3,"file":"AzureCommunicationAttachmentUploadAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,oDAAoD;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,oDAAoD;AACpD,OAAO,EAAuB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAyBxE,oDAAoD;AACpD;;GAEG;AACH,MAAM,uBAAuB;IAG3B,YAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,oBAAoB;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,iBAAiB,CAAC;IACvD,CAAC;IAEM,oBAAoB,CAAC,iBAAqC;QAC/D,MAAM,oBAAoB,GAAG,2DAA2D,CAAC,iBAAiB,CAAC,CAAC;QAC5G,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;YAC7C,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC;YACxD,KAAK,CAAC,iBAAiB,mCAAQ,KAAK,CAAC,iBAAiB,GAAK,oBAAoB,CAAE,CAAC;QACpF,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,YAAY;QACjB,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAuB,EAAE,EAAE;YAC/D,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,sBAAsB,CAC3B,EAAU,EACV,IAAyG;QAEzG,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,O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,EAAE,CAAC,GAAG;YACzB,EAAE,EAAE,gBAAgB,CAAC,EAAE;YACvB,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE;SACxD,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AttachmentUploadManager, AttachmentMetadata } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { produce } from 'immer';\n/* @conditional-compile-remove(attachment-upload) */\nimport { FileSharingMetadata, AttachmentUpload } from '../file-sharing';\n/* @conditional-compile-remove(attachment-upload) */\nimport { ChatContext } from './AzureCommunicationChatAdapter';\n/* @conditional-compile-remove(attachment-upload) */\nimport { ChatAdapterState } from './ChatAdapter';\n\n/**\n * A record containing {@link AttachmentMetadata} mapped to unique ids.\n * @beta\n */\nexport type AttachmentUploadsUiState = Record<string, AttachmentMetadata>;\n\n/**\n * @beta\n */\nexport interface AttachmentUploadAdapter {\n registerActiveUploads: (files: File[]) => AttachmentUploadManager[];\n registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadManager[];\n clearUploads: () => void;\n cancelUpload: (id: string) => void;\n updateUploadProgress: (id: string, progress: number) => void;\n updateUploadStatusMessage: (id: string, errorMessage: string) => void;\n updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nclass AttachmentUploadContext {\n private chatContext: ChatContext;\n\n constructor(chatContext: ChatContext) {\n this.chatContext = chatContext;\n }\n\n public getAttachmentUploads(): AttachmentUploadsUiState | undefined {\n return this.chatContext.getState().attachmentUploads;\n }\n\n public addAttachmentUploads(attachmentUploads: AttachmentUpload[]): void {\n const attachmentUploadsMap = convertObservableAttachmentUploadToAttachmentUploadsUiState(attachmentUploads);\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft) => {\n draft.attachmentUploads = draft.attachmentUploads || {};\n draft.attachmentUploads = { ...draft.attachmentUploads, ...attachmentUploadsMap };\n })\n );\n }\n\n public clearUploads(): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n draft.attachmentUploads = {};\n })\n );\n }\n\n public updateAttachmentUpload(\n id: string,\n data: Partial<Pick<AttachmentMetadata, 'progress' | 'id' | 'name' | 'extension' | 'uploadError' | 'url'>>\n ): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n if (draft.attachmentUploads?.[id]) {\n draft.attachmentUploads[data.id ?? id] = {\n ...draft.attachmentUploads?.[id],\n ...data\n };\n if (data.id) {\n delete draft.attachmentUploads?.[id];\n }\n }\n })\n );\n }\n\n public deleteAttachmentUploads(ids: string[]): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n ids.forEach((id) => {\n const keys = Object.keys(draft?.attachmentUploads ?? []).filter(\n (rawID) => draft.attachmentUploads?.[rawID].id === id\n );\n keys.forEach((key) => {\n delete draft.attachmentUploads?.[key];\n });\n });\n })\n );\n }\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nexport class AzureCommunicationAttachmentUploadAdapter implements AttachmentUploadAdapter {\n private context: AttachmentUploadContext;\n private attachmentUploads: AttachmentUpload[] = [];\n\n constructor(chatContext: ChatContext) {\n this.context = new AttachmentUploadContext(chatContext);\n }\n\n private findAttachmentUpload(id: string): AttachmentUpload | undefined {\n return this.attachmentUploads.find((attachmentUpload) => attachmentUpload.id === id);\n }\n\n private deleteAttachmentUploads(ids: string[]): void {\n this.attachmentUploads = this.attachmentUploads.filter((attachmentUpload) => !ids.includes(attachmentUpload.id));\n this.context.deleteAttachmentUploads(ids);\n }\n\n private deleteErroneousAttachmentUploads(): void {\n const attachmentUploads = this.context.getAttachmentUploads() || {};\n const ids = Object.values(attachmentUploads)\n .filter((item: AttachmentMetadata) => item.uploadError)\n .map((item: AttachmentMetadata) => item.id);\n\n ids.forEach((id) => {\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n });\n\n this.deleteAttachmentUploads(ids);\n }\n\n private registerAttachmentUploads(files: File[] | AttachmentMetadata[]): AttachmentUploadManager[] {\n this.deleteErroneousAttachmentUploads();\n const attachmentUploads: AttachmentUpload[] = [];\n files.forEach((file) => attachmentUploads.push(new AttachmentUpload(file)));\n attachmentUploads.forEach((attachmentUpload) => this.subscribeAllEvents(attachmentUpload));\n this.attachmentUploads = this.attachmentUploads.concat(attachmentUploads);\n this.context.addAttachmentUploads(attachmentUploads);\n return attachmentUploads;\n }\n\n registerActiveUploads(files: File[]): AttachmentUploadManager[] {\n return this.registerAttachmentUploads(files);\n }\n\n registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadManager[] {\n return this.registerAttachmentUploads(metadata);\n }\n\n clearUploads(): void {\n this.context.clearUploads();\n this.attachmentUploads.forEach((attachmentUpload) => this.unsubscribeAllEvents(attachmentUpload));\n this.attachmentUploads = [];\n }\n\n cancelUpload(id: string): void {\n this.deleteErroneousAttachmentUploads();\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n this.deleteAttachmentUploads([id]);\n }\n\n updateUploadProgress(id: string, progress: number): void {\n this.context.updateAttachmentUpload(id, { progress });\n }\n\n updateUploadStatusMessage(id: string, errorMessage: string): void {\n this.context.updateAttachmentUpload(id, {\n uploadError: {\n message: errorMessage,\n timestamp: Date.now()\n }\n });\n }\n\n updateUploadMetadata(id: string, metadata: AttachmentMetadata): void {\n this.context.updateAttachmentUpload(id, {\n progress: 1,\n id: metadata.id,\n name: metadata.name,\n url: metadata.url,\n extension: metadata.extension\n });\n }\n\n private subscribeAllEvents(attachmentUpload: AttachmentUpload): void {\n attachmentUpload.on('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload.on('uploadComplete', this.updateUploadMetadata.bind(this));\n attachmentUpload.on('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n\n private unsubscribeAllEvents(attachmentUpload?: AttachmentUpload): void {\n attachmentUpload?.off('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload?.off('uploadComplete', this.updateUploadMetadata.bind(this));\n attachmentUpload?.off('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @param attachmentUploadUiState {@link AttachmentUploadsUiState}\n * @private\n */\nexport const convertAttachmentUploadsUiStateToMessageMetadata = (\n attachmentUploads?: AttachmentUploadsUiState\n): FileSharingMetadata | undefined => {\n if (attachmentUploads) {\n const attachmentMetadata: AttachmentMetadata[] = [];\n Object.keys(attachmentUploads).forEach((key) => {\n const attachment = attachmentUploads[key];\n if (attachment && !attachment.uploadError) {\n attachmentMetadata.push({\n id: attachment.id,\n name: attachment.name,\n extension: attachment.extension,\n url: attachment.url,\n progress: attachment.progress\n });\n }\n });\n if (attachmentMetadata.length > 0) {\n return { fileSharingMetadata: JSON.stringify(attachmentMetadata) };\n }\n }\n return undefined;\n};\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @private\n */\nconst convertObservableAttachmentUploadToAttachmentUploadsUiState = (\n attachmentUploads: AttachmentUpload[]\n): AttachmentUploadsUiState => {\n return attachmentUploads.reduce((map: AttachmentUploadsUiState, attachmentUpload) => {\n map[attachmentUpload.id] = {\n id: attachmentUpload.id,\n name: attachmentUpload.name,\n progress: 0,\n extension: attachmentUpload.name.split('.').pop() || ''\n };\n return map;\n }, {});\n};\n"]}
|