@azure/communication-react 1.28.0-beta.2 → 1.28.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 (419) hide show
  1. package/dist/communication-react.d.ts +25 -1371
  2. package/dist/dist-cjs/communication-react/index.js +40155 -174
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/common.d.ts +0 -13
  5. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  6. package/dist/dist-esm/acs-ui-common/src/constants.d.ts +0 -5
  7. package/dist/dist-esm/acs-ui-common/src/constants.js +0 -5
  8. package/dist/dist-esm/acs-ui-common/src/constants.js.map +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/index.d.ts +0 -4
  10. package/dist/dist-esm/acs-ui-common/src/index.js +0 -3
  11. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/safeStringify.d.ts +1 -1
  13. package/dist/dist-esm/acs-ui-common/src/safeStringify.js.map +1 -1
  14. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  15. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  16. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +0 -2
  17. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  18. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +1 -2
  19. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
  20. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +0 -2
  21. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +7 -9
  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/createTeamsCallHandlers.js +1 -25
  24. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
  25. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js +1 -1
  26. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js.map +1 -1
  27. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +0 -1
  28. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  29. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +0 -1
  30. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +1 -3
  31. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
  32. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +0 -4
  33. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -1
  34. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +2 -42
  35. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  36. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +0 -6
  37. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +7 -39
  38. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  39. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +0 -4
  40. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +4 -24
  41. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  42. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -3
  43. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  44. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +2 -5
  45. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
  46. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.d.ts +0 -1
  47. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js +1 -7
  48. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js.map +1 -1
  49. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +0 -10
  50. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  51. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js +18 -4
  52. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
  53. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +0 -17
  54. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -1
  55. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +0 -1
  56. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  57. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +2 -6
  58. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +4 -38
  59. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  60. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +1 -2
  61. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +0 -4
  62. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  63. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.js +1 -1
  64. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.js.map +1 -1
  65. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +2 -25
  66. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  67. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +3 -3
  68. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
  69. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +1 -15
  70. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js.map +1 -1
  71. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +1 -2
  72. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
  73. package/dist/dist-esm/chat-stateful-client/src/index.d.ts +0 -1
  74. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  75. package/dist/dist-esm/communication-react/src/index.d.ts +0 -21
  76. package/dist/dist-esm/communication-react/src/index.js +0 -3
  77. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.d.ts +0 -2
  79. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +1 -2
  80. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
  81. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +1 -13
  82. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +3 -9
  83. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  84. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +0 -11
  85. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +2 -32
  86. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  87. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +1 -8
  88. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +7 -9
  89. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  90. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.d.ts +1 -2
  91. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +4 -4
  92. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
  93. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +1 -4
  94. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +6 -31
  95. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  96. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +1 -15
  97. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +0 -9
  98. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  99. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +2 -23
  100. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +6 -17
  101. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  102. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +1 -8
  103. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +8 -10
  104. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  105. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +5 -5
  106. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  107. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +0 -1
  108. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  109. package/dist/dist-esm/react-components/src/components/ImageOverlay.js +0 -2
  110. package/dist/dist-esm/react-components/src/components/ImageOverlay.js.map +1 -1
  111. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +0 -2
  112. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +0 -15
  113. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  114. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +5 -81
  115. package/dist/dist-esm/react-components/src/components/MessageThread.js +3 -13
  116. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  117. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js +2 -7
  118. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
  119. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +0 -15
  120. package/dist/dist-esm/react-components/src/components/ParticipantList.js +3 -12
  121. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  122. package/dist/dist-esm/react-components/src/components/RaiseHandButton.js +21 -7
  123. package/dist/dist-esm/react-components/src/components/RaiseHandButton.js.map +1 -1
  124. package/dist/dist-esm/react-components/src/components/SendBox.d.ts +1 -47
  125. package/dist/dist-esm/react-components/src/components/SendBox.js +6 -57
  126. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  127. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js +2 -2
  128. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -1
  129. package/dist/dist-esm/react-components/src/components/index.d.ts +0 -21
  130. package/dist/dist-esm/react-components/src/components/index.js +0 -8
  131. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  132. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +1 -1
  133. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +1 -1
  134. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +3 -3
  135. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +0 -8
  136. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  137. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +1 -38
  138. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +3 -30
  139. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  140. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +2 -4
  141. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +2 -9
  142. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  143. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +1 -47
  144. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +4 -154
  145. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  146. package/dist/dist-esm/react-components/src/components/utils/common.js +0 -2
  147. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  148. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +1 -2
  149. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
  150. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js +4 -4
  151. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js.map +1 -1
  152. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +0 -4
  153. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +1 -3
  154. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
  155. package/dist/dist-esm/react-components/src/index.d.ts +0 -1
  156. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  157. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +0 -45
  158. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
  159. package/dist/dist-esm/react-components/src/theming/icons.d.ts +0 -24
  160. package/dist/dist-esm/react-components/src/theming/icons.js +0 -67
  161. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  162. package/dist/dist-esm/react-components/src/theming/themes.d.ts +0 -6
  163. package/dist/dist-esm/react-components/src/theming/themes.js +0 -9
  164. package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
  165. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +0 -13
  166. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  167. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -20
  168. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  169. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +0 -59
  170. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +15 -19
  171. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  172. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +6 -38
  173. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +3 -14
  174. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  175. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +0 -2
  176. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  177. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.d.ts +0 -2
  178. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js +0 -19
  179. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageCameraDropdown.js.map +1 -1
  180. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js +2 -10
  181. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageErrorBar.js.map +1 -1
  182. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.d.ts +0 -2
  183. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js +0 -19
  184. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationPageMicDropdown.js.map +1 -1
  185. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalAndRemotePIP.js +3 -1
  186. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalAndRemotePIP.js.map +1 -1
  187. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +0 -1
  188. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +3 -5
  189. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  190. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts +1 -0
  191. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +7 -5
  192. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  193. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +1 -0
  194. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.js +1 -1
  195. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.js.map +1 -1
  196. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +0 -3
  197. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  198. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +2 -2
  199. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  200. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +0 -7
  201. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +7 -44
  202. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  203. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js +1 -1
  204. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js.map +1 -1
  205. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +2 -2
  206. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  207. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +2 -2
  208. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  209. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +2 -2
  210. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
  211. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +0 -8
  212. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +0 -71
  213. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  214. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +0 -52
  215. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +4 -10
  216. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  217. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +3 -10
  218. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -20
  219. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  220. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -18
  221. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  222. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +4 -10
  223. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +2 -14
  224. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  225. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +0 -27
  226. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +1 -2
  227. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  228. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +0 -2
  229. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +11 -189
  230. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  231. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +0 -20
  232. package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
  233. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +2 -6
  234. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +0 -37
  235. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  236. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +2 -12
  237. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  238. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/OnFetchProfileCallback.js +2 -0
  239. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/OnFetchProfileCallback.js.map +1 -1
  240. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +2 -14
  241. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  242. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +0 -2
  243. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  244. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -4
  245. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -4
  246. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +1 -1
  247. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +1 -1
  248. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  249. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js +1 -2
  250. package/dist/dist-esm/react-composites/src/composites/common/ParticipantContainer.js.map +1 -1
  251. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +2 -41
  252. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +0 -21
  253. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
  254. package/dist/dist-esm/react-composites/src/composites/common/constants.d.ts +0 -5
  255. package/dist/dist-esm/react-composites/src/composites/common/constants.js +0 -5
  256. package/dist/dist-esm/react-composites/src/composites/common/constants.js.map +1 -1
  257. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -26
  258. package/dist/dist-esm/react-composites/src/composites/common/icons.js +0 -2
  259. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  260. package/package.json +4 -4
  261. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js +0 -215
  262. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js.map +0 -1
  263. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-K8NQvjwe.js +0 -49
  264. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-K8NQvjwe.js.map +0 -1
  265. package/dist/dist-cjs/communication-react/index-C-rok69c.js +0 -46100
  266. package/dist/dist-cjs/communication-react/index-C-rok69c.js.map +0 -1
  267. package/dist/dist-esm/acs-ui-common/src/dataConversion.d.ts +0 -6
  268. package/dist/dist-esm/acs-ui-common/src/dataConversion.js +0 -20
  269. package/dist/dist-esm/acs-ui-common/src/dataConversion.js.map +0 -1
  270. package/dist/dist-esm/acs-ui-common/src/removeImageTags.d.ts +0 -7
  271. package/dist/dist-esm/acs-ui-common/src/removeImageTags.js +0 -18
  272. package/dist/dist-esm/acs-ui-common/src/removeImageTags.js.map +0 -1
  273. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.d.ts +0 -17
  274. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js +0 -33
  275. package/dist/dist-esm/calling-stateful-client/src/LocalRecordingSubscriber.js.map +0 -1
  276. package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.d.ts +0 -6
  277. package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js +0 -20
  278. package/dist/dist-esm/chat-component-bindings/src/utils/getImageAttachmentsFromHTMLContent.js.map +0 -1
  279. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.d.ts +0 -10
  280. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js +0 -15
  281. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +0 -1
  282. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +0 -24
  283. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +0 -206
  284. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +0 -1
  285. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.d.ts +0 -69
  286. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js +0 -36
  287. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDenied.js.map +0 -1
  288. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.d.ts +0 -75
  289. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js +0 -67
  290. package/dist/dist-esm/react-components/src/components/DevicePermissions/BrowserPermissionDeniedIOS.js.map +0 -1
  291. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.d.ts +0 -105
  292. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js +0 -51
  293. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissions.js.map +0 -1
  294. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.d.ts +0 -86
  295. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js +0 -40
  296. package/dist/dist-esm/react-components/src/components/DevicePermissions/SitePermissionsScaffolding.js.map +0 -1
  297. package/dist/dist-esm/react-components/src/components/MentionPopover.d.ts +0 -121
  298. package/dist/dist-esm/react-components/src/components/MentionPopover.js +0 -119
  299. package/dist/dist-esm/react-components/src/components/MentionPopover.js.map +0 -1
  300. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.d.ts +0 -9
  301. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js +0 -29
  302. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/ContextMenuPlugin.js.map +0 -1
  303. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +0 -30
  304. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +0 -98
  305. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +0 -1
  306. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.d.ts +0 -19
  307. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js +0 -43
  308. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/KeyboardInputPlugin.js.map +0 -1
  309. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +0 -15
  310. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +0 -42
  311. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +0 -1
  312. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.d.ts +0 -24
  313. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js +0 -64
  314. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/RichTextToolbarPlugin.js.map +0 -1
  315. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.d.ts +0 -20
  316. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js +0 -45
  317. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/TableEditContextMenuProvider.js.map +0 -1
  318. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.d.ts +0 -14
  319. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js +0 -42
  320. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UndoRedoPlugin.js.map +0 -1
  321. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +0 -30
  322. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +0 -99
  323. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +0 -1
  324. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +0 -59
  325. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +0 -334
  326. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +0 -1
  327. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +0 -37
  328. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +0 -78
  329. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +0 -1
  330. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +0 -215
  331. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +0 -183
  332. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +0 -1
  333. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.d.ts +0 -16
  334. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js +0 -75
  335. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +0 -1
  336. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.d.ts +0 -9
  337. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.js +0 -16
  338. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxUtils.js.map +0 -1
  339. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.d.ts +0 -19
  340. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js +0 -229
  341. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/RichTextToolbar.js.map +0 -1
  342. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.d.ts +0 -7
  343. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js +0 -51
  344. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTableCommandBarItem.js.map +0 -1
  345. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.d.ts +0 -15
  346. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js +0 -64
  347. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextInsertTablePane.js.map +0 -1
  348. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.d.ts +0 -6
  349. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js +0 -13
  350. package/dist/dist-esm/react-components/src/components/RichTextEditor/Toolbar/Table/RichTextToolbarTableIcon.js.map +0 -1
  351. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.d.ts +0 -56
  352. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js +0 -75
  353. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +0 -1
  354. package/dist/dist-esm/react-components/src/components/SendBoxErrors.d.ts +0 -14
  355. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js +0 -18
  356. package/dist/dist-esm/react-components/src/components/SendBoxErrors.js.map +0 -1
  357. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.d.ts +0 -24
  358. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +0 -550
  359. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +0 -1
  360. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.d.ts +0 -152
  361. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +0 -819
  362. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +0 -1
  363. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.d.ts +0 -58
  364. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js +0 -144
  365. package/dist/dist-esm/react-components/src/components/styles/BrowserPermissionDenied.styles.js.map +0 -1
  366. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.d.ts +0 -26
  367. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js +0 -69
  368. package/dist/dist-esm/react-components/src/components/styles/MentionPopover.style.js.map +0 -1
  369. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +0 -82
  370. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +0 -328
  371. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +0 -1
  372. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.d.ts +0 -21
  373. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js +0 -38
  374. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js.map +0 -1
  375. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.d.ts +0 -38
  376. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js +0 -99
  377. package/dist/dist-esm/react-components/src/components/styles/SitePermissions.styles.js.map +0 -1
  378. package/dist/dist-esm/react-components/src/components/styles/Stack.style.d.ts +0 -5
  379. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js +0 -32
  380. package/dist/dist-esm/react-components/src/components/styles/Stack.style.js.map +0 -1
  381. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.d.ts +0 -73
  382. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +0 -178
  383. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +0 -1
  384. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.d.ts +0 -33
  385. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +0 -119
  386. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +0 -1
  387. package/dist/dist-esm/react-components/src/components/utils/merge.d.ts +0 -7
  388. package/dist/dist-esm/react-components/src/components/utils/merge.js +0 -16
  389. package/dist/dist-esm/react-components/src/components/utils/merge.js.map +0 -1
  390. package/dist/dist-esm/react-components/src/theming/icons.styles.d.ts +0 -6
  391. package/dist/dist-esm/react-components/src/theming/icons.styles.js +0 -25
  392. package/dist/dist-esm/react-components/src/theming/icons.styles.js.map +0 -1
  393. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +0 -46
  394. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +0 -200
  395. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +0 -1
  396. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.d.ts +0 -15
  397. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js +0 -23
  398. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js.map +0 -1
  399. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.d.ts +0 -18
  400. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js +0 -18
  401. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreenPeoplePane.js.map +0 -1
  402. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.d.ts +0 -49
  403. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js +0 -44
  404. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadReducer.js.map +0 -1
  405. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.d.ts +0 -39
  406. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js +0 -265
  407. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ImageUpload/ImageUploadUtils.js.map +0 -1
  408. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +0 -80
  409. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +0 -36
  410. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +0 -1
  411. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.d.ts +0 -38
  412. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +0 -67
  413. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +0 -1
  414. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +0 -5
  415. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js +0 -5
  416. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +0 -1
  417. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +0 -10
  418. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +0 -16
  419. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +0 -1
