@azure/communication-react 1.10.1-alpha-202311290014 → 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 +82 -56
- 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-component-bindings/src/getRemoteParticipantsExcludingConsumers.d.ts +37 -0
- package/dist/dist-esm/calling-component-bindings/src/getRemoteParticipantsExcludingConsumers.js +21 -0
- package/dist/dist-esm/calling-component-bindings/src/getRemoteParticipantsExcludingConsumers.js.map +1 -0
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +3 -2
- package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +3 -2
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.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 +3 -3
@@ -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;
|
@@ -18762,6 +18768,23 @@ const memoizeLocalParticipant = memoizeOne__default["default"]((identifier, disp
|
|
18762
18768
|
});
|
18763
18769
|
});
|
18764
18770
|
|
18771
|
+
// Copyright (c) Microsoft Corporation.
|
18772
|
+
/**
|
18773
|
+
* @private
|
18774
|
+
*/
|
18775
|
+
const getRemoteParticipantsExcludingConsumers = reselect.createSelector([getRemoteParticipants$1], (remoteParticipants) => {
|
18776
|
+
/* @conditional-compile-remove(rooms) */
|
18777
|
+
{
|
18778
|
+
const newRemoteParticipants = Object.assign({}, remoteParticipants);
|
18779
|
+
Object.keys(newRemoteParticipants).forEach((k) => {
|
18780
|
+
if (newRemoteParticipants[k].role === 'Consumer') {
|
18781
|
+
delete newRemoteParticipants[k];
|
18782
|
+
}
|
18783
|
+
});
|
18784
|
+
return newRemoteParticipants;
|
18785
|
+
}
|
18786
|
+
});
|
18787
|
+
|
18765
18788
|
// Copyright (c) Microsoft Corporation.
|
18766
18789
|
/**
|
18767
18790
|
* Provides data attributes to {@link VideoGallery} component.
|
@@ -18769,7 +18792,7 @@ const memoizeLocalParticipant = memoizeOne__default["default"]((identifier, disp
|
|
18769
18792
|
*/
|
18770
18793
|
const videoGallerySelector = reselect.createSelector([
|
18771
18794
|
getScreenShareRemoteParticipant,
|
18772
|
-
|
18795
|
+
getRemoteParticipantsExcludingConsumers,
|
18773
18796
|
getLocalVideoStreams$1,
|
18774
18797
|
getIsMuted,
|
18775
18798
|
getIsScreenSharingOn,
|
@@ -18912,7 +18935,7 @@ const convertRemoteParticipantsToParticipantListParticipants = (remoteParticipan
|
|
18912
18935
|
const participantListSelector = reselect.createSelector([
|
18913
18936
|
getIdentifier,
|
18914
18937
|
getDisplayName$2,
|
18915
|
-
|
18938
|
+
getRemoteParticipantsExcludingConsumers,
|
18916
18939
|
getIsScreenSharingOn,
|
18917
18940
|
getIsMuted,
|
18918
18941
|
/* @conditional-compile-remove(raise-hand) */ getLocalParticipantRaisedHand$1,
|
@@ -19320,7 +19343,7 @@ const createDefaultChatHandlers = memoizeOne__default["default"]((chatClient, ch
|
|
19320
19343
|
}),
|
19321
19344
|
onUpdateMessage: (messageId, content, options) => __awaiter$q(void 0, void 0, void 0, function* () {
|
19322
19345
|
const updatedMetadata = (options === null || options === void 0 ? void 0 : options.metadata) ? Object.assign({}, options.metadata) : {};
|
19323
|
-
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) || []);
|
19324
19347
|
yield chatThreadClient.updateMessage(messageId, { content, metadata: updatedMetadata });
|
19325
19348
|
}),
|
19326
19349
|
onDeleteMessage: (messageId) => __awaiter$q(void 0, void 0, void 0, function* () {
|
@@ -19705,32 +19728,31 @@ const extractAttachedFilesMetadata = (metadata) => {
|
|
19705
19728
|
};
|
19706
19729
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19707
19730
|
const extractTeamsAttachmentsMetadata = (attachments) => {
|
19708
|
-
const
|
19731
|
+
const files = [];
|
19732
|
+
const inlineImages = [];
|
19709
19733
|
attachments.forEach((attachment) => {
|
19710
|
-
var _a, _b
|
19734
|
+
var _a, _b;
|
19711
19735
|
const attachmentType = mapAttachmentType(attachment.attachmentType);
|
19712
19736
|
if (attachmentType === 'inlineImage') {
|
19713
|
-
|
19737
|
+
inlineImages.push({
|
19714
19738
|
attachmentType: attachmentType,
|
19715
19739
|
id: attachment.id,
|
19716
|
-
name: (_a = attachment.name) !== null && _a !== void 0 ? _a : '',
|
19717
|
-
extension: (_b = attachment.contentType) !== null && _b !== void 0 ? _b : '',
|
19718
19740
|
url: extractAttachmentUrl(attachment),
|
19719
19741
|
previewUrl: attachment.previewUrl
|
19720
19742
|
});
|
19721
19743
|
}
|
19722
|
-
else if (attachmentType === '
|
19723
|
-
|
19744
|
+
else if (attachmentType === 'file') {
|
19745
|
+
files.push({
|
19724
19746
|
attachmentType: attachmentType,
|
19725
19747
|
id: attachment.id,
|
19726
|
-
name: (
|
19727
|
-
extension: (
|
19748
|
+
name: (_a = attachment.name) !== null && _a !== void 0 ? _a : '',
|
19749
|
+
extension: (_b = attachment.contentType) !== null && _b !== void 0 ? _b : '',
|
19728
19750
|
url: extractAttachmentUrl(attachment),
|
19729
19751
|
payload: { teamsFileAttachment: 'true' }
|
19730
19752
|
});
|
19731
19753
|
}
|
19732
19754
|
});
|
19733
|
-
return
|
19755
|
+
return { files, inlineImages };
|
19734
19756
|
};
|
19735
19757
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19736
19758
|
const mapAttachmentType = (attachmentType) => {
|
@@ -19738,7 +19760,7 @@ const mapAttachmentType = (attachmentType) => {
|
|
19738
19760
|
return 'inlineImage';
|
19739
19761
|
}
|
19740
19762
|
else if (attachmentType === 'file') {
|
19741
|
-
return '
|
19763
|
+
return 'file';
|
19742
19764
|
}
|
19743
19765
|
return 'unknown';
|
19744
19766
|
};
|
@@ -19766,18 +19788,21 @@ const generateImageAttachmentImgHtml = (attachment) => {
|
|
19766
19788
|
return `\r\n<p><img alt="image" src="" itemscope="${attachment.contentType}" id="${attachment.id}"></p>`;
|
19767
19789
|
};
|
19768
19790
|
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19769
|
-
const
|
19791
|
+
const extractAttachmentsMetadata = (message) => {
|
19770
19792
|
var _a, _b;
|
19771
|
-
let
|
19793
|
+
let files = [];
|
19794
|
+
let inlineImages = [];
|
19772
19795
|
/* @conditional-compile-remove(file-sharing) */
|
19773
19796
|
if (message.metadata) {
|
19774
|
-
|
19797
|
+
files = files.concat(extractAttachedFilesMetadata(message.metadata));
|
19775
19798
|
}
|
19776
19799
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19777
19800
|
if ((_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments) {
|
19778
|
-
|
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);
|
19779
19804
|
}
|
19780
|
-
return
|
19805
|
+
return { files, inlineImages };
|
19781
19806
|
};
|
19782
19807
|
/* @conditional-compile-remove(data-loss-prevention) */
|
19783
19808
|
const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
@@ -19797,6 +19822,8 @@ const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
|
19797
19822
|
};
|
19798
19823
|
const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
19799
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);
|
19800
19827
|
return {
|
19801
19828
|
messageType: 'chat',
|
19802
19829
|
createdOn: message.createdOn,
|
@@ -19812,7 +19839,9 @@ const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
|
19812
19839
|
mine: messageSenderId === userId,
|
19813
19840
|
metadata: message.metadata,
|
19814
19841
|
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19815
|
-
|
19842
|
+
files,
|
19843
|
+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
19844
|
+
inlineImages
|
19816
19845
|
};
|
19817
19846
|
};
|
19818
19847
|
const convertToUiSystemMessage = (message) => {
|
@@ -21820,9 +21849,7 @@ class AzureCommunicationChatAdapter {
|
|
21820
21849
|
return __awaiter$k(this, void 0, void 0, function* () {
|
21821
21850
|
return yield this.asyncTeeErrorToEventEmitter(() => __awaiter$k(this, void 0, void 0, function* () {
|
21822
21851
|
/* @conditional-compile-remove(file-sharing) */
|
21823
|
-
const updatedOptions = options
|
21824
|
-
? { attachedFilesMetadata: options.attachedFilesMetadata, metadata: metadata }
|
21825
|
-
: {};
|
21852
|
+
const updatedOptions = options ? { attachmentMetadata: options.attachmentMetadata, metadata: metadata } : {};
|
21826
21853
|
/* @conditional-compile-remove(file-sharing) */
|
21827
21854
|
return yield this.handlers.onUpdateMessage(messageId, content, updatedOptions);
|
21828
21855
|
}));
|
@@ -22505,7 +22532,7 @@ const createCompositeHandlers$1 = memoizeOne__default["default"]((adapter) => ({
|
|
22505
22532
|
onUpdateMessage: (messageId, content, options) => {
|
22506
22533
|
const metadata = options === null || options === void 0 ? void 0 : options.metadata;
|
22507
22534
|
/* @conditional-compile-remove(file-sharing) */
|
22508
|
-
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) : {};
|
22509
22536
|
return adapter.updateMessage(messageId, content, metadata,
|
22510
22537
|
/* @conditional-compile-remove(file-sharing) */ updatedOptions);
|
22511
22538
|
},
|
@@ -22818,7 +22845,7 @@ const ChatScreen = (props) => {
|
|
22818
22845
|
fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.uploadHandler(userId, fileUploads);
|
22819
22846
|
}, [adapter, fileSharing, userId]);
|
22820
22847
|
/* @conditional-compile-remove(file-sharing) */
|
22821
|
-
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) => {
|
22822
22849
|
setDownloadErrorMessage(errorMessage);
|
22823
22850
|
} })), [fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.downloadHandler]);
|
22824
22851
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
@@ -22842,14 +22869,13 @@ const ChatScreen = (props) => {
|
|
22842
22869
|
return;
|
22843
22870
|
}
|
22844
22871
|
const chatMessage = messages[0];
|
22845
|
-
const
|
22872
|
+
const inlinedImages = (_b = chatMessage.inlineImages) === null || _b === void 0 ? void 0 : _b.filter((attachment) => {
|
22846
22873
|
return attachment.id === attachmentId;
|
22847
22874
|
});
|
22848
|
-
if (!
|
22875
|
+
if (!inlinedImages || inlinedImages.length <= 0) {
|
22849
22876
|
return;
|
22850
22877
|
}
|
22851
|
-
const attachment =
|
22852
|
-
attachment.name = chatMessage.senderDisplayName || '';
|
22878
|
+
const attachment = inlinedImages[0];
|
22853
22879
|
const titleIconRenderOptions = {
|
22854
22880
|
text: chatMessage.senderDisplayName,
|
22855
22881
|
size: react.PersonaSize.size32,
|
@@ -22858,7 +22884,7 @@ const ChatScreen = (props) => {
|
|
22858
22884
|
};
|
22859
22885
|
const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(chatMessage.senderId, titleIconRenderOptions);
|
22860
22886
|
const galleryImage = {
|
22861
|
-
title:
|
22887
|
+
title: chatMessage.senderDisplayName || '',
|
22862
22888
|
titleIcon: titleIcon,
|
22863
22889
|
downloadFilename: attachment.id,
|
22864
22890
|
imageUrl: ''
|