@azure/communication-react 1.21.0-alpha-202410210016 → 1.21.0-alpha-202410220016

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.
Files changed (48) hide show
  1. package/dist/communication-react.d.ts +9 -1
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CskWqSjD.js → ChatMessageComponentAsRichTextEditBox-DUDmkZ-m.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CskWqSjD.js.map → ChatMessageComponentAsRichTextEditBox-DUDmkZ-m.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BmT4tjtB.js → RichTextSendBoxWrapper-BDR_vyKj.js} +3 -3
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BmT4tjtB.js.map → RichTextSendBoxWrapper-BDR_vyKj.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-CsAc6QmC.js → index-BgsEEH3L.js} +64 -115
  7. package/dist/dist-cjs/communication-react/index-BgsEEH3L.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  12. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +0 -6
  13. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  14. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  15. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.d.ts +1 -1
  16. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +1 -15
  17. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
  18. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
  20. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +2 -8
  21. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +1 -2
  23. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +4 -12
  24. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  25. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +4 -19
  26. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
  27. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  29. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +4 -12
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +4 -24
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  34. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +8 -0
  35. package/dist/dist-esm/react-components/src/components/VideoTile.js +16 -5
  36. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +3 -15
  38. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  39. package/dist/dist-esm/react-components/src/components/utils.d.ts +5 -0
  40. package/dist/dist-esm/react-components/src/components/utils.js +21 -0
  41. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +5 -1
  43. package/dist/dist-esm/react-components/src/theming/icons.js +2 -19
  44. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  45. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -2
  46. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  47. package/package.json +1 -1
  48. package/dist/dist-cjs/communication-react/index-CsAc6QmC.js.map +0 -1
