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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (538) hide show
  1. package/dist/communication-react.d.ts +143 -1785
  2. package/dist/dist-cjs/communication-react/index.js +9016 -14017
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/common.d.ts +5 -0
  5. package/dist/dist-esm/acs-ui-common/src/common.js +7 -0
  6. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/index.d.ts +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  12. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +1 -2
  13. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +0 -5
  14. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts +0 -12
  16. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +1 -13
  17. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
  18. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js +0 -4
  19. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js.map +1 -1
  20. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +1 -10
  21. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +0 -14
  22. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  23. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js +0 -10
  24. package/dist/dist-esm/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.js.map +1 -1
  25. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +1 -15
  26. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  27. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +1 -3
  28. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +0 -12
  29. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  30. package/dist/dist-esm/calling-component-bindings/src/index.d.ts +0 -6
  31. package/dist/dist-esm/calling-component-bindings/src/index.js +0 -8
  32. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
  33. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +0 -1
  34. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +2 -8
  35. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
  36. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.d.ts +3 -4
  37. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js.map +1 -1
  38. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.d.ts +2 -14
  39. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js +1 -20
  40. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js.map +1 -1
  41. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +0 -7
  42. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js +0 -12
  43. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
  44. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +1 -1
  45. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +2 -7
  46. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  47. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.d.ts +1 -1
  48. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +0 -3
  49. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  50. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.d.ts +5 -6
  51. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js.map +1 -1
  52. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +1 -15
  53. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  54. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +1 -2
  55. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +0 -5
  56. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  57. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -22
  58. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  59. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +1 -5
  60. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +2 -39
  61. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  62. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +0 -1
  63. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +0 -8
  64. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  65. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -6
  66. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  67. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.d.ts +0 -1
  68. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js +0 -8
  69. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js.map +1 -1
  70. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +2 -25
  71. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +2 -33
  72. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  73. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +2 -2
  74. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +0 -8
  75. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  76. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +0 -2
  77. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  78. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +1 -5
  79. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  80. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +21 -131
  81. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  82. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +3 -3
  83. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
  84. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +1 -1
  85. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js.map +1 -1
  86. package/dist/dist-esm/chat-stateful-client/src/ChatContext.d.ts +1 -1
  87. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +28 -9
  88. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  89. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.d.ts +23 -14
  90. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +91 -70
  91. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  92. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js +1 -1
  93. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js.map +1 -1
  94. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js +1 -4
  95. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js.map +1 -1
  96. package/dist/dist-esm/chat-stateful-client/src/index.d.ts +1 -0
  97. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  98. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +9 -2
  99. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
  100. package/dist/dist-esm/communication-react/src/index.d.ts +2 -23
  101. package/dist/dist-esm/communication-react/src/index.js +0 -12
  102. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  103. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +4 -4
  104. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -1
  105. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +1 -13
  106. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js +3 -7
  107. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
  108. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +1 -6
  109. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +21 -60
  110. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
  111. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +1 -17
  112. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +4 -30
  113. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
  114. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +1 -8
  115. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +2 -10
  116. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  117. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +3 -14
  118. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +23 -57
  119. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  120. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.d.ts +1 -2
  121. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js +6 -25
  122. package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +1 -1
  123. package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +3 -32
  124. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +5 -27
  125. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
  126. package/dist/dist-esm/react-components/src/components/ImageOverlay.d.ts +3 -3
  127. package/dist/dist-esm/react-components/src/components/ImageOverlay.js +14 -10
  128. package/dist/dist-esm/react-components/src/components/ImageOverlay.js.map +1 -1
  129. package/dist/dist-esm/react-components/src/components/InputBoxButton.d.ts +1 -0
  130. package/dist/dist-esm/react-components/src/components/InputBoxButton.js +2 -2
  131. package/dist/dist-esm/react-components/src/components/InputBoxButton.js.map +1 -1
  132. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +0 -2
  133. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +0 -18
  134. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  135. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +2 -40
  136. package/dist/dist-esm/react-components/src/components/MessageThread.js +3 -14
  137. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  138. package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts +0 -13
  139. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +0 -3
  140. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  141. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +0 -15
  142. package/dist/dist-esm/react-components/src/components/ParticipantList.js +4 -22
  143. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  144. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +1 -3
  145. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
  146. package/dist/dist-esm/react-components/src/components/SendBox.d.ts +0 -42
  147. package/dist/dist-esm/react-components/src/components/SendBox.js +8 -63
  148. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  149. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js +1 -1
  150. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +1 -1
  151. package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js +0 -2
  152. package/dist/dist-esm/react-components/src/components/UnsupportedBrowser.js.map +1 -1
  153. package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js +0 -2
  154. package/dist/dist-esm/react-components/src/components/UnsupportedBrowserVersion.js.map +1 -1
  155. package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js +0 -24
  156. package/dist/dist-esm/react-components/src/components/UnsupportedEnvironment.js.map +1 -1
  157. package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js +0 -2
  158. package/dist/dist-esm/react-components/src/components/UnsupportedOperatingSystem.js.map +1 -1
  159. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +3 -4
  160. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  161. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +4 -5
  162. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  163. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +0 -1
  164. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
  165. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js +4 -5
  166. package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
  167. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +4 -21
  168. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  169. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +2 -2
  170. package/dist/dist-esm/react-components/src/components/VideoGallery.js +5 -12
  171. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  172. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +0 -7
  173. package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -7
  174. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  175. package/dist/dist-esm/react-components/src/components/index.d.ts +0 -15
  176. package/dist/dist-esm/react-components/src/components/index.js +0 -10
  177. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  178. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.d.ts +4 -0
  179. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js +10 -0
  180. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js.map +1 -1
  181. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.d.ts +10 -4
  182. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js +17 -4
  183. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js.map +1 -1
  184. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +2 -2
  185. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +15 -1
  186. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +22 -12
  187. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  188. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +16 -0
  189. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +27 -0
  190. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -0
  191. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +1 -10
  192. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -15
  193. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  194. package/dist/dist-esm/react-components/src/components/utils/common.js +0 -4
  195. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  196. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +1 -2
  197. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
  198. package/dist/dist-esm/react-components/src/components/utils.d.ts +0 -6
  199. package/dist/dist-esm/react-components/src/components/utils.js +0 -8
  200. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  201. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +0 -4
  202. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +1 -5
  203. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
  204. package/dist/dist-esm/react-components/src/index.d.ts +0 -1
  205. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  206. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +0 -57
  207. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
  208. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +23 -4
  209. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +23 -4
  210. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +23 -4
  211. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +23 -4
  212. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -1
  213. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +23 -4
  214. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +23 -4
  215. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +23 -4
  216. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +23 -4
  217. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +23 -4
  218. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +25 -6
  219. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +23 -4
  220. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +23 -4
  221. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +23 -4
  222. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +23 -4
  223. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +23 -4
  224. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +23 -4
  225. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +23 -4
  226. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +23 -4
  227. package/dist/dist-esm/react-components/src/localization/locales/utils.js +2 -2
  228. package/dist/dist-esm/react-components/src/localization/locales/utils.js.map +1 -1
  229. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +23 -4
  230. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +23 -4
  231. package/dist/dist-esm/react-components/src/theming/icons.d.ts +0 -13
  232. package/dist/dist-esm/react-components/src/theming/icons.js +0 -102
  233. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  234. package/dist/dist-esm/react-components/src/theming/themes.d.ts +0 -6
  235. package/dist/dist-esm/react-components/src/theming/themes.js +0 -10
  236. package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
  237. package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js +7 -0
  238. package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js.map +1 -1
  239. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -34
  240. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  241. package/dist/dist-esm/react-components/src/types/OnRender.d.ts +0 -8
  242. package/dist/dist-esm/react-components/src/types/OnRender.js.map +1 -1
  243. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +0 -6
  244. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js +0 -2
  245. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js.map +1 -1
  246. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +39 -72
  247. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +5 -28
  248. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  249. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +4 -104
  250. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  251. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +6 -77
  252. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +7 -192
  253. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  254. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +2 -91
  255. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js +1 -1
  256. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  257. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js +7 -5
  258. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js.map +1 -1
  259. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +1 -2
  260. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js +1 -7
  261. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -1
  262. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +0 -5
  263. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +0 -2
  264. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  265. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +9 -33
  266. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  267. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.d.ts +0 -1
  268. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +2 -38
  269. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  270. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.d.ts +0 -2
  271. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js +0 -27
  272. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
  273. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js +2 -20
  274. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
  275. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.d.ts +0 -2
  276. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js +0 -27
  277. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
  278. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +0 -1
  279. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +5 -31
  280. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  281. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +2 -8
  282. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
  283. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.d.ts +1 -0
  284. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js +2 -2
  285. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js.map +1 -1
  286. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js +1 -10
  287. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js.map +1 -1
  288. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +2 -6
  289. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
  290. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +10 -21
  291. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  292. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +0 -4
  293. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +0 -2
  294. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  295. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +4 -33
  296. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  297. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +8 -7
  298. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +13 -82
  299. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  300. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js +1 -2
  301. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js.map +1 -1
  302. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +0 -5
  303. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +0 -5
  304. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  305. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js +0 -4
  306. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js.map +1 -1
  307. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/MediaGalleryUtils.js +0 -2
  308. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/MediaGalleryUtils.js.map +1 -1
  309. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js +7 -2
  310. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackCapabilityChangedNotifications.js.map +1 -1
  311. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +2 -14
  312. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +9 -96
  313. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  314. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +40 -61
  315. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +16 -32
  316. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  317. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.d.ts +0 -32
  318. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.js.map +1 -1
  319. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +4 -24
  320. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +3 -92
  321. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  322. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -53
  323. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  324. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +2 -10
  325. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +1 -34
  326. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  327. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +0 -9
  328. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +1 -31
  329. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  330. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +0 -22
  331. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +1 -9
  332. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  333. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +0 -20
  334. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +1 -3
  335. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  336. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +0 -1
  337. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +70 -76
  338. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  339. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +0 -4
  340. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
  341. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +1 -13
  342. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +0 -68
  343. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  344. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.d.ts +0 -28
  345. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js +1 -159
  346. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +1 -1
  347. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -13
  348. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  349. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -2
  350. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
  351. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +1 -1
  352. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js +1 -8
  353. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js.map +1 -1
  354. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +1 -3
  355. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  356. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +0 -3
  357. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  358. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.d.ts +1 -5
  359. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js +0 -15
  360. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
  361. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +0 -5
  362. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js +2 -3
  363. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
  364. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.d.ts +0 -1
  365. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +7 -21
  366. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  367. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.d.ts +10 -1
  368. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js +5 -1
  369. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -1
  370. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +1 -40
  371. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -1
  372. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DtmfDialerButton.js +0 -7
  373. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DtmfDialerButton.js.map +1 -1
  374. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionLanguageSettingsDrawer.d.ts +21 -0
  375. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionLanguageSettingsDrawer.js +45 -0
  376. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionLanguageSettingsDrawer.js.map +1 -0
  377. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +4 -37
  378. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  379. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.d.ts +0 -1
  380. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js +0 -1
  381. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -1
  382. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageSettingsDrawer.d.ts +21 -0
  383. package/dist/dist-esm/react-composites/src/composites/common/Drawer/{CaptionSettingsDrawer.js → SpokenLanguageSettingsDrawer.js} +4 -3
  384. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageSettingsDrawer.js.map +1 -0
  385. package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js +3 -3
  386. package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js.map +1 -1
  387. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js.map +1 -1
  388. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js +1 -3
  389. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js.map +1 -1
  390. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.d.ts +2 -2
  391. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +2 -14
  392. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  393. package/dist/dist-esm/react-composites/src/composites/common/SendBox.d.ts +15 -0
  394. package/dist/dist-esm/react-composites/src/composites/common/SendBox.js +18 -0
  395. package/dist/dist-esm/react-composites/src/composites/common/SendBox.js.map +1 -0
  396. package/dist/dist-esm/react-composites/src/composites/common/SidePaneHeader.js.map +1 -1
  397. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.d.ts +1 -0
  398. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js +8 -1
  399. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js.map +1 -1
  400. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -24
  401. package/dist/dist-esm/react-composites/src/composites/common/icons.js +0 -23
  402. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  403. package/dist/dist-esm/react-composites/src/composites/common/styles/Pane.styles.js +1 -0
  404. package/dist/dist-esm/react-composites/src/composites/common/styles/Pane.styles.js.map +1 -1
  405. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +4 -15
  406. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
  407. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +6 -2
  408. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +6 -2
  409. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +6 -2
  410. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +6 -2
  411. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +2 -0
  412. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +6 -2
  413. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +6 -2
  414. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +6 -2
  415. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +6 -2
  416. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +6 -2
  417. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +7 -3
  418. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +6 -2
  419. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +6 -2
  420. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +6 -2
  421. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +6 -2
  422. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +6 -2
  423. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +6 -2
  424. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +6 -2
  425. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +6 -2
  426. package/dist/dist-esm/react-composites/src/composites/localization/locales/utils.js +5 -1
  427. package/dist/dist-esm/react-composites/src/composites/localization/locales/utils.js.map +1 -1
  428. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +6 -2
  429. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +6 -2
  430. package/dist/tsdoc-metadata.json +1 -1
  431. package/package.json +10 -9
  432. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.d.ts +0 -45
  433. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +0 -91
  434. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +0 -1
  435. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +0 -19
  436. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js +0 -91
  437. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +0 -1
  438. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +0 -23
  439. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +0 -49
  440. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +0 -1
  441. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.d.ts +0 -10
  442. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js +0 -15
  443. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +0 -1
  444. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.d.ts +0 -69
  445. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js +0 -43
  446. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +0 -1
  447. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.d.ts +0 -75
  448. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js +0 -75
  449. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +0 -1
  450. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +0 -105
  451. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js +0 -68
  452. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js.map +0 -1
  453. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +0 -86
  454. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js +0 -39
  455. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +0 -1
  456. package/dist/dist-esm/react-components/src/components/HoldButton.d.ts +0 -49
  457. package/dist/dist-esm/react-components/src/components/HoldButton.js +0 -25
  458. package/dist/dist-esm/react-components/src/components/HoldButton.js.map +0 -1
  459. package/dist/dist-esm/react-components/src/components/MentionPopover.d.ts +0 -121
  460. package/dist/dist-esm/react-components/src/components/MentionPopover.js +0 -123
  461. package/dist/dist-esm/react-components/src/components/MentionPopover.js.map +0 -1
  462. package/dist/dist-esm/react-components/src/components/SendBoxErrors.d.ts +0 -14
  463. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js +0 -18
  464. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js.map +0 -1
  465. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.d.ts +0 -24
  466. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +0 -550
  467. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +0 -1
  468. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.d.ts +0 -152
  469. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +0 -816
  470. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +0 -1
  471. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.d.ts +0 -58
  472. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js +0 -144
  473. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +0 -1
  474. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.d.ts +0 -26
  475. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js +0 -69
  476. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js.map +0 -1
  477. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.d.ts +0 -38
  478. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +0 -92
  479. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +0 -1
  480. package/dist/dist-esm/react-components/src/components/styles/Stack.style.d.ts +0 -5
  481. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js +0 -32
  482. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js.map +0 -1
  483. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.d.ts +0 -26
  484. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js +0 -67
  485. package/dist/dist-esm/react-components/src/components/styles/UnsupportedEnvironment.styles.js.map +0 -1
  486. package/dist/dist-esm/react-components/src/components/utils/merge.d.ts +0 -7
  487. package/dist/dist-esm/react-components/src/components/utils/merge.js +0 -16
  488. package/dist/dist-esm/react-components/src/components/utils/merge.js.map +0 -1
  489. package/dist/dist-esm/react-components/src/theming/icons.styles.d.ts +0 -6
  490. package/dist/dist-esm/react-components/src/theming/icons.styles.js +0 -25
  491. package/dist/dist-esm/react-components/src/theming/icons.styles.js.map +0 -1
  492. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +0 -48
  493. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +0 -218
  494. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +0 -1
  495. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.d.ts +0 -12
  496. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js +0 -93
  497. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js.map +0 -1
  498. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.d.ts +0 -8
  499. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js +0 -26
  500. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/People.js.map +0 -1
  501. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +0 -24
  502. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +0 -28
  503. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +0 -1
  504. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.d.ts +0 -15
  505. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js +0 -54
  506. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/UnsupportedBrowser.js.map +0 -1
  507. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.d.ts +0 -32
  508. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js +0 -81
  509. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/HoldPane.styles.js.map +0 -1
  510. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +0 -18
  511. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js +0 -18
  512. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +0 -1
  513. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.d.ts +0 -15
  514. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js +0 -23
  515. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js.map +0 -1
  516. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
  517. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
  518. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
  519. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
  520. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
  521. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
  522. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +0 -27
  523. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js +0 -14
  524. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js.map +0 -1
  525. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.d.ts +0 -22
  526. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +0 -107
  527. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +0 -1
  528. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.d.ts +0 -17
  529. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js +0 -32
  530. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.js.map +0 -1
  531. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.d.ts +0 -22
  532. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +0 -74
  533. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +0 -1
  534. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.d.ts +0 -15
  535. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js +0 -61
  536. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +0 -1
  537. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionSettingsDrawer.d.ts +0 -21
  538. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionSettingsDrawer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../preprocess-dist/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,EAA6F,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAIzI,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;AAG9C,uEAAuE;AACvE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAClF,YAAY,EAAE,CAAC;AACf,qDAAqD;AACrD,aAAa,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,OAAO,WAAW;IAiBtB,YAAY,YAAqB,EAAE,uEAAuE,CAAA,UAAyC;QAhB3I,WAAM,GAAoB;YAChC,MAAM,EAAG;gBACP,EAAE,EAAE,EAAE;aACmB;YAC3B,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAG,EAAiB;SACjC,CAAC;QACM,eAAU,GAAG,KAAK,CAAC;QAGnB,4BAAuB,GAAuB,SAAS,CAAC;QAChE,uEAAuE;QAC/D,sBAAiB,GAAsC,SAAS,CAAC;QACzE,uEAAuE;QAC/D,wBAAmB,GAAsC,SAAS,CAAC;QAEzE,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,kCAAkC,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,uEAAuE;QACvE,IAAI,U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E,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 { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget, ChatError } 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/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: ({\n id: ''\n } 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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(maxListeners?: number, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */credential?: CommunicationTokenCredential) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, credential);\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, credential);\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n public getState(): ChatClientState {\n return this._state;\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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n Object.keys(draft.threads).forEach(threadId => {\n const thread = draft.threads[threadId];\n Object.keys(thread.chatMessages).forEach(messageId => {\n const cache = thread.chatMessages[messageId].resourceCache;\n if (cache) {\n Object.keys(cache).forEach(resourceUrl => {\n const blobUrl = cache[resourceUrl];\n URL.revokeObjectURL(blobUrl);\n });\n }\n thread.chatMessages[messageId].resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = {\n ...message,\n resourceCache: {}\n };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && message.resourceCache) {\n const blobUrl = message.resourceCache[resourceUrl];\n URL.revokeObjectURL(blobUrl);\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\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 public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\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 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 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 = {\n topic: topic\n };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\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 public setChatMessages(threadId: string, messages: {\n [key: string]: ChatMessageWithStatus;\n }): 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 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 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 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 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 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 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 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 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 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 if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\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 public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n this.parseAttachments(threadId, message);\n const {\n id: messageId,\n clientMessageId\n } = 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 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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (this._inlineImageQueue && !this._inlineImageQueue.containsMessageWithSameAttachments(message) && message.resourceCache === undefined) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\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>(f: (...args: Args) => Promise<R>, target: ChatErrorTarget): (...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>(f: (...args: Args) => R, target: ChatErrorTarget): (...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 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(typingIndicator => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey);\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 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 public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\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};"]}
1
+ {"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/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Q,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;IACM,aAAa,CAAC,OAAyC;QAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IACM,cAAc,CAAC,OAAyC;QAC7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AACD,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 { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget, ChatError } 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/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ResourceDownloadQueue, fetchImageSource } from './ResourceDownloadQueue';\nenableMapSet();\n// Needed to generate state diff for verbose logging.\nenablePatches();\n\n/**\n * @internal\n */\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: ({\n id: ''\n } 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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _inlineImageQueue: ResourceDownloadQueue | undefined = undefined;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private _fullsizeImageQueue: ResourceDownloadQueue | undefined = undefined;\n constructor(maxListeners?: number, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */credential?: CommunicationTokenCredential, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */endpoint?: string) {\n this._logger = createClientLogger('communication-react:chat-context');\n this._emitter = new EventEmitter();\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n if (credential) {\n this._inlineImageQueue = new ResourceDownloadQueue(this, {\n credential,\n endpoint: endpoint ?? ''\n });\n this._fullsizeImageQueue = new ResourceDownloadQueue(this, {\n credential,\n endpoint: endpoint ?? ''\n });\n }\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n public getState(): ChatClientState {\n return this._state;\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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public dispose(): void {\n this.modifyState((draft: ChatClientState) => {\n this._inlineImageQueue?.cancelAllRequests();\n this._fullsizeImageQueue?.cancelAllRequests();\n Object.keys(draft.threads).forEach(threadId => {\n const thread = draft.threads[threadId];\n Object.keys(thread.chatMessages).forEach(messageId => {\n const cache = thread.chatMessages[messageId].resourceCache;\n if (cache) {\n Object.keys(cache).forEach(resourceUrl => {\n const resource = cache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n });\n }\n thread.chatMessages[messageId].resourceCache = undefined;\n });\n });\n });\n // Any item in queue should be removed.\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public async downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): Promise<void> {\n let message = this.getState().threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue) {\n if (!message.resourceCache) {\n message = {\n ...message,\n resourceCache: {}\n };\n }\n // Need to discuss retry logic in case of failure\n this._fullsizeImageQueue.addMessage(message);\n await this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {\n singleUrl: resourceUrl\n });\n }\n }\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n public removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void {\n this.modifyState((draft: ChatClientState) => {\n const message = draft.threads[threadId]?.chatMessages[messageId];\n if (message && this._fullsizeImageQueue && this._fullsizeImageQueue.containsMessageWithSameAttachments(message)) {\n this._fullsizeImageQueue?.cancelRequest(resourceUrl);\n } else if (message && this._inlineImageQueue && this._inlineImageQueue.containsMessageWithSameAttachments(message)) {\n this._inlineImageQueue?.cancelRequest(resourceUrl);\n }\n if (message && message.resourceCache && message.resourceCache[resourceUrl]) {\n const resource = message.resourceCache[resourceUrl];\n if (resource.sourceUrl) {\n URL.revokeObjectURL(resource.sourceUrl);\n }\n delete message.resourceCache[resourceUrl];\n }\n });\n }\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.modifyState((draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\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 public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.modifyState((draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\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 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 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 = {\n topic: topic\n };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\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 public setChatMessages(threadId: string, messages: {\n [key: string]: ChatMessageWithStatus;\n }): 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 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 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 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 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 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 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 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 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 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 if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\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 public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n this.parseAttachments(threadId, message);\n const {\n id: messageId,\n clientMessageId\n } = 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 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 /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n private parseAttachments(threadId: string, message: ChatMessageWithStatus): void {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments && attachments.length > 0) {\n if (this._inlineImageQueue && !this._inlineImageQueue.containsMessageWithSameAttachments(message) && message.resourceCache === undefined) {\n // Need to discuss retry logic in case of failure\n this._inlineImageQueue.addMessage(message);\n this._inlineImageQueue.startQueue(threadId, fetchImageSource);\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>(f: (...args: Args) => Promise<R>, target: ChatErrorTarget): (...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>(f: (...args: Args) => R, target: ChatErrorTarget): (...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 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(typingIndicator => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey);\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 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 public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\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};"]}
@@ -9,32 +9,41 @@ export declare class ResourceDownloadQueue {
9
9
  private _context;
10
10
  private isActive;
11
11
  private _credential;
12
- constructor(context: ChatContext, credential: CommunicationTokenCredential);
12
+ private _endpoint;
13
+ private _requestsToCancel;
14
+ constructor(context: ChatContext, authentication: {
15
+ credential: CommunicationTokenCredential;
16
+ endpoint: string;
17
+ });
13
18
  containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean;
14
19
  addMessage(message: ChatMessageWithStatus): void;
15
20
  startQueue(threadId: string, operation: ImageRequest, options?: {
16
21
  singleUrl: string;
17
22
  }): Promise<void>;
23
+ cancelAllRequests(): void;
24
+ cancelRequest(url: string): void;
18
25
  private downloadSingleUrl;
19
26
  private downloadAllPreviewUrls;
27
+ private downloadResource;
20
28
  }
21
29
  /**
22
30
  * @private
23
31
  */
24
- export declare const requestPreviewUrl: (message: ChatMessageWithStatus, credential: CommunicationTokenCredential) => Promise<ChatMessageWithStatus>;
25
- /**
26
- * @private
27
- */
28
- export declare const fetchImageSource: (src: string, credential: CommunicationTokenCredential) => Promise<string>;
32
+ export declare const fetchImageSource: (src: string, authentication: {
33
+ credential: CommunicationTokenCredential;
34
+ endpoint: string;
35
+ }, options: {
36
+ abortController: AbortController;
37
+ timeout?: number;
38
+ }) => Promise<string>;
29
39
  interface ImageRequest {
30
- (request: string, credential: CommunicationTokenCredential): Promise<string>;
31
- }
32
- /**
33
- * @private
34
- */
35
- export declare class ResourceDownloadError extends Error {
36
- chatMessageWithStatus: ChatMessageWithStatus;
37
- constructor(chatMessageWithStatus: ChatMessageWithStatus);
40
+ (request: string, authentication: {
41
+ credential: CommunicationTokenCredential;
42
+ endpoint: string;
43
+ }, options: {
44
+ abortController: AbortController;
45
+ timeout?: number;
46
+ }): Promise<string>;
38
47
  }
39
48
  export {};
40
49
  //# sourceMappingURL=ResourceDownloadQueue.d.ts.map
@@ -8,17 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
11
- import { ChatError } from './ChatClientState';
12
- /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
13
11
  /**
14
12
  * @private
15
13
  */
16
14
  export class ResourceDownloadQueue {
17
- constructor(context, credential) {
15
+ constructor(context, authentication) {
18
16
  this._messagesNeedingResourceRetrieval = [];
19
17
  this.isActive = false;
18
+ this._requestsToCancel = {};
20
19
  this._context = context;
21
- this._credential = credential;
20
+ this._credential = authentication.credential;
21
+ this._endpoint = authentication.endpoint;
22
22
  }
23
23
  containsMessageWithSameAttachments(message) {
24
24
  var _a, _b, _c;
@@ -52,29 +52,45 @@ export class ResourceDownloadQueue {
52
52
  this.isActive = false;
53
53
  continue;
54
54
  }
55
- try {
56
- if (options) {
57
- const singleUrl = options.singleUrl;
58
- message = yield this.downloadSingleUrl(message, singleUrl, operation);
59
- }
60
- else {
61
- message = yield this.downloadAllPreviewUrls(message, operation);
62
- }
63
- this._context.setChatMessage(threadId, message);
55
+ if (options) {
56
+ const singleUrl = options.singleUrl;
57
+ message = yield this.downloadSingleUrl(message, singleUrl, operation);
64
58
  }
65
- catch (error) {
66
- console.log('Downloading Resource error: ', error);
67
- }
68
- finally {
69
- this.isActive = false;
59
+ else {
60
+ message = yield this.downloadAllPreviewUrls(message, operation);
70
61
  }
62
+ this._context.setChatMessage(threadId, message);
63
+ this.isActive = false;
71
64
  }
72
65
  });
73
66
  }
67
+ cancelAllRequests() {
68
+ for (const key in this._requestsToCancel) {
69
+ this._requestsToCancel[key].abortController.abort();
70
+ }
71
+ this._requestsToCancel = {};
72
+ }
73
+ cancelRequest(url) {
74
+ if (this._requestsToCancel[url]) {
75
+ this._requestsToCancel[url].abortController.abort();
76
+ delete this._requestsToCancel[url];
77
+ }
78
+ }
74
79
  downloadSingleUrl(message, resourceUrl, operation) {
75
80
  return __awaiter(this, void 0, void 0, function* () {
76
- const blobUrl = yield operation(resourceUrl, this._credential);
77
- message = Object.assign(Object.assign({}, message), { resourceCache: Object.assign(Object.assign({}, message.resourceCache), { [resourceUrl]: blobUrl }) });
81
+ const response = {
82
+ sourceUrl: ''
83
+ };
84
+ try {
85
+ const abortController = new AbortController();
86
+ const blobUrl = yield this.downloadResource(operation, resourceUrl, abortController);
87
+ response.sourceUrl = blobUrl;
88
+ }
89
+ catch (error) {
90
+ response.error = error;
91
+ delete this._requestsToCancel[resourceUrl];
92
+ }
93
+ message = Object.assign(Object.assign({}, message), { resourceCache: Object.assign(Object.assign({}, message.resourceCache), { [resourceUrl]: response }) });
78
94
  return message;
79
95
  });
80
96
  }
@@ -88,73 +104,78 @@ export class ResourceDownloadQueue {
88
104
  }
89
105
  for (const attachment of attachments) {
90
106
  if (attachment.previewUrl && attachment.attachmentType === 'image') {
91
- const blobUrl = yield operation(attachment.previewUrl, this._credential);
92
- message.resourceCache[attachment.previewUrl] = blobUrl;
107
+ const response = {
108
+ sourceUrl: ''
109
+ };
110
+ try {
111
+ const abortController = new AbortController();
112
+ const blobUrl = yield this.downloadResource(operation, attachment.previewUrl, abortController);
113
+ response.sourceUrl = blobUrl;
114
+ }
115
+ catch (error) {
116
+ response.error = error;
117
+ delete this._requestsToCancel[attachment.previewUrl];
118
+ }
119
+ message.resourceCache[attachment.previewUrl] = response;
93
120
  }
94
121
  }
95
122
  }
96
123
  return message;
97
124
  });
98
125
  }
99
- }
100
- /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
101
- /**
102
- * @private
103
- */
104
- export const requestPreviewUrl = (message, credential) => __awaiter(void 0, void 0, void 0, function* () {
105
- var _a;
106
- const attachments = (_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments;
107
- if (message.type === 'html' && attachments) {
108
- if (message.resourceCache === undefined) {
109
- message.resourceCache = {};
110
- }
111
- for (const attachment of attachments) {
112
- if (attachment.previewUrl) {
113
- const previewUrl = attachment.previewUrl;
114
- try {
115
- const src = yield fetchImageSource(previewUrl, credential);
116
- message.resourceCache[previewUrl] = src;
117
- }
118
- catch (error) {
119
- throw new ResourceDownloadError(message);
120
- }
121
- }
122
- }
126
+ downloadResource(operation, url, abortController) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ this._requestsToCancel[url] = {
129
+ src: url,
130
+ abortController
131
+ };
132
+ const blobUrl = yield operation(url, {
133
+ credential: this._credential,
134
+ endpoint: this._endpoint
135
+ }, {
136
+ abortController
137
+ });
138
+ delete this._requestsToCancel[url];
139
+ return blobUrl;
140
+ });
123
141
  }
124
- return message;
125
- });
142
+ }
126
143
  /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
