@azure/communication-react 1.10.1-alpha-202312010014 → 1.11.0-alpha-202312020013
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 +79 -75
- package/dist/dist-cjs/communication-react/index.js +63 -54
- 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/chat-component-bindings/src/handlers/createHandlers.d.ts +2 -2
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +23 -17
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.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.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +12 -12
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +8 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +2 -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 +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +6 -6
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +36 -37
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +6 -5
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +5 -5
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +9 -3
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +4 -4
- 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 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +5 -6
- 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 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +1 -3
- 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/AzureCommunicationFileUploadAdapter.d.ts +5 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.d.ts +11 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +2 -2
- package/package.json +1 -1
@@ -238,7 +238,7 @@ export declare type AreParamEqual<A extends (props: any) => JSX.Element | undefi
|
|
238
238
|
export declare type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;
|
239
239
|
|
240
240
|
/**
|
241
|
-
*
|
241
|
+
* Metadata of the attachment object returned by the ACS SDK.
|
242
242
|
* @beta
|
243
243
|
*/
|
244
244
|
export declare interface AttachmentDownloadResult {
|
@@ -246,6 +246,12 @@ export declare interface AttachmentDownloadResult {
|
|
246
246
|
blobUrl: string;
|
247
247
|
}
|
248
248
|
|
249
|
+
/**
|
250
|
+
* Metadata containing information about the uploaded file.
|
251
|
+
* @beta
|
252
|
+
*/
|
253
|
+
export declare type AttachmentMetadata = FileMetadata | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ InlineImageMetadata;
|
254
|
+
|
249
255
|
/**
|
250
256
|
* Custom data attributes for displaying avatar for a user.
|
251
257
|
*
|
@@ -425,36 +431,6 @@ export declare interface BaseCustomStyles {
|
|
425
431
|
root?: IStyle;
|
426
432
|
}
|
427
433
|
|
428
|
-
/**
|
429
|
-
* Base interface that all Meta Data should extend.
|
430
|
-
* Typically used for ACS to ACS file transfers.
|
431
|
-
* @beta
|
432
|
-
*/
|
433
|
-
export declare interface BaseFileMetadata {
|
434
|
-
/**
|
435
|
-
* File name to be displayed.
|
436
|
-
*/
|
437
|
-
name: string;
|
438
|
-
/**
|
439
|
-
* Extension is used for rendering the file icon.
|
440
|
-
* An unknown extension will be rendered as a generic icon.
|
441
|
-
* Example: `jpeg`
|
442
|
-
*/
|
443
|
-
extension: string;
|
444
|
-
/**
|
445
|
-
* Download URL for the file.
|
446
|
-
*/
|
447
|
-
url: string;
|
448
|
-
/**
|
449
|
-
* Unique ID of the file.
|
450
|
-
*/
|
451
|
-
id: string;
|
452
|
-
/**
|
453
|
-
* Attachment Type
|
454
|
-
*/
|
455
|
-
attachmentType: FileMetadataAttachmentType;
|
456
|
-
}
|
457
|
-
|
458
434
|
/**
|
459
435
|
* Content blocked message type.
|
460
436
|
*
|
@@ -2862,7 +2838,7 @@ export declare interface CallWithChatAdapterManagement {
|
|
2862
2838
|
/** @beta */
|
2863
2839
|
registerActiveFileUploads: (files: File[]) => FileUploadManager[];
|
2864
2840
|
/** @beta */
|
2865
|
-
registerCompletedFileUploads: (metadata:
|
2841
|
+
registerCompletedFileUploads: (metadata: AttachmentMetadata[]) => FileUploadManager[];
|
2866
2842
|
/** @beta */
|
2867
2843
|
clearFileUploads: () => void;
|
2868
2844
|
/** @beta */
|
@@ -2872,7 +2848,7 @@ export declare interface CallWithChatAdapterManagement {
|
|
2872
2848
|
/** @beta */
|
2873
2849
|
updateFileUploadErrorMessage: (id: string, errorMessage: string) => void;
|
2874
2850
|
/** @beta */
|
2875
|
-
updateFileUploadMetadata: (id: string, metadata:
|
2851
|
+
updateFileUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
2876
2852
|
downloadAttachments: (options: {
|
2877
2853
|
attachmentUrls: Record<string, string>;
|
2878
2854
|
}) => Promise<AttachmentDownloadResult[]>;
|
@@ -4041,7 +4017,7 @@ export declare interface ChatAdapterThreadManagement {
|
|
4041
4017
|
* Update a message content.
|
4042
4018
|
*/
|
4043
4019
|
updateMessage(messageId: string, content: string, metadata?: Record<string, string>, options?: {
|
4044
|
-
|
4020
|
+
attachmentMetadata?: AttachmentMetadata[];
|
4045
4021
|
}): Promise<void>;
|
4046
4022
|
/**
|
4047
4023
|
* Delete a message in the thread.
|
@@ -4076,6 +4052,12 @@ export declare type ChatAdapterUiState = {
|
|
4076
4052
|
fileUploads?: FileUploadsUiState;
|
4077
4053
|
};
|
4078
4054
|
|
4055
|
+
/**
|
4056
|
+
* Represents the type of attachment
|
4057
|
+
* @beta
|
4058
|
+
*/
|
4059
|
+
export declare type ChatAttachmentType = 'file' | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ 'inlineImage' | 'unknown';
|
4060
|
+
|
4079
4061
|
/**
|
4080
4062
|
* Common props for selectors for {@link ChatClientState}.
|
4081
4063
|
*
|
@@ -4332,7 +4314,7 @@ export declare type ChatHandlers = {
|
|
4332
4314
|
onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;
|
4333
4315
|
onUpdateMessage: (messageId: string, content: string, options?: {
|
4334
4316
|
metadata?: Record<string, string>;
|
4335
|
-
|
4317
|
+
attachmentMetadata?: AttachmentMetadata[];
|
4336
4318
|
}) => Promise<void>;
|
4337
4319
|
onDeleteMessage: (messageId: string) => Promise<void>;
|
4338
4320
|
};
|
@@ -4362,10 +4344,16 @@ export declare interface ChatMessage extends MessageCommon {
|
|
4362
4344
|
metadata?: Record<string, string>;
|
4363
4345
|
/**
|
4364
4346
|
* @beta
|
4365
|
-
* A list of
|
4347
|
+
* A list of file attachments for the message.
|
4366
4348
|
* {@link FileMetadata}
|
4367
4349
|
*/
|
4368
|
-
|
4350
|
+
files?: FileMetadata[];
|
4351
|
+
/**
|
4352
|
+
* @beta
|
4353
|
+
* A list of inline images embedded in the message.
|
4354
|
+
* {@link InlineImageMetadata}
|
4355
|
+
*/
|
4356
|
+
inlineImages?: InlineImageMetadata[];
|
4369
4357
|
}
|
4370
4358
|
|
4371
4359
|
/**
|
@@ -6573,28 +6561,35 @@ export declare interface FileDownloadError {
|
|
6573
6561
|
*
|
6574
6562
|
* ```
|
6575
6563
|
* @param userId - The user ID of the user downloading the file.
|
6576
|
-
* @param fileMetadata - The {@link
|
6564
|
+
* @param fileMetadata - The {@link AttachmentMetadata} containing file `url`, `extension` and `name`.
|
6577
6565
|
*/
|
6578
|
-
export declare type FileDownloadHandler = (userId: string, fileMetadata:
|
6566
|
+
export declare type FileDownloadHandler = (userId: string, fileMetadata: AttachmentMetadata) => Promise<URL | FileDownloadError>;
|
6579
6567
|
|
6580
6568
|
/**
|
6581
|
-
*
|
6582
|
-
*
|
6583
|
-
*/
|
6584
|
-
export declare type FileMetadata = FileSharingMetadata | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ ImageFileMetadata;
|
6585
|
-
|
6586
|
-
/**
|
6587
|
-
* @beta
|
6588
|
-
*/
|
6589
|
-
export declare type FileMetadataAttachmentType = 'fileSharing' | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ 'inlineImage' | 'unknown';
|
6590
|
-
|
6591
|
-
/**
|
6592
|
-
* Meta Data containing basic information about the uploaded file.
|
6593
|
-
* Typically used for ACS to ACS file transfers.
|
6569
|
+
* Metadata containing basic information about the uploaded file.
|
6570
|
+
*
|
6594
6571
|
* @beta
|
6595
6572
|
*/
|
6596
|
-
export declare interface
|
6597
|
-
attachmentType: '
|
6573
|
+
export declare interface FileMetadata {
|
6574
|
+
attachmentType: 'file';
|
6575
|
+
/**
|
6576
|
+
* Extension hint, useful for rendering a specific icon.
|
6577
|
+
* An unknown or empty extension will be rendered as a generic icon.
|
6578
|
+
* Example: `pdf`
|
6579
|
+
*/
|
6580
|
+
extension: string;
|
6581
|
+
/**
|
6582
|
+
* Unique ID of the file.
|
6583
|
+
*/
|
6584
|
+
id: string;
|
6585
|
+
/**
|
6586
|
+
* File name to be displayed.
|
6587
|
+
*/
|
6588
|
+
name: string;
|
6589
|
+
/**
|
6590
|
+
* Download URL for the file.
|
6591
|
+
*/
|
6592
|
+
url: string;
|
6598
6593
|
payload?: Record<string, string>;
|
6599
6594
|
}
|
6600
6595
|
|
@@ -6635,12 +6630,12 @@ export declare interface FileSharingOptions {
|
|
6635
6630
|
*/
|
6636
6631
|
export declare interface FileUploadAdapter {
|
6637
6632
|
registerActiveFileUploads: (files: File[]) => FileUploadManager[];
|
6638
|
-
registerCompletedFileUploads: (metadata:
|
6633
|
+
registerCompletedFileUploads: (metadata: AttachmentMetadata[]) => FileUploadManager[];
|
6639
6634
|
clearFileUploads: () => void;
|
6640
6635
|
cancelFileUpload: (id: string) => void;
|
6641
6636
|
updateFileUploadProgress: (id: string, progress: number) => void;
|
6642
6637
|
updateFileUploadErrorMessage: (id: string, errorMessage: string) => void;
|
6643
|
-
updateFileUploadMetadata: (id: string, metadata:
|
6638
|
+
updateFileUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
6644
6639
|
}
|
6645
6640
|
|
6646
6641
|
/**
|
@@ -6663,7 +6658,7 @@ export declare type FileUploadHandler = (userId: string, fileUploads: FileUpload
|
|
6663
6658
|
|
6664
6659
|
/**
|
6665
6660
|
* A wrapper object for a file that is being uploaded.
|
6666
|
-
* Allows
|
6661
|
+
* Allows managing file uploads by providing common functions for updating the
|
6667
6662
|
* upload progress, canceling an upload, completing an upload etc.
|
6668
6663
|
* @beta
|
6669
6664
|
*/
|
@@ -6684,9 +6679,9 @@ export declare interface FileUploadManager {
|
|
6684
6679
|
/**
|
6685
6680
|
* Mark the upload as complete.
|
6686
6681
|
* Requires the `metadata` param containing uploaded file information.
|
6687
|
-
* @param metadata - {@link
|
6682
|
+
* @param metadata - {@link AttachmentMetadata}
|
6688
6683
|
*/
|
6689
|
-
notifyUploadCompleted: (metadata:
|
6684
|
+
notifyUploadCompleted: (metadata: AttachmentMetadata) => void;
|
6690
6685
|
/**
|
6691
6686
|
* Mark the upload as failed.
|
6692
6687
|
* @param message - An error message that can be displayed to the user.
|
@@ -6695,7 +6690,7 @@ export declare interface FileUploadManager {
|
|
6695
6690
|
}
|
6696
6691
|
|
6697
6692
|
/**
|
6698
|
-
* Contains the state
|
6693
|
+
* Contains the state attributes of a file upload like name, progress etc.
|
6699
6694
|
* @beta
|
6700
6695
|
*/
|
6701
6696
|
export declare interface FileUploadState {
|
@@ -6713,9 +6708,9 @@ export declare interface FileUploadState {
|
|
6713
6708
|
*/
|
6714
6709
|
progress: number;
|
6715
6710
|
/**
|
6716
|
-
*
|
6711
|
+
* Metadata {@link AttachmentMetadata} containing information about the uploaded file.
|
6717
6712
|
*/
|
6718
|
-
metadata?:
|
6713
|
+
metadata?: AttachmentMetadata;
|
6719
6714
|
/**
|
6720
6715
|
* Error message to be displayed to the user if the upload fails.
|
6721
6716
|
*/
|
@@ -6976,15 +6971,6 @@ export declare interface _Identifiers {
|
|
6976
6971
|
mentionSuggestionItem: string;
|
6977
6972
|
}
|
6978
6973
|
|
6979
|
-
/**
|
6980
|
-
* Meta Data containing data for images.
|
6981
|
-
* @beta
|
6982
|
-
*/
|
6983
|
-
export declare interface ImageFileMetadata extends BaseFileMetadata {
|
6984
|
-
attachmentType: 'inlineImage';
|
6985
|
-
previewUrl?: string;
|
6986
|
-
}
|
6987
|
-
|
6988
6974
|
/**
|
6989
6975
|
* Component to render a fullscreen modal for a selected image.
|
6990
6976
|
*
|
@@ -7104,6 +7090,24 @@ export declare interface IncomingCallState {
|
|
7104
7090
|
endTime?: Date;
|
7105
7091
|
}
|
7106
7092
|
|
7093
|
+
/**
|
7094
|
+
* Metadata for rendering images inline with a message.
|
7095
|
+
* This does not include images attached as files.
|
7096
|
+
* @beta
|
7097
|
+
*/
|
7098
|
+
export declare interface InlineImageMetadata {
|
7099
|
+
attachmentType: 'inlineImage';
|
7100
|
+
/**
|
7101
|
+
* Unique ID of the attachment.
|
7102
|
+
*/
|
7103
|
+
id: string;
|
7104
|
+
previewUrl?: string;
|
7105
|
+
/**
|
7106
|
+
* Download URL for the full resolution version.
|
7107
|
+
*/
|
7108
|
+
url: string;
|
7109
|
+
}
|
7110
|
+
|
7107
7111
|
/**
|
7108
7112
|
* Callback for {@link CallAdapterSubscribers} 'isCaptionLanguageChanged' event.
|
7109
7113
|
*
|
@@ -7708,16 +7712,16 @@ export declare type MessageThreadProps = {
|
|
7708
7712
|
*/
|
7709
7713
|
onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;
|
7710
7714
|
/**
|
7711
|
-
* Optional callback to render
|
7715
|
+
* Optional callback to render attached files in the message component.
|
7712
7716
|
* @beta
|
7713
7717
|
*/
|
7714
7718
|
onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;
|
7715
7719
|
/**
|
7716
7720
|
* Optional callback to retrieve the inline image in a message.
|
7717
|
-
* @param attachment -
|
7721
|
+
* @param attachment - AttachmentMetadata object we want to render
|
7718
7722
|
* @beta
|
7719
7723
|
*/
|
7720
|
-
onFetchAttachments?: (attachments:
|
7724
|
+
onFetchAttachments?: (attachments: AttachmentMetadata[]) => Promise<AttachmentDownloadResult[]>;
|
7721
7725
|
/**
|
7722
7726
|
* Optional callback to edit a message.
|
7723
7727
|
*
|
@@ -9818,7 +9822,7 @@ export declare interface UnsupportedOperatingSystemStrings {
|
|
9818
9822
|
*/
|
9819
9823
|
export declare type UpdateMessageCallback = (messageId: string, content: string, options?: {
|
9820
9824
|
metadata?: Record<string, string>;
|
9821
|
-
|
9825
|
+
attachmentMetadata?: AttachmentMetadata[];
|
9822
9826
|
}) => Promise<void>;
|
9823
9827
|
|
9824
9828
|
/**
|
@@ -177,7 +177,7 @@ const _isValidIdentifier = (identifier) => {
|
|
177
177
|
// Copyright (c) Microsoft Corporation.
|
178
178
|
// Licensed under the MIT License.
|
179
179
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
180
|
-
var telemetryVersion = '1.
|
180
|
+
var telemetryVersion = '1.11.0-alpha-202312020013';
|
181
181
|
|
182
182
|
// Copyright (c) Microsoft Corporation.
|
183
183
|
/**
|
@@ -9759,10 +9759,10 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9759
9759
|
/* @conditional-compile-remove(mention) */
|
9760
9760
|
const { mentionLookupOptions } = props;
|
9761
9761
|
const [textValue, setTextValue] = React.useState(message.content || '');
|
9762
|
-
const [
|
9762
|
+
const [attachmentMetadata, setAttachedFilesMetadata] = React__default["default"].useState(getMessageAttachedFilesMetadata(message));
|
9763
9763
|
const editTextFieldRef = React__default["default"].useRef(null);
|
9764
9764
|
const theme = useTheme();
|
9765
|
-
const messageState = getMessageState(textValue,
|
9765
|
+
const messageState = getMessageState(textValue, attachmentMetadata !== null && attachmentMetadata !== void 0 ? attachmentMetadata : []);
|
9766
9766
|
const submitEnabled = messageState === 'OK';
|
9767
9767
|
const editContainerStyles = useChatMessageEditContainerStyles();
|
9768
9768
|
const chatMyMessageStyles = useChatMyMessageStyles();
|
@@ -9782,16 +9782,16 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9782
9782
|
return react.concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
|
9783
9783
|
}, [theme.palette.themePrimary]);
|
9784
9784
|
const onRenderFileUploads = React.useCallback(() => {
|
9785
|
-
return (!!
|
9786
|
-
|
9787
|
-
React__default["default"].createElement(_FileUploadCards, { activeFileUploads:
|
9785
|
+
return (!!attachmentMetadata &&
|
9786
|
+
attachmentMetadata.length > 0 && (React__default["default"].createElement("div", { style: { margin: '0.25rem' } },
|
9787
|
+
React__default["default"].createElement(_FileUploadCards, { activeFileUploads: attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.map((file) => ({
|
9788
9788
|
id: file.name,
|
9789
9789
|
filename: file.name,
|
9790
9790
|
progress: 1
|
9791
9791
|
})), onCancelFileUpload: (fileId) => {
|
9792
|
-
setAttachedFilesMetadata(
|
9792
|
+
setAttachedFilesMetadata(attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.filter((file) => file.name !== fileId));
|
9793
9793
|
} }))));
|
9794
|
-
}, [
|
9794
|
+
}, [attachmentMetadata]);
|
9795
9795
|
const getContent = () => {
|
9796
9796
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
9797
9797
|
React__default["default"].createElement(InputBoxComponent, { "data-ui-id": "edit-box", textFieldRef: editTextFieldRef, inputClassName: editBoxStyle, placeholderText: strings.editBoxPlaceholderText, textValue: textValue, onChange: setText, onKeyDown: (ev) => {
|
@@ -9801,7 +9801,7 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9801
9801
|
}, onEnterKeyDown: () => {
|
9802
9802
|
submitEnabled &&
|
9803
9803
|
onSubmit(textValue, message.metadata, {
|
9804
|
-
|
9804
|
+
attachmentMetadata
|
9805
9805
|
});
|
9806
9806
|
}, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles,
|
9807
9807
|
/* @conditional-compile-remove(mention) */
|
@@ -9817,7 +9817,7 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9817
9817
|
React__default["default"].createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
|
9818
9818
|
submitEnabled &&
|
9819
9819
|
onSubmit(textValue, message.metadata, {
|
9820
|
-
|
9820
|
+
attachmentMetadata
|
9821
9821
|
});
|
9822
9822
|
e.stopPropagation();
|
9823
9823
|
}, id: 'submitIconWrapper' }))),
|
@@ -9831,12 +9831,12 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9831
9831
|
} }, getContent()));
|
9832
9832
|
};
|
9833
9833
|
const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
|
9834
|
-
const isMessageEmpty = (messageText,
|
9835
|
-
const getMessageState = (messageText,
|
9834
|
+
const isMessageEmpty = (messageText, attachmentMetadata) => messageText.trim().length === 0 && attachmentMetadata.length === 0;
|
9835
|
+
const getMessageState = (messageText, attachmentMetadata) => isMessageEmpty(messageText, attachmentMetadata) ? 'too short' : isMessageTooLong(messageText) ? 'too long' : 'OK';
|
9836
9836
|
// @TODO: Remove when file-sharing feature becomes stable.
|
9837
9837
|
const getMessageAttachedFilesMetadata = (message) => {
|
9838
9838
|
/* @conditional-compile-remove(file-sharing) */
|
9839
|
-
return message.
|
9839
|
+
return message.files;
|
9840
9840
|
};
|
9841
9841
|
|
9842
9842
|
// Copyright (c) Microsoft Corporation.
|
@@ -10137,13 +10137,13 @@ const MessageContentAsRichTextHTML = (props) => {
|
|
10137
10137
|
if (!attachmentsMap || !onFetchAttachments) {
|
10138
10138
|
return;
|
10139
10139
|
}
|
10140
|
-
const attachments = (_a = message.
|
10141
|
-
return
|
10140
|
+
const attachments = (_a = message.inlineImages) === null || _a === void 0 ? void 0 : _a.filter((inlinedImages) => {
|
10141
|
+
return attachmentsMap[inlinedImages.id] === undefined;
|
10142
10142
|
});
|
10143
10143
|
if (attachments && attachments.length > 0) {
|
10144
10144
|
onFetchAttachments(attachments, message.messageId);
|
10145
10145
|
}
|
10146
|
-
}, [message.
|
10146
|
+
}, [message.inlineImages, message.messageId, onFetchAttachments, attachmentsMap]);
|
10147
10147
|
return (React__default["default"].createElement(MessageContentWithLiveAria, { message: props.message, liveMessage: generateLiveMessage(props), ariaLabel: messageContentAriaText(props), content: processHtmlToReact(props) }));
|
10148
10148
|
};
|
10149
10149
|
const MessageContentAsText = (props) => {
|
@@ -10200,15 +10200,15 @@ const processInlineImage = (props) => ({
|
|
10200
10200
|
// Custom <img> processing
|
10201
10201
|
shouldProcessNode: (node) => {
|
10202
10202
|
var _a;
|
10203
|
-
function
|
10204
|
-
return
|
10203
|
+
function matchingImageNode(imageMetadata) {
|
10204
|
+
return imageMetadata.id === node.attribs.id;
|
10205
10205
|
}
|
10206
10206
|
// Process img node with id in attachments list
|
10207
10207
|
return (node.name &&
|
10208
10208
|
node.name === 'img' &&
|
10209
10209
|
node.attribs &&
|
10210
10210
|
node.attribs.id &&
|
10211
|
-
((_a = props.message.
|
10211
|
+
((_a = props.message.inlineImages) === null || _a === void 0 ? void 0 : _a.find(matchingImageNode)));
|
10212
10212
|
},
|
10213
10213
|
processNode: (node, children, index) => {
|
10214
10214
|
node.attribs = Object.assign(Object.assign({}, node.attribs), { 'aria-label': node.attribs.name });
|
@@ -10320,20 +10320,20 @@ const _FileDownloadCards = (props) => {
|
|
10320
10320
|
}, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile, localeStrings.downloadFile]);
|
10321
10321
|
const isFileSharingAttachment = React.useCallback((attachment) => {
|
10322
10322
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10323
|
-
return attachment.attachmentType === '
|
10323
|
+
return attachment.attachmentType === 'file';
|
10324
10324
|
}, []);
|
10325
10325
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10326
10326
|
const isShowDownloadIcon = React.useCallback((attachment) => {
|
10327
10327
|
var _a;
|
10328
10328
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10329
|
-
return attachment.attachmentType === '
|
10329
|
+
return attachment.attachmentType === 'file' && ((_a = attachment.payload) === null || _a === void 0 ? void 0 : _a.teamsFileAttachment) !== 'true';
|
10330
10330
|
}, []);
|
10331
10331
|
const fileCardGroupDescription = React.useMemo(() => () => {
|
10332
|
-
var _a, _b;
|
10332
|
+
var _a, _b, _c;
|
10333
10333
|
const fileGroupLocaleString = (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.fileCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.fileCardGroupMessage;
|
10334
10334
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10335
10335
|
return _formatString(fileGroupLocaleString, {
|
10336
|
-
fileCount: `${fileMetadata.filter(isFileSharingAttachment).length}`
|
10336
|
+
fileCount: `${(_c = fileMetadata === null || fileMetadata === void 0 ? void 0 : fileMetadata.filter(isFileSharingAttachment).length) !== null && _c !== void 0 ? _c : 0}`
|
10337
10337
|
});
|
10338
10338
|
}, [(_b = props.strings) === null || _b === void 0 ? void 0 : _b.fileCardGroupMessage, localeStrings.fileCardGroupMessage, fileMetadata, isFileSharingAttachment]);
|
10339
10339
|
const fileDownloadHandler = React.useCallback((userId, file) => __awaiter$y(void 0, void 0, void 0, function* () {
|
@@ -10369,6 +10369,7 @@ const _FileDownloadCards = (props) => {
|
|
10369
10369
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10370
10370
|
return isFileSharingAttachment(attachment);
|
10371
10371
|
})
|
10372
|
+
.map((file) => file)
|
10372
10373
|
.map((file) => (React__default["default"].createElement(react.TooltipHost, { content: downloadFileButtonString(), key: file.name },
|
10373
10374
|
React__default["default"].createElement(_FileCard, { fileName: file.name, key: file.name, fileExtension: file.extension, actionIcon: showSpinner ? (React__default["default"].createElement(react.Spinner, { size: react.SpinnerSize.medium, "aria-live": 'polite', role: 'status' })) : /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10374
10375
|
isShowDownloadIcon(file) ? (React__default["default"].createElement(react.IconButton, { className: iconButtonClassName, ariaLabel: downloadFileButtonString() },
|
@@ -10459,13 +10460,18 @@ const MessageBubble = (props) => {
|
|
10459
10460
|
// or not we need to set the target to undefined here to actually hide the action flyout
|
10460
10461
|
setChatMessageActionFlyoutTarget(undefined);
|
10461
10462
|
}, [setChatMessageActionFlyoutTarget]);
|
10462
|
-
const defaultOnRenderFileDownloads = React.useCallback(() =>
|
10463
|
-
|
10464
|
-
|
10463
|
+
const defaultOnRenderFileDownloads = React.useCallback(() => {
|
10464
|
+
return (React__default["default"].createElement(_FileDownloadCards, { userId: userId,
|
10465
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing)*/
|
10466
|
+
fileMetadata: message.files || [], downloadHandler: fileDownloadHandler,
|
10467
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing)*/
|
10468
|
+
strings: { downloadFile: strings.downloadFile, fileCardGroupMessage: strings.fileCardGroupMessage } }));
|
10469
|
+
}, [
|
10465
10470
|
userId,
|
10466
10471
|
message,
|
10467
10472
|
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing)*/
|
10468
10473
|
strings,
|
10474
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing)*/
|
10469
10475
|
fileDownloadHandler
|
10470
10476
|
]);
|
10471
10477
|
const editedOn = 'editedOn' in message ? message.editedOn : undefined;
|
@@ -19337,7 +19343,7 @@ const createDefaultChatHandlers = memoizeOne__default["default"]((chatClient, ch
|
|
19337
19343
|
}),
|
19338
19344
|
onUpdateMessage: (messageId, content, options) => __awaiter$q(void 0, void 0, void 0, function* () {
|
19339
19345
|
const updatedMetadata = (options === null || options === void 0 ? void 0 : options.metadata) ? Object.assign({}, options.metadata) : {};
|
19340
|
-
updatedMetadata['fileSharingMetadata'] = JSON.stringify((options === null || options === void 0 ? void 0 : options.
|
19346
|
+
updatedMetadata['fileSharingMetadata'] = JSON.stringify((options === null || options === void 0 ? void 0 : options.attachmentMetadata) || []);
|
19341
19347
|
yield chatThreadClient.updateMessage(messageId, { content, metadata: updatedMetadata });
|
19342
19348
|
}),
|
19343
19349
|
onDeleteMessage: (messageId) => __awaiter$q(void 0, void 0, void 0, function* () {
|
@@ -19722,32 +19728,31 @@ const extractAttachedFilesMetadata = (metadata) => {
|
|
19722
19728
|
};
|
19723
19729
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19724
19730
|
const extractTeamsAttachmentsMetadata = (attachments) => {
|
19725
|
-
const
|
19731
|
+
const files = [];
|
19732
|
+
const inlineImages = [];
|
19726
19733
|
attachments.forEach((attachment) => {
|
19727
|
-
var _a, _b
|
19734
|
+
var _a, _b;
|
19728
19735
|
const attachmentType = mapAttachmentType(attachment.attachmentType);
|
19729
19736
|
if (attachmentType === 'inlineImage') {
|
19730
|
-
|
19737
|
+
inlineImages.push({
|
19731
19738
|
attachmentType: attachmentType,
|
19732
19739
|
id: attachment.id,
|
19733
|
-
name: (_a = attachment.name) !== null && _a !== void 0 ? _a : '',
|
19734
|
-
extension: (_b = attachment.contentType) !== null && _b !== void 0 ? _b : '',
|
19735
19740
|
url: extractAttachmentUrl(attachment),
|
19736
19741
|
previewUrl: attachment.previewUrl
|
19737
19742
|
});
|
19738
19743
|
}
|
19739
|
-
else if (attachmentType === '
|
19740
|
-
|
19744
|
+
else if (attachmentType === 'file') {
|
19745
|
+
files.push({
|
19741
19746
|
attachmentType: attachmentType,
|
19742
19747
|
id: attachment.id,
|
19743
|
-
name: (
|
19744
|
-
extension: (
|
19748
|
+
name: (_a = attachment.name) !== null && _a !== void 0 ? _a : '',
|
19749
|
+
extension: (_b = attachment.contentType) !== null && _b !== void 0 ? _b : '',
|
19745
19750
|
url: extractAttachmentUrl(attachment),
|
19746
19751
|
payload: { teamsFileAttachment: 'true' }
|
19747
19752
|
});
|
19748
19753
|
}
|
19749
19754
|
});
|
19750
|
-
return
|
19755
|
+
return { files, inlineImages };
|
19751
19756
|
};
|
19752
19757
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19753
19758
|
const mapAttachmentType = (attachmentType) => {
|
@@ -19755,7 +19760,7 @@ const mapAttachmentType = (attachmentType) => {
|
|
19755
19760
|
return 'inlineImage';
|
19756
19761
|
}
|
19757
19762
|
else if (attachmentType === 'file') {
|
19758
|
-
return '
|
19763
|
+
return 'file';
|
19759
19764
|
}
|
19760
19765
|
return 'unknown';
|
19761
19766
|
};
|
@@ -19783,18 +19788,21 @@ const generateImageAttachmentImgHtml = (attachment) => {
|
|
19783
19788
|
return `\r\n<p><img alt="image" src="" itemscope="${attachment.contentType}" id="${attachment.id}"></p>`;
|
19784
19789
|
};
|
19785
19790
|
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19786
|
-
const
|
19791
|
+
const extractAttachmentsMetadata = (message) => {
|
19787
19792
|
var _a, _b;
|
19788
|
-
let
|
19793
|
+
let files = [];
|
19794
|
+
let inlineImages = [];
|
19789
19795
|
/* @conditional-compile-remove(file-sharing) */
|
19790
19796
|
if (message.metadata) {
|
19791
|
-
|
19797
|
+
files = files.concat(extractAttachedFilesMetadata(message.metadata));
|
19792
19798
|
}
|
19793
19799
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19794
19800
|
if ((_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments) {
|
19795
|
-
|
19801
|
+
const teamsAttachments = extractTeamsAttachmentsMetadata((_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments);
|
19802
|
+
files = files.concat(teamsAttachments.files);
|
19803
|
+
inlineImages = inlineImages.concat(teamsAttachments.inlineImages);
|
19796
19804
|
}
|
19797
|
-
return
|
19805
|
+
return { files, inlineImages };
|
19798
19806
|
};
|
19799
19807
|
/* @conditional-compile-remove(data-loss-prevention) */
|
19800
19808
|
const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
@@ -19814,6 +19822,8 @@ const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
|
19814
19822
|
};
|
19815
19823
|
const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
19816
19824
|
const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
|
19825
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19826
|
+
const { files, inlineImages } = extractAttachmentsMetadata(message);
|
19817
19827
|
return {
|
19818
19828
|
messageType: 'chat',
|
19819
19829
|
createdOn: message.createdOn,
|
@@ -19829,7 +19839,9 @@ const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
|
19829
19839
|
mine: messageSenderId === userId,
|
19830
19840
|
metadata: message.metadata,
|
19831
19841
|
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19832
|
-
|
19842
|
+
files,
|
19843
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19844
|
+
inlineImages
|
19833
19845
|
};
|
19834
19846
|
};
|
19835
19847
|
const convertToUiSystemMessage = (message) => {
|
@@ -21837,9 +21849,7 @@ class AzureCommunicationChatAdapter {
|
|
21837
21849
|
return __awaiter$k(this, void 0, void 0, function* () {
|
21838
21850
|
return yield this.asyncTeeErrorToEventEmitter(() => __awaiter$k(this, void 0, void 0, function* () {
|
21839
21851
|
/* @conditional-compile-remove(file-sharing) */
|
21840
|
-
const updatedOptions = options
|
21841
|
-
? { attachedFilesMetadata: options.attachedFilesMetadata, metadata: metadata }
|
21842
|
-
: {};
|
21852
|
+
const updatedOptions = options ? { attachmentMetadata: options.attachmentMetadata, metadata: metadata } : {};
|
21843
21853
|
/* @conditional-compile-remove(file-sharing) */
|
21844
21854
|
return yield this.handlers.onUpdateMessage(messageId, content, updatedOptions);
|
21845
21855
|
}));
|
@@ -22522,7 +22532,7 @@ const createCompositeHandlers$1 = memoizeOne__default["default"]((adapter) => ({
|
|
22522
22532
|
onUpdateMessage: (messageId, content, options) => {
|
22523
22533
|
const metadata = options === null || options === void 0 ? void 0 : options.metadata;
|
22524
22534
|
/* @conditional-compile-remove(file-sharing) */
|
22525
|
-
const updatedOptions = (options === null || options === void 0 ? void 0 : options.
|
22535
|
+
const updatedOptions = (options === null || options === void 0 ? void 0 : options.attachmentMetadata) ? Object.assign({}, options.attachmentMetadata) : {};
|
22526
22536
|
return adapter.updateMessage(messageId, content, metadata,
|
22527
22537
|
/* @conditional-compile-remove(file-sharing) */ updatedOptions);
|
22528
22538
|
},
|
@@ -22835,7 +22845,7 @@ const ChatScreen = (props) => {
|
|
22835
22845
|
fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.uploadHandler(userId, fileUploads);
|
22836
22846
|
}, [adapter, fileSharing, userId]);
|
22837
22847
|
/* @conditional-compile-remove(file-sharing) */
|
22838
|
-
const onRenderFileDownloads = React.useCallback((userId, message) => (React__default["default"].createElement(_FileDownloadCards, { userId: userId, fileMetadata: message.
|
22848
|
+
const onRenderFileDownloads = React.useCallback((userId, message) => (React__default["default"].createElement(_FileDownloadCards, { userId: userId, fileMetadata: message.files || [], downloadHandler: fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.downloadHandler, onDownloadErrorMessage: (errorMessage) => {
|
22839
22849
|
setDownloadErrorMessage(errorMessage);
|
22840
22850
|
} })), [fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.downloadHandler]);
|
22841
22851
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
@@ -22859,14 +22869,13 @@ const ChatScreen = (props) => {
|
|
22859
22869
|
return;
|
22860
22870
|
}
|
22861
22871
|
const chatMessage = messages[0];
|
22862
|
-
const
|
22872
|
+
const inlinedImages = (_b = chatMessage.inlineImages) === null || _b === void 0 ? void 0 : _b.filter((attachment) => {
|
22863
22873
|
return attachment.id === attachmentId;
|
22864
22874
|
});
|
22865
|
-
if (!
|
22875
|
+
if (!inlinedImages || inlinedImages.length <= 0) {
|
22866
22876
|
return;
|
22867
22877
|
}
|
22868
|
-
const attachment =
|
22869
|
-
attachment.name = chatMessage.senderDisplayName || '';
|
22878
|
+
const attachment = inlinedImages[0];
|
22870
22879
|
const titleIconRenderOptions = {
|
22871
22880
|
text: chatMessage.senderDisplayName,
|
22872
22881
|
size: react.PersonaSize.size32,
|
@@ -22875,7 +22884,7 @@ const ChatScreen = (props) => {
|
|
22875
22884
|
};
|
22876
22885
|
const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(chatMessage.senderId, titleIconRenderOptions);
|
22877
22886
|
const galleryImage = {
|
22878
|
-
title:
|
22887
|
+
title: chatMessage.senderDisplayName || '',
|
22879
22888
|
titleIcon: titleIcon,
|
22880
22889
|
downloadFilename: attachment.id,
|
22881
22890
|
imageUrl: ''
|