@@ -74,7 +74,12 @@ function createViewVideo(context, internalContext, callId, stream, participantId
74
74
  return;
75
75
  }
76
76
  const renderer = new VideoStreamRenderer(renderInfo.stream);
77
- streamEventType === 'createViewRemote' && participantKey ? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Rendering', undefined) : internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Rendering', renderer);
77
+ if (streamEventType === 'createViewRemote' && participantKey) {
78
+ internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Rendering', undefined);
79
+ }
80
+ else {
81
+ internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Rendering', renderer);
82
+ }
78
83
  let view;
79
84
  try {
80
85
  view = yield renderer.createView(options);
@@ -98,13 +103,17 @@ function createViewVideo(context, internalContext, callId, stream, participantId
98
103
  // and clean up the state.
99
104
  _logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);
100
105
  renderer.dispose();
101
- streamEventType === 'createViewRemote' && participantKey ? context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined) : context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);
106
+ if (streamEventType === 'createViewRemote' && participantKey) {
107
+ context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);
108
+ }
109
+ else {
110
+ context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);
111
+ }
102
112
  return;
103
113
  }
104
114
  if (refreshedRenderInfo.status === 'Stopping') {
105
115
  // Stop render was called on this stream after we had started rendering. We will dispose this view and do not
106
116
  // put the view into the state.
107
- streamEventType === 'createViewRemote';
108
117
  _logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);
109
118
  renderer.dispose();
