@azure/communication-react 1.11.0-alpha-202312100013 → 1.11.0-alpha-202312120013

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 (558) hide show
  1. package/dist/dist-cjs/communication-react/index.js +160 -122
  2. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  3. package/dist/dist-esm/acs-ui-common/src/MessageStatus.d.ts +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/areEqual.d.ts +3 -3
  5. package/dist/dist-esm/acs-ui-common/src/commonProperties.d.ts +2 -2
  6. package/dist/dist-esm/acs-ui-common/src/identifier.js.map +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/localizationUtils.js.map +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/logEvent.d.ts +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.d.ts +2 -2
  10. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.js.map +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/safeStringify.js.map +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/telemetry.d.ts +1 -1
  13. package/dist/dist-esm/acs-ui-common/src/telemetry.js.map +1 -1
  14. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  15. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  16. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +1 -1
  17. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  18. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts +6 -6
  19. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
  20. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.d.ts +3 -3
  21. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
  22. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.d.ts +1 -1
  23. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js.map +1 -1
  24. package/dist/dist-esm/calling-component-bindings/src/getRemoteParticipantsExcludingConsumers.js.map +1 -1
  25. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +2 -2
  26. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  27. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js.map +1 -1
  28. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +2 -2
  29. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  30. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
  31. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.d.ts +1 -1
  32. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js.map +1 -1
  33. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +2 -2
  34. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  35. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.js.map +1 -1
  36. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +1 -1
  37. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
  38. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.d.ts +1 -1
  39. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.js.map +1 -1
  40. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.d.ts +1 -1
  41. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js.map +1 -1
  42. package/dist/dist-esm/calling-component-bindings/src/providers/CallClientProvider.d.ts +1 -1
  43. package/dist/dist-esm/calling-component-bindings/src/providers/CallClientProvider.js.map +1 -1
  44. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.d.ts +1 -1
  45. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js.map +1 -1
  46. package/dist/dist-esm/calling-component-bindings/src/utils/SelectorUtils.js.map +1 -1
  47. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +1 -1
  48. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
  49. package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.js.map +1 -1
  50. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  51. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.d.ts +1 -1
  52. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  53. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.d.ts +5 -5
  54. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +2 -2
  55. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  56. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +2 -2
  57. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  58. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +4 -4
  59. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  60. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.js.map +1 -1
  61. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  62. package/dist/dist-esm/calling-stateful-client/src/CallIdHistory.js.map +1 -1
  63. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  64. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js.map +1 -1
  65. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  66. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
  67. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.d.ts +1 -1
  68. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.js.map +1 -1
  69. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +3 -3
  70. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js.map +1 -1
  71. package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js.map +1 -1
  72. package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.js.map +1 -1
  73. package/dist/dist-esm/calling-stateful-client/src/RaiseHandSubscriber.js.map +1 -1
  74. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js.map +1 -1
  75. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js.map +1 -1
  76. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +3 -3
  77. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  78. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.d.ts +1 -1
  79. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
  80. package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.js.map +1 -1
  81. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +1 -1
  82. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  83. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +1 -1
  84. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
  85. package/dist/dist-esm/calling-stateful-client/src/TranscriptionSubscriber.js.map +1 -1
  86. package/dist/dist-esm/calling-stateful-client/src/UserFacingDiagnosticsSubscriber.js.map +1 -1
  87. package/dist/dist-esm/calling-stateful-client/src/VideoStreamRendererViewDeclarative.js.map +1 -1
  88. package/dist/dist-esm/chat-component-bindings/src/baseSelectors.d.ts +1 -1
  89. package/dist/dist-esm/chat-component-bindings/src/baseSelectors.js.map +1 -1
  90. package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.d.ts +1 -1
  91. package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.js.map +1 -1
  92. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.d.ts +1 -1
  93. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js.map +1 -1
  94. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +1 -1
  95. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  96. package/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.js.map +1 -1
  97. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +1 -1
  98. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  99. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.js.map +1 -1
  100. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.d.ts +1 -1
  101. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  102. package/dist/dist-esm/chat-component-bindings/src/providers/ChatClientProvider.d.ts +1 -1
  103. package/dist/dist-esm/chat-component-bindings/src/providers/ChatClientProvider.js.map +1 -1
  104. package/dist/dist-esm/chat-component-bindings/src/providers/ChatThreadClientProvider.d.ts +1 -1
  105. package/dist/dist-esm/chat-component-bindings/src/providers/ChatThreadClientProvider.js.map +1 -1
  106. package/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.d.ts +1 -1
  107. package/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.js.map +1 -1
  108. package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.d.ts +1 -1
  109. package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.js.map +1 -1
  110. package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js.map +1 -1
  111. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
  112. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +5 -5
  113. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  114. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +8 -6
  115. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
  116. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.d.ts +3 -3
  117. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js.map +1 -1
  118. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js.map +1 -1
  119. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js.map +1 -1
  120. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts +1 -1
  121. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.js.map +1 -1
  122. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.js.map +1 -1
  123. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +1 -1
  124. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
  125. package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +5 -5
  126. package/dist/dist-esm/communication-react/src/mergedHooks.js.map +1 -1
  127. package/dist/dist-esm/react-components/src/components/Announcer/Announcer.d.ts +2 -2
  128. package/dist/dist-esm/react-components/src/components/Announcer/Announcer.js.map +1 -1
  129. package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerContext.d.ts +1 -1
  130. package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.js.map +1 -1
  131. package/dist/dist-esm/react-components/src/components/Announcer.d.ts +1 -1
  132. package/dist/dist-esm/react-components/src/components/CameraButton.js.map +1 -1
  133. package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +1 -1
  134. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
  135. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -1
  136. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.d.ts +1 -1
  137. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.js.map +1 -1
  138. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js.map +1 -1
  139. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +1 -1
  140. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
  141. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +1 -1
  142. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
  143. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +1 -1
  144. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
  145. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +1 -1
  146. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  147. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +2 -2
  148. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  149. package/dist/dist-esm/react-components/src/components/ChatMessage/DefaultSystemMessage.js.map +1 -1
  150. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.d.ts +1 -1
  151. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +1 -1
  152. package/dist/dist-esm/react-components/src/components/ComplianceBanner/BannerMessage.js.map +1 -1
  153. package/dist/dist-esm/react-components/src/components/ComplianceBanner/ComplianceBanner.js.map +1 -1
  154. package/dist/dist-esm/react-components/src/components/ComplianceBanner/DelayedUpdateBanner.js.map +1 -1
  155. package/dist/dist-esm/react-components/src/components/ComplianceBanner/Utils.d.ts +2 -2
  156. package/dist/dist-esm/react-components/src/components/ComplianceBanner/Utils.js.map +1 -1
  157. package/dist/dist-esm/react-components/src/components/ComplianceBanner/types.d.ts +1 -1
  158. package/dist/dist-esm/react-components/src/components/ControlBar.d.ts +1 -1
  159. package/dist/dist-esm/react-components/src/components/ControlBarButton.d.ts +1 -1
  160. package/dist/dist-esm/react-components/src/components/ControlButtonTooltip.js +1 -2
  161. package/dist/dist-esm/react-components/src/components/ControlButtonTooltip.js.map +1 -1
  162. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +1 -1
  163. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +1 -1
  164. package/dist/dist-esm/react-components/src/components/DevicePermissions/DevicePermissionDropdown.d.ts +1 -1
  165. package/dist/dist-esm/react-components/src/components/DevicePermissions/DevicePermissionDropdown.js.map +1 -1
  166. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +3 -3
  167. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +1 -1
  168. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +1 -1
  169. package/dist/dist-esm/react-components/src/components/DevicesButton.js.map +1 -1
  170. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.d.ts +1 -1
  171. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  172. package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js.map +1 -1
  173. package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.js.map +1 -1
  174. package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts +1 -1
  175. package/dist/dist-esm/react-components/src/components/FileCard.js +1 -1
  176. package/dist/dist-esm/react-components/src/components/FileCard.js.map +1 -1
  177. package/dist/dist-esm/react-components/src/components/FileCardGroup.js.map +1 -1
  178. package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +3 -3
  179. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
  180. package/dist/dist-esm/react-components/src/components/FileUploadCards.js.map +1 -1
  181. package/dist/dist-esm/react-components/src/components/GridLayout.d.ts +2 -2
  182. package/dist/dist-esm/react-components/src/components/GridLayout.js.map +1 -1
  183. package/dist/dist-esm/react-components/src/components/HorizontalGallery.js.map +1 -1
  184. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +2 -2
  185. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  186. package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.js.map +1 -1
  187. package/dist/dist-esm/react-components/src/components/LocalVideoTile.js.map +1 -1
  188. package/dist/dist-esm/react-components/src/components/MentionPopover.d.ts +1 -1
  189. package/dist/dist-esm/react-components/src/components/MentionPopover.js.map +1 -1
  190. package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js.map +1 -1
  191. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -6
  192. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  193. package/dist/dist-esm/react-components/src/components/MicrophoneButton.js.map +1 -1
  194. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.d.ts +1 -1
  195. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
  196. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +6 -2
  197. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  198. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +2 -2
  199. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  200. package/dist/dist-esm/react-components/src/components/ParticipantsButton.js.map +1 -1
  201. package/dist/dist-esm/react-components/src/components/PictureInPictureInPicture/PictureInPictureInPictureTile.d.ts +2 -2
  202. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
  203. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +1 -1
  204. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js +2 -2
  205. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js.map +1 -1
  206. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  207. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +1 -1
  208. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js.map +1 -1
  209. package/dist/dist-esm/react-components/src/components/StartCaptionsButton.d.ts +1 -1
  210. package/dist/dist-esm/react-components/src/components/StartCaptionsButton.js.map +1 -1
  211. package/dist/dist-esm/react-components/src/components/StreamMedia.d.ts +1 -1
  212. package/dist/dist-esm/react-components/src/components/StreamMedia.js.map +1 -1
  213. package/dist/dist-esm/react-components/src/components/SystemMessage.d.ts +2 -2
  214. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.d.ts +1 -1
  215. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
  216. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.d.ts +6 -6
  217. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +3 -3
  218. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +1 -1
  219. package/dist/dist-esm/react-components/src/components/TroubleshootingGuideErrorBar.js.map +1 -1
  220. package/dist/dist-esm/react-components/src/components/TypingIndicator.js.map +1 -1
  221. package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js.map +1 -1
  222. package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js.map +1 -1
  223. package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js.map +1 -1
  224. package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js.map +1 -1
  225. package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -1
  226. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.d.ts +1 -1
  227. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
  228. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -1
  229. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.d.ts +1 -1
  230. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  231. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js.map +1 -1
  232. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  233. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.d.ts +1 -1
  234. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.js.map +1 -1
  235. package/dist/dist-esm/react-components/src/components/VideoGallery/LocalScreenShare.js.map +1 -1
  236. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
  237. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js.map +1 -1
  238. package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.js.map +1 -1
  239. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
  240. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js +2 -2
  241. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js.map +1 -1
  242. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.js.map +1 -1
  243. package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoStreamLifecycleMaintainer.js.map +1 -1
  244. package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.js.map +1 -1
  245. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/OverflowGalleryUtils.js.map +1 -1
  246. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  247. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +3 -3
  248. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  249. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  250. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +1 -1
  251. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -1
  252. package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js.map +1 -1
  253. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js +1 -1
  254. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js.map +1 -1
  255. package/dist/dist-esm/react-components/src/components/styles/ImageGallery.style.js +1 -1
  256. package/dist/dist-esm/react-components/src/components/styles/ImageGallery.style.js.map +1 -1
  257. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.js +1 -1
  258. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.js.map +1 -1
  259. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +2 -2
  260. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  261. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +1 -1
  262. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
  263. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +1 -1
  264. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.js +3 -3
  265. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.js.map +1 -1
  266. package/dist/dist-esm/react-components/src/components/styles/TroubleshootingGuideErrorBar.styles.js +1 -1
  267. package/dist/dist-esm/react-components/src/components/styles/TroubleshootingGuideErrorBar.styles.js.map +1 -1
  268. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js.map +1 -1
  269. package/dist/dist-esm/react-components/src/components/styles/VerticalGallery.styles.js +1 -1
  270. package/dist/dist-esm/react-components/src/components/styles/VerticalGallery.styles.js.map +1 -1
  271. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js +2 -2
  272. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js.map +1 -1
  273. package/dist/dist-esm/react-components/src/components/styles/v8StyleShim.js.map +1 -1
  274. package/dist/dist-esm/react-components/src/components/utils/Datetime.js.map +1 -1
  275. package/dist/dist-esm/react-components/src/components/utils/formatPhoneNumber.js.map +1 -1
  276. package/dist/dist-esm/react-components/src/components/utils/keyboardNavigation.js.map +1 -1
  277. package/dist/dist-esm/react-components/src/components/utils/merge.js.map +1 -1
  278. package/dist/dist-esm/react-components/src/components/utils/overFlowGalleriesUtils.js.map +1 -1
  279. package/dist/dist-esm/react-components/src/components/utils/responsive.js.map +1 -1
  280. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js.map +1 -1
  281. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  282. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.d.ts +1 -1
  283. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
  284. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +1 -1
  285. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +2 -1
  286. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +2 -1
  287. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +2 -1
  288. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +2 -1
  289. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +2 -1
  290. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +2 -1
  291. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +2 -1
  292. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +2 -1
  293. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +2 -1
  294. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +2 -1
  295. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +2 -1
  296. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +2 -1
  297. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +2 -1
  298. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +2 -1
  299. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +2 -1
  300. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +2 -1
  301. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +2 -1
  302. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +2 -1
  303. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +2 -1
  304. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +2 -1
  305. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
  306. package/dist/dist-esm/react-components/src/theming/generateTheme.js.map +1 -1
  307. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -1
  308. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  309. package/dist/dist-esm/react-components/src/theming/themeDuplicates.d.ts +2 -2
  310. package/dist/dist-esm/react-components/src/theming/themeUtils.js.map +1 -1
  311. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +4 -4
  312. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  313. package/dist/dist-esm/react-components/src/types/CommunicationParticipant.d.ts +1 -1
  314. package/dist/dist-esm/react-components/src/types/ComponentSlotStyle.d.ts +1 -1
  315. package/dist/dist-esm/react-components/src/types/OnRender.d.ts +2 -2
  316. package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.d.ts +4 -4
  317. package/dist/dist-esm/react-components/src/types/ReadReceiptsBySenderId.d.ts +1 -1
  318. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +2 -2
  319. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +1 -1
  320. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  321. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  322. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +9 -9
  323. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +16 -9
  324. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  325. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +25 -25
  326. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  327. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.d.ts +1 -1
  328. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.js.map +1 -1
  329. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js.map +1 -1
  330. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/DiagnosticsForwarder.js.map +1 -1
  331. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/OnFetchProfileCallback.d.ts +2 -2
  332. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/OnFetchProfileCallback.js.map +1 -1
  333. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.d.ts +1 -1
  334. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +1 -1
  335. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -1
  336. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +7 -7
  337. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  338. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.d.ts +1 -1
  339. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  340. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +1 -1
  341. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CapabilitiesChangedNotificationBar.js.map +1 -1
  342. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
  343. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
  344. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
  345. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ExpandedLocalVideoTile.js.map +1 -1
  346. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js.map +1 -1
  347. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LobbyTile.js.map +1 -1
  348. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalAndRemotePIP.js.map +1 -1
  349. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  350. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js +9 -2
  351. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js.map +1 -1
  352. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +1 -1
  353. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
  354. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/NetworkReconnectTile.js.map +1 -1
  355. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js.map +1 -1
  356. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePaneProvider.d.ts +2 -2
  357. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
  358. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js.map +1 -1
  359. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SvgWithWordWrapping.js +1 -2
  360. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SvgWithWordWrapping.js.map +1 -1
  361. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js.map +1 -1
  362. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Devices.js.map +1 -1
  363. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js.map +1 -1
  364. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js +2 -3
  365. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js.map +1 -1
  366. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Participants.js.map +1 -1
  367. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js.map +1 -1
  368. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/RaiseHand.js.map +1 -1
  369. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js.map +1 -1
  370. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
  371. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  372. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +1 -1
  373. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.js.map +1 -1
  374. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  375. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +1 -1
  376. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  377. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  378. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  379. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
  380. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.d.ts +1 -1
  381. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js.map +1 -1
  382. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/LocalVideoTileSelector.d.ts +2 -2
  383. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/activeVideoBackgroundEffectSelector.js.map +1 -1
  384. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  385. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.d.ts +1 -1
  386. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/capabilitiesChangedInfoAndRoleSelector.d.ts +1 -1
  387. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.d.ts +1 -1
  388. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/deviceCountSelector.d.ts +1 -1
  389. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.d.ts +2 -2
  390. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.d.ts +2 -2
  391. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js.map +1 -1
  392. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.d.ts +4 -4
  393. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.js.map +1 -1
  394. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.d.ts +10 -10
  395. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.js.map +1 -1
  396. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.d.ts +2 -2
  397. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localVideoStreamSelector.d.ts +1 -1
  398. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localVideoStreamSelector.js.map +1 -1
  399. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.d.ts +5 -5
  400. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mutedNotificationSelector.d.ts +2 -2
  401. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/networkReconnectTileSelector.d.ts +5 -5
  402. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Buttons.styles.js.map +1 -1
  403. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +2 -2
  404. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +16 -11
  405. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
  406. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.js +1 -0
  407. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.js.map +1 -1
  408. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js.map +1 -1
  409. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.d.ts +1 -2
  410. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js +19 -7
  411. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js.map +1 -1
  412. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/StartCallButton.styles.js +1 -1
  413. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/StartCallButton.styles.js.map +1 -1
  414. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.d.ts +1 -1
  415. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CapabilityChangedNotificationTracking.d.ts +1 -1
  416. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/ErrorTracking.d.ts +1 -1
  417. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/ErrorTracking.js.map +1 -1
  418. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/MediaGalleryUtils.d.ts +1 -1
  419. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/MediaGalleryUtils.js.map +1 -1
  420. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js.map +1 -1
  421. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js.map +1 -1
  422. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +1 -1
  423. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  424. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/useConsoleErrors.js.map +1 -1
  425. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +1 -1
  426. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  427. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/ChatButton.js.map +1 -1
  428. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/ChatButtonWithUnreadMessagesBadge.js.map +1 -1
  429. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.d.ts +1 -1
  430. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.js +3 -3
  431. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.js.map +1 -1
  432. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/useUnreadMessagesTracker.js.map +1 -1
  433. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +2 -2
  434. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  435. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +1 -1
  436. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  437. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  438. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  439. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/parseTeamsUrl.js.map +1 -1
  440. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/selectors/moreDrawerSelector.d.ts +1 -1
  441. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/selectors/moreDrawerSelector.js.map +1 -1
  442. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  443. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +1 -1
  444. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  445. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.d.ts +1 -1
  446. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.js.map +1 -1
  447. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +2 -2
  448. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  449. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +1 -1
  450. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +1 -1
  451. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js.map +1 -1
  452. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +2 -2
  453. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +7 -5
  454. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  455. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.d.ts +1 -1
  456. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +1 -1
  457. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +10 -10
  458. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  459. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +1 -1
  460. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
  461. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.d.ts +4 -4
  462. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +1 -1
  463. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadHandler.d.ts +1 -1
  464. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -1
  465. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.js.map +1 -1
  466. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  467. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.d.ts +1 -1
  468. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.js.map +1 -1
  469. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +6 -6
  470. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
  471. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
  472. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +1 -1
  473. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +2 -2
  474. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
  475. package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.js.map +1 -1
  476. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +1 -1
  477. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +1 -1
  478. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js.map +1 -1
  479. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.js.map +1 -1
  480. package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.js.map +1 -1
  481. package/dist/dist-esm/react-composites/src/composites/common/ContainerRectProps.d.ts +1 -1
  482. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  483. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.d.ts +5 -5
  484. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -1
  485. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -1
  486. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/PeopleButton.js.map +1 -1
  487. package/dist/dist-esm/react-composites/src/composites/common/ConvertContextualMenuItemToDrawerMenuItem.js.map +1 -1
  488. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionSettingsDrawer.js.map +1 -1
  489. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  490. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.js.map +1 -1
  491. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -1
  492. package/dist/dist-esm/react-composites/src/composites/common/Drawer/captionSettingsDrawer.styles.js.map +1 -1
  493. package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js.map +1 -1
  494. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js.map +1 -1
  495. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.d.ts +1 -1
  496. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js +1 -1
  497. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js.map +1 -1
  498. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  499. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js.map +1 -1
  500. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js.map +1 -1
  501. package/dist/dist-esm/react-composites/src/composites/common/SidePaneHeader.js.map +1 -1
  502. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.d.ts +2 -2
  503. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js.map +1 -1
  504. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +1 -1
  505. package/dist/dist-esm/react-composites/src/composites/common/adapters.d.ts +1 -1
  506. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +5 -5
  507. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  508. package/dist/dist-esm/react-composites/src/composites/common/resolveVideoEffectDependency.js.map +1 -1
  509. package/dist/dist-esm/react-composites/src/composites/common/resolveVideoEffectDependencyLazy.js.map +1 -1
  510. package/dist/dist-esm/react-composites/src/composites/common/styles/ModalLocalAndRemotePIP.styles.d.ts +1 -1
  511. package/dist/dist-esm/react-composites/src/composites/common/styles/ModalLocalAndRemotePIP.styles.js.map +1 -1
  512. package/dist/dist-esm/react-composites/src/composites/common/styles/ParticipantContainer.styles.js.map +1 -1
  513. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +2 -2
  514. package/dist/dist-esm/react-composites/src/composites/common/utils.js.map +1 -1
  515. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.d.ts +1 -1
  516. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.js.map +1 -1
  517. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/CompositeLocale.js.map +1 -1
  518. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +2 -0
  519. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/CompositeLocale.js.map +1 -1
  520. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +2 -0
  521. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/CompositeLocale.js.map +1 -1
  522. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +2 -0
  523. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/CompositeLocale.js.map +1 -1
  524. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +2 -0
  525. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/CompositeLocale.js.map +1 -1
  526. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +2 -0
  527. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/CompositeLocale.js.map +1 -1
  528. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +2 -0
  529. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/CompositeLocale.js.map +1 -1
  530. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +2 -0
  531. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/CompositeLocale.js.map +1 -1
  532. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +2 -0
  533. package/dist/dist-esm/react-composites/src/composites/localization/locales/index.js.map +1 -1
  534. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/CompositeLocale.js.map +1 -1
  535. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +2 -0
  536. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/CompositeLocale.js.map +1 -1
  537. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +2 -0
  538. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/CompositeLocale.js.map +1 -1
  539. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +2 -0
  540. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/CompositeLocale.js.map +1 -1
  541. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +2 -0
  542. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/CompositeLocale.js.map +1 -1
  543. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +2 -0
  544. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/CompositeLocale.js.map +1 -1
  545. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +2 -0
  546. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/CompositeLocale.js.map +1 -1
  547. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +2 -0
  548. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/CompositeLocale.js.map +1 -1
  549. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +2 -0
  550. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/CompositeLocale.js.map +1 -1
  551. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +2 -0
  552. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/CompositeLocale.js.map +1 -1
  553. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +2 -0
  554. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/CompositeLocale.js.map +1 -1
  555. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +2 -0
  556. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/CompositeLocale.js.map +1 -1
  557. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +2 -0
  558. package/package.json +3 -2
