@azure/communication-react 1.14.0-alpha-202403160012 → 1.14.0-alpha-202403200012
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +14 -14
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js → RichTextSendBoxWrapper-DRoOTcxC.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js.map → RichTextSendBoxWrapper-DRoOTcxC.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-BfFCLrEO.js → index-CeYIHxFb.js} +695 -542
- package/dist/dist-cjs/communication-react/index-CeYIHxFb.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +14 -12
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +2 -0
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts +2 -2
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +12 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +46 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +91 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.d.ts → MessageComponents/FluentChatMessageComponent.d.ts} +6 -7
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +122 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.d.ts → MyMessageComponents/ChatMyMessageComponent.d.ts} +9 -9
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.js → MyMessageComponents/ChatMyMessageComponent.js} +5 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponentAsMessageBubble.d.ts → MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts} +10 -19
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +162 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.d.ts +12 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.js → MyMessageComponents/FluentChatMyMessageComponent.js} +12 -54
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js +1 -4
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +3 -3
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +3 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js +3 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +3 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +98 -118
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +3 -7
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts +0 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +29 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +92 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.d.ts +2 -3
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js +2 -2
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +5 -3
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +5 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +5 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +2 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +10 -12
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +18 -18
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +1 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js +4 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +4 -4
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +4 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +5 -5
- package/package.json +3 -5
- package/dist/dist-cjs/communication-react/index-BfFCLrEO.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +0 -218
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +0 -1
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAqF5F;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;;IACpF,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAE1E,MAAM,eAAe,GAAG,iBAAiB,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,MAAM,OAAO,GAAG,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE;QACrC,IAA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AClE,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;YACD,0CAA0C;YAC1C,oBAAoB,EAAE,MAAA,KAAK,CAAC,cAAc,0CAAE,aAAa,GACzD,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CACL,oBAAC,mCAAmC,oBAC9B,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;YACtB,gDAAgD;YAChD,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 { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\nimport { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMessageBubble';\nimport { FileDownloadHandler, AttachmentMetadata } from '../FileDownloadCards';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from '../MentionPopover';\n/* @conditional-compile-remove(image-overlay) */\nimport { InlineImageOptions } from './ChatMessageContent';\n\ntype ChatMessageComponentProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n userId: string;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onUpdateMessage?: (\n messageId: string,\n content: string,\n metadata?: Record<string, string>,\n options?: {\n attachmentMetadata?: AttachmentMetadata[];\n }\n ) => Promise<void>;\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?: (content: string) => 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 /**\n * Optional callback to render uploaded files in the message component.\n */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n /**\n * Optional function called when someone clicks on the file download icon.\n */\n fileDownloadHandler?: FileDownloadHandler;\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 /* @conditional-compile-remove(image-overlay) */\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponent = (props: ChatMessageComponentProps): 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 const onResendClick = useCallback(() => {\n onDeleteMessage && clientMessageId && onDeleteMessage(clientMessageId);\n onSendMessage && onSendMessage(content !== undefined ? content : '');\n }, [clientMessageId, content, onSendMessage, onDeleteMessage]);\n\n if (isEditing && message.messageType === 'chat') {\n return (\n <ChatMessageComponentAsEditBox\n message={message}\n strings={props.strings}\n onSubmit={async (text, metadata, options) => {\n props.onUpdateMessage &&\n message.messageId &&\n (await props.onUpdateMessage(message.messageId, text, metadata, options));\n setIsEditing(false);\n }}\n onCancel={(messageId) => {\n props.onCancelEditMessage && props.onCancelEditMessage(messageId);\n setIsEditing(false);\n }}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={props.mentionOptions?.lookupOptions}\n />\n );\n } else {\n return (\n <ChatMessageComponentAsMessageBubble\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 /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions={props.inlineImageOptions}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={props.mentionOptions?.displayOptions}\n />\n );\n }\n};\n"]}
|
@@ -1,218 +0,0 @@
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
2
|
-
// Licensed under the MIT License.
|
3
|
-
import { Text, mergeStyles } from '@fluentui/react';
|
4
|
-
import { ChatMessage as FluentChatMessage, ChatMyMessage } from '@fluentui-contrib/react-chat';
|
5
|
-
import React, { useCallback, useRef, useState } from 'react';
|
6
|
-
import { chatMessageEditedTagStyle, chatMessageDateStyle, chatMessageFailedTagStyle, chatMessageAuthorStyle } from '../styles/ChatMessageComponent.styles';
|
7
|
-
import { formatTimeForChatMessage, formatTimestampForChatMessage } from '../utils/Datetime';
|
8
|
-
import { useIdentifiers } from '../../identifiers/IdentifierProvider';
|
9
|
-
import { useTheme } from '../../theming';
|
10
|
-
import { ChatMessageActionFlyout } from './ChatMessageActionsFlyout';
|
11
|
-
import { ChatMessageContent } from './ChatMessageContent';
|
12
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
13
|
-
import { BlockedMessageContent } from './ChatMessageContent';
|
14
|
-
import { chatMessageActionMenuProps } from './ChatMessageActionMenu';
|
15
|
-
import { _FileDownloadCards } from '../FileDownloadCards';
|
16
|
-
import { useLocale } from '../../localization';
|
17
|
-
import { createStyleFromV8Style } from '../styles/v8StyleShim';
|
18
|
-
import { mergeClasses } from '@fluentui/react-components';
|
19
|
-
import { useChatMessageStyles, useChatMyMessageStyles, useChatMessageCommonStyles } from '../styles/MessageThread.styles';
|
20
|
-
const generateDefaultTimestamp = (createdOn, showDate, strings) => {
|
21
|
-
const formattedTimestamp = showDate
|
22
|
-
? formatTimestampForChatMessage(createdOn, new Date(), strings)
|
23
|
-
: formatTimeForChatMessage(createdOn);
|
24
|
-
return formattedTimestamp;
|
25
|
-
};
|
26
|
-
// onDisplayDateTimeString from props overwrite onDisplayDateTimeString from locale
|
27
|
-
const generateCustomizedTimestamp = (props, createdOn, locale) => {
|
28
|
-
/* @conditional-compile-remove(date-time-customization) */
|
29
|
-
return props.onDisplayDateTimeString
|
30
|
-
? props.onDisplayDateTimeString(createdOn)
|
31
|
-
: locale.onDisplayDateTimeString
|
32
|
-
? locale.onDisplayDateTimeString(createdOn)
|
33
|
-
: '';
|
34
|
-
return '';
|
35
|
-
};
|
36
|
-
/** @private */
|
37
|
-
const MessageBubble = (props) => {
|
38
|
-
var _a;
|
39
|
-
const ids = useIdentifiers();
|
40
|
-
const theme = useTheme();
|
41
|
-
const locale = useLocale();
|
42
|
-
const { userId, message, onRemoveClick, onResendClick, disableEditing, showDate, messageContainerStyle, strings, onEditClick, remoteParticipantsCount = 0, onRenderAvatar, showMessageStatus, messageStatus,
|
43
|
-
/* @conditional-compile-remove(file-sharing) */
|
44
|
-
fileDownloadHandler,
|
45
|
-
/* @conditional-compile-remove(image-overlay) */
|
46
|
-
inlineImageOptions, shouldOverlapAvatarAndMessage } = props;
|
47
|
-
const defaultTimeStamp = message.createdOn
|
48
|
-
? generateDefaultTimestamp(message.createdOn, showDate, strings)
|
49
|
-
: undefined;
|
50
|
-
const customTimestamp = message.createdOn ? generateCustomizedTimestamp(props, message.createdOn, locale) : '';
|
51
|
-
const formattedTimestamp = customTimestamp || defaultTimeStamp;
|
52
|
-
// Track if the action menu was opened by touch - if so we increase the touch targets for the items
|
53
|
-
const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);
|
54
|
-
// `focused` state is used for show/hide actionMenu
|
55
|
-
const [focused, setFocused] = React.useState(false);
|
56
|
-
// The chat message action flyout should target the Chat.Message action menu if clicked,
|
57
|
-
// or target the chat message if opened via touch press.
|
58
|
-
// Undefined indicates the flyout menu should not be being shown.
|
59
|
-
const messageRef = useRef(null);
|
60
|
-
const messageActionButtonRef = useRef(null);
|
61
|
-
const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState(undefined);
|
62
|
-
const chatActionsEnabled = !disableEditing &&
|
63
|
-
message.status !== 'sending' &&
|
64
|
-
!!message.mine &&
|
65
|
-
/* @conditional-compile-remove(data-loss-prevention) */ message.messageType !== 'blocked';
|
66
|
-
const [messageReadBy, setMessageReadBy] = useState([]);
|
67
|
-
const actionMenuProps = chatMessageActionMenuProps({
|
68
|
-
ariaLabel: (_a = strings.actionMenuMoreOptions) !== null && _a !== void 0 ? _a : '',
|
69
|
-
enabled: chatActionsEnabled,
|
70
|
-
menuButtonRef: messageActionButtonRef,
|
71
|
-
menuExpanded: chatMessageActionFlyoutTarget === messageActionButtonRef,
|
72
|
-
onActionButtonClick: () => {
|
73
|
-
if (message.messageType === 'chat') {
|
74
|
-
props.onActionButtonClick(message, setMessageReadBy);
|
75
|
-
setChatMessageActionFlyoutTarget(messageActionButtonRef);
|
76
|
-
}
|
77
|
-
},
|
78
|
-
theme
|
79
|
-
});
|
80
|
-
const onActionFlyoutDismiss = useCallback(() => {
|
81
|
-
// When the flyout dismiss is called, since we control if the action flyout is visible
|
82
|
-
// or not we need to set the target to undefined here to actually hide the action flyout
|
83
|
-
setChatMessageActionFlyoutTarget(undefined);
|
84
|
-
}, [setChatMessageActionFlyoutTarget]);
|
85
|
-
const defaultOnRenderFileDownloads = useCallback(() => {
|
86
|
-
/* @conditional-compile-remove(file-sharing) */
|
87
|
-
return (React.createElement(_FileDownloadCards, { userId: userId,
|
88
|
-
/* @conditional-compile-remove(file-sharing) */
|
89
|
-
fileMetadata: message.files || [],
|
90
|
-
/* @conditional-compile-remove(file-sharing) */
|
91
|
-
downloadHandler: fileDownloadHandler,
|
92
|
-
/* @conditional-compile-remove(file-sharing) */
|
93
|
-
strings: { downloadFile: strings.downloadFile, fileCardGroupMessage: strings.fileCardGroupMessage } }));
|
94
|
-
}, [
|
95
|
-
userId,
|
96
|
-
message,
|
97
|
-
/* @conditional-compile-remove(file-sharing) */
|
98
|
-
strings,
|
99
|
-
/* @conditional-compile-remove(file-sharing) */
|
100
|
-
fileDownloadHandler
|
101
|
-
]);
|
102
|
-
const editedOn = 'editedOn' in message ? message.editedOn : undefined;
|
103
|
-
const getMessageDetails = useCallback(() => {
|
104
|
-
if (messageStatus === 'failed') {
|
105
|
-
return React.createElement("div", { className: chatMessageFailedTagStyle(theme) }, strings.failToSendTag);
|
106
|
-
}
|
107
|
-
else if (message.messageType === 'chat' && editedOn) {
|
108
|
-
return React.createElement("div", { className: chatMessageEditedTagStyle(theme) }, strings.editedTag);
|
109
|
-
}
|
110
|
-
return undefined;
|
111
|
-
}, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);
|
112
|
-
const getContent = useCallback(() => {
|
113
|
-
/* @conditional-compile-remove(data-loss-prevention) */
|
114
|
-
if (message.messageType === 'blocked') {
|
115
|
-
return (React.createElement("div", { tabIndex: 0 },
|
116
|
-
React.createElement(BlockedMessageContent, { message: message, strings: strings })));
|
117
|
-
}
|
118
|
-
return (React.createElement("div", { tabIndex: 0, className: "ui-chat__message__content" },
|
119
|
-
React.createElement(ChatMessageContent, { message: message, strings: strings,
|
120
|
-
/* @conditional-compile-remove(mention) */
|
121
|
-
mentionDisplayOptions: props.mentionDisplayOptions,
|
122
|
-
/* @conditional-compile-remove(image-overlay) */
|
123
|
-
inlineImageOptions: inlineImageOptions }),
|
124
|
-
/* @conditional-compile-remove(file-sharing) */ props.onRenderFileDownloads
|
125
|
-
? props.onRenderFileDownloads(userId, message)
|
126
|
-
: defaultOnRenderFileDownloads()));
|
127
|
-
}, [
|
128
|
-
defaultOnRenderFileDownloads,
|
129
|
-
/* @conditional-compile-remove(image-overlay) */ inlineImageOptions,
|
130
|
-
message,
|
131
|
-
props,
|
132
|
-
strings,
|
133
|
-
userId
|
134
|
-
]);
|
135
|
-
const isBlockedMessage = false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';
|
136
|
-
const chatMyMessageStyles = useChatMyMessageStyles();
|
137
|
-
const chatMessageCommonStyles = useChatMessageCommonStyles();
|
138
|
-
const chatMessageStyles = useChatMessageStyles();
|
139
|
-
const chatItemMessageContainerClassName = mergeClasses(
|
140
|
-
// messageContainerStyle used in className and style prop as style prop can't handle CSS selectors
|
141
|
-
chatMessageStyles.body,
|
142
|
-
// disable placeholder functionality for GA releases as it might confuse users
|
143
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
144
|
-
chatMessageStyles.bodyWithPlaceholderImage, isBlockedMessage
|
145
|
-
? chatMessageCommonStyles.blocked
|
146
|
-
: props.message.status === 'failed'
|
147
|
-
? chatMessageCommonStyles.failed
|
148
|
-
: undefined, shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap, message.attached === 'top' || message.attached === false
|
149
|
-
? chatMessageStyles.bodyWithAvatar
|
150
|
-
: chatMessageStyles.bodyWithoutAvatar, mergeStyles(messageContainerStyle));
|
151
|
-
const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
|
152
|
-
const chatMessage = (React.createElement(React.Fragment, null,
|
153
|
-
React.createElement("div", { key: props.message.messageId }, message.mine ? (React.createElement(ChatMyMessage, { attached: attached, key: props.message.messageId, body: {
|
154
|
-
// messageContainerStyle used in className and style prop as style prop can't handle CSS selectors
|
155
|
-
className: mergeClasses(chatMyMessageStyles.body, isBlockedMessage
|
156
|
-
? chatMessageCommonStyles.blocked
|
157
|
-
: props.message.status === 'failed'
|
158
|
-
? chatMessageCommonStyles.failed
|
159
|
-
: undefined, attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined, mergeStyles(messageContainerStyle)),
|
160
|
-
style: Object.assign({}, createStyleFromV8Style(messageContainerStyle)),
|
161
|
-
ref: messageRef
|
162
|
-
}, root: {
|
163
|
-
className: chatMyMessageStyles.root,
|
164
|
-
onBlur: (e) => {
|
165
|
-
// `focused` controls is focused the whole `ChatMessage` or any of its children. When we're navigating
|
166
|
-
// with keyboard the focused element will be changed and there is no way to use `:focus` selector
|
167
|
-
if (chatMessageActionFlyoutTarget === null || chatMessageActionFlyoutTarget === void 0 ? void 0 : chatMessageActionFlyoutTarget.current) {
|
168
|
-
// doesn't dismiss action button if flyout is open, otherwise, narrator's focus will stay on the closed action menu
|
169
|
-
return;
|
170
|
-
}
|
171
|
-
const shouldPreserveFocusState = e.currentTarget.contains(e.relatedTarget);
|
172
|
-
setFocused(shouldPreserveFocusState);
|
173
|
-
},
|
174
|
-
onFocus: () => {
|
175
|
-
// react onFocus is called even when nested component receives focus (i.e. it bubbles)
|
176
|
-
// so when focus moves within actionMenu, the `focus` state in chatMessage remains true, and keeps actionMenu visible
|
177
|
-
setFocused(true);
|
178
|
-
},
|
179
|
-
// make body not focusable to remove repetitions from narrators.
|
180
|
-
// inner components are already focusable
|
181
|
-
role: 'none',
|
182
|
-
tabIndex: -1
|
183
|
-
}, "data-ui-id": "chat-composite-message", author: React.createElement(Text, { className: chatMessageDateStyle, tabIndex: 0 }, message.senderDisplayName), timestamp: React.createElement(Text, { className: chatMessageDateStyle, "data-ui-id": ids.messageTimestamp, tabIndex: 0 }, formattedTimestamp), details: getMessageDetails(), actions: {
|
184
|
-
children: actionMenuProps === null || actionMenuProps === void 0 ? void 0 : actionMenuProps.children,
|
185
|
-
className: mergeClasses(chatMyMessageStyles.menu,
|
186
|
-
// Make actions menu visible when the message is focused or the flyout is shown
|
187
|
-
focused || (chatMessageActionFlyoutTarget === null || chatMessageActionFlyoutTarget === void 0 ? void 0 : chatMessageActionFlyoutTarget.current)
|
188
|
-
? chatMyMessageStyles.menuVisible
|
189
|
-
: chatMyMessageStyles.menuHidden, attached !== 'top' ? chatMyMessageStyles.menuAttached : undefined)
|
190
|
-
}, onTouchStart: () => setWasInteractionByTouch(true), onPointerDown: () => setWasInteractionByTouch(false), onKeyDown: () => setWasInteractionByTouch(false), onClick: () => {
|
191
|
-
if (!wasInteractionByTouch) {
|
192
|
-
return;
|
193
|
-
}
|
194
|
-
// If the message was touched via touch we immediately open the menu
|
195
|
-
// flyout (when using mouse the 3-dot menu that appears on hover
|
196
|
-
// must be clicked to open the flyout).
|
197
|
-
// In doing so here we set the target of the flyout to be the message and
|
198
|
-
// not the 3-dot menu button to position the flyout correctly.
|
199
|
-
setChatMessageActionFlyoutTarget(messageRef);
|
200
|
-
if (message.messageType === 'chat') {
|
201
|
-
props.onActionButtonClick(message, setMessageReadBy);
|
202
|
-
}
|
203
|
-
} }, getContent())) : (React.createElement(FluentChatMessage, { attached: attached, key: props.message.messageId, root: {
|
204
|
-
className: chatMessageStyles.root,
|
205
|
-
// make body not focusable to remove repetitions from narrators.
|
206
|
-
// inner components are already focusable
|
207
|
-
tabIndex: -1,
|
208
|
-
role: 'none'
|
209
|
-
}, author: React.createElement(Text, { className: chatMessageAuthorStyle }, message.senderDisplayName), body: {
|
210
|
-
className: chatItemMessageContainerClassName,
|
211
|
-
style: Object.assign({}, createStyleFromV8Style(messageContainerStyle))
|
212
|
-
}, "data-ui-id": "chat-composite-message", timestamp: React.createElement(Text, { className: chatMessageDateStyle, "data-ui-id": ids.messageTimestamp }, formattedTimestamp), details: getMessageDetails() }, getContent()))),
|
213
|
-
chatActionsEnabled && (React.createElement(ChatMessageActionFlyout, { hidden: !chatMessageActionFlyoutTarget, target: chatMessageActionFlyoutTarget, increaseFlyoutItemSize: wasInteractionByTouch, onDismiss: onActionFlyoutDismiss, onEditClick: onEditClick, onRemoveClick: onRemoveClick, onResendClick: onResendClick, strings: strings, messageReadBy: messageReadBy, messageStatus: messageStatus !== null && messageStatus !== void 0 ? messageStatus : 'failed', remoteParticipantsCount: remoteParticipantsCount, onRenderAvatar: onRenderAvatar, showMessageStatus: showMessageStatus }))));
|
214
|
-
return chatMessage;
|
215
|
-
};
|
216
|
-
/** @private */
|
217
|
-
export const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);
|
218
|
-
//# sourceMappingURL=ChatMessageComponentAsMessageBubble.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAU,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC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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,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles, IStyle } from '@fluentui/react';\nimport { ChatMessage as FluentChatMessage, ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useRef, useState } from 'react';\nimport {\n chatMessageEditedTagStyle,\n chatMessageDateStyle,\n chatMessageFailedTagStyle,\n chatMessageAuthorStyle\n} from '../styles/ChatMessageComponent.styles';\nimport { formatTimeForChatMessage, formatTimestampForChatMessage } from '../utils/Datetime';\nimport { useIdentifiers } from '../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../theming';\nimport { ChatMessageActionFlyout } from './ChatMessageActionsFlyout';\nimport { ChatMessageContent } from './ChatMessageContent';\n/* @conditional-compile-remove(image-overlay) */\nimport { InlineImageOptions } from './ChatMessageContent';\nimport { ChatMessage } from '../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessageContent } from './ChatMessageContent';\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) */\nimport { FileDownloadHandler } from '../FileDownloadCards';\nimport { _FileDownloadCards } from '../FileDownloadCards';\nimport { ComponentLocale, useLocale } from '../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../MentionPopover';\nimport { createStyleFromV8Style } from '../styles/v8StyleShim';\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport { mergeClasses } from '@fluentui/react-components';\nimport {\n useChatMessageStyles,\n useChatMyMessageStyles,\n useChatMessageCommonStyles\n} from '../styles/MessageThread.styles';\n\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\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 messageStatusRenderer?: (status: MessageStatus) => JSX.Element | null;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n /* @conditional-compile-remove(file-sharing) */\n /**\n * Optional callback to render uploaded files in the message component.\n */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(file-sharing) */\n /**\n * Optional function called when someone clicks on the file download icon.\n */\n fileDownloadHandler?: FileDownloadHandler;\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 /* @conditional-compile-remove(image-overlay) */\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\nconst generateDefaultTimestamp = (\n createdOn: Date,\n showDate: boolean | undefined,\n strings: MessageThreadStrings\n): string => {\n const formattedTimestamp = showDate\n ? formatTimestampForChatMessage(createdOn, new Date(), strings)\n : formatTimeForChatMessage(createdOn);\n\n return formattedTimestamp;\n};\n\n// onDisplayDateTimeString from props overwrite onDisplayDateTimeString from locale\nconst generateCustomizedTimestamp = (\n props: ChatMessageComponentAsMessageBubbleProps,\n createdOn: Date,\n locale: ComponentLocale\n): string => {\n /* @conditional-compile-remove(date-time-customization) */\n return props.onDisplayDateTimeString\n ? props.onDisplayDateTimeString(createdOn)\n : locale.onDisplayDateTimeString\n ? locale.onDisplayDateTimeString(createdOn)\n : '';\n\n return '';\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 onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler,\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions,\n shouldOverlapAvatarAndMessage\n } = props;\n\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn ? generateCustomizedTimestamp(props, message.createdOn, locale) : '';\n\n const formattedTimestamp = customTimestamp || defaultTimeStamp;\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 const defaultOnRenderFileDownloads = useCallback(() => {\n /* @conditional-compile-remove(file-sharing) */\n return (\n <_FileDownloadCards\n userId={userId}\n /* @conditional-compile-remove(file-sharing) */\n fileMetadata={(message as ChatMessage).files || []}\n /* @conditional-compile-remove(file-sharing) */\n downloadHandler={fileDownloadHandler}\n /* @conditional-compile-remove(file-sharing) */\n strings={{ downloadFile: strings.downloadFile, fileCardGroupMessage: strings.fileCardGroupMessage }}\n />\n );\n }, [\n userId,\n message,\n /* @conditional-compile-remove(file-sharing) */\n strings,\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler\n ]);\n\n const editedOn = 'editedOn' in message ? message.editedOn : undefined;\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else if (message.messageType === 'chat' && editedOn) {\n return <div className={chatMessageEditedTagStyle(theme)}>{strings.editedTag}</div>;\n }\n return undefined;\n }, [editedOn, message.messageType, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n\n const getContent = useCallback(() => {\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.messageType === 'blocked') {\n return (\n <div tabIndex={0}>\n <BlockedMessageContent message={message} strings={strings} />\n </div>\n );\n }\n return (\n <div tabIndex={0} className=\"ui-chat__message__content\">\n <ChatMessageContent\n message={message}\n strings={strings}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={props.mentionDisplayOptions}\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions={inlineImageOptions}\n />\n {\n /* @conditional-compile-remove(file-sharing) */ props.onRenderFileDownloads\n ? props.onRenderFileDownloads(userId, message)\n : defaultOnRenderFileDownloads()\n }\n </div>\n );\n }, [\n defaultOnRenderFileDownloads,\n /* @conditional-compile-remove(image-overlay) */ inlineImageOptions,\n message,\n props,\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 chatMessageStyles = useChatMessageStyles();\n const chatItemMessageContainerClassName = mergeClasses(\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n chatMessageStyles.body,\n // disable placeholder functionality for GA releases as it might confuse users\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n chatMessageStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,\n message.attached === 'top' || message.attached === false\n ? chatMessageStyles.bodyWithAvatar\n : chatMessageStyles.bodyWithoutAvatar,\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 {message.mine ? (\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 chatMyMessageStyles.body,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n attached !== 'top' ? chatMyMessageStyles.bodyAttached : 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 // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n role: 'none',\n tabIndex: -1\n }}\n data-ui-id=\"chat-composite-message\"\n author={\n <Text className={chatMessageDateStyle} tabIndex={0}>\n {message.senderDisplayName}\n </Text>\n }\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp} tabIndex={0}>\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 ) : (\n <FluentChatMessage\n attached={attached}\n key={props.message.messageId}\n root={{\n className: chatMessageStyles.root,\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n tabIndex: -1,\n role: 'none'\n }}\n author={<Text className={chatMessageAuthorStyle}>{message.senderDisplayName}</Text>}\n body={{\n className: chatItemMessageContainerClassName,\n style: { ...createStyleFromV8Style(messageContainerStyle) }\n }}\n data-ui-id=\"chat-composite-message\"\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp}>\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n >\n {getContent()}\n </FluentChatMessage>\n )}\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 ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FluentChatMessageComponentWrapper.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAKpD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AACxC,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,uBAAuB,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAWtH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,KAA6C,EAAe,EAAE;IAC9G,MAAM,EACJ,OAAO,EACP,MAAM,EACN,6BAA6B,EAC7B,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,mBAAmB;IACnB,0DAA0D;IAC1D,uBAAuB;IACvB,gDAAgD;IAChD,kBAAkB;IAClB,0CAA0C;IAC1C,cAAc;IACd,+CAA+C;IAC/C,mBAAmB,EACnB,MAAM;IACN,+CAA+C;IAC/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AAC,CAAC;IAEpF,8EAA8E;IAC9E,uFAAuF;IACvF,iFAAiF;IACjF,2EAA2E;IAC3E,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC1B,OAAO,CACL;YACE,oBAAC,mBAAmB,IAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,kBAAkB,EACxB,UAAU,EAAE,mBAAmB,IAE9B,eAAe,mBAAM,KAAK,EAAG,CACV,CAClB,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CACL;YACE,oBAAC,iBAAiB,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAClG,eAAe,mBAAM,KAAK,EAAG,CACZ,CAChB,CACP,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus, _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport { MessageProps, _ChatMessageProps } from '../MessageThread';\nimport { ChatMessage } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\nimport {\n gutterWithAvatar,\n gutterWithHiddenAvatar,\n noMessageStatusStyle,\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 { MessageStatusIndicatorProps } from '../MessageStatusIndicator';\nimport { ChatMessageComponentWrapperProps } from './ChatMessageComponentWrapper';\nimport { ChatMessageComponent } from './ChatMessageComponent';\nimport { ChatMessage as FluentChatMessage, ChatMyMessage as FluentChatMyMessage } from '@fluentui-contrib/react-chat';\n\n/**\n * Props for {@link FluentChatMessageComponentWrapper}\n *\n * @private\n */\ntype 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 FluentChatMessageComponentWrapper = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n const {\n message,\n styles,\n shouldOverlapAvatarAndMessage,\n onRenderMessage,\n onRenderAvatar,\n showMessageStatus,\n onRenderMessageStatus,\n participantCount,\n readCount,\n onActionButtonClick,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler,\n userId,\n /* @conditional-compile-remove(file-sharing) */\n onRenderFileDownloads,\n defaultStatusRenderer,\n statusToRender\n } = props;\n const chatMessageRenderStyles = useChatMessageRenderStyles();\n\n const onRenderFileDownloadsMemo = useMemo(() => {\n /* @conditional-compile-remove(file-sharing) */\n return onRenderFileDownloads;\n return undefined;\n }, [/* @conditional-compile-remove(file-sharing) */ onRenderFileDownloads]);\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 <ChatMessageComponent\n {...messageProps}\n /* @conditional-compile-remove(file-sharing) */\n onRenderFileDownloads={onRenderFileDownloadsMemo}\n /* @conditional-compile-remove(file-sharing) */\n strings={messageProps.strings}\n message={messageProps.message}\n userId={userId}\n remoteParticipantsCount={participantCount ? participantCount - 1 : 0}\n shouldOverlapAvatarAndMessage={shouldOverlapAvatarAndMessage}\n onRenderAvatar={onRenderAvatar}\n showMessageStatus={showMessageStatus}\n messageStatus={messageProps.message.status}\n onActionButtonClick={onActionButtonClick}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={onDisplayDateTimeString}\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions={inlineImageOptions}\n /* @conditional-compile-remove(mention) */\n mentionOptions={mentionOptions}\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler={fileDownloadHandler}\n />\n );\n }\n return <></>;\n },\n [\n onActionButtonClick,\n onRenderAvatar,\n onRenderFileDownloadsMemo,\n participantCount,\n shouldOverlapAvatarAndMessage,\n showMessageStatus,\n userId,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n /* @conditional-compile-remove(image-overlay) */\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionOptions,\n /* @conditional-compile-remove(file-sharing) */\n fileDownloadHandler,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n new Date().toDateString()\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 messageStatusRenderer = useCallback(\n (\n onRenderMessageStatus:\n | ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null)\n | undefined,\n defaultStatusRenderer: (\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage,\n participantCount: number,\n readCount: number,\n status?: MessageStatus\n ) => JSX.Element,\n showMessageStatus?: boolean,\n participantCount?: number,\n readCount?: number\n ) => {\n return showMessageStatus && statusToRender ? (\n onRenderMessageStatus ? (\n onRenderMessageStatus({ status: message.status })\n ) : (\n defaultStatusRenderer(message, participantCount ?? 0, readCount ?? 0, message.status)\n )\n ) : (\n <div className={mergeStyles(noMessageStatusStyle)} />\n );\n },\n [message, statusToRender]\n );\n\n const shouldShowAvatar = useMemo(() => {\n return message.attached === 'top' || message.attached === false;\n }, [message.attached]);\n\n const attached = useMemo(() => {\n return shouldShowAvatar ? 'top' : 'center';\n }, [shouldShowAvatar]);\n\n const myMessageRootProps = useMemo(() => {\n return {\n // myChatItemMessageContainer used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageRenderStyles.rootMyMessage,\n chatMessageRenderStyles.rootCommon,\n mergeStyles(styles?.myChatItemMessageContainer)\n ),\n style:\n styles?.myChatItemMessageContainer !== undefined\n ? createStyleFromV8Style(styles?.myChatItemMessageContainer)\n : {},\n role: 'none'\n };\n }, [chatMessageRenderStyles.rootCommon, chatMessageRenderStyles.rootMyMessage, styles?.myChatItemMessageContainer]);\n\n const myMessageBodyProps = useMemo(() => {\n return {\n className: mergeClasses(chatMessageRenderStyles.bodyCommon, chatMessageRenderStyles.bodyMyMessage),\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n tabIndex: -1,\n role: 'none'\n };\n }, [chatMessageRenderStyles.bodyCommon, chatMessageRenderStyles.bodyMyMessage]);\n\n const myMessageStatusIcon = useMemo(() => {\n return (\n <div\n className={mergeStyles(\n { paddingLeft: '0.25rem' },\n styles?.messageStatusContainer ? styles.messageStatusContainer(message.mine ?? false) : ''\n )}\n >\n {message.status\n ? messageStatusRenderer(\n onRenderMessageStatus,\n defaultStatusRenderer,\n showMessageStatus,\n participantCount,\n readCount\n )\n : undefined}\n </div>\n );\n }, [\n defaultStatusRenderer,\n message.mine,\n message.status,\n messageStatusRenderer,\n onRenderMessageStatus,\n participantCount,\n readCount,\n showMessageStatus,\n styles\n ]);\n\n const messageRootProps = useMemo(() => {\n return { className: mergeClasses(chatMessageRenderStyles.rootMessage, chatMessageRenderStyles.rootCommon) };\n }, [chatMessageRenderStyles.rootCommon, chatMessageRenderStyles.rootMessage]);\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 ? chatMessageRenderStyles.bodyWithoutAvatar : chatMessageRenderStyles.bodyWithAvatar,\n shouldOverlapAvatarAndMessage ? chatMessageRenderStyles.avatarOverlap : chatMessageRenderStyles.avatarNoOverlap,\n mergeStyles(styles?.chatItemMessageContainer)\n ),\n style:\n styles?.chatItemMessageContainer !== undefined ? createStyleFromV8Style(styles?.chatItemMessageContainer) : {},\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n tabIndex: -1,\n role: 'none'\n };\n }, [\n chatMessageRenderStyles.avatarNoOverlap,\n chatMessageRenderStyles.avatarOverlap,\n chatMessageRenderStyles.bodyCommon,\n chatMessageRenderStyles.bodyWithAvatar,\n chatMessageRenderStyles.bodyWithoutAvatar,\n shouldOverlapAvatarAndMessage,\n shouldShowAvatar,\n styles?.chatItemMessageContainer\n ]);\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 return (\n <div className={mergeStyles(chatAvatarStyle)}>\n {onRenderAvatar ? onRenderAvatar?.(message.senderId, personaOptions) : <Persona {...personaOptions} />}\n </div>\n );\n }, [message.senderDisplayName, message.senderId, onRenderAvatar, shouldShowAvatar]);\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 // Status and avatar should be shown for both custom and default renderers.\n if (message.mine === true) {\n return (\n <div>\n <FluentChatMyMessage\n attached={attached}\n root={myMessageRootProps}\n body={myMessageBodyProps}\n statusIcon={myMessageStatusIcon}\n >\n {messageRenderer({ ...props })}\n </FluentChatMyMessage>\n </div>\n );\n } else {\n return (\n <div>\n <FluentChatMessage attached={attached} root={messageRootProps} body={messageBodyProps} avatar={avatar}>\n {messageRenderer({ ...props })}\n </FluentChatMessage>\n </div>\n );\n }\n};\n"]}
|