@azure/communication-react 1.23.0-alpha-202501160016 → 1.23.0-alpha-202501170016
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 +4 -0
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-R5C_P0J9.js → ChatMessageComponentAsRichTextEditBox-Bs70B1Sm.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-R5C_P0J9.js.map → ChatMessageComponentAsRichTextEditBox-Bs70B1Sm.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D0KlP9qO.js → RichTextSendBoxWrapper-CxNd16vB.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D0KlP9qO.js.map → RichTextSendBoxWrapper-CxNd16vB.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-iq0jAnxX.js → index-DwZL8eqF.js} +30 -11
- package/dist/dist-cjs/communication-react/{index-iq0jAnxX.js.map → index-DwZL8eqF.js.map} +1 -1
- package/dist/dist-cjs/communication-react/index.js +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/CapabilitiesSubscriber.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/CapabilitiesSubscriber.js +10 -2
- package/dist/dist-esm/calling-stateful-client/src/CapabilitiesSubscriber.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +13 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.23.0-alpha-
|
1
|
+
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.23.0-alpha-202501170016';\n"]}
|
@@ -8,6 +8,7 @@ export declare class CapabilitiesSubscriber {
|
|
8
8
|
private _callIdRef;
|
9
9
|
private _context;
|
10
10
|
private _capabilitiesFeature;
|
11
|
+
private _capabilitiesInitialized;
|
11
12
|
constructor(callIdRef: CallIdRef, context: CallContext, capabilities: CapabilitiesFeature);
|
12
13
|
private subscribe;
|
13
14
|
unsubscribe: () => void;
|
@@ -5,6 +5,8 @@
|
|
5
5
|
*/
|
6
6
|
export class CapabilitiesSubscriber {
|
7
7
|
constructor(callIdRef, context, capabilities) {
|
8
|
+
/* @conditional-compile-remove(media-access) */
|
9
|
+
this._capabilitiesInitialized = false;
|
8
10
|
this.subscribe = () => {
|
9
11
|
this._capabilitiesFeature.on('capabilitiesChanged', this.capabilitiesChanged);
|
10
12
|
};
|
@@ -18,12 +20,16 @@ export class CapabilitiesSubscriber {
|
|
18
20
|
}
|
19
21
|
/* @conditional-compile-remove(media-access) */
|
20
22
|
this.setUnmuteMicAndTurnVideoOnNotification(data);
|
23
|
+
/* @conditional-compile-remove(media-access) */
|
24
|
+
this._capabilitiesInitialized = true;
|
21
25
|
};
|
22
26
|
/* @conditional-compile-remove(media-access) */
|
23
27
|
this.setUnmuteMicAndTurnVideoOnNotification = (data) => {
|
24
28
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
25
29
|
if (((_a = data.oldValue.turnVideoOn) === null || _a === void 0 ? void 0 : _a.isPresent) !== ((_b = data.newValue.turnVideoOn) === null || _b === void 0 ? void 0 : _b.isPresent)) {
|
26
|
-
if (((_c = data.oldValue.turnVideoOn) === null || _c === void 0 ? void 0 : _c.isPresent) === false &&
|
30
|
+
if (((_c = data.oldValue.turnVideoOn) === null || _c === void 0 ? void 0 : _c.isPresent) === false &&
|
31
|
+
((_d = data.newValue.turnVideoOn) === null || _d === void 0 ? void 0 : _d.isPresent) &&
|
32
|
+
this._capabilitiesInitialized) {
|
27
33
|
const capabilityTurnVideoOnAbsent = this._context.getState().latestNotifications.capabilityTurnVideoOnAbsent;
|
28
34
|
if (capabilityTurnVideoOnAbsent) {
|
29
35
|
this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityTurnVideoOnAbsent');
|
@@ -51,7 +57,9 @@ export class CapabilitiesSubscriber {
|
|
51
57
|
}
|
52
58
|
}
|
53
59
|
if (((_f = data.oldValue.unmuteMic) === null || _f === void 0 ? void 0 : _f.isPresent) !== ((_g = data.newValue.unmuteMic) === null || _g === void 0 ? void 0 : _g.isPresent)) {
|
54
|
-
if (((_h = data.oldValue.unmuteMic) === null || _h === void 0 ? void 0 : _h.isPresent) === false &&
|
60
|
+
if (((_h = data.oldValue.unmuteMic) === null || _h === void 0 ? void 0 : _h.isPresent) === false &&
|
61
|
+
((_j = data.newValue.unmuteMic) === null || _j === void 0 ? void 0 : _j.isPresent) &&
|
62
|
+
this._capabilitiesInitialized) {
|
55
63
|
const capabilityUnmuteMicAbsent = this._context.getState().latestNotifications.capabilityUnmuteMicAbsent;
|
56
64
|
if (capabilityUnmuteMicAbsent) {
|
57
65
|
this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityUnmuteMicAbsent');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CapabilitiesSubscriber.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/CapabilitiesSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC;;GAEG;AACH,MAAM,OAAO,sBAAsB;
|
1
|
+
{"version":3,"file":"CapabilitiesSubscriber.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/CapabilitiesSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAOjC,YAAY,SAAoB,EAAE,OAAoB,EAAE,YAAiC;QAHzF,+CAA+C;QACvC,6BAAwB,GAAY,KAAK,CAAC;QAU1C,cAAS,GAAG,GAAS,EAAE;YAC7B,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAChF,CAAC,CAAC;QAEK,gBAAW,GAAG,GAAS,EAAE;YAC9B,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACjF,CAAC,CAAC;QAEM,wBAAmB,GAAG,CAAC,IAA4B,EAAQ,EAAE;YACnE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACpG,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,KAAK,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;gBACxE,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnE,CAAC;YACD,+CAA+C;YAC/C,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,CAAC;IACnB,CAAC;CA2FF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CapabilitiesChangeInfo, CapabilitiesFeature } from '@azure/communication-calling';\n\nimport { CallContext } from './CallContext';\n\nimport { CallIdRef } from './CallIdRef';\n\n/**\n * @private\n */\nexport class CapabilitiesSubscriber {\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _capabilitiesFeature: CapabilitiesFeature;\n /* @conditional-compile-remove(media-access) */\n private _capabilitiesInitialized: boolean = false;\n\n constructor(callIdRef: CallIdRef, context: CallContext, capabilities: CapabilitiesFeature) {\n this._callIdRef = callIdRef;\n this._context = context;\n this._capabilitiesFeature = capabilities;\n\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._capabilitiesFeature.on('capabilitiesChanged', this.capabilitiesChanged);\n };\n\n public unsubscribe = (): void => {\n this._capabilitiesFeature.off('capabilitiesChanged', this.capabilitiesChanged);\n };\n\n private capabilitiesChanged = (data: CapabilitiesChangeInfo): void => {\n this._context.setCapabilities(this._callIdRef.callId, this._capabilitiesFeature.capabilities, data);\n if (data.oldValue.viewAttendeeNames !== data.newValue.viewAttendeeNames) {\n this._context.setHideAttendeeNames(this._callIdRef.callId, data);\n }\n /* @conditional-compile-remove(media-access) */\n this.setUnmuteMicAndTurnVideoOnNotification(data);\n\n /* @conditional-compile-remove(media-access) */\n this._capabilitiesInitialized = true;\n };\n\n /* @conditional-compile-remove(media-access) */\n private setUnmuteMicAndTurnVideoOnNotification = (data: CapabilitiesChangeInfo): void => {\n if (data.oldValue.turnVideoOn?.isPresent !== data.newValue.turnVideoOn?.isPresent) {\n if (\n data.oldValue.turnVideoOn?.isPresent === false &&\n data.newValue.turnVideoOn?.isPresent &&\n this._capabilitiesInitialized\n ) {\n const capabilityTurnVideoOnAbsent = this._context.getState().latestNotifications.capabilityTurnVideoOnAbsent;\n if (capabilityTurnVideoOnAbsent) {\n this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityTurnVideoOnAbsent');\n }\n const capabilityTurnVideoOnPresent = this._context.getState().latestNotifications.capabilityTurnVideoOnPresent;\n if (!capabilityTurnVideoOnPresent) {\n this._context.setLatestNotification(this._callIdRef.callId, {\n target: 'capabilityTurnVideoOnPresent',\n timestamp: new Date(Date.now())\n });\n }\n }\n\n if (data.newValue.turnVideoOn?.isPresent === false) {\n const capabilityTurnVideoOnPresent = this._context.getState().latestNotifications.capabilityTurnVideoOnPresent;\n if (capabilityTurnVideoOnPresent) {\n this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityTurnVideoOnPresent');\n }\n const capabilityTurnVideoOnAbsent = this._context.getState().latestNotifications.capabilityTurnVideoOnAbsent;\n if (!capabilityTurnVideoOnAbsent) {\n this._context.setLatestNotification(this._callIdRef.callId, {\n target: 'capabilityTurnVideoOnAbsent',\n timestamp: new Date(Date.now())\n });\n }\n }\n }\n if (data.oldValue.unmuteMic?.isPresent !== data.newValue.unmuteMic?.isPresent) {\n if (\n data.oldValue.unmuteMic?.isPresent === false &&\n data.newValue.unmuteMic?.isPresent &&\n this._capabilitiesInitialized\n ) {\n const capabilityUnmuteMicAbsent = this._context.getState().latestNotifications.capabilityUnmuteMicAbsent;\n if (capabilityUnmuteMicAbsent) {\n this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityUnmuteMicAbsent');\n }\n const capabilityUnmuteMicPresent = this._context.getState().latestNotifications.capabilityUnmuteMicPresent;\n if (!capabilityUnmuteMicPresent) {\n this._context.setLatestNotification(this._callIdRef.callId, {\n target: 'capabilityUnmuteMicPresent',\n timestamp: new Date(Date.now())\n });\n }\n }\n\n if (data.newValue.unmuteMic?.isPresent === false) {\n const capabilityUnmuteMicPresent = this._context.getState().latestNotifications.capabilityUnmuteMicPresent;\n if (capabilityUnmuteMicPresent) {\n this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityUnmuteMicPresent');\n }\n const capabilityUnmuteMicAbsent = this._context.getState().latestNotifications.capabilityUnmuteMicAbsent;\n if (!capabilityUnmuteMicAbsent) {\n this._context.setLatestNotification(this._callIdRef.callId, {\n target: 'capabilityUnmuteMicAbsent',\n timestamp: new Date(Date.now())\n });\n }\n }\n }\n };\n}\n"]}
|
@@ -94,8 +94,19 @@ const extractContentForAllyMessage = (props) => {
|
|
94
94
|
return '';
|
95
95
|
};
|
96
96
|
const generateLiveMessage = (props) => {
|
97
|
-
const
|
98
|
-
|
97
|
+
const messageContent = extractContentForAllyMessage(props);
|
98
|
+
if (props.message.editedOn) {
|
99
|
+
const liveAuthor = _formatString(props.strings.editedMessageLiveAuthorIntro, {
|
100
|
+
author: `${props.message.senderDisplayName}`
|
101
|
+
});
|
102
|
+
return `${props.message.mine ? props.strings.editedMessageLocalUserLiveAuthorIntro : liveAuthor} ${messageContent}`;
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
const liveAuthor = _formatString(props.strings.liveAuthorIntro, {
|
106
|
+
author: `${props.message.senderDisplayName}`
|
107
|
+
});
|
108
|
+
return `${props.message.mine ? '' : liveAuthor} ${messageContent} `;
|
109
|
+
}
|
99
110
|
};
|
100
111
|
const messageContentAriaText = (props) => {
|
101
112
|
var _a, _b;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageContent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageContent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAsB,aAAa,EAAE,sCAAgC;AAC5E,OAAO,KAAK,EAAE,EAA0B,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,OAAO,MAAM,eAAe,CAAC;AAIpC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,uDAAuD;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,i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AM;;QAC5C,OAAO,MAAA,SAAS,CAAC,MAAM,CAAC,mCAAI,KAAK,CAAC;IACpC,CAAC,CAAC;QACF,sCAAsC;QACtC,uFAAuF;QACvF,iDAAiD;SAChD,OAAO,CAAC,YAAY,EAAE,UAAU,KAAK,EAAE,MAAM;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React from 'react';\nimport { AttachmentMetadata, _formatString } from '@internal/acs-ui-common';\nimport parse, { HTMLReactParserOptions, Element as DOMElement } from 'html-react-parser';\nimport { attributesToProps } from 'html-react-parser';\nimport Linkify from 'react-linkify';\nimport { ChatMessage } from '../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types/ChatMessage';\nimport { Link } from '@fluentui/react';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions, Mention } from '../MentionPopover';\n\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { FontIcon, Stack } from '@fluentui/react';\nimport { MessageThreadStrings } from '../MessageThread';\nimport LiveMessage from '../Announcer/LiveMessage';\n/* @conditional-compile-remove(mention) */\nimport { defaultOnMentionRender } from './MentionRenderer';\nimport DOMPurify from 'dompurify';\nimport { _AttachmentDownloadCardsStrings } from '../Attachment/AttachmentDownloadCards';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { dataLossIconStyle } from '../styles/MessageThread.styles';\nimport { messageTextContentStyles } from '../styles/MessageThread.styles';\n\ntype ChatMessageContentProps = {\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions?: MentionDisplayOptions;\n inlineImageOptions?: InlineImageOptions;\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\ntype BlockedMessageContentProps = {\n message: BlockedMessage;\n strings: MessageThreadStrings;\n};\n\ntype MessageContentWithLiveAriaProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n liveMessage: string;\n ariaLabel?: string;\n content: JSX.Element;\n className?: string;\n};\n\n/**\n * InlineImage's state, as reflected in the UI.\n *\n * @public\n */\nexport interface InlineImage {\n /** ID of the message that the inline image is belonged to */\n messageId: string;\n /** Attributes of the inline image */\n imageAttributes: React.ImgHTMLAttributes<HTMLImageElement>;\n}\n\n/**\n * Options to display inline image in the inline image scenario.\n *\n * @public\n */\nexport interface InlineImageOptions {\n /**\n * Optional callback to render an inline image of in a message.\n */\n onRenderInlineImage?: (\n inlineImage: InlineImage,\n defaultOnRender: (inlineImage: InlineImage) => JSX.Element\n ) => JSX.Element;\n}\n\n/** @private */\nexport const ChatMessageContent = (props: ChatMessageContentProps): JSX.Element => {\n switch (props.message.contentType) {\n case 'text':\n return MessageContentAsText(props);\n case 'html':\n return MessageContentAsRichTextHTML(props);\n case 'richtext/html':\n return MessageContentAsRichTextHTML(props);\n default:\n console.warn('unknown message content type');\n return <></>;\n }\n};\n\nconst MessageContentWithLiveAria = (props: MessageContentWithLiveAriaProps): JSX.Element => {\n return (\n <div data-ui-status={props.message.status} role=\"text\" aria-label={props.ariaLabel} className={props.className}>\n <LiveMessage message={props.liveMessage} ariaLive=\"polite\" />\n {props.content}\n </div>\n );\n};\n\nconst MessageContentAsRichTextHTML = (props: ChatMessageContentProps): JSX.Element => {\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={generateLiveMessage(props)}\n ariaLabel={messageContentAriaText(props)}\n content={processHtmlToReact(props)}\n />\n );\n};\n\nconst MessageContentAsText = (props: ChatMessageContentProps): JSX.Element => {\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={generateLiveMessage(props)}\n ariaLabel={messageContentAriaText(props)}\n className={messageTextContentStyles}\n content={\n <Linkify\n componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\n return (\n <Link target=\"_blank\" href={decoratedHref} key={key}>\n {decoratedText}\n </Link>\n );\n }}\n >\n {props.message.content}\n </Linkify>\n }\n />\n );\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\n/**\n * @private\n */\nexport const BlockedMessageContent = (props: BlockedMessageContentProps): JSX.Element => {\n const Icon: JSX.Element = <FontIcon className={dataLossIconStyle} iconName={'DataLossPreventionProhibited'} />;\n const blockedMessage =\n props.message.warningText === undefined ? props.strings.blockedWarningText : props.message.warningText;\n const blockedMessageLink = props.message.link;\n const blockedMessageLinkText = blockedMessageLink\n ? props.message.linkText ?? props.strings.blockedWarningLinkText\n : '';\n\n const liveAuthor =\n props.message.mine || props.message.senderDisplayName === undefined ? '' : props.message.senderDisplayName;\n const liveBlockedWarningText = `${liveAuthor} ${blockedMessage} ${blockedMessageLinkText}`;\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={liveBlockedWarningText}\n ariaLabel={liveBlockedWarningText}\n content={\n <Stack horizontal wrap>\n {Icon}\n {blockedMessage && <p>{blockedMessage}</p>}\n {blockedMessageLink && (\n <Link target={'_blank'} href={blockedMessageLink}>\n {blockedMessageLinkText}\n </Link>\n )}\n </Stack>\n }\n />\n );\n};\n\nconst extractContentForAllyMessage = (props: ChatMessageContentProps): string => {\n if (props.message.content || props.message.attachments) {\n // Replace all <img> tags with 'image' for aria.\n const parsedContent = DOMPurify.sanitize(props.message.content ?? '', {\n ALLOWED_TAGS: ['img'],\n RETURN_DOM_FRAGMENT: true\n });\n\n parsedContent.childNodes.forEach((child) => {\n if (child.nodeName.toLowerCase() !== 'img') {\n return;\n }\n const imageTextNode = document.createElement('div');\n imageTextNode.innerHTML = 'image ';\n parsedContent.replaceChild(imageTextNode, child);\n });\n\n // Inject message attachment count for aria.\n // this is only applying to file attachments not for inline images.\n if (props.message.attachments && props.message.attachments.length > 0) {\n const attachmentCardDescription = attachmentCardGroupDescription(props);\n const attachmentTextNode = document.createElement('div');\n attachmentTextNode.innerHTML = `${attachmentCardDescription}`;\n parsedContent.appendChild(attachmentTextNode);\n }\n\n // Strip all html tags from the content for aria.\n let message = DOMPurify.sanitize(parsedContent, { ALLOWED_TAGS: [] });\n // decode HTML entities so that screen reader can read the content properly.\n message = decodeEntities(message);\n return message;\n }\n return '';\n};\n\nconst generateLiveMessage = (props: ChatMessageContentProps): string => {\n const liveAuthor = _formatString(props.strings.liveAuthorIntro, { author: `${props.message.senderDisplayName}` });\n\n return `${props.message.editedOn ? props.strings.editedTag : ''} ${\n props.message.mine ? '' : liveAuthor\n } ${extractContentForAllyMessage(props)} `;\n};\n\nconst messageContentAriaText = (props: ChatMessageContentProps): string | undefined => {\n const message = extractContentForAllyMessage(props);\n return props.message.mine\n ? _formatString(props.strings.messageContentMineAriaText, {\n status: props.message.status ?? '',\n message: message\n })\n : _formatString(props.strings.messageContentAriaText, {\n status: props.message.status ?? '',\n author: `${props.message.senderDisplayName}`,\n message: message\n });\n};\n\nconst attachmentCardGroupDescription = (props: ChatMessageContentProps): string => {\n const attachments = props.message.attachments;\n return getAttachmentCountLiveMessage(attachments ?? [], props.strings.attachmentCardGroupMessage);\n};\n\n/**\n * @private\n */\nexport const getAttachmentCountLiveMessage = (\n attachments: AttachmentMetadata[],\n attachmentCardGroupMessage: string\n): string => {\n if (attachments.length === 0) {\n return '';\n }\n return _formatString(attachmentCardGroupMessage, {\n attachmentCount: `${attachments.length}`\n });\n};\n\nconst defaultOnRenderInlineImage = (inlineImage: InlineImage): JSX.Element => {\n return (\n <img\n key={inlineImage.imageAttributes.id}\n tabIndex={0}\n data-ui-id={inlineImage.imageAttributes.id}\n {...inlineImage.imageAttributes}\n />\n );\n};\n\nconst processHtmlToReact = (props: ChatMessageContentProps): JSX.Element => {\n const options: HTMLReactParserOptions = {\n transform(reactNode, domNode) {\n if (domNode instanceof DOMElement && domNode.attribs) {\n // Transform custom rendering of mentions\n /* @conditional-compile-remove(mention) */\n if (domNode.name === 'msft-mention' && domNode.attribs.id) {\n const { id } = domNode.attribs;\n const mention: Mention = {\n id: id,\n displayText: (domNode.children[0] as unknown as Text).nodeValue ?? ''\n };\n if (props.mentionDisplayOptions?.onRenderMention) {\n return props.mentionDisplayOptions.onRenderMention(mention, defaultOnMentionRender);\n }\n return defaultOnMentionRender(mention);\n }\n\n // Transform inline images\n if (domNode.name && domNode.name === 'img' && domNode.attribs && domNode.attribs.id) {\n if (domNode.attribs.name) {\n domNode.attribs['aria-label'] = domNode.attribs.name;\n }\n const imgProps = attributesToProps(domNode.attribs);\n const inlineImageProps: InlineImage = { messageId: props.message.messageId, imageAttributes: imgProps };\n\n return props.inlineImageOptions?.onRenderInlineImage\n ? props.inlineImageOptions.onRenderInlineImage(inlineImageProps, defaultOnRenderInlineImage)\n : defaultOnRenderInlineImage(inlineImageProps);\n }\n\n // Transform links to open in new tab\n if (domNode.name === 'a' && React.isValidElement<React.AnchorHTMLAttributes<HTMLAnchorElement>>(reactNode)) {\n return React.cloneElement(reactNode, {\n target: '_blank',\n rel: 'noreferrer noopener'\n });\n }\n }\n // Pass through the original node\n return reactNode as unknown as JSX.Element;\n }\n };\n return <>{parse(props.message.content ?? '', options)}</>;\n};\n\nconst decodeEntities = (encodedString: string): string => {\n // This regular expression matches HTML entities.\n const translate_re = /&(nbsp|amp|quot|lt|gt);/g;\n // This object maps HTML entities to their respective characters.\n const translate: Record<string, string> = {\n nbsp: ' ',\n amp: '&',\n quot: '\"',\n lt: '<',\n gt: '>'\n };\n\n return (\n encodedString\n // Find all matches of HTML entities defined in translate_re and\n // replace them with the corresponding character from the translate object.\n .replace(translate_re, function (match, entity) {\n return translate[entity] ?? match;\n })\n // Find numeric entities (e.g., A)\n // and replace them with the equivalent character using the String.fromCharCode method,\n // which converts Unicode values into characters.\n .replace(/&#(\\d+);/gi, function (match, numStr) {\n const num = parseInt(numStr, 10);\n return String.fromCharCode(num);\n })\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"ChatMessageContent.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IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,cAAc,CAAgD,SAAS,CAAC,EAAE,CAAC;oBAC3G,OAAO,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE;wBACnC,MAAM,EAAE,QAAQ;wBAChB,GAAG,EAAE,qBAAqB;qBAC3B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,iCAAiC;YACjC,OAAO,SAAmC,CAAC;QAC7C,CAAC;KACF,CAAC;IACF,OAAO,0CAAG,KAAK,CAAC,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,OAAO,CAAC,CAAI,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,aAAqB,EAAU,EAAE;IACvD,iDAAiD;IACjD,MAAM,YAAY,GAAG,0BAA0B,CAAC;IAChD,iEAAiE;IACjE,MAAM,SAAS,GAA2B;QACxC,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,GAAG;QACP,EAAE,EAAE,GAAG;KACR,CAAC;IAEF,OAAO,CACL,aAAa;QACX,gEAAgE;QAChE,2EAA2E;SAC1E,OAAO,CAAC,YAAY,EAAE,UAAU,KAAK,EAAE,MAAM;;QAC5C,OAAO,MAAA,SAAS,CAAC,MAAM,CAAC,mCAAI,KAAK,CAAC;IACpC,CAAC,CAAC;QACF,sCAAsC;QACtC,uFAAuF;QACvF,iDAAiD;SAChD,OAAO,CAAC,YAAY,EAAE,UAAU,KAAK,EAAE,MAAM;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React from 'react';\nimport { AttachmentMetadata, _formatString } from '@internal/acs-ui-common';\nimport parse, { HTMLReactParserOptions, Element as DOMElement } from 'html-react-parser';\nimport { attributesToProps } from 'html-react-parser';\nimport Linkify from 'react-linkify';\nimport { ChatMessage } from '../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types/ChatMessage';\nimport { Link } from '@fluentui/react';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions, Mention } from '../MentionPopover';\n\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { FontIcon, Stack } from '@fluentui/react';\nimport { MessageThreadStrings } from '../MessageThread';\nimport LiveMessage from '../Announcer/LiveMessage';\n/* @conditional-compile-remove(mention) */\nimport { defaultOnMentionRender } from './MentionRenderer';\nimport DOMPurify from 'dompurify';\nimport { _AttachmentDownloadCardsStrings } from '../Attachment/AttachmentDownloadCards';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { dataLossIconStyle } from '../styles/MessageThread.styles';\nimport { messageTextContentStyles } from '../styles/MessageThread.styles';\n\ntype ChatMessageContentProps = {\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions?: MentionDisplayOptions;\n inlineImageOptions?: InlineImageOptions;\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\ntype BlockedMessageContentProps = {\n message: BlockedMessage;\n strings: MessageThreadStrings;\n};\n\ntype MessageContentWithLiveAriaProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n liveMessage: string;\n ariaLabel?: string;\n content: JSX.Element;\n className?: string;\n};\n\n/**\n * InlineImage's state, as reflected in the UI.\n *\n * @public\n */\nexport interface InlineImage {\n /** ID of the message that the inline image is belonged to */\n messageId: string;\n /** Attributes of the inline image */\n imageAttributes: React.ImgHTMLAttributes<HTMLImageElement>;\n}\n\n/**\n * Options to display inline image in the inline image scenario.\n *\n * @public\n */\nexport interface InlineImageOptions {\n /**\n * Optional callback to render an inline image of in a message.\n */\n onRenderInlineImage?: (\n inlineImage: InlineImage,\n defaultOnRender: (inlineImage: InlineImage) => JSX.Element\n ) => JSX.Element;\n}\n\n/** @private */\nexport const ChatMessageContent = (props: ChatMessageContentProps): JSX.Element => {\n switch (props.message.contentType) {\n case 'text':\n return MessageContentAsText(props);\n case 'html':\n return MessageContentAsRichTextHTML(props);\n case 'richtext/html':\n return MessageContentAsRichTextHTML(props);\n default:\n console.warn('unknown message content type');\n return <></>;\n }\n};\n\nconst MessageContentWithLiveAria = (props: MessageContentWithLiveAriaProps): JSX.Element => {\n return (\n <div data-ui-status={props.message.status} role=\"text\" aria-label={props.ariaLabel} className={props.className}>\n <LiveMessage message={props.liveMessage} ariaLive=\"polite\" />\n {props.content}\n </div>\n );\n};\n\nconst MessageContentAsRichTextHTML = (props: ChatMessageContentProps): JSX.Element => {\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={generateLiveMessage(props)}\n ariaLabel={messageContentAriaText(props)}\n content={processHtmlToReact(props)}\n />\n );\n};\n\nconst MessageContentAsText = (props: ChatMessageContentProps): JSX.Element => {\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={generateLiveMessage(props)}\n ariaLabel={messageContentAriaText(props)}\n className={messageTextContentStyles}\n content={\n <Linkify\n componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\n return (\n <Link target=\"_blank\" href={decoratedHref} key={key}>\n {decoratedText}\n </Link>\n );\n }}\n >\n {props.message.content}\n </Linkify>\n }\n />\n );\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\n/**\n * @private\n */\nexport const BlockedMessageContent = (props: BlockedMessageContentProps): JSX.Element => {\n const Icon: JSX.Element = <FontIcon className={dataLossIconStyle} iconName={'DataLossPreventionProhibited'} />;\n const blockedMessage =\n props.message.warningText === undefined ? props.strings.blockedWarningText : props.message.warningText;\n const blockedMessageLink = props.message.link;\n const blockedMessageLinkText = blockedMessageLink\n ? props.message.linkText ?? props.strings.blockedWarningLinkText\n : '';\n\n const liveAuthor =\n props.message.mine || props.message.senderDisplayName === undefined ? '' : props.message.senderDisplayName;\n const liveBlockedWarningText = `${liveAuthor} ${blockedMessage} ${blockedMessageLinkText}`;\n return (\n <MessageContentWithLiveAria\n message={props.message}\n liveMessage={liveBlockedWarningText}\n ariaLabel={liveBlockedWarningText}\n content={\n <Stack horizontal wrap>\n {Icon}\n {blockedMessage && <p>{blockedMessage}</p>}\n {blockedMessageLink && (\n <Link target={'_blank'} href={blockedMessageLink}>\n {blockedMessageLinkText}\n </Link>\n )}\n </Stack>\n }\n />\n );\n};\n\nconst extractContentForAllyMessage = (props: ChatMessageContentProps): string => {\n if (props.message.content || props.message.attachments) {\n // Replace all <img> tags with 'image' for aria.\n const parsedContent = DOMPurify.sanitize(props.message.content ?? '', {\n ALLOWED_TAGS: ['img'],\n RETURN_DOM_FRAGMENT: true\n });\n\n parsedContent.childNodes.forEach((child) => {\n if (child.nodeName.toLowerCase() !== 'img') {\n return;\n }\n const imageTextNode = document.createElement('div');\n imageTextNode.innerHTML = 'image ';\n parsedContent.replaceChild(imageTextNode, child);\n });\n\n // Inject message attachment count for aria.\n // this is only applying to file attachments not for inline images.\n if (props.message.attachments && props.message.attachments.length > 0) {\n const attachmentCardDescription = attachmentCardGroupDescription(props);\n const attachmentTextNode = document.createElement('div');\n attachmentTextNode.innerHTML = `${attachmentCardDescription}`;\n parsedContent.appendChild(attachmentTextNode);\n }\n\n // Strip all html tags from the content for aria.\n let message = DOMPurify.sanitize(parsedContent, { ALLOWED_TAGS: [] });\n // decode HTML entities so that screen reader can read the content properly.\n message = decodeEntities(message);\n return message;\n }\n return '';\n};\n\nconst generateLiveMessage = (props: ChatMessageContentProps): string => {\n const messageContent = extractContentForAllyMessage(props);\n\n if (props.message.editedOn) {\n const liveAuthor = _formatString(props.strings.editedMessageLiveAuthorIntro, {\n author: `${props.message.senderDisplayName}`\n });\n return `${props.message.mine ? props.strings.editedMessageLocalUserLiveAuthorIntro : liveAuthor} ${messageContent}`;\n } else {\n const liveAuthor = _formatString(props.strings.liveAuthorIntro, {\n author: `${props.message.senderDisplayName}`\n });\n return `${props.message.mine ? '' : liveAuthor} ${messageContent} `;\n }\n};\n\nconst messageContentAriaText = (props: ChatMessageContentProps): string | undefined => {\n const message = extractContentForAllyMessage(props);\n return props.message.mine\n ? _formatString(props.strings.messageContentMineAriaText, {\n status: props.message.status ?? '',\n message: message\n })\n : _formatString(props.strings.messageContentAriaText, {\n status: props.message.status ?? '',\n author: `${props.message.senderDisplayName}`,\n message: message\n });\n};\n\nconst attachmentCardGroupDescription = (props: ChatMessageContentProps): string => {\n const attachments = props.message.attachments;\n return getAttachmentCountLiveMessage(attachments ?? [], props.strings.attachmentCardGroupMessage);\n};\n\n/**\n * @private\n */\nexport const getAttachmentCountLiveMessage = (\n attachments: AttachmentMetadata[],\n attachmentCardGroupMessage: string\n): string => {\n if (attachments.length === 0) {\n return '';\n }\n return _formatString(attachmentCardGroupMessage, {\n attachmentCount: `${attachments.length}`\n });\n};\n\nconst defaultOnRenderInlineImage = (inlineImage: InlineImage): JSX.Element => {\n return (\n <img\n key={inlineImage.imageAttributes.id}\n tabIndex={0}\n data-ui-id={inlineImage.imageAttributes.id}\n {...inlineImage.imageAttributes}\n />\n );\n};\n\nconst processHtmlToReact = (props: ChatMessageContentProps): JSX.Element => {\n const options: HTMLReactParserOptions = {\n transform(reactNode, domNode) {\n if (domNode instanceof DOMElement && domNode.attribs) {\n // Transform custom rendering of mentions\n /* @conditional-compile-remove(mention) */\n if (domNode.name === 'msft-mention' && domNode.attribs.id) {\n const { id } = domNode.attribs;\n const mention: Mention = {\n id: id,\n displayText: (domNode.children[0] as unknown as Text).nodeValue ?? ''\n };\n if (props.mentionDisplayOptions?.onRenderMention) {\n return props.mentionDisplayOptions.onRenderMention(mention, defaultOnMentionRender);\n }\n return defaultOnMentionRender(mention);\n }\n\n // Transform inline images\n if (domNode.name && domNode.name === 'img' && domNode.attribs && domNode.attribs.id) {\n if (domNode.attribs.name) {\n domNode.attribs['aria-label'] = domNode.attribs.name;\n }\n const imgProps = attributesToProps(domNode.attribs);\n const inlineImageProps: InlineImage = { messageId: props.message.messageId, imageAttributes: imgProps };\n\n return props.inlineImageOptions?.onRenderInlineImage\n ? props.inlineImageOptions.onRenderInlineImage(inlineImageProps, defaultOnRenderInlineImage)\n : defaultOnRenderInlineImage(inlineImageProps);\n }\n\n // Transform links to open in new tab\n if (domNode.name === 'a' && React.isValidElement<React.AnchorHTMLAttributes<HTMLAnchorElement>>(reactNode)) {\n return React.cloneElement(reactNode, {\n target: '_blank',\n rel: 'noreferrer noopener'\n });\n }\n }\n // Pass through the original node\n return reactNode as unknown as JSX.Element;\n }\n };\n return <>{parse(props.message.content ?? '', options)}</>;\n};\n\nconst decodeEntities = (encodedString: string): string => {\n // This regular expression matches HTML entities.\n const translate_re = /&(nbsp|amp|quot|lt|gt);/g;\n // This object maps HTML entities to their respective characters.\n const translate: Record<string, string> = {\n nbsp: ' ',\n amp: '&',\n quot: '\"',\n lt: '<',\n gt: '>'\n };\n\n return (\n encodedString\n // Find all matches of HTML entities defined in translate_re and\n // replace them with the corresponding character from the translate object.\n .replace(translate_re, function (match, entity) {\n return translate[entity] ?? match;\n })\n // Find numeric entities (e.g., A)\n // and replace them with the equivalent character using the String.fromCharCode method,\n // which converts Unicode values into characters.\n .replace(/&#(\\d+);/gi, function (match, numStr) {\n const num = parseInt(numStr, 10);\n return String.fromCharCode(num);\n })\n );\n};\n"]}
|
@@ -77,6 +77,10 @@ export interface MessageThreadStrings {
|
|
77
77
|
failToSendTag?: string;
|
78
78
|
/** String for LiveMessage introduction for the Chat Message */
|
79
79
|
liveAuthorIntro: string;
|
80
|
+
/** String for LiveMessage introduction for the edited Chat Message by remote user */
|
81
|
+
editedMessageLiveAuthorIntro: string;
|
82
|
+
/** String for LiveMessage introduction for the edited Chat Message sent by local user */
|
83
|
+
editedMessageLocalUserLiveAuthorIntro: string;
|
80
84
|
/** String for aria text of remote user's message content */
|
81
85
|
messageContentAriaText: string;
|
82
86
|
/** String for aria text of local user's message content */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageThread.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,IAAI,EAAU,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,aAAa,EACb,8BAA8B,EAC9B,2BAA2B,EAC3B,kCAAkC,EAClC,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AActC,OAAO,EAAE,YAAY,EAAiB,mCAAgC;AAKtE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,iCAAiC,MAAM,2CAA2C,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAE5B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,mDAAmD;AACn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S,CAAC,CAAA;4BAEpF,gEAAgE;4BAChE,mBAAmB,EAAE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,mBAAmB,IAC/D,CACH,CAAC;oBACJ,CAAC,CAAC,CACG,CACe,CACV,CACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,+BAA+B,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAqC,EAAe,EAAE;IACxG,OAAO,oBAAC,2BAA2B,oBAAK,GAAG,EAAI,CAAC;AAClD,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Icon, IStyle, mergeStyles, PrimaryButton } from '@fluentui/react';\nimport { Chat } from '@fluentui-contrib/react-chat';\nimport { mergeClasses, useArrowNavigationGroup } from '@fluentui/react-components';\nimport {\n DownIconStyle,\n newMessageButtonContainerStyle,\n messageThreadContainerStyle,\n messageThreadWrapperContainerStyle,\n useChatStyles,\n buttonWithIconStyles,\n newMessageButtonStyle\n} from './styles/MessageThread.styles';\nimport { delay } from './utils/delay';\nimport {\n BaseCustomStyles,\n ChatMessage,\n CustomMessage,\n SystemMessage,\n OnRenderAvatarCallback,\n Message,\n ReadReceiptsBySenderId,\n ComponentSlotStyle\n} from '../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../types';\nimport { MessageStatusIndicatorProps } from './MessageStatusIndicator';\nimport { memoizeFnAll, MessageStatus } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport { isNarrowWidth, _useContainerWidth } from './utils/responsive';\nimport getParticipantsWhoHaveReadMessage from './utils/getParticipantsWhoHaveReadMessage';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentOptions } from '../types/Attachment';\nimport { useTheme } from '../theming';\nimport { FluentV9ThemeProvider } from './../theming/FluentV9ThemeProvider';\nimport LiveAnnouncer from './Announcer/LiveAnnouncer';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from './MentionPopover';\nimport { createStyleFromV8Style } from './styles/v8StyleShim';\nimport {\n ChatMessageComponentWrapper,\n ChatMessageComponentWrapperProps\n} from './ChatMessage/ChatMessageComponentWrapper';\nimport { InlineImageOptions } from './ChatMessage/ChatMessageContent';\nimport { MessageStatusIndicatorInternal } from './MessageStatusIndicatorInternal';\nimport { Announcer } from './Announcer';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextEditorOptions, RichTextStrings } from './RichTextEditor/RichTextSendBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { loadChatMessageComponentAsRichTextEditBox } from './ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker';\n\nconst isMessageSame = (first: ChatMessage, second: ChatMessage): boolean => {\n return (\n first.messageId === second.messageId &&\n first.content === second.content &&\n first.contentType === second.contentType &&\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\n first.senderId === second.senderId &&\n first.senderDisplayName === second.senderDisplayName &&\n JSON.stringify(first.editedOn) === JSON.stringify(second.editedOn)\n );\n};\n\n/**\n * Get the latest message from the message array.\n *\n * @param messages\n */\nconst getLatestChatMessage = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && !!message.createdOn) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\n * current user.\n */\nconst isThereNewMessageNotFromCurrentUser = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId !== userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId !== userId\n );\n};\n\n/**\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\n * updated this component due to current user sending a message we want to then call scrollToBottom.\n */\nconst didUserSendTheLatestMessage = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId === userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId === userId\n );\n};\n\n/**\n * Fluent styles for {@link MessageThread}.\n *\n * @public\n */\nexport interface MessageThreadStyles extends BaseCustomStyles {\n /** Styles for load previous messages container. */\n loadPreviousMessagesButtonContainer?: IStyle;\n /** Styles for new message container. */\n newMessageButtonContainer?: IStyle;\n /** Styles for chat container. */\n chatContainer?: ComponentSlotStyle;\n /** styles for my chat items. */\n myChatItemMessageContainer?: ComponentSlotStyle;\n /** styles for chat items. */\n chatItemMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container. */\n myChatMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container in case of failure. */\n failedMyChatMessageContainer?: ComponentSlotStyle;\n /** Styles for chat message container. */\n chatMessageContainer?: ComponentSlotStyle;\n /** Styles for system message container. */\n systemMessageContainer?: ComponentSlotStyle;\n /** Styles for blocked message container. */\n /* @conditional-compile-remove(data-loss-prevention) */\n blockedMessageContainer?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\n}\n\n/**\n * Strings of {@link MessageThread} that can be overridden.\n *\n * @public\n */\nexport interface MessageThreadStrings {\n /** String for Sunday */\n sunday: string;\n /** String for Monday */\n monday: string;\n /** String for Tuesday */\n tuesday: string;\n /** String for Wednesday */\n wednesday: string;\n /** String for Thursday */\n thursday: string;\n /** String for Friday */\n friday: string;\n /** String for Saturday */\n saturday: string;\n /** String for Yesterday */\n yesterday: string;\n /** String for participants joined */\n participantJoined: string;\n /** String for participants left */\n participantLeft: string;\n /** Tag shown on a message that has been edited */\n editedTag: string;\n /** String for editing message in floating menu */\n editMessage: string;\n /** String for removing message in floating menu */\n removeMessage: string;\n /** String for resending failed message in floating menu */\n resendMessage?: string;\n /** String for indicating failed to send messages */\n failToSendTag?: string;\n /** String for LiveMessage introduction for the Chat Message */\n liveAuthorIntro: string;\n /** String for aria text of remote user's message content */\n messageContentAriaText: string;\n /** String for aria text of local user's message content */\n messageContentMineAriaText: string;\n /** String for warning on text limit exceeded in EditBox*/\n editBoxTextLimit: string;\n /** String for placeholder text in EditBox when there is no user input*/\n editBoxPlaceholderText: string;\n /** String for new messages indicator*/\n newMessagesIndicator: string;\n /** String for showing message read status in floating menu */\n messageReadCount?: string;\n /** String for replacing display name when there is none*/\n noDisplayNameSub: string;\n /** String for Cancel button in EditBox*/\n editBoxCancelButton: string;\n /** String for Submit in EditBox when there is no user input*/\n editBoxSubmitButton: string;\n /** String for action menu indicating there are more options */\n actionMenuMoreOptions?: string;\n /** Aria label to announce when a message is deleted */\n messageDeletedAnnouncementAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /** String for download attachment button in attachment card */\n downloadAttachment: string;\n /** String for open attachment button in attachment card */\n openAttachment: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal */\n blockedWarningText: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal details link */\n blockedWarningLinkText: string;\n /** String for aria text in attachment card group*/\n attachmentCardGroupMessage: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating that one or more image uploads are not complete.\n */\n imageUploadsPendingError: string;\n}\n\n/**\n * Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.\n *\n * @public\n */\nexport interface JumpToNewMessageButtonProps {\n /** String for button text */\n text: string;\n /** Callback for when button is clicked */\n onClick: () => void;\n}\n\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\n const { text, onClick } = props;\n return (\n <PrimaryButton\n className={newMessageButtonStyle}\n styles={buttonWithIconStyles}\n text={text}\n onClick={onClick}\n onRenderIcon={() => <Icon iconName=\"Down\" className={DownIconStyle} />}\n />\n );\n};\n\n/**\n * A component to render a single message.\n *\n * @public\n */\nexport type MessageRenderer = (props: MessageProps) => JSX.Element;\n\nconst memoizeAllMessages = memoizeFnAll(\n (\n message: Message,\n showMessageDate: boolean,\n showMessageStatus: boolean,\n strings: MessageThreadStrings,\n index: number,\n onUpdateMessage?: UpdateMessageCallback,\n onCancelEditMessage?: CancelEditCallback,\n onDeleteMessage?: (messageId: string) => Promise<void>,\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>,\n disableEditing?: boolean,\n lastSeenChatMessage?: string,\n lastSendingChatMessage?: string,\n lastDeliveredChatMessage?: string\n ): _ChatMessageProps => {\n let key: string | undefined = message.messageId;\n let statusToRender: MessageStatus | undefined = undefined;\n\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\n if ((!message.messageId || message.messageId === '') && 'clientMessageId' in message) {\n key = message.clientMessageId;\n }\n if (showMessageStatus && message.mine) {\n switch (message.messageId) {\n case lastSeenChatMessage: {\n statusToRender = 'seen';\n break;\n }\n case lastSendingChatMessage: {\n statusToRender = 'sending';\n break;\n }\n case lastDeliveredChatMessage: {\n statusToRender = 'delivered';\n break;\n }\n }\n }\n if (message.mine && message.status === 'failed') {\n statusToRender = 'failed';\n }\n }\n return {\n key: key ?? 'id_' + index,\n statusToRender,\n message,\n strings,\n showDate: showMessageDate,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n disableEditing,\n showMessageStatus\n };\n }\n);\n\nconst getLastChatMessageIdWithStatus = (messages: Message[], status: MessageStatus): string | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && message.status === status && message.mine) {\n return message.messageId;\n }\n }\n return undefined;\n};\n\nconst getLastChatMessageForCurrentUser = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && message.mine) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * @public\n * Callback function run when a message is updated.\n */\nexport type UpdateMessageCallback = (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n) => Promise<void>;\n/**\n * @public\n * Callback function run when a message edit is cancelled.\n */\nexport type CancelEditCallback = (messageId: string) => void;\n\n/**\n * Props for {@link MessageThread}.\n *\n * @public\n */\nexport type MessageThreadProps = {\n /**\n * UserId of the current user.\n */\n userId: string;\n /**\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n messages: (\n | ChatMessage\n | SystemMessage\n | CustomMessage\n | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage\n )[];\n /**\n * number of participants in the thread\n */\n participantCount?: number;\n /**\n * read receipts for each sender in the chat\n */\n readReceiptsBySenderId?: ReadReceiptsBySenderId;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageThread styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: MessageThreadStyles;\n /**\n * Whether the new message button is disabled or not.\n *\n * @defaultValue `false`\n */\n disableJumpToNewMessageButton?: boolean;\n /**\n * Whether the date of each message is displayed or not.\n * It is ignored when onDisplayDateTimeString is supplied.\n *\n * @defaultValue `false`\n */\n showMessageDate?: boolean;\n /**\n * Whether the status indicator for each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageStatus?: boolean;\n /**\n * Number of chat messages to reload each time onLoadPreviousChatMessages is called.\n *\n * @defaultValue 0\n */\n numberOfChatMessagesToReload?: number;\n /**\n * Optional callback to override actions on message being seen.\n *\n * @param messageId - message Id\n */\n onMessageSeen?: (messageId: string) => Promise<void>;\n /**\n * Optional callback to override render of the message status indicator.\n *\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\n */\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional callback to override render of the button for jumping to the new message.\n *\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps 0 */\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\n /**\n * Optional callback to override loading of previous messages.\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\n */\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\n /**\n * Optional callback to override render of a message.\n *\n * @param messageProps - props of type {@link communication-react#MessageProps}\n * @param defaultOnRender - default render of type {@link communication-react#MessageRenderer}\n *\n * @remarks\n * `messageRenderer` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\n */\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message body to send\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n\n /**\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MessageThreadStrings>;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * @beta\n * Optional attachment options, which defines behvaiour for uploading and downloading attachments.\n * As this moment, the uploadOptions would be ignored and this option is intended for download only.\n */\n attachmentOptions?: AttachmentOptions;\n\n /* @conditional-compile-remove(date-time-customization) */\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup a mention query and display mentions\n * @beta\n */\n mentionOptions?: MentionOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n\n /* @conditional-compile-remove(rich-text-editor) */\n /**\n * Options to enable rich text editor for the edit box.\n * @beta\n */\n richTextEditorOptions?: RichTextEditBoxOptions;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor edit box configuration.\n *\n * @beta\n */\nexport interface RichTextEditBoxOptions extends RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle an inline image that's inserted in the rich text editor.\n * When not provided, pasting images into rich text editor will be disabled.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']\n * @param messageId - the id of the message that the inlineImage belongs to.\n */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback invoked after inline image is removed from the UI.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].\n * Note that if the src attribute is a local blob url, it has been revoked at this point.\n * @param messageId - the id of the message that the inlineImage belongs to.\n */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Record of type {@link AttachmentMetadataInProgress}\n * to render the errorBar for inline images inserted in the MessageThread's edit boxes when:\n * - there is an error provided in the messagesInlineImagesWithProgress\n * - progress is less than 1 when the send button is clicked\n * - content html string is longer than the max allowed length.\n * (Note that the id and the url prop of the messagesInlineImagesWithProgress will be used as the id and src attribute of the content html\n * when calculating the content length, only for the purpose of displaying the content length overflow error.)\n */\n messagesInlineImagesWithProgress?: Record<string, AttachmentMetadataInProgress[]>;\n}\n\n/**\n * Props to render a single message.\n *\n * See {@link MessageRenderer}.\n *\n * @public\n */\nexport type MessageProps = {\n /**\n * Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n message: Message;\n /**\n * Strings from parent MessageThread component\n */\n strings: MessageThreadStrings & /* @conditional-compile-remove(rich-text-editor) */ Partial<RichTextStrings>;\n /**\n * Custom CSS styles for chat message container.\n */\n messageContainerStyle?: ComponentSlotStyle;\n /**\n * Whether the date of a message is displayed or not.\n *\n * @defaultValue `false`\n */\n showDate?: boolean;\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message content from chatClient\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type _ChatMessageProps = MessageProps & {\n key: string;\n statusToRender: MessageStatus | undefined;\n showMessageStatus?: boolean;\n};\n\n/**\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\n * @param props - of type MessageThreadProps\n *\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\n *\n * `MessageThread` internally uses the `Chat` component from `@fluentui-contrib/chat`. You can checkout the details about these components [here](https://microsoft.github.io/fluentui-contrib/react-chat/).\n *\n * @public\n */\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\n const theme = useTheme();\n\n const chatBody = useMemo(() => {\n return (\n <FluentV9ThemeProvider v8Theme={theme}>\n {/* Wrapper is required to call \"useClasses\" hook with proper context values */}\n <MessageThreadWrapper {...props} />\n </FluentV9ThemeProvider>\n );\n }, [theme, props]);\n\n return <div className={mergeStyles(messageThreadContainerStyle, props.styles?.root)}>{chatBody}</div>;\n};\n\n/**\n * @private\n */\nexport const MessageThreadWrapper = (props: MessageThreadProps): JSX.Element => {\n const {\n messages: newMessages,\n userId,\n participantCount,\n readReceiptsBySenderId,\n styles,\n disableJumpToNewMessageButton = false,\n showMessageDate = false,\n showMessageStatus = false,\n numberOfChatMessagesToReload = 5,\n onMessageSeen,\n onRenderMessageStatus,\n onRenderAvatar,\n onLoadPreviousChatMessages,\n onRenderJumpToNewMessageButton,\n onRenderMessage,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions\n } = props;\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const [forceUpdate, setForceUpdate] = useState<number>(0);\n\n // Used to decide if should auto scroll to bottom or show \"new message\" button\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\n\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\n\n // readCount and participantCount will only need to be updated on-fly when user hover on an indicator\n const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = useState<number | undefined>(undefined);\n\n const localeStrings = useLocale().strings.messageThread;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n // it is required to use useState for messages\n // as the scrolling logic requires re - render at a specific point in time\n const [messages, setMessages] = useState<Message[]>([]);\n\n // id for the latest deleted message\n const [latestDeletedMessageId, setLatestDeletedMessageId] = useState<string | undefined>(undefined);\n // this value is used to check if a message is deleted for the previous value of messages array\n const previousMessagesRef = useRef<Message[]>([]);\n // an aria label for Narrator to notify when a message is deleted\n const [deletedMessageAriaLabel, setDeletedMessageAriaLabel] = useState<string | undefined>(undefined);\n /* @conditional-compile-remove(rich-text-editor) */\n useEffect(() => {\n // if rich text editor is enabled, the rich text editor component should be loaded early for good UX\n if (richTextEditorOptions !== undefined) {\n // this line is needed to load the Rooster JS dependencies early in the lifecycle\n // when the rich text editor is enabled\n loadChatMessageComponentAsRichTextEditBox();\n }\n }, [richTextEditorOptions]);\n\n const onDeleteMessageCallback = useCallback(\n async (messageId: string): Promise<void> => {\n if (!onDeleteMessage) {\n return;\n }\n try {\n // reset deleted message label in case if there was a value already (messages are deleted 1 after another)\n setDeletedMessageAriaLabel(undefined);\n setLatestDeletedMessageId(messageId);\n lastChatMessageStatus.current = 'deleted';\n // we should set up latestDeletedMessageId before the onDeleteMessage call\n // as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId\n await onDeleteMessage(messageId);\n } catch (e) {\n console.log('onDeleteMessage failed: messageId', messageId, 'error', e);\n }\n },\n [onDeleteMessage]\n );\n\n const isAllChatMessagesLoadedRef = useRef(false);\n // isAllChatMessagesLoadedRef needs to be updated every time when a new adapter is set in order to display correct data\n // onLoadPreviousChatMessages is updated when a new adapter is set\n useEffect(() => {\n if (onLoadPreviousChatMessages) {\n isAllChatMessagesLoadedRef.current = false;\n }\n }, [onLoadPreviousChatMessages]);\n\n const previousTopRef = useRef<number>(-1);\n const previousHeightRef = useRef<number>(-1);\n\n const messageIdSeenByMeRef = useRef<string>('');\n\n const chatScrollDivRef = useRef<HTMLDivElement>(null);\n const isLoadingChatMessagesRef = useRef(false);\n\n useEffect(() => {\n if (latestDeletedMessageId === undefined) {\n setDeletedMessageAriaLabel(undefined);\n } else {\n if (!previousMessagesRef.current.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in previousMessagesRef\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n } else if (!messages.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in messages array but still exists in previousMessagesRef\n // update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(strings.messageDeletedAnnouncementAriaLabel);\n } else {\n // the message exists in both arrays\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n }\n }\n previousMessagesRef.current = messages;\n }, [latestDeletedMessageId, messages, strings.messageDeletedAnnouncementAriaLabel]);\n\n const messagesRef = useRef(messages);\n const setMessagesRef = (messagesWithAttachedValue: Message[]): void => {\n messagesRef.current = messagesWithAttachedValue;\n setMessages(messagesWithAttachedValue);\n };\n\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\n };\n\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\n chatMessagesInitializedRef.current = chatMessagesInitialized;\n setChatMessagesInitialized(chatMessagesInitialized);\n };\n\n const chatThreadRef = useRef<HTMLDivElement>(null);\n\n // When the chat thread is narrow, we perform space optimizations such as overlapping\n // the avatar on top of the chat message and moving the chat accept/reject edit buttons\n // to a new line\n const chatThreadWidth = _useContainerWidth(chatThreadRef);\n const isNarrow = chatThreadWidth ? isNarrowWidth(chatThreadWidth) : false;\n\n /**\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\n */\n const clientHeight = chatThreadRef.current?.clientHeight;\n\n // we try to only send those message status if user is scrolled to the bottom.\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\n if (\n !isAtBottomOfScrollRef.current ||\n !document.hasFocus() ||\n !messagesRef.current ||\n messagesRef.current.length === 0 ||\n !showMessageStatus\n ) {\n return;\n }\n const messagesWithId = messagesRef.current.filter((message) => {\n return message.messageType === 'chat' && !message.mine && !!message.messageId;\n });\n if (messagesWithId.length === 0) {\n return;\n }\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\n try {\n if (\n onMessageSeen &&\n lastMessage &&\n lastMessage.messageId &&\n lastMessage.messageId !== messageIdSeenByMeRef.current\n ) {\n await onMessageSeen(lastMessage.messageId);\n messageIdSeenByMeRef.current = lastMessage.messageId;\n }\n } catch (e) {\n console.log('onMessageSeen Error', lastMessage, e);\n }\n }, [showMessageStatus, onMessageSeen]);\n\n const scrollToBottom = useCallback((): void => {\n if (chatScrollDivRef.current) {\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\n }\n setExistsNewChatMessage(false);\n setIsAtBottomOfScrollRef(true);\n sendMessageStatusIfAtBottom();\n }, [sendMessageStatusIfAtBottom]);\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n const atBottom =\n Math.ceil(chatScrollDivRef.current.scrollTop) >=\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\n if (atBottom) {\n sendMessageStatusIfAtBottom();\n if (!isAtBottomOfScrollRef.current) {\n scrollToBottom();\n }\n }\n setIsAtBottomOfScrollRef(atBottom);\n }, [scrollToBottom, sendMessageStatusIfAtBottom]);\n\n // Infinite scrolling + threadInitialize function\n const fetchNewMessageWhenAtTop = useCallback(async () => {\n if (!isLoadingChatMessagesRef.current) {\n if (onLoadPreviousChatMessages) {\n isLoadingChatMessagesRef.current = true;\n try {\n // Fetch message until scrollTop reach the threshold for fetching new message\n while (\n !isAllChatMessagesLoadedRef.current &&\n chatScrollDivRef.current &&\n chatScrollDivRef.current.scrollTop <= 500\n ) {\n isAllChatMessagesLoadedRef.current = await onLoadPreviousChatMessages(numberOfChatMessagesToReload);\n await delay(200);\n }\n } finally {\n // Set isLoadingChatMessagesRef to false after messages are fetched\n isLoadingChatMessagesRef.current = false;\n }\n }\n }\n }, [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);\n\n // The below 2 of useEffects are design for fixing infinite scrolling problem\n // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)\n // we need to get previousTop before it prepend contents\n // Execute order [newMessage useEffect] => get previousTop => dom update => [messages useEffect]\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n previousTopRef.current = chatScrollDivRef.current.scrollTop;\n previousHeightRef.current = chatScrollDivRef.current.scrollHeight;\n }, [newMessages]);\n\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n chatScrollDivRef.current.scrollTop =\n chatScrollDivRef.current.scrollHeight - (previousHeightRef.current - previousTopRef.current);\n }, [messages]);\n\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\n useEffect(() => {\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n /**\n * One time run useEffects. Sets up listeners when component is mounted and tears down listeners when component\n * unmounts unless these function changed\n */\n useEffect(() => {\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\n return () => {\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\n };\n }, [sendMessageStatusIfAtBottom]);\n\n useEffect(() => {\n const chatScrollDiv = chatScrollDivRef.current;\n chatScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.addEventListener('scroll', fetchNewMessageWhenAtTop);\n\n return () => {\n chatScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.removeEventListener('scroll', fetchNewMessageWhenAtTop);\n };\n }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);\n\n useEffect(() => {\n if (clientHeight === undefined) {\n setForceUpdate(forceUpdate + 1);\n return;\n }\n // Only scroll to bottom if isAtBottomOfScrollRef is true\n isAtBottomOfScrollRef.current && scrollToBottom();\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\n useEffect(() => {\n const newStatus = getLastChatMessageForCurrentUser(newMessages)?.status;\n if (newStatus !== undefined) {\n if (lastChatMessageStatus.current === 'deleted' && newStatus === 'sending') {\n // enforce message life cycle\n // message status should always be [ sending -> delivered -> seen (optional) -> deleted ] or [sending -> failed -> deleted]\n // not any other way around\n // therefore, if current message status is deleted, we should only update it if newStatus is sending\n lastChatMessageStatus.current = newStatus;\n } else if (lastChatMessageStatus.current !== 'deleted') {\n lastChatMessageStatus.current = newStatus;\n }\n }\n // The hook should depend on newMessages not on messages as otherwise it will skip the sending status for a first message\n }, [newMessages]);\n\n /**\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\n * These two states are used to manipulate scrollbar\n */\n useEffect(() => {\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\n setMessagesRef(newMessages);\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\n }, [newMessages]);\n\n /**\n * This needs to run after messages are rendered so we can manipulate the scroll bar.\n */\n useEffect(() => {\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\n if (\n isThereNewMessageNotFromCurrentUser(userId, latestPreviousChatMessage, latestCurrentChatMessage) &&\n !isAtBottomOfScrollRef.current\n ) {\n setExistsNewChatMessage(true);\n } else if (\n didUserSendTheLatestMessage(userId, latestPreviousChatMessage, latestCurrentChatMessage) ||\n isAtBottomOfScrollRef.current\n ) {\n scrollToBottom();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n const lastChatMessageStatus = useRef<string | undefined>(undefined);\n const participantCountRef = useRef(participantCount);\n const readReceiptsBySenderIdRef = useRef(readReceiptsBySenderId);\n\n participantCountRef.current = participantCount;\n readReceiptsBySenderIdRef.current = readReceiptsBySenderId;\n\n const onActionButtonClickMemo = useCallback(\n (message: ChatMessage, setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void) => {\n if (participantCountRef.current && participantCountRef.current - 1 > 1 && readReceiptsBySenderIdRef.current) {\n setMessageReadBy(getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current));\n }\n },\n []\n );\n\n const defaultStatusRenderer = useCallback(\n (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => {\n // we should only announce label if the message status isn't deleted\n // because after message is deleted, we now need to render statusIndicator for previous messages\n // and their status has been announced already and we should not announce them again\n const shouldAnnounce = lastChatMessageStatus.current !== 'deleted';\n\n const onToggleToolTip = (isToggled: boolean): void => {\n if (isToggled && readReceiptsBySenderIdRef.current) {\n setReadCountForHoveredIndicator(\n getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current).length\n );\n } else {\n setReadCountForHoveredIndicator(undefined);\n }\n };\n return (\n <MessageStatusIndicatorInternal\n status={status}\n readCount={readCount}\n onToggleToolTip={onToggleToolTip}\n // -1 because participant count does not include myself\n remoteParticipantsCount={participantCount ? participantCount - 1 : 0}\n shouldAnnounce={shouldAnnounce}\n />\n );\n },\n []\n );\n\n const theme = useTheme();\n\n const messagesToDisplay = useMemo(() => {\n return memoizeAllMessages((memoizedMessageFn) => {\n return messages.map((message: Message, index: number): _ChatMessageProps => {\n return memoizedMessageFn(\n message,\n showMessageDate,\n showMessageStatus,\n strings,\n index,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n props.disableEditing,\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage\n );\n });\n });\n }, [\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage,\n messages,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n onUpdateMessage,\n props.disableEditing,\n showMessageDate,\n showMessageStatus,\n strings\n ]);\n\n const classes = useChatStyles();\n const chatArrowNavigationAttributes = useArrowNavigationGroup({ axis: 'vertical', memorizeCurrent: false });\n\n return (\n <div className={mergeStyles(messageThreadWrapperContainerStyle)} ref={chatThreadRef}>\n {/* Always ensure New Messages button is above the chat body element in the DOM tree. This is to ensure correct\n tab ordering. Because the New Messages button floats on top of the chat body it is in a higher z-index and\n thus Users should be able to tab navigate to the new messages button _before_ tab focus is taken to the chat body.*/}\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\n {onRenderJumpToNewMessageButton ? (\n onRenderJumpToNewMessageButton({ text: strings.newMessagesIndicator, onClick: scrollToBottom })\n ) : (\n <DefaultJumpToNewMessageButton text={strings.newMessagesIndicator} onClick={scrollToBottom} />\n )}\n </div>\n )}\n <LiveAnnouncer>\n <FluentV9ThemeProvider v8Theme={theme}>\n <Chat\n // styles?.chatContainer used in className and style prop as style prop can't handle CSS selectors\n className={mergeClasses(classes.root, mergeStyles(styles?.chatContainer))}\n ref={chatScrollDivRef}\n style={{ ...createStyleFromV8Style(styles?.chatContainer) }}\n {...chatArrowNavigationAttributes}\n >\n {latestDeletedMessageId && (\n <Announcer\n key={latestDeletedMessageId}\n announcementString={deletedMessageAriaLabel}\n ariaLive={'polite'}\n />\n )}\n {messagesToDisplay.map((message: _ChatMessageProps): JSX.Element => {\n return (\n <MemoChatMessageComponentWrapper\n {...message}\n userId={userId}\n key={message.key}\n styles={styles}\n shouldOverlapAvatarAndMessage={isNarrow}\n strings={strings}\n onRenderAvatar={onRenderAvatar}\n onRenderMessage={onRenderMessage}\n onRenderMessageStatus={onRenderMessageStatus}\n defaultStatusRenderer={defaultStatusRenderer}\n onActionButtonClick={onActionButtonClickMemo}\n readCount={readCountForHoveredIndicator}\n participantCount={participantCount}\n /* @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n /* @conditional-compile-remove(mention) */\n mentionOptions={mentionOptions}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled={!!richTextEditorOptions}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={richTextEditorOptions?.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={richTextEditorOptions?.onInsertInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress={\n richTextEditorOptions?.messagesInlineImagesWithProgress &&\n richTextEditorOptions?.messagesInlineImagesWithProgress[message.message.messageId]\n }\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage={richTextEditorOptions?.onRemoveInlineImage}\n />\n );\n })}\n </Chat>\n </FluentV9ThemeProvider>\n </LiveAnnouncer>\n </div>\n );\n};\n\nconst MemoChatMessageComponentWrapper = React.memo((obj: ChatMessageComponentWrapperProps): JSX.Element => {\n return <ChatMessageComponentWrapper {...obj} />;\n});\n"]}
|
1
|
+
{"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageThread.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,IAAI,EAAU,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,I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under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Icon, IStyle, mergeStyles, PrimaryButton } from '@fluentui/react';\nimport { Chat } from '@fluentui-contrib/react-chat';\nimport { mergeClasses, useArrowNavigationGroup } from '@fluentui/react-components';\nimport {\n DownIconStyle,\n newMessageButtonContainerStyle,\n messageThreadContainerStyle,\n messageThreadWrapperContainerStyle,\n useChatStyles,\n buttonWithIconStyles,\n newMessageButtonStyle\n} from './styles/MessageThread.styles';\nimport { delay } from './utils/delay';\nimport {\n BaseCustomStyles,\n ChatMessage,\n CustomMessage,\n SystemMessage,\n OnRenderAvatarCallback,\n Message,\n ReadReceiptsBySenderId,\n ComponentSlotStyle\n} from '../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../types';\nimport { MessageStatusIndicatorProps } from './MessageStatusIndicator';\nimport { memoizeFnAll, MessageStatus } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport { isNarrowWidth, _useContainerWidth } from './utils/responsive';\nimport getParticipantsWhoHaveReadMessage from './utils/getParticipantsWhoHaveReadMessage';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentOptions } from '../types/Attachment';\nimport { useTheme } from '../theming';\nimport { FluentV9ThemeProvider } from './../theming/FluentV9ThemeProvider';\nimport LiveAnnouncer from './Announcer/LiveAnnouncer';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from './MentionPopover';\nimport { createStyleFromV8Style } from './styles/v8StyleShim';\nimport {\n ChatMessageComponentWrapper,\n ChatMessageComponentWrapperProps\n} from './ChatMessage/ChatMessageComponentWrapper';\nimport { InlineImageOptions } from './ChatMessage/ChatMessageContent';\nimport { MessageStatusIndicatorInternal } from './MessageStatusIndicatorInternal';\nimport { Announcer } from './Announcer';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextEditorOptions, RichTextStrings } from './RichTextEditor/RichTextSendBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { loadChatMessageComponentAsRichTextEditBox } from './ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker';\n\nconst isMessageSame = (first: ChatMessage, second: ChatMessage): boolean => {\n return (\n first.messageId === second.messageId &&\n first.content === second.content &&\n first.contentType === second.contentType &&\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\n first.senderId === second.senderId &&\n first.senderDisplayName === second.senderDisplayName &&\n JSON.stringify(first.editedOn) === JSON.stringify(second.editedOn)\n );\n};\n\n/**\n * Get the latest message from the message array.\n *\n * @param messages\n */\nconst getLatestChatMessage = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && !!message.createdOn) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\n * current user.\n */\nconst isThereNewMessageNotFromCurrentUser = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId !== userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId !== userId\n );\n};\n\n/**\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\n * updated this component due to current user sending a message we want to then call scrollToBottom.\n */\nconst didUserSendTheLatestMessage = (\n userId: string,\n latestMessageFromPreviousMessages?: ChatMessage,\n latestMessageFromNewMessages?: ChatMessage\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n }\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId === userId;\n }\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId === userId\n );\n};\n\n/**\n * Fluent styles for {@link MessageThread}.\n *\n * @public\n */\nexport interface MessageThreadStyles extends BaseCustomStyles {\n /** Styles for load previous messages container. */\n loadPreviousMessagesButtonContainer?: IStyle;\n /** Styles for new message container. */\n newMessageButtonContainer?: IStyle;\n /** Styles for chat container. */\n chatContainer?: ComponentSlotStyle;\n /** styles for my chat items. */\n myChatItemMessageContainer?: ComponentSlotStyle;\n /** styles for chat items. */\n chatItemMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container. */\n myChatMessageContainer?: ComponentSlotStyle;\n /** Styles for my chat message container in case of failure. */\n failedMyChatMessageContainer?: ComponentSlotStyle;\n /** Styles for chat message container. */\n chatMessageContainer?: ComponentSlotStyle;\n /** Styles for system message container. */\n systemMessageContainer?: ComponentSlotStyle;\n /** Styles for blocked message container. */\n /* @conditional-compile-remove(data-loss-prevention) */\n blockedMessageContainer?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\n}\n\n/**\n * Strings of {@link MessageThread} that can be overridden.\n *\n * @public\n */\nexport interface MessageThreadStrings {\n /** String for Sunday */\n sunday: string;\n /** String for Monday */\n monday: string;\n /** String for Tuesday */\n tuesday: string;\n /** String for Wednesday */\n wednesday: string;\n /** String for Thursday */\n thursday: string;\n /** String for Friday */\n friday: string;\n /** String for Saturday */\n saturday: string;\n /** String for Yesterday */\n yesterday: string;\n /** String for participants joined */\n participantJoined: string;\n /** String for participants left */\n participantLeft: string;\n /** Tag shown on a message that has been edited */\n editedTag: string;\n /** String for editing message in floating menu */\n editMessage: string;\n /** String for removing message in floating menu */\n removeMessage: string;\n /** String for resending failed message in floating menu */\n resendMessage?: string;\n /** String for indicating failed to send messages */\n failToSendTag?: string;\n /** String for LiveMessage introduction for the Chat Message */\n liveAuthorIntro: string;\n /** String for LiveMessage introduction for the edited Chat Message by remote user */\n editedMessageLiveAuthorIntro: string;\n /** String for LiveMessage introduction for the edited Chat Message sent by local user */\n editedMessageLocalUserLiveAuthorIntro: string;\n /** String for aria text of remote user's message content */\n messageContentAriaText: string;\n /** String for aria text of local user's message content */\n messageContentMineAriaText: string;\n /** String for warning on text limit exceeded in EditBox*/\n editBoxTextLimit: string;\n /** String for placeholder text in EditBox when there is no user input*/\n editBoxPlaceholderText: string;\n /** String for new messages indicator*/\n newMessagesIndicator: string;\n /** String for showing message read status in floating menu */\n messageReadCount?: string;\n /** String for replacing display name when there is none*/\n noDisplayNameSub: string;\n /** String for Cancel button in EditBox*/\n editBoxCancelButton: string;\n /** String for Submit in EditBox when there is no user input*/\n editBoxSubmitButton: string;\n /** String for action menu indicating there are more options */\n actionMenuMoreOptions?: string;\n /** Aria label to announce when a message is deleted */\n messageDeletedAnnouncementAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /** String for download attachment button in attachment card */\n downloadAttachment: string;\n /** String for open attachment button in attachment card */\n openAttachment: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal */\n blockedWarningText: string;\n /* @conditional-compile-remove(data-loss-prevention) */\n /** String for policy violation message removal details link */\n blockedWarningLinkText: string;\n /** String for aria text in attachment card group*/\n attachmentCardGroupMessage: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating that one or more image uploads are not complete.\n */\n imageUploadsPendingError: string;\n}\n\n/**\n * Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.\n *\n * @public\n */\nexport interface JumpToNewMessageButtonProps {\n /** String for button text */\n text: string;\n /** Callback for when button is clicked */\n onClick: () => void;\n}\n\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\n const { text, onClick } = props;\n return (\n <PrimaryButton\n className={newMessageButtonStyle}\n styles={buttonWithIconStyles}\n text={text}\n onClick={onClick}\n onRenderIcon={() => <Icon iconName=\"Down\" className={DownIconStyle} />}\n />\n );\n};\n\n/**\n * A component to render a single message.\n *\n * @public\n */\nexport type MessageRenderer = (props: MessageProps) => JSX.Element;\n\nconst memoizeAllMessages = memoizeFnAll(\n (\n message: Message,\n showMessageDate: boolean,\n showMessageStatus: boolean,\n strings: MessageThreadStrings,\n index: number,\n onUpdateMessage?: UpdateMessageCallback,\n onCancelEditMessage?: CancelEditCallback,\n onDeleteMessage?: (messageId: string) => Promise<void>,\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>,\n disableEditing?: boolean,\n lastSeenChatMessage?: string,\n lastSendingChatMessage?: string,\n lastDeliveredChatMessage?: string\n ): _ChatMessageProps => {\n let key: string | undefined = message.messageId;\n let statusToRender: MessageStatus | undefined = undefined;\n\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\n if ((!message.messageId || message.messageId === '') && 'clientMessageId' in message) {\n key = message.clientMessageId;\n }\n if (showMessageStatus && message.mine) {\n switch (message.messageId) {\n case lastSeenChatMessage: {\n statusToRender = 'seen';\n break;\n }\n case lastSendingChatMessage: {\n statusToRender = 'sending';\n break;\n }\n case lastDeliveredChatMessage: {\n statusToRender = 'delivered';\n break;\n }\n }\n }\n if (message.mine && message.status === 'failed') {\n statusToRender = 'failed';\n }\n }\n return {\n key: key ?? 'id_' + index,\n statusToRender,\n message,\n strings,\n showDate: showMessageDate,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n disableEditing,\n showMessageStatus\n };\n }\n);\n\nconst getLastChatMessageIdWithStatus = (messages: Message[], status: MessageStatus): string | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && message.status === status && message.mine) {\n return message.messageId;\n }\n }\n return undefined;\n};\n\nconst getLastChatMessageForCurrentUser = (messages: Message[]): ChatMessage | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message?.messageType === 'chat' && message.mine) {\n return message;\n }\n }\n return undefined;\n};\n\n/**\n * @public\n * Callback function run when a message is updated.\n */\nexport type UpdateMessageCallback = (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n) => Promise<void>;\n/**\n * @public\n * Callback function run when a message edit is cancelled.\n */\nexport type CancelEditCallback = (messageId: string) => void;\n\n/**\n * Props for {@link MessageThread}.\n *\n * @public\n */\nexport type MessageThreadProps = {\n /**\n * UserId of the current user.\n */\n userId: string;\n /**\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n messages: (\n | ChatMessage\n | SystemMessage\n | CustomMessage\n | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage\n )[];\n /**\n * number of participants in the thread\n */\n participantCount?: number;\n /**\n * read receipts for each sender in the chat\n */\n readReceiptsBySenderId?: ReadReceiptsBySenderId;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageThread styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: MessageThreadStyles;\n /**\n * Whether the new message button is disabled or not.\n *\n * @defaultValue `false`\n */\n disableJumpToNewMessageButton?: boolean;\n /**\n * Whether the date of each message is displayed or not.\n * It is ignored when onDisplayDateTimeString is supplied.\n *\n * @defaultValue `false`\n */\n showMessageDate?: boolean;\n /**\n * Whether the status indicator for each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageStatus?: boolean;\n /**\n * Number of chat messages to reload each time onLoadPreviousChatMessages is called.\n *\n * @defaultValue 0\n */\n numberOfChatMessagesToReload?: number;\n /**\n * Optional callback to override actions on message being seen.\n *\n * @param messageId - message Id\n */\n onMessageSeen?: (messageId: string) => Promise<void>;\n /**\n * Optional callback to override render of the message status indicator.\n *\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\n */\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional callback to override render of the button for jumping to the new message.\n *\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps 0 */\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\n /**\n * Optional callback to override loading of previous messages.\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\n */\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\n /**\n * Optional callback to override render of a message.\n *\n * @param messageProps - props of type {@link communication-react#MessageProps}\n * @param defaultOnRender - default render of type {@link communication-react#MessageRenderer}\n *\n * @remarks\n * `messageRenderer` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\n */\n onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message body to send\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n\n /**\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MessageThreadStrings>;\n\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * @beta\n * Optional attachment options, which defines behvaiour for uploading and downloading attachments.\n * As this moment, the uploadOptions would be ignored and this option is intended for download only.\n */\n attachmentOptions?: AttachmentOptions;\n\n /* @conditional-compile-remove(date-time-customization) */\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup a mention query and display mentions\n * @beta\n */\n mentionOptions?: MentionOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n\n /* @conditional-compile-remove(rich-text-editor) */\n /**\n * Options to enable rich text editor for the edit box.\n * @beta\n */\n richTextEditorOptions?: RichTextEditBoxOptions;\n};\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor edit box configuration.\n *\n * @beta\n */\nexport interface RichTextEditBoxOptions extends RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle an inline image that's inserted in the rich text editor.\n * When not provided, pasting images into rich text editor will be disabled.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']\n * @param messageId - the id of the message that the inlineImage belongs to.\n */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback invoked after inline image is removed from the UI.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].\n * Note that if the src attribute is a local blob url, it has been revoked at this point.\n * @param messageId - the id of the message that the inlineImage belongs to.\n */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Record of type {@link AttachmentMetadataInProgress}\n * to render the errorBar for inline images inserted in the MessageThread's edit boxes when:\n * - there is an error provided in the messagesInlineImagesWithProgress\n * - progress is less than 1 when the send button is clicked\n * - content html string is longer than the max allowed length.\n * (Note that the id and the url prop of the messagesInlineImagesWithProgress will be used as the id and src attribute of the content html\n * when calculating the content length, only for the purpose of displaying the content length overflow error.)\n */\n messagesInlineImagesWithProgress?: Record<string, AttachmentMetadataInProgress[]>;\n}\n\n/**\n * Props to render a single message.\n *\n * See {@link MessageRenderer}.\n *\n * @public\n */\nexport type MessageProps = {\n /**\n * Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.\n */\n message: Message;\n /**\n * Strings from parent MessageThread component\n */\n strings: MessageThreadStrings & /* @conditional-compile-remove(rich-text-editor) */ Partial<RichTextStrings>;\n /**\n * Custom CSS styles for chat message container.\n */\n messageContainerStyle?: ComponentSlotStyle;\n /**\n * Whether the date of a message is displayed or not.\n *\n * @defaultValue `false`\n */\n showDate?: boolean;\n /**\n * Disable editing messages.\n *\n * @remarks This removes the action menu on messages.\n *\n * @defaultValue `false`\n */\n disableEditing?: boolean;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n */\n onUpdateMessage?: UpdateMessageCallback;\n\n /**\n * Optional callback for when a message edit is cancelled.\n *\n * @param messageId - message id from chatClient\n */\n onCancelEditMessage?: CancelEditCallback;\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Optional callback to send a message.\n *\n * @param content - message content from chatClient\n * @param options - message options to be included in the message\n *\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type _ChatMessageProps = MessageProps & {\n key: string;\n statusToRender: MessageStatus | undefined;\n showMessageStatus?: boolean;\n};\n\n/**\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\n * @param props - of type MessageThreadProps\n *\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\n *\n * `MessageThread` internally uses the `Chat` component from `@fluentui-contrib/chat`. You can checkout the details about these components [here](https://microsoft.github.io/fluentui-contrib/react-chat/).\n *\n * @public\n */\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\n const theme = useTheme();\n\n const chatBody = useMemo(() => {\n return (\n <FluentV9ThemeProvider v8Theme={theme}>\n {/* Wrapper is required to call \"useClasses\" hook with proper context values */}\n <MessageThreadWrapper {...props} />\n </FluentV9ThemeProvider>\n );\n }, [theme, props]);\n\n return <div className={mergeStyles(messageThreadContainerStyle, props.styles?.root)}>{chatBody}</div>;\n};\n\n/**\n * @private\n */\nexport const MessageThreadWrapper = (props: MessageThreadProps): JSX.Element => {\n const {\n messages: newMessages,\n userId,\n participantCount,\n readReceiptsBySenderId,\n styles,\n disableJumpToNewMessageButton = false,\n showMessageDate = false,\n showMessageStatus = false,\n numberOfChatMessagesToReload = 5,\n onMessageSeen,\n onRenderMessageStatus,\n onRenderAvatar,\n onLoadPreviousChatMessages,\n onRenderJumpToNewMessageButton,\n onRenderMessage,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessage,\n onSendMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditorOptions\n } = props;\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const [forceUpdate, setForceUpdate] = useState<number>(0);\n\n // Used to decide if should auto scroll to bottom or show \"new message\" button\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessage | undefined>(undefined);\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\n\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\n\n // readCount and participantCount will only need to be updated on-fly when user hover on an indicator\n const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = useState<number | undefined>(undefined);\n\n const localeStrings = useLocale().strings.messageThread;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n // it is required to use useState for messages\n // as the scrolling logic requires re - render at a specific point in time\n const [messages, setMessages] = useState<Message[]>([]);\n\n // id for the latest deleted message\n const [latestDeletedMessageId, setLatestDeletedMessageId] = useState<string | undefined>(undefined);\n // this value is used to check if a message is deleted for the previous value of messages array\n const previousMessagesRef = useRef<Message[]>([]);\n // an aria label for Narrator to notify when a message is deleted\n const [deletedMessageAriaLabel, setDeletedMessageAriaLabel] = useState<string | undefined>(undefined);\n /* @conditional-compile-remove(rich-text-editor) */\n useEffect(() => {\n // if rich text editor is enabled, the rich text editor component should be loaded early for good UX\n if (richTextEditorOptions !== undefined) {\n // this line is needed to load the Rooster JS dependencies early in the lifecycle\n // when the rich text editor is enabled\n loadChatMessageComponentAsRichTextEditBox();\n }\n }, [richTextEditorOptions]);\n\n const onDeleteMessageCallback = useCallback(\n async (messageId: string): Promise<void> => {\n if (!onDeleteMessage) {\n return;\n }\n try {\n // reset deleted message label in case if there was a value already (messages are deleted 1 after another)\n setDeletedMessageAriaLabel(undefined);\n setLatestDeletedMessageId(messageId);\n lastChatMessageStatus.current = 'deleted';\n // we should set up latestDeletedMessageId before the onDeleteMessage call\n // as otherwise in very rare cases the messages array can be updated before latestDeletedMessageId\n await onDeleteMessage(messageId);\n } catch (e) {\n console.log('onDeleteMessage failed: messageId', messageId, 'error', e);\n }\n },\n [onDeleteMessage]\n );\n\n const isAllChatMessagesLoadedRef = useRef(false);\n // isAllChatMessagesLoadedRef needs to be updated every time when a new adapter is set in order to display correct data\n // onLoadPreviousChatMessages is updated when a new adapter is set\n useEffect(() => {\n if (onLoadPreviousChatMessages) {\n isAllChatMessagesLoadedRef.current = false;\n }\n }, [onLoadPreviousChatMessages]);\n\n const previousTopRef = useRef<number>(-1);\n const previousHeightRef = useRef<number>(-1);\n\n const messageIdSeenByMeRef = useRef<string>('');\n\n const chatScrollDivRef = useRef<HTMLDivElement>(null);\n const isLoadingChatMessagesRef = useRef(false);\n\n useEffect(() => {\n if (latestDeletedMessageId === undefined) {\n setDeletedMessageAriaLabel(undefined);\n } else {\n if (!previousMessagesRef.current.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in previousMessagesRef\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n } else if (!messages.find((message) => message.messageId === latestDeletedMessageId)) {\n // the message is deleted in messages array but still exists in previousMessagesRef\n // update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(strings.messageDeletedAnnouncementAriaLabel);\n } else {\n // the message exists in both arrays\n // no need to update deletedMessageAriaLabel\n setDeletedMessageAriaLabel(undefined);\n }\n }\n previousMessagesRef.current = messages;\n }, [latestDeletedMessageId, messages, strings.messageDeletedAnnouncementAriaLabel]);\n\n const messagesRef = useRef(messages);\n const setMessagesRef = (messagesWithAttachedValue: Message[]): void => {\n messagesRef.current = messagesWithAttachedValue;\n setMessages(messagesWithAttachedValue);\n };\n\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\n };\n\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\n chatMessagesInitializedRef.current = chatMessagesInitialized;\n setChatMessagesInitialized(chatMessagesInitialized);\n };\n\n const chatThreadRef = useRef<HTMLDivElement>(null);\n\n // When the chat thread is narrow, we perform space optimizations such as overlapping\n // the avatar on top of the chat message and moving the chat accept/reject edit buttons\n // to a new line\n const chatThreadWidth = _useContainerWidth(chatThreadRef);\n const isNarrow = chatThreadWidth ? isNarrowWidth(chatThreadWidth) : false;\n\n /**\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\n */\n const clientHeight = chatThreadRef.current?.clientHeight;\n\n // we try to only send those message status if user is scrolled to the bottom.\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\n if (\n !isAtBottomOfScrollRef.current ||\n !document.hasFocus() ||\n !messagesRef.current ||\n messagesRef.current.length === 0 ||\n !showMessageStatus\n ) {\n return;\n }\n const messagesWithId = messagesRef.current.filter((message) => {\n return message.messageType === 'chat' && !message.mine && !!message.messageId;\n });\n if (messagesWithId.length === 0) {\n return;\n }\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\n try {\n if (\n onMessageSeen &&\n lastMessage &&\n lastMessage.messageId &&\n lastMessage.messageId !== messageIdSeenByMeRef.current\n ) {\n await onMessageSeen(lastMessage.messageId);\n messageIdSeenByMeRef.current = lastMessage.messageId;\n }\n } catch (e) {\n console.log('onMessageSeen Error', lastMessage, e);\n }\n }, [showMessageStatus, onMessageSeen]);\n\n const scrollToBottom = useCallback((): void => {\n if (chatScrollDivRef.current) {\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\n }\n setExistsNewChatMessage(false);\n setIsAtBottomOfScrollRef(true);\n sendMessageStatusIfAtBottom();\n }, [sendMessageStatusIfAtBottom]);\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n const atBottom =\n Math.ceil(chatScrollDivRef.current.scrollTop) >=\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\n if (atBottom) {\n sendMessageStatusIfAtBottom();\n if (!isAtBottomOfScrollRef.current) {\n scrollToBottom();\n }\n }\n setIsAtBottomOfScrollRef(atBottom);\n }, [scrollToBottom, sendMessageStatusIfAtBottom]);\n\n // Infinite scrolling + threadInitialize function\n const fetchNewMessageWhenAtTop = useCallback(async () => {\n if (!isLoadingChatMessagesRef.current) {\n if (onLoadPreviousChatMessages) {\n isLoadingChatMessagesRef.current = true;\n try {\n // Fetch message until scrollTop reach the threshold for fetching new message\n while (\n !isAllChatMessagesLoadedRef.current &&\n chatScrollDivRef.current &&\n chatScrollDivRef.current.scrollTop <= 500\n ) {\n isAllChatMessagesLoadedRef.current = await onLoadPreviousChatMessages(numberOfChatMessagesToReload);\n await delay(200);\n }\n } finally {\n // Set isLoadingChatMessagesRef to false after messages are fetched\n isLoadingChatMessagesRef.current = false;\n }\n }\n }\n }, [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);\n\n // The below 2 of useEffects are design for fixing infinite scrolling problem\n // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)\n // we need to get previousTop before it prepend contents\n // Execute order [newMessage useEffect] => get previousTop => dom update => [messages useEffect]\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n previousTopRef.current = chatScrollDivRef.current.scrollTop;\n previousHeightRef.current = chatScrollDivRef.current.scrollHeight;\n }, [newMessages]);\n\n useEffect(() => {\n if (!chatScrollDivRef.current) {\n return;\n }\n chatScrollDivRef.current.scrollTop =\n chatScrollDivRef.current.scrollHeight - (previousHeightRef.current - previousTopRef.current);\n }, [messages]);\n\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\n useEffect(() => {\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n /**\n * One time run useEffects. Sets up listeners when component is mounted and tears down listeners when component\n * unmounts unless these function changed\n */\n useEffect(() => {\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\n return () => {\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\n };\n }, [sendMessageStatusIfAtBottom]);\n\n useEffect(() => {\n const chatScrollDiv = chatScrollDivRef.current;\n chatScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.addEventListener('scroll', fetchNewMessageWhenAtTop);\n\n return () => {\n chatScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.removeEventListener('scroll', fetchNewMessageWhenAtTop);\n };\n }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);\n\n useEffect(() => {\n if (clientHeight === undefined) {\n setForceUpdate(forceUpdate + 1);\n return;\n }\n // Only scroll to bottom if isAtBottomOfScrollRef is true\n isAtBottomOfScrollRef.current && scrollToBottom();\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\n useEffect(() => {\n const newStatus = getLastChatMessageForCurrentUser(newMessages)?.status;\n if (newStatus !== undefined) {\n if (lastChatMessageStatus.current === 'deleted' && newStatus === 'sending') {\n // enforce message life cycle\n // message status should always be [ sending -> delivered -> seen (optional) -> deleted ] or [sending -> failed -> deleted]\n // not any other way around\n // therefore, if current message status is deleted, we should only update it if newStatus is sending\n lastChatMessageStatus.current = newStatus;\n } else if (lastChatMessageStatus.current !== 'deleted') {\n lastChatMessageStatus.current = newStatus;\n }\n }\n // The hook should depend on newMessages not on messages as otherwise it will skip the sending status for a first message\n }, [newMessages]);\n\n /**\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\n * These two states are used to manipulate scrollbar\n */\n useEffect(() => {\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\n setMessagesRef(newMessages);\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\n }, [newMessages]);\n\n /**\n * This needs to run after messages are rendered so we can manipulate the scroll bar.\n */\n useEffect(() => {\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\n if (\n isThereNewMessageNotFromCurrentUser(userId, latestPreviousChatMessage, latestCurrentChatMessage) &&\n !isAtBottomOfScrollRef.current\n ) {\n setExistsNewChatMessage(true);\n } else if (\n didUserSendTheLatestMessage(userId, latestPreviousChatMessage, latestCurrentChatMessage) ||\n isAtBottomOfScrollRef.current\n ) {\n scrollToBottom();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n const lastChatMessageStatus = useRef<string | undefined>(undefined);\n const participantCountRef = useRef(participantCount);\n const readReceiptsBySenderIdRef = useRef(readReceiptsBySenderId);\n\n participantCountRef.current = participantCount;\n readReceiptsBySenderIdRef.current = readReceiptsBySenderId;\n\n const onActionButtonClickMemo = useCallback(\n (message: ChatMessage, setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void) => {\n if (participantCountRef.current && participantCountRef.current - 1 > 1 && readReceiptsBySenderIdRef.current) {\n setMessageReadBy(getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current));\n }\n },\n []\n );\n\n const defaultStatusRenderer = useCallback(\n (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => {\n // we should only announce label if the message status isn't deleted\n // because after message is deleted, we now need to render statusIndicator for previous messages\n // and their status has been announced already and we should not announce them again\n const shouldAnnounce = lastChatMessageStatus.current !== 'deleted';\n\n const onToggleToolTip = (isToggled: boolean): void => {\n if (isToggled && readReceiptsBySenderIdRef.current) {\n setReadCountForHoveredIndicator(\n getParticipantsWhoHaveReadMessage(message, readReceiptsBySenderIdRef.current).length\n );\n } else {\n setReadCountForHoveredIndicator(undefined);\n }\n };\n return (\n <MessageStatusIndicatorInternal\n status={status}\n readCount={readCount}\n onToggleToolTip={onToggleToolTip}\n // -1 because participant count does not include myself\n remoteParticipantsCount={participantCount ? participantCount - 1 : 0}\n shouldAnnounce={shouldAnnounce}\n />\n );\n },\n []\n );\n\n const theme = useTheme();\n\n const messagesToDisplay = useMemo(() => {\n return memoizeAllMessages((memoizedMessageFn) => {\n return messages.map((message: Message, index: number): _ChatMessageProps => {\n return memoizedMessageFn(\n message,\n showMessageDate,\n showMessageStatus,\n strings,\n index,\n onUpdateMessage,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n props.disableEditing,\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage\n );\n });\n });\n }, [\n lastDeliveredChatMessage,\n lastSeenChatMessage,\n lastSendingChatMessage,\n messages,\n onCancelEditMessage,\n onDeleteMessageCallback,\n onSendMessage,\n onUpdateMessage,\n props.disableEditing,\n showMessageDate,\n showMessageStatus,\n strings\n ]);\n\n const classes = useChatStyles();\n const chatArrowNavigationAttributes = useArrowNavigationGroup({ axis: 'vertical', memorizeCurrent: false });\n\n return (\n <div className={mergeStyles(messageThreadWrapperContainerStyle)} ref={chatThreadRef}>\n {/* Always ensure New Messages button is above the chat body element in the DOM tree. This is to ensure correct\n tab ordering. Because the New Messages button floats on top of the chat body it is in a higher z-index and\n thus Users should be able to tab navigate to the new messages button _before_ tab focus is taken to the chat body.*/}\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\n {onRenderJumpToNewMessageButton ? (\n onRenderJumpToNewMessageButton({ text: strings.newMessagesIndicator, onClick: scrollToBottom })\n ) : (\n <DefaultJumpToNewMessageButton text={strings.newMessagesIndicator} onClick={scrollToBottom} />\n )}\n </div>\n )}\n <LiveAnnouncer>\n <FluentV9ThemeProvider v8Theme={theme}>\n <Chat\n // styles?.chatContainer used in className and style prop as style prop can't handle CSS selectors\n className={mergeClasses(classes.root, mergeStyles(styles?.chatContainer))}\n ref={chatScrollDivRef}\n style={{ ...createStyleFromV8Style(styles?.chatContainer) }}\n {...chatArrowNavigationAttributes}\n >\n {latestDeletedMessageId && (\n <Announcer\n key={latestDeletedMessageId}\n announcementString={deletedMessageAriaLabel}\n ariaLive={'polite'}\n />\n )}\n {messagesToDisplay.map((message: _ChatMessageProps): JSX.Element => {\n return (\n <MemoChatMessageComponentWrapper\n {...message}\n userId={userId}\n key={message.key}\n styles={styles}\n shouldOverlapAvatarAndMessage={isNarrow}\n strings={strings}\n onRenderAvatar={onRenderAvatar}\n onRenderMessage={onRenderMessage}\n onRenderMessageStatus={onRenderMessageStatus}\n defaultStatusRenderer={defaultStatusRenderer}\n onActionButtonClick={onActionButtonClickMemo}\n readCount={readCountForHoveredIndicator}\n participantCount={participantCount}\n /* @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n /* @conditional-compile-remove(mention) */\n mentionOptions={mentionOptions}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled={!!richTextEditorOptions}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={richTextEditorOptions?.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={richTextEditorOptions?.onInsertInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress={\n richTextEditorOptions?.messagesInlineImagesWithProgress &&\n richTextEditorOptions?.messagesInlineImagesWithProgress[message.message.messageId]\n }\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage={richTextEditorOptions?.onRemoveInlineImage}\n />\n );\n })}\n </Chat>\n </FluentV9ThemeProvider>\n </LiveAnnouncer>\n </div>\n );\n};\n\nconst MemoChatMessageComponentWrapper = React.memo((obj: ChatMessageComponentWrapperProps): JSX.Element => {\n return <ChatMessageComponentWrapper {...obj} />;\n});\n"]}
|