@azure/communication-react 1.16.0-alpha-202405132107 → 1.16.0-alpha-202405132302

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 (161) hide show
  1. package/dist/communication-react.d.ts +96 -113
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js → ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js} +23 -14
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{index-W6o1SuXO.js → index-DdWRffLC.js} +647 -869
  5. package/dist/dist-cjs/communication-react/index-DdWRffLC.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/index.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/common.d.ts +74 -0
  8. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
  10. package/dist/dist-esm/acs-ui-common/src/index.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 +3 -6
  14. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +43 -26
  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 +0 -2
  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 +5 -3
  19. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  20. package/dist/dist-esm/react-components/src/components/{AttachmentCard.d.ts → Attachment/AttachmentCard.d.ts} +3 -2
  21. package/dist/dist-esm/react-components/src/components/{AttachmentCard.js → Attachment/AttachmentCard.js} +17 -16
  22. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -0
  23. package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.js → Attachment/AttachmentCardGroup.js} +1 -1
  24. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -0
  25. package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.d.ts → Attachment/AttachmentDownloadCards.d.ts} +3 -2
  26. package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.js → Attachment/AttachmentDownloadCards.js} +2 -2
  27. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -0
  28. package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.d.ts → Attachment/AttachmentUploadCards.d.ts} +3 -3
  29. package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.js → Attachment/AttachmentUploadCards.js} +3 -3
  30. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -0
  31. package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
  32. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -2
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +3 -2
  38. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  39. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +2 -4
  40. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +21 -12
  41. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +2 -4
  43. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  44. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -4
  45. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -14
  46. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  47. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +6 -3
  48. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +31 -13
  49. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +3 -2
  51. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  52. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -7
  53. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  54. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +30 -23
  55. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +43 -27
  56. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  57. package/dist/dist-esm/react-components/src/components/SendBox.d.ts +4 -4
  58. package/dist/dist-esm/react-components/src/components/SendBox.js +42 -17
  59. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/index.d.ts +6 -6
  61. package/dist/dist-esm/react-components/src/components/index.js +3 -3
  62. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  63. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +4 -0
  64. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +4 -0
  65. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  66. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +0 -1
  67. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
  69. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +27 -2
  71. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +14 -2
  72. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  73. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +3 -2
  74. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +6 -5
  75. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  76. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +18 -18
  77. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
  79. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
  80. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  81. package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
  82. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  83. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +18 -18
  84. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +18 -18
  85. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +18 -18
  86. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +18 -18
  87. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +38 -19
  88. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +18 -18
  89. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +18 -18
  90. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +18 -18
  91. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +18 -18
  92. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +18 -18
  93. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +18 -18
  94. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +18 -18
  95. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +18 -18
  96. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +18 -18
  97. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +18 -18
  98. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +18 -18
  99. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +18 -18
  100. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +18 -18
  101. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +18 -18
  102. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +18 -18
  103. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +18 -18
  104. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +21 -49
  105. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  106. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -1
  107. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  108. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +3 -14
  109. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -76
  110. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  111. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -23
  112. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  113. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -11
  114. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +22 -40
  115. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  116. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -9
  117. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +1 -5
  118. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  119. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +73 -15
  120. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  121. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +3 -16
  122. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -89
  123. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  124. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +6 -19
  125. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  126. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +0 -5
  127. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -31
  128. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
  129. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +66 -61
  130. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +33 -44
  131. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
  132. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +2 -2
  133. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
  134. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -8
  135. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
  136. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +22 -10
  137. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  138. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -2
  139. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  140. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -1
  141. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
  142. package/package.json +1 -1
  143. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DWzf8cuK.js.map +0 -1
  144. package/dist/dist-cjs/communication-react/index-W6o1SuXO.js.map +0 -1
  145. package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +0 -1
  146. package/dist/dist-esm/react-components/src/components/AttachmentCardGroup.js.map +0 -1
  147. package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +0 -1
  148. package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +0 -1
  149. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +0 -48
  150. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +0 -188
  151. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +0 -1
  152. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
  153. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
  154. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
  155. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +0 -29
  156. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +0 -12
  157. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +0 -1
  158. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
  159. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
  160. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
  161. /package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.d.ts → Attachment/AttachmentCardGroup.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ChatScreen.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAA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IAChD,CACH,CACK,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isIOS } from '@fluentui/react';\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { PersonaSize } from '@fluentui/react';\nimport {\n CommunicationParticipant,\n ErrorBar,\n MessageProps,\n MessageRenderer,\n MessageThread,\n MessageThreadStyles,\n ParticipantMenuItemsCallback,\n SendBoxStylesProps,\n TypingIndicator,\n TypingIndicatorStylesProps,\n useTheme\n} from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatMessage } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useState } from 'react';\nimport { AvatarPersona, AvatarPersonaDataCallback, AvatarPersonaProps } from '../common/AvatarPersona';\nimport { useAdapter } from './adapter/ChatAdapterProvider';\nimport { ChatCompositeOptions } from './ChatComposite';\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\nimport { AttachmentUploadButtonWrapper as AttachmentUploadButton } from './file-sharing';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nimport {\n chatArea,\n chatContainer,\n chatWrapper,\n messageThreadChatCompositeStyles,\n sendboxContainerStyles,\n typingIndicatorContainerStyles\n} from './styles/Chat.styles';\nimport { participantListContainerPadding } from '../common/styles/ParticipantContainer.styles';\n/* @conditional-compile-remove(chat-composite-participant-pane) */\nimport { ChatScreenPeoplePane } from './ChatScreenPeoplePane';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentDownloadErrorBar } from './AttachmentDownloadErrorBar';\nimport { _AttachmentDownloadCards } from '@internal/react-components';\nimport { ImageOverlay } from '@internal/react-components';\nimport { InlineImage } from '@internal/react-components';\nimport { ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { AttachmentOptions } from '@internal/react-components';\nimport { SendBox } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useSelector } from './hooks/useSelector';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadsSelector } from './selectors/attachmentUploadsSelector';\n\n/**\n * @private\n */\nexport type ChatScreenProps = {\n options?: ChatCompositeOptions;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element;\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n styles?: ChatScreenStyles;\n attachmentOptions?: AttachmentOptions;\n formFactor?: 'desktop' | 'mobile';\n};\n\n/**\n * @private\n */\nexport type ChatScreenStyles = {\n messageThread?: MessageThreadStyles;\n sendBox?: SendBoxStylesProps;\n typingIndicator?: TypingIndicatorStylesProps;\n};\n\n/**\n * @private\n */\ninterface OverlayImageItem {\n imageSrc: string;\n title: string;\n titleIcon: JSX.Element;\n attachmentId: string;\n messageId: string;\n imageUrl: string;\n}\n\n/**\n * @private\n */\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\n const {\n onFetchAvatarPersonaData,\n onRenderMessage,\n onRenderTypingIndicator,\n options,\n styles,\n attachmentOptions,\n formFactor\n } = props;\n\n const defaultNumberOfChatMessagesToReload = 5;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');\n const [overlayImageItem, setOverlayImageItem] = useState<OverlayImageItem>();\n const [isImageOverlayOpen, setIsImageOverlayOpen] = useState<boolean>(false);\n\n const adapter = useAdapter();\n const theme = useTheme();\n\n useEffect(() => {\n // Initial data should be always fetched by the composite(or external caller) instead of the adapter\n const fetchData: () => Promise<void> = async () => {\n // Fetch initial data for adapter\n await adapter.fetchInitialData();\n // Fetch initial set of messages. Without fetching messages here, if the Composite's adapter is changed the message thread does not load new messages.\n await adapter.loadPreviousChatMessages(defaultNumberOfChatMessagesToReload);\n };\n fetchData();\n }, [adapter]);\n\n const messageThreadProps = usePropsFor(MessageThread);\n const sendBoxProps = usePropsFor(SendBox);\n const typingIndicatorProps = usePropsFor(TypingIndicator);\n const headerProps = useAdaptedSelector(getHeaderProps);\n const errorBarProps = usePropsFor(ErrorBar);\n\n useEffect(() => {\n if (overlayImageItem === undefined) {\n return;\n }\n const message = adapter.getState().thread.chatMessages[overlayImageItem.messageId];\n if (message === undefined) {\n return;\n }\n const resourceCache = message.resourceCache;\n if (overlayImageItem.imageSrc === '' && resourceCache && resourceCache[overlayImageItem.imageUrl]) {\n const fullSizeImageSrc = getResourceSourceUrl(resourceCache[overlayImageItem.imageUrl]);\n if (fullSizeImageSrc === undefined || fullSizeImageSrc === '' || overlayImageItem.imageSrc === fullSizeImageSrc) {\n return;\n }\n setOverlayImageItem({\n ...overlayImageItem,\n imageSrc: fullSizeImageSrc\n });\n }\n // Disable eslint because we are using the overlayImageItem in this effect but don't want to have it as a dependency, as it will cause an infinite loop.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageThreadProps.messages]);\n\n const getResourceSourceUrl = (result: ResourceFetchResult): string => {\n let src = '';\n if (result.error || !result.sourceUrl) {\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n\n return src;\n };\n\n const onRenderAvatarCallback = useCallback(\n (userId?: string, defaultOptions?: AvatarPersonaProps) => {\n return (\n <AvatarPersona\n userId={userId}\n hidePersonaDetails={true}\n {...defaultOptions}\n dataProvider={onFetchAvatarPersonaData}\n />\n );\n },\n [onFetchAvatarPersonaData]\n );\n\n const messageThreadStyles = useMemo(() => {\n return Object.assign(\n {},\n messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground),\n styles?.messageThread\n );\n }, [styles?.messageThread, theme.semanticColors.bodyBackground]);\n\n const typingIndicatorStyles = useMemo(() => {\n return Object.assign({}, styles?.typingIndicator);\n }, [styles?.typingIndicator]);\n\n const sendBoxStyles = useMemo(() => {\n return Object.assign({}, styles?.sendBox);\n }, [styles?.sendBox]);\n\n const userId = toFlatCommunicationIdentifier(adapter.getState().userId);\n\n const attachmentUploadButtonOnChange = useCallback(\n (files: FileList | null): void => {\n if (!files) {\n return;\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n const uploadTasks = adapter.registerActiveUploads(Array.from(files));\n /* @conditional-compile-remove(attachment-upload) */\n attachmentOptions?.uploadOptions?.handleAttachmentSelection(uploadTasks);\n },\n [adapter, attachmentOptions]\n );\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentDownloads = useCallback(\n (userId: string, message: ChatMessage) =>\n message?.attachments?.length ?? 0 > 0 ? (\n <_AttachmentDownloadCards\n attachments={message.attachments}\n message={message}\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n onActionHandlerFailed={(errorMessage: string) => {\n setDownloadErrorMessage(errorMessage);\n }}\n />\n ) : (\n <></>\n ),\n [attachmentOptions?.downloadOptions?.actionsForAttachment]\n );\n\n const onInlineImageClicked = useCallback(\n (attachmentId: string, messageId: string) => {\n const message = adapter.getState().thread.chatMessages[messageId];\n const inlinedImages = message.content?.attachments?.filter((attachment) => {\n return attachment.attachmentType === 'image' && attachment.id === attachmentId;\n });\n\n if (!inlinedImages || inlinedImages.length <= 0) {\n return;\n }\n\n const attachment = inlinedImages[0];\n\n const resourceCache = message.resourceCache;\n let imageSrc = '';\n\n if (attachment.url) {\n if (resourceCache && resourceCache[attachment.url]) {\n imageSrc = getResourceSourceUrl(resourceCache[attachment.url]);\n } else {\n adapter.downloadResourceToCache({\n threadId: adapter.getState().thread.threadId,\n messageId: messageId,\n resourceUrl: attachment.url\n });\n }\n }\n\n const titleIconRenderOptions = {\n text: message.senderDisplayName,\n size: PersonaSize.size32,\n showOverflowTooltip: false,\n imageAlt: message.senderDisplayName\n };\n\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(messageSenderId, titleIconRenderOptions);\n const overlayImage: OverlayImageItem = {\n title: message.senderDisplayName || '',\n titleIcon: titleIcon,\n attachmentId: attachment.id,\n imageSrc: imageSrc,\n messageId: messageId,\n imageUrl: attachment.url || ''\n };\n\n setIsImageOverlayOpen(true);\n setOverlayImageItem(overlayImage);\n },\n [adapter, onRenderAvatarCallback, userId]\n );\n\n const onRenderInlineImage = useCallback(\n (inlineImage: InlineImage, defaultOnRender: (inlineImage: InlineImage) => JSX.Element): JSX.Element => {\n const message = adapter.getState().thread.chatMessages[inlineImage.messageId];\n const attachment = message?.content?.attachments?.find(\n (attachment) => attachment.id === inlineImage.imageAttributes.id\n );\n\n if (attachment === undefined) {\n return defaultOnRender(inlineImage);\n }\n\n let pointerEvents: 'none' | 'auto' = inlineImage.imageAttributes.src === '' ? 'none' : 'auto';\n const resourceCache = message.resourceCache;\n if (\n resourceCache &&\n attachment.previewUrl &&\n resourceCache[attachment.previewUrl] &&\n resourceCache[attachment.previewUrl].error\n ) {\n pointerEvents = 'none';\n }\n\n return (\n <span\n key={inlineImage.imageAttributes.id}\n onClick={() => onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId)}\n tabIndex={0}\n role=\"button\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId);\n }\n }}\n style={{ cursor: 'pointer', pointerEvents }}\n >\n {defaultOnRender(inlineImage)}\n </span>\n );\n },\n [adapter, onInlineImageClicked]\n );\n\n const inlineImageOptions = useMemo(() => {\n return { onRenderInlineImage: onRenderInlineImage };\n }, [onRenderInlineImage]);\n\n const onDownloadButtonClicked = useCallback(\n (imageSrc: string): void => {\n if (imageSrc === '') {\n return;\n }\n if (isIOS()) {\n window.open(imageSrc, '_blank');\n } else {\n // Create a new anchor element\n const a = document.createElement('a');\n // Set the href and download attributes for the anchor element\n a.href = imageSrc;\n a.download = overlayImageItem?.attachmentId || '';\n a.rel = 'noopener noreferrer';\n a.target = '_blank';\n\n // Programmatically click the anchor element to trigger the download\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n }\n },\n [overlayImageItem?.attachmentId]\n );\n\n const AttachmentButton = useCallback(() => {\n if (!attachmentOptions?.uploadOptions?.handleAttachmentSelection) {\n return null;\n }\n return (\n <AttachmentUploadButton\n supportedMediaTypes={attachmentOptions?.uploadOptions?.supportedMediaTypes}\n disableMultipleUploads={attachmentOptions?.uploadOptions?.disableMultipleUploads}\n onChange={attachmentUploadButtonOnChange}\n />\n );\n }, [\n attachmentOptions?.uploadOptions?.handleAttachmentSelection,\n attachmentOptions?.uploadOptions?.supportedMediaTypes,\n attachmentOptions?.uploadOptions?.disableMultipleUploads,\n attachmentUploadButtonOnChange\n ]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const attachmentsWithProgress = useSelector(attachmentUploadsSelector).attachments;\n\n return (\n <Stack className={chatContainer} grow>\n {options?.topic !== false && <ChatHeader {...headerProps} />}\n <Stack className={chatArea} tokens={participantListContainerPadding} horizontal grow>\n <Stack className={chatWrapper} grow>\n {options?.errorBar !== false && <ErrorBar {...errorBarProps} />}\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n <AttachmentDownloadErrorBar\n onDismissDownloadErrorMessage={useCallback(() => {\n setDownloadErrorMessage('');\n }, [])}\n attachmentDownloadErrorMessage={downloadErrorMessage || ''}\n />\n }\n <MessageThread\n {...messageThreadProps}\n onRenderAvatar={onRenderAvatarCallback}\n onRenderMessage={onRenderMessage}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n inlineImageOptions={inlineImageOptions}\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\n styles={messageThreadStyles}\n />\n <Stack className={mergeStyles(sendboxContainerStyles)}>\n <div className={mergeStyles(typingIndicatorContainerStyles)}>\n {onRenderTypingIndicator ? (\n onRenderTypingIndicator(typingIndicatorProps.typingUsers)\n ) : (\n <TypingIndicator {...typingIndicatorProps} styles={typingIndicatorStyles} />\n )}\n </div>\n <Stack horizontal={formFactor === 'mobile'}>\n {formFactor === 'mobile' && (\n <Stack verticalAlign=\"center\">\n <AttachmentButton />\n </Stack>\n )}\n <Stack grow>\n <SendBox\n {...sendBoxProps}\n autoFocus={options?.autoFocus}\n styles={sendBoxStyles}\n /* @conditional-compile-remove(attachment-upload) */\n attachmentsWithProgress={attachmentsWithProgress}\n /* @conditional-compile-remove(attachment-upload) */\n onCancelAttachmentUpload={(id) => {\n adapter.cancelUpload?.(id);\n attachmentOptions?.uploadOptions?.handleAttachmentRemoval?.(id);\n }}\n />\n </Stack>\n {formFactor !== 'mobile' && <AttachmentButton />}\n </Stack>\n </Stack>\n </Stack>\n {\n /* @conditional-compile-remove(chat-composite-participant-pane) */\n options?.participantPane === true && (\n <ChatScreenPeoplePane\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={props.onFetchParticipantMenuItems}\n isMobile={formFactor === 'mobile'}\n />\n )\n }\n </Stack>\n {overlayImageItem && (\n <ImageOverlay\n {...overlayImageItem}\n isOpen={isImageOverlayOpen}\n onDismiss={() => {\n setOverlayImageItem(undefined);\n setIsImageOverlayOpen(false);\n adapter.removeResourceFromCache({\n threadId: adapter.getState().thread.threadId,\n messageId: overlayImageItem.messageId,\n resourceUrl: overlayImageItem.imageUrl\n });\n }}\n onDownloadButtonClicked={onDownloadButtonClicked}\n />\n )}\n </Stack>\n );\n};\n"]}
1
+ {"version":3,"file":"ChatScreen.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,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AC,IAAI;4BACT,oBAAC,OAAO,oBACF,YAAY,IAChB,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAC7B,MAAM,EAAE,aAAa;gCACrB,oDAAoD;gCACpD,WAAW,EAAE,WAAW;gCACxB,oDAAoD;gCACpD,wBAAwB,EAAE,qBAAqB;gCAC/C,2FAA2F;gCAC3F,gCAAgC;gCAChC,aAAa,EAAE,oBAAoB,IACnC,CACI;wBACP,UAAU,KAAK,QAAQ,IAAI,oBAAC,gBAAgB,OAAG,CAC1C,CACF,CACF;YAEN,kEAAkE;YAClE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,MAAK,IAAI,IAAI,CACnC,oBAAC,oBAAoB,IACnB,wBAAwB,EAAE,wBAAwB,EAClD,2BAA2B,EAAE,KAAK,CAAC,2BAA2B,EAC9D,QAAQ,EAAE,UAAU,KAAK,QAAQ,GACjC,CACH,CAEG;QACP,gBAAgB,IAAI,CACnB,oBAAC,YAAY,oBACP,gBAAgB,IACpB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,GAAG,EAAE;gBACd,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAC/B,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAC7B,OAAO,CAAC,uBAAuB,CAAC;oBAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ;oBAC5C,SAAS,EAAE,gBAAgB,CAAC,SAAS;oBACrC,WAAW,EAAE,gBAAgB,CAAC,QAAQ;iBACvC,CAAC,CAAC;YACL,CAAC,EACD,uBAAuB,EAAE,uBAAuB,IAChD,CACH,CACK,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isIOS } from '@fluentui/react';\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { PersonaSize } from '@fluentui/react';\nimport {\n CommunicationParticipant,\n ErrorBar,\n MessageProps,\n MessageRenderer,\n MessageThread,\n MessageThreadStyles,\n ParticipantMenuItemsCallback,\n SendBoxStylesProps,\n TypingIndicator,\n TypingIndicatorStylesProps,\n useTheme\n} from '@internal/react-components';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ChatMessage } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { useState } from 'react';\nimport { AvatarPersona, AvatarPersonaDataCallback, AvatarPersonaProps } from '../common/AvatarPersona';\nimport { useAdapter } from './adapter/ChatAdapterProvider';\nimport { ChatCompositeOptions } from './ChatComposite';\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadButtonWrapper as AttachmentUploadButton } from './file-sharing';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nimport {\n chatArea,\n chatContainer,\n chatWrapper,\n messageThreadChatCompositeStyles,\n sendboxContainerStyles,\n typingIndicatorContainerStyles\n} from './styles/Chat.styles';\nimport { participantListContainerPadding } from '../common/styles/ParticipantContainer.styles';\n/* @conditional-compile-remove(chat-composite-participant-pane) */\nimport { ChatScreenPeoplePane } from './ChatScreenPeoplePane';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentDownloadErrorBar } from './AttachmentDownloadErrorBar';\nimport { _AttachmentDownloadCards } from '@internal/react-components';\nimport { ImageOverlay } from '@internal/react-components';\nimport { InlineImage } from '@internal/react-components';\nimport { ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { AttachmentOptions } from '@internal/react-components';\nimport { SendBox } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { nanoid } from 'nanoid';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadActionType, AttachmentUpload, AttachmentUploadReducer } from './file-sharing/AttachmentUpload';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * @private\n */\nexport type ChatScreenProps = {\n options?: ChatCompositeOptions;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => JSX.Element;\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n onFetchParticipantMenuItems?: ParticipantMenuItemsCallback;\n styles?: ChatScreenStyles;\n attachmentOptions?: AttachmentOptions;\n formFactor?: 'desktop' | 'mobile';\n};\n\n/**\n * @private\n */\nexport type ChatScreenStyles = {\n messageThread?: MessageThreadStyles;\n sendBox?: SendBoxStylesProps;\n typingIndicator?: TypingIndicatorStylesProps;\n};\n\n/**\n * @private\n */\ninterface OverlayImageItem {\n imageSrc: string;\n title: string;\n titleIcon: JSX.Element;\n attachmentId: string;\n messageId: string;\n imageUrl: string;\n}\n\n/**\n * @private\n */\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\n const {\n onFetchAvatarPersonaData,\n onRenderMessage,\n onRenderTypingIndicator,\n options,\n styles,\n attachmentOptions,\n formFactor\n } = props;\n\n const defaultNumberOfChatMessagesToReload = 5;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');\n const [overlayImageItem, setOverlayImageItem] = useState<OverlayImageItem>();\n const [isImageOverlayOpen, setIsImageOverlayOpen] = useState<boolean>(false);\n /* @conditional-compile-remove(attachment-upload) */\n const [uploads, handleUploadAction] = useReducer(AttachmentUploadReducer, []);\n\n const adapter = useAdapter();\n const theme = useTheme();\n\n useEffect(() => {\n // Initial data should be always fetched by the composite(or external caller) instead of the adapter\n const fetchData: () => Promise<void> = async () => {\n // Fetch initial data for adapter\n await adapter.fetchInitialData();\n // Fetch initial set of messages. Without fetching messages here, if the Composite's adapter is changed the message thread does not load new messages.\n await adapter.loadPreviousChatMessages(defaultNumberOfChatMessagesToReload);\n };\n fetchData();\n }, [adapter]);\n\n const messageThreadProps = usePropsFor(MessageThread);\n const sendBoxProps = usePropsFor(SendBox);\n const typingIndicatorProps = usePropsFor(TypingIndicator);\n const headerProps = useAdaptedSelector(getHeaderProps);\n const errorBarProps = usePropsFor(ErrorBar);\n\n useEffect(() => {\n if (overlayImageItem === undefined) {\n return;\n }\n const message = adapter.getState().thread.chatMessages[overlayImageItem.messageId];\n if (message === undefined) {\n return;\n }\n const resourceCache = message.resourceCache;\n if (overlayImageItem.imageSrc === '' && resourceCache && resourceCache[overlayImageItem.imageUrl]) {\n const fullSizeImageSrc = getResourceSourceUrl(resourceCache[overlayImageItem.imageUrl]);\n if (fullSizeImageSrc === undefined || fullSizeImageSrc === '' || overlayImageItem.imageSrc === fullSizeImageSrc) {\n return;\n }\n setOverlayImageItem({\n ...overlayImageItem,\n imageSrc: fullSizeImageSrc\n });\n }\n // Disable eslint because we are using the overlayImageItem in this effect but don't want to have it as a dependency, as it will cause an infinite loop.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageThreadProps.messages]);\n\n const getResourceSourceUrl = (result: ResourceFetchResult): string => {\n let src = '';\n if (result.error || !result.sourceUrl) {\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n\n return src;\n };\n\n const onRenderAvatarCallback = useCallback(\n (userId?: string, defaultOptions?: AvatarPersonaProps) => {\n return (\n <AvatarPersona\n userId={userId}\n hidePersonaDetails={true}\n {...defaultOptions}\n dataProvider={onFetchAvatarPersonaData}\n />\n );\n },\n [onFetchAvatarPersonaData]\n );\n\n const messageThreadStyles = useMemo(() => {\n return Object.assign(\n {},\n messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground),\n styles?.messageThread\n );\n }, [styles?.messageThread, theme.semanticColors.bodyBackground]);\n\n const typingIndicatorStyles = useMemo(() => {\n return Object.assign({}, styles?.typingIndicator);\n }, [styles?.typingIndicator]);\n\n const sendBoxStyles = useMemo(() => {\n return Object.assign({}, styles?.sendBox);\n }, [styles?.sendBox]);\n\n const userId = toFlatCommunicationIdentifier(adapter.getState().userId);\n\n /* @conditional-compile-remove(attachment-upload) */\n const attachmentUploadButtonOnChange = useCallback(\n (files: FileList | null): void => {\n if (!files) {\n return;\n }\n\n // Get files, change to tasks, store locally and pass back to Contoso\n const newUploads = Array.from(files).map((file): AttachmentUpload => {\n const taskId = nanoid();\n return {\n file,\n taskId,\n metadata: {\n id: taskId,\n name: file.name,\n progress: 0\n },\n notifyUploadProgressChanged: (value: number) => {\n handleUploadAction({ type: AttachmentUploadActionType.Progress, taskId, progress: value });\n },\n notifyUploadCompleted: (id: string, url: string) => {\n handleUploadAction({ type: AttachmentUploadActionType.Completed, taskId, id, url });\n },\n notifyUploadFailed: (message: string) => {\n handleUploadAction({ type: AttachmentUploadActionType.Failed, taskId, message });\n // remove the failed upload task when error banner is auto dismissed after 10 seconds\n // so the banner won't be shown again on UI re-rendering.\n setTimeout(() => {\n handleUploadAction({ type: AttachmentUploadActionType.Remove, id: taskId });\n }, 10 * 1000);\n }\n };\n });\n\n handleUploadAction({ type: AttachmentUploadActionType.Set, newUploads });\n attachmentOptions?.uploadOptions?.handleAttachmentSelection(newUploads);\n },\n [attachmentOptions?.uploadOptions]\n );\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentDownloads = useCallback(\n (message: ChatMessage) =>\n message?.attachments?.length ?? 0 > 0 ? (\n <_AttachmentDownloadCards\n attachments={message.attachments}\n message={message}\n actionsForAttachment={attachmentOptions?.downloadOptions?.actionsForAttachment}\n onActionHandlerFailed={(errorMessage: string) => {\n setDownloadErrorMessage(errorMessage);\n }}\n />\n ) : (\n <></>\n ),\n [attachmentOptions?.downloadOptions?.actionsForAttachment]\n );\n\n const onInlineImageClicked = useCallback(\n (attachmentId: string, messageId: string) => {\n const message = adapter.getState().thread.chatMessages[messageId];\n const inlinedImages = message.content?.attachments?.filter((attachment) => {\n return attachment.attachmentType === 'image' && attachment.id === attachmentId;\n });\n\n if (!inlinedImages || inlinedImages.length <= 0) {\n return;\n }\n\n const attachment = inlinedImages[0];\n\n const resourceCache = message.resourceCache;\n let imageSrc = '';\n\n if (attachment.url) {\n if (resourceCache && resourceCache[attachment.url]) {\n imageSrc = getResourceSourceUrl(resourceCache[attachment.url]);\n } else {\n adapter.downloadResourceToCache({\n threadId: adapter.getState().thread.threadId,\n messageId: messageId,\n resourceUrl: attachment.url\n });\n }\n }\n\n const titleIconRenderOptions = {\n text: message.senderDisplayName,\n size: PersonaSize.size32,\n showOverflowTooltip: false,\n imageAlt: message.senderDisplayName\n };\n\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n const titleIcon = onRenderAvatarCallback && onRenderAvatarCallback(messageSenderId, titleIconRenderOptions);\n const overlayImage: OverlayImageItem = {\n title: message.senderDisplayName || '',\n titleIcon: titleIcon,\n attachmentId: attachment.id,\n imageSrc: imageSrc,\n messageId: messageId,\n imageUrl: attachment.url || ''\n };\n\n setIsImageOverlayOpen(true);\n setOverlayImageItem(overlayImage);\n },\n [adapter, onRenderAvatarCallback, userId]\n );\n\n const onRenderInlineImage = useCallback(\n (inlineImage: InlineImage, defaultOnRender: (inlineImage: InlineImage) => JSX.Element): JSX.Element => {\n const message = adapter.getState().thread.chatMessages[inlineImage.messageId];\n const attachment = message?.content?.attachments?.find(\n (attachment) => attachment.id === inlineImage.imageAttributes.id\n );\n\n if (attachment === undefined) {\n return defaultOnRender(inlineImage);\n }\n\n let pointerEvents: 'none' | 'auto' = inlineImage.imageAttributes.src === '' ? 'none' : 'auto';\n const resourceCache = message.resourceCache;\n if (\n resourceCache &&\n attachment.previewUrl &&\n resourceCache[attachment.previewUrl] &&\n resourceCache[attachment.previewUrl].error\n ) {\n pointerEvents = 'none';\n }\n\n return (\n <span\n key={inlineImage.imageAttributes.id}\n onClick={() => onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId)}\n tabIndex={0}\n role=\"button\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onInlineImageClicked(inlineImage.imageAttributes.id || '', inlineImage.messageId);\n }\n }}\n style={{ cursor: 'pointer', pointerEvents }}\n >\n {defaultOnRender(inlineImage)}\n </span>\n );\n },\n [adapter, onInlineImageClicked]\n );\n\n const inlineImageOptions = useMemo(() => {\n return { onRenderInlineImage: onRenderInlineImage };\n }, [onRenderInlineImage]);\n\n const onDownloadButtonClicked = useCallback(\n (imageSrc: string): void => {\n if (imageSrc === '') {\n return;\n }\n if (isIOS()) {\n window.open(imageSrc, '_blank');\n } else {\n // Create a new anchor element\n const a = document.createElement('a');\n // Set the href and download attributes for the anchor element\n a.href = imageSrc;\n a.download = overlayImageItem?.attachmentId || '';\n a.rel = 'noopener noreferrer';\n a.target = '_blank';\n\n // Programmatically click the anchor element to trigger the download\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n }\n },\n [overlayImageItem?.attachmentId]\n );\n\n const AttachmentButton = useCallback(() => {\n /* @conditional-compile-remove(attachment-upload) */\n if (!attachmentOptions?.uploadOptions?.handleAttachmentSelection) {\n return null;\n }\n /* @conditional-compile-remove(attachment-upload) */\n return (\n <AttachmentUploadButton\n supportedMediaTypes={attachmentOptions?.uploadOptions?.supportedMediaTypes}\n disableMultipleUploads={attachmentOptions?.uploadOptions?.disableMultipleUploads}\n onChange={attachmentUploadButtonOnChange}\n />\n );\n return <></>;\n }, [\n attachmentOptions?.uploadOptions?.handleAttachmentSelection,\n attachmentOptions?.uploadOptions?.supportedMediaTypes,\n attachmentOptions?.uploadOptions?.disableMultipleUploads,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentUploadButtonOnChange\n ]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const attachments = useMemo(() => {\n return uploads?.map((v) => v.metadata);\n }, [uploads]);\n\n const onSendMessageHandler = useCallback(\n async function (content: string, /* @conditional-compile-remove(attachment-upload) */ options?: MessageOptions) {\n /* @conditional-compile-remove(attachment-upload) */\n const attachments = options?.attachments ?? [];\n /* @conditional-compile-remove(attachment-upload) */\n handleUploadAction({ type: AttachmentUploadActionType.Clear });\n /* @conditional-compile-remove(attachment-upload) */\n await adapter.sendMessage(content, {\n attachments: attachments\n });\n /* @conditional-compile-remove(attachment-upload) */\n return;\n await adapter.sendMessage(content);\n },\n [adapter]\n );\n\n /* @conditional-compile-remove(attachment-upload) */\n const onCancelUploadHandler = useCallback(\n (id: string) => {\n handleUploadAction({ type: AttachmentUploadActionType.Remove, id });\n attachmentOptions?.uploadOptions?.handleAttachmentRemoval?.(id);\n },\n [attachmentOptions?.uploadOptions]\n );\n return (\n <Stack className={chatContainer} grow>\n {options?.topic !== false && <ChatHeader {...headerProps} />}\n <Stack className={chatArea} tokens={participantListContainerPadding} horizontal grow>\n <Stack className={chatWrapper} grow>\n {options?.errorBar !== false && <ErrorBar {...errorBarProps} />}\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n <AttachmentDownloadErrorBar\n onDismissDownloadErrorMessage={useCallback(() => {\n setDownloadErrorMessage('');\n }, [])}\n attachmentDownloadErrorMessage={downloadErrorMessage || ''}\n />\n }\n <MessageThread\n {...messageThreadProps}\n onRenderAvatar={onRenderAvatarCallback}\n onRenderMessage={onRenderMessage}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads={onRenderAttachmentDownloads}\n inlineImageOptions={inlineImageOptions}\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\n styles={messageThreadStyles}\n />\n <Stack className={mergeStyles(sendboxContainerStyles)}>\n <div className={mergeStyles(typingIndicatorContainerStyles)}>\n {onRenderTypingIndicator ? (\n onRenderTypingIndicator(typingIndicatorProps.typingUsers)\n ) : (\n <TypingIndicator {...typingIndicatorProps} styles={typingIndicatorStyles} />\n )}\n </div>\n <Stack horizontal={formFactor === 'mobile'}>\n {formFactor === 'mobile' && (\n <Stack verticalAlign=\"center\">\n <AttachmentButton />\n </Stack>\n )}\n <Stack grow>\n <SendBox\n {...sendBoxProps}\n autoFocus={options?.autoFocus}\n styles={sendBoxStyles}\n /* @conditional-compile-remove(attachment-upload) */\n attachments={attachments}\n /* @conditional-compile-remove(attachment-upload) */\n onCancelAttachmentUpload={onCancelUploadHandler}\n // we need to overwrite onSendMessage for SendBox because we need to clear attachment state\n // when submit button is clicked\n onSendMessage={onSendMessageHandler}\n />\n </Stack>\n {formFactor !== 'mobile' && <AttachmentButton />}\n </Stack>\n </Stack>\n </Stack>\n {\n /* @conditional-compile-remove(chat-composite-participant-pane) */\n options?.participantPane === true && (\n <ChatScreenPeoplePane\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onFetchParticipantMenuItems={props.onFetchParticipantMenuItems}\n isMobile={formFactor === 'mobile'}\n />\n )\n }\n </Stack>\n {overlayImageItem && (\n <ImageOverlay\n {...overlayImageItem}\n isOpen={isImageOverlayOpen}\n onDismiss={() => {\n setOverlayImageItem(undefined);\n setIsImageOverlayOpen(false);\n adapter.removeResourceFromCache({\n threadId: adapter.getState().thread.threadId,\n messageId: overlayImageItem.messageId,\n resourceUrl: overlayImageItem.imageUrl\n });\n }}\n onDownloadButtonClicked={onDownloadButtonClicked}\n />\n )}\n </Stack>\n );\n};\n"]}
@@ -5,8 +5,7 @@ import { _TelemetryImplementationHint } from "../../../../../acs-ui-common/src";
5
5
  import { ChatAdapter, ChatAdapterState, MessageDeletedListener, MessageEditedListener, MessageReadListener, MessageReceivedListener, ParticipantsAddedListener, ParticipantsRemovedListener, TopicChangedListener } from './ChatAdapter';
6
6
  import { ResourceDetails } from './ChatAdapter';
7
7
  import { AdapterError } from '../../common/adapters';
8
- import { AttachmentMetadata } from "../../../../../react-components/src";
9
- import { AttachmentUploadTask } from "../../../../../react-components/src";
8
+ import { MessageOptions } from "../../../../../acs-ui-common/src";
10
9
  /**
11
10
  * Context of Chat, which is a centralized context for all state updates
12
11
  * @private
@@ -30,7 +29,6 @@ export declare class AzureCommunicationChatAdapter implements ChatAdapter {
30
29
  private chatClient;
31
30
  private chatThreadClient;
32
31
  private context;
33
- private attachmentUploadAdapter;
34
32
  private handlers;
35
33
  private emitter;
36
34
  constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient);
@@ -40,25 +38,14 @@ export declare class AzureCommunicationChatAdapter implements ChatAdapter {
40
38
  getState(): ChatAdapterState;
41
39
  onStateChange(handler: (state: ChatAdapterState) => void): void;
42
40
  offStateChange(handler: (state: ChatAdapterState) => void): void;
43
- sendMessage(content: string, options?: SendMessageOptions): Promise<void>;
44
- /** Send a chat message with attachments. */
45
- sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void>;
41
+ sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
46
42
  sendReadReceipt(chatMessageId: string): Promise<void>;
47
43
  sendTypingIndicator(): Promise<void>;
48
44
  removeParticipant(userId: string): Promise<void>;
49
45
  setTopic(topicName: string): Promise<void>;
50
46
  loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;
51
- updateMessage(messageId: string, content: string, metadata?: Record<string, string>, options?: {
52
- attachmentMetadata?: AttachmentMetadata[];
53
- }): Promise<void>;
47
+ updateMessage(messageId: string, content: string, options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions): Promise<void>;
54
48
  deleteMessage(messageId: string): Promise<void>;
55
- registerActiveUploads(files: File[]): AttachmentUploadTask[];
56
- registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadTask[];
57
- clearUploads(): void;
58
- cancelUpload(id: string): void;
59
- updateUploadProgress(id: string, progress: number): void;
60
- updateUploadStatusMessage(id: string, errorMessage: string): void;
61
- updateUploadMetadata(id: string, metadata: AttachmentMetadata): void;
62
49
  downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;
63
50
  removeResourceFromCache(resourceDetails: ResourceDetails): void;
64
51
  private messageReceivedListener;
@@ -20,10 +20,6 @@ import { _createStatefulChatClientInner } from "../../../../../chat-stateful-cli
20
20
  import { createDefaultChatHandlers } from "../../../../../chat-component-bindings/src";
21
21
  import { toFlatCommunicationIdentifier } from "../../../../../acs-ui-common/src";
22
22
  import EventEmitter from 'events';
23
- /* @conditional-compile-remove(attachment-upload) */
24
- import { convertAttachmentUploadsUiStateToMessageMetadata } from './AzureCommunicationAttachmentUploadAdapter';
25
- /* @conditional-compile-remove(attachment-upload) */
26
- import { AzureCommunicationAttachmentUploadAdapter } from './AzureCommunicationAttachmentUploadAdapter';
27
23
  import { useEffect, useRef, useState } from 'react';
28
24
  import { _isValidIdentifier } from "../../../../../acs-ui-common/src";
29
25
  import { TEAMS_LIMITATION_LEARN_MORE, UNSUPPORTED_CHAT_THREAD_TYPE } from '../../common/constants';
@@ -74,7 +70,7 @@ export class ChatContext {
74
70
  latestErrors: clientState.latestErrors
75
71
  };
76
72
  /* @conditional-compile-remove(attachment-upload) */
77
- updatedState = Object.assign(Object.assign({}, updatedState), { _attachmentUploads: this.state._attachmentUploads });
73
+ updatedState = Object.assign({}, updatedState);
78
74
  this.setState(updatedState);
79
75
  }
