@azure/communication-react 1.18.0-beta.1 → 1.18.0

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 (638) hide show
  1. package/dist/communication-react.d.ts +508 -1758
  2. package/dist/dist-cjs/communication-react/index.js +34363 -159
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/common.js +10 -2
  5. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  6. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  8. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +4 -5
  9. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +6 -11
  10. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts +0 -12
  12. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +1 -13
  13. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
  14. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js +0 -5
  15. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js.map +1 -1
  16. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +0 -8
  17. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +0 -14
  18. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  19. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +1 -15
  20. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  21. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +1 -27
  22. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
  23. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +3 -3
  24. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +11 -11
  25. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  26. package/dist/dist-esm/calling-component-bindings/src/index.d.ts +2 -2
  27. package/dist/dist-esm/calling-component-bindings/src/index.js +2 -2
  28. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
  29. package/dist/dist-esm/calling-component-bindings/src/notificationStackSelector.d.ts +23 -0
  30. package/dist/dist-esm/calling-component-bindings/src/notificationStackSelector.js +201 -0
  31. package/dist/dist-esm/calling-component-bindings/src/notificationStackSelector.js.map +1 -0
  32. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +0 -1
  33. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +2 -8
  34. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
  35. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +0 -7
  36. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js +0 -12
  37. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
  38. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +0 -3
  39. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  40. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +0 -3
  41. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  42. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.d.ts +1 -5
  43. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js.map +1 -1
  44. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +1 -15
  45. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  46. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +0 -5
  47. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  48. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +23 -58
  49. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  50. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +3 -12
  51. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +16 -69
  52. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  53. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +0 -68
  54. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  55. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +1 -3
  56. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +16 -28
  57. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  58. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.d.ts +0 -17
  59. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js +3 -61
  60. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js.map +1 -1
  61. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +0 -5
  62. package/dist/dist-esm/calling-stateful-client/src/Converter.js +6 -17
  63. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  64. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.d.ts +0 -1
  65. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js +0 -11
  66. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js.map +1 -1
  67. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +9 -19
  68. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +2 -20
  69. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  70. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +3 -4
  71. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js +2 -0
  72. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  73. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +0 -18
  74. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
  75. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +2 -2
  76. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  77. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +2 -3
  78. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  79. package/dist/dist-esm/calling-stateful-client/src/index.d.ts +1 -1
  80. package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
  81. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +2 -3
  82. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +2 -12
  83. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  84. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +1 -2
  85. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +0 -5
  86. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  87. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +36 -37
  88. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  89. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +3 -3
  90. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
  91. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +1 -1
  92. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js.map +1 -1
  93. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +1 -3
  94. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
  95. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +3 -0
  96. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  97. package/dist/dist-esm/communication-react/src/index.d.ts +4 -28
  98. package/dist/dist-esm/communication-react/src/index.js +2 -14
  99. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  100. package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.js +1 -1
  101. package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.js.map +1 -1
  102. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +5 -4
  103. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
  104. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.d.ts +1 -0
  105. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js +3 -3
  106. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -1
  107. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.d.ts +0 -2
  108. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +1 -14
  109. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
  110. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.d.ts +4 -0
  111. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js +16 -19
  112. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -1
  113. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +1 -7
  114. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +2 -10
  115. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  116. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +0 -11
  117. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +2 -35
  118. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  119. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +1 -8
  120. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +5 -13
  121. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  122. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.d.ts +1 -2
  123. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +7 -15
  124. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
  125. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +1 -4
  126. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +6 -40
  127. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  128. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +1 -16
  129. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +0 -22
  130. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  131. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +2 -21
  132. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +6 -21
  133. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  134. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +1 -8
  135. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +6 -14
  136. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  137. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +6 -19
  138. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  139. package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts +4 -0
  140. package/dist/dist-esm/react-components/src/components/ErrorBar.js +3 -3
  141. package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
  142. package/dist/dist-esm/react-components/src/components/ImageOverlay.js +3 -7
  143. package/dist/dist-esm/react-components/src/components/ImageOverlay.js.map +1 -1
  144. package/dist/dist-esm/react-components/src/components/InputBoxButton.d.ts +1 -0
  145. package/dist/dist-esm/react-components/src/components/InputBoxButton.js +2 -2
  146. package/dist/dist-esm/react-components/src/components/InputBoxButton.js.map +1 -1
  147. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +0 -2
  148. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +0 -18
  149. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  150. package/dist/dist-esm/react-components/src/components/MeetingConferencePhoneInfo.d.ts +85 -0
  151. package/dist/dist-esm/react-components/src/components/MeetingConferencePhoneInfo.js +135 -0
  152. package/dist/dist-esm/react-components/src/components/MeetingConferencePhoneInfo.js.map +1 -0
  153. package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js +1 -1
  154. package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js.map +1 -1
  155. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +5 -50
  156. package/dist/dist-esm/react-components/src/components/MessageThread.js +3 -30
  157. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  158. package/dist/dist-esm/react-components/src/components/{NotificationBar.d.ts → Notification.d.ts} +13 -13
  159. package/dist/dist-esm/react-components/src/components/{NotificationBar.js → Notification.js} +7 -7
  160. package/dist/dist-esm/react-components/src/components/Notification.js.map +1 -0
  161. package/dist/dist-esm/react-components/src/components/{Notifications.d.ts → NotificationStack.d.ts} +109 -73
  162. package/dist/dist-esm/react-components/src/components/NotificationStack.js +57 -0
  163. package/dist/dist-esm/react-components/src/components/NotificationStack.js.map +1 -0
  164. package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts +0 -13
  165. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +0 -3
  166. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  167. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +0 -15
  168. package/dist/dist-esm/react-components/src/components/ParticipantList.js +4 -21
  169. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  170. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +1 -3
  171. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
  172. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js +5 -1
  173. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js.map +1 -1
  174. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js +5 -1
  175. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +1 -1
  176. package/dist/dist-esm/react-components/src/components/SendBox.d.ts +1 -47
  177. package/dist/dist-esm/react-components/src/components/SendBox.js +8 -90
  178. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  179. package/dist/dist-esm/react-components/src/components/TroubleshootingGuideErrorBar.js +1 -1
  180. package/dist/dist-esm/react-components/src/components/TroubleshootingGuideErrorBar.js.map +1 -1
  181. package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js +0 -2
  182. package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js.map +1 -1
  183. package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js +0 -2
  184. package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js.map +1 -1
  185. package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js +0 -24
  186. package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js.map +1 -1
  187. package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js +0 -2
  188. package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js.map +1 -1
  189. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +3 -15
  190. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  191. package/dist/dist-esm/react-components/src/components/VideoGallery.js +1 -2
  192. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  193. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +0 -8
  194. package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -7
  195. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  196. package/dist/dist-esm/react-components/src/components/index.d.ts +3 -20
  197. package/dist/dist-esm/react-components/src/components/index.js +6 -15
  198. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  199. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +1 -1
  200. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +10 -0
  201. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  202. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +5 -1
  203. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js +8 -0
  204. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js.map +1 -1
  205. package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +4 -0
  206. package/dist/dist-esm/react-components/src/components/styles/Common.style.js +4 -0
  207. package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +1 -1
  208. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +5 -3
  209. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +40 -20
  210. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  211. package/dist/dist-esm/react-components/src/components/styles/{NotificationBar.styles.d.ts → Notification.styles.d.ts} +1 -1
  212. package/dist/dist-esm/react-components/src/components/styles/{NotificationBar.styles.js → Notification.styles.js} +1 -1
  213. package/dist/dist-esm/react-components/src/components/styles/Notification.styles.js.map +1 -0
  214. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +4 -1
  215. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +11 -3
  216. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  217. package/dist/dist-esm/react-components/src/components/styles/TeamsMeetingConferenceInfo.d.ts +42 -0
  218. package/dist/dist-esm/react-components/src/components/styles/TeamsMeetingConferenceInfo.js +93 -0
  219. package/dist/dist-esm/react-components/src/components/styles/TeamsMeetingConferenceInfo.js.map +1 -0
  220. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +1 -37
  221. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +3 -34
  222. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  223. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +2 -4
  224. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +2 -14
  225. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  226. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +1 -11
  227. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +2 -18
  228. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  229. package/dist/dist-esm/react-components/src/components/utils/common.js +0 -4
  230. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  231. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +1 -2
  232. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
  233. package/dist/dist-esm/react-components/src/components/utils/responsive.js +12 -2
  234. package/dist/dist-esm/react-components/src/components/utils/responsive.js.map +1 -1
  235. package/dist/dist-esm/react-components/src/components/utils.d.ts +32 -1
  236. package/dist/dist-esm/react-components/src/components/utils.js +101 -1
  237. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  238. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +0 -4
  239. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +1 -5
  240. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
  241. package/dist/dist-esm/react-components/src/index.d.ts +0 -1
  242. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  243. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +7 -58
  244. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
  245. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +102 -64
  246. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +100 -62
  247. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +100 -62
  248. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +100 -62
  249. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +98 -60
  250. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +100 -62
  251. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +100 -62
  252. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +103 -65
  253. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +100 -62
  254. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +100 -62
  255. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +102 -64
  256. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +107 -69
  257. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +100 -62
  258. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +106 -68
  259. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +105 -67
  260. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +103 -65
  261. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +101 -63
  262. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +100 -62
  263. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +101 -63
  264. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +102 -64
  265. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +101 -63
  266. package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.d.ts +1 -0
  267. package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.js +4 -4
  268. package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.js.map +1 -1
  269. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -28
  270. package/dist/dist-esm/react-components/src/theming/icons.js +7 -136
  271. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  272. package/dist/dist-esm/react-components/src/theming/themes.d.ts +0 -6
  273. package/dist/dist-esm/react-components/src/theming/themes.js +11 -20
  274. package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
  275. package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js +1 -1
  276. package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js.map +1 -1
  277. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +0 -9
  278. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  279. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -20
  280. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  281. package/dist/dist-esm/react-components/src/types/OnRender.d.ts +0 -8
  282. package/dist/dist-esm/react-components/src/types/OnRender.js.map +1 -1
  283. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +0 -6
  284. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js +0 -2
  285. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js.map +1 -1
  286. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +0 -72
  287. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +86 -37
  288. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  289. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +4 -108
  290. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  291. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +12 -64
  292. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +15 -150
  293. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  294. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +3 -51
  295. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js +1 -1
  296. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  297. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.d.ts +2 -0
  298. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js +20 -0
  299. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js.map +1 -1
  300. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +2 -2
  301. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -1
  302. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +0 -2
  303. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  304. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +6 -2
  305. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +83 -32
  306. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  307. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.d.ts +0 -1
  308. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +2 -38
  309. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  310. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.d.ts +0 -2
  311. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js +0 -27
  312. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
  313. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js +2 -20
  314. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
  315. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.d.ts +0 -2
  316. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js +0 -27
  317. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
  318. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +0 -1
  319. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +5 -19
  320. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  321. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/NetworkReconnectTile.d.ts +1 -0
  322. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/NetworkReconnectTile.js +65 -1
  323. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/NetworkReconnectTile.js.map +1 -1
  324. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useMeetingPhoneInfo.d.ts +13 -0
  325. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useMeetingPhoneInfo.js +49 -0
  326. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useMeetingPhoneInfo.js.map +1 -0
  327. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +2 -1
  328. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
  329. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.d.ts +1 -0
  330. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js +1 -1
  331. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js.map +1 -1
  332. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +2 -6
  333. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
  334. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +7 -30
  335. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  336. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +0 -3
  337. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  338. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +5 -2
  339. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +12 -4
  340. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  341. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +0 -7
  342. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +7 -80
  343. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  344. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.d.ts +5 -2
  345. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +6 -3
  346. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  347. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +6 -3
  348. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
  349. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +5 -8
  350. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +5 -11
  351. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  352. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js.map +1 -1
  353. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.js +0 -4
  354. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.js.map +1 -1
  355. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.d.ts +4 -0
  356. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.js +11 -0
  357. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.js.map +1 -1
  358. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.d.ts +2 -2
  359. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.js.map +1 -1
  360. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/ErrorTracking.d.ts +6 -2
  361. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/ErrorTracking.js.map +1 -1
  362. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.d.ts +8 -7
  363. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js +20 -20
  364. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js.map +1 -1
  365. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +49 -14
  366. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +104 -98
  367. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  368. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +1 -61
  369. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +6 -27
  370. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  371. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.d.ts +0 -32
  372. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.js.map +1 -1
  373. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +5 -15
  374. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -49
  375. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  376. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -38
  377. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  378. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +1 -9
  379. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +0 -32
  380. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  381. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +4 -5
  382. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +2 -2
  383. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  384. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -13
  385. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +0 -4
  386. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  387. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +0 -20
  388. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +1 -6
  389. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  390. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +0 -2
  391. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +10 -131
  392. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  393. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +0 -4
  394. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
  395. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +2 -3
  396. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +0 -27
  397. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  398. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -3
  399. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  400. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +2 -13
  401. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  402. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +0 -2
  403. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  404. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.d.ts +1 -5
  405. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js +0 -15
  406. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
  407. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +0 -5
  408. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js +2 -3
  409. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
  410. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.d.ts +2 -1
  411. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +25 -19
  412. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  413. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.d.ts +1 -1
  414. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -1
  415. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.d.ts +2 -0
  416. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +29 -26
  417. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -1
  418. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.d.ts +1 -0
  419. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +26 -23
  420. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  421. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.d.ts +1 -1
  422. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -1
  423. package/dist/dist-esm/react-composites/src/composites/common/MeetingPhoneInfoPaneContent.d.ts +10 -0
  424. package/dist/dist-esm/react-composites/src/composites/common/MeetingPhoneInfoPaneContent.js +63 -0
  425. package/dist/dist-esm/react-composites/src/composites/common/MeetingPhoneInfoPaneContent.js.map +1 -0
  426. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js +9 -7
  427. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js.map +1 -1
  428. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +2 -14
  429. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  430. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +1 -4
  431. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +0 -1
  432. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
  433. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +10 -39
  434. package/dist/dist-esm/react-composites/src/composites/common/icons.js +10 -12
  435. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  436. package/dist/dist-esm/react-composites/src/composites/common/styles/ModalLocalAndRemotePIP.styles.d.ts +1 -1
  437. package/dist/dist-esm/react-composites/src/composites/common/styles/ModalLocalAndRemotePIP.styles.js +2 -2
  438. package/dist/dist-esm/react-composites/src/composites/common/styles/ModalLocalAndRemotePIP.styles.js.map +1 -1
  439. package/dist/dist-esm/react-composites/src/composites/common/styles/TeamsMeetingConferenceInfo.style.d.ts +50 -0
  440. package/dist/dist-esm/react-composites/src/composites/common/styles/TeamsMeetingConferenceInfo.style.js +110 -0
  441. package/dist/dist-esm/react-composites/src/composites/common/styles/TeamsMeetingConferenceInfo.style.js.map +1 -0
  442. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +10 -17
  443. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
  444. package/dist/dist-esm/react-composites/src/composites/common/utils.js +6 -6
  445. package/dist/dist-esm/react-composites/src/composites/common/utils.js.map +1 -1
  446. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +10 -5
  447. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +6 -1
  448. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +6 -1
  449. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +6 -1
  450. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +6 -1
  451. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +6 -1
  452. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +10 -5
  453. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +10 -5
  454. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +10 -5
  455. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +10 -5
  456. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +6 -1
  457. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +10 -5
  458. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +6 -1
  459. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +6 -1
  460. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +6 -1
  461. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +10 -5
  462. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +6 -1
  463. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +10 -5
  464. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +6 -1
  465. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +10 -5
  466. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +10 -5
  467. package/dist/tsdoc-metadata.json +1 -1
  468. package/package.json +16 -16
  469. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BWStTUhO.js +0 -136
  470. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BWStTUhO.js.map +0 -1
  471. package/dist/dist-cjs/communication-react/index-Di3ptk8o.js +0 -39650
  472. package/dist/dist-cjs/communication-react/index-Di3ptk8o.js.map +0 -1
  473. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.d.ts +0 -17
  474. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js +0 -36
  475. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js.map +0 -1
  476. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.d.ts +0 -10
  477. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js +0 -15
  478. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +0 -1
  479. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +0 -17
  480. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +0 -125
  481. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +0 -1
  482. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.d.ts +0 -69
  483. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js +0 -43
  484. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +0 -1
  485. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.d.ts +0 -75
  486. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js +0 -75
  487. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +0 -1
  488. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +0 -105
  489. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js +0 -68
  490. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js.map +0 -1
  491. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +0 -86
  492. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js +0 -39
  493. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +0 -1
  494. package/dist/dist-esm/react-components/src/components/HoldButton.d.ts +0 -49
  495. package/dist/dist-esm/react-components/src/components/HoldButton.js +0 -25
  496. package/dist/dist-esm/react-components/src/components/HoldButton.js.map +0 -1
  497. package/dist/dist-esm/react-components/src/components/MentionPopover.d.ts +0 -121
  498. package/dist/dist-esm/react-components/src/components/MentionPopover.js +0 -123
  499. package/dist/dist-esm/react-components/src/components/MentionPopover.js.map +0 -1
  500. package/dist/dist-esm/react-components/src/components/NotificationBar.js.map +0 -1
  501. package/dist/dist-esm/react-components/src/components/Notifications.js +0 -46
  502. package/dist/dist-esm/react-components/src/components/Notifications.js.map +0 -1
  503. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.d.ts +0 -9
  504. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js +0 -29
  505. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js.map +0 -1
  506. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +0 -22
  507. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +0 -89
  508. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +0 -1
  509. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.d.ts +0 -12
  510. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js +0 -23
  511. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js.map +0 -1
  512. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +0 -15
  513. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +0 -39
  514. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +0 -1
  515. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.d.ts +0 -24
  516. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js +0 -64
  517. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js.map +0 -1
  518. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.d.ts +0 -20
  519. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js +0 -46
  520. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js.map +0 -1
  521. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +0 -29
  522. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +0 -73
  523. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +0 -1
  524. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +0 -54
  525. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +0 -226
  526. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +0 -1
  527. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +0 -33
  528. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +0 -82
  529. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +0 -1
  530. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +0 -149
  531. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +0 -182
  532. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +0 -1
  533. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.d.ts +0 -16
  534. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js +0 -73
  535. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +0 -1
  536. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.d.ts +0 -19
  537. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +0 -191
  538. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +0 -1
  539. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.d.ts +0 -7
  540. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js +0 -51
  541. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js.map +0 -1
  542. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.d.ts +0 -15
  543. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js +0 -64
  544. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js.map +0 -1
  545. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.d.ts +0 -6
  546. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js +0 -13
  547. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js.map +0 -1
  548. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.d.ts +0 -34
  549. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js +0 -39
  550. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +0 -1
  551. package/dist/dist-esm/react-components/src/components/SendBoxErrors.d.ts +0 -14
  552. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js +0 -18
  553. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js.map +0 -1
  554. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.d.ts +0 -24
  555. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +0 -550
  556. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +0 -1
  557. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.d.ts +0 -152
  558. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +0 -816
  559. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +0 -1
  560. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.d.ts +0 -58
  561. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js +0 -144
  562. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +0 -1
  563. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.d.ts +0 -26
  564. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js +0 -69
  565. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js.map +0 -1
  566. package/dist/dist-esm/react-components/src/components/styles/NotificationBar.styles.js.map +0 -1
  567. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +0 -82
  568. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +0 -305
  569. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +0 -1
  570. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.d.ts +0 -21
  571. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js +0 -38
  572. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js.map +0 -1
  573. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.d.ts +0 -38
  574. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +0 -92
  575. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +0 -1
  576. package/dist/dist-esm/react-components/src/components/styles/Stack.style.d.ts +0 -5
  577. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js +0 -32
  578. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js.map +0 -1
  579. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.d.ts +0 -26
  580. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js +0 -67
  581. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js.map +0 -1
  582. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +0 -37
  583. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +0 -60
  584. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +0 -1
  585. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.d.ts +0 -33
  586. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +0 -116
  587. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +0 -1
  588. package/dist/dist-esm/react-components/src/components/utils/merge.d.ts +0 -7
  589. package/dist/dist-esm/react-components/src/components/utils/merge.js +0 -16
  590. package/dist/dist-esm/react-components/src/components/utils/merge.js.map +0 -1
  591. package/dist/dist-esm/react-components/src/theming/icons.styles.d.ts +0 -6
  592. package/dist/dist-esm/react-components/src/theming/icons.styles.js +0 -25
  593. package/dist/dist-esm/react-components/src/theming/icons.styles.js.map +0 -1
  594. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +0 -48
  595. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +0 -218
  596. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +0 -1
  597. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.d.ts +0 -12
  598. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js +0 -93
  599. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js.map +0 -1
  600. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.d.ts +0 -8
  601. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js +0 -26
  602. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js.map +0 -1
  603. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +0 -24
  604. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +0 -28
  605. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +0 -1
  606. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.d.ts +0 -15
  607. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js +0 -54
  608. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js.map +0 -1
  609. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.d.ts +0 -32
  610. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js +0 -81
  611. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js.map +0 -1
  612. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.d.ts +0 -15
  613. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js +0 -23
  614. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js.map +0 -1
  615. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +0 -18
  616. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js +0 -18
  617. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +0 -1
  618. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +0 -80
  619. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +0 -39
  620. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +0 -1
  621. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.d.ts +0 -38
  622. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +0 -76
  623. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +0 -1
  624. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +0 -5
  625. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js +0 -5
  626. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +0 -1
  627. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.d.ts +0 -25
  628. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +0 -113
  629. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +0 -1
  630. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.d.ts +0 -17
  631. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js +0 -32
  632. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js.map +0 -1
  633. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.d.ts +0 -22
  634. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +0 -74
  635. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +0 -1
  636. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.d.ts +0 -15
  637. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js +0 -61
  638. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +0 -1
