@azure/communication-react 1.14.1-alpha-202403290012 → 1.14.1-alpha-202404020012
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 +111 -204
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js → RichTextSendBoxWrapper-BTyywbnH.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js.map → RichTextSendBoxWrapper-BTyywbnH.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-qxnuqL7s.js → index-Bj9ORqhl.js} +920 -779
- package/dist/dist-cjs/communication-react/index-Bj9ORqhl.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -1
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +4 -4
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +4 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +6 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.js +2 -2
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +2 -2
- package/dist/dist-esm/communication-react/src/index.js +2 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.d.ts +0 -4
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js +4 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.d.ts +5 -36
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js +15 -24
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +4 -8
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/EndCallButton.d.ts +10 -1
- package/dist/dist-esm/react-components/src/components/EndCallButton.js +93 -51
- package/dist/dist-esm/react-components/src/components/EndCallButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/ReactionButton.js +8 -5
- package/dist/dist-esm/react-components/src/components/ReactionButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +3 -3
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +23 -23
- 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 +5 -5
- package/dist/dist-esm/react-components/src/components/SendBox.js +16 -16
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.d.ts +8 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js +8 -4
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.js +4 -4
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.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 +22 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js +3 -2
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js +10 -12
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +3 -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/SendBoxUtils.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +7 -7
- 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 +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -1
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +15 -88
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +24 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/Prompt.js +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/Prompt.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js +66 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +3 -3
- 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.d.ts +8 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +21 -21
- 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 +8 -8
- 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 +8 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +15 -15
- 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 +3 -3
- 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 +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +2 -33
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +23 -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/AzureCommunicationAttachmentUploadAdapter.d.ts +47 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +179 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +9 -9
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -29
- 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 +4 -4
- 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 +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +8 -8
- 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/{FileUpload.d.ts → AttachmentUpload.d.ts} +10 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUpload.js → AttachmentUpload.js} +12 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.d.ts +38 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUploadButton.js → AttachmentUploadButton.js} +11 -9
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js +2 -2
- 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/index.d.ts +2 -3
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +29 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +12 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +2 -2
- 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 +24 -8
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js +5 -5
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +7 -1
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/utils.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/common/utils.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/common/utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +6 -0
- package/package.json +7 -7
- package/dist/dist-cjs/communication-react/index-qxnuqL7s.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js +0 -160
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.d.ts +0 -36
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +0 -27
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js.map +0 -1
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts
CHANGED
@@ -2,7 +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 {
|
5
|
+
import { AttachmentUploadAdapter, AttachmentUploadsUiState } from './AzureCommunicationAttachmentUploadAdapter';
|
6
6
|
import { AttachmentMetadata } from "../../../../../react-components/src";
|
7
7
|
/**
|
8
8
|
* {@link ChatAdapter} state for pure UI purposes.
|
@@ -14,10 +14,10 @@ export type ChatAdapterUiState = {
|
|
14
14
|
/**
|
15
15
|
* Files being uploaded by a user in the current thread.
|
16
16
|
* Should be set to null once the upload is complete.
|
17
|
-
* Array of type {@link
|
17
|
+
* Array of type {@link AttachmentUploadsUiState}
|
18
18
|
* @beta
|
19
19
|
*/
|
20
|
-
|
20
|
+
attachmentUploads?: AttachmentUploadsUiState;
|
21
21
|
};
|
22
22
|
/**
|
23
23
|
* {@link ChatAdapter} state inferred from Azure Communication Services backend.
|
@@ -192,7 +192,7 @@ export interface ChatAdapterSubscribers {
|
|
192
192
|
*
|
193
193
|
* @public
|
194
194
|
*/
|
195
|
-
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers &
|
195
|
+
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers & AttachmentUploadAdapter;
|
196
196
|
/**
|
197
197
|
* Callback for {@link ChatAdapterSubscribers} 'messageReceived' event.
|
198
198
|
*
|
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-download) @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-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadAdapter, AttachmentUploadsUiState } from './AzureCommunicationAttachmentUploadAdapter';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/react-components';\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 /* @conditional-compile-remove(attachment-download) @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 * @beta\n */\n attachmentUploads?: AttachmentUploadsUiState;\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 */\n sendMessage(content: string, options?: SendMessageOptions): 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 */\n updateMessage(\n messageId: string,\n content: string,\n metadata?: Record<string, string>,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n options?: {\n attachmentMetadata?: AttachmentMetadata[];\n }\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 /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n AttachmentUploadAdapter;\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,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { AttachmentUploadAdapter } from './AzureCommunicationAttachmentUploadAdapter';
|
3
3
|
import { ChatAdapter } from './ChatAdapter';
|
4
4
|
/**
|
5
5
|
* @private
|
@@ -19,6 +19,6 @@ export declare const useAdapter: () => ChatAdapter;
|
|
19
19
|
/**
|
20
20
|
* @private
|
21
21
|
*/
|
22
|
-
export declare const
|
22
|
+
export declare const useAttachmentUploadAdapter: () => AttachmentUploadAdapter;
|
23
23
|
export {};
|
24
24
|
//# sourceMappingURL=ChatAdapterProvider.d.ts.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js
CHANGED
@@ -22,30 +22,30 @@ export const useAdapter = () => {
|
|
22
22
|
/**
|
23
23
|
* @private
|
24
24
|
*/
|
25
|
-
export const
|
25
|
+
export const useAttachmentUploadAdapter = () => {
|
26
26
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
27
27
|
return useAdapter();
|
28
28
|
// A stub that short-circuits all logic because none of the fields are available.
|
29
29
|
return {
|
30
|
-
|
30
|
+
registerActiveUploads() {
|
31
31
|
return [];
|
32
32
|
},
|
33
|
-
|
33
|
+
registerCompletedUploads() {
|
34
34
|
return [];
|
35
35
|
},
|
36
|
-
|
36
|
+
cancelUpload() {
|
37
37
|
// noop
|
38
38
|
},
|
39
|
-
|
39
|
+
clearUploads() {
|
40
40
|
// noop
|
41
41
|
},
|
42
|
-
|
42
|
+
updateUploadStatusMessage() {
|
43
43
|
// noop
|
44
44
|
},
|
45
|
-
|
45
|
+
updateUploadProgress() {
|
46
46
|
// noop
|
47
47
|
},
|
48
|
-
|
48
|
+
updateUploadMetadata() {
|
49
49
|
// noop
|
50
50
|
}
|
51
51
|
};
|
@@ -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;AAazD,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;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,
|
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;AAazD,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;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAA4B,EAAE;IACtE,qGAAqG;IACrG,OAAO,UAAU,EAAE,CAAC;IACpB,iFAAiF;IACjF,OAAO;QACL,qBAAqB;YACnB,OAAO,EAA+B,CAAC;QACzC,CAAC;QACD,wBAAwB;YACtB,OAAO,EAA+B,CAAC;QACzC,CAAC;QACD,YAAY;YACV,OAAO;QACT,CAAC;QACD,YAAY;YACV,OAAO;QACT,CAAC;QACD,yBAAyB;YACvB,OAAO;QACT,CAAC;QACD,oBAAoB;YAClB,OAAO;QACT,CAAC;QACD,oBAAoB;YAClB,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { AttachmentUploadManager } from '@internal/react-components';\nimport { AttachmentUploadAdapter } from './AzureCommunicationAttachmentUploadAdapter';\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\n/**\n * @private\n */\nexport const useAttachmentUploadAdapter = (): AttachmentUploadAdapter => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useAdapter();\n // A stub that short-circuits all logic because none of the fields are available.\n return {\n registerActiveUploads() {\n return [] as AttachmentUploadManager[];\n },\n registerCompletedUploads() {\n return [] as AttachmentUploadManager[];\n },\n cancelUpload() {\n // noop\n },\n clearUploads() {\n // noop\n },\n updateUploadStatusMessage() {\n // noop\n },\n updateUploadProgress() {\n // noop\n },\n updateUploadMetadata() {\n // noop\n }\n };\n};\n"]}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
import { AttachmentMetadata,
|
1
|
+
import { AttachmentMetadata, AttachmentUploadHandler, AttachmentUploadManager, AttachmentUploadStatus } from "../../../../../react-components/src";
|
2
2
|
/**
|
3
3
|
* A wrapper object for a file that is being uploaded.
|
4
4
|
* Provides common functions for updating the upload progress, canceling an upload etc.
|
5
5
|
* @private
|
6
6
|
*/
|
7
|
-
export declare class
|
7
|
+
export declare class AttachmentUpload implements AttachmentUploadManager, AttachmentUploadEventEmitter {
|
8
8
|
private _emitter;
|
9
9
|
readonly id: string;
|
10
10
|
readonly file?: File;
|
11
11
|
/**
|
12
|
-
*
|
12
|
+
* Name to be displayed in the UI during attachment upload.
|
13
13
|
*/
|
14
|
-
readonly
|
14
|
+
readonly name: string;
|
15
15
|
/**
|
16
16
|
* Optional object of type {@link AttachmentMetadata}
|
17
17
|
*/
|
18
18
|
metadata?: AttachmentMetadata;
|
19
19
|
constructor(data: File | AttachmentMetadata);
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
notifyProgressChanged(value: number): void;
|
21
|
+
notifyCompleted(metadata: AttachmentMetadata): void;
|
22
|
+
notifyFailed(message: string): void;
|
23
23
|
on(event: 'uploadProgressChange', listener: UploadProgressListener): void;
|
24
24
|
on(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
25
25
|
on(event: 'uploadFail', listener: UploadFailedListener): void;
|
@@ -27,7 +27,7 @@ export declare class FileUpload implements FileUploadManager, FileUploadEventEmi
|
|
27
27
|
off(event: 'uploadComplete', listener: UploadCompleteListener): void;
|
28
28
|
off(event: 'uploadFail', listener: UploadFailedListener): void;
|
29
29
|
}
|
30
|
-
export type { AttachmentMetadata,
|
30
|
+
export type { AttachmentMetadata, AttachmentUploadHandler, AttachmentUploadManager, AttachmentUploadStatus };
|
31
31
|
/**
|
32
32
|
* Listener for `uploadProgressed` event.
|
33
33
|
* @beta
|
@@ -46,7 +46,7 @@ type UploadFailedListener = (id: string, message: string) => void;
|
|
46
46
|
/**
|
47
47
|
* @beta
|
48
48
|
*/
|
49
|
-
interface
|
49
|
+
interface AttachmentUploadEventEmitter {
|
50
50
|
/**
|
51
51
|
* Subscriber function for `uploadProgressed` event.
|
52
52
|
*/
|
@@ -72,4 +72,4 @@ interface FileUploadEventEmitter {
|
|
72
72
|
*/
|
73
73
|
off(event: 'uploadFail', listener: UploadFailedListener): void;
|
74
74
|
}
|
75
|
-
//# sourceMappingURL=
|
75
|
+
//# sourceMappingURL=AttachmentUpload.d.ts.map
|
@@ -8,7 +8,7 @@ import { _MAX_EVENT_LISTENERS } from "../../../../../acs-ui-common/src";
|
|
8
8
|
* Provides common functions for updating the upload progress, canceling an upload etc.
|
9
9
|
* @private
|
10
10
|
*/
|
11
|
-
export class
|
11
|
+
export class AttachmentUpload {
|
12
12
|
constructor(data) {
|
13
13
|
this._emitter = new EventEmitter();
|
14
14
|
this._emitter.setMaxListeners(_MAX_EVENT_LISTENERS);
|
@@ -20,32 +20,32 @@ export class FileUpload {
|
|
20
20
|
this.metadata = data;
|
21
21
|
}
|
22
22
|
const name = data === null || data === void 0 ? void 0 : data.name;
|
23
|
-
this.
|
23
|
+
this.name = name;
|
24
24
|
}
|
25
|
-
|
25
|
+
notifyProgressChanged(value) {
|
26
26
|
this._emitter.emit('uploadProgressChange', this.id, value);
|
27
27
|
}
|
28
|
-
|
28
|
+
notifyCompleted(metadata) {
|
29
29
|
this._emitter.emit('uploadComplete', this.id, metadata);
|
30
30
|
}
|
31
|
-
|
31
|
+
notifyFailed(message) {
|
32
32
|
this._emitter.emit('uploadFail', this.id, message);
|
33
33
|
}
|
34
34
|
/**
|
35
|
-
*
|
36
|
-
* @param event - {@link
|
37
|
-
* @param listener - {@link
|
35
|
+
* Attachment upload event subscriber.
|
36
|
+
* @param event - {@link AttachmentUploadEvents}
|
37
|
+
* @param listener - {@link AttachmentUploadEventListener}
|
38
38
|
*/
|
39
39
|
on(event, listener) {
|
40
40
|
this._emitter.addListener(event, listener);
|
41
41
|
}
|
42
42
|
/**
|
43
|
-
*
|
44
|
-
* @param event - {@link
|
45
|
-
* @param listener - {@link
|
43
|
+
* Attachment upload event unsubscriber.
|
44
|
+
* @param event - {@link AttachmentUploadEvents}
|
45
|
+
* @param listener - {@link AttachmentUploadEventListener}
|
46
46
|
*/
|
47
47
|
off(event, listener) {
|
48
48
|
this._emitter.removeListener(event, listener);
|
49
49
|
}
|
50
50
|
}
|
51
|
-
//# sourceMappingURL=
|
51
|
+
//# sourceMappingURL=AttachmentUpload.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AttachmentUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,yCAAgC;AAQ/D;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAa3B,YAAY,IAA+B;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;QACpD,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;QACnB,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAI,IAAsC,aAAtC,IAAI,uBAAJ,IAAI,CAAoC,IAAI,CAAC;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,qBAAqB,CAAC,KAAa;QACjC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CAAC,QAA4B;QAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAKD;;;;OAIG;IACH,EAAE,CAAC,KAA6B,EAAE,QAAuC;QACvE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAKD;;;;OAIG;IACH,GAAG,CAAC,KAA6B,EAAE,QAAuC;QACxE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { EventEmitter } from 'events';\nimport { nanoid } from 'nanoid';\nimport { _MAX_EVENT_LISTENERS } from '@internal/acs-ui-common';\nimport {\n AttachmentMetadata,\n AttachmentUploadHandler,\n AttachmentUploadManager,\n AttachmentUploadStatus\n} from '@internal/react-components';\n\n/**\n * A wrapper object for a file that is being uploaded.\n * Provides common functions for updating the upload progress, canceling an upload etc.\n * @private\n */\nexport class AttachmentUpload implements AttachmentUploadManager, AttachmentUploadEventEmitter {\n private _emitter: EventEmitter;\n public readonly id: string;\n public readonly file?: File;\n /**\n * Name to be displayed in the UI during attachment upload.\n */\n public readonly name: string;\n /**\n * Optional object of type {@link AttachmentMetadata}\n */\n public metadata?: AttachmentMetadata;\n\n constructor(data: File | AttachmentMetadata) {\n this._emitter = new EventEmitter();\n this._emitter.setMaxListeners(_MAX_EVENT_LISTENERS);\n this.id = nanoid();\n if (data instanceof File) {\n this.file = data;\n } else {\n this.metadata = data;\n }\n const name = (data as unknown as AttachmentMetadata)?.name;\n this.name = name;\n }\n\n notifyProgressChanged(value: number): void {\n this._emitter.emit('uploadProgressChange', this.id, value);\n }\n\n notifyCompleted(metadata: AttachmentMetadata): void {\n this._emitter.emit('uploadComplete', this.id, metadata);\n }\n\n notifyFailed(message: string): void {\n this._emitter.emit('uploadFail', this.id, message);\n }\n\n on(event: 'uploadProgressChange', listener: UploadProgressListener): void;\n on(event: 'uploadComplete', listener: UploadCompleteListener): void;\n on(event: 'uploadFail', listener: UploadFailedListener): void;\n /**\n * Attachment upload event subscriber.\n * @param event - {@link AttachmentUploadEvents}\n * @param listener - {@link AttachmentUploadEventListener}\n */\n on(event: AttachmentUploadEvents, listener: AttachmentUploadEventListener): void {\n this._emitter.addListener(event, listener);\n }\n\n off(event: 'uploadProgressChange', listener: UploadProgressListener): void;\n off(event: 'uploadComplete', listener: UploadCompleteListener): void;\n off(event: 'uploadFail', listener: UploadFailedListener): void;\n /**\n * Attachment upload event unsubscriber.\n * @param event - {@link AttachmentUploadEvents}\n * @param listener - {@link AttachmentUploadEventListener}\n */\n off(event: AttachmentUploadEvents, listener: AttachmentUploadEventListener): void {\n this._emitter.removeListener(event, listener);\n }\n}\n\nexport type { AttachmentMetadata, AttachmentUploadHandler, AttachmentUploadManager, AttachmentUploadStatus };\n\n/**\n * Events emitted by the AttachmentUpload class.\n * @beta\n */\ntype AttachmentUploadEvents = 'uploadProgressChange' | 'uploadComplete' | 'uploadFail';\n\n/**\n * Events listeners supported by the AttachmentUpload class.\n * @beta\n */\ntype AttachmentUploadEventListener = UploadProgressListener | UploadCompleteListener | UploadFailedListener;\n\n/**\n * Listener for `uploadProgressed` event.\n * @beta\n */\ntype UploadProgressListener = (id: string, value: number) => void;\n/**\n * Listener for `uploadComplete` event.\n * @beta\n */\ntype UploadCompleteListener = (id: string, metadata: AttachmentMetadata) => void;\n/**\n * Listener for `uploadFailed` event.\n * @beta\n */\ntype UploadFailedListener = (id: string, message: string) => void;\n\n/**\n * @beta\n */\ninterface AttachmentUploadEventEmitter {\n /**\n * Subscriber function for `uploadProgressed` event.\n */\n on(event: 'uploadProgressChange', listener: UploadProgressListener): void;\n /**\n * Subscriber function for `uploadComplete` event.\n */\n on(event: 'uploadComplete', listener: UploadCompleteListener): void;\n /**\n * Subscriber function for `uploadFailed` event.\n */\n on(event: 'uploadFail', listener: UploadFailedListener): void;\n\n /**\n * Unsubscriber function for `uploadProgressed` event.\n */\n off(event: 'uploadProgressChange', listener: UploadProgressListener): void;\n /**\n * Unsubscriber function for `uploadComplete` event.\n */\n off(event: 'uploadComplete', listener: UploadCompleteListener): void;\n /**\n * Unsubscriber function for `uploadFailed` event.\n */\n off(event: 'uploadFail', listener: UploadFailedListener): void;\n}\n"]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
/**
|
3
|
+
* Props for {@link AttachmentUploadButton} component.
|
4
|
+
* @internal
|
5
|
+
*/
|
6
|
+
export interface AttachmentUploadButtonProps {
|
7
|
+
/**
|
8
|
+
* A list of strings containing the comma separated list of supported media (aka. mime) types.
|
9
|
+
* i.e. ['image/*', 'video/*', 'audio/*']
|
10
|
+
* Default value is `['*']`, meaning all media types are supported.
|
11
|
+
* Similar to the `accept` attribute of the `<input type="file" />` element.
|
12
|
+
*/
|
13
|
+
supportedMediaTypes?: string[];
|
14
|
+
/**
|
15
|
+
* Disable multiple files to be selected if set to `true`.
|
16
|
+
* Default value is `false`, meaning multiple files can be selected.
|
17
|
+
* Similar to the `multiple` attribute of the `<input type="file" />` element.
|
18
|
+
*/
|
19
|
+
disableMultipleUploads?: boolean;
|
20
|
+
/**
|
21
|
+
* onChange handler for the attachment upload button.
|
22
|
+
* Similar to the `onChange` attribute of the `<input type="file" />` element.
|
23
|
+
* Called every time files are selected through the attachment upload button with a {@link FileList}
|
24
|
+
* of selected files.
|
25
|
+
*/
|
26
|
+
onChange?: (files: FileList | null) => void;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* @internal
|
30
|
+
*/
|
31
|
+
export declare const AttachmentUploadButton: (props: AttachmentUploadButtonProps) => JSX.Element;
|
32
|
+
/**
|
33
|
+
* A wrapper to return {@link AttachmentUploadButton} component conditionally.
|
34
|
+
* It will return `<></>` for stable builds.
|
35
|
+
* @internal
|
36
|
+
*/
|
37
|
+
export declare const AttachmentUploadButtonWrapper: (props: Pick<AttachmentUploadButtonProps, 'supportedMediaTypes' | 'disableMultipleUploads' | 'onChange'>) => JSX.Element;
|
38
|
+
//# sourceMappingURL=AttachmentUploadButton.d.ts.map
|
@@ -8,11 +8,13 @@ import { useLocale } from '../../localization';
|
|
8
8
|
/**
|
9
9
|
* @internal
|
10
10
|
*/
|
11
|
-
export const
|
11
|
+
export const AttachmentUploadButton = (props) => {
|
12
12
|
const inputRef = React.useRef(null);
|
13
13
|
const theme = useTheme();
|
14
|
-
|
15
|
-
|
14
|
+
// default supportedMediaTypes is ['*'], meaning all media types are supported.
|
15
|
+
// default disableMultipleUploads is false, meaning multiple files can be selected.
|
16
|
+
const { supportedMediaTypes = ['*'], disableMultipleUploads = false, onChange } = props;
|
17
|
+
const attachmentUploadButtonClassName = mergeStyles({
|
16
18
|
width: '1.5rem',
|
17
19
|
height: '1.5rem',
|
18
20
|
cursor: 'pointer',
|
@@ -31,13 +33,13 @@ export const FileUploadButton = (props) => {
|
|
31
33
|
}
|
32
34
|
});
|
33
35
|
return (React.createElement(React.Fragment, null,
|
34
|
-
React.createElement(Stack, { verticalAlign: "center", horizontalAlign: "center", className:
|
36
|
+
React.createElement(Stack, { verticalAlign: "center", horizontalAlign: "center", className: attachmentUploadButtonClassName, onClick: () => {
|
35
37
|
var _a;
|
36
38
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
37
39
|
} },
|
38
40
|
React.createElement(IconButton, { className: iconButtonClassName, ariaLabel: uploadFileButtonStringTrampoline() },
|
39
41
|
React.createElement(SendBoxAttachFileIconTrampoline, null))),
|
40
|
-
React.createElement("input", { ref: inputRef, hidden: true, multiple:
|
42
|
+
React.createElement("input", { ref: inputRef, hidden: true, multiple: !disableMultipleUploads, accept: supportedMediaTypes.join(','), type: "file", onClick: (e) => {
|
41
43
|
// To ensure that `onChange` is fired even if the same file is picked again.
|
42
44
|
e.currentTarget.value = '';
|
43
45
|
}, onChange: (e) => {
|
@@ -51,17 +53,17 @@ const SendBoxAttachFileIconTrampoline = () => {
|
|
51
53
|
return React.createElement(ChatCompositeIcon, { iconName: "EditBoxCancel" });
|
52
54
|
};
|
53
55
|
/**
|
54
|
-
* A wrapper to return {@link
|
56
|
+
* A wrapper to return {@link AttachmentUploadButton} component conditionally.
|
55
57
|
* It will return `<></>` for stable builds.
|
56
58
|
* @internal
|
57
59
|
*/
|
58
|
-
export const
|
60
|
+
export const AttachmentUploadButtonWrapper = (
|
59
61
|
// To make conditional compilation not throw errors.
|
60
62
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
61
63
|
props) => {
|
62
64
|
return (React.createElement(React.Fragment, null,
|
63
65
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
64
|
-
React.createElement(
|
66
|
+
React.createElement(AttachmentUploadButton, Object.assign({}, props))));
|
65
67
|
};
|
66
68
|
const uploadFileButtonStringTrampoline = () => {
|
67
69
|
//@conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload)
|
@@ -69,4 +71,4 @@ const uploadFileButtonStringTrampoline = () => {
|
|
69
71
|
return useLocale().strings.chat.uploadFile;
|
70
72
|
return '';
|
71
73
|
};
|
72
|
-
//# sourceMappingURL=
|
74
|
+
//# sourceMappingURL=AttachmentUploadButton.js.map
|
@@ -0,0 +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,qGAAqG;AACrG,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,gCAAgC,EAAE;gBACvF,oBAAC,+BAA+B,OAAG,CACxB,CACP;QACR,+BACE,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,kGAAkG;IAClG,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,qGAAqG;IACrG,oBAAC,sBAAsB,oBAAK,KAAK,EAAI,CAEtC,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gCAAgC,GAAG,GAAW,EAAE;IACpD,iGAAiG;IACjG,qDAAqD;IACrD,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;IAC3C,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-download) @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={uploadFileButtonStringTrampoline()}>\n <SendBoxAttachFileIconTrampoline />\n </IconButton>\n </Stack>\n <input\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-download) @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-download) @conditional-compile-remove(attachment-upload) */\n <AttachmentUploadButton {...props} />\n }\n </>\n );\n};\n\nconst uploadFileButtonStringTrampoline = (): string => {\n //@conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload)\n //eslint-disable-next-line react-hooks/rules-of-hooks\n return useLocale().strings.chat.uploadFile;\n return '';\n};\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './
|
3
|
-
export type { AttachmentUploadStatus, AttachmentUploadOptions, AttachmentUploadHandler, AttachmentUploadManager } from "../../../../../react-components/src";
|
1
|
+
export * from './AttachmentUpload';
|
2
|
+
export * from './AttachmentUploadButton';
|
3
|
+
export type { AttachmentOptions, AttachmentUploadStatus, AttachmentUploadOptions, AttachmentUploadHandler, AttachmentUploadManager } from "../../../../../react-components/src";
|
4
4
|
export type { AttachmentDownloadOptions } from "../../../../../react-components/src";
|
5
5
|
/**
|
6
6
|
* Metadata used for setting uploaded files by a user using chat composite in a group call.
|
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,
|
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 AttachmentUploadStatus,\n AttachmentUploadOptions,\n AttachmentUploadHandler,\n AttachmentUploadManager\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\n/**\n * Metadata used for setting uploaded files by a user using chat composite in a group call.\n * @internal\n */\nexport type FileSharingMetadata = {\n fileSharingMetadata: string;\n};\n"]}
|
@@ -6,7 +6,6 @@ export type { RichTextEditorOptions } from './ChatComposite';
|
|
6
6
|
export type { ChatAdapter, ChatAdapterSubscribers, ChatAdapterThreadManagement, ChatCompositeClientState, ChatAdapterState, ChatAdapterUiState, MessageReadListener, MessageReceivedListener, MessageSentListener, MessageEditedListener, MessageDeletedListener, ParticipantsAddedListener, ParticipantsRemovedListener, TopicChangedListener } from './adapter/ChatAdapter';
|
7
7
|
export type { ResourceDetails } from './adapter/ChatAdapter';
|
8
8
|
export * from './Strings';
|
9
|
-
export type {
|
10
|
-
export type {
|
11
|
-
export type { FileUploadsUiState, FileUploadAdapter } from './adapter/AzureCommunicationFileUploadAdapter';
|
9
|
+
export type { AttachmentOptions, AttachmentMetadata, AttachmentUploadStatus, AttachmentUploadOptions, AttachmentDownloadOptions, AttachmentUploadHandler, AttachmentUploadManager } from './file-sharing';
|
10
|
+
export type { AttachmentUploadsUiState, AttachmentUploadAdapter } from './adapter/AzureCommunicationAttachmentUploadAdapter';
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,mCAAmC,EACnC,6CAA6C,EAC7C,gCAAgC,EACjC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwBhD,cAAc,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n createAzureCommunicationChatAdapter,\n createAzureCommunicationChatAdapterFromClient,\n useAzureCommunicationChatAdapter\n} from './adapter/AzureCommunicationChatAdapter';\nexport type { AzureCommunicationChatAdapterArgs } from './adapter/AzureCommunicationChatAdapter';\nexport { ChatComposite } from './ChatComposite';\nexport type { ChatCompositeProps, ChatCompositeOptions } from './ChatComposite';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextEditorOptions } from './ChatComposite';\n\nexport type {\n ChatAdapter,\n ChatAdapterSubscribers,\n ChatAdapterThreadManagement,\n ChatCompositeClientState,\n ChatAdapterState,\n ChatAdapterUiState,\n MessageReadListener,\n MessageReceivedListener,\n MessageSentListener,\n MessageEditedListener,\n MessageDeletedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './adapter/ChatAdapter';\n\nexport type { ResourceDetails } from './adapter/ChatAdapter';\n\nexport * from './Strings';\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type {\n
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,mCAAmC,EACnC,6CAA6C,EAC7C,gCAAgC,EACjC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwBhD,cAAc,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n createAzureCommunicationChatAdapter,\n createAzureCommunicationChatAdapterFromClient,\n useAzureCommunicationChatAdapter\n} from './adapter/AzureCommunicationChatAdapter';\nexport type { AzureCommunicationChatAdapterArgs } from './adapter/AzureCommunicationChatAdapter';\nexport { ChatComposite } from './ChatComposite';\nexport type { ChatCompositeProps, ChatCompositeOptions } from './ChatComposite';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextEditorOptions } from './ChatComposite';\n\nexport type {\n ChatAdapter,\n ChatAdapterSubscribers,\n ChatAdapterThreadManagement,\n ChatCompositeClientState,\n ChatAdapterState,\n ChatAdapterUiState,\n MessageReadListener,\n MessageReceivedListener,\n MessageSentListener,\n MessageEditedListener,\n MessageDeletedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './adapter/ChatAdapter';\n\nexport type { ResourceDetails } from './adapter/ChatAdapter';\n\nexport * from './Strings';\n\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentOptions,\n AttachmentMetadata,\n AttachmentUploadStatus,\n AttachmentUploadOptions,\n AttachmentDownloadOptions,\n AttachmentUploadHandler,\n AttachmentUploadManager\n} from './file-sharing';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentUploadsUiState,\n AttachmentUploadAdapter\n} from './adapter/AzureCommunicationAttachmentUploadAdapter';\n"]}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* @private
|
3
|
+
*/
|
4
|
+
export declare const attachmentUploadsSelector: ((state: import("index").ChatAdapterUiState & import("index").ChatCompositeClientState) => {
|
5
|
+
files: {
|
6
|
+
uploadComplete: boolean;
|
7
|
+
extension?: string | undefined;
|
8
|
+
id: string;
|
9
|
+
name: string;
|
10
|
+
url?: string | undefined;
|
11
|
+
progress?: number | undefined;
|
12
|
+
uploadError?: import("index").AttachmentUploadStatus | undefined;
|
13
|
+
}[];
|
14
|
+
}) & import("reselect").OutputSelectorFields<(args_0: import("index").AttachmentUploadsUiState | undefined) => {
|
15
|
+
files: {
|
16
|
+
uploadComplete: boolean;
|
17
|
+
extension?: string | undefined;
|
18
|
+
id: string;
|
19
|
+
name: string;
|
20
|
+
url?: string | undefined;
|
21
|
+
progress?: number | undefined;
|
22
|
+
uploadError?: import("index").AttachmentUploadStatus | undefined;
|
23
|
+
}[];
|
24
|
+
}, {
|
25
|
+
clearCache: () => void;
|
26
|
+
}> & {
|
27
|
+
clearCache: () => void;
|
28
|
+
};
|
29
|
+
//# sourceMappingURL=attachmentUploadsSelector.d.ts.map
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { createSelector } from 'reselect';
|
4
|
+
import { getAttachmentUploads } from './baseSelectors';
|
5
|
+
/**
|
6
|
+
* @private
|
7
|
+
*/
|
8
|
+
export const attachmentUploadsSelector = createSelector([getAttachmentUploads], (attachmentUploads) => {
|
9
|
+
const files = Object.values(attachmentUploads || {}).map((attachmentUpload) => (Object.assign(Object.assign({}, attachmentUpload), { uploadComplete: !!attachmentUpload })));
|
10
|
+
return { files: files };
|
11
|
+
});
|
12
|
+
//# sourceMappingURL=attachmentUploadsSelector.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"attachmentUploadsSelector.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE;IACpG,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,iCAC1E,gBAAgB,KACnB,cAAc,EAAE,CAAC,CAAC,gBAAgB,IAClC,CAAC,CAAC;IACJ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSelector } from 'reselect';\nimport { getAttachmentUploads } from './baseSelectors';\n\n/**\n * @private\n */\nexport const attachmentUploadsSelector = createSelector([getAttachmentUploads], (attachmentUploads) => {\n const files = Object.values(attachmentUploads || {}).map((attachmentUpload) => ({\n ...attachmentUpload,\n uploadComplete: !!attachmentUpload\n }));\n return { files: files };\n});\n"]}
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CommunicationIdentifierKind } from '@azure/communication-common';
|
2
2
|
import { ChatAdapterState } from '../adapter/ChatAdapter';
|
3
|
-
import {
|
3
|
+
import { AttachmentUploadsUiState } from '../adapter/AzureCommunicationAttachmentUploadAdapter';
|
4
4
|
/**
|
5
5
|
* @private
|
6
6
|
*/
|
@@ -8,5 +8,5 @@ export declare const getUserId: (state: ChatAdapterState) => CommunicationIdenti
|
|
8
8
|
/**
|
9
9
|
* @private
|
10
10
|
*/
|
11
|
-
export declare const
|
11
|
+
export declare const getAttachmentUploads: (state: ChatAdapterState) => AttachmentUploadsUiState | undefined;
|
12
12
|
//# sourceMappingURL=baseSelectors.d.ts.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js
CHANGED
@@ -7,9 +7,9 @@ export const getUserId = (state) => state.userId;
|
|
7
7
|
/**
|
8
8
|
* @private
|
9
9
|
*/
|
10
|
-
export const
|
10
|
+
export const getAttachmentUploads = (state) => {
|
11
11
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
12
|
-
return state === null || state === void 0 ? void 0 : state.
|
12
|
+
return state === null || state === void 0 ? void 0 : state.attachmentUploads;
|
13
13
|
return undefined;
|
14
14
|
};
|
15
15
|
//# sourceMappingURL=baseSelectors.js.map
|
package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"baseSelectors.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/selectors/baseSelectors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAuB,EAA+B,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,
|
1
|
+
{"version":3,"file":"baseSelectors.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/selectors/baseSelectors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAuB,EAA+B,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAuB,EAAwC,EAAE;IACpG,qGAAqG;IACrG,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,CAAC;IAChC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { ChatAdapterState } from '../adapter/ChatAdapter';\nimport { AttachmentUploadsUiState } from '../adapter/AzureCommunicationAttachmentUploadAdapter';\n\n/**\n * @private\n */\nexport const getUserId = (state: ChatAdapterState): CommunicationIdentifierKind => state.userId;\n\n/**\n * @private\n */\nexport const getAttachmentUploads = (state: ChatAdapterState): AttachmentUploadsUiState | undefined => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return state?.attachmentUploads;\n return undefined;\n};\n"]}
|