@@ -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,EAAE,aAAa,EAAE,sCAAgC;AACxD,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,iBAAiB,CAAC;AAElD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,0CAA0C;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,SAAS,MAAM,WAAW,CAAC;AAIlC,uDAAuD;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAg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,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 { _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(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\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 let attachments = undefined;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachments = props.message.attachments;\n if (props.message.content || 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 /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n if (attachments && 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\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst attachmentCardGroupDescription = (props: ChatMessageContentProps): string => {\n const attachments = props.message.attachments;\n return getAttachmentCountLiveMessage(attachments ?? [], props.strings.attachmentCardGroupMessage);\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\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 return '';\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., &#65;)\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.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,iBAAiB,CAAC;AAElD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,0CAA0C;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,uDAAuD;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAmD1E,eAAe;AACf,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAe,EAAE;IAChF,QAAQ,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAClC,KAAK,MAAM;YACT,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACrC,KAAK,MAAM;YACT,OAAO,4BAA4B,CAAC,KAAK,CAAC,CAAC;QAC7C,KAAK,eAAe;YAClB,OAAO,4BAA4B,CAAC,KAAK,CAAC,CAAC;Q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BACnC,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 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 return '';\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., &#65;)\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"]}
@@ -3,8 +3,7 @@ import { InlineImageOptions } from '../ChatMessageContent';
3
3
  import { ChatMessage } from '../../../types/ChatMessage';
4
4
  import { BlockedMessage } from '../../../types/ChatMessage';
5
5
  import { MessageThreadStrings } from '../../MessageThread';
6
- import { ComponentSlotStyle } from '../../../types';
7
- import { AttachmentMenuAction } from '../../../types';
6
+ import { AttachmentMenuAction, ComponentSlotStyle } from '../../../types';
8
7
  import { AttachmentMetadata } from "../../../../../acs-ui-common/src";
9
8
  import { MentionDisplayOptions } from '../../MentionPopover';
10
9
  type ChatMessageComponentAsMessageBubbleProps = {
@@ -18,11 +18,7 @@ const MessageBubble = (props) => {
18
18
  const ids = useIdentifiers();
19
19
  const theme = useTheme();
20
20
  const locale = useLocale();
21
- const { userId, message, showDate, messageContainerStyle, strings,
22
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
23
- onRenderAttachmentDownloads, inlineImageOptions, shouldOverlapAvatarAndMessage,
24
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
25
- actionsForAttachment,
21
+ const { userId, message, showDate, messageContainerStyle, strings, onRenderAttachmentDownloads, inlineImageOptions, shouldOverlapAvatarAndMessage, actionsForAttachment,
26
22
  /* @conditional-compile-remove(mention) */
27
23
  mentionDisplayOptions, onDisplayDateTimeString } = props;
28
24
  const formattedTimestamp = useMemo(() => {
@@ -40,17 +36,13 @@ const MessageBubble = (props) => {
40
36
  const getContent = useCallback(() => {
41
37
  return getMessageBubbleContent(message, strings, userId, inlineImageOptions,
42
38
  /* @conditional-compile-remove(mention) */
43
- mentionDisplayOptions,
44
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
45
- onRenderAttachmentDownloads,
46
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
47
- actionsForAttachment);
39
+ mentionDisplayOptions, onRenderAttachmentDownloads, actionsForAttachment);
48
40
  }, [
49
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ actionsForAttachment,
41
+ actionsForAttachment,
50
42
  inlineImageOptions,
51
43
  /* @conditional-compile-remove(mention) */ mentionDisplayOptions,
52
44
  message,
53
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentDownloads,
45
+ onRenderAttachmentDownloads,
54
46
  strings,
55
47
  userId
56
48
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA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AAI,IAAC,SAAS,EAAE,sBAAsB,IAAG,OAAO,CAAC,iBAAiB,CAAQ,EACnF,IAAI,EAAE;oBACJ,SAAS,EAAE,iCAAiC;oBAC5C,KAAK,oBAAO,sBAAsB,CAAC,qBAAqB,CAAC,CAAE;iBAC5D,iBACW,wBAAwB,EACpC,SAAS,EACP,oBAAC,IAAI,IACH,SAAS,EACP,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,gBAEzF,GAAG,CAAC,gBAAgB,IAE/B,kBAAkB,CACd,EAET,OAAO,EAAE,iBAAiB,EAAE,IAE3B,UAAU,EAAE,CACK,CAChB,CACL,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport {\n chatMessageDateStyle,\n chatMessageAuthorStyle,\n chatMessageDateFailedStyle\n} from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ComponentSlotStyle } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMenuAction } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n strings: MessageThreadStrings;\n userId: string;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\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 display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n showDate,\n messageContainerStyle,\n strings,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n inlineImageOptions,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n const getMessageDetails = useCallback(() => {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }, [strings.editedTag, theme, message]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n const chatMessageStyles = useChatMessageStyles();\n const chatItemMessageContainerClassName = mergeClasses(\n chatMessageCommonStyles.body,\n chatMessageStyles.body,\n // disable placeholder functionality for GA releases as it might confuse users\n chatMessageCommonStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasMultipleAttachments ? chatMessageStyles.multipleAttachments : undefined,\n message.attached === 'top' || message.attached === false\n ? chatMessageStyles.bodyWithAvatar\n : chatMessageStyles.bodyWithoutAvatar,\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n mergeStyles(messageContainerStyle)\n );\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <FluentChatMessage\n attached={attached}\n key={props.message.messageId}\n root={{\n className: chatMessageStyles.root\n }}\n author={<Text className={chatMessageAuthorStyle}>{message.senderDisplayName}</Text>}\n body={{\n className: chatItemMessageContainerClassName,\n style: { ...createStyleFromV8Style(messageContainerStyle) }\n }}\n data-testid=\"chat-composite-message\"\n timestamp={\n <Text\n className={\n props.message.status === 'failed' ? chatMessageDateFailedStyle(theme) : chatMessageDateStyle(theme)\n }\n data-ui-id={ids.messageTimestamp}\n >\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n >\n {getContent()}\n </FluentChatMessage>\n </div>\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAS5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACrG,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,mDAAmD;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAsCvG,eAAe;AACf,MAAM,aAAa,GAAG,CAAC,KAA+C,EAAe,EAAE;IACrF,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,MAAM,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,2BAA2B,EAC3B,kBA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,OAAO,CAAC,SAAS;YAC/B,oBAAC,iBAAiB,IAChB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,EAC5B,IAAI,EAAE;oBACJ,SAAS,EAAE,iBAAiB,CAAC,IAAI;iBAClC,EACD,MAAM,EAAE,oBAAC,IAAI,IAAC,SAAS,EAAE,sBAAsB,IAAG,OAAO,CAAC,iBAAiB,CAAQ,EACnF,IAAI,EAAE;oBACJ,SAAS,EAAE,iCAAiC;oBAC5C,KAAK,oBAAO,sBAAsB,CAAC,qBAAqB,CAAC,CAAE;iBAC5D,iBACW,wBAAwB,EACpC,SAAS,EACP,oBAAC,IAAI,IACH,SAAS,EACP,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,gBAEzF,GAAG,CAAC,gBAAgB,IAE/B,kBAAkB,CACd,EAET,OAAO,EAAE,iBAAiB,EAAE,IAE3B,UAAU,EAAE,CACK,CAChB,CACL,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport {\n chatMessageDateStyle,\n chatMessageAuthorStyle,\n chatMessageDateFailedStyle\n} from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { AttachmentMenuAction, ComponentSlotStyle } from '../../../types';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n strings: MessageThreadStrings;\n userId: string;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\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 display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n showDate,\n messageContainerStyle,\n strings,\n onRenderAttachmentDownloads,\n inlineImageOptions,\n shouldOverlapAvatarAndMessage,\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n const getMessageDetails = useCallback(() => {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }, [strings.editedTag, theme, message]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onRenderAttachmentDownloads,\n actionsForAttachment\n );\n }, [\n actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n const chatMessageStyles = useChatMessageStyles();\n const chatItemMessageContainerClassName = mergeClasses(\n chatMessageCommonStyles.body,\n chatMessageStyles.body,\n // disable placeholder functionality for GA releases as it might confuse users\n chatMessageCommonStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasMultipleAttachments ? chatMessageStyles.multipleAttachments : undefined,\n message.attached === 'top' || message.attached === false\n ? chatMessageStyles.bodyWithAvatar\n : chatMessageStyles.bodyWithoutAvatar,\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n mergeStyles(messageContainerStyle)\n );\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <FluentChatMessage\n attached={attached}\n key={props.message.messageId}\n root={{\n className: chatMessageStyles.root\n }}\n author={<Text className={chatMessageAuthorStyle}>{message.senderDisplayName}</Text>}\n body={{\n className: chatItemMessageContainerClassName,\n style: { ...createStyleFromV8Style(messageContainerStyle) }\n }}\n data-testid=\"chat-composite-message\"\n timestamp={\n <Text\n className={\n props.message.status === 'failed' ? chatMessageDateFailedStyle(theme) : chatMessageDateStyle(theme)\n }\n data-ui-id={ids.messageTimestamp}\n >\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n >\n {getContent()}\n </FluentChatMessage>\n </div>\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
@@ -19,44 +19,29 @@ import { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMes
19
19
  export const FluentChatMessageComponent = (props) => {
20
20
  const { message, styles, shouldOverlapAvatarAndMessage, onRenderMessage, onRenderAvatar,
21
21
  /* @conditional-compile-remove(date-time-customization) */
22
- onDisplayDateTimeString, inlineImageOptions,
23
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
24
- actionsForAttachment, userId,
25
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
26
- onRenderAttachmentDownloads,
22
+ onDisplayDateTimeString, inlineImageOptions, actionsForAttachment, userId, onRenderAttachmentDownloads,
27
23
  /* @conditional-compile-remove(mention) */
28
24
  mentionOptions } = props;
29
25
  const chatMessageRenderStyles = useChatMessageRenderStyles();
30
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
31
- const onRenderAttachmentDownloadsMemo = useMemo(() => {
32
- return onRenderAttachmentDownloads;
33
- return undefined;
34
- }, [onRenderAttachmentDownloads]);
35
26
  // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp
36
27
  // needs to be regenerated), the dependency on "new Date().toDateString()"" is added.
37
28
  const defaultChatMessageRenderer = useCallback((messageProps) => {
38
29
  if (messageProps.message.messageType === 'chat' ||
39
30
  /* @conditional-compile-remove(data-loss-prevention) */ messageProps.message.messageType === 'blocked') {
40
- return (React.createElement(ChatMessageComponentAsMessageBubble, Object.assign({}, messageProps, {
41
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
42
- onRenderAttachmentDownloads: onRenderAttachmentDownloadsMemo, strings: messageProps.strings, message: messageProps.message, userId: userId, shouldOverlapAvatarAndMessage: shouldOverlapAvatarAndMessage,
31
+ return (React.createElement(ChatMessageComponentAsMessageBubble, Object.assign({}, messageProps, { onRenderAttachmentDownloads: onRenderAttachmentDownloads, strings: messageProps.strings, message: messageProps.message, userId: userId, shouldOverlapAvatarAndMessage: shouldOverlapAvatarAndMessage,
43
32
  /* @conditional-compile-remove(date-time-customization) */
44
- onDisplayDateTimeString: onDisplayDateTimeString, inlineImageOptions: inlineImageOptions,
45
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
46
- actionsForAttachment: actionsForAttachment,
33
+ onDisplayDateTimeString: onDisplayDateTimeString, inlineImageOptions: inlineImageOptions, actionsForAttachment: actionsForAttachment,
47
34
  /* @conditional-compile-remove(mention) */
48
35
  mentionDisplayOptions: mentionOptions === null || mentionOptions === void 0 ? void 0 : mentionOptions.displayOptions })));
49
36
  }
50
37
  return React.createElement(React.Fragment, null);
51
38
  }, [
52
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
53
- onRenderAttachmentDownloadsMemo,
39
+ onRenderAttachmentDownloads,
54
40
  userId,
55
41
  shouldOverlapAvatarAndMessage,
56
42
  /* @conditional-compile-remove(date-time-customization) */
57
43
  onDisplayDateTimeString,
58
44
  inlineImageOptions,
59
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
60
45
  actionsForAttachment,
61
46
  /* @conditional-compile-remove(mention) */
62
47
  mentionOptions === null || mentionOptions === void 0 ? void 0 : mentionOptions.displayOptions
@@ -1 +1 @@
1
- {"version":3,"file":"FluentChatMessageComponent.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAY,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAKjF,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAW5F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,KAA6C,EAAe,EAAE;IACvG,MAAM,EACJ,OAAO,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BAAsB,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE;SACjH,CAAC;IACJ,CAAC,EAAE;QACD,uBAAuB,CAAC,UAAU;QAClC,uBAAuB,CAAC,iBAAiB;QACzC,uBAAuB,CAAC,gBAAgB;QACxC,uBAAuB,CAAC,cAAc;QACtC,uBAAuB,CAAC,aAAa;QACrC,uBAAuB,CAAC,eAAe;QACvC,gBAAgB;QAChB,MAAM;QACN,6BAA6B;QAC7B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB;KACjC,CAAC,CAAC;IAEH,8EAA8E;IAC9E,uFAAuF;IACvF,iFAAiF;IACjF,gEAAgE;IAChE,OAAO,CACL,oBAAC,iBAAiB,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAClG,eAAe,mBAAM,KAAK,EAAG,CACZ,CACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport { MessageProps, _ChatMessageProps } from '../../MessageThread';\nimport {\n gutterWithAvatar,\n gutterWithHiddenAvatar,\n useChatMessageRenderStyles\n} from '../../styles/MessageThread.styles';\nimport { IPersona, PersonaSize, mergeStyles, Persona } from '@fluentui/react';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { getFluentUIAttachedValue } from '../../utils/ChatMessageComponentUtils';\nimport { ChatMessageComponentWrapperProps } from '../ChatMessageComponentWrapper';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { ChatMessage } from '../../../types/ChatMessage';\nimport { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMessageBubble';\n\n/**\n * Props for {@link FluentChatMessageComponentWrapper}\n *\n * @private\n */\nexport type FluentChatMessageComponentWrapperProps = ChatMessageComponentWrapperProps & {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n};\n\n/**\n * The component for rendering a chat message using Fluent UI components\n * and handling default and custom renderers.\n * This component handles rendering for chat message body, avatar and message status.\n * The chat message body, avatar and message status should be shown for both default and custom renderers.\n *\n * @private\n */\nexport const FluentChatMessageComponent = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n const {\n message,\n styles,\n shouldOverlapAvatarAndMessage,\n onRenderMessage,\n onRenderAvatar,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment,\n userId,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(mention) */\n mentionOptions\n } = props;\n const chatMessageRenderStyles = useChatMessageRenderStyles();\n\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentDownloadsMemo = useMemo(() => {\n return onRenderAttachmentDownloads;\n return undefined;\n }, [onRenderAttachmentDownloads]);\n\n // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp\n // needs to be regenerated), the dependency on \"new Date().toDateString()\"\" is added.\n const defaultChatMessageRenderer = useCallback(\n (messageProps: MessageProps) => {\n if (\n messageProps.message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ messageProps.message.messageType === 'blocked'\n ) {\n return (\n <ChatMessageComponentAsMessageBubble\n {...messageProps}\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloadsMemo}\n strings={messageProps.strings}\n message={messageProps.message}\n userId={userId}\n shouldOverlapAvatarAndMessage={shouldOverlapAvatarAndMessage}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment={actionsForAttachment}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={mentionOptions?.displayOptions}\n />\n );\n }\n return <></>;\n },\n [\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloadsMemo,\n userId,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n inlineImageOptions,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionOptions?.displayOptions\n ]\n );\n\n const messageRenderer = useCallback(\n (messageProps: MessageProps) => {\n return onRenderMessage === undefined\n ? defaultChatMessageRenderer({ ...messageProps })\n : onRenderMessage(messageProps, defaultChatMessageRenderer);\n },\n [defaultChatMessageRenderer, onRenderMessage]\n );\n\n const shouldShowAvatar = useMemo(() => {\n return message.attached === 'top' || message.attached === false;\n }, [message.attached]);\n\n const attached = useMemo(() => {\n return getFluentUIAttachedValue(message.attached);\n }, [message.attached]);\n\n const messageRootProps = useMemo(() => {\n return { className: mergeClasses(chatMessageRenderStyles.rootMessage, chatMessageRenderStyles.rootCommon) };\n }, [chatMessageRenderStyles.rootCommon, chatMessageRenderStyles.rootMessage]);\n\n const avatar = useMemo(() => {\n const chatAvatarStyle = shouldShowAvatar ? gutterWithAvatar : gutterWithHiddenAvatar;\n const personaOptions: IPersona = {\n hidePersonaDetails: true,\n size: PersonaSize.size32,\n text: message.senderDisplayName,\n showOverflowTooltip: false\n };\n let renderedAvatar;\n if (onRenderAvatar) {\n const avatarComponent = onRenderAvatar?.(message.senderId, personaOptions);\n if (!avatarComponent) {\n return undefined;\n } else {\n renderedAvatar = avatarComponent;\n }\n }\n return (\n <div className={mergeStyles(chatAvatarStyle)}>\n {renderedAvatar ? renderedAvatar : <Persona {...personaOptions} />}\n </div>\n );\n }, [message.senderDisplayName, message.senderId, onRenderAvatar, shouldShowAvatar]);\n\n const messageBodyProps = useMemo(() => {\n return {\n // chatItemMessageContainer used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageRenderStyles.bodyCommon,\n !shouldShowAvatar\n ? avatar\n ? chatMessageRenderStyles.bodyWithoutAvatar\n : chatMessageRenderStyles.bodyHiddenAvatar\n : chatMessageRenderStyles.bodyWithAvatar,\n shouldOverlapAvatarAndMessage ? chatMessageRenderStyles.avatarOverlap : chatMessageRenderStyles.avatarNoOverlap,\n mergeStyles(styles?.chatItemMessageContainer)\n ),\n style:\n styles?.chatItemMessageContainer !== undefined ? createStyleFromV8Style(styles?.chatItemMessageContainer) : {}\n };\n }, [\n chatMessageRenderStyles.bodyCommon,\n chatMessageRenderStyles.bodyWithoutAvatar,\n chatMessageRenderStyles.bodyHiddenAvatar,\n chatMessageRenderStyles.bodyWithAvatar,\n chatMessageRenderStyles.avatarOverlap,\n chatMessageRenderStyles.avatarNoOverlap,\n shouldShowAvatar,\n avatar,\n shouldOverlapAvatarAndMessage,\n styles?.chatItemMessageContainer\n ]);\n\n // Fluent UI message components are used here as for default message renderer,\n // timestamp and author name should be shown but they aren't shown for custom renderer.\n // More investigations are needed to check if this can be simplified with states.\n // Avatar should be shown for both custom and default renderers.\n return (\n <FluentChatMessage attached={attached} root={messageRootProps} body={messageBodyProps} avatar={avatar}>\n {messageRenderer({ ...props })}\n </FluentChatMessage>\n );\n};\n"]}
1
+ {"version":3,"file":"FluentChatMessageComponent.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;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C,iBAAiB;oBAC3C,CAAC,CAAC,uBAAuB,CAAC,gBAAgB;gBAC5C,CAAC,CAAC,uBAAuB,CAAC,cAAc,EAC1C,6BAA6B,CAAC,CAAC,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,eAAe,EAC/G,WAAW,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB,CAAC,CAC9C;YACD,KAAK,EACH,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB,MAAK,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE;SACjH,CAAC;IACJ,CAAC,EAAE;QACD,uBAAuB,CAAC,UAAU;QAClC,uBAAuB,CAAC,iBAAiB;QACzC,uBAAuB,CAAC,gBAAgB;QACxC,uBAAuB,CAAC,cAAc;QACtC,uBAAuB,CAAC,aAAa;QACrC,uBAAuB,CAAC,eAAe;QACvC,gBAAgB;QAChB,MAAM;QACN,6BAA6B;QAC7B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,wBAAwB;KACjC,CAAC,CAAC;IAEH,8EAA8E;IAC9E,uFAAuF;IACvF,iFAAiF;IACjF,gEAAgE;IAChE,OAAO,CACL,oBAAC,iBAAiB,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAClG,eAAe,mBAAM,KAAK,EAAG,CACZ,CACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport { MessageProps, _ChatMessageProps } from '../../MessageThread';\nimport {\n gutterWithAvatar,\n gutterWithHiddenAvatar,\n useChatMessageRenderStyles\n} from '../../styles/MessageThread.styles';\nimport { IPersona, PersonaSize, mergeStyles, Persona } from '@fluentui/react';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { getFluentUIAttachedValue } from '../../utils/ChatMessageComponentUtils';\nimport { ChatMessageComponentWrapperProps } from '../ChatMessageComponentWrapper';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { ChatMessage } from '../../../types/ChatMessage';\nimport { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMessageBubble';\n\n/**\n * Props for {@link FluentChatMessageComponentWrapper}\n *\n * @private\n */\nexport type FluentChatMessageComponentWrapperProps = ChatMessageComponentWrapperProps & {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n};\n\n/**\n * The component for rendering a chat message using Fluent UI components\n * and handling default and custom renderers.\n * This component handles rendering for chat message body, avatar and message status.\n * The chat message body, avatar and message status should be shown for both default and custom renderers.\n *\n * @private\n */\nexport const FluentChatMessageComponent = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n const {\n message,\n styles,\n shouldOverlapAvatarAndMessage,\n onRenderMessage,\n onRenderAvatar,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n inlineImageOptions,\n actionsForAttachment,\n userId,\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(mention) */\n mentionOptions\n } = props;\n const chatMessageRenderStyles = useChatMessageRenderStyles();\n\n // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp\n // needs to be regenerated), the dependency on \"new Date().toDateString()\"\" is added.\n const defaultChatMessageRenderer = useCallback(\n (messageProps: MessageProps) => {\n if (\n messageProps.message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ messageProps.message.messageType === 'blocked'\n ) {\n return (\n <ChatMessageComponentAsMessageBubble\n {...messageProps}\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n strings={messageProps.strings}\n message={messageProps.message}\n userId={userId}\n shouldOverlapAvatarAndMessage={shouldOverlapAvatarAndMessage}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n inlineImageOptions={inlineImageOptions}\n actionsForAttachment={actionsForAttachment}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={mentionOptions?.displayOptions}\n />\n );\n }\n return <></>;\n },\n [\n onRenderAttachmentDownloads,\n userId,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n inlineImageOptions,\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionOptions?.displayOptions\n ]\n );\n\n const messageRenderer = useCallback(\n (messageProps: MessageProps) => {\n return onRenderMessage === undefined\n ? defaultChatMessageRenderer({ ...messageProps })\n : onRenderMessage(messageProps, defaultChatMessageRenderer);\n },\n [defaultChatMessageRenderer, onRenderMessage]\n );\n\n const shouldShowAvatar = useMemo(() => {\n return message.attached === 'top' || message.attached === false;\n }, [message.attached]);\n\n const attached = useMemo(() => {\n return getFluentUIAttachedValue(message.attached);\n }, [message.attached]);\n\n const messageRootProps = useMemo(() => {\n return { className: mergeClasses(chatMessageRenderStyles.rootMessage, chatMessageRenderStyles.rootCommon) };\n }, [chatMessageRenderStyles.rootCommon, chatMessageRenderStyles.rootMessage]);\n\n const avatar = useMemo(() => {\n const chatAvatarStyle = shouldShowAvatar ? gutterWithAvatar : gutterWithHiddenAvatar;\n const personaOptions: IPersona = {\n hidePersonaDetails: true,\n size: PersonaSize.size32,\n text: message.senderDisplayName,\n showOverflowTooltip: false\n };\n let renderedAvatar;\n if (onRenderAvatar) {\n const avatarComponent = onRenderAvatar?.(message.senderId, personaOptions);\n if (!avatarComponent) {\n return undefined;\n } else {\n renderedAvatar = avatarComponent;\n }\n }\n return (\n <div className={mergeStyles(chatAvatarStyle)}>\n {renderedAvatar ? renderedAvatar : <Persona {...personaOptions} />}\n </div>\n );\n }, [message.senderDisplayName, message.senderId, onRenderAvatar, shouldShowAvatar]);\n\n const messageBodyProps = useMemo(() => {\n return {\n // chatItemMessageContainer used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageRenderStyles.bodyCommon,\n !shouldShowAvatar\n ? avatar\n ? chatMessageRenderStyles.bodyWithoutAvatar\n : chatMessageRenderStyles.bodyHiddenAvatar\n : chatMessageRenderStyles.bodyWithAvatar,\n shouldOverlapAvatarAndMessage ? chatMessageRenderStyles.avatarOverlap : chatMessageRenderStyles.avatarNoOverlap,\n mergeStyles(styles?.chatItemMessageContainer)\n ),\n style:\n styles?.chatItemMessageContainer !== undefined ? createStyleFromV8Style(styles?.chatItemMessageContainer) : {}\n };\n }, [\n chatMessageRenderStyles.bodyCommon,\n chatMessageRenderStyles.bodyWithoutAvatar,\n chatMessageRenderStyles.bodyHiddenAvatar,\n chatMessageRenderStyles.bodyWithAvatar,\n chatMessageRenderStyles.avatarOverlap,\n chatMessageRenderStyles.avatarNoOverlap,\n shouldShowAvatar,\n avatar,\n shouldOverlapAvatarAndMessage,\n styles?.chatItemMessageContainer\n ]);\n\n // Fluent UI message components are used here as for default message renderer,\n // timestamp and author name should be shown but they aren't shown for custom renderer.\n // More investigations are needed to check if this can be simplified with states.\n // Avatar should be shown for both custom and default renderers.\n return (\n <FluentChatMessage attached={attached} root={messageRootProps} body={messageBodyProps} avatar={avatar}>\n {messageRenderer({ ...props })}\n </FluentChatMessage>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,mDAAmD;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mDAAmD;AACnD,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AAElH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAEtD,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;AA4BxD;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,KAA+C,EAAe,EAAE;IAClH,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,oBAAC,6BAA6B,oBAAK,KAAK,EAAI,CAAC;IACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,mDAAmD;IACnD,IAAI,KAAK,CAAC,uBAAuB,EAAE,CAAC;QAClC,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,aAAa;YACrC,oBAAC,QAAQ,IAAC,QAAQ,EAAE,aAAa;gBAC/B,oBAAC,qCAAqC,oBAAK,KAAK,EAAI,CAC3C,CACI,CAClB,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { Suspense } from 'react';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\n/* @conditional-compile-remove(rich-text-editor) */\nimport type { ChatMessageComponentAsRichTextEditBoxProps } from './ChatMessageComponentAsRichTextEditBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { _ErrorBoundary } from '../../ErrorBoundary';\n\n/* @conditional-compile-remove(rich-text-editor) */\nconst ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n * @conditional-compile-remove(rich-text-editor)\n */\nexport const loadChatMessageComponentAsRichTextEditBox = (): Promise<{\n default: React.ComponentType<ChatMessageComponentAsRichTextEditBoxProps>;\n}> => import('./ChatMessageComponentAsRichTextEditBox');\n\n/**\n * @private\n */\nexport type ChatMessageComponentAsEditBoxPickerProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBoxPicker = (props: ChatMessageComponentAsEditBoxPickerProps): JSX.Element => {\n const simpleEditBox = useMemo(() => {\n return <ChatMessageComponentAsEditBox {...props} />;\n }, [props]);\n\n /* @conditional-compile-remove(rich-text-editor) */\n if (props.isRichTextEditorEnabled) {\n return (\n <_ErrorBoundary fallback={simpleEditBox}>\n <Suspense fallback={simpleEditBox}>\n <ChatMessageComponentAsRichTextEditBox {...props} />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n\n return simpleEditBox;\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,mDAAmD;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mDAAmD;AACnD,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AAElH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAEtD,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;AAwBxD;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,KAA+C,EAAe,EAAE;IAClH,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,oBAAC,6BAA6B,oBAAK,KAAK,EAAI,CAAC;IACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,mDAAmD;IACnD,IAAI,KAAK,CAAC,uBAAuB,EAAE,CAAC;QAClC,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,aAAa;YACrC,oBAAC,QAAQ,IAAC,QAAQ,EAAE,aAAa;gBAC/B,oBAAC,qCAAqC,oBAAK,KAAK,EAAI,CAC3C,CACI,CAClB,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { Suspense } from 'react';\nimport { ChatMessage } from '../../../types';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\n/* @conditional-compile-remove(rich-text-editor) */\nimport type { ChatMessageComponentAsRichTextEditBoxProps } from './ChatMessageComponentAsRichTextEditBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { _ErrorBoundary } from '../../ErrorBoundary';\n\n/* @conditional-compile-remove(rich-text-editor) */\nconst ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n * @conditional-compile-remove(rich-text-editor)\n */\nexport const loadChatMessageComponentAsRichTextEditBox = (): Promise<{\n default: React.ComponentType<ChatMessageComponentAsRichTextEditBoxProps>;\n}> => import('./ChatMessageComponentAsRichTextEditBox');\n\n/**\n * @private\n */\nexport type ChatMessageComponentAsEditBoxPickerProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (text: string, attachmentMetadata?: AttachmentMetadata[]) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBoxPicker = (props: ChatMessageComponentAsEditBoxPickerProps): JSX.Element => {\n const simpleEditBox = useMemo(() => {\n return <ChatMessageComponentAsEditBox {...props} />;\n }, [props]);\n\n /* @conditional-compile-remove(rich-text-editor) */\n if (props.isRichTextEditorEnabled) {\n return (\n <_ErrorBoundary fallback={simpleEditBox}>\n <Suspense fallback={simpleEditBox}>\n <ChatMessageComponentAsRichTextEditBox {...props} />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n\n return simpleEditBox;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMyMessageComponent.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgBrD,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,gEAAgE;AAChE,OAAO,EAAE,+CAA+C,EAAE,MAAM,0BAA0B,CAAC;AA6F3F;;GAEG;AACH,MAAM,CAAC,MAAM,sBA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,KAAK,CAAC,CAAC;YACtB,CAAC;YACD,0CAA0C;YAC1C,oBAAoB,EAAE,MAAA,KAAK,CAAC,cAAc,0CAAE,aAAa;YACzD,mDAAmD;YACnD,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;YACtD,gEAAgE;YAChE,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,gEAAgE;YAChE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,gEAAgE;YAChE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;YACxD,gEAAgE;YAChE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,GAC9C,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CACL,oBAAC,qCAAqC,oBAChC,KAAK,IACT,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,0DAA0D;YAC1D,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,EACtD,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;YAC5C,0CAA0C;YAC1C,qBAAqB,EAAE,MAAA,KAAK,CAAC,cAAc,0CAAE,cAAc,IAC3D,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useState } from 'react';\nimport { MessageThreadStrings, UpdateMessageCallback } from '../../MessageThread';\nimport { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMenuAction } from '../../../types/Attachment';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } 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(mention) */\nimport { MentionOptions } from '../../MentionPopover';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMyMessageComponentAsMessageBubble } from './ChatMyMessageComponentAsMessageBubble';\nimport { ChatMessageComponentAsEditBoxPicker } from './ChatMessageComponentAsEditBoxPicker';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { removeBrokenImageContentAndClearImageSizeStyles } from '../../utils/SendBoxUtils';\n\n/**\n * Props for the ChatMyMessageComponent component.\n */\nexport type ChatMyMessageComponentProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n userId: string;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onUpdateMessage?: UpdateMessageCallback;\n onCancelEditMessage?: (messageId: string) => void;\n /**\n * Callback to delete a message. Also called before resending a message that failed to send.\n * @param messageId ID of the message to delete\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n /**\n * Callback to send a message\n * @param content The message content to send\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n strings: MessageThreadStrings;\n messageStatus?: string;\n /**\n * Optional text to display when the message status is 'failed'.\n */\n failureReason?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\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 suggestions and display mentions in the mention scenario.\n * @beta\n */\n mentionOptions?: MentionOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render message attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to define custom actions for attachments.\n * @beta\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMyMessageComponent = (props: ChatMyMessageComponentProps): JSX.Element => {\n const { onDeleteMessage, onSendMessage, message } = props;\n const [isEditing, setIsEditing] = useState(false);\n\n const onEditClick = useCallback(() => setIsEditing(true), [setIsEditing]);\n\n const clientMessageId = 'clientMessageId' in message ? message.clientMessageId : undefined;\n const content = 'content' in message ? message.content : undefined;\n const onRemoveClick = useCallback(() => {\n if (onDeleteMessage && message.messageId) {\n onDeleteMessage(message.messageId);\n }\n // when fail to send, message does not have message id, delete message using clientMessageId\n else if (onDeleteMessage && message.messageType === 'chat' && clientMessageId) {\n onDeleteMessage(clientMessageId);\n }\n }, [onDeleteMessage, message.messageId, message.messageType, clientMessageId]);\n\n const onResendClick = useCallback(() => {\n onDeleteMessage && clientMessageId && onDeleteMessage(clientMessageId);\n let newContent = content ?? '';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n newContent = removeBrokenImageContentAndClearImageSizeStyles(newContent);\n onSendMessage &&\n onSendMessage(\n newContent,\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */ attachments:\n `attachments` in message ? message.attachments : undefined,\n /* @conditional-compile-remove(rich-text-editor) */\n type: props.isRichTextEditorEnabled ? 'html' : 'text'\n }\n );\n }, [\n message,\n onDeleteMessage,\n clientMessageId,\n onSendMessage,\n content,\n /* @conditional-compile-remove(rich-text-editor) */ props.isRichTextEditorEnabled\n ]);\n\n const onSubmitHandler = useCallback(\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n async function (\n text: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments?: AttachmentMetadata[] | undefined\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n if (`attachments` in message && attachments) {\n message.attachments = attachments;\n }\n props.onUpdateMessage &&\n message.messageId &&\n (await props.onUpdateMessage(\n message.messageId,\n text,\n /* @conditional-compile-remove(file-sharing-acs) */\n { attachments: attachments }\n ));\n setIsEditing(false);\n },\n [message, props]\n );\n if (isEditing && message.messageType === 'chat') {\n return (\n <ChatMessageComponentAsEditBoxPicker\n message={message}\n strings={props.strings}\n onSubmit={onSubmitHandler}\n onCancel={(messageId) => {\n props.onCancelEditMessage && props.onCancelEditMessage(messageId);\n setIsEditing(false);\n }}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={props.mentionOptions?.lookupOptions}\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled={props.isRichTextEditorEnabled}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={props.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={props.onInsertInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress={props.inlineImagesWithProgress}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage={props.onRemoveInlineImage}\n />\n );\n } else {\n return (\n <ChatMyMessageComponentAsMessageBubble\n {...props}\n onRemoveClick={onRemoveClick}\n onEditClick={onEditClick}\n onResendClick={onResendClick}\n onRenderAvatar={props.onRenderAvatar}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={props.onDisplayDateTimeString}\n strings={props.strings}\n inlineImageOptions={props.inlineImageOptions}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={props.mentionOptions?.displayOptions}\n />\n );\n }\n};\n"]}
1
+ {"version":3,"file":"ChatMyMessageComponent.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAcrD,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,gEAAgE;AAChE,OAAO,EAAE,+CAA+C,EAAE,MAAM,0BAA0B,CAAC;AA2F3F;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;;IACxF,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK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E,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,gEAAgE;YAChE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,gEAAgE;YAChE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;YACxD,gEAAgE;YAChE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,GAC9C,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CACL,oBAAC,qCAAqC,oBAChC,KAAK,IACT,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,0DAA0D;YAC1D,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,EACtD,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;YAC5C,0CAA0C;YAC1C,qBAAqB,EAAE,MAAA,KAAK,CAAC,cAAc,0CAAE,cAAc,IAC3D,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useState } from 'react';\nimport { MessageThreadStrings, UpdateMessageCallback } from '../../MessageThread';\nimport { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types';\nimport { AttachmentMenuAction } from '../../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } 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(mention) */\nimport { MentionOptions } from '../../MentionPopover';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMyMessageComponentAsMessageBubble } from './ChatMyMessageComponentAsMessageBubble';\nimport { ChatMessageComponentAsEditBoxPicker } from './ChatMessageComponentAsEditBoxPicker';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { removeBrokenImageContentAndClearImageSizeStyles } from '../../utils/SendBoxUtils';\n\n/**\n * Props for the ChatMyMessageComponent component.\n */\nexport type ChatMyMessageComponentProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n userId: string;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onUpdateMessage?: UpdateMessageCallback;\n onCancelEditMessage?: (messageId: string) => void;\n /**\n * Callback to delete a message. Also called before resending a message that failed to send.\n * @param messageId ID of the message to delete\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n /**\n * Callback to send a message\n * @param content The message content to send\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n strings: MessageThreadStrings;\n messageStatus?: string;\n /**\n * Optional text to display when the message status is 'failed'.\n */\n failureReason?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\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 suggestions and display mentions in the mention scenario.\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 * Optional callback to render message attachments in the message component.\n * @beta\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to define custom actions for attachments.\n * @beta\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMyMessageComponent = (props: ChatMyMessageComponentProps): JSX.Element => {\n const { onDeleteMessage, onSendMessage, message } = props;\n const [isEditing, setIsEditing] = useState(false);\n\n const onEditClick = useCallback(() => setIsEditing(true), [setIsEditing]);\n\n const clientMessageId = 'clientMessageId' in message ? message.clientMessageId : undefined;\n const content = 'content' in message ? message.content : undefined;\n const onRemoveClick = useCallback(() => {\n if (onDeleteMessage && message.messageId) {\n onDeleteMessage(message.messageId);\n }\n // when fail to send, message does not have message id, delete message using clientMessageId\n else if (onDeleteMessage && message.messageType === 'chat' && clientMessageId) {\n onDeleteMessage(clientMessageId);\n }\n }, [onDeleteMessage, message.messageId, message.messageType, clientMessageId]);\n\n const onResendClick = useCallback(() => {\n onDeleteMessage && clientMessageId && onDeleteMessage(clientMessageId);\n let newContent = content ?? '';\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n newContent = removeBrokenImageContentAndClearImageSizeStyles(newContent);\n onSendMessage &&\n onSendMessage(\n newContent,\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */ attachments:\n `attachments` in message ? message.attachments : undefined,\n /* @conditional-compile-remove(rich-text-editor) */\n type: props.isRichTextEditorEnabled ? 'html' : 'text'\n }\n );\n }, [\n message,\n onDeleteMessage,\n clientMessageId,\n onSendMessage,\n content,\n /* @conditional-compile-remove(rich-text-editor) */ props.isRichTextEditorEnabled\n ]);\n\n const onSubmitHandler = useCallback(\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n async function (\n text: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments?: AttachmentMetadata[] | undefined\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n if (`attachments` in message && attachments) {\n message.attachments = attachments;\n }\n props.onUpdateMessage &&\n message.messageId &&\n (await props.onUpdateMessage(\n message.messageId,\n text,\n /* @conditional-compile-remove(file-sharing-acs) */\n { attachments: attachments }\n ));\n setIsEditing(false);\n },\n [message, props]\n );\n if (isEditing && message.messageType === 'chat') {\n return (\n <ChatMessageComponentAsEditBoxPicker\n message={message}\n strings={props.strings}\n onSubmit={onSubmitHandler}\n onCancel={(messageId) => {\n props.onCancelEditMessage && props.onCancelEditMessage(messageId);\n setIsEditing(false);\n }}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={props.mentionOptions?.lookupOptions}\n /* @conditional-compile-remove(rich-text-editor) */\n isRichTextEditorEnabled={props.isRichTextEditorEnabled}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={props.onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={props.onInsertInlineImage}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress={props.inlineImagesWithProgress}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage={props.onRemoveInlineImage}\n />\n );\n } else {\n return (\n <ChatMyMessageComponentAsMessageBubble\n {...props}\n onRemoveClick={onRemoveClick}\n onEditClick={onEditClick}\n onResendClick={onResendClick}\n onRenderAvatar={props.onRenderAvatar}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={props.onDisplayDateTimeString}\n strings={props.strings}\n inlineImageOptions={props.inlineImageOptions}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={props.mentionOptions?.displayOptions}\n />\n );\n }\n};\n"]}
@@ -23,11 +23,7 @@ const MessageBubble = (props) => {
23
23
  const locale = useLocale();
24
24
  const { userId, message, onRemoveClick, onResendClick, disableEditing, showDate, messageContainerStyle, strings, onEditClick, remoteParticipantsCount = 0, onRenderAvatar, showMessageStatus, messageStatus, inlineImageOptions,
25
25
  /* @conditional-compile-remove(mention) */
26
- mentionDisplayOptions, onDisplayDateTimeString,
27
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
28
- onRenderAttachmentDownloads,
29
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
30
- actionsForAttachment } = props;
26
+ mentionDisplayOptions, onDisplayDateTimeString, onRenderAttachmentDownloads, actionsForAttachment } = props;
31
27
  const formattedTimestamp = useMemo(() => {
32
28
  const defaultTimeStamp = message.createdOn
33
29
  ? generateDefaultTimestamp(message.createdOn, showDate, strings)
@@ -85,17 +81,13 @@ const MessageBubble = (props) => {
85
81
  const getContent = useCallback(() => {
86
82
  return getMessageBubbleContent(message, strings, userId, inlineImageOptions,
87
83
  /* @conditional-compile-remove(mention) */
88
- mentionDisplayOptions,
89
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
90
- onRenderAttachmentDownloads,
91
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
92
- actionsForAttachment);
84
+ mentionDisplayOptions, onRenderAttachmentDownloads, actionsForAttachment);
93
85
  }, [
94
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ actionsForAttachment,
86
+ actionsForAttachment,
95
87
  inlineImageOptions,
96
88
  /* @conditional-compile-remove(mention) */ mentionDisplayOptions,
97
89
  message,
98
- /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentDownloads,
90
+ onRenderAttachmentDownloads,
99
91
  strings,
100
92
  userId
101
93
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMyMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAOtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACvG,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,mDAAmD;AACnD,OAAO,EAAE,qCAAqC,EAAE,M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O;oBACT,CAAC;oBACD,oEAAoE;oBACpE,gEAAgE;oBAChE,uCAAuC;oBACvC,yEAAyE;oBACzE,8DAA8D;oBAC9D,gCAAgC,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;wBACnC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC,IAEA,UAAU,EAAE,CACC,CACZ;QACL,kBAAkB,IAAI,CACrB,oBAAC,uBAAuB,IACtB,MAAM,EAAE,CAAC,6BAA6B,EACtC,MAAM,EAAE,6BAA6B,EACrC,sBAAsB,EAAE,qBAAqB,EAC7C,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,QAAQ,EACxC,uBAAuB,EAAE,uBAAuB,EAChD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACA,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n chatMessageDateStyle,\n chatMessageFailedTagStyle,\n chatMessageDateFailedStyle\n} from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { ChatMessageActionFlyout } from '../ChatMessageActionsFlyout';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { chatMessageActionMenuProps } from '../ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMenuAction } from '../../../types/Attachment';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMyMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMyMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\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 display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMyMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n // `focused` state is used for show/hide actionMenu\n const [focused, setFocused] = React.useState<boolean>(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLDivElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<\n React.MutableRefObject<HTMLElement | null> | undefined\n >(undefined);\n\n const chatActionsEnabled =\n !disableEditing &&\n message.status !== 'sending' &&\n !!message.mine &&\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType !== 'blocked';\n const [messageReadBy, setMessageReadBy] = useState<{ id: string; displayName: string }[]>([]);\n\n const actionMenuProps = chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n menuExpanded: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }\n }, [message, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMyMessageStyles = useChatMyMessageStyles();\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <ChatMyMessage\n attached={attached}\n key={props.message.messageId}\n body={{\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageCommonStyles.body,\n chatMyMessageStyles.body,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n chatMessageCommonStyles.bodyWithPlaceholderImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n chatMyMessageStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachmentsInViewing : undefined,\n mergeStyles(messageContainerStyle)\n ),\n style: { ...createStyleFromV8Style(messageContainerStyle) },\n ref: messageRef\n }}\n root={{\n className: chatMyMessageStyles.root,\n onBlur: (e) => {\n // `focused` controls is focused the whole `ChatMessage` or any of its children. When we're navigating\n // with keyboard the focused element will be changed and there is no way to use `:focus` selector\n if (chatMessageActionFlyoutTarget?.current) {\n // doesn't dismiss action button if flyout is open, otherwise, narrator's focus will stay on the closed action menu\n return;\n }\n const shouldPreserveFocusState = e.currentTarget.contains(e.relatedTarget);\n setFocused(shouldPreserveFocusState);\n },\n onFocus: () => {\n // react onFocus is called even when nested component receives focus (i.e. it bubbles)\n // so when focus moves within actionMenu, the `focus` state in chatMessage remains true, and keeps actionMenu visible\n setFocused(true);\n }\n }}\n data-testid=\"chat-composite-message\"\n author={<Text className={chatMessageDateStyle(theme)}>{message.senderDisplayName}</Text>}\n timestamp={\n <Text\n className={\n props.message.status === 'failed' ? chatMessageDateFailedStyle(theme) : chatMessageDateStyle(theme)\n }\n data-ui-id={ids.messageTimestamp}\n >\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n actions={{\n children: actionMenuProps?.children,\n className: mergeClasses(\n chatMyMessageStyles.menu,\n // Make actions menu visible when the message is focused or the flyout is shown\n focused || chatMessageActionFlyoutTarget?.current\n ? chatMyMessageStyles.menuVisible\n : chatMyMessageStyles.menuHidden,\n attached !== 'top' ? chatMyMessageStyles.menuAttached : undefined\n )\n }}\n onTouchStart={() => setWasInteractionByTouch(true)}\n onPointerDown={() => setWasInteractionByTouch(false)}\n onKeyDown={() => setWasInteractionByTouch(false)}\n onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }}\n >\n {getContent()}\n </ChatMyMessage>\n </div>\n {chatActionsEnabled && (\n <ChatMessageActionFlyout\n hidden={!chatMessageActionFlyoutTarget}\n target={chatMessageActionFlyoutTarget}\n increaseFlyoutItemSize={wasInteractionByTouch}\n onDismiss={onActionFlyoutDismiss}\n onEditClick={onEditClick}\n onRemoveClick={onRemoveClick}\n onResendClick={onResendClick}\n strings={strings}\n messageReadBy={messageReadBy}\n messageStatus={messageStatus ?? 'failed'}\n remoteParticipantsCount={remoteParticipantsCount}\n onRenderAvatar={onRenderAvatar}\n showMessageStatus={showMessageStatus}\n />\n )}\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMyMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
1
+ {"version":3,"file":"ChatMyMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAKtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGl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AAC,IAAI,CAAC,EAClD,aAAa,EAAE,GAAG,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACpD,SAAS,EAAE,GAAG,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAChD,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,CAAC,qBAAqB,EAAE,CAAC;wBAC3B,OAAO;oBACT,CAAC;oBACD,oEAAoE;oBACpE,gEAAgE;oBAChE,uCAAuC;oBACvC,yEAAyE;oBACzE,8DAA8D;oBAC9D,gCAAgC,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;wBACnC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC,IAEA,UAAU,EAAE,CACC,CACZ;QACL,kBAAkB,IAAI,CACrB,oBAAC,uBAAuB,IACtB,MAAM,EAAE,CAAC,6BAA6B,EACtC,MAAM,EAAE,6BAA6B,EACrC,sBAAsB,EAAE,qBAAqB,EAC7C,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,QAAQ,EACxC,uBAAuB,EAAE,uBAAuB,EAChD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACA,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n chatMessageDateStyle,\n chatMessageFailedTagStyle,\n chatMessageDateFailedStyle\n} from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { ChatMessageActionFlyout } from '../ChatMessageActionsFlyout';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { chatMessageActionMenuProps } from '../ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\nimport { AttachmentMenuAction } from '../../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMyMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMyMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\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 display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMyMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString,\n onRenderAttachmentDownloads,\n actionsForAttachment\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n // `focused` state is used for show/hide actionMenu\n const [focused, setFocused] = React.useState<boolean>(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLDivElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<\n React.MutableRefObject<HTMLElement | null> | undefined\n >(undefined);\n\n const chatActionsEnabled =\n !disableEditing &&\n message.status !== 'sending' &&\n !!message.mine &&\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType !== 'blocked';\n const [messageReadBy, setMessageReadBy] = useState<{ id: string; displayName: string }[]>([]);\n\n const actionMenuProps = chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n menuExpanded: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }\n }, [message, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onRenderAttachmentDownloads,\n actionsForAttachment\n );\n }, [\n actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMyMessageStyles = useChatMyMessageStyles();\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <ChatMyMessage\n attached={attached}\n key={props.message.messageId}\n body={{\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageCommonStyles.body,\n chatMyMessageStyles.body,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n chatMessageCommonStyles.bodyWithPlaceholderImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n chatMyMessageStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachmentsInViewing : undefined,\n mergeStyles(messageContainerStyle)\n ),\n style: { ...createStyleFromV8Style(messageContainerStyle) },\n ref: messageRef\n }}\n root={{\n className: chatMyMessageStyles.root,\n onBlur: (e) => {\n // `focused` controls is focused the whole `ChatMessage` or any of its children. When we're navigating\n // with keyboard the focused element will be changed and there is no way to use `:focus` selector\n if (chatMessageActionFlyoutTarget?.current) {\n // doesn't dismiss action button if flyout is open, otherwise, narrator's focus will stay on the closed action menu\n return;\n }\n const shouldPreserveFocusState = e.currentTarget.contains(e.relatedTarget);\n setFocused(shouldPreserveFocusState);\n },\n onFocus: () => {\n // react onFocus is called even when nested component receives focus (i.e. it bubbles)\n // so when focus moves within actionMenu, the `focus` state in chatMessage remains true, and keeps actionMenu visible\n setFocused(true);\n }\n }}\n data-testid=\"chat-composite-message\"\n author={<Text className={chatMessageDateStyle(theme)}>{message.senderDisplayName}</Text>}\n timestamp={\n <Text\n className={\n props.message.status === 'failed' ? chatMessageDateFailedStyle(theme) : chatMessageDateStyle(theme)\n }\n data-ui-id={ids.messageTimestamp}\n >\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n actions={{\n children: actionMenuProps?.children,\n className: mergeClasses(\n chatMyMessageStyles.menu,\n // Make actions menu visible when the message is focused or the flyout is shown\n focused || chatMessageActionFlyoutTarget?.current\n ? chatMyMessageStyles.menuVisible\n : chatMyMessageStyles.menuHidden,\n attached !== 'top' ? chatMyMessageStyles.menuAttached : undefined\n )\n }}\n onTouchStart={() => setWasInteractionByTouch(true)}\n onPointerDown={() => setWasInteractionByTouch(false)}\n onKeyDown={() => setWasInteractionByTouch(false)}\n onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }}\n >\n {getContent()}\n </ChatMyMessage>\n </div>\n {chatActionsEnabled && (\n <ChatMessageActionFlyout\n hidden={!chatMessageActionFlyoutTarget}\n target={chatMessageActionFlyoutTarget}\n increaseFlyoutItemSize={wasInteractionByTouch}\n onDismiss={onActionFlyoutDismiss}\n onEditClick={onEditClick}\n onRemoveClick={onRemoveClick}\n onResendClick={onResendClick}\n strings={strings}\n messageReadBy={messageReadBy}\n messageStatus={messageStatus ?? 'failed'}\n remoteParticipantsCount={remoteParticipantsCount}\n onRenderAvatar={onRenderAvatar}\n showMessageStatus={showMessageStatus}\n />\n )}\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMyMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}