@@ -31,7 +31,7 @@ export declare const usePropsFor: <Component extends (props: any) => JSX.Element
31
31
  *
32
32
  * @public
33
33
  */
34
- export declare 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;
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;
35
35
  /**
36
36
  * Get the selector for a specified component.
37
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../../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,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,CACzB,SAAoB,EAGR,EAAE;IACd,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CA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ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\n\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>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]>\n : 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 { ...props, ...handlers } 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<\n Component,\n typeof SendBox\n> extends true\n ? SendBoxSelector\n : AreEqual<Component, typeof MessageThread> extends true\n ? MessageThreadSelector\n : AreEqual<Component, typeof TypingIndicator> extends true\n ? TypingIndicatorSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? ChatParticipantListSelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? ErrorBarSelector\n : 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>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst messageThreadSelectorsByThread = {};\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\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};\n\"../../../react-components/src\"\"../../../acs-ui-common/src\""]}
1
+ {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../../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,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,4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,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC,CAAC;IAEF,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';\n\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>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]>\n : 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 { ...props, ...handlers } 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<\n Component,\n typeof SendBox\n> extends true\n ? SendBoxSelector\n : AreEqual<Component, typeof MessageThread> extends true\n ? MessageThreadSelector\n : AreEqual<Component, typeof TypingIndicator> extends true\n ? TypingIndicatorSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? ChatParticipantListSelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? ErrorBarSelector\n : 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>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst messageThreadSelectorsByThread = {};\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\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};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSelector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AAG,KAAK,CAAC;IACxB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ,EAAE;YAC5B,OAAO;SACR;QACD,MAAM,aAAa,GAAG,CAAC,KAAsB,EAAQ,EAAE;YACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,iBAAiB,CAAC,CAAC;YACrE,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE;gBAChC,QAAQ,CAAC,QAAQ,CAAC,CAAC;aACpB;QACH,CAAC,CAAC;QACF,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState, StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\n\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n\n/**\n * Hook to obtain a 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 useSelector = <\n SelectorT extends (state: ChatClientState, props: any) => any,\n ParamT extends SelectorT | undefined\n>(\n selector: ParamT,\n selectorProps?: Parameters<SelectorT>[1]\n): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const chatClient: StatefulChatClient | undefined = useContext(ChatClientContext);\n const threadId = useContext(ChatThreadClientContext)?.threadId;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const threadConfigProps = useMemo(\n () => ({\n threadId\n }),\n [threadId]\n );\n\n const [props, setProps] = useState(\n chatClient && selector ? selector(chatClient.getState(), selectorProps ?? threadConfigProps) : undefined\n );\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) {\n return;\n }\n const onStateChange = (state: ChatClientState): void => {\n const newProps = selector(state, selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return selector ? props : undefined;\n};\n\"../../../chat-stateful-client/src\""]}
1
+ {"version":3,"file":"useSelector.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/hooks/useSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAIzB,QAAgB,EAChB,aAAwC,EACsB,EAAE;;IAChE,MAAM,UAAU,GAAmC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAA,UAAU,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,CAAC;IAE/D,sHAAsH;IACtH,qHAAqH;IACrH,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B,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AC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState, StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\n\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n\n/**\n * Hook to obtain a 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 useSelector = <\n SelectorT extends (state: ChatClientState, props: any) => any,\n ParamT extends SelectorT | undefined\n>(\n selector: ParamT,\n selectorProps?: Parameters<SelectorT>[1]\n): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const chatClient: StatefulChatClient | undefined = useContext(ChatClientContext);\n const threadId = useContext(ChatThreadClientContext)?.threadId;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const threadConfigProps = useMemo(\n () => ({\n threadId\n }),\n [threadId]\n );\n\n const [props, setProps] = useState(\n chatClient && selector ? selector(chatClient.getState(), selectorProps ?? threadConfigProps) : undefined\n );\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) {\n return;\n }\n const onStateChange = (state: ChatClientState): void => {\n const newProps = selector(state, selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return selector ? props : undefined;\n};\n"]}
@@ -6,7 +6,7 @@ import { Message } from "../../react-components/src";
6
6
  *
7
7
  * @public
8
8
  */
