@azure/communication-react 1.11.1-alpha-202312210012 → 1.11.1-alpha-202312230012
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 +31 -24
- package/dist/dist-cjs/communication-react/index.js +140 -256
- 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 +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- 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 +34 -38
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +0 -1
- package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.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 +0 -1
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js +1 -7
- 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 +25 -8
- 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 +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +15 -31
- 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 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +1 -14
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js +2 -17
- package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +12 -6
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +9 -13
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ImageGallery.d.ts +4 -4
- package/dist/dist-esm/react-components/src/components/ImageGallery.js +3 -14
- package/dist/dist-esm/react-components/src/components/ImageGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/MessageThread.js +11 -26
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.js +0 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ImageGallery.style.js +19 -25
- package/dist/dist-esm/react-components/src/components/styles/ImageGallery.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +2 -20
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/themes.d.ts +9 -9
- package/dist/dist-esm/react-components/src/theming/themes.js +10 -12
- package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +3 -2
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -8
- 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.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +0 -1
- 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 +1 -16
- 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 +2 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +8 -17
- 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 +2 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js +2 -1
- 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/index.js.map +1 -1
- package/package.json +1 -1
@@ -170,7 +170,7 @@ function getDefaultExportFromCjs (x) {
|
|
170
170
|
// Copyright (c) Microsoft Corporation.
|
171
171
|
// Licensed under the MIT License.
|
172
172
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
173
|
-
var telemetryVersion = '1.11.1-alpha-
|
173
|
+
var telemetryVersion = '1.11.1-alpha-202312230012';
|
174
174
|
|
175
175
|
|
176
176
|
var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
|
@@ -5939,13 +5939,12 @@ const lightTheme = {
|
|
5939
5939
|
/* @conditional-compile-remove(raise-hand) */
|
5940
5940
|
raiseHandGold: '#eaa300'
|
5941
5941
|
},
|
5942
|
-
/* @conditional-compile-remove(image-gallery) */
|
5943
5942
|
chatPalette: {
|
5944
|
-
|
5945
|
-
|
5946
|
-
|
5947
|
-
|
5948
|
-
|
5943
|
+
imageGalleryOverlayBlack: '#000000',
|
5944
|
+
imageGalleryTitleWhite: '#ffffff',
|
5945
|
+
imageGalleryDefaultButtonBackground: '#1b1a19',
|
5946
|
+
imageGalleryButtonBackgroundHover: '#252423',
|
5947
|
+
imageGalleryButtonBackgroundActive: '#292827'
|
5949
5948
|
},
|
5950
5949
|
semanticColors: {
|
5951
5950
|
errorText: '#a80000'
|
@@ -5990,13 +5989,12 @@ const darkTheme = {
|
|
5990
5989
|
/* @conditional-compile-remove(raise-hand) */
|
5991
5990
|
raiseHandGold: '#eaa300'
|
5992
5991
|
},
|
5993
|
-
/* @conditional-compile-remove(image-gallery) */
|
5994
5992
|
chatPalette: {
|
5995
|
-
|
5996
|
-
|
5997
|
-
|
5998
|
-
|
5999
|
-
|
5993
|
+
imageGalleryOverlayBlack: '#000000',
|
5994
|
+
imageGalleryTitleWhite: '#ffffff',
|
5995
|
+
imageGalleryDefaultButtonBackground: '#1b1a19',
|
5996
|
+
imageGalleryButtonBackgroundHover: '#252423',
|
5997
|
+
imageGalleryButtonBackgroundActive: '#292827'
|
6000
5998
|
},
|
6001
5999
|
semanticColors: {
|
6002
6000
|
errorText: '#f1707b'
|
@@ -6027,7 +6025,6 @@ const wrapper = react.mergeStyles({
|
|
6027
6025
|
const defaultTheme = Object.assign({}, react.mergeThemes(react.getTheme(), lightTheme));
|
6028
6026
|
/** Theme context for library's react components */
|
6029
6027
|
const ThemeContext = React.createContext(defaultTheme);
|
6030
|
-
const SingleUsageCheckContext = React.createContext(false);
|
6031
6028
|
/**
|
6032
6029
|
* Provider to apply a Fluent theme across this library's react components.
|
6033
6030
|
*
|
@@ -6038,21 +6035,10 @@ const SingleUsageCheckContext = React.createContext(false);
|
|
6038
6035
|
*/
|
6039
6036
|
const FluentThemeProvider = (props) => {
|
6040
6037
|
const { fluentTheme, rtl, children } = props;
|
6041
|
-
/**
|
6042
|
-
* Pass only the children if we previously wrapped.
|
6043
|
-
* This is to prevent the provider from being applied
|
6044
|
-
* multiple times and wiping out configuration like RTL
|
6045
|
-
* FluentThemeProvider
|
6046
|
-
*/
|
6047
|
-
const alreadyWrapped = useSingleUsageCheck();
|
6048
|
-
if (alreadyWrapped) {
|
6049
|
-
return React.createElement(React.Fragment, null, children);
|
6050
|
-
}
|
6051
6038
|
let fluentV8Theme = react.mergeThemes(defaultTheme, fluentTheme);
|
6052
6039
|
fluentV8Theme = react.mergeThemes(fluentV8Theme, { rtl });
|
6053
|
-
return (React.createElement(
|
6054
|
-
React.createElement(
|
6055
|
-
React.createElement(react.ThemeProvider, { theme: fluentV8Theme, className: wrapper }, children))));
|
6040
|
+
return (React.createElement(ThemeContext.Provider, { value: fluentV8Theme },
|
6041
|
+
React.createElement(react.ThemeProvider, { theme: fluentV8Theme, className: wrapper }, children)));
|
6056
6042
|
};
|
6057
6043
|
/**
|
6058
6044
|
* React hook to access theme
|
@@ -6060,12 +6046,6 @@ const FluentThemeProvider = (props) => {
|
|
6060
6046
|
* @public
|
6061
6047
|
*/
|
6062
6048
|
const useTheme = () => React.useContext(ThemeContext);
|
6063
|
-
/**
|
6064
|
-
* This is used to prevent the provider from being applied multiple times.
|
6065
|
-
*
|
6066
|
-
* @private
|
6067
|
-
*/
|
6068
|
-
const useSingleUsageCheck = () => React.useContext(SingleUsageCheckContext);
|
6069
6049
|
|
6070
6050
|
// Copyright (c) Microsoft Corporation.
|
6071
6051
|
// Licensed under the MIT License.
|
@@ -8507,14 +8487,13 @@ const cancelIcon = { iconName: 'Cancel' };
|
|
8507
8487
|
const downloadIcon = {
|
8508
8488
|
iconName: 'Download'
|
8509
8489
|
};
|
8510
|
-
/* @conditional-compile-remove(image-gallery) */
|
8511
8490
|
/**
|
8512
8491
|
* @private
|
8513
8492
|
*/
|
8514
8493
|
const overlayStyles = (theme) => {
|
8515
8494
|
return {
|
8516
8495
|
root: {
|
8517
|
-
background: theme.chatPalette.
|
8496
|
+
background: theme.chatPalette.imageGalleryOverlayBlack,
|
8518
8497
|
opacity: '0.85'
|
8519
8498
|
}
|
8520
8499
|
};
|
@@ -8564,14 +8543,13 @@ const titleBarContainerStyle = {
|
|
8564
8543
|
alignContent: 'center',
|
8565
8544
|
alignItems: 'center'
|
8566
8545
|
};
|
8567
|
-
/* @conditional-compile-remove(image-gallery) */
|
8568
8546
|
/**
|
8569
8547
|
* @private
|
8570
8548
|
*/
|
8571
8549
|
const titleStyle$2 = (theme) => {
|
8572
8550
|
return {
|
8573
8551
|
paddingLeft: '0.5rem',
|
8574
|
-
color: theme.chatPalette.
|
8552
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8575
8553
|
fontFamily: 'inherit',
|
8576
8554
|
fontSize: '0.875rem',
|
8577
8555
|
fontStyle: 'normal',
|
@@ -8619,33 +8597,30 @@ const normalImageStyle = {
|
|
8619
8597
|
maxHeight: '100%',
|
8620
8598
|
maxWidth: '100%'
|
8621
8599
|
};
|
8622
|
-
/* @conditional-compile-remove(image-gallery) */
|
8623
8600
|
/**
|
8624
8601
|
* @private
|
8625
8602
|
*/
|
8626
8603
|
const brokenImageStyle = (theme) => {
|
8627
8604
|
return {
|
8628
|
-
color: theme.chatPalette.
|
8605
|
+
color: theme.chatPalette.imageGalleryTitleWhite
|
8629
8606
|
};
|
8630
8607
|
};
|
8631
|
-
/* @conditional-compile-remove(image-gallery) */
|
8632
8608
|
/**
|
8633
8609
|
* @private
|
8634
8610
|
*/
|
8635
8611
|
const closeButtonStyles = (theme) => {
|
8636
8612
|
return {
|
8637
|
-
color: theme.chatPalette.
|
8613
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8638
8614
|
':hover': {
|
8639
|
-
color: theme.chatPalette.
|
8640
|
-
backgroundColor: theme.chatPalette.
|
8615
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8616
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundHover
|
8641
8617
|
},
|
8642
8618
|
':active': {
|
8643
|
-
color: theme.chatPalette.
|
8644
|
-
backgroundColor: theme.chatPalette.
|
8619
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8620
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundActive
|
8645
8621
|
}
|
8646
8622
|
};
|
8647
8623
|
};
|
8648
|
-
/* @conditional-compile-remove(image-gallery) */
|
8649
8624
|
/**
|
8650
8625
|
* @private
|
8651
8626
|
*/
|
@@ -8658,38 +8633,37 @@ const downloadButtonStyle = (theme) => {
|
|
8658
8633
|
fontWeight: 600,
|
8659
8634
|
padding: '0.38rem 0.75rem',
|
8660
8635
|
borderRadius: '4px',
|
8661
|
-
backgroundColor: theme.chatPalette.
|
8662
|
-
color: theme.chatPalette.
|
8636
|
+
backgroundColor: theme.chatPalette.imageGalleryDefaultButtonBackground,
|
8637
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8663
8638
|
whiteSpace: 'nowrap',
|
8664
8639
|
':hover': {
|
8665
|
-
color: theme.chatPalette.
|
8666
|
-
backgroundColor: theme.chatPalette.
|
8640
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8641
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundHover
|
8667
8642
|
},
|
8668
8643
|
':active': {
|
8669
|
-
color: theme.chatPalette.
|
8670
|
-
backgroundColor: theme.chatPalette.
|
8644
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8645
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundActive
|
8671
8646
|
},
|
8672
8647
|
'@media (max-width: 25rem)': {
|
8673
8648
|
display: 'none'
|
8674
8649
|
}
|
8675
8650
|
};
|
8676
8651
|
};
|
8677
|
-
/* @conditional-compile-remove(image-gallery) */
|
8678
8652
|
/**
|
8679
8653
|
* @private
|
8680
8654
|
*/
|
8681
8655
|
const smallDownloadButtonContainerStyle = (theme) => {
|
8682
8656
|
return {
|
8683
8657
|
marginRight: '0.5rem',
|
8684
|
-
color: theme.chatPalette.
|
8658
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8685
8659
|
whiteSpace: 'nowrap',
|
8686
8660
|
':hover': {
|
8687
|
-
color: theme.chatPalette.
|
8688
|
-
backgroundColor: theme.chatPalette.
|
8661
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8662
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundHover
|
8689
8663
|
},
|
8690
8664
|
':active': {
|
8691
|
-
color: theme.chatPalette.
|
8692
|
-
backgroundColor: theme.chatPalette.
|
8665
|
+
color: theme.chatPalette.imageGalleryTitleWhite,
|
8666
|
+
backgroundColor: theme.chatPalette.imageGalleryButtonBackgroundActive
|
8693
8667
|
},
|
8694
8668
|
'@media (min-width: 25rem)': {
|
8695
8669
|
display: 'none'
|
@@ -8699,17 +8673,14 @@ const smallDownloadButtonContainerStyle = (theme) => {
|
|
8699
8673
|
|
8700
8674
|
// Copyright (c) Microsoft Corporation.
|
8701
8675
|
// Licensed under the MIT License.
|
8702
|
-
/* @conditional-compile-remove(image-gallery) */
|
8703
|
-
/* @conditional-compile-remove(image-gallery) */
|
8704
8676
|
/**
|
8705
8677
|
* Component to render a fullscreen modal for a selected image.
|
8706
8678
|
*
|
8707
|
-
* @
|
8679
|
+
* @public
|
8708
8680
|
*/
|
8709
8681
|
const ImageGallery = (props) => {
|
8710
8682
|
const { isOpen, images, onImageDownloadButtonClicked, onDismiss, onError, startIndex = 0 } = props;
|
8711
8683
|
const theme = useTheme();
|
8712
|
-
/* @conditional-compile-remove(image-gallery) */
|
8713
8684
|
const localeStrings = useLocale$1().strings.imageGallery;
|
8714
8685
|
const [isImageLoaded, setIsImageLoaded] = React.useState(true);
|
8715
8686
|
const imageStyle = isImageLoaded ? normalImageStyle : brokenImageStyle(theme);
|
@@ -8720,13 +8691,9 @@ const ImageGallery = (props) => {
|
|
8720
8691
|
image.titleIcon,
|
8721
8692
|
React.createElement(react.Stack.Item, { className: react.mergeStyles(titleStyle$2(theme)), "aria-label": image === null || image === void 0 ? void 0 : image.title }, image === null || image === void 0 ? void 0 : image.title)),
|
8722
8693
|
React.createElement(react.Stack, { className: react.mergeStyles(controlBarContainerStyle) },
|
8723
|
-
React.createElement(react.DefaultButton, { className: react.mergeStyles(downloadButtonStyle(theme)),
|
8724
|
-
/* @conditional-compile-remove(image-gallery) */
|
8725
|
-
text: localeStrings.downloadButtonLabel, onClick: () => onImageDownloadButtonClicked((image === null || image === void 0 ? void 0 : image.imageUrl) || '', (image === null || image === void 0 ? void 0 : image.downloadFilename) || 'image'), onRenderIcon: () => React.createElement(react.Icon, { iconName: downloadIcon.iconName, className: react.mergeStyles(downloadIconStyle) }), "aria-live": 'polite', "aria-label": localeStrings.downloadButtonLabel }),
|
8694
|
+
React.createElement(react.DefaultButton, { className: react.mergeStyles(downloadButtonStyle(theme)), text: localeStrings.downloadButtonLabel, onClick: () => onImageDownloadButtonClicked((image === null || image === void 0 ? void 0 : image.imageUrl) || '', (image === null || image === void 0 ? void 0 : image.downloadFilename) || 'image'), onRenderIcon: () => React.createElement(react.Icon, { iconName: downloadIcon.iconName, className: react.mergeStyles(downloadIconStyle) }), "aria-live": 'polite', "aria-label": localeStrings.downloadButtonLabel }),
|
8726
8695
|
React.createElement(react.IconButton, { iconProps: downloadIcon, className: react.mergeStyles(smallDownloadButtonContainerStyle(theme)), onClick: () => onImageDownloadButtonClicked(image === null || image === void 0 ? void 0 : image.imageUrl, image === null || image === void 0 ? void 0 : image.downloadFilename), "aria-label": localeStrings.downloadButtonLabel, "aria-live": 'polite' }),
|
8727
|
-
React.createElement(react.IconButton, { iconProps: cancelIcon, className: react.mergeStyles(closeButtonStyles(theme)), onClick: onDismiss,
|
8728
|
-
/* @conditional-compile-remove(image-gallery) */
|
8729
|
-
ariaLabel: localeStrings.dismissButtonAriaLabel, "aria-live": 'polite' }))));
|
8696
|
+
React.createElement(react.IconButton, { iconProps: cancelIcon, className: react.mergeStyles(closeButtonStyles(theme)), onClick: onDismiss, ariaLabel: localeStrings.dismissButtonAriaLabel, "aria-live": 'polite' }))));
|
8730
8697
|
};
|
8731
8698
|
const renderBodyWithLightDismiss = () => {
|
8732
8699
|
return (React.createElement(react.Stack, { className: react.mergeStyles(bodyContainer), onClick: () => props.onDismiss() }, images.length > startIndex && (React.createElement("img", { src: image === null || image === void 0 ? void 0 : image.imageUrl, className: react.mergeStyles(imageStyle), alt: (image === null || image === void 0 ? void 0 : image.altText) || 'image', "aria-label": 'image-gallery-main-image', "aria-live": 'polite', onError: (event) => {
|
@@ -9883,10 +9850,12 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9883
9850
|
/* @conditional-compile-remove(mention) */
|
9884
9851
|
const { mentionLookupOptions } = props;
|
9885
9852
|
const [textValue, setTextValue] = React.useState(message.content || '');
|
9853
|
+
/* @conditional-compile-remove(file-sharing) */
|
9886
9854
|
const [attachmentMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));
|
9887
9855
|
const editTextFieldRef = React.useRef(null);
|
9888
9856
|
const theme = useTheme();
|
9889
|
-
const messageState = getMessageState(textValue,
|
9857
|
+
const messageState = getMessageState(textValue,
|
9858
|
+
/* @conditional-compile-remove(file-sharing) */ attachmentMetadata !== null && attachmentMetadata !== void 0 ? attachmentMetadata : []);
|
9890
9859
|
const submitEnabled = messageState === 'OK';
|
9891
9860
|
const editContainerStyles = useChatMessageEditContainerStyles();
|
9892
9861
|
const chatMyMessageStyles = useChatMyMessageStyles();
|
@@ -9905,6 +9874,7 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9905
9874
|
const editBoxStyles = React.useMemo(() => {
|
9906
9875
|
return react.concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
|
9907
9876
|
}, [theme.palette.themePrimary]);
|
9877
|
+
/* @conditional-compile-remove(file-sharing) */
|
9908
9878
|
const onRenderFileUploads = React.useCallback(() => {
|
9909
9879
|
return (!!attachmentMetadata &&
|
9910
9880
|
attachmentMetadata.length > 0 && (React.createElement("div", { style: { margin: '0.25rem' } },
|
@@ -9924,7 +9894,8 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9924
9894
|
}
|
9925
9895
|
}, onEnterKeyDown: () => {
|
9926
9896
|
submitEnabled &&
|
9927
|
-
onSubmit(textValue, message.metadata,
|
9897
|
+
onSubmit(textValue, message.metadata,
|
9898
|
+
/* @conditional-compile-remove(file-sharing) */ {
|
9928
9899
|
attachmentMetadata
|
9929
9900
|
});
|
9930
9901
|
}, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles,
|
@@ -9940,11 +9911,12 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9940
9911
|
React.createElement(react.Stack.Item, { align: "end" },
|
9941
9912
|
React.createElement(InputBoxButton, { className: editingButtonStyle, ariaLabel: strings.editBoxSubmitButton, tooltipContent: strings.editBoxSubmitButton, onRenderIcon: onRenderThemedSubmitIcon, onClick: (e) => {
|
9942
9913
|
submitEnabled &&
|
9943
|
-
onSubmit(textValue, message.metadata,
|
9914
|
+
onSubmit(textValue, message.metadata,
|
9915
|
+
/* @conditional-compile-remove(file-sharing) */ {
|
9944
9916
|
attachmentMetadata
|
9945
9917
|
});
|
9946
9918
|
e.stopPropagation();
|
9947
|
-
}, id: 'submitIconWrapper' }))),
|
9919
|
+
}, id: 'submitIconWrapper' }))), /* @conditional-compile-remove(file-sharing) */
|
9948
9920
|
onRenderFileUploads()));
|
9949
9921
|
};
|
9950
9922
|
const bodyClassName = reactComponents.mergeClasses(editContainerStyles.body, message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault);
|
@@ -9955,11 +9927,23 @@ const ChatMessageComponentAsEditBox = (props) => {
|
|
9955
9927
|
} }, getContent()));
|
9956
9928
|
};
|
9957
9929
|
const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
|
9958
|
-
|
9959
|
-
|
9930
|
+
function isMessageEmpty(messageText,
|
9931
|
+
/* @conditional-compile-remove(file-sharing) */
|
9932
|
+
attachmentMetadata) {
|
9933
|
+
/* @conditional-compile-remove(file-sharing) */
|
9934
|
+
return messageText.trim().length === 0 && (attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.length) === 0;
|
9935
|
+
}
|
9936
|
+
function getMessageState(messageText,
|
9937
|
+
/* @conditional-compile-remove(file-sharing) */ attachmentMetadata) {
|
9938
|
+
return isMessageEmpty(messageText, /* @conditional-compile-remove(file-sharing) */ attachmentMetadata)
|
9939
|
+
? 'too short'
|
9940
|
+
: isMessageTooLong(messageText)
|
9941
|
+
? 'too long'
|
9942
|
+
: 'OK';
|
9943
|
+
}
|
9944
|
+
/* @conditional-compile-remove(file-sharing) */
|
9960
9945
|
// @TODO: Remove when file-sharing feature becomes stable.
|
9961
9946
|
const getMessageAttachedFilesMetadata = (message) => {
|
9962
|
-
/* @conditional-compile-remove(file-sharing) */
|
9963
9947
|
return message.files;
|
9964
9948
|
};
|
9965
9949
|
|
@@ -10250,15 +10234,7 @@ const MessageContentWithLiveAria = (props) => {
|
|
10250
10234
|
props.content));
|
10251
10235
|
};
|
10252
10236
|
const MessageContentAsRichTextHTML = (props) => {
|
10253
|
-
const {
|
10254
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10255
|
-
// message is used only in useEffect that is under teams-inline-images-and-file-sharing cc
|
10256
|
-
message,
|
10257
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10258
|
-
attachmentsMap,
|
10259
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10260
|
-
onFetchAttachments } = props;
|
10261
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10237
|
+
const { message, attachmentsMap, onFetchAttachments } = props;
|
10262
10238
|
React.useEffect(() => {
|
10263
10239
|
var _a;
|
10264
10240
|
if (!attachmentsMap || !onFetchAttachments) {
|
@@ -10322,7 +10298,6 @@ const messageContentAriaText = (props) => {
|
|
10322
10298
|
};
|
10323
10299
|
const processNodeDefinitions = htmlToReact.ProcessNodeDefinitions();
|
10324
10300
|
const htmlToReactParser = htmlToReact.Parser();
|
10325
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10326
10301
|
const processInlineImage = (props) => ({
|
10327
10302
|
// Custom <img> processing
|
10328
10303
|
shouldProcessNode: (node) => {
|
@@ -10343,11 +10318,9 @@ const processInlineImage = (props) => ({
|
|
10343
10318
|
if (props.attachmentsMap && node.attribs.id in props.attachmentsMap) {
|
10344
10319
|
node.attribs = Object.assign(Object.assign({}, node.attribs), { src: props.attachmentsMap[node.attribs.id] });
|
10345
10320
|
}
|
10346
|
-
/* @conditional-compile-remove(image-gallery) */
|
10347
10321
|
const handleOnClick = () => {
|
10348
10322
|
props.onInlineImageClicked && props.onInlineImageClicked(node.attribs.id);
|
10349
10323
|
};
|
10350
|
-
/* @conditional-compile-remove(image-gallery) */
|
10351
10324
|
return (React.createElement("span", { "data-ui-id": node.attribs.id, onClick: handleOnClick, tabIndex: 0, role: "button", style: {
|
10352
10325
|
cursor: 'pointer'
|
10353
10326
|
}, onKeyDown: (e) => {
|
@@ -10383,7 +10356,6 @@ const processMention = (props) => ({
|
|
10383
10356
|
const processHtmlToReact = (props) => {
|
10384
10357
|
var _a;
|
10385
10358
|
const steps = [
|
10386
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10387
10359
|
processInlineImage(props),
|
10388
10360
|
/* @conditional-compile-remove(mention) */
|
10389
10361
|
processMention(props),
|
@@ -10447,19 +10419,19 @@ const _FileDownloadCards = (props) => {
|
|
10447
10419
|
return (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile) !== null && _b !== void 0 ? _b : localeStrings.downloadFile;
|
10448
10420
|
}, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile, localeStrings.downloadFile]);
|
10449
10421
|
const isFileSharingAttachment = React.useCallback((attachment) => {
|
10450
|
-
/* @conditional-compile-remove(
|
10422
|
+
/* @conditional-compile-remove(file-sharing) */
|
10451
10423
|
return attachment.attachmentType === 'file';
|
10452
10424
|
}, []);
|
10453
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10454
10425
|
const isShowDownloadIcon = React.useCallback((attachment) => {
|
10455
10426
|
var _a;
|
10456
|
-
/* @conditional-compile-remove(
|
10427
|
+
/* @conditional-compile-remove(file-sharing) */
|
10457
10428
|
return attachment.attachmentType === 'file' && ((_a = attachment.payload) === null || _a === void 0 ? void 0 : _a.teamsFileAttachment) !== 'true';
|
10458
10429
|
}, []);
|
10430
|
+
/* @conditional-compile-remove(file-sharing) */
|
10459
10431
|
const fileCardGroupDescription = React.useMemo(() => () => {
|
10460
10432
|
var _a, _b, _c;
|
10461
10433
|
const fileGroupLocaleString = (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.fileCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.fileCardGroupMessage;
|
10462
|
-
/* @conditional-compile-remove(
|
10434
|
+
/* @conditional-compile-remove(file-sharing) */
|
10463
10435
|
return _formatString(fileGroupLocaleString, {
|
10464
10436
|
fileCount: `${(_c = fileMetadata === null || fileMetadata === void 0 ? void 0 : fileMetadata.filter(isFileSharingAttachment).length) !== null && _c !== void 0 ? _c : 0}`
|
10465
10437
|
});
|
@@ -10485,22 +10457,19 @@ const _FileDownloadCards = (props) => {
|
|
10485
10457
|
}
|
10486
10458
|
}
|
10487
10459
|
}), [props]);
|
10488
|
-
if (!fileMetadata ||
|
10489
|
-
fileMetadata.length === 0 ||
|
10490
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ !fileMetadata.some(isFileSharingAttachment)) {
|
10460
|
+
if (!fileMetadata || fileMetadata.length === 0 || !fileMetadata.some(isFileSharingAttachment)) {
|
10491
10461
|
return React.createElement(React.Fragment, null);
|
10492
10462
|
}
|
10493
10463
|
return (React.createElement("div", { style: fileDownloadCardsStyle, "data-ui-id": "file-download-card-group" },
|
10494
|
-
React.createElement(_FileCardGroup
|
10464
|
+
React.createElement(_FileCardGroup /* @conditional-compile-remove(file-sharing) */, { ariaLabel: fileCardGroupDescription() }, fileMetadata &&
|
10495
10465
|
fileMetadata
|
10496
10466
|
.filter((attachment) => {
|
10497
|
-
/* @conditional-compile-remove(
|
10467
|
+
/* @conditional-compile-remove(file-sharing) */
|
10498
10468
|
return isFileSharingAttachment(attachment);
|
10499
10469
|
})
|
10500
10470
|
.map((file) => file)
|
10501
10471
|
.map((file) => (React.createElement(react.TooltipHost, { content: downloadFileButtonString(), key: file.name },
|
10502
|
-
React.createElement(_FileCard, { fileName: file.name, key: file.name, fileExtension: file.extension, actionIcon: showSpinner ? (React.createElement(react.Spinner, { size: react.SpinnerSize.medium, "aria-live": 'polite', role: 'status' })) :
|
10503
|
-
isShowDownloadIcon(file) ? (React.createElement(react.IconButton, { className: iconButtonClassName, ariaLabel: downloadFileButtonString() },
|
10472
|
+
React.createElement(_FileCard, { fileName: file.name, key: file.name, fileExtension: file.extension, actionIcon: showSpinner ? (React.createElement(react.Spinner, { size: react.SpinnerSize.medium, "aria-live": 'polite', role: 'status' })) : isShowDownloadIcon(file) ? (React.createElement(react.IconButton, { className: iconButtonClassName, ariaLabel: downloadFileButtonString() },
|
10504
10473
|
React.createElement(DownloadIconTrampoline, null))) : undefined, actionHandler: () => fileDownloadHandler(userId, file) })))))));
|
10505
10474
|
};
|
10506
10475
|
/**
|
@@ -10511,7 +10480,7 @@ const DownloadIconTrampoline = () => {
|
|
10511
10480
|
return React.createElement(react.Icon, { "data-ui-id": "file-download-card-download-icon", iconName: "DownloadFile", style: actionIconStyle });
|
10512
10481
|
};
|
10513
10482
|
const useLocaleStringsTrampoline = () => {
|
10514
|
-
/* @conditional-compile-remove(file-sharing)
|
10483
|
+
/* @conditional-compile-remove(file-sharing) */
|
10515
10484
|
return useLocale$1().strings.messageThread;
|
10516
10485
|
};
|
10517
10486
|
|
@@ -10547,9 +10516,9 @@ const MessageBubble = (props) => {
|
|
10547
10516
|
const ids = useIdentifiers();
|
10548
10517
|
const theme = useTheme();
|
10549
10518
|
const locale = useLocale$1();
|
10550
|
-
const { userId, message, onRemoveClick, onResendClick, disableEditing, showDate, messageContainerStyle, strings, onEditClick, remoteParticipantsCount = 0, onRenderAvatar, showMessageStatus, messageStatus,
|
10551
|
-
/* @conditional-compile-remove(
|
10552
|
-
onInlineImageClicked, shouldOverlapAvatarAndMessage } = props;
|
10519
|
+
const { userId, message, onRemoveClick, onResendClick, disableEditing, showDate, messageContainerStyle, strings, onEditClick, remoteParticipantsCount = 0, onRenderAvatar, showMessageStatus, messageStatus,
|
10520
|
+
/* @conditional-compile-remove(file-sharing) */
|
10521
|
+
fileDownloadHandler, onInlineImageClicked, shouldOverlapAvatarAndMessage } = props;
|
10553
10522
|
const defaultTimeStamp = message.createdOn
|
10554
10523
|
? generateDefaultTimestamp(message.createdOn, showDate, strings)
|
10555
10524
|
: undefined;
|
@@ -10589,17 +10558,18 @@ const MessageBubble = (props) => {
|
|
10589
10558
|
setChatMessageActionFlyoutTarget(undefined);
|
10590
10559
|
}, [setChatMessageActionFlyoutTarget]);
|
10591
10560
|
const defaultOnRenderFileDownloads = React.useCallback(() => {
|
10561
|
+
/* @conditional-compile-remove(file-sharing) */
|
10592
10562
|
return (React.createElement(_FileDownloadCards, { userId: userId,
|
10593
|
-
/* @conditional-compile-remove(file-sharing)
|
10594
|
-
fileMetadata: message.files || [],
|
10595
|
-
/* @conditional-compile-remove(file-sharing)
|
10596
|
-
strings: { downloadFile: strings.downloadFile, fileCardGroupMessage: strings.fileCardGroupMessage } }));
|
10563
|
+
/* @conditional-compile-remove(file-sharing) */
|
10564
|
+
fileMetadata: message.files || [],
|
10565
|
+
/* @conditional-compile-remove(file-sharing) */
|
10566
|
+
downloadHandler: fileDownloadHandler, strings: { downloadFile: strings.downloadFile, fileCardGroupMessage: strings.fileCardGroupMessage } }));
|
10597
10567
|
}, [
|
10598
10568
|
userId,
|
10599
10569
|
message,
|
10600
|
-
/* @conditional-compile-remove(file-sharing)
|
10570
|
+
/* @conditional-compile-remove(file-sharing) */
|
10601
10571
|
strings,
|
10602
|
-
/* @conditional-compile-remove(file-sharing)
|
10572
|
+
/* @conditional-compile-remove(file-sharing) */
|
10603
10573
|
fileDownloadHandler
|
10604
10574
|
]);
|
10605
10575
|
const editedOn = 'editedOn' in message ? message.editedOn : undefined;
|
@@ -10612,7 +10582,6 @@ const MessageBubble = (props) => {
|
|
10612
10582
|
}
|
10613
10583
|
return undefined;
|
10614
10584
|
}, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);
|
10615
|
-
/* @conditional-compile-remove(image-gallery) */
|
10616
10585
|
const handleOnInlineImageClicked = React.useCallback((attachmentId) => __awaiter$x(void 0, void 0, void 0, function* () {
|
10617
10586
|
if (onInlineImageClicked === undefined) {
|
10618
10587
|
return;
|
@@ -10626,35 +10595,18 @@ const MessageBubble = (props) => {
|
|
10626
10595
|
React.createElement(BlockedMessageContent, { message: message, strings: strings })));
|
10627
10596
|
}
|
10628
10597
|
return (React.createElement("div", { tabIndex: 0, className: "ui-chat__message__content" },
|
10629
|
-
React.createElement(ChatMessageContent, { message: message, strings: strings,
|
10630
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10631
|
-
onFetchAttachments: props.onFetchAttachments,
|
10632
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10633
|
-
attachmentsMap: props.attachmentsMap,
|
10598
|
+
React.createElement(ChatMessageContent, { message: message, strings: strings, onFetchAttachments: props.onFetchAttachments, attachmentsMap: props.attachmentsMap,
|
10634
10599
|
/* @conditional-compile-remove(mention) */
|
10635
|
-
mentionDisplayOptions: props.mentionDisplayOptions,
|
10636
|
-
/* @conditional-compile-remove(image-gallery) */
|
10637
|
-
onInlineImageClicked: handleOnInlineImageClicked }),
|
10600
|
+
mentionDisplayOptions: props.mentionDisplayOptions, onInlineImageClicked: handleOnInlineImageClicked }),
|
10638
10601
|
props.onRenderFileDownloads ? props.onRenderFileDownloads(userId, message) : defaultOnRenderFileDownloads()));
|
10639
|
-
}, [
|
10640
|
-
defaultOnRenderFileDownloads,
|
10641
|
-
message,
|
10642
|
-
props,
|
10643
|
-
strings,
|
10644
|
-
userId,
|
10645
|
-
/* @conditional-compile-remove(image-gallery) */
|
10646
|
-
handleOnInlineImageClicked
|
10647
|
-
]);
|
10602
|
+
}, [defaultOnRenderFileDownloads, message, props, strings, userId, handleOnInlineImageClicked]);
|
10648
10603
|
const isBlockedMessage = /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';
|
10649
10604
|
const chatMyMessageStyles = useChatMyMessageStyles();
|
10650
10605
|
const chatMessageCommonStyles = useChatMessageCommonStyles();
|
10651
10606
|
const chatMessageStyles = useChatMessageStyles();
|
10652
10607
|
const chatItemMessageContainerClassName = reactComponents.mergeClasses(
|
10653
10608
|
// messageContainerStyle used in className and style prop as style prop can't handle CSS selectors
|
10654
|
-
chatMessageStyles.body,
|
10655
|
-
// disable placeholder functionality for GA releases as it might confuse users
|
10656
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10657
|
-
chatMessageStyles.bodyWithPlaceholderImage, isBlockedMessage
|
10609
|
+
chatMessageStyles.body, chatMessageStyles.bodyWithPlaceholderImage, isBlockedMessage
|
10658
10610
|
? chatMessageCommonStyles.blocked
|
10659
10611
|
: props.message.status === 'failed'
|
10660
10612
|
? chatMessageCommonStyles.failed
|
@@ -10779,13 +10731,7 @@ const ChatMessageComponent = (props) => {
|
|
10779
10731
|
else {
|
10780
10732
|
return (React.createElement(ChatMessageComponentAsMessageBubble, Object.assign({}, props, { onRemoveClick: onRemoveClick, onEditClick: onEditClick, onResendClick: onResendClick, onRenderAvatar: props.onRenderAvatar,
|
10781
10733
|
/* @conditional-compile-remove(date-time-customization) */
|
10782
|
-
onDisplayDateTimeString: props.onDisplayDateTimeString, strings: props.strings,
|
10783
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10784
|
-
onFetchAttachments: props.onFetchAttachments,
|
10785
|
-
/* @conditional-compile-remove(image-gallery) */
|
10786
|
-
onInlineImageClicked: props.onInlineImageClicked,
|
10787
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10788
|
-
attachmentsMap: props.attachmentsMap,
|
10734
|
+
onDisplayDateTimeString: props.onDisplayDateTimeString, strings: props.strings, onFetchAttachments: props.onFetchAttachments, onInlineImageClicked: props.onInlineImageClicked, attachmentsMap: props.attachmentsMap,
|
10789
10735
|
/* @conditional-compile-remove(mention) */
|
10790
10736
|
mentionDisplayOptions: (_b = props.mentionOptions) === null || _b === void 0 ? void 0 : _b.displayOptions })));
|
10791
10737
|
}
|
@@ -10804,13 +10750,7 @@ const ChatMessageComponent = (props) => {
|
|
10804
10750
|
const FluentChatMessageComponentWrapper = (props) => {
|
10805
10751
|
const { message, styles, shouldOverlapAvatarAndMessage, onRenderMessage, onRenderAvatar, showMessageStatus, onRenderMessageStatus, participantCount, readCount, onActionButtonClick,
|
10806
10752
|
/* @conditional-compile-remove(date-time-customization) */
|
10807
|
-
onDisplayDateTimeString,
|
10808
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10809
|
-
onFetchInlineAttachment,
|
10810
|
-
/* @conditional-compile-remove(image-gallery) */
|
10811
|
-
onInlineImageClicked,
|
10812
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10813
|
-
inlineAttachments,
|
10753
|
+
onDisplayDateTimeString, onFetchInlineAttachment, onInlineImageClicked, inlineAttachments,
|
10814
10754
|
/* @conditional-compile-remove(mention) */
|
10815
10755
|
mentionOptions,
|
10816
10756
|
/* @conditional-compile-remove(file-sharing) */
|
@@ -10834,13 +10774,7 @@ const FluentChatMessageComponentWrapper = (props) => {
|
|
10834
10774
|
/* @conditional-compile-remove(file-sharing) */
|
10835
10775
|
strings: messageProps.strings, message: messageProps.message, userId: userId, remoteParticipantsCount: participantCount ? participantCount - 1 : 0, shouldOverlapAvatarAndMessage: shouldOverlapAvatarAndMessage, onRenderAvatar: onRenderAvatar, showMessageStatus: showMessageStatus, messageStatus: messageProps.message.status, onActionButtonClick: onActionButtonClick,
|
10836
10776
|
/* @conditional-compile-remove(date-time-customization) */
|
10837
|
-
onDisplayDateTimeString: onDisplayDateTimeString,
|
10838
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10839
|
-
onFetchAttachments: onFetchInlineAttachment,
|
10840
|
-
/* @conditional-compile-remove(image-gallery) */
|
10841
|
-
onInlineImageClicked: onInlineImageClicked,
|
10842
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10843
|
-
attachmentsMap: (_a = inlineAttachments[messageProps.message.messageId]) !== null && _a !== void 0 ? _a : {},
|
10777
|
+
onDisplayDateTimeString: onDisplayDateTimeString, onFetchAttachments: onFetchInlineAttachment, onInlineImageClicked: onInlineImageClicked, attachmentsMap: (_a = inlineAttachments[messageProps.message.messageId]) !== null && _a !== void 0 ? _a : {},
|
10844
10778
|
/* @conditional-compile-remove(mention) */
|
10845
10779
|
mentionOptions: mentionOptions,
|
10846
10780
|
/* @conditional-compile-remove(file-sharing) */
|
@@ -10857,11 +10791,8 @@ const FluentChatMessageComponentWrapper = (props) => {
|
|
10857
10791
|
userId,
|
10858
10792
|
/* @conditional-compile-remove(date-time-customization) */
|
10859
10793
|
onDisplayDateTimeString,
|
10860
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10861
10794
|
onFetchInlineAttachment,
|
10862
|
-
/* @conditional-compile-remove(image-gallery) */
|
10863
10795
|
onInlineImageClicked,
|
10864
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
10865
10796
|
inlineAttachments,
|
10866
10797
|
/* @conditional-compile-remove(mention) */
|
10867
10798
|
mentionOptions,
|
@@ -11091,7 +11022,7 @@ const isMessageSame = (first, second) => {
|
|
11091
11022
|
JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&
|
11092
11023
|
first.senderId === second.senderId &&
|
11093
11024
|
first.senderDisplayName === second.senderDisplayName &&
|
11094
|
-
first.
|
11025
|
+
JSON.stringify(first.editedOn) === JSON.stringify(second.editedOn));
|
11095
11026
|
};
|
11096
11027
|
/**
|
11097
11028
|
* Get the latest message from the message array.
|
@@ -11219,13 +11150,9 @@ const MessageThreadWrapper = (props) => {
|
|
11219
11150
|
var _a;
|
11220
11151
|
const { messages: newMessages, userId, participantCount, readReceiptsBySenderId, styles, disableJumpToNewMessageButton = false, showMessageDate = false, showMessageStatus = false, numberOfChatMessagesToReload = 5, onMessageSeen, onRenderMessageStatus, onRenderAvatar, onLoadPreviousChatMessages, onRenderJumpToNewMessageButton, onRenderMessage, onUpdateMessage, onCancelEditMessage, onDeleteMessage, onSendMessage,
|
11221
11152
|
/* @conditional-compile-remove(date-time-customization) */
|
11222
|
-
onDisplayDateTimeString,
|
11223
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11224
|
-
onFetchAttachments,
|
11153
|
+
onDisplayDateTimeString, onFetchAttachments,
|
11225
11154
|
/* @conditional-compile-remove(mention) */
|
11226
|
-
mentionOptions,
|
11227
|
-
/* @conditional-compile-remove(image-gallery) */
|
11228
|
-
onInlineImageClicked,
|
11155
|
+
mentionOptions, onInlineImageClicked,
|
11229
11156
|
/* @conditional-compile-remove(file-sharing) */
|
11230
11157
|
onRenderFileDownloads } = props;
|
11231
11158
|
// We need this state to wait for one tick and scroll to bottom after messages have been initialized.
|
@@ -11242,9 +11169,7 @@ const MessageThreadWrapper = (props) => {
|
|
11242
11169
|
const [lastSendingChatMessage, setLastSendingChatMessage] = React.useState(undefined);
|
11243
11170
|
// readCount and participantCount will only need to be updated on-fly when user hover on an indicator
|
11244
11171
|
const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = React.useState(undefined);
|
11245
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11246
11172
|
const [inlineAttachments, setInlineAttachments] = React.useState({});
|
11247
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11248
11173
|
const onFetchInlineAttachment = React.useCallback((attachments, messageId) => __awaiter$v(void 0, void 0, void 0, function* () {
|
11249
11174
|
if (!onFetchAttachments || attachments.length === 0) {
|
11250
11175
|
return;
|
@@ -11266,6 +11191,9 @@ const MessageThreadWrapper = (props) => {
|
|
11266
11191
|
}), [onFetchAttachments]);
|
11267
11192
|
const localeStrings = useLocale$1().strings.messageThread;
|
11268
11193
|
const strings = React.useMemo(() => (Object.assign(Object.assign({}, localeStrings), props.strings)), [localeStrings, props.strings]);
|
11194
|
+
// it is required to use useState for messages
|
11195
|
+
// as the scrolling logic requires re - render at a specific point in time
|
11196
|
+
const [messages, setMessages] = React.useState([]);
|
11269
11197
|
// id for the latest deleted message
|
11270
11198
|
const [latestDeletedMessageId, setLatestDeletedMessageId] = React.useState(undefined);
|
11271
11199
|
// this value is used to check if a message is deleted for the previous value of messages array
|
@@ -11277,10 +11205,12 @@ const MessageThreadWrapper = (props) => {
|
|
11277
11205
|
return;
|
11278
11206
|
}
|
11279
11207
|
try {
|
11280
|
-
yield onDeleteMessage(messageId);
|
11281
11208
|
// reset deleted message label in case if there was a value already (messages are deleted 1 after another)
|
11282
11209
|
setDeletedMessageAriaLabel(undefined);
|
11283
11210
|
setLatestDeletedMessageId(messageId);
|
11211
|
+
// we should set up latestDeletedMessageId before the onDeleteMessage call
|
11212
|
+
// as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId
|
11213
|
+
yield onDeleteMessage(messageId);
|
11284
11214
|
}
|
11285
11215
|
catch (e) {
|
11286
11216
|
console.log('onDeleteMessage failed: messageId', messageId, 'error', e);
|
@@ -11294,18 +11224,11 @@ const MessageThreadWrapper = (props) => {
|
|
11294
11224
|
isAllChatMessagesLoadedRef.current = false;
|
11295
11225
|
}
|
11296
11226
|
}, [onLoadPreviousChatMessages]);
|
11297
|
-
/* @conditional-compile-remove(file-sharing) */ /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11298
|
-
React.useEffect(() => {
|
11299
|
-
reactFileTypeIcons.initializeFileTypeIcons();
|
11300
|
-
}, []);
|
11301
11227
|
const previousTopRef = React.useRef(-1);
|
11302
11228
|
const previousHeightRef = React.useRef(-1);
|
11303
11229
|
const messageIdSeenByMeRef = React.useRef('');
|
11304
11230
|
const chatScrollDivRef = React.useRef(null);
|
11305
11231
|
const isLoadingChatMessagesRef = React.useRef(false);
|
11306
|
-
const messages = React.useMemo(() => {
|
11307
|
-
return newMessages;
|
11308
|
-
}, [newMessages]);
|
11309
11232
|
React.useEffect(() => {
|
11310
11233
|
if (latestDeletedMessageId === undefined) {
|
11311
11234
|
setDeletedMessageAriaLabel(undefined);
|
@@ -11332,6 +11255,7 @@ const MessageThreadWrapper = (props) => {
|
|
11332
11255
|
const messagesRef = React.useRef(messages);
|
11333
11256
|
const setMessagesRef = (messagesWithAttachedValue) => {
|
11334
11257
|
messagesRef.current = messagesWithAttachedValue;
|
11258
|
+
setMessages(messagesWithAttachedValue);
|
11335
11259
|
};
|
11336
11260
|
const isAtBottomOfScrollRef = React.useRef(isAtBottomOfScroll);
|
11337
11261
|
const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue) => {
|
@@ -11562,13 +11486,7 @@ const MessageThreadWrapper = (props) => {
|
|
11562
11486
|
className: reactComponents.mergeClasses(classes.root, react.mergeStyles(styles === null || styles === void 0 ? void 0 : styles.chatContainer)), ref: chatScrollDivRef, style: Object.assign({}, createStyleFromV8Style(styles === null || styles === void 0 ? void 0 : styles.chatContainer)) }, messagesToDisplay.map((message) => {
|
11563
11487
|
return (React.createElement(MemoChatMessageComponentWrapper, Object.assign({}, message, { userId: userId, key: message.key, styles: styles, shouldOverlapAvatarAndMessage: isNarrow, strings: strings, onRenderAvatar: onRenderAvatar, onRenderMessage: onRenderMessage, onRenderMessageStatus: onRenderMessageStatus, defaultStatusRenderer: defaultStatusRenderer, onActionButtonClick: onActionButtonClickMemo, readCount: readCountForHoveredIndicator, participantCount: participantCount,
|
11564
11488
|
/* @conditional-compile-remove(file-sharing) */
|
11565
|
-
fileDownloadHandler: props.fileDownloadHandler,
|
11566
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11567
|
-
onFetchInlineAttachment: onFetchInlineAttachment,
|
11568
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
11569
|
-
inlineAttachments: inlineAttachments,
|
11570
|
-
/* @conditional-compile-remove(image-gallery) */
|
11571
|
-
onInlineImageClicked: onInlineImageClicked,
|
11489
|
+
fileDownloadHandler: props.fileDownloadHandler, onFetchInlineAttachment: onFetchInlineAttachment, inlineAttachments: inlineAttachments, onInlineImageClicked: onInlineImageClicked,
|
11572
11490
|
/* @conditional-compile-remove(date-time-customization) */
|
11573
11491
|
onDisplayDateTimeString: onDisplayDateTimeString,
|
11574
11492
|
/* @conditional-compile-remove(mention) */
|
@@ -19881,7 +19799,7 @@ const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClient) => {
|
|
19881
19799
|
}),
|
19882
19800
|
onUpdateMessage: (messageId, content, options) => __awaiter$q(void 0, void 0, void 0, function* () {
|
19883
19801
|
const updatedMetadata = (options === null || options === void 0 ? void 0 : options.metadata) ? Object.assign({}, options.metadata) : {};
|
19884
|
-
updatedMetadata
|
19802
|
+
updatedMetadata.fileSharingMetadata = JSON.stringify((options === null || options === void 0 ? void 0 : options.attachmentMetadata) || []);
|
19885
19803
|
yield chatThreadClient.updateMessage(messageId, { content, metadata: updatedMetadata });
|
19886
19804
|
}),
|
19887
19805
|
onDeleteMessage: (messageId) => __awaiter$q(void 0, void 0, void 0, function* () {
|
@@ -20259,7 +20177,7 @@ const memoizedAllConvertChatMessage = memoizeFnAll((_key, chatMessage, userId, i
|
|
20259
20177
|
});
|
20260
20178
|
/* @conditional-compile-remove(file-sharing) */
|
20261
20179
|
const extractAttachedFilesMetadata = (metadata) => {
|
20262
|
-
const fileMetadata = metadata
|
20180
|
+
const fileMetadata = metadata.fileSharingMetadata;
|
20263
20181
|
if (!fileMetadata) {
|
20264
20182
|
return [];
|
20265
20183
|
}
|
@@ -20271,13 +20189,14 @@ const extractAttachedFilesMetadata = (metadata) => {
|
|
20271
20189
|
return [];
|
20272
20190
|
}
|
20273
20191
|
};
|
20274
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20275
20192
|
const extractTeamsAttachmentsMetadata = (attachments) => {
|
20193
|
+
/* @conditional-compile-remove(file-sharing) */
|
20276
20194
|
const files = [];
|
20277
20195
|
const inlineImages = [];
|
20278
20196
|
attachments.forEach((attachment) => {
|
20279
20197
|
var _a;
|
20280
20198
|
const attachmentType = mapAttachmentType(attachment.attachmentType);
|
20199
|
+
/* @conditional-compile-remove(file-sharing) */
|
20281
20200
|
const contentType = extractAttachmentContentTypeFromName(attachment.name);
|
20282
20201
|
if (attachmentType === 'inlineImage') {
|
20283
20202
|
inlineImages.push({
|
@@ -20287,36 +20206,52 @@ const extractTeamsAttachmentsMetadata = (attachments) => {
|
|
20287
20206
|
previewUrl: attachment.previewUrl
|
20288
20207
|
});
|
20289
20208
|
}
|
20290
|
-
|
20209
|
+
/* @conditional-compile-remove(file-sharing) */
|
20210
|
+
if (attachmentType === 'file') {
|
20291
20211
|
files.push({
|
20292
20212
|
attachmentType: attachmentType,
|
20293
20213
|
id: attachment.id,
|
20294
20214
|
name: (_a = attachment.name) !== null && _a !== void 0 ? _a : '',
|
20295
|
-
extension: contentType
|
20215
|
+
extension: contentType,
|
20296
20216
|
url: extractAttachmentUrl(attachment),
|
20297
20217
|
payload: { teamsFileAttachment: 'true' }
|
20298
20218
|
});
|
20299
20219
|
}
|
20300
20220
|
});
|
20301
|
-
return { files, inlineImages };
|
20221
|
+
return { /* @conditional-compile-remove(file-sharing) */ files, inlineImages };
|
20222
|
+
};
|
20223
|
+
/* @conditional-compile-remove(data-loss-prevention) */
|
20224
|
+
const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
20225
|
+
const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
|
20226
|
+
return {
|
20227
|
+
messageType: 'blocked',
|
20228
|
+
createdOn: message.createdOn,
|
20229
|
+
warningText: undefined,
|
20230
|
+
status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,
|
20231
|
+
senderDisplayName: message.senderDisplayName,
|
20232
|
+
senderId: messageSenderId,
|
20233
|
+
messageId: message.id,
|
20234
|
+
deletedOn: message.deletedOn,
|
20235
|
+
mine: messageSenderId === userId,
|
20236
|
+
link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL
|
20237
|
+
};
|
20302
20238
|
};
|
20303
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20304
20239
|
const mapAttachmentType = (attachmentType) => {
|
20305
20240
|
if (attachmentType === 'image') {
|
20306
20241
|
return 'inlineImage';
|
20307
20242
|
}
|
20308
|
-
|
20243
|
+
/* @conditional-compile-remove(file-sharing) */
|
20244
|
+
if (attachmentType === 'file') {
|
20309
20245
|
return 'file';
|
20310
20246
|
}
|
20311
20247
|
return 'unknown';
|
20312
20248
|
};
|
20313
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20314
20249
|
const extractAttachmentUrl = (attachment) => {
|
20250
|
+
/* @conditional-compile-remove(file-sharing) */
|
20315
20251
|
return attachment.attachmentType === 'file' && attachment.previewUrl ? attachment.previewUrl : attachment.url || '';
|
20316
20252
|
};
|
20317
20253
|
const processChatMessageContent = (message) => {
|
20318
20254
|
var _a, _b, _c, _d, _e;
|
20319
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20320
20255
|
if (sanitizedMessageContentType(message.type).includes('html') && ((_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments)) {
|
20321
20256
|
const attachments = (_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments;
|
20322
20257
|
const teamsImageHtmlContent = attachments
|
@@ -20329,12 +20264,10 @@ const processChatMessageContent = (message) => {
|
|
20329
20264
|
}
|
20330
20265
|
return (_e = message.content) === null || _e === void 0 ? void 0 : _e.message;
|
20331
20266
|
};
|
20332
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20333
20267
|
const generateImageAttachmentImgHtml = (attachment) => {
|
20334
20268
|
const contentType = extractAttachmentContentTypeFromName(attachment.name);
|
20335
20269
|
return `\r\n<p><img alt="image" src="" itemscope="${contentType}" id="${attachment.id}"></p>`;
|
20336
20270
|
};
|
20337
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20338
20271
|
const extractAttachmentContentTypeFromName = (name) => {
|
20339
20272
|
if (name === undefined) {
|
20340
20273
|
return '';
|
@@ -20346,43 +20279,26 @@ const extractAttachmentContentTypeFromName = (name) => {
|
|
20346
20279
|
const contentType = name.substring(indexOfLastDot + 1);
|
20347
20280
|
return contentType;
|
20348
20281
|
};
|
20349
|
-
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20350
20282
|
const extractAttachmentsMetadata = (message) => {
|
20351
20283
|
var _a, _b;
|
20284
|
+
/* @conditional-compile-remove(file-sharing) */
|
20352
20285
|
let files = [];
|
20353
20286
|
let inlineImages = [];
|
20354
20287
|
/* @conditional-compile-remove(file-sharing) */
|
20355
20288
|
if (message.metadata) {
|
20356
20289
|
files = files.concat(extractAttachedFilesMetadata(message.metadata));
|
20357
20290
|
}
|
20358
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20359
20291
|
if ((_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments) {
|
20360
20292
|
const teamsAttachments = extractTeamsAttachmentsMetadata((_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments);
|
20293
|
+
/* @conditional-compile-remove(file-sharing) */
|
20361
20294
|
files = files.concat(teamsAttachments.files);
|
20362
20295
|
inlineImages = inlineImages.concat(teamsAttachments.inlineImages);
|
20363
20296
|
}
|
20364
|
-
return { files, inlineImages };
|
20365
|
-
};
|
20366
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
20367
|
-
const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
|
20368
|
-
const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
|
20369
|
-
return {
|
20370
|
-
messageType: 'blocked',
|
20371
|
-
createdOn: message.createdOn,
|
20372
|
-
warningText: undefined,
|
20373
|
-
status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,
|
20374
|
-
senderDisplayName: message.senderDisplayName,
|
20375
|
-
senderId: messageSenderId,
|
20376
|
-
messageId: message.id,
|
20377
|
-
deletedOn: message.deletedOn,
|
20378
|
-
mine: messageSenderId === userId,
|
20379
|
-
link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL
|
20380
|
-
};
|
20297
|
+
return { /* @conditional-compile-remove(file-sharing) */ files, inlineImages };
|
20381
20298
|
};
|
20382
20299
|
const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
20383
20300
|
const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
|
20384
|
-
/* @conditional-compile-remove(file-sharing)
|
20385
|
-
const { files, inlineImages } = extractAttachmentsMetadata(message);
|
20301
|
+
const { /* @conditional-compile-remove(file-sharing) */ files, inlineImages } = extractAttachmentsMetadata(message);
|
20386
20302
|
return {
|
20387
20303
|
messageType: 'chat',
|
20388
20304
|
createdOn: message.createdOn,
|
@@ -20397,9 +20313,8 @@ const convertToUiChatMessage = (message, userId, isSeen, isLargeGroup) => {
|
|
20397
20313
|
deletedOn: message.deletedOn,
|
20398
20314
|
mine: messageSenderId === userId,
|
20399
20315
|
metadata: message.metadata,
|
20400
|
-
/* @conditional-compile-remove(file-sharing)
|
20316
|
+
/* @conditional-compile-remove(file-sharing) */
|
20401
20317
|
files,
|
20402
|
-
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
20403
20318
|
inlineImages
|
20404
20319
|
};
|
20405
20320
|
};
|
@@ -20494,9 +20409,7 @@ const isMessageValidToRender = (message) => {
|
|
20494
20409
|
if (message.deletedOn) {
|
20495
20410
|
return false;
|
20496
20411
|
}
|
20497
|
-
if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a
|
20498
|
-
(
|
20499
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ (_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments)) {
|
20412
|
+
if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a.fileSharingMetadata) || ((_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments)) {
|
20500
20413
|
return true;
|
20501
20414
|
}
|
20502
20415
|
/* @conditional-compile-remove(data-loss-prevention) */
|
@@ -21216,7 +21129,6 @@ class EventSubscriber {
|
|
21216
21129
|
version: event.version,
|
21217
21130
|
content: {
|
21218
21131
|
message: event.message,
|
21219
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
21220
21132
|
attachments: event.attachments
|
21221
21133
|
},
|
21222
21134
|
type: this.convertEventType(event.type),
|
@@ -21807,7 +21719,8 @@ class FileUpload {
|
|
21807
21719
|
else {
|
21808
21720
|
this.metadata = data;
|
21809
21721
|
}
|
21810
|
-
|
21722
|
+
const name = data === null || data === void 0 ? void 0 : data.name;
|
21723
|
+
this.fileName = name;
|
21811
21724
|
}
|
21812
21725
|
notifyUploadProgressChanged(value) {
|
21813
21726
|
this._emitter.emit('uploadProgressChange', this.id, value);
|
@@ -22271,20 +22184,17 @@ class ChatContext {
|
|
22271
22184
|
* @private
|
22272
22185
|
*/
|
22273
22186
|
class AzureCommunicationChatAdapter {
|
22274
|
-
constructor(chatClient, chatThreadClient,
|
22275
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options) {
|
22276
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22187
|
+
constructor(chatClient, chatThreadClient, options) {
|
22277
22188
|
this.credential = undefined;
|
22278
22189
|
this.emitter = new EventEmitter();
|
22279
22190
|
this.bindAllPublicMethods();
|
22280
22191
|
this.chatClient = chatClient;
|
22281
22192
|
this.chatThreadClient = chatThreadClient;
|
22282
22193
|
this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);
|
22283
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22284
22194
|
if (options && options.credential) {
|
22285
22195
|
this.credential = options.credential;
|
22286
22196
|
}
|
22287
|
-
/* @conditional-compile-remove(file-sharing) */
|
22197
|
+
/* @conditional-compile-remove(file-sharing) */
|
22288
22198
|
this.fileUploadAdapter = new AzureCommunicationFileUploadAdapter(this.context);
|
22289
22199
|
const onStateChange = (clientState) => {
|
22290
22200
|
// unsubscribe when the instance gets disposed
|
@@ -22328,7 +22238,6 @@ class AzureCommunicationChatAdapter {
|
|
22328
22238
|
this.updateFileUploadErrorMessage = this.updateFileUploadErrorMessage.bind(this);
|
22329
22239
|
/* @conditional-compile-remove(file-sharing) */
|
22330
22240
|
this.updateFileUploadMetadata = this.updateFileUploadMetadata.bind(this);
|
22331
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22332
22241
|
this.downloadAttachments = this.downloadAttachments.bind(this);
|
22333
22242
|
}
|
22334
22243
|
dispose() {
|
@@ -22470,7 +22379,6 @@ class AzureCommunicationChatAdapter {
|
|
22470
22379
|
updateFileUploadMetadata(id, metadata) {
|
22471
22380
|
this.fileUploadAdapter.updateFileUploadMetadata(id, metadata);
|
22472
22381
|
}
|
22473
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22474
22382
|
downloadAttachments(options) {
|
22475
22383
|
return __awaiter$k(this, void 0, void 0, function* () {
|
22476
22384
|
return this.asyncTeeErrorToEventEmitter(() => __awaiter$k(this, void 0, void 0, function* () {
|
@@ -22491,7 +22399,6 @@ class AzureCommunicationChatAdapter {
|
|
22491
22399
|
}));
|
22492
22400
|
});
|
22493
22401
|
}
|
22494
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22495
22402
|
downloadAuthenticatedFile(accessToken, options) {
|
22496
22403
|
return __awaiter$k(this, void 0, void 0, function* () {
|
22497
22404
|
function fetchWithAuthentication(url, token) {
|
@@ -22632,10 +22539,8 @@ const _createAzureCommunicationChatAdapterInner = (endpoint, userId, displayName
|
|
22632
22539
|
}, undefined, telemetryImplementationHint);
|
22633
22540
|
const chatThreadClient = yield chatClient.getChatThreadClient(threadId);
|
22634
22541
|
yield chatClient.startRealtimeNotifications();
|
22635
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22636
22542
|
const options = { credential: credential };
|
22637
|
-
const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
|
22638
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options);
|
22543
|
+
const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient, options);
|
22639
22544
|
return adapter;
|
22640
22545
|
});
|
22641
22546
|
/**
|
@@ -22742,12 +22647,9 @@ beforeDispose) => {
|
|
22742
22647
|
*
|
22743
22648
|
* @public
|
22744
22649
|
*/
|
22745
|
-
function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
|
22746
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
22747
|
-
options) {
|
22650
|
+
function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient, options) {
|
22748
22651
|
return __awaiter$k(this, void 0, void 0, function* () {
|
22749
|
-
return new AzureCommunicationChatAdapter(chatClient, chatThreadClient,
|
22750
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options);
|
22652
|
+
return new AzureCommunicationChatAdapter(chatClient, chatThreadClient, options);
|
22751
22653
|
});
|
22752
22654
|
}
|
22753
22655
|
const isChatError = (e) => {
|
@@ -23416,11 +23318,8 @@ const ChatScreen = (props) => {
|
|
23416
23318
|
const defaultNumberOfChatMessagesToReload = 5;
|
23417
23319
|
/* @conditional-compile-remove(file-sharing) */
|
23418
23320
|
const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');
|
23419
|
-
/* @conditional-compile-remove(image-gallery) */
|
23420
23321
|
const [fullSizeAttachments, setFullSizeAttachments] = React.useState({});
|
23421
|
-
/* @conditional-compile-remove(image-gallery) */
|
23422
23322
|
const [galleryImages, setGalleryImages] = React.useState([]);
|
23423
|
-
/* @conditional-compile-remove(image-gallery) */
|
23424
23323
|
const [isImageGalleryOpen, setIsImageGalleryOpen] = React.useState(false);
|
23425
23324
|
const adapter = useAdapter$1();
|
23426
23325
|
const theme = useTheme();
|
@@ -23465,7 +23364,6 @@ const ChatScreen = (props) => {
|
|
23465
23364
|
const onRenderFileDownloads = React.useCallback((userId, message) => (React.createElement(_FileDownloadCards, { userId: userId, fileMetadata: message.files || [], downloadHandler: fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.downloadHandler, onDownloadErrorMessage: (errorMessage) => {
|
23466
23365
|
setDownloadErrorMessage(errorMessage);
|
23467
23366
|
} })), [fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.downloadHandler]);
|
23468
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23469
23367
|
const onRenderInlineAttachment = React.useCallback((attachment) => __awaiter$i(void 0, void 0, void 0, function* () {
|
23470
23368
|
const entry = {};
|
23471
23369
|
attachment.forEach((target) => {
|
@@ -23476,7 +23374,6 @@ const ChatScreen = (props) => {
|
|
23476
23374
|
const blob = yield adapter.downloadAttachments({ attachmentUrls: entry });
|
23477
23375
|
return blob;
|
23478
23376
|
}), [adapter]);
|
23479
|
-
/* @conditional-compile-remove(image-gallery) */
|
23480
23377
|
const onInlineImageClicked = React.useCallback((attachmentId, messageId) => __awaiter$i(void 0, void 0, void 0, function* () {
|
23481
23378
|
var _a, _b;
|
23482
23379
|
const messages = (_a = messageThreadProps.messages) === null || _a === void 0 ? void 0 : _a.filter((message) => {
|
@@ -23524,7 +23421,6 @@ const ChatScreen = (props) => {
|
|
23524
23421
|
}
|
23525
23422
|
}
|
23526
23423
|
}), [adapter, fullSizeAttachments, messageThreadProps.messages, onRenderAvatarCallback]);
|
23527
|
-
/* @conditional-compile-remove(image-gallery) */
|
23528
23424
|
const onImageDownloadButtonClicked = React.useCallback((imageUrl, downloadFilename) => {
|
23529
23425
|
if (imageUrl === '') {
|
23530
23426
|
return;
|
@@ -23563,11 +23459,7 @@ const ChatScreen = (props) => {
|
|
23563
23459
|
}, []), fileDownloadErrorMessage: downloadErrorMessage || '' }),
|
23564
23460
|
React.createElement(MessageThread, Object.assign({}, messageThreadProps, { onRenderAvatar: onRenderAvatarCallback, onRenderMessage: onRenderMessage,
|
23565
23461
|
/* @conditional-compile-remove(file-sharing) */
|
23566
|
-
onRenderFileDownloads: onRenderFileDownloads,
|
23567
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23568
|
-
onFetchAttachments: onRenderInlineAttachment,
|
23569
|
-
/* @conditional-compile-remove(image-gallery) */
|
23570
|
-
onInlineImageClicked: onInlineImageClicked, numberOfChatMessagesToReload: defaultNumberOfChatMessagesToReload, styles: messageThreadStyles })),
|
23462
|
+
onRenderFileDownloads: onRenderFileDownloads, onFetchAttachments: onRenderInlineAttachment, onInlineImageClicked: onInlineImageClicked, numberOfChatMessagesToReload: defaultNumberOfChatMessagesToReload, styles: messageThreadStyles })),
|
23571
23463
|
React.createElement(react.Stack, { className: react.mergeStyles(sendboxContainerStyles) },
|
23572
23464
|
React.createElement("div", { className: react.mergeStyles(typingIndicatorContainerStyles) }, onRenderTypingIndicator ? (onRenderTypingIndicator(typingIndicatorProps.typingUsers)) : (React.createElement(TypingIndicator, Object.assign({}, typingIndicatorProps, { styles: typingIndicatorStyles })))),
|
23573
23465
|
React.createElement(react.Stack, { horizontal: formFactor === 'mobile' },
|
@@ -23582,7 +23474,6 @@ const ChatScreen = (props) => {
|
|
23582
23474
|
formFactor !== 'mobile' && React.createElement(AttachFileButton, null)))),
|
23583
23475
|
/* @conditional-compile-remove(chat-composite-participant-pane) */
|
23584
23476
|
(options === null || options === void 0 ? void 0 : options.participantPane) === true && (React.createElement(ChatScreenPeoplePane, { onFetchAvatarPersonaData: onFetchAvatarPersonaData, onFetchParticipantMenuItems: props.onFetchParticipantMenuItems, isMobile: formFactor === 'mobile' }))),
|
23585
|
-
/* @conditional-compile-remove(image-gallery) */
|
23586
23477
|
React.createElement(ImageGallery, { isOpen: isImageGalleryOpen, images: galleryImages, onDismiss: () => {
|
23587
23478
|
setGalleryImages([]);
|
23588
23479
|
setIsImageGalleryOpen(false);
|
@@ -33119,7 +33010,6 @@ class CallWithChatBackedChatAdapter {
|
|
33119
33010
|
};
|
33120
33011
|
this.callWithChatAdapter = callWithChatAdapter;
|
33121
33012
|
}
|
33122
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
33123
33013
|
downloadAttachments(options) {
|
33124
33014
|
return __awaiter$3(this, void 0, void 0, function* () {
|
33125
33015
|
return yield this.callWithChatAdapter.downloadAttachments(options);
|
@@ -33752,7 +33642,6 @@ class AzureCommunicationCallWithChatAdapter {
|
|
33752
33642
|
this.updateFileUploadErrorMessage = this.updateFileUploadErrorMessage.bind(this);
|
33753
33643
|
/* @conditional-compile-remove(file-sharing) */
|
33754
33644
|
this.updateFileUploadMetadata = this.updateFileUploadMetadata.bind(this);
|
33755
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
33756
33645
|
this.downloadAttachments = this.downloadAttachments.bind(this);
|
33757
33646
|
/* @conditional-compile-remove(PSTN-calls) */
|
33758
33647
|
this.holdCall.bind(this);
|
@@ -33997,7 +33886,6 @@ class AzureCommunicationCallWithChatAdapter {
|
|
33997
33886
|
return yield this.chatAdapter.deleteMessage(messageId);
|
33998
33887
|
});
|
33999
33888
|
}
|
34000
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34001
33889
|
downloadAttachments(options) {
|
34002
33890
|
return __awaiter$2(this, void 0, void 0, function* () {
|
34003
33891
|
return yield this.chatAdapter.downloadAttachments(options);
|
@@ -34389,15 +34277,11 @@ beforeDispose) => {
|
|
34389
34277
|
*/
|
34390
34278
|
const createAzureCommunicationCallWithChatAdapterFromClients = ({ callClient, callAgent, callLocator, chatClient, chatThreadClient,
|
34391
34279
|
/* @conditional-compile-remove(video-background-effects) */
|
34392
|
-
callAdapterOptions,
|
34393
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34394
|
-
chatAdapterOptions }) => __awaiter$2(void 0, void 0, void 0, function* () {
|
34280
|
+
callAdapterOptions, chatAdapterOptions }) => __awaiter$2(void 0, void 0, void 0, function* () {
|
34395
34281
|
const createCallAdapterPromise = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, callLocator,
|
34396
34282
|
/* @conditional-compile-remove(video-background-effects) */
|
34397
34283
|
callAdapterOptions);
|
34398
|
-
const createChatAdapterPromise = createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
|
34399
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34400
|
-
chatAdapterOptions);
|
34284
|
+
const createChatAdapterPromise = createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient, chatAdapterOptions);
|
34401
34285
|
const [callAdapter, chatAdapter] = yield Promise.all([createCallAdapterPromise, createChatAdapterPromise]);
|
34402
34286
|
return new AzureCommunicationCallWithChatAdapter(callAdapter, chatAdapter);
|
34403
34287
|
});
|