@azure/communication-react 1.16.0-alpha-202405080011 → 1.16.0-alpha-202405132302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +109 -117
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-MqUGJDlB.js → ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js} +23 -14
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js.map +1 -0
- package/dist/dist-cjs/communication-react/{index-CY4kAQ6s.js → index-DdWRffLC.js} +742 -906
- package/dist/dist-cjs/communication-react/index-DdWRffLC.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/common.d.ts +74 -0
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
- package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.d.ts +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +24 -4
- package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -6
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +43 -26
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +0 -2
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.d.ts +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +5 -3
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.d.ts → Attachment/AttachmentCard.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentCard.js → Attachment/AttachmentCard.js} +17 -16
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.js → Attachment/AttachmentCardGroup.js} +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.d.ts → Attachment/AttachmentDownloadCards.d.ts} +3 -2
- package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.js → Attachment/AttachmentDownloadCards.js} +2 -2
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.d.ts → Attachment/AttachmentUploadCards.d.ts} +3 -3
- package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.js → Attachment/AttachmentUploadCards.js} +3 -3
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +21 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -4
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -14
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +6 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +31 -13
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +3 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/LocalVideoTile.d.ts +29 -29
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -7
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.d.ts +28 -28
- package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +30 -23
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +43 -27
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +4 -4
- package/dist/dist-esm/react-components/src/components/SendBox.js +42 -17
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +10 -10
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.d.ts +13 -13
- package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.d.ts +28 -28
- package/dist/dist-esm/react-components/src/components/index.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/index.js +3 -3
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +0 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +27 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +14 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +4 -3
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +6 -5
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +18 -18
- package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +38 -19
- package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +18 -18
- package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +18 -18
- package/dist/dist-esm/react-components/src/theming/icons.js +3 -3
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +21 -49
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +7 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +57 -30
- 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 +7 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +9 -4
- 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/CallReadinessModal.d.ts +6 -6
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +14 -14
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.d.ts +7 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +6 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.d.ts +6 -6
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +4 -15
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -76
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -23
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -11
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +22 -40
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +2 -9
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +3 -6
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +73 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +4 -17
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -89
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +6 -19
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +0 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -31
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +66 -61
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +33 -44
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +22 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionLanguageSettingsDrawer.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageSettingsDrawer.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.d.ts +6 -6
- package/dist/dist-esm/react-composites/src/composites/common/Survey.d.ts +20 -7
- package/dist/dist-esm/react-composites/src/composites/common/SurveyContent.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/TagsSurvey.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +1 -1
- package/package.json +5 -5
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-MqUGJDlB.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-CY4kAQ6s.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCardGroup.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +0 -188
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +0 -29
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
- /package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.d.ts → Attachment/AttachmentCardGroup.d.ts} +0 -0
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts
CHANGED
@@ -2,8 +2,7 @@ import type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/co
|
|
2
2
|
import type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';
|
3
3
|
import { ChatThreadClientState } from "../../../../../chat-stateful-client/src";
|
4
4
|
import type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';
|
5
|
-
import {
|
6
|
-
import { AttachmentMetadata } from "../../../../../react-components/src";
|
5
|
+
import { MessageOptions } from "../../../../../acs-ui-common/src";
|
7
6
|
/**
|
8
7
|
* {@link ChatAdapter} state for pure UI purposes.
|
9
8
|
*
|
@@ -11,14 +10,6 @@ import { AttachmentMetadata } from "../../../../../react-components/src";
|
|
11
10
|
*/
|
12
11
|
export type ChatAdapterUiState = {
|
13
12
|
error?: Error;
|
14
|
-
/**
|
15
|
-
* Attachments being uploaded by a user in the current thread.
|
16
|
-
* Should be set to null once the upload is complete.
|
17
|
-
* Array of type {@link _AttachmentUploadsUiState}
|
18
|
-
*
|
19
|
-
* @internal
|
20
|
-
*/
|
21
|
-
_attachmentUploads?: _AttachmentUploadsUiState;
|
22
13
|
};
|
23
14
|
/**
|
24
15
|
* {@link ChatAdapter} state inferred from Azure Communication Services backend.
|
@@ -54,12 +45,9 @@ export interface ChatAdapterThreadManagement {
|
|
54
45
|
fetchInitialData(): Promise<void>;
|
55
46
|
/**
|
56
47
|
* Send a message in the thread.
|
48
|
+
* Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.
|
57
49
|
*/
|
58
|
-
sendMessage(content: string, options?: SendMessageOptions): Promise<void>;
|
59
|
-
/**
|
60
|
-
* Send a message with attachments in the chat thread.
|
61
|
-
*/
|
62
|
-
sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void>;
|
50
|
+
sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
63
51
|
/**
|
64
52
|
* Send a read receipt for a message.
|
65
53
|
*/
|
@@ -78,10 +66,9 @@ export interface ChatAdapterThreadManagement {
|
|
78
66
|
setTopic(topicName: string): Promise<void>;
|
79
67
|
/**
|
80
68
|
* Update a message content.
|
69
|
+
* Please note that metadata is being deprecated, please use MessageOptions.metadata instead.
|
81
70
|
*/
|
82
|
-
updateMessage(messageId: string, content: string,
|
83
|
-
attachmentMetadata?: AttachmentMetadata[];
|
84
|
-
}): Promise<void>;
|
71
|
+
updateMessage(messageId: string, content: string, options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
|
85
72
|
/**
|
86
73
|
* Delete a message in the thread.
|
87
74
|
*/
|
@@ -197,7 +184,7 @@ export interface ChatAdapterSubscribers {
|
|
197
184
|
*
|
198
185
|
* @public
|
199
186
|
*/
|
200
|
-
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers
|
187
|
+
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers;
|
201
188
|
/**
|
202
189
|
* Callback for {@link ChatAdapterSubscribers} 'messageReceived' event.
|
203
190
|
*
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/communication-chat';\nimport type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';\nimport { ChatThreadClientState } from '@internal/chat-stateful-client';\nimport type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';\n/* @conditional-compile-remove(attachment-upload) */\nimport {
|
1
|
+
{"version":3,"file":"ChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/communication-chat';\nimport type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';\nimport { ChatThreadClientState } from '@internal/chat-stateful-client';\nimport type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * {@link ChatAdapter} state for pure UI purposes.\n *\n * @public\n */\nexport type ChatAdapterUiState = {\n // FIXME(Delete?)\n // Self-contained state for composite\n error?: Error;\n};\n\n/**\n * {@link ChatAdapter} state inferred from Azure Communication Services backend.\n *\n * @public\n */\nexport type ChatCompositeClientState = {\n userId: CommunicationIdentifierKind;\n displayName: string;\n thread: ChatThreadClientState;\n /**\n * Latest error encountered for each operation performed via the adapter.\n */\n latestErrors: AdapterErrors;\n};\n\n/**\n * {@link ChatAdapter} state.\n *\n * @public\n */\nexport type ChatAdapterState = ChatAdapterUiState & ChatCompositeClientState;\n\n/**\n * Functionality for managing the current chat thread.\n *\n * @public\n */\nexport interface ChatAdapterThreadManagement {\n /**\n * Fetch initial state for the Chat adapter.\n *\n * Performs the minimal fetch necessary for ChatComposite and API methods.\n */\n fetchInitialData(): Promise<void>;\n /**\n * Send a message in the thread.\n * Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.\n */\n sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void>;\n /**\n * Send a read receipt for a message.\n */\n sendReadReceipt(chatMessageId: string): Promise<void>;\n /**\n * Send typing indicator in the thread.\n */\n sendTypingIndicator(): Promise<void>;\n /**\n * Remove a participant in the thread.\n */\n removeParticipant(userId: string): Promise<void>;\n /**\n * Set the topic for the thread.\n */\n setTopic(topicName: string): Promise<void>;\n /**\n * Update a message content.\n * Please note that metadata is being deprecated, please use MessageOptions.metadata instead.\n */\n updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void>;\n /**\n * Delete a message in the thread.\n */\n deleteMessage(messageId: string): Promise<void>;\n /**\n * Load more previous messages in the chat thread history.\n *\n * @remarks\n * This method is usually used to control incremental fetch/infinite scroll\n *\n */\n loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;\n /**\n * Downloads a resource into the cache for the given message.\n */\n downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;\n /**\n * Removes a resource from the cache for the given message.\n */\n removeResourceFromCache(resourceDetails: ResourceDetails): void;\n}\n/**\n * Details required for download a resource to cache.\n *\n * @public\n */\nexport type ResourceDetails = {\n threadId: string;\n messageId: string;\n resourceUrl: string;\n};\n\n/**\n * Chat composite events that can be subscribed to.\n *\n * @public\n */\nexport interface ChatAdapterSubscribers {\n /**\n * Subscribe function for 'messageReceived' event.\n */\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Subscribe function for 'messageEdited' event.\n */\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Subscribe function for 'messageDeleted' event.\n */\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Subscribe function for 'messageSent' event.\n */\n on(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Subscribe function for 'messageRead' event.\n */\n on(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Subscribe function for 'participantsAdded' event.\n */\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Subscribe function for 'participantsRemoved' event.\n */\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Subscribe function for 'topicChanged' event.\n */\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Subscribe function for 'error' event.\n */\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n /**\n * Unsubscribe function for 'messageReceived' event.\n */\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Unsubscribe function for 'messageEdited' event.\n */\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Unsubscribe function for 'messageDeleted' event.\n */\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Unsubscribe function for 'messageSent' event.\n */\n off(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Unsubscribe function for 'messageRead' event.\n */\n off(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Unsubscribe function for 'participantsAdded' event.\n */\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Unsubscribe function for 'participantsRemoved' event.\n */\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Unsubscribe function for 'topicChanged' event.\n */\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Unsubscribe function for 'error' event.\n */\n off(event: 'error', listener: (e: AdapterError) => void): void;\n}\n\n/**\n * {@link ChatComposite} Adapter interface.\n *\n * @public\n */\nexport type ChatAdapter = ChatAdapterThreadManagement &\n AdapterState<ChatAdapterState> &\n Disposable &\n ChatAdapterSubscribers;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageReceived' event.\n *\n * @public\n */\nexport type MessageReceivedListener = (event: { message: ChatMessage }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageSent' event.\n *\n * @public\n */\nexport type MessageSentListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageEdited' event.\n *\n * @public\n */\nexport type MessageEditedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageDeleted' event.\n *\n * @public\n */\nexport type MessageDeletedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageRead' event.\n *\n * @public\n */\nexport type MessageReadListener = (event: { message: ChatMessage; readBy: CommunicationUserKind }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsAdded' event.\n *\n * @public\n */\nexport type ParticipantsAddedListener = (event: {\n participantsAdded: ChatParticipant[];\n addedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsRemoved' event.\n *\n * @public\n */\nexport type ParticipantsRemovedListener = (event: {\n participantsRemoved: ChatParticipant[];\n removedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'topicChanged' event.\n *\n * @public\n */\nexport type TopicChangedListener = (event: { topic: string }) => void;\n"]}
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { _AttachmentUploadAdapter } from './AzureCommunicationAttachmentUploadAdapter';
|
3
2
|
import { ChatAdapter } from './ChatAdapter';
|
4
3
|
/**
|
5
4
|
* @private
|
@@ -16,9 +15,5 @@ export declare const ChatAdapterProvider: (props: ChatProviderProps) => JSX.Elem
|
|
16
15
|
* @private
|
17
16
|
*/
|
18
17
|
export declare const useAdapter: () => ChatAdapter;
|
19
|
-
/**
|
20
|
-
* @private
|
21
|
-
*/
|
22
|
-
export declare const useAttachmentUploadAdapter: () => _AttachmentUploadAdapter;
|
23
18
|
export {};
|
24
19
|
//# sourceMappingURL=ChatAdapterProvider.d.ts.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js
CHANGED
@@ -19,35 +19,4 @@ export const useAdapter = () => {
|
|
19
19
|
}
|
20
20
|
return adapter;
|
21
21
|
};
|
22
|
-
/**
|
23
|
-
* @private
|
24
|
-
*/
|
25
|
-
export const useAttachmentUploadAdapter = () => {
|
26
|
-
/* @conditional-compile-remove(attachment-upload) */
|
27
|
-
return useAdapter();
|
28
|
-
// A stub that short-circuits all logic because none of the fields are available.
|
29
|
-
return {
|
30
|
-
registerActiveUploads() {
|
31
|
-
return [];
|
32
|
-
},
|
33
|
-
registerCompletedUploads() {
|
34
|
-
return [];
|
35
|
-
},
|
36
|
-
cancelUpload() {
|
37
|
-
// noop
|
38
|
-
},
|
39
|
-
clearUploads() {
|
40
|
-
// noop
|
41
|
-
},
|
42
|
-
updateUploadStatusMessage() {
|
43
|
-
// noop
|
44
|
-
},
|
45
|
-
updateUploadProgress() {
|
46
|
-
// noop
|
47
|
-
},
|
48
|
-
updateUploadMetadata() {
|
49
|
-
// noop
|
50
|
-
}
|
51
|
-
};
|
52
|
-
};
|
53
22
|
//# sourceMappingURL=ChatAdapterProvider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatAdapterProvider.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ChatAdapterProvider.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAWzD,MAAM,kBAAkB,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAwB,EAAe,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,OAAO,oBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,KAAK,CAAC,QAAQ,CAA+B,CAAC;AACrG,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAgB,EAAE;IAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,qDAAqD,CAAC;IAC9D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { ChatAdapter } from './ChatAdapter';\n\n/**\n * @private\n */\ntype ChatProviderProps = {\n children: React.ReactNode;\n adapter: ChatAdapter;\n};\n\nconst ChatAdapterContext = createContext<ChatAdapter | undefined>(undefined);\n\n/**\n * @private\n */\nexport const ChatAdapterProvider = (props: ChatProviderProps): JSX.Element => {\n const { adapter } = props;\n return <ChatAdapterContext.Provider value={adapter}>{props.children}</ChatAdapterContext.Provider>;\n};\n\n/**\n * @private\n */\nexport const useAdapter = (): ChatAdapter => {\n const adapter = useContext(ChatAdapterContext);\n if (!adapter) {\n throw 'Cannot find adapter please initialize before usage.';\n }\n return adapter;\n};\n"]}
|
@@ -1,75 +1,80 @@
|
|
1
|
-
import {
|
1
|
+
import { AttachmentUploadTask, AttachmentSelectionHandler, AttachmentActionHandler } from "../../../../../react-components/src";
|
2
|
+
import { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from "../../../../../acs-ui-common/src";
|
3
|
+
/**
|
4
|
+
* @internal
|
5
|
+
*/
|
6
|
+
export interface AttachmentUpload extends AttachmentUploadTask {
|
7
|
+
metadata: AttachmentMetadataInProgress;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* @private
|
11
|
+
*/
|
12
|
+
export declare enum AttachmentUploadActionType {
|
13
|
+
Set = "set",
|
14
|
+
Progress = "progress",
|
15
|
+
Completed = "completed",
|
16
|
+
Failed = "failed",
|
17
|
+
Remove = "remove",
|
18
|
+
Clear = "clear"
|
19
|
+
}
|
2
20
|
/**
|
3
|
-
* A wrapper object for a attachments that is being uploaded.
|
4
|
-
* Provides common functions for updating the upload progress, canceling an upload etc.
|
5
21
|
* @private
|
6
22
|
*/
|
7
|
-
|
8
|
-
|
9
|
-
readonly taskId: string;
|
10
|
-
readonly file?: File;
|
11
|
-
/**
|
12
|
-
* Name to be displayed in the UI during attachment upload.
|
13
|
-
*/
|
14
|
-
readonly name: string;
|
15
|
-
/**
|
16
|
-
* Optional object of type {@link AttachmentMetadata}
|
17
|
-
*/
|
18
|
-
metadata?: AttachmentMetadata;
|
19
|
-
constructor(data: File | AttachmentMetadata);
|
20
|
-
notifyUploadProgressChanged(value: number): void;
|
21
|
-
notifyUploadCompleted(id: string, url: string): void;
|
22
|
-
notifyUploadFailed(message: string): void;
|
23
|
-
on(event: 'uploadProgressChange', listener: UploadProgressListener): void;
|
24
|
-
on(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
25
|
-
on(event: 'uploadFail', listener: UploadFailedListener): void;
|
26
|
-
off(event: 'uploadProgressChange', listener: UploadProgressListener): void;
|
27
|
-
off(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
28
|
-
off(event: 'uploadFail', listener: UploadFailedListener): void;
|
23
|
+
interface Action {
|
24
|
+
type: AttachmentUploadActionType;
|
29
25
|
}
|
30
|
-
export type { AttachmentMetadata, AttachmentSelectionHandler, AttachmentUploadTask, AttachmentProgressError };
|
31
26
|
/**
|
32
|
-
*
|
33
|
-
* @beta
|
27
|
+
* @private
|
34
28
|
*/
|
35
|
-
|
29
|
+
interface SetAction extends Action {
|
30
|
+
type: AttachmentUploadActionType.Set;
|
31
|
+
newUploads: AttachmentUpload[];
|
32
|
+
}
|
36
33
|
/**
|
37
|
-
*
|
38
|
-
* @beta
|
34
|
+
* @private
|
39
35
|
*/
|
40
|
-
|
36
|
+
interface ProgressAction extends Action {
|
37
|
+
type: AttachmentUploadActionType.Progress;
|
38
|
+
taskId: string;
|
39
|
+
progress: number;
|
40
|
+
}
|
41
41
|
/**
|
42
|
-
*
|
43
|
-
* @beta
|
42
|
+
* @private
|
44
43
|
*/
|
45
|
-
|
44
|
+
interface CompleteAction extends Action {
|
45
|
+
type: AttachmentUploadActionType.Completed;
|
46
|
+
taskId: string;
|
47
|
+
id: string;
|
48
|
+
url: string;
|
49
|
+
}
|
46
50
|
/**
|
47
|
-
* @
|
51
|
+
* @private
|
48
52
|
*/
|
49
|
-
interface
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
on(event: 'uploadProgressChange', listener: UploadProgressListener): void;
|
54
|
-
/**
|
55
|
-
* Subscriber function for `uploadComplete` event.
|
56
|
-
*/
|
57
|
-
on(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
58
|
-
/**
|
59
|
-
* Subscriber function for `uploadFailed` event.
|
60
|
-
*/
|
61
|
-
on(event: 'uploadFail', listener: UploadFailedListener): void;
|
62
|
-
/**
|
63
|
-
* Unsubscriber function for `uploadProgressed` event.
|
64
|
-
*/
|
65
|
-
off(event: 'uploadProgressChange', listener: UploadProgressListener): void;
|
66
|
-
/**
|
67
|
-
* Unsubscriber function for `uploadComplete` event.
|
68
|
-
*/
|
69
|
-
off(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
70
|
-
/**
|
71
|
-
* Unsubscriber function for `uploadFailed` event.
|
72
|
-
*/
|
73
|
-
off(event: 'uploadFail', listener: UploadFailedListener): void;
|
53
|
+
interface FailedAction extends Action {
|
54
|
+
type: AttachmentUploadActionType.Failed;
|
55
|
+
taskId: string;
|
56
|
+
message: string;
|
74
57
|
}
|
58
|
+
/**
|
59
|
+
* @private
|
60
|
+
*/
|
61
|
+
interface RemoveAction extends Action {
|
62
|
+
type: AttachmentUploadActionType.Remove;
|
63
|
+
id: string;
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* @private
|
67
|
+
*/
|
68
|
+
interface ClearAction extends Action {
|
69
|
+
type: AttachmentUploadActionType.Clear;
|
70
|
+
}
|
71
|
+
/**
|
72
|
+
* @private
|
73
|
+
*/
|
74
|
+
type Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;
|
75
|
+
/**
|
76
|
+
* @internal
|
77
|
+
*/
|
78
|
+
export declare const AttachmentUploadReducer: (state: AttachmentUpload[], action: Actions) => AttachmentUpload[];
|
79
|
+
export type { AttachmentMetadata, AttachmentSelectionHandler, AttachmentActionHandler, AttachmentUploadTask, AttachmentProgressError };
|
75
80
|
//# sourceMappingURL=AttachmentUpload.d.ts.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js
CHANGED
@@ -1,51 +1,40 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import { EventEmitter } from 'events';
|
4
|
-
import { nanoid } from 'nanoid';
|
5
|
-
import { _MAX_EVENT_LISTENERS } from "../../../../../acs-ui-common/src";
|
6
3
|
/**
|
7
|
-
* A wrapper object for a attachments that is being uploaded.
|
8
|
-
* Provides common functions for updating the upload progress, canceling an upload etc.
|
9
4
|
* @private
|
10
5
|
*/
|
11
|
-
export
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
* Attachment upload event unsubscriber.
|
44
|
-
* @param event - {@link AttachmentUploadEvents}
|
45
|
-
* @param listener - {@link AttachmentUploadEventListener}
|
46
|
-
*/
|
47
|
-
off(event, listener) {
|
48
|
-
this._emitter.removeListener(event, listener);
|
6
|
+
export var AttachmentUploadActionType;
|
7
|
+
(function (AttachmentUploadActionType) {
|
8
|
+
AttachmentUploadActionType["Set"] = "set";
|
9
|
+
AttachmentUploadActionType["Progress"] = "progress";
|
10
|
+
AttachmentUploadActionType["Completed"] = "completed";
|
11
|
+
AttachmentUploadActionType["Failed"] = "failed";
|
12
|
+
AttachmentUploadActionType["Remove"] = "remove";
|
13
|
+
AttachmentUploadActionType["Clear"] = "clear";
|
14
|
+
})(AttachmentUploadActionType || (AttachmentUploadActionType = {}));
|
15
|
+
/**
|
16
|
+
* @internal
|
17
|
+
*/
|
18
|
+
export const AttachmentUploadReducer = (state, action) => {
|
19
|
+
switch (action.type) {
|
20
|
+
case AttachmentUploadActionType.Set:
|
21
|
+
return state.filter((v) => !v.metadata.error).concat(action.newUploads);
|
22
|
+
case AttachmentUploadActionType.Completed:
|
23
|
+
return state.map((v) => v.taskId === action.taskId
|
24
|
+
? Object.assign(Object.assign({}, v), { metadata: Object.assign(Object.assign({}, v.metadata), { id: action.id, url: action.url, progress: 1 }) }) : v);
|
25
|
+
case AttachmentUploadActionType.Failed:
|
26
|
+
return state.map((v) => v.taskId === action.taskId
|
27
|
+
? Object.assign(Object.assign({}, v), { metadata: Object.assign(Object.assign({}, v.metadata), { error: {
|
28
|
+
message: action.message
|
29
|
+
} }) }) : v);
|
30
|
+
case AttachmentUploadActionType.Remove:
|
31
|
+
return state.filter((v) => !v.metadata.error).filter((v) => v.metadata.id !== action.id);
|
32
|
+
case AttachmentUploadActionType.Progress:
|
33
|
+
return state.map((v) => v.taskId === action.taskId ? Object.assign(Object.assign({}, v), { metadata: Object.assign(Object.assign({}, v.metadata), { progress: action.progress }) }) : v);
|
34
|
+
case AttachmentUploadActionType.Clear:
|
35
|
+
return [];
|
36
|
+
default:
|
37
|
+
return state;
|
49
38
|
}
|
50
|
-
}
|
39
|
+
};
|
51
40
|
//# sourceMappingURL=AttachmentUpload.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
1
|
+
{"version":3,"file":"AttachmentUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC;;GAEG;AACH,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,yCAAW,CAAA;IACX,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;IACvB,+CAAiB,CAAA;IACjB,+CAAiB,CAAA;IACjB,6CAAe,CAAA;AACjB,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAiED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,MAAe,EAAsB,EAAE;IACxG,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,0BAA0B,CAAC,GAAG;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE1E,KAAK,0BAA0B,CAAC,SAAS;YACvC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrB,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;gBACxB,CAAC,iCAAM,CAAC,KAAE,QAAQ,kCAAO,CAAC,CAAC,QAAQ,KAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,OAChF,CAAC,CAAC,CAAC,CACN,CAAC;QAEJ,KAAK,0BAA0B,CAAC,MAAM;YACpC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrB,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;gBACxB,CAAC,iCACM,CAAC,KACJ,QAAQ,kCACH,CAAC,CAAC,QAAQ,KACb,KAAK,EAAE;4BACL,OAAO,EAAE,MAAM,CAAC,OAAO;yBACxB,OAGP,CAAC,CAAC,CAAC,CACN,CAAC;QAEJ,KAAK,0BAA0B,CAAC,MAAM;YACpC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;QAE3F,KAAK,0BAA0B,CAAC,QAAQ;YACtC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrB,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,iCAAM,CAAC,KAAE,QAAQ,kCAAO,CAAC,CAAC,QAAQ,KAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,OAAK,CAAC,CAAC,CAAC,CAClG,CAAC;QAEJ,KAAK,0BAA0B,CAAC,KAAK;YACnC,OAAO,EAAE,CAAC;QACZ;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AttachmentUploadTask, AttachmentSelectionHandler, AttachmentActionHandler } from '@internal/react-components';\nimport { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from '@internal/acs-ui-common';\n\n/**\n * @internal\n */\nexport interface AttachmentUpload extends AttachmentUploadTask {\n metadata: AttachmentMetadataInProgress;\n}\n\n/**\n * @private\n */\nexport enum AttachmentUploadActionType {\n Set = 'set',\n Progress = 'progress',\n Completed = 'completed',\n Failed = 'failed',\n Remove = 'remove',\n Clear = 'clear'\n}\n\n/**\n * @private\n */\ninterface Action {\n type: AttachmentUploadActionType;\n}\n\n/**\n * @private\n */\ninterface SetAction extends Action {\n type: AttachmentUploadActionType.Set;\n newUploads: AttachmentUpload[];\n}\n\n/**\n * @private\n */\ninterface ProgressAction extends Action {\n type: AttachmentUploadActionType.Progress;\n taskId: string;\n progress: number;\n}\n\n/**\n * @private\n */\ninterface CompleteAction extends Action {\n type: AttachmentUploadActionType.Completed;\n taskId: string;\n id: string;\n url: string;\n}\n\n/**\n * @private\n */\ninterface FailedAction extends Action {\n type: AttachmentUploadActionType.Failed;\n taskId: string;\n message: string;\n}\n\n/**\n * @private\n */\ninterface RemoveAction extends Action {\n type: AttachmentUploadActionType.Remove;\n id: string;\n}\n\n/**\n * @private\n */\ninterface ClearAction extends Action {\n type: AttachmentUploadActionType.Clear;\n}\n\n/**\n * @private\n */\ntype Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;\n\n/**\n * @internal\n */\nexport const AttachmentUploadReducer = (state: AttachmentUpload[], action: Actions): AttachmentUpload[] => {\n switch (action.type) {\n case AttachmentUploadActionType.Set:\n return state.filter((v) => !v.metadata.error).concat(action.newUploads);\n\n case AttachmentUploadActionType.Completed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? { ...v, metadata: { ...v.metadata, id: action.id, url: action.url, progress: 1 } }\n : v\n );\n\n case AttachmentUploadActionType.Failed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? {\n ...v,\n metadata: {\n ...v.metadata,\n error: {\n message: action.message\n }\n }\n }\n : v\n );\n\n case AttachmentUploadActionType.Remove:\n return state.filter((v) => !v.metadata.error).filter((v) => v.metadata.id !== action.id);\n\n case AttachmentUploadActionType.Progress:\n return state.map((v) =>\n v.taskId === action.taskId ? { ...v, metadata: { ...v.metadata, progress: action.progress } } : v\n );\n\n case AttachmentUploadActionType.Clear:\n return [];\n default:\n return state;\n }\n};\n\nexport type {\n AttachmentMetadata,\n AttachmentSelectionHandler,\n AttachmentActionHandler,\n AttachmentUploadTask,\n AttachmentProgressError\n};\n"]}
|
@@ -39,7 +39,7 @@ export const AttachmentUploadButton = (props) => {
|
|
39
39
|
} },
|
40
40
|
React.createElement(IconButton, { className: iconButtonClassName, ariaLabel: uploadAttachmentButtonStringTrampoline() },
|
41
41
|
React.createElement(SendBoxAttachFileIconTrampoline, null))),
|
42
|
-
React.createElement("input", { ref: inputRef, hidden: true, multiple: !disableMultipleUploads, accept: supportedMediaTypes.join(','), type: "file", onClick: (e) => {
|
42
|
+
React.createElement("input", { "data-testid": "attachment-upload-button", ref: inputRef, hidden: true, multiple: !disableMultipleUploads, accept: supportedMediaTypes.join(','), type: "file", onClick: (e) => {
|
43
43
|
// To ensure that `onChange` is fired even if the same file is picked again.
|
44
44
|
e.currentTarget.value = '';
|
45
45
|
}, onChange: (e) => {
|
@@ -66,7 +66,7 @@ props) => {
|
|
66
66
|
React.createElement(AttachmentUploadButton, Object.assign({}, props))));
|
67
67
|
};
|
68
68
|
const uploadAttachmentButtonStringTrampoline = () => {
|
69
|
-
|
69
|
+
/* @conditional-compile-remove(attachment-upload) */
|
70
70
|
//eslint-disable-next-line react-hooks/rules-of-hooks
|
71
71
|
return useLocale().strings.chat.uploadAttachment;
|
72
72
|
return '';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentUploadButton.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,oDAAoD;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA6B/C;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;IACxF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,+EAA+E;IAC/E,mFAAmF;IACnF,MAAM,EAAE,mBAAmB,GAAG,CAAC,GAAG,CAAC,EAAE,sBAAsB,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExF,MAAM,+BAA+B,GAAG,WAAW,CAAC;QAClD,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;SAC9C;KACF,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,WAAW,CAAC;QACtC,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE;YACR,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,aAAa;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,CACL;QACE,oBAAC,KAAK,IACJ,aAAa,EAAC,QAAQ,EACtB,eAAe,EAAC,QAAQ,EACxB,SAAS,EAAE,+BAA+B,EAC1C,OAAO,EAAE,GAAG,EAAE;;gBACZ,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC5B,CAAC;YAED,oBAAC,UAAU,IAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,sCAAsC,EAAE;gBAC7F,oBAAC,+BAA+B,OAAG,CACxB,CACP;QACR
|
1
|
+
{"version":3,"file":"AttachmentUploadButton.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,oDAAoD;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA6B/C;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;IACxF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,+EAA+E;IAC/E,mFAAmF;IACnF,MAAM,EAAE,mBAAmB,GAAG,CAAC,GAAG,CAAC,EAAE,sBAAsB,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExF,MAAM,+BAA+B,GAAG,WAAW,CAAC;QAClD,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;SAC9C;KACF,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,WAAW,CAAC;QACtC,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE;YACR,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,aAAa;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,CACL;QACE,oBAAC,KAAK,IACJ,aAAa,EAAC,QAAQ,EACtB,eAAe,EAAC,QAAQ,EACxB,SAAS,EAAE,+BAA+B,EAC1C,OAAO,EAAE,GAAG,EAAE;;gBACZ,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC5B,CAAC;YAED,oBAAC,UAAU,IAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,sCAAsC,EAAE;gBAC7F,oBAAC,+BAA+B,OAAG,CACxB,CACP;QACR,8CACc,0BAA0B,EACtC,GAAG,EAAE,QAAQ,EACb,MAAM,QACN,QAAQ,EAAE,CAAC,sBAAsB,EACjC,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EACrC,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,4EAA4E;gBAC5E,CAAC,CAAC,aAAa,CAAC,KAAK,GAAG,EAAE,CAAC;YAC7B,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,GACD,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,GAAgB,EAAE;IACxD,oDAAoD;IACpD,OAAO,oBAAC,iBAAiB,IAAC,QAAQ,EAAC,mBAAmB,GAAG,CAAC;IAC1D,+DAA+D;IAC/D,OAAO,oBAAC,iBAAiB,IAAC,QAAQ,EAAC,eAAe,GAAG,CAAC;AACxD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;AAC3C,oDAAoD;AACpD,6DAA6D;AAC7D,KAAuG,EAC1F,EAAE;IACf,OAAO,CACL;IAEI,oDAAoD;IACpD,oBAAC,sBAAsB,oBAAK,KAAK,EAAI,CAEtC,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,sCAAsC,GAAG,GAAW,EAAE;IAC1D,oDAAoD;IACpD,qDAAqD;IACrD,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACjD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IconButton, mergeStyles, Stack, useTheme } from '@fluentui/react';\nimport React from 'react';\nimport { ChatCompositeIcon } from '../../common/icons';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useLocale } from '../../localization';\n\n/**\n * Props for {@link AttachmentUploadButton} component.\n * @internal\n */\nexport interface AttachmentUploadButtonProps {\n /**\n * A list of strings containing the comma separated list of supported media (aka. mime) types.\n * i.e. ['image/*', 'video/*', 'audio/*']\n * Default value is `['*']`, meaning all media types are supported.\n * Similar to the `accept` attribute of the `<input type=\"file\" />` element.\n */\n supportedMediaTypes?: string[];\n /**\n * Disable multiple files to be selected if set to `true`.\n * Default value is `false`, meaning multiple files can be selected.\n * Similar to the `multiple` attribute of the `<input type=\"file\" />` element.\n */\n disableMultipleUploads?: boolean;\n /**\n * onChange handler for the attachment upload button.\n * Similar to the `onChange` attribute of the `<input type=\"file\" />` element.\n * Called every time files are selected through the attachment upload button with a {@link FileList}\n * of selected files.\n */\n onChange?: (files: FileList | null) => void;\n}\n\n/**\n * @internal\n */\nexport const AttachmentUploadButton = (props: AttachmentUploadButtonProps): JSX.Element => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const theme = useTheme();\n // default supportedMediaTypes is ['*'], meaning all media types are supported.\n // default disableMultipleUploads is false, meaning multiple files can be selected.\n const { supportedMediaTypes = ['*'], disableMultipleUploads = false, onChange } = props;\n\n const attachmentUploadButtonClassName = mergeStyles({\n width: '1.5rem',\n height: '1.5rem',\n cursor: 'pointer',\n padding: '0.15rem',\n ':hover': {\n backgroundColor: theme.palette.neutralLighter\n }\n });\n\n const iconButtonClassName = mergeStyles({\n color: 'unset',\n width: '1.5rem',\n height: '1.5rem',\n ':hover': {\n color: 'unset',\n background: 'transparent'\n }\n });\n\n return (\n <>\n <Stack\n verticalAlign=\"center\"\n horizontalAlign=\"center\"\n className={attachmentUploadButtonClassName}\n onClick={() => {\n inputRef.current?.click();\n }}\n >\n <IconButton className={iconButtonClassName} ariaLabel={uploadAttachmentButtonStringTrampoline()}>\n <SendBoxAttachFileIconTrampoline />\n </IconButton>\n </Stack>\n <input\n data-testid=\"attachment-upload-button\"\n ref={inputRef}\n hidden\n multiple={!disableMultipleUploads}\n accept={supportedMediaTypes.join(',')}\n type=\"file\"\n onClick={(e) => {\n // To ensure that `onChange` is fired even if the same file is picked again.\n e.currentTarget.value = '';\n }}\n onChange={(e) => {\n onChange && onChange(e.currentTarget.files);\n }}\n />\n </>\n );\n};\n\nconst SendBoxAttachFileIconTrampoline = (): JSX.Element => {\n /* @conditional-compile-remove(attachment-upload) */\n return <ChatCompositeIcon iconName=\"SendBoxAttachFile\" />;\n // Return _some_ available icon, as the real icon is beta-only.\n return <ChatCompositeIcon iconName=\"EditBoxCancel\" />;\n};\n\n/**\n * A wrapper to return {@link AttachmentUploadButton} component conditionally.\n * It will return `<></>` for stable builds.\n * @internal\n */\nexport const AttachmentUploadButtonWrapper = (\n // To make conditional compilation not throw errors.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n props: Pick<AttachmentUploadButtonProps, 'supportedMediaTypes' | 'disableMultipleUploads' | 'onChange'>\n): JSX.Element => {\n return (\n <>\n {\n /* @conditional-compile-remove(attachment-upload) */\n <AttachmentUploadButton {...props} />\n }\n </>\n );\n};\n\nconst uploadAttachmentButtonStringTrampoline = (): string => {\n /* @conditional-compile-remove(attachment-upload) */\n //eslint-disable-next-line react-hooks/rules-of-hooks\n return useLocale().strings.chat.uploadAttachment;\n return '';\n};\n"]}
|
@@ -1,12 +1,5 @@
|
|
1
1
|
export * from './AttachmentUpload';
|
2
2
|
export * from './AttachmentUploadButton';
|
3
|
-
export type { AttachmentOptions,
|
3
|
+
export type { AttachmentOptions, AttachmentUploadTask, AttachmentUploadOptions, AttachmentRemovalHandler, AttachmentMetadataWrapper, AttachmentSelectionHandler, AttachmentActionHandler } from "../../../../../react-components/src";
|
4
4
|
export type { AttachmentDownloadOptions } from "../../../../../react-components/src";
|
5
|
-
/**
|
6
|
-
* Metadata used for setting uploaded attachments by a user using chat composite in a group call.
|
7
|
-
* @internal
|
8
|
-
*/
|
9
|
-
export type FileSharingMetadata = {
|
10
|
-
fileSharingMetadata: string;
|
11
|
-
};
|
12
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './AttachmentUpload';\nexport * from './AttachmentUploadButton';\n\nexport type {\n AttachmentOptions,\n
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './AttachmentUpload';\nexport * from './AttachmentUploadButton';\n\nexport type {\n AttachmentOptions,\n AttachmentUploadTask,\n AttachmentUploadOptions,\n AttachmentRemovalHandler,\n AttachmentMetadataWrapper,\n AttachmentSelectionHandler,\n AttachmentActionHandler\n} from '@internal/react-components';\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type { AttachmentDownloadOptions } from '@internal/react-components';\n"]}
|
@@ -12,24 +12,36 @@ _component) => {
|
|
12
12
|
return createCompositeHandlers(useAdapter());
|
13
13
|
};
|
14
14
|
const createCompositeHandlers = memoizeOne((adapter) => ({
|
15
|
-
|
15
|
+
// have to use `any` here so we don't import from Chat SDK
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
|
+
onSendMessage: (content, options) => {
|
18
|
+
/* @conditional-compile-remove(attachment-upload) */
|
19
|
+
if (options &&
|
20
|
+
'attachments' in options &&
|
21
|
+
options.attachments &&
|
22
|
+
options.attachments[0] &&
|
23
|
+
!('attachmentType' in options.attachments[0])) {
|
24
|
+
const adapterMessageOption = {
|
25
|
+
metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), { fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) })
|
26
|
+
};
|
27
|
+
return adapter.sendMessage(content, adapterMessageOption);
|
28
|
+
}
|
29
|
+
return adapter.sendMessage(content, options);
|
30
|
+
},
|
16
31
|
onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,
|
17
32
|
onMessageSeen: adapter.sendReadReceipt,
|
18
33
|
onTyping: adapter.sendTypingIndicator,
|
19
34
|
onRemoveParticipant: adapter.removeParticipant,
|
20
35
|
updateThreadTopicName: adapter.setTopic,
|
21
|
-
onUpdateMessage: (messageId, content,
|
36
|
+
onUpdateMessage: function (messageId, content,
|
22
37
|
/* @conditional-compile-remove(attachment-upload) */
|
23
|
-
options)
|
24
|
-
let metadata = undefined;
|
25
|
-
/* @conditional-compile-remove(attachment-upload) */
|
26
|
-
metadata = options === null || options === void 0 ? void 0 : options.metadata;
|
38
|
+
options) {
|
27
39
|
/* @conditional-compile-remove(attachment-upload) */
|
28
|
-
const
|
29
|
-
|
40
|
+
const adapterMessageOptions = {
|
41
|
+
attachments: options === null || options === void 0 ? void 0 : options.attachments
|
30
42
|
};
|
31
|
-
return adapter.updateMessage(messageId, content,
|
32
|
-
/* @conditional-compile-remove(attachment-upload) */
|
43
|
+
return adapter.updateMessage(messageId, content,
|
44
|
+
/* @conditional-compile-remove(attachment-upload) */ adapterMessageOptions);
|
33
45
|
},
|
34
46
|
onDeleteMessage: adapter.deleteMessage
|
35
47
|
}));
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useHandlers.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D;;GAEG;AACH,+HAA+H;AAC/H,MAAM,CAAC,MAAM,WAAW,GAAG;AACzB,6DAA6D;AAC7D,UAAkD,EACU,EAAE;IAC9D,OAAO,uBAAuB,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,UAAU,CACxC,CAAC,OAAoB,EAAgB,EAAE,CAAC,CAAC;IACvC,aAAa,EAAE,OAAO,CAAC,WAAW;
|
1
|
+
{"version":3,"file":"useHandlers.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D;;GAEG;AACH,+HAA+H;AAC/H,MAAM,CAAC,MAAM,WAAW,GAAG;AACzB,6DAA6D;AAC7D,UAAkD,EACU,EAAE;IAC9D,OAAO,uBAAuB,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,UAAU,CACxC,CAAC,OAAoB,EAAgB,EAAE,CAAC,CAAC;IACvC,0DAA0D;IAC1D,8DAA8D;IAC9D,aAAa,EAAE,CAAC,OAAe,EAAE,OAAY,EAAE,EAAE;QAC/C,oDAAoD;QACpD,IACE,OAAO;YACP,aAAa,IAAI,OAAO;YACxB,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAC7C,CAAC;YACD,MAAM,oBAAoB,GAAG;gBAC3B,QAAQ,kCACH,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KACpB,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC,GAC1D;aACF,CAAC;YACF,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,0BAA0B,EAAE,OAAO,CAAC,wBAAwB;IAC5D,aAAa,EAAE,OAAO,CAAC,eAAe;IACtC,QAAQ,EAAE,OAAO,CAAC,mBAAmB;IACrC,mBAAmB,EAAE,OAAO,CAAC,iBAAiB;IAC9C,qBAAqB,EAAE,OAAO,CAAC,QAAQ;IACvC,eAAe,EAAE,UACf,SAAiB,EACjB,OAAe;IACf,oDAAoD;IACpD,OAAwB;QAExB,oDAAoD;QACpD,MAAM,qBAAqB,GAAmB;YAC5C,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW;SAClC,CAAC;QACF,OAAO,OAAO,CAAC,aAAa,CAC1B,SAAS,EACT,OAAO;QACP,oDAAoD,CAAC,qBAAqB,CAC3E,CAAC;IACJ,CAAC;IACD,eAAe,EAAE,OAAO,CAAC,aAAa;CACvC,CAAC,CACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommonProperties } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '@internal/chat-component-bindings';\n\nimport { ReactElement } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { ChatAdapter } from '../adapter/ChatAdapter';\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * @private\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _component: (props: PropsT) => ReactElement | null\n): Pick<ChatHandlers, CommonProperties<ChatHandlers, PropsT>> => {\n return createCompositeHandlers(useAdapter());\n};\n\nconst createCompositeHandlers = memoizeOne(\n (adapter: ChatAdapter): ChatHandlers => ({\n // have to use `any` here so we don't import from Chat SDK\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSendMessage: (content: string, options: any) => {\n /* @conditional-compile-remove(attachment-upload) */\n if (\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !('attachmentType' in options.attachments[0])\n ) {\n const adapterMessageOption = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n return adapter.sendMessage(content, adapterMessageOption);\n }\n return adapter.sendMessage(content, options);\n },\n onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,\n onMessageSeen: adapter.sendReadReceipt,\n onTyping: adapter.sendTypingIndicator,\n onRemoveParticipant: adapter.removeParticipant,\n updateThreadTopicName: adapter.setTopic,\n onUpdateMessage: function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(attachment-upload) */\n options?: MessageOptions\n ) {\n /* @conditional-compile-remove(attachment-upload) */\n const adapterMessageOptions: MessageOptions = {\n attachments: options?.attachments\n };\n return adapter.updateMessage(\n messageId,\n content,\n /* @conditional-compile-remove(attachment-upload) */ adapterMessageOptions\n );\n },\n onDeleteMessage: adapter.deleteMessage\n })\n);\n"]}
|
@@ -6,6 +6,5 @@ export type { ChatAdapter, ChatAdapterSubscribers, ChatAdapterThreadManagement,
|
|
6
6
|
export type { ResourceDetails } from './adapter/ChatAdapter';
|
7
7
|
export * from './Strings';
|
8
8
|
export type { AttachmentOptions, AttachmentMetadata, AttachmentDownloadOptions } from './file-sharing';
|
9
|
-
export type { AttachmentProgressError, AttachmentUploadOptions, AttachmentSelectionHandler, AttachmentRemovalHandler, AttachmentUploadTask } from './file-sharing';
|
10
|
-
export type { _AttachmentUploadsUiState, _AttachmentUploadAdapter } from './adapter/AzureCommunicationAttachmentUploadAdapter';
|
9
|
+
export type { AttachmentProgressError, AttachmentUploadOptions, AttachmentSelectionHandler, AttachmentActionHandler, AttachmentRemovalHandler, AttachmentUploadTask } from './file-sharing';
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|