110
119
  if (streamEventType === 'createViewRemote' && participantKey) {
@@ -246,7 +255,12 @@ function disposeViewVideo(context, internalContext, callId, stream, participantI
246
255
  // rendering and clean up the state once the view has finished being created.
247
256
  if (renderInfo.status === 'Rendering') {
248
257
  _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
249
- streamEventType === 'disposeViewRemote' && participantKey ? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Stopping', undefined) : internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Stopping', renderInfo.renderer);
258
+ if (streamEventType === 'disposeViewRemote' && participantKey) {
259
+ internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Stopping', undefined);
260
+ }
261
+ else {
262
+ internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Stopping', renderInfo.renderer);
263
+ }
250
264
  return;
251
265
  }
252
266
  if (renderInfo.renderer) {
@@ -1 +1 @@
1
- {"version":3,"file":"StreamUtils.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/StreamUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAqB,gBAAgB,EAAqB,mBAAmB,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AAC;IAC5D,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CreateViewOptions, LocalVideoStream, RemoteVideoStream, VideoStreamRenderer, VideoStreamRendererView } from '@azure/communication-calling';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport { convertSdkLocalStreamToDeclarativeLocalStream, convertSdkRemoteStreamToDeclarativeRemoteStream, convertFromSDKToDeclarativeVideoStreamRendererView } from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { toFlatCommunicationIdentifier, _logEvent } from '@internal/acs-ui-common';\nimport { EventNames } from './Logger';\nimport { _logStreamEvent } from './StreamUtilsLogging';\n\n/**\n * Return result from {@link StatefulCallClient.createView}.\n *\n * @public\n */\nexport type CreateViewResult = {\n renderer: VideoStreamRenderer;\n view: VideoStreamRendererView;\n};\nasync function createViewVideo(context: CallContext, internalContext: InternalCallContext, callId: string, stream?: RemoteVideoStreamState | LocalVideoStreamState, participantId?: CommunicationIdentifierKind | string, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n // we can only have 3 types of createView\n let streamEventType: 'createViewLocal' | 'createViewRemote' | 'createViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'createViewRemote';\n } else if (callId) {\n streamEventType = 'createViewLocal';\n } else {\n // TODO update for when unparented view.\n throw new Error('unparented createView not implemented yet here');\n streamEventType = 'createViewUnparented';\n }\n const streamType = stream?.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey = streamEventType === 'createViewRemote' && participantId ? typeof participantId === 'string' ? participantId : toFlatCommunicationIdentifier(participantId) : undefined;\n const streamLogInfo = {\n callId,\n participantKey,\n streamId: remoteStreamId ?? localStreamKey,\n streamType,\n streamEventType\n };\n\n // make different logging announcement based on whether or not we are starting a local or remote\n _logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);\n\n // if we have a participant Id and a stream get the remote info, else get the local render info from state.\n const renderInfo = streamEventType === 'createViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!renderInfo) {\n _logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n _logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);\n return;\n }\n\n // \"Stopping\" only happens if the stream was in \"rendering\" but `disposeView` was called.\n // Now that `createView` has been re-called, we can flip the state back to \"rendering\".\n if (renderInfo.status === 'Stopping') {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Rendering', renderInfo.renderer);\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Rendering', renderInfo.renderer);\n }\n return;\n }\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n streamEventType === 'createViewRemote' && participantKey ? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Rendering', undefined) : internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Rendering', renderer);\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n }\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = streamEventType === 'createViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!refreshedRenderInfo) {\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\n // and clean up the state.\n _logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);\n renderer.dispose();\n streamEventType === 'createViewRemote' && participantKey ? context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined) : context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n return;\n }\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state.\n streamEventType === 'createViewRemote';\n _logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);\n renderer.dispose();\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n return;\n }\n\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream as RemoteVideoStream, 'Rendered', renderer);\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream as LocalVideoStream, 'Rendered', renderer);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n }\n return {\n renderer,\n view\n };\n}\nasync function createViewUnparentedVideo(context: CallContext, internalContext: InternalCallContext, stream: LocalVideoStreamState, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (renderInfo && renderInfo.status === 'Rendered') {\n console.warn('Unparented LocalVideoStream is already rendered');\n return;\n }\n if (renderInfo && renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n return;\n }\n if (renderInfo && renderInfo.status === 'Stopping') {\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\n return;\n }\n const localVideoStream = new LocalVideoStream(stream.source);\n const renderer = new VideoStreamRenderer(localVideoStream);\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\n let view: VideoStreamRendererView;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n // Special case for unparented views. Since they are not tied to anything and created by us based on the calls to\n // this function we'll delete it to clean up the data since keeping it around doesn't help us and if developer wants\n // to create a new view they can check that the view is not rendered and call this function again.\n internalContext.deleteUnparentedRenderInfo(stream);\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!refreshedRenderInfo) {\n // Unparented stream's RenderInfo was deleted. Currently this shouldn't happen but if it does we'll just dispose the\n // renderer and clean up state. If developer wanted the stream they could call this function again and that should\n // generate new working state via this function.\n renderer.dispose();\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state. Special case for unparented views, delete them from state when stopped to free up\n // the memory since we were the ones generating this and not tied to any Call state.\n internalContext.deleteUnparentedRenderInfo(stream);\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);\n internalContext.subscribeToUnparentedViewVideoEffects(localVideoStream, context);\n context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n return {\n renderer,\n view\n };\n}\nfunction disposeViewVideo(context: CallContext, internalContext: InternalCallContext, callId: string, stream: RemoteVideoStreamState | LocalVideoStreamState, participantId?: CommunicationIdentifierKind | string): void {\n // we can only have 3 types of createView\n let streamEventType: 'disposeViewLocal' | 'disposeViewRemote' | 'disposeViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'disposeViewRemote';\n } else if (callId) {\n streamEventType = 'disposeViewLocal';\n } else {\n // TODO update for when unparented view.\n streamEventType = 'disposeViewUnparented';\n }\n const streamType = stream.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey = streamEventType === 'disposeViewRemote' && participantId ? typeof participantId === 'string' ? participantId : toFlatCommunicationIdentifier(participantId) : undefined;\n const streamLogInfo = {\n callId,\n participantKey,\n streamId: remoteStreamId ?? localStreamKey,\n streamType\n };\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n }\n const renderInfo = streamEventType === 'disposeViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n // Nothing to dispose of or clean up -- we can safely exit early here.\n if (renderInfo.status === 'NotRendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);\n return;\n }\n\n // Status is already marked as \"stopping\" so we can exit early here. This is because stopping only occurs\n // when the stream is being created in createView but hasn't been completed being created yet. The createView\n // method will see the \"stopping\" status and perform the cleanup\n if (renderInfo.status === 'Stopping') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n return;\n }\n\n // If the stream is in the middle of being rendered (i.e. has state \"Rendering\"), we need the status as\n // \"stopping\" without performing any cleanup. This will tell the `createView` method that it should stop\n // rendering and clean up the state once the view has finished being created.\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n streamEventType === 'disposeViewRemote' && participantKey ? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Stopping', undefined) : internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Stopping', renderInfo.renderer);\n return;\n }\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n // Else the state must be in the \"Rendered\" state, so we can dispose the renderer and clean up the state.\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n } else if (streamEventType === 'disposeViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\nfunction disposeViewUnparentedVideo(context: CallContext, internalContext: InternalCallContext, stream: LocalVideoStreamState): void {\n const streamType = stream.mediaStreamType;\n const streamLogInfo = {\n streamType,\n streamEventType: 'disposeViewUnparented'\n };\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n context.deleteDeviceManagerUnparentedView(stream);\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.deleteUnparentedRenderInfo(stream);\n }\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\n/**\n * @private\n */\nexport function createView(context: CallContext, internalContext: InternalCallContext, callId: string | undefined, participantId: CommunicationIdentifierKind | string | undefined, stream: LocalVideoStreamState | RemoteVideoStreamState, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n const streamType = stream.mediaStreamType;\n if (callId) {\n return createViewVideo(context, internalContext, callId, stream, participantId, options);\n } else if (!('id' in stream) && !callId) {\n // Render LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a startLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n return context.withAsyncErrorTeedToState(async () => await createViewUnparentedVideo(context, internalContext, stream, options), 'Call.startVideo')();\n } else {\n _logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, {\n streamType\n });\n return Promise.resolve(undefined);\n }\n}\n\n/**\n * @private\n */\nexport function disposeView(context: CallContext, internalContext: InternalCallContext, callId: string | undefined, participantId: CommunicationIdentifierKind | string | undefined, stream: LocalVideoStreamState | RemoteVideoStreamState): void {\n const streamType = stream.mediaStreamType;\n if (callId) {\n disposeViewVideo(context, internalContext, callId, stream, participantId);\n } else if (!('id' in stream) && !callId) {\n // Stop rendering LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a stopLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n context.withErrorTeedToState(() => disposeViewUnparentedVideo(context, internalContext, stream), 'Call.stopVideo')();\n } else {\n _logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, {\n streamType\n });\n return;\n }\n}\n\n/**\n * @private\n * Only stops videos that are tied to a Call.\n */\nexport function disposeAllViewsFromCall(context: CallContext, internalContext: InternalCallContext, callId: string): void {\n const remoteStreams = internalContext.getRemoteRenderInfoForCall(callId);\n if (remoteStreams) {\n for (const [participantKey, participantStreams] of remoteStreams.entries()) {\n for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(context, internalContext, callId, participantKey, convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream));\n }\n }\n }\n const localStreams = internalContext.getLocalRenderInfosForCall(callId);\n if (localStreams) {\n for (const localStreamAndRenderer of localStreams.values()) {\n if (localStreamAndRenderer && localStreamAndRenderer.renderer) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(context, internalContext, callId, undefined, convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream));\n }\n }\n }\n const callFeatureStreams = internalContext.getCallFeatureRenderInfosForCall(callId);\n if (callFeatureStreams) {\n for (const featureStreams of callFeatureStreams.values()) {\n for (const streamAndRenderer of featureStreams.values()) {\n disposeView(context, internalContext, callId, undefined, convertSdkRemoteStreamToDeclarativeRemoteStream(streamAndRenderer.stream as RemoteVideoStream));\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\n const callIds = internalContext.getCallIds();\n for (const callId of callIds) {\n disposeAllViewsFromCall(context, internalContext, callId);\n }\n}"]}
1
+ {"version":3,"file":"StreamUtils.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/StreamUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAqB,gBAAgB,EAAqB,mBAAmB,EAA2B,MAAM,8BAA8B,CAAC;AAIpJ,OAAO,EAAE,6CAA6C,EAAE,+CAA+C,EAAE,kDAAkD,EAAE,MAAM,aAAa,CAAC;AAEjL,OAAO,EAAE,6BAA6B,EAAa,gCAAgC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAWvD,SAAe,eAAe,CAAC,OAAoB,EAAE,eAAoC,EAAE,MAAc,EAAE,MAAuD,EAAE,aAAoD,EAAE,OAA2B;;QACnP,yCAAyC;QACzC,IAAI,eAAgF,CAAC;QAErF,6GAA6G;QAE7G,IAAI,aAAa,EAAE,CAAC;YAClB,eAAe,GAAG,kBAAkB,CAAC;QACvC,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YAClB,eAAe,GAAG,iBAAiB,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,wCAAwC;YACxC,MAAM,IAAI,KAAK,CA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AAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;YACzI,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,kBAAkB,GAAG,eAAe,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC;IACpF,IAAI,kBAAkB,EAAE,CAAC;QACvB,KAAK,MAAM,cAAc,IAAI,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;YACzD,KAAK,MAAM,iBAAiB,IAAI,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC;gBACxD,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,+CAA+C,CAAC,iBAAiB,CAAC,MAA2B,CAAC,CAAC,CAAC;YAC3J,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAoB,EAAE,eAAoC;IACxF,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,EAAE,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CreateViewOptions, LocalVideoStream, RemoteVideoStream, VideoStreamRenderer, VideoStreamRendererView } from '@azure/communication-calling';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport { convertSdkLocalStreamToDeclarativeLocalStream, convertSdkRemoteStreamToDeclarativeRemoteStream, convertFromSDKToDeclarativeVideoStreamRendererView } from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { toFlatCommunicationIdentifier, _logEvent } from '@internal/acs-ui-common';\nimport { EventNames } from './Logger';\nimport { _logStreamEvent } from './StreamUtilsLogging';\n\n/**\n * Return result from {@link StatefulCallClient.createView}.\n *\n * @public\n */\nexport type CreateViewResult = {\n renderer: VideoStreamRenderer;\n view: VideoStreamRendererView;\n};\nasync function createViewVideo(context: CallContext, internalContext: InternalCallContext, callId: string, stream?: RemoteVideoStreamState | LocalVideoStreamState, participantId?: CommunicationIdentifierKind | string, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n // we can only have 3 types of createView\n let streamEventType: 'createViewLocal' | 'createViewRemote' | 'createViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'createViewRemote';\n } else if (callId) {\n streamEventType = 'createViewLocal';\n } else {\n // TODO update for when unparented view.\n throw new Error('unparented createView not implemented yet here');\n streamEventType = 'createViewUnparented';\n }\n const streamType = stream?.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey = streamEventType === 'createViewRemote' && participantId ? typeof participantId === 'string' ? participantId : toFlatCommunicationIdentifier(participantId) : undefined;\n const streamLogInfo = {\n callId,\n participantKey,\n streamId: remoteStreamId ?? localStreamKey,\n streamType,\n streamEventType\n };\n\n // make different logging announcement based on whether or not we are starting a local or remote\n _logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);\n\n // if we have a participant Id and a stream get the remote info, else get the local render info from state.\n const renderInfo = streamEventType === 'createViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!renderInfo) {\n _logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n _logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);\n return;\n }\n\n // \"Stopping\" only happens if the stream was in \"rendering\" but `disposeView` was called.\n // Now that `createView` has been re-called, we can flip the state back to \"rendering\".\n if (renderInfo.status === 'Stopping') {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Rendering', renderInfo.renderer);\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Rendering', renderInfo.renderer);\n }\n return;\n }\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Rendering', undefined);\n } else {\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Rendering', renderer);\n }\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n }\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = streamEventType === 'createViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!refreshedRenderInfo) {\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\n // and clean up the state.\n _logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);\n renderer.dispose();\n if (streamEventType === 'createViewRemote' && participantKey) {\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n } else {\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n return;\n }\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state.\n _logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);\n renderer.dispose();\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n return;\n }\n\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream as RemoteVideoStream, 'Rendered', renderer);\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream as LocalVideoStream, 'Rendered', renderer);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n }\n return {\n renderer,\n view\n };\n}\nasync function createViewUnparentedVideo(context: CallContext, internalContext: InternalCallContext, stream: LocalVideoStreamState, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (renderInfo && renderInfo.status === 'Rendered') {\n console.warn('Unparented LocalVideoStream is already rendered');\n return;\n }\n if (renderInfo && renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n return;\n }\n if (renderInfo && renderInfo.status === 'Stopping') {\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\n return;\n }\n const localVideoStream = new LocalVideoStream(stream.source);\n const renderer = new VideoStreamRenderer(localVideoStream);\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\n let view: VideoStreamRendererView;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n // Special case for unparented views. Since they are not tied to anything and created by us based on the calls to\n // this function we'll delete it to clean up the data since keeping it around doesn't help us and if developer wants\n // to create a new view they can check that the view is not rendered and call this function again.\n internalContext.deleteUnparentedRenderInfo(stream);\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!refreshedRenderInfo) {\n // Unparented stream's RenderInfo was deleted. Currently this shouldn't happen but if it does we'll just dispose the\n // renderer and clean up state. If developer wanted the stream they could call this function again and that should\n // generate new working state via this function.\n renderer.dispose();\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state. Special case for unparented views, delete them from state when stopped to free up\n // the memory since we were the ones generating this and not tied to any Call state.\n internalContext.deleteUnparentedRenderInfo(stream);\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);\n internalContext.subscribeToUnparentedViewVideoEffects(localVideoStream, context);\n context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n return {\n renderer,\n view\n };\n}\nfunction disposeViewVideo(context: CallContext, internalContext: InternalCallContext, callId: string, stream: RemoteVideoStreamState | LocalVideoStreamState, participantId?: CommunicationIdentifierKind | string): void {\n // we can only have 3 types of createView\n let streamEventType: 'disposeViewLocal' | 'disposeViewRemote' | 'disposeViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'disposeViewRemote';\n } else if (callId) {\n streamEventType = 'disposeViewLocal';\n } else {\n // TODO update for when unparented view.\n streamEventType = 'disposeViewUnparented';\n }\n const streamType = stream.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey = streamEventType === 'disposeViewRemote' && participantId ? typeof participantId === 'string' ? participantId : toFlatCommunicationIdentifier(participantId) : undefined;\n const streamLogInfo = {\n callId,\n participantKey,\n streamId: remoteStreamId ?? localStreamKey,\n streamType\n };\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n }\n const renderInfo = streamEventType === 'disposeViewRemote' && participantKey ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId) : internalContext.getLocalRenderInfo(callId, localStreamKey);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n // Nothing to dispose of or clean up -- we can safely exit early here.\n if (renderInfo.status === 'NotRendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);\n return;\n }\n\n // Status is already marked as \"stopping\" so we can exit early here. This is because stopping only occurs\n // when the stream is being created in createView but hasn't been completed being created yet. The createView\n // method will see the \"stopping\" status and perform the cleanup\n if (renderInfo.status === 'Stopping') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n return;\n }\n\n // If the stream is in the middle of being rendered (i.e. has state \"Rendering\"), we need the status as\n // \"stopping\" without performing any cleanup. This will tell the `createView` method that it should stop\n // rendering and clean up the state once the view has finished being created.\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'Stopping', undefined);\n } else {\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'Stopping', renderInfo.renderer);\n }\n return;\n }\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n // Else the state must be in the \"Rendered\" state, so we can dispose the renderer and clean up the state.\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream as RemoteVideoStream, 'NotRendered', undefined);\n } else if (streamEventType === 'disposeViewLocal') {\n internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\nfunction disposeViewUnparentedVideo(context: CallContext, internalContext: InternalCallContext, stream: LocalVideoStreamState): void {\n const streamType = stream.mediaStreamType;\n const streamLogInfo = {\n streamType,\n streamEventType: 'disposeViewUnparented'\n };\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n context.deleteDeviceManagerUnparentedView(stream);\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.deleteUnparentedRenderInfo(stream);\n }\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\n/**\n * @private\n */\nexport function createView(context: CallContext, internalContext: InternalCallContext, callId: string | undefined, participantId: CommunicationIdentifierKind | string | undefined, stream: LocalVideoStreamState | RemoteVideoStreamState, options?: CreateViewOptions): Promise<CreateViewResult | undefined> {\n const streamType = stream.mediaStreamType;\n if (callId) {\n return createViewVideo(context, internalContext, callId, stream, participantId, options);\n } else if (!('id' in stream) && !callId) {\n // Render LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a startLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n return context.withAsyncErrorTeedToState(async () => await createViewUnparentedVideo(context, internalContext, stream, options), 'Call.startVideo')();\n } else {\n _logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, {\n streamType\n });\n return Promise.resolve(undefined);\n }\n}\n\n/**\n * @private\n */\nexport function disposeView(context: CallContext, internalContext: InternalCallContext, callId: string | undefined, participantId: CommunicationIdentifierKind | string | undefined, stream: LocalVideoStreamState | RemoteVideoStreamState): void {\n const streamType = stream.mediaStreamType;\n if (callId) {\n disposeViewVideo(context, internalContext, callId, stream, participantId);\n } else if (!('id' in stream) && !callId) {\n // Stop rendering LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a stopLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n context.withErrorTeedToState(() => disposeViewUnparentedVideo(context, internalContext, stream), 'Call.stopVideo')();\n } else {\n _logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, {\n streamType\n });\n return;\n }\n}\n\n/**\n * @private\n * Only stops videos that are tied to a Call.\n */\nexport function disposeAllViewsFromCall(context: CallContext, internalContext: InternalCallContext, callId: string): void {\n const remoteStreams = internalContext.getRemoteRenderInfoForCall(callId);\n if (remoteStreams) {\n for (const [participantKey, participantStreams] of remoteStreams.entries()) {\n for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(context, internalContext, callId, participantKey, convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream));\n }\n }\n }\n const localStreams = internalContext.getLocalRenderInfosForCall(callId);\n if (localStreams) {\n for (const localStreamAndRenderer of localStreams.values()) {\n if (localStreamAndRenderer && localStreamAndRenderer.renderer) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(context, internalContext, callId, undefined, convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream));\n }\n }\n }\n const callFeatureStreams = internalContext.getCallFeatureRenderInfosForCall(callId);\n if (callFeatureStreams) {\n for (const featureStreams of callFeatureStreams.values()) {\n for (const streamAndRenderer of featureStreams.values()) {\n disposeView(context, internalContext, callId, undefined, convertSdkRemoteStreamToDeclarativeRemoteStream(streamAndRenderer.stream as RemoteVideoStream));\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\n const callIds = internalContext.getCallIds();\n for (const callId of callIds) {\n disposeAllViewsFromCall(context, internalContext, callId);\n }\n}"]}
@@ -1,26 +1,9 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
3
  import { ProxyCallCommon } from './CallDeclarativeCommon';