9
- export declare type MessageThreadSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
9
+ export type MessageThreadSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
10
10
  userId: string;
11
11
  showMessageStatus: boolean;
12
12
  messages: Message[];
@@ -1 +1 @@
1
- {"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAWvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAOhF,MAAM,6BAA6B,GAAG,YAAY,CAChD,CACE,IAAY,EACZ,WAAkC,EAClC,MAAc,EACd,MAAe,EACf,YAAqB,EACZ,EAAE;IACX,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACnD,uDAAuD;IACvD,IAAI,WAAW,CAAC,eAAe,EAAE;QAC/B,OAAO,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;KAC7E;IACD,IACE,WAAW,KAAK,mBAAmB,CAAC,IAAI;QACxC,WAAW,KAAK,mBAAmB,CAAC,YAAY;QAChD,WAAW,KAAK,mBAAmB,CAAC,IAAI,EACxC;QACA,OAAO,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAA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c,EACnC,YAAY,CACb,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;IAEF,0BAA0B,CAAC,iBAAiB,CAAC,CAAC;IAC9C,OAAO;QACL,MAAM;QACN,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,iBAAiB;QAC3B,gBAAgB;QAChB,sBAAsB;KACvB,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,2BAA2B,GAAG,CAAC,IAAY,EAAsB,EAAE;IACvE,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,eAAe;QAC9F,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,OAA8B,EAAW,EAAE;;IACzE,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IACD,IACE,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAG,qBAAqB,CAAC;;QACzC,uEAAuE,CAAC,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAA,EACpG;QACA,OAAO,IAAI,CAAC;KACb;IACD,uDAAuD;IACvD,IAAI,OAAO,CAAC,eAAe,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;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 {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { ACSKnownMessageType } from './utils/constants';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n\n/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { FileMetadata, ChatAttachmentType, InlineImageMetadata } from '@internal/react-components';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { AttachmentType, ChatAttachment } from '@azure/communication-chat';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation) {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\n/* @conditional-compile-remove(file-sharing) */\nconst extractAttachedFilesMetadata = (metadata: Record<string, string>): FileMetadata[] => {\n const fileMetadata = metadata['fileSharingMetadata'];\n if (!fileMetadata) {\n return [];\n }\n try {\n return JSON.parse(fileMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractTeamsAttachmentsMetadata = (\n attachments: ChatAttachment[]\n): { files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {\n const files: FileMetadata[] = [];\n const inlineImages: InlineImageMetadata[] = [];\n attachments.forEach((attachment) => {\n const attachmentType = mapAttachmentType(attachment.attachmentType);\n if (attachmentType === 'inlineImage') {\n inlineImages.push({\n attachmentType: attachmentType,\n id: attachment.id,\n url: extractAttachmentUrl(attachment),\n previewUrl: attachment.previewUrl\n });\n } else if (attachmentType === 'file') {\n files.push({\n attachmentType: attachmentType,\n id: attachment.id,\n name: attachment.name ?? '',\n extension: attachment.contentType ?? '',\n url: extractAttachmentUrl(attachment),\n payload: { teamsFileAttachment: 'true' }\n });\n }\n });\n return { files, inlineImages };\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst mapAttachmentType = (attachmentType: AttachmentType): ChatAttachmentType => {\n if (attachmentType === 'teamsImage' || attachmentType === 'teamsInlineImage') {\n return 'inlineImage';\n } else if (attachmentType === 'file') {\n return 'file';\n }\n return 'unknown';\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.attachmentType === 'file' && attachment.previewUrl ? attachment.previewUrl : attachment.url;\n};\n\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (sanitizedMessageContentType(message.type).includes('html') && message.content?.attachments) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n const teamsImageHtmlContent = attachments\n .filter((attachment) => attachment.attachmentType === 'teamsImage')\n .map((attachment) => generateImageAttachmentImgHtml(attachment))\n .join('');\n\n if (teamsImageHtmlContent) {\n return (message.content?.message ?? '') + teamsImageHtmlContent;\n }\n }\n return message.content?.message;\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst generateImageAttachmentImgHtml = (attachment: ChatAttachment): string => {\n return `\\r\\n<p><img alt=\"image\" src=\"\" itemscope=\"${attachment.contentType}\" id=\"${attachment.id}\"></p>`;\n};\n\n/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractAttachmentsMetadata = (\n message: ChatMessageWithStatus\n): { files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {\n let files: FileMetadata[] = [];\n let inlineImages: InlineImageMetadata[] = [];\n\n /* @conditional-compile-remove(file-sharing) */\n if (message.metadata) {\n files = files.concat(extractAttachedFilesMetadata(message.metadata));\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n files = files.concat(teamsAttachments.files);\n inlineImages = inlineImages.concat(teamsAttachments.inlineImages);\n }\n\n return { files, inlineImages };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): 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\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n const { files, inlineImages } = 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) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n files,\n /* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n inlineImages\n };\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:\n 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) => participant.displayName && participant.displayName !== '')\n .map(\n (participant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\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 = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\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 =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (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\n ? undefined\n : 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\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .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) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (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\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\n\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (\n message.metadata?.['fileSharingMetadata'] ||\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ message.content?.attachments\n ) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation) {\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();\n\"../../acs-ui-common/src\"\"../../chat-stateful-client/src\"\"../../react-components/src\""]}
1
+ {"version":3,"file":"messageThreadSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/messageThreadSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,YAAY,EAAE,gCAAgC;AAWvD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,uDAAuD;AACvD,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAOhF,MAAM,6BAA6B,GAAG,YAAY,CAChD,CACE,IAAY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AC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAG,qBAAqB,CAAC;;QACzC,uEAAuE,CAAC,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAA,EACpG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,uDAAuD;IACvD,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,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 {\n ChatBaseSelectorProps,\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getParticipants,\n getReadReceipts,\n getUserId\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatClientState, ChatMessageWithStatus } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport {\n ChatMessage,\n Message,\n CommunicationParticipant,\n SystemMessage,\n MessageContentType,\n ReadReceiptsBySenderId\n} from '@internal/react-components';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { ACSKnownMessageType } from './utils/constants';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';\nimport { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';\n\n/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { FileMetadata, ChatAttachmentType, InlineImageMetadata } from '@internal/react-components';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { AttachmentType, ChatAttachment } from '@azure/communication-chat';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message => {\n const messageType = chatMessage.type.toLowerCase();\n /* @conditional-compile-remove(data-loss-prevention) */\n if (chatMessage.policyViolation) {\n return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);\n }\n if (\n messageType === ACSKnownMessageType.text ||\n messageType === ACSKnownMessageType.richtextHtml ||\n messageType === ACSKnownMessageType.html\n ) {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\n/* @conditional-compile-remove(file-sharing) */\nconst extractAttachedFilesMetadata = (metadata: Record<string, string>): FileMetadata[] => {\n const fileMetadata = metadata['fileSharingMetadata'];\n if (!fileMetadata) {\n return [];\n }\n try {\n return JSON.parse(fileMetadata);\n } catch (e) {\n console.error(e);\n return [];\n }\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractTeamsAttachmentsMetadata = (\n attachments: ChatAttachment[]\n): { files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {\n const files: FileMetadata[] = [];\n const inlineImages: InlineImageMetadata[] = [];\n attachments.forEach((attachment) => {\n const attachmentType = mapAttachmentType(attachment.attachmentType);\n if (attachmentType === 'inlineImage') {\n inlineImages.push({\n attachmentType: attachmentType,\n id: attachment.id,\n url: extractAttachmentUrl(attachment),\n previewUrl: attachment.previewUrl\n });\n } else if (attachmentType === 'file') {\n files.push({\n attachmentType: attachmentType,\n id: attachment.id,\n name: attachment.name ?? '',\n extension: attachment.contentType ?? '',\n url: extractAttachmentUrl(attachment),\n payload: { teamsFileAttachment: 'true' }\n });\n }\n });\n return { files, inlineImages };\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst mapAttachmentType = (attachmentType: AttachmentType): ChatAttachmentType => {\n if (attachmentType === 'teamsImage' || attachmentType === 'teamsInlineImage') {\n return 'inlineImage';\n } else if (attachmentType === 'file') {\n return 'file';\n }\n return 'unknown';\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractAttachmentUrl = (attachment: ChatAttachment): string => {\n return attachment.attachmentType === 'file' && attachment.previewUrl ? attachment.previewUrl : attachment.url;\n};\n\nconst processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (sanitizedMessageContentType(message.type).includes('html') && message.content?.attachments) {\n const attachments: ChatAttachment[] = message.content?.attachments;\n const teamsImageHtmlContent = attachments\n .filter((attachment) => attachment.attachmentType === 'teamsImage')\n .map((attachment) => generateImageAttachmentImgHtml(attachment))\n .join('');\n\n if (teamsImageHtmlContent) {\n return (message.content?.message ?? '') + teamsImageHtmlContent;\n }\n }\n return message.content?.message;\n};\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst generateImageAttachmentImgHtml = (attachment: ChatAttachment): string => {\n return `\\r\\n<p><img alt=\"image\" src=\"\" itemscope=\"${attachment.contentType}\" id=\"${attachment.id}\"></p>`;\n};\n\n/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nconst extractAttachmentsMetadata = (\n message: ChatMessageWithStatus\n): { files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {\n let files: FileMetadata[] = [];\n let inlineImages: InlineImageMetadata[] = [];\n\n /* @conditional-compile-remove(file-sharing) */\n if (message.metadata) {\n files = files.concat(extractAttachedFilesMetadata(message.metadata));\n }\n\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (message.content?.attachments) {\n const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);\n files = files.concat(teamsAttachments.files);\n inlineImages = inlineImages.concat(teamsAttachments.inlineImages);\n }\n\n return { files, inlineImages };\n};\n\n/* @conditional-compile-remove(data-loss-prevention) */\nconst convertToUiBlockedMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): 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\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;\n /* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n const { files, inlineImages } = 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) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n files,\n /* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n inlineImages\n };\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:\n 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) => participant.displayName && participant.displayName !== '')\n .map(\n (participant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\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 = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\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 =>\n !!chatMessage.content?.participants && chatMessage.content.participants.some((p) => !!p.displayName);\n\n/**\n *\n * @private\n */\nexport const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>\n createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],\n (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\n ? undefined\n : 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\n .filter((r) => r.sender && toFlatCommunicationIdentifier(r.sender) !== userId)\n .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) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n (message.type === ACSKnownMessageType.participantAdded && hasValidParticipant(message)) ||\n (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\n )\n .filter(isMessageValidToRender)\n .map((message) => {\n return memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n );\n })\n );\n\n updateMessagesWithAttached(convertedMessages);\n return {\n userId,\n showMessageStatus: true,\n messages: convertedMessages,\n participantCount,\n readReceiptsBySenderId\n };\n }\n );\n\nconst sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nconst isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {\n if (message.deletedOn) {\n return false;\n }\n if (\n message.metadata?.['fileSharingMetadata'] ||\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ message.content?.attachments\n ) {\n return true;\n }\n /* @conditional-compile-remove(data-loss-prevention) */\n if (message.policyViolation) {\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();\n"]}
@@ -9,7 +9,7 @@ export declare const ChatClientContext: React.Context<StatefulChatClient | undef
9
9
  *