127
144
  /**
128
145
  * @private
129
146
  */
130
- export const fetchImageSource = (src, credential) => __awaiter(void 0, void 0, void 0, function* () {
131
- function fetchWithAuthentication(url, token) {
147
+ export const fetchImageSource = (src, authentication, options) => __awaiter(void 0, void 0, void 0, function* () {
148
+ function fetchWithAuthentication(url, token, options) {
132
149
  return __awaiter(this, void 0, void 0, function* () {
133
150
  const headers = new Headers();
134
151
  headers.append('Authorization', `Bearer ${token}`);
135
- try {
136
- return yield fetch(url, {
137
- headers
138
- });
139
- }
140
- catch (err) {
141
- throw new ChatError('ChatThreadClient.getMessage', err);
142
- }
152
+ return yield fetchWithTimeout(url, {
153
+ timeout: options.timeout,
154
+ headers,
155
+ abortController: options.abortController
156
+ });
143
157
  });
144
158
  }
145
- const accessToken = yield credential.getToken();
146
- const response = yield fetchWithAuthentication(src, accessToken.token);
159
+ function fetchWithTimeout(resource, options) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ // default timeout is 30 seconds
162
+ const { timeout = 30000, abortController } = options;
163
+ const id = setTimeout(() => {
164
+ abortController.abort();
165
+ }, timeout);
166
+ const response = yield fetch(resource, Object.assign(Object.assign({}, options), { signal: abortController.signal }));
167
+ clearTimeout(id);
168
+ return response;
169
+ });
170
+ }
171
+ const fetchUrl = new URL(src);
172
+ const endpoint = new URL(authentication.endpoint);
173
+ let token = '';
174
+ if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {
175
+ token = (yield authentication.credential.getToken()).token;
176
+ }
177
+ const response = yield fetchWithAuthentication(src, token, options);
147
178
  const blob = yield response.blob();
148
179
  return URL.createObjectURL(blob);
149
180
  });