13
4
  class ProxyTeamsCall extends ProxyCallCommon {
14
5
  get(target, prop) {
15
6
  switch (prop) {
16
- case 'addParticipant':
17
- {
18
- return this.getContext().withAsyncErrorTeedToState(function (...args) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- return yield target.addParticipant(...args);
21
- });
22
- }, 'TeamsCall.addParticipant');
23
- }
24
7
  default:
25
8
  return super.get(target, prop);
26
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TeamsCallDeclarative.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/TeamsCallDeclarative.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAc1D,MAAM,cAAe,SAAQ,eAAe;IACnC,GAAG,CAA4B,MAAiB,EAAE,IAAO;QAC9D,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,gBAAgB;gBACnB,CAAC;oBACC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,yBAAyB,CAAC,UAAgB,GAAG,IAA6C;;4BACjH,OAAO,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;wBAC9C,CAAC;qBAAA,EAAE,0BAA0B,CAAC,CAAC;gBACjC,CAAC;YACH;gBACE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAe,EAAE,OAAoB,EAAwB,EAAE;IAClG,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9C,SAAS,CAAC,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE;QACzC,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE;KACrC,CAAC,CAAC;IACH,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,SAAS,CAAyB,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProxyCallCommon } from './CallDeclarativeCommon';\nimport { CallContext } from './CallContext';\nimport { TeamsCall } from './BetaToStableTypes';\n\n/**\n *\n * @public\n */\nexport type DeclarativeTeamsCall = TeamsCall & {\n /**\n * Stop any declarative specific subscriptions and remove declarative subscribers.\n */\n unsubscribe(): void;\n};\nclass ProxyTeamsCall extends ProxyCallCommon implements ProxyHandler<TeamsCall> {\n public get<P extends keyof TeamsCall>(target: TeamsCall, prop: P): any {\n switch (prop) {\n case 'addParticipant':\n {\n return this.getContext().withAsyncErrorTeedToState(async function (...args: Parameters<TeamsCall['addParticipant']>) {\n return await target.addParticipant(...args);\n }, 'TeamsCall.addParticipant');\n }\n default:\n return super.get(target, prop as any);\n }\n return super.get(target, prop as any);\n }\n}\n\n/**\n * Creates a declarative Call by proxying Call with ProxyCall.\n * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that\n * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to\n * context)\n *\n * @param call - TeamsCall from SDK\n * @param context - CallContext from StatefulCallClient\n */\nexport const teamsCallDeclaratify = (call: TeamsCall, context: CallContext): DeclarativeTeamsCall => {\n const proxyCall = new ProxyTeamsCall(context);\n proxyCall.unsubscribe();\n Object.defineProperty(call, 'unsubscribe', {\n configurable: false,\n value: () => proxyCall.unsubscribe()\n });\n return new Proxy(call, proxyCall) as DeclarativeTeamsCall;\n};"]}
1
+ {"version":3,"file":"TeamsCallDeclarative.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/TeamsCallDeclarative.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAc1D,MAAM,cAAe,SAAQ,eAAe;IACnC,GAAG,CAA4B,MAAiB,EAAE,IAAO;QAC9D,QAAQ,IAAI,EAAE,CAAC;YACb;gBACE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAe,EAAE,OAAoB,EAAwB,EAAE;IAClG,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9C,SAAS,CAAC,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE;QACzC,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE;KACrC,CAAC,CAAC;IACH,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,SAAS,CAAyB,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProxyCallCommon } from './CallDeclarativeCommon';\nimport { CallContext } from './CallContext';\nimport { TeamsCall } from './BetaToStableTypes';\n\n/**\n *\n * @public\n */\nexport type DeclarativeTeamsCall = TeamsCall & {\n /**\n * Stop any declarative specific subscriptions and remove declarative subscribers.\n */\n unsubscribe(): void;\n};\nclass ProxyTeamsCall extends ProxyCallCommon implements ProxyHandler<TeamsCall> {\n public get<P extends keyof TeamsCall>(target: TeamsCall, prop: P): any {\n switch (prop) {\n default:\n return super.get(target, prop as any);\n }\n return super.get(target, prop as any);\n }\n}\n\n/**\n * Creates a declarative Call by proxying Call with ProxyCall.\n * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that\n * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to\n * context)\n *\n * @param call - TeamsCall from SDK\n * @param context - CallContext from StatefulCallClient\n */\nexport const teamsCallDeclaratify = (call: TeamsCall, context: CallContext): DeclarativeTeamsCall => {\n const proxyCall = new ProxyTeamsCall(context);\n proxyCall.unsubscribe();\n Object.defineProperty(call, 'unsubscribe', {\n configurable: false,\n value: () => proxyCall.unsubscribe()\n });\n return new Proxy(call, proxyCall) as DeclarativeTeamsCall;\n};"]}
@@ -19,7 +19,6 @@ export type { OptimalVideoCountFeatureState } from './CallClientState';
19
19
  export type { PPTLiveCallFeatureState } from './CallClientState';