10
10
  * @public
11
11
  */
12
- export declare type ChatClientProviderProps = {
12
+ export type ChatClientProviderProps = {
13
13
  children: React.ReactNode;
14
14
  chatClient: StatefulChatClient;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChatClientProvider.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/providers/ChatClientProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAY1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAe,EAAE;IAChF,OAAO,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,UAAU,IAAG,KAAK,CAAC,QAAQ,CAA8B,CAAC;AAC5G,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAuB,EAAE;IACpD,MAAM,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,sGAAsG,CAAC;KAC9G;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n\n/**\n * @private\n */\nexport const ChatClientContext = createContext<StatefulChatClient | undefined>(undefined);\n\n/**\n * Arguments to initialize a {@link ChatClientProvider}.\n *\n * @public\n */\nexport type ChatClientProviderProps = {\n children: React.ReactNode;\n chatClient: StatefulChatClient;\n};\n\n/**\n * A {@link React.Context} that stores a {@link StatefulChatClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatClientProvider}.\n *\n * @public\n */\nexport const ChatClientProvider = (props: ChatClientProviderProps): JSX.Element => {\n return <ChatClientContext.Provider value={props.chatClient}>{props.children}</ChatClientContext.Provider>;\n};\n\n/**\n * Hook to obtain {@link StatefulChatClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatClient = (): StatefulChatClient => {\n const chatClient = useContext(ChatClientContext);\n if (!chatClient) {\n throw 'Please wrap components with ChatClientProvider and initialize a chat client before calling the hook!';\n }\n return chatClient;\n};\n\"../../../chat-stateful-client/src\""]}
1
+ {"version":3,"file":"ChatClientProvider.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/providers/ChatClientProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAY1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAe,EAAE;IAChF,OAAO,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,UAAU,IAAG,KAAK,CAAC,QAAQ,CAA8B,CAAC;AAC5G,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAuB,EAAE;IACpD,MAAM,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,sGAAsG,CAAC;IAC/G,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n\n/**\n * @private\n */\nexport const ChatClientContext = createContext<StatefulChatClient | undefined>(undefined);\n\n/**\n * Arguments to initialize a {@link ChatClientProvider}.\n *\n * @public\n */\nexport type ChatClientProviderProps = {\n children: React.ReactNode;\n chatClient: StatefulChatClient;\n};\n\n/**\n * A {@link React.Context} that stores a {@link StatefulChatClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatClientProvider}.\n *\n * @public\n */\nexport const ChatClientProvider = (props: ChatClientProviderProps): JSX.Element => {\n return <ChatClientContext.Provider value={props.chatClient}>{props.children}</ChatClientContext.Provider>;\n};\n\n/**\n * Hook to obtain {@link StatefulChatClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatClient = (): StatefulChatClient => {\n const chatClient = useContext(ChatClientContext);\n if (!chatClient) {\n throw 'Please wrap components with ChatClientProvider and initialize a chat client before calling the hook!';\n }\n return chatClient;\n};\n"]}
@@ -9,7 +9,7 @@ export declare const ChatThreadClientContext: React.Context<ChatThreadClient | u
9
9
  *
10
10
  * @public
11
11
  */
12
- export declare type ChatThreadClientProviderProps = {
12
+ export type ChatThreadClientProviderProps = {
13
13
  children: React.ReactNode;
14
14
  chatThreadClient: ChatThreadClient;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChatThreadClientProvider.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/providers/ChatThreadClientProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAY9F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;IAC5F,OAAO,CACL,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,IAAG,KAAK,CAAC,QAAQ,CAAoC,CACrH,CAAC;AACJ,CAAC,CAAC;AACF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,MAAM,gBAAgB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,mHAAmH,CAAC;KAC3H;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { ChatThreadClient } from '@azure/communication-chat';\n\n/**\n * @private\n */\nexport const ChatThreadClientContext = createContext<ChatThreadClient | undefined>(undefined);\n\n/**\n * Arguments to initialize a {@link ChatThreadClientProvider}.\n *\n * @public\n */\nexport type ChatThreadClientProviderProps = {\n children: React.ReactNode;\n chatThreadClient: ChatThreadClient;\n};\n\n/**\n * A {@link React.Context} that stores a {@link @azure/communication-chat#ChatThreadClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatThreadClientProvider}.\n *\n * @public\n */\nexport const ChatThreadClientProvider = (props: ChatThreadClientProviderProps): JSX.Element => {\n return (\n <ChatThreadClientContext.Provider value={props.chatThreadClient}>{props.children}</ChatThreadClientContext.Provider>\n );\n};\n/**\n * Hook to obtain {@link @azure/communication-chat#ChatThreadClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatThreadClient = (): ChatThreadClient => {\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient) {\n throw 'Please wrap components with ChatThreadClientProvider and initialize a chat thread client before calling the hook.';\n }\n return chatThreadClient;\n};\n"]}
1
+ {"version":3,"file":"ChatThreadClientProvider.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/providers/ChatThreadClientProvider.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAY9F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;IAC5F,OAAO,CACL,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,IAAG,KAAK,CAAC,QAAQ,CAAoC,CACrH,CAAC;AACJ,CAAC,CAAC;AACF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,MAAM,gBAAgB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,mHAAmH,CAAC;IAC5H,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { createContext, useContext } from 'react';\nimport { ChatThreadClient } from '@azure/communication-chat';\n\n/**\n * @private\n */\nexport const ChatThreadClientContext = createContext<ChatThreadClient | undefined>(undefined);\n\n/**\n * Arguments to initialize a {@link ChatThreadClientProvider}.\n *\n * @public\n */\nexport type ChatThreadClientProviderProps = {\n children: React.ReactNode;\n chatThreadClient: ChatThreadClient;\n};\n\n/**\n * A {@link React.Context} that stores a {@link @azure/communication-chat#ChatThreadClient}.\n *\n * Chat components from this package must be wrapped with a {@link ChatThreadClientProvider}.\n *\n * @public\n */\nexport const ChatThreadClientProvider = (props: ChatThreadClientProviderProps): JSX.Element => {\n return (\n <ChatThreadClientContext.Provider value={props.chatThreadClient}>{props.children}</ChatThreadClientContext.Provider>\n );\n};\n/**\n * Hook to obtain {@link @azure/communication-chat#ChatThreadClient} from the provider.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useChatThreadClient = (): ChatThreadClient => {\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient) {\n throw 'Please wrap components with ChatThreadClientProvider and initialize a chat thread client before calling the hook.';\n }\n return chatThreadClient;\n};\n"]}
@@ -5,7 +5,7 @@ import { ChatBaseSelectorProps } from './baseSelectors';
5
5
  *
6
6
  * @public
7
7
  */
8
- export declare type SendBoxSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
8
+ export type SendBoxSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
9
9
  displayName: string;
10
10
  userId: string;
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sendBoxSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/sendBoxSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAyB,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAenF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB,cAAc,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACpH,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,MAAM;CACf,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState } from '@internal/chat-stateful-client';\nimport { createSelector } from 'reselect';\nimport { ChatBaseSelectorProps, getDisplayName, getUserId } from './baseSelectors';\n\n/**\n * Selector type for {@link SendBox} component.\n *\n * @public\n */\nexport type SendBoxSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n displayName: string;\n userId: string;\n};\n\n/**\n * Selector for {@link SendBox} component.\n *\n * @public\n */\nexport const sendBoxSelector: SendBoxSelector = createSelector([getUserId, getDisplayName], (userId, displayName) => ({\n displayName: displayName,\n userId: userId\n}));\n\"../../chat-stateful-client/src\""]}
1
+ {"version":3,"file":"sendBoxSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/sendBoxSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAyB,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAenF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB,cAAc,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACpH,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,MAAM;CACf,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState } from '@internal/chat-stateful-client';\nimport { createSelector } from 'reselect';\nimport { ChatBaseSelectorProps, getDisplayName, getUserId } from './baseSelectors';\n\n/**\n * Selector type for {@link SendBox} component.\n *\n * @public\n */\nexport type SendBoxSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n displayName: string;\n userId: string;\n};\n\n/**\n * Selector for {@link SendBox} component.\n *\n * @public\n */\nexport const sendBoxSelector: SendBoxSelector = createSelector([getUserId, getDisplayName], (userId, displayName) => ({\n displayName: displayName,\n userId: userId\n}));\n"]}
@@ -6,7 +6,7 @@ import { ChatClientState } from "../../chat-stateful-client/src";
6
6
  *