80
76
  }
@@ -88,8 +84,6 @@ export class AzureCommunicationChatAdapter {
88
84
  this.chatClient = chatClient;
89
85
  this.chatThreadClient = chatThreadClient;
90
86
  this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);
91
- /* @conditional-compile-remove(attachment-upload) */
92
- this.attachmentUploadAdapter = new AzureCommunicationAttachmentUploadAdapter(this.context);
93
87
  const onStateChange = (clientState) => {
94
88
  // unsubscribe when the instance gets disposed
95
89
  if (!this) {
@@ -109,8 +103,6 @@ export class AzureCommunicationChatAdapter {
109
103
  this.dispose = this.dispose.bind(this);
110
104
  this.fetchInitialData = this.fetchInitialData.bind(this);
111
105
  this.sendMessage = this.sendMessage.bind(this);
112
- /* @conditional-compile-remove(attachment-upload) */
113
- this.sendMessageWithAttachments = this.sendMessageWithAttachments.bind(this);
114
106
  this.sendReadReceipt = this.sendReadReceipt.bind(this);
115
107
  this.sendTypingIndicator = this.sendTypingIndicator.bind(this);
116
108
  this.updateMessage = this.updateMessage.bind(this);
@@ -120,20 +112,6 @@ export class AzureCommunicationChatAdapter {
120
112
  this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);
121
113
  this.on = this.on.bind(this);
122
114
  this.off = this.off.bind(this);
123
- /* @conditional-compile-remove(attachment-upload) */
124
- this.registerActiveUploads = this.registerActiveUploads.bind(this);
125
- /* @conditional-compile-remove(attachment-upload) */
126
- this.registerCompletedUploads = this.registerCompletedUploads.bind(this);
127
- /* @conditional-compile-remove(attachment-upload) */
128
- this.clearUploads = this.clearUploads.bind(this);
129
- /* @conditional-compile-remove(attachment-upload) */
130
- this.cancelUpload = this.cancelUpload.bind(this);
131
- /* @conditional-compile-remove(attachment-upload) */
132
- this.updateUploadProgress = this.updateUploadProgress.bind(this);
133
- /* @conditional-compile-remove(attachment-upload) */
134
- this.updateUploadStatusMessage = this.updateUploadStatusMessage.bind(this);
135
- /* @conditional-compile-remove(attachment-upload) */
136
- this.updateUploadMetadata = this.updateUploadMetadata.bind(this);
137
115
  this.downloadResourceToCache = this.downloadResourceToCache.bind(this);
138
116
  this.removeResourceFromCache = this.removeResourceFromCache.bind(this);
139
117
  }
@@ -179,43 +157,10 @@ export class AzureCommunicationChatAdapter {
179
157
  offStateChange(handler) {
180
158
  this.context.offStateChange(handler);
181
159
  }
182
- sendMessage(content_1) {
183
- return __awaiter(this, arguments, void 0, function* (content, options = {}) {
184
- yield this.asyncTeeErrorToEventEmitter(() => __awaiter(this, void 0, void 0, function* () {
185
- /* @conditional-compile-remove(attachment-upload) */
186
- options.metadata = Object.assign(Object.assign({}, options.metadata), convertAttachmentUploadsUiStateToMessageMetadata(this.context.getState()._attachmentUploads));
187
- /* @conditional-compile-remove(attachment-upload) */
188
- /**
189
- * All the current uploads need to be clear from the state before a message has been sent.
190
- * This ensures the following behavior:
191
- * 1. Attachment Upload cards are removed from sendbox at the same time text in sendbox is removed.
192
- * 2. any component rendering these attachment uploads doesn't continue to do so.
193
- * 3. Cleans the state for new attachment uploads with a fresh message.
194
- */
195
- this.attachmentUploadAdapter.clearUploads();
196
- yield this.handlers.onSendMessage(content, options);
197
- }));
198
- });
199
- }
200
- /* @conditional-compile-remove(attachment-upload) */
201
- /** Send a chat message with attachments. */
202
- sendMessageWithAttachments(content, attachments) {
160
+ sendMessage(content, options) {
203
161
  return __awaiter(this, void 0, void 0, function* () {
204
162
  yield this.asyncTeeErrorToEventEmitter(() => __awaiter(this, void 0, void 0, function* () {
205
- const fileSharingMetadata = {
206
- fileSharingMetadata: JSON.stringify(attachments)
207
- };
208
- /**
209
- * All the current uploads need to be clear from the state before a message has been sent.
210
- * This ensures the following behavior:
211
- * 1. Attachment Upload cards are removed from sendbox at the same time text in sendbox is removed.
212
- * 2. any component rendering these attachment uploads doesn't continue to do so.
213
- * 3. Cleans the state for new attachment uploads with a fresh message.
214
- */
215
- this.attachmentUploadAdapter.clearUploads();
216
- yield this.handlers.onSendMessage(content, {
217
- metadata: fileSharingMetadata
218
- });
163
+ return yield this.handlers.onSendMessage(content, options);
219
164
  }));
220
165
  });
221
166
  }
@@ -254,13 +199,36 @@ export class AzureCommunicationChatAdapter {
254
199
  }));
255
200
  });