150
- /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
151
- /**
152
- * @private
153
- */
154
- export class ResourceDownloadError extends Error {
155
- constructor(chatMessageWithStatus) {
156
- super();
157
- this.chatMessageWithStatus = chatMessageWithStatus;
158
- }
159
- }
160
181
  //# sourceMappingURL=ResourceDownloadQueue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAIA,uEAAuE;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAM9C,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAKhC,YAAY,OAAoB,EAAE,UAAwC;QAJlE,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAAC;gBACvD,MAAM,kBAAkB,GAAG,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;gBACxD,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC/F,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAA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ACnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC;AAMF,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAE9C,YAAY,qBAA4C;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatError } from './ChatClientState';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n constructor(context: ChatContext, credential: CommunicationTokenCredential) {\n this._context = context;\n this._credential = credential;\n }\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n return contains;\n }\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = {\n ...message\n };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n public async startQueue(threadId: string, operation: ImageRequest, options?: {\n singleUrl: string;\n }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n try {\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n } catch (error) {\n console.log('Downloading Resource error: ', error);\n } finally {\n this.isActive = false;\n }\n }\n }\n private async downloadSingleUrl(message: ChatMessageWithStatus, resourceUrl: string, operation: ImageRequest): Promise<ChatMessageWithStatus> {\n const blobUrl = await operation(resourceUrl, this._credential);\n message = {\n ...message,\n resourceCache: {\n ...message.resourceCache,\n [resourceUrl]: blobUrl\n }\n };\n return message;\n }\n private async downloadAllPreviewUrls(message: ChatMessageWithStatus, operation: ImageRequest): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const blobUrl = await operation(attachment.previewUrl, this._credential);\n message.resourceCache[attachment.previewUrl] = blobUrl;\n }\n }\n }\n return message;\n }\n}\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const requestPreviewUrl = async (message: ChatMessageWithStatus, credential: CommunicationTokenCredential): Promise<ChatMessageWithStatus> => {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl) {\n const previewUrl = attachment.previewUrl;\n try {\n const src = await fetchImageSource(previewUrl, credential);\n message.resourceCache[previewUrl] = src;\n } catch (error) {\n throw new ResourceDownloadError(message);\n }\n }\n }\n }\n return message;\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (src: string, credential: CommunicationTokenCredential): Promise<string> => {\n async function fetchWithAuthentication(url: string, token: string): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n try {\n return await fetch(url, {\n headers\n });\n } catch (err) {\n throw new ChatError('ChatThreadClient.getMessage', (err as Error));\n }\n }\n const accessToken = await credential.getToken();\n const response = await fetchWithAuthentication(src, accessToken.token);\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (request: string, credential: CommunicationTokenCredential): Promise<string>;\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadError extends Error {\n public chatMessageWithStatus: ChatMessageWithStatus;\n constructor(chatMessageWithStatus: ChatMessageWithStatus) {\n super();\n this.chatMessageWithStatus = chatMessageWithStatus;\n }\n}"]}