7
7
  * @public
8
8
  */
9
- export declare type TypingIndicatorSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
9
+ export type TypingIndicatorSelector = (state: ChatClientState, props: ChatBaseSelectorProps) => {
10
10
  typingUsers: CommunicationParticipant[];
11
11
  };
12
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"typingIndicatorSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/typingIndicatorSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,EAAyB,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,uCAAuC,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGpG,MAAM,sBAAsB,GAAG,CAC7B,gBAAgD,EAChD,MAAc,EACkB,EAAE;IAClC,MAAM,wBAAwB,GAAmC,EAAE,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,uCAAuC,CAAC,CAAC;IACvF,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACrD,MAAM,eAAe,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE;YACpE,SAAS;SACV;QACD,IAAI,eAAe,CAAC,UAAU,GAAG,eAAe,EAAE;YAChD,SAAS;SACV;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE;YACnE,SAAS;SACV;QACD,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,wBAAwB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KAChD;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,qDAAqD,GAAG,CAC5D,gBAAgD,EAChD,YAAgD,EACpB,EAAE;IAC9B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE;;QAAC,OAAA,CAAC;YAChD,MAAM,EAAE,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC;YAC7D,WAAW,EAAE,MAAA,YAAY,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,0CAAE,WAAW;SAC9F,CAAC,CAAA;KAAA,CAAC,CAAC;AACN,CAAC,CAAC;AAcF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA4B,cAAc,CAC5E,CAAC,mBAAmB,EAAE,eAAe,EAAE,SAAS,CAAC,EACjD,CACE,gBAAgD,EAChD,YAAgD,EAChD,MAAc,EACd,EAAE;IACF,4EAA4E;IAC5E,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,IAAI,sBAAsB,EAAE;QAChE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;KAC5B;IAED,qIAAqI;IACrI,MAAM,wBAAwB,GAAG,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAElF,MAAM,WAAW,GAA+B,qDAAqD,CACnG,wBAAwB,EACxB,YAAY,CACb,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC,CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getTypingIndicators, getParticipants, getUserId, ChatBaseSelectorProps } from './baseSelectors';\nimport { createSelector } from 'reselect';\nimport { ChatParticipant } from '@azure/communication-chat';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CommunicationParticipant } from '@internal/react-components';\nimport { MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS, PARTICIPANTS_THRESHOLD } from './utils/constants';\nimport { ChatClientState } from '@internal/chat-stateful-client';\n\nconst filterTypingIndicators = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n userId: string\n): TypingIndicatorReceivedEvent[] => {\n const filteredTypingIndicators: TypingIndicatorReceivedEvent[] = [];\n const seen = new Set();\n const date8SecondsAgo = new Date(Date.now() - MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS);\n for (let i = typingIndicators.length - 1; i >= 0; i--) {\n const typingIndicator = typingIndicators[i];\n if (toFlatCommunicationIdentifier(typingIndicator.sender) === userId) {\n continue;\n }\n if (typingIndicator.receivedOn < date8SecondsAgo) {\n continue;\n }\n if (seen.has(toFlatCommunicationIdentifier(typingIndicator.sender))) {\n continue;\n }\n seen.add(toFlatCommunicationIdentifier(typingIndicator.sender));\n filteredTypingIndicators.push(typingIndicator);\n }\n return filteredTypingIndicators;\n};\n\nconst convertSdkTypingIndicatorsToCommunicationParticipants = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant }\n): CommunicationParticipant[] => {\n return typingIndicators.map((typingIndicator) => ({\n userId: toFlatCommunicationIdentifier(typingIndicator.sender),\n displayName: participants[toFlatCommunicationIdentifier(typingIndicator.sender)]?.displayName\n }));\n};\n\n/**\n * Selector type for {@link TypingIndicator} component.\n *\n * @public\n */\nexport type TypingIndicatorSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n typingUsers: CommunicationParticipant[];\n};\n\n/**\n * Selector for {@link TypingIndicator} component.\n *\n * @public\n */\nexport const typingIndicatorSelector: TypingIndicatorSelector = createSelector(\n [getTypingIndicators, getParticipants, getUserId],\n (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant },\n userId: string\n ) => {\n // if the participant size reaches the threshold then return no typing users\n if (Object.values(participants).length >= PARTICIPANTS_THRESHOLD) {\n return { typingUsers: [] };\n }\n\n // filter typing indicators to remove those that are from the duplicate users or current user as well as those older than a threshold\n const filteredTypingIndicators = filterTypingIndicators(typingIndicators, userId);\n\n const typingUsers: CommunicationParticipant[] = convertSdkTypingIndicatorsToCommunicationParticipants(\n filteredTypingIndicators,\n participants\n );\n\n return { typingUsers };\n }\n);\n\"../../acs-ui-common/src\"\"../../react-components/src\"\"../../chat-stateful-client/src\""]}
1
+ {"version":3,"file":"typingIndicatorSelector.js","sourceRoot":"","sources":["../../../../../chat-component-bindings/src/typingIndicatorSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,EAAyB,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,6BAA6B,EAAE,gCAAgC;AAExE,OAAO,EAAE,uCAAuC,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGpG,MAAM,sBAAsB,GAAG,CAC7B,gBAAgD,EAChD,MAAc,EACkB,EAAE;IAClC,MAAM,wBAAwB,GAAmC,EAAE,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,uCAAuC,CAAC,CAAC;IACvF,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtD,MAAM,eAAe,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;YACrE,SAAS;QACX,CAAC;QACD,IAAI,eAAe,CAAC,UAAU,GAAG,eAAe,EAAE,CAAC;YACjD,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YACpE,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,wBAAwB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,qDAAqD,GAAG,CAC5D,gBAAgD,EAChD,YAAgD,EACpB,EAAE;IAC9B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE;;QAAC,OAAA,CAAC;YAChD,MAAM,EAAE,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC;YAC7D,WAAW,EAAE,MAAA,YAAY,CAAC,6BAA6B,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,0CAAE,WAAW;SAC9F,CAAC,CAAA;KAAA,CAAC,CAAC;AACN,CAAC,CAAC;AAcF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA4B,cAAc,CAC5E,CAAC,mBAAmB,EAAE,eAAe,EAAE,SAAS,CAAC,EACjD,CACE,gBAAgD,EAChD,YAAgD,EAChD,MAAc,EACd,EAAE;IACF,4EAA4E;IAC5E,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,IAAI,sBAAsB,EAAE,CAAC;QACjE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,qIAAqI;IACrI,MAAM,wBAAwB,GAAG,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAElF,MAAM,WAAW,GAA+B,qDAAqD,CACnG,wBAAwB,EACxB,YAAY,CACb,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC,CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getTypingIndicators, getParticipants, getUserId, ChatBaseSelectorProps } from './baseSelectors';\nimport { createSelector } from 'reselect';\nimport { ChatParticipant } from '@azure/communication-chat';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CommunicationParticipant } from '@internal/react-components';\nimport { MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS, PARTICIPANTS_THRESHOLD } from './utils/constants';\nimport { ChatClientState } from '@internal/chat-stateful-client';\n\nconst filterTypingIndicators = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n userId: string\n): TypingIndicatorReceivedEvent[] => {\n const filteredTypingIndicators: TypingIndicatorReceivedEvent[] = [];\n const seen = new Set();\n const date8SecondsAgo = new Date(Date.now() - MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS);\n for (let i = typingIndicators.length - 1; i >= 0; i--) {\n const typingIndicator = typingIndicators[i];\n if (toFlatCommunicationIdentifier(typingIndicator.sender) === userId) {\n continue;\n }\n if (typingIndicator.receivedOn < date8SecondsAgo) {\n continue;\n }\n if (seen.has(toFlatCommunicationIdentifier(typingIndicator.sender))) {\n continue;\n }\n seen.add(toFlatCommunicationIdentifier(typingIndicator.sender));\n filteredTypingIndicators.push(typingIndicator);\n }\n return filteredTypingIndicators;\n};\n\nconst convertSdkTypingIndicatorsToCommunicationParticipants = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant }\n): CommunicationParticipant[] => {\n return typingIndicators.map((typingIndicator) => ({\n userId: toFlatCommunicationIdentifier(typingIndicator.sender),\n displayName: participants[toFlatCommunicationIdentifier(typingIndicator.sender)]?.displayName\n }));\n};\n\n/**\n * Selector type for {@link TypingIndicator} component.\n *\n * @public\n */\nexport type TypingIndicatorSelector = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n) => {\n typingUsers: CommunicationParticipant[];\n};\n\n/**\n * Selector for {@link TypingIndicator} component.\n *\n * @public\n */\nexport const typingIndicatorSelector: TypingIndicatorSelector = createSelector(\n [getTypingIndicators, getParticipants, getUserId],\n (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant },\n userId: string\n ) => {\n // if the participant size reaches the threshold then return no typing users\n if (Object.values(participants).length >= PARTICIPANTS_THRESHOLD) {\n return { typingUsers: [] };\n }\n\n // filter typing indicators to remove those that are from the duplicate users or current user as well as those older than a threshold\n const filteredTypingIndicators = filterTypingIndicators(typingIndicators, userId);\n\n const typingUsers: CommunicationParticipant[] = convertSdkTypingIndicatorsToCommunicationParticipants(\n filteredTypingIndicators,\n participants\n );\n\n return { typingUsers };\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compareMessages.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/compareMessages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAqB,EAAE,aAAsB,EAAU,EAAE;IACvF,IAAI,YAAY,CAAC,SAAS,KAAK,SAAS,EAAE;QACxC,OAAO,CAAC,CAAC;KACV;IACD,IAAI,aAAa,CAAC,SAAS,KAAK,SAAS,EAAE;QACzC,OAAO,CAAC,CAAC,CAAC;KACX;IACD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC/D,8FAA8F;IAC9F,+FAA+F;IAC/F,MAAM,OAAO,GACX,YAAY,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS;QAC/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC;QACpF,CAAC,CAAC,CAAC,CAAC;IACR,OAAO,SAAS,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC;AACzE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Message } from '@internal/react-components';\n\n/**\n * @private\n */\nexport const compareMessages = (firstMessage: Message, secondMessage: Message): number => {\n if (firstMessage.createdOn === undefined) {\n return 1;\n }\n if (secondMessage.createdOn === undefined) {\n return -1;\n }\n const firstDate = new Date(firstMessage.createdOn).getTime();\n const secondDate = new Date(secondMessage.createdOn).getTime();\n // Workaround to get a stable order of message before we can get sequenceId from chat service.\n // MessageIds are generated by time order the message persist, a good candidate other than time\n const idDelta =\n firstMessage.messageId && secondMessage.messageId\n ? Number.parseInt(firstMessage.messageId) - Number.parseInt(secondMessage.messageId)\n : 0;\n return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate;\n};\n\"../../../react-components/src\""]}
1
+ {"version":3,"file":"compareMessages.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/utils/compareMessages.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAqB,EAAE,aAAsB,EAAU,EAAE;IACvF,IAAI,YAAY,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,aAAa,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IAC/D,8FAA8F;IAC9F,+FAA+F;IAC/F,MAAM,OAAO,GACX,YAAY,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS;QAC/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC;QACpF,CAAC,CAAC,CAAC,CAAC;IACR,OAAO,SAAS,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC;AACzE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Message } from '@internal/react-components';\n\n/**\n * @private\n */\nexport const compareMessages = (firstMessage: Message, secondMessage: Message): number => {\n if (firstMessage.createdOn === undefined) {\n return 1;\n }\n if (secondMessage.createdOn === undefined) {\n return -1;\n }\n const firstDate = new Date(firstMessage.createdOn).getTime();\n const secondDate = new Date(secondMessage.createdOn).getTime();\n // Workaround to get a stable order of message before we can get sequenceId from chat service.\n // MessageIds are generated by time order the message persist, a good candidate other than time\n const idDelta =\n firstMessage.messageId && secondMessage.messageId\n ? Number.parseInt(firstMessage.messageId) - Number.parseInt(secondMessage.messageId)\n : 0;\n return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateMessagesWithAttached.js","sourceRoot":"","sources":["../../../../../../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;IAE7C,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;;QAC1D,IACE,OAAO,CAAC,WAAW,KAAK,MAAM;YAC9B,uDA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OAAO,CAAC,QAAQ,EAAE;gBACzC,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;aAC9D;iBAAM,IAAI,QAAQ,IAAI,QAAQ,IAAI,CAAC,EAAE;gBACpC,wGAAwG;gBACxG,QAAQ,GAAG,KAAK,CAAC;aAClB;iBAAM;gBACL,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;aAChE;YAED,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC7B;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\n chatMessagesWithStatus.forEach((message, index, messages) => {\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\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\n const previousSenderId =\n previousMessage?.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ previousMessage?.messageType === 'blocked'\n ? previousMessage.senderId\n : undefined;\n const nextSenderId =\n nextMessage?.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ nextMessage?.messageType === 'blocked'\n ? nextMessage.senderId\n : undefined;\n\n const timediff =\n new Date(message?.createdOn ?? '').getTime() - new Date(previousMessage?.createdOn ?? '').getTime();\n\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\n message.attached = attached;\n }\n });\n};\n\"../../../react-components/src\""]}
1
+ {"version":3,"file":"updateMessagesWithAttached.js","sourceRoot":"","sources":["../../../../../../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;IAE7C,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;;QAC1D,IACE,OAAO,CAAC,WAAW,KAAK,MAAM;YAC9B,uDAAuD,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,EACzF,CAAC;YACD;;;;;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;YAEpF,MAAM,gBAAgB,GACpB,CAAA,eAAe,aAA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,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\n chatMessagesWithStatus.forEach((message, index, messages) => {\n if (\n message.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'\n ) {\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\n const previousSenderId =\n previousMessage?.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ previousMessage?.messageType === 'blocked'\n ? previousMessage.senderId\n : undefined;\n const nextSenderId =\n nextMessage?.messageType === 'chat' ||\n /* @conditional-compile-remove(data-loss-prevention) */ nextMessage?.messageType === 'blocked'\n ? nextMessage.senderId\n : undefined;\n\n const timediff =\n new Date(message?.createdOn ?? '').getTime() - new Date(previousMessage?.createdOn ?? '').getTime();\n\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\n message.attached = attached;\n }\n });\n};\n"]}
@@ -7,7 +7,7 @@ import { TypingIndicatorReceivedEvent } from '@azure/communication-chat';
7
7
  *