20
20
  export type { ReactionState } from './CallClientState';
21
21
  export type { SpotlightCallFeatureState, SpotlightState } from './CallClientState';
22
- export type { LocalRecordingCallFeatureState } from './CallClientState';
23
22
  export type { ConferencePhoneInfo } from './CallClientState';
24
23
  export type { BreakoutRoomsState } from './CallClientState';
25
24
  export type { MediaAccessState } from './CallClientState';
@@ -1 +1 @@
1
- {"version":3,"file":"index-public.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/index-public.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createStatefulCallClient } from './StatefulCallClient';\nexport type { StatefulCallClient, StatefulCallClientArgs, StatefulCallClientOptions } from './StatefulCallClient';\nexport type { StatefulDeviceManager } from './DeviceManagerDeclarative';\nexport type { CallAgentState, CallClientState, CallError, CallErrors, CallErrorTarget, CallState, DeviceManagerState, DiagnosticsCallFeatureState, IncomingCallState, LocalVideoStreamState, MediaDiagnosticsState, NetworkDiagnosticsState, RecordingCallFeatureState as RecordingCallFeature, RemoteParticipantState, RemoteVideoStreamState, TranscriptionCallFeatureState as TranscriptionCallFeature, VideoStreamRendererViewState, CallInfoState } from './CallClientState';\nexport type { CallNotification, CallNotifications, NotificationTarget } from './CallClientState';\nexport type { TeamsIncomingCallState } from './CallClientState';\nexport type { CreateViewResult } from './StreamUtils';\nexport type { RaiseHandCallFeatureState as RaiseHandCallFeature } from './CallClientState';\nexport type { CallFeatureStreamState, TogetherModeSeatingPositionState, CallFeatureStreamName, TogetherModeStreamsState, TogetherModeParticipantSeatingState, TogetherModeCallFeatureState } from './CallClientState';\nexport type { RaisedHandState } from './CallClientState';\nexport type { DeclarativeCallAgent, IncomingCallManagement } from './CallAgentDeclarative';\nexport type { DeclarativeTeamsCallAgent } from './TeamsCallAgentDeclarative';\nexport type { TeamsIncomingCallManagement } from './TeamsCallAgentDeclarative';\nexport type { LocalVideoStreamVideoEffectsState } from './CallClientState';\nexport type { CapabilitiesFeatureState } from './CallClientState';\nexport type { CaptionsCallFeatureState, CaptionsInfo } from './CallClientState';\nexport type { AcceptedTransfer, TransferFeatureState as TransferFeature } from './CallClientState';\nexport type { OptimalVideoCountFeatureState } from './CallClientState';\nexport type { PPTLiveCallFeatureState } from './CallClientState';\nexport type { ReactionState } from './CallClientState';\nexport type { SpotlightCallFeatureState, SpotlightState } from './CallClientState';\nexport type { LocalRecordingCallFeatureState } from './CallClientState';\nexport type { ConferencePhoneInfo } from './CallClientState';\nexport type { BreakoutRoomsState } from './CallClientState';\nexport type { MediaAccessState } from './CallClientState';\nexport type { RealTimeTextInfo, RealTimeTextCallFeatureState } from './CallClientState';"]}
1
+ {"version":3,"file":"index-public.js","sourceRoot":"","sources":["../../../../preprocess-dist/calling-stateful-client/src/index-public.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createStatefulCallClient } from './StatefulCallClient';\nexport type { StatefulCallClient, StatefulCallClientArgs, StatefulCallClientOptions } from './StatefulCallClient';\nexport type { StatefulDeviceManager } from './DeviceManagerDeclarative';\nexport type { CallAgentState, CallClientState, CallError, CallErrors, CallErrorTarget, CallState, DeviceManagerState, DiagnosticsCallFeatureState, IncomingCallState, LocalVideoStreamState, MediaDiagnosticsState, NetworkDiagnosticsState, RecordingCallFeatureState as RecordingCallFeature, RemoteParticipantState, RemoteVideoStreamState, TranscriptionCallFeatureState as TranscriptionCallFeature, VideoStreamRendererViewState, CallInfoState } from './CallClientState';\nexport type { CallNotification, CallNotifications, NotificationTarget } from './CallClientState';\nexport type { TeamsIncomingCallState } from './CallClientState';\nexport type { CreateViewResult } from './StreamUtils';\nexport type { RaiseHandCallFeatureState as RaiseHandCallFeature } from './CallClientState';\nexport type { CallFeatureStreamState, TogetherModeSeatingPositionState, CallFeatureStreamName, TogetherModeStreamsState, TogetherModeParticipantSeatingState, TogetherModeCallFeatureState } from './CallClientState';\nexport type { RaisedHandState } from './CallClientState';\nexport type { DeclarativeCallAgent, IncomingCallManagement } from './CallAgentDeclarative';\nexport type { DeclarativeTeamsCallAgent } from './TeamsCallAgentDeclarative';\nexport type { TeamsIncomingCallManagement } from './TeamsCallAgentDeclarative';\nexport type { LocalVideoStreamVideoEffectsState } from './CallClientState';\nexport type { CapabilitiesFeatureState } from './CallClientState';\nexport type { CaptionsCallFeatureState, CaptionsInfo } from './CallClientState';\nexport type { AcceptedTransfer, TransferFeatureState as TransferFeature } from './CallClientState';\nexport type { OptimalVideoCountFeatureState } from './CallClientState';\nexport type { PPTLiveCallFeatureState } from './CallClientState';\nexport type { ReactionState } from './CallClientState';\nexport type { SpotlightCallFeatureState, SpotlightState } from './CallClientState';\nexport type { ConferencePhoneInfo } from './CallClientState';\nexport type { BreakoutRoomsState } from './CallClientState';\nexport type { MediaAccessState } from './CallClientState';\nexport type { RealTimeTextInfo, RealTimeTextCallFeatureState } from './CallClientState';"]}
@@ -1,9 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { Common } from "../../../acs-ui-common/src";
3
3
  import { StatefulChatClient } from "../../../chat-stateful-client/src";
