@azure/communication-react 1.17.0-alpha-202406020014 → 1.17.0-alpha-202406050014

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 (106) hide show
  1. package/dist/communication-react.d.ts +7 -8
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-BQpOd_cF.js → ChatMessageComponentAsRichTextEditBox-CueWJlOs.js} +12 -12
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-CueWJlOs.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CBQNEhRD.js → RichTextSendBoxWrapper-DORQ6cdT.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CBQNEhRD.js.map → RichTextSendBoxWrapper-DORQ6cdT.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-xYWFdTrM.js → index-B4rHuheV.js} +240 -216
  7. package/dist/dist-cjs/communication-react/index-B4rHuheV.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.d.ts +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  13. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +1 -1
  14. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +4 -4
  15. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  16. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +6 -6
  17. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  18. package/dist/dist-esm/communication-react/src/index.d.ts +4 -2
  19. package/dist/dist-esm/communication-react/src/index.js +1 -1
  20. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  21. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.d.ts +1 -1
  22. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +30 -13
  23. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
  24. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  25. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +4 -4
  26. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  27. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +9 -9
  28. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  29. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +7 -7
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +12 -12
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +14 -14
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +2 -1
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +5 -5
  38. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  39. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +9 -9
  40. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  41. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +10 -10
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  43. package/dist/dist-esm/react-components/src/components/ErrorBar.js +1 -1
  44. package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
  45. package/dist/dist-esm/react-components/src/components/MessageThread.js +4 -4
  46. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  47. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +6 -7
  48. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
  49. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +32 -32
  50. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  51. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js +6 -6
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +1 -1
  53. package/dist/dist-esm/react-components/src/components/SendBox.js +22 -22
  54. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  56. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js +5 -3
  57. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +2 -2
  59. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +7 -7
  61. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  62. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +10 -9
  63. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +4 -4
  65. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  66. package/dist/dist-esm/react-components/src/components/utils/common.js +2 -2
  67. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/theming/icons.js +8 -6
  69. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  71. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +0 -1
  72. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  73. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +3 -3
  74. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  75. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -1
  76. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -2
  77. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  78. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +2 -2
  79. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  80. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +1 -1
  81. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +2 -2
  82. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  83. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +4 -4
  84. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +30 -26
  86. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  87. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
  88. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +2 -2
  89. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +7 -7
  90. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -2
  92. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  93. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +1 -0
  94. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
  95. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +11 -4
  96. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
  97. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
  98. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +4 -4
  99. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  100. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  101. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
  102. package/dist/dist-esm/react-composites/src/composites/common/icons.js +2 -2
  103. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  104. package/package.json +2 -2
  105. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BQpOd_cF.js.map +0 -1
  106. package/dist/dist-cjs/communication-react/index-xYWFdTrM.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,qGAAqG;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,sDAAsD;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAkDpF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,aAAa,GAAG,0BAA0B,EAAE,CAAC;IACnD,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAC;IAEjE,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,UAA8B,EAC9B,aAA8C,EAC9C,OAAqB,EACrB,MAA0F,EAClE,EAAE;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AA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,kBAAkB;KAElC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyB;IAC/D;;;;;;;;;;OAUG;IACH,IAAI,EAAE,UAAU;IAChB,6DAA6D;IAC7D,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAY,wCAAwC,GAAG;IAChG,wDAAwD;IACxD,OAAO,EAAE,CAAC,UAA8B,EAAE,EAAE;QAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YACrF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\n/* @conditional-compile-remove(attachment-download) */\nimport { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\nimport { mergeClasses } from '@griffel/react';\nimport { _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /** Aria label to notify user when focus is on attachment download button. */\n downloadAttachment: string;\n /** Aria label to notify user when focus is on attachment open button. */\n openAttachment: string;\n attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * A chat message metadata that includes attachment metadata\n */\n attachments?: AttachmentMetadata[];\n /**\n * A chat message metadata that includes attachment metadata\n */\n message?: ChatMessage;\n /**\n * Optional callback to handle attachment download\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional callback that runs if downloadHandler returns an error.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional aria label strings for attachment download cards\n */\n strings?: _AttachmentDownloadCardsStrings;\n}\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n const attachmentCardGroupStyles = useAttachmentCardGroupStyles();\n\n const getMenuActions = useCallback(\n (\n attachment: AttachmentMetadata,\n localeStrings: _AttachmentDownloadCardsStrings,\n message?: ChatMessage,\n action?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[]\n ): AttachmentMenuAction[] => {\n const defaultMenuActions = getDefaultMenuActions(localeStrings, message);\n try {\n const actions = action?.(attachment, message);\n if (actions && actions.length > 0) {\n return actions;\n } else {\n return defaultMenuActions;\n }\n } catch (error) {\n return defaultMenuActions;\n }\n },\n []\n );\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(attachment-download) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n const hasMultipleAttachments = useMemo(() => {\n return (props.attachments?.length ?? 0) > 1;\n }, [props.attachments]);\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div\n className={mergeClasses(\n attachmentCardGroupStyles.root,\n hasMultipleAttachments\n ? attachmentCardGroupStyles.multipleAttachments\n : attachmentCardGroupStyles.singleAttachment\n )}\n data-ui-id=\"attachment-download-card-group\"\n >\n <_AttachmentCardGroup\n ariaLabel={attachmentCardGroupDescription()}\n attachmentGroupLayout={_AttachmentCardGroupLayout.Grid}\n >\n {attachments &&\n attachments.map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n selfResizing={hasMultipleAttachments}\n />\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useLocale().strings.messageThread;\n return { downloadAttachment: '', openAttachment: '', attachmentCardGroupMessage: '' };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n // if message is sent by a Teams user, we need to use a different icon (\"open\")\n if (chatMessage?.senderId?.includes('8:orgid:')) {\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.openAttachment,\n icon: <Icon iconName=\"OpenAttachment\" />\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.downloadAttachment\n }\n ];\n};\n\n/**\n * @beta\n *\n * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.\n */\nexport const defaultAttachmentMenuAction: AttachmentMenuAction = {\n /**\n *\n * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.\n * by default it's an unlocalized string when this is used as a imported constant,\n * but you can overwrite it with your own localized string.\n *\n * i.e. defaultAttachmentMenuAction.name = localize('Download');\n *\n * when no action is provided, the UI library will overwrite this name\n * with a localized string this string when it's used in the UI.\n */\n name: 'Download',\n // this is the icon shown on the right of the attachment card\n icon: <Icon iconName=\"DownloadAttachment\" data-ui-id=\"attachment-download-card-download-icon\" />,\n // this is the action that runs when the icon is clicked\n onClick: (attachment: AttachmentMetadata) => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\n });\n }\n};\n"]}