256
201
  }
257
- updateMessage(messageId, content, metadata, options) {
202
+ updateMessage(messageId, content, options) {
258
203
  return __awaiter(this, void 0, void 0, function* () {
259
204
  return yield this.asyncTeeErrorToEventEmitter(() => __awaiter(this, void 0, void 0, function* () {
205
+ var _a;
206
+ /* @conditional-compile-remove(attachment-upload) */
207
+ const messageOptions = {};
208
+ /* @conditional-compile-remove(attachment-upload) */
209
+ if (options &&
210
+ // if options.attachments is an array or undefined (for removal all attachments),
211
+ // then given options is a MessageOptions
212
+ (Array.isArray(options.attachments) || options.attachments === undefined)) {
213
+ messageOptions.attachments = (_a = options.attachments) !== null && _a !== void 0 ? _a : [];
214
+ }
260
215
  /* @conditional-compile-remove(attachment-upload) */
261
- const updatedOptions = { attachmentMetadata: options === null || options === void 0 ? void 0 : options.attachmentMetadata, metadata: metadata };
216
+ if (options &&
217
+ // if options.metadata is provided, we need to add it in MessageOptions
218
+ options.metadata &&
219
+ typeof options.metadata === 'object') {
220
+ messageOptions.metadata = options.metadata;
221
+ }
222
+ /* @conditional-compile-remove(attachment-upload) */
223
+ if (options && !('attachments' in options) && !('metadata' in options)) {
224
+ // if options don't have attachments or metadata,
225
+ // then it is a Record<string, string>
226
+ /* @conditional-compile-remove(attachment-upload) */
227
+ return yield this.handlers.onUpdateMessage(messageId, content, options);
228
+ }
262
229
  /* @conditional-compile-remove(attachment-upload) */
263
- return yield this.handlers.onUpdateMessage(messageId, content, updatedOptions);
230
+ return yield this.handlers.onUpdateMessage(messageId, content, messageOptions);
231
+ // metadata is never used in the current stable
264
232
  return yield this.handlers.onUpdateMessage(messageId, content);
265
233
  }));
266
234
  });
@@ -272,34 +240,6 @@ export class AzureCommunicationChatAdapter {
272
240
  }));