4
- import { UploadChatImageResult } from "../../../acs-ui-common/src";
5
4
  import { ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';
6
- import { MessageOptions } from "../../../acs-ui-common/src";
7
5
  /**
8
6
  * Object containing all the handlers required for chat components.
9
7
  *
@@ -13,15 +11,13 @@ import { MessageOptions } from "../../../acs-ui-common/src";
13
11
  * @public
14
12
  */
15
13
  export type ChatHandlers = {
16
- onSendMessage: (content: string, options?: SendMessageOptions | MessageOptions) => Promise<void>;
17
- onUploadImage: (image: Blob, imageFilename: string) => Promise<UploadChatImageResult>;
18
- onDeleteImage: (imageId: string) => Promise<void>;
14
+ onSendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;
19
15
  onMessageSeen: (chatMessageId: string) => Promise<void>;
20
16
  onTyping: () => Promise<void>;
21
17
  onRemoveParticipant: (userId: string) => Promise<void>;
22
18
  updateThreadTopicName: (topicName: string) => Promise<void>;
23
19
  onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;
24
- onUpdateMessage: (messageId: string, content: string, options?: MessageOptions) => Promise<void>;
20
+ onUpdateMessage: (messageId: string, content: string) => Promise<void>;
25
21
  onDeleteMessage: (messageId: string) => Promise<void>;
26
22
  };
27
23
  /**
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  import { fromFlatCommunicationIdentifier } from "../../../acs-ui-common/src";
13
- import { getImageAttachmentsFromHTMLContent } from '../utils/getImageAttachmentsFromHTMLContent';
14
13
  import memoizeOne from 'memoize-one';
15
14
  /**
16
15
  * Create the default implementation of {@link ChatHandlers}.
@@ -31,50 +30,17 @@ export const createDefaultChatHandlers = memoizeOne((chatClient, chatThreadClien
31
30
  onSendMessage: function (content, options) {
32
31
  return __awaiter(this, void 0, void 0, function* () {
33
32
  const sendMessageRequest = {
34
- content,
35
- senderDisplayName: chatClient.getState().displayName
33
+ content
36
34
  };
37
- const imageAttachments = getImageAttachmentsFromHTMLContent(content);
38
- const hasAttachments = options && 'attachments' in options && options.attachments && options.attachments[0] && !options.attachments[0].attachmentType;
39
- const hasImages = imageAttachments && imageAttachments.length > 0;
40
- if (hasAttachments || hasImages) {
41
- const chatSDKOptions = {
42
- metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), { fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) }),
43
- attachments: imageAttachments,
44
- type: options === null || options === void 0 ? void 0 : options.type
45
- };
46
- yield chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);
47
- return;
48
- }
49
- yield chatThreadClient.sendMessage(sendMessageRequest, options);
50
- });
51
- },
52
- onUploadImage: function (image, imageFilename) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const imageResult = yield chatThreadClient.uploadImage(image, imageFilename);
55
- return imageResult;
56
- });
57
- },
58
- onDeleteImage: function (imageId) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- try {
61
- yield chatThreadClient.deleteImage(imageId);
62
- }
63
- catch (e) {
64
- console.log(`Error deleting image message: ${e}`);
65
- }
66
- return;
35
+ yield chatThreadClient.sendMessage(sendMessageRequest, Object.assign(Object.assign({}, options), { senderDisplayName: chatClient.getState().displayName }));
67
36
  });
68
37
  },
69
38
  // due to a bug in babel, we can't use arrow function here
70
39
  // affecting conditional-compile-remove(attachment-upload)
71
- onUpdateMessage: function (messageId, content, options) {
40
+ onUpdateMessage: function (messageId, content) {
72
41
  return __awaiter(this, void 0, void 0, function* () {
73
- const imageAttachments = getImageAttachmentsFromHTMLContent(content);
74
42
  const updateMessageOptions = {
75
- content,
76
- metadata: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.metadata), { fileSharingMetadata: JSON.stringify(options === null || options === void 0 ? void 0 : options.attachments) }),
77
- attachments: imageAttachments
43
+ content
78
44
  };
79
45
  yield chatThreadClient.updateMessage(messageId, updateMessageOptions);
80
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAIlF,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEjG,OAAO,UAAU,MAAM,aAAa,CAAC;AAwBrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACvI,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,0DAA0D;QAC1D,aAAa,EAAE,UAAgB,OAAe,EAAE,OAA6C;;gBAC3F,MAAM,kBAAkB,GAAG;oBACzB,OAAO;oBACP,iBAAiB,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW;iBACrD,CAAC;gBACF,MAAM,gBAAgB,GAAiC,kCAAkC,CAAC,OAAO,CAAC,CAAC;gBACnG,MAAM,cAAc,GAAG,OAAO,IAAI,aAAa,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAE,OAAO,CAAC,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CAAC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAS,UAA8B,EAAE,gBAAkC,EAAE,CAAwC,EAA+B,EAAE;IACzM,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatAttachment } from '@azure/communication-chat';\nimport { UploadChatImageResult } from '@internal/acs-ui-common';\nimport { getImageAttachmentsFromHTMLContent } from '../utils/getImageAttachmentsFromHTMLContent';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (content: string, options?: SendMessageOptions | MessageOptions) => Promise<void>;\n onUploadImage: (image: Blob, imageFilename: string) => Promise<UploadChatImageResult>;\n onDeleteImage: (imageId: string) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (messageId: string, content: string, options?: MessageOptions) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne((chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (content: string, options?: SendMessageOptions | MessageOptions) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n const hasAttachments = options && 'attachments' in options && options.attachments && options.attachments[0] && !(options.attachments[0] as ChatAttachment).attachmentType;\n const hasImages = imageAttachments && imageAttachments.length > 0;\n if (hasAttachments || hasImages) {\n const chatSDKOptions: SendMessageOptions = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n attachments: imageAttachments,\n type: options?.type\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);\n },\n onUploadImage: async function (image: Blob, imageFilename: string): Promise<UploadChatImageResult> {\n const imageResult = await chatThreadClient.uploadImage(image, imageFilename);\n return imageResult;\n },\n onDeleteImage: async function (imageId: string): Promise<void> {\n try {\n await chatThreadClient.deleteImage(imageId);\n } catch (e) {\n console.log(`Error deleting image message: ${e}`);\n }\n return;\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (messageId: string, content: string, options?: MessageOptions) {\n const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);\n const updateMessageOptions = {\n content,\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n attachments: imageAttachments\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({\n chatMessageId\n });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({\n maxPageSize: 50\n });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n return isAllChatMessagesLoaded;\n }\n };\n});\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props,>(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};"]}
1
+ {"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAIlF,OAAO,UAAU,MAAM,aAAa,CAAC;AAoBrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACvI,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,0DAA0D;QAC1D,aAAa,EAAE,UAAgB,OAAe,EAAE,OAA4B;;gBAC1E,MAAM,kBAAkB,GAAuB;oBAC7C,OAAO;iBACR,CAAC;gBACF,MAAM,gBAAgB,CAAC,WAAW,CAAC,kBAAkB,kCAC/C,OAA8B,KAClC,iBAAiB,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW,IACpD,CAAC;YACL,CAAC;SAAA;QACD,0DAA0D;QAC1D,0DAA0D;QAC1D,eAAe,EAAE,UAAgB,SAAiB,EAAE,OAAe;;gBACjE,MAAM,oBAAoB,GAAG;oBAC3B,OAAO;iBACR,CAAC;gBACF,MAAM,gBAAgB,CAAC,aAAa,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,CAAC;SAAA;QACD,eAAe,EAAE,CAAO,SAAiB,EAAE,EAAE;YAC3C,MAAM,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC,CAAA;QACD,qDAAqD;QACrD,aAAa,EAAE,CAAO,aAAqB,EAAE,EAAE;YAC7C,MAAM,gBAAgB,CAAC,eAAe,CAAC;gBACrC,aAAa;aACd,CAAC,CAAC;QACL,CAAC,CAAA;QACD,QAAQ,EAAE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,CAAC,KAAK,0CAAE,IAAI,KAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACzD,sBAAsB,EAAE,CAAC;gBAC3B,CAAC;gBAED,gDAAgD;gBAChD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;oBACjB,uBAAuB,GAAG,IAAI,CAAC;oBAC/B,MAAM;gBACR,CAAC;YACH,CAAC;YACD,6EAA6E;YAC7E,IAAI,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACnD,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,aAAa,CAAC,IAAI,YAAY,EAAE,CAAC;gBACxF,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjD,CAAC;YACD,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAS,UAA8B,EAAE,gBAAkC,EAAE,CAAwC,EAA+B,EAAE;IACzM,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\nimport { SendMessageRequest } from '@azure/communication-chat';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (content: string, options?: SendMessageOptions) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (messageId: string, content: string) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne((chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (content: string, options?: SendMessageOptions) {\n const sendMessageRequest: SendMessageRequest = {\n content\n };\n await chatThreadClient.sendMessage(sendMessageRequest, {\n ...(options as SendMessageOptions),\n senderDisplayName: chatClient.getState().displayName\n });\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (messageId: string, content: string) {\n const updateMessageOptions = {\n content\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({\n chatMessageId\n });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({\n maxPageSize: 50\n });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n return isAllChatMessagesLoaded;\n }\n };\n});\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props,>(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient, _: (props: Props) => ReactElement | null): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};"]}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from "../../../react-components/src";
3
- import type { RichTextSendBox } from "../../../react-components/src";
4
3
  import { SendBoxSelector } from '../sendBoxSelector';
5
4
  import { MessageThreadSelector } from '../messageThreadSelector';
6
5
  import { TypingIndicatorSelector } from '../typingIndicatorSelector';
@@ -32,7 +31,7 @@ export declare const usePropsFor: <Component extends (props: any) => JSX.Element
32
31
  *
33
32
  * @public
34
33
  */
35
- export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof RichTextSendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;
34
+ export type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;
36
35
  /**
37
36
  * Get the selector for a specified component.
38
37
  *
@@ -1,7 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from "../../../react-components/src";
4
- import { _isRichTextSendBox } from "../../../react-components/src";
5
4
  import { useHandlers } from './useHandlers';
6
5
  import { useSelector } from './useSelector';
7
6
  import { sendBoxSelector } from '../sendBoxSelector';
@@ -66,9 +65,6 @@ const findSelector = (component) => {
66
65
  };
67
66
  // Add component type check to assist in identification for usePropsFor
68
67
  // to avoid issue where production build does not have the component name
69
- if (_isRichTextSendBox(component)) {
70
- return sendBoxSelector;
71
- }
72
68
  switch (component) {
73
69
  case SendBox:
74
70
  return sendBoxSelector;
@@ -1 +1 @@
1
- {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/usePropsFor.ts"],"names":[],"mappings":"AAAA,uCAAuC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SAAkD,EAAO,EAAE;IAC/E,8EAA8E;IAC9E,8FAA8F;IAC9F,yBAAyB;IACzB,MAAM,wBAAwB,GAAgC,GAAG,EAAE;;QACjE,MAAM,QAAQ,GAAG,MAAA,MAAA,UAAU,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,mCAAI,iCAAiC,CAAC;QACpG,IAAI,yBAAyB,GAAG,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QACzE,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/B,yBAAyB,GAAG,+BAA+B,EAAE,CAAC;YAC9D,8BAA8B,CAAC,QAAQ,CAAC,GAAG,yBAAyB,CAAC;QACvE,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC,CAAC;IAEF,uEAAuE;IACvE,yEAAyE;IACzE,IAAI,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,eAAe,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,wBAAwB,EAAE,CAAC;QACpC,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC;QACjC,KAAK,eAAe;YAClB,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\nimport type { RichTextSendBox } from '@internal/react-components';\nimport { _isRichTextSendBox } from '@internal/react-components';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { SendBoxSelector, sendBoxSelector } from '../sendBoxSelector';\nimport { MessageThreadSelector, messageThreadSelectorWithThread } from '../messageThreadSelector';\nimport { TypingIndicatorSelector, typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { Common, AreEqual } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\nimport { ChatParticipantListSelector, chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n\n/**\n * Primary hook to get all hooks necessary for a chat Component.\n *\n * Most straightforward usage of chat components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element,>(component: Component): GetSelector<Component> extends ((props: any) => any) ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return {\n ...props,\n ...handlers\n } as any;\n }\n return undefined as any;\n};\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof RichTextSendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined,>(component: Component): GetSelector<Component> => {\n return findSelector(component);\n};\nconst messageThreadSelectorsByThread: {\n [key: string]: MessageThreadSelector;\n} = {};\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // For the message thread selector we need to create a new one for each thread\n // If we have just one for the entire app, then we will have updates when not expecting due to\n // the arguments changing\n const getMessageThreadSelector: () => MessageThreadSelector = () => {\n const threadId = useContext(ChatThreadClientContext)?.threadId ?? 'default-id-when-not-in-provider';\n let messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n if (!messageThreadSelectorImpl) {\n messageThreadSelectorImpl = messageThreadSelectorWithThread();\n messageThreadSelectorsByThread[threadId] = messageThreadSelectorImpl;\n }\n return messageThreadSelectorImpl;\n };\n\n // Add component type check to assist in identification for usePropsFor\n // to avoid issue where production build does not have the component name\n if (_isRichTextSendBox(component)) {\n return sendBoxSelector;\n }\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n case MessageThread:\n return getMessageThreadSelector();\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};"]}
1
+ {"version":3,"file":"usePropsFor.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/usePropsFor.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAyB,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAA2B,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,EAA+B,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAAoB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB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,OAAO,eAAe,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,wBAAwB,EAAE,CAAC;QACpC,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC;QACjC,KAAK,eAAe;YAClB,OAAO,2BAA2B,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { SendBoxSelector, sendBoxSelector } from '../sendBoxSelector';\nimport { MessageThreadSelector, messageThreadSelectorWithThread } from '../messageThreadSelector';\nimport { TypingIndicatorSelector, typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { Common, AreEqual } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\nimport { ChatParticipantListSelector, chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { ErrorBarSelector, errorBarSelector } from '../errorBarSelector';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { useContext } from 'react';\n\n/**\n * Primary hook to get all hooks necessary for a chat Component.\n *\n * Most straightforward usage of chat components looks like:\n *\n * @example\n * ```\n * import { ParticipantList, usePropsFor } from '@azure/communication-react';\n *\n * const App = (): JSX.Element => {\n * // ... code to setup Providers ...\n *\n * return <ParticipantList {...usePropsFor(ParticipantList)}/>\n * }\n * ```\n *\n * @public\n */\nexport const usePropsFor = <Component extends (props: any) => JSX.Element,>(component: Component): GetSelector<Component> extends ((props: any) => any) ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return {\n ...props,\n ...handlers\n } as any;\n }\n return undefined as any;\n};\n\n/**\n * Specific type of the selector applicable to a given Component.\n *\n * @public\n */\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<Component, typeof SendBox> extends true ? SendBoxSelector : AreEqual<Component, typeof MessageThread> extends true ? MessageThreadSelector : AreEqual<Component, typeof TypingIndicator> extends true ? TypingIndicatorSelector : AreEqual<Component, typeof ParticipantList> extends true ? ChatParticipantListSelector : AreEqual<Component, typeof ErrorBar> extends true ? ErrorBarSelector : undefined;\n\n/**\n * Get the selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined,>(component: Component): GetSelector<Component> => {\n return findSelector(component);\n};\nconst messageThreadSelectorsByThread: {\n [key: string]: MessageThreadSelector;\n} = {};\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n // For the message thread selector we need to create a new one for each thread\n // If we have just one for the entire app, then we will have updates when not expecting due to\n // the arguments changing\n const getMessageThreadSelector: () => MessageThreadSelector = () => {\n const threadId = useContext(ChatThreadClientContext)?.threadId ?? 'default-id-when-not-in-provider';\n let messageThreadSelectorImpl = messageThreadSelectorsByThread[threadId];\n if (!messageThreadSelectorImpl) {\n messageThreadSelectorImpl = messageThreadSelectorWithThread();\n messageThreadSelectorsByThread[threadId] = messageThreadSelectorImpl;\n }\n return messageThreadSelectorImpl;\n };\n\n // Add component type check to assist in identification for usePropsFor\n // to avoid issue where production build does not have the component name\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n case MessageThread:\n return getMessageThreadSelector();\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};"]}
@@ -45,6 +45,6 @@ export const useSelector = (selector, selectorProps) => {
45
45
  chatClient.offStateChange(onStateChange);
46
46
  };
47
47
  }, [chatClient, selector, selectorProps, threadConfigProps]);
48
- return selector ? props : undefined;
48
+ return (selector ? props : undefined);
49
49
  };
50
50
  //# sourceMappingURL=useSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSelector.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/useSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAsG,QAAgB,EAAE,aAAwC,EAAgE,EAAE;;IAC3P,MAAM,UAAU,GAAmC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAA,UAAU,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,CAAC;IAE/D,sHAAsH;IACtH,qHAAqH;IACrH,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACvC,QAAQ;KACT,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7I,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QACD,MAAM,aAAa,GAAG,CAAC,KAAsB,EAAQ,EAAE;YACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,iBAAiB,CAAC,CAAC;YACrE,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACjC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;QACF,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState, StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n\n/**\n * Hook to obtain a selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useSelector = <SelectorT extends (state: ChatClientState, props: any) => any, ParamT extends SelectorT | undefined>(selector: ParamT, selectorProps?: Parameters<SelectorT>[1]): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const chatClient: StatefulChatClient | undefined = useContext(ChatClientContext);\n const threadId = useContext(ChatThreadClientContext)?.threadId;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n const threadConfigProps = useMemo(() => ({\n threadId\n }), [threadId]);\n const [props, setProps] = useState(chatClient && selector ? selector(chatClient.getState(), selectorProps ?? threadConfigProps) : undefined);\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) {\n return;\n }\n const onStateChange = (state: ChatClientState): void => {\n const newProps = selector(state, selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return selector ? props : undefined;\n};"]}
1
+ {"version":3,"file":"useSelector.js","sourceRoot":"","sources":["../../../../../preprocess-dist/chat-component-bindings/src/hooks/useSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAsG,QAAgB,EAAE,aAAwC,EAAgE,EAAE;;IAC3P,MAAM,UAAU,GAAmC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAA,UAAU,CAAC,uBAAuB,CAAC,0CAAE,QAAQ,CAAC;IAE/D,sHAAsH;IACtH,qHA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AE,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAiE,CAAC;AACxG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatClientState, StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n\n/**\n * Hook to obtain a selector for a specified component.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * @public\n */\nexport const useSelector = <SelectorT extends (state: ChatClientState, props: any) => any, ParamT extends SelectorT | undefined>(selector: ParamT, selectorProps?: Parameters<SelectorT>[1]): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const chatClient: StatefulChatClient | undefined = useContext(ChatClientContext);\n const threadId = useContext(ChatThreadClientContext)?.threadId;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n const threadConfigProps = useMemo(() => ({\n threadId\n }), [threadId]);\n const [props, setProps] = useState(chatClient && selector ? selector(chatClient.getState(), selectorProps ?? threadConfigProps) : undefined);\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) {\n return;\n }\n const onStateChange = (state: ChatClientState): void => {\n const newProps = selector(state, selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return (selector ? props : undefined) as ParamT extends SelectorT ? ReturnType<SelectorT> : undefined;\n};"]}
@@ -4,15 +4,10 @@ import { getChatMessages, getIsLargeGroup, getLatestReadTime, getParticipants, g
4
4
  import { toFlatCommunicationIdentifier } from "../../acs-ui-common/src";
5
5
  import { memoizeFnAll } from "../../acs-ui-common/src";
6
6
  import { createSelector } from 'reselect';
7
- import { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';
8
7
  import { ACSKnownMessageType } from './utils/constants';
9
8
  import { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';
10
9
  const memoizedAllConvertChatMessage = memoizeFnAll((_key, chatMessage, userId, isSeen, isLargeGroup) => {
11
- var _a;
12
10
  const messageType = chatMessage.type.toLowerCase();
13
- if (((_a = chatMessage.policyViolation) === null || _a === void 0 ? void 0 : _a.result) === 'contentBlocked') {
14
- return convertToUiBlockedMessage(chatMessage, userId, isSeen, isLargeGroup);
15
- }
16
11
  if (messageType === ACSKnownMessageType.text || messageType === ACSKnownMessageType.richtextHtml || messageType === ACSKnownMessageType.html) {
17
12
  return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);
18
13
  }
@@ -50,21 +45,6 @@ const extractTeamsAttachmentsMetadata = (rawAttachments) => {
50
45
  attachments
51
46
  };
52
47
  };
53
- const convertToUiBlockedMessage = (message, userId, isSeen, isLargeGroup) => {
54
- const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
55
- return {
56
- messageType: 'blocked',
57
- createdOn: message.createdOn,
58
- warningText: undefined,
59
- status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,
60
- senderDisplayName: message.senderDisplayName,
61
- senderId: messageSenderId,
62
- messageId: message.id,
63
- deletedOn: message.deletedOn,
64
- mine: messageSenderId === userId,
65
- link: DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL
66
- };
67
- };
68
48
  const extractAttachmentUrl = (attachment) => {
69
49
  return attachment.previewUrl ? attachment.previewUrl : attachment.url || '';
70
50
  };
@@ -271,17 +251,14 @@ const getBrokenImageViewNode = (img) => {
271
251
  return wrapper;
272
252
  };
273
253
  const isMessageValidToRender = (message) => {
274
- var _a, _b, _c, _d, _e;
254
+ var _a, _b, _c, _d;
275
255
  if (message.deletedOn) {
276
256
  return false;
277
257
  }
278
258
  if (((_a = message.metadata) === null || _a === void 0 ? void 0 : _a.fileSharingMetadata) || ((_c = (_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length)) {
279
259
  return true;
280
260
  }
281
- if (((_d = message.policyViolation) === null || _d === void 0 ? void 0 : _d.result) === 'contentBlocked') {
282
- return true;
283
- }
284
- return !!(message.content && ((_e = message.content) === null || _e === void 0 ? void 0 : _e.message) !== '');
261
+ return !!(message.content && ((_d = message.content) === null || _d === void 0 ? void 0 : _d.message) !== '');
285
262
  };
286
263
  /**
287
264
  * Selector for {@link MessageThread} component.