1
+ {"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,2GAA2G;AAC3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAmDpF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,aAAa,GAAG,0BAA0B,EAAE,CAAC;I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AU,CAAC,EAAE,CAAC;QAChD,OAAO;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,gBAAgB,GAAG;gBACxC,OAAO,EAAE,qBAAqB;aAC/B;SACF,CAAC;IACJ,CAAC;IACD,+CAA+C;IAC/C,mDAAmD;IACnD,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC;IACvC,OAAO;wCAEA,2BAA2B,KAC9B,IAAI,EAAE,UAAU;KAEnB,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,UAA8B,EAAiB,EAAE;IAC9E,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QACrF,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyB;IAC/D;;;;;;;;;;OAUG;IACH,IAAI,EAAE,UAAU;IAChB,6DAA6D;IAC7D,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAY,wCAAwC,GAAG;IAChG,wDAAwD;IACxD,OAAO,EAAE,qBAAqB;CAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\nimport { mergeClasses } from '@griffel/react';\nimport { _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /* @conditional-compile-remove(file-sharing-acs) */\n /** Aria label to notify user when focus is on attachment download button. */\n downloadAttachment: string;\n /** Aria label to notify user when focus is on attachment open button. */\n openAttachment: string;\n attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * A chat message metadata that includes attachment metadata\n */\n attachments?: AttachmentMetadata[];\n /**\n * A chat message metadata that includes attachment metadata\n */\n message?: ChatMessage;\n /**\n * Optional callback to handle attachment download\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional callback that runs if downloadHandler returns an error.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional aria label strings for attachment download cards\n */\n strings?: _AttachmentDownloadCardsStrings;\n}\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n const attachmentCardGroupStyles = useAttachmentCardGroupStyles();\n\n const getMenuActions = useCallback(\n (\n attachment: AttachmentMetadata,\n localeStrings: _AttachmentDownloadCardsStrings,\n message?: ChatMessage,\n action?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[]\n ): AttachmentMenuAction[] => {\n const defaultMenuActions = getDefaultMenuActions(localeStrings, message);\n try {\n const actions = action?.(attachment, message);\n if (actions && actions.length > 0) {\n return actions;\n } else {\n return defaultMenuActions;\n }\n } catch (error) {\n return defaultMenuActions;\n }\n },\n []\n );\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n const hasMultipleAttachments = useMemo(() => {\n return (props.attachments?.length ?? 0) > 1;\n }, [props.attachments]);\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div\n className={mergeClasses(\n attachmentCardGroupStyles.root,\n hasMultipleAttachments\n ? attachmentCardGroupStyles.multipleAttachments\n : attachmentCardGroupStyles.singleAttachment\n )}\n data-ui-id=\"attachment-download-card-group\"\n >\n <_AttachmentCardGroup\n ariaLabel={attachmentCardGroupDescription()}\n attachmentGroupLayout={_AttachmentCardGroupLayout.Grid}\n >\n {attachments &&\n attachments.map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n selfResizing={hasMultipleAttachments}\n />\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n return useLocale().strings.messageThread;\n return {\n /* @conditional-compile-remove(file-sharing-acs) */\n downloadAttachment: '',\n openAttachment: '',\n attachmentCardGroupMessage: ''\n };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n let actionName = locale.openAttachment;\n // if message is sent by a Teams user, we need to use a different icon (\"open\")\n if (chatMessage?.senderId?.includes('8:orgid:')) {\n return [\n {\n name: actionName,\n icon: <Icon iconName=\"OpenAttachment\" />,\n onClick: defaultOnClickHandler\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n /* @conditional-compile-remove(file-sharing-acs) */\n actionName = locale.downloadAttachment;\n return [\n {\n ...defaultAttachmentMenuAction,\n name: actionName\n }\n ];\n};\n\n/**\n *\n * The default action handler for downloading attachments. This handler will open the attachment's URL in a new tab.\n */\nconst defaultOnClickHandler = (attachment: AttachmentMetadata): Promise<void> => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\n });\n};\n\n/**\n * @beta\n *\n * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.\n */\nexport const defaultAttachmentMenuAction: AttachmentMenuAction = {\n /**\n *\n * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.\n * by default it's an unlocalized string when this is used as a imported constant,\n * but you can overwrite it with your own localized string.\n *\n * i.e. defaultAttachmentMenuAction.name = localize('Download');\n *\n * when no action is provided, the UI library will overwrite this name\n * with a localized string this string when it's used in the UI.\n */\n name: 'Download',\n // this is the icon shown on the right of the attachment card\n icon: <Icon iconName=\"DownloadAttachment\" data-ui-id=\"attachment-download-card-download-icon\" />,\n // this is the action that runs when the icon is clicked\n onClick: defaultOnClickHandler\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentWrapper.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentWrapper.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OA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AAS,CAAC,CAAC,CAAC,yCAAK,CAAC,CAAC,CAAC,eAAe,mBAAM,KAAK,EAAG,CAAC;YACrG,OAAO,CACL,6BAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,IAC5C,sBAAsB,CACnB,CACP,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAA6C,EAAe,EAAE;IACzF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,oBAAC,4BAA4B,oBAAK,KAAK,EAAI,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,oBAAC,0BAA0B,oBAAK,KAAK,EAAI,CAAC;IACnD,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { MessageProps, MessageRenderer, MessageThreadStyles, _ChatMessageProps } from '../MessageThread';\nimport { ChatMessage, OnRenderAvatarCallback } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../types/Attachment';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from '../MentionPopover';\nimport { MessageStatusIndicatorProps } from '../MessageStatusIndicator';\nimport { FluentChatMessageComponentWrapperProps } from './MessageComponents/FluentChatMessageComponent';\nimport { DefaultSystemMessage } from './DefaultSystemMessage';\nimport { InlineImageOptions } from './ChatMessageContent';\nimport { FluentChatMyMessageComponent } from './MyMessageComponents/FluentChatMyMessageComponent';\nimport { FluentChatMessageComponent } from './MessageComponents/FluentChatMessageComponent';\n\n/**\n * Props for {@link ChatMessageComponentWrapper}\n *\n * @private\n */\nexport type ChatMessageComponentWrapperProps = _ChatMessageProps & {\n /**\n * UserId of the current user.\n */\n userId: string;\n styles: MessageThreadStyles | undefined;\n shouldOverlapAvatarAndMessage: boolean;\n onRenderMessageStatus: ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null) | 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 onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n onRenderAvatar?: OnRenderAvatarCallback;\n showMessageStatus?: boolean;\n participantCount?: number;\n readCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (\n readBy: {\n id: string;\n displayName: string;\n }[]\n ) => void\n ) => void;\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(mention) */\n mentionOptions?: MentionOptions;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /* @conditional-compile-remove(rich-text-editor) */\n richTextEditor?: boolean;\n};\n\n/**\n * The wrapper component to display different types of chat message.\n *\n * @private\n */\nexport const ChatMessageComponentWrapper = (props: ChatMessageComponentWrapperProps): JSX.Element => {\n const { message, styles, onRenderMessage, key: messageKey } = props;\n\n const systemMessageStyle = useMemo(() => {\n return {\n paddingTop: '0.5rem'\n };\n }, []);\n\n const customMessageStyle = useMemo(() => {\n return { paddingTop: '1rem', paddingBottom: '0.25rem' };\n }, []);\n\n /* @conditional-compile-remove(data-loss-prevention) */\n // Similar logic as switch statement case 'chat', if statement for conditional compile (merge logic to switch case when stabilize)\n if (message.messageType === 'blocked') {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const blockedMessageStyle = styles?.blockedMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n switch (message.messageType) {\n case 'chat': {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const chatMessageStyle = styles?.chatMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n case 'system': {\n const messageContainerStyle = styles?.systemMessageContainer;\n const systemMessageComponent =\n onRenderMessage === undefined ? (\n <DefaultSystemMessage {...props} />\n ) : (\n onRenderMessage({ ...props, messageContainerStyle }, (props) => <DefaultSystemMessage {...props} />)\n );\n return (\n <div key={messageKey} style={systemMessageStyle}>\n {systemMessageComponent}\n </div>\n );\n }\n\n default: {\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage({ ...props });\n return (\n <div key={messageKey} style={customMessageStyle}>\n {customMessageComponent}\n </div>\n );\n }\n }\n};\n\nconst fluentChatComponent = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n if (props.message.mine === true) {\n return <FluentChatMyMessageComponent {...props} />;\n } else {\n return <FluentChatMessageComponent {...props} />;\n }\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentWrapper.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentWrapper.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;A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R,mHAAmH;YACnH,MAAM,sBAAsB,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,yCAAK,CAAC,CAAC,CAAC,eAAe,mBAAM,KAAK,EAAG,CAAC;YACrG,OAAO,CACL,6BAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,IAC5C,sBAAsB,CACnB,CACP,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAA6C,EAAe,EAAE;IACzF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,oBAAC,4BAA4B,oBAAK,KAAK,EAAI,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,oBAAC,0BAA0B,oBAAK,KAAK,EAAI,CAAC;IACnD,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { MessageProps, MessageRenderer, MessageThreadStyles, _ChatMessageProps } from '../MessageThread';\nimport { ChatMessage, 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(mention) */\nimport { MentionOptions } from '../MentionPopover';\nimport { MessageStatusIndicatorProps } from '../MessageStatusIndicator';\nimport { FluentChatMessageComponentWrapperProps } from './MessageComponents/FluentChatMessageComponent';\nimport { DefaultSystemMessage } from './DefaultSystemMessage';\nimport { InlineImageOptions } from './ChatMessageContent';\nimport { FluentChatMyMessageComponent } from './MyMessageComponents/FluentChatMyMessageComponent';\nimport { FluentChatMessageComponent } from './MessageComponents/FluentChatMessageComponent';\n\n/**\n * Props for {@link ChatMessageComponentWrapper}\n *\n * @private\n */\nexport type ChatMessageComponentWrapperProps = _ChatMessageProps & {\n /**\n * UserId of the current user.\n */\n userId: string;\n styles: MessageThreadStyles | undefined;\n shouldOverlapAvatarAndMessage: boolean;\n onRenderMessageStatus: ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null) | 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 onRenderMessage?: (messageProps: MessageProps, messageRenderer?: MessageRenderer) => JSX.Element;\n onRenderAvatar?: OnRenderAvatarCallback;\n showMessageStatus?: boolean;\n participantCount?: number;\n readCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (\n readBy: {\n id: string;\n displayName: string;\n }[]\n ) => void\n ) => void;\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(mention) */\n mentionOptions?: MentionOptions;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\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 /* @conditional-compile-remove(rich-text-editor) */\n richTextEditor?: boolean;\n};\n\n/**\n * The wrapper component to display different types of chat message.\n *\n * @private\n */\nexport const ChatMessageComponentWrapper = (props: ChatMessageComponentWrapperProps): JSX.Element => {\n const { message, styles, onRenderMessage, key: messageKey } = props;\n\n const systemMessageStyle = useMemo(() => {\n return {\n paddingTop: '0.5rem'\n };\n }, []);\n\n const customMessageStyle = useMemo(() => {\n return { paddingTop: '1rem', paddingBottom: '0.25rem' };\n }, []);\n\n /* @conditional-compile-remove(data-loss-prevention) */\n // Similar logic as switch statement case 'chat', if statement for conditional compile (merge logic to switch case when stabilize)\n if (message.messageType === 'blocked') {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const blockedMessageStyle = styles?.blockedMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n switch (message.messageType) {\n case 'chat': {\n const myChatMessageStyle =\n message.status === 'failed'\n ? styles?.failedMyChatMessageContainer ?? styles?.myChatMessageContainer\n : styles?.myChatMessageContainer;\n const chatMessageStyle = styles?.chatMessageContainer;\n const messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;\n return fluentChatComponent({ ...props, message: message, messageContainerStyle: messageContainerStyle });\n }\n\n case 'system': {\n const messageContainerStyle = styles?.systemMessageContainer;\n const systemMessageComponent =\n onRenderMessage === undefined ? (\n <DefaultSystemMessage {...props} />\n ) : (\n onRenderMessage({ ...props, messageContainerStyle }, (props) => <DefaultSystemMessage {...props} />)\n );\n return (\n <div key={messageKey} style={systemMessageStyle}>\n {systemMessageComponent}\n </div>\n );\n }\n\n default: {\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage({ ...props });\n return (\n <div key={messageKey} style={customMessageStyle}>\n {customMessageComponent}\n </div>\n );\n }\n }\n};\n\nconst fluentChatComponent = (props: FluentChatMessageComponentWrapperProps): JSX.Element => {\n if (props.message.mine === true) {\n return <FluentChatMyMessageComponent {...props} />;\n } else {\n return <FluentChatMessageComponent {...props} />;\n }\n};\n"]}
@@ -61,7 +61,7 @@ export const BlockedMessageContent = (props) => {
61
61
  const extractContentForAllyMessage = (props) => {
62
62
  var _a;
63
63
  let attachments = undefined;
64
- /* @conditional-compile-remove(attachment-download) */
64
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
65
65
  attachments = props.message.attachments;
66
66
  if (props.message.content || attachments) {
67
67
  // Replace all <img> tags with 'image' for aria.
@@ -79,7 +79,7 @@ const extractContentForAllyMessage = (props) => {
79
79
  });
80
80
  // Inject message attachment count for aria.
81
81
  // this is only applying to file attachments not for inline images.
82
- /* @conditional-compile-remove(attachment-download) */
82
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
83
83
  if (attachments && attachments.length > 0) {
84
84
  const attachmentCardDescription = attachmentCardGroupDescription(props);
85
85
  const attachmentTextNode = document.createElement('div');
@@ -109,12 +109,12 @@ const messageContentAriaText = (props) => {
109
109
  message: message
110
110
  });
111
111
  };
112
- /* @conditional-compile-remove(attachment-download) */
112
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
113
113
  const attachmentCardGroupDescription = (props) => {
114
114
  const attachments = props.message.attachments;
115
115
  return getAttachmentCountLiveMessage(attachments !== null && attachments !== void 0 ? attachments : [], props.strings.attachmentCardGroupMessage);
116
116
  };
117
- /* @conditional-compile-remove(attachment-download) */
117
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
118
118
  /**
119
119
  * @private
120
120
  */
@@ -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,E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AAM,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(attachment-download) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\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};\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}>\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 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 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(attachment-download) */\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(attachment-download) */\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 message: message\n })\n : _formatString(props.strings.messageContentAriaText, {\n author: `${props.message.senderDisplayName}`,\n message: message\n });\n};\n\n/* @conditional-compile-remove(attachment-download) */\nconst attachmentCardGroupDescription = (props: ChatMessageContentProps): string => {\n const attachments = props.message.attachments;\n return getAttachmentCountLiveMessage(attachments ?? [], props.strings.attachmentCardGroupMessage);\n};\n\n/* @conditional-compile-remove(attachment-download) */\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') {\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 domNode.attribs['aria-label'] = domNode.attribs.name;\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];\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,EAAE,aAAa,EAAE,sCAAgC;AACxD,OAAO,KAAK,EAAE,EAA0B,OAAO,IAAI,UAAU,EAAE,MAA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AAC,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 { _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\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};\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}>\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 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 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 message: message\n })\n : _formatString(props.strings.messageContentAriaText, {\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') {\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 domNode.attribs['aria-label'] = domNode.attribs.name;\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];\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"]}
@@ -11,7 +11,7 @@ import { createStyleFromV8Style } from '../../styles/v8StyleShim';
11
11
  import { mergeClasses } from '@fluentui/react-components';