8
8
  * @public
9
9
  */
10
- export declare type ChatClientState = {
10
+ export type ChatClientState = {
11
11
  /**
12
12
  * Identifier of the current user.
13
13
  */
@@ -36,7 +36,7 @@ export declare type ChatClientState = {
36
36
  *
37
37
  * @public
38
38
  */
39
- export declare type ChatThreadClientState = {
39
+ export type ChatThreadClientState = {
40
40
  /**
41
41
  * Messages in this thread.
42
42
  * Object with {@link ChatMessageWithStatus} entries
@@ -84,7 +84,7 @@ export declare type ChatThreadClientState = {
84
84
  *
85
85
  * @public
86
86
  */
87
- export declare type ChatThreadProperties = {
87
+ export type ChatThreadProperties = {
88
88
  topic?: string;
89
89
  };
90
90
  /**
@@ -94,7 +94,7 @@ export declare type ChatThreadProperties = {
94
94
  *
95
95
  * @public
96
96
  */
97
- export declare type ChatErrors = {
97
+ export type ChatErrors = {
98
98
  [target in ChatErrorTarget]: ChatError;
99
99
  };
100
100
  /**
@@ -122,5 +122,5 @@ export declare class ChatError extends Error {
122
122
  *
123
123
  * @public
124
124
  */
125
- export declare 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';
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';
126
126
  //# sourceMappingURL=ChatClientState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,YAAY,EAAE,CAAC;AACf,qDAAqD;AACrD,aAAa,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,OAAO,WAAW;IAYtB,YAAY,YAAqB;QAXzB,WAAM,GAAoB;YAChC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAA2B;YAC3C,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,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IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;YACzB,IAAI,WAAW,EAAE,KAAK,SAAS,EAAE;gBAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;aAC9E;YACD,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;SACzB;IACH,CAAC;IAEM,aAAa,CAAC,OAAyC;QAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACrC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport EventEmitter from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @private\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n\n constructor(maxListeners?: number) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n\"../../acs-ui-common/src\""]}
1
+ {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ChatContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACpE,OAAO,EAML,SAAS,EACV,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAe,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,gCAAgC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,YAAY,EAAE,CAAC;AACf,qDAAqD;AACrD,aAAa,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,OAAO,WAAW;IAYtB,YAAY,YAAqB;QAXzB,WAAM,GAAoB;YAChC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAA2B;YAC3C,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAgB;SAC/B,CAAC;QACM,eAAU,GAAG,KAAK,CAAC;QAGnB,4BAAuB,GAAuB,SAAS,CAAC;QAG9D,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,kCAAkC,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,IAAI,YAAY,EAAE,CAAC;YACjB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH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AI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;YACzB,IAAI,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC/E,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IAEM,aAAa,CAAC,OAAyC;QAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAc,EAAa,EAAE;IACzE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport EventEmitter from 'events';\nimport { enableMapSet, enablePatches, produce, Patch } from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { AzureLogger, createClientLogger, getLogLevel } from '@azure/logger';\nimport { _safeJSONStringify, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-chat';\nimport { chatStatefulLogger } from './Logger';\n\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @private\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: { id: '' } as UnknownIdentifierKind,\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _logger: AzureLogger;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n\n constructor(maxListeners?: number) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: (draft: ChatClientState) => void): void {\n const priorState = this._state;\n this._state = produce(this._state, modifier, (patches: Patch[]) => {\n if (getLogLevel() === 'verbose') {\n // Log to `info` because AzureLogger.verbose() doesn't show up in console.\n this._logger.info(`State change: ${_safeJSONStringify(patches)}`);\n }\n });\n if (!this._batchMode && this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n });\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n });\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n });\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n });\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.modifyState((draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n });\n }\n\n public deleteThread(threadId: string): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n });\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.modifyState((draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n });\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n });\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n });\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.modifyState((draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n });\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n });\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n });\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n });\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.modifyState((draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n });\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n });\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (this.typingIndicatorInterval) {\n return;\n }\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n this.modifyState((draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.modifyState((draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n });\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.modifyState((draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n });\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n return await f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n chatStatefulLogger.info(`Chat stateful client target function called: ${target}`);\n return f(...args);\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.modifyState((draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n });\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) {\n return;\n }\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n if (getLogLevel() === 'verbose') {\n this._logger.warning(`State rollback to: ${_safeJSONStringify(priorState)}`);\n }\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n"]}
@@ -38,7 +38,7 @@ export class EventSubscriber {
38
38
  type: this.convertEventType(event.type),
39
39
  sender: event.sender,
40
40
  senderDisplayName: event.senderDisplayName,
41
- sequenceId: '',
41
+ sequenceId: '', // 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
44
  metadata: event.metadata
@@ -92,12 +92,14 @@ export class EventSubscriber {
92
92
  // This is a temporary fix that no participant message is received for onChatMessageReceived event, which should be handled by JS SDK.
93
93
  // Without the temporary fix, there are missing 'participant joined' and 'participant left' system messages in the chat thread.
94
94
  this.fetchLastParticipantMessage = (threadId, actionType) => __awaiter(this, void 0, void 0, function* () {
95
- var e_1, _a;
95
+ var _a, e_1, _b, _c;
96
96
  try {
97
- for (var _b = __asyncValues(this.chatClient
97
+ for (var _d = true, _e = __asyncValues(this.chatClient
98
98
  .getChatThreadClient(threadId)
99
- .listMessages({ startTime: new Date(Date.now() - maxSyncTimeInMs) })), _c; _c = yield _b.next(), !_c.done;) {
100
- const message = _c.value;
99
+ .listMessages({ startTime: new Date(Date.now() - maxSyncTimeInMs) })), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
100
+ _c = _f.value;
101
+ _d = false;
102
+ const message = _c;
101
103
  if (message.type === actionType) {
102
104
  this.chatContext.setChatMessage(threadId, Object.assign(Object.assign({}, message), { status: 'delivered' }));
103
105
  }
@@ -106,7 +108,7 @@ export class EventSubscriber {
106
108
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
107
109
  finally {
108
110
  try {
109
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
111
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
110
112
  }
111
113
  finally { if (e_1) throw e_1.error; }
112
114
  }