1
+ {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAYA,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAOhC,YAAY,OAAoB,EAAE,cAGjC;QATO,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAGjB,sBAAiB,GAAwC,EAAE,CAAC;QAKlE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC;IAC3C,CAAC;IACM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAA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AAQ,CAAC,CAAC;IAClD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9E,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\ndeclare type CancellationDetails = {\n src: string;\n abortController: AbortController;\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n private _endpoint: string;\n private _requestsToCancel: Record<string, CancellationDetails> = {};\n constructor(context: ChatContext, authentication: {\n credential: CommunicationTokenCredential;\n endpoint: string;\n }) {\n this._context = context;\n this._credential = authentication.credential;\n this._endpoint = authentication.endpoint;\n }\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n return contains;\n }\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = {\n ...message\n };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n public async startQueue(threadId: string, operation: ImageRequest, options?: {\n singleUrl: string;\n }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n public cancelAllRequests(): void {\n for (const key in this._requestsToCancel) {\n this._requestsToCancel[key].abortController.abort();\n }\n this._requestsToCancel = {};\n }\n public cancelRequest(url: string): void {\n if (this._requestsToCancel[url]) {\n this._requestsToCancel[url].abortController.abort();\n delete this._requestsToCancel[url];\n }\n }\n private async downloadSingleUrl(message: ChatMessageWithStatus, resourceUrl: string, operation: ImageRequest): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = {\n sourceUrl: ''\n };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, resourceUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = (error as Error);\n delete this._requestsToCancel[resourceUrl];\n }\n message = {\n ...message,\n resourceCache: {\n ...message.resourceCache,\n [resourceUrl]: response\n }\n };\n return message;\n }\n private async downloadAllPreviewUrls(message: ChatMessageWithStatus, operation: ImageRequest): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = {\n sourceUrl: ''\n };\n try {\n const abortController = new AbortController();\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl, abortController);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = (error as Error);\n delete this._requestsToCancel[attachment.previewUrl];\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n return message;\n }\n private async downloadResource(operation: ImageRequest, url: string, abortController: AbortController): Promise<string> {\n this._requestsToCancel[url] = {\n src: url,\n abortController\n };\n const blobUrl = await operation(url, {\n credential: this._credential,\n endpoint: this._endpoint\n }, {\n abortController\n });\n delete this._requestsToCancel[url];\n return blobUrl;\n }\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (src: string, authentication: {\n credential: CommunicationTokenCredential;\n endpoint: string;\n}, options: {\n abortController: AbortController;\n timeout?: number;\n}): Promise<string> => {\n async function fetchWithAuthentication(url: string, token: string, options: {\n abortController: AbortController;\n timeout?: number;\n }): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n return await fetchWithTimeout(url, {\n timeout: options.timeout,\n headers,\n abortController: options.abortController\n });\n }\n async function fetchWithTimeout(resource: string | URL | Request, options: {\n timeout?: number;\n headers?: Headers;\n abortController: AbortController;\n }): Promise<Response> {\n // default timeout is 30 seconds\n const {\n timeout = 30000,\n abortController\n } = options;\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n }\n const fetchUrl = new URL(src);\n const endpoint = new URL(authentication.endpoint);\n let token = '';\n if (fetchUrl.hostname === endpoint.hostname && fetchUrl.protocol === 'https:') {\n token = (await authentication.credential.getToken()).token;\n }\n const response = await fetchWithAuthentication(src, token, options);\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (request: string, authentication: {\n credential: CommunicationTokenCredential;\n endpoint: string;\n }, options: {\n abortController: AbortController;\n timeout?: number;\n }): Promise<string>;\n}"]}
@@ -123,7 +123,7 @@ export const _createStatefulChatClientInner = (args, options, telemetryImplement
123
123
  * @internal
124
124
  */
125
125
  export const _createStatefulChatClientWithDeps = (chatClient, args, options) => {
126
- const context = new ChatContext(options === null || options === void 0 ? void 0 : options.maxStateChangeListeners, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ args.credential);
126
+ const context = new ChatContext(options === null || options === void 0 ? void 0 : options.maxStateChangeListeners, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ args.credential, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ args.endpoint);
127
127
  let eventSubscriber;
128
128
  context.updateChatConfig(getIdentifierKind(args.userId), args.displayName);
129
129
  const proxy = new Proxy(chatClient, proxyChatClient);
@@ -1 +1 @@
1
- {"version":3,"file":"StatefulChatClient.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/StatefulChatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,UAAU,EAAqB,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAgC,gCAAgC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAA6D,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3H,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAuD9C,MAAM,eAAe,GAA6B;IAChD,GAAG,EAAE,UAA8D,UAAsB,EAAE,IAAO,EAAE,QAA4C;QAC9I,qDA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AAyC,EAAE,EAAE,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAC,OAAO,CAAC;KACtF,CAAC,CAAC;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE;QAC7C,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,CAAC,OAAyC,EAAE,EAAE,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,OAAO,CAAC;KACvF,CAAC,CAAC;IACH,OAAQ,KAA4B,CAAC;AACvC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClient, ChatClientOptions } from '@azure/communication-chat';\nimport { _getApplicationId, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport { ChatContext } from './ChatContext';\nimport { ChatClientState } from './ChatClientState';\nimport { EventSubscriber } from './EventSubscriber';\nimport { chatThreadClientDeclaratify } from './StatefulChatThreadClient';\nimport { createDecoratedListThreads } from './iterators/createDecoratedListThreads';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier, getIdentifierKind } from '@azure/communication-common';\nimport { chatStatefulLogger } from './Logger';\n\n/**\n * Defines the methods that allow {@Link @azure/communication-chat#ChatClient} to be used with a centralized generated state.\n *\n * The interface provides access to proxied state and also allows registering a handler for state change events.\n *\n * @public\n */\nexport interface StatefulChatClient extends ChatClient {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Cleans up the resource cache from the chat thread client.\n */\n dispose(): void;\n /**\n * Holds all the state that we could proxy from ChatClient {@Link @azure/communication-chat#ChatClient} as\n * ChatClientState {@Link ChatClientState}.\n */\n getState(): ChatClientState;\n /**\n * Allows a handler to be registered for 'stateChanged' events.\n *\n * @param handler - Callback to receive the state.\n */\n onStateChange(handler: (state: ChatClientState) => void): void;\n /**\n * Allows unregistering for 'stateChanged' events.\n *\n * @param handler - Original callback to be unsubscribed.\n */\n offStateChange(handler: (state: ChatClientState) => void): void;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Downloads a resource for specific message and caches it.\n *\n * @param threadId - The thread id of the chat thread.\n * @param messageId - The message id of the chat message.\n * @param resourceUrl - The resource url to fetch and cache.\n */\n downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): void;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Removes a resource from cache for a specific message.\n *\n * @param threadId - The thread id of the chat thread.\n * @param messageId - The message id of the chat message.\n * @param resourceUrl - The resource url to remove from cache.\n */\n removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void;\n}\ninterface StatefulChatClientWithPrivateProps extends StatefulChatClient {\n context: ChatContext;\n eventSubscriber: EventSubscriber | undefined;\n}\nconst proxyChatClient: ProxyHandler<ChatClient> = {\n get: function <P extends keyof StatefulChatClientWithPrivateProps>(chatClient: ChatClient, prop: P, receiver: StatefulChatClientWithPrivateProps) {\n // skip receiver.context call to avoid recursive bugs\n if (prop === 'context') {\n return Reflect.get(chatClient, prop);\n }\n const context = receiver.context;\n switch (prop) {\n case 'createChatThread':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['createChatThread']>) {\n const result = await chatClient.createChatThread(...args);\n const thread = result.chatThread;\n if (thread) {\n const [request] = args;\n context.createThread(thread.id, {\n topic: request.topic\n });\n }\n return result;\n }, 'ChatClient.createChatThread');\n }\n case 'deleteChatThread':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['deleteChatThread']>) {\n const result = await chatClient.deleteChatThread(...args);\n context.deleteThread(args[0]);\n return result;\n }, 'ChatClient.deleteChatThread');\n }\n case 'listChatThreads':\n {\n return createDecoratedListThreads(chatClient, context);\n }\n case 'getChatThreadClient':\n {\n return function (...args: Parameters<ChatClient['getChatThreadClient']>) {\n const chatThreadClient = chatClient.getChatThreadClient(...args);\n // TODO(prprabhu): Ensure that thread properties are fetched into the ChatContext at this point.\n // A new thread might be created here, but the properties will never be fetched.\n return chatThreadClientDeclaratify(chatThreadClient, context);\n };\n }\n case 'startRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['startRealtimeNotifications']>) {\n const ret = await chatClient.startRealtimeNotifications(...args);\n if (!receiver.eventSubscriber) {\n receiver.eventSubscriber = new EventSubscriber(chatClient, context);\n }\n return ret;\n }, 'ChatClient.startRealtimeNotifications');\n }\n case 'stopRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['stopRealtimeNotifications']>) {\n const ret = await chatClient.stopRealtimeNotifications(...args);\n if (receiver.eventSubscriber) {\n receiver.eventSubscriber.unsubscribe();\n receiver.eventSubscriber = undefined;\n }\n return ret;\n }, 'ChatClient.stopRealtimeNotifications');\n }\n default:\n return Reflect.get(chatClient, prop);\n }\n }\n};\n\n/**\n * Arguments to construct the {@link StatefulChatClient}.\n *\n * @public\n */\nexport type StatefulChatClientArgs = {\n userId: CommunicationUserIdentifier;\n displayName: string;\n endpoint: string;\n credential: CommunicationTokenCredential;\n};\n\n/**\n * Options to construct the {@link StatefulChatClient}.\n *\n * @public\n */\nexport type StatefulChatClientOptions = {\n /**\n * Options to construct the {@link @azure/communication-chat#ChatClient} with.\n */\n chatClientOptions: ChatClientOptions;\n /**\n * Sets the max listeners limit of the 'stateChange' event. Defaults to the node.js EventEmitter.defaultMaxListeners\n * if not specified.\n */\n maxStateChangeListeners?: number;\n};\n\n/**\n * Creates a stateful ChatClient {@link StatefulChatClient} by proxying ChatClient\n * {@link @azure/communication-chat#ChatClient} with ProxyChatClient {@link ProxyChatClient} which then allows access\n * to state in a declarative way.\n *\n * @public\n */\nexport const createStatefulChatClient = (args: StatefulChatClientArgs, options?: StatefulChatClientOptions): StatefulChatClient => {\n return _createStatefulChatClientInner(args, options);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createStatefulChatClientInner = (args: StatefulChatClientArgs, options?: StatefulChatClientOptions, telemetryImplementationHint: _TelemetryImplementationHint = 'StatefulComponents'): StatefulChatClient => {\n chatStatefulLogger.info(`Creating chat stateful client using library version: ${_getApplicationId(telemetryImplementationHint)}`);\n const tweakedOptions = {\n ...options,\n chatClientOptions: {\n ...options?.chatClientOptions,\n userAgentOptions: {\n userAgentPrefix: _getApplicationId(telemetryImplementationHint)\n }\n }\n };\n return _createStatefulChatClientWithDeps(new ChatClient(args.endpoint, args.credential, tweakedOptions.chatClientOptions), args, tweakedOptions);\n};\n\n/**\n * A function to modify the state of the StatefulChatClient.\n *\n * Provided as a callback to the {@link StatefulChatClient.modifyState} method.\n *\n * The function must modify the provided state in place as much as possible.\n * Making large modifications can lead to bad performance by causing spurious rerendering of the UI.\n *\n * Consider using commonly used modifier functions exported from this package.\n */\nexport type ChatStateModifier = (state: ChatClientState) => void;\n\n/**\n * Internal implementation of {@link createStatefulChatClient} for dependency injection.\n *\n * Used by tests. Should not be exported out of this package.\n * @internal\n */\nexport const _createStatefulChatClientWithDeps = (chatClient: ChatClient, args: StatefulChatClientArgs, options?: StatefulChatClientOptions): StatefulChatClient => {\n const context = new ChatContext(options?.maxStateChangeListeners, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */args.credential);\n let eventSubscriber: EventSubscriber;\n context.updateChatConfig(getIdentifierKind(args.userId), args.displayName);\n const proxy = new Proxy(chatClient, proxyChatClient);\n Object.defineProperty(proxy, 'context', {\n configurable: false,\n get: () => context\n });\n Object.defineProperty(proxy, 'eventSubscriber', {\n configurable: false,\n get: () => eventSubscriber,\n set: (val: EventSubscriber) => {\n eventSubscriber = val;\n }\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'dispose', {\n configurable: false,\n value: () => context?.dispose()\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'downloadResourceToCache', {\n configurable: false,\n value: (threadId: string, messageId: string, resourceUrl: string) => context?.downloadResourceToCache(threadId, messageId, resourceUrl)\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'removeResourceFromCache', {\n configurable: false,\n value: (threadId: string, messageId: string, resourceUrl: string) => context?.removeResourceFromCache(threadId, messageId, resourceUrl)\n });\n Object.defineProperty(proxy, 'getState', {\n configurable: false,\n value: () => context?.getState()\n });\n Object.defineProperty(proxy, 'onStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.onStateChange(handler)\n });\n Object.defineProperty(proxy, 'offStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.offStateChange(handler)\n });\n return (proxy as StatefulChatClient);\n};"]}
1
+ {"version":3,"file":"StatefulChatClient.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/StatefulChatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,UAAU,EAAqB,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAgC,gCAAgC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAA6D,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3H,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAuD9C,MAAM,eAAe,GAA6B;IAChD,GAAG,EAAE,UAA8D,UAAsB,EAAE,IAAO,EAAE,QAA4C;QAC9I,qDAAqD;QACrD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,MAAM,OAAO,GAAG,QAAQ,CAAC,O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c,CAAC,KAAK,EAAE,gBAAgB,EAAE;QAC7C,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,CAAC,OAAyC,EAAE,EAAE,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,OAAO,CAAC;KACvF,CAAC,CAAC;IACH,OAAQ,KAA4B,CAAC;AACvC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClient, ChatClientOptions } from '@azure/communication-chat';\nimport { _getApplicationId, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport { ChatContext } from './ChatContext';\nimport { ChatClientState } from './ChatClientState';\nimport { EventSubscriber } from './EventSubscriber';\nimport { chatThreadClientDeclaratify } from './StatefulChatThreadClient';\nimport { createDecoratedListThreads } from './iterators/createDecoratedListThreads';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier, getIdentifierKind } from '@azure/communication-common';\nimport { chatStatefulLogger } from './Logger';\n\n/**\n * Defines the methods that allow {@Link @azure/communication-chat#ChatClient} to be used with a centralized generated state.\n *\n * The interface provides access to proxied state and also allows registering a handler for state change events.\n *\n * @public\n */\nexport interface StatefulChatClient extends ChatClient {\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Cleans up the resource cache from the chat thread client.\n */\n dispose(): void;\n /**\n * Holds all the state that we could proxy from ChatClient {@Link @azure/communication-chat#ChatClient} as\n * ChatClientState {@Link ChatClientState}.\n */\n getState(): ChatClientState;\n /**\n * Allows a handler to be registered for 'stateChanged' events.\n *\n * @param handler - Callback to receive the state.\n */\n onStateChange(handler: (state: ChatClientState) => void): void;\n /**\n * Allows unregistering for 'stateChanged' events.\n *\n * @param handler - Original callback to be unsubscribed.\n */\n offStateChange(handler: (state: ChatClientState) => void): void;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Downloads a resource for specific message and caches it.\n *\n * @param threadId - The thread id of the chat thread.\n * @param messageId - The message id of the chat message.\n * @param resourceUrl - The resource url to fetch and cache.\n */\n downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string): void;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n /**\n * Removes a resource from cache for a specific message.\n *\n * @param threadId - The thread id of the chat thread.\n * @param messageId - The message id of the chat message.\n * @param resourceUrl - The resource url to remove from cache.\n */\n removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string): void;\n}\ninterface StatefulChatClientWithPrivateProps extends StatefulChatClient {\n context: ChatContext;\n eventSubscriber: EventSubscriber | undefined;\n}\nconst proxyChatClient: ProxyHandler<ChatClient> = {\n get: function <P extends keyof StatefulChatClientWithPrivateProps>(chatClient: ChatClient, prop: P, receiver: StatefulChatClientWithPrivateProps) {\n // skip receiver.context call to avoid recursive bugs\n if (prop === 'context') {\n return Reflect.get(chatClient, prop);\n }\n const context = receiver.context;\n switch (prop) {\n case 'createChatThread':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['createChatThread']>) {\n const result = await chatClient.createChatThread(...args);\n const thread = result.chatThread;\n if (thread) {\n const [request] = args;\n context.createThread(thread.id, {\n topic: request.topic\n });\n }\n return result;\n }, 'ChatClient.createChatThread');\n }\n case 'deleteChatThread':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['deleteChatThread']>) {\n const result = await chatClient.deleteChatThread(...args);\n context.deleteThread(args[0]);\n return result;\n }, 'ChatClient.deleteChatThread');\n }\n case 'listChatThreads':\n {\n return createDecoratedListThreads(chatClient, context);\n }\n case 'getChatThreadClient':\n {\n return function (...args: Parameters<ChatClient['getChatThreadClient']>) {\n const chatThreadClient = chatClient.getChatThreadClient(...args);\n // TODO(prprabhu): Ensure that thread properties are fetched into the ChatContext at this point.\n // A new thread might be created here, but the properties will never be fetched.\n return chatThreadClientDeclaratify(chatThreadClient, context);\n };\n }\n case 'startRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['startRealtimeNotifications']>) {\n const ret = await chatClient.startRealtimeNotifications(...args);\n if (!receiver.eventSubscriber) {\n receiver.eventSubscriber = new EventSubscriber(chatClient, context);\n }\n return ret;\n }, 'ChatClient.startRealtimeNotifications');\n }\n case 'stopRealtimeNotifications':\n {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['stopRealtimeNotifications']>) {\n const ret = await chatClient.stopRealtimeNotifications(...args);\n if (receiver.eventSubscriber) {\n receiver.eventSubscriber.unsubscribe();\n receiver.eventSubscriber = undefined;\n }\n return ret;\n }, 'ChatClient.stopRealtimeNotifications');\n }\n default:\n return Reflect.get(chatClient, prop);\n }\n }\n};\n\n/**\n * Arguments to construct the {@link StatefulChatClient}.\n *\n * @public\n */\nexport type StatefulChatClientArgs = {\n userId: CommunicationUserIdentifier;\n displayName: string;\n endpoint: string;\n credential: CommunicationTokenCredential;\n};\n\n/**\n * Options to construct the {@link StatefulChatClient}.\n *\n * @public\n */\nexport type StatefulChatClientOptions = {\n /**\n * Options to construct the {@link @azure/communication-chat#ChatClient} with.\n */\n chatClientOptions: ChatClientOptions;\n /**\n * Sets the max listeners limit of the 'stateChange' event. Defaults to the node.js EventEmitter.defaultMaxListeners\n * if not specified.\n */\n maxStateChangeListeners?: number;\n};\n\n/**\n * Creates a stateful ChatClient {@link StatefulChatClient} by proxying ChatClient\n * {@link @azure/communication-chat#ChatClient} with ProxyChatClient {@link ProxyChatClient} which then allows access\n * to state in a declarative way.\n *\n * @public\n */\nexport const createStatefulChatClient = (args: StatefulChatClientArgs, options?: StatefulChatClientOptions): StatefulChatClient => {\n return _createStatefulChatClientInner(args, options);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createStatefulChatClientInner = (args: StatefulChatClientArgs, options?: StatefulChatClientOptions, telemetryImplementationHint: _TelemetryImplementationHint = 'StatefulComponents'): StatefulChatClient => {\n chatStatefulLogger.info(`Creating chat stateful client using library version: ${_getApplicationId(telemetryImplementationHint)}`);\n const tweakedOptions = {\n ...options,\n chatClientOptions: {\n ...options?.chatClientOptions,\n userAgentOptions: {\n userAgentPrefix: _getApplicationId(telemetryImplementationHint)\n }\n }\n };\n return _createStatefulChatClientWithDeps(new ChatClient(args.endpoint, args.credential, tweakedOptions.chatClientOptions), args, tweakedOptions);\n};\n\n/**\n * A function to modify the state of the StatefulChatClient.\n *\n * Provided as a callback to the {@link StatefulChatClient.modifyState} method.\n *\n * The function must modify the provided state in place as much as possible.\n * Making large modifications can lead to bad performance by causing spurious rerendering of the UI.\n *\n * Consider using commonly used modifier functions exported from this package.\n */\nexport type ChatStateModifier = (state: ChatClientState) => void;\n\n/**\n * Internal implementation of {@link createStatefulChatClient} for dependency injection.\n *\n * Used by tests. Should not be exported out of this package.\n * @internal\n */\nexport const _createStatefulChatClientWithDeps = (chatClient: ChatClient, args: StatefulChatClientArgs, options?: StatefulChatClientOptions): StatefulChatClient => {\n const context = new ChatContext(options?.maxStateChangeListeners, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */args.credential, /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */args.endpoint);\n let eventSubscriber: EventSubscriber;\n context.updateChatConfig(getIdentifierKind(args.userId), args.displayName);\n const proxy = new Proxy(chatClient, proxyChatClient);\n Object.defineProperty(proxy, 'context', {\n configurable: false,\n get: () => context\n });\n Object.defineProperty(proxy, 'eventSubscriber', {\n configurable: false,\n get: () => eventSubscriber,\n set: (val: EventSubscriber) => {\n eventSubscriber = val;\n }\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'dispose', {\n configurable: false,\n value: () => context?.dispose()\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'downloadResourceToCache', {\n configurable: false,\n value: (threadId: string, messageId: string, resourceUrl: string) => context?.downloadResourceToCache(threadId, messageId, resourceUrl)\n });\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n Object.defineProperty(proxy, 'removeResourceFromCache', {\n configurable: false,\n value: (threadId: string, messageId: string, resourceUrl: string) => context?.removeResourceFromCache(threadId, messageId, resourceUrl)\n });\n Object.defineProperty(proxy, 'getState', {\n configurable: false,\n value: () => context?.getState()\n });\n Object.defineProperty(proxy, 'onStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.onStateChange(handler)\n });\n Object.defineProperty(proxy, 'offStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.offStateChange(handler)\n });\n return (proxy as StatefulChatClient);\n};"]}
@@ -4,9 +4,6 @@
4
4
  * @private
5
5
  */
6
6
  export const convertChatMessage = (message, status = 'delivered', clientMessageId) => {
7
- var _a, _b, _c;
8
- return Object.assign(Object.assign({}, message), { clientMessageId: clientMessageId, status,
9
- /* @conditional-compile-remove(data-loss-prevention) */
10
- policyViolation: !!(((_a = message.sender) === null || _a === void 0 ? void 0 : _a.kind) === 'microsoftTeamsUser' && !!message.editedOn && ((_b = message.content) === null || _b === void 0 ? void 0 : _b.message) === '' && ((_c = message.content.attachments) === null || _c === void 0 ? void 0 : _c.length) === 0) });
7
+ return Object.assign(Object.assign({}, message), { clientMessageId: clientMessageId, status });
11
8
  };
12
9
  //# sourceMappingURL=convertChatMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertChatMessage.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/convertChatMessage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAoB,EAAE,SAAwB,WAAW,EAAE,eAAwB,EAAyB,EAAE;;IAC/I,uCACK,OAAO,KACV,eAAe,EAAE,eAAe,EAChC,MAAM;QACN,uDAAuD;QACvD,eAAe,EAAE,CAAC,CAAC,CAAC,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,IAAI,MAAK,oBAAoB,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,MAAK,EAAE,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,CAAC,WAAW,0CAAE,MAAM,MAAK,CAAC,CAAC,IACxK;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessage } from '@azure/communication-chat';\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\n/**\n * @private\n */\nexport const convertChatMessage = (message: ChatMessage, status: MessageStatus = 'delivered', clientMessageId?: string): ChatMessageWithStatus => {\n return {\n ...message,\n clientMessageId: clientMessageId,\n status,\n /* @conditional-compile-remove(data-loss-prevention) */\n policyViolation: !!(message.sender?.kind === 'microsoftTeamsUser' && !!message.editedOn && message.content?.message === '' && message.content.attachments?.length === 0)\n };\n};"]}
1
+ {"version":3,"file":"convertChatMessage.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/convertChatMessage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAoB,EAAE,SAAwB,WAAW,EAAE,eAAwB,EAAyB,EAAE;IAC/I,uCACK,OAAO,KACV,eAAe,EAAE,eAAe,EAChC,MAAM,IACN;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessage } from '@azure/communication-chat';\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\n/**\n * @private\n */\nexport const convertChatMessage = (message: ChatMessage, status: MessageStatus = 'delivered', clientMessageId?: string): ChatMessageWithStatus => {\n return {\n ...message,\n clientMessageId: clientMessageId,\n status\n };\n};"]}
@@ -1,6 +1,7 @@
1
1
  export { createStatefulChatClient, _createStatefulChatClientInner, _createStatefulChatClientWithDeps } from './StatefulChatClient';
2
2
  export type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';
3
3
  export type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';
4
+ export type { ResourceFetchResult } from './types/ChatMessageWithStatus';
4
5
  export { ChatError } from './ChatClientState';
5
6
  export type { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget } from './ChatClientState';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAGnI,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createStatefulChatClient, _createStatefulChatClientInner, _createStatefulChatClientWithDeps } from './StatefulChatClient';\nexport type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';\nexport type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nexport { ChatError } from './ChatClientState';\nexport type { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget } from './ChatClientState';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../preprocess-dist/chat-stateful-client/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAKnI,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createStatefulChatClient, _createStatefulChatClientInner, _createStatefulChatClientWithDeps } from './StatefulChatClient';\nexport type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';\nexport type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ResourceFetchResult } from './types/ChatMessageWithStatus';\nexport { ChatError } from './ChatClientState';\nexport type { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget } from './ChatClientState';"]}