273
241
  });
274
242
  }
275
- /* @conditional-compile-remove(attachment-upload) */
276
- registerActiveUploads(files) {
277
- return this.attachmentUploadAdapter.registerActiveUploads(files);
278
- }
279
- /* @conditional-compile-remove(attachment-upload) */
280
- registerCompletedUploads(metadata) {
281
- return this.attachmentUploadAdapter.registerCompletedUploads(metadata);
282
- }
283
- /* @conditional-compile-remove(attachment-upload) */
284
- clearUploads() {
285
- this.attachmentUploadAdapter.clearUploads();
286
- }
287
- /* @conditional-compile-remove(attachment-upload) */
288
- cancelUpload(id) {
289
- this.attachmentUploadAdapter.cancelUpload(id);
290
- }
291
- /* @conditional-compile-remove(attachment-upload) */
292
- updateUploadProgress(id, progress) {
293
- this.attachmentUploadAdapter.updateUploadProgress(id, progress);
294
- }
295
- /* @conditional-compile-remove(attachment-upload) */
296
- updateUploadStatusMessage(id, errorMessage) {
297
- this.attachmentUploadAdapter.updateUploadStatusMessage(id, errorMessage);
298
- }
299
- /* @conditional-compile-remove(attachment-upload) */
300
- updateUploadMetadata(id, metadata) {
301
- this.attachmentUploadAdapter.updateUploadMetadata(id, metadata);
302
- }
303
243
  downloadResourceToCache(resourceDetails) {
304
244
  return __awaiter(this, void 0, void 0, function* () {
305
245
  this.chatClient.downloadResourceToCache(resourceDetails.threadId, resourceDetails.messageId, resourceDetails.resourceUrl);
@@ -1 +1 @@
1
- {"version":3,"file":"AzureCommunicationChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAElC,OAAO,EACL,8BAA8B,EAI/B,gDAAuC;AACxC,OAAO,EAAgB,yBAAyB,EAAE,mDAA0C;AAY5F,OAAO,EAAE,6BAA6B,EAAgC,yCAAgC;AACtG,OAAO,YAAY,MAAM,QAAQ,CAAC;AAclC,oDAAoD;AACpD,OAAO,EAEL,gDAAgD,EACjD,MAAM,6CAA6C,CAAC;AACrD,oDAAoD;AACpD,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,yCAAgC;AAO7D,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEnG;;;GAGG;AACH,MAAM,OAAO,WAAW;IAKtB,YAAY,WAA4B,EAAE,QAAgB;QAJlD,YAAO,GAAiB,IAAI,YAAY,EAAE,CAAC;QAKjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,4DAA4D,CAAC;QACrE,CAAC;QACD,IAAI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ACzB,CAAC,CAAA,CAAC,EAAE,CAAC;IACP,CAAC;IACD,0FAA0F;IAC1F,CAAC,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CACpG,CAAC;IAEF,4DAA4D;IAC5D,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,CAAC,GAAS,EAAE;gBACV,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACvB,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;wBAC7B,MAAM,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBACrD,CAAC;oBACD,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC7B,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;gBACjC,CAAC;YACH,CAAC,CAAA,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAgB,6CAA6C,CACjE,UAA8B,EAC9B,gBAAkC;;QAElC,OAAO,IAAI,6BAA6B,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;CAAA;AAED,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAkB,EAAE;IAC/C,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAC1G,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n _createStatefulChatClientInner,\n ChatClientState,\n ChatError,\n StatefulChatClient\n} from '@internal/chat-stateful-client';\nimport { ChatHandlers, createDefaultChatHandlers } from '@internal/chat-component-bindings';\nimport { ChatMessage, ChatMessageType, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier } from '@azure/communication-common';\nimport type {\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent\n} from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport EventEmitter from 'events';\nimport {\n ChatAdapter,\n ChatAdapterState,\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './ChatAdapter';\nimport { ResourceDetails } from './ChatAdapter';\nimport { AdapterError } from '../../common/adapters';\n/* @conditional-compile-remove(attachment-upload) */\nimport {\n _AttachmentUploadAdapter,\n convertAttachmentUploadsUiStateToMessageMetadata\n} from './AzureCommunicationAttachmentUploadAdapter';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AzureCommunicationAttachmentUploadAdapter } from './AzureCommunicationAttachmentUploadAdapter';\nimport { useEffect, useRef, useState } from 'react';\nimport { _isValidIdentifier } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentUploadTask } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { FileSharingMetadata } from '../../ChatComposite/file-sharing';\nimport { TEAMS_LIMITATION_LEARN_MORE, UNSUPPORTED_CHAT_THREAD_TYPE } from '../../common/constants';\n\n/**\n * Context of Chat, which is a centralized context for all state updates\n * @private\n */\nexport class ChatContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: ChatAdapterState;\n private threadId: string;\n\n constructor(clientState: ChatClientState, threadId: string) {\n const thread = clientState.threads[threadId];\n this.threadId = threadId;\n if (!thread) {\n throw 'Cannot find threadId, please initialize thread before use!';\n }\n this.state = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: ChatAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): ChatAdapterState {\n return this.state;\n }\n\n public setError(error: Error): void {\n this.setState({ ...this.state, error });\n }\n\n public updateClientState(clientState: ChatClientState): void {\n const thread = clientState.threads[this.threadId];\n if (!thread) {\n throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\n }\n\n let updatedState: ChatAdapterState = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n updatedState = { ...updatedState, _attachmentUploads: this.state._attachmentUploads };\n\n this.setState(updatedState);\n }\n}\n\n/**\n * @private\n */\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\n private chatClient: StatefulChatClient;\n private chatThreadClient: ChatThreadClient;\n private context: ChatContext;\n /* @conditional-compile-remove(attachment-upload) */\n private attachmentUploadAdapter: _AttachmentUploadAdapter;\n private handlers: ChatHandlers;\n private emitter: EventEmitter = new EventEmitter();\n\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\n this.bindAllPublicMethods();\n this.chatClient = chatClient;\n this.chatThreadClient = chatThreadClient;\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\n /* @conditional-compile-remove(attachment-upload) */\n this.attachmentUploadAdapter = new AzureCommunicationAttachmentUploadAdapter(this.context);\n\n const onStateChange = (clientState: ChatClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n chatClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\n\n this.chatClient.onStateChange(onStateChange);\n this.subscribeAllEvents();\n }\n\n private bindAllPublicMethods(): void {\n this.onStateChange = this.onStateChange.bind(this);\n this.offStateChange = this.offStateChange.bind(this);\n this.getState = this.getState.bind(this);\n this.dispose = this.dispose.bind(this);\n this.fetchInitialData = this.fetchInitialData.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.sendMessageWithAttachments = this.sendMessageWithAttachments.bind(this);\n this.sendReadReceipt = this.sendReadReceipt.bind(this);\n this.sendTypingIndicator = this.sendTypingIndicator.bind(this);\n this.updateMessage = this.updateMessage.bind(this);\n this.deleteMessage = this.deleteMessage.bind(this);\n this.removeParticipant = this.removeParticipant.bind(this);\n this.setTopic = this.setTopic.bind(this);\n this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.registerActiveUploads = this.registerActiveUploads.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.registerCompletedUploads = this.registerCompletedUploads.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.clearUploads = this.clearUploads.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.cancelUpload = this.cancelUpload.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.updateUploadProgress = this.updateUploadProgress.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.updateUploadStatusMessage = this.updateUploadStatusMessage.bind(this);\n /* @conditional-compile-remove(attachment-upload) */\n this.updateUploadMetadata = this.updateUploadMetadata.bind(this);\n this.downloadResourceToCache = this.downloadResourceToCache.bind(this);\n this.removeResourceFromCache = this.removeResourceFromCache.bind(this);\n }\n\n dispose(): void {\n this.unsubscribeAllEvents();\n this.chatClient.dispose();\n }\n\n async fetchInitialData(): Promise<void> {\n // If get properties fails we dont want to try to get the participants after.\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.chatThreadClient.getProperties();\n // Fetch all participants who joined before the local user.\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\n // Fetch 100 participants per page by default.\n maxPageSize: 100\n // eslint-disable-next-line curly\n }));\n });\n }\n\n getState(): ChatAdapterState {\n return this.context.getState();\n }\n\n onStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n offStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n async sendMessage(content: string, options: SendMessageOptions = {}): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n /* @conditional-compile-remove(attachment-upload) */\n options.metadata = {\n ...options.metadata,\n ...convertAttachmentUploadsUiStateToMessageMetadata(this.context.getState()._attachmentUploads)\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n /**\n * All the current uploads need to be clear from the state before a message has been sent.\n * This ensures the following behavior:\n * 1. Attachment Upload cards are removed from sendbox at the same time text in sendbox is removed.\n * 2. any component rendering these attachment uploads doesn't continue to do so.\n * 3. Cleans the state for new attachment uploads with a fresh message.\n */\n this.attachmentUploadAdapter.clearUploads();\n\n await this.handlers.onSendMessage(content, options);\n });\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n /** Send a chat message with attachments. */\n public async sendMessageWithAttachments(content: string, attachments: AttachmentMetadata[]): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n const fileSharingMetadata: FileSharingMetadata = {\n fileSharingMetadata: JSON.stringify(attachments)\n };\n /**\n * All the current uploads need to be clear from the state before a message has been sent.\n * This ensures the following behavior:\n * 1. Attachment Upload cards are removed from sendbox at the same time text in sendbox is removed.\n * 2. any component rendering these attachment uploads doesn't continue to do so.\n * 3. Cleans the state for new attachment uploads with a fresh message.\n */\n this.attachmentUploadAdapter.clearUploads();\n await this.handlers.onSendMessage(content, {\n metadata: fileSharingMetadata\n });\n });\n }\n\n async sendReadReceipt(chatMessageId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onMessageSeen(chatMessageId);\n });\n }\n\n async sendTypingIndicator(): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onTyping();\n });\n }\n\n async removeParticipant(userId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onRemoveParticipant(userId);\n });\n }\n\n async setTopic(topicName: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.updateThreadTopicName(topicName);\n });\n }\n\n async loadPreviousChatMessages(messagesToLoad: number): Promise<boolean> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\n });\n }\n\n async updateMessage(\n messageId: string,\n content: string,\n metadata?: Record<string, string>,\n options?: {\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[];\n }\n ): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n /* @conditional-compile-remove(attachment-upload) */\n const updatedOptions = { attachmentMetadata: options?.attachmentMetadata, metadata: metadata };\n /* @conditional-compile-remove(attachment-upload) */\n return await this.handlers.onUpdateMessage(messageId, content, updatedOptions);\n return await this.handlers.onUpdateMessage(messageId, content);\n });\n }\n\n async deleteMessage(messageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteMessage(messageId);\n });\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n registerActiveUploads(files: File[]): AttachmentUploadTask[] {\n return this.attachmentUploadAdapter.registerActiveUploads(files);\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadTask[] {\n return this.attachmentUploadAdapter.registerCompletedUploads(metadata);\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n clearUploads(): void {\n this.attachmentUploadAdapter.clearUploads();\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n cancelUpload(id: string): void {\n this.attachmentUploadAdapter.cancelUpload(id);\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n updateUploadProgress(id: string, progress: number): void {\n this.attachmentUploadAdapter.updateUploadProgress(id, progress);\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n updateUploadStatusMessage(id: string, errorMessage: string): void {\n this.attachmentUploadAdapter.updateUploadStatusMessage(id, errorMessage);\n }\n\n /* @conditional-compile-remove(attachment-upload) */\n updateUploadMetadata(id: string, metadata: AttachmentMetadata): void {\n this.attachmentUploadAdapter.updateUploadMetadata(id, metadata);\n }\n\n async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.chatClient.downloadResourceToCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.chatClient.removeResourceFromCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n private messageReceivedListener(event: ChatMessageReceivedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageReceived', { message });\n\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\n this.emitter.emit('messageSent', { message });\n }\n }\n\n private messageEditedListener(event: ChatMessageEditedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageEdited', { message });\n }\n\n private messageDeletedListener(event: ChatMessageDeletedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageDeleted', { message });\n }\n\n private messageReadListener({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void {\n const message = this.getState().thread.chatMessages[chatMessageId];\n if (message) {\n this.emitter.emit('messageRead', { message, readBy: recipient });\n }\n }\n\n private participantsAddedListener({ addedBy, participantsAdded }: ParticipantsAddedEvent): void {\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\n }\n\n private participantsRemovedListener({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void {\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\n }\n\n private chatThreadPropertiesUpdatedListener(event: ChatThreadPropertiesUpdatedEvent): void {\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\n }\n\n private subscribeAllEvents(): void {\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.on('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.on('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.on('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.on('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n private unsubscribeAllEvents(): void {\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.off('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.off('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.off('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.off('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageReceivedListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageReceivedListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n off(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isChatError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst convertEventToChatMessage = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): ChatMessage => {\n return {\n id: event.id,\n version: event.version,\n content: isChatMessageDeletedEvent(event) ? undefined : { message: event.message },\n type: convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n createdOn: new Date(event.createdOn),\n editedOn: isChatMessageEditedEvent(event) ? event.editedOn : undefined,\n deletedOn: isChatMessageDeletedEvent(event) ? event.deletedOn : undefined\n };\n};\n\nconst isChatMessageEditedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageEditedEvent => {\n return 'editedOn' in event;\n};\n\nconst isChatMessageDeletedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageDeletedEvent => {\n return 'deletedOn' in event;\n};\n\n// only text/html message type will be received from event\nconst convertEventType = (type: string): ChatMessageType => {\n const lowerCaseType = type.toLowerCase();\n if (lowerCaseType === 'richtext/html' || lowerCaseType === 'html') {\n return 'html';\n } else {\n return 'text';\n }\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link ChatAdapter}.\n *\n * @public\n */\nexport type AzureCommunicationChatAdapterArgs = {\n endpoint: string;\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n threadId: string;\n};\n\n/**\n * Create a {@link ChatAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link ChatAdapter} provided by this library.\n *\n * @public\n */\nexport const createAzureCommunicationChatAdapter = async ({\n endpoint: endpointUrl,\n userId,\n displayName,\n credential,\n threadId\n}: AzureCommunicationChatAdapterArgs): Promise<ChatAdapter> => {\n return _createAzureCommunicationChatAdapterInner(endpointUrl, userId, displayName, credential, threadId);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: string,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n};\n\n/**\n * This inner function to create ChatAdapterPromise in case when threadID is not avaialble.\n * ThreadId is a promise to allow for lazy initialization of the adapter.\n * @internal\n */\nexport const _createLazyAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: Promise<string>,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n return threadId.then(async (threadId) => {\n if (UNSUPPORTED_CHAT_THREAD_TYPE.some((t) => threadId.includes(t))) {\n console.error(\n `Invalid Chat ThreadId: ${threadId}. Please note with Teams Channel Meetings, only Calling is supported and Chat is not currently supported. Read more: ${TEAMS_LIMITATION_LEARN_MORE}.`\n );\n }\n\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n });\n};\n\n/**\n * A custom React hook to simplify the creation of {@link ChatAdapter}.\n *\n * Similar to {@link createAzureCommunicationChatAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationChatAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationChatAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationChatAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: ChatAdapter) => Promise<ChatAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: ChatAdapter) => Promise<void>\n): ChatAdapter | undefined => {\n const { credential, displayName, endpoint, threadId, userId } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<ChatAdapter | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<ChatAdapter | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: ChatAdapter) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !endpoint || !threadId || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationChatAdapter({\n credential,\n displayName,\n endpoint,\n threadId,\n userId\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [adapterRef, afterCreateRef, beforeDisposeRef, credential, displayName, endpoint, threadId, userId]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * Create a {@link ChatAdapter} using the provided {@link StatefulChatClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulChatClient}.\n * Consider using {@link createAzureCommunicationChatAdapter} for a simpler API.\n *\n * @public\n */\nexport async function createAzureCommunicationChatAdapterFromClient(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient\n): Promise<ChatAdapter> {\n return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\n}\n\nconst isChatError = (e: Error): e is ChatError => {\n return 'target' in e && e['target'] !== undefined && 'innerError' in e && e['innerError'] !== undefined;\n};\n"]}
1
+ {"version":3,"file":"AzureCommunicationChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAElC,OAAO,EACL,8BAA8B,EAI/B,gDAAuC;AACxC,OAAO,EAAgB,yBAAyB,EAAE,mDAA0C;AAY5F,OAAO,EAAE,6BAA6B,EAAgC,yCAAgC;AACtG,OAAO,YAAY,MAAM,QAAQ,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,yCAAgC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAInG;;;GAGG;AACH,MAAM,OAAO,WAAW;IAKtB,YAAY,WAA4B,EAAE,QAAgB;QAJlD,YAAO,GAAiB,IAAI,YAAY,EAAE,CAAC;QAKj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C;oBACD,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC7B,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;gBACjC,CAAC;YACH,CAAC,CAAA,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAgB,6CAA6C,CACjE,UAA8B,EAC9B,gBAAkC;;QAElC,OAAO,IAAI,6BAA6B,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;CAAA;AAED,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAkB,EAAE;IAC/C,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAC1G,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n _createStatefulChatClientInner,\n ChatClientState,\n ChatError,\n StatefulChatClient\n} from '@internal/chat-stateful-client';\nimport { ChatHandlers, createDefaultChatHandlers } from '@internal/chat-component-bindings';\nimport { ChatMessage, ChatMessageType, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier } from '@azure/communication-common';\nimport type {\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent\n} from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport EventEmitter from 'events';\nimport {\n ChatAdapter,\n ChatAdapterState,\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './ChatAdapter';\nimport { ResourceDetails } from './ChatAdapter';\nimport { AdapterError } from '../../common/adapters';\nimport { useEffect, useRef, useState } from 'react';\nimport { _isValidIdentifier } from '@internal/acs-ui-common';\nimport { TEAMS_LIMITATION_LEARN_MORE, UNSUPPORTED_CHAT_THREAD_TYPE } from '../../common/constants';\n/* @conditional-compile-remove(attachment-upload) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Context of Chat, which is a centralized context for all state updates\n * @private\n */\nexport class ChatContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: ChatAdapterState;\n private threadId: string;\n\n constructor(clientState: ChatClientState, threadId: string) {\n const thread = clientState.threads[threadId];\n this.threadId = threadId;\n if (!thread) {\n throw 'Cannot find threadId, please initialize thread before use!';\n }\n this.state = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: ChatAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): ChatAdapterState {\n return this.state;\n }\n\n public setError(error: Error): void {\n this.setState({ ...this.state, error });\n }\n\n public updateClientState(clientState: ChatClientState): void {\n const thread = clientState.threads[this.threadId];\n if (!thread) {\n throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\n }\n\n let updatedState: ChatAdapterState = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n\n /* @conditional-compile-remove(attachment-upload) */\n updatedState = { ...updatedState };\n\n this.setState(updatedState);\n }\n}\n\n/**\n * @private\n */\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\n private chatClient: StatefulChatClient;\n private chatThreadClient: ChatThreadClient;\n private context: ChatContext;\n private handlers: ChatHandlers;\n private emitter: EventEmitter = new EventEmitter();\n\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\n this.bindAllPublicMethods();\n this.chatClient = chatClient;\n this.chatThreadClient = chatThreadClient;\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\n\n const onStateChange = (clientState: ChatClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n chatClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\n\n this.chatClient.onStateChange(onStateChange);\n this.subscribeAllEvents();\n }\n\n private bindAllPublicMethods(): void {\n this.onStateChange = this.onStateChange.bind(this);\n this.offStateChange = this.offStateChange.bind(this);\n this.getState = this.getState.bind(this);\n this.dispose = this.dispose.bind(this);\n this.fetchInitialData = this.fetchInitialData.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n this.sendReadReceipt = this.sendReadReceipt.bind(this);\n this.sendTypingIndicator = this.sendTypingIndicator.bind(this);\n this.updateMessage = this.updateMessage.bind(this);\n this.deleteMessage = this.deleteMessage.bind(this);\n this.removeParticipant = this.removeParticipant.bind(this);\n this.setTopic = this.setTopic.bind(this);\n this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n this.downloadResourceToCache = this.downloadResourceToCache.bind(this);\n this.removeResourceFromCache = this.removeResourceFromCache.bind(this);\n }\n\n dispose(): void {\n this.unsubscribeAllEvents();\n this.chatClient.dispose();\n }\n\n async fetchInitialData(): Promise<void> {\n // If get properties fails we dont want to try to get the participants after.\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.chatThreadClient.getProperties();\n // Fetch all participants who joined before the local user.\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\n // Fetch 100 participants per page by default.\n maxPageSize: 100\n // eslint-disable-next-line curly\n }));\n });\n }\n\n getState(): ChatAdapterState {\n return this.context.getState();\n }\n\n onStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n offStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n async sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onSendMessage(content, options);\n });\n }\n\n async sendReadReceipt(chatMessageId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onMessageSeen(chatMessageId);\n });\n }\n\n async sendTypingIndicator(): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onTyping();\n });\n }\n\n async removeParticipant(userId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onRemoveParticipant(userId);\n });\n }\n\n async setTopic(topicName: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.updateThreadTopicName(topicName);\n });\n }\n\n async loadPreviousChatMessages(messagesToLoad: number): Promise<boolean> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\n });\n }\n\n async updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(attachment-upload) */ MessageOptions\n ): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n /* @conditional-compile-remove(attachment-upload) */\n const messageOptions: MessageOptions = {};\n /* @conditional-compile-remove(attachment-upload) */\n if (\n options &&\n // if options.attachments is an array or undefined (for removal all attachments),\n // then given options is a MessageOptions\n (Array.isArray(options.attachments) || options.attachments === undefined)\n ) {\n messageOptions.attachments = options.attachments ?? [];\n }\n /* @conditional-compile-remove(attachment-upload) */\n if (\n options &&\n // if options.metadata is provided, we need to add it in MessageOptions\n options.metadata &&\n typeof options.metadata === 'object'\n ) {\n messageOptions.metadata = options.metadata;\n }\n /* @conditional-compile-remove(attachment-upload) */\n if (options && !('attachments' in options) && !('metadata' in options)) {\n // if options don't have attachments or metadata,\n // then it is a Record<string, string>\n /* @conditional-compile-remove(attachment-upload) */\n return await this.handlers.onUpdateMessage(messageId, content, options);\n }\n /* @conditional-compile-remove(attachment-upload) */\n return await this.handlers.onUpdateMessage(messageId, content, messageOptions);\n // metadata is never used in the current stable\n return await this.handlers.onUpdateMessage(messageId, content);\n });\n }\n\n async deleteMessage(messageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteMessage(messageId);\n });\n }\n\n async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.chatClient.downloadResourceToCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.chatClient.removeResourceFromCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n private messageReceivedListener(event: ChatMessageReceivedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageReceived', { message });\n\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\n this.emitter.emit('messageSent', { message });\n }\n }\n\n private messageEditedListener(event: ChatMessageEditedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageEdited', { message });\n }\n\n private messageDeletedListener(event: ChatMessageDeletedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageDeleted', { message });\n }\n\n private messageReadListener({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void {\n const message = this.getState().thread.chatMessages[chatMessageId];\n if (message) {\n this.emitter.emit('messageRead', { message, readBy: recipient });\n }\n }\n\n private participantsAddedListener({ addedBy, participantsAdded }: ParticipantsAddedEvent): void {\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\n }\n\n private participantsRemovedListener({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void {\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\n }\n\n private chatThreadPropertiesUpdatedListener(event: ChatThreadPropertiesUpdatedEvent): void {\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\n }\n\n private subscribeAllEvents(): void {\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.on('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.on('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.on('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.on('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n private unsubscribeAllEvents(): void {\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.off('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.off('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.off('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.off('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageReceivedListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageReceivedListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n off(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isChatError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst convertEventToChatMessage = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): ChatMessage => {\n return {\n id: event.id,\n version: event.version,\n content: isChatMessageDeletedEvent(event) ? undefined : { message: event.message },\n type: convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n createdOn: new Date(event.createdOn),\n editedOn: isChatMessageEditedEvent(event) ? event.editedOn : undefined,\n deletedOn: isChatMessageDeletedEvent(event) ? event.deletedOn : undefined\n };\n};\n\nconst isChatMessageEditedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageEditedEvent => {\n return 'editedOn' in event;\n};\n\nconst isChatMessageDeletedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageDeletedEvent => {\n return 'deletedOn' in event;\n};\n\n// only text/html message type will be received from event\nconst convertEventType = (type: string): ChatMessageType => {\n const lowerCaseType = type.toLowerCase();\n if (lowerCaseType === 'richtext/html' || lowerCaseType === 'html') {\n return 'html';\n } else {\n return 'text';\n }\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link ChatAdapter}.\n *\n * @public\n */\nexport type AzureCommunicationChatAdapterArgs = {\n endpoint: string;\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n threadId: string;\n};\n\n/**\n * Create a {@link ChatAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link ChatAdapter} provided by this library.\n *\n * @public\n */\nexport const createAzureCommunicationChatAdapter = async ({\n endpoint: endpointUrl,\n userId,\n displayName,\n credential,\n threadId\n}: AzureCommunicationChatAdapterArgs): Promise<ChatAdapter> => {\n return _createAzureCommunicationChatAdapterInner(endpointUrl, userId, displayName, credential, threadId);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: string,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n};\n\n/**\n * This inner function to create ChatAdapterPromise in case when threadID is not avaialble.\n * ThreadId is a promise to allow for lazy initialization of the adapter.\n * @internal\n */\nexport const _createLazyAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: Promise<string>,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n return threadId.then(async (threadId) => {\n if (UNSUPPORTED_CHAT_THREAD_TYPE.some((t) => threadId.includes(t))) {\n console.error(\n `Invalid Chat ThreadId: ${threadId}. Please note with Teams Channel Meetings, only Calling is supported and Chat is not currently supported. Read more: ${TEAMS_LIMITATION_LEARN_MORE}.`\n );\n }\n\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n });\n};\n\n/**\n * A custom React hook to simplify the creation of {@link ChatAdapter}.\n *\n * Similar to {@link createAzureCommunicationChatAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationChatAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationChatAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationChatAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: ChatAdapter) => Promise<ChatAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: ChatAdapter) => Promise<void>\n): ChatAdapter | undefined => {\n const { credential, displayName, endpoint, threadId, userId } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<ChatAdapter | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<ChatAdapter | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: ChatAdapter) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !endpoint || !threadId || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationChatAdapter({\n credential,\n displayName,\n endpoint,\n threadId,\n userId\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [adapterRef, afterCreateRef, beforeDisposeRef, credential, displayName, endpoint, threadId, userId]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * Create a {@link ChatAdapter} using the provided {@link StatefulChatClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulChatClient}.\n * Consider using {@link createAzureCommunicationChatAdapter} for a simpler API.\n *\n * @public\n */\nexport async function createAzureCommunicationChatAdapterFromClient(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient\n): Promise<ChatAdapter> {\n return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\n}\n\nconst isChatError = (e: Error): e is ChatError => {\n return 'target' in e && e['target'] !== undefined && 'innerError' in e && e['innerError'] !== undefined;\n};\n"]}