12
12
  import { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';
13
13
  import { generateCustomizedTimestamp, generateDefaultTimestamp, getMessageBubbleContent, getMessageEditedDetails } from '../../utils/ChatMessageComponentUtils';
14
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
14
+ /* @conditional-compile-remove(file-sharing-acs) */
15
15
  import { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
16
16
  /** @private */
17
17
  const MessageBubble = (props) => {
@@ -19,9 +19,9 @@ const MessageBubble = (props) => {
19
19
  const theme = useTheme();
20
20
  const locale = useLocale();
21
21
  const { userId, message, showDate, messageContainerStyle, strings,
22
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
22
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
23
23
  onRenderAttachmentDownloads, inlineImageOptions, shouldOverlapAvatarAndMessage,
24
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
24
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
25
25
  actionsForAttachment,
26
26
  /* @conditional-compile-remove(mention) */
27
27
  mentionDisplayOptions, onDisplayDateTimeString } = props;
@@ -41,22 +41,22 @@ const MessageBubble = (props) => {
41
41
  return getMessageBubbleContent(message, strings, userId, inlineImageOptions,
42
42
  /* @conditional-compile-remove(mention) */
43
43
  mentionDisplayOptions,
44
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
44
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
45
45
  onRenderAttachmentDownloads,
46
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
46
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
47
47
  actionsForAttachment);
48
48
  }, [
49
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,
49
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ actionsForAttachment,
50
50
  inlineImageOptions,
51
51
  /* @conditional-compile-remove(mention) */ mentionDisplayOptions,
52
52
  message,
53
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentDownloads,
53
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ onRenderAttachmentDownloads,
54
54
  strings,
55
55
  userId
56
56
  ]);
57
57
  const isBlockedMessage = false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';
58
58
  const chatMessageCommonStyles = useChatMessageCommonStyles();
59
- /* @conditional-compile-remove(attachment-upload) */
59
+ /* @conditional-compile-remove(file-sharing-acs) */
60
60
  const hasMultipleAttachments = useMemo(() => {
61
61
  return doesMessageContainMultipleAttachments(message);
62
62
  }, [message]);
@@ -68,7 +68,7 @@ const MessageBubble = (props) => {
68
68
  : props.message.status === 'failed'
69
69
  ? chatMessageCommonStyles.failed
70
70
  : undefined, shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,
71
- /* @conditional-compile-remove(attachment-upload) */
71
+ /* @conditional-compile-remove(file-sharing-acs) */
72
72
  hasMultipleAttachments ? chatMessageStyles.multipleAttachments : undefined, message.attached === 'top' || message.attached === false
73
73
  ? chatMessageStyles.bodyWithAvatar
74
74
  : chatMessageStyles.bodyWithoutAvatar,
@@ -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,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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,gBACU,wBAAwB,EACnC,SAAS,EACP,oBAAC,IAAI,IAAC,SAAS,EAAE,oBAAoB,gBAAc,GAAG,CAAC,gBAAgB,IACpE,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 { chatMessageDateStyle, chatMessageAuthorStyle } 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(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n inlineImageOptions,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ 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(attachment-upload) */\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 chatMessageStyles.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(attachment-upload) */\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-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 </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,W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I;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,gBACU,wBAAwB,EACnC,SAAS,EACP,oBAAC,IAAI,IAAC,SAAS,EAAE,oBAAoB,gBAAc,GAAG,CAAC,gBAAgB,IACpE,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 { chatMessageDateStyle, chatMessageAuthorStyle } 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 chatMessageStyles.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-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 </div>\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
@@ -20,14 +20,14 @@ export const FluentChatMessageComponent = (props) => {
20
20
  const { message, styles, shouldOverlapAvatarAndMessage, onRenderMessage, onRenderAvatar,
21
21
  /* @conditional-compile-remove(date-time-customization) */
22
22
  onDisplayDateTimeString, inlineImageOptions,
23
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
23
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
24
24
  actionsForAttachment, userId,
25
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
25
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
26
26
  onRenderAttachmentDownloads,
27
27
  /* @conditional-compile-remove(mention) */
28
28
  mentionOptions } = props;
29
29
  const chatMessageRenderStyles = useChatMessageRenderStyles();
30
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
30
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
31
31
  const onRenderAttachmentDownloadsMemo = useMemo(() => {
32
32
  return onRenderAttachmentDownloads;
33
33
  return undefined;
@@ -38,25 +38,25 @@ export const FluentChatMessageComponent = (props) => {
38
38
  if (messageProps.message.messageType === 'chat' ||
39
39
  /* @conditional-compile-remove(data-loss-prevention) */ messageProps.message.messageType === 'blocked') {
40
40
  return (React.createElement(ChatMessageComponentAsMessageBubble, Object.assign({}, messageProps, {
41
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
41
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
42
42
  onRenderAttachmentDownloads: onRenderAttachmentDownloadsMemo, strings: messageProps.strings, message: messageProps.message, userId: userId, shouldOverlapAvatarAndMessage: shouldOverlapAvatarAndMessage,
43
43
  /* @conditional-compile-remove(date-time-customization) */
44
44
  onDisplayDateTimeString: onDisplayDateTimeString, inlineImageOptions: inlineImageOptions,
45
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
45
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
46
46
  actionsForAttachment: actionsForAttachment,
47
47
  /* @conditional-compile-remove(mention) */
48
48
  mentionDisplayOptions: mentionOptions === null || mentionOptions === void 0 ? void 0 : mentionOptions.displayOptions })));
49
49
  }
50
50
  return React.createElement(React.Fragment, null);
51
51
  }, [
52
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
52
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
53
53
  onRenderAttachmentDownloadsMemo,
54
54
  userId,
55
55
  shouldOverlapAvatarAndMessage,
56
56
  /* @conditional-compile-remove(date-time-customization) */
57
57
  onDisplayDateTimeString,
58
58
  inlineImageOptions,
59
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
59
+ /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
60
60
  actionsForAttachment,
61
61
  /* @conditional-compile-remove(mention) */
62
62
  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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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 /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment,\n userId,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(mention) */\n mentionOptions\n } = props;\n const chatMessageRenderStyles = useChatMessageRenderStyles();\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\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(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment={actionsForAttachment}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={mentionOptions?.displayOptions}\n />\n );\n }\n return <></>;\n },\n [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloadsMemo,\n userId,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString,\n inlineImageOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\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/FluentChatMessage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,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"]}
@@ -6,20 +6,20 @@ import { mergeClasses } from '@fluentui/react-components';
6
6
  import { _formatString } from "../../../../../acs-ui-common/src";
7
7
  import { useTheme } from '../../../theming/FluentThemeProvider';
8
8
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
9
- /* @conditional-compile-remove(attachment-upload) */
9
+ /* @conditional-compile-remove(file-sharing-acs) */
10
10
  import { useReducer } from 'react';
11
11
  import { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../../styles/EditBox.styles';
12
12
  import { InputBoxComponent } from '../../InputBoxComponent';
13
13
  import { InputBoxButton } from '../../InputBoxButton';
14
14
  import { useChatMyMessageStyles } from '../../styles/MessageThread.styles';
15
- /* @conditional-compile-remove(attachment-upload) */
15
+ /* @conditional-compile-remove(file-sharing-acs) */
16
16
  import { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';
17
17
  import { chatMessageFailedTagStyle, editChatMessageFailedTagStyle, chatMessageFailedTagStackItemStyle, editChatMessageButtonsStackStyle, useChatMessageEditContainerStyles } from '../../styles/ChatMessageComponent.styles';
18
18
  import { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';
19
- /* @conditional-compile-remove(attachment-upload) */
19
+ /* @conditional-compile-remove(file-sharing-acs) */
20
20
  import { attachmentMetadataReducer, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
21
21
  import { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';
22
- /* @conditional-compile-remove(attachment-upload) */
22
+ /* @conditional-compile-remove(file-sharing-acs) */
23
23
  import { getMessageWithAttachmentMetadata } from '../../utils/ChatMessageComponentAsEditBoxUtils';
24
24
  /**
25
25
  * @private
@@ -30,12 +30,12 @@ export const ChatMessageComponentAsEditBox = (props) => {
30
30
  /* @conditional-compile-remove(mention) */
31
31
  const { mentionLookupOptions } = props;
32
32
  const [textValue, setTextValue] = useState(message.content || '');
33
- /* @conditional-compile-remove(attachment-upload) */
33
+ /* @conditional-compile-remove(file-sharing-acs) */
34
34
  const [attachmentMetadata, handleAttachmentAction] = useReducer(attachmentMetadataReducer, (_a = getMessageWithAttachmentMetadata(message)) !== null && _a !== void 0 ? _a : []);
35
35
  const editTextFieldRef = React.useRef(null);
36
36
  const theme = useTheme();
37
37
  const messageState = getMessageState(textValue,
38
- /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata !== null && attachmentMetadata !== void 0 ? attachmentMetadata : []);
38
+ /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata !== null && attachmentMetadata !== void 0 ? attachmentMetadata : []);
39
39
  const submitEnabled = messageState === 'OK';
40
40
  const editContainerStyles = useChatMessageEditContainerStyles();
41
41
  const chatMyMessageStyles = useChatMyMessageStyles();
@@ -59,14 +59,14 @@ export const ChatMessageComponentAsEditBox = (props) => {
59
59
  const onRenderThemedSubmitIcon = useCallback((isHover) => {
60
60
  return onRenderSubmitIcon(iconClassName(isHover));
61
61
  }, [iconClassName]);
62
- /* @conditional-compile-remove(attachment-upload) */
62
+ /* @conditional-compile-remove(file-sharing-acs) */
63
63
  const hasMultipleAttachments = useMemo(() => {
64
64
  return doesMessageContainMultipleAttachments(message);
65
65
  }, [message]);
66
66
  const editBoxStyles = useMemo(() => {
67
67
  return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
68
68
  }, [theme.palette.themePrimary]);
69
- /* @conditional-compile-remove(attachment-upload) */
69
+ /* @conditional-compile-remove(file-sharing-acs) */
70
70
  const onRenderAttachmentUploads = useCallback(() => {
71
71
  return (!!attachmentMetadata &&
72
72
  attachmentMetadata.length > 0 && (React.createElement("div", { style: { margin: '0.25rem' } },
@@ -86,7 +86,7 @@ export const ChatMessageComponentAsEditBox = (props) => {
86
86
  }, onEnterKeyDown: () => {
87
87
  submitEnabled &&
88
88
  onSubmit(textValue,
89
- /* @conditional-compile-remove(attachment-upload) */
89
+ /* @conditional-compile-remove(file-sharing-acs) */
90
90
  attachmentMetadata);
91
91
  }, supportNewline: false, maxLength: MAXIMUM_LENGTH_OF_MESSAGE, errorMessage: textTooLongMessage, styles: editBoxStyles,
92
92
  /* @conditional-compile-remove(mention) */
@@ -105,15 +105,15 @@ export const ChatMessageComponentAsEditBox = (props) => {
105
105
  // if you set it to undefined, the attachments pre-edited would still be there
106
106
  // until edit message event is received
107
107
  submitEnabled &&
108
- onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);
108
+ onSubmit(textValue, /* @conditional-compile-remove(file-sharing-acs) */ attachmentMetadata);
109
109
  e.stopPropagation();
110
- }, id: 'submitIconWrapper' }))), /* @conditional-compile-remove(attachment-upload) */
110
+ }, id: 'submitIconWrapper' }))), /* @conditional-compile-remove(file-sharing-acs) */
111
111
  onRenderAttachmentUploads()));
112
112
  };
113
113
  const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
114
114
  return (React.createElement(ChatMyMessage, { attached: attached, root: {
115
115
  className: mergeClasses(chatMyMessageStyles.root,
116
- /* @conditional-compile-remove(attachment-upload) */
116
+ /* @conditional-compile-remove(file-sharing-acs) */
117
117
  hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined)
118
118
  }, body: {
119
119
  className: mergeClasses(editContainerStyles.body, message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)