@@ -33,25 +33,15 @@ export const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClien
33
33
  content,
34
34
  senderDisplayName: chatClient.getState().displayName
35
35
  };
36
- /* @conditional-compile-remove(file-sharing-acs) */
37
- if (options && 'attachments' in options && options.attachments && options.attachments[0] && !options.attachments[0].attachmentType) {
38
- const chatSDKOptions = {
39
- metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), { fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) })
40
- };
41
- yield chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);
42
- return;
43
- }
44
36
  yield chatThreadClient.sendMessage(sendMessageRequest, options);
45
37
  });
46
38
  },
47
39
  // due to a bug in babel, we can't use arrow function here
48
40
  // affecting conditional-compile-remove(attachment-upload)
49
- onUpdateMessage: function (messageId, content, /* @conditional-compile-remove(file-sharing-acs) */ options) {
41
+ onUpdateMessage: function (messageId, content) {
50
42
  return __awaiter(this, void 0, void 0, function* () {
51
43
  const updateMessageOptions = {
52
- content,
53
- /* @conditional-compile-remove(file-sharing-acs) */
54
- metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), { fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) })
44
+ content
55
45
  };
56
46
  yield chatThreadClient.updateMessage(messageId, updateMessageOptions);
57
47
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EA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AA+B,EAAE;IACzM,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachment } from '@azure/communication-chat';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (content: string, options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */MessageOptions) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (messageId: string, content: string, /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne((chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (content: string, options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */MessageOptions) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n /* @conditional-compile-remove(file-sharing-acs) */\n if (options && 'attachments' in options && options.attachments && options.attachments[0] && !(options.attachments[0] as ChatAttachment).attachmentType) {\n const chatSDKOptions = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n await chatThreadClient.sendMessage(sendMessageRequest, (options as SendMessageOptions));\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (messageId: string, content: string, /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions) {\n const updateMessageOptions = {\n content,\n /* @conditional-compile-remove(file-sharing-acs) */\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({\n chatMessageId\n });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({\n maxPageSize: 50\n });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n return isAllChatMessagesLoaded;\n }\n };\n});\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props,>(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};"]}
1
+ {"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAGlF,OAAO,UAAU,MAAM,aAAa,CAAC;AAoBrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACvI,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,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,CAAC;gBACxF,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjD,CAAC;YACD,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAS,UAA8B,EAAE,gBAAkC,EAAE,CAAwC,EAA+B,EAAE;IACzM,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (messageId: string, content: string) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne((chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (content: string, options?: SendMessageOptions) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n await chatThreadClient.sendMessage(sendMessageRequest, (options as SendMessageOptions));\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (messageId: string, content: string) {\n const updateMessageOptions = {\n content\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({\n chatMessageId\n });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({\n maxPageSize: 50\n });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n return isAllChatMessagesLoaded;\n }\n };\n});\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props,>(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};"]}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from "../../../react-components/src";
3
- import { RichTextSendBox } from "../../../react-components/src";
4
3
  import { SendBoxSelector } from '../sendBoxSelector';
5
4
  import { MessageThreadSelector } from '../messageThreadSelector';
6
5
  import { TypingIndicatorSelector } from '../typingIndicatorSelector';
@@ -32,7 +31,7 @@ export declare const usePropsFor: <Component extends (props: any) => JSX.Element
32
31
  *
33
32
  * @public
34
33
  */
35
- export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof RichTextSendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;
34
+ export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;
36
35
  /**
37
36
  * Get the selector for a specified component.
38
37
  *
@@ -1,8 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from "../../../react-components/src";
4
- /* @conditional-compile-remove(rich-text-editor) */
5
- import { RichTextSendBox } from "../../../react-components/src";
6
4
  import { useHandlers } from './useHandlers';
7
5
  import { useSelector } from './useSelector';
8
6
  import { sendBoxSelector } from '../sendBoxSelector';
@@ -68,9 +66,6 @@ const findSelector = (component) => {
68
66
  switch (component) {
69
67
  case SendBox:
70
68
  return sendBoxSelector;
71
- /* @conditional-compile-remove(rich-text-editor) */
72
- case RichTextSendBox:
73
- return sendBoxSelector;
74
69
  case MessageThread:
75
70
  return getMessageThreadSelector();
76
71
  case TypingIndicator:
@@ -1 +1 @@
1
- {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/usePropsFor.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAEhH,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAyB,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAA2B,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,EAA+B,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAAo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AAC;IACF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,eAAe,CAAC;QACzB,mDAAmD;QACnD,KAAK,eAAe;YAClB,OAAO,eAAe,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,wBAAwB,EAAE,CAAC;QACpC,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC;QACjC,KAAK,eAAe;YAClB,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\n\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextSendBox } from '@internal/react-components';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { SendBoxSelector, sendBoxSelector } from '../sendBoxSelector';\nimport { MessageThreadSelector, messageThreadSelectorWithThread } from '../messageThreadSelector';\nimport { TypingIndicatorSelector, typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { Common, AreEqual } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\nimport { ChatParticipantListSelector, chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n\n/**\n * Primary hook to get all hooks necessary for a chat Component.\n *\n * Most straightforward usage of chat components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element,>(component: Component): GetSelector<Component> extends (props: any) => any ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return ({\n ...props,\n ...handlers\n } as any);\n }\n return (undefined as any);\n};\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof RichTextSendBox> extends true ? /* @conditional-compile-remove(rich-text-editor) */SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined,>(component: Component): GetSelector<Component> => {\n return findSelector(component);\n};\nconst messageThreadSelectorsByThread: {\n [key: string]: MessageThreadSelector;\n} = {};\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // For the message thread selector we need to create a new one for each thread\n // If we have just one for the entire app, then we will have updates when not expecting due to\n // the arguments changing\n const getMessageThreadSelector: () => MessageThreadSelector = () => {\n const threadId = useContext(ChatThreadClientContext)?.threadId ?? 'default-id-when-not-in-provider';\n let messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n if (!messageThreadSelectorImpl) {\n messageThreadSelectorsByThread[threadId] = messageThreadSelectorWithThread();\n messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n }\n return messageThreadSelectorImpl;\n };\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n /* @conditional-compile-remove(rich-text-editor) */\n case RichTextSendBox:\n return sendBoxSelector;\n case MessageThread:\n return getMessageThreadSelector();\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};"]}
1
+ {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/usePropsFor.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAyB,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAA2B,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,EAA+B,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAAoB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAiD,SAAoB,EAAwJ,EAAE;IACxP,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAA2B,SAAS,CAAC,CAAC;IAClE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAQ,gCACH,KAAK,GACL,QAAQ,CACJ,CAAC;IACZ,CAAC;IACD,OAAQ,SAAiB,CAAC;AAC5B,CAAC,CAAC;AASF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAA6D,SAAoB,EAA0B,EAAE;IACtI,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC;AACF,MAAM,8BAA8B,GAEhC,EAAE,CAAC;AACP,MAAM,YAAY,GAAG,CAAC,SAAkD,EAAO,EAAE;IAC/E,8EAA8E;IAC9E,8FAA8F;IAC9F,yBAAyB;IACzB,MAAM,wBAAwB,GAAgC,GAAG,EAAE;;QACjE,MAAM,QAAQ,GAAG,MAAA,MAAA,UAAU,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,mCAAI,iCAAiC,CAAC;QACpG,IAAI,yBAAyB,GAAG,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QACzE,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/B,8BAA8B,CAAC,QAAQ,CAAC,GAAG,+BAA+B,EAAE,CAAC;YAC7E,yBAAyB,GAAG,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC,CAAC;IACF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,eAAe,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,wBAAwB,EAAE,CAAC;QACpC,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC;QACjC,KAAK,eAAe;YAClB,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { SendBoxSelector, sendBoxSelector } from '../sendBoxSelector';\nimport { MessageThreadSelector, messageThreadSelectorWithThread } from '../messageThreadSelector';\nimport { TypingIndicatorSelector, typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { Common, AreEqual } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\nimport { ChatParticipantListSelector, chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n\n/**\n * Primary hook to get all hooks necessary for a chat Component.\n *\n * Most straightforward usage of chat components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element,>(component: Component): GetSelector<Component> extends (props: any) => any ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return ({\n ...props,\n ...handlers\n } as any);\n }\n return (undefined as any);\n};\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined,>(component: Component): GetSelector<Component> => {\n return findSelector(component);\n};\nconst messageThreadSelectorsByThread: {\n [key: string]: MessageThreadSelector;\n} = {};\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // For the message thread selector we need to create a new one for each thread\n // If we have just one for the entire app, then we will have updates when not expecting due to\n // the arguments changing\n const getMessageThreadSelector: () => MessageThreadSelector = () => {\n const threadId = useContext(ChatThreadClientContext)?.threadId ?? 'default-id-when-not-in-provider';\n let messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n if (!messageThreadSelectorImpl) {\n messageThreadSelectorsByThread[threadId] = messageThreadSelectorWithThread();\n messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n }\n return messageThreadSelectorImpl;\n };\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n case MessageThread:\n return getMessageThreadSelector();\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};"]}
@@ -4,17 +4,10 @@ import { getChatMessages, getIsLargeGroup, getLatestReadTime, getParticipants, g
4
4
  import { toFlatCommunicationIdentifier } from "../../acs-ui-common/src";
5
5
  import { memoizeFnAll } from "../../acs-ui-common/src";
6
6
  import { createSelector } from 'reselect';
7
- /* @conditional-compile-remove(data-loss-prevention) */
8
- import { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';
9
7
  import { ACSKnownMessageType } from './utils/constants';
10
8
  import { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';
11
9
  const memoizedAllConvertChatMessage = memoizeFnAll((_key, chatMessage, userId, isSeen, isLargeGroup) => {
12
- var _a;
13
10
  const messageType = chatMessage.type.toLowerCase();
14
- /* @conditional-compile-remove(data-loss-prevention) */
15
- if (((_a = chatMessage.policyViolation) === null || _a === void 0 ? void 0 : _a.result) === 'contentBlocked') {
16
- return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);
17
- }
18
11
  if (messageType === ACSKnownMessageType.text || messageType === ACSKnownMessageType.richtextHtml || messageType === ACSKnownMessageType.html) {
19
12
  return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);
20
13
  }
@@ -54,22 +47,6 @@ const extractTeamsAttachmentsMetadata = (rawAttachments) => {
54
47
  attachments
55
48
  };
56
49
  };
57
- /* @conditional-compile-remove(data-loss-prevention) */
58
- const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
59
- const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
60
- return {
61
- messageType: 'blocked',
62
- createdOn: message.createdOn,
63
- warningText: undefined,
64
- status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,
65
- senderDisplayName: message.senderDisplayName,
66
- senderId: messageSenderId,
67
- messageId: message.id,
68
- deletedOn: message.deletedOn,
69
- mine: messageSenderId === userId,
70
- link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL
71
- };
72
- };
73
50
  /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
74
51
  const extractAttachmentUrl = (attachment) => {
75
52
  return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';
@@ -83,11 +60,20 @@ const processChatMessageContent = (message) => {
83
60
  if (content) {
84
61
  const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
85
62
  document.querySelectorAll('img').forEach(img => {
86
- var _a, _b;
63
+ var _a, _b, _c;
87
64
  const attachmentPreviewUrl = (_a = attachments.find(attachment => attachment.id === img.id)) === null || _a === void 0 ? void 0 : _a.previewUrl;
88
65
  if (attachmentPreviewUrl) {
89
66
  const resourceCache = (_b = message.resourceCache) === null || _b === void 0 ? void 0 : _b[attachmentPreviewUrl];
90
- img.src = getResourceSourceUrl(resourceCache);
67
+ const src = getResourceSourceUrl(resourceCache);
68
+ // if in error state
69
+ if (src === undefined) {
70
+ const brokenImageView = getBrokenImageViewNode(img);
71
+ (_c = img.parentElement) === null || _c === void 0 ? void 0 : _c.replaceChild(brokenImageView, img);
72
+ }
73
+ else {
74
+ // else in loading or success state
75
+ img.setAttribute('src', src);
76
+ }
91
77
  }
92
78
  });
93
79
  content = document.body.innerHTML;
@@ -105,22 +91,28 @@ const generateImageAttachmentImgHtml = (message, attachment) => {
105
91
  const contentType = extractAttachmentContentTypeFromName(attachment.name);
106
92
  const resourceCache = (_a = message.resourceCache) === null || _a === void 0 ? void 0 : _a[attachment.previewUrl];
107
93
  const src = getResourceSourceUrl(resourceCache);
94
+ // if in error state
95
+ if (src === undefined) {
96
+ return `\r\n<p>${getBrokenImageViewNode()}</p>`;
97
+ }
98
+ // else in loading or success state
108
99
  return `\r\n<p><img alt="image" src="${src}" itemscope="${contentType}" id="${attachment.id}"></p>`;
109
100
  }
110
101
  return '';
111
102
  };
112
103
  const getResourceSourceUrl = (result) => {
113
- let src = '';
114
104
  if (result) {
115
- if (result.error || !result.sourceUrl) {
116
- // In case of an error we set src to some invalid value to show broken image
117
- src = 'blob://';
105
+ if (!result.error && result.sourceUrl) {
106
+ // return sourceUrl for success state
107
+ return result.sourceUrl;
118
108
  }
119
109
  else {
120
- src = result.sourceUrl;
110
+ // return undefined for error state
111
+ return undefined;
121
112
  }
122
113
  }
123
- return src;
114
+ // return empty string for loading state
115
+ return '';
124
116
  };
125
117
  const extractAttachmentContentTypeFromName = (name) => {
126
118
  if (name === undefined) {
@@ -243,19 +235,26 @@ const sanitizedMessageContentType = (type) => {
243
235
  const lowerCaseType = type.toLowerCase();
244
236
  return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html' ? lowerCaseType : 'unknown';
245
237
  };
238
+ const getBrokenImageViewNode = (img) => {
239
+ var _a;
240
+ const wrapper = document.createElement('div');
241
+ Array.from((_a = img === null || img === void 0 ? void 0 : img.attributes) !== null && _a !== void 0 ? _a : []).forEach(attr => {
242
+ var _a;
243
+ wrapper.setAttribute(attr.nodeName, (_a = attr.nodeValue) !== null && _a !== void 0 ? _a : '');
244
+ });
245
+ wrapper.setAttribute('class', 'broken-image-wrapper');
246
+ wrapper.setAttribute('data-ui-id', 'broken-image-icon');
247
+ return wrapper;
248
+ };
246
249
  const isMessageValidToRender = (message) => {
247
- var _a, _b, _c, _d, _e;
250
+ var _a, _b, _c, _d;
248
251
  if (message.deletedOn) {
249
252
  return false;
250
253
  }
251
254
  if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a.fileSharingMetadata) || ((_c = (_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length)) {
252
255
  return true;
253
256
  }
254
- /* @conditional-compile-remove(data-loss-prevention) */
255
- if (((_d = message.policyViolation) === null || _d === void 0 ? void 0 : _d.result) === 'contentBlocked') {
256
- return true;
257
- }
258
- return !!(message.content && ((_e = message.content) === null || _e === void 0 ? void 0 : _e.message) !== '');
257
+ return !!(message.content && ((_d = message.content) === null || _d === void 0 ? void 0 : _d.message) !== '');
259
258
  };
260
259
  /**
261
260
  * Selector for {@link MessageThread} component.
@@ -1 +1 @@
1
- {"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC1J,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAIvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAOhF,MAAM,6BAA6B,GAAG,YAAY,CAAC,CAAC,IAAY,EAAE,WAAkC,EAAE,MAAc,EAAE,MAAe,EAAE,YAAqB,EAAW,EAAE;;IACvK,MAAM,WAAW,G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AO,IAAI,CAAC;IACd,CAAC;IACD,uDAAuD;IACvD,IAAI,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM,MAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatBaseSelectorProps, getChatMessages, getIsLargeGroup, getLatestReadTime, getParticipants, getReadReceipts, getUserId } from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport { ChatMessage, Message, CommunicationParticipant, SystemMessage, MessageContentType, ReadReceiptsBySenderId } from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachmentType } from '@internal/react-components';\nconst memoizedAllConvertChatMessage = memoizeFnAll((_key: string, chatMessage: ChatMessageWithStatus, userId: string, isSeen: boolean, isLargeGroup: boolean): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation?.result === 'contentBlocked') {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (messageType === ACSKnownMessageType.text || messageType === ACSKnownMessageType.richtextHtml || messageType === ACSKnownMessageType.html) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n});\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractTeamsAttachmentsMetadata = (rawAttachments: ChatAttachment[]): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach(rawAttachment => {\n const attachmentType = (rawAttachment.attachmentType as ChatAttachmentType);\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (message: ChatMessageWithStatus, userId: string, isSeen: boolean, isLargeGroup: boolean): BlockedMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n return {\n messageType: 'blocked',\n createdOn: message.createdOn,\n warningText: undefined,\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL\n };\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (message.content?.attachments && message.content?.attachments.length > 0 && sanitizedMessageContentType(message.type).includes('html')) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach(img => {\n const attachmentPreviewUrl = attachments.find(attachment => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n img.src = getResourceSourceUrl(resourceCache);\n }\n });\n content = document.body.innerHTML;\n }\n const teamsImageHtmlContent = attachments.filter(attachment => attachment.attachmentType === 'image' && attachment.previewUrl !== undefined && !message.content?.message?.includes(attachment.id)).map(attachment => generateImageAttachmentImgHtml(message, attachment)).join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n return '';\n};\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string => {\n let src = '';\n if (result) {\n if (result.error || !result.sourceUrl) {\n // In case of an error we set src to some invalid value to show broken image\n src = 'blob://';\n } else {\n src = result.sourceUrl;\n }\n }\n return src;\n};\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): {\n attachments?: AttachmentMetadata[];\n} => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return {\n attachments: attachments.length > 0 ? attachments : undefined\n };\n};\nconst convertToUiChatMessage = (message: ChatMessageWithStatus, userId: string, isSeen: boolean, isLargeGroup: boolean): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n const {\n attachments\n } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachments\n };\n};\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants: message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '').map((participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean => !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () => createSelector([getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants], (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find(p => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop ? undefined : Object.values(participants).filter(p => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts.filter(r => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId).forEach(r => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage(memoizedFn => Object.values(chatMessages).filter(message => message.type.toLowerCase() === ACSKnownMessageType.text || message.type.toLowerCase() === ACSKnownMessageType.richtextHtml || message.type.toLowerCase() === ACSKnownMessageType.html || message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message) || message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined).filter(isMessageValidToRender).map(message => {\n return memoizedFn(message.id ?? message.clientMessageId, message, userId, message.createdOn <= latestReadTime, isLargeGroup);\n }));\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n});\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html' ? lowerCaseType : 'unknown';\n};\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation?.result === 'contentBlocked') {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();"]}
1
+ {"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-component-bindings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AAC,OAAO,CAAC,IAAI,CAAC,EAAE;;QAC/C,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAA,IAAI,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACtD,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AACF,MAAM,sBAAsB,GAAG,CAAC,OAA8B,EAAW,EAAE;;IACzE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,mBAAmB,MAAI,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,0CAAE,MAAM,CAAA,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,+BAA+B,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatBaseSelectorProps, getChatMessages, getIsLargeGroup, getLatestReadTime, getParticipants, getReadReceipts, getUserId } from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus, ResourceFetchResult } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport { ChatMessage, Message, CommunicationParticipant, SystemMessage, MessageContentType, ReadReceiptsBySenderId } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { ACSKnownMessageType } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport type { ChatParticipant } from '@azure/communication-chat';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachmentType } from '@internal/react-components';\nconst memoizedAllConvertChatMessage = memoizeFnAll((_key: string, chatMessage: ChatMessageWithStatus, userId: string, isSeen: boolean, isLargeGroup: boolean): Message => {\n const messageType = chatMessage.type.toLowerCase();\n if (messageType === ACSKnownMessageType.text || messageType === ACSKnownMessageType.richtextHtml || messageType === ACSKnownMessageType.html) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n});\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {\n const attachmentMetadata = metadata.fileSharingMetadata;\n if (!attachmentMetadata) {\n return [];\n }\n try {\n return JSON.parse(attachmentMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractTeamsAttachmentsMetadata = (rawAttachments: ChatAttachment[]): {\n attachments: AttachmentMetadata[];\n} => {\n const attachments: AttachmentMetadata[] = [];\n rawAttachments.forEach(rawAttachment => {\n const attachmentType = (rawAttachment.attachmentType as ChatAttachmentType);\n if (attachmentType === 'file') {\n attachments.push({\n id: rawAttachment.id,\n name: rawAttachment.name ?? '',\n url: extractAttachmentUrl(rawAttachment)\n });\n }\n });\n return {\n attachments\n };\n};\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';\n};\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n let content = message.content?.message;\n if (message.content?.attachments && message.content?.attachments.length > 0 && sanitizedMessageContentType(message.type).includes('html')) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n // Fill in the src here\n if (content) {\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n document.querySelectorAll('img').forEach(img => {\n const attachmentPreviewUrl = attachments.find(attachment => attachment.id === img.id)?.previewUrl;\n if (attachmentPreviewUrl) {\n const resourceCache = message.resourceCache?.[attachmentPreviewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n const brokenImageView = getBrokenImageViewNode(img);\n img.parentElement?.replaceChild(brokenImageView, img);\n } else {\n // else in loading or success state\n img.setAttribute('src', src);\n }\n }\n });\n content = document.body.innerHTML;\n }\n const teamsImageHtmlContent = attachments.filter(attachment => attachment.attachmentType === 'image' && attachment.previewUrl !== undefined && !message.content?.message?.includes(attachment.id)).map(attachment => generateImageAttachmentImgHtml(message, attachment)).join('');\n if (teamsImageHtmlContent) {\n return (content ?? '') + teamsImageHtmlContent;\n }\n }\n return content;\n};\nconst generateImageAttachmentImgHtml = (message: ChatMessageWithStatus, attachment: ChatAttachment): string => {\n if (attachment.previewUrl !== undefined) {\n const contentType = extractAttachmentContentTypeFromName(attachment.name);\n const resourceCache = message.resourceCache?.[attachment.previewUrl];\n const src = getResourceSourceUrl(resourceCache);\n // if in error state\n if (src === undefined) {\n return `\\r\\n<p>${getBrokenImageViewNode()}</p>`;\n }\n // else in loading or success state\n return `\\r\\n<p><img alt=\"image\" src=\"${src}\" itemscope=\"${contentType}\" id=\"${attachment.id}\"></p>`;\n }\n return '';\n};\nconst getResourceSourceUrl = (result?: ResourceFetchResult): string | undefined => {\n if (result) {\n if (!result.error && result.sourceUrl) {\n // return sourceUrl for success state\n return result.sourceUrl;\n } else {\n // return undefined for error state\n return undefined;\n }\n }\n // return empty string for loading state\n return '';\n};\nconst extractAttachmentContentTypeFromName = (name?: string): string => {\n if (name === undefined) {\n return '';\n }\n const indexOfLastDot = name.lastIndexOf('.');\n if (indexOfLastDot === undefined || indexOfLastDot < 0) {\n return '';\n }\n const contentType = name.substring(indexOfLastDot + 1);\n return contentType;\n};\n\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nconst extractAttachmentsMetadata = (message: ChatMessageWithStatus): {\n attachments?: AttachmentMetadata[];\n} => {\n let attachments: AttachmentMetadata[] = [];\n if (message.metadata) {\n attachments = attachments.concat(extractAttachmentMetadata(message.metadata));\n }\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n attachments = attachments.concat(teamsAttachments.attachments);\n }\n return {\n attachments: attachments.length > 0 ? attachments : undefined\n };\n};\nconst convertToUiChatMessage = (message: ChatMessageWithStatus, userId: string, isSeen: boolean, isLargeGroup: boolean): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n const {\n attachments\n } = extractAttachmentsMetadata(message);\n return {\n messageType: 'chat',\n createdOn: message.createdOn,\n content: processChatMessageContent(message),\n contentType: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: messageSenderId,\n messageId: message.id,\n clientMessageId: message.clientMessageId,\n editedOn: message.editedOn,\n deletedOn: message.deletedOn,\n mine: messageSenderId === userId,\n metadata: message.metadata,\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n attachments\n };\n};\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): SystemMessage => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n messageType: 'system',\n systemMessageType,\n createdOn: message.createdOn,\n participants: message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant: ChatParticipant) => participant.displayName && participant.displayName !== '').map((participant: ChatParticipant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })) ?? [],\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n messageType: 'system',\n systemMessageType: 'topicUpdated',\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n messageId: message.id,\n iconName: 'Edit'\n };\n }\n};\n\n/**\n * Selector type for {@link MessageThread} component.\n *\n * @public\n */\nexport type MessageThreadSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {\n userId: string;\n showMessageStatus: boolean;\n messages: Message[];\n};\n\n/** Returns `true` if the message has participants and at least one participant has a display name. */\nconst hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean => !!chatMessage.content?.participants && chatMessage.content.participants.some((p: ChatParticipant) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () => createSelector([getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants], (userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {\n // We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop\n const isTeamsInterop = Object.values(participants).find(p => 'microsoftTeamsUserId' in p.id) !== undefined;\n\n // get number of participants\n // filter out the non valid participants (no display name)\n // Read Receipt details will be disabled when participant count is 0\n const participantCount = isTeamsInterop ? undefined : Object.values(participants).filter(p => p.displayName && p.displayName !== '').length;\n\n // creating key value pairs of senderID: last read message information\n\n const readReceiptsBySenderId: ReadReceiptsBySenderId = {};\n\n // readReceiptsBySenderId[senderID] gets updated every time a new message is read by this sender\n // in this way we can make sure that we are only saving the latest read message id and read on time for each sender\n readReceipts.filter(r => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId).forEach(r => {\n readReceiptsBySenderId[toFlatCommunicationIdentifier(r.sender)] = {\n lastReadMessage: r.chatMessageId,\n displayName: participants[toFlatCommunicationIdentifier(r.sender)]?.displayName ?? ''\n };\n });\n\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage(memoizedFn => Object.values(chatMessages).filter(message => message.type.toLowerCase() === ACSKnownMessageType.text || message.type.toLowerCase() === ACSKnownMessageType.richtextHtml || message.type.toLowerCase() === ACSKnownMessageType.html || message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message) || message.type === ACSKnownMessageType.participantRemoved && hasValidParticipant(message) ||\n // TODO: Add support for topicUpdated system messages in MessageThread component.\n // message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined).filter(isMessageValidToRender).map(message => {\n return memoizedFn(message.id ?? message.clientMessageId, message, userId, message.createdOn <= latestReadTime, isLargeGroup);\n }));\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n});\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html' ? lowerCaseType : 'unknown';\n};\nconst getBrokenImageViewNode = (img?: HTMLDivElement): HTMLDivElement => {\n const wrapper = document.createElement('div');\n Array.from(img?.attributes ?? []).forEach(attr => {\n wrapper.setAttribute(attr.nodeName, attr.nodeValue ?? '');\n });\n wrapper.setAttribute('class', 'broken-image-wrapper');\n wrapper.setAttribute('data-ui-id', 'broken-image-icon');\n return wrapper;\n};\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (message.metadata?.fileSharingMetadata || message.content?.attachments?.length) {\n return true;\n }\n return !!(message.content && message.content?.message !== '');\n};\n\n/**\n * Selector for {@link MessageThread} component.\n *\n * @public\n */\nexport const messageThreadSelector: MessageThreadSelector = messageThreadSelectorWithThread();"]}
@@ -7,7 +7,7 @@ export const updateMessagesWithAttached = (chatMessagesWithStatus) => {
7
7
  chatMessagesWithStatus.sort(compareMessages);
8
8
  chatMessagesWithStatus.forEach((message, index, messages) => {
9
9
  var _a, _b;
10
- if (message.messageType === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked') {
10
+ if (message.messageType === 'chat') {
11
11
  /**
12
12
  * Attached === true means it is within a group of messages in the current order
13
13
  * Attached === top/bottom means it is on the top/bottom boundary
@@ -17,8 +17,8 @@ export const updateMessagesWithAttached = (chatMessagesWithStatus) => {
17
17
  let attached = false;
18
18
  const previousMessage = index > 0 ? messages[index - 1] : undefined;
19
19
  const nextMessage = index === messages.length - 1 ? undefined : messages[index + 1];
20
- const previousSenderId = (previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.messageType) === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */ (previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.messageType) === 'blocked' ? previousMessage.senderId : undefined;
21
- const nextSenderId = (nextMessage === null || nextMessage === void 0 ? void 0 : nextMessage.messageType) === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */ (nextMessage === null || nextMessage === void 0 ? void 0 : nextMessage.messageType) === 'blocked' ? nextMessage.senderId : undefined;
20
+ const previousSenderId = (previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.messageType) === 'chat' ? previousMessage.senderId : undefined;
21
+ const nextSenderId = (nextMessage === null || nextMessage === void 0 ? void 0 : nextMessage.messageType) === 'chat' ? nextMessage.senderId : undefined;
22
22
  const timediff = new Date((_a = message === null || message === void 0 ? void 0 : message.createdOn) !== null && _a !== void 0 ? _a : '').getTime() - new Date((_b = previousMessage === null || previousMessage === void 0 ? void 0 : previousMessage.createdOn) !== null && _b !== void 0 ? _b : '').getTime();
23
23
  const diffMins = Math.round(timediff / MINUTE_IN_MS); // minutes
24
24
  if (previousSenderId !== message.senderId) {
@@ -1 +1 @@
1
- {"version":3,"file":"updateMessagesWithAttached.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/utils/updateMessagesWithAttached.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,sBAAiC,EAAQ,EAAE;IACpF,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7C,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;;QAC1D,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,IAAI,uDAAuD,CAAA,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/H;;;;;eAKG;YACH,IAAI,QAAQ,GAAoC,KAAK,CAAC;YACtD,MAAM,eAAe,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACpE,MAAM,WAAW,GAAG,KAAK,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACpF,MAAM,gBAAgB,GAAG,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,MAAK,MAAM,IAAI,uDAAuD,CAAA,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,MAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7M,MAAM,YAAY,GAAG,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,MAAK,MAAM,IAAI,uDAAuD,CAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,MAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7L,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,SAAS,mCAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACrH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,UAAU;YAEhE,IAAI,gBAAgB,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC1C,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/D,CAAC;iBAAM,IAAI,QAAQ,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBACrC,wGAAwG;gBACxG,QAAQ,GAAG,KAAK,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { Message, MessageAttachedStatus } from '@internal/react-components';\nimport { compareMessages } from './compareMessages';\nimport { MINUTE_IN_MS } from './constants';\n\n/**\n * @private\n */\nexport const updateMessagesWithAttached = (chatMessagesWithStatus: Message[]): void => {\n chatMessagesWithStatus.sort(compareMessages);\n chatMessagesWithStatus.forEach((message, index, messages) => {\n if (message.messageType === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */message.messageType === 'blocked') {\n /**\n * Attached === true means it is within a group of messages in the current order\n * Attached === top/bottom means it is on the top/bottom boundary\n * Attached === false means it is just a single message\n * A group of messages: continuous messages that belong to the same sender and not intercepted by other senders.\n */\n let attached: boolean | MessageAttachedStatus = false;\n const previousMessage = index > 0 ? messages[index - 1] : undefined;\n const nextMessage = index === messages.length - 1 ? undefined : messages[index + 1];\n const previousSenderId = previousMessage?.messageType === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */previousMessage?.messageType === 'blocked' ? previousMessage.senderId : undefined;\n const nextSenderId = nextMessage?.messageType === 'chat' || /* @conditional-compile-remove(data-loss-prevention) */nextMessage?.messageType === 'blocked' ? nextMessage.senderId : undefined;\n const timediff = new Date(message?.createdOn ?? '').getTime() - new Date(previousMessage?.createdOn ?? '').getTime();\n const diffMins = Math.round(timediff / MINUTE_IN_MS); // minutes\n\n if (previousSenderId !== message.senderId) {\n attached = message.senderId === nextSenderId ? 'top' : false;\n } else if (diffMins && diffMins >= 5) {\n // if there are more than or equal to 5 mins time gap between messages do not attach and show time stamp\n attached = false;\n } else {\n attached = message.senderId === nextSenderId ? true : 'bottom';\n }\n message.attached = attached;\n }\n });\n};"]}
1
+ {"version":3,"file":"updateMessagesWithAttached.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/utils/updateMessagesWithAttached.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,sBAAiC,EAAQ,EAAE;IACpF,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7C,sBAAsB,CAAC,OAA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,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/D,CAAC;iBAAM,IAAI,QAAQ,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBACrC,wGAAwG;gBACxG,QAAQ,GAAG,KAAK,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { Message, MessageAttachedStatus } from '@internal/react-components';\nimport { compareMessages } from './compareMessages';\nimport { MINUTE_IN_MS } from './constants';\n\n/**\n * @private\n */\nexport const updateMessagesWithAttached = (chatMessagesWithStatus: Message[]): void => {\n chatMessagesWithStatus.sort(compareMessages);\n chatMessagesWithStatus.forEach((message, index, messages) => {\n if (message.messageType === 'chat') {\n /**\n * Attached === true means it is within a group of messages in the current order\n * Attached === top/bottom means it is on the top/bottom boundary\n * Attached === false means it is just a single message\n * A group of messages: continuous messages that belong to the same sender and not intercepted by other senders.\n */\n let attached: boolean | MessageAttachedStatus = false;\n const previousMessage = index > 0 ? messages[index - 1] : undefined;\n const nextMessage = index === messages.length - 1 ? undefined : messages[index + 1];\n const previousSenderId = previousMessage?.messageType === 'chat' ? previousMessage.senderId : undefined;\n const nextSenderId = nextMessage?.messageType === 'chat' ? nextMessage.senderId : undefined;\n const timediff = new Date(message?.createdOn ?? '').getTime() - new Date(previousMessage?.createdOn ?? '').getTime();\n const diffMins = Math.round(timediff / MINUTE_IN_MS); // minutes\n\n if (previousSenderId !== message.senderId) {\n attached = message.senderId === nextSenderId ? 'top' : false;\n } else if (diffMins && diffMins >= 5) {\n // if there are more than or equal to 5 mins time gap between messages do not attach and show time stamp\n attached = false;\n } else {\n attached = message.senderId === nextSenderId ? true : 'bottom';\n }\n message.attached = attached;\n }\n });\n};"]}
@@ -122,5 +122,5 @@ export declare class ChatError extends Error {
122
122
  *
123
123
  * @public
124
124
  */
125
- export type ChatErrorTarget = 'ChatClient.createChatThread' | 'ChatClient.deleteChatThread' | 'ChatClient.getChatThreadClient' | 'ChatClient.listChatThreads' | 'ChatClient.off' | 'ChatClient.on' | 'ChatClient.startRealtimeNotifications' | 'ChatClient.stopRealtimeNotifications' | 'ChatThreadClient.addParticipants' | 'ChatThreadClient.deleteMessage' | 'ChatThreadClient.getMessage' | 'ChatThreadClient.getProperties' | 'ChatThreadClient.listMessages' | 'ChatThreadClient.listParticipants' | 'ChatThreadClient.listReadReceipts' | 'ChatThreadClient.removeParticipant' | 'ChatThreadClient.sendMessage' | 'ChatThreadClient.sendReadReceipt' | 'ChatThreadClient.sendTypingNotification' | 'ChatThreadClient.updateMessage' | /* @conditional-compile-remove(chat-beta-sdk) */ 'ChatThreadClient.updateProperties' | 'ChatThreadClient.updateTopic' | /* @conditional-compile-remove(chat-beta-sdk) */ 'ChatThreadClient.uploadImage' | /* @conditional-compile-remove(chat-beta-sdk) */ 'ChatThreadClient.deleteImage';
125
+ export type ChatErrorTarget = 'ChatClient.createChatThread' | 'ChatClient.deleteChatThread' | 'ChatClient.getChatThreadClient' | 'ChatClient.listChatThreads' | 'ChatClient.off' | 'ChatClient.on' | 'ChatClient.startRealtimeNotifications' | 'ChatClient.stopRealtimeNotifications' | 'ChatThreadClient.addParticipants' | 'ChatThreadClient.deleteMessage' | 'ChatThreadClient.getMessage' | 'ChatThreadClient.getProperties' | 'ChatThreadClient.listMessages' | 'ChatThreadClient.listParticipants' | 'ChatThreadClient.listReadReceipts' | 'ChatThreadClient.removeParticipant' | 'ChatThreadClient.sendMessage' | 'ChatThreadClient.sendReadReceipt' | 'ChatThreadClient.sendTypingNotification' | 'ChatThreadClient.updateMessage' | 'ChatThreadClient.updateTopic';
126
126
  //# sourceMappingURL=ChatClientState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatClientState.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/ChatClientState.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwGlC;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAalC,YAAY,MAAuB,EAAE,UAAiB,EAAE,SAAgB;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\n\n/**\n * Centralized state for {@link @azure/communication-chat#ChatClient}.\n *\n * @public\n */\nexport type ChatClientState = {\n /**\n * Identifier of the current user.\n */\n userId: CommunicationIdentifierKind;\n /**\n * DisplayName of the current user.\n * The same value as what others see in {@link @azure/communication-chat#ChatParticipant.displayName}\n */\n displayName: string;\n /**\n * Chat threads joined by the current user.\n * Object with {@link ChatThreadClientState} fields, keyed by {@link ChatThreadClientState.threadId}.\n */\n threads: {\n [key: string]: ChatThreadClientState;\n };\n /**\n * Stores the latest error for each API method.\n *\n * See documentation of {@link ChatErrors} for details.\n */\n latestErrors: ChatErrors;\n};\n\n/**\n * Centralized state for {@link @azure/communication-chat#ChatThreadClient}.\n *\n * @public\n */\nexport type ChatThreadClientState = {\n /**\n * Messages in this thread.\n * Object with {@link ChatMessageWithStatus} entries\n * Local messages are keyed by keyed by {@link ChatMessageWithStatus.clientMessageId}.\n * Remote messages are keyed by {@link @azure/communication-chat#ChatMessage.id}.\n */\n chatMessages: {\n [key: string]: ChatMessageWithStatus;\n };\n /**\n * Participants of this chat thread.\n *\n * Object with {@link @azure/communication-chat#ChatParticipant} fields,\n * keyed by {@link @azure/communication-chat#ChatParticipant.id}.\n */\n participants: {\n [key: string]: ChatParticipant;\n };\n /**\n * Id of this chat thread. Returned from {@link @azure/communication-chat#ChatThreadClient.threadId}\n */\n threadId: string;\n /**\n * An object containing properties of this chat thread.\n */\n properties?: ChatThreadProperties;\n /**\n * An array of ReadReceipts of this chat thread. Returned from {@link @azure/communication-chat#ChatThreadClient.listReadReceipts}\n */\n readReceipts: ChatMessageReadReceipt[];\n /**\n * An array of typingIndicators of this chat thread. Captured from event listener of {@link @azure/communication-chat#ChatClient}\n * Stateful client only stores recent 8000ms real-time typing indicators data.\n */\n typingIndicators: TypingIndicatorReceivedEvent[];\n /**\n * Latest timestamp when other users read messages sent by current user.\n */\n latestReadTime: Date;\n};\n\n/**\n * Properties of a chat thread.\n *\n * We define a minimal one that helps us hide the different types used by underlying API.\n *\n * @public\n */\nexport type ChatThreadProperties = {\n topic?: string;\n};\n\n/**\n * Errors teed from API calls to the Chat SDK.\n *\n * Each property in the object stores the latest error for a particular SDK API method.\n *\n * @public\n */\nexport type ChatErrors = { [target in ChatErrorTarget]: ChatError };\n\n/**\n * Error thrown from failed {@link StatefulChatClient} methods.\n *\n * @public\n */\nexport class ChatError extends Error {\n /**\n * The API method target that failed.\n */\n public target: ChatErrorTarget;\n /**\n * Error thrown by the failed SDK method.\n */\n public innerError: Error;\n /**\n * Timestamp added to the error by the stateful layer.\n */\n public timestamp: Date;\n constructor(target: ChatErrorTarget, innerError: Error, timestamp?: Date) {\n super();\n this.target = target;\n this.innerError = innerError;\n // Testing note: It is easier to mock Date::now() than the Date() constructor.\n this.timestamp = timestamp ?? new Date(Date.now());\n this.name = 'ChatError';\n this.message = `${this.target}: ${this.innerError.message}`;\n }\n}\n\n/**\n * String literal type for all permissible keys in {@link ChatErrors}.\n *\n * @public\n */\nexport type ChatErrorTarget = 'ChatClient.createChatThread' | 'ChatClient.deleteChatThread' | 'ChatClient.getChatThreadClient' | 'ChatClient.listChatThreads' | 'ChatClient.off' | 'ChatClient.on' | 'ChatClient.startRealtimeNotifications' | 'ChatClient.stopRealtimeNotifications' | 'ChatThreadClient.addParticipants' | 'ChatThreadClient.deleteMessage' | 'ChatThreadClient.getMessage' | 'ChatThreadClient.getProperties' | 'ChatThreadClient.listMessages' | 'ChatThreadClient.listParticipants' | 'ChatThreadClient.listReadReceipts' | 'ChatThreadClient.removeParticipant' | 'ChatThreadClient.sendMessage' | 'ChatThreadClient.sendReadReceipt' | 'ChatThreadClient.sendTypingNotification' | 'ChatThreadClient.updateMessage' | /* @conditional-compile-remove(chat-beta-sdk) */'ChatThreadClient.updateProperties' | 'ChatThreadClient.updateTopic' | /* @conditional-compile-remove(chat-beta-sdk) */'ChatThreadClient.uploadImage' | /* @conditional-compile-remove(chat-beta-sdk) */'ChatThreadClient.deleteImage';"]}
1
+ {"version":3,"file":"ChatClientState.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/ChatClientState.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuGlC;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAalC,YAAY,MAAuB,EAAE,UAAiB,EAAE,SAAgB;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\n\n/**\n * Centralized state for {@link @azure/communication-chat#ChatClient}.\n *\n * @public\n */\nexport type ChatClientState = {\n /**\n * Identifier of the current user.\n */\n userId: CommunicationIdentifierKind;\n /**\n * DisplayName of the current user.\n * The same value as what others see in {@link @azure/communication-chat#ChatParticipant.displayName}\n */\n displayName: string;\n /**\n * Chat threads joined by the current user.\n * Object with {@link ChatThreadClientState} fields, keyed by {@link ChatThreadClientState.threadId}.\n */\n threads: {\n [key: string]: ChatThreadClientState;\n };\n /**\n * Stores the latest error for each API method.\n *\n * See documentation of {@link ChatErrors} for details.\n */\n latestErrors: ChatErrors;\n};\n\n/**\n * Centralized state for {@link @azure/communication-chat#ChatThreadClient}.\n *\n * @public\n */\nexport type ChatThreadClientState = {\n /**\n * Messages in this thread.\n * Object with {@link ChatMessageWithStatus} entries\n * Local messages are keyed by keyed by {@link ChatMessageWithStatus.clientMessageId}.\n * Remote messages are keyed by {@link @azure/communication-chat#ChatMessage.id}.\n */\n chatMessages: {\n [key: string]: ChatMessageWithStatus;\n };\n /**\n * Participants of this chat thread.\n *\n * Object with {@link @azure/communication-chat#ChatParticipant} fields,\n * keyed by {@link @azure/communication-chat#ChatParticipant.id}.\n */\n participants: {\n [key: string]: ChatParticipant;\n };\n /**\n * Id of this chat thread. Returned from {@link @azure/communication-chat#ChatThreadClient.threadId}\n */\n threadId: string;\n /**\n * An object containing properties of this chat thread.\n */\n properties?: ChatThreadProperties;\n /**\n * An array of ReadReceipts of this chat thread. Returned from {@link @azure/communication-chat#ChatThreadClient.listReadReceipts}\n */\n readReceipts: ChatMessageReadReceipt[];\n /**\n * An array of typingIndicators of this chat thread. Captured from event listener of {@link @azure/communication-chat#ChatClient}\n * Stateful client only stores recent 8000ms real-time typing indicators data.\n */\n typingIndicators: TypingIndicatorReceivedEvent[];\n /**\n * Latest timestamp when other users read messages sent by current user.\n */\n latestReadTime: Date;\n};\n\n/**\n * Properties of a chat thread.\n *\n * We define a minimal one that helps us hide the different types used by underlying API.\n *\n * @public\n */\nexport type ChatThreadProperties = {\n topic?: string;\n};\n/**\n * Errors teed from API calls to the Chat SDK.\n *\n * Each property in the object stores the latest error for a particular SDK API method.\n *\n * @public\n */\nexport type ChatErrors = { [target in ChatErrorTarget]: ChatError };\n\n/**\n * Error thrown from failed {@link StatefulChatClient} methods.\n *\n * @public\n */\nexport class ChatError extends Error {\n /**\n * The API method target that failed.\n */\n public target: ChatErrorTarget;\n /**\n * Error thrown by the failed SDK method.\n */\n public innerError: Error;\n /**\n * Timestamp added to the error by the stateful layer.\n */\n public timestamp: Date;\n constructor(target: ChatErrorTarget, innerError: Error, timestamp?: Date) {\n super();\n this.target = target;\n this.innerError = innerError;\n // Testing note: It is easier to mock Date::now() than the Date() constructor.\n this.timestamp = timestamp ?? new Date(Date.now());\n this.name = 'ChatError';\n this.message = `${this.target}: ${this.innerError.message}`;\n }\n}\n\n/**\n * String literal type for all permissible keys in {@link ChatErrors}.\n *\n * @public\n */\nexport type ChatErrorTarget = 'ChatClient.createChatThread' | 'ChatClient.deleteChatThread' | 'ChatClient.getChatThreadClient' | 'ChatClient.listChatThreads' | 'ChatClient.off' | 'ChatClient.on' | 'ChatClient.startRealtimeNotifications' | 'ChatClient.stopRealtimeNotifications' | 'ChatThreadClient.addParticipants' | 'ChatThreadClient.deleteMessage' | 'ChatThreadClient.getMessage' | 'ChatThreadClient.getProperties' | 'ChatThreadClient.listMessages' | 'ChatThreadClient.listParticipants' | 'ChatThreadClient.listReadReceipts' | 'ChatThreadClient.removeParticipant' | 'ChatThreadClient.sendMessage' | 'ChatThreadClient.sendReadReceipt' | 'ChatThreadClient.sendTypingNotification' | 'ChatThreadClient.updateMessage' | 'ChatThreadClient.updateTopic';"]}
@@ -41,9 +41,7 @@ export class EventSubscriber {
41
41
  // Note: there is a bug in chatMessageReceived event that it is missing sequenceId
42
42
  createdOn: new Date(event.createdOn),
43
43
  editedOn: 'editedOn' in event ? event.editedOn : undefined,
44
- metadata: event.metadata,
45
- /* @conditional-compile-remove(data-loss-prevention) */
46
- policyViolation: 'policyViolation' in event ? event.policyViolation : undefined
44
+ metadata: event.metadata
47
45
  });
48
46
  };
49
47
  // convert event type to chatMessage type, only possible type is 'html' and 'text' in chat event
@@ -1 +1 @@
1
- {"version":3,"file":"EventSubscriber.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/EventSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAIlC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,iEAAiE;AACjE,wEAAwE;AACxE,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,eAAe;IAG1B,YAAY,UAAsB,EAAE,WAAwB;QAKpD,8BAAyB,GAAG,CAAC,KAAwD,EAAyB,EAAE;YACtH,OAAO,kBAAkB,CAAC;gBACxB,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,OAAO,EAAE;oBACP,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,WAAW,EAAE,KAAK,CAAC,WAAW;iBA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IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;CA2JF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClient, ChatMessageReadReceipt, ChatMessageType } from '@azure/communication-chat';\nimport { ChatMessageDeletedEvent, ChatMessageEditedEvent, ChatMessageReceivedEvent, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatContext } from './ChatContext';\nimport { convertChatMessage } from './convertChatMessage';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\n// TODO: When we can get messageId of event from SDK, remove this\n// Maximum time to look back message list when we receive a system event\nconst maxSyncTimeInMs = 10 * 1000;\n\n/**\n * @private\n */\nexport class EventSubscriber {\n private chatClient: ChatClient;\n private chatContext: ChatContext;\n constructor(chatClient: ChatClient, chatContext: ChatContext) {\n this.chatClient = chatClient;\n this.chatContext = chatContext;\n this.subscribe();\n }\n private convertEventToChatMessage = (event: ChatMessageReceivedEvent | ChatMessageEditedEvent): ChatMessageWithStatus => {\n return convertChatMessage({\n id: event.id,\n version: event.version,\n content: {\n message: event.message,\n attachments: event.attachments\n },\n type: this.convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n // Note: there is a bug in chatMessageReceived event that it is missing sequenceId\n createdOn: new Date(event.createdOn),\n editedOn: 'editedOn' in event ? event.editedOn : undefined,\n metadata: event.metadata,\n /* @conditional-compile-remove(data-loss-prevention) */\n policyViolation: 'policyViolation' in event ? event.policyViolation : undefined\n });\n };\n\n // convert event type to chatMessage type, only possible type is 'html' and 'text' in chat event\n private 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 private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {\n // Today we are avoiding how to render these messages. In the future we can\n // remove this condition and handle this message appropriately.\n const messageEventType = event.type.toLowerCase();\n if (messageEventType !== 'text' && messageEventType !== 'richtext/html' && messageEventType !== 'html') {\n return;\n }\n const newMessage = this.convertEventToChatMessage(event);\n\n // Because of bug in chatMessageReceived event, if we already have that particular message in context, we want to\n // make sure to not overwrite the sequenceId when calling setChatMessage.\n const existingMessage = this.chatContext.getState().threads[event.threadId]?.chatMessages[event.id];\n if (existingMessage) {\n newMessage.sequenceId = existingMessage.sequenceId;\n }\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setChatMessage(event.threadId, newMessage);\n });\n };\n private onChatMessageDeleted = (event: ChatMessageDeletedEvent): void => {\n this.chatContext.deleteMessage(event.threadId, event.id);\n };\n private onChatMessageEdited = (event: ChatMessageEditedEvent): void => {\n const editedMessage = this.convertEventToChatMessage(event);\n this.chatContext.setChatMessage(event.threadId, convertChatMessage(editedMessage));\n };\n private onParticipantsAdded = (event: ParticipantsAddedEvent): void => {\n const participantsToAdd = event.participantsAdded.map(participant => ({\n ...participant,\n shareHistoryTime: participant.shareHistoryTime ? new Date(participant.shareHistoryTime) : undefined\n }));\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setParticipants(event.threadId, participantsToAdd);\n });\n this.fetchLastParticipantMessage(event.threadId, 'participantAdded');\n };\n\n // This is a temporary fix that no participant message is received for onChatMessageReceived event, which should be handled by JS SDK.\n // Without the temporary fix, there are missing 'participant joined' and 'participant left' system messages in the chat thread.\n private fetchLastParticipantMessage = async (threadId: string, actionType: 'participantAdded' | 'participantRemoved'): Promise<void> => {\n for await (const message of this.chatClient.getChatThreadClient(threadId).listMessages({\n startTime: new Date(Date.now() - maxSyncTimeInMs)\n })) {\n if (message.type === actionType) {\n this.chatContext.setChatMessage(threadId, {\n ...message,\n status: 'delivered'\n });\n }\n }\n };\n private onParticipantsRemoved = (event: ParticipantsRemovedEvent): void => {\n const participantIds = event.participantsRemoved.map(participant => {\n return participant.id;\n });\n this.chatContext.deleteParticipants(event.threadId, participantIds);\n\n // If the current user is removed from the thread, do not fetch the last participant message\n // as they no longer have access to the thread.\n const currentUserId = toFlatCommunicationIdentifier(this.chatContext.getState().userId);\n const wasCurrentUserRemoved = participantIds.find(id => toFlatCommunicationIdentifier(id) === currentUserId);\n if (!wasCurrentUserRemoved) {\n this.fetchLastParticipantMessage(event.threadId, 'participantRemoved');\n }\n };\n private onReadReceiptReceived = (event: ReadReceiptReceivedEvent): void => {\n const readReceipt: ChatMessageReadReceipt = {\n ...event,\n sender: event.sender,\n readOn: new Date(event.readOn)\n };\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.addReadReceipt(event.threadId, readReceipt);\n });\n };\n private onTypingIndicatorReceived = (typingIndicator: TypingIndicatorReceivedEvent): void => {\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(typingIndicator.threadId);\n this.chatContext.addTypingIndicator(typingIndicator.threadId, typingIndicator);\n });\n };\n private onChatThreadCreated = (event: ChatThreadCreatedEvent): void => {\n const properties = {\n topic: event.properties.topic\n };\n if (!this.chatContext.createThreadIfNotExist(event.threadId, properties)) {\n this.chatContext.updateThread(event.threadId, properties);\n }\n };\n private onChatThreadDeleted = (event: ChatThreadDeletedEvent): void => {\n this.chatContext.deleteThread(event.threadId);\n };\n private onChatThreadPropertiesUpdated = (event: ChatThreadPropertiesUpdatedEvent): void => {\n this.chatContext.updateThread(event.threadId, {\n topic: event.properties.topic\n });\n };\n public subscribe = (): void => {\n this.chatClient.on('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.on('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.on('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.on('participantsAdded', this.onParticipantsAdded);\n this.chatClient.on('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.on('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.on('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.on('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.on('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.on('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n public unsubscribe = (): void => {\n this.chatClient.off('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.off('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.off('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.off('participantsAdded', this.onParticipantsAdded);\n this.chatClient.off('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.off('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.off('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.off('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.off('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.off('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n}"]}
1
+ {"version":3,"file":"EventSubscriber.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/EventSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAIlC,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,iEAAiE;AACjE,wEAAwE;AACxE,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,eAAe;IAG1B,YAAY,UAAsB,EAAE,WAAwB;QAKpD,8BAAyB,GAAG,CAAC,KAAwD,EAAyB,EAAE;YACtH,OAAO,kBAAkB,CAAC;gBACxB,EAAE,EAAE,KAAK,CAAC,EAAE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UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;CAyJF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClient, ChatMessageReadReceipt, ChatMessageType } from '@azure/communication-chat';\nimport { ChatMessageDeletedEvent, ChatMessageEditedEvent, ChatMessageReceivedEvent, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatContext } from './ChatContext';\nimport { convertChatMessage } from './convertChatMessage';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\n// TODO: When we can get messageId of event from SDK, remove this\n// Maximum time to look back message list when we receive a system event\nconst maxSyncTimeInMs = 10 * 1000;\n\n/**\n * @private\n */\nexport class EventSubscriber {\n private chatClient: ChatClient;\n private chatContext: ChatContext;\n constructor(chatClient: ChatClient, chatContext: ChatContext) {\n this.chatClient = chatClient;\n this.chatContext = chatContext;\n this.subscribe();\n }\n private convertEventToChatMessage = (event: ChatMessageReceivedEvent | ChatMessageEditedEvent): ChatMessageWithStatus => {\n return convertChatMessage({\n id: event.id,\n version: event.version,\n content: {\n message: event.message,\n attachments: event.attachments\n },\n type: this.convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n // Note: there is a bug in chatMessageReceived event that it is missing sequenceId\n createdOn: new Date(event.createdOn),\n editedOn: 'editedOn' in event ? event.editedOn : undefined,\n metadata: event.metadata\n });\n };\n\n // convert event type to chatMessage type, only possible type is 'html' and 'text' in chat event\n private 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 private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {\n // Today we are avoiding how to render these messages. In the future we can\n // remove this condition and handle this message appropriately.\n const messageEventType = event.type.toLowerCase();\n if (messageEventType !== 'text' && messageEventType !== 'richtext/html' && messageEventType !== 'html') {\n return;\n }\n const newMessage = this.convertEventToChatMessage(event);\n\n // Because of bug in chatMessageReceived event, if we already have that particular message in context, we want to\n // make sure to not overwrite the sequenceId when calling setChatMessage.\n const existingMessage = this.chatContext.getState().threads[event.threadId]?.chatMessages[event.id];\n if (existingMessage) {\n newMessage.sequenceId = existingMessage.sequenceId;\n }\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setChatMessage(event.threadId, newMessage);\n });\n };\n private onChatMessageDeleted = (event: ChatMessageDeletedEvent): void => {\n this.chatContext.deleteMessage(event.threadId, event.id);\n };\n private onChatMessageEdited = (event: ChatMessageEditedEvent): void => {\n const editedMessage = this.convertEventToChatMessage(event);\n this.chatContext.setChatMessage(event.threadId, convertChatMessage(editedMessage));\n };\n private onParticipantsAdded = (event: ParticipantsAddedEvent): void => {\n const participantsToAdd = event.participantsAdded.map(participant => ({\n ...participant,\n shareHistoryTime: participant.shareHistoryTime ? new Date(participant.shareHistoryTime) : undefined\n }));\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setParticipants(event.threadId, participantsToAdd);\n });\n this.fetchLastParticipantMessage(event.threadId, 'participantAdded');\n };\n\n // This is a temporary fix that no participant message is received for onChatMessageReceived event, which should be handled by JS SDK.\n // Without the temporary fix, there are missing 'participant joined' and 'participant left' system messages in the chat thread.\n private fetchLastParticipantMessage = async (threadId: string, actionType: 'participantAdded' | 'participantRemoved'): Promise<void> => {\n for await (const message of this.chatClient.getChatThreadClient(threadId).listMessages({\n startTime: new Date(Date.now() - maxSyncTimeInMs)\n })) {\n if (message.type === actionType) {\n this.chatContext.setChatMessage(threadId, {\n ...message,\n status: 'delivered'\n });\n }\n }\n };\n private onParticipantsRemoved = (event: ParticipantsRemovedEvent): void => {\n const participantIds = event.participantsRemoved.map(participant => {\n return participant.id;\n });\n this.chatContext.deleteParticipants(event.threadId, participantIds);\n\n // If the current user is removed from the thread, do not fetch the last participant message\n // as they no longer have access to the thread.\n const currentUserId = toFlatCommunicationIdentifier(this.chatContext.getState().userId);\n const wasCurrentUserRemoved = participantIds.find(id => toFlatCommunicationIdentifier(id) === currentUserId);\n if (!wasCurrentUserRemoved) {\n this.fetchLastParticipantMessage(event.threadId, 'participantRemoved');\n }\n };\n private onReadReceiptReceived = (event: ReadReceiptReceivedEvent): void => {\n const readReceipt: ChatMessageReadReceipt = {\n ...event,\n sender: event.sender,\n readOn: new Date(event.readOn)\n };\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.addReadReceipt(event.threadId, readReceipt);\n });\n };\n private onTypingIndicatorReceived = (typingIndicator: TypingIndicatorReceivedEvent): void => {\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(typingIndicator.threadId);\n this.chatContext.addTypingIndicator(typingIndicator.threadId, typingIndicator);\n });\n };\n private onChatThreadCreated = (event: ChatThreadCreatedEvent): void => {\n const properties = {\n topic: event.properties.topic\n };\n if (!this.chatContext.createThreadIfNotExist(event.threadId, properties)) {\n this.chatContext.updateThread(event.threadId, properties);\n }\n };\n private onChatThreadDeleted = (event: ChatThreadDeletedEvent): void => {\n this.chatContext.deleteThread(event.threadId);\n };\n private onChatThreadPropertiesUpdated = (event: ChatThreadPropertiesUpdatedEvent): void => {\n this.chatContext.updateThread(event.threadId, {\n topic: event.properties.topic\n });\n };\n public subscribe = (): void => {\n this.chatClient.on('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.on('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.on('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.on('participantsAdded', this.onParticipantsAdded);\n this.chatClient.on('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.on('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.on('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.on('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.on('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.on('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n public unsubscribe = (): void => {\n this.chatClient.off('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.off('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.off('chatMessageEdited', this.onChatMessageEdited);\n this.chatClient.off('participantsAdded', this.onParticipantsAdded);\n this.chatClient.off('participantsRemoved', this.onParticipantsRemoved);\n this.chatClient.off('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.off('typingIndicatorReceived', this.onTypingIndicatorReceived);\n this.chatClient.off('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.off('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.off('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n}"]}
@@ -173,6 +173,9 @@ export const fetchImageSource = (src, authentication, options) => __awaiter(void
173
173
  token = (yield authentication.credential.getToken()).token;
174
174
  }
175
175
  const response = yield fetchWithAuthentication(src, token, options);
176
+ if (response.status >= 400) {
177
+ throw new Error(`Failed to fetch image source. Status code: ${response.status}`);
178
+ }
176
179
  const blob = yield response.blob();
177
180
  return URL.createObjectURL(blob);
178
181
  });