@azure/communication-react 1.0.0-beta.1 → 1.0.0-beta.5

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 (934) hide show
  1. package/CHANGELOG.json +190 -20
  2. package/CHANGELOG.md +209 -47
  3. package/LICENSE +21 -21
  4. package/README.md +21 -21
  5. package/dist/communication-react.d.ts +3660 -2057
  6. package/dist/dist-cjs/communication-react/index.js +9697 -7296
  7. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/MessageStatus.d.ts +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/MessageStatus.js +3 -3
  10. package/dist/dist-esm/acs-ui-common/src/areEqual.d.ts +13 -1
  11. package/dist/dist-esm/acs-ui-common/src/areEqual.d.ts.map +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/areEqual.js +3 -3
  13. package/dist/dist-esm/acs-ui-common/src/commonProperties.d.ts +10 -4
  14. package/dist/dist-esm/acs-ui-common/src/commonProperties.d.ts.map +1 -1
  15. package/dist/dist-esm/acs-ui-common/src/commonProperties.js +3 -3
  16. package/dist/dist-esm/acs-ui-common/src/identifier.d.ts +11 -11
  17. package/dist/dist-esm/acs-ui-common/src/identifier.js +28 -28
  18. package/dist/dist-esm/acs-ui-common/src/index.d.ts +7 -6
  19. package/dist/dist-esm/acs-ui-common/src/index.d.ts.map +1 -1
  20. package/dist/dist-esm/acs-ui-common/src/index.js +5 -4
  21. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  22. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.d.ts +40 -40
  23. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.d.ts.map +1 -1
  24. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.js +65 -65
  25. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.js.map +1 -1
  26. package/dist/dist-esm/acs-ui-common/src/telemetry.d.ts +6 -0
  27. package/dist/dist-esm/acs-ui-common/src/telemetry.d.ts.map +1 -0
  28. package/dist/dist-esm/acs-ui-common/src/telemetry.js +20 -0
  29. package/dist/dist-esm/acs-ui-common/src/telemetry.js.map +1 -0
  30. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.d.ts +3 -0
  31. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.d.ts.map +1 -0
  32. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +6 -0
  33. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -0
  34. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +31 -0
  35. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts.map +1 -0
  36. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +18 -0
  37. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -0
  38. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts +36 -0
  39. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.d.ts.map +1 -0
  40. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +38 -0
  41. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -0
  42. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.d.ts +18 -0
  43. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.d.ts.map +1 -0
  44. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js +49 -0
  45. package/dist/dist-esm/calling-component-bindings/src/errorBarSelector.js.map +1 -0
  46. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/handlers/createHandlers.d.ts +57 -54
  47. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts.map +1 -0
  48. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/handlers/createHandlers.js +236 -211
  49. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -0
  50. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.d.ts +3 -0
  51. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.d.ts.map +1 -0
  52. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/hooks/useHandlers.js +16 -12
  53. package/dist/dist-esm/calling-component-bindings/src/hooks/useHandlers.js.map +1 -0
  54. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +16 -0
  55. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts.map +1 -0
  56. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/hooks/usePropsFor.js +48 -38
  57. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -0
  58. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.d.ts +3 -0
  59. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.d.ts.map +1 -0
  60. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/hooks/useSelector.js +42 -40
  61. package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.js.map +1 -0
  62. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/index.d.ts +14 -12
  63. package/dist/dist-esm/calling-component-bindings/src/index.d.ts.map +1 -0
  64. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/index.js +13 -11
  65. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -0
  66. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts +13 -0
  67. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.d.ts.map +1 -0
  68. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +35 -0
  69. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -0
  70. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.d.ts +13 -0
  71. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.d.ts.map +1 -0
  72. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.js +8 -0
  73. package/dist/dist-esm/calling-component-bindings/src/participantsButtonSelector.js.map +1 -0
  74. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallAgentProvider.d.ts +12 -12
  75. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.d.ts.map +1 -0
  76. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallAgentProvider.js +13 -13
  77. package/dist/dist-esm/calling-component-bindings/src/providers/CallAgentProvider.js.map +1 -0
  78. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallClientProvider.d.ts +14 -14
  79. package/dist/dist-esm/calling-component-bindings/src/providers/CallClientProvider.d.ts.map +1 -0
  80. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallClientProvider.js +41 -41
  81. package/dist/dist-esm/calling-component-bindings/src/providers/CallClientProvider.js.map +1 -0
  82. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallProvider.d.ts +12 -12
  83. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.d.ts.map +1 -0
  84. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/CallProvider.js +16 -16
  85. package/dist/dist-esm/calling-component-bindings/src/providers/CallProvider.js.map +1 -0
  86. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/index.d.ts +3 -3
  87. package/dist/dist-esm/calling-component-bindings/src/providers/index.d.ts.map +1 -0
  88. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/providers/index.js +5 -5
  89. package/dist/dist-esm/calling-component-bindings/src/providers/index.js.map +1 -0
  90. package/dist/dist-esm/{acs-calling-selector → calling-component-bindings}/src/videoGallerySelector.d.ts +34 -33
  91. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.d.ts.map +1 -0
  92. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +141 -0
  93. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -0
  94. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +12 -12
  95. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js +184 -184
  96. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  97. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +482 -395
  98. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts.map +1 -1
  99. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js +16 -3
  100. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  101. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +97 -56
  102. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts.map +1 -1
  103. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +574 -446
  104. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  105. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.d.ts +18 -18
  106. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.d.ts.map +1 -1
  107. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.js +108 -57
  108. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.js.map +1 -1
  109. package/dist/dist-esm/calling-stateful-client/src/CallIdRef.d.ts +8 -8
  110. package/dist/dist-esm/calling-stateful-client/src/CallIdRef.js +3 -3
  111. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +31 -29
  112. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts.map +1 -1
  113. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +135 -127
  114. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  115. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +11 -11
  116. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts.map +1 -1
  117. package/dist/dist-esm/calling-stateful-client/src/Converter.js +95 -86
  118. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  119. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.d.ts +21 -21
  120. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.d.ts.map +1 -1
  121. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +154 -141
  122. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
  123. package/dist/dist-esm/calling-stateful-client/src/DiagnosticsSubscriber.d.ts +15 -0
  124. package/dist/dist-esm/calling-stateful-client/src/DiagnosticsSubscriber.d.ts.map +1 -0
  125. package/dist/dist-esm/calling-stateful-client/src/DiagnosticsSubscriber.js +71 -0
  126. package/dist/dist-esm/calling-stateful-client/src/DiagnosticsSubscriber.js.map +1 -0
  127. package/dist/dist-esm/calling-stateful-client/src/IncomingCallSubscriber.d.ts +15 -15
  128. package/dist/dist-esm/calling-stateful-client/src/IncomingCallSubscriber.js +26 -26
  129. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +53 -53
  130. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js +88 -88
  131. package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.d.ts +26 -26
  132. package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.js +81 -81
  133. package/dist/dist-esm/calling-stateful-client/src/ParticipantSubscriber.js.map +1 -1
  134. package/dist/dist-esm/calling-stateful-client/src/ReceivedTransferSubscriber.d.ts +15 -15
  135. package/dist/dist-esm/calling-stateful-client/src/ReceivedTransferSubscriber.js +23 -23
  136. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.d.ts +12 -12
  137. package/dist/dist-esm/calling-stateful-client/src/RecordingSubscriber.js +24 -24
  138. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.d.ts +21 -21
  139. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.d.ts.map +1 -1
  140. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js +65 -67
  141. package/dist/dist-esm/calling-stateful-client/src/RemoteVideoStreamSubscriber.js.map +1 -1
  142. package/dist/dist-esm/calling-stateful-client/src/RequestedTransferSubscriber.d.ts +16 -16
  143. package/dist/dist-esm/calling-stateful-client/src/RequestedTransferSubscriber.js +24 -24
  144. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +171 -139
  145. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts.map +1 -1
  146. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +119 -110
  147. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  148. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.d.ts +9 -9
  149. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.d.ts.map +1 -1
  150. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js +305 -305
  151. package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
  152. package/dist/dist-esm/calling-stateful-client/src/TranscriptionSubscriber.d.ts +12 -12
  153. package/dist/dist-esm/calling-stateful-client/src/TranscriptionSubscriber.js +24 -24
  154. package/dist/dist-esm/calling-stateful-client/src/TransferCallFeatureDeclarative.d.ts +16 -16
  155. package/dist/dist-esm/calling-stateful-client/src/TransferCallFeatureDeclarative.js +55 -55
  156. package/dist/dist-esm/calling-stateful-client/src/TransferCallFeatureDeclarative.js.map +1 -1
  157. package/dist/dist-esm/calling-stateful-client/src/index.d.ts +5 -4
  158. package/dist/dist-esm/calling-stateful-client/src/index.d.ts.map +1 -1
  159. package/dist/dist-esm/calling-stateful-client/src/index.js +4 -3
  160. package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
  161. package/dist/dist-esm/calling-stateful-client/src/modifiers/ClearErrors.d.ts +11 -0
  162. package/dist/dist-esm/calling-stateful-client/src/modifiers/ClearErrors.d.ts.map +1 -0
  163. package/dist/dist-esm/calling-stateful-client/src/modifiers/ClearErrors.js +19 -0
  164. package/dist/dist-esm/calling-stateful-client/src/modifiers/ClearErrors.js.map +1 -0
  165. package/dist/dist-esm/calling-stateful-client/src/modifiers/index.d.ts +5 -0
  166. package/dist/dist-esm/calling-stateful-client/src/modifiers/index.d.ts.map +1 -0
  167. package/dist/dist-esm/calling-stateful-client/src/modifiers/index.js +7 -0
  168. package/dist/dist-esm/calling-stateful-client/src/modifiers/index.js.map +1 -0
  169. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/baseSelectors.d.ts +23 -18
  170. package/dist/dist-esm/chat-component-bindings/src/baseSelectors.d.ts.map +1 -0
  171. package/dist/dist-esm/chat-component-bindings/src/baseSelectors.js +31 -0
  172. package/dist/dist-esm/chat-component-bindings/src/baseSelectors.js.map +1 -0
  173. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/chatParticipantListSelector.d.ts +12 -12
  174. package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.d.ts.map +1 -0
  175. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/chatParticipantListSelector.js +38 -38
  176. package/dist/dist-esm/chat-component-bindings/src/chatParticipantListSelector.js.map +1 -0
  177. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.d.ts +18 -0
  178. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.d.ts.map +1 -0
  179. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js +105 -0
  180. package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js.map +1 -0
  181. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/handlers/createHandlers.d.ts +17 -16
  182. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts.map +1 -0
  183. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/handlers/createHandlers.js +73 -62
  184. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -0
  185. package/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.d.ts +5 -0
  186. package/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.d.ts.map +1 -0
  187. package/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.js +15 -0
  188. package/dist/dist-esm/chat-component-bindings/src/hooks/useHandlers.js.map +1 -0
  189. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +13 -0
  190. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts.map +1 -0
  191. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/hooks/usePropsFor.js +37 -29
  192. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -0
  193. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.d.ts +3 -0
  194. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.d.ts.map +1 -0
  195. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/hooks/useSelector.js +42 -42
  196. package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.js.map +1 -0
  197. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/index.d.ts +16 -14
  198. package/dist/dist-esm/chat-component-bindings/src/index.d.ts.map +1 -0
  199. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/index.js +14 -12
  200. package/dist/dist-esm/chat-component-bindings/src/index.js.map +1 -0
  201. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.d.ts +15 -0
  202. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.d.ts.map +1 -0
  203. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +145 -0
  204. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -0
  205. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/providers/ChatClientProvider.d.ts +15 -15
  206. package/dist/dist-esm/chat-component-bindings/src/providers/ChatClientProvider.d.ts.map +1 -0
  207. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/providers/ChatClientProvider.js +19 -19
  208. package/dist/dist-esm/chat-component-bindings/src/providers/ChatClientProvider.js.map +1 -0
  209. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/providers/ChatThreadClientProvider.d.ts +15 -15
  210. package/dist/dist-esm/chat-component-bindings/src/providers/ChatThreadClientProvider.d.ts.map +1 -0
  211. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/providers/ChatThreadClientProvider.js +19 -19
  212. package/dist/dist-esm/chat-component-bindings/src/providers/ChatThreadClientProvider.js.map +1 -0
  213. package/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.d.ts +8 -0
  214. package/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.d.ts.map +1 -0
  215. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/sendBoxSelector.js +8 -8
  216. package/dist/dist-esm/chat-component-bindings/src/sendBoxSelector.js.map +1 -0
  217. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/typingIndicatorSelector.d.ts +11 -11
  218. package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.d.ts.map +1 -0
  219. package/dist/dist-esm/{acs-chat-selector → chat-component-bindings}/src/typingIndicatorSelector.js +45 -45
  220. package/dist/dist-esm/chat-component-bindings/src/typingIndicatorSelector.js.map +1 -0
  221. package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.d.ts +3 -0
  222. package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.d.ts.map +1 -0
  223. package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js +17 -0
  224. package/dist/dist-esm/chat-component-bindings/src/utils/compareMessages.js.map +1 -0
  225. package/dist/dist-esm/chat-component-bindings/src/utils/constants.d.ts +11 -0
  226. package/dist/dist-esm/chat-component-bindings/src/utils/constants.d.ts.map +1 -0
  227. package/dist/dist-esm/chat-component-bindings/src/utils/constants.js +14 -0
  228. package/dist/dist-esm/chat-component-bindings/src/utils/constants.js.map +1 -0
  229. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts +85 -21
  230. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.d.ts.map +1 -1
  231. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js +16 -3
  232. package/dist/dist-esm/chat-stateful-client/src/ChatClientState.js.map +1 -1
  233. package/dist/dist-esm/chat-stateful-client/src/ChatContext.d.ts +76 -39
  234. package/dist/dist-esm/chat-stateful-client/src/ChatContext.d.ts.map +1 -1
  235. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +384 -290
  236. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  237. package/dist/dist-esm/chat-stateful-client/src/Constants.d.ts +4 -4
  238. package/dist/dist-esm/chat-stateful-client/src/Constants.js +6 -6
  239. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.d.ts +21 -20
  240. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.d.ts.map +1 -1
  241. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +146 -107
  242. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
  243. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.d.ts +68 -33
  244. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.d.ts.map +1 -1
  245. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js +134 -121
  246. package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.js.map +1 -1
  247. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.d.ts +3 -3
  248. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.d.ts.map +1 -1
  249. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js +138 -138
  250. package/dist/dist-esm/chat-stateful-client/src/StatefulChatThreadClient.js.map +1 -1
  251. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.d.ts +4 -4
  252. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.d.ts.map +1 -1
  253. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js +5 -5
  254. package/dist/dist-esm/chat-stateful-client/src/index.d.ts +5 -4
  255. package/dist/dist-esm/chat-stateful-client/src/index.d.ts.map +1 -1
  256. package/dist/dist-esm/chat-stateful-client/src/index.js +4 -3
  257. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  258. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts +23 -13
  259. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts.map +1 -1
  260. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.js +88 -60
  261. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.js.map +1 -1
  262. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.d.ts +4 -4
  263. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.d.ts.map +1 -1
  264. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.js +10 -10
  265. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.js.map +1 -1
  266. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts +4 -4
  267. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts.map +1 -1
  268. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.js +9 -9
  269. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.js.map +1 -1
  270. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.d.ts +4 -4
  271. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.d.ts.map +1 -1
  272. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.js +9 -9
  273. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.js.map +1 -1
  274. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.d.ts +4 -4
  275. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.d.ts.map +1 -1
  276. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.js +14 -14
  277. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.js.map +1 -1
  278. package/dist/dist-esm/chat-stateful-client/src/modifiers/ClearErrors.d.ts +4 -0
  279. package/dist/dist-esm/chat-stateful-client/src/modifiers/ClearErrors.d.ts.map +1 -0
  280. package/dist/dist-esm/chat-stateful-client/src/modifiers/ClearErrors.js +12 -0
  281. package/dist/dist-esm/chat-stateful-client/src/modifiers/ClearErrors.js.map +1 -0
  282. package/dist/dist-esm/chat-stateful-client/src/modifiers/index.d.ts +5 -0
  283. package/dist/dist-esm/chat-stateful-client/src/modifiers/index.d.ts.map +1 -0
  284. package/dist/dist-esm/chat-stateful-client/src/modifiers/index.js +7 -0
  285. package/dist/dist-esm/chat-stateful-client/src/modifiers/index.js.map +1 -0
  286. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +6 -6
  287. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts.map +1 -1
  288. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js +3 -3
  289. package/dist/dist-esm/communication-react/src/index.d.ts +11 -8
  290. package/dist/dist-esm/communication-react/src/index.d.ts.map +1 -1
  291. package/dist/dist-esm/communication-react/src/index.js +10 -9
  292. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  293. package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +13 -0
  294. package/dist/dist-esm/communication-react/src/mergedHooks.d.ts.map +1 -0
  295. package/dist/dist-esm/communication-react/src/mergedHooks.js +36 -0
  296. package/dist/dist-esm/communication-react/src/mergedHooks.js.map +1 -0
  297. package/dist/dist-esm/react-components/src/components/CameraButton.d.ts +37 -24
  298. package/dist/dist-esm/react-components/src/components/CameraButton.d.ts.map +1 -1
  299. package/dist/dist-esm/react-components/src/components/CameraButton.js +43 -25
  300. package/dist/dist-esm/react-components/src/components/CameraButton.js.map +1 -1
  301. package/dist/dist-esm/react-components/src/components/ChatMessageComponent.d.ts +14 -0
  302. package/dist/dist-esm/react-components/src/components/ChatMessageComponent.d.ts.map +1 -0
  303. package/dist/dist-esm/react-components/src/components/ChatMessageComponent.js +132 -0
  304. package/dist/dist-esm/react-components/src/components/ChatMessageComponent.js.map +1 -0
  305. package/dist/dist-esm/react-components/src/components/ControlBar.d.ts +33 -33
  306. package/dist/dist-esm/react-components/src/components/ControlBar.d.ts.map +1 -1
  307. package/dist/dist-esm/react-components/src/components/ControlBar.js +31 -25
  308. package/dist/dist-esm/react-components/src/components/ControlBar.js.map +1 -1
  309. package/dist/dist-esm/react-components/src/components/ControlBarButton.d.ts +51 -0
  310. package/dist/dist-esm/react-components/src/components/ControlBarButton.d.ts.map +1 -0
  311. package/dist/dist-esm/react-components/src/components/ControlBarButton.js +28 -0
  312. package/dist/dist-esm/react-components/src/components/ControlBarButton.js.map +1 -0
  313. package/dist/dist-esm/react-components/src/components/EditBox.d.ts +9 -0
  314. package/dist/dist-esm/react-components/src/components/EditBox.d.ts.map +1 -0
  315. package/dist/dist-esm/react-components/src/components/EditBox.js +50 -0
  316. package/dist/dist-esm/react-components/src/components/EditBox.js.map +1 -0
  317. package/dist/dist-esm/react-components/src/components/EndCallButton.d.ts +31 -24
  318. package/dist/dist-esm/react-components/src/components/EndCallButton.d.ts.map +1 -1
  319. package/dist/dist-esm/react-components/src/components/EndCallButton.js +35 -38
  320. package/dist/dist-esm/react-components/src/components/EndCallButton.js.map +1 -1
  321. package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts +113 -0
  322. package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts.map +1 -0
  323. package/dist/dist-esm/react-components/src/components/ErrorBar.js +87 -0
  324. package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -0
  325. package/dist/dist-esm/react-components/src/components/GridLayout.d.ts +16 -16
  326. package/dist/dist-esm/react-components/src/components/GridLayout.js +28 -28
  327. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts +36 -0
  328. package/dist/dist-esm/react-components/src/components/InputBoxComponent.d.ts.map +1 -0
  329. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +39 -0
  330. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -0
  331. package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.d.ts +39 -33
  332. package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.d.ts.map +1 -1
  333. package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js +32 -31
  334. package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js.map +1 -1
  335. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +210 -125
  336. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts.map +1 -1
  337. package/dist/dist-esm/react-components/src/components/MessageThread.js +466 -447
  338. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  339. package/dist/dist-esm/react-components/src/components/MicrophoneButton.d.ts +30 -22
  340. package/dist/dist-esm/react-components/src/components/MicrophoneButton.d.ts.map +1 -1
  341. package/dist/dist-esm/react-components/src/components/MicrophoneButton.js +18 -23
  342. package/dist/dist-esm/react-components/src/components/MicrophoneButton.js.map +1 -1
  343. package/dist/dist-esm/react-components/src/components/OptionsButton.d.ts +101 -50
  344. package/dist/dist-esm/react-components/src/components/OptionsButton.d.ts.map +1 -1
  345. package/dist/dist-esm/react-components/src/components/OptionsButton.js +111 -88
  346. package/dist/dist-esm/react-components/src/components/OptionsButton.js.map +1 -1
  347. package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts +58 -43
  348. package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts.map +1 -1
  349. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +44 -30
  350. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  351. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts +28 -22
  352. package/dist/dist-esm/react-components/src/components/ParticipantList.d.ts.map +1 -1
  353. package/dist/dist-esm/react-components/src/components/ParticipantList.js +66 -73
  354. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  355. package/dist/dist-esm/react-components/src/components/ParticipantsButton.d.ts +76 -0
  356. package/dist/dist-esm/react-components/src/components/ParticipantsButton.d.ts.map +1 -0
  357. package/dist/dist-esm/react-components/src/components/ParticipantsButton.js +126 -0
  358. package/dist/dist-esm/react-components/src/components/ParticipantsButton.js.map +1 -0
  359. package/dist/dist-esm/react-components/src/components/ScreenShareButton.d.ts +32 -24
  360. package/dist/dist-esm/react-components/src/components/ScreenShareButton.d.ts.map +1 -1
  361. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js +20 -25
  362. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js.map +1 -1
  363. package/dist/dist-esm/react-components/src/components/SendBox.d.ts +77 -63
  364. package/dist/dist-esm/react-components/src/components/SendBox.d.ts.map +1 -1
  365. package/dist/dist-esm/react-components/src/components/SendBox.js +70 -66
  366. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  367. package/dist/dist-esm/react-components/src/components/StreamMedia.d.ts +24 -24
  368. package/dist/dist-esm/react-components/src/components/StreamMedia.js +30 -30
  369. package/dist/dist-esm/react-components/src/components/SystemMessage.d.ts +15 -15
  370. package/dist/dist-esm/react-components/src/components/SystemMessage.js +12 -12
  371. package/dist/dist-esm/react-components/src/components/SystemMessage.js.map +1 -1
  372. package/dist/dist-esm/react-components/src/components/TypingIndicator.d.ts +113 -32
  373. package/dist/dist-esm/react-components/src/components/TypingIndicator.d.ts.map +1 -1
  374. package/dist/dist-esm/react-components/src/components/TypingIndicator.js +102 -48
  375. package/dist/dist-esm/react-components/src/components/TypingIndicator.js.map +1 -1
  376. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +53 -46
  377. package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts.map +1 -1
  378. package/dist/dist-esm/react-components/src/components/VideoGallery.js +122 -64
  379. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  380. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +51 -49
  381. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts.map +1 -1
  382. package/dist/dist-esm/react-components/src/components/VideoTile.js +53 -23
  383. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  384. package/dist/dist-esm/react-components/src/components/index.d.ts +39 -32
  385. package/dist/dist-esm/react-components/src/components/index.d.ts.map +1 -1
  386. package/dist/dist-esm/react-components/src/components/index.js +21 -18
  387. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  388. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.d.ts +12 -0
  389. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.d.ts.map +1 -0
  390. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js +29 -0
  391. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js.map +1 -0
  392. package/dist/dist-esm/react-components/src/components/styles/ControlBar.styles.d.ts +20 -18
  393. package/dist/dist-esm/react-components/src/components/styles/ControlBar.styles.d.ts.map +1 -1
  394. package/dist/dist-esm/react-components/src/components/styles/ControlBar.styles.js +143 -128
  395. package/dist/dist-esm/react-components/src/components/styles/ControlBar.styles.js.map +1 -1
  396. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.d.ts +10 -0
  397. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.d.ts.map +1 -0
  398. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js +24 -0
  399. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js.map +1 -0
  400. package/dist/dist-esm/react-components/src/components/styles/GridLayout.styles.d.ts +1 -1
  401. package/dist/dist-esm/react-components/src/components/styles/GridLayout.styles.js +10 -10
  402. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.d.ts +7 -0
  403. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.d.ts.map +1 -0
  404. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.js +74 -0
  405. package/dist/dist-esm/react-components/src/components/styles/InputBoxComponent.style.js.map +1 -0
  406. package/dist/dist-esm/react-components/src/components/styles/MessageStatusIndicator.styles.d.ts +2 -2
  407. package/dist/dist-esm/react-components/src/components/styles/MessageStatusIndicator.styles.d.ts.map +1 -1
  408. package/dist/dist-esm/react-components/src/components/styles/MessageStatusIndicator.styles.js +11 -14
  409. package/dist/dist-esm/react-components/src/components/styles/MessageStatusIndicator.styles.js.map +1 -1
  410. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +13 -12
  411. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts.map +1 -1
  412. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +59 -57
  413. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  414. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts +4 -5
  415. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts.map +1 -1
  416. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +25 -37
  417. package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
  418. package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.d.ts +2 -4
  419. package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.d.ts.map +1 -1
  420. package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.js +9 -22
  421. package/dist/dist-esm/react-components/src/components/styles/ParticipantList.styles.js.map +1 -1
  422. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +20 -28
  423. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts.map +1 -1
  424. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +24 -58
  425. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  426. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.d.ts +2 -2
  427. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.js +16 -16
  428. package/dist/dist-esm/react-components/src/components/styles/SystemMessage.styles.d.ts +1 -2
  429. package/dist/dist-esm/react-components/src/components/styles/SystemMessage.styles.d.ts.map +1 -1
  430. package/dist/dist-esm/react-components/src/components/styles/SystemMessage.styles.js +6 -11
  431. package/dist/dist-esm/react-components/src/components/styles/SystemMessage.styles.js.map +1 -1
  432. package/dist/dist-esm/react-components/src/components/styles/TypingIndicator.styles.d.ts +3 -4
  433. package/dist/dist-esm/react-components/src/components/styles/TypingIndicator.styles.d.ts.map +1 -1
  434. package/dist/dist-esm/react-components/src/components/styles/TypingIndicator.styles.js +17 -27
  435. package/dist/dist-esm/react-components/src/components/styles/TypingIndicator.styles.js.map +1 -1
  436. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.d.ts +6 -6
  437. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.d.ts.map +1 -1
  438. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js +39 -15
  439. package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js.map +1 -1
  440. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.d.ts +10 -6
  441. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.d.ts.map +1 -1
  442. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +64 -42
  443. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
  444. package/dist/dist-esm/react-components/src/components/utils/Datetime.d.ts +22 -21
  445. package/dist/dist-esm/react-components/src/components/utils/Datetime.d.ts.map +1 -1
  446. package/dist/dist-esm/react-components/src/components/utils/Datetime.js +92 -73
  447. package/dist/dist-esm/react-components/src/components/utils/Datetime.js.map +1 -1
  448. package/dist/dist-esm/react-components/src/components/utils/delay.d.ts +1 -1
  449. package/dist/dist-esm/react-components/src/components/utils/delay.js +7 -7
  450. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +52 -0
  451. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts.map +1 -0
  452. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +26 -0
  453. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -0
  454. package/dist/dist-esm/react-components/src/identifiers/index.d.ts +2 -0
  455. package/dist/dist-esm/react-components/src/identifiers/index.d.ts.map +1 -0
  456. package/dist/dist-esm/react-components/src/identifiers/index.js +4 -0
  457. package/dist/dist-esm/react-components/src/identifiers/index.js.map +1 -0
  458. package/dist/dist-esm/react-components/src/index.d.ts +8 -3
  459. package/dist/dist-esm/react-components/src/index.d.ts.map +1 -1
  460. package/dist/dist-esm/react-components/src/index.js +7 -4
  461. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  462. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +60 -0
  463. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts.map +1 -0
  464. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js +20 -0
  465. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -0
  466. package/dist/dist-esm/react-components/src/localization/index.d.ts +2 -0
  467. package/dist/dist-esm/react-components/src/localization/index.d.ts.map +1 -0
  468. package/dist/dist-esm/react-components/src/localization/index.js +4 -0
  469. package/dist/dist-esm/react-components/src/localization/index.js.map +1 -0
  470. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +78 -0
  471. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +78 -0
  472. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +80 -0
  473. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +78 -0
  474. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +78 -0
  475. package/dist/dist-esm/react-components/src/localization/locales/index.d.ts +30 -0
  476. package/dist/dist-esm/react-components/src/localization/locales/index.d.ts.map +1 -0
  477. package/dist/dist-esm/react-components/src/localization/locales/index.js +52 -0
  478. package/dist/dist-esm/react-components/src/localization/locales/index.js.map +1 -0
  479. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +78 -0
  480. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +78 -0
  481. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +78 -0
  482. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +78 -0
  483. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +78 -0
  484. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +78 -0
  485. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +78 -0
  486. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +78 -0
  487. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +78 -0
  488. package/dist/dist-esm/react-components/src/localization/localizationUtils.d.ts +24 -0
  489. package/dist/dist-esm/react-components/src/localization/localizationUtils.d.ts.map +1 -0
  490. package/dist/dist-esm/react-components/src/localization/localizationUtils.js +57 -0
  491. package/dist/dist-esm/react-components/src/localization/localizationUtils.js.map +1 -0
  492. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.d.ts +27 -18
  493. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.d.ts.map +1 -1
  494. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +61 -59
  495. package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
  496. package/dist/dist-esm/react-components/src/theming/icons.d.ts +35 -0
  497. package/dist/dist-esm/react-components/src/theming/icons.d.ts.map +1 -0
  498. package/dist/dist-esm/react-components/src/theming/icons.js +38 -0
  499. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -0
  500. package/dist/dist-esm/react-components/src/theming/index.d.ts +3 -2
  501. package/dist/dist-esm/react-components/src/theming/index.d.ts.map +1 -1
  502. package/dist/dist-esm/react-components/src/theming/index.js +5 -4
  503. package/dist/dist-esm/react-components/src/theming/index.js.map +1 -1
  504. package/dist/dist-esm/react-components/src/theming/themeUtils.d.ts +2 -2
  505. package/dist/dist-esm/react-components/src/theming/themeUtils.d.ts.map +1 -1
  506. package/dist/dist-esm/react-components/src/theming/themeUtils.js +21 -21
  507. package/dist/dist-esm/react-components/src/theming/themes.d.ts +19 -19
  508. package/dist/dist-esm/react-components/src/theming/themes.d.ts.map +1 -1
  509. package/dist/dist-esm/react-components/src/theming/themes.js +70 -70
  510. package/dist/dist-esm/react-components/src/types/CallParticipant.d.ts +14 -14
  511. package/dist/dist-esm/react-components/src/types/CallParticipant.js +3 -3
  512. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +50 -32
  513. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts.map +1 -1
  514. package/dist/dist-esm/react-components/src/types/ChatMessage.js +3 -3
  515. package/dist/dist-esm/react-components/src/types/CommunicationParticipant.d.ts +9 -9
  516. package/dist/dist-esm/react-components/src/types/CommunicationParticipant.js +3 -3
  517. package/dist/dist-esm/react-components/src/types/CustomStylesProps.d.ts +12 -5
  518. package/dist/dist-esm/react-components/src/types/CustomStylesProps.d.ts.map +1 -1
  519. package/dist/dist-esm/react-components/src/types/CustomStylesProps.js +3 -3
  520. package/dist/dist-esm/react-components/src/types/OnRender.d.ts +38 -0
  521. package/dist/dist-esm/react-components/src/types/OnRender.d.ts.map +1 -0
  522. package/dist/dist-esm/react-components/src/types/OnRender.js +4 -0
  523. package/dist/dist-esm/react-components/src/types/OnRender.js.map +1 -0
  524. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.d.ts +50 -50
  525. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js +3 -3
  526. package/dist/dist-esm/react-components/src/types/index.d.ts +6 -5
  527. package/dist/dist-esm/react-components/src/types/index.d.ts.map +1 -1
  528. package/dist/dist-esm/react-components/src/types/index.js +8 -7
  529. package/dist/dist-esm/react-components/src/types/index.js.map +1 -1
  530. package/dist/dist-esm/react-composites/src/composites/CallComposite/Call.d.ts +49 -15
  531. package/dist/dist-esm/react-composites/src/composites/CallComposite/Call.d.ts.map +1 -1
  532. package/dist/dist-esm/react-composites/src/composites/CallComposite/Call.js +69 -65
  533. package/dist/dist-esm/react-composites/src/composites/CallComposite/Call.js.map +1 -1
  534. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallControls.d.ts +8 -6
  535. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallControls.d.ts.map +1 -1
  536. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallControls.js +35 -36
  537. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallControls.js.map +1 -1
  538. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallScreen.d.ts +16 -11
  539. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallScreen.d.ts.map +1 -1
  540. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallScreen.js +99 -79
  541. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallScreen.js.map +1 -1
  542. package/dist/dist-esm/react-composites/src/composites/CallComposite/ComplianceBanner.d.ts +6 -6
  543. package/dist/dist-esm/react-composites/src/composites/CallComposite/ComplianceBanner.js +134 -134
  544. package/dist/dist-esm/react-composites/src/composites/CallComposite/ConfigurationScreen.d.ts +5 -6
  545. package/dist/dist-esm/react-composites/src/composites/CallComposite/ConfigurationScreen.d.ts.map +1 -1
  546. package/dist/dist-esm/react-composites/src/composites/CallComposite/ConfigurationScreen.js +34 -22
  547. package/dist/dist-esm/react-composites/src/composites/CallComposite/ConfigurationScreen.js.map +1 -1
  548. package/dist/dist-esm/react-composites/src/composites/CallComposite/Error.d.ts +7 -7
  549. package/dist/dist-esm/react-composites/src/composites/CallComposite/Error.js +23 -23
  550. package/dist/dist-esm/react-composites/src/composites/CallComposite/Error.js.map +1 -1
  551. package/dist/dist-esm/react-composites/src/composites/CallComposite/Lobby.d.ts +13 -13
  552. package/dist/dist-esm/react-composites/src/composites/CallComposite/Lobby.d.ts.map +1 -1
  553. package/dist/dist-esm/react-composites/src/composites/CallComposite/Lobby.js +67 -69
  554. package/dist/dist-esm/react-composites/src/composites/CallComposite/Lobby.js.map +1 -1
  555. package/dist/dist-esm/react-composites/src/composites/CallComposite/LobbyControlBar.d.ts +6 -6
  556. package/dist/dist-esm/react-composites/src/composites/CallComposite/LobbyControlBar.d.ts.map +1 -1
  557. package/dist/dist-esm/react-composites/src/composites/CallComposite/LobbyControlBar.js +30 -33
  558. package/dist/dist-esm/react-composites/src/composites/CallComposite/LobbyControlBar.js.map +1 -1
  559. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalDeviceSettings.d.ts +17 -16
  560. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalDeviceSettings.d.ts.map +1 -1
  561. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalDeviceSettings.js +85 -55
  562. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalDeviceSettings.js.map +1 -1
  563. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalPreview.d.ts +2 -2
  564. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalPreview.d.ts.map +1 -1
  565. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalPreview.js +46 -45
  566. package/dist/dist-esm/react-composites/src/composites/CallComposite/LocalPreview.js.map +1 -1
  567. package/dist/dist-esm/react-composites/src/composites/CallComposite/MediaGallery.d.ts +11 -9
  568. package/dist/dist-esm/react-composites/src/composites/CallComposite/MediaGallery.d.ts.map +1 -1
  569. package/dist/dist-esm/react-composites/src/composites/CallComposite/MediaGallery.js +42 -38
  570. package/dist/dist-esm/react-composites/src/composites/CallComposite/MediaGallery.js.map +1 -1
  571. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenShare.d.ts +10 -10
  572. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenShare.d.ts.map +1 -1
  573. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenShare.js +71 -78
  574. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenShare.js.map +1 -1
  575. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenSharePopup.d.ts +14 -0
  576. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenSharePopup.d.ts.map +1 -0
  577. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenSharePopup.js +59 -0
  578. package/dist/dist-esm/react-composites/src/composites/CallComposite/ScreenSharePopup.js.map +1 -0
  579. package/dist/dist-esm/react-composites/src/composites/CallComposite/StartCallButton.d.ts +6 -6
  580. package/dist/dist-esm/react-composites/src/composites/CallComposite/StartCallButton.d.ts.map +1 -1
  581. package/dist/dist-esm/react-composites/src/composites/CallComposite/StartCallButton.js +14 -13
  582. package/dist/dist-esm/react-composites/src/composites/CallComposite/StartCallButton.js.map +1 -1
  583. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +63 -0
  584. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts.map +1 -0
  585. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js +4 -0
  586. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -0
  587. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +80 -69
  588. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts.map +1 -1
  589. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +427 -348
  590. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  591. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +127 -104
  592. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts.map +1 -1
  593. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js +3 -3
  594. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.d.ts +9 -9
  595. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.js +14 -14
  596. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.d.ts +15 -15
  597. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.js +40 -40
  598. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +3 -2
  599. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts.map +1 -1
  600. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +3 -3
  601. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  602. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.d.ts +4 -4
  603. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.d.ts.map +1 -1
  604. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +75 -61
  605. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
  606. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts +4 -4
  607. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts.map +1 -1
  608. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +77 -70
  609. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  610. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +6 -9
  611. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts.map +1 -1
  612. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.js +13 -33
  613. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.js.map +1 -1
  614. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.d.ts +2 -2
  615. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.d.ts.map +1 -1
  616. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.js +8 -8
  617. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.js.map +1 -1
  618. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +4 -3
  619. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts.map +1 -1
  620. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +5 -4
  621. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  622. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +16 -12
  623. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts.map +1 -1
  624. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +21 -17
  625. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  626. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.d.ts +8 -7
  627. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.d.ts.map +1 -1
  628. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.js +10 -10
  629. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.js.map +1 -1
  630. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.d.ts +8 -8
  631. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.d.ts.map +1 -1
  632. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.js +10 -10
  633. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.js.map +1 -1
  634. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.d.ts +9 -0
  635. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.d.ts.map +1 -0
  636. package/dist/dist-esm/{acs-calling-selector/src → react-composites/src/composites/CallComposite/selectors}/devicePermissionSelector.js +10 -12
  637. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.js.map +1 -0
  638. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.d.ts +14 -27
  639. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.d.ts.map +1 -1
  640. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.js +15 -21
  641. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.js.map +1 -1
  642. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.d.ts +6 -6
  643. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.d.ts.map +1 -1
  644. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.js +12 -13
  645. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.js.map +1 -1
  646. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.d.ts +6 -6
  647. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.js +10 -10
  648. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.js.map +1 -1
  649. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +3 -6
  650. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts.map +1 -1
  651. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +10 -29
  652. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
  653. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallControls.styles.d.ts +24 -30
  654. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallControls.styles.d.ts.map +1 -1
  655. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallControls.styles.js +26 -32
  656. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallControls.styles.js.map +1 -1
  657. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallScreen.styles.d.ts +7 -8
  658. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallScreen.styles.d.ts.map +1 -1
  659. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallScreen.styles.js +54 -54
  660. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallScreen.styles.js.map +1 -1
  661. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ConfigurationScreen.styles.d.ts +2 -0
  662. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ConfigurationScreen.styles.d.ts.map +1 -0
  663. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ConfigurationScreen.styles.js +10 -0
  664. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ConfigurationScreen.styles.js.map +1 -0
  665. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Error.styles.d.ts +10 -10
  666. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Error.styles.js +42 -42
  667. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.d.ts +7 -6
  668. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.d.ts.map +1 -1
  669. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.js +57 -44
  670. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.js.map +1 -1
  671. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.d.ts +7 -13
  672. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.d.ts.map +1 -1
  673. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js +17 -43
  674. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js.map +1 -1
  675. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/MediaGallery.styles.d.ts +16 -5
  676. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/MediaGallery.styles.d.ts.map +1 -1
  677. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/MediaGallery.styles.js +36 -32
  678. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/MediaGallery.styles.js.map +1 -1
  679. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenShare.styles.d.ts +2 -7
  680. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenShare.styles.d.ts.map +1 -1
  681. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenShare.styles.js +16 -21
  682. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenShare.styles.js.map +1 -1
  683. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenSharePopup.styles.d.ts +7 -0
  684. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenSharePopup.styles.d.ts.map +1 -0
  685. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenSharePopup.styles.js +36 -0
  686. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/ScreenSharePopup.styles.js.map +1 -0
  687. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/StartCallButton.styles.d.ts +2 -2
  688. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/StartCallButton.styles.js +16 -16
  689. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +48 -18
  690. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts.map +1 -1
  691. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +12 -13
  692. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  693. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.d.ts +10 -10
  694. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.d.ts.map +1 -1
  695. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.js +20 -20
  696. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.js.map +1 -1
  697. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +12 -6
  698. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts.map +1 -1
  699. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +46 -45
  700. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  701. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +57 -45
  702. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts.map +1 -1
  703. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +288 -216
  704. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  705. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +75 -59
  706. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts.map +1 -1
  707. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js +3 -3
  708. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +9 -9
  709. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +14 -14
  710. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.d.ts +4 -4
  711. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.d.ts.map +1 -1
  712. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.js +69 -56
  713. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.js.map +1 -1
  714. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.d.ts +4 -4
  715. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.d.ts.map +1 -1
  716. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +21 -19
  717. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  718. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.d.ts +6 -6
  719. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.d.ts.map +1 -1
  720. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.js +13 -23
  721. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/usePropsFor.js.map +1 -1
  722. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +5 -4
  723. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts.map +1 -1
  724. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js +4 -4
  725. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  726. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.d.ts +12 -9
  727. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.d.ts.map +1 -1
  728. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +65 -74
  729. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
  730. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/ChatButton.d.ts +4 -0
  731. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/ChatButton.d.ts.map +1 -0
  732. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/ChatButton.js +13 -0
  733. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/ChatButton.js.map +1 -0
  734. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingCallControlBar.d.ts +12 -0
  735. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingCallControlBar.d.ts.map +1 -0
  736. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingCallControlBar.js +18 -0
  737. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingCallControlBar.js.map +1 -0
  738. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingComposite.d.ts +25 -0
  739. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingComposite.d.ts.map +1 -0
  740. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingComposite.js +52 -0
  741. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/MeetingComposite.js.map +1 -0
  742. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/PeopleButton.d.ts +4 -0
  743. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/PeopleButton.d.ts.map +1 -0
  744. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/PeopleButton.js +13 -0
  745. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/PeopleButton.js.map +1 -0
  746. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/SidePane.d.ts +18 -0
  747. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/SidePane.d.ts.map +1 -0
  748. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/SidePane.js +58 -0
  749. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/SidePane.js.map +1 -0
  750. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/adapter/MeetingAdapter.d.ts +66 -0
  751. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/adapter/MeetingAdapter.d.ts.map +1 -0
  752. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/adapter/MeetingAdapter.js +4 -0
  753. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/adapter/MeetingAdapter.js.map +1 -0
  754. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/index.d.ts +4 -0
  755. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/index.d.ts.map +1 -0
  756. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/index.js +4 -0
  757. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/index.js.map +1 -0
  758. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/state/MeetingAdapterState.d.ts +81 -0
  759. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/state/MeetingAdapterState.d.ts.map +1 -0
  760. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/state/MeetingAdapterState.js +4 -0
  761. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/state/MeetingAdapterState.js.map +1 -0
  762. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/MeetingCompositeStyles.d.ts +3 -0
  763. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/MeetingCompositeStyles.d.ts.map +1 -0
  764. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/MeetingCompositeStyles.js +4 -0
  765. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/MeetingCompositeStyles.js.map +1 -0
  766. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/SidePane.styles.d.ts +12 -0
  767. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/SidePane.styles.d.ts.map +1 -0
  768. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/SidePane.styles.js +45 -0
  769. package/dist/dist-esm/react-composites/src/composites/MeetingComposite/styles/SidePane.styles.js.map +1 -0
  770. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts +51 -0
  771. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.d.ts.map +1 -0
  772. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js +33 -0
  773. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -0
  774. package/dist/dist-esm/react-composites/src/composites/common/Composite.d.ts +44 -0
  775. package/dist/dist-esm/react-composites/src/composites/common/Composite.d.ts.map +1 -0
  776. package/dist/dist-esm/react-composites/src/composites/common/Composite.js +24 -0
  777. package/dist/dist-esm/react-composites/src/composites/common/Composite.js.map +1 -0
  778. package/dist/dist-esm/react-composites/src/composites/common/PermissionsBanner.d.ts +38 -0
  779. package/dist/dist-esm/react-composites/src/composites/common/PermissionsBanner.d.ts.map +1 -0
  780. package/dist/dist-esm/react-composites/src/composites/common/PermissionsBanner.js +67 -0
  781. package/dist/dist-esm/react-composites/src/composites/common/PermissionsBanner.js.map +1 -0
  782. package/dist/dist-esm/react-composites/src/composites/common/adapters.d.ts +51 -0
  783. package/dist/dist-esm/react-composites/src/composites/common/adapters.d.ts.map +1 -0
  784. package/dist/dist-esm/react-composites/src/composites/common/adapters.js +4 -0
  785. package/dist/dist-esm/react-composites/src/composites/common/adapters.js.map +1 -0
  786. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +55 -0
  787. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts.map +1 -0
  788. package/dist/dist-esm/react-composites/src/composites/common/icons.js +21 -0
  789. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -0
  790. package/dist/dist-esm/react-composites/src/composites/common/styles/PermissionsBanner.styles.d.ts +6 -0
  791. package/dist/dist-esm/react-composites/src/composites/common/styles/PermissionsBanner.styles.d.ts.map +1 -0
  792. package/dist/dist-esm/react-composites/src/composites/common/styles/PermissionsBanner.styles.js +19 -0
  793. package/dist/dist-esm/react-composites/src/composites/common/styles/PermissionsBanner.styles.js.map +1 -0
  794. package/dist/dist-esm/react-composites/src/composites/index.d.ts +11 -0
  795. package/dist/dist-esm/react-composites/src/composites/index.d.ts.map +1 -0
  796. package/dist/dist-esm/react-composites/src/composites/index.js +8 -0
  797. package/dist/dist-esm/react-composites/src/composites/index.js.map +1 -0
  798. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.d.ts +52 -0
  799. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.d.ts.map +1 -0
  800. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.js +22 -0
  801. package/dist/dist-esm/react-composites/src/composites/localization/LocalizationProvider.js.map +1 -0
  802. package/dist/dist-esm/react-composites/src/composites/localization/index.d.ts +2 -0
  803. package/dist/dist-esm/react-composites/src/composites/localization/index.d.ts.map +1 -0
  804. package/dist/dist-esm/react-composites/src/composites/localization/index.js +4 -0
  805. package/dist/dist-esm/react-composites/src/composites/localization/index.js.map +1 -0
  806. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +11 -0
  807. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +11 -0
  808. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +18 -0
  809. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +11 -0
  810. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +11 -0
  811. package/dist/dist-esm/react-composites/src/composites/localization/locales/index.d.ts +30 -0
  812. package/dist/dist-esm/react-composites/src/composites/localization/locales/index.d.ts.map +1 -0
  813. package/dist/dist-esm/react-composites/src/composites/localization/locales/index.js +95 -0
  814. package/dist/dist-esm/react-composites/src/composites/localization/locales/index.js.map +1 -0
  815. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +11 -0
  816. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +11 -0
  817. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +11 -0
  818. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +11 -0
  819. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +11 -0
  820. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +11 -0
  821. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +11 -0
  822. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +11 -0
  823. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +11 -0
  824. package/dist/dist-esm/react-composites/src/index.d.ts +2 -0
  825. package/dist/dist-esm/react-composites/src/index.d.ts.map +1 -0
  826. package/dist/dist-esm/react-composites/src/index.js +4 -0
  827. package/dist/dist-esm/react-composites/src/index.js.map +1 -0
  828. package/dist/dist-esm/react-composites/src/utils/SDKUtils.d.ts +4 -7
  829. package/dist/dist-esm/react-composites/src/utils/SDKUtils.d.ts.map +1 -1
  830. package/dist/dist-esm/react-composites/src/utils/SDKUtils.js +19 -60
  831. package/dist/dist-esm/react-composites/src/utils/SDKUtils.js.map +1 -1
  832. package/dist/dist-esm/react-composites/src/utils/index.d.ts +1 -1
  833. package/dist/dist-esm/react-composites/src/utils/index.js +3 -3
  834. package/dist/tsdoc-metadata.json +11 -11
  835. package/package.json +129 -123
  836. package/dist/dist-esm/acs-calling-selector/src/baseSelectors.d.ts +0 -16
  837. package/dist/dist-esm/acs-calling-selector/src/baseSelectors.d.ts.map +0 -1
  838. package/dist/dist-esm/acs-calling-selector/src/baseSelectors.js +0 -11
  839. package/dist/dist-esm/acs-calling-selector/src/baseSelectors.js.map +0 -1
  840. package/dist/dist-esm/acs-calling-selector/src/callControlSelectors.d.ts +0 -39
  841. package/dist/dist-esm/acs-calling-selector/src/callControlSelectors.d.ts.map +0 -1
  842. package/dist/dist-esm/acs-calling-selector/src/callControlSelectors.js +0 -38
  843. package/dist/dist-esm/acs-calling-selector/src/callControlSelectors.js.map +0 -1
  844. package/dist/dist-esm/acs-calling-selector/src/devicePermissionSelector.d.ts +0 -10
  845. package/dist/dist-esm/acs-calling-selector/src/devicePermissionSelector.d.ts.map +0 -1
  846. package/dist/dist-esm/acs-calling-selector/src/devicePermissionSelector.js.map +0 -1
  847. package/dist/dist-esm/acs-calling-selector/src/handlers/createHandlers.d.ts.map +0 -1
  848. package/dist/dist-esm/acs-calling-selector/src/handlers/createHandlers.js.map +0 -1
  849. package/dist/dist-esm/acs-calling-selector/src/hooks/useHandlers.d.ts +0 -5
  850. package/dist/dist-esm/acs-calling-selector/src/hooks/useHandlers.d.ts.map +0 -1
  851. package/dist/dist-esm/acs-calling-selector/src/hooks/useHandlers.js.map +0 -1
  852. package/dist/dist-esm/acs-calling-selector/src/hooks/usePropsFor.d.ts +0 -13
  853. package/dist/dist-esm/acs-calling-selector/src/hooks/usePropsFor.d.ts.map +0 -1
  854. package/dist/dist-esm/acs-calling-selector/src/hooks/usePropsFor.js.map +0 -1
  855. package/dist/dist-esm/acs-calling-selector/src/hooks/useSelector.d.ts +0 -3
  856. package/dist/dist-esm/acs-calling-selector/src/hooks/useSelector.d.ts.map +0 -1
  857. package/dist/dist-esm/acs-calling-selector/src/hooks/useSelector.js.map +0 -1
  858. package/dist/dist-esm/acs-calling-selector/src/index.d.ts.map +0 -1
  859. package/dist/dist-esm/acs-calling-selector/src/index.js.map +0 -1
  860. package/dist/dist-esm/acs-calling-selector/src/participantListSelector.d.ts +0 -12
  861. package/dist/dist-esm/acs-calling-selector/src/participantListSelector.d.ts.map +0 -1
  862. package/dist/dist-esm/acs-calling-selector/src/participantListSelector.js +0 -36
  863. package/dist/dist-esm/acs-calling-selector/src/participantListSelector.js.map +0 -1
  864. package/dist/dist-esm/acs-calling-selector/src/providers/CallAgentProvider.d.ts.map +0 -1
  865. package/dist/dist-esm/acs-calling-selector/src/providers/CallAgentProvider.js.map +0 -1
  866. package/dist/dist-esm/acs-calling-selector/src/providers/CallClientProvider.d.ts.map +0 -1
  867. package/dist/dist-esm/acs-calling-selector/src/providers/CallClientProvider.js.map +0 -1
  868. package/dist/dist-esm/acs-calling-selector/src/providers/CallProvider.d.ts.map +0 -1
  869. package/dist/dist-esm/acs-calling-selector/src/providers/CallProvider.js.map +0 -1
  870. package/dist/dist-esm/acs-calling-selector/src/providers/index.d.ts.map +0 -1
  871. package/dist/dist-esm/acs-calling-selector/src/providers/index.js.map +0 -1
  872. package/dist/dist-esm/acs-calling-selector/src/videoGallerySelector.d.ts.map +0 -1
  873. package/dist/dist-esm/acs-calling-selector/src/videoGallerySelector.js +0 -83
  874. package/dist/dist-esm/acs-calling-selector/src/videoGallerySelector.js.map +0 -1
  875. package/dist/dist-esm/acs-chat-selector/src/baseSelectors.d.ts.map +0 -1
  876. package/dist/dist-esm/acs-chat-selector/src/baseSelectors.js +0 -30
  877. package/dist/dist-esm/acs-chat-selector/src/baseSelectors.js.map +0 -1
  878. package/dist/dist-esm/acs-chat-selector/src/chatParticipantListSelector.d.ts.map +0 -1
  879. package/dist/dist-esm/acs-chat-selector/src/chatParticipantListSelector.js.map +0 -1
  880. package/dist/dist-esm/acs-chat-selector/src/chatThreadSelector.d.ts +0 -16
  881. package/dist/dist-esm/acs-chat-selector/src/chatThreadSelector.d.ts.map +0 -1
  882. package/dist/dist-esm/acs-chat-selector/src/chatThreadSelector.js +0 -96
  883. package/dist/dist-esm/acs-chat-selector/src/chatThreadSelector.js.map +0 -1
  884. package/dist/dist-esm/acs-chat-selector/src/handlers/createHandlers.d.ts.map +0 -1
  885. package/dist/dist-esm/acs-chat-selector/src/handlers/createHandlers.js.map +0 -1
  886. package/dist/dist-esm/acs-chat-selector/src/hooks/useHandlers.d.ts +0 -5
  887. package/dist/dist-esm/acs-chat-selector/src/hooks/useHandlers.d.ts.map +0 -1
  888. package/dist/dist-esm/acs-chat-selector/src/hooks/useHandlers.js +0 -14
  889. package/dist/dist-esm/acs-chat-selector/src/hooks/useHandlers.js.map +0 -1
  890. package/dist/dist-esm/acs-chat-selector/src/hooks/usePropsFor.d.ts +0 -12
  891. package/dist/dist-esm/acs-chat-selector/src/hooks/usePropsFor.d.ts.map +0 -1
  892. package/dist/dist-esm/acs-chat-selector/src/hooks/usePropsFor.js.map +0 -1
  893. package/dist/dist-esm/acs-chat-selector/src/hooks/useSelector.d.ts +0 -3
  894. package/dist/dist-esm/acs-chat-selector/src/hooks/useSelector.d.ts.map +0 -1
  895. package/dist/dist-esm/acs-chat-selector/src/hooks/useSelector.js.map +0 -1
  896. package/dist/dist-esm/acs-chat-selector/src/index.d.ts.map +0 -1
  897. package/dist/dist-esm/acs-chat-selector/src/index.js.map +0 -1
  898. package/dist/dist-esm/acs-chat-selector/src/providers/ChatClientProvider.d.ts.map +0 -1
  899. package/dist/dist-esm/acs-chat-selector/src/providers/ChatClientProvider.js.map +0 -1
  900. package/dist/dist-esm/acs-chat-selector/src/providers/ChatThreadClientProvider.d.ts.map +0 -1
  901. package/dist/dist-esm/acs-chat-selector/src/providers/ChatThreadClientProvider.js.map +0 -1
  902. package/dist/dist-esm/acs-chat-selector/src/sendBoxSelector.d.ts +0 -10
  903. package/dist/dist-esm/acs-chat-selector/src/sendBoxSelector.d.ts.map +0 -1
  904. package/dist/dist-esm/acs-chat-selector/src/sendBoxSelector.js.map +0 -1
  905. package/dist/dist-esm/acs-chat-selector/src/typingIndicatorSelector.d.ts.map +0 -1
  906. package/dist/dist-esm/acs-chat-selector/src/typingIndicatorSelector.js.map +0 -1
  907. package/dist/dist-esm/acs-chat-selector/src/utils/compareMessages.d.ts +0 -3
  908. package/dist/dist-esm/acs-chat-selector/src/utils/compareMessages.d.ts.map +0 -1
  909. package/dist/dist-esm/acs-chat-selector/src/utils/compareMessages.js +0 -12
  910. package/dist/dist-esm/acs-chat-selector/src/utils/compareMessages.js.map +0 -1
  911. package/dist/dist-esm/acs-chat-selector/src/utils/constants.d.ts +0 -3
  912. package/dist/dist-esm/acs-chat-selector/src/utils/constants.d.ts.map +0 -1
  913. package/dist/dist-esm/acs-chat-selector/src/utils/constants.js +0 -5
  914. package/dist/dist-esm/acs-chat-selector/src/utils/constants.js.map +0 -1
  915. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallConfiguration.d.ts +0 -8
  916. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallConfiguration.d.ts.map +0 -1
  917. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallConfiguration.js +0 -14
  918. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallConfiguration.js.map +0 -1
  919. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Call.styles.d.ts +0 -2
  920. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Call.styles.d.ts.map +0 -1
  921. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Call.styles.js +0 -11
  922. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/Call.styles.js.map +0 -1
  923. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ThreadStatus.d.ts +0 -13
  924. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ThreadStatus.d.ts.map +0 -1
  925. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ThreadStatus.js +0 -22
  926. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ThreadStatus.js.map +0 -1
  927. package/dist/dist-esm/react-composites/src/index.release.d.ts +0 -3
  928. package/dist/dist-esm/react-composites/src/index.release.d.ts.map +0 -1
  929. package/dist/dist-esm/react-composites/src/index.release.js +0 -5
  930. package/dist/dist-esm/react-composites/src/index.release.js.map +0 -1
  931. package/dist/dist-esm/react-composites/src/types/CommunicationUiError.d.ts +0 -82
  932. package/dist/dist-esm/react-composites/src/types/CommunicationUiError.d.ts.map +0 -1
  933. package/dist/dist-esm/react-composites/src/types/CommunicationUiError.js +0 -82
  934. package/dist/dist-esm/react-composites/src/types/CommunicationUiError.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../acs-ui-common/src/memoizeFnAll.ts","../../../../acs-ui-common/src/identifier.ts","../../../../acs-calling-selector/src/baseSelectors.ts","../../../../acs-calling-selector/src/callControlSelectors.ts","../../../../acs-calling-selector/src/devicePermissionSelector.ts","../../../../acs-calling-selector/src/handlers/createHandlers.ts","../../../../acs-calling-selector/src/participantListSelector.ts","../../../../acs-calling-selector/src/videoGallerySelector.ts","../../../../acs-calling-selector/src/providers/CallAgentProvider.tsx","../../../../acs-calling-selector/src/providers/CallClientProvider.tsx","../../../../acs-calling-selector/src/providers/CallProvider.tsx","../../../../react-components/src/components/styles/TypingIndicator.styles.ts","../../../../react-components/src/components/TypingIndicator.tsx","../../../../react-components/src/components/styles/GridLayout.styles.ts","../../../../react-components/src/components/GridLayout.tsx","../../../../react-components/src/components/styles/SendBox.styles.ts","../../../../react-components/src/components/SendBox.tsx","../../../../react-components/src/components/styles/MessageStatusIndicator.styles.ts","../../../../react-components/src/components/MessageStatusIndicator.tsx","../../../../react-components/src/components/styles/MessageThread.styles.ts","../../../../react-components/src/components/utils/Datetime.ts","../../../../react-components/src/components/utils/delay.ts","../../../../react-components/src/components/styles/SystemMessage.styles.ts","../../../../react-components/src/components/SystemMessage.tsx","../../../../react-components/src/components/MessageThread.tsx","../../../../react-components/src/components/styles/StreamMedia.styles.ts","../../../../react-components/src/components/StreamMedia.tsx","../../../../react-components/src/components/styles/ParticipantItem.styles.ts","../../../../react-components/src/components/ParticipantItem.tsx","../../../../react-components/src/components/styles/ParticipantList.styles.ts","../../../../react-components/src/components/ParticipantList.tsx","../../../../react-components/src/components/styles/VideoGallery.styles.ts","../../../../react-components/src/components/styles/VideoTile.styles.ts","../../../../react-components/src/components/VideoTile.tsx","../../../../react-components/src/components/VideoGallery.tsx","../../../../react-components/src/components/styles/ControlBar.styles.ts","../../../../react-components/src/components/CameraButton.tsx","../../../../react-components/src/theming/themeUtils.ts","../../../../react-components/src/components/ControlBar.tsx","../../../../react-components/src/theming/themes.ts","../../../../react-components/src/components/EndCallButton.tsx","../../../../react-components/src/components/MicrophoneButton.tsx","../../../../react-components/src/components/OptionsButton.tsx","../../../../react-components/src/components/ScreenShareButton.tsx","../../../../react-components/src/theming/FluentThemeProvider.tsx","../../../../acs-calling-selector/src/hooks/useHandlers.ts","../../../../acs-calling-selector/src/hooks/useSelector.ts","../../../../acs-calling-selector/src/hooks/usePropsFor.ts","../../../../acs-chat-selector/src/handlers/createHandlers.ts","../../../../acs-chat-selector/src/providers/ChatClientProvider.tsx","../../../../acs-chat-selector/src/providers/ChatThreadClientProvider.tsx","../../../../acs-chat-selector/src/hooks/useHandlers.ts","../../../../acs-chat-selector/src/hooks/useSelector.ts","../../../../acs-chat-selector/src/baseSelectors.ts","../../../../acs-chat-selector/src/sendBoxSelector.ts","../../../../acs-chat-selector/src/utils/compareMessages.ts","../../../../acs-chat-selector/src/chatThreadSelector.ts","../../../../acs-chat-selector/src/utils/constants.ts","../../../../acs-chat-selector/src/typingIndicatorSelector.ts","../../../../acs-chat-selector/src/chatParticipantListSelector.ts","../../../../acs-chat-selector/src/hooks/usePropsFor.ts","../../../../calling-stateful-client/src/DeviceManagerDeclarative.ts","../../../../calling-stateful-client/src/CallContext.ts","../../../../calling-stateful-client/src/Converter.ts","../../../../calling-stateful-client/src/RequestedTransferSubscriber.ts","../../../../calling-stateful-client/src/TransferCallFeatureDeclarative.ts","../../../../calling-stateful-client/src/CallDeclarative.ts","../../../../calling-stateful-client/src/ReceivedTransferSubscriber.ts","../../../../calling-stateful-client/src/RemoteVideoStreamSubscriber.ts","../../../../calling-stateful-client/src/StreamUtils.ts","../../../../calling-stateful-client/src/ParticipantSubscriber.ts","../../../../calling-stateful-client/src/RecordingSubscriber.ts","../../../../calling-stateful-client/src/TranscriptionSubscriber.ts","../../../../calling-stateful-client/src/CallSubscriber.ts","../../../../calling-stateful-client/src/IncomingCallSubscriber.ts","../../../../calling-stateful-client/src/CallAgentDeclarative.ts","../../../../calling-stateful-client/src/InternalCallContext.ts","../../../../calling-stateful-client/src/StatefulCallClient.ts","../../../../chat-stateful-client/src/Constants.ts","../../../../chat-stateful-client/src/ChatContext.ts","../../../../chat-stateful-client/src/convertChatMessage.ts","../../../../chat-stateful-client/src/EventSubscriber.ts","../../../../chat-stateful-client/src/iterators/createDecoratedIterator.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListMessages.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListReadReceipts.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListParticipants.ts","../../../../chat-stateful-client/src/StatefulChatThreadClient.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListThreads.ts","../../../../chat-stateful-client/src/StatefulChatClient.ts","../../../../react-composites/src/types/CommunicationUiError.ts","../../../../react-composites/src/utils/SDKUtils.ts","../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts","../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.tsx","../../../../react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.ts","../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts","../../../../react-composites/src/composites/ChatComposite/hooks/usePropsFor.ts","../../../../react-composites/src/composites/ChatComposite/styles/Chat.styles.ts","../../../../react-composites/src/composites/ChatComposite/ChatHeader.tsx","../../../../react-composites/src/composites/ChatComposite/ThreadStatus.tsx","../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx","../../../../react-composites/src/composites/ChatComposite/ChatComposite.tsx","../../../../react-composites/src/composites/CallComposite/styles/CallScreen.styles.ts","../../../../react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.tsx","../../../../react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.ts","../../../../react-composites/src/composites/CallComposite/hooks/useSelector.ts","../../../../react-composites/src/composites/CallComposite/hooks/useHandlers.ts","../../../../react-composites/src/composites/CallComposite/hooks/usePropsFor.ts","../../../../react-composites/src/composites/CallComposite/styles/MediaGallery.styles.ts","../../../../react-composites/src/composites/CallComposite/styles/ScreenShare.styles.ts","../../../../react-composites/src/composites/CallComposite/ScreenShare.tsx","../../../../react-composites/src/composites/CallComposite/selectors/baseSelectors.ts","../../../../react-composites/src/composites/CallComposite/MediaGallery.tsx","../../../../react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.ts","../../../../react-composites/src/composites/CallComposite/selectors/callStatusSelector.ts","../../../../react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.ts","../../../../react-composites/src/composites/CallComposite/styles/CallControls.styles.ts","../../../../react-composites/src/composites/CallComposite/CallControls.tsx","../../../../react-composites/src/composites/CallComposite/ComplianceBanner.tsx","../../../../react-composites/src/composites/CallComposite/selectors/lobbySelector.ts","../../../../react-composites/src/composites/CallComposite/LobbyControlBar.tsx","../../../../react-composites/src/composites/CallComposite/Lobby.tsx","../../../../react-composites/src/composites/CallComposite/CallScreen.tsx","../../../../react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.ts","../../../../react-composites/src/composites/CallComposite/styles/LocalPreview.styles.ts","../../../../react-composites/src/composites/CallComposite/selectors/localPreviewSelector.ts","../../../../react-composites/src/composites/CallComposite/LocalPreview.tsx","../../../../react-composites/src/composites/CallComposite/CallConfiguration.tsx","../../../../react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.ts","../../../../react-composites/src/composites/CallComposite/LocalDeviceSettings.tsx","../../../../react-composites/src/composites/CallComposite/styles/StartCallButton.styles.ts","../../../../react-composites/src/composites/CallComposite/StartCallButton.tsx","../../../../react-composites/src/composites/CallComposite/ConfigurationScreen.tsx","../../../../react-composites/src/composites/CallComposite/styles/Error.styles.ts","../../../../react-composites/src/composites/CallComposite/Error.tsx","../../../../react-composites/src/composites/CallComposite/styles/Call.styles.ts","../../../../react-composites/src/composites/CallComposite/Call.tsx","../../../../react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.ts","../../../../react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nexport type FunctionWithKey<KeyT, ArgsT extends any[], RetT> = (key: KeyT, ...args: ArgsT) => RetT;\r\nexport type CallbackType<KeyT, ArgsT extends any[], FnRetT> = (\r\n memoizedFn: FunctionWithKey<KeyT, ArgsT, FnRetT>\r\n) => FnRetT[];\r\n\r\nconst argsCmp = (args1: any[], args2: any[], objCmp: (obj1: any, obj2: any) => boolean): boolean => {\r\n return args1.length === args2.length && args1.every((arg1, index) => objCmp(args2[index], arg1));\r\n};\r\n\r\n/**\r\n * The function memoize a series of function calls in a single pass,\r\n * it memoizes all the args and return in a single run of the callback function, and read it in the next round of execution\r\n * note: this is a memory opimized function which will only memoize one round of bulk calls\r\n * @param fnToMemoize - the function needs to be bulk memorized and a key key paramter needs to be provided as cache id\r\n * @param shouldCacheUpdate - the validate function for comparing 2 argument, return true when 2 args are equal\r\n * @returns callback function includes a series calls of memoizedFn, and each call will get cache result if args are the same(according to shouldCacheUpdate fn)\r\n * @example\r\n * ```ts\r\n * const items = [{id:1, value:3}];\r\n * const heavyFn = (_key, value) => { // key is not used in the function, but it is a cache id\r\n * // assume this is a heavy caculation\r\n * return value+1;\r\n * }\r\n *\r\n * const memoizeHeavyFnAll = memoizeFnAll(heavyFn);\r\n * const generateValueArray = (memoizedHeavyFn) => (\r\n * items.map(item => {\r\n * memoizedHeavyFn(item.id, item.value);\r\n * })\r\n * );\r\n *\r\n * const result = memoizeHeavyFnAll(generateValueArray); // Cache: {}, nextCache: {1: 4 *new}, heavyFn call times: 1\r\n *\r\n * // Argument changed\r\n * items[0].value = 2\r\n * const result0 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 4}, nextCache: {1: 3 *new}, heavyFn call times: 1\r\n *\r\n * // Cache added\r\n * items.push({id:3, value:4});\r\n * const result1 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 3 *hit}, nextCache: {1: 3, 3: 5 *new}, heavyFn call times: 1\r\n *\r\n * // Cache removed\r\n * delete items[0];\r\n * const result2 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 3, 3: 5 *hit}, nextCache: {3: 5}, heavyFn call times: 0\r\n * ```\r\n */\r\nexport const memoizeFnAll = <KeyT, ArgsT extends any[], FnRetT, CallBackT extends CallbackType<KeyT, ArgsT, FnRetT>>(\r\n fnToMemoize: FunctionWithKey<KeyT, ArgsT, FnRetT>,\r\n shouldCacheUpdate: (args1: any, args2: any) => boolean = Object.is\r\n): ((callback: CallBackT) => FnRetT[]) => {\r\n let cache = new Map<KeyT, [ArgsT, FnRetT]>();\r\n let nextCache = new Map<KeyT, [ArgsT, FnRetT]>();\r\n\r\n return (callback: CallbackType<KeyT, ArgsT, FnRetT>): FnRetT[] => {\r\n const memoizedFn: FunctionWithKey<KeyT, ArgsT, FnRetT> = (key: KeyT, ...args: ArgsT): FnRetT => {\r\n const value = cache.get(key);\r\n if (value) {\r\n const [preArgs, ret] = value;\r\n if (argsCmp(preArgs, args, shouldCacheUpdate)) {\r\n nextCache.set(key, [args, ret]);\r\n return ret;\r\n }\r\n }\r\n const ret = fnToMemoize(key, ...args);\r\n nextCache.set(key, [args, ret]);\r\n return ret;\r\n };\r\n const retValue = callback(memoizedFn);\r\n cache = nextCache;\r\n nextCache = new Map<KeyT, [ArgsT, FnRetT]>();\r\n return retValue;\r\n };\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n CommunicationIdentifier,\r\n isCommunicationUserIdentifier,\r\n isMicrosoftTeamsUserIdentifier,\r\n isPhoneNumberIdentifier\r\n} from '@azure/communication-common';\r\n\r\n/**\r\n * A string representation of a CommunicationIdentifier.\r\n *\r\n * This string representation of CommunicationIdentifier is guaranteed to be stable for\r\n * a unique Communication user. Thus,\r\n * - it can be used to persist a user's identity in external databases.\r\n * - it can be used as keys into a Map to store data for the user.\r\n */\r\nexport const toFlatCommunicationIdentifier = (id: CommunicationIdentifier): string => {\r\n if (isCommunicationUserIdentifier(id)) {\r\n return id.communicationUserId;\r\n }\r\n if (isMicrosoftTeamsUserIdentifier(id)) {\r\n return id.microsoftTeamsUserId;\r\n }\r\n if (isPhoneNumberIdentifier(id)) {\r\n return id.phoneNumber;\r\n }\r\n return id.id;\r\n};\r\n\r\nexport const fromFlatCommunicationIdentifier = (id: string): CommunicationIdentifier => {\r\n // This implementation is currently a hack that only works with ACS identifiers.\r\n // TODO: Make `toFlatCommunicationIdentifier` not be lossy so this can reverse the process.\r\n return { communicationUserId: id };\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallState, CallClientState, DeviceManagerState, IncomingCallState } from 'calling-stateful-client';\r\n\r\n/**\r\n * Common props used to reference calling declarative client state.\r\n */\r\nexport type CallingBaseSelectorProps = {\r\n callId: string;\r\n};\r\n\r\nexport const getCalls = (state: CallClientState): Map<string, CallState> => state.calls;\r\n\r\nexport const getCallsEnded = (state: CallClientState): CallState[] => state.callsEnded;\r\n\r\nexport const getIncomingCalls = (state: CallClientState): Map<string, IncomingCallState> => state.incomingCalls;\r\n\r\nexport const getIncomingCallsEnded = (state: CallClientState): IncomingCallState[] => state.incomingCallsEnded;\r\n\r\nexport const getDeviceManager = (state: CallClientState): DeviceManagerState => state.deviceManager;\r\n\r\nexport const getCall = (state: CallClientState, props: CallingBaseSelectorProps): CallState | undefined =>\r\n state.calls.get(props.callId);\r\n\r\nexport const getDisplayName = (state: CallClientState): string | undefined => state.callAgent?.displayName;\r\n\r\nexport const getIdentifier = (state: CallClientState): string => state.userId;\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { CallState, CallClientState, DeviceManagerState } from 'calling-stateful-client';\r\n// @ts-ignore\r\nimport { CallingBaseSelectorProps } from './baseSelectors';\r\nimport { getCall, getDeviceManager } from './baseSelectors';\r\n// @ts-ignore\r\nimport { AudioDeviceInfo, VideoDeviceInfo } from '@azure/communication-calling';\r\n\r\nexport const microphoneButtonSelector = reselect.createSelector([getCall, getDeviceManager], (call, deviceManager) => {\r\n return {\r\n disabled: !call,\r\n checked: call ? !call.isMuted : false\r\n };\r\n});\r\n\r\nexport const cameraButtonSelector = reselect.createSelector([getCall, getDeviceManager], (call, deviceManager) => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n const previewOn = deviceManager.unparentedViews.values().next().value?.view !== undefined;\r\n const localVideoFromCall = call?.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\r\n\r\n return {\r\n disabled: !deviceManager.selectedCamera,\r\n checked: call ? !!localVideoFromCall : previewOn\r\n };\r\n});\r\n\r\nexport const screenShareButtonSelector = reselect.createSelector([getCall], (call) => {\r\n return {\r\n checked: call?.isScreenSharingOn\r\n };\r\n});\r\n\r\nexport const optionsButtonSelector = reselect.createSelector([getDeviceManager, getCall], (deviceManager) => {\r\n return {\r\n microphones: deviceManager.microphones,\r\n speakers: deviceManager.speakers,\r\n cameras: deviceManager.cameras,\r\n selectedMicrophone: deviceManager.selectedMicrophone,\r\n selectedSpeaker: deviceManager.selectedSpeaker,\r\n selectedCamera: deviceManager.selectedCamera\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { CallClientState, DeviceManagerState } from 'calling-stateful-client';\r\n// @ts-ignore\r\nimport { getDeviceManager } from './baseSelectors';\r\n\r\nexport const devicePermissionSelector = reselect.createSelector([getDeviceManager], (deviceManager) => {\r\n return {\r\n video: deviceManager.deviceAccess ? deviceManager.deviceAccess.video : true,\r\n audio: deviceManager.deviceAccess ? deviceManager.deviceAccess.audio : true\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// @ts-ignore\r\nimport {\r\n AudioDeviceInfo,\r\n Call,\r\n CallAgent,\r\n LocalVideoStream,\r\n StartCallOptions,\r\n VideoDeviceInfo\r\n} from '@azure/communication-calling';\r\nimport { CommunicationUserIdentifier, PhoneNumberIdentifier, UnknownIdentifier } from '@azure/communication-common';\r\nimport { Common, fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { DeviceManagerState, StatefulCallClient, StatefulDeviceManager } from 'calling-stateful-client';\r\nimport memoizeOne from 'memoize-one';\r\nimport { ReactElement } from 'react';\r\nimport { VideoStreamOptions } from 'react-components';\r\n\r\n// @ts-ignore\r\nimport { CommonProperties } from 'acs-ui-common';\r\n\r\nexport type DefaultCallingHandlers = {\r\n onStartLocalVideo: () => Promise<void>;\r\n onToggleCamera: () => Promise<void>;\r\n onStartCall: (\r\n participants: (CommunicationUserIdentifier | PhoneNumberIdentifier | UnknownIdentifier)[],\r\n options?: StartCallOptions\r\n ) => Call | undefined;\r\n onSelectMicrophone: (device: AudioDeviceInfo) => Promise<void>;\r\n onSelectSpeaker: (device: AudioDeviceInfo) => Promise<void>;\r\n onSelectCamera: (device: VideoDeviceInfo) => Promise<void>;\r\n onToggleMicrophone: () => Promise<void>;\r\n onStartScreenShare: () => Promise<void>;\r\n onStopScreenShare: () => Promise<void>;\r\n onToggleScreenShare: () => Promise<void>;\r\n onHangUp: () => Promise<void>;\r\n onCreateLocalStreamView: (options?: VideoStreamOptions) => Promise<void>;\r\n onCreateRemoteStreamView: (userId: string, options?: VideoStreamOptions) => Promise<void>;\r\n onParticipantRemove: (userId: string) => void;\r\n};\r\n\r\nexport const areStreamsEqual = (prevStream: LocalVideoStream, newStream: LocalVideoStream): boolean => {\r\n return !!prevStream && !!newStream && prevStream.source.id === newStream.source.id;\r\n};\r\n\r\nexport const createDefaultCallingHandlers = memoizeOne(\r\n (\r\n callClient: StatefulCallClient,\r\n callAgent: CallAgent | undefined,\r\n deviceManager: StatefulDeviceManager | undefined,\r\n call: Call | undefined\r\n ) => {\r\n const onStartLocalVideo = async (): Promise<void> => {\r\n const callId = call?.id;\r\n let videoDeviceInfo = callClient.getState().deviceManager.selectedCamera;\r\n if (!videoDeviceInfo) {\r\n const cameras = await deviceManager?.getCameras();\r\n videoDeviceInfo = cameras && cameras.length > 0 ? cameras[0] : undefined;\r\n videoDeviceInfo && deviceManager?.selectCamera(videoDeviceInfo);\r\n }\r\n if (!callId || !videoDeviceInfo) return;\r\n const stream = new LocalVideoStream(videoDeviceInfo);\r\n if (call && !call.localVideoStreams.find((s) => areStreamsEqual(s, stream))) {\r\n await call.startVideo(stream);\r\n }\r\n };\r\n\r\n const onStopLocalVideo = async (stream: LocalVideoStream): Promise<void> => {\r\n const callId = call?.id;\r\n if (!callId) return;\r\n if (call && call.localVideoStreams.find((s) => areStreamsEqual(s, stream))) {\r\n await call.stopVideo(stream);\r\n await callClient.disposeView(callId, undefined, {\r\n source: stream.source,\r\n mediaStreamType: stream.mediaStreamType\r\n });\r\n }\r\n };\r\n\r\n const onToggleCamera = async (): Promise<void> => {\r\n if (call) {\r\n const stream = call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\r\n if (stream) {\r\n await onStopLocalVideo(stream);\r\n } else {\r\n await onStartLocalVideo();\r\n }\r\n } else {\r\n const selectedCamera = callClient.getState().deviceManager.selectedCamera;\r\n if (selectedCamera) {\r\n const previewOn = isPreviewOn(callClient.getState().deviceManager);\r\n if (previewOn) {\r\n // TODO: we need to remember which LocalVideoStream was used for LocalPreview and dispose that one. For now\r\n // assume any unparented view is a LocalPreview and stop all since those are only used for LocalPreview\r\n // currently.\r\n for (const stream of callClient.getState().deviceManager.unparentedViews.keys()) {\r\n await callClient.disposeView(undefined, undefined, stream);\r\n }\r\n } else {\r\n await callClient.createView(undefined, undefined, {\r\n source: selectedCamera,\r\n mediaStreamType: 'Video'\r\n });\r\n }\r\n }\r\n }\r\n };\r\n\r\n // FIXME: onStartCall API should use string, not the underlying SDK types.\r\n const onStartCall = (\r\n participants: (CommunicationUserIdentifier | PhoneNumberIdentifier | UnknownIdentifier)[],\r\n options?: StartCallOptions\r\n ): Call | undefined => {\r\n return callAgent ? callAgent.startCall(participants, options) : undefined;\r\n };\r\n\r\n const onSelectMicrophone = async (device: AudioDeviceInfo): Promise<void> => {\r\n if (!deviceManager) {\r\n return;\r\n }\r\n return deviceManager.selectMicrophone(device);\r\n };\r\n\r\n const onSelectSpeaker = async (device: AudioDeviceInfo): Promise<void> => {\r\n if (!deviceManager) {\r\n return;\r\n }\r\n return deviceManager.selectSpeaker(device);\r\n };\r\n\r\n const onSelectCamera = async (device: VideoDeviceInfo): Promise<void> => {\r\n if (!deviceManager) {\r\n return;\r\n }\r\n if (call) {\r\n deviceManager.selectCamera(device);\r\n const stream = call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\r\n return stream?.switchSource(device);\r\n } else {\r\n const previewOn = isPreviewOn(callClient.getState().deviceManager);\r\n\r\n if (!previewOn) {\r\n deviceManager.selectCamera(device);\r\n return;\r\n }\r\n\r\n const selectedCamera = callClient.getState().deviceManager.selectedCamera;\r\n // If preview is on, then stop current preview and then start new preview with new device\r\n if (selectedCamera) {\r\n // TODO: we need to remember which LocalVideoStream was used for LocalPreview and dispose that one. For now\r\n // assume any unparented view is a LocalPreview and stop all since those are only used for LocalPreview\r\n // currently.\r\n for (const stream of callClient.getState().deviceManager.unparentedViews.keys()) {\r\n await callClient.disposeView(undefined, undefined, stream);\r\n }\r\n }\r\n deviceManager.selectCamera(device);\r\n await callClient.createView(undefined, undefined, {\r\n source: device,\r\n mediaStreamType: 'Video'\r\n });\r\n }\r\n };\r\n\r\n const onToggleMicrophone = async (): Promise<void> => {\r\n if (!call) {\r\n throw new Error(`Please invoke onToggleMicrophone after call is started`);\r\n }\r\n return call.isMuted ? await call.unmute() : await call.mute();\r\n };\r\n\r\n const onStartScreenShare = async (): Promise<void> => await call?.startScreenSharing();\r\n\r\n const onStopScreenShare = async (): Promise<void> => await call?.stopScreenSharing();\r\n\r\n const onToggleScreenShare = async (): Promise<void> =>\r\n call?.isScreenSharingOn ? await onStopScreenShare() : await onStartScreenShare();\r\n\r\n const onHangUp = async (): Promise<void> => await call?.hangUp();\r\n\r\n const onCreateLocalStreamView = async (options?: VideoStreamOptions): Promise<void> => {\r\n if (!call || call.localVideoStreams.length === 0) {\r\n return;\r\n }\r\n\r\n const callState = callClient.getState().calls.get(call.id);\r\n if (!callState) {\r\n return;\r\n }\r\n\r\n const localStream = callState.localVideoStreams.find((item) => item.mediaStreamType === 'Video');\r\n if (!localStream) {\r\n return;\r\n }\r\n\r\n return callClient.createView(call.id, undefined, localStream, options);\r\n };\r\n\r\n const onCreateRemoteStreamView = async (userId: string, options?: VideoStreamOptions): Promise<void> => {\r\n if (!call) return;\r\n const callState = callClient.getState().calls.get(call.id);\r\n if (!callState) throw new Error(`Call Not Found: ${call.id}`);\r\n\r\n const participant = Array.from(callState.remoteParticipants.values()).find(\r\n (participant) => toFlatCommunicationIdentifier(participant.identifier) === userId\r\n );\r\n\r\n if (!participant || !participant.videoStreams) {\r\n return;\r\n }\r\n\r\n const remoteVideoStream = Array.from(participant.videoStreams.values()).find(\r\n (i) => i.mediaStreamType === 'Video'\r\n );\r\n const screenShareStream = Array.from(participant.videoStreams.values()).find(\r\n (i) => i.mediaStreamType === 'ScreenSharing'\r\n );\r\n\r\n if (remoteVideoStream && remoteVideoStream.isAvailable && !remoteVideoStream.view) {\r\n callClient.createView(call.id, participant.identifier, remoteVideoStream, options);\r\n }\r\n\r\n if (screenShareStream && screenShareStream.isAvailable && !screenShareStream.view) {\r\n callClient.createView(call.id, participant.identifier, screenShareStream, options);\r\n }\r\n };\r\n\r\n const onParticipantRemove = (userId: string): void => {\r\n call?.removeParticipant(fromFlatCommunicationIdentifier(userId));\r\n };\r\n\r\n return {\r\n onHangUp,\r\n onSelectCamera,\r\n onSelectMicrophone,\r\n onSelectSpeaker,\r\n onStartCall,\r\n onStartScreenShare,\r\n onStopScreenShare,\r\n onToggleCamera,\r\n onToggleMicrophone,\r\n onToggleScreenShare,\r\n onCreateLocalStreamView,\r\n onCreateRemoteStreamView,\r\n onParticipantRemove,\r\n onStartLocalVideo\r\n };\r\n }\r\n);\r\n\r\n// TODO: extract into an util.\r\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n return deviceManager.unparentedViews.values().next().value?.view !== undefined;\r\n};\r\n\r\n/**\r\n * Create a set of default handlers for given component. Memoization is applied to the result. Multiple invokations with\r\n * the same arguments will return the same handler instances. DeclarativeCallAgent, DeclarativeDeviceManager, and\r\n * DeclarativeCall may be undefined. If undefined, their associated handlers will not be created and returned.\r\n *\r\n * @param callClient - StatefulCallClient returned from\r\n * {@Link calling-stateful-client#createStatefulCallClient}.\r\n * @param callAgent - Instance of {@Link @azure/communication-calling#CallClient}.\r\n * @param deviceManager - Instance of {@Link @azure/communication-calling#DeviceManager}.\r\n * @param call - Instance of {@Link @azure/communication-calling#Call}.\r\n * @param _ - React component that you want to generate handlers for.\r\n * @returns\r\n */\r\nexport const createDefaultCallingHandlersForComponent = <Props>(\r\n callClient: StatefulCallClient,\r\n callAgent: CallAgent | undefined,\r\n deviceManager: StatefulDeviceManager | undefined,\r\n call: Call | undefined,\r\n _Component: (props: Props) => ReactElement | null\r\n): Common<DefaultCallingHandlers, Props> => {\r\n return createDefaultCallingHandlers(callClient, callAgent, deviceManager, call);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { RemoteParticipantState, CallClientState, CallState } from 'calling-stateful-client';\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { CallingBaseSelectorProps } from './baseSelectors';\r\nimport { getCall, getIdentifier, getDisplayName } from './baseSelectors';\r\nimport { CallParticipant } from 'react-components';\r\n\r\nconst convertRemoteParticipantsToCommunicationParticipants = (\r\n remoteParticipants: RemoteParticipantState[]\r\n): CallParticipant[] => {\r\n return remoteParticipants.map((participant: RemoteParticipantState) => {\r\n const isScreenSharing = Array.from(participant.videoStreams.values()).some(\r\n (videoStream) => videoStream.mediaStreamType === 'ScreenSharing' && videoStream.isAvailable\r\n );\r\n\r\n return {\r\n userId: toFlatCommunicationIdentifier(participant.identifier),\r\n displayName: participant.displayName,\r\n state: participant.state,\r\n isMuted: participant.isMuted,\r\n isScreenSharing: isScreenSharing,\r\n isSpeaking: participant.isSpeaking\r\n };\r\n });\r\n};\r\n\r\nexport const participantListSelector = reselect.createSelector(\r\n [getIdentifier, getDisplayName, getCall],\r\n (\r\n userId,\r\n displayName,\r\n call\r\n ): {\r\n participants: CallParticipant[];\r\n myUserId: string;\r\n } => {\r\n const remoteParticipants =\r\n call && call?.remoteParticipants\r\n ? convertRemoteParticipantsToCommunicationParticipants(Array.from(call?.remoteParticipants.values()))\r\n : [];\r\n remoteParticipants.push({\r\n userId: userId,\r\n displayName: displayName,\r\n isScreenSharing: call?.isScreenSharingOn,\r\n isMuted: call?.isMuted,\r\n state: 'Connected'\r\n });\r\n return {\r\n participants: remoteParticipants,\r\n myUserId: userId\r\n };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { CallState, CallClientState, RemoteParticipantState, RemoteVideoStreamState } from 'calling-stateful-client';\r\n// @ts-ignore\r\nimport { createSelector } from 'reselect';\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { getCall, CallingBaseSelectorProps, getDisplayName, getIdentifier, getCallId } from './baseSelectors';\r\nimport { memoizeFnAll } from 'acs-ui-common';\r\nimport { VideoGalleryRemoteParticipant, VideoGalleryStream } from 'react-components';\r\n\r\nconst convertRemoteVideoStreamToVideoGalleryStream = (stream: RemoteVideoStreamState): VideoGalleryStream => {\r\n return {\r\n id: stream.id,\r\n isAvailable: stream.isAvailable,\r\n isMirrored: stream.view?.isMirrored,\r\n renderElement: stream.view?.target\r\n };\r\n};\r\n\r\nconst convertRemoteParticipantToVideoGalleryRemoteParticipant = (\r\n userId: string,\r\n isMuted: boolean,\r\n isSpeaking: boolean,\r\n videoStreams: Map<number, RemoteVideoStreamState>,\r\n displayName?: string\r\n): VideoGalleryRemoteParticipant => {\r\n const rawVideoStreamsArray = Array.from(videoStreams.values());\r\n let videoStream: VideoGalleryStream | undefined = undefined;\r\n let screenShareStream: VideoGalleryStream | undefined = undefined;\r\n\r\n if (rawVideoStreamsArray[0]) {\r\n if (rawVideoStreamsArray[0].mediaStreamType === 'Video') {\r\n videoStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[0]);\r\n } else {\r\n screenShareStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[0]);\r\n }\r\n }\r\n\r\n if (rawVideoStreamsArray[1]) {\r\n if (rawVideoStreamsArray[1].mediaStreamType === 'ScreenSharing') {\r\n screenShareStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[1]);\r\n } else {\r\n videoStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[1]);\r\n }\r\n }\r\n\r\n return {\r\n userId,\r\n displayName,\r\n isMuted,\r\n isSpeaking,\r\n videoStream,\r\n screenShareStream,\r\n isScreenSharingOn: screenShareStream !== undefined && screenShareStream.isAvailable\r\n };\r\n};\r\n\r\nconst memoizedAllConvertRemoteParticipant = memoizeFnAll(\r\n (\r\n userId: string,\r\n isMuted: boolean,\r\n isSpeaking: boolean,\r\n videoStreams: Map<number, RemoteVideoStreamState>,\r\n displayName?: string\r\n ): VideoGalleryRemoteParticipant => {\r\n return convertRemoteParticipantToVideoGalleryRemoteParticipant(\r\n userId,\r\n isMuted,\r\n isSpeaking,\r\n videoStreams,\r\n displayName\r\n );\r\n }\r\n);\r\n\r\nconst videoGalleryRemoteParticipantsFromCall = (call: CallState | undefined): VideoGalleryRemoteParticipant[] => {\r\n if (!call || !call.remoteParticipants) return [];\r\n return memoizedAllConvertRemoteParticipant((memoizedFn) => {\r\n return Array.from(call.remoteParticipants.values()).map((participant: RemoteParticipantState) => {\r\n return memoizedFn(\r\n toFlatCommunicationIdentifier(participant.identifier),\r\n participant.isMuted,\r\n participant.isSpeaking,\r\n participant.videoStreams,\r\n participant.displayName\r\n );\r\n });\r\n });\r\n};\r\n\r\nexport const videoGallerySelector = createSelector(\r\n [getCall, getDisplayName, getIdentifier],\r\n (call: CallState | undefined, displayName: string | undefined, identifier: string) => {\r\n const screenShareRemoteParticipant = call?.screenShareRemoteParticipant\r\n ? call.remoteParticipants.get(call.screenShareRemoteParticipant)\r\n : undefined;\r\n const localVideoStream = call?.localVideoStreams.find((i) => i.mediaStreamType === 'Video');\r\n return {\r\n screenShareParticipant: screenShareRemoteParticipant\r\n ? convertRemoteParticipantToVideoGalleryRemoteParticipant(\r\n toFlatCommunicationIdentifier(screenShareRemoteParticipant.identifier),\r\n screenShareRemoteParticipant.isMuted,\r\n screenShareRemoteParticipant.isSpeaking,\r\n screenShareRemoteParticipant.videoStreams,\r\n screenShareRemoteParticipant.displayName\r\n )\r\n : undefined,\r\n localParticipant: {\r\n userId: identifier,\r\n displayName: displayName ?? '',\r\n isMuted: call?.isMuted,\r\n isScreenSharingOn: call?.isScreenSharingOn,\r\n videoStream: {\r\n isAvailable: !!localVideoStream,\r\n isMirrored: localVideoStream?.view?.isMirrored,\r\n renderElement: localVideoStream?.view?.target\r\n }\r\n },\r\n remoteParticipants: videoGalleryRemoteParticipantsFromCall(call)\r\n };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallAgent } from '@azure/communication-calling';\r\nimport React, { createContext, useContext } from 'react';\r\n\r\nexport type CallAgentContextType = {\r\n callAgent: CallAgent | undefined;\r\n};\r\n\r\nexport const CallAgentContext = createContext<CallAgentContextType | undefined>(undefined);\r\n\r\nexport interface CallAgentProviderProps {\r\n children: React.ReactNode;\r\n callAgent?: CallAgent;\r\n}\r\n\r\nconst CallAgentProviderBase = (props: CallAgentProviderProps): JSX.Element => {\r\n const { callAgent } = props;\r\n\r\n const initialState: CallAgentContextType = {\r\n callAgent\r\n };\r\n\r\n return <CallAgentContext.Provider value={initialState}>{props.children}</CallAgentContext.Provider>;\r\n};\r\n\r\nexport const CallAgentProvider = (props: CallAgentProviderProps): JSX.Element => <CallAgentProviderBase {...props} />;\r\n\r\nexport const useCallAgent = (): CallAgent | undefined => useContext(CallAgentContext)?.callAgent;\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { StatefulCallClient, StatefulDeviceManager } from 'calling-stateful-client';\r\nimport React, { createContext, useContext, useEffect, useState } from 'react';\r\n\r\nexport type CallClientContextType = {\r\n callClient: StatefulCallClient;\r\n deviceManager: StatefulDeviceManager | undefined;\r\n};\r\n\r\nexport const CallClientContext = createContext<CallClientContextType | undefined>(undefined);\r\n\r\nexport interface CallClientProviderProps {\r\n children: React.ReactNode;\r\n callClient: StatefulCallClient;\r\n}\r\n\r\nconst CallClientProviderBase = (props: CallClientProviderProps): JSX.Element => {\r\n const { callClient } = props;\r\n\r\n const [deviceManager, setDeviceManager] = useState<StatefulDeviceManager | undefined>(undefined);\r\n\r\n /**\r\n * Initialize the DeviceManager inside CallClientState\r\n */\r\n useEffect(() => {\r\n callClient\r\n .getDeviceManager()\r\n .then((manager) => {\r\n manager.getCameras();\r\n manager.getMicrophones();\r\n manager.getSpeakers();\r\n setDeviceManager(manager as StatefulDeviceManager);\r\n })\r\n .catch((error) => {\r\n throw new Error(error);\r\n });\r\n }, [callClient]);\r\n\r\n const initialState: CallClientContextType = {\r\n callClient,\r\n deviceManager\r\n };\r\n\r\n return <CallClientContext.Provider value={initialState}>{props.children}</CallClientContext.Provider>;\r\n};\r\n\r\nexport const CallClientProvider = (props: CallClientProviderProps): JSX.Element => (\r\n <CallClientProviderBase {...props} />\r\n);\r\n\r\nexport const useCallClient = (): StatefulCallClient => {\r\n const context = useContext(CallClientContext);\r\n if (context === undefined) {\r\n throw new Error('CallClient Context is undefined');\r\n }\r\n return context.callClient;\r\n};\r\n\r\nexport const useDeviceManager = (): StatefulDeviceManager | undefined => {\r\n return useContext(CallClientContext)?.deviceManager;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useContext, createContext } from 'react';\r\nimport { Call } from '@azure/communication-calling';\r\n\r\nexport type CallContextType = {\r\n call: Call | undefined;\r\n};\r\n\r\nexport interface CallProviderProps {\r\n children: React.ReactNode;\r\n call?: Call;\r\n}\r\n\r\nexport const CallContext = createContext<CallContextType | undefined>(undefined);\r\n\r\nconst CallProviderBase = (props: CallProviderProps): JSX.Element => {\r\n const { children, call } = props;\r\n\r\n const initialState: CallContextType = {\r\n call\r\n };\r\n\r\n return <CallContext.Provider value={initialState}>{children}</CallContext.Provider>;\r\n};\r\n\r\nexport const CallProvider = (props: CallProviderProps): JSX.Element => <CallProviderBase {...props} />;\r\n\r\nexport const useCall = (): Call | undefined => {\r\n return useContext(CallContext)?.call;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const typingIndicatorContainerStyle = mergeStyles({\r\n height: '2.125rem',\r\n display: 'flex',\r\n alignItems: 'center'\r\n});\r\n\r\nexport const typingIndicatorListStyle = mergeStyles({\r\n fontWeight: 400,\r\n whiteSpace: 'nowrap',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n paddingRight: '0.1875rem'\r\n});\r\n\r\nexport const typingIndicatorVerbStyle = mergeStyles({\r\n fontWeight: 400,\r\n whiteSpace: 'nowrap',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n paddingRight: '0.1875rem'\r\n});\r\n\r\nexport const typingIndicatorPrefixImageStyle = mergeStyles({\r\n width: '2.125rem',\r\n height: '2.125rem',\r\n paddingRight: '0.1875rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n typingIndicatorContainerStyle,\r\n typingIndicatorListStyle,\r\n typingIndicatorVerbStyle\r\n} from './styles/TypingIndicator.styles';\r\n\r\nimport React from 'react';\r\nimport { BaseCustomStylesProps, CommunicationParticipant } from '../types';\r\nimport { IStyle, mergeStyles, Stack } from '@fluentui/react';\r\n\r\nexport interface TypingIndicatorStylesProps extends BaseCustomStylesProps {\r\n /** Styles for each typing user's displayName. */\r\n typingUserDisplayName?: IStyle;\r\n /** Styles for the typing string. */\r\n typingString?: IStyle;\r\n}\r\n\r\n/**\r\n * Props for TypingIndicator component\r\n */\r\nexport interface TypingIndicatorProps {\r\n /** List of the typing users. */\r\n typingUsers: CommunicationParticipant[];\r\n /** The string to render after listing all users' display name. For example ' are typing ...'. */\r\n typingString?: string;\r\n /** Callback to render typing users */\r\n onRenderUsers?: (users: CommunicationParticipant[]) => JSX.Element;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <TypingIndicator styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: TypingIndicatorStylesProps;\r\n}\r\n\r\nconst MAXIMUM_LENGTH_OF_TYPING_USERS = 35;\r\n\r\nconst getDefaultComponents = (\r\n typingUsers: CommunicationParticipant[],\r\n styles?: TypingIndicatorStylesProps\r\n): JSX.Element[] => {\r\n const displayComponents: JSX.Element[] = [];\r\n\r\n const typingUsersMentioned: CommunicationParticipant[] = [];\r\n let countOfUsersMentioned = 0;\r\n let totalCharacterCount = 0;\r\n\r\n for (const typingUser of typingUsers) {\r\n // The typing users above will be separated by ', '. We account for that additional length and with this length in\r\n // mind we generate the final string.\r\n const additionalCharCount =\r\n 2 * (countOfUsersMentioned - 1) + (typingUser.displayName ? typingUser.displayName.length : 0);\r\n if (totalCharacterCount + additionalCharCount <= MAXIMUM_LENGTH_OF_TYPING_USERS || countOfUsersMentioned === 1) {\r\n typingUsersMentioned.push(typingUser);\r\n totalCharacterCount += additionalCharCount;\r\n countOfUsersMentioned += 1;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n typingUsersMentioned.forEach((typingUser, index) => {\r\n displayComponents.push(\r\n <span\r\n className={mergeStyles(typingIndicatorListStyle, styles?.typingUserDisplayName)}\r\n key={`typing indicator display string ${index}`}\r\n >\r\n {index < typingUsers.length - 1 ? typingUser.displayName + ', ' : typingUser.displayName}\r\n </span>\r\n );\r\n });\r\n\r\n const countOfUsersNotMentioned = typingUsers.length - typingUsersMentioned.length;\r\n if (countOfUsersNotMentioned > 0) {\r\n displayComponents.push(\r\n <span className={mergeStyles(typingIndicatorVerbStyle, styles?.typingString)} key={'UsersCountKey'}>\r\n {` and ${countOfUsersNotMentioned} other${countOfUsersNotMentioned === 1 ? '' : 's'}`}\r\n </span>\r\n );\r\n }\r\n\r\n return displayComponents;\r\n};\r\n\r\nconst defaultTypingString = (typingUsers: CommunicationParticipant[]): string => {\r\n return typingUsers.length > 0 ? (typingUsers.length > 1 ? ' are typing...' : ' is typing...') : '';\r\n};\r\n\r\n/**\r\n * Typing Indicator is used to notify users if there are any other users typing in the thread.\r\n */\r\nexport const TypingIndicator = (props: TypingIndicatorProps): JSX.Element => {\r\n const { typingUsers, typingString, onRenderUsers, styles } = props;\r\n\r\n const typingUsersToRender = onRenderUsers\r\n ? typingUsers\r\n : typingUsers.filter((typingUser) => typingUser.displayName !== undefined);\r\n\r\n return (\r\n <Stack horizontal className={mergeStyles(typingIndicatorContainerStyle, styles?.root)}>\r\n {onRenderUsers ? onRenderUsers(typingUsersToRender) : getDefaultComponents(typingUsersToRender, styles)}\r\n <span className={mergeStyles(typingIndicatorVerbStyle, styles?.typingString)} key={'TypingStringKey'}>\r\n {typingString ?? defaultTypingString(typingUsersToRender)}\r\n </span>\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const gridLayoutStyle = mergeStyles({\r\n height: '100%',\r\n display: 'grid',\r\n flexGrow: '1',\r\n gap: '.5rem',\r\n padding: '.5rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\nimport React, { useState } from 'react';\r\nimport { BaseCustomStylesProps } from '../types';\r\nimport { gridLayoutStyle } from './styles/GridLayout.styles';\r\n\r\nexport type GridLayoutType = 'standard';\r\n\r\nexport interface GridLayoutProps {\r\n children: React.ReactNode;\r\n layout?: GridLayoutType;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <GridLayout styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: BaseCustomStylesProps;\r\n}\r\n\r\nconst calculateStandardLayoutRows = (numberOfItems: number, gridCol: number): number =>\r\n Math.ceil(numberOfItems / gridCol);\r\n\r\nconst calculateStandardLayoutColumns = (numberOfItems: number): number =>\r\n numberOfItems > 0 ? Math.ceil(Math.sqrt(numberOfItems)) : 1;\r\n\r\nexport const GridLayout = (props: GridLayoutProps): JSX.Element => {\r\n const [gridCol, setGridCol] = useState(1);\r\n const [gridRow, setGridRow] = useState(1);\r\n\r\n const { children, layout = 'standard', styles } = props;\r\n const numberOfChildren = React.Children.count(children);\r\n\r\n switch (layout) {\r\n case 'standard': {\r\n const numberOfColumns = calculateStandardLayoutColumns(numberOfChildren);\r\n if (gridCol !== numberOfColumns) setGridCol(numberOfColumns);\r\n const numberOfRows = calculateStandardLayoutRows(numberOfChildren, gridCol);\r\n if (gridRow !== numberOfRows) setGridRow(numberOfRows);\r\n break;\r\n }\r\n }\r\n\r\n return (\r\n <div\r\n className={mergeStyles(gridLayoutStyle, styles?.root)}\r\n style={{\r\n gridTemplateRows: `repeat(${gridRow}, minmax(0, 1fr))`,\r\n gridTemplateColumns: `repeat(${gridCol}, 1fr)`\r\n }}\r\n >\r\n {children}\r\n </div>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { getTheme, mergeStyles } from '@fluentui/react';\r\n\r\nconst palette = getTheme().palette;\r\n\r\nexport const TextFieldStyleProps = {\r\n root: {\r\n width: '100%',\r\n minHeight: '0px',\r\n fontSize: '8.25rem'\r\n },\r\n wrapper: {},\r\n fieldGroup: {\r\n height: 'auto',\r\n minHeight: '0px'\r\n }\r\n};\r\n\r\nexport const sendBoxWrapperStyle = mergeStyles({\r\n padding: '0.0625rem'\r\n});\r\n\r\nexport const suppressIconStyle = {\r\n iconContainer: { minHeight: '0', minWidth: '0', height: '0', width: '0', margin: '0' },\r\n icon: { display: 'none' }\r\n};\r\n\r\nexport const sendBoxStyle = mergeStyles({\r\n minHeight: '0',\r\n maxHeight: '8.25rem',\r\n outline: 'red 5px',\r\n fontWeight: 400,\r\n fontSize: '0.875rem',\r\n width: '100%',\r\n height: '2.25rem',\r\n lineHeight: '1.5rem',\r\n '::-webkit-input-placeholder': {\r\n fontSize: '0.875rem'\r\n },\r\n '::-moz-placeholder': {\r\n fontSize: '0.875rem'\r\n },\r\n ':-moz-placeholder': {\r\n fontSize: '0.875rem'\r\n }\r\n});\r\n\r\nexport const sendButtonStyle = mergeStyles({\r\n width: '2.25rem',\r\n color: 'grey',\r\n paddingLeft: '0.5rem',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n justifyContent: 'center',\r\n alignItems: 'center'\r\n});\r\n\r\nexport const sendIconDiv = mergeStyles({\r\n width: '1.0625rem',\r\n height: '1.0625rem',\r\n '#sendIconWrapper:hover &': {\r\n color: palette.themePrimary\r\n }\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useState } from 'react';\r\nimport {\r\n IStyle,\r\n ITextField,\r\n mergeStyles,\r\n Stack,\r\n TextField,\r\n MessageBar,\r\n MessageBarType,\r\n concatStyleSets\r\n} from '@fluentui/react';\r\nimport { SendIcon } from '@fluentui/react-northstar';\r\nimport {\r\n TextFieldStyleProps,\r\n sendBoxStyle,\r\n sendBoxWrapperStyle,\r\n sendButtonStyle,\r\n sendIconDiv,\r\n suppressIconStyle\r\n} from './styles/SendBox.styles';\r\nimport { BaseCustomStylesProps } from '../types';\r\n\r\nconst EMPTY_MESSAGE_REGEX = /^\\s*$/;\r\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\r\nconst TEXT_EXCEEDS_LIMIT = `Your message is over the limit of ${MAXIMUM_LENGTH_OF_MESSAGE} characters`;\r\n\r\nexport interface SendBoxStylesProps extends BaseCustomStylesProps {\r\n /** Styles for the text field. */\r\n textField?: IStyle;\r\n /** Styles for the container of the send message icon. */\r\n sendMessageIconContainer?: IStyle;\r\n /** Styles for the send message icon; These styles will be ignored when a custom send message icon is provided. */\r\n sendMessageIcon?: IStyle;\r\n /** Styles for the system message; These styles will be ignored when a custom system message component is provided. */\r\n systemMessage?: IStyle;\r\n}\r\n\r\n/**\r\n * Props for SendBox component\r\n */\r\nexport interface SendBoxProps {\r\n /**\r\n * Optional boolean to disable text box\r\n * @defaultValue false\r\n */\r\n disabled?: boolean;\r\n /**\r\n * Optional text for system message below text box\r\n */\r\n systemMessage?: string;\r\n /**\r\n * Optional callback called when message is sent\r\n */\r\n onSendMessage?: (content: string) => Promise<void>;\r\n /**\r\n * Optional callback called when user is typing\r\n */\r\n onTyping?: () => Promise<void>;\r\n /**\r\n * Optional callback to render system message below the SendBox.\r\n * @defaultValue MessageBar\r\n */\r\n onRenderSystemMessage?: (systemMessage: string | undefined) => React.ReactElement;\r\n /**\r\n * Optional boolean to support new line in SendBox.\r\n * @defaultValue false\r\n */\r\n supportNewline?: boolean;\r\n /**\r\n * Optional callback to render send button icon to the right of the SendBox.\r\n * @defaultValue SendIcon\r\n */\r\n onRenderIcon?: (props: SendBoxProps, isMouseOverSendIcon: boolean) => JSX.Element | null;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <SendBox styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: SendBoxStylesProps;\r\n}\r\n\r\nconst defaultOnRenderSystemMessage = (\r\n systemMessage: string | undefined,\r\n style: IStyle | undefined\r\n): JSX.Element | undefined =>\r\n systemMessage ? (\r\n <MessageBar messageBarType={MessageBarType.info} styles={concatStyleSets(suppressIconStyle, { root: style })}>\r\n {systemMessage}\r\n </MessageBar>\r\n ) : undefined;\r\n\r\n/**\r\n * `SendBox` is a component for users to send messages and typing notifications. An optional message\r\n * can also be shown below the `SendBox`.\r\n */\r\nexport const SendBox = (props: SendBoxProps): JSX.Element => {\r\n const { disabled, systemMessage, supportNewline, onSendMessage, onTyping, onRenderIcon, styles } = props;\r\n\r\n const [textValue, setTextValue] = useState('');\r\n const [textValueOverflow, setTextValueOverflow] = useState(false);\r\n const [isMouseOverSendIcon, setIsMouseOverSendIcon] = useState(false);\r\n\r\n const sendTextFieldRef = React.useRef<ITextField>(null);\r\n\r\n const onRenderSystemMessage = props.onRenderSystemMessage ?? defaultOnRenderSystemMessage;\r\n\r\n const sendMessageOnClick = (): void => {\r\n // don't send a message when disabled\r\n if (disabled || textValueOverflow) {\r\n return;\r\n }\r\n // we dont want to send empty messages including spaces, newlines, tabs\r\n if (!EMPTY_MESSAGE_REGEX.test(textValue)) {\r\n onSendMessage && onSendMessage(textValue);\r\n setTextValue('');\r\n }\r\n sendTextFieldRef.current?.focus();\r\n };\r\n const setText = (e: any): void => {\r\n if (e.target.value.length > MAXIMUM_LENGTH_OF_MESSAGE) {\r\n setTextValueOverflow(true);\r\n } else {\r\n setTextValueOverflow(false);\r\n }\r\n setTextValue(e.target.value);\r\n };\r\n\r\n const textTooLongMessage = textValueOverflow ? TEXT_EXCEEDS_LIMIT : undefined;\r\n\r\n return (\r\n <Stack className={mergeStyles(sendBoxWrapperStyle, styles?.root)}>\r\n <Stack horizontal={true}>\r\n <TextField\r\n multiline\r\n autoAdjustHeight\r\n multiple={false}\r\n resizable={false}\r\n componentRef={sendTextFieldRef}\r\n id=\"sendbox\"\r\n ariaLabel={'Type'}\r\n inputClassName={sendBoxStyle}\r\n placeholder=\"Type a new message\"\r\n value={textValue}\r\n onChange={setText}\r\n autoComplete=\"off\"\r\n onKeyDown={(ev) => {\r\n if (ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline) && !textValueOverflow) {\r\n ev.preventDefault();\r\n sendMessageOnClick();\r\n }\r\n onTyping && onTyping();\r\n }}\r\n styles={concatStyleSets(TextFieldStyleProps, { fieldGroup: styles?.textField })}\r\n />\r\n\r\n <div\r\n className={mergeStyles(sendButtonStyle, styles?.sendMessageIconContainer)}\r\n onClick={(e) => {\r\n if (!textValueOverflow) {\r\n sendMessageOnClick();\r\n }\r\n e.stopPropagation();\r\n }}\r\n id={'sendIconWrapper'}\r\n onMouseEnter={() => {\r\n setIsMouseOverSendIcon(true);\r\n }}\r\n onMouseLeave={() => {\r\n setIsMouseOverSendIcon(false);\r\n }}\r\n >\r\n {onRenderIcon ? (\r\n onRenderIcon(props, isMouseOverSendIcon)\r\n ) : (\r\n <SendIcon className={mergeStyles(sendIconDiv, styles?.sendMessageIcon)} outline={!isMouseOverSendIcon} />\r\n )}\r\n </div>\r\n </Stack>\r\n {onRenderSystemMessage(systemMessage ? systemMessage : textTooLongMessage, styles?.systemMessage)}\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { getTheme, mergeStyles } from '@fluentui/react';\r\n\r\nconst palette = getTheme().palette;\r\n\r\n// ErrorIcon seems designed slightly smaller than other icons we try to match the size and then fix positioning here\r\nexport const MessageStatusIndicatorErrorIconStyle = mergeStyles({\r\n marginRight: '-0.06rem',\r\n fontSize: '1.06rem',\r\n color: palette.redDark\r\n});\r\n\r\nexport const MessageStatusIndicatorIconStyle = mergeStyles({\r\n fontSize: '1rem',\r\n color: palette.blue\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { mergeStyles, TooltipHost } from '@fluentui/react';\r\nimport { MessageStatus } from 'acs-ui-common';\r\nimport { SizeValue } from '@fluentui/react-northstar';\r\nimport {\r\n MessageStatusIndicatorErrorIconStyle,\r\n MessageStatusIndicatorIconStyle\r\n} from './styles/MessageStatusIndicator.styles';\r\nimport { CircleRingIcon, CompletedIcon, ErrorIcon } from '@fluentui/react-icons';\r\nimport { MessageSeenIcon } from '@fluentui/react-icons-northstar';\r\nimport { BaseCustomStylesProps } from '../types';\r\n\r\n/**\r\n * Props for MessageStatusIndicator component\r\n */\r\nexport interface MessageStatusIndicatorProps {\r\n /** Message status that determines the icon to display. */\r\n status?: MessageStatus;\r\n /** Text to display in the delivered message icon tooltip. */\r\n deliveredTooltipText?: string;\r\n /** Text to display in the seen message icon tooltip. */\r\n seenTooltipText?: string;\r\n /** Text to display in the sending message icon tooltip. */\r\n sendingTooltipText?: string;\r\n /** Text to display in the failed message icon tooltip. */\r\n failedToSendTooltipText?: string;\r\n /** Size of the message status icon. */\r\n size?: SizeValue;\r\n /**\r\n * Allows users to pass an object containing custom CSS styles.\r\n * @Example\r\n * ```\r\n * <MessageStatus styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: BaseCustomStylesProps;\r\n}\r\n\r\n/**\r\n * MessageStatusIndicator component.\r\n */\r\nexport const MessageStatusIndicator = (props: MessageStatusIndicatorProps): JSX.Element => {\r\n const {\r\n status,\r\n deliveredTooltipText = 'Sent',\r\n seenTooltipText = 'Seen',\r\n sendingTooltipText = 'Sending',\r\n failedToSendTooltipText = 'Failed to send',\r\n size = 'medium',\r\n styles\r\n } = props;\r\n\r\n switch (status) {\r\n case 'failed':\r\n return (\r\n <TooltipHost content={failedToSendTooltipText}>\r\n <ErrorIcon className={mergeStyles(MessageStatusIndicatorErrorIconStyle, styles?.root)} />\r\n </TooltipHost>\r\n );\r\n case 'sending':\r\n return (\r\n <TooltipHost content={sendingTooltipText}>\r\n <CircleRingIcon className={mergeStyles(MessageStatusIndicatorIconStyle, styles?.root)} />\r\n </TooltipHost>\r\n );\r\n case 'seen':\r\n // MessageSeenIcon is only one that takes in size because its a react-northstar-icon. There doesn't seem to be a\r\n // equivalent one in react-icons and react-icons don't seem to have size property.\r\n return (\r\n <TooltipHost content={seenTooltipText}>\r\n <MessageSeenIcon size={size} className={mergeStyles(styles?.root)} />\r\n </TooltipHost>\r\n );\r\n case 'delivered':\r\n return (\r\n <TooltipHost content={deliveredTooltipText}>\r\n <CompletedIcon className={mergeStyles(MessageStatusIndicatorIconStyle, styles?.root)} />\r\n </TooltipHost>\r\n );\r\n default:\r\n return <></>;\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CSSProperties } from 'react';\r\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const messageAvatarContainerStyle = (backgroundColor: string): string =>\r\n mergeStyles({\r\n width: '2rem',\r\n minWidth: '2rem',\r\n height: '2rem',\r\n backgroundColor: backgroundColor,\r\n borderRadius: '50%',\r\n alignItems: 'center',\r\n display: 'flex',\r\n justifyContent: 'center',\r\n fontFamily: 'Segoe UI Regular',\r\n fontSize: '1rem' // 16px\r\n });\r\n\r\nexport const messageThreadContainerStyle = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n maxHeight: '100%',\r\n overflow: 'auto',\r\n position: 'relative'\r\n});\r\n\r\nexport const noMessageStatusStyle = mergeStyles({\r\n width: '1rem'\r\n});\r\n\r\nexport const chatStyle: ComponentSlotStyle = {\r\n paddingBottom: '0.5rem',\r\n border: 'none',\r\n overflow: 'auto'\r\n};\r\n\r\nexport const newMessageButtonContainerStyle = mergeStyles({\r\n position: 'absolute',\r\n zIndex: 1,\r\n bottom: 0,\r\n right: '1.5rem'\r\n});\r\n\r\nexport const chatMessageStyle: CSSProperties = {\r\n overflowY: 'hidden'\r\n};\r\n\r\nexport const messageStatusContainerStyle = (mine: boolean): string =>\r\n mergeStyles({\r\n marginLeft: mine ? '1rem' : '0rem'\r\n });\r\n\r\nexport const newMessageButtonStyle = mergeStyles({\r\n float: 'right',\r\n width: 'fit-content'\r\n});\r\n\r\nexport const loadPreviousMessageButtonStyle = mergeStyles({\r\n border: 'none',\r\n minHeight: '1.5rem',\r\n selectors: {\r\n '&:hover': { background: 'none' },\r\n '&:active': { background: 'none' }\r\n }\r\n});\r\n\r\nexport const DownIconStyle = mergeStyles({\r\n marginRight: '0.5em'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nconst weekDayToDayName = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\r\n\r\nexport const formatTimeForChatMessage = (messageDate: Date): string => {\r\n let hours = messageDate.getHours();\r\n let minutes = messageDate.getMinutes().toString();\r\n const isAm = hours < 12;\r\n if (hours > 12) {\r\n hours = hours - 12;\r\n }\r\n if (hours === 0) {\r\n hours = 12;\r\n }\r\n if (minutes.length < 2) {\r\n minutes = '0' + minutes;\r\n }\r\n return hours.toString() + ':' + minutes + ' ' + (isAm ? 'a.m.' : 'p.m.');\r\n};\r\n\r\nexport const formatDateForChatMessage = (messageDate: Date): string => {\r\n const year = messageDate.getFullYear().toString();\r\n let month = (messageDate.getMonth() + 1).toString();\r\n let day = messageDate.getDate().toString();\r\n\r\n if (month.length === 1) {\r\n month = '0' + month;\r\n }\r\n if (day.length === 1) {\r\n day = '0' + day;\r\n }\r\n\r\n return year + '-' + month + '-' + day;\r\n};\r\n\r\n/**\r\n * Given a message date object in ISO8601 and a current date object, generates a user friendly timestamp text like the\r\n * following:\r\n *\r\n * 1:30 p.m.\r\n * Yesterday 1:30 p.m.\r\n * Monday 1:30 p.m.\r\n * 2021-01-10 1:30 p.m.\r\n *\r\n * If message is after yesterday, then only show the time.\r\n * If message is before yesteray and after day before yesterday, then show 'Yesterday' plus the time.\r\n * If message is before day before yesterday and within the current week, then show 'Monday/Tuesday/etc' plus the time.\r\n * - We consider start of the week as Sunday. If current day is Sunday, then any time before that is in previous week.\r\n * If message is in previous or older weeks, then show date string plus the time.\r\n *\r\n * @param messageDate - date of message\r\n * @param currentDate - date used as offset to create the user friendly timestamp (e.g. to create 'Yesterday' instead of an absolute date)\r\n */\r\nexport const formatTimestampForChatMessage = (messageDate: Date, todayDate: Date): string => {\r\n // If message was in the same day timestamp string is just the time like '1:30 p.m.'.\r\n const startOfDay = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate());\r\n if (messageDate > startOfDay) {\r\n return formatTimeForChatMessage(messageDate);\r\n }\r\n\r\n // If message was yesterday then timestamp string is like this 'Yesterday 1:30 p.m.'.\r\n const yesterdayDate = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate() - 1);\r\n if (messageDate > yesterdayDate) {\r\n return 'Yesterday ' + formatTimeForChatMessage(messageDate);\r\n }\r\n\r\n // If message was before Sunday and today is Sunday (start of week) then timestamp string is like\r\n // '2021-01-10 1:30 p.m.'.\r\n const weekDay = todayDate.getDay();\r\n if (weekDay === 0) {\r\n return formatDateForChatMessage(messageDate) + ' ' + formatTimeForChatMessage(messageDate);\r\n }\r\n\r\n // If message was before first day of the week then timestamp string is like Monday 1:30 p.m.\r\n const firstDayOfTheWeekDate = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate() - weekDay);\r\n if (messageDate > firstDayOfTheWeekDate) {\r\n return weekDayToDayName[messageDate.getDay()] + ' ' + formatTimeForChatMessage(messageDate);\r\n }\r\n\r\n // If message date is in previous or older weeks then timestamp string is like 2021-01-10 1:30 p.m.\r\n return formatDateForChatMessage(messageDate) + ' ' + formatTimeForChatMessage(messageDate);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nexport const delay = (delay: number): Promise<void> => {\r\n return new Promise(function (resolve) {\r\n setTimeout(resolve, delay);\r\n });\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const systemMessageIconStyle = mergeStyles({\r\n margin: '0 0.688rem 0 0'\r\n});\r\n\r\nexport const systemMessageContentStyle = mergeStyles({\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n whiteSpace: 'nowrap'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStyle, FontIcon, mergeStyles, Stack } from '@fluentui/react';\r\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\r\nimport React from 'react';\r\nimport { systemMessageContentStyle, systemMessageIconStyle } from './styles/SystemMessage.styles';\r\n\r\n// Todo: We need to add more types of system messages that we support.\r\nexport type SystemMessageIconTypes = 'PeopleAdd' | 'PeopleBlock' | 'Edit';\r\n\r\nexport type SystemMessageProps = {\r\n /**\r\n * Icon name for the system message. iconName should match the iconName in fluentUI icon.\r\n */\r\n iconName: SystemMessageIconTypes;\r\n /**\r\n * Content string for the system message.\r\n */\r\n content: string;\r\n /*\r\n * Custom CSS Style for the system message container.\r\n */\r\n containerStyle?: ComponentSlotStyle;\r\n};\r\n\r\nexport const SystemMessage = (props: SystemMessageProps): JSX.Element => {\r\n const { iconName, content } = props;\r\n const Icon: JSX.Element = <FontIcon iconName={iconName} className={mergeStyles(systemMessageIconStyle)} />;\r\n\r\n return (\r\n <Stack horizontal className={mergeStyles(props?.containerStyle as IStyle)}>\r\n {Icon}\r\n <span className={mergeStyles(systemMessageContentStyle)}>{content}</span>\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport Linkify from 'react-linkify';\r\nimport { Chat, ChatItemProps, Flex, Ref, ShorthandValue } from '@fluentui/react-northstar';\r\nimport {\r\n DownIconStyle,\r\n newMessageButtonContainerStyle,\r\n messageThreadContainerStyle,\r\n chatMessageStyle,\r\n chatStyle,\r\n newMessageButtonStyle,\r\n messageStatusContainerStyle,\r\n noMessageStatusStyle\r\n} from './styles/MessageThread.styles';\r\nimport { Icon, IStyle, mergeStyles, Persona, PersonaSize, PrimaryButton, Stack, Link } from '@fluentui/react';\r\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\r\nimport { LiveAnnouncer, LiveMessage } from 'react-aria-live';\r\nimport { formatTimestampForChatMessage } from './utils/Datetime';\r\nimport { delay } from './utils/delay';\r\nimport {\r\n BaseCustomStylesProps,\r\n ChatMessage,\r\n CustomMessage,\r\n SystemMessage,\r\n ChatMessagePayload,\r\n SystemMessagePayload\r\n} from '../types';\r\nimport { MessageStatusIndicator, MessageStatusIndicatorProps } from './MessageStatusIndicator';\r\nimport { memoizeFnAll, MessageStatus } from 'acs-ui-common';\r\nimport { SystemMessage as SystemMessageComponent, SystemMessageIconTypes } from './SystemMessage';\r\nimport { Parser } from 'html-to-react';\r\n\r\nconst NEW_MESSAGES = 'New Messages';\r\n\r\nconst isMessageSame = (first: ChatMessagePayload, second: ChatMessagePayload): boolean => {\r\n return (\r\n first.messageId === second.messageId &&\r\n first.content === second.content &&\r\n first.type === second.type &&\r\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\r\n first.senderId === second.senderId &&\r\n first.senderDisplayName === second.senderDisplayName &&\r\n first.status === second.status\r\n );\r\n};\r\n\r\n/**\r\n * Get the latest message from the message array.\r\n *\r\n * @param messages\r\n */\r\nconst getLatestChatMessage = (\r\n messages: (ChatMessage | SystemMessage | CustomMessage)[]\r\n): ChatMessagePayload | undefined => {\r\n let latestChatMessage: ChatMessagePayload | undefined = undefined;\r\n for (let i = messages.length - 1; i >= 0; i--) {\r\n const message = messages[i];\r\n if (message.type === 'chat') {\r\n const payload: ChatMessagePayload = message.payload;\r\n if (payload.createdOn !== undefined) {\r\n latestChatMessage = payload;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return latestChatMessage;\r\n};\r\n\r\n/**\r\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\r\n * current user.\r\n *\r\n * @param latestMessageFromPreviousMessages\r\n * @param latestMessageFromNewMessages\r\n * @param userId\r\n */\r\nconst isThereNewMessageNotFromCurrentUser = (\r\n latestMessageFromPreviousMessages: ChatMessagePayload | undefined,\r\n latestMessageFromNewMessages: ChatMessagePayload | undefined,\r\n userId: string\r\n): boolean => {\r\n if (latestMessageFromNewMessages === undefined) {\r\n return false;\r\n } else {\r\n if (latestMessageFromPreviousMessages === undefined) {\r\n return latestMessageFromNewMessages.senderId !== userId;\r\n } else {\r\n return (\r\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\r\n latestMessageFromNewMessages.senderId !== userId\r\n );\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\r\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\r\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\r\n * updated this component due to current user sending a message we want to then call scrollToBottom.\r\n *\r\n * @param latestMessageFromPreviousMessages\r\n * @param latestMessageFromNewMessages\r\n */\r\nconst didUserSendTheLatestMessage = (\r\n latestMessageFromPreviousMessages: ChatMessagePayload | undefined,\r\n latestMessageFromNewMessages: ChatMessagePayload | undefined,\r\n userId: string\r\n): boolean => {\r\n if (latestMessageFromNewMessages === undefined) {\r\n return false;\r\n } else {\r\n if (latestMessageFromPreviousMessages === undefined) {\r\n return latestMessageFromNewMessages.senderId === userId;\r\n } else {\r\n return (\r\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\r\n latestMessageFromNewMessages.senderId === userId\r\n );\r\n }\r\n }\r\n};\r\n\r\nexport interface MessageThreadStylesProps extends BaseCustomStylesProps {\r\n /** Styles for load previous messages container. */\r\n loadPreviousMessagesButtonContainer?: IStyle;\r\n /** Styles for new message container. */\r\n newMessageButtonContainer?: IStyle;\r\n /** Styles for chat container. */\r\n chatContainer?: ComponentSlotStyle;\r\n /** Styles for chat message container. */\r\n chatMessageContainer?: ComponentSlotStyle;\r\n /** Styles for system message container. */\r\n systemMessageContainer?: ComponentSlotStyle;\r\n /** Styles for message status indicator container. */\r\n messageStatusContainer?: (mine: boolean) => IStyle;\r\n}\r\n\r\nexport interface JumpToNewMessageButtonProps {\r\n onClick: () => void;\r\n}\r\n\r\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\r\n const { onClick } = props;\r\n return (\r\n <PrimaryButton className={newMessageButtonStyle} onClick={onClick}>\r\n <Icon iconName=\"Down\" className={DownIconStyle} />\r\n {NEW_MESSAGES}\r\n </PrimaryButton>\r\n );\r\n};\r\n\r\nexport type DefaultMessageRendererType = (props: MessageProps) => JSX.Element;\r\n\r\nconst DefaultSystemMessageRenderer: DefaultMessageRendererType = (props: MessageProps) => {\r\n if (props.message.type === 'system') {\r\n const payload: SystemMessagePayload = props.message.payload;\r\n return (\r\n <SystemMessageComponent\r\n iconName={(payload.iconName ?? '') as SystemMessageIconTypes}\r\n content={payload.content ?? ''}\r\n containerStyle={props?.messageContainerStyle}\r\n />\r\n );\r\n }\r\n\r\n return <></>;\r\n};\r\n\r\n// https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript\r\nfunction extractContent(s): string {\r\n const span = document.createElement('span');\r\n span.innerHTML = s;\r\n return span.textContent || span.innerText;\r\n}\r\n\r\nconst generateRichTextHTMLMessageContent = (payload: ChatMessagePayload): JSX.Element => {\r\n const htmlToReactParser = new Parser();\r\n const liveAuthor = `${payload.senderDisplayName} says `;\r\n return (\r\n <div>\r\n <LiveMessage\r\n message={`${payload.mine ? '' : liveAuthor} ${extractContent(payload.content)}`}\r\n aria-live=\"polite\"\r\n />\r\n {htmlToReactParser.parse(payload.content)}\r\n </div>\r\n );\r\n};\r\n\r\nconst generateTextMessageContent = (payload: ChatMessagePayload): JSX.Element => {\r\n const liveAuthor = `${payload.senderDisplayName} says `;\r\n return (\r\n <div>\r\n <LiveMessage message={`${payload.mine ? '' : liveAuthor} ${payload.content}`} aria-live=\"polite\" />\r\n <Linkify\r\n componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\r\n return (\r\n <Link href={decoratedHref} key={key}>\r\n {decoratedText}\r\n </Link>\r\n );\r\n }}\r\n >\r\n {payload.content}\r\n </Linkify>\r\n </div>\r\n );\r\n};\r\n\r\nconst generateMessageContent = (payload: ChatMessagePayload) => {\r\n switch (payload.type) {\r\n case 'text':\r\n return generateTextMessageContent(payload);\r\n case 'html':\r\n return generateRichTextHTMLMessageContent(payload);\r\n case 'richtext/html':\r\n return generateRichTextHTMLMessageContent(payload);\r\n default:\r\n console.warn('unknown message content type');\r\n return <></>;\r\n }\r\n};\r\n\r\nconst DefaultChatMessageRenderer: DefaultMessageRendererType = (props: MessageProps) => {\r\n if (props.message.type === 'chat') {\r\n const payload: ChatMessagePayload = props.message.payload;\r\n const messageContentItem = generateMessageContent(payload);\r\n return (\r\n <Chat.Message\r\n className={mergeStyles(chatMessageStyle as IStyle, props.messageContainerStyle as IStyle)}\r\n content={messageContentItem}\r\n author={payload.senderDisplayName}\r\n mine={payload.mine}\r\n timestamp={payload.createdOn ? formatTimestampForChatMessage(payload.createdOn, new Date()) : undefined}\r\n />\r\n );\r\n }\r\n\r\n return <></>;\r\n};\r\n\r\nconst memoizeAllMessages = memoizeFnAll(\r\n (\r\n _messageKey: string,\r\n message: ChatMessage | SystemMessage | CustomMessage,\r\n showMessageStatus: boolean,\r\n onRenderAvatar: ((userId: string) => JSX.Element) | undefined,\r\n styles: MessageThreadStylesProps | undefined,\r\n onRenderMessageStatus:\r\n | ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null)\r\n | undefined,\r\n defaultChatMessageRenderer: (message: MessageProps) => JSX.Element,\r\n _attached?: boolean | string,\r\n statusToRender?: MessageStatus,\r\n onRenderMessage?: (message: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element\r\n ): ShorthandValue<ChatItemProps> => {\r\n const messageProps: MessageProps = {\r\n message: message\r\n };\r\n\r\n if (message.type === 'chat') {\r\n const payload: ChatMessagePayload = message.payload;\r\n messageProps.messageContainerStyle = styles?.chatMessageContainer;\r\n\r\n const chatMessageComponent =\r\n onRenderMessage === undefined\r\n ? defaultChatMessageRenderer(messageProps)\r\n : onRenderMessage(messageProps, DefaultChatMessageRenderer);\r\n\r\n return {\r\n gutter: payload.mine ? (\r\n ''\r\n ) : onRenderAvatar ? (\r\n onRenderAvatar(payload.senderId ?? '')\r\n ) : (\r\n <Persona text={payload.senderDisplayName} hidePersonaDetails={true} size={PersonaSize.size32} />\r\n ),\r\n contentPosition: payload.mine ? 'end' : 'start',\r\n message: (\r\n <Flex vAlign=\"end\">\r\n {chatMessageComponent}\r\n <div\r\n className={mergeStyles(\r\n messageStatusContainerStyle(payload.mine ?? false),\r\n styles?.messageStatusContainer ? styles.messageStatusContainer(payload.mine ?? false) : ''\r\n )}\r\n >\r\n {showMessageStatus && statusToRender ? (\r\n onRenderMessageStatus ? (\r\n onRenderMessageStatus({ status: statusToRender })\r\n ) : (\r\n MessageStatusIndicator({ status: statusToRender })\r\n )\r\n ) : (\r\n <div className={mergeStyles(noMessageStatusStyle)} />\r\n )}\r\n </div>\r\n </Flex>\r\n ),\r\n attached: payload.attached,\r\n key: _messageKey\r\n };\r\n } else if (message.type === 'system') {\r\n messageProps.messageContainerStyle = styles?.systemMessageContainer;\r\n\r\n const systemMessageComponent =\r\n onRenderMessage === undefined\r\n ? DefaultSystemMessageRenderer(messageProps)\r\n : onRenderMessage(messageProps, DefaultSystemMessageRenderer);\r\n\r\n return {\r\n children: systemMessageComponent,\r\n key: _messageKey\r\n };\r\n } else {\r\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\r\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage(messageProps);\r\n return {\r\n children: customMessageComponent,\r\n key: _messageKey\r\n };\r\n }\r\n }\r\n);\r\n\r\nconst getLastChatMessageIdWithStatus = (\r\n messages: (ChatMessage | SystemMessage | CustomMessage)[],\r\n status: MessageStatus\r\n): string | undefined => {\r\n for (let i = messages.length - 1; i >= 0; i--) {\r\n const message = messages[i];\r\n if (message.type === 'chat' && message.payload.status === status && message.payload.mine) {\r\n return message.payload.messageId;\r\n }\r\n }\r\n return undefined;\r\n};\r\n\r\n/**\r\n * Props for MessageThread component\r\n */\r\nexport type MessageThreadProps = {\r\n /**\r\n * UserId of the current user.\r\n */\r\n userId: string;\r\n /**\r\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage` or `CustomMessage`.\r\n */\r\n messages: (ChatMessage | SystemMessage | CustomMessage)[];\r\n /**\r\n * Allows users to pass an object containing custom CSS styles.\r\n * @Example\r\n * ```\r\n * <MessageThread styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: MessageThreadStylesProps;\r\n /**\r\n * Whether the new message button is disabled or not.\r\n *\r\n * @defaultValue `false`\r\n */\r\n disableJumpToNewMessageButton?: boolean;\r\n /**\r\n * Whether the status indicator for each message is displayed or not.\r\n *\r\n * @defaultValue `false`\r\n */\r\n showMessageStatus?: boolean;\r\n /**\r\n * Number of chat messaegs to reload each time onLoadPreviousChatMessages is called.\r\n *\r\n * @defaultValue 0\r\n */\r\n numberOfChatMessagesToReload?: number;\r\n /**\r\n * Optional callback to override actions on message being seen.\r\n *\r\n * @param messageId - message Id\r\n */\r\n onMessageSeen?: (messageId: string) => Promise<void>;\r\n /**\r\n * Optional callback to override render of the message status indicator.\r\n *\r\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\r\n */\r\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\r\n /**\r\n * Optional callback to override render of the avatar.\r\n *\r\n * @param userId - user Id\r\n */\r\n onRenderAvatar?: (userId: string) => JSX.Element;\r\n /**\r\n * Optional callback to override render of the button for jumping to the new message.\r\n *\r\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps\r\n */\r\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\r\n /**\r\n * Optional callback to override loading of previous messages.\r\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\r\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\r\n */\r\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\r\n /**\r\n * Optional callback to override render of a message.\r\n *\r\n * @param messageProps - props of type MessageProps\r\n * @param defaultOnRender - default render of type DefaultMessageRendererType\r\n *\r\n * @remarks\r\n * `defaultOnRender` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\r\n */\r\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element;\r\n};\r\n\r\n/**\r\n * Props for MessageThread component\r\n */\r\nexport type MessageProps = {\r\n /**\r\n * Message to render. It can type `ChatMessage` or `SystemMessage` or `CustomMessage`.\r\n */\r\n message: ChatMessage | SystemMessage | CustomMessage;\r\n /**\r\n * Custom CSS styles for chat message container.\r\n */\r\n messageContainerStyle?: ComponentSlotStyle;\r\n};\r\n\r\n/**\r\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\r\n * @param props - of type MessageThreadProps\r\n *\r\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\r\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\r\n *\r\n * `MessageThread` internally uses the `Chat` & `Chat.Message` component from `@fluentui/react-northstar`. You can checkout the details about these [two components](https://fluentsite.z22.web.core.windows.net/0.53.0/components/chat/props).\r\n */\r\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\r\n const {\r\n messages: newMessages,\r\n userId,\r\n styles,\r\n disableJumpToNewMessageButton = false,\r\n showMessageStatus = false,\r\n numberOfChatMessagesToReload = 0,\r\n onMessageSeen,\r\n onRenderMessageStatus,\r\n onRenderAvatar,\r\n onLoadPreviousChatMessages,\r\n onRenderJumpToNewMessageButton,\r\n onRenderMessage\r\n } = props;\r\n\r\n const [messages, setMessages] = useState<(ChatMessage | SystemMessage | CustomMessage)[]>([]);\r\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\r\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\r\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\r\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\r\n const [isAtTopOfScroll, setIsAtTopOfScroll] = useState<boolean>(false);\r\n const [forceUpdate, setForceUpdate] = useState<number>(0);\r\n\r\n // Used to decide if should auto scroll to bottom or show \"new message\" button\r\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessagePayload | undefined>(undefined);\r\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessagePayload | undefined>(undefined);\r\n const [chatMessageIdJustSeen, setChatMessageIdJustSeen] = useState<string | undefined>(undefined);\r\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\r\n\r\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\r\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\r\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\r\n\r\n const [isAllChatMessagesLoaded, setIsAllChatMessagesLoaded] = useState<boolean>(false);\r\n const isAllChatMessagesLoadedRef = useRef(isAllChatMessagesLoaded);\r\n isAllChatMessagesLoadedRef.current = isAllChatMessagesLoaded;\r\n\r\n const chatScrollDivRef: any = useRef();\r\n const chatThreadRef: any = useRef();\r\n const isLoadingChatMessagesRef = useRef(false);\r\n\r\n const messagesRef = useRef(messages);\r\n const setMessagesRef = (messagesWithAttachedValue: (ChatMessage | SystemMessage | CustomMessage)[]): void => {\r\n messagesRef.current = messagesWithAttachedValue;\r\n setMessages(messagesWithAttachedValue);\r\n };\r\n\r\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\r\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\r\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\r\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\r\n };\r\n\r\n const isAtTopOfScrollRef = useRef(isAtTopOfScroll);\r\n const setIsAtTopOfScrollRef = (isAtTopOfScrollValue: boolean): void => {\r\n isAtTopOfScrollRef.current = isAtTopOfScrollValue;\r\n setIsAtTopOfScroll(isAtTopOfScrollValue);\r\n };\r\n\r\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\r\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\r\n chatMessagesInitializedRef.current = chatMessagesInitialized;\r\n setChatMessagesInitialized(chatMessagesInitialized);\r\n };\r\n\r\n // we try to only send those message status if user is scrolled to the bottom.\r\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\r\n if (\r\n !isAtBottomOfScrollRef.current ||\r\n !document.hasFocus() ||\r\n !messagesRef.current ||\r\n messagesRef.current.length === 0 ||\r\n !showMessageStatus\r\n ) {\r\n return;\r\n }\r\n const messagesWithId = messagesRef.current.filter((message) => {\r\n return message.type === 'chat' && !message.payload.mine && !!message.payload.messageId;\r\n });\r\n if (messagesWithId.length === 0) {\r\n return;\r\n }\r\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\r\n\r\n try {\r\n if (\r\n onMessageSeen &&\r\n lastMessage &&\r\n lastMessage.payload.messageId &&\r\n lastMessage.payload.messageId !== chatMessageIdJustSeen\r\n ) {\r\n await onMessageSeen(lastMessage.payload.messageId);\r\n setChatMessageIdJustSeen(lastMessage.payload.messageId);\r\n }\r\n } catch (e) {\r\n console.log('onMessageSeen Error', lastMessage, e);\r\n }\r\n }, [showMessageStatus, onMessageSeen, chatMessageIdJustSeen]);\r\n\r\n const scrollToBottom = useCallback((): void => {\r\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\r\n setExistsNewChatMessage(false);\r\n setIsAtBottomOfScrollRef(true);\r\n sendMessageStatusIfAtBottom();\r\n }, [sendMessageStatusIfAtBottom]);\r\n\r\n const handleScroll = (): void => {\r\n const atBottom =\r\n Math.floor(chatScrollDivRef.current.scrollTop) >=\r\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\r\n const atTop = chatScrollDivRef.current.scrollTop === 0;\r\n if (atBottom) {\r\n sendMessageStatusIfAtBottom();\r\n if (!isAtBottomOfScrollRef.current) {\r\n scrollToBottom();\r\n }\r\n }\r\n setIsAtBottomOfScrollRef(atBottom);\r\n setIsAtTopOfScrollRef(atTop);\r\n\r\n // Make sure we do not stuck at the top if more messages are being fetched.\r\n if (chatScrollDivRef.current.scrollTop === 0 && !isAllChatMessagesLoadedRef.current)\r\n chatScrollDivRef.current.scrollTop = 5;\r\n\r\n (async () => {\r\n if (\r\n chatScrollDivRef.current.scrollTop <= 200 &&\r\n !isAllChatMessagesLoadedRef.current &&\r\n !isLoadingChatMessagesRef.current\r\n ) {\r\n if (onLoadPreviousChatMessages) {\r\n isLoadingChatMessagesRef.current = true;\r\n setIsAllChatMessagesLoaded(await onLoadPreviousChatMessages(numberOfChatMessagesToReload));\r\n isLoadingChatMessagesRef.current = false;\r\n }\r\n }\r\n })();\r\n };\r\n\r\n /**\r\n * One time run useEffect. Sets up listeners when component is mounted and tears down listeners when component\r\n * unmounts.\r\n */\r\n useEffect(() => {\r\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\r\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\r\n chatScrollDivRef.current && chatScrollDivRef.current.addEventListener('scroll', handleScroll);\r\n const chatScrollDiv = chatScrollDivRef.current;\r\n return () => {\r\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\r\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\r\n chatScrollDiv && chatScrollDiv.removeEventListener('scroll', handleScroll);\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n /**\r\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\r\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\r\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\r\n */\r\n const clientHeight = chatThreadRef.current?.clientHeight;\r\n useEffect(() => {\r\n if (clientHeight === undefined) {\r\n setForceUpdate(forceUpdate + 1);\r\n return;\r\n }\r\n // Only scroll to bottom if isAtBottomOfScrollRef is true\r\n isAtBottomOfScrollRef.current && scrollToBottom();\r\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\r\n\r\n /**\r\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\r\n * These two states are used to manipulate scrollbar\r\n */\r\n useEffect(() => {\r\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\r\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\r\n setMessagesRef(newMessages);\r\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\r\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\r\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\r\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\r\n }, [newMessages]);\r\n\r\n /**\r\n * This needs to run after messages are rendererd so we can manipulate the scroll bar.\r\n */\r\n useEffect(() => {\r\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\r\n if (\r\n isThereNewMessageNotFromCurrentUser(latestPreviousChatMessage, latestCurrentChatMessage, userId) &&\r\n !isAtBottomOfScrollRef.current\r\n ) {\r\n setExistsNewChatMessage(true);\r\n } else if (\r\n didUserSendTheLatestMessage(latestPreviousChatMessage, latestCurrentChatMessage, userId) ||\r\n isAtBottomOfScrollRef.current\r\n ) {\r\n scrollToBottom();\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [messages]);\r\n\r\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\r\n useEffect(() => {\r\n (async () => {\r\n if (onLoadPreviousChatMessages) {\r\n while (chatScrollDivRef.current.scrollTop <= 200 && !isAllChatMessagesLoadedRef.current) {\r\n setIsAllChatMessagesLoaded(await onLoadPreviousChatMessages(numberOfChatMessagesToReload));\r\n // Release CPU resources for 200 milliseconds between each loop.\r\n await delay(200);\r\n }\r\n }\r\n })();\r\n }, [onLoadPreviousChatMessages, numberOfChatMessagesToReload]);\r\n\r\n // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp need to be regenerated)\r\n const defaultChatMessageRenderer = useCallback(\r\n (messageProps: MessageProps) => {\r\n return DefaultChatMessageRenderer(messageProps);\r\n },\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n [new Date().toDateString()]\r\n );\r\n\r\n const messagesToDisplay = useMemo(\r\n () =>\r\n memoizeAllMessages((memoizedMessageFn) => {\r\n return messages.map(\r\n (message: ChatMessage | SystemMessage | CustomMessage, index: number): ShorthandValue<ChatItemProps> => {\r\n let key: string | undefined = message.payload.messageId;\r\n if (message.type === 'chat' && (!message.payload.messageId || message.payload.messageId === '')) {\r\n key = message.payload.clientMessageId;\r\n }\r\n\r\n let statusToRender: MessageStatus | undefined = undefined;\r\n if (message.type === 'chat') {\r\n if (showMessageStatus && message.payload.mine) {\r\n switch (message.payload.messageId) {\r\n case lastSeenChatMessage: {\r\n statusToRender = 'seen';\r\n break;\r\n }\r\n case lastSendingChatMessage: {\r\n statusToRender = 'sending';\r\n break;\r\n }\r\n case lastDeliveredChatMessage: {\r\n statusToRender = 'delivered';\r\n break;\r\n }\r\n }\r\n }\r\n if (message.payload.mine && message.payload.status === 'failed') statusToRender = 'failed';\r\n }\r\n\r\n return memoizedMessageFn(\r\n key ?? 'id_' + index,\r\n message,\r\n showMessageStatus,\r\n onRenderAvatar,\r\n styles,\r\n onRenderMessageStatus,\r\n defaultChatMessageRenderer,\r\n // Temporary solution to make sure we re-render if attach attribute is changed.\r\n // The proper fix should be in selector.\r\n message.type === 'chat' ? message.payload.attached : undefined,\r\n statusToRender,\r\n onRenderMessage\r\n );\r\n }\r\n );\r\n }),\r\n [\r\n messages,\r\n showMessageStatus,\r\n onRenderAvatar,\r\n styles,\r\n onRenderMessageStatus,\r\n defaultChatMessageRenderer,\r\n lastSeenChatMessage,\r\n lastSendingChatMessage,\r\n lastDeliveredChatMessage,\r\n onRenderMessage\r\n ]\r\n );\r\n\r\n const chatBody = useMemo(() => {\r\n return (\r\n <LiveAnnouncer>\r\n <Chat styles={styles?.chatContainer ?? chatStyle} items={messagesToDisplay} />\r\n </LiveAnnouncer>\r\n );\r\n }, [styles?.chatContainer, messagesToDisplay]);\r\n\r\n return (\r\n <Ref innerRef={chatThreadRef}>\r\n <Stack className={mergeStyles(messageThreadContainerStyle, styles?.root)} grow>\r\n <Ref innerRef={chatScrollDivRef}>{chatBody}</Ref>\r\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\r\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\r\n {onRenderJumpToNewMessageButton ? (\r\n onRenderJumpToNewMessageButton({ onClick: scrollToBottom })\r\n ) : (\r\n <DefaultJumpToNewMessageButton onClick={scrollToBottom} />\r\n )}\r\n </div>\r\n )}\r\n </Stack>\r\n </Ref>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const mediaContainer = mergeStyles({\r\n position: 'relative',\r\n height: '100%',\r\n width: '100%',\r\n background: 'transparent',\r\n display: 'flex',\r\n '& video': {\r\n borderRadius: '.25rem'\r\n }\r\n});\r\n\r\nexport const invertedVideoStyle = mergeStyles(mediaContainer, {\r\n transform: 'rotateY(180deg)'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useEffect, useRef } from 'react';\r\nimport { invertedVideoStyle, mediaContainer } from './styles/StreamMedia.styles';\r\nimport { BaseCustomStylesProps } from '../types';\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\n/**\r\n * Props for StreamMedia component\r\n */\r\nexport interface StreamMediaProps {\r\n /** Video stream element to render. */\r\n videoStreamElement: HTMLElement | null;\r\n /** Decides whether to mirror the video or not. */\r\n isMirrored?: boolean;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <StreamMedia styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: BaseCustomStylesProps;\r\n}\r\n\r\n/**\r\n * StreamMedia component converts a HTMLElement to a JSX Element.\r\n * This component becomes very handy when you get the video stream HTMLElement from the calling sdk and want to render it in components like VideoTile.\r\n */\r\nexport const StreamMedia = (props: StreamMediaProps): JSX.Element => {\r\n const containerEl = useRef<HTMLDivElement>(null);\r\n const { isMirrored, videoStreamElement, styles } = props;\r\n\r\n useEffect(() => {\r\n const container = containerEl.current;\r\n if (!container) {\r\n return;\r\n }\r\n\r\n // If videoStreamElement changes, we clear the container to make sure we don't have duplicate, and replace it with\r\n // the new videoStreamElement. If videoStreamElement is undefined nothing is appended and container should be empty\r\n // and we don't render anyting.\r\n container.innerHTML = '';\r\n if (videoStreamElement) {\r\n container.appendChild(videoStreamElement);\r\n }\r\n\r\n return () => {\r\n container.innerHTML = '';\r\n };\r\n }, [videoStreamElement]);\r\n\r\n return (\r\n <div className={mergeStyles(isMirrored ? invertedVideoStyle : mediaContainer, styles?.root)} ref={containerEl} />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\nimport { Theme } from '@fluentui/react-theme-provider';\r\n\r\nexport const participantItemContainerStyle = (theme: Theme): string =>\r\n mergeStyles({\r\n paddingTop: '0.25rem',\r\n paddingBottom: '0.25rem',\r\n display: 'flex',\r\n position: 'relative',\r\n maxWidth: '20rem',\r\n minWidth: '12rem',\r\n cursor: 'pointer',\r\n selectors: {\r\n '&:hover': { background: theme.palette.neutralLight }\r\n }\r\n });\r\n\r\nexport const participantItemNameStyle = mergeStyles({\r\n fontSize: '0.875rem', // 14px\r\n fontWeight: 400,\r\n marginTop: '0.3125rem',\r\n marginRight: '0.25rem',\r\n paddingLeft: '0.25rem',\r\n overflowY: 'hidden'\r\n});\r\n\r\nexport const participantItemMeStyle = mergeStyles({\r\n fontSize: '0.875rem', // 14px\r\n fontWeight: 400,\r\n color: '#A19F9D',\r\n marginTop: '0.3125rem'\r\n});\r\n\r\nexport const iconContainerStyle = mergeStyles({\r\n position: 'absolute',\r\n display: 'flex',\r\n right: '1rem',\r\n top: '50%',\r\n msTransform: 'translateY(-50%)',\r\n transform: 'translateY(-50%)'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { participantItemContainerStyle, iconContainerStyle } from './styles/ParticipantItem.styles';\r\nimport {\r\n ContextualMenu,\r\n DirectionalHint,\r\n IContextualMenuItem,\r\n Persona,\r\n PersonaSize,\r\n PersonaPresence,\r\n Stack,\r\n mergeStyles,\r\n IStyle\r\n} from '@fluentui/react';\r\nimport React, { useRef, useState } from 'react';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport { BaseCustomStylesProps } from '../types';\r\n\r\nexport interface ParticipantItemStylesProps extends BaseCustomStylesProps {\r\n /** Styles for the avatar. */\r\n avatar?: IStyle;\r\n /** Styles for the (You) string. */\r\n me?: IStyle;\r\n /** Styles for the container of the icon. */\r\n iconContainer?: IStyle;\r\n /** Styles for the menu. */\r\n menu?: IStyle;\r\n}\r\n\r\n/**\r\n * Props for ParticipantItem component\r\n */\r\nexport interface ParticipantItemProps {\r\n /** Name of participant. */\r\n displayName: string;\r\n /** Optional indicator to show participant is the user. */\r\n me?: boolean;\r\n /** Optional callback returning a JSX element to override avatar. */\r\n onRenderAvatar?: (props?: ParticipantItemProps) => JSX.Element | null;\r\n /** Optional array of IContextualMenuItem for contextual menu. */\r\n menuItems?: IContextualMenuItem[];\r\n /** Optional callback returning a JSX element rendered on the right portion of the ParticipantItem. Intended for adding icons. */\r\n onRenderIcon?: (props?: ParticipantItemProps) => JSX.Element | null;\r\n /** Optional PersonaPresence to show participant presence. This will not have an effect if property avatar is assigned. */\r\n presence?: PersonaPresence;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <ParticipantItem styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: ParticipantItemStylesProps;\r\n}\r\n\r\n/**\r\n * `ParticipantItem` represents a participant in Calling or Chat. `ParticipantItem` displays a participant's avatar,\r\n * displayName and status as well as optional icons and context menu.\r\n */\r\nexport const ParticipantItem = (props: ParticipantItemProps): JSX.Element => {\r\n const { displayName, onRenderAvatar, menuItems, onRenderIcon, presence, styles } = props;\r\n const [clickEvent, setClickEvent] = useState<MouseEvent | undefined>();\r\n const [menuHidden, setMenuHidden] = useState<boolean>(true);\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const theme = useTheme();\r\n\r\n const showMenu = (clickEvent: React.MouseEvent<HTMLDivElement, MouseEvent>): void => {\r\n setClickEvent(clickEvent.nativeEvent);\r\n setMenuHidden(false);\r\n };\r\n\r\n const hideMenu = (): void => {\r\n setClickEvent(undefined);\r\n setMenuHidden(true);\r\n };\r\n\r\n const avatarToUse = (\r\n <Persona\r\n text={displayName}\r\n size={PersonaSize.size32}\r\n presence={presence}\r\n onRenderPersonaCoin={onRenderAvatar ? () => onRenderAvatar(props) : undefined}\r\n className={mergeStyles(styles?.avatar)}\r\n initialsTextColor=\"white\"\r\n />\r\n );\r\n return (\r\n <div\r\n ref={containerRef}\r\n className={mergeStyles(participantItemContainerStyle(theme), styles?.root)}\r\n onClick={showMenu}\r\n >\r\n {avatarToUse}\r\n {onRenderIcon && (\r\n <Stack className={mergeStyles(iconContainerStyle, styles?.iconContainer)}>{onRenderIcon(props)}</Stack>\r\n )}\r\n {menuItems && (\r\n <ContextualMenu\r\n items={menuItems}\r\n hidden={menuHidden}\r\n target={clickEvent ?? containerRef}\r\n onItemClick={hideMenu}\r\n onDismiss={hideMenu}\r\n directionalHint={DirectionalHint.bottomLeftEdge}\r\n className={mergeStyles(styles?.menu)}\r\n />\r\n )}\r\n </div>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IButtonStyles, IOverflowSetStyles, mergeStyles } from '@fluentui/react';\r\n\r\nexport const participantListStyle = mergeStyles({\r\n height: '100%',\r\n overflow: 'auto',\r\n paddingLeft: '1.125rem',\r\n paddingRight: '1.125rem'\r\n});\r\n\r\nexport const overFlowButtonStyles: IButtonStyles = {\r\n root: {\r\n minWidth: 0,\r\n padding: '0 0.25rem',\r\n alignSelf: 'stretch',\r\n height: 'auto'\r\n }\r\n};\r\n\r\nexport const overflowSetStyle: IOverflowSetStyles = {\r\n item: {\r\n width: '100%'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\n\r\nimport {\r\n IContextualMenuItem,\r\n IOverflowSetItemProps,\r\n IconButton,\r\n OverflowSet,\r\n Stack,\r\n PersonaPresence\r\n} from '@fluentui/react';\r\nimport { ParticipantItem } from './ParticipantItem';\r\nimport { MicOffIcon, CallControlPresentNewIcon } from '@fluentui/react-northstar';\r\nimport { participantListStyle, overFlowButtonStyles, overflowSetStyle } from './styles/ParticipantList.styles';\r\nimport { CommunicationParticipant, CallParticipant } from '../types';\r\n\r\n/**\r\n * Props for component `ParticipantList`\r\n */\r\nexport type ParticipantListProps = {\r\n /** Participants in user call or chat */\r\n participants: CommunicationParticipant[];\r\n /** User ID of user */\r\n myUserId?: string;\r\n /** Optional callback to render each participant. If no callback is provided, each participant will be rendered with `ParticipantItem` */\r\n onRenderParticipant?: (participant: CommunicationParticipant) => JSX.Element | null;\r\n /** Optional callback to render the avatar for each participant. This property will have no effect if `onRenderParticipant` is assigned. */\r\n onRenderAvatar?: (participant: CommunicationParticipant) => JSX.Element | null;\r\n /** Optional callback to render the context menu for each participant */\r\n onParticipantRemove?: (userId: string) => void;\r\n};\r\n\r\nconst getDefaultRenderer = (\r\n myUserId?: string,\r\n onParticipantRemove?: (userId: string) => void,\r\n onRenderAvatar?: (remoteParticipant: CommunicationParticipant) => JSX.Element | null\r\n): ((participant: CommunicationParticipant) => JSX.Element | null) => {\r\n return (participant: CommunicationParticipant) => {\r\n // Try to consider CommunicationParticipant as CallParticipant\r\n const callingParticipant = participant as CallParticipant;\r\n\r\n let presence: PersonaPresence | undefined = undefined;\r\n if (callingParticipant) {\r\n if (callingParticipant.state === 'Connected') {\r\n presence = PersonaPresence.online;\r\n } else if (callingParticipant.state === 'Idle') {\r\n presence = PersonaPresence.away;\r\n }\r\n }\r\n\r\n const menuItems: IContextualMenuItem[] = [];\r\n if (participant.userId !== myUserId && onParticipantRemove) {\r\n menuItems.push({\r\n key: 'Remove',\r\n text: 'Remove',\r\n onClick: () => onParticipantRemove(participant.userId)\r\n });\r\n }\r\n\r\n const onRenderIcon =\r\n callingParticipant?.isScreenSharing || callingParticipant?.isMuted\r\n ? () => (\r\n <Stack horizontal={true} tokens={{ childrenGap: '0.5rem' }}>\r\n {callingParticipant.isScreenSharing && <CallControlPresentNewIcon size=\"small\" />}\r\n {callingParticipant.isMuted && <MicOffIcon size=\"small\" />}\r\n </Stack>\r\n )\r\n : () => <></>;\r\n\r\n const renderAvatar = onRenderAvatar\r\n ? () => {\r\n return onRenderAvatar(participant);\r\n }\r\n : undefined;\r\n\r\n if (participant.displayName) {\r\n return (\r\n <ParticipantItem\r\n displayName={participant.displayName}\r\n me={myUserId ? participant.userId === myUserId : false}\r\n menuItems={menuItems}\r\n presence={presence}\r\n onRenderIcon={onRenderIcon}\r\n onRenderAvatar={renderAvatar}\r\n />\r\n );\r\n }\r\n return null;\r\n };\r\n};\r\n\r\nconst onRenderOverflowButton = (overflowItems: unknown): JSX.Element => (\r\n <IconButton\r\n role=\"menuitem\"\r\n title=\"More options\"\r\n styles={overFlowButtonStyles}\r\n menuIconProps={{ iconName: 'More' }}\r\n menuProps={{ items: overflowItems as IContextualMenuItem[] }}\r\n />\r\n);\r\n\r\nconst renderParticipants = (\r\n participants: CommunicationParticipant[],\r\n myUserId?: string,\r\n onRenderParticipant?: (participant: CommunicationParticipant) => JSX.Element | null,\r\n onRenderAvatar?: (participant: CommunicationParticipant) => JSX.Element | null,\r\n onParticipantRemove?: (userId: string) => void\r\n): (JSX.Element | null)[] => {\r\n const renderParticipant = onRenderParticipant ?? getDefaultRenderer(myUserId, onParticipantRemove, onRenderAvatar);\r\n const onRenderItem = (item: IOverflowSetItemProps): JSX.Element | null => {\r\n const participant = {\r\n userId: item.userId,\r\n displayName: item.displayName,\r\n state: item.state,\r\n isScreenSharing: item.isScreenSharing,\r\n isMuted: item.isMuted,\r\n isSpeaking: item.isSpeaking\r\n };\r\n return renderParticipant(participant);\r\n };\r\n return participants.map((item, i) => {\r\n return (\r\n <OverflowSet\r\n key={i}\r\n items={[{ key: `${i}`, displayName: item.displayName, me: item.userId === myUserId, ...item }]}\r\n role=\"menubar\"\r\n vertical={false}\r\n onRenderOverflowButton={onRenderOverflowButton}\r\n onRenderItem={onRenderItem}\r\n styles={overflowSetStyle}\r\n />\r\n );\r\n });\r\n};\r\n\r\n/**\r\n * `ParticipantList` renders a list of participants in Calling or Chat. If property `onRenderParticipant` is not\r\n * assigned then each participant is rendered with `ParticipantItem`.\r\n */\r\nexport const ParticipantList = (props: ParticipantListProps): JSX.Element => {\r\n const allParticipants: CommunicationParticipant[] = [];\r\n if (props.participants !== undefined) {\r\n props.participants.forEach((participant) => allParticipants.push(participant));\r\n }\r\n return (\r\n <Stack className={participantListStyle}>\r\n {renderParticipants(\r\n allParticipants,\r\n props.myUserId,\r\n props.onRenderParticipant,\r\n props.onRenderAvatar,\r\n props.onParticipantRemove\r\n )}\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nconst videoBaseStyle = mergeStyles({\r\n border: 0\r\n});\r\n\r\nexport const gridStyle = mergeStyles(videoBaseStyle, {\r\n width: '100%',\r\n height: '100%'\r\n});\r\n\r\nexport const videoTileStyle = {\r\n root: {\r\n borderRadius: '.25rem'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStyle, mergeStyles } from '@fluentui/react';\r\n\r\nexport const rootStyles: IStyle = {\r\n position: 'relative',\r\n height: '100%',\r\n width: '100%'\r\n};\r\n\r\nexport const videoContainerStyles: IStyle = {\r\n position: 'absolute',\r\n top: '0',\r\n left: '0',\r\n width: '100%',\r\n height: '100%',\r\n minWidth: '100%',\r\n minHeight: '100%',\r\n objectPosition: 'center',\r\n objectFit: 'cover',\r\n zIndex: 0\r\n};\r\n\r\nexport const overlayContainerStyles: IStyle = {\r\n width: '100%',\r\n height: '100%',\r\n zIndex: 5\r\n};\r\n\r\nexport const disabledVideoHint = mergeStyles({\r\n bottom: '0.5rem',\r\n boxShadow: 'none',\r\n textAlign: 'left',\r\n left: '0.5rem',\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n padding: '0.25rem',\r\n lineHeight: '1.4286rem',\r\n whiteSpace: 'nowrap',\r\n maxWidth: '95%',\r\n borderRadius: 4\r\n});\r\n\r\nexport const videoHint = mergeStyles(disabledVideoHint, {\r\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\r\n boxShadow: '0 0 1px 0 rgba(0,0,0,.5)'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStyle, mergeStyles, Persona, PersonaSize, Stack, Text } from '@fluentui/react';\r\nimport React from 'react';\r\nimport {\r\n disabledVideoHint,\r\n overlayContainerStyles,\r\n rootStyles,\r\n videoContainerStyles,\r\n videoHint\r\n} from './styles/VideoTile.styles';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport { BaseCustomStylesProps } from '../types';\r\n\r\nexport interface VideoTileStylesProps extends BaseCustomStylesProps {\r\n /** Styles for video container. */\r\n videoContainer?: IStyle;\r\n /** Styles for container overlayed on the video container. */\r\n overlayContainer?: IStyle;\r\n /** Styles for displayName on the video container. */\r\n displayNameContainer?: IStyle;\r\n}\r\n\r\n/**\r\n * Props for VideoTile component\r\n */\r\nexport interface VideoTileProps extends PlaceholderProps {\r\n /** React Child components. Child Components will show as overlay component in the VideoTile. */\r\n children?: React.ReactNode;\r\n /**\r\n * Allows users to pass in an object contains custom CSS styles.\r\n * @Example\r\n * ```\r\n * <VideoTile styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: VideoTileStylesProps;\r\n /** Determines if the static image or video stream should be rendered. */\r\n isVideoReady?: boolean;\r\n /** Component with the video stream. */\r\n renderElement?: JSX.Element | null;\r\n /** Determines if the video is mirrored or not. */\r\n isMirrored?: boolean;\r\n /** Custom render Component function for no video is available. Render a Persona Icon if undefined. */\r\n onRenderPlaceholder?: (\r\n props: PlaceholderProps,\r\n defaultOnRender: (props: PlaceholderProps) => JSX.Element\r\n ) => JSX.Element | null;\r\n /**\r\n * Whether the displayName is displayed or not.\r\n *\r\n * @defaultValue `true`\r\n */\r\n showDisplayName?: boolean;\r\n}\r\n\r\nexport interface PlaceholderProps {\r\n /** user id for the VideoTile placeholder. */\r\n userId?: string;\r\n /** Optional participant display name for the VideoTile default placeholder. */\r\n displayName?: string;\r\n /** Optional property to set the aria label of the video tile if there is no available stream. */\r\n noVideoAvailableAriaLabel?: string;\r\n}\r\n\r\nconst DefaultPlaceholder = (props: PlaceholderProps): JSX.Element => {\r\n const { displayName, noVideoAvailableAriaLabel } = props;\r\n const personaStyles = { root: { margin: 'auto' } };\r\n return (\r\n <Stack className={mergeStyles({ position: 'absolute', height: '100%', width: '100%' })}>\r\n <Persona\r\n styles={personaStyles}\r\n size={PersonaSize.size100}\r\n hidePersonaDetails={true}\r\n text={displayName}\r\n initialsTextColor=\"white\"\r\n aria-label={noVideoAvailableAriaLabel}\r\n />\r\n </Stack>\r\n );\r\n};\r\n\r\nexport const VideoTile = (props: VideoTileProps): JSX.Element => {\r\n const {\r\n children,\r\n displayName,\r\n isMirrored,\r\n isVideoReady,\r\n onRenderPlaceholder,\r\n renderElement,\r\n showDisplayName = true,\r\n styles,\r\n userId,\r\n noVideoAvailableAriaLabel\r\n } = props;\r\n\r\n const placeHolderProps = { userId, displayName, noVideoAvailableAriaLabel };\r\n const theme = useTheme();\r\n return (\r\n <Stack className={mergeStyles(rootStyles, { background: theme.palette.neutralLighter }, styles?.root)}>\r\n {isVideoReady && renderElement ? (\r\n <Stack\r\n className={mergeStyles(\r\n videoContainerStyles,\r\n isMirrored && {\r\n transform: 'scaleX(-1)'\r\n },\r\n styles?.videoContainer\r\n )}\r\n >\r\n {renderElement}\r\n </Stack>\r\n ) : (\r\n <Stack className={mergeStyles(videoContainerStyles)}>\r\n {onRenderPlaceholder ? (\r\n onRenderPlaceholder(placeHolderProps, DefaultPlaceholder)\r\n ) : (\r\n <DefaultPlaceholder {...placeHolderProps} />\r\n )}\r\n </Stack>\r\n )}\r\n {displayName && showDisplayName && (\r\n <Text\r\n className={mergeStyles(\r\n isVideoReady ? videoHint : disabledVideoHint,\r\n { color: isVideoReady ? 'white' : theme.palette.neutralPrimaryAlt },\r\n styles?.displayNameContainer\r\n )}\r\n >\r\n {displayName}\r\n </Text>\r\n )}\r\n {children && <Stack className={mergeStyles(overlayContainerStyles, styles?.overlayContainer)}>{children}</Stack>}\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Stack } from '@fluentui/react';\r\nimport React, { useMemo } from 'react';\r\nimport {\r\n BaseCustomStylesProps,\r\n VideoGalleryLocalParticipant,\r\n VideoGalleryRemoteParticipant,\r\n VideoStreamOptions\r\n} from '../types';\r\nimport { GridLayout } from './GridLayout';\r\nimport { StreamMedia } from './StreamMedia';\r\nimport { gridStyle, videoTileStyle } from './styles/VideoGallery.styles';\r\nimport { memoizeFnAll } from 'acs-ui-common';\r\nimport { VideoTile, PlaceholderProps } from './VideoTile';\r\n\r\n/**\r\n * Props for component `VideoGallery`\r\n */\r\nexport interface VideoGalleryProps {\r\n /**\r\n * Allows users to pass an object containing custom CSS styles for the gallery container.\r\n *\r\n * @Example\r\n * ```\r\n * <VideoGallery styles={{ root: { border: 'solid 1px red' } }} />\r\n * ```\r\n */\r\n styles?: BaseCustomStylesProps;\r\n /** Local video particpant */\r\n localParticipant: VideoGalleryLocalParticipant;\r\n /** List of remote video particpants */\r\n remoteParticipants?: VideoGalleryRemoteParticipant[];\r\n /** Local video view options */\r\n localVideoViewOption?: VideoStreamOptions;\r\n /** Remote videos view options */\r\n remoteVideoViewOption?: VideoStreamOptions;\r\n /** Callback to create the local video stream view */\r\n onCreateLocalStreamView?: (options?: VideoStreamOptions | undefined) => Promise<void>;\r\n /** Callback to dispose of the local video stream view */\r\n onDisposeLocalStreamView?: () => void;\r\n /** Callback to render the local video tile*/\r\n onRenderLocalVideoTile?: (localParticipant: VideoGalleryLocalParticipant) => JSX.Element;\r\n /** Callback to create a remote video stream view */\r\n onCreateRemoteStreamView?: (userId: string, options?: VideoStreamOptions) => Promise<void>;\r\n /** Callback to render a remote video tile */\r\n onRenderRemoteVideoTile?: (remoteParticipant: VideoGalleryRemoteParticipant) => JSX.Element;\r\n /** Callback to render a particpant avatar */\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element;\r\n}\r\n\r\n// @todo: replace with React.memo method\r\nconst memoizeAllRemoteParticipants = memoizeFnAll(\r\n (\r\n userId: string,\r\n onCreateRemoteStreamView: any,\r\n isAvailable?: boolean,\r\n renderElement?: HTMLElement,\r\n displayName?: string,\r\n remoteVideoViewOption?: VideoStreamOptions,\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element\r\n ): JSX.Element => {\r\n if (isAvailable && !renderElement) {\r\n onCreateRemoteStreamView && onCreateRemoteStreamView(userId, remoteVideoViewOption);\r\n }\r\n return (\r\n <Stack className={gridStyle} key={userId} grow>\r\n <VideoTile\r\n userId={userId}\r\n isVideoReady={isAvailable}\r\n renderElement={<StreamMedia videoStreamElement={renderElement ?? null} />}\r\n displayName={displayName}\r\n styles={videoTileStyle}\r\n onRenderPlaceholder={onRenderAvatar}\r\n />\r\n </Stack>\r\n );\r\n }\r\n);\r\n\r\n/**\r\n * VideoGallery represents a `GridLayout` of video tiles for a specific call.\r\n * It displays a `VideoTile` for the local user as well as for each remote participants who joined the call.\r\n *\r\n * @param props - of type `VideoGalleryProps`\r\n *\r\n * @returns a JSX Element\r\n */\r\nexport const VideoGallery = (props: VideoGalleryProps): JSX.Element => {\r\n const {\r\n localParticipant,\r\n remoteParticipants,\r\n localVideoViewOption,\r\n remoteVideoViewOption,\r\n onRenderLocalVideoTile,\r\n onRenderRemoteVideoTile,\r\n onCreateLocalStreamView,\r\n onCreateRemoteStreamView,\r\n styles,\r\n onRenderAvatar\r\n } = props;\r\n\r\n /**\r\n * Utility function for meoized rendering of LocalParticipant.\r\n */\r\n const defaultOnRenderLocalVideoTile = useMemo((): JSX.Element => {\r\n const localVideoStream = localParticipant?.videoStream;\r\n const isLocalVideoReady = localVideoStream?.isAvailable;\r\n\r\n if (onRenderLocalVideoTile) return onRenderLocalVideoTile(localParticipant);\r\n\r\n if (localVideoStream && !localVideoStream.renderElement) {\r\n onCreateLocalStreamView && onCreateLocalStreamView(localVideoViewOption);\r\n }\r\n return (\r\n <VideoTile\r\n userId={localParticipant.userId}\r\n isVideoReady={isLocalVideoReady}\r\n renderElement={<StreamMedia videoStreamElement={localVideoStream?.renderElement ?? null} />}\r\n displayName={localParticipant?.displayName}\r\n styles={videoTileStyle}\r\n onRenderPlaceholder={onRenderAvatar}\r\n />\r\n );\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [localParticipant, localParticipant.videoStream, onCreateLocalStreamView]);\r\n\r\n /**\r\n * Utility function for memoized rendering of RemoteParticipants.\r\n */\r\n const defaultOnRenderRemoteParticipants = useMemo(() => {\r\n if (!remoteParticipants) return null;\r\n\r\n // If user provided a custom onRender function return that function.\r\n if (onRenderRemoteVideoTile) {\r\n return remoteParticipants.map((participant) => onRenderRemoteVideoTile(participant));\r\n }\r\n\r\n return memoizeAllRemoteParticipants((memoizedRemoteParticipantFn) => {\r\n // Else return Remote Stream Video Tiles\r\n return remoteParticipants.map((participant) => {\r\n const remoteVideoStream = participant.videoStream;\r\n return memoizedRemoteParticipantFn(\r\n participant.userId,\r\n onCreateRemoteStreamView,\r\n remoteVideoStream?.isAvailable,\r\n remoteVideoStream?.renderElement,\r\n participant.displayName,\r\n remoteVideoViewOption,\r\n onRenderAvatar\r\n );\r\n });\r\n });\r\n }, [remoteParticipants, onRenderRemoteVideoTile, onCreateRemoteStreamView, remoteVideoViewOption]);\r\n\r\n return (\r\n <GridLayout styles={styles}>\r\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={gridStyle} grow>\r\n {localParticipant && defaultOnRenderLocalVideoTile}\r\n </Stack>\r\n {defaultOnRenderRemoteParticipants}\r\n </GridLayout>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { getTheme, IStyle, IButtonStyles, concatStyleSets } from '@fluentui/react';\r\n\r\nconst theme = getTheme();\r\nconst palette = theme.palette;\r\n\r\ninterface IControlBarStyles {\r\n horizontal: IStyle;\r\n vertical: IStyle;\r\n dockedTop: IStyle;\r\n dockedBottom: IStyle;\r\n dockedLeft: IStyle;\r\n dockedRight: IStyle;\r\n floatingTop: IStyle;\r\n floatingBottom: IStyle;\r\n floatingLeft: IStyle;\r\n floatingRight: IStyle;\r\n}\r\n\r\nexport const controlBarStyles: IControlBarStyles = {\r\n horizontal: {\r\n flexFlow: 'row nowrap'\r\n },\r\n vertical: {\r\n flexFlow: 'column nowrap',\r\n maxWidth: '3.5rem'\r\n },\r\n dockedTop: {\r\n flexFlow: 'row nowrap',\r\n justifyContent: 'center',\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n width: '100%'\r\n },\r\n dockedBottom: {\r\n flexFlow: 'row nowrap',\r\n justifyContent: 'center',\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n bottom: 0,\r\n left: 0,\r\n width: '100%'\r\n },\r\n dockedLeft: {\r\n justifyContent: 'center',\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n height: '100%'\r\n },\r\n dockedRight: {\r\n justifyContent: 'center',\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: 0,\r\n right: 0,\r\n height: '100%'\r\n },\r\n floatingTop: {\r\n flexFlow: 'row nowrap',\r\n justifyContent: 'center',\r\n boxShadow: theme.effects.elevation16,\r\n borderRadius: theme.effects.roundedCorner6,\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: '1rem',\r\n left: '50%',\r\n transform: 'translateX(-50%)',\r\n zIndex: 10\r\n },\r\n floatingBottom: {\r\n flexFlow: 'row nowrap',\r\n justifyContent: 'center',\r\n boxShadow: theme.effects.elevation16,\r\n borderRadius: theme.effects.roundedCorner6,\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n bottom: '1rem',\r\n left: '50%',\r\n transform: 'translateX(-50%)',\r\n zIndex: 10\r\n },\r\n floatingLeft: {\r\n flexFlow: 'column nowrap',\r\n justifyContent: 'center',\r\n boxShadow: theme.effects.elevation16,\r\n borderRadius: theme.effects.roundedCorner6,\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: '50%',\r\n left: '1rem',\r\n transform: 'translateY(-50%)',\r\n zIndex: 10\r\n },\r\n floatingRight: {\r\n flexFlow: 'column nowrap',\r\n justifyContent: 'center',\r\n boxShadow: theme.effects.elevation16,\r\n borderRadius: theme.effects.roundedCorner6,\r\n overflow: 'hidden',\r\n position: 'absolute',\r\n top: '50%',\r\n right: '1rem',\r\n transform: 'translateY(-50%)',\r\n zIndex: 10\r\n }\r\n};\r\n\r\nexport const controlButtonStyles: IButtonStyles = {\r\n root: {\r\n background: 'none',\r\n border: 'none',\r\n borderRadius: 0,\r\n minHeight: '3.5rem',\r\n minWidth: '3.5rem'\r\n },\r\n flexContainer: {\r\n flexFlow: 'column',\r\n display: 'contents'\r\n }\r\n};\r\n\r\nexport const controlButtonLabelStyles: IStyle = {\r\n fontSize: '0.625rem',\r\n lineHeight: '1rem',\r\n marginTop: '0.125rem'\r\n};\r\n\r\nexport const endCallControlButtonStyles: IButtonStyles = concatStyleSets(controlButtonStyles, {\r\n root: {\r\n color: palette.white\r\n },\r\n rootHovered: {\r\n color: palette.white\r\n },\r\n rootPressed: {\r\n color: palette.white\r\n },\r\n label: {\r\n color: palette.whiteTranslucent40\r\n }\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { concatStyleSets, DefaultButton, IButtonProps, Label, mergeStyles } from '@fluentui/react';\r\nimport { CallVideoIcon, CallVideoOffIcon } from '@fluentui/react-northstar';\r\nimport React from 'react';\r\nimport { controlButtonLabelStyles, controlButtonStyles } from './styles/ControlBar.styles';\r\n\r\n/**\r\n * Props for CameraButton component\r\n */\r\nexport interface CameraButtonProps extends IButtonProps {\r\n /**\r\n * Whether the label is displayed or not.\r\n * @defaultValue `false`\r\n */\r\n showLabel?: boolean;\r\n\r\n /**\r\n * Utility property for using this component with `communication react eventHandlers`.\r\n * Maps directly to the `onClick` property.\r\n */\r\n onToggleCamera?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * `CameraButton` allows you to easily create a component for rendering a camera button.\r\n * It can be used in your ControlBar component for example.\r\n *\r\n * @param props - of type CameraButtonProps\r\n */\r\nexport const CameraButton = (props: CameraButtonProps): JSX.Element => {\r\n const { showLabel = false, styles, onRenderIcon, onRenderText } = props;\r\n const componentStyles = concatStyleSets(controlButtonStyles, styles ?? {});\r\n\r\n const defaultRenderIcon = (props?: IButtonProps): JSX.Element => {\r\n return props?.checked ? <CallVideoIcon key={'videoIconKey'} /> : <CallVideoOffIcon key={'videoOffIconKey'} />;\r\n };\r\n\r\n const defaultRenderText = (props?: IButtonProps): JSX.Element => {\r\n return (\r\n <Label key={'videoLabelKey'} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\r\n {props?.checked ? 'Turn off' : 'Turn on'}\r\n </Label>\r\n );\r\n };\r\n\r\n return (\r\n <DefaultButton\r\n {...props}\r\n onClick={props.onToggleCamera ?? props.onClick}\r\n styles={componentStyles}\r\n onRenderIcon={onRenderIcon ?? defaultRenderIcon}\r\n onRenderText={showLabel ? onRenderText ?? defaultRenderText : undefined}\r\n />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Theme } from '@fluentui/react-theme-provider';\r\n\r\nexport const isDarkThemed = (theme: Theme): boolean => {\r\n const themeBlackBrightness = getPerceptualBrightnessOfHexColor(theme.palette.black);\r\n const themeWhiteBrightness = getPerceptualBrightnessOfHexColor(theme.palette.white);\r\n if (Number.isNaN(themeBlackBrightness) || Number.isNaN(themeWhiteBrightness)) {\r\n return false;\r\n }\r\n return themeBlackBrightness > themeWhiteBrightness;\r\n};\r\n\r\nconst getPerceptualBrightnessOfHexColor = (hexColor: string): number => {\r\n // return NaN if hexColor is not a hex code\r\n if (!/^#[0-9A-Fa-f]{6}$/i.test(hexColor)) {\r\n return NaN;\r\n }\r\n const r = parseInt(hexColor.substring(1, 3), 16);\r\n const g = parseInt(hexColor.substring(3, 5), 16);\r\n const b = parseInt(hexColor.substring(5, 7), 16);\r\n\r\n // arithmetic mean μ of the red, green, and blue color coordinates. Source: https://en.wikipedia.org/wiki/Brightness\r\n return (r + g + b) / 3;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStyle, mergeStyles, Stack } from '@fluentui/react';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport React from 'react';\r\nimport { BaseCustomStylesProps } from '../types';\r\nimport { controlBarStyles } from './styles/ControlBar.styles';\r\nimport { isDarkThemed } from '../theming/themeUtils';\r\n\r\nconst mainDivStyle: IStyle = { position: 'relative', height: '100%', width: '100%' };\r\n\r\nexport type ControlBarLayoutType =\r\n | 'horizontal'\r\n | 'vertical'\r\n | 'dockedTop'\r\n | 'dockedBottom'\r\n | 'dockedLeft'\r\n | 'dockedRight'\r\n | 'floatingTop'\r\n | 'floatingBottom'\r\n | 'floatingLeft'\r\n | 'floatingRight';\r\n\r\n/**\r\n * Props for ControlBar component.\r\n */\r\nexport interface ControlBarProps {\r\n /** React Child components. */\r\n children?: React.ReactNode;\r\n /**\r\n * Allows users to pass an object containing custom CSS styles.\r\n * @Example\r\n * ```\r\n * <ControlBar styles={{ root: { background: 'blue' } }} />\r\n * ```\r\n */\r\n styles?: BaseCustomStylesProps;\r\n /**\r\n * Changes the layout of the control bar.\r\n * Available layouts are `horizontal`, `vertical`, `dockedTop`, `dockedBottom`,\r\n * `dockedLeft`, `dockedRight`, `floatingTop`, `floatingBottom`, `floatingLeft`,\r\n * `floatingRight`\r\n * Defaults to a `horizontal` layout.\r\n */\r\n layout?: ControlBarLayoutType;\r\n}\r\n\r\n/**\r\n * `ControlBar` allows you to easily create a component for call controls using\r\n * [Button](https://developer.microsoft.com/en-us/fluentui#/controls/web/button) component from\r\n * Fluent UI. Users will need to provide methods to Button components used inside `ControlBar`\r\n * for altering call behavior.\r\n */\r\nexport const ControlBar = (props: ControlBarProps): JSX.Element => {\r\n const { styles, layout } = props;\r\n const theme = useTheme();\r\n const controlBarStyle = controlBarStyles[layout ?? 'horizontal'];\r\n return (\r\n <div className={mergeStyles(mainDivStyle)}>\r\n <Stack\r\n className={mergeStyles(\r\n controlBarStyle,\r\n {\r\n background:\r\n isDarkThemed(theme) && layout?.startsWith('floating')\r\n ? theme.palette.neutralQuaternaryAlt\r\n : theme.palette.white\r\n },\r\n styles?.root\r\n )}\r\n >\r\n {props.children}\r\n </Stack>\r\n </div>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { PartialTheme } from '@fluentui/react-theme-provider';\r\n\r\n/**\r\n * Theme designed ACS UI SDK calling components\r\n */\r\nexport interface CallingTheme {\r\n callingPalette: {\r\n callRed: string;\r\n callRedDark: string;\r\n callRedDarker: string;\r\n };\r\n}\r\n\r\n/**\r\n * Light theme designed ACS UI SDK components\r\n */\r\nexport const lightTheme: PartialTheme & CallingTheme = {\r\n palette: {\r\n themePrimary: '#0078d4',\r\n themeLighterAlt: '#eff6fc',\r\n themeLighter: '#deecf9',\r\n themeLight: '#c7e0f4',\r\n themeTertiary: '#71afe5',\r\n themeSecondary: '#2b88d8',\r\n themeDarkAlt: '#106ebe',\r\n themeDark: '#59b0f7',\r\n themeDarker: '#004578',\r\n neutralLighterAlt: '#faf9f8',\r\n neutralLighter: '#f3f2f1',\r\n neutralLight: '#edebe9',\r\n neutralQuaternaryAlt: '#e1dfdd',\r\n neutralQuaternary: '#d0d0d0',\r\n neutralTertiaryAlt: '#c8c6c4',\r\n neutralTertiary: '#a19f9d',\r\n neutralSecondary: '#605e5c',\r\n neutralPrimaryAlt: '#3b3a39',\r\n neutralPrimary: '#323130',\r\n neutralDark: '#201f1e',\r\n black: '#000000',\r\n white: '#ffffff'\r\n },\r\n callingPalette: {\r\n callRed: '#c4314b',\r\n callRedDark: '#a42e43',\r\n callRedDarker: '#8b2c3d'\r\n }\r\n};\r\n\r\n/**\r\n * Dark theme designed ACS UI SDK components\r\n */\r\nexport const darkTheme: PartialTheme & CallingTheme = {\r\n palette: {\r\n themePrimary: '#2899f5',\r\n themeLighterAlt: '#02060a',\r\n themeLighter: '#061827',\r\n themeLight: '#0c2e49',\r\n themeTertiary: '#185b93',\r\n themeSecondary: '#2286d7',\r\n themeDarkAlt: '#3ca2f6',\r\n themeDark: '#59b0f7',\r\n themeDarker: '#84c5f9',\r\n neutralLighterAlt: '#302e2d',\r\n neutralLighter: '#383735',\r\n neutralLight: '#464443',\r\n neutralQuaternaryAlt: '#4e4d4b',\r\n neutralQuaternary: '#4d4b49',\r\n neutralTertiaryAlt: '#72706e',\r\n neutralTertiary: '#c8c8c8',\r\n neutralSecondary: '#d0d0d0',\r\n neutralPrimaryAlt: '#dadada',\r\n neutralPrimary: '#ffffff',\r\n neutralDark: '#f4f4f4',\r\n black: '#f8f8f8',\r\n white: '#252423'\r\n },\r\n callingPalette: {\r\n callRed: '#a42e43',\r\n callRedDark: '#8b2c3d',\r\n callRedDarker: '#772a38'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { DefaultButton, IButtonProps, Label, concatStyleSets, mergeStyles } from '@fluentui/react';\r\nimport { CallEndIcon } from '@fluentui/react-northstar';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport { controlButtonLabelStyles, endCallControlButtonStyles } from './styles/ControlBar.styles';\r\nimport { lightTheme, darkTheme } from '../theming/themes';\r\nimport { isDarkThemed } from '../theming/themeUtils';\r\n\r\n/**\r\n * Props for EndCallButton component\r\n */\r\nexport interface EndCallButtonProps extends IButtonProps {\r\n /**\r\n * Whether the label is displayed or not.\r\n *\r\n * @defaultValue `false`\r\n */\r\n showLabel?: boolean;\r\n\r\n /**\r\n * Utility property for using this component with `communication react eventHandlers`.\r\n * Maps directly to the `onClick` property.\r\n */\r\n onHangUp?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * `EndCallButton` allows you to easily create a component for rendering a end call button. It can be used in your ControlBar component for example.\r\n *\r\n * @param props - of type EndCallButtonProps\r\n */\r\nexport const EndCallButton = (props: EndCallButtonProps): JSX.Element => {\r\n const { showLabel = false, styles, onRenderIcon, onRenderText } = props;\r\n\r\n const isDarkTheme = isDarkThemed(useTheme());\r\n\r\n const componentStyles = concatStyleSets(\r\n endCallControlButtonStyles,\r\n {\r\n root: {\r\n background: isDarkTheme ? darkTheme.callingPalette.callRed : lightTheme.callingPalette.callRed\r\n },\r\n rootHovered: {\r\n background: isDarkTheme ? darkTheme.callingPalette.callRedDark : lightTheme.callingPalette.callRedDark\r\n },\r\n rootPressed: {\r\n background: isDarkTheme ? darkTheme.callingPalette.callRedDarker : lightTheme.callingPalette.callRedDarker\r\n }\r\n },\r\n styles ?? {}\r\n );\r\n\r\n const defaultRenderIcon = (): JSX.Element => {\r\n return <CallEndIcon key={'callEndIconKey'} />;\r\n };\r\n\r\n const defaultRenderText = (props?: IButtonProps): JSX.Element => {\r\n return (\r\n <Label key={'callEndLabelKey'} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\r\n {'Leave call'}\r\n </Label>\r\n );\r\n };\r\n\r\n return (\r\n <DefaultButton\r\n {...props}\r\n onClick={props.onHangUp ?? props.onClick}\r\n styles={componentStyles}\r\n onRenderIcon={onRenderIcon ?? defaultRenderIcon}\r\n onRenderText={showLabel ? onRenderText ?? defaultRenderText : undefined}\r\n />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { DefaultButton, IButtonProps, Label, concatStyleSets, mergeStyles } from '@fluentui/react';\r\nimport { MicIcon, MicOffIcon } from '@fluentui/react-northstar';\r\nimport { controlButtonLabelStyles, controlButtonStyles } from './styles/ControlBar.styles';\r\n\r\n/**\r\n * Props for MicrophoneButton component\r\n */\r\nexport interface MicrophoneButtonProps extends IButtonProps {\r\n /**\r\n * Whether the label is displayed or not.\r\n * @defaultValue `false`\r\n */\r\n showLabel?: boolean;\r\n\r\n /**\r\n * Utility property for using this component with `communication react eventHandlers`.\r\n * Maps directly to the `onClick` property.\r\n */\r\n onToggleMicrophone?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * `MicrophoneButton` allows you to easily create a component for rendering an audio button. It can be used in your ControlBar component for example.\r\n * @param props - of type MicrophoneButtonProps\r\n */\r\nexport const MicrophoneButton = (props: MicrophoneButtonProps): JSX.Element => {\r\n const { showLabel = false, styles, onRenderIcon, onRenderText } = props;\r\n const componentStyles = concatStyleSets(controlButtonStyles, styles ?? {});\r\n\r\n const defaultRenderIcon = (props?: IButtonProps): JSX.Element => {\r\n return props?.checked ? <MicIcon key={'microphoneIconKey'} /> : <MicOffIcon key={'microphoneOffIconKey'} />;\r\n };\r\n\r\n const defaultRenderText = (props?: IButtonProps): JSX.Element => {\r\n return (\r\n <Label key={'microphoneLabelKey'} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\r\n {props?.checked ? 'Mute' : 'Unmute'}\r\n </Label>\r\n );\r\n };\r\n\r\n return (\r\n <DefaultButton\r\n {...props}\r\n onClick={props.onToggleMicrophone ?? props.onClick}\r\n styles={componentStyles}\r\n onRenderIcon={onRenderIcon ?? defaultRenderIcon}\r\n onRenderText={showLabel ? onRenderText ?? defaultRenderText : undefined}\r\n />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { DefaultButton, IButtonProps, Label, concatStyleSets, mergeStyles } from '@fluentui/react';\r\nimport { MoreIcon } from '@fluentui/react-northstar';\r\nimport { controlButtonLabelStyles, controlButtonStyles } from './styles/ControlBar.styles';\r\n\r\n/**\r\n * Props for OptionsButton component\r\n */\r\nexport interface OptionsButtonProps extends IButtonProps {\r\n /**\r\n * Whether the label is displayed or not.\r\n * @defaultValue `false`\r\n */\r\n showLabel?: boolean;\r\n\r\n /**\r\n * Utility props for stateful props.\r\n */\r\n microphones?: [{ id: string; name: string }];\r\n speakers?: [{ id: string; name: string }];\r\n cameras?: [{ id: string; name: string }];\r\n selectedMicrophone?: { id: string; name: string };\r\n selectedSpeaker?: { id: string; name: string };\r\n selectedCamera?: { id: string; name: string };\r\n onSelectCamera?: (device: any) => Promise<void>;\r\n onSelectMicrophone?: (device: any) => Promise<void>;\r\n onSelectSpeaker?: (device: any) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Generates default menuprops for an OptionsButton if the props contain device\r\n * information and device change handlers.\r\n * @param props OptionsButtonProps\r\n * @returns MenuProps\r\n */\r\nconst generateDefaultMenuProps = (props: OptionsButtonProps): { items: Array<any> } => {\r\n const {\r\n microphones,\r\n speakers,\r\n cameras,\r\n selectedMicrophone,\r\n selectedSpeaker,\r\n selectedCamera,\r\n onSelectCamera,\r\n onSelectMicrophone,\r\n onSelectSpeaker\r\n } = props;\r\n\r\n const defaultMenuProps: { items: Array<any> } = { items: [] };\r\n\r\n if (cameras && selectedCamera && onSelectCamera) {\r\n defaultMenuProps.items.push({\r\n key: '1',\r\n name: 'Choose Camera',\r\n iconProps: { iconName: 'LocationCircle' },\r\n subMenuProps: {\r\n items: cameras.map((val) => ({\r\n key: val.id,\r\n text: val.name,\r\n title: val.name,\r\n canCheck: true,\r\n isChecked: val.id === selectedCamera?.id,\r\n onClick: () => !(val.id === selectedCamera?.id) && onSelectCamera(val)\r\n }))\r\n }\r\n });\r\n }\r\n\r\n if (microphones && selectedMicrophone && onSelectMicrophone) {\r\n defaultMenuProps.items.push({\r\n key: '2',\r\n name: 'Choose Microphone',\r\n iconProps: { iconName: 'LocationCircle' },\r\n subMenuProps: {\r\n items: microphones.map((val) => ({\r\n key: val.id,\r\n text: val.name,\r\n title: val.name,\r\n canCheck: true,\r\n isChecked: val.id === selectedMicrophone?.id,\r\n onClick: () => !(val.id === selectedMicrophone?.id) && onSelectMicrophone(val)\r\n }))\r\n }\r\n });\r\n }\r\n\r\n if (speakers && selectedSpeaker && onSelectSpeaker) {\r\n defaultMenuProps.items.push({\r\n key: '3',\r\n name: 'Choose Speaker',\r\n iconProps: { iconName: 'LocationCircle' },\r\n subMenuProps: {\r\n items: speakers.map((val) => ({\r\n key: val.id,\r\n text: val.name,\r\n title: val.name,\r\n canCheck: true,\r\n isChecked: val.id === selectedSpeaker?.id,\r\n onClick: () => !(val.id === selectedSpeaker?.id) && onSelectSpeaker(val)\r\n }))\r\n }\r\n });\r\n }\r\n\r\n return defaultMenuProps;\r\n};\r\n\r\n/**\r\n * `OptionsButton` allows you to easily create a component for rendering an options button. It can be used in your ControlBar component for example.\r\n * This button should contain dropdown menu items you can define through its property `menuProps`.\r\n * This `menuProps` property is of type [IContextualMenuProps](https://developer.microsoft.com/en-us/fluentui#/controls/web/contextualmenu#IContextualMenuProps).\r\n *\r\n * @param props - of type OptionsButtonProps\r\n */\r\nexport const OptionsButton = (props: OptionsButtonProps): JSX.Element => {\r\n const { showLabel = false, styles, onRenderIcon, onRenderText } = props;\r\n\r\n const defaultMenuProps = generateDefaultMenuProps(props);\r\n\r\n const componentStyles = concatStyleSets(controlButtonStyles, styles ?? {});\r\n\r\n const defaultRenderIcon = (): JSX.Element => {\r\n return <MoreIcon key={'optionsIconKey'} />;\r\n };\r\n\r\n const defaultRenderText = (props?: IButtonProps): JSX.Element => {\r\n return (\r\n <Label key={'optionsLabelKey'} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\r\n {'Options'}\r\n </Label>\r\n );\r\n };\r\n\r\n return (\r\n <DefaultButton\r\n {...props}\r\n menuProps={defaultMenuProps ?? props.menuProps}\r\n menuIconProps={{ hidden: true }}\r\n styles={componentStyles}\r\n onRenderIcon={onRenderIcon ?? defaultRenderIcon}\r\n onRenderText={showLabel ? onRenderText ?? defaultRenderText : undefined}\r\n />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { DefaultButton, IButtonProps, Label, concatStyleSets, mergeStyles } from '@fluentui/react';\r\nimport { CallControlCloseTrayIcon, CallControlPresentNewIcon } from '@fluentui/react-northstar';\r\nimport { controlButtonLabelStyles, controlButtonStyles } from './styles/ControlBar.styles';\r\n\r\n/**\r\n * Props for ScreenShareButton component\r\n */\r\nexport interface ScreenShareButtonProps extends IButtonProps {\r\n /**\r\n * Whether the label is displayed or not.\r\n * @defaultValue `false`\r\n */\r\n showLabel?: boolean;\r\n\r\n /**\r\n * Utility property for using this component with `communication react eventHandlers`.\r\n * Maps directly to the `onClick` property.\r\n */\r\n onToggleScreenShare?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * `ScreenShareButton` allows you to easily create a component for rendering a screen-share button.\r\n * It can be used in your ControlBar component for example.\r\n *\r\n * @param props - of type ScreenShareButtonProps\r\n */\r\nexport const ScreenShareButton = (props: ScreenShareButtonProps): JSX.Element => {\r\n const { showLabel = false, styles, onRenderIcon, onRenderText } = props;\r\n const componentStyles = concatStyleSets(controlButtonStyles, styles ?? {});\r\n\r\n const defaultRenderIcon = (props?: IButtonProps): JSX.Element => {\r\n return props?.checked ? (\r\n <CallControlCloseTrayIcon key={'screenShareIconKey'} />\r\n ) : (\r\n <CallControlPresentNewIcon key={'screenShareBorderedIconKey'} bordered={false} />\r\n );\r\n };\r\n\r\n const defaultRenderText = (props?: IButtonProps): JSX.Element => {\r\n return (\r\n <Label key={'screenShareLabelKey'} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\r\n {props?.checked ? 'Stop' : 'Share'}\r\n </Label>\r\n );\r\n };\r\n\r\n return (\r\n <DefaultButton\r\n {...props}\r\n onClick={props.onToggleScreenShare ?? props.onClick}\r\n styles={componentStyles}\r\n onRenderIcon={onRenderIcon ?? defaultRenderIcon}\r\n onRenderText={showLabel ? onRenderText ?? defaultRenderText : undefined}\r\n />\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useState, useEffect } from 'react';\r\nimport { mergeStyles } from '@fluentui/react';\r\nimport { ThemeProvider, Theme, PartialTheme } from '@fluentui/react-theme-provider';\r\nimport { mergeThemes, Provider, teamsTheme, ThemeInput } from '@fluentui/react-northstar';\r\nimport { lightTheme } from './themes';\r\n\r\n/**\r\n * Props for FluentThemeProvider\r\n */\r\nexport interface FluentThemeProviderProps {\r\n /** Children to be themed. */\r\n children: React.ReactNode;\r\n /** Optional theme state for FluentThemeProvider. Defaults to a light theme if not provided. */\r\n fluentTheme?: PartialTheme | Theme;\r\n}\r\n\r\nconst wrapper = mergeStyles({\r\n height: '100%',\r\n width: '100%'\r\n});\r\n\r\nconst initialFluentNorthstarTheme = mergeThemes(teamsTheme, {\r\n componentVariables: {\r\n // suppressing teams theme for chat message links to get better styling from Fluent UI Link\r\n ChatMessage: {\r\n linkColor: undefined,\r\n linkColorMine: undefined\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * @description Provider to apply a Fluent theme across this library's react components.\r\n * @remarks Components in this library are composed primarily from [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/controls/web),\r\n * controls, and also from [Fluent React Northstar](https://fluentsite.z22.web.core.windows.net/0.53.0) controls.\r\n * This provider handles applying any theme provided to both the underlying Fluent UI controls, as well as the Fluent React Northstar controls.\r\n */\r\nexport const FluentThemeProvider = (props: FluentThemeProviderProps): JSX.Element => {\r\n const { fluentTheme, children } = props;\r\n // if fluentTheme is not provided, default to light theme\r\n const fluentUITheme = fluentTheme ?? lightTheme;\r\n const [fluentNorthstarTheme, setFluentNorthstarTheme] = useState<ThemeInput<any>>(initialFluentNorthstarTheme);\r\n\r\n useEffect(() => {\r\n setFluentNorthstarTheme(\r\n mergeThemes(initialFluentNorthstarTheme, {\r\n componentVariables: {\r\n Chat: {\r\n backgroundColor: fluentUITheme?.palette?.white\r\n },\r\n ChatMessage: {\r\n authorColor: fluentUITheme?.palette?.neutralPrimary,\r\n contentColor: fluentUITheme?.palette?.neutralPrimary,\r\n backgroundColor: fluentUITheme?.palette?.neutralLighter,\r\n backgroundColorMine: fluentUITheme?.palette?.themeLight\r\n }\r\n },\r\n componentStyles: {\r\n ChatMessage: {\r\n timestamp: {\r\n WebkitTextFillColor: fluentUITheme?.palette?.neutralSecondary\r\n }\r\n }\r\n }\r\n // add more northstar components to align with Fluent UI theme\r\n })\r\n );\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [fluentUITheme]);\r\n\r\n return (\r\n <ThemeProvider theme={fluentUITheme} className={wrapper}>\r\n <Provider theme={fluentNorthstarTheme} className={wrapper}>\r\n {children}\r\n </Provider>\r\n </ThemeProvider>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReactElement } from 'react';\r\nimport { StatefulCallClient } from 'calling-stateful-client';\r\nimport { createDefaultCallingHandlersForComponent } from '../handlers/createHandlers';\r\nimport { useCall, useCallAgent, useCallClient, useDeviceManager } from '../providers';\r\n// @ts-ignore\r\nimport { CommonProperties } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { DefaultCallingHandlers } from '../handlers/createHandlers';\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\r\nexport const useHandlers = <PropsT>(component: (props: PropsT) => ReactElement | null) => {\r\n const callClient: StatefulCallClient = useCallClient() as any;\r\n const callAgent = useCallAgent();\r\n const deviceManager = useDeviceManager();\r\n const call = useCall();\r\n\r\n return createDefaultCallingHandlersForComponent(callClient, callAgent, deviceManager, call, component);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallClientState, StatefulCallClient } from 'calling-stateful-client';\r\nimport { useCall, useCallClient } from '../providers';\r\n\r\nimport { useState, useEffect, useRef, useMemo } from 'react';\r\n\r\nexport const useSelector = <SelectorT extends (state: CallClientState, props: any) => any>(\r\n selector: SelectorT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n const callClient: StatefulCallClient = useCallClient() as any;\r\n const callId = useCall()?.id;\r\n\r\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\r\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\r\n const mounted = useRef(false);\r\n\r\n useEffect(() => {\r\n mounted.current = true;\r\n return () => {\r\n mounted.current = false;\r\n };\r\n });\r\n\r\n const callIdConfigProps = useMemo(\r\n () => ({\r\n callId\r\n }),\r\n [callId]\r\n );\r\n\r\n const [props, setProps] = useState(selector(callClient.getState(), selectorProps ?? callIdConfigProps));\r\n const propRef = useRef(props);\r\n propRef.current = props;\r\n useEffect(() => {\r\n const onStateChange = (state: CallClientState): void => {\r\n if (!mounted.current) {\r\n return;\r\n }\r\n const newProps = selector(state, selectorProps ?? callIdConfigProps);\r\n if (propRef.current !== newProps) {\r\n setProps(newProps);\r\n }\r\n };\r\n callClient.onStateChange(onStateChange);\r\n return () => {\r\n callClient.offStateChange(onStateChange);\r\n };\r\n }, [callClient, selector, selectorProps, callIdConfigProps, mounted]);\r\n return props;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n CameraButton,\r\n EndCallButton,\r\n MicrophoneButton,\r\n OptionsButton,\r\n ParticipantList,\r\n ScreenShareButton,\r\n VideoGallery\r\n} from 'react-components';\r\nimport {\r\n cameraButtonSelector,\r\n microphoneButtonSelector,\r\n optionsButtonSelector,\r\n screenShareButtonSelector\r\n} from '../callControlSelectors';\r\nimport { videoGallerySelector } from '../videoGallerySelector';\r\nimport { participantListSelector } from '../participantListSelector';\r\nimport { useHandlers } from './useHandlers';\r\nimport { useSelector } from './useSelector';\r\nimport { Common } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { CommonProperties, AreEqual } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { DefaultCallingHandlers } from '../handlers/createHandlers';\r\n// @ts-ignore\r\nimport { AudioDeviceInfo, StartCallOptions, Call, VideoDeviceInfo } from '@azure/communication-calling';\r\n// @ts-ignore\r\nimport { CommunicationUserIdentifier, PhoneNumberIdentifier, UnknownIdentifier } from '@azure/communication-common';\r\n// @ts-ignore\r\nimport { VideoStreamOptions, CallParticipant, VideoGalleryRemoteParticipant } from 'react-components';\r\n\r\n// @ts-ignore\r\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\r\n component: Component\r\n): ReturnType<GetSelector<Component>> & Common<DefaultCallingHandlers, Parameters<Component>[0]> => {\r\n const selector = getSelector(component);\r\n return { ...useSelector(selector), ...useHandlers<Parameters<Component>[0]>(component) };\r\n};\r\n\r\nconst emptySelector = (): Record<string, never> => ({});\r\nexport const endCallButtonSelector = emptySelector;\r\nexport type GetSelector<Component> = AreEqual<Component, typeof VideoGallery> extends true\r\n ? typeof videoGallerySelector\r\n : AreEqual<Component, typeof MicrophoneButton> extends true\r\n ? typeof microphoneButtonSelector\r\n : AreEqual<Component, typeof CameraButton> extends true\r\n ? typeof cameraButtonSelector\r\n : AreEqual<Component, typeof ScreenShareButton> extends true\r\n ? typeof screenShareButtonSelector\r\n : AreEqual<Component, typeof OptionsButton> extends true\r\n ? typeof optionsButtonSelector\r\n : AreEqual<Component, typeof ParticipantList> extends true\r\n ? typeof participantListSelector\r\n : AreEqual<Component, typeof EndCallButton> extends true\r\n ? typeof endCallButtonSelector\r\n : never;\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\r\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\r\n component: Component\r\n): GetSelector<Component> => {\r\n return findSelector(component);\r\n};\r\n\r\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\r\n switch (component) {\r\n case VideoGallery:\r\n return videoGallerySelector;\r\n case MicrophoneButton:\r\n return microphoneButtonSelector;\r\n case CameraButton:\r\n return cameraButtonSelector;\r\n case ScreenShareButton:\r\n return screenShareButtonSelector;\r\n case OptionsButton:\r\n return optionsButtonSelector;\r\n case ParticipantList:\r\n return participantListSelector;\r\n case EndCallButton:\r\n return emptySelector;\r\n }\r\n throw 'Can\\'t find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.';\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReactElement } from 'react';\r\nimport { Common, fromFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { StatefulChatClient } from 'chat-stateful-client';\r\nimport { ChatThreadClient } from '@azure/communication-chat';\r\nimport memoizeOne from 'memoize-one';\r\n\r\n// @ts-ignore\r\nimport { CommonProperties } from 'acs-ui-common';\r\n\r\nexport type DefaultChatHandlers = {\r\n onSendMessage: (content: string) => Promise<void>;\r\n onMessageSeen: (chatMessageId: string) => Promise<void>;\r\n onTyping: () => Promise<void>;\r\n onParticipantRemove: (userId: string) => Promise<void>;\r\n updateThreadTopicName: (topicName: string) => Promise<void>;\r\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\r\n};\r\n\r\n// Keep all these handlers the same instance(unless client changed) to avoid re-render\r\nexport const createDefaultChatHandlers = memoizeOne(\r\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): DefaultChatHandlers => {\r\n const messageIterator = chatThreadClient.listMessages();\r\n return {\r\n onSendMessage: async (content: string) => {\r\n const sendMessageRequest = {\r\n content,\r\n senderDisplayName: chatClient.getState().displayName\r\n };\r\n await chatThreadClient.sendMessage(sendMessageRequest);\r\n },\r\n // This handler is designed for chatThread to consume\r\n onMessageSeen: async (chatMessageId: string) => {\r\n await chatThreadClient.sendReadReceipt({ chatMessageId });\r\n },\r\n onTyping: async () => {\r\n await chatThreadClient.sendTypingNotification();\r\n },\r\n onParticipantRemove: async (userId: string) => {\r\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\r\n },\r\n updateThreadTopicName: async (topicName: string) => {\r\n await chatThreadClient.updateTopic(topicName);\r\n },\r\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\r\n let remainingMessagesToGet = messagesToLoad;\r\n let isAllChatMessagesLoaded = false;\r\n while (remainingMessagesToGet >= 1) {\r\n const message = await messageIterator.next();\r\n if (message.value?.type && message.value.type === 'text') remainingMessagesToGet--;\r\n // We have traversed all messages in this thread\r\n if (message.done) {\r\n isAllChatMessagesLoaded = true;\r\n break;\r\n }\r\n }\r\n\r\n return isAllChatMessagesLoaded;\r\n }\r\n };\r\n }\r\n);\r\n\r\n// These could be shared functions between Chat and Calling\r\nexport const defaultHandlerCreator = (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) => <Props>(\r\n _: (props: Props) => ReactElement | null\r\n): Common<DefaultChatHandlers, Props> => {\r\n return createDefaultChatHandlers(chatClient, chatThreadClient);\r\n};\r\n\r\nexport const createDefaultChatHandlersForComponent = <Props>(\r\n chatClient: StatefulChatClient,\r\n chatThreadClient: ChatThreadClient,\r\n _: (props: Props) => ReactElement | null\r\n): Common<DefaultChatHandlers, Props> => {\r\n return createDefaultChatHandlers(chatClient, chatThreadClient);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { createContext, useContext } from 'react';\r\nimport { StatefulChatClient } from 'chat-stateful-client';\r\n\r\nexport const ChatClientContext = createContext<StatefulChatClient | undefined>(undefined);\r\n\r\nexport type ChatClientProviderProps = {\r\n children: React.ReactNode;\r\n chatClient: StatefulChatClient;\r\n};\r\n\r\n/**\r\n * ChatClientProvider requires valid StatefulChatClient. It provides a global access to the\r\n * stateful chat client for the contoso app\r\n *\r\n * @param props - only one parameter StatefulChatClient\r\n */\r\nexport const ChatClientProvider = (props: ChatClientProviderProps): JSX.Element => {\r\n return <ChatClientContext.Provider value={props.chatClient}>{props.children}</ChatClientContext.Provider>;\r\n};\r\n\r\nexport const useChatClient = (): StatefulChatClient => {\r\n const chatClient = useContext(ChatClientContext);\r\n if (!chatClient)\r\n throw 'Please wrap components with ChatClientProvider and initialize a chat client before calling the hook!';\r\n return chatClient;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { createContext, useContext } from 'react';\r\nimport { ChatThreadClient } from '@azure/communication-chat';\r\n\r\nexport const ChatThreadClientContext = createContext<ChatThreadClient | undefined>(undefined);\r\n\r\nexport type ChatThreadClientProviderProps = {\r\n children: React.ReactNode;\r\n chatThreadClient: ChatThreadClient;\r\n};\r\n\r\n/**\r\n * ChatThreadClientProvider requires valid StatefulChatThreadClient. It provides a global access to the\r\n * stateful chat thread client for the contoso app\r\n *\r\n * @param props - includes one parameter StatefulChatThreadClient\r\n */\r\nexport const ChatThreadClientProvider = (props: ChatThreadClientProviderProps): JSX.Element => {\r\n return (\r\n <ChatThreadClientContext.Provider value={props.chatThreadClient}>{props.children}</ChatThreadClientContext.Provider>\r\n );\r\n};\r\n\r\nexport const useChatThreadClient = (): ChatThreadClient => {\r\n const chatThreadClient = useContext(ChatThreadClientContext);\r\n if (!chatThreadClient)\r\n throw 'Please wrap components with ChatThreadClientProvider and initialize a chat thread client before calling the hook.';\r\n return chatThreadClient;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { StatefulChatClient } from 'chat-stateful-client';\r\nimport { createDefaultChatHandlersForComponent } from '../handlers/createHandlers';\r\nimport { useChatClient } from '../providers/ChatClientProvider';\r\nimport { useChatThreadClient } from '../providers/ChatThreadClientProvider';\r\nimport { ReactElement } from 'react';\r\nimport { Common } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { DefaultChatHandlers } from '../handlers/createHandlers';\r\n\r\nexport const useHandlers = <PropsT>(\r\n component: (props: PropsT) => ReactElement | null\r\n): Common<DefaultChatHandlers, PropsT> => {\r\n const chatClient: StatefulChatClient = useChatClient() as any;\r\n const chatThreadClient = useChatThreadClient();\r\n if (!chatThreadClient) {\r\n throw 'Please initialize chatThreadClient first!';\r\n }\r\n\r\n return createDefaultChatHandlersForComponent(chatClient, chatThreadClient, component);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClientState, StatefulChatClient } from 'chat-stateful-client';\r\nimport { useChatClient } from '../providers/ChatClientProvider';\r\n\r\nimport { useState, useEffect, useRef, useMemo } from 'react';\r\nimport { useChatThreadClient } from '../providers/ChatThreadClientProvider';\r\n\r\n// This function highly depends on chatClient.onChange event\r\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\r\nexport const useSelector = <SelectorT extends (state: ChatClientState, props: any) => any>(\r\n selector: SelectorT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n const chatClient: StatefulChatClient = useChatClient() as any;\r\n const threadId = useChatThreadClient().threadId;\r\n\r\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\r\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\r\n const mounted = useRef(false);\r\n\r\n useEffect(() => {\r\n mounted.current = true;\r\n return () => {\r\n mounted.current = false;\r\n };\r\n });\r\n\r\n const threadConfigProps = useMemo(\r\n () => ({\r\n threadId\r\n }),\r\n [threadId]\r\n );\r\n\r\n const [props, setProps] = useState(selector(chatClient.getState(), selectorProps ?? threadConfigProps));\r\n const propRef = useRef(props);\r\n propRef.current = props;\r\n useEffect(() => {\r\n const onStateChange = (state: ChatClientState): void => {\r\n if (!mounted.current) {\r\n return;\r\n }\r\n const newProps = selector(state, selectorProps ?? threadConfigProps);\r\n if (propRef.current !== newProps) {\r\n setProps(newProps);\r\n }\r\n };\r\n chatClient.onStateChange(onStateChange);\r\n return () => {\r\n chatClient.offStateChange(onStateChange);\r\n };\r\n }, [chatClient, selector, selectorProps, threadConfigProps]);\r\n return props;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClientState, ChatMessageWithStatus } from 'chat-stateful-client';\r\nimport { ChatParticipant, ChatMessageReadReceipt } from '@azure/communication-chat';\r\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { MessageContentType } from 'react-components';\r\nexport type ChatBaseSelectorProps = {\r\n threadId: string;\r\n};\r\n\r\nexport const getSelectorProps = <T>(_: ChatClientState, props: T): T => props;\r\nexport const getUserId = (state: ChatClientState): string => toFlatCommunicationIdentifier(state.userId);\r\n\r\nexport const getDisplayName = (state: ChatClientState): string => state.displayName;\r\nexport const getChatMessages = (\r\n state: ChatClientState,\r\n props: ChatBaseSelectorProps\r\n): Map<string, ChatMessageWithStatus> =>\r\n (props.threadId && state.threads.get(props.threadId)?.chatMessages) || new Map();\r\n\r\nexport const getReadReceipts = (state: ChatClientState, props: ChatBaseSelectorProps): ChatMessageReadReceipt[] =>\r\n (props.threadId && state.threads.get(props.threadId)?.readReceipts) || [];\r\n\r\nexport const getParticipants = (state: ChatClientState, props: ChatBaseSelectorProps): Map<string, ChatParticipant> =>\r\n (props.threadId && state.threads.get(props.threadId)?.participants) || new Map();\r\n\r\nexport const getIsLargeGroup = (state: ChatClientState, props: ChatBaseSelectorProps): boolean => {\r\n const participants = state.threads.get(props.threadId)?.participants;\r\n return !!participants && participants.size > 20;\r\n};\r\n\r\nexport const getLatestReadTime = (state: ChatClientState, props: ChatBaseSelectorProps): Date =>\r\n (props.threadId && state.threads.get(props.threadId)?.latestReadTime) || new Date(0);\r\n\r\nexport const getTopicName = (state: ChatClientState, props: ChatBaseSelectorProps): string => {\r\n return state.threads.get(props.threadId)?.properties?.topic || '';\r\n};\r\n\r\nexport const getTypingIndicators = (\r\n state: ChatClientState,\r\n props: ChatBaseSelectorProps\r\n): TypingIndicatorReceivedEvent[] => {\r\n return (props.threadId && state.threads.get(props.threadId)?.typingIndicators) || [];\r\n};\r\n\r\nexport const sanitizedMessageContentType = (type: string): MessageContentType => {\r\n const lowerCaseType = type.toLowerCase();\r\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\r\n ? lowerCaseType\r\n : 'unknown';\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { createSelector } from 'reselect';\r\nimport { getDisplayName, getUserId } from './baseSelectors';\r\n\r\n// The following need explicitly imported to avoid api-extractor issues.\r\n// These can be removed once https://github.com/microsoft/rushstack/pull/1916 is fixed.\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { ChatClientState } from 'chat-stateful-client';\r\n// @ts-ignore\r\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\r\n// @ts-ignore\r\nimport { ChatBaseSelectorProps } from './baseSelectors';\r\n\r\nexport const sendBoxSelector = createSelector([getUserId, getDisplayName], (userId, displayName) => ({\r\n displayName: displayName,\r\n userId: userId\r\n}));\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatMessage } from 'react-components';\r\n\r\nexport const compareMessages = (firstMessage: ChatMessage, secondMessage: ChatMessage): number => {\r\n if (firstMessage.payload.createdOn === undefined) return 1;\r\n if (secondMessage.payload.createdOn === undefined) return -1;\r\n const firstDate = new Date(firstMessage.payload.createdOn).getTime();\r\n const secondDate = new Date(secondMessage.payload.createdOn).getTime();\r\n return firstDate - secondDate;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n getChatMessages,\r\n getIsLargeGroup,\r\n getLatestReadTime,\r\n getUserId,\r\n sanitizedMessageContentType\r\n} from './baseSelectors';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { ChatMessageWithStatus } from 'chat-stateful-client';\r\n// The following need explicitly imported to avoid api-extractor issues.\r\n// These can be removed once https://github.com/microsoft/rushstack/pull/1916 is fixed.\r\n// @ts-ignore\r\nimport * as reselect from 'reselect';\r\n// @ts-ignore\r\nimport { ChatMessageContent, ChatParticipant } from '@azure/communication-chat';\r\n// @ts-ignore\r\nimport { ChatClientState } from 'chat-stateful-client';\r\n// @ts-ignore\r\nimport { ChatBaseSelectorProps } from './baseSelectors';\r\n// @ts-ignore\r\nimport { memoizeFnAll } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { ChatMessage, MessageAttachedStatus, Message, MessageTypes } from 'react-components';\r\n// @ts-ignore\r\nimport { createSelector } from 'reselect';\r\n// @ts-ignore\r\nimport { compareMessages } from './utils/compareMessages';\r\n\r\nconst memoizedAllConvertChatMessage = memoizeFnAll(\r\n (\r\n _key: string,\r\n chatMessage: ChatMessageWithStatus,\r\n userId: string,\r\n isSeen: boolean,\r\n isLargeGroup: boolean\r\n ): ChatMessage => ({\r\n type: 'chat',\r\n payload: {\r\n createdOn: chatMessage.createdOn,\r\n content: chatMessage.content?.message,\r\n type: sanitizedMessageContentType(chatMessage.type),\r\n status: !isLargeGroup && chatMessage.status === 'delivered' && isSeen ? 'seen' : chatMessage.status,\r\n senderDisplayName: chatMessage.senderDisplayName,\r\n senderId: chatMessage.sender !== undefined ? toFlatCommunicationIdentifier(chatMessage.sender) : userId,\r\n messageId: chatMessage.id,\r\n clientMessageId: chatMessage.clientMessageId\r\n }\r\n })\r\n);\r\n\r\nexport const chatThreadSelector = createSelector(\r\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup],\r\n (userId, chatMessages, latestReadTime, isLargeGroup) => {\r\n // A function takes parameter above and generate return value\r\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\r\n Array.from(chatMessages.values())\r\n .filter(\r\n (message) =>\r\n message.type.toLowerCase() === 'text' ||\r\n message.type.toLowerCase() === 'richtext/html' ||\r\n message.clientMessageId !== undefined\r\n )\r\n .map((message) =>\r\n memoizedFn(\r\n message.id ?? message.clientMessageId,\r\n message,\r\n userId,\r\n message.createdOn <= latestReadTime,\r\n isLargeGroup\r\n )\r\n )\r\n );\r\n\r\n updateMessagesWithAttached(convertedMessages, userId);\r\n return {\r\n userId,\r\n showMessageStatus: !isLargeGroup,\r\n messages: convertedMessages\r\n };\r\n }\r\n);\r\n\r\nexport const updateMessagesWithAttached = (chatMessagesWithStatus: ChatMessage[], userId: string): void => {\r\n chatMessagesWithStatus.sort(compareMessages);\r\n\r\n chatMessagesWithStatus.forEach((message, index, messages) => {\r\n const mine = message.payload.senderId === userId;\r\n /**\r\n * A block of messages: continuous messages that belong to the same sender and not intercepted by other senders.\r\n *\r\n * Attacthed is the index of the last message in the previous block of messages which mine===true.\r\n * This message's statusToRender will be reset when there's a new block of messages which mine===true. (Because\r\n * in this case, we only want to show the read statusToRender of last message of the new messages block)\r\n */\r\n let attached: boolean | MessageAttachedStatus = false;\r\n if (index === 0) {\r\n if (index !== messages.length - 1) {\r\n //the next message has the same sender\r\n if (messages[index].payload.senderId === messages[index + 1].payload.senderId) {\r\n attached = 'top';\r\n }\r\n }\r\n } else {\r\n if (messages[index].payload.senderId === messages[index - 1].payload.senderId) {\r\n //the previous message has the same sender\r\n if (index !== messages.length - 1) {\r\n if (messages[index].payload.senderId === messages[index + 1].payload.senderId) {\r\n //the next message has the same sender\r\n attached = true;\r\n } else {\r\n //the next message has a different sender\r\n attached = 'bottom';\r\n }\r\n } else {\r\n // this is the last message of the whole messages list\r\n attached = 'bottom';\r\n }\r\n } else {\r\n //the previous message has a different sender\r\n if (index !== messages.length - 1) {\r\n if (messages[index].payload.senderId === messages[index + 1].payload.senderId) {\r\n //the next message has the same sender\r\n attached = 'top';\r\n }\r\n }\r\n }\r\n }\r\n message.payload.attached = attached;\r\n message.payload.mine = mine;\r\n });\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nexport const MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS = 8000;\r\nexport const PARTICIPANTS_THRESHOLD = 20;\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// @ts-ignore\r\nimport { ChatClientState } from 'chat-stateful-client';\r\n// @ts-ignore\r\nimport { ChatBaseSelectorProps } from './baseSelectors';\r\nimport { getTypingIndicators, getParticipants, getUserId } from './baseSelectors';\r\nimport * as reselect from 'reselect';\r\nimport { ChatParticipant } from '@azure/communication-chat';\r\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { CommunicationParticipant } from 'react-components';\r\nimport { MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS, PARTICIPANTS_THRESHOLD } from './utils/constants';\r\n\r\nconst filterTypingIndicators = (\r\n typingIndicators: TypingIndicatorReceivedEvent[],\r\n userId: string\r\n): TypingIndicatorReceivedEvent[] => {\r\n const filteredTypingIndicators: TypingIndicatorReceivedEvent[] = [];\r\n const seen = new Set();\r\n const date8SecondsAgo = new Date(Date.now() - MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS);\r\n for (let i = typingIndicators.length - 1; i >= 0; i--) {\r\n const typingIndicator = typingIndicators[i];\r\n if (toFlatCommunicationIdentifier(typingIndicator.sender) === userId) {\r\n continue;\r\n }\r\n if (typingIndicator.receivedOn < date8SecondsAgo) {\r\n continue;\r\n }\r\n if (seen.has(toFlatCommunicationIdentifier(typingIndicator.sender))) {\r\n continue;\r\n }\r\n seen.add(toFlatCommunicationIdentifier(typingIndicator.sender));\r\n filteredTypingIndicators.push(typingIndicator);\r\n }\r\n return filteredTypingIndicators;\r\n};\r\n\r\nconst convertSdkTypingIndicatorsToCommunicationParticipants = (\r\n typingIndicators: TypingIndicatorReceivedEvent[],\r\n participants: Map<string, ChatParticipant>\r\n): CommunicationParticipant[] => {\r\n return typingIndicators.map((typingIndicator) => ({\r\n userId: toFlatCommunicationIdentifier(typingIndicator.sender),\r\n displayName: participants.get(toFlatCommunicationIdentifier(typingIndicator.sender))?.displayName\r\n }));\r\n};\r\n\r\nexport const typingIndicatorSelector = reselect.createSelector(\r\n [getTypingIndicators, getParticipants, getUserId],\r\n (typingIndicators: TypingIndicatorReceivedEvent[], participants: Map<string, ChatParticipant>, userId: string) => {\r\n // if the participant size reaches the threshold then return no typing users\r\n if (participants.size >= PARTICIPANTS_THRESHOLD) {\r\n return { typingUsers: [] };\r\n }\r\n\r\n // filter typing indicators to remove those that are from the duplicate users or current user as well as those older than a threshold\r\n const filteredTypingIndicators = filterTypingIndicators(typingIndicators, userId);\r\n\r\n const typingUsers: CommunicationParticipant[] = convertSdkTypingIndicatorsToCommunicationParticipants(\r\n filteredTypingIndicators,\r\n participants\r\n );\r\n\r\n return { typingUsers };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n// @ts-ignore\r\nimport { ChatClientState } from 'chat-stateful-client';\r\n// @ts-ignore\r\nimport { ChatBaseSelectorProps } from './baseSelectors';\r\nimport { getUserId, getDisplayName, getParticipants } from './baseSelectors';\r\nimport * as reselect from 'reselect';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { ChatParticipant } from '@azure/communication-chat';\r\nimport { CommunicationParticipant } from 'react-components';\r\n\r\nconst convertChatParticipantsToCommunicationParticipants = (\r\n chatParticipants: ChatParticipant[]\r\n): CommunicationParticipant[] => {\r\n return chatParticipants.map((participant: ChatParticipant) => {\r\n return {\r\n userId: toFlatCommunicationIdentifier(participant.id),\r\n displayName: participant.displayName\r\n };\r\n });\r\n};\r\n\r\n/**\r\n * get the index of moderator to help updating its display name if they are the local user or removing them from list of participants otherwise\r\n */\r\nconst moderatorIndex = (participants: CommunicationParticipant[]): number => {\r\n return participants.map((p) => p.displayName).indexOf(undefined);\r\n};\r\n\r\nexport const chatParticipantListSelector = reselect.createSelector(\r\n [getUserId, getParticipants, getDisplayName],\r\n (userId, chatParticipants: Map<string, ChatParticipant>, displayName) => {\r\n let participants = convertChatParticipantsToCommunicationParticipants(Array.from(chatParticipants.values()));\r\n if (0 !== participants.length) {\r\n const moderatorIdx = moderatorIndex(participants);\r\n\r\n if (-1 !== moderatorIdx) {\r\n const userIndex = participants.map((p) => p.userId).indexOf(userId);\r\n if (moderatorIdx === userIndex) {\r\n participants[moderatorIdx].displayName = displayName;\r\n } else {\r\n participants = participants.filter((p) => p.displayName);\r\n }\r\n }\r\n }\r\n\r\n return {\r\n myUserId: userId,\r\n participants: participants\r\n };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport { MessageThread, ParticipantList, SendBox, TypingIndicator } from 'react-components';\r\n\r\nimport { useHandlers } from './useHandlers';\r\nimport { useSelector } from './useSelector';\r\nimport { sendBoxSelector } from '../sendBoxSelector';\r\nimport { chatThreadSelector } from '../chatThreadSelector';\r\nimport { typingIndicatorSelector } from '../typingIndicatorSelector';\r\nimport { Common } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { CommonProperties, AreEqual } from 'acs-ui-common';\r\n// @ts-ignore\r\nimport { DefaultChatHandlers } from '../handlers/createHandlers';\r\nimport { chatParticipantListSelector } from '../chatParticipantListSelector';\r\n\r\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\r\n component: Component\r\n): ReturnType<GetSelector<Component>> & Common<DefaultChatHandlers, Parameters<Component>[0]> => {\r\n const selector = getSelector(component);\r\n return { ...useSelector(selector), ...useHandlers<Parameters<Component>[0]>(component) };\r\n};\r\n\r\nexport type GetSelector<Component> = AreEqual<Component, typeof SendBox> extends true\r\n ? typeof sendBoxSelector\r\n : AreEqual<Component, typeof MessageThread> extends true\r\n ? typeof chatThreadSelector\r\n : AreEqual<Component, typeof TypingIndicator> extends true\r\n ? typeof typingIndicatorSelector\r\n : never;\r\n\r\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\r\n component: Component\r\n): GetSelector<Component> => {\r\n return findSelector(component);\r\n};\r\n\r\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\r\n switch (component) {\r\n case SendBox:\r\n return sendBoxSelector;\r\n case MessageThread:\r\n return chatThreadSelector;\r\n case TypingIndicator:\r\n return typingIndicatorSelector;\r\n case ParticipantList:\r\n return chatParticipantListSelector;\r\n }\r\n throw 'Can\\'t find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.';\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioDeviceInfo, DeviceAccess, DeviceManager, VideoDeviceInfo } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\n\r\n/**\r\n * Defines the additional methods added by the stateful on top of {@Link @azure/communication-calling#DeviceManager}.\r\n */\r\nexport interface StatefulDeviceManager extends DeviceManager {\r\n /**\r\n * Sets the selectedCamera in the {@Link DeviceManagerState}. This is completely developer driven and is not tied in\r\n * any way to {@Link @azure/communication-calling#DeviceManager}. It is entirely contained in\r\n * {@Link StatefulDeviceManager}. See also {@Link DeviceManagerState.selectedCamera}.\r\n */\r\n selectCamera: (VideoDeviceInfo) => void;\r\n}\r\n\r\n/**\r\n * ProxyDeviceManager proxies DeviceManager and subscribes to all events that affect device manager state. State updates\r\n * are set on the provided context. Also any queries for state are proxied and stored in state as well. Only one device\r\n * manager should exist for a given CallClient so if CallClient.getDeviceManager is called multiple times, either a\r\n * cached ProxyDeviceManager should be returned or the existing ProxyDeviceManager should be destructed via destructor()\r\n * and a new ProxyDeviceManager created.\r\n */\r\nclass ProxyDeviceManager implements ProxyHandler<DeviceManager> {\r\n private _deviceManager: DeviceManager;\r\n private _context: CallContext;\r\n\r\n constructor(deviceManager: DeviceManager, context: CallContext) {\r\n this._deviceManager = deviceManager;\r\n this._context = context;\r\n\r\n this.setDeviceManager();\r\n this.subscribe();\r\n }\r\n\r\n private setDeviceManager = (): void => {\r\n // isSpeakerSelectionAvailable, selectedMicrophone, and selectedSpeaker are properties on DeviceManager. Since they\r\n // are not functions we can't proxy them so we'll update whenever we think they may need updating such as at\r\n // construction time or when certain events happen.\r\n this._context.setDeviceManagerIsSpeakerSelectionAvailable(this._deviceManager.isSpeakerSelectionAvailable);\r\n this._context.setDeviceManagerSelectedMicrophone(this._deviceManager.selectedMicrophone);\r\n this._context.setDeviceManagerSelectedSpeaker(this._deviceManager.selectedSpeaker);\r\n };\r\n\r\n private subscribe = (): void => {\r\n this._deviceManager.on('videoDevicesUpdated', this.videoDevicesUpdated);\r\n this._deviceManager.on('audioDevicesUpdated', this.audioDevicesUpdated);\r\n this._deviceManager.on('selectedMicrophoneChanged', this.selectedMicrophoneChanged);\r\n this._deviceManager.on('selectedSpeakerChanged', this.selectedSpeakerChanged);\r\n };\r\n\r\n /**\r\n * This is used to unsubscribe DeclarativeDeviceManager from the DeviceManager events.\r\n */\r\n public unsubscribe = (): void => {\r\n this._deviceManager.off('videoDevicesUpdated', this.videoDevicesUpdated);\r\n this._deviceManager.off('audioDevicesUpdated', this.audioDevicesUpdated);\r\n this._deviceManager.off('selectedMicrophoneChanged', this.selectedMicrophoneChanged);\r\n this._deviceManager.off('selectedSpeakerChanged', this.selectedSpeakerChanged);\r\n };\r\n\r\n /**\r\n * Used to set a camera inside the proxy device manager.\r\n * @param videoDeviceInfo VideoDeviceInfo\r\n */\r\n public selectCamera = (videoDeviceInfo: VideoDeviceInfo): void => {\r\n this._context.setDeviceManagerSelectedCamera(videoDeviceInfo);\r\n };\r\n\r\n private videoDevicesUpdated = async (): Promise<void> => {\r\n this._context.setDeviceManagerCameras(await this._deviceManager.getCameras());\r\n };\r\n\r\n private audioDevicesUpdated = async (): Promise<void> => {\r\n this._context.setDeviceManagerMicrophones(await this._deviceManager.getMicrophones());\r\n this._context.setDeviceManagerSpeakers(await this._deviceManager.getSpeakers());\r\n };\r\n\r\n private selectedMicrophoneChanged = (): void => {\r\n this._context.setDeviceManagerSelectedMicrophone(this._deviceManager.selectedMicrophone);\r\n };\r\n\r\n private selectedSpeakerChanged = (): void => {\r\n this._context.setDeviceManagerSelectedSpeaker(this._deviceManager.selectedSpeaker);\r\n };\r\n\r\n public get<P extends keyof DeviceManager>(target: DeviceManager, prop: P): any {\r\n switch (prop) {\r\n case 'getCameras': {\r\n return (): Promise<VideoDeviceInfo[]> => {\r\n return target.getCameras().then((cameras: VideoDeviceInfo[]) => {\r\n this._context.setDeviceManagerCameras([...cameras]);\r\n return cameras;\r\n });\r\n };\r\n }\r\n case 'getMicrophones': {\r\n return (): Promise<AudioDeviceInfo[]> => {\r\n return target.getMicrophones().then((microphones: AudioDeviceInfo[]) => {\r\n this._context.setDeviceManagerMicrophones([...microphones]);\r\n return microphones;\r\n });\r\n };\r\n }\r\n case 'getSpeakers': {\r\n return (): Promise<AudioDeviceInfo[]> => {\r\n return target.getSpeakers().then((speakers: AudioDeviceInfo[]) => {\r\n this._context.setDeviceManagerSpeakers([...speakers]);\r\n return speakers;\r\n });\r\n };\r\n }\r\n case 'selectMicrophone': {\r\n return (...args: Parameters<DeviceManager['selectMicrophone']>): Promise<void> => {\r\n return target.selectMicrophone(...args).then(() => {\r\n this._context.setDeviceManagerSelectedMicrophone(target.selectedMicrophone);\r\n });\r\n };\r\n }\r\n case 'selectSpeaker': {\r\n return (...args: Parameters<DeviceManager['selectSpeaker']>): Promise<void> => {\r\n return target.selectSpeaker(...args).then(() => {\r\n this._context.setDeviceManagerSelectedSpeaker(target.selectedSpeaker);\r\n });\r\n };\r\n }\r\n case 'askDevicePermission': {\r\n return (...args: Parameters<DeviceManager['askDevicePermission']>): Promise<DeviceAccess> => {\r\n return target.askDevicePermission(...args).then((deviceAccess: DeviceAccess) => {\r\n this._context.setDeviceManagerDeviceAccess(deviceAccess);\r\n this.setDeviceManager();\r\n return deviceAccess;\r\n });\r\n };\r\n }\r\n default:\r\n return Reflect.get(target, prop);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Creates a declarative DeviceManager by proxying DeviceManager with ProxyDeviceManager. The declarative DeviceManager\r\n * will put state updates in the given context.\r\n *\r\n * @param deviceManager - DeviceManager from SDK\r\n * @param context - CallContext from StatefulCallClient\r\n */\r\nexport const deviceManagerDeclaratify = (deviceManager: DeviceManager, context: CallContext): DeviceManager => {\r\n const proxyDeviceManager = new ProxyDeviceManager(deviceManager, context);\r\n Object.defineProperty(deviceManager, 'unsubscribe', {\r\n configurable: false,\r\n value: () => proxyDeviceManager.unsubscribe()\r\n });\r\n Object.defineProperty(deviceManager, 'selectCamera', {\r\n configurable: false,\r\n value: (videoDeviceInfo: VideoDeviceInfo) => proxyDeviceManager.selectCamera(videoDeviceInfo)\r\n });\r\n return new Proxy(deviceManager, proxyDeviceManager) as StatefulDeviceManager;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n AudioDeviceInfo,\r\n DeviceAccess,\r\n TransferErrorCode,\r\n TransferState,\r\n VideoDeviceInfo\r\n} from '@azure/communication-calling';\r\nimport EventEmitter from 'events';\r\nimport { enableMapSet, produce } from 'immer';\r\nimport {\r\n CallEndReason,\r\n CallState as CallStatus,\r\n RemoteParticipantState as RemoteParticipantStatus\r\n} from '@azure/communication-calling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport {\r\n CallState,\r\n CallClientState,\r\n LocalVideoStreamState,\r\n RemoteParticipantState,\r\n RemoteVideoStreamState,\r\n IncomingCallState,\r\n VideoStreamRendererViewState,\r\n CallAgentState,\r\n TransferRequest,\r\n Transfer\r\n} from './CallClientState';\r\n\r\nenableMapSet();\r\n\r\n// TODO: How can we make this configurable?\r\nexport const MAX_CALL_HISTORY_LENGTH = 10;\r\nexport const MAX_TRANSFER_REQUEST_LENGTH = 10;\r\n\r\nexport class CallContext {\r\n private _state: CallClientState;\r\n private _emitter: EventEmitter;\r\n private _atomicId: number;\r\n\r\n constructor(userId: string) {\r\n this._state = {\r\n calls: new Map<string, CallState>(),\r\n callsEnded: [],\r\n incomingCalls: new Map<string, IncomingCallState>(),\r\n incomingCallsEnded: [],\r\n deviceManager: {\r\n isSpeakerSelectionAvailable: false,\r\n cameras: [],\r\n microphones: [],\r\n speakers: [],\r\n unparentedViews: new Map<LocalVideoStreamState, LocalVideoStreamState>()\r\n },\r\n callAgent: undefined,\r\n userId: userId\r\n };\r\n this._emitter = new EventEmitter();\r\n this._emitter.setMaxListeners(50);\r\n this._atomicId = 0;\r\n }\r\n\r\n public setState(state: CallClientState): void {\r\n this._state = state;\r\n this._emitter.emit('stateChanged', this._state);\r\n }\r\n\r\n public getState(): CallClientState {\r\n return this._state;\r\n }\r\n\r\n public onStateChange(handler: (state: CallClientState) => void): void {\r\n this._emitter.on('stateChanged', handler);\r\n }\r\n\r\n public offStateChange(handler: (state: CallClientState) => void): void {\r\n this._emitter.off('stateChanged', handler);\r\n }\r\n\r\n // Disposing of the CallAgentDeclarative will not clear the state. If we create a new CallAgentDeclarative, we should\r\n // make sure the state is clean because any left over state (if previous CallAgentDeclarative was disposed) may be\r\n // invalid.\r\n public clearCallRelatedState(): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.calls.clear();\r\n draft.incomingCalls.clear();\r\n draft.callsEnded.splice(0, draft.callsEnded.length);\r\n draft.incomingCallsEnded.splice(0, draft.incomingCallsEnded.length);\r\n })\r\n );\r\n }\r\n\r\n public setCallAgent(callAgent: CallAgentState): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.callAgent = callAgent;\r\n })\r\n );\r\n }\r\n\r\n public setCall(call: CallState): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const existingCall = draft.calls.get(call.id);\r\n if (existingCall) {\r\n existingCall.callerInfo = call.callerInfo;\r\n existingCall.state = call.state;\r\n existingCall.callEndReason = call.callEndReason;\r\n existingCall.direction = call.direction;\r\n existingCall.isMuted = call.isMuted;\r\n existingCall.isScreenSharingOn = call.isScreenSharingOn;\r\n existingCall.localVideoStreams = call.localVideoStreams;\r\n existingCall.remoteParticipants = call.remoteParticipants;\r\n existingCall.transcription.isTranscriptionActive = call.transcription.isTranscriptionActive;\r\n existingCall.recording.isRecordingActive = call.recording.isRecordingActive;\r\n // We don't update the startTime and endTime if we are updating an existing active call\r\n } else {\r\n draft.calls.set(call.id, call);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public removeCall(callId: string): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.calls.delete(callId);\r\n })\r\n );\r\n }\r\n\r\n public setCallEnded(callId: string, callEndReason: CallEndReason | undefined): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.endTime = new Date();\r\n call.callEndReason = callEndReason;\r\n draft.calls.delete(callId);\r\n if (draft.callsEnded.length >= MAX_CALL_HISTORY_LENGTH) {\r\n draft.callsEnded.shift();\r\n }\r\n draft.callsEnded.push(call);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallState(callId: string, state: CallStatus): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.state = state;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallId(newCallId: string, oldCallId: string): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(oldCallId);\r\n if (call) {\r\n draft.calls.delete(oldCallId);\r\n draft.calls.set(newCallId, call);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallIsScreenSharingOn(callId: string, isScreenSharingOn: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.isScreenSharingOn = isScreenSharingOn;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallRemoteParticipants(\r\n callId: string,\r\n addRemoteParticipant: RemoteParticipantState[],\r\n removeRemoteParticipant: string[]\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n removeRemoteParticipant.forEach((id: string) => {\r\n call.remoteParticipants.delete(id);\r\n });\r\n addRemoteParticipant.forEach((participant: RemoteParticipantState) => {\r\n call.remoteParticipants.set(toFlatCommunicationIdentifier(participant.identifier), participant);\r\n });\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallRemoteParticipantsEnded(\r\n callId: string,\r\n addRemoteParticipant: RemoteParticipantState[],\r\n removeRemoteParticipant: string[]\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n removeRemoteParticipant.forEach((id: string) => {\r\n call.remoteParticipantsEnded.delete(id);\r\n });\r\n addRemoteParticipant.forEach((participant: RemoteParticipantState) => {\r\n call.remoteParticipantsEnded.set(toFlatCommunicationIdentifier(participant.identifier), participant);\r\n });\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallLocalVideoStream(callId: string, streams: LocalVideoStreamState[]): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.localVideoStreams = streams;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallIsMicrophoneMuted(callId: string, isMicrophoneMuted: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.isMuted = isMicrophoneMuted;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallRecordingActive(callId: string, isRecordingActive: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.recording.isRecordingActive = isRecordingActive;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallTranscriptionActive(callId: string, isTranscriptionActive: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.transcription.isTranscriptionActive = isTranscriptionActive;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallReceivedTransferRequest(callId: string, transfer: TransferRequest): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n if (call.transfer.receivedTransferRequests.length >= MAX_TRANSFER_REQUEST_LENGTH) {\r\n call.transfer.receivedTransferRequests.shift();\r\n }\r\n call.transfer.receivedTransferRequests.push(transfer);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallRequestedTransfer(callId: string, transfer: Transfer): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n if (call.transfer.requestedTransfers.length >= MAX_TRANSFER_REQUEST_LENGTH) {\r\n call.transfer.requestedTransfers.shift();\r\n }\r\n call.transfer.requestedTransfers.push(transfer);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallRequestedTransferState(\r\n callId: string,\r\n transferId: number,\r\n state: TransferState,\r\n error?: TransferErrorCode\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n for (const requestedTransfer of call.transfer.requestedTransfers) {\r\n if (requestedTransfer.id === transferId) {\r\n requestedTransfer.state = state;\r\n requestedTransfer.error = error;\r\n break;\r\n }\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setCallScreenShareParticipant(callId: string, participantKey: string | undefined): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n call.screenShareRemoteParticipant = participantKey;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setLocalVideoStreamRendererView(callId: string, view: VideoStreamRendererViewState | undefined): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n if (call.localVideoStreams.length > 0) {\r\n call.localVideoStreams[0].view = view;\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipantState(callId: string, participantKey: string, state: RemoteParticipantStatus): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n participant.state = state;\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipantIsMuted(callId: string, participantKey: string, muted: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n participant.isMuted = muted;\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipantDisplayName(callId: string, participantKey: string, displayName: string): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n participant.displayName = displayName;\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipantIsSpeaking(callId: string, participantKey: string, isSpeaking: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n participant.isSpeaking = isSpeaking;\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipantVideoStream(callId: string, participantKey: string, stream: RemoteVideoStreamState): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n // Set is called by subscriber will not modify any rendered stream so if there is existing stream only\r\n // modify the values that subscriber has access to.\r\n const existingStream = participant.videoStreams.get(stream.id);\r\n if (existingStream) {\r\n existingStream.isAvailable = stream.isAvailable;\r\n existingStream.mediaStreamType = stream.mediaStreamType;\r\n } else {\r\n participant.videoStreams.set(stream.id, stream);\r\n }\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setRemoteVideoStreamIsAvailable(\r\n callId: string,\r\n participantKey: string,\r\n streamId: number,\r\n isAvailable: boolean\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n const stream = participant.videoStreams.get(streamId);\r\n if (stream) {\r\n stream.isAvailable = isAvailable;\r\n }\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setRemoteVideoStreams(\r\n callId: string,\r\n participantKey: string,\r\n addRemoteVideoStream: RemoteVideoStreamState[],\r\n removeRemoteVideoStream: number[]\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n for (const id of removeRemoteVideoStream) {\r\n participant.videoStreams.delete(id);\r\n }\r\n\r\n for (const newStream of addRemoteVideoStream) {\r\n // This should only be called by the subscriber and some properties are add by other components so if the\r\n // stream already exists, only update the values that subscriber knows about.\r\n const stream = participant.videoStreams.get(newStream.id);\r\n if (stream) {\r\n stream.mediaStreamType = newStream.mediaStreamType;\r\n stream.isAvailable = newStream.isAvailable;\r\n } else {\r\n participant.videoStreams.set(newStream.id, newStream);\r\n }\r\n }\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setRemoteVideoStreamRendererView(\r\n callId: string,\r\n participantKey: string,\r\n streamId: number,\r\n view: VideoStreamRendererViewState | undefined\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.calls.get(callId);\r\n if (call) {\r\n const participant = call.remoteParticipants.get(participantKey);\r\n if (participant) {\r\n const stream = participant.videoStreams.get(streamId);\r\n if (stream) {\r\n stream.view = view;\r\n }\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setIncomingCall(call: IncomingCallState): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const existingCall = draft.incomingCalls.get(call.id);\r\n if (existingCall) {\r\n existingCall.callerInfo = call.callerInfo;\r\n } else {\r\n draft.incomingCalls.set(call.id, call);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public removeIncomingCall(callId: string): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.incomingCalls.delete(callId);\r\n })\r\n );\r\n }\r\n\r\n public setIncomingCallEnded(callId: string, callEndReason: CallEndReason | undefined): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n const call = draft.incomingCalls.get(callId);\r\n if (call) {\r\n call.endTime = new Date();\r\n call.callEndReason = callEndReason;\r\n draft.incomingCalls.delete(callId);\r\n if (draft.incomingCallsEnded.length >= MAX_CALL_HISTORY_LENGTH) {\r\n draft.incomingCallsEnded.shift();\r\n }\r\n draft.incomingCallsEnded.push(call);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerIsSpeakerSelectionAvailable(isSpeakerSelectionAvailable: boolean): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.isSpeakerSelectionAvailable = isSpeakerSelectionAvailable;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerSelectedMicrophone(selectedMicrophone?: AudioDeviceInfo): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.selectedMicrophone = selectedMicrophone;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerSelectedSpeaker(selectedSpeaker?: AudioDeviceInfo): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.selectedSpeaker = selectedSpeaker;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerSelectedCamera(selectedCamera?: VideoDeviceInfo): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.selectedCamera = selectedCamera;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerCameras(cameras: VideoDeviceInfo[]): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n if (!!draft.deviceManager.cameras && cameras.length > 0) {\r\n draft.deviceManager.selectedCamera = cameras[0];\r\n }\r\n draft.deviceManager.cameras = cameras;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerMicrophones(microphones: AudioDeviceInfo[]): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.microphones = microphones;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerSpeakers(speakers: AudioDeviceInfo[]): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.speakers = speakers;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerDeviceAccess(deviceAccess: DeviceAccess): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.deviceAccess = deviceAccess;\r\n })\r\n );\r\n }\r\n\r\n public setDeviceManagerUnparentedView(\r\n localVideoStream: LocalVideoStreamState,\r\n view: VideoStreamRendererViewState | undefined\r\n ): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.unparentedViews.set(localVideoStream, {\r\n source: localVideoStream.source,\r\n mediaStreamType: localVideoStream.mediaStreamType,\r\n view: view\r\n });\r\n })\r\n );\r\n }\r\n\r\n public deleteDeviceManagerUnparentedView(localVideoStream: LocalVideoStreamState): void {\r\n this.setState(\r\n produce(this._state, (draft: CallClientState) => {\r\n draft.deviceManager.unparentedViews.delete(localVideoStream);\r\n })\r\n );\r\n }\r\n\r\n public getAndIncrementAtomicId(): number {\r\n const id = this._atomicId;\r\n this._atomicId++;\r\n return id;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n Call as SdkCall,\r\n RemoteParticipant as SdkRemoteParticipant,\r\n RemoteVideoStream as SdkRemoteVideoStream,\r\n LocalVideoStream as SdkLocalVideoStream,\r\n IncomingCall as SdkIncomingCall,\r\n VideoStreamRendererView,\r\n TransferRequestedEventArgs,\r\n Transfer\r\n} from '@azure/communication-calling';\r\nimport { CommunicationUserIdentifier, PhoneNumberIdentifier } from '@azure/communication-common';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport {\r\n CallState,\r\n RemoteParticipantState as DeclarativeRemoteParticipant,\r\n RemoteVideoStreamState as DeclarativeRemoteVideoStream,\r\n LocalVideoStreamState as DeclarativeLocalVideoStream,\r\n IncomingCallState as DeclarativeIncomingCall,\r\n VideoStreamRendererViewState as DeclarativeVideoStreamRendererView,\r\n TransferRequest,\r\n Transfer as DeclarativeTransfer\r\n} from './CallClientState';\r\n\r\nexport function convertSdkLocalStreamToDeclarativeLocalStream(\r\n stream: SdkLocalVideoStream\r\n): DeclarativeLocalVideoStream {\r\n return {\r\n source: stream.source,\r\n mediaStreamType: stream.mediaStreamType,\r\n view: undefined\r\n };\r\n}\r\n\r\nexport function convertSdkRemoteStreamToDeclarativeRemoteStream(\r\n stream: SdkRemoteVideoStream\r\n): DeclarativeRemoteVideoStream {\r\n return {\r\n id: stream.id,\r\n mediaStreamType: stream.mediaStreamType,\r\n isAvailable: stream.isAvailable,\r\n view: undefined\r\n };\r\n}\r\n\r\nexport function convertSdkParticipantToDeclarativeParticipant(\r\n participant: SdkRemoteParticipant\r\n): DeclarativeRemoteParticipant {\r\n const declarativeVideoStreams = new Map<number, DeclarativeRemoteVideoStream>();\r\n for (const videoStream of participant.videoStreams) {\r\n declarativeVideoStreams.set(videoStream.id, convertSdkRemoteStreamToDeclarativeRemoteStream(videoStream));\r\n }\r\n return {\r\n identifier: participant.identifier,\r\n displayName: participant.displayName,\r\n state: participant.state,\r\n callEndReason: participant.callEndReason,\r\n videoStreams: declarativeVideoStreams,\r\n isMuted: participant.isMuted,\r\n isSpeaking: participant.isSpeaking\r\n };\r\n}\r\n\r\n// Note at the time of writing only one LocalVideoStream is supported by the SDK.\r\nexport function convertSdkCallToDeclarativeCall(call: SdkCall): CallState {\r\n const declarativeRemoteParticipants = new Map<string, DeclarativeRemoteParticipant>();\r\n call.remoteParticipants.forEach((participant: SdkRemoteParticipant) => {\r\n declarativeRemoteParticipants.set(\r\n toFlatCommunicationIdentifier(participant.identifier),\r\n convertSdkParticipantToDeclarativeParticipant(participant)\r\n );\r\n });\r\n return {\r\n id: call.id,\r\n callerInfo: call.callerInfo,\r\n state: call.state,\r\n callEndReason: call.callEndReason,\r\n direction: call.direction,\r\n isMuted: call.isMuted,\r\n isScreenSharingOn: call.isScreenSharingOn,\r\n localVideoStreams: call.localVideoStreams.map(convertSdkLocalStreamToDeclarativeLocalStream),\r\n remoteParticipants: declarativeRemoteParticipants,\r\n remoteParticipantsEnded: new Map<string, DeclarativeRemoteParticipant>(),\r\n recording: { isRecordingActive: false },\r\n transcription: { isTranscriptionActive: false },\r\n transfer: { receivedTransferRequests: [], requestedTransfers: [] },\r\n screenShareRemoteParticipant: undefined,\r\n startTime: new Date(),\r\n endTime: undefined\r\n };\r\n}\r\n\r\nexport function convertSdkIncomingCallToDeclarativeIncomingCall(call: SdkIncomingCall): DeclarativeIncomingCall {\r\n return {\r\n id: call.id,\r\n callerInfo: call.callerInfo,\r\n startTime: new Date(),\r\n endTime: undefined\r\n };\r\n}\r\n\r\nexport function convertFromSDKToDeclarativeVideoStreamRendererView(\r\n view: VideoStreamRendererView\r\n): DeclarativeVideoStreamRendererView {\r\n return {\r\n scalingMode: view.scalingMode,\r\n isMirrored: view.isMirrored,\r\n target: view.target\r\n };\r\n}\r\n\r\nexport function convertSdkTransferRequestedToDeclarativeTransferRequested(\r\n transferRequested: TransferRequestedEventArgs\r\n): TransferRequest {\r\n return {\r\n targetParticipant: transferRequested.targetParticipant\r\n };\r\n}\r\n\r\nexport function convertSdkTransferToDeclarativeTransfer(\r\n transfer: Transfer,\r\n targetParticipant: CommunicationUserIdentifier | PhoneNumberIdentifier,\r\n transferId: number\r\n): DeclarativeTransfer {\r\n return {\r\n id: transferId,\r\n targetParticipant: targetParticipant,\r\n state: transfer.state,\r\n error: transfer.error\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Call, Transfer } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\n\r\n/**\r\n * Subscribe to 'stateChanged' events in {@Link @azure/communication-calling#Transfer}. These are outgoing or sent\r\n * requests.\r\n */\r\nexport class RequestedTransferSubscriber {\r\n private _call: Call;\r\n private _context: CallContext;\r\n private _transfer: Transfer;\r\n private _transferId: number;\r\n\r\n constructor(call: Call, context: CallContext, transfer: Transfer, transferId: number) {\r\n this._call = call;\r\n this._context = context;\r\n this._transfer = transfer;\r\n this._transferId = transferId;\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._transfer.on('stateChanged', this.stateChanged);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._transfer.off('stateChanged', this.stateChanged);\r\n };\r\n\r\n private stateChanged = (): void => {\r\n this._context.setCallRequestedTransferState(\r\n this._call.id,\r\n this._transferId,\r\n this._transfer.state,\r\n this._transfer.error\r\n );\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n Call,\r\n Transfer,\r\n TransferCallFeature,\r\n TransferToParticipant,\r\n TransferToParticipantOptions\r\n} from '@azure/communication-calling';\r\nimport { CallContext, MAX_TRANSFER_REQUEST_LENGTH } from './CallContext';\r\nimport { convertSdkTransferToDeclarativeTransfer } from './Converter';\r\nimport { RequestedTransferSubscriber } from './RequestedTransferSubscriber';\r\n\r\nexport interface DeclarativeTransferCallFeature extends TransferCallFeature {\r\n /**\r\n * Stop any declarative specific subscriptions and remove declarative subscribers.\r\n */\r\n unsubscribe(): void;\r\n}\r\n\r\n/**\r\n * ProxyTransfer proxies transfer so that the return value from transfer can be subscribed to and its state surfaced.\r\n */\r\nclass ProxyTransferCallFeature implements ProxyHandler<TransferCallFeature> {\r\n private _call: Call;\r\n private _context: CallContext;\r\n private _requestedTransferSubscribers: RequestedTransferSubscriber[];\r\n\r\n constructor(call: Call, context: CallContext) {\r\n this._call = call;\r\n this._context = context;\r\n this._requestedTransferSubscribers = [];\r\n }\r\n\r\n public unsubscribe(): void {\r\n for (const requestedTransfer of this._requestedTransferSubscribers) {\r\n requestedTransfer.unsubscribe();\r\n }\r\n this._requestedTransferSubscribers = [];\r\n }\r\n\r\n public get<P extends keyof TransferCallFeature>(target: TransferCallFeature, prop: P): any {\r\n switch (prop) {\r\n case 'transfer': {\r\n return (targetParticipant: TransferToParticipant, transferOptions?: TransferToParticipantOptions): Transfer => {\r\n const transfer = target.transfer(targetParticipant, transferOptions);\r\n const transferId = this._context.getAndIncrementAtomicId();\r\n this._context.setCallRequestedTransfer(\r\n this._call.id,\r\n convertSdkTransferToDeclarativeTransfer(transfer, targetParticipant.targetParticipant, transferId)\r\n );\r\n\r\n if (this._requestedTransferSubscribers.length >= MAX_TRANSFER_REQUEST_LENGTH) {\r\n const subscriber = this._requestedTransferSubscribers.shift();\r\n subscriber?.unsubscribe();\r\n }\r\n this._requestedTransferSubscribers.push(\r\n new RequestedTransferSubscriber(this._call, this._context, transfer, transferId)\r\n );\r\n return transfer;\r\n };\r\n }\r\n default:\r\n return Reflect.get(target, prop);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Creates a declarative TransferCallFeature by proxying TransferCallFeature with ProxyTransferCallFeature which proxy\r\n * transfer calls to update the state properly.\r\n *\r\n * @param transfer - TransferCallFeature from SDK\r\n * @param context - CallContext from StatefulCallClient\r\n */\r\nexport const transferCallFeatureDeclaratify = (\r\n call: Call,\r\n transfer: TransferCallFeature,\r\n context: CallContext\r\n): TransferCallFeature => {\r\n const proxyTransferCallFeature = new ProxyTransferCallFeature(call, context);\r\n Object.defineProperty(transfer, 'unsubscribe', {\r\n configurable: false,\r\n value: () => proxyTransferCallFeature.unsubscribe()\r\n });\r\n return new Proxy(transfer, proxyTransferCallFeature) as TransferCallFeature;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Call, CallApiFeature, CallFeatureFactoryType } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { transferCallFeatureDeclaratify } from './TransferCallFeatureDeclarative';\r\n\r\nexport interface DeclarativeCall extends Call {\r\n /**\r\n * Stop any declarative specific subscriptions and remove declarative subscribers.\r\n */\r\n unsubscribe(): void;\r\n}\r\n\r\n/**\r\n * ProxyCall proxies Call in order to intercept the Call.api function to return a DeclarativeTransferCallFeature.\r\n */\r\nclass ProxyCall implements ProxyHandler<Call> {\r\n private _call: Call;\r\n private _context: CallContext;\r\n private _transfer: any | undefined;\r\n\r\n constructor(call: Call, context: CallContext) {\r\n this._call = call;\r\n this._context = context;\r\n }\r\n\r\n public unsubscribe(): void {\r\n if (this._transfer) {\r\n this._transfer.unsubscribe();\r\n }\r\n }\r\n\r\n public get<P extends keyof Call>(target: Call, prop: P): any {\r\n switch (prop) {\r\n case 'api': {\r\n return <TFeature extends CallApiFeature>(cls: CallFeatureFactoryType<TFeature>): TFeature => {\r\n const feature = target.api(cls) as any;\r\n if (feature.transfer) {\r\n if (this._transfer) {\r\n return this._transfer as TFeature;\r\n } else {\r\n this._transfer = transferCallFeatureDeclaratify(this._call, feature, this._context);\r\n return this._transfer as TFeature;\r\n }\r\n } else {\r\n return feature as TFeature;\r\n }\r\n };\r\n }\r\n default:\r\n return Reflect.get(target, prop);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Creates a declarative Call by proxying Call with ProxyCall in order to intercept the Call.api function to return a\r\n * DeclarativeTransferCall. This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that\r\n * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to\r\n * context)\r\n *\r\n * @param call - Call from SDK\r\n * @param context - CallContext from StatefulCallClient\r\n */\r\nexport const callDeclaratify = (call: Call, context: CallContext): DeclarativeCall => {\r\n const proxyCall = new ProxyCall(call, context);\r\n Object.defineProperty(call, 'unsubscribe', {\r\n configurable: false,\r\n value: () => proxyCall.unsubscribe()\r\n });\r\n\r\n return new Proxy(call, proxyCall) as DeclarativeCall;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { TransferCallFeature, TransferRequestedEventArgs } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\nimport { convertSdkTransferRequestedToDeclarativeTransferRequested } from './Converter';\r\n\r\n/**\r\n * Subscribe to 'transferRequested' events. These are incoming or received requests.\r\n */\r\nexport class ReceivedTransferSubscriber {\r\n private _callIdRef: CallIdRef;\r\n private _context: CallContext;\r\n private _transfer: TransferCallFeature;\r\n\r\n constructor(callIdRef: CallIdRef, context: CallContext, transfer: TransferCallFeature) {\r\n this._callIdRef = callIdRef;\r\n this._context = context;\r\n this._transfer = transfer;\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._transfer.on('transferRequested', this.transferRequested);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._transfer.off('transferRequested', this.transferRequested);\r\n };\r\n\r\n private transferRequested = (transferRequested: TransferRequestedEventArgs): void => {\r\n this._context.setCallReceivedTransferRequest(\r\n this._callIdRef.callId,\r\n convertSdkTransferRequestedToDeclarativeTransferRequested(transferRequested)\r\n );\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { RemoteVideoStream } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\n\r\nexport class RemoteVideoStreamSubscriber {\r\n private _callIdRef: CallIdRef;\r\n private _participantKey: string;\r\n private _remoteVideoStream: RemoteVideoStream;\r\n private _context: CallContext;\r\n\r\n constructor(\r\n callIdRef: CallIdRef,\r\n participantKey: string,\r\n remoteVideoStream: RemoteVideoStream,\r\n context: CallContext\r\n ) {\r\n this._callIdRef = callIdRef;\r\n this._participantKey = participantKey;\r\n this._remoteVideoStream = remoteVideoStream;\r\n this._context = context;\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._remoteVideoStream.on('isAvailableChanged', this.isAvailableChanged);\r\n this.checkAndUpdateScreenShareState();\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._remoteVideoStream.off('isAvailableChanged', this.isAvailableChanged);\r\n };\r\n\r\n private includesActiveScreenShareStream = (streams): boolean => {\r\n for (const [_, stream] of streams.entries()) {\r\n if (stream.mediaStreamType === 'ScreenSharing' && stream.isAvailable) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n\r\n /**\r\n * Update the state with the active screen share stream. If there is an existing stream will overwrite it if this one\r\n * is active (newer stream takes priority). If there is an existing stream and this one is set to unavailable, and the\r\n * existing stream is different participant, then don't set the active screen share stream to undefined, else set it\r\n * to undefined.\r\n */\r\n private checkAndUpdateScreenShareState = (): void => {\r\n if (this._remoteVideoStream.mediaStreamType !== 'ScreenSharing') {\r\n return;\r\n }\r\n\r\n if (this._remoteVideoStream.isAvailable) {\r\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, this._participantKey);\r\n return;\r\n }\r\n\r\n const existingScreenShare = this._context.getState().calls.get(this._callIdRef.callId)\r\n ?.screenShareRemoteParticipant;\r\n\r\n // If somehow we end up with an event where a RemoteParticipant's ScreenShare stream is set to\r\n // unavailable but there exists already another different participant actively sharing, and they are still\r\n // sharing then this event shouldn't set the screenShareRemoteParticipant to undefined.\r\n if (!existingScreenShare || existingScreenShare === this._participantKey) {\r\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\r\n return;\r\n }\r\n\r\n const streams = this._context\r\n .getState()\r\n .calls.get(this._callIdRef.callId)\r\n ?.remoteParticipants.get(existingScreenShare)?.videoStreams;\r\n\r\n if (!streams) {\r\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\r\n return;\r\n }\r\n\r\n // If the existing ScreenShare that is not owned by the current RemoteParticipant is still active, don't\r\n // overwrite it with undefined. So only overwrite if it is not active.\r\n if (!this.includesActiveScreenShareStream(streams)) {\r\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\r\n return;\r\n }\r\n };\r\n\r\n private isAvailableChanged = (): void => {\r\n this._context.setRemoteVideoStreamIsAvailable(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n this._remoteVideoStream.id,\r\n this._remoteVideoStream.isAvailable\r\n );\r\n\r\n this.checkAndUpdateScreenShareState();\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CreateViewOptions, LocalVideoStream, VideoStreamRenderer } from '@azure/communication-calling';\r\nimport {\r\n CommunicationUserKind,\r\n MicrosoftTeamsUserKind,\r\n PhoneNumberKind,\r\n UnknownIdentifierKind\r\n} from '@azure/communication-common';\r\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\r\nimport { CallContext } from './CallContext';\r\nimport {\r\n convertSdkLocalStreamToDeclarativeLocalStream,\r\n convertSdkRemoteStreamToDeclarativeRemoteStream,\r\n convertFromSDKToDeclarativeVideoStreamRendererView\r\n} from './Converter';\r\nimport { InternalCallContext } from './InternalCallContext';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\n\r\nasync function createViewRemoteVideo(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string,\r\n participantId: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind | string,\r\n stream: RemoteVideoStreamState,\r\n options?: CreateViewOptions\r\n): Promise<void> {\r\n // Render RemoteVideoStream that is part of a Call\r\n const streamId = stream.id;\r\n let participantKey;\r\n if (typeof participantId === 'string') {\r\n participantKey = participantId;\r\n } else {\r\n participantKey = toFlatCommunicationIdentifier(participantId);\r\n }\r\n const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\r\n\r\n if (!renderInfo) {\r\n console.warn('RemoteVideoStream not found in state');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Rendered') {\r\n console.warn('RemoteVideoStream is already rendered');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Rendering') {\r\n console.warn('RemoteVideoStream rendering is already in progress');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Stopping') {\r\n console.warn('RemoteVideoStream is in the middle of stopping');\r\n return;\r\n }\r\n\r\n const renderer = new VideoStreamRenderer(renderInfo.stream);\r\n\r\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', undefined);\r\n\r\n let view;\r\n try {\r\n view = await renderer.createView(options);\r\n } catch (e) {\r\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);\r\n throw e;\r\n }\r\n\r\n const refreshedRenderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\r\n if (!refreshedRenderInfo) {\r\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\r\n // and clean up state.\r\n renderer.dispose();\r\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\r\n return;\r\n }\r\n\r\n if (refreshedRenderInfo.status === 'Stopping') {\r\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\r\n // put the view into the state.\r\n renderer.dispose();\r\n internalContext.setRemoteRenderInfo(\r\n callId,\r\n participantKey,\r\n streamId,\r\n refreshedRenderInfo.stream,\r\n 'NotRendered',\r\n undefined\r\n );\r\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\r\n return;\r\n }\r\n\r\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\r\n // updating the state.\r\n internalContext.setRemoteRenderInfo(\r\n callId,\r\n participantKey,\r\n streamId,\r\n refreshedRenderInfo.stream,\r\n 'Rendered',\r\n renderer\r\n );\r\n context.setRemoteVideoStreamRendererView(\r\n callId,\r\n participantKey,\r\n streamId,\r\n convertFromSDKToDeclarativeVideoStreamRendererView(view)\r\n );\r\n}\r\n\r\nasync function createViewLocalVideo(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string,\r\n options?: CreateViewOptions\r\n): Promise<void> {\r\n // Render LocalVideoStream that is part of a Call\r\n const renderInfo = internalContext.getLocalRenderInfo(callId);\r\n\r\n if (!renderInfo) {\r\n console.warn('LocalVideoStream not found in state');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Rendered') {\r\n console.warn('LocalVideoStream is already rendered');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Rendering') {\r\n console.warn('LocalVideoStream rendering is already in progress');\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Stopping') {\r\n console.warn('LocalVideoStream is in the middle of stopping');\r\n return;\r\n }\r\n\r\n const renderer = new VideoStreamRenderer(renderInfo.stream);\r\n\r\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', undefined);\r\n\r\n let view;\r\n try {\r\n view = await renderer.createView(options);\r\n } catch (e) {\r\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);\r\n throw e;\r\n }\r\n\r\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\r\n // stop rendering.\r\n const refreshedRenderInfo = internalContext.getLocalRenderInfo(callId);\r\n if (!refreshedRenderInfo) {\r\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\r\n // and clean up the state.\r\n renderer.dispose();\r\n context.setLocalVideoStreamRendererView(callId, undefined);\r\n return;\r\n }\r\n\r\n if (refreshedRenderInfo.status === 'Stopping') {\r\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\r\n // put the view into the state.\r\n renderer.dispose();\r\n internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);\r\n context.setLocalVideoStreamRendererView(callId, undefined);\r\n return;\r\n }\r\n\r\n // Else The stream still exists and status is not telling us to stop rendering. Complete the render process by\r\n // updating the state.\r\n internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);\r\n context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));\r\n}\r\n\r\nasync function createViewUnparentedVideo(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n stream: LocalVideoStreamState,\r\n options?: CreateViewOptions\r\n): Promise<void> {\r\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\r\n\r\n if (renderInfo && renderInfo.status === 'Rendered') {\r\n console.warn('Unparented LocalVideoStream is already rendered');\r\n return;\r\n }\r\n\r\n if (renderInfo && renderInfo.status === 'Rendering') {\r\n console.warn('Unparented LocalVideoStream rendering is already in progress');\r\n return;\r\n }\r\n\r\n if (renderInfo && renderInfo.status === 'Stopping') {\r\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\r\n return;\r\n }\r\n\r\n const localVideoStream = new LocalVideoStream(stream.source);\r\n const renderer = new VideoStreamRenderer(localVideoStream);\r\n\r\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\r\n\r\n let view;\r\n try {\r\n view = await renderer.createView(options);\r\n } catch (e) {\r\n // Special case for unparented views. Since they are not tied to anything and created by us based on the calls to\r\n // this function we'll delete it to clean up the data since keeping it around doesn't help us and if developer wants\r\n // to create a new view they can check that the view is not rendered and call this function again.\r\n internalContext.deleteUnparentedRenderInfo(stream);\r\n throw e;\r\n }\r\n\r\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\r\n // stop rendering.\r\n const refreshedRenderInfo = internalContext.getUnparentedRenderInfo(stream);\r\n if (!refreshedRenderInfo) {\r\n // Unparented stream's RenderInfo was deleted. Currently this shouldn't happen but if it does we'll just dispose the\r\n // renderer and clean up state. If developer wanted the stream they could call this function again and that should\r\n // generate new working state via this function.\r\n renderer.dispose();\r\n context.deleteDeviceManagerUnparentedView(stream);\r\n return;\r\n }\r\n\r\n if (refreshedRenderInfo.status === 'Stopping') {\r\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\r\n // put the view into the state. Special case for unparented views, delete them from state when stopped to free up\r\n // the memory since we were the ones generating this and not tied to any Call state.\r\n internalContext.deleteUnparentedRenderInfo(stream);\r\n context.deleteDeviceManagerUnparentedView(stream);\r\n return;\r\n }\r\n\r\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\r\n // updating the state.\r\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);\r\n context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\r\n}\r\n\r\nfunction disposeViewRemoteVideo(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string,\r\n participantId: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind | string,\r\n stream: RemoteVideoStreamState\r\n): void {\r\n const streamId = stream.id;\r\n\r\n let participantKey;\r\n if (typeof participantId === 'string') {\r\n participantKey = participantId;\r\n } else {\r\n participantKey = toFlatCommunicationIdentifier(participantId);\r\n }\r\n\r\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\r\n\r\n const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\r\n if (!renderInfo) {\r\n return;\r\n }\r\n\r\n // Sets the status and also renderer. I think we need to always set renderer to undefined since in all status when\r\n // cleaned up should have renderer as undefined. If the status is 'Rendered' and renderer is not defined it should\r\n // be cleaned up below so we can set it to undefined here.\r\n if (renderInfo.status === 'Rendering') {\r\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined);\r\n } else {\r\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);\r\n }\r\n\r\n if (renderInfo.renderer) {\r\n renderInfo.renderer.dispose();\r\n }\r\n}\r\n\r\nfunction disposeViewLocalVideo(context: CallContext, internalContext: InternalCallContext, callId: string): void {\r\n context.setLocalVideoStreamRendererView(callId, undefined);\r\n\r\n const renderInfo = internalContext.getLocalRenderInfo(callId);\r\n if (!renderInfo) {\r\n return;\r\n }\r\n\r\n // Sets the status and also renderer. I think we need to always set renderer to undefined since in all status when\r\n // cleaned up should have renderer as undefined. If the status is 'Rendered' and renderer is not defined it should\r\n // be cleaned up below so we can set it to undefined here.\r\n if (renderInfo.status === 'Rendering') {\r\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', undefined);\r\n } else {\r\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);\r\n }\r\n\r\n if (renderInfo.renderer) {\r\n renderInfo.renderer.dispose();\r\n }\r\n}\r\n\r\nfunction disposeViewUnparentedVideo(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n stream: LocalVideoStreamState\r\n): void {\r\n context.deleteDeviceManagerUnparentedView(stream);\r\n\r\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\r\n if (!renderInfo) {\r\n return;\r\n }\r\n\r\n if (renderInfo.status === 'Rendering') {\r\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\r\n } else {\r\n internalContext.deleteUnparentedRenderInfo(stream);\r\n }\r\n\r\n if (renderInfo.renderer) {\r\n renderInfo.renderer.dispose();\r\n }\r\n}\r\n\r\nexport function createView(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string | undefined,\r\n participantId:\r\n | CommunicationUserKind\r\n | PhoneNumberKind\r\n | MicrosoftTeamsUserKind\r\n | UnknownIdentifierKind\r\n | string\r\n | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState,\r\n options?: CreateViewOptions\r\n): Promise<void> {\r\n if ('id' in stream && callId && participantId) {\r\n // Render RemoteVideoStream that is part of a Call\r\n return createViewRemoteVideo(context, internalContext, callId, participantId, stream, options);\r\n } else if (!('id' in stream) && callId) {\r\n // Render LocalVideoStream that is part of a Call\r\n return createViewLocalVideo(context, internalContext, callId, options);\r\n } else if (!('id' in stream) && !callId) {\r\n // Render LocalVideoStream that is not part of a Call\r\n return createViewUnparentedVideo(context, internalContext, stream, options);\r\n } else {\r\n console.warn('Invalid combination of parameters');\r\n return Promise.resolve();\r\n }\r\n}\r\n\r\nexport function disposeView(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string | undefined,\r\n participantId:\r\n | CommunicationUserKind\r\n | PhoneNumberKind\r\n | MicrosoftTeamsUserKind\r\n | UnknownIdentifierKind\r\n | string\r\n | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState\r\n): void {\r\n if ('id' in stream && callId && participantId) {\r\n // Stop rendering RemoteVideoStream that is part of a Call\r\n disposeViewRemoteVideo(context, internalContext, callId, participantId, stream);\r\n } else if (!('id' in stream) && callId) {\r\n // Stop rendering LocalVideoStream that is part of a Call\r\n disposeViewLocalVideo(context, internalContext, callId);\r\n } else if (!('id' in stream) && !callId) {\r\n // Stop rendering LocalVideoStream that is not part of a Call\r\n disposeViewUnparentedVideo(context, internalContext, stream);\r\n } else {\r\n console.warn('Invalid combination of parameters');\r\n return;\r\n }\r\n}\r\n\r\n// Only stops videos that are tied to a Call.\r\nexport function disposeAllViewsFromCall(\r\n context: CallContext,\r\n internalContext: InternalCallContext,\r\n callId: string\r\n): void {\r\n const callStreams = internalContext.getRemoteRenderInfoForCall(callId);\r\n if (callStreams) {\r\n for (const [participantKey, participantStreams] of callStreams.entries()) {\r\n for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {\r\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\r\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\r\n disposeView(\r\n context,\r\n internalContext,\r\n callId,\r\n participantKey,\r\n convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream)\r\n );\r\n }\r\n }\r\n }\r\n const localStreamAndRenderer = internalContext.getLocalRenderInfo(callId);\r\n if (localStreamAndRenderer && localStreamAndRenderer.renderer) {\r\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\r\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\r\n disposeView(\r\n context,\r\n internalContext,\r\n callId,\r\n undefined,\r\n convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream)\r\n );\r\n }\r\n}\r\n\r\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\r\n const remoteStreamAndRenderers = internalContext.getRemoteRenderInfos();\r\n for (const [callId] of remoteStreamAndRenderers.entries()) {\r\n disposeAllViewsFromCall(context, internalContext, callId);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\nimport { convertSdkRemoteStreamToDeclarativeRemoteStream } from './Converter';\r\nimport { InternalCallContext } from './InternalCallContext';\r\nimport { RemoteVideoStreamSubscriber } from './RemoteVideoStreamSubscriber';\r\nimport { disposeView } from './StreamUtils';\r\n\r\n/**\r\n * Keeps track of the listeners assigned to a particular participant because when we get an event from SDK, it doesn't\r\n * tell us which participant it is for. If we keep track of this then we know which participant in the state that needs\r\n * an update and also which property of that participant. Also we can use this when unregistering to a participant.\r\n */\r\nexport class ParticipantSubscriber {\r\n private _callIdRef: CallIdRef;\r\n private _participant: RemoteParticipant;\r\n private _context: CallContext;\r\n private _internalContext: InternalCallContext;\r\n private _participantKey: string;\r\n private _remoteVideoStreamSubscribers: Map<number, RemoteVideoStreamSubscriber>;\r\n\r\n constructor(\r\n callIdRef: CallIdRef,\r\n participant: RemoteParticipant,\r\n context: CallContext,\r\n internalContext: InternalCallContext\r\n ) {\r\n this._callIdRef = callIdRef;\r\n this._participant = participant;\r\n this._context = context;\r\n this._internalContext = internalContext;\r\n this._participantKey = toFlatCommunicationIdentifier(this._participant.identifier);\r\n this._remoteVideoStreamSubscribers = new Map<number, RemoteVideoStreamSubscriber>();\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._participant.on('stateChanged', this.stateChanged);\r\n this._participant.on('isMutedChanged', this.isMutedChanged);\r\n this._participant.on('displayNameChanged', this.displayNameChanged);\r\n this._participant.on('isSpeakingChanged', this.isSpeakingChanged);\r\n this._participant.on('videoStreamsUpdated', this.videoStreamsUpdated);\r\n\r\n if (this._participant.videoStreams.length > 0) {\r\n for (const stream of this._participant.videoStreams) {\r\n this._internalContext.setRemoteRenderInfo(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n stream.id,\r\n stream,\r\n 'NotRendered',\r\n undefined\r\n );\r\n this.addRemoteVideoStreamSubscriber(stream);\r\n }\r\n this._context.setRemoteVideoStreams(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n this._participant.videoStreams.map(convertSdkRemoteStreamToDeclarativeRemoteStream),\r\n []\r\n );\r\n }\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._participant.off('stateChanged', this.stateChanged);\r\n this._participant.off('isMutedChanged', this.isMutedChanged);\r\n this._participant.off('displayNameChanged', this.displayNameChanged);\r\n this._participant.off('isSpeakingChanged', this.isSpeakingChanged);\r\n this._participant.off('videoStreamsUpdated', this.videoStreamsUpdated);\r\n\r\n // If unsubscribing it means the participant left the call. If they have any rendering streams we should stop them\r\n // as it doesn't make sense to render for an ended participant.\r\n if (this._participant.videoStreams.length > 0) {\r\n for (const stream of this._participant.videoStreams) {\r\n disposeView(\r\n this._context,\r\n this._internalContext,\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n convertSdkRemoteStreamToDeclarativeRemoteStream(stream)\r\n );\r\n this._internalContext.deleteRemoteRenderInfo(this._callIdRef.callId, this._participantKey, stream.id);\r\n }\r\n }\r\n };\r\n\r\n private addRemoteVideoStreamSubscriber = (remoteVideoStream: RemoteVideoStream): void => {\r\n this._remoteVideoStreamSubscribers.get(remoteVideoStream.id)?.unsubscribe();\r\n this._remoteVideoStreamSubscribers.set(\r\n remoteVideoStream.id,\r\n new RemoteVideoStreamSubscriber(this._callIdRef, this._participantKey, remoteVideoStream, this._context)\r\n );\r\n };\r\n\r\n private stateChanged = (): void => {\r\n this._context.setParticipantState(this._callIdRef.callId, this._participantKey, this._participant.state);\r\n };\r\n\r\n private isMutedChanged = (): void => {\r\n this._context.setParticipantIsMuted(this._callIdRef.callId, this._participantKey, this._participant.isMuted);\r\n };\r\n\r\n private displayNameChanged = (): void => {\r\n this._context.setParticipantDisplayName(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n this._participant.displayName || ''\r\n );\r\n };\r\n\r\n private isSpeakingChanged = (): void => {\r\n this._context.setParticipantIsSpeaking(this._callIdRef.callId, this._participantKey, this._participant.isSpeaking);\r\n };\r\n\r\n private videoStreamsUpdated = (event: { added: RemoteVideoStream[]; removed: RemoteVideoStream[] }): void => {\r\n for (const stream of event.removed) {\r\n this._remoteVideoStreamSubscribers.get(stream.id)?.unsubscribe();\r\n disposeView(\r\n this._context,\r\n this._internalContext,\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n convertSdkRemoteStreamToDeclarativeRemoteStream(stream)\r\n );\r\n this._internalContext.deleteRemoteRenderInfo(this._callIdRef.callId, this._participantKey, stream.id);\r\n }\r\n\r\n for (const stream of event.added) {\r\n this._internalContext.setRemoteRenderInfo(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n stream.id,\r\n stream,\r\n 'NotRendered',\r\n undefined\r\n );\r\n this.addRemoteVideoStreamSubscriber(stream);\r\n }\r\n\r\n this._context.setRemoteVideoStreams(\r\n this._callIdRef.callId,\r\n this._participantKey,\r\n event.added.map(convertSdkRemoteStreamToDeclarativeRemoteStream),\r\n event.removed.map((stream: RemoteVideoStream) => stream.id)\r\n );\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecordingCallFeature } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\n\r\nexport class RecordingSubscriber {\r\n private _callIdRef: CallIdRef;\r\n private _context: CallContext;\r\n private _recording: RecordingCallFeature;\r\n\r\n constructor(callIdRef: CallIdRef, context: CallContext, recording: RecordingCallFeature) {\r\n this._callIdRef = callIdRef;\r\n this._context = context;\r\n this._recording = recording;\r\n\r\n // If recording as already started when we joined the call, make sure it is reflected in state as there may not\r\n // be an event for it.\r\n if (this._recording.isRecordingActive) {\r\n this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive);\r\n }\r\n\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._recording.on('isRecordingActiveChanged', this.isAvailableChanged);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._recording.off('isRecordingActiveChanged', this.isAvailableChanged);\r\n };\r\n\r\n private isAvailableChanged = (): void => {\r\n this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive);\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { TranscriptionCallFeature } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\n\r\nexport class TranscriptionSubscriber {\r\n private _callIdRef: CallIdRef;\r\n private _context: CallContext;\r\n private _transcription: TranscriptionCallFeature;\r\n\r\n constructor(callIdRef: CallIdRef, context: CallContext, transcription: TranscriptionCallFeature) {\r\n this._callIdRef = callIdRef;\r\n this._context = context;\r\n this._transcription = transcription;\r\n\r\n // If transcription as already started when we joined the call, make sure it is reflected in state as there may not\r\n // be an event for it.\r\n if (this._transcription.isTranscriptionActive) {\r\n this._context.setCallTranscriptionActive(this._callIdRef.callId, this._transcription.isTranscriptionActive);\r\n }\r\n\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._transcription.on('isTranscriptionActiveChanged', this.isTranscriptionActiveChanged);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._transcription.off('isTranscriptionActiveChanged', this.isTranscriptionActiveChanged);\r\n };\r\n\r\n private isTranscriptionActiveChanged = (): void => {\r\n this._context.setCallTranscriptionActive(this._callIdRef.callId, this._transcription.isTranscriptionActive);\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Call, Features, LocalVideoStream, RemoteParticipant } from '@azure/communication-calling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { CallContext } from './CallContext';\r\nimport { CallIdRef } from './CallIdRef';\r\nimport {\r\n convertSdkLocalStreamToDeclarativeLocalStream,\r\n convertSdkParticipantToDeclarativeParticipant\r\n} from './Converter';\r\nimport { ReceivedTransferSubscriber } from './ReceivedTransferSubscriber';\r\nimport { InternalCallContext } from './InternalCallContext';\r\nimport { ParticipantSubscriber } from './ParticipantSubscriber';\r\nimport { RecordingSubscriber } from './RecordingSubscriber';\r\nimport { disposeView } from './StreamUtils';\r\nimport { TranscriptionSubscriber } from './TranscriptionSubscriber';\r\n\r\n/**\r\n * Keeps track of the listeners assigned to a particular call because when we get an event from SDK, it doesn't tell us\r\n * which call it is for. If we keep track of this then we know which call in the state that needs an update and also\r\n * which property of that call. Also we can use this when unregistering to a call.\r\n */\r\nexport class CallSubscriber {\r\n private _call: Call;\r\n private _callIdRef: CallIdRef;\r\n private _context: CallContext;\r\n private _internalContext: InternalCallContext;\r\n private _participantSubscribers: Map<string, ParticipantSubscriber>;\r\n private _recordingSubscriber: RecordingSubscriber;\r\n private _transcriptionSubscriber: TranscriptionSubscriber;\r\n private _receivedTransferSubscriber: ReceivedTransferSubscriber;\r\n\r\n constructor(call: Call, context: CallContext, internalContext: InternalCallContext) {\r\n this._call = call;\r\n this._callIdRef = { callId: call.id };\r\n this._context = context;\r\n this._internalContext = internalContext;\r\n this._participantSubscribers = new Map<string, ParticipantSubscriber>();\r\n\r\n this._recordingSubscriber = new RecordingSubscriber(\r\n this._callIdRef,\r\n this._context,\r\n this._call.api(Features.Recording)\r\n );\r\n\r\n this._transcriptionSubscriber = new TranscriptionSubscriber(\r\n this._callIdRef,\r\n this._context,\r\n this._call.api(Features.Transcription)\r\n );\r\n\r\n this._receivedTransferSubscriber = new ReceivedTransferSubscriber(\r\n this._callIdRef,\r\n this._context,\r\n this._call.api(Features.Transfer)\r\n );\r\n\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._call.on('stateChanged', this.stateChanged);\r\n this._call.on('idChanged', this.idChanged);\r\n this._call.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\r\n this._call.on('remoteParticipantsUpdated', this.remoteParticipantsUpdated);\r\n this._call.on('localVideoStreamsUpdated', this.localVideoStreamsUpdated);\r\n this._call.on('isMutedChanged', this.isMuteChanged);\r\n\r\n // At time of writing only one LocalVideoStream is supported by SDK.\r\n if (this._call.localVideoStreams.length > 0) {\r\n this._internalContext.setLocalRenderInfo(\r\n this._callIdRef.callId,\r\n this._call.localVideoStreams[0],\r\n 'NotRendered',\r\n undefined\r\n );\r\n }\r\n\r\n if (this._call.remoteParticipants.length > 0) {\r\n this._call.remoteParticipants.forEach((participant: RemoteParticipant) => {\r\n this.addParticipantListener(participant);\r\n });\r\n\r\n this._context.setCallRemoteParticipants(\r\n this._callIdRef.callId,\r\n this._call.remoteParticipants.map(convertSdkParticipantToDeclarativeParticipant),\r\n []\r\n );\r\n }\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._call.off('stateChanged', this.stateChanged);\r\n this._call.off('idChanged', this.idChanged);\r\n this._call.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\r\n this._call.off('remoteParticipantsUpdated', this.remoteParticipantsUpdated);\r\n this._call.off('localVideoStreamsUpdated', this.localVideoStreamsUpdated);\r\n this._call.off('isMutedChanged', this.isMuteChanged);\r\n\r\n this._participantSubscribers.forEach((participantSubscriber: ParticipantSubscriber) => {\r\n participantSubscriber.unsubscribe();\r\n });\r\n this._participantSubscribers.clear();\r\n\r\n // If we are unsubscribing that means we no longer want to display any video for this call (callEnded or callAgent\r\n // disposed) and we should not be updating it any more. So if video is rendering we stop rendering.\r\n if (this._call.localVideoStreams && this._call.localVideoStreams[0]) {\r\n disposeView(\r\n this._context,\r\n this._internalContext,\r\n this._callIdRef.callId,\r\n undefined,\r\n convertSdkLocalStreamToDeclarativeLocalStream(this._call.localVideoStreams[0])\r\n );\r\n }\r\n\r\n this._internalContext.deleteLocalRenderInfo(this._callIdRef.callId);\r\n this._recordingSubscriber.unsubscribe();\r\n this._transcriptionSubscriber.unsubscribe();\r\n this._receivedTransferSubscriber.unsubscribe();\r\n };\r\n\r\n private addParticipantListener(participant: RemoteParticipant): void {\r\n const participantKey = toFlatCommunicationIdentifier(participant.identifier);\r\n this._participantSubscribers.get(participantKey)?.unsubscribe();\r\n this._participantSubscribers.set(\r\n participantKey,\r\n new ParticipantSubscriber(this._callIdRef, participant, this._context, this._internalContext)\r\n );\r\n }\r\n\r\n private removeParticipantListener(participant: RemoteParticipant): void {\r\n const participantKey = toFlatCommunicationIdentifier(participant.identifier);\r\n const participantSubscriber = this._participantSubscribers.get(participantKey);\r\n if (participantSubscriber) {\r\n participantSubscriber.unsubscribe();\r\n this._participantSubscribers.delete(participantKey);\r\n }\r\n }\r\n\r\n private stateChanged = (): void => {\r\n this._context.setCallState(this._callIdRef.callId, this._call.state);\r\n };\r\n\r\n private idChanged = (): void => {\r\n this._internalContext.setCallId(this._call.id, this._callIdRef.callId);\r\n this._context.setCallId(this._call.id, this._callIdRef.callId);\r\n this._callIdRef.callId = this._call.id;\r\n };\r\n\r\n private isScreenSharingOnChanged = (): void => {\r\n this._context.setCallIsScreenSharingOn(this._callIdRef.callId, this._call.isScreenSharingOn);\r\n };\r\n\r\n private isMuteChanged = (): void => {\r\n this._context.setCallIsMicrophoneMuted(this._callIdRef.callId, this._call.isMuted);\r\n };\r\n\r\n private remoteParticipantsUpdated = (event: { added: RemoteParticipant[]; removed: RemoteParticipant[] }): void => {\r\n event.added.forEach((participant: RemoteParticipant) => {\r\n this.addParticipantListener(participant);\r\n });\r\n event.removed.forEach((participant: RemoteParticipant) => {\r\n this.removeParticipantListener(participant);\r\n });\r\n\r\n // Remove any added participants from remoteParticipantsEnded if they are there and add any removed participants to\r\n // remoteParticipantsEnded.\r\n this._context.setCallRemoteParticipantsEnded(\r\n this._callIdRef.callId,\r\n event.removed.map(convertSdkParticipantToDeclarativeParticipant),\r\n event.added.map((participant: RemoteParticipant) => {\r\n return toFlatCommunicationIdentifier(participant.identifier);\r\n })\r\n );\r\n\r\n // Add added participants to remoteParticipants and remove removed participants from remoteParticipants.\r\n this._context.setCallRemoteParticipants(\r\n this._callIdRef.callId,\r\n event.added.map(convertSdkParticipantToDeclarativeParticipant),\r\n event.removed.map((participant: RemoteParticipant) => {\r\n return toFlatCommunicationIdentifier(participant.identifier);\r\n })\r\n );\r\n };\r\n\r\n private localVideoStreamsUpdated = (event: { added: LocalVideoStream[]; removed: LocalVideoStream[] }): void => {\r\n // At time of writing only one LocalVideoStream is supported by SDK.\r\n if (event.added.length > 0) {\r\n const localVideoStreams = [convertSdkLocalStreamToDeclarativeLocalStream(this._call.localVideoStreams[0])];\r\n // IMPORTANT: The internalContext should be set before context. This is done to ensure that the internal context\r\n // has the required data when component re-renders due to external state changes.\r\n this._internalContext.setLocalRenderInfo(\r\n this._callIdRef.callId,\r\n this._call.localVideoStreams[0],\r\n 'NotRendered',\r\n undefined\r\n );\r\n this._context.setCallLocalVideoStream(this._callIdRef.callId, [...localVideoStreams]);\r\n }\r\n if (event.removed.length > 0) {\r\n disposeView(\r\n this._context,\r\n this._internalContext,\r\n this._callIdRef.callId,\r\n undefined,\r\n convertSdkLocalStreamToDeclarativeLocalStream(event.removed[0])\r\n );\r\n this._internalContext.deleteLocalRenderInfo(this._callIdRef.callId);\r\n this._context.setCallLocalVideoStream(this._callIdRef.callId, []);\r\n }\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallEndReason, IncomingCall } from '@azure/communication-calling';\r\n\r\n/**\r\n * Keeps track of the listeners assigned to a particular incoming call because when we get an event from SDK, it doesn't\r\n * tell us which incoming call it is for. If we keep track of this then we know which incoming call in the state that\r\n * needs an update and also which property of that incoming call. Also we can use this when unregistering to a incoming\r\n * call.\r\n */\r\nexport class IncomingCallSubscriber {\r\n private _incomingCall: IncomingCall;\r\n private _setIncomingCallEnded: (incomingCallId: string, callEndReason: CallEndReason) => void;\r\n\r\n constructor(\r\n incomingCall: IncomingCall,\r\n // setIncomingCallEnded callback is used so parent can clean up IncomingCallSubscriber.\r\n setIncomingCallEnded: (incomingCallId: string, callEndReason: CallEndReason) => void\r\n ) {\r\n this._incomingCall = incomingCall;\r\n this._setIncomingCallEnded = setIncomingCallEnded;\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._incomingCall.on('callEnded', this.callEnded);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this._incomingCall.off('callEnded', this.callEnded);\r\n };\r\n\r\n private callEnded = (event: { callEndReason: CallEndReason }): void => {\r\n this._setIncomingCallEnded(this._incomingCall.id, event.callEndReason);\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Call, CallAgent, CallEndReason, CollectionUpdatedEvent, IncomingCall } from '@azure/communication-calling';\r\nimport { CallContext } from './CallContext';\r\nimport { callDeclaratify, DeclarativeCall } from './CallDeclarative';\r\nimport { CallSubscriber } from './CallSubscriber';\r\nimport { convertSdkCallToDeclarativeCall, convertSdkIncomingCallToDeclarativeIncomingCall } from './Converter';\r\nimport { IncomingCallSubscriber } from './IncomingCallSubscriber';\r\nimport { InternalCallContext } from './InternalCallContext';\r\nimport { disposeAllViewsFromCall, disposeAllViews } from './StreamUtils';\r\n\r\n/**\r\n * ProxyCallAgent proxies CallAgent and saves any returned state in the given context. It will subscribe to all state\r\n * updates in the CallAgent and in the contained Calls and RemoteParticipants. When dispose is called it will\r\n * unsubscribe from all state updates.\r\n */\r\nclass ProxyCallAgent implements ProxyHandler<CallAgent> {\r\n private _callAgent: CallAgent;\r\n private _context: CallContext;\r\n private _internalContext: InternalCallContext;\r\n private _callSubscribers: Map<Call, CallSubscriber>;\r\n private _incomingCallSubscribers: Map<string, IncomingCallSubscriber>;\r\n private _declarativeCalls: Map<Call, DeclarativeCall>;\r\n private _externalCallsUpdatedListeners: Set<CollectionUpdatedEvent<Call>>;\r\n\r\n constructor(callAgent: CallAgent, context: CallContext, internalContext: InternalCallContext) {\r\n this._callAgent = callAgent;\r\n this._context = context;\r\n this._internalContext = internalContext;\r\n this._callSubscribers = new Map<Call, CallSubscriber>();\r\n this._incomingCallSubscribers = new Map<string, IncomingCallSubscriber>();\r\n this._declarativeCalls = new Map<Call, DeclarativeCall>();\r\n this._externalCallsUpdatedListeners = new Set<CollectionUpdatedEvent<Call>>();\r\n this.subscribe();\r\n }\r\n\r\n private subscribe = (): void => {\r\n this._callAgent.on('callsUpdated', this.callsUpdated);\r\n this._callAgent.on('incomingCall', this.incomingCall);\r\n\r\n // There could be scenario that when ProxyCallAgent is created that the given CallAgent already has Calls. In this\r\n // case we need to make sure to subscribe to those already existing Calls.\r\n for (const call of this._callAgent.calls) {\r\n this.addCall(call);\r\n }\r\n };\r\n\r\n private unsubscribe = (): void => {\r\n this._callAgent.off('callsUpdated', this.callsUpdated);\r\n this._callAgent.off('incomingCall', this.incomingCall);\r\n\r\n // Unsubscribe is called when CallAgent is disposed. This should mean no more updating of existing call but we don't\r\n // remove any existing state.\r\n for (const [_, callSubscriber] of this._callSubscribers.entries()) {\r\n callSubscriber.unsubscribe();\r\n }\r\n this._callSubscribers.clear();\r\n\r\n for (const [_, incomingCallSubscriber] of this._incomingCallSubscribers.entries()) {\r\n incomingCallSubscriber.unsubscribe();\r\n }\r\n this._incomingCallSubscribers.clear();\r\n\r\n for (const [_, declarativeCall] of this._declarativeCalls.entries()) {\r\n declarativeCall.unsubscribe();\r\n }\r\n this._declarativeCalls.clear();\r\n };\r\n\r\n private callsUpdated = (event: { added: Call[]; removed: Call[] }): void => {\r\n const addedStatefulCall: DeclarativeCall[] = [];\r\n for (const call of event.added) {\r\n const statefulCall = this.addCall(call);\r\n addedStatefulCall.push(statefulCall);\r\n }\r\n const removedStatefulCall: DeclarativeCall[] = [];\r\n for (const call of event.removed) {\r\n disposeAllViewsFromCall(this._context, this._internalContext, call.id);\r\n const callSubscriber = this._callSubscribers.get(call);\r\n if (callSubscriber) {\r\n callSubscriber.unsubscribe();\r\n this._callSubscribers.delete(call);\r\n }\r\n this._context.setCallEnded(call.id, call.callEndReason);\r\n const declarativeCall = this._declarativeCalls.get(call);\r\n if (declarativeCall) {\r\n declarativeCall.unsubscribe();\r\n removedStatefulCall.push(declarativeCall);\r\n this._declarativeCalls.delete(call);\r\n } else {\r\n removedStatefulCall.push(callDeclaratify(call, this._context));\r\n }\r\n }\r\n\r\n for (const externalCallsUpdatedListener of this._externalCallsUpdatedListeners) {\r\n externalCallsUpdatedListener({ added: addedStatefulCall, removed: removedStatefulCall });\r\n }\r\n };\r\n\r\n private setIncomingCallEnded = (incomingCallId: string, callEndReason: CallEndReason): void => {\r\n const incomingCallSubscriber = this._incomingCallSubscribers.get(incomingCallId);\r\n if (incomingCallSubscriber) {\r\n incomingCallSubscriber.unsubscribe();\r\n this._incomingCallSubscribers.delete(incomingCallId);\r\n }\r\n this._context.setIncomingCallEnded(incomingCallId, callEndReason);\r\n };\r\n\r\n private incomingCall = (event: { incomingCall: IncomingCall }): void => {\r\n // Make sure to not subscribe to the incoming call if we are already subscribed to it.\r\n if (!this._incomingCallSubscribers.has(event.incomingCall.id)) {\r\n this._incomingCallSubscribers.set(\r\n event.incomingCall.id,\r\n new IncomingCallSubscriber(event.incomingCall, this.setIncomingCallEnded)\r\n );\r\n }\r\n this._context.setIncomingCall(convertSdkIncomingCallToDeclarativeIncomingCall(event.incomingCall));\r\n };\r\n\r\n private addCall = (call: Call): DeclarativeCall => {\r\n this._callSubscribers.get(call)?.unsubscribe();\r\n\r\n // For API extentions we need to have the call in the state when we are subscribing as we may want to update the\r\n // state during the subscription process in the subscriber so we add the call to state before subscribing.\r\n this._context.setCall(convertSdkCallToDeclarativeCall(call));\r\n this._callSubscribers.set(call, new CallSubscriber(call, this._context, this._internalContext));\r\n return this.getOrCreateDeclarativeCall(call);\r\n };\r\n\r\n private getOrCreateDeclarativeCall = (call: Call): DeclarativeCall => {\r\n const declarativeCall = this._declarativeCalls.get(call);\r\n if (declarativeCall) {\r\n return declarativeCall;\r\n }\r\n\r\n const newDeclarativeCall = callDeclaratify(call, this._context);\r\n this._declarativeCalls.set(call, newDeclarativeCall as DeclarativeCall);\r\n return newDeclarativeCall;\r\n };\r\n\r\n public get<P extends keyof CallAgent>(target: CallAgent, prop: P): any {\r\n switch (prop) {\r\n case 'startCall': {\r\n return (...args: Parameters<CallAgent['startCall']>): Call => {\r\n const call = target.startCall(...args);\r\n this.addCall(call);\r\n return this.getOrCreateDeclarativeCall(call);\r\n };\r\n }\r\n case 'join': {\r\n return (...args: Parameters<CallAgent['join']>): Call => {\r\n const call = target.join(...args);\r\n this.addCall(call);\r\n return this.getOrCreateDeclarativeCall(call);\r\n };\r\n }\r\n case 'calls': {\r\n return Array.from(this._declarativeCalls.values());\r\n }\r\n case 'on': {\r\n return (...args: Parameters<CallAgent['on']>): void => {\r\n const isCallsUpdated = args[0] === 'callsUpdated';\r\n if (isCallsUpdated) {\r\n const listener = args[1];\r\n this._externalCallsUpdatedListeners.add(listener);\r\n } else {\r\n target.on(...args);\r\n }\r\n };\r\n }\r\n case 'off': {\r\n return (...args: Parameters<CallAgent['off']>): void => {\r\n const isCallsUpdated = args[0] === 'callsUpdated';\r\n if (isCallsUpdated) {\r\n const listener = args[1];\r\n this._externalCallsUpdatedListeners.delete(listener);\r\n } else {\r\n target.off(...args);\r\n }\r\n };\r\n }\r\n case 'dispose': {\r\n return (): Promise<void> => {\r\n return target.dispose().then(() => {\r\n this.unsubscribe();\r\n });\r\n };\r\n }\r\n default:\r\n return Reflect.get(target, prop);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Creates a declarative CallAgent by proxying CallAgent with ProxyCallAgent which will track state updates by updating\r\n * the given context.\r\n *\r\n * @param callAgent - CallAgent from SDK\r\n * @param context - CallContext from StatefulCallClient\r\n * @param internalContext- InternalCallContext from StatefulCallClient\r\n */\r\nexport const callAgentDeclaratify = (\r\n callAgent: CallAgent,\r\n context: CallContext,\r\n internalContext: InternalCallContext\r\n): CallAgent => {\r\n // Make sure there are no existing call data if creating a new CallAgentDeclarative (if creating a new\r\n // CallAgentDeclarative after disposing of the hold one will mean context have old call state). TODO: should we stop\r\n // rendering when the previous callAgent is disposed?\r\n disposeAllViews(context, internalContext);\r\n\r\n context.clearCallRelatedState();\r\n internalContext.clearCallRelatedState();\r\n return new Proxy(callAgent, new ProxyCallAgent(callAgent, context, internalContext)) as CallAgent;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { LocalVideoStream, RemoteVideoStream, VideoStreamRenderer } from '@azure/communication-calling';\r\nimport { LocalVideoStreamState } from './CallClientState';\r\n\r\n/**\r\n * Internally tracked render status. Stores the status of a video render of a stream as rendering could take a long\r\n * time.\r\n *\r\n * 'NotRendered' - the stream has not yet been rendered\r\n * 'Rendering' - the stream is currently rendering\r\n * 'Rendered' - the stream has been rendered\r\n * 'Stopping' - the stream is currently rendering but has been signaled to stop\r\n */\r\nexport type RenderStatus = 'NotRendered' | 'Rendering' | 'Rendered' | 'Stopping';\r\n\r\n/**\r\n * Internal container to hold common state needed to keep track of renders.\r\n */\r\nexport interface RenderInfo {\r\n status: RenderStatus;\r\n renderer: VideoStreamRenderer | undefined;\r\n}\r\n\r\n/**\r\n * Internally used to keep track of the status, renderer, and awaiting promise, associated with a LocalVideoStream.\r\n */\r\nexport interface LocalRenderInfo extends RenderInfo {\r\n stream: LocalVideoStream;\r\n}\r\n\r\n/**\r\n * Internally used to keep track of the status, renderer, and awaiting promise, associated with a RemoteVideoStream.\r\n */\r\nexport interface RemoteRenderInfo extends RenderInfo {\r\n stream: RemoteVideoStream;\r\n}\r\n\r\n/**\r\n * Contains internal data used between different Declarative components to share data.\r\n */\r\nexport class InternalCallContext {\r\n // <CallId, <ParticipantKey, <StreamId, RemoteRenderInfo>>\r\n private _remoteRenderInfos: Map<string, Map<string, Map<number, RemoteRenderInfo>>>;\r\n\r\n // <CallId, LocalRenderInfo>.\r\n private _localRenderInfos: Map<string, LocalRenderInfo>;\r\n\r\n // Used for keeping track of rendered LocalVideoStreams that are not part of a Call.\r\n private _unparentedRenderInfos: Map<LocalVideoStreamState, LocalRenderInfo>;\r\n\r\n constructor() {\r\n this._remoteRenderInfos = new Map<string, Map<string, Map<number, RemoteRenderInfo>>>();\r\n this._localRenderInfos = new Map<string, LocalRenderInfo>();\r\n this._unparentedRenderInfos = new Map<LocalVideoStreamState, LocalRenderInfo>();\r\n }\r\n\r\n public setCallId(newCallId: string, oldCallId: string): void {\r\n const remoteRenderInfos = this._remoteRenderInfos.get(oldCallId);\r\n if (remoteRenderInfos) {\r\n this._remoteRenderInfos.delete(oldCallId);\r\n this._remoteRenderInfos.set(newCallId, remoteRenderInfos);\r\n }\r\n\r\n const localRenderInfos = this._localRenderInfos.get(oldCallId);\r\n if (localRenderInfos) {\r\n this._localRenderInfos.delete(oldCallId);\r\n this._localRenderInfos.set(newCallId, localRenderInfos);\r\n }\r\n }\r\n\r\n public getRemoteRenderInfos(): Map<string, Map<string, Map<number, RemoteRenderInfo>>> {\r\n return this._remoteRenderInfos;\r\n }\r\n\r\n public getRemoteRenderInfoForCall(callId: string): Map<string, Map<number, RemoteRenderInfo>> | undefined {\r\n return this._remoteRenderInfos.get(callId);\r\n }\r\n\r\n public getRemoteRenderInfoForParticipant(\r\n callId: string,\r\n participantKey: string,\r\n streamId: number\r\n ): RemoteRenderInfo | undefined {\r\n const callRenderInfos = this._remoteRenderInfos.get(callId);\r\n if (!callRenderInfos) {\r\n return undefined;\r\n }\r\n const participantRenderInfos = callRenderInfos.get(participantKey);\r\n if (!participantRenderInfos) {\r\n return undefined;\r\n }\r\n return participantRenderInfos.get(streamId);\r\n }\r\n\r\n public setRemoteRenderInfo(\r\n callId: string,\r\n participantKey: string,\r\n streamId: number,\r\n stream: RemoteVideoStream,\r\n status: RenderStatus,\r\n renderer: VideoStreamRenderer | undefined\r\n ): void {\r\n let callRenderInfos = this._remoteRenderInfos.get(callId);\r\n if (!callRenderInfos) {\r\n callRenderInfos = new Map<string, Map<number, RemoteRenderInfo>>();\r\n this._remoteRenderInfos.set(callId, callRenderInfos);\r\n }\r\n\r\n let participantRenderInfos = callRenderInfos.get(participantKey);\r\n if (!participantRenderInfos) {\r\n participantRenderInfos = new Map<number, RemoteRenderInfo>();\r\n callRenderInfos.set(participantKey, participantRenderInfos);\r\n }\r\n\r\n participantRenderInfos.set(streamId, { stream, status, renderer });\r\n }\r\n\r\n public deleteRemoteRenderInfo(callId: string, participantKey: string, streamId: number): void {\r\n const callRenderInfos = this._remoteRenderInfos.get(callId);\r\n if (!callRenderInfos) {\r\n return;\r\n }\r\n\r\n const participantRenderInfos = callRenderInfos.get(participantKey);\r\n if (!participantRenderInfos) {\r\n return;\r\n }\r\n\r\n participantRenderInfos.delete(streamId);\r\n }\r\n\r\n public setLocalRenderInfo(\r\n callId: string,\r\n stream: LocalVideoStream,\r\n status: RenderStatus,\r\n renderer: VideoStreamRenderer | undefined\r\n ): void {\r\n this._localRenderInfos.set(callId, { stream, status, renderer });\r\n }\r\n\r\n public getLocalRenderInfo(callId: string): LocalRenderInfo | undefined {\r\n return this._localRenderInfos.get(callId);\r\n }\r\n\r\n public deleteLocalRenderInfo(callId: string): void {\r\n this._localRenderInfos.delete(callId);\r\n }\r\n\r\n public getUnparentedRenderInfo(localVideoStream: LocalVideoStreamState): LocalRenderInfo | undefined {\r\n return this._unparentedRenderInfos.get(localVideoStream);\r\n }\r\n\r\n public setUnparentedRenderInfo(\r\n statefulStream: LocalVideoStreamState,\r\n stream: LocalVideoStream,\r\n status: RenderStatus,\r\n renderer: VideoStreamRenderer | undefined\r\n ): void {\r\n this._unparentedRenderInfos.set(statefulStream, { stream, status, renderer });\r\n }\r\n\r\n public deleteUnparentedRenderInfo(localVideoStream: LocalVideoStreamState): void {\r\n this._unparentedRenderInfos.delete(localVideoStream);\r\n }\r\n\r\n // UnparentedRenderInfos are not cleared as they are not part of the Call state.\r\n public clearCallRelatedState(): void {\r\n this._remoteRenderInfos.clear();\r\n this._localRenderInfos.clear();\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { deviceManagerDeclaratify } from './DeviceManagerDeclarative';\r\nimport {\r\n CallAgent,\r\n CallClient,\r\n CallClientOptions,\r\n CreateViewOptions,\r\n DeviceManager\r\n} from '@azure/communication-calling';\r\nimport { CallClientState, LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\r\nimport { CallContext } from './CallContext';\r\nimport { callAgentDeclaratify } from './CallAgentDeclarative';\r\nimport { InternalCallContext } from './InternalCallContext';\r\nimport { createView, disposeView } from './StreamUtils';\r\nimport {\r\n CommunicationUserKind,\r\n MicrosoftTeamsUserKind,\r\n PhoneNumberKind,\r\n UnknownIdentifierKind\r\n} from '@azure/communication-common';\r\n\r\n/**\r\n * Defines the methods that allow CallClient {@Link @azure/communication-calling#CallClient} to be used statefully.\r\n * The interface provides access to proxied state and also allows registering a handler for state change events. For\r\n * state definition see {@Link CallClientState}.\r\n *\r\n * State change events are driven by:\r\n * - Returned data from {@Link @azure/communication-calling#DeviceManager} APIs.\r\n * - Returned data from {@Link @azure/communication-calling#CallAgent} APIs.\r\n * - Listeners automatically attached to various azure communication-calling objects:\r\n * - CallAgent 'incomingCall'\r\n * - CallAgent 'callsUpdated'\r\n * - DeviceManager 'videoDevicesUpdated'\r\n * - DeviceManager 'audioDevicesUpdated\r\n * - DeviceManager 'selectedMicrophoneChanged'\r\n * - DeviceManager 'selectedSpeakerChanged'\r\n * - Call 'stateChanged'\r\n * - Call 'idChanged'\r\n * - Call 'isMutedChanged'\r\n * - Call 'isScreenSharingOnChanged'\r\n * - Call 'remoteParticipantsUpdated'\r\n * - Call 'localVideoStreamsUpdated'\r\n * - IncomingCall 'callEnded'\r\n * - RemoteParticipant 'stateChanged'\r\n * - RemoteParticipant 'isMutedChanged'\r\n * - RemoteParticipant 'displayNameChanged'\r\n * - RemoteParticipant 'isSpeakingChanged'\r\n * - RemoteParticipant 'videoStreamsUpdated'\r\n * - RemoteVideoStream 'isAvailableChanged'\r\n * - TranscriptionCallFeature 'isTranscriptionActiveChanged'\r\n * - RecordingCallFeature 'isRecordingActiveChanged'\r\n * - Transfer 'stateChanged'\r\n * - TransferCallFeature 'transferRequested'\r\n */\r\nexport interface StatefulCallClient extends CallClient {\r\n /**\r\n * Holds all the state that we could proxy from CallClient {@Link @azure/communication-calling#CallClient} as\r\n * CallClientState {@Link CallClientState}.\r\n */\r\n getState(): CallClientState;\r\n /**\r\n * Allows a handler to be registered for 'stateChanged' events.\r\n *\r\n * @param handler - Callback to receive the state.\r\n */\r\n onStateChange(handler: (state: CallClientState) => void): void;\r\n /**\r\n * Allows unregistering for 'stateChanged' events.\r\n *\r\n * @param handler - Original callback to be unsubscribed.\r\n */\r\n offStateChange(handler: (state: CallClientState) => void): void;\r\n /**\r\n * Renders a {@Link RemoteVideoStreamState} or {@Link LocalVideoStreamState} and stores the resulting\r\n * {@Link VideoStreamRendererViewState} under the relevant {@Link RemoteVideoStreamState} or\r\n * {@Link LocalVideoStreamState} or as unparented view in the state. Under the hood calls\r\n * {@Link @azure/communication-calling#VideoStreamRenderer.createView}.\r\n *\r\n * Scenario 1: Render RemoteVideoStreamState\r\n * - CallId is required, participantId is required, and stream of type RemoteVideoStreamState is required\r\n * - Resulting {@Link VideoStreamRendererViewState} is stored in the given callId and participantId in\r\n * {@Link CallClientState}\r\n *\r\n * Scenario 2: Render LocalVideoStreamState for a call\r\n * - CallId is required, participantId must be undefined, and stream of type LocalVideoStreamState is required.\r\n * - The {@Link @azure/communication-calling#Call.localVideoStreams} must already be started using\r\n * {@Link @azure/communication-calling#Call.startVideo}.\r\n * - Resulting {@Link VideoStreamRendererViewState} is stored in the given callId {@Link CallState.localVideoStreams}\r\n * in {@Link CallClientState}.\r\n *\r\n * - Scenario 2: Render LocalVideoStreamState not part of a call (example rendering camera for local preview)\r\n * - CallId must be undefined, participantId must be undefined, and stream of type LocalVideoStreamState is required.\r\n * - Resulting {@Link VideoStreamRendererViewState} is stored in under the given LocalVideoStreamState in\r\n * {@Link CallClientState.deviceManager.unparentedViews}\r\n *\r\n * @param callId - CallId for the given stream. Can be undefined if the stream is not part of any call.\r\n * @param participantId - {@Link RemoteParticipant.identifier} associated with the given RemoteVideoStreamState. Could\r\n * be undefined if rendering LocalVideoStreamState.\r\n * @param stream - The LocalVideoStreamState or RemoteVideoStreamState to start rendering.\r\n * @param options - Options that are passed to the {@Link @azure/communication-calling#VideoStreamRenderer}.\r\n */\r\n createView(\r\n callId: string | undefined,\r\n participantId: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState,\r\n options?: CreateViewOptions\r\n ): Promise<void>;\r\n /**\r\n * Stops rendering a {@Link RemoteVideoStreamState} or {@Link LocalVideoStreamState} and removes the\r\n * {@Link VideoStreamRendererView} from the relevant {@Link RemoteVideoStreamState} in {@Link CallClientState} or\r\n * {@Link LocalVideoStream} in {@Link CallClientState} or appropriate\r\n * {@Link CallClientState.deviceManager.unparentedViews} Under the hood calls\r\n * {@Link @azure/communication-calling#VideoStreamRenderer.dispose}.\r\n *\r\n * Its important to disposeView to clean up resources properly.\r\n *\r\n * Scenario 1: Dispose RemoteVideoStreamState\r\n * - CallId is required, participantId is required, and stream of type RemoteVideoStreamState is required\r\n *\r\n * Scenario 2: Dispose LocalVideoStreamState for a call\r\n * - CallId is required, participantId must be undefined, and stream of type LocalVideoStreamState is required.\r\n *\r\n * - Scenario 2: Dispose LocalVideoStreamState not part of a call\r\n * - CallId must be undefined, participantId must be undefined, and stream of type LocalVideoStreamState is required.\r\n * - LocalVideoStreamState must be the original one passed to createView.\r\n *\r\n * @param callId - CallId for the given stream. Can be undefined if the stream is not part of any call.\r\n * @param participantId - {@Link RemoteParticipant.identifier} associated with the given RemoteVideoStreamState. Could\r\n * be undefined if disposing LocalVideoStreamState.\r\n * @param stream - The LocalVideoStreamState or RemoteVideoStreamState to dispose.\r\n */\r\n disposeView(\r\n callId: string | undefined,\r\n participantId: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState\r\n ): void;\r\n}\r\n\r\n/**\r\n * ProxyCallClient proxies CallClient {@Link @azure/communication-calling#CallClient} and subscribes to all events that\r\n * affect state. ProxyCallClient keeps its own copy of the call state and when state is updated, ProxyCallClient emits\r\n * the event 'stateChanged'.\r\n */\r\nclass ProxyCallClient implements ProxyHandler<CallClient> {\r\n private _context: CallContext;\r\n private _internalContext: InternalCallContext;\r\n private _callAgent: CallAgent | undefined;\r\n private _deviceManager: DeviceManager | undefined;\r\n private _sdkDeviceManager: DeviceManager | undefined;\r\n\r\n constructor(context: CallContext, internalContext: InternalCallContext) {\r\n this._context = context;\r\n this._internalContext = internalContext;\r\n }\r\n\r\n public get<P extends keyof CallClient>(target: CallClient, prop: P): any {\r\n switch (prop) {\r\n case 'createCallAgent': {\r\n return async (...args: Parameters<CallClient['createCallAgent']>) => {\r\n // createCallAgent will throw an exception if the previous callAgent was not disposed. If the previous\r\n // callAgent was disposed then it would have unsubscribed to events so we can just create a new declarative\r\n // callAgent if the createCallAgent succeeds.\r\n const callAgent = await target.createCallAgent(...args);\r\n this._callAgent = callAgentDeclaratify(callAgent, this._context, this._internalContext);\r\n this._context.setCallAgent({ displayName: this._callAgent.displayName });\r\n return this._callAgent;\r\n };\r\n }\r\n case 'getDeviceManager': {\r\n return async () => {\r\n // As of writing, the SDK always returns the same instance of DeviceManager so we keep a reference of\r\n // DeviceManager and if it does not change we return the cached DeclarativeDeviceManager. If it does not we'll\r\n // throw an error that indicate we need to fix this issue as our implementation has diverged from the SDK.\r\n const deviceManager = await target.getDeviceManager();\r\n if (this._sdkDeviceManager) {\r\n if (this._sdkDeviceManager === deviceManager) {\r\n return this._deviceManager;\r\n } else {\r\n throw new Error(\r\n 'Multiple DeviceManager not supported. This means a incompatible version of communication-calling is ' +\r\n 'used OR calling declarative was not properly updated to communication-calling version.'\r\n );\r\n }\r\n } else {\r\n this._sdkDeviceManager = deviceManager;\r\n }\r\n this._deviceManager = deviceManagerDeclaratify(deviceManager, this._context);\r\n return this._deviceManager;\r\n };\r\n }\r\n default:\r\n return Reflect.get(target, prop);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Required arguments to construct the stateful call client.\r\n */\r\nexport type StatefulCallClientArgs = {\r\n /**\r\n * UserId from SDK. This is provided for developer convenience to easily access the userId from the\r\n * state. It is not used by StatefulCallClient so if you do not have this value or do not want to use this value,\r\n * you could pass any dummy value like empty string.\r\n */\r\n userId: string;\r\n};\r\n\r\n/**\r\n * Options to construct the stateful call client with.\r\n */\r\nexport type StatefulCallClientOptions = CallClientOptions;\r\n\r\n/**\r\n * Creates a StatefulCallClient {@Link StatefulCallClient} by proxying CallClient\r\n * {@Link @azure/communication-calling#CallClient} with ProxyCallClient {@Link ProxyCallClient} which then allows access\r\n * to state in a declarative way.\r\n *\r\n * It is important to use the {@Link @azure/communication-calling#DeviceManager} and\r\n * {@Link @azure/communication-calling#CallAgent} and {@Link @azure/communication-calling#Call} (and etc.) that are\r\n * obtained from the StatefulCallClient in order for their state changes to be proxied properly.\r\n *\r\n * @param callClientArgs - {@Link StatefulCallClientArgs}\r\n * @param callClientOptions - {@Link StatefulCallClientOptions}\r\n * @returns\r\n */\r\nexport const createStatefulCallClient = (\r\n callClientArgs: StatefulCallClientArgs,\r\n callClientOptions?: StatefulCallClientOptions\r\n): StatefulCallClient => {\r\n const callClient = new CallClient(callClientOptions);\r\n const context: CallContext = new CallContext(callClientArgs.userId);\r\n const internalContext: InternalCallContext = new InternalCallContext();\r\n\r\n Object.defineProperty(callClient, 'getState', {\r\n configurable: false,\r\n value: () => context.getState()\r\n });\r\n Object.defineProperty(callClient, 'onStateChange', {\r\n configurable: false,\r\n value: (handler: (state: CallClientState) => void) => context.onStateChange(handler)\r\n });\r\n Object.defineProperty(callClient, 'offStateChange', {\r\n configurable: false,\r\n value: (handler: (state: CallClientState) => void) => context.offStateChange(handler)\r\n });\r\n Object.defineProperty(callClient, 'createView', {\r\n configurable: false,\r\n value: (\r\n callId: string | undefined,\r\n participantId:\r\n | CommunicationUserKind\r\n | PhoneNumberKind\r\n | MicrosoftTeamsUserKind\r\n | UnknownIdentifierKind\r\n | string\r\n | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState,\r\n options?: CreateViewOptions\r\n ): Promise<void> => {\r\n return createView(context, internalContext, callId, participantId, stream, options);\r\n }\r\n });\r\n Object.defineProperty(callClient, 'disposeView', {\r\n configurable: false,\r\n value: (\r\n callId: string | undefined,\r\n participantId:\r\n | CommunicationUserKind\r\n | PhoneNumberKind\r\n | MicrosoftTeamsUserKind\r\n | UnknownIdentifierKind\r\n | string\r\n | undefined,\r\n stream: LocalVideoStreamState | RemoteVideoStreamState\r\n ): void => {\r\n disposeView(context, internalContext, callId, participantId, stream);\r\n }\r\n });\r\n\r\n return new Proxy(callClient, new ProxyCallClient(context, internalContext)) as StatefulCallClient;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nexport const Constants = {\r\n TYPING_INDICATOR_MAINTAIN_TIME: 8 * 1000,\r\n DUMMY_DATE: new Date(0)\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport EventEmitter from 'events';\r\nimport produce from 'immer';\r\nimport { ChatClientState, ChatThreadClientState, ChatThreadProperties } from './ChatClientState';\r\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\r\nimport { enableMapSet } from 'immer';\r\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\r\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { Constants } from './Constants';\r\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\r\n\r\nenableMapSet();\r\n\r\n// have separated ClientState and ChatThreadState?\r\nexport class ChatContext {\r\n private _state: ChatClientState = {\r\n userId: <UnknownIdentifierKind>{ id: '' },\r\n displayName: '',\r\n threads: new Map()\r\n };\r\n private _batchMode = false;\r\n private _emitter: EventEmitter;\r\n private typingIndicatorInterval: number | undefined = undefined;\r\n\r\n constructor() {\r\n this._emitter = new EventEmitter();\r\n this._emitter.setMaxListeners(50);\r\n }\r\n\r\n public setState(state: ChatClientState): void {\r\n this._state = state;\r\n if (!this._batchMode) {\r\n this._emitter.emit('stateChanged', this._state);\r\n }\r\n }\r\n\r\n public getState(): ChatClientState {\r\n return this._state;\r\n }\r\n\r\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n draft.threads.set(threadId, threadState);\r\n })\r\n );\r\n }\r\n\r\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n draft.threads.set(threadId, {\r\n chatMessages: new Map(),\r\n threadId: threadId,\r\n properties: properties,\r\n participants: new Map(),\r\n readReceipts: [],\r\n typingIndicators: [],\r\n latestReadTime: new Date(0)\r\n });\r\n })\r\n );\r\n }\r\n\r\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n draft.displayName = displayName;\r\n draft.userId = userId;\r\n })\r\n );\r\n }\r\n\r\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\r\n const exists = this.getState().threads.has(threadId);\r\n if (!exists) {\r\n this.createThread(threadId, properties);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const thread = draft.threads.get(threadId);\r\n if (thread) {\r\n thread.properties = properties;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public updateThreadTopic(threadId: string, topic?: string): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n if (topic === undefined) {\r\n return;\r\n }\r\n const thread = draft.threads.get(threadId);\r\n if (thread && !thread.properties) {\r\n thread.properties = { topic: topic };\r\n } else if (thread && thread.properties) {\r\n thread.properties.topic = topic;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public deleteThread(threadId: string): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const thread = draft.threads.get(threadId);\r\n if (thread) {\r\n draft.threads.delete(threadId);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setChatMessages(threadId: string, messages: Map<string, ChatMessageWithStatus>): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const threadState = draft.threads.get(threadId);\r\n if (threadState) {\r\n threadState.chatMessages = messages;\r\n }\r\n\r\n // remove typing indicator when receive messages\r\n const thread = draft.threads.get(threadId);\r\n if (thread) {\r\n for (const message of messages.values()) {\r\n this.filterTypingIndicatorForUser(thread, message.sender);\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const chatMessage = draft.threads.get(threadId)?.chatMessages.get(messagesId);\r\n if (chatMessage) {\r\n if (!chatMessage.content) {\r\n chatMessage.content = {};\r\n }\r\n chatMessage.content.message = content;\r\n }\r\n })\r\n );\r\n }\r\n\r\n public deleteLocalMessage(threadId: string, localId: string): boolean {\r\n let localMessageDeleted = false;\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const chatMessages = draft.threads.get(threadId)?.chatMessages;\r\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages.get(localId) : undefined;\r\n if (chatMessages && message && message.clientMessageId) {\r\n chatMessages.delete(message.clientMessageId);\r\n localMessageDeleted = true;\r\n }\r\n })\r\n );\r\n return localMessageDeleted;\r\n }\r\n\r\n public deleteMessage(threadId: string, id: string): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const chatMessages = draft.threads.get(threadId)?.chatMessages;\r\n chatMessages?.delete(id);\r\n })\r\n );\r\n }\r\n\r\n public setParticipant(threadId: string, participant: ChatParticipant): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const participants = draft.threads.get(threadId)?.participants;\r\n if (participants) {\r\n participants.set(toFlatCommunicationIdentifier(participant.id), participant);\r\n }\r\n })\r\n );\r\n }\r\n\r\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const participantsMap = draft.threads.get(threadId)?.participants;\r\n if (participantsMap) {\r\n for (const participant of participants) {\r\n participantsMap.set(toFlatCommunicationIdentifier(participant.id), participant);\r\n }\r\n }\r\n })\r\n );\r\n }\r\n\r\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const participants = draft.threads.get(threadId)?.participants;\r\n if (participants) {\r\n participantIds.forEach((id) => {\r\n participants.delete(toFlatCommunicationIdentifier(id));\r\n });\r\n }\r\n })\r\n );\r\n }\r\n\r\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const participants = draft.threads.get(threadId)?.participants;\r\n participants?.delete(toFlatCommunicationIdentifier(participantId));\r\n })\r\n );\r\n }\r\n\r\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const thread = draft.threads.get(threadId);\r\n const readReceipts = thread?.readReceipts;\r\n if (thread && readReceipts) {\r\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\r\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\r\n thread.latestReadTime = readReceipt.readOn;\r\n }\r\n readReceipts.push(readReceipt);\r\n }\r\n })\r\n );\r\n }\r\n\r\n private startTypingIndicatorCleanUp(): void {\r\n if (!this.typingIndicatorInterval) {\r\n this.typingIndicatorInterval = window.setInterval(() => {\r\n let isTypingActive = false;\r\n let isStateChanged = false;\r\n const newState = produce(this._state, (draft: ChatClientState) => {\r\n for (const thread of draft.threads.values()) {\r\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\r\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\r\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\r\n });\r\n\r\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\r\n isStateChanged = true;\r\n thread.typingIndicators = filteredTypingIndicators;\r\n }\r\n if (thread.typingIndicators.length > 0) {\r\n isTypingActive = true;\r\n }\r\n }\r\n });\r\n\r\n if (isStateChanged) {\r\n this.setState(newState);\r\n }\r\n if (!isTypingActive && this.typingIndicatorInterval) {\r\n window.clearInterval(this.typingIndicatorInterval);\r\n this.typingIndicatorInterval = undefined;\r\n }\r\n }, 1000);\r\n }\r\n }\r\n\r\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const thread = draft.threads.get(threadId);\r\n if (thread) {\r\n const typingIndicators = thread.typingIndicators;\r\n typingIndicators.push(typingIndicator);\r\n }\r\n })\r\n );\r\n\r\n // Make sure we only maintain a period of typing indicator for perf purposes\r\n this.startTypingIndicatorCleanUp();\r\n }\r\n\r\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\r\n const { id: messageId, clientMessageId } = message;\r\n if (messageId || clientMessageId) {\r\n this.setState(\r\n produce(this._state, (draft: ChatClientState) => {\r\n const threadMessages = draft.threads.get(threadId)?.chatMessages;\r\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages.get(clientMessageId);\r\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\r\n\r\n if (threadMessages && messageKey) {\r\n threadMessages.set(messageKey, message);\r\n }\r\n\r\n // remove typing indicator when receive a message from a user\r\n const thread = draft.threads.get(threadId);\r\n if (thread) {\r\n this.filterTypingIndicatorForUser(thread, message.sender);\r\n }\r\n })\r\n );\r\n }\r\n }\r\n\r\n // This is a mutating function, only use it inside of a produce() function\r\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\r\n if (!userId) return;\r\n const typingIndicators = thread.typingIndicators;\r\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\r\n const filteredTypingIndicators = typingIndicators.filter(\r\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\r\n );\r\n if (filteredTypingIndicators.length !== typingIndicators.length) {\r\n thread.typingIndicators = filteredTypingIndicators;\r\n }\r\n }\r\n\r\n // Batch mode for multiple updates in one action(to trigger just on event), similar to redux batch() function\r\n private startBatch(): void {\r\n this._batchMode = true;\r\n }\r\n\r\n private endBatch(): void {\r\n this._batchMode = false;\r\n this._emitter.emit('stateChanged', this._state);\r\n }\r\n\r\n // All operations finished in this batch should be sync call(only context related)\r\n public batch(batchFunc: () => void): void {\r\n this.startBatch();\r\n const backupState = this._state;\r\n try {\r\n batchFunc();\r\n } catch (e) {\r\n this._state = backupState;\r\n } finally {\r\n this.endBatch();\r\n }\r\n }\r\n\r\n public onStateChange(handler: (state: ChatClientState) => void): void {\r\n this._emitter.on('stateChanged', handler);\r\n }\r\n\r\n public offStateChange(handler: (state: ChatClientState) => void): void {\r\n this._emitter.off('stateChanged', handler);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatMessage } from '@azure/communication-chat';\r\nimport { MessageStatus } from 'acs-ui-common';\r\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\r\n\r\nexport const convertChatMessage = (\r\n message: ChatMessage,\r\n status: MessageStatus = 'delivered',\r\n clientMessageId?: string\r\n): ChatMessageWithStatus => {\r\n return {\r\n ...message,\r\n clientMessageId: clientMessageId,\r\n status\r\n };\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClient, ChatMessageReadReceipt } from '@azure/communication-chat';\r\nimport {\r\n ChatMessageDeletedEvent,\r\n ChatMessageEditedEvent,\r\n ChatMessageReceivedEvent,\r\n ChatThreadCreatedEvent,\r\n ChatThreadDeletedEvent,\r\n ChatThreadPropertiesUpdatedEvent,\r\n ParticipantsAddedEvent,\r\n ParticipantsRemovedEvent,\r\n ReadReceiptReceivedEvent,\r\n TypingIndicatorReceivedEvent\r\n} from '@azure/communication-signaling';\r\nimport { ChatContext } from './ChatContext';\r\nimport { convertChatMessage } from './convertChatMessage';\r\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\r\n\r\nexport class EventSubscriber {\r\n private chatClient: ChatClient;\r\n private chatContext: ChatContext;\r\n\r\n constructor(chatClient: ChatClient, chatContext: ChatContext) {\r\n this.chatClient = chatClient;\r\n this.chatContext = chatContext;\r\n this.subscribe();\r\n }\r\n\r\n private convertEventToChatMessage = (\r\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent\r\n ): ChatMessageWithStatus => {\r\n return convertChatMessage({\r\n id: event.id,\r\n version: event.version,\r\n content: { message: event.message },\r\n type: event.type,\r\n sender: event.sender,\r\n senderDisplayName: event.senderDisplayName,\r\n sequenceId: '', // Note: there is a bug in chatMessageReceived event that it is missing sequenceId\r\n createdOn: new Date(event.createdOn)\r\n });\r\n };\r\n\r\n private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {\r\n const newMessage = this.convertEventToChatMessage(event);\r\n // Because of bug in chatMessageReceived event, if we already have that particular message in context, we want to\r\n // make sure to not overwrite the sequenceId when calling setChatMessage.\r\n const existingMessage = this.chatContext.getState().threads.get(event.threadId)?.chatMessages.get(event.id);\r\n if (existingMessage) {\r\n newMessage.sequenceId = existingMessage.sequenceId;\r\n }\r\n this.chatContext.batch(() => {\r\n this.chatContext.createThreadIfNotExist(event.threadId);\r\n this.chatContext.setChatMessage(event.threadId, newMessage);\r\n });\r\n };\r\n\r\n private onChatMessageDeleted = (event: ChatMessageDeletedEvent): void => {\r\n this.chatContext.deleteMessage(event.threadId, event.id);\r\n };\r\n\r\n private onChatMessageEdited = (event: ChatMessageEditedEvent): void => {\r\n const editedMessage = this.convertEventToChatMessage(event);\r\n this.chatContext.setChatMessage(event.threadId, convertChatMessage(editedMessage));\r\n };\r\n\r\n private onParticipantsAdded = (event: ParticipantsAddedEvent): void => {\r\n const participantsToAdd = event.participantsAdded.map((participant) => ({\r\n ...participant,\r\n shareHistoryTime: participant.shareHistoryTime ? new Date(participant.shareHistoryTime) : undefined\r\n }));\r\n this.chatContext.batch(() => {\r\n this.chatContext.createThreadIfNotExist(event.threadId);\r\n this.chatContext.setParticipants(event.threadId, participantsToAdd);\r\n });\r\n };\r\n\r\n private onParticipantsRemoved = (event: ParticipantsRemovedEvent): void => {\r\n const participantIds = event.participantsRemoved.map((participant) => {\r\n return participant.id;\r\n });\r\n this.chatContext.deleteParticipants(event.threadId, participantIds);\r\n };\r\n\r\n private onReadReceiptReceived = (event: ReadReceiptReceivedEvent): void => {\r\n const readReceipt: ChatMessageReadReceipt = {\r\n ...event,\r\n sender: event.sender,\r\n readOn: new Date(event.readOn)\r\n };\r\n this.chatContext.batch(() => {\r\n this.chatContext.createThreadIfNotExist(event.threadId);\r\n this.chatContext.addReadReceipt(event.threadId, readReceipt);\r\n });\r\n };\r\n\r\n private onTypingIndicatorReceived = (typingIndicator: TypingIndicatorReceivedEvent): void => {\r\n this.chatContext.batch(() => {\r\n this.chatContext.createThreadIfNotExist(typingIndicator.threadId);\r\n this.chatContext.addTypingIndicator(typingIndicator.threadId, typingIndicator);\r\n });\r\n };\r\n\r\n private onChatThreadCreated = (event: ChatThreadCreatedEvent): void => {\r\n const properties = {\r\n topic: event.properties.topic\r\n };\r\n if (!this.chatContext.createThreadIfNotExist(event.threadId, properties)) {\r\n this.chatContext.updateThread(event.threadId, properties);\r\n }\r\n };\r\n\r\n private onChatThreadDeleted = (event: ChatThreadDeletedEvent): void => {\r\n this.chatContext.deleteThread(event.threadId);\r\n };\r\n\r\n private onChatThreadPropertiesUpdated = (event: ChatThreadPropertiesUpdatedEvent): void => {\r\n this.chatContext.updateThread(event.threadId, { topic: event.properties.topic });\r\n };\r\n\r\n public subscribe = (): void => {\r\n this.chatClient.on('chatMessageReceived', this.onChatMessageReceived);\r\n this.chatClient.on('chatMessageDeleted', this.onChatMessageDeleted);\r\n this.chatClient.on('chatMessageEdited', this.onChatMessageEdited);\r\n\r\n this.chatClient.on('participantsAdded', this.onParticipantsAdded);\r\n this.chatClient.on('participantsRemoved', this.onParticipantsRemoved);\r\n\r\n this.chatClient.on('readReceiptReceived', this.onReadReceiptReceived);\r\n this.chatClient.on('typingIndicatorReceived', this.onTypingIndicatorReceived);\r\n\r\n this.chatClient.on('chatThreadCreated', this.onChatThreadCreated);\r\n this.chatClient.on('chatThreadDeleted', this.onChatThreadDeleted);\r\n this.chatClient.on('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\r\n };\r\n\r\n public unsubscribe = (): void => {\r\n this.chatClient.off('chatMessageReceived', this.onChatMessageReceived);\r\n this.chatClient.off('chatMessageDeleted', this.onChatMessageDeleted);\r\n this.chatClient.off('chatMessageEdited', this.onChatMessageEdited);\r\n\r\n this.chatClient.off('participantsAdded', this.onParticipantsAdded);\r\n this.chatClient.off('participantsRemoved', this.onParticipantsRemoved);\r\n\r\n this.chatClient.off('readReceiptReceived', this.onReadReceiptReceived);\r\n this.chatClient.off('typingIndicatorReceived', this.onTypingIndicatorReceived);\r\n\r\n this.chatClient.off('chatThreadCreated', this.onChatThreadCreated);\r\n this.chatClient.off('chatThreadDeleted', this.onChatThreadDeleted);\r\n this.chatClient.off('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\r\n };\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ListPageSettings } from '@azure/communication-chat';\r\nimport { ChatContext } from '../ChatContext';\r\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\r\n\r\ntype IteratorCreatorFn<T, OptionsType, PageT = T[]> = (options?: OptionsType) => PagedAsyncIterableIterator<T, PageT>;\r\n\r\n/**\r\n * Create a decorated iterator\r\n * returned iterators.\r\n *\r\n * @param iteratorCreator the function to create the original iterator\r\n * @param context chatContext\r\n * @param decorateFn the function for the decorating behavior\r\n */\r\nexport const createDecoratedIterator = <ItemType, OptionsType>(\r\n iteratorCreator: IteratorCreatorFn<ItemType, OptionsType>,\r\n context: ChatContext,\r\n decorateFn: (item: ItemType, context: ChatContext) => void\r\n) => {\r\n return (...args: Parameters<IteratorCreatorFn<ItemType, OptionsType>>): PagedAsyncIterableIterator<ItemType> => {\r\n const threadsIterator = iteratorCreator(...args);\r\n return {\r\n async next() {\r\n const result = await threadsIterator.next();\r\n if (!result.done && result.value) {\r\n decorateFn(result.value, context);\r\n }\r\n return result;\r\n },\r\n [Symbol.asyncIterator]() {\r\n return this;\r\n },\r\n byPage: (settings: ListPageSettings = {}): AsyncIterableIterator<ItemType[]> => {\r\n const pages = threadsIterator.byPage(settings);\r\n return {\r\n async next() {\r\n const result = await pages.next();\r\n const page = result.value;\r\n if (!result.done && result.value) {\r\n context.batch(() => {\r\n for (const item of page) {\r\n decorateFn(item, context);\r\n }\r\n });\r\n }\r\n return result;\r\n },\r\n [Symbol.asyncIterator]() {\r\n return this;\r\n }\r\n };\r\n }\r\n };\r\n };\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatMessage, ChatThreadClient, RestListMessagesOptions } from '@azure/communication-chat';\r\nimport { ChatContext } from '../ChatContext';\r\nimport { convertChatMessage } from '../convertChatMessage';\r\nimport { createDecoratedIterator } from './createDecoratedIterator';\r\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\r\n\r\nexport const createDecoratedListMessages = (\r\n chatThreadClient: ChatThreadClient,\r\n context: ChatContext\r\n): ((options?: RestListMessagesOptions) => PagedAsyncIterableIterator<ChatMessage>) => {\r\n const setMessage = (message: ChatMessage, context: ChatContext): void => {\r\n context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\r\n };\r\n return createDecoratedIterator(chatThreadClient.listMessages.bind(chatThreadClient), context, setMessage);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatThreadClient, ChatMessageReadReceipt, RestListReadReceiptsOptions } from '@azure/communication-chat';\r\nimport { ChatContext } from '../ChatContext';\r\nimport { createDecoratedIterator } from './createDecoratedIterator';\r\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\r\n\r\nexport const createDecoratedListReadReceipts = (\r\n chatThreadClient: ChatThreadClient,\r\n context: ChatContext\r\n): ((options?: RestListReadReceiptsOptions | undefined) => PagedAsyncIterableIterator<ChatMessageReadReceipt>) => {\r\n const setReadReceipt = (readReceipt: ChatMessageReadReceipt, context: ChatContext): void => {\r\n context.addReadReceipt(chatThreadClient.threadId, {\r\n ...readReceipt\r\n });\r\n };\r\n return createDecoratedIterator(chatThreadClient.listReadReceipts.bind(chatThreadClient), context, setReadReceipt);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatParticipant, ChatThreadClient, RestListParticipantsOptions } from '@azure/communication-chat';\r\nimport { ChatContext } from '../ChatContext';\r\nimport { createDecoratedIterator } from './createDecoratedIterator';\r\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\r\n\r\nexport const createDecoratedListParticipants = (\r\n chatThreadClient: ChatThreadClient,\r\n context: ChatContext\r\n): ((options?: RestListParticipantsOptions) => PagedAsyncIterableIterator<ChatParticipant>) => {\r\n const setParticipant = (participant: ChatParticipant, context: ChatContext): void => {\r\n context.setParticipant(chatThreadClient.threadId, participant);\r\n };\r\n return createDecoratedIterator(chatThreadClient.listParticipants.bind(chatThreadClient), context, setParticipant);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatThreadClient, SendChatMessageResult } from '@azure/communication-chat';\r\nimport { getIdentifierKind } from '@azure/communication-common';\r\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\r\nimport { ChatContext } from './ChatContext';\r\nimport { nanoid } from 'nanoid';\r\nimport { createDecoratedListMessages } from './iterators/createDecoratedListMessages';\r\nimport { createDecoratedListReadReceipts } from './iterators/createDecoratedListReadReceipts';\r\nimport { createDecoratedListParticipants } from './iterators/createDecoratedListParticipants';\r\nimport { convertChatMessage } from './convertChatMessage';\r\n\r\nclass ProxyChatThreadClient implements ProxyHandler<ChatThreadClient> {\r\n private _context: ChatContext;\r\n\r\n constructor(context: ChatContext) {\r\n this._context = context;\r\n }\r\n\r\n public get<P extends keyof ChatThreadClient>(chatThreadClient: ChatThreadClient, prop: P): any {\r\n switch (prop) {\r\n case 'listMessages': {\r\n return createDecoratedListMessages(chatThreadClient, this._context);\r\n }\r\n case 'getMessage': {\r\n return async (...args: Parameters<ChatThreadClient['getMessage']>) => {\r\n const message = await chatThreadClient.getMessage(...args);\r\n this._context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\r\n return message;\r\n };\r\n }\r\n case 'sendMessage': {\r\n // Retry logic?\r\n return async (...args: Parameters<ChatThreadClient['sendMessage']>) => {\r\n const { content } = args[0];\r\n const clientMessageId = nanoid(); // Generate a local short uuid for message\r\n const newMessage: ChatMessageWithStatus = {\r\n content: { message: content },\r\n clientMessageId,\r\n id: '',\r\n type: 'text',\r\n sequenceId: '',\r\n version: '',\r\n createdOn: new Date(),\r\n status: 'sending',\r\n senderDisplayName: this._context.getState().displayName,\r\n sender: this._context.getState().userId\r\n };\r\n this._context.setChatMessage(chatThreadClient.threadId, newMessage);\r\n\r\n let result: SendChatMessageResult | undefined = undefined;\r\n try {\r\n result = await chatThreadClient.sendMessage(...args);\r\n } catch (e) {\r\n this._context.setChatMessage(chatThreadClient.threadId, { ...newMessage, status: 'failed' });\r\n throw e;\r\n }\r\n\r\n if (result?.id) {\r\n this._context.batch(() => {\r\n if (!result) {\r\n return;\r\n }\r\n this._context.setChatMessage(chatThreadClient.threadId, {\r\n ...newMessage,\r\n clientMessageId: undefined,\r\n status: 'delivered',\r\n id: result.id\r\n });\r\n this._context.deleteLocalMessage(chatThreadClient.threadId, clientMessageId);\r\n });\r\n }\r\n return result;\r\n };\r\n }\r\n case 'addParticipants': {\r\n return async (...args: Parameters<ChatThreadClient['addParticipants']>) => {\r\n const result = await chatThreadClient.addParticipants(...args);\r\n const [addRequest] = args;\r\n const participantsToAdd = addRequest.participants;\r\n this._context.setParticipants(chatThreadClient.threadId, participantsToAdd);\r\n return result;\r\n };\r\n }\r\n case 'deleteMessage': {\r\n return async (...args: Parameters<ChatThreadClient['deleteMessage']>) => {\r\n // DeleteMessage is able to either delete local one(for failed message) or synced message\r\n const [messageId] = args;\r\n if (this._context.deleteLocalMessage(chatThreadClient.threadId, messageId)) {\r\n return {};\r\n }\r\n const result = await chatThreadClient.deleteMessage(...args);\r\n this._context.deleteMessage(chatThreadClient.threadId, messageId);\r\n return result;\r\n };\r\n }\r\n case 'listParticipants': {\r\n return createDecoratedListParticipants(chatThreadClient, this._context);\r\n }\r\n case 'listReadReceipts': {\r\n return createDecoratedListReadReceipts(chatThreadClient, this._context);\r\n }\r\n case 'removeParticipant': {\r\n return async (...args: Parameters<ChatThreadClient['removeParticipant']>) => {\r\n const result = await chatThreadClient.removeParticipant(...args);\r\n const [removeIdentifier] = args;\r\n this._context.deleteParticipant(chatThreadClient.threadId, getIdentifierKind(removeIdentifier));\r\n return result;\r\n };\r\n }\r\n case 'updateMessage': {\r\n return async (...args: Parameters<ChatThreadClient['updateMessage']>) => {\r\n const result = await chatThreadClient.updateMessage(...args);\r\n const [messageId, updateOption] = args;\r\n\r\n this._context.updateChatMessageContent(chatThreadClient.threadId, messageId, updateOption?.content);\r\n return result;\r\n };\r\n }\r\n case 'updateTopic': {\r\n return async (...args: Parameters<ChatThreadClient['updateTopic']>) => {\r\n const result = await chatThreadClient.updateTopic(...args);\r\n const [topic] = args;\r\n\r\n this._context.updateThreadTopic(chatThreadClient.threadId, topic);\r\n return result;\r\n };\r\n }\r\n case 'getProperties': {\r\n return async (...args: Parameters<ChatThreadClient['getProperties']>) => {\r\n const result = await chatThreadClient.getProperties(...args);\r\n this._context.updateThread(chatThreadClient.threadId, result);\r\n return result;\r\n };\r\n }\r\n default:\r\n return Reflect.get(chatThreadClient, prop);\r\n }\r\n }\r\n}\r\n\r\nexport const chatThreadClientDeclaratify = (\r\n chatThreadClient: ChatThreadClient,\r\n context: ChatContext\r\n): ChatThreadClient => {\r\n context.createThreadIfNotExist(chatThreadClient.threadId);\r\n return new Proxy(chatThreadClient, new ProxyChatThreadClient(context)) as ChatThreadClient;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatThreadItem, ChatClient, RestListChatThreadsOptions } from '@azure/communication-chat';\r\nimport { ChatContext } from '../ChatContext';\r\nimport { createDecoratedIterator } from './createDecoratedIterator';\r\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\r\n\r\nexport const createDecoratedListThreads = (\r\n chatClient: ChatClient,\r\n context: ChatContext\r\n): ((options?: RestListChatThreadsOptions) => PagedAsyncIterableIterator<ChatThreadItem>) => {\r\n const setThreadProperties = (chatThreadItem: ChatThreadItem, context: ChatContext): void => {\r\n const properties = {\r\n topic: chatThreadItem.topic\r\n };\r\n if (!context.createThreadIfNotExist(chatThreadItem.id, properties)) {\r\n context.updateThread(chatThreadItem.id, properties);\r\n }\r\n };\r\n return createDecoratedIterator(chatClient.listChatThreads.bind(chatClient), context, setThreadProperties);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClient, ChatClientOptions } from '@azure/communication-chat';\r\nimport { ChatContext } from './ChatContext';\r\nimport { ChatClientState } from './ChatClientState';\r\nimport { EventSubscriber } from './EventSubscriber';\r\nimport { chatThreadClientDeclaratify } from './StatefulChatThreadClient';\r\nimport { createDecoratedListThreads } from './iterators/createDecoratedListThreads';\r\nimport { CommunicationIdentifierKind, CommunicationTokenCredential } from '@azure/communication-common';\r\n\r\nexport interface StatefulChatClient extends ChatClient {\r\n getState(): ChatClientState;\r\n onStateChange(handler: (state: ChatClientState) => void): void;\r\n offStateChange(handler: (state: ChatClientState) => void): void;\r\n}\r\n\r\nexport interface StatefulChatClientWithPrivateProps extends StatefulChatClient {\r\n context: ChatContext;\r\n eventSubscriber: EventSubscriber | undefined;\r\n}\r\n\r\nconst proxyChatClient: ProxyHandler<ChatClient> = {\r\n get: function <P extends keyof StatefulChatClientWithPrivateProps>(\r\n chatClient: ChatClient,\r\n prop: P,\r\n receiver: StatefulChatClientWithPrivateProps\r\n ) {\r\n // skip receiver.context call to avoid recursive bugs\r\n if (prop === 'context') {\r\n return Reflect.get(chatClient, prop);\r\n }\r\n\r\n const context = receiver.context;\r\n switch (prop) {\r\n case 'createChatThread': {\r\n return async function (...args: Parameters<ChatClient['createChatThread']>) {\r\n const result = await chatClient.createChatThread(...args);\r\n const thread = result.chatThread;\r\n\r\n if (thread) {\r\n const [request] = args;\r\n context.createThread(thread.id, { topic: request.topic });\r\n }\r\n return result;\r\n };\r\n }\r\n case 'deleteChatThread': {\r\n return async function (...args: Parameters<ChatClient['deleteChatThread']>) {\r\n const result = await chatClient.deleteChatThread(...args);\r\n context.deleteThread(args[0]);\r\n return result;\r\n };\r\n }\r\n case 'listChatThreads': {\r\n return createDecoratedListThreads(chatClient, context);\r\n }\r\n case 'getChatThreadClient': {\r\n return function (...args: Parameters<ChatClient['getChatThreadClient']>) {\r\n const chatThreadClient = chatClient.getChatThreadClient(...args);\r\n // TODO(prprabhu): Ensure that thread properties are fetched into the ChatContext at this point.\r\n // A new thread might be created here, but the properties will never be fetched.\r\n return chatThreadClientDeclaratify(chatThreadClient, context);\r\n };\r\n }\r\n case 'startRealtimeNotifications': {\r\n return async function (...args: Parameters<ChatClient['startRealtimeNotifications']>) {\r\n const ret = await chatClient.startRealtimeNotifications(...args);\r\n if (!receiver.eventSubscriber) {\r\n receiver.eventSubscriber = new EventSubscriber(chatClient, context);\r\n }\r\n\r\n return ret;\r\n };\r\n }\r\n case 'stopRealtimeNotifications': {\r\n return async function (...args: Parameters<ChatClient['stopRealtimeNotifications']>) {\r\n const ret = await chatClient.stopRealtimeNotifications(...args);\r\n if (receiver.eventSubscriber) {\r\n receiver.eventSubscriber.unsubscribe();\r\n receiver.eventSubscriber = undefined;\r\n }\r\n\r\n return ret;\r\n };\r\n }\r\n default:\r\n return Reflect.get(chatClient, prop);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Required arguments to construct the stateful chat client\r\n */\r\nexport type StatefulChatClientArgs = {\r\n userId: CommunicationIdentifierKind;\r\n displayName: string;\r\n endpoint: string;\r\n credential: CommunicationTokenCredential;\r\n};\r\n\r\n/**\r\n * Options to construct the stateful chat client with\r\n */\r\nexport type StatefulChatClientOptions = ChatClientOptions;\r\n\r\n/**\r\n * Creates a stateful ChatClient {@Link StatefulChatClient} by proxying ChatClient\r\n * {@Link @azure/communication-chat#ChatClient} with ProxyChatClient {@Link ProxyChatClient} which then allows access\r\n * to state in a declarative way.\r\n */\r\nexport const createStatefulChatClient = (\r\n args: StatefulChatClientArgs,\r\n options?: StatefulChatClientOptions\r\n): StatefulChatClient => {\r\n const chatClient = new ChatClient(args.endpoint, args.credential, options);\r\n const context = new ChatContext();\r\n let eventSubscriber: EventSubscriber;\r\n\r\n context.updateChatConfig(args.userId, args.displayName);\r\n\r\n const proxy = new Proxy(chatClient, proxyChatClient);\r\n\r\n Object.defineProperty(proxy, 'context', {\r\n configurable: false,\r\n get: () => context\r\n });\r\n\r\n Object.defineProperty(proxy, 'eventSubscriber', {\r\n configurable: false,\r\n get: () => eventSubscriber,\r\n set: (val: EventSubscriber) => {\r\n eventSubscriber = val;\r\n }\r\n });\r\n\r\n Object.defineProperty(proxy, 'getState', {\r\n configurable: false,\r\n value: () => context?.getState()\r\n });\r\n Object.defineProperty(proxy, 'onStateChange', {\r\n configurable: false,\r\n value: (handler: (state: ChatClientState) => void) => context?.onStateChange(handler)\r\n });\r\n Object.defineProperty(proxy, 'offStateChange', {\r\n configurable: false,\r\n value: (handler: (state: ChatClientState) => void) => context?.offStateChange(handler)\r\n });\r\n return proxy as StatefulChatClient;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ErrorInfo } from 'react';\r\n\r\n/**\r\n * Severity is a rating provided by UI on the impact of the error. It can be used as a rough metric for decision making.\r\n * If using ErrorBar component, a INFO, WARNING, or ERROR severity will cause the message to be displayed in ErrorBar.\r\n */\r\nexport type CommunicationUiErrorSeverity = 'info' | 'warning' | 'error' | 'ignore';\r\n\r\nexport enum CommunicationUiErrorCode {\r\n UNKNOWN_ERROR, // Any error we don't know about that may happen unexpectedly.\r\n CONFIGURATION_ERROR, // Errors related to configuration issue such as invalid connectionString.\r\n UNAUTHORIZED_ERROR, // 401 status code returned from ACS resource.\r\n FORBIDDEN_ERROR, // 403 status code returned from from ACS resource.\r\n TOO_MANY_REQUESTS_ERROR, // 429 status code returned from ACS resource.\r\n SERVICE_UNAVAILABLE_ERROR, // 503 status code returned from ACS resource.\r\n INTERNAL_SERVER_ERROR, // 500 status code returned from ACS resource.\r\n UNKNOWN_STATUS_CODE_ERROR, // Unknown status code from ACS resource.\r\n MESSAGE_EXCEEDED_RETRY_ERROR, // Message failed to send even after X number of retries.\r\n START_REALTIME_NOTIFICATIONS_ERROR, // ChatClient.startRealtimeNotifications() threw an error.\r\n CREATE_CHAT_THREAD_CLIENT_ERROR, // ChatClient.getChatThreadClient() threw an error.\r\n SEND_READ_RECEIPT_ERROR, // ChatThreadClient.sendReadReceipt() threw an error.\r\n GET_READ_RECEIPT_ERROR, // ChatThreadClient.listReadReceipts() threw an error.\r\n SEND_MESSAGE_ERROR, // ChatThreadClient.sendMessage() threw an error.\r\n GET_MESSAGE_ERROR, // ChatThreadClient.getMessage() threw an error.\r\n SEND_TYPING_NOTIFICATION_ERROR, // ChatThreadClient.sendTypingNotification() threw an error.\r\n GET_MESSAGES_ERROR, // ChatThreadClient.listMessages() threw an error.\r\n REMOVE_THREAD_PARTICIPANT_ERROR, // ChatThreadClient.removeThreadParticipant() threw an error.\r\n UPDATE_THREAD_ERROR, // ChatThreadClient.updateThread() threw an error.\r\n GET_THREAD_ERROR, // ChatThreadClient.getChatThread() threw an error.\r\n QUERY_PERMISSIONS_ERROR, // DeviceManager.getPermissionState() threw an error.\r\n ASK_PERMISSIONS_ERROR, // DeviceManager.askDevicePermission() threw an error.\r\n SWITCH_VIDEO_SOURCE_ERROR, // LocalVideoStream.switchSource() threw an error.\r\n UNMUTE_ERROR, // Call.unmute() threw an error or microphone permission not granted.\r\n MUTE_ERROR, // Call.mute() threw an error.\r\n START_VIDEO_ERROR, // Error starting local video.\r\n STOP_VIDEO_ERROR, // Error stopping local video.\r\n START_SCREEN_SHARE_ERROR, // Call.startScreenSharing() threw an error.\r\n STOP_SCREEN_SHARE_ERROR, // Call.stopScreenSharing() threw an error.\r\n RENDER_REMOTE_VIDEO_ERROR, // Renderer.createView() threw an error.\r\n RENDER_LOCAL_VIDEO_ERROR, // Renderer.createView() threw an error.\r\n CREATE_CALL_AGENT_ERROR, // CallClient.createCallAgent() threw an error.\r\n CREATE_DEVICE_MANAGER_ERROR, // CallClient.createCallAgent() threw an error.\r\n DISPOSE_CALL_AGENT_ERROR, // CallAgent.dispose() threw an error.\r\n JOIN_CALL_ERROR, // CallAgent.join() threw an error.\r\n LEAVE_CALL_ERROR // CallAgent.hangup() threw an error or no call exists.\r\n}\r\n\r\nexport interface CommunicationUiErrorInfo {\r\n message: string;\r\n code: CommunicationUiErrorCode;\r\n severity: CommunicationUiErrorSeverity;\r\n originalError: Error | undefined;\r\n errorInfo: ErrorInfo | undefined;\r\n}\r\n\r\nexport interface CommunicationUiErrorArgs {\r\n message?: string;\r\n code?: CommunicationUiErrorCode;\r\n severity?: CommunicationUiErrorSeverity;\r\n error?: Error;\r\n errorInfo?: ErrorInfo;\r\n}\r\n\r\n/**\r\n * CommunicationUiError is a type defined and used within CommunicationUi and in externally provided onErrorCallback.\r\n *\r\n * Message - can be any message and is used to provide some context on the error.\r\n * Code - is a CommunicationUiErrorCode type and allows the error to be handled programmatically.\r\n * OriginalError - optional and if present, is the error that was thrown and then wrapped by CommunicationUiError.\r\n * ErrorInfo - optional and will be provided if the error was caught at the React Error Boundary but it may not always\r\n * be present.\r\n */\r\nexport class CommunicationUiError extends Error implements CommunicationUiErrorInfo {\r\n private _code: CommunicationUiErrorCode;\r\n private _severity: CommunicationUiErrorSeverity;\r\n private _originalError: Error | undefined;\r\n private _errorInfo: ErrorInfo | undefined;\r\n\r\n constructor(args: CommunicationUiErrorArgs) {\r\n super(args.message ?? 'Unknown error');\r\n this.message = args.message ?? 'Unknown error';\r\n this._code = args.code ?? CommunicationUiErrorCode.UNKNOWN_ERROR;\r\n this._severity = args.severity ?? 'error';\r\n this._originalError = args.error;\r\n this._errorInfo = args.errorInfo;\r\n }\r\n\r\n public get code(): CommunicationUiErrorCode {\r\n return this._code;\r\n }\r\n\r\n public get severity(): CommunicationUiErrorSeverity {\r\n return this._severity;\r\n }\r\n\r\n public set severity(severity: CommunicationUiErrorSeverity) {\r\n this._severity = severity;\r\n }\r\n\r\n public get originalError(): Error | undefined {\r\n return this._originalError;\r\n }\r\n\r\n public get errorInfo(): ErrorInfo | undefined {\r\n return this._errorInfo;\r\n }\r\n\r\n public set errorInfo(errorInfo: ErrorInfo | undefined) {\r\n this._errorInfo = errorInfo;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\r\nexport const CommunicationUiErrorFromError = (error: any): CommunicationUiError =>\r\n error instanceof CommunicationUiError ? error : new CommunicationUiError({ error });\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { AzureCommunicationTokenCredential, CommunicationTokenRefreshOptions } from '@azure/communication-common';\r\nimport { CallState as CallStatus } from '@azure/communication-calling';\r\nimport {\r\n CommunicationUiErrorCode,\r\n CommunicationUiError,\r\n CommunicationUiErrorFromError,\r\n CommunicationUiErrorInfo\r\n} from '../types/CommunicationUiError';\r\n\r\nexport const isInCall = (callStatus: CallStatus): boolean => !!(callStatus !== 'None' && callStatus !== 'Disconnected');\r\n\r\n// Create AzureCommunicationUserCredential using optional refreshTokenCallback if provided. If callback is provided then\r\n// identity must also be provided for callback to be used.\r\nexport const createAzureCommunicationUserCredential = (\r\n token: string,\r\n refreshTokenCallback?: (() => Promise<string>) | undefined\r\n): AzureCommunicationTokenCredential => {\r\n if (refreshTokenCallback !== undefined) {\r\n const options: CommunicationTokenRefreshOptions = {\r\n token: token,\r\n tokenRefresher: () => refreshTokenCallback(),\r\n refreshProactively: true\r\n };\r\n return new AzureCommunicationTokenCredential(options);\r\n } else {\r\n return new AzureCommunicationTokenCredential(token);\r\n }\r\n};\r\n\r\n// This is a temporary solution to grab the userId from the token.\r\n// In the future we want to use the AzureCommunicationUserCredential and CommunicationUser types into the Provider\r\nexport const getIdFromToken = (jwtToken: string): string => {\r\n const claimName = 'skypeid';\r\n\r\n const jwtTokenParts = jwtToken.split('.');\r\n if (jwtTokenParts.length !== 3) {\r\n throw new CommunicationUiError({\r\n message: 'Invalid jwt token',\r\n code: CommunicationUiErrorCode.CONFIGURATION_ERROR\r\n });\r\n }\r\n\r\n let base64DecodedClaims;\r\n let base64DecodedClaimsAsJson;\r\n try {\r\n base64DecodedClaims = atob(jwtTokenParts[1]);\r\n base64DecodedClaimsAsJson = JSON.parse(base64DecodedClaims);\r\n } catch (error) {\r\n throw new CommunicationUiError({\r\n message: 'Invalid access token',\r\n code: CommunicationUiErrorCode.CONFIGURATION_ERROR,\r\n error: error\r\n });\r\n }\r\n\r\n if (Object.prototype.hasOwnProperty.call(base64DecodedClaimsAsJson, claimName)) {\r\n return `8:${base64DecodedClaimsAsJson[claimName]}`;\r\n }\r\n\r\n throw new CommunicationUiError({\r\n message: 'Invalid access token',\r\n code: CommunicationUiErrorCode.CONFIGURATION_ERROR\r\n });\r\n};\r\n\r\nexport const propagateError = (error: Error, onErrorCallback?: (error: CommunicationUiErrorInfo) => void): void => {\r\n if (onErrorCallback) {\r\n onErrorCallback(CommunicationUiErrorFromError(error));\r\n } else {\r\n throw error;\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { createStatefulChatClient, ChatClientState, StatefulChatClient } from 'chat-stateful-client';\r\nimport { DefaultChatHandlers, createDefaultChatHandlers } from '@azure/acs-chat-selector';\r\nimport { ChatMessage, ChatThreadClient } from '@azure/communication-chat';\r\n\r\nimport type {\r\n ChatMessageReceivedEvent,\r\n ChatThreadPropertiesUpdatedEvent,\r\n CommunicationUserKind,\r\n ParticipantsAddedEvent,\r\n ParticipantsRemovedEvent,\r\n ReadReceiptReceivedEvent\r\n} from '@azure/communication-signaling';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport EventEmitter from 'events';\r\nimport { createAzureCommunicationUserCredential, getIdFromToken } from '../../../utils';\r\nimport {\r\n ChatAdapter,\r\n ChatEvent,\r\n ChatState,\r\n MessageReadListener,\r\n MessageReceivedListener,\r\n ParticipantsAddedListener,\r\n ParticipantsRemovedListener,\r\n TopicChangedListener\r\n} from './ChatAdapter';\r\n\r\n// Context of Chat, which is a centralized context for all state updates\r\nclass ChatContext {\r\n private emitter: EventEmitter = new EventEmitter();\r\n private state: ChatState;\r\n private threadId: string;\r\n\r\n constructor(clientState: ChatClientState, threadId: string) {\r\n const thread = clientState.threads.get(threadId);\r\n this.threadId = threadId;\r\n if (!thread) throw 'Cannot find threadId, please initialize thread before use!';\r\n this.state = {\r\n userId: toFlatCommunicationIdentifier(clientState.userId),\r\n displayName: clientState.displayName,\r\n thread\r\n };\r\n }\r\n\r\n public onStateChange(handler: (_uiState: ChatState) => void): void {\r\n this.emitter.on('stateChanged', handler);\r\n }\r\n\r\n public offStateChange(handler: (_uiState: ChatState) => void): void {\r\n this.emitter.off('stateChanged', handler);\r\n }\r\n\r\n public setState(state: ChatState): void {\r\n this.state = state;\r\n this.emitter.emit('stateChanged', this.state);\r\n }\r\n\r\n public getState(): ChatState {\r\n return this.state;\r\n }\r\n\r\n public setError(error: Error): void {\r\n this.setState({ ...this.state, error });\r\n }\r\n\r\n public updateClientState(clientState: ChatClientState): void {\r\n const thread = clientState.threads.get(this.threadId);\r\n if (!thread) throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\r\n this.setState({\r\n userId: toFlatCommunicationIdentifier(clientState.userId),\r\n displayName: clientState.displayName,\r\n thread\r\n });\r\n }\r\n}\r\n\r\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\r\n private chatClient: StatefulChatClient;\r\n private chatThreadClient: ChatThreadClient;\r\n private context: ChatContext;\r\n private handlers: DefaultChatHandlers;\r\n private emitter: EventEmitter = new EventEmitter();\r\n\r\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\r\n this.chatClient = chatClient;\r\n this.chatThreadClient = chatThreadClient;\r\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\r\n const onStateChange = (clientState: ChatClientState): void => {\r\n // unsubscribe when the instance gets disposed\r\n if (!this) {\r\n chatClient.offStateChange(onStateChange);\r\n return;\r\n }\r\n this.context.updateClientState(clientState);\r\n };\r\n\r\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\r\n\r\n this.chatClient.onStateChange(onStateChange);\r\n this.subscribeAllEvents();\r\n }\r\n\r\n dispose(): void {\r\n this.unsubscribeAllEvents();\r\n }\r\n\r\n fetchInitialData = async (): Promise<void> => {\r\n try {\r\n await this.chatThreadClient.getProperties();\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n\r\n // Fetch all participants who joined before the local user.\r\n try {\r\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\r\n // Fetch 100 participants per page by default.\r\n maxPageSize: 100\r\n }));\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n };\r\n\r\n public getState = (): ChatState => {\r\n return this.context.getState();\r\n };\r\n\r\n public onStateChange = (handler: (state: ChatState) => void): void => {\r\n this.context.onStateChange(handler);\r\n };\r\n\r\n public offStateChange = (handler: (state: ChatState) => void): void => {\r\n this.context.offStateChange(handler);\r\n };\r\n\r\n sendMessage = async (content: string): Promise<void> => {\r\n await this.handlers.onSendMessage(content);\r\n };\r\n\r\n sendReadReceipt = async (chatMessageId: string): Promise<void> => {\r\n await this.handlers.onMessageSeen(chatMessageId);\r\n };\r\n\r\n sendTypingIndicator = async (): Promise<void> => {\r\n await this.handlers.onTyping();\r\n };\r\n\r\n removeParticipant = async (userId: string): Promise<void> => {\r\n await this.handlers.onParticipantRemove(userId);\r\n };\r\n\r\n setTopic = async (topicName: string): Promise<void> => {\r\n await this.handlers.updateThreadTopicName(topicName);\r\n };\r\n\r\n loadPreviousChatMessages = async (messagesToLoad: number): Promise<boolean> => {\r\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\r\n };\r\n\r\n messageReceivedListener = (event: ChatMessageReceivedEvent): void => {\r\n const message = convertEventToChatMessage(event);\r\n this.emitter.emit('messageReceived', { message });\r\n\r\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\r\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\r\n this.emitter.emit('messageSent', { message });\r\n }\r\n };\r\n\r\n messageReadListener = ({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void => {\r\n const message = this.getState().thread.chatMessages.get(chatMessageId);\r\n if (message) {\r\n this.emitter.emit('messageRead', { message, readBy: recipient });\r\n }\r\n };\r\n\r\n participantsAddedListener = ({ addedBy, participantsAdded }: ParticipantsAddedEvent): void => {\r\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\r\n };\r\n\r\n participantsRemovedListener = ({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void => {\r\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\r\n };\r\n\r\n chatThreadPropertiesUpdatedListener = (event: ChatThreadPropertiesUpdatedEvent): void => {\r\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\r\n };\r\n\r\n subscribeAllEvents = (): void => {\r\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener);\r\n this.chatClient.on('participantsAdded', this.participantsAddedListener);\r\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener);\r\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener);\r\n this.chatClient.on('readReceiptReceived', this.messageReadListener);\r\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener);\r\n };\r\n\r\n unsubscribeAllEvents = (): void => {\r\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener);\r\n this.chatClient.off('participantsAdded', this.participantsAddedListener);\r\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener);\r\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener);\r\n this.chatClient.off('readReceiptReceived', this.messageReadListener);\r\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener);\r\n };\r\n\r\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\r\n on(event: 'messageSent', listener: MessageReceivedListener): void;\r\n on(event: 'messageRead', listener: MessageReadListener): void;\r\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\r\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\r\n on(event: 'topicChanged', listener: TopicChangedListener): void;\r\n on(event: 'error', listener: (e: Error) => void): void;\r\n on(event: ChatEvent, listener: (e: any) => void): void {\r\n this.emitter.on(event, listener);\r\n }\r\n\r\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\r\n off(event: 'messageSent', listener: MessageReceivedListener): void;\r\n off(event: 'messageRead', listener: MessageReadListener): void;\r\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\r\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\r\n off(event: 'topicChanged', listener: TopicChangedListener): void;\r\n off(event: 'error', listener: (e: Error) => void): void;\r\n off(event: ChatEvent, listener: (e: any) => void): void {\r\n this.emitter.off(event, listener);\r\n }\r\n}\r\n\r\nconst convertEventToChatMessage = (event: ChatMessageReceivedEvent): ChatMessage => {\r\n return {\r\n id: event.id,\r\n version: event.version,\r\n content: { message: event.message },\r\n type: event.type,\r\n sender: event.sender,\r\n senderDisplayName: event.senderDisplayName,\r\n sequenceId: '',\r\n createdOn: new Date(event.createdOn)\r\n };\r\n};\r\n\r\nexport const createAzureCommunicationChatAdapter = async (\r\n token: string,\r\n endpointUrl: string,\r\n threadId: string,\r\n displayName: string,\r\n refreshTokenCallback?: (() => Promise<string>) | undefined\r\n): Promise<ChatAdapter> => {\r\n const rawUserId = getIdFromToken(token);\r\n\r\n // This hack can be removed when `getIdFromToken` is dropped in favour of actually passing in user credentials.\r\n const userId = <CommunicationUserKind>{ kind: 'communicationUser', communicationUserId: rawUserId };\r\n const chatClient = createStatefulChatClient({\r\n userId,\r\n displayName,\r\n endpoint: endpointUrl,\r\n credential: createAzureCommunicationUserCredential(token, refreshTokenCallback)\r\n });\r\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\r\n\r\n chatClient.startRealtimeNotifications();\r\n\r\n const adapter = new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\r\n return adapter;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { createContext, useContext } from 'react';\r\nimport { ChatAdapter } from './ChatAdapter';\r\n\r\ntype ChatProviderProps = {\r\n children: React.ReactNode;\r\n adapter: ChatAdapter;\r\n};\r\n\r\nconst ChatAdapterContext = createContext<ChatAdapter | undefined>(undefined);\r\n\r\nexport const ChatAdapterProvider = (props: ChatProviderProps): JSX.Element => {\r\n const { adapter } = props;\r\n return <ChatAdapterContext.Provider value={adapter}>{props.children}</ChatAdapterContext.Provider>;\r\n};\r\n\r\nexport const useAdapter = (): ChatAdapter => {\r\n const adapter = useContext(ChatAdapterContext);\r\n if (!adapter) throw 'Cannot find adapter please initialize before usage.';\r\n return adapter;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClientState, ChatThreadClientState } from 'chat-stateful-client';\r\nimport { useState, useEffect, useRef, useMemo } from 'react';\r\nimport { ChatState } from '../adapter/ChatAdapter';\r\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\r\nimport memoizeOne from 'memoize-one';\r\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\r\n\r\n// This function highly depends on chatClient.onChange event\r\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\r\nexport const useAdaptedSelector = <SelectorT extends (state: ChatClientState, props: any) => any>(\r\n selector: SelectorT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n return useSelectorWithAdaptation(selector, adaptCompositeState, selectorProps);\r\n};\r\n\r\nexport const useSelectorWithAdaptation = <\r\n SelectorT extends (state: ReturnType<AdaptFuncT>, props: any) => any,\r\n AdaptFuncT extends (state: ChatState) => any\r\n>(\r\n selector: SelectorT,\r\n adaptState: AdaptFuncT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n const adapter = useAdapter();\r\n\r\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\r\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\r\n const mounted = useRef(false);\r\n\r\n useEffect(() => {\r\n mounted.current = true;\r\n return () => {\r\n mounted.current = false;\r\n };\r\n });\r\n\r\n const threadId = adapter.getState().thread.threadId;\r\n const threadConfigProps = useMemo(\r\n () => ({\r\n threadId\r\n }),\r\n [threadId]\r\n );\r\n\r\n const [props, setProps] = useState(selector(adaptState(adapter.getState()), selectorProps ?? threadConfigProps));\r\n const propRef = useRef(props);\r\n propRef.current = props;\r\n\r\n useEffect(() => {\r\n const onStateChange = (state: ChatState): void => {\r\n if (!mounted.current) {\r\n return;\r\n }\r\n const newProps = selector(adaptState(state), selectorProps ?? threadConfigProps);\r\n if (propRef.current !== newProps) {\r\n setProps(newProps);\r\n }\r\n };\r\n adapter.onStateChange(onStateChange);\r\n return () => {\r\n adapter.offStateChange(onStateChange);\r\n };\r\n }, [adaptState, adapter, selector, selectorProps, threadConfigProps]);\r\n return props;\r\n};\r\n\r\nconst memoizeState = memoizeOne(\r\n (userId: CommunicationIdentifierKind, displayName: string, threads: Map<string, ChatThreadClientState>) => ({\r\n userId,\r\n displayName,\r\n threads\r\n })\r\n);\r\n\r\nconst memoizeThreadMap = memoizeOne((thread: ChatThreadClientState) => new Map([[thread.threadId, thread]]));\r\n\r\nconst adaptCompositeState = (compositeState: ChatState): ChatClientState => {\r\n const thread = compositeState.thread;\r\n const threadMap = memoizeThreadMap(thread);\r\n return memoizeState(\r\n { kind: 'communicationUser', communicationUserId: compositeState.userId },\r\n compositeState.displayName,\r\n threadMap\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CommonProperties } from 'acs-ui-common';\r\nimport { DefaultChatHandlers } from '@azure/acs-chat-selector';\r\n\r\nimport { ReactElement } from 'react';\r\nimport memoizeOne from 'memoize-one';\r\nimport { ChatAdapter } from '../adapter/ChatAdapter';\r\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\r\n\r\n// This will be moved into selector folder when ChatClientProvide when refactor finished\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\r\nexport const useHandlers = <PropsT>(\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n _component: (props: PropsT) => ReactElement | null\r\n): Pick<DefaultChatHandlers, CommonProperties<DefaultChatHandlers, PropsT>> => {\r\n return createCompositeHandlers(useAdapter());\r\n};\r\n\r\nconst createCompositeHandlers = memoizeOne(\r\n (adapter: ChatAdapter): DefaultChatHandlers => ({\r\n onSendMessage: adapter.sendMessage,\r\n onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,\r\n onMessageSeen: adapter.sendReadReceipt,\r\n onTyping: adapter.sendTypingIndicator,\r\n onParticipantRemove: adapter.removeParticipant,\r\n updateThreadTopicName: adapter.setTopic\r\n })\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { ChatClientState } from 'chat-stateful-client';\r\nimport {\r\n chatThreadSelector,\r\n chatParticipantListSelector,\r\n sendBoxSelector,\r\n typingIndicatorSelector\r\n} from '@azure/acs-chat-selector';\r\nimport { MessageThread, ParticipantList, SendBox, TypingIndicator } from 'react-components';\r\n\r\nimport React from 'react';\r\nimport { useHandlers } from './useHandlers';\r\nimport { useAdaptedSelector } from './useAdaptedSelector';\r\n\r\ntype Selector = (state: ChatClientState, props: any) => any;\r\nexport const usePropsFor = <SelectorT extends (state: ChatClientState, props: any) => any>(\r\n component: React.FunctionComponent<any>\r\n): ReturnType<SelectorT> => {\r\n const selector = getSelector(component);\r\n return { ...useAdaptedSelector(selector), ...useHandlers(component) };\r\n};\r\n\r\nexport const getSelector = (component: React.FunctionComponent<any>): Selector => {\r\n switch (component) {\r\n case MessageThread:\r\n return chatThreadSelector;\r\n case ParticipantList:\r\n return chatParticipantListSelector;\r\n case SendBox:\r\n return sendBoxSelector;\r\n case TypingIndicator:\r\n return typingIndicatorSelector;\r\n }\r\n throw 'Can\\'t find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.';\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const chatContainer = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n overflow: 'hidden',\r\n minHeight: '25rem',\r\n minWidth: '25rem',\r\n\r\n '*::-webkit-scrollbar': {\r\n width: '0.3rem',\r\n height: '0.3rem'\r\n },\r\n '.scroll::-webkit-scrollbar-track': {\r\n background: 'rgba(150, 150, 150)',\r\n borderRadius: '0.3rem'\r\n },\r\n '*::-webkit-scrollbar-thumb': {\r\n borderRadius: '10px',\r\n background: 'rgba(150, 150, 150)'\r\n }\r\n});\r\n\r\nexport const chatArea = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n paddingLeft: '1rem',\r\n paddingRight: '1rem',\r\n paddingBottom: '1rem',\r\n overflow: 'hidden'\r\n});\r\n\r\nexport const chatWrapper = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n paddingBottom: '1rem',\r\n overflow: 'auto',\r\n margin: '0 0.2rem'\r\n});\r\n\r\nexport const chatHeaderContainerStyle = mergeStyles({\r\n width: '100%',\r\n height: '3rem',\r\n paddingLeft: '1.5rem',\r\n paddingRight: '3.25rem',\r\n selectors: {\r\n '@media screen and (max-width: 25rem)': {\r\n paddingLeft: '5%',\r\n paddingRight: '5%'\r\n }\r\n },\r\n borderBottom: '0.063rem solid #DDDDDD'\r\n});\r\n\r\nexport const topicNameLabelStyle = mergeStyles({\r\n fontSize: '1.1rem',\r\n lineHeight: '2.5rem',\r\n fontWeight: 600,\r\n marginRight: '0.125rem',\r\n textOverflow: 'ellipsis',\r\n overflowY: 'hidden'\r\n});\r\n\r\nexport const participantListWrapper = mergeStyles({\r\n boxShadow: '0px 0.3px 0.9px rgba(0, 0, 0, 0.1), 0px 1.6px 3.6px rgba(0, 0, 0, 0.13)',\r\n width: '15rem',\r\n height: '100%'\r\n});\r\nexport const listHeader = mergeStyles({\r\n fontSize: '1rem',\r\n margin: '1rem'\r\n});\r\n\r\nexport const participantListStack = mergeStyles({\r\n width: '15rem',\r\n height: '100%'\r\n});\r\n\r\nexport const participantListStyle = mergeStyles({\r\n overflowY: 'hidden'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Stack } from '@fluentui/react';\r\nimport React from 'react';\r\nimport * as reselect from 'reselect';\r\nimport { ChatClientState } from 'chat-stateful-client';\r\nimport { ChatBaseSelectorProps } from '@azure/acs-chat-selector';\r\nimport { chatHeaderContainerStyle, topicNameLabelStyle } from './styles/Chat.styles';\r\n\r\nexport type HeaderProps = {\r\n topic: string;\r\n};\r\n\r\nexport const ChatHeader = (props: HeaderProps): JSX.Element => {\r\n return (\r\n <Stack className={chatHeaderContainerStyle} horizontal>\r\n <Stack.Item align=\"center\" style={{ minWidth: '12.5rem' }}>\r\n <div className={topicNameLabelStyle}>{props.topic}</div>\r\n </Stack.Item>\r\n </Stack>\r\n );\r\n};\r\n\r\n// TODO: Consider exporting building-block selectors internally to composites.\r\n// This will avoid code duplication but still keep the public API clean.\r\nexport const getTopicName = (state: ChatClientState, props: ChatBaseSelectorProps): string => {\r\n return state.threads.get(props.threadId)?.properties?.topic || '';\r\n};\r\n\r\nexport const getHeaderProps = reselect.createSelector(\r\n [getTopicName],\r\n (topic): HeaderProps => {\r\n return { topic: topic };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { MessageBar, MessageBarType } from '@fluentui/react';\r\nimport React from 'react';\r\nimport { ChatClientState } from 'chat-stateful-client';\r\nimport * as reselect from 'reselect';\r\nimport { ChatBaseSelectorProps } from '@azure/acs-chat-selector';\r\nimport { ChatParticipant } from '@azure/communication-chat';\r\nimport { toFlatCommunicationIdentifier } from 'acs-ui-common';\r\n\r\nexport type ThreadStatusProps = {\r\n amIRemovedFromThread: boolean;\r\n};\r\n\r\nexport const ThreadStatus = (props: ThreadStatusProps): JSX.Element => {\r\n return (\r\n <>\r\n {props.amIRemovedFromThread ? (\r\n <MessageBar messageBarType={MessageBarType.warning}>You no longer have access to the chat.</MessageBar>\r\n ) : (\r\n <></>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\n// TODO: Consider exporting building-block selectors internally to composites.\r\n// This will avoid code duplication but still keep the public API clean.\r\nexport const getUserId = (state: ChatClientState): string => toFlatCommunicationIdentifier(state.userId);\r\n\r\n// TODO: Consider exporting building-block selectors internally to composites.\r\n// This will avoid code duplication but still keep the public API clean.\r\nexport const getParticipants = (state: ChatClientState, props: ChatBaseSelectorProps): Map<string, ChatParticipant> =>\r\n (props.threadId && state.threads.get(props.threadId)?.participants) || new Map();\r\n\r\nexport const getThreadStatusProps = reselect.createSelector(\r\n [getUserId, getParticipants],\r\n (userId, chatParticipants: Map<string, ChatParticipant>): ThreadStatusProps => {\r\n return {\r\n // Check that participants are not empty to prevent jank before particpants are loaded.\r\n amIRemovedFromThread: chatParticipants.size > 0 && !chatParticipants.has(userId)\r\n };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles, Stack } from '@fluentui/react';\r\nimport React, { useEffect } from 'react';\r\nimport { MessageThread, ParticipantList, SendBox, TypingIndicator } from 'react-components';\r\nimport { useAdapter } from './adapter/ChatAdapterProvider';\r\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\r\nimport { usePropsFor } from './hooks/usePropsFor';\r\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\r\nimport { ThreadStatus, getThreadStatusProps } from './ThreadStatus';\r\nimport {\r\n chatContainer,\r\n chatWrapper,\r\n chatArea,\r\n participantListWrapper,\r\n listHeader,\r\n participantListStack,\r\n participantListStyle\r\n} from './styles/Chat.styles';\r\n\r\nexport type ChatScreenProps = {\r\n sendBoxMaxLength?: number;\r\n onRenderAvatar?: (userId: string) => JSX.Element;\r\n};\r\n\r\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\r\n const { onRenderAvatar, sendBoxMaxLength } = props;\r\n\r\n const pixelToRemConvertRatio = 16;\r\n const defaultNumberOfChatMessagesToReload = 5;\r\n const sendBoxParentStyle = mergeStyles({\r\n maxWidth: sendBoxMaxLength ? `${sendBoxMaxLength / pixelToRemConvertRatio}rem` : 'unset',\r\n width: '100%'\r\n });\r\n\r\n const adapter = useAdapter();\r\n\r\n useEffect(() => {\r\n adapter.fetchInitialData();\r\n }, [adapter]);\r\n\r\n const messageThreadProps = usePropsFor(MessageThread);\r\n const participantListProps = usePropsFor(ParticipantList);\r\n const sendBoxProps = usePropsFor(SendBox);\r\n const typingIndicatorProps = usePropsFor(TypingIndicator);\r\n const headerProps = useAdaptedSelector(getHeaderProps);\r\n const threadStatusProps = useAdaptedSelector(getThreadStatusProps);\r\n\r\n return (\r\n <Stack className={chatContainer} grow>\r\n <ChatHeader {...headerProps} />\r\n <Stack className={chatArea} horizontal grow>\r\n <Stack className={chatWrapper} grow>\r\n <ThreadStatus {...threadStatusProps} />\r\n <MessageThread\r\n {...messageThreadProps}\r\n onRenderAvatar={onRenderAvatar}\r\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\r\n />\r\n <Stack.Item align=\"center\" className={sendBoxParentStyle}>\r\n <div style={{ paddingLeft: '0.5rem', paddingRight: '0.5rem' }}>\r\n <TypingIndicator {...typingIndicatorProps} />\r\n </div>\r\n <SendBox {...sendBoxProps} />\r\n </Stack.Item>\r\n </Stack>\r\n <Stack.Item className={participantListWrapper}>\r\n <Stack className={participantListStack}>\r\n <Stack.Item className={listHeader}>In this chat</Stack.Item>\r\n <Stack.Item className={participantListStyle}>\r\n <ParticipantList {...participantListProps} />\r\n </Stack.Item>\r\n </Stack>\r\n </Stack.Item>\r\n </Stack>\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { ChatScreen } from './ChatScreen';\r\nimport { ChatAdapterProvider } from './adapter/ChatAdapterProvider';\r\nimport { ChatAdapter } from './adapter/ChatAdapter';\r\nimport { Theme, PartialTheme } from '@fluentui/react-theme-provider';\r\nimport { FluentThemeProvider } from 'react-components';\r\n\r\nexport type ChatCompositeProps = {\r\n adapter: ChatAdapter;\r\n /**\r\n * Fluent theme for the composite.\r\n *\r\n * Defaults to a light theme if undefined.\r\n */\r\n fluentTheme?: PartialTheme | Theme;\r\n onRenderAvatar?: (userId: string) => JSX.Element;\r\n options?: ChatOptions;\r\n};\r\n\r\nexport type ChatOptions = {\r\n sendBoxMaxLength?: number; // Limit max send box length, when change viewport size\r\n // messagesPerPage?: number; // Number of messages per page - smaller for better perf\r\n // supportNewline: boolean; // Whether to support new line (shift+enter) in textArea, disable until ACS backend supports line switch\r\n};\r\n\r\nexport const ChatComposite = (props: ChatCompositeProps): JSX.Element => {\r\n const { adapter, fluentTheme, options, onRenderAvatar } = props;\r\n\r\n return (\r\n <FluentThemeProvider fluentTheme={fluentTheme}>\r\n <ChatAdapterProvider adapter={adapter}>\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\" />\r\n <ChatScreen sendBoxMaxLength={options?.sendBoxMaxLength} onRenderAvatar={onRenderAvatar} />\r\n </ChatAdapterProvider>\r\n </FluentThemeProvider>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStackItemStyles, IStackStyles, mergeStyles } from '@fluentui/react';\r\n\r\nconst headerShadow = 'rgba(0, 0, 0, 0.133) 0px 1.6px 3.6px 0px, rgba(0, 0, 0, 0.11) 0px 0.3px 0.9px 0px';\r\n\r\nexport const headerStyles: IStackItemStyles = {\r\n root: {\r\n width: '100%'\r\n }\r\n};\r\n\r\nexport const headerContainer = mergeStyles({\r\n width: '100%',\r\n height: '3.875rem',\r\n padding: '0.0625rem 0',\r\n boxShadow: headerShadow,\r\n overflow: 'hidden',\r\n flexDirection: 'row',\r\n justifyContent: 'flex-end',\r\n alignItems: 'center',\r\n marginBottom: 2\r\n});\r\n\r\nexport const headerCenteredContainer = mergeStyles(headerContainer, {\r\n justifyContent: 'center'\r\n});\r\n\r\nexport const containerStyles: IStackStyles = {\r\n root: {\r\n height: '100%',\r\n width: '100%',\r\n flexDirection: 'column',\r\n display: 'flex'\r\n }\r\n};\r\n\r\nexport const subContainerStyles: IStackStyles = {\r\n root: {\r\n overflow: 'hidden',\r\n width: '100%',\r\n flexDirection: 'column',\r\n display: 'flex',\r\n flexBasis: '0'\r\n }\r\n};\r\n\r\nexport const activeContainerClassName: IStackItemStyles = {\r\n root: {\r\n display: 'flex',\r\n height: '100%',\r\n position: 'relative'\r\n }\r\n};\r\n\r\nexport const loadingStyle = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n display: 'flex',\r\n justifyContent: 'center',\r\n alignItems: 'center'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { createContext, useContext } from 'react';\r\nimport { CallAdapter } from './CallAdapter';\r\n\r\ntype CallProviderProps = {\r\n children: React.ReactNode;\r\n adapter: CallAdapter;\r\n};\r\n\r\nconst CallAdapterContext = createContext<CallAdapter | undefined>(undefined);\r\n\r\nexport const CallAdapterProvider = (props: CallProviderProps): JSX.Element => {\r\n const { adapter } = props;\r\n return <CallAdapterContext.Provider value={adapter}>{props.children}</CallAdapterContext.Provider>;\r\n};\r\n\r\nexport const useAdapter = (): CallAdapter => {\r\n const adapter = useContext(CallAdapterContext);\r\n if (!adapter) throw 'Cannot find adapter please initialize before usage.';\r\n return adapter;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { useState, useEffect, useRef, useMemo } from 'react';\r\n\r\nimport memoizeOne from 'memoize-one';\r\nimport { useAdapter } from '../adapter/CallAdapterProvider';\r\nimport { CallAdapterState } from '../adapter/CallAdapter';\r\nimport { CallState, CallClientState, DeviceManagerState } from 'calling-stateful-client';\r\n\r\n// This function highly depends on chatClient.onChange event\r\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\r\nexport const useAdaptedSelector = <SelectorT extends (state: CallClientState, props: any) => any>(\r\n selector: SelectorT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n return useSelectorWithAdaptation(selector, adaptCompositeState, selectorProps);\r\n};\r\n\r\nexport const useSelectorWithAdaptation = <\r\n SelectorT extends (state: ReturnType<AdaptFuncT>, props: any) => any,\r\n AdaptFuncT extends (state: CallAdapterState) => any\r\n>(\r\n selector: SelectorT,\r\n adaptState: AdaptFuncT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n const adapter = useAdapter();\r\n\r\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\r\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\r\n const mounted = useRef(false);\r\n\r\n useEffect(() => {\r\n mounted.current = true;\r\n return () => {\r\n mounted.current = false;\r\n };\r\n });\r\n\r\n const callId = adapter.getState().call?.id;\r\n const callConfigProps = useMemo(\r\n () => ({\r\n callId\r\n }),\r\n [callId]\r\n );\r\n\r\n const [props, setProps] = useState(selector(adaptState(adapter.getState()), selectorProps ?? callConfigProps));\r\n const propRef = useRef(props);\r\n propRef.current = props;\r\n\r\n useEffect(() => {\r\n const onStateChange = (state: CallAdapterState): void => {\r\n if (!mounted.current) {\r\n return;\r\n }\r\n const newProps = selector(adaptState(state), selectorProps ?? callConfigProps);\r\n if (propRef.current !== newProps) {\r\n setProps(newProps);\r\n }\r\n };\r\n adapter.onStateChange(onStateChange);\r\n return () => {\r\n adapter.offStateChange(onStateChange);\r\n };\r\n }, [adaptState, adapter, selector, selectorProps, callConfigProps]);\r\n return props;\r\n};\r\n\r\nconst memoizeState = memoizeOne(\r\n (\r\n userId: string,\r\n deviceManager: DeviceManagerState,\r\n calls: Map<string, CallState>,\r\n displayName?: string\r\n ): CallClientState => ({\r\n userId,\r\n incomingCalls: new Map([]),\r\n incomingCallsEnded: [],\r\n callsEnded: [],\r\n deviceManager,\r\n callAgent: { displayName },\r\n calls\r\n })\r\n);\r\n\r\nconst memoizeCallMap = memoizeOne(\r\n (call?: CallState): Map<string, CallState> => (call ? new Map([[call.id, call]]) : new Map([]))\r\n);\r\n\r\nconst adaptCompositeState = (compositeState: CallAdapterState): CallClientState => {\r\n const call = compositeState.call;\r\n const callMap = memoizeCallMap(call);\r\n return memoizeState(compositeState.userId, compositeState.devices, callMap, compositeState.displayName);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallAdapterState } from '../adapter/CallAdapter';\r\nimport { useSelectorWithAdaptation } from './useAdaptedSelector';\r\n\r\n// This function highly depends on callClient.onChange event\r\nexport const useSelector = <SelectorT extends (state: CallAdapterState, props: any) => any>(\r\n selector: SelectorT,\r\n selectorProps?: Parameters<SelectorT>[1]\r\n): ReturnType<SelectorT> => {\r\n // use selector with no adaptation\r\n return useSelectorWithAdaptation(selector, (state) => state, selectorProps);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { DefaultCallingHandlers } from '@azure/acs-calling-selector';\r\nimport { CommonProperties, toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { ReactElement } from 'react';\r\nimport memoizeOne from 'memoize-one';\r\nimport { CallAdapter } from '..';\r\nimport { useAdapter } from '../adapter/CallAdapterProvider';\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\r\nexport const useHandlers = <PropsT>(\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n _component: (props: PropsT) => ReactElement | null\r\n): Pick<DefaultCallingHandlers, CommonProperties<DefaultCallingHandlers, PropsT>> => {\r\n return createCompositeHandlers(useAdapter());\r\n};\r\n\r\nconst createCompositeHandlers = memoizeOne(\r\n (adapter: CallAdapter): DefaultCallingHandlers => ({\r\n onCreateLocalStreamView: async (options) => {\r\n await adapter.createStreamView(undefined, options);\r\n },\r\n onCreateRemoteStreamView: async (userId, options) => {\r\n await adapter.createStreamView(userId, options);\r\n },\r\n onHangUp: async () => {\r\n await adapter.leaveCall();\r\n },\r\n onParticipantRemove: async (userId) => {\r\n await adapter.removeParticipant(userId);\r\n },\r\n onSelectCamera: async (deviceInfo) => {\r\n await adapter.setCamera(deviceInfo);\r\n },\r\n onSelectMicrophone: async (deviceInfo) => {\r\n await adapter.setMicrophone(deviceInfo);\r\n },\r\n onSelectSpeaker: async (deviceInfo) => {\r\n await adapter.setSpeaker(deviceInfo);\r\n },\r\n onStartCall: (participants) => {\r\n const rawIds = participants.map((participant) => toFlatCommunicationIdentifier(participant));\r\n return adapter.startCall(rawIds);\r\n },\r\n onStartScreenShare: async () => {\r\n await adapter.startScreenShare();\r\n },\r\n onStopScreenShare: async () => {\r\n await adapter.stopScreenShare();\r\n },\r\n onToggleCamera: async () => {\r\n await adapter.onToggleCamera();\r\n },\r\n onToggleMicrophone: async () => {\r\n return adapter.getState().call?.isMuted ? await adapter.unmute() : await adapter.mute();\r\n },\r\n onToggleScreenShare: async () => {\r\n return adapter.getState().call?.isScreenSharingOn\r\n ? await adapter.stopScreenShare()\r\n : await adapter.startScreenShare();\r\n },\r\n onStartLocalVideo: async () => {\r\n if (adapter.getState().call) {\r\n return adapter.startCamera();\r\n }\r\n }\r\n })\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n cameraButtonSelector,\r\n microphoneButtonSelector,\r\n optionsButtonSelector,\r\n screenShareButtonSelector,\r\n videoGallerySelector\r\n} from '@azure/acs-calling-selector';\r\nimport {\r\n CameraButton,\r\n EndCallButton,\r\n MicrophoneButton,\r\n OptionsButton,\r\n ScreenShareButton,\r\n VideoGallery\r\n} from 'react-components';\r\nimport { useAdaptedSelector } from './useAdaptedSelector';\r\nimport { useHandlers } from './useHandlers';\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\r\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(component: Component) => {\r\n const selector = getSelector(component);\r\n return { ...useAdaptedSelector(selector), ...useHandlers<Parameters<Component>[0]>(component) };\r\n};\r\n\r\nconst emptySelector = (): Record<string, never> => ({});\r\ntype GetSelector<Component> = AreEqual<Component, typeof VideoGallery> extends true\r\n ? typeof videoGallerySelector\r\n : AreEqual<Component, typeof MicrophoneButton> extends true\r\n ? typeof microphoneButtonSelector\r\n : AreEqual<Component, typeof CameraButton> extends true\r\n ? typeof cameraButtonSelector\r\n : AreEqual<Component, typeof ScreenShareButton> extends true\r\n ? typeof screenShareButtonSelector\r\n : AreEqual<Component, typeof EndCallButton> extends true\r\n ? typeof emptySelector\r\n : never;\r\n\r\ntype AreEqual<A, B> = A extends B ? (B extends A ? true : false) : false;\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\r\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\r\n component: Component\r\n): GetSelector<Component> => {\r\n return findSelector(component);\r\n};\r\n\r\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\r\n switch (component) {\r\n case VideoGallery:\r\n return videoGallerySelector;\r\n case MicrophoneButton:\r\n return microphoneButtonSelector;\r\n case CameraButton:\r\n return cameraButtonSelector;\r\n case ScreenShareButton:\r\n return screenShareButtonSelector;\r\n case OptionsButton:\r\n return optionsButtonSelector;\r\n case EndCallButton:\r\n return emptySelector;\r\n }\r\n throw 'Can\\'t find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.';\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nconst videoBaseStyle = mergeStyles({\r\n border: 0\r\n});\r\n\r\nexport const gridStyle = mergeStyles(videoBaseStyle, {\r\n width: '100%',\r\n height: '100%'\r\n});\r\n\r\nexport const aspectRatioBoxStyle = mergeStyles(videoBaseStyle, {\r\n width: '100%',\r\n height: 0,\r\n position: 'relative',\r\n paddingTop: '56.25%' /* default to 16:9 Aspect Ratio for now*/\r\n});\r\n\r\nexport const aspectRatioBoxContentStyle = mergeStyles({\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n width: '100%',\r\n height: '100%'\r\n});\r\n\r\nexport const stackContainerStyle = mergeStyles({\r\n height: '100%',\r\n width: '25%'\r\n});\r\n\r\nexport const screenShareContainerStyle = mergeStyles({\r\n height: '100%',\r\n width: '75%',\r\n position: 'relative'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const videoStreamStyle = mergeStyles({\r\n position: 'absolute',\r\n bottom: '.25rem',\r\n right: '.25rem',\r\n height: '20%',\r\n width: '25%'\r\n});\r\n\r\nexport const loadingStyle = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n display: 'flex',\r\n justifyContent: 'center'\r\n});\r\n\r\nexport const videoTileStyle = {\r\n root: {\r\n borderRadius: '.25rem'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { memoizeFnAll } from 'acs-ui-common';\r\nimport { mergeStyles, Spinner, SpinnerSize, Stack } from '@fluentui/react';\r\nimport React, { useMemo } from 'react';\r\nimport {\r\n PlaceholderProps,\r\n StreamMedia,\r\n VideoGalleryLocalParticipant,\r\n VideoGalleryRemoteParticipant,\r\n VideoStreamOptions,\r\n VideoTile\r\n} from 'react-components';\r\nimport {\r\n aspectRatioBoxContentStyle,\r\n aspectRatioBoxStyle,\r\n screenShareContainerStyle,\r\n stackContainerStyle\r\n} from './styles/MediaGallery.styles';\r\nimport { loadingStyle, videoStreamStyle, videoTileStyle } from './styles/ScreenShare.styles';\r\n\r\nexport type ScreenShareProps = {\r\n screenShareParticipant: VideoGalleryRemoteParticipant | undefined;\r\n localParticipant?: VideoGalleryLocalParticipant;\r\n remoteParticipants: VideoGalleryRemoteParticipant[];\r\n onCreateLocalStreamView?: () => Promise<void>;\r\n onCreateRemoteStreamView?: (userId: string, options?: VideoStreamOptions) => Promise<void>;\r\n};\r\n\r\nconst memoizeAllRemoteParticipants = memoizeFnAll(\r\n (userId: string, isAvailable?: boolean, renderElement?: HTMLElement, displayName?: string): JSX.Element => {\r\n return (\r\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle} key={userId}>\r\n <Stack className={aspectRatioBoxContentStyle}>\r\n <VideoTile\r\n userId={userId}\r\n isVideoReady={isAvailable}\r\n renderElement={<StreamMedia videoStreamElement={renderElement ?? null} />}\r\n displayName={displayName}\r\n styles={videoTileStyle}\r\n />\r\n </Stack>\r\n </Stack>\r\n );\r\n }\r\n);\r\n\r\n// A non-undefined display name is needed for this render, and that is coming from VideoTile props below\r\nconst onRenderPlaceholder = (props: PlaceholderProps): JSX.Element => (\r\n <div className={loadingStyle}>\r\n <Spinner label={`Loading ${props.displayName}'s screen`} size={SpinnerSize.xSmall} />\r\n </div>\r\n);\r\n\r\nexport const ScreenShare = (props: ScreenShareProps): JSX.Element => {\r\n const {\r\n screenShareParticipant,\r\n localParticipant,\r\n remoteParticipants,\r\n onCreateRemoteStreamView,\r\n onCreateLocalStreamView\r\n } = props;\r\n\r\n const localVideoStream = localParticipant?.videoStream;\r\n const isLocalVideoReady = localVideoStream?.renderElement !== undefined;\r\n const isScreenShareAvailable =\r\n screenShareParticipant &&\r\n screenShareParticipant.screenShareStream &&\r\n screenShareParticipant.screenShareStream.isAvailable;\r\n\r\n const screenShareStreamComponent = useMemo(() => {\r\n if (!isScreenShareAvailable) {\r\n return;\r\n }\r\n const screenShareStream = screenShareParticipant?.screenShareStream;\r\n const videoStream = screenShareParticipant?.videoStream;\r\n if (screenShareStream?.isAvailable && !screenShareStream?.renderElement) {\r\n screenShareParticipant &&\r\n onCreateRemoteStreamView &&\r\n onCreateRemoteStreamView(screenShareParticipant.userId, {\r\n scalingMode: 'Fit'\r\n });\r\n }\r\n if (videoStream?.isAvailable && !videoStream?.renderElement) {\r\n screenShareParticipant && onCreateRemoteStreamView && onCreateRemoteStreamView(screenShareParticipant.userId);\r\n }\r\n\r\n return (\r\n <VideoTile\r\n displayName={screenShareParticipant?.displayName}\r\n isVideoReady={screenShareStream?.isAvailable}\r\n renderElement={<StreamMedia videoStreamElement={screenShareStream?.renderElement ?? null} />}\r\n onRenderPlaceholder={onRenderPlaceholder}\r\n styles={{\r\n overlayContainer: videoStreamStyle\r\n }}\r\n >\r\n {videoStream && videoStream.isAvailable && videoStream.renderElement && (\r\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle}>\r\n <Stack className={aspectRatioBoxContentStyle}>\r\n <VideoTile\r\n isVideoReady={videoStream.isAvailable}\r\n renderElement={<StreamMedia videoStreamElement={videoStream.renderElement ?? null} />}\r\n styles={videoTileStyle}\r\n />\r\n </Stack>\r\n </Stack>\r\n )}\r\n </VideoTile>\r\n );\r\n }, [isScreenShareAvailable, onCreateRemoteStreamView, screenShareParticipant]);\r\n\r\n const layoutLocalParticipant = useMemo(() => {\r\n if (localVideoStream && !localVideoStream?.renderElement) {\r\n onCreateLocalStreamView && onCreateLocalStreamView();\r\n }\r\n\r\n return (\r\n <VideoTile\r\n isVideoReady={isLocalVideoReady}\r\n renderElement={<StreamMedia videoStreamElement={localVideoStream?.renderElement ?? null} />}\r\n displayName={localParticipant?.displayName}\r\n styles={videoTileStyle}\r\n />\r\n );\r\n }, [isLocalVideoReady, localParticipant, localVideoStream, onCreateLocalStreamView]);\r\n\r\n const sidePanelRemoteParticipants = useMemo(() => {\r\n return memoizeAllRemoteParticipants((memoizedRemoteParticipantFn) => {\r\n return remoteParticipants && screenShareParticipant\r\n ? remoteParticipants\r\n .filter((remoteParticipant: VideoGalleryRemoteParticipant) => {\r\n return remoteParticipant.userId !== screenShareParticipant.userId;\r\n })\r\n .map((participant: VideoGalleryRemoteParticipant) => {\r\n const remoteVideoStream = participant.videoStream;\r\n\r\n if (remoteVideoStream?.isAvailable && !remoteVideoStream?.renderElement) {\r\n onCreateRemoteStreamView && onCreateRemoteStreamView(participant.userId);\r\n }\r\n\r\n return memoizedRemoteParticipantFn(\r\n participant.userId,\r\n remoteVideoStream?.isAvailable,\r\n remoteVideoStream?.renderElement,\r\n participant.displayName\r\n );\r\n })\r\n : [];\r\n });\r\n }, [remoteParticipants, onCreateRemoteStreamView, screenShareParticipant]);\r\n\r\n return (\r\n <>\r\n <div className={stackContainerStyle}>\r\n <Stack grow className={mergeStyles({ height: '100%', overflow: 'auto' })}>\r\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle}>\r\n <Stack className={aspectRatioBoxContentStyle}>{layoutLocalParticipant}</Stack>\r\n </Stack>\r\n {sidePanelRemoteParticipants}\r\n </Stack>\r\n </div>\r\n <div className={screenShareContainerStyle}>{screenShareStreamComponent}</div>\r\n </>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallState as SDKCallStatus } from '@azure/communication-calling';\r\nimport { CallState, DeviceManagerState } from 'calling-stateful-client';\r\nimport { CallAdapterState, CallCompositePage } from '../adapter/CallAdapter';\r\n\r\nexport const getCall = (state: CallAdapterState): CallState | undefined => state.call;\r\nexport const getCallStatus = (state: CallAdapterState): SDKCallStatus => state.call?.state ?? 'None';\r\nexport const getDeviceManager = (state: CallAdapterState): DeviceManagerState => state.devices;\r\nexport const getIsScreenShareOn = (state: CallAdapterState): boolean => state.call?.isScreenSharingOn ?? false;\r\nexport const getIsPreviewCameraOn = (state: CallAdapterState): boolean => isPreviewOn(state.devices);\r\nexport const getPage = (state: CallAdapterState): CallCompositePage => state.page;\r\nexport const getLocalMicrophoneEnabled = (state: CallAdapterState): boolean => state.isLocalPreviewMicrophoneEnabled;\r\nexport const getDisplayName = (state: CallAdapterState): string | undefined => state.displayName;\r\nexport const getIdentifier = (state: CallAdapterState): string => state.userId;\r\n\r\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n return deviceManager.unparentedViews.values().next().value?.view !== undefined;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useMemo, useState, useEffect } from 'react';\r\nimport { VideoGallery, PlaceholderProps, VideoStreamOptions } from 'react-components';\r\nimport { useSelector } from './hooks/useSelector';\r\nimport { usePropsFor } from './hooks/usePropsFor';\r\nimport { ScreenShare } from './ScreenShare';\r\nimport { getIsPreviewCameraOn } from './selectors/baseSelectors';\r\n\r\nconst VideoGalleryStyles = {\r\n root: {\r\n height: 'auto'\r\n }\r\n};\r\n\r\nconst localVideoViewOption = {\r\n scalingMode: 'Crop',\r\n isMirrored: true\r\n} as VideoStreamOptions;\r\n\r\nconst remoteVideoViewOption = {\r\n scalingMode: 'Crop'\r\n} as VideoStreamOptions;\r\n\r\nexport interface MediaGalleryProps {\r\n isVideoStreamOn?: boolean;\r\n isMicrophoneChecked?: boolean;\r\n onStartLocalVideo: () => Promise<void>;\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element;\r\n}\r\n\r\nexport const MediaGallery = (props: MediaGalleryProps): JSX.Element => {\r\n const videoGalleryProps = usePropsFor(VideoGallery);\r\n const [isButtonStatusSynced, setIsButtonStatusSynced] = useState(false);\r\n\r\n const isPreviewCameraOn = useSelector(getIsPreviewCameraOn);\r\n const isScreenShareActive = useMemo(() => {\r\n return videoGalleryProps.screenShareParticipant !== undefined;\r\n }, [videoGalleryProps]);\r\n\r\n useEffect(() => {\r\n if (isPreviewCameraOn && !props.isVideoStreamOn && !isButtonStatusSynced) {\r\n props.onStartLocalVideo();\r\n }\r\n setIsButtonStatusSynced(true);\r\n }, [isButtonStatusSynced, isPreviewCameraOn, props]);\r\n\r\n const VideoGalleryMemoized = useMemo(() => {\r\n return (\r\n <VideoGallery\r\n {...videoGalleryProps}\r\n localVideoViewOption={localVideoViewOption}\r\n remoteVideoViewOption={remoteVideoViewOption}\r\n styles={VideoGalleryStyles}\r\n onRenderAvatar={props.onRenderAvatar}\r\n />\r\n );\r\n }, [props.onRenderAvatar, videoGalleryProps]);\r\n\r\n return isScreenShareActive ? <ScreenShare {...videoGalleryProps} /> : VideoGalleryMemoized;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as reselect from 'reselect';\r\nimport { getCall } from './baseSelectors';\r\n\r\nexport const complianceBannerSelector = reselect.createSelector([getCall], (call) => {\r\n return {\r\n callTranscribeState: call?.transcription.isTranscriptionActive,\r\n callRecordState: call?.recording.isRecordingActive\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport { getCallStatus, getIsScreenShareOn } from './baseSelectors';\r\nimport { createSelector } from 'reselect';\r\n\r\nexport const callStatusSelector = createSelector([getCallStatus, getIsScreenShareOn], (callStatus, isScreenShareOn) => {\r\n return {\r\n callStatus,\r\n isScreenShareOn\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as reselect from 'reselect';\r\nimport { getCall } from './baseSelectors';\r\n\r\nexport const mediaGallerySelector = reselect.createSelector([getCall], (call) => {\r\n return {\r\n isVideoStreamOn: !!call?.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video')?.view?.target\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nexport const groupCallLeaveButtonStyle = {\r\n root: {\r\n border: '0.125rem',\r\n borderRadius: 2,\r\n marginRight: '.75rem',\r\n height: '2.1875rem',\r\n width: '6.5625rem'\r\n },\r\n flexContainer: {\r\n flexFlow: 'row'\r\n }\r\n};\r\n\r\nexport const groupCallLeaveButtonCompressedStyle = {\r\n root: {\r\n width: '2rem',\r\n height: '3.75rem',\r\n border: '0.125rem',\r\n borderRadius: 2,\r\n marginRight: '0.4375rem'\r\n },\r\n flexContainer: {\r\n flexFlow: 'row'\r\n }\r\n};\r\n\r\nexport const controlBarStyle = {\r\n root: {\r\n marginRight: '.5rem',\r\n float: 'right'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useCallback } from 'react';\r\nimport { CameraButton, ControlBar, EndCallButton, MicrophoneButton, ScreenShareButton } from 'react-components';\r\nimport {\r\n controlBarStyle,\r\n groupCallLeaveButtonCompressedStyle,\r\n groupCallLeaveButtonStyle\r\n} from './styles/CallControls.styles';\r\nimport { usePropsFor } from './hooks/usePropsFor';\r\nimport { devicePermissionSelector } from '@azure/acs-calling-selector';\r\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\r\n\r\nexport type GroupCallControlsProps = {\r\n onEndCallClick(): void;\r\n compressedMode: boolean;\r\n};\r\n\r\nexport const CallControls = (props: GroupCallControlsProps): JSX.Element => {\r\n const { compressedMode, onEndCallClick } = props;\r\n const microphoneButtonProps = usePropsFor(MicrophoneButton);\r\n const cameraButtonProps = usePropsFor(CameraButton);\r\n const screenShareButtonProps = usePropsFor(ScreenShareButton);\r\n const hangUpButtonProps = usePropsFor(EndCallButton);\r\n const onHangUp = useCallback(async () => {\r\n await hangUpButtonProps.onHangUp();\r\n onEndCallClick();\r\n }, [hangUpButtonProps, onEndCallClick]);\r\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useAdaptedSelector(\r\n devicePermissionSelector\r\n );\r\n\r\n return (\r\n <ControlBar styles={controlBarStyle}>\r\n <CameraButton\r\n {...cameraButtonProps}\r\n onToggleCamera={() => {\r\n return cameraButtonProps.onToggleCamera().catch((e) => console.log(e));\r\n }}\r\n disabled={!cameraPermissionGranted}\r\n />\r\n <MicrophoneButton {...microphoneButtonProps} disabled={!microphonePermissionGranted} />\r\n <ScreenShareButton {...screenShareButtonProps} />\r\n <EndCallButton\r\n {...hangUpButtonProps}\r\n onHangUp={onHangUp}\r\n styles={!compressedMode ? groupCallLeaveButtonStyle : groupCallLeaveButtonCompressedStyle}\r\n text={!compressedMode ? 'Leave' : ''}\r\n />\r\n </ControlBar>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Link, MessageBar } from '@fluentui/react';\r\n\r\nexport type ComplianceBannerProps = {\r\n callTranscribeState?: boolean;\r\n callRecordState?: boolean;\r\n};\r\nexport const ComplianceBanner = (props: ComplianceBannerProps): JSX.Element => {\r\n const [previousCallTranscribeState, setPreviousCallTranscribeState] = useState<boolean | undefined>(false);\r\n const [previousCallRecordState, setPreviousCallRecordState] = useState<boolean | undefined>(false);\r\n const [variant, setVariant] = useState(0);\r\n\r\n const TRANSCRIPTION_STOPPED_STILL_RECORDING = 1;\r\n const RECORDING_STOPPED_STILL_TRANSCRIBING = 2;\r\n const RECORDING_AND_TRANSCRIPTION_STOPPED = 3;\r\n const RECORDING_AND_TRANSCRIPTION_STARTED = 4;\r\n const TRANSCRIPTION_STARTED = 5;\r\n const RECORDING_STOPPED = 6;\r\n const RECORDING_STARTED = 7;\r\n const RECORDING_STOPPED_AND_SAVED = 8;\r\n const NO_STATE = 0;\r\n\r\n const { callTranscribeState, callRecordState } = props;\r\n\r\n useEffect(() => {\r\n if (previousCallRecordState && previousCallTranscribeState) {\r\n if (callRecordState && !callTranscribeState) {\r\n setVariant(TRANSCRIPTION_STOPPED_STILL_RECORDING);\r\n } else if (!callRecordState && callTranscribeState) {\r\n setVariant(RECORDING_STOPPED_STILL_TRANSCRIBING);\r\n } else if (!callRecordState && !callTranscribeState) {\r\n setVariant(RECORDING_AND_TRANSCRIPTION_STOPPED);\r\n } else {\r\n setVariant(NO_STATE);\r\n }\r\n } else if (previousCallRecordState && !previousCallTranscribeState) {\r\n if (callRecordState && callTranscribeState) {\r\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\r\n } else if (!callRecordState && callTranscribeState) {\r\n setVariant(TRANSCRIPTION_STARTED);\r\n } else if (!callRecordState && !callTranscribeState) {\r\n setVariant(RECORDING_STOPPED);\r\n } else {\r\n setVariant(NO_STATE);\r\n }\r\n } else if (!previousCallRecordState && previousCallTranscribeState) {\r\n if (callRecordState && callTranscribeState) {\r\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\r\n } else if (!callRecordState && callTranscribeState) {\r\n setVariant(RECORDING_STARTED);\r\n } else if (!callRecordState && !callTranscribeState) {\r\n setVariant(RECORDING_STOPPED_AND_SAVED);\r\n } else {\r\n setVariant(NO_STATE);\r\n }\r\n } else if (!previousCallRecordState && !previousCallTranscribeState) {\r\n if (callRecordState && callTranscribeState) {\r\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\r\n } else if (callRecordState && !callTranscribeState) {\r\n setVariant(RECORDING_STARTED);\r\n } else if (!callRecordState && callTranscribeState) {\r\n setVariant(TRANSCRIPTION_STARTED);\r\n } else {\r\n setVariant(NO_STATE);\r\n }\r\n }\r\n\r\n setPreviousCallTranscribeState(callTranscribeState);\r\n setPreviousCallRecordState(callRecordState);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [callTranscribeState, callRecordState]);\r\n\r\n function PrivacyPolicy(): JSX.Element {\r\n return (\r\n <Link\r\n href=\"https://privacy.microsoft.com/en-US/privacystatement#mainnoticetoendusersmodule\"\r\n target=\"_blank\"\r\n underline\r\n >\r\n Privacy policy\r\n </Link>\r\n );\r\n }\r\n\r\n function LearnMore(): JSX.Element {\r\n return (\r\n <Link\r\n href=\"https://support.microsoft.com/en-us/office/record-a-meeting-in-teams-34dfbe7f-b07d-4a27-b4c6-de62f1348c24\"\r\n target=\"_blank\"\r\n underline\r\n >\r\n Learn more\r\n </Link>\r\n );\r\n }\r\n\r\n function getBannerMessage(variant: number): JSX.Element {\r\n switch (variant) {\r\n case TRANSCRIPTION_STOPPED_STILL_RECORDING:\r\n return (\r\n <>\r\n <b>Transcription has stopped.</b> You are now only recording this meeting.\r\n <PrivacyPolicy />\r\n </>\r\n );\r\n case RECORDING_STOPPED_STILL_TRANSCRIBING:\r\n return (\r\n <>\r\n <b>Recording has stopped.</b> You are now only transcribing this meeting.\r\n <PrivacyPolicy />\r\n </>\r\n );\r\n case RECORDING_AND_TRANSCRIPTION_STOPPED:\r\n return (\r\n <>\r\n <b>Recording and transcription are being saved. </b> Recording and transcription have stopped.\r\n <LearnMore />\r\n </>\r\n );\r\n case RECORDING_AND_TRANSCRIPTION_STARTED:\r\n return (\r\n <>\r\n <b>Recording and transcription have started.</b> By joining, you are giving consent for this meeting to be\r\n transcribed.\r\n <PrivacyPolicy />\r\n </>\r\n );\r\n case TRANSCRIPTION_STARTED:\r\n return (\r\n <>\r\n <b>Transcription has started.</b> By joining, you are giving consent for this meeting to be transcribed.\r\n <PrivacyPolicy />\r\n </>\r\n );\r\n case RECORDING_STOPPED:\r\n return (\r\n <>\r\n <b>Recording is being saved.</b> Recording has stopped.\r\n <LearnMore />\r\n </>\r\n );\r\n case RECORDING_STARTED:\r\n return (\r\n <>\r\n <b>Recording has started.</b> By joining, you are giving consent for this meeting to be transcribed.\r\n <PrivacyPolicy />\r\n </>\r\n );\r\n case RECORDING_STOPPED_AND_SAVED:\r\n return (\r\n <>\r\n <b>Transcription is being saved.</b> Transcription has stopped.\r\n <LearnMore />\r\n </>\r\n );\r\n }\r\n return <></>;\r\n }\r\n\r\n return variant === NO_STATE ? (\r\n <></>\r\n ) : (\r\n <MessageBar\r\n onDismiss={() => {\r\n setVariant(NO_STATE);\r\n }}\r\n dismissButtonAriaLabel=\"Close\"\r\n >\r\n {getBannerMessage(variant)}\r\n </MessageBar>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as reselect from 'reselect';\r\nimport { CallState } from 'calling-stateful-client';\r\nimport { getCall, getDisplayName, getIdentifier } from './baseSelectors';\r\n\r\nexport const lobbySelector = reselect.createSelector(\r\n [getCall, getDisplayName, getIdentifier],\r\n (call: CallState | undefined, displayName: string | undefined, identifier: string | undefined) => {\r\n const localVideoStream = call?.localVideoStreams.find((i) => i.mediaStreamType === 'Video');\r\n return {\r\n localParticipant: {\r\n userId: identifier ?? '',\r\n displayName: displayName ?? '',\r\n isMuted: call?.isMuted,\r\n isScreenSharingOn: call?.isScreenSharingOn,\r\n videoStream: {\r\n isAvailable: !!localVideoStream,\r\n isMirrored: localVideoStream?.view?.isMirrored,\r\n renderElement: localVideoStream?.view?.target\r\n }\r\n }\r\n };\r\n }\r\n);\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport React, { useCallback } from 'react';\r\nimport { CameraButton, ControlBar, EndCallButton, MicrophoneButton, OptionsButton } from 'react-components';\r\nimport { usePropsFor } from './hooks/usePropsFor';\r\n\r\nexport interface LobbyCallControlBarProps {\r\n isMicrophoneChecked?: boolean;\r\n onEndCallClick(): void;\r\n}\r\n\r\nexport const LobbyCallControlBar = (props: LobbyCallControlBarProps): JSX.Element => {\r\n const theme = useTheme();\r\n\r\n const microphoneButtonProps = usePropsFor(MicrophoneButton);\r\n const cameraButtonProps = usePropsFor(CameraButton);\r\n const optionsButtonProps = usePropsFor(OptionsButton);\r\n const hangUpButtonProps = usePropsFor(EndCallButton);\r\n const onHangUp = useCallback(async () => {\r\n await hangUpButtonProps.onHangUp();\r\n props.onEndCallClick();\r\n }, [hangUpButtonProps, props]);\r\n\r\n return (\r\n <ControlBar\r\n layout=\"dockedBottom\"\r\n styles={{ root: { background: theme.palette.white, minHeight: '4.25rem', alignItems: 'center' } }}\r\n >\r\n <CameraButton\r\n showLabel={true}\r\n {...cameraButtonProps}\r\n onToggleCamera={async () => {\r\n cameraButtonProps.onToggleCamera();\r\n }}\r\n />\r\n <MicrophoneButton showLabel={true} {...microphoneButtonProps} checked={props.isMicrophoneChecked} />\r\n <OptionsButton showLabel={true} {...optionsButtonProps} />\r\n <EndCallButton showLabel={true} style={{ borderRadius: '0.25rem', marginLeft: '0.25rem' }} onHangUp={onHangUp} />\r\n </ControlBar>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport React, { useEffect, useState } from 'react';\r\nimport { StreamMedia, VideoGalleryLocalParticipant, VideoStreamOptions, VideoTile } from 'react-components';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\nimport { LobbyCallControlBar } from './LobbyControlBar';\r\nimport { useSelector } from './hooks/useSelector';\r\nimport { getIsPreviewCameraOn } from './selectors/baseSelectors';\r\n\r\nexport interface LobbyProps {\r\n callState: string;\r\n localParticipant: VideoGalleryLocalParticipant;\r\n localVideoViewOption?: VideoStreamOptions;\r\n isCameraChecked?: boolean;\r\n isMicrophoneChecked?: boolean;\r\n onCreateLocalStreamView?: (options?: VideoStreamOptions | undefined) => Promise<void>;\r\n onStartLocalVideo: () => Promise<void>;\r\n onEndCallClick: () => void;\r\n}\r\n\r\nconst onRenderEmptyPlaceholder = (): JSX.Element => <></>;\r\n\r\nexport const Lobby = (props: LobbyProps): JSX.Element => {\r\n const theme = useTheme();\r\n const palette = theme.palette;\r\n\r\n const [isButtonStatusSynced, setIsButtonStatusSynced] = useState(false);\r\n const isPreviewCameraOn = useSelector(getIsPreviewCameraOn);\r\n\r\n const localVideoStream = props.localParticipant?.videoStream;\r\n const isVideoReady = localVideoStream?.isAvailable;\r\n const renderElement = props.localParticipant.videoStream?.renderElement;\r\n\r\n const callStateText = props.callState === 'InLobby' ? 'Waiting to be admitted' : 'Connecting...';\r\n\r\n const videoTileStyles = {\r\n root: { height: '100%', width: '100%' },\r\n overlayContainer: {}\r\n };\r\n\r\n useEffect(() => {\r\n if (\r\n props.callState === 'InLobby' &&\r\n isPreviewCameraOn &&\r\n !isButtonStatusSynced &&\r\n !isVideoReady &&\r\n !renderElement\r\n ) {\r\n props.onStartLocalVideo().catch((err) => console.log('Can not start video', err));\r\n setIsButtonStatusSynced(true);\r\n }\r\n }, [isButtonStatusSynced, isPreviewCameraOn, isVideoReady, props, renderElement]);\r\n\r\n useEffect(() => {\r\n if (localVideoStream && isVideoReady) {\r\n props.onCreateLocalStreamView &&\r\n props\r\n .onCreateLocalStreamView(props.localVideoViewOption)\r\n .catch((err) => console.log('Can not render video', err));\r\n }\r\n }, [isVideoReady, localVideoStream, props, renderElement]);\r\n\r\n return (\r\n <VideoTile\r\n styles={videoTileStyles}\r\n isVideoReady={isVideoReady}\r\n renderElement={<StreamMedia videoStreamElement={renderElement ?? null} />}\r\n onRenderPlaceholder={onRenderEmptyPlaceholder}\r\n >\r\n <div\r\n style={{\r\n width: '100%',\r\n height: '100%',\r\n position: 'absolute',\r\n background: isVideoReady ? '#201f1e' : palette.neutralLight,\r\n opacity: 0.75\r\n }}\r\n />\r\n\r\n <div\r\n style={{\r\n textAlign: 'center',\r\n zIndex: 0,\r\n width: '50%',\r\n height: '25%',\r\n overflow: 'none',\r\n margin: 'auto',\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n bottom: 0,\r\n right: 0\r\n }}\r\n >\r\n <p style={{ fontSize: '1.75rem', color: isVideoReady ? 'white' : palette.neutralPrimary }}>\r\n ☕ <br /> {callStateText}\r\n </p>\r\n </div>\r\n\r\n <LobbyCallControlBar isMicrophoneChecked={props.isMicrophoneChecked} onEndCallClick={props.onEndCallClick} />\r\n </VideoTile>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Label, Spinner, Stack } from '@fluentui/react';\r\nimport React, { useEffect, useRef, useState } from 'react';\r\nimport {\r\n activeContainerClassName,\r\n containerStyles,\r\n headerStyles,\r\n loadingStyle,\r\n subContainerStyles,\r\n headerCenteredContainer,\r\n headerContainer\r\n} from './styles/CallScreen.styles';\r\n\r\nimport { MediaGallery } from './MediaGallery';\r\nimport { isInCall } from '../../utils/SDKUtils';\r\nimport { complianceBannerSelector } from './selectors/complianceBannerSelector';\r\nimport { useAdapter } from './adapter/CallAdapterProvider';\r\nimport { useSelector } from './hooks/useSelector';\r\nimport { getCall } from './selectors/baseSelectors';\r\nimport { callStatusSelector } from './selectors/callStatusSelector';\r\nimport { mediaGallerySelector } from './selectors/mediaGallerySelector';\r\nimport { useHandlers } from './hooks/useHandlers';\r\nimport { PlaceholderProps, VideoStreamOptions } from 'react-components';\r\nimport { CallControls } from './CallControls';\r\nimport { ComplianceBanner } from './ComplianceBanner';\r\nimport { lobbySelector } from './selectors/lobbySelector';\r\nimport { Lobby } from './Lobby';\r\nimport { AzureCommunicationCallAdapter, CallCompositePage } from './adapter';\r\n\r\nexport const MINI_HEADER_WINDOW_WIDTH = 450;\r\n\r\nexport interface CallScreenProps {\r\n screenWidth: number;\r\n endCallHandler(): void;\r\n callErrorHandler(customPage?: CallCompositePage): void;\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element;\r\n}\r\n\r\nconst spinnerLabel = 'Initializing call client...';\r\n\r\nexport const CallScreen = (props: CallScreenProps): JSX.Element => {\r\n const { screenWidth, endCallHandler, callErrorHandler, onRenderAvatar } = props;\r\n\r\n const [joinedCall, setJoinedCall] = useState<boolean>(false);\r\n\r\n // To use useProps to get these states, we need to create another file wrapping Call,\r\n // It seems unnecessary in this case, so we get the updated states using this approach.\r\n const { callStatus, isScreenShareOn } = useSelector(callStatusSelector);\r\n const call = useSelector(getCall);\r\n const currentCallId = useRef('');\r\n if (call) {\r\n currentCallId.current = call.id;\r\n }\r\n\r\n const mediaGalleryProps = useSelector(mediaGallerySelector);\r\n const mediaGalleryHandlers = useHandlers(MediaGallery);\r\n const complianceBannerProps = useSelector(complianceBannerSelector);\r\n\r\n const lobbyProps = useSelector(lobbySelector);\r\n const lobbyHandlers = useHandlers(Lobby);\r\n\r\n const localVideoViewOption = {\r\n scalingMode: 'Crop',\r\n isMirrored: true\r\n } as VideoStreamOptions;\r\n\r\n const adapter = useAdapter();\r\n\r\n useEffect(() => {\r\n if (!joinedCall) {\r\n adapter.joinCall();\r\n }\r\n setJoinedCall(true);\r\n }, [adapter, joinedCall]);\r\n\r\n // Handle Call Join Errors\r\n useEffect(() => {\r\n const endedCall = adapter.getState().endedCall;\r\n if (endedCall && currentCallId.current === endedCall?.id) {\r\n if (endedCall?.callEndReason?.code === 0 && endedCall?.callEndReason.subCode === 5854) {\r\n callErrorHandler('errorJoiningTeamsMeeting');\r\n }\r\n }\r\n }, [adapter, call, callErrorHandler]);\r\n\r\n if ('isTeamsCall' in adapter) {\r\n const azureAdapter = adapter as AzureCommunicationCallAdapter;\r\n const callState = azureAdapter.getState().call?.state;\r\n if (\r\n azureAdapter.isTeamsCall() &&\r\n callState !== undefined &&\r\n azureAdapter.getState().call &&\r\n ['Connecting', 'Ringing', 'InLobby'].includes(callState)\r\n ) {\r\n return (\r\n <Lobby\r\n callState={callState}\r\n {...lobbyProps}\r\n {...lobbyHandlers}\r\n onEndCallClick={endCallHandler}\r\n isMicrophoneChecked={azureAdapter.getState().isLocalPreviewMicrophoneEnabled}\r\n localVideoViewOption={localVideoViewOption}\r\n />\r\n );\r\n }\r\n }\r\n\r\n return (\r\n <>\r\n {isInCall(callStatus ?? 'None') ? (\r\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" styles={containerStyles} grow>\r\n <Stack.Item styles={headerStyles}>\r\n <Stack className={props.screenWidth > MINI_HEADER_WINDOW_WIDTH ? headerContainer : headerCenteredContainer}>\r\n <CallControls onEndCallClick={endCallHandler} compressedMode={screenWidth <= MINI_HEADER_WINDOW_WIDTH} />\r\n </Stack>\r\n </Stack.Item>\r\n <Stack.Item style={{ width: '100%' }}>\r\n <ComplianceBanner {...complianceBannerProps} />\r\n </Stack.Item>\r\n <Stack.Item styles={subContainerStyles} grow>\r\n {!isScreenShareOn ? (\r\n callStatus === 'Connected' && (\r\n <Stack styles={containerStyles} grow>\r\n <Stack.Item grow styles={activeContainerClassName}>\r\n <MediaGallery {...mediaGalleryProps} {...mediaGalleryHandlers} onRenderAvatar={onRenderAvatar} />\r\n </Stack.Item>\r\n </Stack>\r\n )\r\n ) : (\r\n <div className={loadingStyle}>\r\n <Label>Your screen is being shared</Label>\r\n </div>\r\n )}\r\n </Stack.Item>\r\n </Stack>\r\n ) : (\r\n <Spinner label={spinnerLabel} ariaLive=\"assertive\" labelPosition=\"top\" />\r\n )}\r\n </>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStackTokens, mergeStyles } from '@fluentui/react';\r\n\r\nexport const configurationStackTokens: IStackTokens = {\r\n childrenGap: '3rem'\r\n};\r\nexport const mainContainerStyle = mergeStyles({\r\n width: '100%',\r\n height: '100%',\r\n selectors: {\r\n '@media (max-width: 750px)': {\r\n padding: '0.625rem',\r\n height: '100%'\r\n }\r\n }\r\n});\r\nexport const localSettingsContainerStyle = mergeStyles({\r\n width: '100%',\r\n maxWidth: '18.75rem'\r\n});\r\nexport const fullScreenStyle = mergeStyles({\r\n height: '100%',\r\n width: '100%'\r\n});\r\nexport const verticalStackStyle = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n justifyContent: 'space-evenly'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStackTokens, IToggleStyles, getTheme, mergeStyles, IImageStyles } from '@fluentui/react';\r\n\r\nconst palette = getTheme().palette;\r\n\r\nexport const toggleStyle: Partial<IToggleStyles> = {\r\n root: { marginBottom: 0 }\r\n};\r\n\r\nexport const imgStyles = mergeStyles({\r\n width: '100%',\r\n height: '100%'\r\n});\r\n\r\nexport const staticAvatarStyle: Partial<IImageStyles> = {\r\n image: { width: '10rem', height: '10rem' }\r\n};\r\n\r\nexport const toggleButtonsBarToken: IStackTokens = {\r\n childrenGap: '0.625rem',\r\n padding: '0.625rem'\r\n};\r\n\r\nexport const localPreviewContainerStyle = mergeStyles({\r\n maxWidth: '25rem',\r\n minWidth: '12.5rem',\r\n width: '100%',\r\n height: '100%',\r\n maxHeight: '18.75rem',\r\n minHeight: '16.875rem',\r\n background: palette.neutralLighter,\r\n color: palette.neutralPrimaryAlt\r\n});\r\n\r\nexport const toggleButtonsBarStyle = mergeStyles({\r\n height: '2.8125rem',\r\n width: '100%',\r\n backgroundColor: palette.neutralQuaternaryAlt\r\n});\r\n\r\nexport const cameraOffLabelStyle = mergeStyles({\r\n fontFamily: 'Segoe UI Regular',\r\n fontSize: '0.625rem', // 10px\r\n color: palette.neutralTertiary\r\n});\r\n\r\nexport const localPreviewTileStyle = {\r\n root: {\r\n minHeight: '14rem'\r\n }\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { VideoStreamRendererViewState } from 'calling-stateful-client';\r\nimport * as reselect from 'reselect';\r\nimport { getDeviceManager } from './baseSelectors';\r\n\r\nexport const localPreviewSelector = reselect.createSelector([getDeviceManager], (deviceManager) => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n const view: VideoStreamRendererViewState | undefined = deviceManager.unparentedViews.values().next().value?.view;\r\n return {\r\n videoStreamElement: view ? view.target : null\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { CallVideoOffIcon } from '@fluentui/react-icons-northstar';\r\nimport { Stack, Text } from '@fluentui/react';\r\nimport React, { useCallback } from 'react';\r\nimport { localPreviewContainerStyle, cameraOffLabelStyle, localPreviewTileStyle } from './styles/LocalPreview.styles';\r\nimport { StreamMedia, VideoTile, MicrophoneButton, ControlBar, CameraButton } from 'react-components';\r\nimport { usePropsFor } from './hooks/usePropsFor';\r\nimport { localPreviewSelector } from './selectors/localPreviewSelector';\r\nimport { useSelector } from './hooks/useSelector';\r\nimport { getLocalMicrophoneEnabled } from './selectors/baseSelectors';\r\nimport { useAdapter } from './adapter/CallAdapterProvider';\r\nimport { devicePermissionSelector } from '@azure/acs-calling-selector';\r\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\r\n\r\nconst onRenderPlaceholder = (): JSX.Element => {\r\n return (\r\n <Stack style={{ width: '100%', height: '100%' }} verticalAlign=\"center\">\r\n <Stack.Item align=\"center\">\r\n <CallVideoOffIcon />\r\n </Stack.Item>\r\n <Stack.Item align=\"center\">\r\n <Text className={cameraOffLabelStyle}>Your camera is turned off.</Text>\r\n </Stack.Item>\r\n </Stack>\r\n );\r\n};\r\n\r\nexport const LocalPreview = (): JSX.Element => {\r\n const cameraButtonProps = usePropsFor(CameraButton);\r\n const localPreviewProps = useSelector(localPreviewSelector);\r\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useAdaptedSelector(\r\n devicePermissionSelector\r\n );\r\n\r\n const isLocalMicrophoneEnabled = useSelector(getLocalMicrophoneEnabled);\r\n const adapter = useAdapter();\r\n\r\n const onToggleMic = useCallback(async () => {\r\n isLocalMicrophoneEnabled ? adapter.mute() : adapter.unmute();\r\n }, [adapter, isLocalMicrophoneEnabled]);\r\n\r\n return (\r\n <Stack className={localPreviewContainerStyle}>\r\n <VideoTile\r\n styles={localPreviewTileStyle}\r\n isVideoReady={!!localPreviewProps.videoStreamElement}\r\n renderElement={<StreamMedia videoStreamElement={localPreviewProps.videoStreamElement} />}\r\n onRenderPlaceholder={onRenderPlaceholder}\r\n >\r\n <ControlBar layout=\"floatingBottom\">\r\n <CameraButton {...cameraButtonProps} disabled={!cameraPermissionGranted} />\r\n <MicrophoneButton\r\n checked={isLocalMicrophoneEnabled}\r\n onToggleMicrophone={onToggleMic}\r\n disabled={!microphonePermissionGranted}\r\n />\r\n </ControlBar>\r\n </VideoTile>\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { Stack } from '@fluentui/react';\r\nimport React from 'react';\r\nimport {\r\n configurationStackTokens,\r\n fullScreenStyle,\r\n localSettingsContainerStyle,\r\n mainContainerStyle,\r\n verticalStackStyle\r\n} from './styles/CallConfiguration.styles';\r\nimport { LocalPreview } from './LocalPreview';\r\n\r\nexport interface CallConfigurationProps {\r\n screenWidth: number;\r\n startCallHandler(): void;\r\n children: React.ReactNode;\r\n}\r\n\r\nexport const CallConfiguration = (props: CallConfigurationProps): JSX.Element => {\r\n const { screenWidth } = props;\r\n\r\n return (\r\n <Stack className={mainContainerStyle} horizontalAlign=\"center\" verticalAlign=\"center\" grow>\r\n <Stack\r\n className={screenWidth > 750 ? fullScreenStyle : verticalStackStyle}\r\n horizontal={screenWidth > 750}\r\n horizontalAlign=\"center\"\r\n verticalAlign=\"center\"\r\n tokens={screenWidth > 750 ? configurationStackTokens : undefined}\r\n grow\r\n >\r\n <LocalPreview />\r\n <Stack className={localSettingsContainerStyle}>{props.children}</Stack>\r\n </Stack>\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IDropdownStyles, IStackTokens, mergeStyles } from '@fluentui/react';\r\nimport { Theme } from '@fluentui/react-theme-provider';\r\n\r\nexport const mainStackTokens: IStackTokens = {\r\n childrenGap: '1.5rem'\r\n};\r\n\r\nexport const micStackTokens: IStackTokens = {\r\n childrenGap: '0.75rem'\r\n};\r\n\r\nexport const dropDownStyles = (theme: Theme): Partial<IDropdownStyles> => ({\r\n caretDownWrapper: {\r\n height: '2.5rem',\r\n lineHeight: '2.5rem'\r\n },\r\n dropdownItem: {\r\n fontSize: '0.875rem',\r\n height: '2.5rem',\r\n background: theme.palette.neutralQuaternaryAlt\r\n },\r\n dropdown: {\r\n height: '2.5rem',\r\n maxWidth: '20.75rem',\r\n minWidth: '12.5rem'\r\n },\r\n title: {\r\n fontSize: '0.875rem',\r\n height: '2.5rem',\r\n lineHeight: '2.3125rem'\r\n },\r\n label: {\r\n fontWeight: 600,\r\n fontSize: '0.875rem'\r\n },\r\n errorMessage: {\r\n fontSize: '0.875rem'\r\n }\r\n});\r\n\r\nexport const localSettingsContainer = mergeStyles({\r\n width: '100%',\r\n maxWidth: '18.75rem',\r\n minWidth: '12.5rem',\r\n maxHeight: '19.125rem',\r\n marginTop: '2.125rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { IDropdownOption, Dropdown, Stack } from '@fluentui/react';\r\nimport { dropDownStyles, localSettingsContainer, mainStackTokens } from './styles/LocalDeviceSettings.styles';\r\nimport { VideoDeviceInfo, AudioDeviceInfo } from '@azure/communication-calling';\r\nimport { useTheme } from '@fluentui/react-theme-provider';\r\n\r\nconst cameraPermissionDeniedText = 'Your browser is blocking access to your camera.';\r\nconst microphonePermissionDeniedText = 'Your browser is blocking access to your microphone.';\r\n\r\nconst getDropDownList = (list: Array<VideoDeviceInfo | AudioDeviceInfo>): IDropdownOption[] => {\r\n // Remove duplicates\r\n const noDuplicates = new Map();\r\n for (const item of list) {\r\n noDuplicates.set(item.id, item);\r\n }\r\n const dropdownList: any[] = [];\r\n for (const item of noDuplicates.values()) {\r\n dropdownList.push({\r\n val: item,\r\n key: item.id,\r\n text: item.name === '' ? item.deviceType : item.name\r\n });\r\n }\r\n return dropdownList;\r\n};\r\n\r\nexport interface LocalDeviceSettingsType {\r\n cameras: VideoDeviceInfo[];\r\n microphones: AudioDeviceInfo[];\r\n speakers: AudioDeviceInfo[];\r\n selectedCamera?: VideoDeviceInfo;\r\n selectedMicrophone?: AudioDeviceInfo;\r\n selectedSpeaker?: AudioDeviceInfo;\r\n microphonePermissionGranted: boolean;\r\n cameraPermissionGranted: boolean;\r\n onSelectCamera: (device: VideoDeviceInfo) => Promise<void>;\r\n onSelectMicrophone: (device: AudioDeviceInfo) => Promise<void>;\r\n onSelectSpeaker: (device: AudioDeviceInfo) => Promise<void>;\r\n}\r\n\r\nexport const LocalDeviceSettings = (props: LocalDeviceSettingsType): JSX.Element => {\r\n const theme = useTheme();\r\n const defaultPlaceHolder = 'Select an option';\r\n const cameraLabel = 'Camera';\r\n const micLabel = 'Microphone';\r\n const speakerLabel = 'Speaker';\r\n\r\n // TODO: speaker permission is tied to microphone permission (when you request 'audio' permission using the SDK) its\r\n // actually granting access to query both microphone and speaker. However the browser popup asks you explicity for\r\n // 'microphone'. This needs investigation on how we want to handle this and maybe needs follow up with SDK team.\r\n\r\n return (\r\n <Stack className={localSettingsContainer} tokens={mainStackTokens}>\r\n <Dropdown\r\n label={cameraLabel}\r\n placeholder={defaultPlaceHolder}\r\n options={props.cameraPermissionGranted ? getDropDownList(props.cameras) : [{ key: 'denied', text: '' }]}\r\n styles={dropDownStyles(theme)}\r\n disabled={!props.cameraPermissionGranted}\r\n errorMessage={props.cameraPermissionGranted ? undefined : cameraPermissionDeniedText}\r\n defaultSelectedKey={\r\n props.cameraPermissionGranted\r\n ? props.selectedCamera\r\n ? props.selectedCamera.id\r\n : props.cameras\r\n ? props.cameras[0]?.id\r\n : ''\r\n : 'denied'\r\n }\r\n onChange={(event, option, index) => {\r\n props.onSelectCamera(props.cameras[index ?? 0]);\r\n }}\r\n />\r\n <Dropdown\r\n label={micLabel}\r\n placeholder={defaultPlaceHolder}\r\n styles={dropDownStyles(theme)}\r\n disabled={!props.microphonePermissionGranted}\r\n errorMessage={props.microphonePermissionGranted ? undefined : microphonePermissionDeniedText}\r\n options={props.microphonePermissionGranted ? getDropDownList(props.microphones) : [{ key: 'denied', text: '' }]}\r\n defaultSelectedKey={\r\n props.microphonePermissionGranted\r\n ? props.selectedMicrophone\r\n ? props.selectedMicrophone.id\r\n : props.microphones\r\n ? props.microphones[0]?.id\r\n : ''\r\n : 'denied'\r\n }\r\n onChange={(\r\n event: React.FormEvent<HTMLDivElement>,\r\n option?: IDropdownOption | undefined,\r\n index?: number | undefined\r\n ) => {\r\n props.onSelectMicrophone(props.microphones[index ?? 0]);\r\n }}\r\n />\r\n <Dropdown\r\n label={speakerLabel}\r\n placeholder={defaultPlaceHolder}\r\n styles={dropDownStyles(theme)}\r\n disabled={props.speakers.length === 0}\r\n options={getDropDownList(props.speakers)}\r\n defaultSelectedKey={\r\n props.selectedSpeaker ? props.selectedSpeaker.id : props.speakers ? props.speakers[0]?.id : ''\r\n }\r\n onChange={(\r\n event: React.FormEvent<HTMLDivElement>,\r\n option?: IDropdownOption | undefined,\r\n index?: number | undefined\r\n ) => {\r\n props.onSelectSpeaker(props.speakers[index ?? 0]);\r\n }}\r\n />\r\n </Stack>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const videoCameraIconStyle = mergeStyles({\r\n marginRight: '0.375rem',\r\n fontSize: '1.375rem'\r\n});\r\n\r\nexport const buttonStyle = mergeStyles({\r\n fontWeight: 600,\r\n fontSize: '0.875rem', // 14px\r\n height: '2.75rem',\r\n width: '100%',\r\n marginTop: '2.125rem',\r\n maxWidth: '18.75rem',\r\n minWidth: '12.5rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { PrimaryButton } from '@fluentui/react';\r\nimport React from 'react';\r\nimport { buttonStyle, videoCameraIconStyle } from './styles/StartCallButton.styles';\r\nimport { VideoCameraEmphasisIcon } from '@fluentui/react-icons-northstar';\r\n\r\nexport interface StartCallButtonProps {\r\n onClickHandler: () => void;\r\n isDisabled: boolean;\r\n}\r\n\r\nconst buttonText = 'Start call';\r\n\r\nexport const StartCallButton = (props: StartCallButtonProps): JSX.Element => {\r\n const { isDisabled, onClickHandler } = props;\r\n\r\n return (\r\n <PrimaryButton disabled={isDisabled} className={buttonStyle} onClick={onClickHandler}>\r\n <VideoCameraEmphasisIcon className={videoCameraIconStyle} size=\"medium\" />\r\n {buttonText}\r\n </PrimaryButton>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { devicePermissionSelector, optionsButtonSelector } from '@azure/acs-calling-selector';\r\nimport React from 'react';\r\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\r\nimport { CallConfiguration } from './CallConfiguration';\r\n// TODO: Next PR should move move provider & hooks into the selector package\r\n// and we want to make samples and composite both use from selector package.\r\nimport { useHandlers } from './hooks/useHandlers';\r\nimport { LocalDeviceSettings } from './LocalDeviceSettings';\r\nimport { StartCallButton } from './StartCallButton';\r\n\r\nexport interface ConfigurationScreenProps {\r\n screenWidth: number;\r\n startCallHandler(): void;\r\n}\r\n\r\nexport const ConfigurationScreen = (props: ConfigurationScreenProps): JSX.Element => {\r\n const { startCallHandler } = props;\r\n\r\n const options = useAdaptedSelector(optionsButtonSelector);\r\n const localDeviceSettingsHandlers = useHandlers(LocalDeviceSettings);\r\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useAdaptedSelector(\r\n devicePermissionSelector\r\n );\r\n\r\n return (\r\n <CallConfiguration {...props}>\r\n <div>\r\n <LocalDeviceSettings\r\n {...options}\r\n {...localDeviceSettingsHandlers}\r\n cameraPermissionGranted={cameraPermissionGranted}\r\n microphonePermissionGranted={microphonePermissionGranted}\r\n />\r\n </div>\r\n <div>\r\n <StartCallButton onClickHandler={startCallHandler} isDisabled={false} />\r\n </div>\r\n </CallConfiguration>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStackTokens, mergeStyles } from '@fluentui/react';\r\n\r\nexport const mainStackTokens: IStackTokens = {\r\n childrenGap: '0.25rem'\r\n};\r\nexport const buttonsStackTokens: IStackTokens = {\r\n childrenGap: '0.75rem'\r\n};\r\nexport const upperStackTokens: IStackTokens = {\r\n childrenGap: '1.5rem'\r\n};\r\nexport const bottomStackTokens: IStackTokens = {\r\n childrenGap: '1.4375rem'\r\n};\r\nexport const endCallContainerStyle = mergeStyles({\r\n width: '20.625rem',\r\n position: 'absolute',\r\n top: '0',\r\n bottom: '0',\r\n left: '0',\r\n right: '0',\r\n margin: 'auto'\r\n});\r\nexport const endCallTitleStyle = mergeStyles({\r\n fontSize: '1.375rem',\r\n fontWeight: 600\r\n});\r\nexport const buttonStyle = mergeStyles({\r\n fontWeight: 600,\r\n height: '2.5rem',\r\n width: '9.875rem',\r\n fontSize: '0.875rem', // 14px\r\n padding: 0\r\n});\r\nexport const videoCameraIconStyle = mergeStyles({\r\n marginRight: '0.375rem',\r\n fontSize: '1.375rem'\r\n});\r\nexport const bottomStackFooterStyle = mergeStyles({\r\n fontSize: '0.875 rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\nimport { PrimaryButton, Stack } from '@fluentui/react';\r\nimport { VideoCameraEmphasisIcon } from '@fluentui/react-icons-northstar';\r\nimport {\r\n endCallContainerStyle,\r\n endCallTitleStyle,\r\n buttonStyle,\r\n mainStackTokens,\r\n buttonsStackTokens,\r\n upperStackTokens,\r\n videoCameraIconStyle,\r\n bottomStackFooterStyle\r\n} from './styles/Error.styles';\r\n\r\nexport interface ErrorProps {\r\n rejoinHandler(): void;\r\n title?: string;\r\n reason?: string;\r\n}\r\n\r\nexport function Error(props: ErrorProps): JSX.Element {\r\n const title = props.title ?? 'Error joining the Call';\r\n const rejoinCall = 'Retry Call';\r\n\r\n return (\r\n <Stack verticalAlign=\"center\" tokens={mainStackTokens} className={endCallContainerStyle}>\r\n <Stack tokens={upperStackTokens}>\r\n <div className={endCallTitleStyle}>{title}</div>\r\n <Stack horizontal tokens={buttonsStackTokens}>\r\n <PrimaryButton className={buttonStyle} onClick={props.rejoinHandler}>\r\n <VideoCameraEmphasisIcon className={videoCameraIconStyle} size=\"medium\" />\r\n {rejoinCall}\r\n </PrimaryButton>\r\n </Stack>\r\n <div className={bottomStackFooterStyle}>\r\n {props.reason ? (\r\n props.reason\r\n ) : (\r\n <>\r\n Common reasons for this error:\r\n <ul>\r\n <li>Incorrect Teams Meeting URL</li>\r\n <li>Incorrect Group Call ID</li>\r\n </ul>\r\n </>\r\n )}\r\n </div>\r\n </Stack>\r\n </Stack>\r\n );\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { mergeStyles } from '@fluentui/react';\r\n\r\nexport const callContainer = mergeStyles({\r\n height: '100%',\r\n width: '100%',\r\n overflow: 'auto',\r\n minHeight: '30rem',\r\n minWidth: '50rem'\r\n});\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React, { useEffect, useState } from 'react';\r\nimport { CallScreen } from './CallScreen';\r\nimport { ConfigurationScreen } from './ConfigurationScreen';\r\nimport { Error } from './Error';\r\nimport { callContainer } from './styles/Call.styles';\r\nimport { Stack } from '@fluentui/react';\r\nimport { CallAdapterProvider, useAdapter } from './adapter/CallAdapterProvider';\r\nimport { CallAdapter, CallCompositePage } from './adapter/CallAdapter';\r\nimport { PlaceholderProps } from 'react-components';\r\nimport { useSelector } from './hooks/useSelector';\r\nimport { getPage } from './selectors/baseSelectors';\r\nimport { Theme, PartialTheme } from '@fluentui/react-theme-provider';\r\nimport { FluentThemeProvider } from 'react-components';\r\n\r\nexport type CallCompositeProps = {\r\n adapter: CallAdapter;\r\n /**\r\n * Fluent theme for the composite.\r\n *\r\n * Defaults to a light theme if undefined.\r\n */\r\n fluentTheme?: PartialTheme | Theme;\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element;\r\n};\r\n\r\ntype MainScreenProps = {\r\n onRenderAvatar?: (props: PlaceholderProps, defaultOnRender: (props: PlaceholderProps) => JSX.Element) => JSX.Element;\r\n screenWidth: number;\r\n};\r\n\r\nconst MainScreen = ({ screenWidth, onRenderAvatar }: MainScreenProps): JSX.Element => {\r\n const page = useSelector(getPage);\r\n const adapter = useAdapter();\r\n switch (page) {\r\n case 'configuration':\r\n return <ConfigurationScreen screenWidth={screenWidth} startCallHandler={(): void => adapter.setPage('call')} />;\r\n case 'error':\r\n return <Error rejoinHandler={() => adapter.setPage('configuration')} />;\r\n case 'errorJoiningTeamsMeeting':\r\n return (\r\n <Error\r\n rejoinHandler={() => adapter.setPage('configuration')}\r\n title=\"Error joining Teams Meeting\"\r\n reason=\"Access to the Teams meeting was denied.\"\r\n />\r\n );\r\n default:\r\n return (\r\n <CallScreen\r\n endCallHandler={async (): Promise<void> => {\r\n adapter.setPage('configuration');\r\n }}\r\n callErrorHandler={(customPage?: CallCompositePage) => {\r\n customPage ? adapter.setPage(customPage) : adapter.setPage('error');\r\n }}\r\n onRenderAvatar={onRenderAvatar}\r\n screenWidth={screenWidth}\r\n />\r\n );\r\n }\r\n};\r\n\r\nexport const Call = (props: CallCompositeProps): JSX.Element => {\r\n const [screenWidth, setScreenWidth] = useState(window?.innerWidth ?? 0);\r\n\r\n useEffect(() => {\r\n const setWindowWidth = (): void => {\r\n const width = typeof window !== 'undefined' ? window.innerWidth : 0;\r\n setScreenWidth(width);\r\n };\r\n setWindowWidth();\r\n window.addEventListener('resize', setWindowWidth);\r\n return () => window.removeEventListener('resize', setWindowWidth);\r\n }, []);\r\n\r\n const { adapter, fluentTheme } = props;\r\n\r\n useEffect(() => {\r\n (async () => {\r\n await adapter.askDevicePermission({ video: true, audio: true });\r\n adapter.queryCameras();\r\n adapter.queryMicrophones();\r\n adapter.querySpeakers();\r\n })();\r\n }, [adapter]);\r\n\r\n return (\r\n <FluentThemeProvider fluentTheme={fluentTheme}>\r\n <CallAdapterProvider adapter={adapter}>\r\n <Stack className={callContainer} grow>\r\n <MainScreen screenWidth={screenWidth} onRenderAvatar={props.onRenderAvatar} />\r\n </Stack>\r\n </CallAdapterProvider>\r\n </FluentThemeProvider>\r\n );\r\n};\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\nimport { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling';\r\nimport EventEmitter from 'events';\r\n\r\nexport class ParticipantSubscriber {\r\n private participant: RemoteParticipant;\r\n private emitter: EventEmitter;\r\n\r\n constructor(participant: RemoteParticipant, emitter: EventEmitter) {\r\n this.participant = participant;\r\n this.emitter = emitter;\r\n this.subscribeParticipantEvents();\r\n }\r\n\r\n private isMutedChangedHandler = (): void => {\r\n this.emitter.emit('isMutedChanged', {\r\n participantId: this.participant.identifier,\r\n isMuted: this.participant.isMuted\r\n });\r\n };\r\n\r\n private displayNameChangedHandler = (): void => {\r\n this.emitter.emit('displayNameChanged', {\r\n participantId: this.participant.identifier,\r\n displayName: this.participant.displayName\r\n });\r\n };\r\n\r\n private isSpeakingChangedHandler = (): void => {\r\n this.emitter.emit('isSpeakingChanged', {\r\n participantId: this.participant.identifier,\r\n isSpeaking: this.participant.isSpeaking\r\n });\r\n };\r\n\r\n private videoStreamsUpdatedHandler = (event: { added: RemoteVideoStream[]; removed: RemoteVideoStream[] }): void => {\r\n this.emitter.emit('videoStreamsUpdated', event);\r\n };\r\n\r\n private subscribeParticipantEvents(): void {\r\n this.participant.on('isMutedChanged', this.isMutedChangedHandler);\r\n this.participant.on('displayNameChanged', this.displayNameChangedHandler);\r\n this.participant.on('isSpeakingChanged', this.isSpeakingChangedHandler);\r\n this.participant.on('videoStreamsUpdated', this.videoStreamsUpdatedHandler);\r\n }\r\n\r\n public unsubscribeAll(): void {\r\n this.participant.off('isMutedChanged', this.isMutedChangedHandler);\r\n this.participant.off('displayNameChanged', this.displayNameChangedHandler);\r\n this.participant.off('isSpeakingChanged', this.isSpeakingChangedHandler);\r\n this.participant.off('videoStreamsUpdated', this.videoStreamsUpdatedHandler);\r\n }\r\n}\r\n\r\nexport type ParticipantEvent = 'isMutedChanged' | 'displayNameChanged' | 'isSpeakingChanged' | 'videoStreamsUpdated';\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { DefaultCallingHandlers, createDefaultCallingHandlers } from '@azure/acs-calling-selector';\r\nimport {\r\n CallClientState,\r\n StatefulDeviceManager,\r\n StatefulCallClient,\r\n createStatefulCallClient,\r\n DeviceManagerState,\r\n CallState\r\n} from 'calling-stateful-client';\r\nimport {\r\n AudioOptions,\r\n CallAgent,\r\n Call,\r\n CallClientOptions,\r\n GroupCallLocator,\r\n TeamsMeetingLinkLocator,\r\n LocalVideoStream as SDKLocalVideoStream,\r\n AudioDeviceInfo,\r\n VideoDeviceInfo,\r\n RemoteParticipant,\r\n PermissionConstraints\r\n} from '@azure/communication-calling';\r\nimport { EventEmitter } from 'events';\r\nimport {\r\n CallAdapter,\r\n CallCompositePage,\r\n CallEndedListener,\r\n CallEvent,\r\n CallIdChangedListener,\r\n CallAdapterState,\r\n DisplayNameChangedListener,\r\n IsMuteChangedListener,\r\n IsScreenSharingOnChangedListener,\r\n IsSpeakingChangedListener,\r\n ParticipantJoinedListener,\r\n ParticipantLeftListener\r\n} from './CallAdapter';\r\nimport { createAzureCommunicationUserCredential, getIdFromToken, isInCall } from '../../../utils';\r\nimport { VideoStreamOptions } from 'react-components';\r\nimport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from 'acs-ui-common';\r\nimport { CommunicationUserIdentifier } from '@azure/communication-signaling';\r\nimport { CommunicationUserKind } from '@azure/communication-common';\r\nimport { ParticipantSubscriber } from './ParticipantSubcriber';\r\n\r\n// Context of Chat, which is a centralized context for all state updates\r\nclass CallContext {\r\n private emitter: EventEmitter = new EventEmitter();\r\n private state: CallAdapterState;\r\n private callId: string | undefined;\r\n\r\n constructor(clientState: CallClientState) {\r\n this.state = {\r\n isLocalPreviewMicrophoneEnabled: false,\r\n userId: clientState.userId,\r\n displayName: clientState.callAgent?.displayName,\r\n devices: clientState.deviceManager,\r\n call: undefined,\r\n page: 'configuration'\r\n };\r\n }\r\n\r\n public onStateChange(handler: (_uiState: CallAdapterState) => void): void {\r\n this.emitter.on('stateChanged', handler);\r\n }\r\n\r\n public offStateChange(handler: (_uiState: CallAdapterState) => void): void {\r\n this.emitter.off('stateChanged', handler);\r\n }\r\n\r\n public setState(state: CallAdapterState): void {\r\n this.state = state;\r\n this.emitter.emit('stateChanged', this.state);\r\n }\r\n\r\n public getState(): CallAdapterState {\r\n return this.state;\r\n }\r\n\r\n public setPage(page: CallCompositePage): void {\r\n this.setState({ ...this.state, page });\r\n }\r\n\r\n public setError(error: Error): void {\r\n this.setState({ ...this.state, error });\r\n }\r\n\r\n public setIsLocalMicrophoneEnabled(isLocalPreviewMicrophoneEnabled: boolean): void {\r\n this.setState({ ...this.state, isLocalPreviewMicrophoneEnabled });\r\n }\r\n\r\n public setCallId(callId: string | undefined): void {\r\n this.callId = callId;\r\n }\r\n\r\n public updateClientState(clientState: CallClientState): void {\r\n const call = clientState.calls.get(this.callId ?? '');\r\n const endedCall =\r\n clientState.callsEnded.length > 0 ? clientState.callsEnded[clientState.callsEnded.length - 1] : undefined;\r\n this.setState({\r\n ...this.state,\r\n userId: clientState.userId,\r\n displayName: clientState.callAgent?.displayName,\r\n call,\r\n endedCall: endedCall,\r\n devices: clientState.deviceManager,\r\n isLocalPreviewMicrophoneEnabled:\r\n call?.isMuted === undefined ? this.state.isLocalPreviewMicrophoneEnabled : !call?.isMuted\r\n });\r\n }\r\n\r\n public setEndedCall(call: CallState): void {\r\n this.setState({ ...this.state, endedCall: call });\r\n }\r\n}\r\n\r\nexport class AzureCommunicationCallAdapter implements CallAdapter {\r\n private callClient: StatefulCallClient;\r\n private callAgent: CallAgent;\r\n private deviceManager: StatefulDeviceManager;\r\n private localStream: SDKLocalVideoStream | undefined;\r\n private locator: TeamsMeetingLinkLocator | GroupCallLocator;\r\n private call: Call | undefined;\r\n private context: CallContext;\r\n private handlers: DefaultCallingHandlers;\r\n private participantSubscribers = new Map<string, ParticipantSubscriber>();\r\n private emitter: EventEmitter = new EventEmitter();\r\n private onClientStateChange: (clientState: CallClientState) => void;\r\n\r\n constructor(\r\n callClient: StatefulCallClient,\r\n locator: TeamsMeetingLinkLocator | GroupCallLocator,\r\n callAgent: CallAgent,\r\n deviceManager: StatefulDeviceManager\r\n ) {\r\n this.callClient = callClient;\r\n this.callAgent = callAgent;\r\n this.locator = locator;\r\n this.deviceManager = deviceManager;\r\n this.context = new CallContext(callClient.getState());\r\n const onStateChange = (clientState: CallClientState): void => {\r\n // unsubscribe when the instance gets disposed\r\n if (!this) {\r\n callClient.offStateChange(onStateChange);\r\n return;\r\n }\r\n this.context.updateClientState(clientState);\r\n };\r\n\r\n this.handlers = createDefaultCallingHandlers(callClient, callAgent, deviceManager, undefined);\r\n\r\n this.onClientStateChange = onStateChange;\r\n\r\n this.callClient.onStateChange(onStateChange);\r\n }\r\n\r\n public dispose(): void {\r\n this.callClient.offStateChange(this.onClientStateChange);\r\n this.callAgent.dispose();\r\n }\r\n\r\n public isTeamsCall(): boolean {\r\n return 'meetingLink' in this.locator;\r\n }\r\n\r\n public queryCameras(): Promise<VideoDeviceInfo[]> {\r\n return this.deviceManager.getCameras();\r\n }\r\n\r\n public queryMicrophones(): Promise<AudioDeviceInfo[]> {\r\n return this.deviceManager.getMicrophones();\r\n }\r\n\r\n public async querySpeakers(): Promise<AudioDeviceInfo[]> {\r\n return this.deviceManager.getSpeakers();\r\n }\r\n\r\n public async askDevicePermission(constrain: PermissionConstraints): Promise<void> {\r\n await this.deviceManager.askDevicePermission(constrain);\r\n }\r\n\r\n public async joinCall(microphoneOn?: boolean): Promise<void> {\r\n if (isInCall(this.getState().call?.state ?? 'None')) {\r\n throw new Error('You are already in the call!');\r\n } else {\r\n const audioOptions: AudioOptions = { muted: microphoneOn ?? !this.getState().isLocalPreviewMicrophoneEnabled };\r\n // TODO: find a way to expose stream to here\r\n const videoOptions = { localVideoStreams: this.localStream ? [this.localStream] : undefined };\r\n\r\n const isTeamsMeeting = 'groupId' in this.locator;\r\n\r\n if (isTeamsMeeting) {\r\n this.call = this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\r\n audioOptions,\r\n videoOptions\r\n });\r\n } else {\r\n this.call = this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\r\n audioOptions,\r\n videoOptions\r\n });\r\n }\r\n\r\n this.context.setCallId(this.call.id);\r\n // Resync state after callId is set\r\n this.context.updateClientState(this.callClient.getState());\r\n this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);\r\n this.subscribeCallEvents();\r\n }\r\n }\r\n\r\n public async createStreamView(userId?: string, options?: VideoStreamOptions | undefined): Promise<void> {\r\n if (userId === undefined) {\r\n await this.handlers.onCreateLocalStreamView(options);\r\n } else {\r\n await this.handlers.onCreateRemoteStreamView(userId, options);\r\n }\r\n }\r\n\r\n public async leaveCall(): Promise<void> {\r\n const callId = this.call?.id;\r\n await this.handlers.onHangUp();\r\n this.unsubscribeCallEvents();\r\n this.call = undefined;\r\n this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);\r\n this.context.setCallId(undefined);\r\n // Resync state after callId is set\r\n this.context.updateClientState(this.callClient.getState());\r\n this.stopCamera();\r\n this.mute();\r\n this.emitter.emit('callEnded', { callId });\r\n }\r\n\r\n public async setCamera(device: VideoDeviceInfo): Promise<void> {\r\n await this.handlers.onSelectCamera(device);\r\n }\r\n\r\n public async setMicrophone(device: AudioDeviceInfo): Promise<void> {\r\n await this.handlers.onSelectMicrophone(device);\r\n }\r\n\r\n public async setSpeaker(device: AudioDeviceInfo): Promise<void> {\r\n await this.handlers.onSelectSpeaker(device);\r\n }\r\n\r\n public async onToggleCamera(): Promise<void> {\r\n await this.handlers.onToggleCamera();\r\n }\r\n\r\n //TODO: seperate onToggleCamera logic in Handler\r\n public async startCamera(): Promise<void> {\r\n if (!this.isCameraOn()) await this.handlers.onToggleCamera();\r\n }\r\n\r\n public async stopCamera(): Promise<void> {\r\n if (this.isCameraOn()) await this.handlers.onToggleCamera();\r\n }\r\n\r\n private isCameraOn(): boolean {\r\n if (this.call) {\r\n const stream = this.call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\r\n return !!stream;\r\n } else {\r\n if (this.callClient.getState().deviceManager.selectedCamera) {\r\n const previewOn = isPreviewOn(this.callClient.getState().deviceManager);\r\n return previewOn;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public async mute(): Promise<void> {\r\n if (!this.call) {\r\n this.context.setIsLocalMicrophoneEnabled(false);\r\n }\r\n await this.call?.mute();\r\n }\r\n\r\n public async unmute(): Promise<void> {\r\n if (!this.call) {\r\n this.context.setIsLocalMicrophoneEnabled(true);\r\n }\r\n await this.call?.unmute();\r\n }\r\n\r\n public async startScreenShare(): Promise<void> {\r\n if (!this.call?.isScreenSharingOn) await this.handlers.onToggleScreenShare();\r\n }\r\n\r\n public async stopScreenShare(): Promise<void> {\r\n if (this.call?.isScreenSharingOn) await this.handlers.onToggleScreenShare();\r\n }\r\n\r\n //TODO: a better way to expose option parameter\r\n public startCall(participants: string[]): Call | undefined {\r\n const idsToAdd = participants.map((participant) => {\r\n // FIXME: `onStartCall` does not allow a Teams user.\r\n // Need some way to return an error if a Teams user is provided.\r\n const backendId = fromFlatCommunicationIdentifier(participant) as CommunicationUserIdentifier;\r\n return backendId;\r\n });\r\n\r\n return this.handlers.onStartCall(idsToAdd);\r\n }\r\n\r\n public async removeParticipant(userId: string): Promise<void> {\r\n this.handlers.onParticipantRemove(userId);\r\n }\r\n\r\n public getState(): CallAdapterState {\r\n return this.context.getState();\r\n }\r\n\r\n public onStateChange(handler: (state: CallAdapterState) => void): void {\r\n this.context.onStateChange(handler);\r\n }\r\n\r\n public offStateChange(handler: (state: CallAdapterState) => void): void {\r\n this.context.offStateChange(handler);\r\n }\r\n\r\n on(event: 'participantsJoined', listener: ParticipantJoinedListener): void;\r\n on(event: 'participantsLeft', listener: ParticipantLeftListener): void;\r\n on(event: 'isMutedChanged', listener: IsMuteChangedListener): void;\r\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\r\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsScreenSharingOnChangedListener): void;\r\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\r\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\r\n on(event: 'callEnded', listener: CallEndedListener): void;\r\n on(event: 'error', errorHandler: (e: Error) => void): void;\r\n\r\n public on(event: CallEvent, listener: (e: any) => void): void {\r\n this.emitter.on(event, listener);\r\n }\r\n\r\n private subscribeCallEvents(): void {\r\n this.call?.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated);\r\n this.call?.on('isMutedChanged', this.isMyMutedChanged);\r\n this.call?.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\r\n this.call?.on('idChanged', this.callIdChanged);\r\n }\r\n\r\n private unsubscribeCallEvents(): void {\r\n for (const subscriber of this.participantSubscribers.values()) {\r\n subscriber.unsubscribeAll();\r\n }\r\n this.participantSubscribers.clear();\r\n this.call?.off('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated);\r\n this.call?.off('isMutedChanged', this.isMyMutedChanged);\r\n this.call?.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\r\n this.call?.off('idChanged', this.callIdChanged);\r\n }\r\n\r\n private isMyMutedChanged = (): void => {\r\n this.emitter.emit('isMutedChanged', {\r\n participantId: createCommunicationIdentifier(this.getState().userId),\r\n isMuted: this.call?.isMuted\r\n });\r\n };\r\n\r\n public setPage = (page: CallCompositePage): void => {\r\n this.context.setPage(page);\r\n };\r\n\r\n private onRemoteParticipantsUpdated = ({\r\n added,\r\n removed\r\n }: {\r\n added: RemoteParticipant[];\r\n removed: RemoteParticipant[];\r\n }): void => {\r\n if (added && added.length > 0) {\r\n this.emitter.emit('participantsJoined', added);\r\n }\r\n if (removed && removed.length > 0) {\r\n this.emitter.emit('participantsLeft', removed);\r\n }\r\n\r\n added.forEach((participant) => {\r\n this.participantSubscribers.set(\r\n toFlatCommunicationIdentifier(participant.identifier),\r\n new ParticipantSubscriber(participant, this.emitter)\r\n );\r\n });\r\n\r\n removed.forEach((participant) => {\r\n const subscriber = this.participantSubscribers.get(toFlatCommunicationIdentifier(participant.identifier));\r\n subscriber && subscriber.unsubscribeAll();\r\n this.participantSubscribers.delete(toFlatCommunicationIdentifier(participant.identifier));\r\n });\r\n };\r\n\r\n private isScreenSharingOnChanged = (): void => {\r\n this.emitter.emit('isLocalScreenSharingActiveChanged', { isScreenSharingOn: this.call?.isScreenSharingOn });\r\n };\r\n\r\n private callIdChanged = (): void => {\r\n this.context.setCallId(this.call?.id);\r\n // Resync state after callId is set\r\n this.context.updateClientState(this.callClient.getState());\r\n this.emitter.emit('callIdChanged', { callId: this.callIdChanged });\r\n };\r\n\r\n off(event: 'participantsJoined', listener: ParticipantJoinedListener): void;\r\n off(event: 'participantsLeft', listener: ParticipantLeftListener): void;\r\n off(event: 'isMutedChanged', listener: IsMuteChangedListener): void;\r\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\r\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsScreenSharingOnChangedListener): void;\r\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\r\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\r\n off(event: 'callEnded', listener: CallEndedListener): void;\r\n off(event: 'error', errorHandler: (e: Error) => void): void;\r\n\r\n public off(event: CallEvent, listener: (e: any) => void): void {\r\n this.emitter.off(event, listener);\r\n }\r\n}\r\n\r\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n return deviceManager.unparentedViews.values().next().value?.view !== undefined;\r\n};\r\n\r\nconst createCommunicationIdentifier = (rawId: string): CommunicationUserKind => {\r\n return { kind: 'communicationUser', communicationUserId: rawId };\r\n};\r\n\r\nexport const createAzureCommunicationCallAdapter = async (\r\n token: string,\r\n locator: TeamsMeetingLinkLocator | GroupCallLocator,\r\n displayName: string,\r\n refreshTokenCallback?: (() => Promise<string>) | undefined,\r\n callClientOptions?: CallClientOptions\r\n): Promise<CallAdapter> => {\r\n const userId = getIdFromToken(token);\r\n\r\n const callClient = createStatefulCallClient({ userId }, callClientOptions);\r\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\r\n const callAgent = await callClient.createCallAgent(\r\n createAzureCommunicationUserCredential(token, refreshTokenCallback),\r\n { displayName }\r\n );\r\n\r\n const adapter = new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);\r\n return adapter;\r\n};\r\n"],"names":["isCommunicationUserIdentifier","isMicrosoftTeamsUserIdentifier","isPhoneNumberIdentifier","getDeviceManager","getCall","getDisplayName","getIdentifier","reselect","memoizeOne","LocalVideoStream","isPreviewOn","createSelector","createContext","React","useContext","useState","useEffect","CallContext","mergeStyles","Stack","palette","getTheme","MessageBar","MessageBarType","concatStyleSets","TextField","SendIcon","TooltipHost","ErrorIcon","CircleRingIcon","MessageSeenIcon","CompletedIcon","FontIcon","PrimaryButton","Icon","SystemMessageComponent","Parser","LiveMessage","Linkify","Link","Chat","Persona","PersonaSize","Flex","useRef","useCallback","useMemo","LiveAnnouncer","Ref","useTheme","ContextualMenu","DirectionalHint","participantListStyle","PersonaPresence","CallControlPresentNewIcon","MicOffIcon","IconButton","OverflowSet","videoBaseStyle","videoTileStyle","Text","memoizeAllRemoteParticipants","CallVideoIcon","CallVideoOffIcon","Label","DefaultButton","CallEndIcon","MicIcon","MoreIcon","CallControlCloseTrayIcon","mergeThemes","teamsTheme","ThemeProvider","Provider","useHandlers","useSelector","usePropsFor","getSelector","emptySelector","findSelector","getUserId","getParticipants","enableMapSet","EventEmitter","produce","VideoStreamRenderer","ParticipantSubscriber","Features","CallClient","ChatContext","nanoid","getIdentifierKind","ChatClient","AzureCommunicationTokenCredential","useAdapter","useAdaptedSelector","useSelectorWithAdaptation","adaptCompositeState","memoizeState","createCompositeHandlers","loadingStyle","onRenderPlaceholder","Spinner","SpinnerSize","mainStackTokens","Dropdown","videoCameraIconStyle","buttonStyle","VideoCameraEmphasisIcon","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,OAAO,GAAG,CAAC,KAAY,EAAE,KAAY,EAAE,MAAyC;IACpF,OAAO,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,YAAY,GAAG,CAC1B,WAAiD,EACjD,oBAAyD,MAAM,CAAC,EAAE;IAElE,IAAI,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC7C,IAAI,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEjD,OAAO,CAAC,QAA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-common/src/identifier.ts","../../../../acs-ui-common/src/telemetryVersion.js","../../../../acs-ui-common/src/telemetry.ts","../../../../calling-component-bindings/src/baseSelectors.ts","../../../../calling-component-bindings/src/callControlSelectors.ts","../../../../calling-component-bindings/src/handlers/createHandlers.ts","../../../../calling-component-bindings/src/participantListSelector.ts","../../../../calling-component-bindings/src/participantsButtonSelector.ts","../../../../calling-component-bindings/src/videoGallerySelector.ts","../../../../calling-component-bindings/src/errorBarSelector.ts","../../../../calling-component-bindings/src/providers/CallAgentProvider.tsx","../../../../calling-component-bindings/src/providers/CallClientProvider.tsx","../../../../calling-component-bindings/src/providers/CallProvider.tsx","../../../../react-components/src/components/styles/TypingIndicator.styles.ts","../../../../react-components/src/localization/locales/index.ts","../../../../react-components/src/localization/LocalizationProvider.tsx","../../../../react-components/src/localization/localizationUtils.tsx","../../../../react-components/src/identifiers/IdentifierProvider.tsx","../../../../react-components/src/components/TypingIndicator.tsx","../../../../react-components/src/components/ErrorBar.tsx","../../../../react-components/src/components/styles/GridLayout.styles.ts","../../../../react-components/src/components/GridLayout.tsx","../../../../react-components/src/components/styles/SendBox.styles.ts","../../../../react-components/src/theming/themes.ts","../../../../react-components/src/theming/FluentThemeProvider.tsx","../../../../react-components/src/theming/icons.tsx","../../../../react-components/src/components/styles/InputBoxComponent.style.ts","../../../../react-components/src/theming/themeUtils.ts","../../../../react-components/src/components/InputBoxComponent.tsx","../../../../react-components/src/components/SendBox.tsx","../../../../react-components/src/components/styles/MessageStatusIndicator.styles.ts","../../../../react-components/src/components/MessageStatusIndicator.tsx","../../../../react-components/src/components/styles/MessageThread.styles.ts","../../../../react-components/src/components/utils/delay.ts","../../../../react-components/src/components/styles/SystemMessage.styles.ts","../../../../react-components/src/components/SystemMessage.tsx","../../../../react-components/src/components/styles/ChatMessageComponent.styles.ts","../../../../react-components/src/components/utils/Datetime.ts","../../../../react-components/src/components/styles/EditBox.styles.ts","../../../../react-components/src/components/EditBox.tsx","../../../../react-components/src/components/ChatMessageComponent.tsx","../../../../react-components/src/components/MessageThread.tsx","../../../../react-components/src/components/styles/StreamMedia.styles.ts","../../../../react-components/src/components/StreamMedia.tsx","../../../../react-components/src/components/styles/ParticipantItem.styles.ts","../../../../react-components/src/components/ParticipantItem.tsx","../../../../react-components/src/components/styles/ParticipantList.styles.ts","../../../../react-components/src/components/ParticipantList.tsx","../../../../react-components/src/components/styles/VideoGallery.styles.ts","../../../../react-components/src/components/styles/VideoTile.styles.ts","../../../../react-components/src/components/VideoTile.tsx","../../../../react-components/src/components/VideoGallery.tsx","../../../../react-components/src/components/styles/ControlBar.styles.ts","../../../../react-components/src/components/ControlBarButton.tsx","../../../../react-components/src/components/CameraButton.tsx","../../../../react-components/src/components/ControlBar.tsx","../../../../react-components/src/components/EndCallButton.tsx","../../../../react-components/src/components/MicrophoneButton.tsx","../../../../react-components/src/components/OptionsButton.tsx","../../../../react-components/src/components/ParticipantsButton.tsx","../../../../react-components/src/components/ScreenShareButton.tsx","../../../../calling-component-bindings/src/hooks/useHandlers.ts","../../../../calling-component-bindings/src/hooks/useSelector.ts","../../../../calling-component-bindings/src/hooks/usePropsFor.ts","../../../../chat-component-bindings/src/handlers/createHandlers.ts","../../../../chat-component-bindings/src/providers/ChatClientProvider.tsx","../../../../chat-component-bindings/src/providers/ChatThreadClientProvider.tsx","../../../../chat-component-bindings/src/hooks/useHandlers.ts","../../../../chat-component-bindings/src/hooks/useSelector.ts","../../../../chat-component-bindings/src/baseSelectors.ts","../../../../chat-component-bindings/src/sendBoxSelector.ts","../../../../chat-component-bindings/src/utils/compareMessages.ts","../../../../chat-component-bindings/src/utils/constants.ts","../../../../chat-component-bindings/src/messageThreadSelector.ts","../../../../chat-component-bindings/src/typingIndicatorSelector.ts","../../../../chat-component-bindings/src/chatParticipantListSelector.ts","../../../../chat-component-bindings/src/errorBarSelector.ts","../../../../chat-component-bindings/src/hooks/usePropsFor.ts","../../../../calling-stateful-client/src/DeviceManagerDeclarative.ts","../../../../calling-stateful-client/src/CallClientState.ts","../../../../calling-stateful-client/src/modifiers/ClearErrors.ts","../../../../calling-stateful-client/src/CallContext.ts","../../../../calling-stateful-client/src/Converter.ts","../../../../calling-stateful-client/src/RequestedTransferSubscriber.ts","../../../../calling-stateful-client/src/TransferCallFeatureDeclarative.ts","../../../../calling-stateful-client/src/CallDeclarative.ts","../../../../calling-stateful-client/src/ReceivedTransferSubscriber.ts","../../../../calling-stateful-client/src/RemoteVideoStreamSubscriber.ts","../../../../calling-stateful-client/src/StreamUtils.ts","../../../../calling-stateful-client/src/ParticipantSubscriber.ts","../../../../calling-stateful-client/src/RecordingSubscriber.ts","../../../../calling-stateful-client/src/TranscriptionSubscriber.ts","../../../../calling-stateful-client/src/DiagnosticsSubscriber.ts","../../../../calling-stateful-client/src/CallSubscriber.ts","../../../../calling-stateful-client/src/IncomingCallSubscriber.ts","../../../../calling-stateful-client/src/CallAgentDeclarative.ts","../../../../calling-stateful-client/src/InternalCallContext.ts","../../../../calling-stateful-client/src/StatefulCallClient.ts","../../../../chat-stateful-client/src/ChatClientState.ts","../../../../chat-stateful-client/src/Constants.ts","../../../../chat-stateful-client/src/modifiers/ClearErrors.ts","../../../../chat-stateful-client/src/ChatContext.ts","../../../../chat-stateful-client/src/convertChatMessage.ts","../../../../chat-stateful-client/src/EventSubscriber.ts","../../../../chat-stateful-client/src/iterators/createDecoratedIterator.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListMessages.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListReadReceipts.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListParticipants.ts","../../../../chat-stateful-client/src/StatefulChatThreadClient.ts","../../../../chat-stateful-client/src/iterators/createDecoratedListThreads.ts","../../../../chat-stateful-client/src/StatefulChatClient.ts","../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts","../../../../react-composites/src/composites/localization/locales/index.ts","../../../../react-composites/src/composites/localization/LocalizationProvider.tsx","../../../../react-composites/src/composites/common/icons.tsx","../../../../react-composites/src/composites/common/Composite.tsx","../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.tsx","../../../../react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.ts","../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts","../../../../react-composites/src/composites/ChatComposite/hooks/usePropsFor.ts","../../../../react-composites/src/composites/ChatComposite/styles/Chat.styles.ts","../../../../react-composites/src/composites/ChatComposite/ChatHeader.tsx","../../../../react-composites/src/composites/common/AvatarPersona.tsx","../../../../react-composites/src/composites/ChatComposite/ChatScreen.tsx","../../../../react-composites/src/composites/ChatComposite/ChatComposite.tsx","../../../../react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.tsx","../../../../react-composites/src/composites/CallComposite/styles/CallScreen.styles.ts","../../../../react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.ts","../../../../react-composites/src/composites/CallComposite/hooks/useSelector.ts","../../../../react-composites/src/composites/CallComposite/hooks/useHandlers.ts","../../../../react-composites/src/composites/CallComposite/hooks/usePropsFor.ts","../../../../react-composites/src/composites/CallComposite/styles/MediaGallery.styles.ts","../../../../react-composites/src/composites/CallComposite/styles/ScreenShare.styles.ts","../../../../react-composites/src/composites/CallComposite/ScreenShare.tsx","../../../../react-composites/src/composites/CallComposite/selectors/baseSelectors.ts","../../../../react-composites/src/composites/CallComposite/MediaGallery.tsx","../../../../react-composites/src/utils/SDKUtils.ts","../../../../react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.ts","../../../../react-composites/src/composites/CallComposite/selectors/callStatusSelector.ts","../../../../react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.ts","../../../../react-composites/src/composites/CallComposite/styles/CallControls.styles.ts","../../../../react-composites/src/composites/CallComposite/CallControls.tsx","../../../../react-composites/src/composites/CallComposite/ComplianceBanner.tsx","../../../../react-composites/src/composites/CallComposite/selectors/lobbySelector.ts","../../../../react-composites/src/composites/CallComposite/LobbyControlBar.tsx","../../../../react-composites/src/composites/CallComposite/Lobby.tsx","../../../../react-composites/src/composites/common/styles/PermissionsBanner.styles.ts","../../../../react-composites/src/composites/common/PermissionsBanner.tsx","../../../../react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.ts","../../../../react-composites/src/composites/CallComposite/styles/ScreenSharePopup.styles.ts","../../../../react-composites/src/composites/CallComposite/ScreenSharePopup.tsx","../../../../react-composites/src/composites/CallComposite/CallScreen.tsx","../../../../react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.ts","../../../../react-composites/src/composites/CallComposite/LocalDeviceSettings.tsx","../../../../react-composites/src/composites/CallComposite/styles/StartCallButton.styles.ts","../../../../react-composites/src/composites/CallComposite/StartCallButton.tsx","../../../../react-composites/src/composites/CallComposite/styles/ConfigurationScreen.styles.tsx","../../../../react-composites/src/composites/CallComposite/selectors/localPreviewSelector.ts","../../../../react-composites/src/composites/CallComposite/styles/LocalPreview.styles.ts","../../../../react-composites/src/composites/CallComposite/LocalPreview.tsx","../../../../react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.ts","../../../../react-composites/src/composites/CallComposite/ConfigurationScreen.tsx","../../../../react-composites/src/composites/CallComposite/styles/Error.styles.ts","../../../../react-composites/src/composites/CallComposite/Error.tsx","../../../../react-composites/src/composites/CallComposite/Call.tsx","../../../../react-composites/src/composites/CallComposite/adapter/ParticipantSubcriber.ts","../../../../react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.ts","../../../../react-composites/src/composites/MeetingComposite/styles/SidePane.styles.ts","../../../../react-composites/src/composites/MeetingComposite/SidePane.tsx","../../../../react-composites/src/composites/MeetingComposite/ChatButton.tsx","../../../../react-composites/src/composites/MeetingComposite/PeopleButton.tsx","../../../../react-composites/src/composites/MeetingComposite/MeetingCallControlBar.tsx","../../../../react-composites/src/composites/MeetingComposite/styles/MeetingCompositeStyles.ts","../../../../react-composites/src/composites/MeetingComposite/MeetingComposite.tsx","../../../src/mergedHooks.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport type FunctionWithKey<KeyT, ArgsT extends unknown[], RetT> = (key: KeyT, ...args: ArgsT) => RetT;\nexport type CallbackType<KeyT, ArgsT extends unknown[], FnRetT> = (\n memoizedFn: FunctionWithKey<KeyT, ArgsT, FnRetT>\n) => FnRetT[];\n\nconst argsCmp = (args1: unknown[], args2: unknown[], objCmp: (obj1: unknown, obj2: unknown) => boolean): boolean => {\n return args1.length === args2.length && args1.every((arg1, index) => objCmp(args2[index], arg1));\n};\n\n/**\n * The function memoize a series of function calls in a single pass,\n * it memoizes all the args and return in a single run of the callback function, and read it in the next round of execution\n * note: this is a memory opimized function which will only memoize one round of bulk calls\n * @param fnToMemoize - the function needs to be bulk memorized and a key key paramter needs to be provided as cache id\n * @param shouldCacheUpdate - the validate function for comparing 2 argument, return true when 2 args are equal\n * @returns callback function includes a series calls of memoizedFn, and each call will get cache result if args are the same(according to shouldCacheUpdate fn)\n * @example\n * ```ts\n * const items = [{id:1, value:3}];\n * const heavyFn = (_key, value) => { // key is not used in the function, but it is a cache id\n * // assume this is a heavy caculation\n * return value+1;\n * }\n *\n * const memoizeHeavyFnAll = memoizeFnAll(heavyFn);\n * const generateValueArray = (memoizedHeavyFn) => (\n * items.map(item => {\n * memoizedHeavyFn(item.id, item.value);\n * })\n * );\n *\n * const result = memoizeHeavyFnAll(generateValueArray); // Cache: {}, nextCache: {1: 4 *new}, heavyFn call times: 1\n *\n * // Argument changed\n * items[0].value = 2\n * const result0 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 4}, nextCache: {1: 3 *new}, heavyFn call times: 1\n *\n * // Cache added\n * items.push({id:3, value:4});\n * const result1 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 3 *hit}, nextCache: {1: 3, 3: 5 *new}, heavyFn call times: 1\n *\n * // Cache removed\n * delete items[0];\n * const result2 = memoizeHeavyFnAll(generateValueArray); // Cache: {1: 3, 3: 5 *hit}, nextCache: {3: 5}, heavyFn call times: 0\n * ```\n */\nexport const memoizeFnAll = <\n KeyT,\n ArgsT extends unknown[],\n FnRetT,\n CallBackT extends CallbackType<KeyT, ArgsT, FnRetT>\n>(\n fnToMemoize: FunctionWithKey<KeyT, ArgsT, FnRetT>,\n shouldCacheUpdate: (args1: unknown, args2: unknown) => boolean = Object.is\n): ((callback: CallBackT) => FnRetT[]) => {\n let cache = new Map<KeyT, [ArgsT, FnRetT]>();\n let nextCache = new Map<KeyT, [ArgsT, FnRetT]>();\n\n return (callback: CallbackType<KeyT, ArgsT, FnRetT>): FnRetT[] => {\n const memoizedFn: FunctionWithKey<KeyT, ArgsT, FnRetT> = (key: KeyT, ...args: ArgsT): FnRetT => {\n const value = cache.get(key);\n if (value) {\n const [preArgs, ret] = value;\n if (argsCmp(preArgs, args, shouldCacheUpdate)) {\n nextCache.set(key, [args, ret]);\n return ret;\n }\n }\n const ret = fnToMemoize(key, ...args);\n nextCache.set(key, [args, ret]);\n return ret;\n };\n const retValue = callback(memoizedFn);\n cache = nextCache;\n nextCache = new Map<KeyT, [ArgsT, FnRetT]>();\n return retValue;\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CommunicationIdentifier,\n isCommunicationUserIdentifier,\n isMicrosoftTeamsUserIdentifier,\n isPhoneNumberIdentifier\n} from '@azure/communication-common';\n\n/**\n * A string representation of a CommunicationIdentifier.\n *\n * This string representation of CommunicationIdentifier is guaranteed to be stable for\n * a unique Communication user. Thus,\n * - it can be used to persist a user's identity in external databases.\n * - it can be used as keys into a Map to store data for the user.\n */\nexport const toFlatCommunicationIdentifier = (id: CommunicationIdentifier): string => {\n if (isCommunicationUserIdentifier(id)) {\n return id.communicationUserId;\n }\n if (isMicrosoftTeamsUserIdentifier(id)) {\n return id.microsoftTeamsUserId;\n }\n if (isPhoneNumberIdentifier(id)) {\n return id.phoneNumber;\n }\n return id.id;\n};\n\nexport const fromFlatCommunicationIdentifier = (id: string): CommunicationIdentifier => {\n // This implementation is currently a hack that only works with ACS identifiers.\n // TODO: Make `toFlatCommunicationIdentifier` not be lossy so this can reverse the process.\n return { communicationUserId: id };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.0.0-beta.5';\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as telemetryVersion from './telemetryVersion';\n\n// Removes long suffixes that don't fit the constraints for telemetry application ID.\n// e.g., the build suffix is dropped for alpha package versions.\nexport const sanitize = (version: string): string => {\n const alphaIndex = version.search(/alpha/);\n if (alphaIndex >= 0) {\n return version.substring(0, alphaIndex + 5);\n }\n return version;\n};\n\n/**\n * Application ID to be included in telemetry data from the UI library.\n */\nexport const getApplicationId = (): string => {\n const version = telemetryVersion['default'];\n return sanitize(`acr/${version}`);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { DominantSpeakersInfo } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallState,\n CallClientState,\n DeviceManagerState,\n IncomingCallState,\n RemoteParticipantState,\n LocalVideoStreamState,\n CallErrors,\n DiagnosticsCallFeatureState\n} from '@internal/calling-stateful-client';\n\n/**\n * Common props used to reference calling declarative client state.\n */\nexport type CallingBaseSelectorProps = {\n callId: string;\n};\n\nexport const getCalls = (state: CallClientState): { [key: string]: CallState } => state.calls;\n\nexport const getCallsEnded = (state: CallClientState): CallState[] => state.callsEnded;\n\nexport const getIncomingCalls = (state: CallClientState): { [key: string]: IncomingCallState } => state.incomingCalls;\n\nexport const getIncomingCallsEnded = (state: CallClientState): IncomingCallState[] => state.incomingCallsEnded;\n\nexport const getDeviceManager = (state: CallClientState): DeviceManagerState => state.deviceManager;\n\nexport const getCallExists = (state: CallClientState, props: CallingBaseSelectorProps): boolean =>\n !!state.calls[props.callId];\n\nexport const getDominantSpeakers = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): undefined | DominantSpeakersInfo => state.calls[props.callId]?.dominantSpeakers;\n\nexport const getRemoteParticipants = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n):\n | undefined\n | {\n [keys: string]: RemoteParticipantState;\n } => state.calls[props.callId]?.remoteParticipants;\n\nexport const getIsScreenSharingOn = (state: CallClientState, props: CallingBaseSelectorProps): boolean | undefined =>\n state.calls[props.callId]?.isScreenSharingOn;\n\nexport const getIsMuted = (state: CallClientState, props: CallingBaseSelectorProps): boolean | undefined =>\n state.calls[props.callId]?.isMuted;\n\nexport const getLocalVideoStreams = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): LocalVideoStreamState[] | undefined => state.calls[props.callId]?.localVideoStreams;\n\nexport const getScreenShareRemoteParticipant = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): string | undefined => state.calls[props.callId]?.screenShareRemoteParticipant;\n\nexport const getDisplayName = (state: CallClientState): string | undefined => state.callAgent?.displayName;\n\nexport const getIdentifier = (state: CallClientState): string => toFlatCommunicationIdentifier(state.userId);\n\nexport const getLatestErrors = (state: CallClientState): CallErrors => state.latestErrors;\n\nexport const getDiagnostics = (\n state: CallClientState,\n props: CallingBaseSelectorProps\n): DiagnosticsCallFeatureState | undefined => state.calls[props.callId]?.diagnostics;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport {\n getCallExists,\n getDeviceManager,\n getIsMuted,\n getIsScreenSharingOn,\n getLocalVideoStreams\n} from './baseSelectors';\n\nexport const microphoneButtonSelector = reselect.createSelector(\n [getCallExists, getIsMuted, getDeviceManager],\n (callExists, isMuted, deviceManager) => {\n const permission = deviceManager.deviceAccess ? deviceManager.deviceAccess.audio : true;\n return {\n disabled: !callExists || !permission,\n checked: callExists ? !isMuted : false\n };\n }\n);\n\nexport const cameraButtonSelector = reselect.createSelector(\n [getLocalVideoStreams, getDeviceManager],\n (localVideoStreams, deviceManager) => {\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\n // handle cases where 'Preview' view is in progress and not necessary completed.\n const previewOn = deviceManager.unparentedViews.length > 0 && deviceManager.unparentedViews[0].view !== undefined;\n const localVideoFromCall = localVideoStreams?.find((stream) => stream.mediaStreamType === 'Video');\n const permission = deviceManager.deviceAccess ? deviceManager.deviceAccess.video : true;\n\n return {\n disabled: !deviceManager.selectedCamera || !permission,\n checked: localVideoStreams !== undefined ? !!localVideoFromCall : previewOn\n };\n }\n);\n\nexport const screenShareButtonSelector = reselect.createSelector([getIsScreenSharingOn], (isScreenSharingOn) => {\n return {\n checked: isScreenSharingOn\n };\n});\n\nexport const optionsButtonSelector = reselect.createSelector([getDeviceManager], (deviceManager) => {\n return {\n microphones: deviceManager.microphones,\n speakers: deviceManager.speakers,\n cameras: deviceManager.cameras,\n selectedMicrophone: deviceManager.selectedMicrophone,\n selectedSpeaker: deviceManager.selectedSpeaker,\n selectedCamera: deviceManager.selectedCamera\n };\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AudioDeviceInfo,\n Call,\n CallAgent,\n LocalVideoStream,\n StartCallOptions,\n VideoDeviceInfo\n} from '@azure/communication-calling';\nimport { CommunicationUserIdentifier, PhoneNumberIdentifier, UnknownIdentifier } from '@azure/communication-common';\nimport { Common, fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { DeviceManagerState, StatefulCallClient, StatefulDeviceManager } from '@internal/calling-stateful-client';\nimport memoizeOne from 'memoize-one';\nimport { ReactElement } from 'react';\nimport { VideoStreamOptions } from '@internal/react-components';\n\nexport type CallingHandlers = {\n onStartLocalVideo: () => Promise<void>;\n onToggleCamera: (options?: VideoStreamOptions) => Promise<void>;\n onStartCall: (\n participants: (CommunicationUserIdentifier | PhoneNumberIdentifier | UnknownIdentifier)[],\n options?: StartCallOptions\n ) => Call | undefined;\n onSelectMicrophone: (device: AudioDeviceInfo) => Promise<void>;\n onSelectSpeaker: (device: AudioDeviceInfo) => Promise<void>;\n onSelectCamera: (device: VideoDeviceInfo, options?: VideoStreamOptions) => Promise<void>;\n onToggleMicrophone: () => Promise<void>;\n onStartScreenShare: () => Promise<void>;\n onStopScreenShare: () => Promise<void>;\n onToggleScreenShare: () => Promise<void>;\n onHangUp: () => Promise<void>;\n onCreateLocalStreamView: (options?: VideoStreamOptions) => Promise<void>;\n onCreateRemoteStreamView: (userId: string, options?: VideoStreamOptions) => Promise<void>;\n onParticipantRemove: (userId: string) => Promise<void>;\n onDisposeRemoteStreamView: (userId: string) => Promise<void>;\n onDisposeLocalStreamView: () => Promise<void>;\n};\n\nexport const areStreamsEqual = (prevStream: LocalVideoStream, newStream: LocalVideoStream): boolean => {\n return !!prevStream && !!newStream && prevStream.source.id === newStream.source.id;\n};\n\nexport const createDefaultCallingHandlers = memoizeOne(\n (\n callClient: StatefulCallClient,\n callAgent: CallAgent | undefined,\n deviceManager: StatefulDeviceManager | undefined,\n call: Call | undefined\n ) => {\n const onStartLocalVideo = async (): Promise<void> => {\n const callId = call?.id;\n let videoDeviceInfo = callClient.getState().deviceManager.selectedCamera;\n if (!videoDeviceInfo) {\n const cameras = await deviceManager?.getCameras();\n videoDeviceInfo = cameras && cameras.length > 0 ? cameras[0] : undefined;\n videoDeviceInfo && deviceManager?.selectCamera(videoDeviceInfo);\n }\n if (!callId || !videoDeviceInfo) return;\n const stream = new LocalVideoStream(videoDeviceInfo);\n if (call && !call.localVideoStreams.find((s) => areStreamsEqual(s, stream))) {\n await call.startVideo(stream);\n }\n };\n\n const onStopLocalVideo = async (stream: LocalVideoStream): Promise<void> => {\n const callId = call?.id;\n if (!callId) return;\n if (call && call.localVideoStreams.find((s) => areStreamsEqual(s, stream))) {\n await call.stopVideo(stream);\n await callClient.disposeView(callId, undefined, {\n source: stream.source,\n mediaStreamType: stream.mediaStreamType\n });\n }\n };\n\n const onToggleCamera = async (options?: VideoStreamOptions): Promise<void> => {\n if (call) {\n const stream = call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\n if (stream) {\n await onStopLocalVideo(stream);\n } else {\n await onStartLocalVideo();\n }\n } else {\n const selectedCamera = callClient.getState().deviceManager.selectedCamera;\n if (selectedCamera) {\n const previewOn = isPreviewOn(callClient.getState().deviceManager);\n if (previewOn) {\n // TODO: we need to remember which LocalVideoStream was used for LocalPreview and dispose that one. For now\n // assume any unparented view is a LocalPreview and stop all since those are only used for LocalPreview\n // currently.\n callClient.getState().deviceManager.unparentedViews.forEach(async (view) => {\n await callClient.disposeView(undefined, undefined, view);\n });\n } else {\n await callClient.createView(\n undefined,\n undefined,\n {\n source: selectedCamera,\n mediaStreamType: 'Video'\n },\n options\n );\n }\n }\n }\n };\n\n // FIXME: onStartCall API should use string, not the underlying SDK types.\n const onStartCall = (\n participants: (CommunicationUserIdentifier | PhoneNumberIdentifier | UnknownIdentifier)[],\n options?: StartCallOptions\n ): Call | undefined => {\n return callAgent ? callAgent.startCall(participants, options) : undefined;\n };\n\n const onSelectMicrophone = async (device: AudioDeviceInfo): Promise<void> => {\n if (!deviceManager) {\n return;\n }\n return deviceManager.selectMicrophone(device);\n };\n\n const onSelectSpeaker = async (device: AudioDeviceInfo): Promise<void> => {\n if (!deviceManager) {\n return;\n }\n return deviceManager.selectSpeaker(device);\n };\n\n const onSelectCamera = async (device: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void> => {\n if (!deviceManager) {\n return;\n }\n if (call) {\n deviceManager.selectCamera(device);\n const stream = call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\n return stream?.switchSource(device);\n } else {\n const previewOn = isPreviewOn(callClient.getState().deviceManager);\n\n if (!previewOn) {\n deviceManager.selectCamera(device);\n return;\n }\n\n onDisposeLocalStreamView();\n\n deviceManager.selectCamera(device);\n await callClient.createView(\n undefined,\n undefined,\n {\n source: device,\n mediaStreamType: 'Video'\n },\n options\n );\n }\n };\n\n const onToggleMicrophone = async (): Promise<void> => {\n if (!call) {\n throw new Error(`Please invoke onToggleMicrophone after call is started`);\n }\n return call.isMuted ? await call.unmute() : await call.mute();\n };\n\n const onStartScreenShare = async (): Promise<void> => await call?.startScreenSharing();\n\n const onStopScreenShare = async (): Promise<void> => await call?.stopScreenSharing();\n\n const onToggleScreenShare = async (): Promise<void> =>\n call?.isScreenSharingOn ? await onStopScreenShare() : await onStartScreenShare();\n\n const onHangUp = async (): Promise<void> => await call?.hangUp();\n\n const onCreateLocalStreamView = async (options?: VideoStreamOptions): Promise<void> => {\n if (!call || call.localVideoStreams.length === 0) {\n return;\n }\n\n const callState = callClient.getState().calls[call.id];\n if (!callState) {\n return;\n }\n\n const localStream = callState.localVideoStreams.find((item) => item.mediaStreamType === 'Video');\n if (!localStream) {\n return;\n }\n\n return callClient.createView(call.id, undefined, localStream, options);\n };\n\n const onCreateRemoteStreamView = async (\n userId: string,\n options = { scalingMode: 'Crop' } as VideoStreamOptions\n ): Promise<void> => {\n if (!call) return;\n const callState = callClient.getState().calls[call.id];\n if (!callState) throw new Error(`Call Not Found: ${call.id}`);\n\n const participant = Object.values(callState.remoteParticipants).find(\n (participant) => toFlatCommunicationIdentifier(participant.identifier) === userId\n );\n\n if (!participant || !participant.videoStreams) {\n return;\n }\n\n const remoteVideoStream = Object.values(participant.videoStreams).find((i) => i.mediaStreamType === 'Video');\n const screenShareStream = Object.values(participant.videoStreams).find(\n (i) => i.mediaStreamType === 'ScreenSharing'\n );\n\n if (remoteVideoStream && remoteVideoStream.isAvailable && !remoteVideoStream.view) {\n callClient.createView(call.id, participant.identifier, remoteVideoStream, options);\n }\n\n if (screenShareStream && screenShareStream.isAvailable && !screenShareStream.view) {\n // Hardcoded `scalingMode` since it is highly unlikely that CONTOSO would ever want to use a different scaling mode for screenshare.\n // Using `Crop` would crop the contents of screenshare and `Stretch` would warp it.\n // `Fit` is the only mode that maintains the integrity of the screen being shared.\n callClient.createView(call.id, participant.identifier, screenShareStream, { scalingMode: 'Fit' });\n }\n };\n\n const onDisposeRemoteStreamView = async (userId: string): Promise<void> => {\n if (!call) return;\n const callState = callClient.getState().calls[call.id];\n if (!callState) throw new Error(`Call Not Found: ${call.id}`);\n\n const participant = Object.values(callState.remoteParticipants).find(\n (participant) => toFlatCommunicationIdentifier(participant.identifier) === userId\n );\n\n if (!participant || !participant.videoStreams) {\n return;\n }\n\n const remoteVideoStream = Object.values(participant.videoStreams).find((i) => i.mediaStreamType === 'Video');\n const screenShareStream = Object.values(participant.videoStreams).find(\n (i) => i.mediaStreamType === 'ScreenSharing'\n );\n\n if (remoteVideoStream && remoteVideoStream.view) {\n callClient.disposeView(call.id, participant.identifier, remoteVideoStream);\n }\n\n if (screenShareStream && screenShareStream.view) {\n callClient.disposeView(call.id, participant.identifier, screenShareStream);\n }\n };\n\n const onDisposeLocalStreamView = async (): Promise<void> => {\n const selectedCamera = callClient.getState().deviceManager.selectedCamera;\n // If preview is on, then stop current preview and then start new preview with new device\n if (selectedCamera) {\n // TODO: we need to remember which LocalVideoStream was used for LocalPreview and dispose that one. For now\n // assume any unparented view is a LocalPreview and stop all since those are only used for LocalPreview\n // currently.\n callClient.getState().deviceManager.unparentedViews.forEach(async (view) => {\n await callClient.disposeView(undefined, undefined, view);\n });\n }\n };\n\n const onParticipantRemove = async (userId: string): Promise<void> => {\n await call?.removeParticipant(fromFlatCommunicationIdentifier(userId));\n };\n\n return {\n onHangUp,\n onSelectCamera,\n onSelectMicrophone,\n onSelectSpeaker,\n onStartCall,\n onStartScreenShare,\n onStopScreenShare,\n onToggleCamera,\n onToggleMicrophone,\n onToggleScreenShare,\n onCreateLocalStreamView,\n onCreateRemoteStreamView,\n onParticipantRemove,\n onStartLocalVideo,\n onDisposeRemoteStreamView,\n onDisposeLocalStreamView\n };\n }\n);\n\n// TODO: extract into an util.\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\n // handle cases where 'Preview' view is in progress and not necessary completed.\n return deviceManager.unparentedViews.length > 0 && deviceManager.unparentedViews[0].view !== undefined;\n};\n\n/**\n * Create a set of default handlers for given component. Memoization is applied to the result. Multiple invokations with\n * the same arguments will return the same handler instances. DeclarativeCallAgent, DeclarativeDeviceManager, and\n * DeclarativeCall may be undefined. If undefined, their associated handlers will not be created and returned.\n *\n * @param callClient - StatefulCallClient returned from\n * {@link @azure/communication-react#createStatefulCallClient}.\n * @param callAgent - Instance of {@link @azure/communication-calling#CallClient}.\n * @param deviceManager - Instance of {@link @azure/communication-calling#DeviceManager}.\n * @param call - Instance of {@link @azure/communication-calling#Call}.\n * @param _ - React component that you want to generate handlers for.\n * @returns\n */\nexport const createDefaultCallingHandlersForComponent = <Props>(\n callClient: StatefulCallClient,\n callAgent: CallAgent | undefined,\n deviceManager: StatefulDeviceManager | undefined,\n call: Call | undefined,\n _Component: (props: Props) => ReactElement | null\n): Common<CallingHandlers, Props> => {\n return createDefaultCallingHandlers(callClient, callAgent, deviceManager, call);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { RemoteParticipantState } from '@internal/calling-stateful-client';\nimport * as reselect from 'reselect';\nimport {\n getIdentifier,\n getDisplayName,\n getRemoteParticipants,\n getIsScreenSharingOn,\n getIsMuted\n} from './baseSelectors';\nimport { CallParticipant } from '@internal/react-components';\n\nconst convertRemoteParticipantsToCommunicationParticipants = (\n remoteParticipants: RemoteParticipantState[]\n): CallParticipant[] => {\n return remoteParticipants.map((participant: RemoteParticipantState) => {\n const isScreenSharing = Object.values(participant.videoStreams).some(\n (videoStream) => videoStream.mediaStreamType === 'ScreenSharing' && videoStream.isAvailable\n );\n\n return {\n userId: toFlatCommunicationIdentifier(participant.identifier),\n displayName: participant.displayName,\n state: participant.state,\n isMuted: participant.isMuted,\n isScreenSharing: isScreenSharing,\n isSpeaking: participant.isSpeaking\n };\n });\n};\n\nexport const participantListSelector = reselect.createSelector(\n [getIdentifier, getDisplayName, getRemoteParticipants, getIsScreenSharingOn, getIsMuted],\n (\n userId,\n displayName,\n remoteParticipants,\n isScreenSharingOn,\n isMuted\n ): {\n participants: CallParticipant[];\n myUserId: string;\n } => {\n const participants = remoteParticipants\n ? convertRemoteParticipantsToCommunicationParticipants(Object.values(remoteParticipants))\n : [];\n participants.push({\n userId: userId,\n displayName: displayName,\n isScreenSharing: isScreenSharingOn,\n isMuted: isMuted,\n state: 'Connected'\n });\n return {\n participants: participants,\n myUserId: userId\n };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport { CallParticipant } from '@internal/react-components';\nimport { participantListSelector } from './participantListSelector';\n\nexport const participantsButtonSelector = reselect.createSelector(\n [participantListSelector],\n (\n participantListProps\n ): {\n participants: CallParticipant[];\n myUserId: string;\n } => {\n return participantListProps;\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DominantSpeakersInfo } from '@azure/communication-calling';\nimport { memoizeFnAll, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { RemoteParticipantState, RemoteVideoStreamState } from '@internal/calling-stateful-client';\nimport { VideoGalleryRemoteParticipant, VideoGalleryStream } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport {\n getDisplayName,\n getDominantSpeakers,\n getIdentifier,\n getIsMuted,\n getIsScreenSharingOn,\n getLocalVideoStreams,\n getRemoteParticipants,\n getScreenShareRemoteParticipant\n} from './baseSelectors';\n\nconst convertRemoteVideoStreamToVideoGalleryStream = (stream: RemoteVideoStreamState): VideoGalleryStream => {\n return {\n id: stream.id,\n isAvailable: stream.isAvailable,\n isMirrored: stream.view?.isMirrored,\n renderElement: stream.view?.target\n };\n};\n\nconst convertRemoteParticipantToVideoGalleryRemoteParticipant = (\n userId: string,\n isMuted: boolean,\n isSpeaking: boolean,\n videoStreams: { [key: number]: RemoteVideoStreamState },\n displayName?: string\n): VideoGalleryRemoteParticipant => {\n const rawVideoStreamsArray = Object.values(videoStreams);\n let videoStream: VideoGalleryStream | undefined = undefined;\n let screenShareStream: VideoGalleryStream | undefined = undefined;\n\n if (rawVideoStreamsArray[0]) {\n if (rawVideoStreamsArray[0].mediaStreamType === 'Video') {\n videoStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[0]);\n } else {\n screenShareStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[0]);\n }\n }\n\n if (rawVideoStreamsArray[1]) {\n if (rawVideoStreamsArray[1].mediaStreamType === 'ScreenSharing') {\n screenShareStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[1]);\n } else {\n videoStream = convertRemoteVideoStreamToVideoGalleryStream(rawVideoStreamsArray[1]);\n }\n }\n\n return {\n userId,\n displayName,\n isMuted,\n isSpeaking,\n videoStream,\n screenShareStream,\n isScreenSharingOn: screenShareStream !== undefined && screenShareStream.isAvailable\n };\n};\n\nconst memoizedAllConvertRemoteParticipant = memoizeFnAll(\n (\n userId: string,\n isMuted: boolean,\n isSpeaking: boolean,\n videoStreams: { [key: number]: RemoteVideoStreamState },\n displayName?: string\n ): VideoGalleryRemoteParticipant => {\n return convertRemoteParticipantToVideoGalleryRemoteParticipant(\n userId,\n isMuted,\n isSpeaking,\n videoStreams,\n displayName\n );\n }\n);\n\nconst videoGalleryRemoteParticipantsMemo = (\n remoteParticipants:\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined\n): VideoGalleryRemoteParticipant[] => {\n if (!remoteParticipants) return [];\n return memoizedAllConvertRemoteParticipant((memoizedFn) => {\n return Object.values(remoteParticipants).map((participant: RemoteParticipantState) => {\n return memoizedFn(\n toFlatCommunicationIdentifier(participant.identifier),\n participant.isMuted,\n participant.isSpeaking,\n participant.videoStreams,\n participant.displayName\n );\n });\n });\n};\n\nconst dominantSpeakersWithFlatId = (dominantSpeakers?: DominantSpeakersInfo): undefined | string[] => {\n return dominantSpeakers?.speakersList.map(toFlatCommunicationIdentifier);\n};\n\n/**\n * Sorts remote participants on the basis of their video status (on/off) and dominant speaker rank.\n * 1. Video participants should always render before non-video participants.\n * 2. Video Tiles should be further sorted based on their ordering in dominant speakers list.\n */\nconst sortedRemoteParticipants = (\n participants?: VideoGalleryRemoteParticipant[],\n dominantSpeakers?: string[]\n): VideoGalleryRemoteParticipant[] => {\n if (!participants) return [];\n\n const participantsWithVideo: VideoGalleryRemoteParticipant[] = [];\n const participantsWithoutVideo: VideoGalleryRemoteParticipant[] = [];\n\n participants.forEach((p) => {\n if (p.videoStream?.renderElement?.childElementCount) {\n participantsWithVideo.push(p);\n } else {\n participantsWithoutVideo.push(p);\n }\n });\n\n const speakersList: Record<string, number> = {};\n dominantSpeakers?.forEach((speaker, idx) => (speakersList[speaker] = idx));\n\n // If dominantSpeakers are available, we sort the video tiles basis on dominant speakers.\n if (dominantSpeakers) {\n participantsWithVideo.sort((a, b) => {\n const idxA = speakersList[a.userId];\n const idxB = speakersList[b.userId];\n if (idxA === undefined && idxB === undefined) return 0; // Both a and b don't exist in dominant speakers.\n if (idxA === undefined && idxB >= 0) return 1; // b exists in dominant speakers.\n if (idxB === undefined && idxA >= 0) return -1; // a exists in dominant speakers.\n return idxA - idxB;\n });\n\n participantsWithoutVideo.sort((a, b) => {\n const idxA = speakersList[a.userId];\n const idxB = speakersList[b.userId];\n if (idxA === undefined && idxB === undefined) return 0; // Both a and b don't exist in dominant speakers.\n if (idxA === undefined && idxB >= 0) return 1; // b exists in dominant speakers.\n if (idxB === undefined && idxA >= 0) return -1; // a exists in dominant speakers.\n return idxA - idxB;\n });\n }\n\n return participantsWithVideo.concat(participantsWithoutVideo);\n};\n\nexport const videoGallerySelector = createSelector(\n [\n getScreenShareRemoteParticipant,\n getRemoteParticipants,\n getLocalVideoStreams,\n getIsMuted,\n getIsScreenSharingOn,\n getDisplayName,\n getIdentifier,\n getDominantSpeakers\n ],\n (\n screenShareRemoteParticipantId,\n remoteParticipants,\n localVideoStreams,\n isMuted,\n isScreenSharingOn,\n displayName: string | undefined,\n identifier: string,\n dominantSpeakers\n ) => {\n const screenShareRemoteParticipant =\n screenShareRemoteParticipantId && remoteParticipants\n ? remoteParticipants[screenShareRemoteParticipantId]\n : undefined;\n const localVideoStream = localVideoStreams?.find((i) => i.mediaStreamType === 'Video');\n return {\n screenShareParticipant: screenShareRemoteParticipant\n ? convertRemoteParticipantToVideoGalleryRemoteParticipant(\n toFlatCommunicationIdentifier(screenShareRemoteParticipant.identifier),\n screenShareRemoteParticipant.isMuted,\n screenShareRemoteParticipant.isSpeaking,\n screenShareRemoteParticipant.videoStreams,\n screenShareRemoteParticipant.displayName\n )\n : undefined,\n localParticipant: {\n userId: identifier,\n displayName: displayName ?? '',\n isMuted: isMuted,\n isScreenSharingOn: isScreenSharingOn,\n videoStream: {\n isAvailable: !!localVideoStream,\n isMirrored: localVideoStream?.view?.isMirrored,\n renderElement: localVideoStream?.view?.target\n }\n },\n remoteParticipants: sortedRemoteParticipants(\n videoGalleryRemoteParticipantsMemo(remoteParticipants),\n dominantSpeakersWithFlatId(dominantSpeakers)\n )\n };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getDiagnostics, getLatestErrors } from './baseSelectors';\nimport { ActiveError, ErrorType } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { CallErrors, CallErrorTarget } from '@internal/calling-stateful-client';\n\n/**\n * Select the first 3 active errors from the state for the `ErrorBar` component.\n *\n * In case there are many errors, only the first three errors are returned to avoid\n * filling up the UI with too many errors.\n *\n * Invariants:\n * - `ErrorType` is never repeated in the returned errors.\n * - Errors are returned in a fixed order by `ErrorType`.\n */\nexport const errorBarSelector = createSelector(\n [getLatestErrors, getDiagnostics],\n (latestErrors: CallErrors, diagnostics): { activeErrors: ActiveError[] } => {\n // The order in which the errors are returned is significant: The `ErrorBar` shows errors on the UI in that order.\n // There are several options for the ordering:\n // - Sorted by when the errors happened (latest first / oldest first).\n // - Stable sort by error type.\n //\n // We chose to stable sort by error type: We intend to show only a small number of errors on the UI and we do not\n // have timestamps for errors.\n const activeErrors: ActiveError[] = [];\n\n // Errors reported via diagnostics are more reliable than from API method failures, so process those first.\n if (diagnostics?.network.latest.networkReconnect?.value === 3) {\n activeErrors.push({ type: 'callingNetworkFailure' });\n }\n\n // Prefer to show errors with privacy implications.\n appendActiveErrorIfDefined(activeErrors, latestErrors, 'Call.stopVideo', 'stopVideoGeneric');\n appendActiveErrorIfDefined(activeErrors, latestErrors, 'Call.mute', 'muteGeneric');\n appendActiveErrorIfDefined(activeErrors, latestErrors, 'Call.stopScreenSharing', 'stopScreenShareGeneric');\n\n appendActiveErrorIfDefined(activeErrors, latestErrors, 'Call.startVideo', 'startVideoGeneric');\n appendActiveErrorIfDefined(activeErrors, latestErrors, 'Call.unmute', 'unmuteGeneric');\n\n // We only return the first few errors to avoid filling up the UI with too many `MessageBar`s.\n activeErrors.splice(maxErrorCount);\n return { activeErrors: activeErrors };\n }\n);\n\nconst appendActiveErrorIfDefined = (\n activeErrors: ActiveError[],\n latestErrors: CallErrors,\n target: CallErrorTarget,\n activeErrorType: ErrorType\n): void => {\n if (latestErrors[target] === undefined) {\n return;\n }\n activeErrors.push({\n type: activeErrorType,\n timestamp: latestErrors[target].timestamp\n });\n};\n\nconst maxErrorCount = 3;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallAgent } from '@azure/communication-calling';\nimport React, { createContext, useContext } from 'react';\n\nexport type CallAgentContextType = {\n callAgent: CallAgent | undefined;\n};\n\nexport const CallAgentContext = createContext<CallAgentContextType | undefined>(undefined);\n\nexport interface CallAgentProviderProps {\n children: React.ReactNode;\n callAgent?: CallAgent;\n}\n\nconst CallAgentProviderBase = (props: CallAgentProviderProps): JSX.Element => {\n const { callAgent } = props;\n\n const initialState: CallAgentContextType = {\n callAgent\n };\n\n return <CallAgentContext.Provider value={initialState}>{props.children}</CallAgentContext.Provider>;\n};\n\nexport const CallAgentProvider = (props: CallAgentProviderProps): JSX.Element => <CallAgentProviderBase {...props} />;\n\nexport const useCallAgent = (): CallAgent | undefined => useContext(CallAgentContext)?.callAgent;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { StatefulCallClient, StatefulDeviceManager } from '@internal/calling-stateful-client';\nimport React, { createContext, useContext, useEffect, useState } from 'react';\n\nexport type CallClientContextType = {\n callClient: StatefulCallClient;\n deviceManager: StatefulDeviceManager | undefined;\n};\n\nexport const CallClientContext = createContext<CallClientContextType | undefined>(undefined);\n\nexport interface CallClientProviderProps {\n children: React.ReactNode;\n callClient: StatefulCallClient;\n}\n\nconst CallClientProviderBase = (props: CallClientProviderProps): JSX.Element => {\n const { callClient } = props;\n\n const [deviceManager, setDeviceManager] = useState<StatefulDeviceManager | undefined>(undefined);\n\n /**\n * Initialize the DeviceManager inside CallClientState\n */\n useEffect(() => {\n callClient\n .getDeviceManager()\n .then((manager) => {\n manager.getCameras();\n manager.getMicrophones();\n manager.getSpeakers();\n setDeviceManager(manager as StatefulDeviceManager);\n })\n .catch((error) => {\n throw new Error(error);\n });\n }, [callClient]);\n\n const initialState: CallClientContextType = {\n callClient,\n deviceManager\n };\n\n return <CallClientContext.Provider value={initialState}>{props.children}</CallClientContext.Provider>;\n};\n\nexport const CallClientProvider = (props: CallClientProviderProps): JSX.Element => (\n <CallClientProviderBase {...props} />\n);\n\nexport const useCallClient = (): StatefulCallClient => {\n const context = useContext(CallClientContext);\n if (context === undefined) {\n throw new Error('CallClient Context is undefined');\n }\n return context.callClient;\n};\n\nexport const useDeviceManager = (): StatefulDeviceManager | undefined => {\n return useContext(CallClientContext)?.deviceManager;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useContext, createContext } from 'react';\nimport { Call } from '@azure/communication-calling';\n\nexport type CallContextType = {\n call: Call | undefined;\n};\n\nexport interface CallProviderProps {\n children: React.ReactNode;\n call?: Call;\n}\n\nexport const CallContext = createContext<CallContextType | undefined>(undefined);\n\nconst CallProviderBase = (props: CallProviderProps): JSX.Element => {\n const { children, call } = props;\n\n const initialState: CallContextType = {\n call\n };\n\n return <CallContext.Provider value={initialState}>{children}</CallContext.Provider>;\n};\n\nexport const CallProvider = (props: CallProviderProps): JSX.Element => <CallProviderBase {...props} />;\n\nexport const useCall = (): Call | undefined => {\n return useContext(CallContext)?.call;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const typingIndicatorContainerStyle = mergeStyles({\n height: '2.125rem'\n});\n\nexport const typingIndicatorStringStyle = mergeStyles({\n fontWeight: 400,\n whiteSpace: 'pre',\n display: 'flex',\n alignItems: 'center'\n});\n\nexport const typingIndicatorPrefixImageStyle = mergeStyles({\n width: '2.125rem',\n height: '2.125rem',\n paddingRight: '0.1875rem'\n});\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { PartialDeep } from 'type-fest';\r\nimport { ComponentLocale, ComponentStrings } from '..';\r\nimport en_US from './en-US/strings.json';\r\nimport en_GB from './en-GB/strings.json';\r\nimport de_DE from './de-DE/strings.json';\r\nimport es_ES from './es-ES/strings.json';\r\nimport fr_FR from './fr-FR/strings.json';\r\nimport it_IT from './it-IT/strings.json';\r\nimport ja_JP from './ja-JP/strings.json';\r\nimport ko_KR from './ko-KR/strings.json';\r\nimport nl_NL from './nl-NL/strings.json';\r\nimport pt_BR from './pt-BR/strings.json';\r\nimport ru_RU from './ru-RU/strings.json';\r\nimport tr_TR from './tr-TR/strings.json';\r\nimport zh_CN from './zh-CN/strings.json';\r\nimport zh_TW from './zh-TW/strings.json';\r\n\r\nconst createComponentStrings = (localizedStrings: PartialDeep<ComponentStrings>): ComponentStrings => {\r\n const strings: ComponentStrings = { ...en_US };\r\n Object.keys(localizedStrings).forEach((key: string) => {\r\n strings[key] = { ...strings[key], ...localizedStrings[key] };\r\n });\r\n return strings;\r\n};\r\n\r\n/** Locale for English (US) */\r\nexport const COMPONENT_LOCALE_EN_US: ComponentLocale = { strings: en_US };\r\n/** Locale for English (US) */\r\nexport const COMPONENT_LOCALE_EN_GB: ComponentLocale = { strings: createComponentStrings(en_GB) };\r\n/** Locale for German (Germany) */\r\nexport const COMPONENT_LOCALE_DE_DE: ComponentLocale = { strings: createComponentStrings(de_DE) };\r\n/** Locale for Spanish (Spain) */\r\nexport const COMPONENT_LOCALE_ES_ES: ComponentLocale = { strings: createComponentStrings(es_ES) };\r\n/** Locale for French (France) */\r\nexport const COMPONENT_LOCALE_FR_FR: ComponentLocale = { strings: createComponentStrings(fr_FR) };\r\n/** Locale for Italian (Italy) */\r\nexport const COMPONENT_LOCALE_IT_IT: ComponentLocale = { strings: createComponentStrings(it_IT) };\r\n/** Locale for Japanese (Japan) */\r\nexport const COMPONENT_LOCALE_JA_JP: ComponentLocale = { strings: createComponentStrings(ja_JP) };\r\n/** Locale for Korean (South Korea) */\r\nexport const COMPONENT_LOCALE_KO_KR: ComponentLocale = { strings: createComponentStrings(ko_KR) };\r\n/** Locale for Dutch (Netherlands) */\r\nexport const COMPONENT_LOCALE_NL_NL: ComponentLocale = { strings: createComponentStrings(nl_NL) };\r\n/** Locale for Portuguese (Brazil) */\r\nexport const COMPONENT_LOCALE_PT_BR: ComponentLocale = { strings: createComponentStrings(pt_BR) };\r\n/** Locale for Russian (Russia) */\r\nexport const COMPONENT_LOCALE_RU_RU: ComponentLocale = { strings: createComponentStrings(ru_RU) };\r\n/** Locale for Turkish (Turkey) */\r\nexport const COMPONENT_LOCALE_TR_TR: ComponentLocale = { strings: createComponentStrings(tr_TR) };\r\n/** Locale for Chinese (Mainland China) */\r\nexport const COMPONENT_LOCALE_ZH_CN: ComponentLocale = { strings: createComponentStrings(zh_CN) };\r\n/** Locale for Chinese (Taiwan) */\r\nexport const COMPONENT_LOCALE_ZH_TW: ComponentLocale = { strings: createComponentStrings(zh_TW) };\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport {\n CameraButtonStrings,\n EndCallButtonStrings,\n ErrorBarStrings,\n MessageStatusIndicatorStrings,\n MessageThreadStrings,\n MicrophoneButtonStrings,\n OptionsButtonStrings,\n ParticipantsButtonStrings,\n ParticipantItemStrings,\n ScreenShareButtonStrings,\n SendBoxStrings,\n TypingIndicatorStrings\n} from '../components';\nimport { COMPONENT_LOCALE_EN_US } from './locales';\n\n/**\n * Data structure for localization\n */\nexport interface ComponentLocale {\n /** Strings for components */\n strings: ComponentStrings;\n}\n\n/**\n * Strings for components\n */\nexport interface ComponentStrings {\n /** Strings for MessageThread */\n messageThread: MessageThreadStrings;\n /** Strings for ParticipantItem */\n participantItem: ParticipantItemStrings;\n /** Strings for CameraButton */\n cameraButton: CameraButtonStrings;\n /** Strings for MicrophoneButton */\n microphoneButton: MicrophoneButtonStrings;\n /** Strings for EndCallButton */\n endCallButton: EndCallButtonStrings;\n /** Strings for OptionsButton */\n optionsButton: OptionsButtonStrings;\n /** Strings for ParticipantsButton */\n participantsButton: ParticipantsButtonStrings;\n /** Strings for OptionsButton */\n screenShareButton: ScreenShareButtonStrings;\n /** Strings for TypingIndicator */\n typingIndicator: TypingIndicatorStrings;\n /** Strings for SendBox */\n sendBox: SendBoxStrings;\n /** Strings for MessageStatusIndicator */\n messageStatusIndicator: MessageStatusIndicatorStrings;\n /** Strings for ErroBar */\n errorBar: ErrorBarStrings;\n}\n\n/**\n * Context for providing localized strings to components\n */\nexport const LocaleContext = createContext<ComponentLocale>(COMPONENT_LOCALE_EN_US);\n\n/**\n * Props to LocalizationProvider\n */\nexport type LocalizationProviderProps = {\n /** Locale context to provide components */\n locale: ComponentLocale;\n /** Children to provide locale context. */\n children: React.ReactNode;\n};\n\n/**\n * @description Provider to provide localized strings for this library's react components.\n * @remarks Components will be provided localized strings in English (US) by default if this\n * provider is not used\n */\nexport const LocalizationProvider = (props: LocalizationProviderProps): JSX.Element => {\n const { locale, children } = props;\n return <LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>;\n};\n\n/** React hook to access locale */\nexport const useLocale = (): ComponentLocale => useContext(LocaleContext);\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport React from 'react';\r\n\r\nexport interface IObjectMap<T> {\r\n [key: string]: T;\r\n}\r\n\r\n/**\r\n * Create an array of span elements by replacing the pattern \"{}\" in str with the elements\r\n * passed in as vars and creating span elements fromt he rest\r\n * eg: formatElements(\"hello {name}. '{name}' is a rare name.\", {name: <Persona text=\"Foo\"/>})\r\n * returns [<span>hello </span>, <span><Persona text=\"Foo\"/></span>, <span>. <span>, <span><Persona text=\"Foo\"/></span>, <span> is a rare name.</span>]\"\r\n * @param {string} str The string to be formatted\r\n * @param {Object} vars Variables to use to format the string\r\n * @returns {JSX.Element} formatted elements\r\n */\r\nexport const formatSpanElements = (str: string, vars: IObjectMap<JSX.Element>): JSX.Element[] => {\r\n if (!str) {\r\n return [];\r\n }\r\n if (!vars) {\r\n return [];\r\n }\r\n\r\n const elements: JSX.Element[] = [];\r\n\r\n // regex to search for the pattern \"{}\"\r\n const placeholdersRegex = /{(\\w+)}/g;\r\n const regex = RegExp(placeholdersRegex);\r\n let array: RegExpExecArray | null = regex.exec(str);\r\n let prev = 0;\r\n let elementKey = 1;\r\n while (array !== null) {\r\n if (prev !== array.index) {\r\n elements.push(<span key={elementKey++}>{str.substring(prev, array.index)}</span>);\r\n }\r\n elements.push(<span key={elementKey++}>{vars[array[0].substring(1, array[0].length - 1)]}</span>);\r\n prev = regex.lastIndex;\r\n array = regex.exec(str);\r\n }\r\n elements.push(<span key={elementKey++}>{str.substring(prev)}</span>);\r\n return elements;\r\n};\r\n\r\n/**\r\n * Replace the pattern \"{}\" in str with the values passed in as vars\r\n * eg: formatString(\"hello {name}. '{name}' is a rare name.\", {name: \"Foo\"})\r\n * return \"hello Foo. 'Foo' is a rare name.\"\r\n * @param {string} str The string to be formatted\r\n * @param {Object} variables Variables to use to format the string\r\n * @returns {string} formatted string\r\n */\r\nexport const formatString = (str: string, vars: IObjectMap<string>): string => {\r\n if (!str) {\r\n return '';\r\n }\r\n if (!vars) {\r\n return str;\r\n }\r\n\r\n // regex to search for the pattern \"{}\"\r\n const placeholdersRegex = /{(\\w+)}/g;\r\n return str.replace(placeholdersRegex, (_: string, k: string) => vars[k] || `{${k}}`);\r\n};\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\n\n/**\n * Identifiers that can be used to target specific components in a composite.\n *\n * @experimental\n *\n * These identifiers are assigned as `data-ui-id` HTML attribute of the root element of the targeted component.\n *\n * This API is intended for end to end test automation. As such, they are not covered by the API\n * guarantee of the public API. This will remain perenially experimental and compatibility breaking changes\n * may be made at any point.\n *\n */\nexport interface Identifiers {\n /** `data-ui-id` value for `SendBox` Component */\n sendboxTextfield: string;\n /** `data-ui-id` value for `ParticipantList` Component */\n participantList: string;\n /** `data-ui-id` value for `MessageThread` components message content */\n messageContent: string;\n /** `data-ui-id` value for `MessageThread` components message timestamp */\n messageTimestamp: string;\n /** `data-ui-id` value for `TypingIndicator` Component */\n typingIndicator: string;\n /** `data-ui-id` value for `VideoGallery` Component */\n videoGallery: string;\n /** `data-ui-id` value for `VideoTile` Component */\n videoTile: string;\n}\n\nconst defaultIdentifiers: Identifiers = {\n sendboxTextfield: 'sendbox-textfield',\n participantList: 'participant-list',\n messageContent: 'message-content',\n messageTimestamp: 'message-timestamp',\n typingIndicator: 'typing-indicator',\n videoGallery: 'video-gallery',\n videoTile: 'video-tile'\n};\n\nexport const IdentifierContext = createContext<Identifiers>(defaultIdentifiers);\n\n/**\n * Arguments to Context Provider for {@link Identifiers}.\n *\n * @experimental\n *\n * See documentation for {@link Identifiers}.\n *\n */\nexport interface IdentifierProviderProps {\n identifiers?: Identifiers;\n children: React.ReactNode;\n}\n\n/**\n * React Context provider for {@link Identifiers}.\n *\n * @experimental\n *\n * See documentation for {@link Identifiers}.\n */\nexport const IdentifierProvider = (props: IdentifierProviderProps): JSX.Element => {\n const { identifiers, children } = props;\n return <IdentifierContext.Provider value={identifiers ?? defaultIdentifiers}>{children}</IdentifierContext.Provider>;\n};\n\nexport const useIdentifiers = (): Identifiers => useContext(IdentifierContext);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { typingIndicatorContainerStyle, typingIndicatorStringStyle } from './styles/TypingIndicator.styles';\n\nimport React from 'react';\nimport { BaseCustomStylesProps, CommunicationParticipant } from '../types';\nimport { IStyle, mergeStyles, Stack } from '@fluentui/react';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport { formatSpanElements } from '../localization/localizationUtils';\nimport { useIdentifiers } from '../identifiers';\n\nexport interface TypingIndicatorStylesProps extends BaseCustomStylesProps {\n /** Styles for each typing user's displayName. */\n typingUserDisplayName?: IStyle;\n /** Styles for the typing string. */\n typingString?: IStyle;\n}\n\n/**\n * Strings of TypingIndicator that can be overridden\n */\nexport interface TypingIndicatorStrings {\n /**\n * String template to use when one user is typing. Placeholders: [user].\n * @example\n * ```\n * <TypingIndicator\n * strings={{ multipleUsersAbbreviateOne: '{users} is typing...' }}\n * typingUsers={[{ userId: 'user1', displayName: 'Claire' }]}\n * />\n * ```\n * would be 'Claire is typing...'\n **/\n singleUser: string;\n /**\n * String template to use when multiple users are typing. Placeholders: [users].\n * @example\n * ```\n * <TypingIndicator\n * strings={{ multipleUsers: '{users} are typing...' }}\n * typingUsers={[\n * { userId: 'user1', displayName: 'Claire' },\n * { userId: 'user2', displayName: 'Chris' }\n * ]}\n * />\n * ```\n * would be 'Claire, Chris are typing...'\n **/\n multipleUsers: string;\n /**\n * String template to use when multiple users are typing with one other user abbreviated. Placeholders: [users].\n * @example\n * ```typescript\n * <TypingIndicator\n * strings={{ multipleUsersAbbreviateOne: '{users} and 1 other are typing...' }}\n * typingUsers={[\n * { userId: 'user1', displayName: 'Claire Romanov' },\n * { userId: 'user2', displayName: 'Chris Rutherford' }\n * ]}\n * />\n * ```\n * would be 'Claire Romanov and 1 other are typing...'\n **/\n multipleUsersAbbreviateOne: string;\n /**\n * String template to use when multiple users are typing with one other user abbreviated. Placeholders: [users, numOthers].\n * @example\n * ```\n * <TypingIndicator\n * strings={{ multipleUsersAbbreviateMany: '{users} and {numOthers} others are typing...' }}\n * typingUsers={[\n * { userId: 'user1', displayName: 'Claire Romanov' },\n * { userId: 'user2', displayName: 'Chris Rutherford' },\n * { userId: 'user3', displayName: 'Jill Vernblom' }\n * ]}\n * />\n * ```\n * would be 'Claire Romanov and 2 others are typing...'\n **/\n multipleUsersAbbreviateMany: string;\n /**\n * String to use as delimiter to separate multiple users.\n * @example\n * ```\n * <TypingIndicator\n * strings={{ delimiter: ' + ' }}\n * typingUsers={[\n * { userId: 'user1', displayName: 'Claire' },\n * { userId: 'user2', displayName: 'Chris' },\n * { userId: 'user3', displayName: 'Jill' }\n * ]}\n * />\n * ```\n * would be 'Claire + Chris + Jill are typing...'\n **/\n delimiter: string;\n}\n\n/**\n * Props for TypingIndicator component\n */\nexport interface TypingIndicatorProps {\n /** List of the typing users. */\n typingUsers: CommunicationParticipant[];\n /** Callback to render typing users */\n onRenderUser?: (users: CommunicationParticipant) => JSX.Element;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <TypingIndicator styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: TypingIndicatorStylesProps;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<TypingIndicatorStrings>;\n}\n\nconst MAXIMUM_LENGTH_OF_TYPING_USERS = 35;\n\n/**\n * Helper function to create element wrapping all typing users\n * @param typingUsers typing users\n * @param delimiter string to separate typing users\n * @param onRenderUser optional callback to render each typing user\n * @param styles optional additional IStyle to apply to element containing all users\n * @returns element wrapping all typing users\n */\nconst getUsersElement = (\n typingUsers: CommunicationParticipant[],\n delimiter: string,\n onRenderUser?: (users: CommunicationParticipant) => JSX.Element,\n styles?: IStyle\n): JSX.Element => {\n const userElements: JSX.Element[] = [];\n typingUsers.forEach((user, index) => {\n userElements.push(onRenderUser ? onRenderUser(user) : <span key={`user-${index}`}>{user.displayName}</span>);\n userElements.push(<span key={`comma-${index}`}>{`${delimiter}`}</span>);\n });\n // pop last comma\n userElements.pop();\n return (\n <Stack horizontal className={mergeStyles(typingIndicatorStringStyle, styles)}>\n {userElements}\n </Stack>\n );\n};\n\n/**\n * Helper function to create span elements making up the typing indicator string\n * @param strings TypingIndicatorStrings containing strings to create span elements\n * @param usersElement JSX.Element containing all typing users\n * @param numTypingUsers number of total typing users\n * @param numUserNotMentioned number of typing users abbreviated\n * @returns array of span elements making up the typing indicator string\n */\nconst getSpanElements = (\n strings: TypingIndicatorStrings,\n usersElement: JSX.Element,\n numTypingUsers: number,\n numTypingUsersAbbreviated: number\n): JSX.Element[] => {\n let variables: Record<string, JSX.Element> = {};\n let typingString = '';\n if (numTypingUsers === 1) {\n typingString = strings.singleUser;\n variables = {\n user: usersElement\n };\n } else if (numTypingUsers > 1 && numTypingUsersAbbreviated === 0) {\n typingString = strings.multipleUsers;\n variables = {\n users: usersElement\n };\n } else if (numTypingUsers > 1 && numTypingUsersAbbreviated === 1) {\n typingString = strings.multipleUsersAbbreviateOne;\n variables = {\n users: usersElement\n };\n } else if (numTypingUsers > 1 && numTypingUsersAbbreviated > 1) {\n typingString = strings.multipleUsersAbbreviateMany;\n variables = {\n users: usersElement,\n numOthers: <>{numTypingUsersAbbreviated}</>\n };\n }\n\n return formatSpanElements(typingString, variables);\n};\n\nconst IndicatorComponent = (\n typingUsers: CommunicationParticipant[],\n strings: TypingIndicatorStrings,\n onRenderUser?: (users: CommunicationParticipant) => JSX.Element,\n styles?: TypingIndicatorStylesProps\n): JSX.Element => {\n const typingUsersMentioned: CommunicationParticipant[] = [];\n let totalCharacterCount = 0;\n const ids = useIdentifiers();\n\n for (const typingUser of typingUsers) {\n if (!typingUser.displayName) {\n continue;\n }\n\n let additionalCharCount = typingUser.displayName.length;\n // The typing users will be separated by the delimiter. We account for that additional length when we generate the final string.\n if (typingUsersMentioned.length > 0) {\n additionalCharCount += strings.delimiter.length;\n }\n\n if (\n totalCharacterCount + additionalCharCount <= MAXIMUM_LENGTH_OF_TYPING_USERS ||\n typingUsersMentioned.length === 0\n ) {\n typingUsersMentioned.push(typingUser);\n totalCharacterCount += additionalCharCount;\n } else {\n break;\n }\n }\n\n const usersElement: JSX.Element = getUsersElement(\n typingUsersMentioned,\n strings.delimiter,\n onRenderUser,\n styles?.typingUserDisplayName\n );\n\n const numUserNotMentioned = typingUsers.length - typingUsersMentioned.length;\n const spanElements: JSX.Element[] = getSpanElements(\n strings,\n usersElement,\n typingUsersMentioned.length,\n numUserNotMentioned\n );\n\n return (\n <Stack\n horizontal\n data-ui-id={ids.typingIndicator}\n className={mergeStyles(typingIndicatorStringStyle, styles?.typingString)}\n key=\"typingStringKey\"\n >\n {spanElements}\n </Stack>\n );\n};\n\n/**\n * Typing Indicator is used to notify users if there are any other users typing in the thread.\n */\nexport const TypingIndicator = (props: TypingIndicatorProps): JSX.Element => {\n const { typingUsers, onRenderUser, styles } = props;\n const { strings } = useLocale();\n\n const typingUsersToRender = typingUsers.filter((typingUser) => typingUser.displayName !== undefined);\n\n const indicatorComponent = IndicatorComponent(\n typingUsersToRender,\n { ...strings.typingIndicator, ...props.strings },\n onRenderUser,\n styles\n );\n\n return <Stack className={mergeStyles(typingIndicatorContainerStyle, styles?.root)}>{indicatorComponent}</Stack>;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useEffect, useState } from 'react';\nimport { IMessageBarProps, MessageBar, MessageBarType, Stack } from '@fluentui/react';\nimport { useLocale } from '../localization';\n\n/**\n * {@link ErrorBar} properties.\n *\n * In addition to the following, {@link ErrorBar} forwards all\n * {@link @fluentui/react#IMessageBarProps} to the underlying {@link @fluentui/react#MessageBar}.\n */\nexport interface ErrorBarProps extends IMessageBarProps {\n /**\n * Strings shown on the UI on errors.\n */\n strings?: ErrorBarStrings;\n\n /**\n * Currently active errors.\n */\n activeErrors: ActiveError[];\n}\n\n/**\n * All strings that may be shown on the UI in the {@link ErrorBar}.\n */\nexport interface ErrorBarStrings {\n /**\n * Unable to reach Chat service.\n *\n * This can mean:\n * - Incorrect Azure Communication Services endpoint was provided.\n * - User's network connection is down.\n */\n unableToReachChatService: string;\n\n /**\n * User does not have access to the Chat service.\n * This usually means that either the Azure Communication Services endpiont or the token provided are incorrect.\n */\n accessDenied: string;\n\n /**\n * User is no longer on the thread.\n *\n * See also: {@link ErrorBarStrings.sendMessageNotInThisThread} for a more specific error.\n */\n userNotInThisThread: string;\n\n /**\n * Sending message failed because user is no longer on the thread.\n */\n sendMessageNotInThisThread: string;\n\n /**\n * A generic message when sending message fails.\n * Prefer more specific error strings when possible.\n */\n sendMessageGeneric: string;\n\n /**\n * Detected bad network connection via the Calling SDK.\n */\n callingNetworkFailure: string;\n\n /**\n * A generic message when starting video fails.\n */\n startVideoGeneric: string;\n\n /**\n * A generic message when starting video fails.\n */\n stopVideoGeneric: string;\n\n /**\n * A generic message when muting microphone fails.\n */\n muteGeneric: string;\n\n /**\n * A generic message when unmuting microphone fails.\n */\n unmuteGeneric: string;\n\n /**\n * A generic message when starting screenshare fails.\n */\n startScreenShareGeneric: string;\n\n /**\n * A generic message when stopping screenshare fails.\n */\n stopScreenShareGeneric: string;\n}\n\n/**\n * All errors that can be shown in the {@link ErrorBar}.\n */\nexport type ErrorType = keyof ErrorBarStrings;\n\n/**\n * Active error to be shown via {@link ErrorBar}.\n */\nexport interface ActiveError {\n /**\n * Type of error that is active.\n */\n type: ErrorType;\n /**\n * The latest timestamp when this error was observed.\n *\n * When available, this is used to track errors that have already been seen and dismissed\n * by the user.\n */\n timestamp?: Date;\n}\n\n/**\n * A component to show error messages on the UI.\n * All strings that can be shown are accepted as the {@link ErrorBarProps.strings} so that they can be localized.\n * Active errors are selected by {@link ErrorBarProps.activeErrors}.\n *\n * This component internally tracks dismissed by the user.\n * * Errors that have an associated timestamp: The error is shown on the UI again if it occurs after being dismissed.\n * * Errors that do not have a timestamp: The error is dismissed until it dissappears from the props.\n * If the error recurs, it is shown in the UI.\n *\n * Uses {@link @fluentui/react#MessageBar} UI element.\n */\nexport const ErrorBar = (props: ErrorBarProps): JSX.Element => {\n const localeStrings = useLocale().strings.errorBar;\n const strings = props.strings ?? localeStrings;\n\n const [dismissedErrors, setDismissedErrors] = useState<DismissedError[]>([]);\n\n // dropDismissalsForInactiveErrors only returns a new object if `dismissedErrors` actually changes.\n // Without this behaviour, this `useEffect` block would cause a render loop.\n useEffect(\n () => setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrors, dismissedErrors)),\n [props.activeErrors, dismissedErrors]\n );\n\n const toShow = errorsToShow(props.activeErrors, dismissedErrors);\n\n return (\n <Stack>\n {toShow.map((error) => (\n <MessageBar\n {...props}\n key={error.type}\n messageBarType={MessageBarType.error}\n onDismiss={() => setDismissedErrors(dismissError(dismissedErrors, error))}\n >\n {strings[error.type]}\n </MessageBar>\n ))}\n </Stack>\n );\n};\n\ninterface DismissedError {\n type: ErrorType;\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n// Always returns a new Array so that the state variable is updated, trigerring a render.\nconst dismissError = (dismissedErrors: DismissedError[], toDismiss: ActiveError): DismissedError[] => {\n const now = new Date(Date.now());\n for (const error of dismissedErrors) {\n if (error.type === toDismiss.type) {\n // Bump the timestamp for latest dismissal of this error to now.\n error.dismissedAt = now;\n error.activeSince = toDismiss.timestamp;\n return Array.from(dismissedErrors);\n }\n }\n\n // Record that this error was dismissed for the first time right now.\n return [\n ...dismissedErrors,\n {\n type: toDismiss.type,\n dismissedAt: now,\n activeSince: toDismiss.timestamp\n }\n ];\n};\n\n// Returns a new Array if and only if contents change, to avoid re-rendering when nothing was dropped.\nconst dropDismissalsForInactiveErrors = (\n activeErrors: ActiveError[],\n dismissedErrors: DismissedError[]\n): DismissedError[] => {\n const active = new Map();\n for (const error of activeErrors) {\n active.set(error.type, error);\n }\n\n // For an error such that:\n // * It was previously active, and dismissed.\n // * It did not have a timestamp associated with it.\n // * It is no longer active.\n //\n // We remove it from dismissals. When it becomes active again next time, it will be shown again on the UI.\n const shouldDeleteDismissal = (dismissed: DismissedError) =>\n dismissed.activeSince === undefined && active.get(dismissed.type) === undefined;\n\n if (dismissedErrors.some((dismissed) => shouldDeleteDismissal(dismissed))) {\n return dismissedErrors.filter((dismissed) => !shouldDeleteDismissal(dismissed));\n }\n return dismissedErrors;\n};\n\nconst errorsToShow = (activeErrors: ActiveError[], dismissedErrors: DismissedError[]): ActiveError[] => {\n const dismissed: Map<ErrorType, DismissedError> = new Map();\n for (const error of dismissedErrors) {\n dismissed.set(error.type, error);\n }\n\n return activeErrors.filter((error) => {\n const dismissal = dismissed.get(error.type);\n if (!dismissal) {\n // This error was never dismissed.\n return true;\n }\n if (!error.timestamp) {\n // No timestamp associated with the error. In this case, the existence of a dismissal is enough to suppress the error.\n return false;\n }\n // Error has an associated timestamp, so compare with last dismissal.\n return error.timestamp > dismissal.dismissedAt;\n });\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const gridLayoutStyle = mergeStyles({\n height: '100%',\n display: 'grid',\n flexGrow: '1',\n gap: '.5rem',\n padding: '.5rem'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\nimport React, { useState } from 'react';\nimport { BaseCustomStylesProps } from '../types';\nimport { gridLayoutStyle } from './styles/GridLayout.styles';\n\nexport type GridLayoutType = 'standard';\n\nexport interface GridLayoutProps {\n children: React.ReactNode;\n layout?: GridLayoutType;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <GridLayout styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStylesProps;\n}\n\nconst calculateStandardLayoutRows = (numberOfItems: number, gridCol: number): number =>\n Math.ceil(numberOfItems / gridCol);\n\nconst calculateStandardLayoutColumns = (numberOfItems: number): number =>\n numberOfItems > 0 ? Math.ceil(Math.sqrt(numberOfItems)) : 1;\n\nexport const GridLayout = (props: GridLayoutProps): JSX.Element => {\n const [gridCol, setGridCol] = useState(1);\n const [gridRow, setGridRow] = useState(1);\n\n const { children, layout = 'standard', styles } = props;\n const numberOfChildren = React.Children.count(children);\n\n switch (layout) {\n case 'standard': {\n const numberOfColumns = calculateStandardLayoutColumns(numberOfChildren);\n if (gridCol !== numberOfColumns) setGridCol(numberOfColumns);\n const numberOfRows = calculateStandardLayoutRows(numberOfChildren, gridCol);\n if (gridRow !== numberOfRows) setGridRow(numberOfRows);\n break;\n }\n }\n\n return (\n <div\n className={mergeStyles(gridLayoutStyle, styles?.root)}\n style={{\n gridTemplateRows: `repeat(${gridRow}, minmax(0, 1fr))`,\n gridTemplateColumns: `repeat(${gridCol}, 1fr)`\n }}\n >\n {children}\n </div>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const suppressIconStyle = {\n iconContainer: { minHeight: '0', minWidth: '0', height: '0', width: '0', margin: '0' },\n icon: { display: 'none' }\n};\n\nexport const sendBoxStyleSet = {\n root: {\n padding: '0.25rem'\n }\n};\n\nexport const sendBoxStyle = mergeStyles({\n paddingRight: '2rem'\n});\n\nexport const sendButtonStyle = mergeStyles({\n margin: 'auto .6rem',\n paddingBottom: '1.125rem'\n});\n\nexport const sendIconStyle = mergeStyles({\n width: '1.0625rem',\n height: '1.0625rem',\n margin: 'auto'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PartialTheme } from '@fluentui/react';\n\n/**\n * Theme designed ACS UI SDK calling components\n */\nexport interface CallingTheme {\n callingPalette: {\n callRed: string;\n callRedDark: string;\n callRedDarker: string;\n };\n}\n\n/**\n * Light theme designed ACS UI SDK components\n */\nexport const lightTheme: PartialTheme & CallingTheme = {\n palette: {\n themePrimary: '#0078d4',\n themeLighterAlt: '#eff6fc',\n themeLighter: '#deecf9',\n themeLight: '#c7e0f4',\n themeTertiary: '#71afe5',\n themeSecondary: '#2b88d8',\n themeDarkAlt: '#106ebe',\n themeDark: '#59b0f7',\n themeDarker: '#004578',\n neutralLighterAlt: '#faf9f8',\n neutralLighter: '#f3f2f1',\n neutralLight: '#edebe9',\n neutralQuaternaryAlt: '#e1dfdd',\n neutralQuaternary: '#d0d0d0',\n neutralTertiaryAlt: '#c8c6c4',\n neutralTertiary: '#a19f9d',\n neutralSecondary: '#605e5c',\n neutralPrimaryAlt: '#3b3a39',\n neutralPrimary: '#323130',\n neutralDark: '#201f1e',\n black: '#000000',\n white: '#ffffff'\n },\n callingPalette: {\n callRed: '#c4314b',\n callRedDark: '#a42e43',\n callRedDarker: '#8b2c3d'\n }\n};\n\n/**\n * Dark theme designed ACS UI SDK components\n */\nexport const darkTheme: PartialTheme & CallingTheme = {\n palette: {\n themePrimary: '#2899f5',\n themeLighterAlt: '#02060a',\n themeLighter: '#061827',\n themeLight: '#0c2e49',\n themeTertiary: '#185b93',\n themeSecondary: '#2286d7',\n themeDarkAlt: '#3ca2f6',\n themeDark: '#59b0f7',\n themeDarker: '#84c5f9',\n neutralLighterAlt: '#302e2d',\n neutralLighter: '#383735',\n neutralLight: '#464443',\n neutralQuaternaryAlt: '#4e4d4b',\n neutralQuaternary: '#4d4b49',\n neutralTertiaryAlt: '#72706e',\n neutralTertiary: '#c8c8c8',\n neutralSecondary: '#d0d0d0',\n neutralPrimaryAlt: '#dadada',\n neutralPrimary: '#ffffff',\n neutralDark: '#f4f4f4',\n black: '#f8f8f8',\n white: '#252423'\n },\n callingPalette: {\n callRed: '#a42e43',\n callRedDark: '#8b2c3d',\n callRedDarker: '#772a38'\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport { ThemeProvider, Theme, PartialTheme, getTheme, mergeThemes, mergeStyles } from '@fluentui/react';\nimport { mergeThemes as mergeNorthstarThemes, Provider, teamsTheme } from '@fluentui/react-northstar';\nimport { lightTheme } from './themes';\n\n/**\n * Props for FluentThemeProvider\n */\nexport interface FluentThemeProviderProps {\n /** Children to be themed. */\n children: React.ReactNode;\n /** Theme for components. Defaults to a light theme if not provided. */\n fluentTheme?: PartialTheme | Theme;\n /**\n * Whether components are displayed right-to-left\n * @defaultValue `false`\n */\n rtl?: boolean;\n}\n\nconst wrapper = mergeStyles({\n height: '100%',\n width: '100%',\n overflow: 'auto'\n});\n\nconst defaultTheme = mergeThemes(getTheme(), lightTheme);\n\n/** Theme context for library's react components */\nexport const ThemeContext = createContext<Theme>(defaultTheme);\n\nconst initialFluentNorthstarTheme = mergeNorthstarThemes(teamsTheme, {\n componentVariables: {\n // suppressing teams theme for chat message links to get better styling from Fluent UI Link\n ChatMessage: {\n linkColor: undefined,\n linkColorMine: undefined\n }\n }\n});\n\n/**\n * @description Provider to apply a Fluent theme across this library's react components.\n * @remarks Components in this library are composed primarily from [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/controls/web),\n * controls, and also from [Fluent React Northstar](https://fluentsite.z22.web.core.windows.net/0.53.0) controls.\n * This provider handles applying any theme provided to both the underlying Fluent UI controls, as well as the Fluent React Northstar controls.\n */\nexport const FluentThemeProvider = (props: FluentThemeProviderProps): JSX.Element => {\n const { fluentTheme, rtl, children } = props;\n\n let fluentUITheme: Theme = mergeThemes(defaultTheme, fluentTheme);\n // merge in rtl from FluentThemeProviderProps\n fluentUITheme = mergeThemes(fluentUITheme, { rtl });\n\n const fluentNorthstarTheme = mergeNorthstarThemes(initialFluentNorthstarTheme, {\n componentVariables: {\n Chat: {\n backgroundColor: fluentUITheme.palette.white\n },\n ChatMessage: {\n authorColor: fluentUITheme.palette.neutralPrimary,\n contentColor: fluentUITheme.palette.neutralPrimary,\n backgroundColor: fluentUITheme.palette.neutralLighter,\n backgroundColorMine: fluentUITheme.palette.themeLight\n }\n },\n componentStyles: {\n ChatMessage: {\n timestamp: {\n WebkitTextFillColor: fluentUITheme.palette.neutralSecondary\n }\n }\n }\n // add more northstar components to align with Fluent UI theme\n });\n\n return (\n <ThemeContext.Provider value={fluentUITheme}>\n <ThemeProvider theme={fluentUITheme} className={wrapper}>\n <Provider theme={fluentNorthstarTheme} className={wrapper} rtl={rtl}>\n {children}\n </Provider>\n </ThemeProvider>\n </ThemeContext.Provider>\n );\n};\n\n/** React hook to access theme */\nexport const useTheme = (): Theme => useContext(ThemeContext);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CallEnd20Filled,\n Checkmark20Regular,\n CheckmarkCircle20Regular,\n Circle20Regular,\n Delete20Regular,\n Dismiss20Regular,\n Edit20Regular,\n ErrorCircle20Regular,\n EyeShow20Filled,\n MicOff16Filled,\n MicOff20Filled,\n MicOn20Filled,\n MicOn20Regular,\n MoreHorizontal20Filled,\n MoreHorizontal20Regular,\n People20Filled,\n Send20Filled,\n Send20Regular,\n ShareScreenStart20Filled,\n ShareScreenStop20Filled,\n Speaker220Regular,\n Video20Filled,\n Video20Regular,\n VideoOff20Filled\n} from '@fluentui/react-icons';\nimport React from 'react';\n\nexport type ComponentIcons = Record<keyof typeof DEFAULT_COMPONENT_ICONS, JSX.Element>;\n\n/**\n * The default set of icons that are available to use in the UI components.\n */\n// NOTE: Don't forget to add icons used in composites to the types in `packages/react-composites/src/composites/common/icons.tsx`\nexport const DEFAULT_COMPONENT_ICONS = {\n ControlButtonCameraOff: <VideoOff20Filled />,\n ControlButtonCameraOn: <Video20Filled />,\n ControlButtonEndCall: <CallEnd20Filled />,\n ControlButtonMicOff: <MicOff20Filled />,\n ControlButtonMicOn: <MicOn20Filled />,\n ControlButtonOptions: <MoreHorizontal20Filled />,\n ControlButtonParticipants: <People20Filled />,\n ControlButtonScreenShareStart: <ShareScreenStart20Filled />,\n ControlButtonScreenShareStop: <ShareScreenStop20Filled />,\n MessageDelivered: <CheckmarkCircle20Regular />,\n MessageFailed: <ErrorCircle20Regular />,\n MessageSeen: <EyeShow20Filled />,\n MessageSending: <Circle20Regular />,\n OptionsCamera: <Video20Regular />,\n OptionsMic: <MicOn20Regular />,\n OptionsSpeaker: <Speaker220Regular />,\n ParticipantItemScreenShareStart: <ShareScreenStart20Filled />,\n ParticipantItemMicOff: <MicOff16Filled />,\n ParticipantItemOptions: <MoreHorizontal20Regular />,\n ParticipantItemOptionsHovered: <MoreHorizontal20Filled />,\n SendBoxSend: <Send20Regular />,\n SendBoxSendHovered: <Send20Filled />,\n VideoTileMicOff: <MicOff16Filled />,\n EditBoxCancel: <Dismiss20Regular />,\n EditBoxSubmit: <Checkmark20Regular />,\n MessageEdit: <Edit20Regular />,\n MessageRemove: <Delete20Regular />\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { mergeStyles, IStyle, FontWeights } from '@fluentui/react';\n\nexport const inputBoxWrapperStyle = mergeStyles({\n padding: '0'\n});\n\nexport const inputBoxStyle = mergeStyles({\n minHeight: '2.25rem', // prevents the input text box from being sized to 0px when the meeting composite chat pane is closed.\n maxHeight: '8.25rem',\n outline: 'red 5px',\n fontWeight: FontWeights.regular,\n fontSize: '0.875rem',\n width: '100%',\n height: '2.25rem',\n lineHeight: '1.5rem',\n '::-webkit-input-placeholder': {\n fontSize: '0.875rem'\n },\n '::-moz-placeholder': {\n fontSize: '0.875rem'\n },\n ':-moz-placeholder': {\n fontSize: '0.875rem'\n }\n});\n\nexport const textFieldStyle = (errorColor: string, hasErrorMessage: boolean, disabled: boolean): IStyle => {\n const borderColor = hasErrorMessage ? errorColor : 'none';\n return {\n root: {\n width: '100%',\n minHeight: '0',\n fontSize: '8.25rem'\n },\n wrapper: {},\n fieldGroup: {\n height: 'auto',\n minHeight: '0',\n borderRadius: '0.25rem',\n borderColor: borderColor,\n borderWidth: disabled ? '0px' : '1px',\n ':hover': { borderColor: borderColor },\n ':active': { borderColor: borderColor },\n ':after': { borderColor: borderColor, borderRadius: '0.25rem' }\n },\n field: {\n borderRadius: '0.25rem'\n },\n errorMessage: {\n color: errorColor\n }\n };\n};\n\nexport const inputButtonStyle = mergeStyles({\n color: 'grey',\n cursor: 'pointer',\n display: 'flex',\n justifyContent: 'center',\n margin: 'auto',\n top: '0',\n bottom: '0',\n width: '1.0625rem',\n height: '1.0625rem'\n});\n\nexport const inputButtonContainerStyle = (rtl?: boolean): string =>\n mergeStyles({\n display: 'flex',\n justifyContent: 'center',\n position: 'absolute',\n margin: 'auto',\n top: '0',\n bottom: '0',\n right: !rtl ? '0.3rem' : undefined,\n left: rtl ? '0.3rem' : undefined\n });\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Theme } from '@fluentui/react';\n\nexport const isDarkThemed = (theme: Theme): boolean => {\n const themeBlackBrightness = getPerceptualBrightnessOfHexColor(theme.palette.black);\n const themeWhiteBrightness = getPerceptualBrightnessOfHexColor(theme.palette.white);\n if (Number.isNaN(themeBlackBrightness) || Number.isNaN(themeWhiteBrightness)) {\n return false;\n }\n return themeBlackBrightness > themeWhiteBrightness;\n};\n\nconst getPerceptualBrightnessOfHexColor = (hexColor: string): number => {\n // return NaN if hexColor is not a hex code\n if (!/^#[0-9A-Fa-f]{6}$/i.test(hexColor)) {\n return NaN;\n }\n const r = parseInt(hexColor.substring(1, 3), 16);\n const g = parseInt(hexColor.substring(3, 5), 16);\n const b = parseInt(hexColor.substring(5, 7), 16);\n\n // arithmetic mean μ of the red, green, and blue color coordinates. Source: https://en.wikipedia.org/wiki/Brightness\n return (r + g + b) / 3;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useState, ReactNode, FormEvent, useCallback } from 'react';\nimport { Stack, TextField, mergeStyles, IStyle, ITextField, concatStyleSets } from '@fluentui/react';\nimport { BaseCustomStylesProps } from '../types';\nimport {\n inputBoxStyle,\n inputBoxWrapperStyle,\n inputButtonContainerStyle,\n inputButtonStyle,\n textFieldStyle\n} from './styles/InputBoxComponent.style';\n\nimport { isDarkThemed } from '../theming/themeUtils';\nimport { useTheme } from '../theming/FluentThemeProvider';\n\nexport interface InputBoxStylesProps extends BaseCustomStylesProps {\n /** Styles for the text field. */\n textField?: IStyle;\n\n /** Styles for the system message; These styles will be ignored when a custom system message component is provided. */\n systemMessage?: IStyle;\n}\n\ntype InputBoxComponentProps = {\n children: ReactNode;\n 'data-ui-id'?: string;\n id?: string;\n textValue: string;\n onChange: (event: FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string | undefined) => void;\n textFieldRef?: React.RefObject<ITextField>;\n inputClassName?: string;\n placeholderText?: string;\n supportNewline?: boolean;\n maxLength: number;\n onKeyDown?: (ev: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n onEnterKeyDown?: () => void;\n errorMessage?: string | React.ReactElement;\n disabled?: boolean;\n styles?: InputBoxStylesProps;\n};\n\nexport const InputBoxComponent = (props: InputBoxComponentProps): JSX.Element => {\n const {\n styles,\n id,\n 'data-ui-id': dataUiId,\n textValue,\n onChange,\n textFieldRef,\n placeholderText,\n onKeyDown,\n onEnterKeyDown,\n supportNewline,\n inputClassName,\n errorMessage,\n disabled,\n children\n } = props;\n\n const theme = useTheme();\n const mergedRootStyle = mergeStyles(inputBoxWrapperStyle, styles?.root);\n const mergedTextFiledStyle = mergeStyles(inputBoxStyle, inputClassName);\n\n const mergedTextFieldStyle = concatStyleSets(\n textFieldStyle(isDarkThemed(theme) ? '#f1707b' : '#a80000', !!errorMessage, !!disabled),\n {\n fieldGroup: styles?.textField,\n errorMessage: styles?.systemMessage\n }\n );\n\n const onTexFieldKeyDown = useCallback(\n (ev: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline)) {\n ev.preventDefault();\n onEnterKeyDown && onEnterKeyDown();\n }\n onKeyDown && onKeyDown(ev);\n },\n [onEnterKeyDown, onKeyDown, supportNewline]\n );\n\n return (\n <Stack className={mergedRootStyle}>\n <div style={{ position: 'relative' }}>\n <TextField\n data-ui-id={dataUiId}\n multiline\n autoAdjustHeight\n multiple={false}\n resizable={false}\n componentRef={textFieldRef}\n id={id}\n ariaLabel={'Type'}\n inputClassName={mergedTextFiledStyle}\n placeholder={placeholderText}\n value={textValue}\n onChange={onChange}\n autoComplete=\"off\"\n onKeyDown={onTexFieldKeyDown}\n styles={mergedTextFieldStyle}\n disabled={disabled}\n errorMessage={errorMessage}\n />\n <div className={inputButtonContainerStyle(theme.rtl)}>{children}</div>\n </div>\n </Stack>\n );\n};\n\nexport type InputBoxButtonProps = {\n onRenderIcon: (props: InputBoxButtonProps, isMouseOverSendIcon: boolean) => JSX.Element;\n onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n className?: string;\n id?: string;\n};\n\nexport const InputBoxButton = (props: InputBoxButtonProps): JSX.Element => {\n const { onRenderIcon, onClick, className, id } = props;\n const [isMouseOverSendIcon, setIsMouseOverSendIcon] = useState(false);\n const mergedButtonStyle = mergeStyles(inputButtonStyle, className);\n return (\n <div\n className={mergedButtonStyle}\n onClick={onClick}\n id={id}\n onMouseEnter={() => {\n setIsMouseOverSendIcon(true);\n }}\n onMouseLeave={() => {\n setIsMouseOverSendIcon(false);\n }}\n >\n {onRenderIcon(props, isMouseOverSendIcon)}\n </div>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useState, useMemo, useCallback } from 'react';\nimport { IStyle, ITextField, mergeStyles, concatStyleSets, Icon } from '@fluentui/react';\nimport { sendBoxStyle, sendBoxStyleSet, sendButtonStyle, sendIconStyle } from './styles/SendBox.styles';\nimport { BaseCustomStylesProps } from '../types';\nimport { useTheme } from '../theming';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { InputBoxButton, InputBoxButtonProps, InputBoxComponent } from './InputBoxComponent';\n\nconst EMPTY_MESSAGE_REGEX = /^\\s*$/;\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\nconst TEXT_EXCEEDS_LIMIT = `Your message is over the limit of ${MAXIMUM_LENGTH_OF_MESSAGE} characters`;\n\nexport interface SendBoxStylesProps extends BaseCustomStylesProps {\n /** Styles for the text field. */\n textField?: IStyle;\n /** Styles for the container of the send message icon. */\n sendMessageIconContainer?: IStyle;\n /** Styles for the send message icon; These styles will be ignored when a custom send message icon is provided. */\n sendMessageIcon?: IStyle;\n /** Styles for the system message; These styles will be ignored when a custom system message component is provided. */\n systemMessage?: IStyle;\n}\n\n/**\n * Strings of SendBox that can be overridden\n */\nexport interface SendBoxStrings {\n /**\n * Placeholder text in SendBox when there is no user input\n */\n placeholderText: string;\n}\n\n/**\n * Props for SendBox component\n */\nexport interface SendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Optional text for system message below text box\n */\n systemMessage?: string;\n /**\n * Optional callback called when message is sent\n */\n onSendMessage?: (content: string) => Promise<void>;\n /**\n * Optional callback called when user is typing\n */\n onTyping?: () => Promise<void>;\n /**\n * Optional callback to render system message below the SendBox.\n * @defaultValue MessageBar\n */\n onRenderSystemMessage?: (systemMessage: string | undefined) => React.ReactElement;\n /**\n * Optional boolean to support new line in SendBox.\n * @defaultValue false\n */\n supportNewline?: boolean;\n /**\n * Optional callback to render send button icon to the right of the SendBox.\n * @defaultValue SendIcon\n */\n onRenderIcon?: (props: InputBoxButtonProps, isMouseOverSendIcon: boolean) => JSX.Element;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <SendBox styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: SendBoxStylesProps;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<SendBoxStrings>;\n}\n\n/**\n * `SendBox` is a component for users to send messages and typing notifications. An optional message\n * can also be shown below the `SendBox`.\n */\nexport const SendBox = (props: SendBoxProps): JSX.Element => {\n const {\n disabled,\n systemMessage,\n supportNewline,\n onSendMessage,\n onTyping,\n onRenderIcon,\n onRenderSystemMessage,\n styles\n } = props;\n const theme = useTheme();\n const localeStrings = useLocale().strings.sendBox;\n const strings = { ...localeStrings, ...props.strings };\n const ids = useIdentifiers();\n\n const [textValue, setTextValue] = useState('');\n const [textValueOverflow, setTextValueOverflow] = useState(false);\n\n const sendTextFieldRef = React.useRef<ITextField>(null);\n\n const sendMessageOnClick = (): void => {\n // don't send a message when disabled\n if (disabled || textValueOverflow) {\n return;\n }\n // we dont want to send empty messages including spaces, newlines, tabs\n if (!EMPTY_MESSAGE_REGEX.test(textValue)) {\n onSendMessage && onSendMessage(textValue);\n setTextValue('');\n }\n sendTextFieldRef.current?.focus();\n };\n const setText = (\n event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,\n newValue?: string | undefined\n ): void => {\n if (newValue === undefined) return;\n\n if (newValue.length > MAXIMUM_LENGTH_OF_MESSAGE) {\n setTextValueOverflow(true);\n } else {\n setTextValueOverflow(false);\n }\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? TEXT_EXCEEDS_LIMIT : undefined;\n const errorMessage = systemMessage ?? textTooLongMessage;\n\n const mergedSendButtonStyle = useMemo(\n () => mergeStyles(sendButtonStyle, styles?.sendMessageIconContainer),\n [styles?.sendMessageIconContainer]\n );\n\n const mergedStyles = useMemo(() => concatStyleSets(sendBoxStyleSet, styles), [styles]);\n\n const hasText = !!textValue;\n const mergedSendIconStyle = useMemo(\n () =>\n mergeStyles(\n sendIconStyle,\n {\n color: !!errorMessage || !hasText ? theme.palette.neutralTertiary : theme.palette.themePrimary\n },\n styles?.sendMessageIcon\n ),\n [errorMessage, hasText, theme, styles?.sendMessageIcon]\n );\n\n const onRenderSendIcon = useCallback(\n (props: InputBoxButtonProps, isMouseOverSendIcon: boolean) =>\n onRenderIcon ? (\n onRenderIcon(props, isMouseOverSendIcon)\n ) : (\n <Icon iconName={isMouseOverSendIcon ? 'SendBoxSendHovered' : 'SendBoxSend'} className={mergedSendIconStyle} />\n ),\n [mergedSendIconStyle, onRenderIcon]\n );\n\n return (\n <InputBoxComponent\n data-ui-id={ids.sendboxTextfield}\n disabled={disabled}\n errorMessage={onRenderSystemMessage ? onRenderSystemMessage(errorMessage) : errorMessage}\n textFieldRef={sendTextFieldRef}\n id=\"sendbox\"\n inputClassName={sendBoxStyle}\n placeholderText={strings.placeholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={() => {\n onTyping && onTyping();\n }}\n onEnterKeyDown={() => {\n sendMessageOnClick();\n }}\n styles={mergedStyles}\n supportNewline={supportNewline}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n >\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n if (!textValueOverflow) {\n sendMessageOnClick();\n }\n e.stopPropagation();\n }}\n id={'sendIconWrapper'}\n className={mergedSendButtonStyle}\n />\n </InputBoxComponent>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\n// ErrorIcon seems designed slightly smaller than other icons we try to match the size and then fix positioning here\nexport const MessageStatusIndicatorErrorIconStyle = mergeStyles({\n marginRight: '-0.06rem',\n fontSize: '1.06rem'\n});\n\nexport const MessageStatusIndicatorIconStyle = mergeStyles({\n fontSize: '1rem'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Icon, mergeStyles, TooltipHost } from '@fluentui/react';\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { BaseCustomStylesProps } from '../types';\nimport {\n MessageStatusIndicatorErrorIconStyle,\n MessageStatusIndicatorIconStyle\n} from './styles/MessageStatusIndicator.styles';\n\n/**\n * Strings of MessageStatusIndicator that can be overridden\n */\nexport interface MessageStatusIndicatorStrings {\n /** Text to display in the delivered message icon tooltip. */\n deliveredTooltipText: string;\n /** Text to display in the seen message icon tooltip. */\n seenTooltipText: string;\n /** Text to display in the sending message icon tooltip. */\n sendingTooltipText: string;\n /** Text to display in the failed message icon tooltip. */\n failedToSendTooltipText: string;\n}\n\n/**\n * Props for MessageStatusIndicator component\n */\nexport interface MessageStatusIndicatorProps {\n /** Message status that determines the icon to display. */\n status?: MessageStatus;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageStatus styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStylesProps;\n /**\n * Optional strings to override in component\n */\n strings?: MessageStatusIndicatorStrings;\n}\n\n/**\n * MessageStatusIndicator component.\n */\nexport const MessageStatusIndicator = (props: MessageStatusIndicatorProps): JSX.Element => {\n const { status, styles } = props;\n\n const localeStrings = useLocale().strings.messageStatusIndicator;\n const strings = { ...localeStrings, ...props.strings };\n const theme = useTheme();\n\n switch (status) {\n case 'failed':\n return (\n <TooltipHost content={strings.failedToSendTooltipText}>\n <Icon\n iconName=\"MessageFailed\"\n className={mergeStyles(\n MessageStatusIndicatorErrorIconStyle,\n { color: theme.palette.redDark },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n case 'sending':\n return (\n <TooltipHost content={strings.sendingTooltipText}>\n <Icon\n iconName=\"MessageSending\"\n className={mergeStyles(\n MessageStatusIndicatorIconStyle,\n { color: theme.palette.themePrimary },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n case 'seen':\n return (\n <TooltipHost content={strings.seenTooltipText}>\n <Icon iconName=\"MessageSeen\" className={mergeStyles({ color: theme.palette.black }, styles?.root)} />\n </TooltipHost>\n );\n case 'delivered':\n return (\n <TooltipHost content={strings.deliveredTooltipText}>\n <Icon\n iconName=\"MessageDelivered\"\n className={mergeStyles(\n MessageStatusIndicatorIconStyle,\n { color: theme.palette.themePrimary },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n default:\n return <></>;\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CSSProperties } from 'react';\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\nimport { mergeStyles } from '@fluentui/react';\n\nexport const messageAvatarContainerStyle = (backgroundColor: string): string =>\n mergeStyles({\n width: '2rem',\n minWidth: '2rem',\n height: '2rem',\n backgroundColor: backgroundColor,\n borderRadius: '50%',\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n fontFamily: 'Segoe UI Regular',\n fontSize: '1rem' // 16px\n });\n\nexport const messageThreadContainerStyle = mergeStyles({\n height: '100%',\n width: '100%',\n maxHeight: '100%',\n overflow: 'auto',\n position: 'relative'\n});\n\nexport const noMessageStatusStyle = mergeStyles({\n width: '1.25rem'\n});\n\nexport const chatStyle: ComponentSlotStyle = {\n paddingBottom: '0.5rem',\n paddingTop: '0.8rem',\n border: 'none',\n overflow: 'auto'\n};\n\nexport const newMessageButtonContainerStyle = mergeStyles({\n position: 'absolute',\n zIndex: 1,\n bottom: 0,\n right: '1.5rem'\n});\n\nexport const chatMessageStyle: CSSProperties = {\n overflowY: 'hidden'\n};\n\nexport const chatMessageDateStyle: CSSProperties = {\n fontWeight: 600\n};\n\nexport const messageStatusContainerStyle = (mine: boolean): string =>\n mergeStyles({\n marginLeft: mine ? '1rem' : '0rem'\n });\n\nexport const newMessageButtonStyle = mergeStyles({\n float: 'right',\n width: 'fit-content'\n});\n\nexport const loadPreviousMessageButtonStyle = mergeStyles({\n border: 'none',\n minHeight: '1.5rem',\n '&:hover': { background: 'none' },\n '&:active': { background: 'none' }\n});\n\nexport const DownIconStyle = mergeStyles({\n marginRight: '0.5em'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const delay = (delay: number): Promise<void> => {\n return new Promise(function (resolve) {\n setTimeout(resolve, delay);\n });\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const systemMessageIconStyle = mergeStyles({\n margin: '0 0.688rem 0 0'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, FontIcon, mergeStyles, Stack } from '@fluentui/react';\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\nimport React from 'react';\nimport { systemMessageIconStyle } from './styles/SystemMessage.styles';\n\n// Todo: We need to add more types of system messages that we support.\nexport type SystemMessageIconTypes = 'PeopleAdd' | 'PeopleBlock' | 'Edit';\n\nexport type SystemMessageProps = {\n /**\n * Icon name for the system message. iconName should match the iconName in fluentUI icon.\n */\n iconName: SystemMessageIconTypes;\n /**\n * Content string for the system message.\n */\n content: string;\n /*\n * Custom CSS Style for the system message container.\n */\n containerStyle?: ComponentSlotStyle;\n};\n\nexport const SystemMessage = (props: SystemMessageProps): JSX.Element => {\n const { iconName, content } = props;\n const Icon: JSX.Element = <FontIcon iconName={iconName} className={mergeStyles(systemMessageIconStyle)} />;\n\n return (\n <Stack horizontal className={mergeStyles(props?.containerStyle as IStyle)}>\n {Icon}\n <span>{content}</span>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles, IStyle, FontWeights } from '@fluentui/react';\n\nexport const chatActionsCSS: IStyle = {\n 'ul&': {\n right: '0',\n left: 'auto',\n top: '-1.625rem',\n bottom: 'auto',\n position: 'absolute'\n },\n '& a': {\n margin: '0',\n padding: '0',\n border: '0'\n }\n};\n\nexport const iconWrapperStyle = mergeStyles({\n padding: '0.375rem',\n webkitBoxPack: 'center',\n justifyContent: 'center'\n});\n\nexport const chatMessageDateStyle = mergeStyles({ fontWeight: FontWeights.semibold });\n\nexport const chatMessageMenuStyle = mergeStyles({\n minWidth: '8.5rem',\n cursor: 'pointer'\n});\n\nexport const menuIconStyleSet = { root: { height: 28, width: 20 } };\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { MessageThreadStrings } from '../MessageThread';\n\nexport const formatTimeForChatMessage = (messageDate: Date): string => {\n let hours = messageDate.getHours();\n let minutes = messageDate.getMinutes().toString();\n const isAm = hours < 12;\n if (hours > 12) {\n hours = hours - 12;\n }\n if (hours === 0) {\n hours = 12;\n }\n if (minutes.length < 2) {\n minutes = '0' + minutes;\n }\n return hours.toString() + ':' + minutes + ' ' + (isAm ? 'a.m.' : 'p.m.');\n};\n\nexport const formatDateForChatMessage = (messageDate: Date): string => {\n const year = messageDate.getFullYear().toString();\n let month = (messageDate.getMonth() + 1).toString();\n let day = messageDate.getDate().toString();\n\n if (month.length === 1) {\n month = '0' + month;\n }\n if (day.length === 1) {\n day = '0' + day;\n }\n\n return year + '-' + month + '-' + day;\n};\n\n/**\n * Given a message date object in ISO8601 and a current date object, generates a user friendly timestamp text like the\n * following:\n *\n * 1:30 p.m.\n * Yesterday 1:30 p.m.\n * Monday 1:30 p.m.\n * 2021-01-10 1:30 p.m.\n *\n * If message is after yesterday, then only show the time.\n * If message is before yesteray and after day before yesterday, then show 'Yesterday' plus the time.\n * If message is before day before yesterday and within the current week, then show 'Monday/Tuesday/etc' plus the time.\n * - We consider start of the week as Sunday. If current day is Sunday, then any time before that is in previous week.\n * If message is in previous or older weeks, then show date string plus the time.\n *\n * @param messageDate - date of message\n * @param currentDate - date used as offset to create the user friendly timestamp (e.g. to create 'Yesterday' instead of an absolute date)\n */\nexport const formatTimestampForChatMessage = (\n messageDate: Date,\n todayDate: Date,\n dateStrings: MessageThreadStrings\n): string => {\n // If message was in the same day timestamp string is just the time like '1:30 p.m.'.\n const startOfDay = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate());\n if (messageDate > startOfDay) {\n return formatTimeForChatMessage(messageDate);\n }\n\n // If message was yesterday then timestamp string is like this 'Yesterday 1:30 p.m.'.\n const yesterdayDate = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate() - 1);\n if (messageDate > yesterdayDate) {\n return dateStrings.yesterday + ' ' + formatTimeForChatMessage(messageDate);\n }\n\n // If message was before Sunday and today is Sunday (start of week) then timestamp string is like\n // '2021-01-10 1:30 p.m.'.\n const weekDay = todayDate.getDay();\n if (weekDay === 0) {\n return formatDateForChatMessage(messageDate) + ' ' + formatTimeForChatMessage(messageDate);\n }\n\n // If message was before first day of the week then timestamp string is like Monday 1:30 p.m.\n const firstDayOfTheWeekDate = new Date(todayDate.getFullYear(), todayDate.getMonth(), todayDate.getDate() - weekDay);\n if (messageDate > firstDayOfTheWeekDate) {\n return dayToDayName(messageDate.getDay(), dateStrings) + ' ' + formatTimeForChatMessage(messageDate);\n }\n\n // If message date is in previous or older weeks then timestamp string is like 2021-01-10 1:30 p.m.\n return formatDateForChatMessage(messageDate) + ' ' + formatTimeForChatMessage(messageDate);\n};\n\nconst dayToDayName = (day: number, dateStrings: MessageThreadStrings): string => {\n switch (day) {\n case 0:\n return dateStrings.sunday;\n case 1:\n return dateStrings.monday;\n case 2:\n return dateStrings.tuesday;\n case 3:\n return dateStrings.wednesday;\n case 4:\n return dateStrings.thursday;\n case 5:\n return dateStrings.friday;\n case 6:\n return dateStrings.saturday;\n default:\n throw new Error(`Invalid day [${day}] passed`);\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const editBoxStyle = mergeStyles({\n marginTop: '0.0875rem',\n marginBottom: '0.0875rem',\n paddingRight: '3.25rem'\n});\n\nexport const editingButtonStyle = mergeStyles({\n margin: 'auto .3rem'\n});\n\nexport const inputBoxIcon = mergeStyles({\n margin: 'auto',\n '&:hover svg': {\n stroke: 'currentColor'\n }\n});\n\nexport const editBoxStyleSet = {\n root: {\n width: '100%',\n marginLeft: '6.25rem'\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { useTheme } from '../theming/FluentThemeProvider';\nimport React, { useCallback, useState } from 'react';\nimport { Icon, mergeStyles } from '@fluentui/react';\n\nimport { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from './styles/EditBox.styles';\nimport { InputBoxButton, InputBoxComponent } from './InputBoxComponent';\n\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\nconst TEXT_EXCEEDS_LIMIT = `Your message is over the limit of ${MAXIMUM_LENGTH_OF_MESSAGE} characters`;\n\nconst onRenderCancelIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, { color });\n return <Icon iconName={'EditBoxCancel'} className={className} />;\n};\n\nconst onRenderSubmitIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, { color });\n return <Icon iconName={'EditBoxSubmit'} className={className} />;\n};\n\ntype EditBoxProps = {\n onCancel?: () => void;\n onSubmit: (text: string) => void;\n initialValue: string;\n};\n\nexport const EditBox = (props: EditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, initialValue } = props;\n const [textValue, setTextValue] = useState<string>(initialValue);\n const [textValueOverflow, setTextValueOverflow] = useState(false);\n const theme = useTheme();\n\n const setText = (\n event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,\n newValue?: string | undefined\n ): void => {\n if (newValue === undefined) return;\n\n if (newValue.length > MAXIMUM_LENGTH_OF_MESSAGE) {\n setTextValueOverflow(true);\n } else {\n setTextValueOverflow(false);\n }\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? TEXT_EXCEEDS_LIMIT : undefined;\n\n const onRenderThemedCancelIcon = useCallback(\n () => onRenderCancelIcon(theme.palette.themePrimary),\n [theme.palette.themePrimary]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n () => onRenderSubmitIcon(theme.palette.themePrimary),\n [theme.palette.themePrimary]\n );\n\n return (\n <InputBoxComponent\n inputClassName={editBoxStyle}\n textValue={textValue}\n onChange={setText}\n onEnterKeyDown={() => {\n onSubmit(textValue);\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyleSet}\n >\n <InputBoxButton\n className={editingButtonStyle}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel();\n }}\n id={'dismissIconWrapper'}\n />\n <InputBoxButton\n className={editingButtonStyle}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n if (!textValueOverflow && textValue !== '') {\n onSubmit(textValue);\n }\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </InputBoxComponent>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport React, { useMemo, useRef, useState } from 'react';\nimport { IStyle, mergeStyles, Link, ContextualMenu, DirectionalHint, IContextualMenuItem } from '@fluentui/react';\nimport { Chat, Text, ComponentSlotStyle, MoreIcon, MenuProps } from '@fluentui/react-northstar';\nimport { ChatMessage, ChatMessagePayload } from '../types';\nimport { LiveMessage } from 'react-aria-live';\nimport Linkify from 'react-linkify';\nimport { useLocale } from '../localization/LocalizationProvider';\nimport {\n chatMessageMenuStyle,\n chatMessageDateStyle,\n chatActionsCSS,\n iconWrapperStyle,\n menuIconStyleSet\n} from './styles/ChatMessageComponent.styles';\nimport { formatTimeForChatMessage, formatTimestampForChatMessage } from './utils/Datetime';\nimport { useIdentifiers } from '../identifiers/IdentifierProvider';\nimport { Parser } from 'html-to-react';\nimport { useTheme } from '../theming';\nimport { EditBox } from './EditBox';\n\ntype ChatMessageProps = {\n message: ChatMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n editDisabled?: boolean;\n onUpdateMessage?: (messageId: string, content: string) => Promise<void>;\n onDeleteMessage?: (messageId: string) => Promise<void>;\n};\n\n// https://stackoverflow.com/questions/28899298/extract-the-text-out-of-html-string-using-javascript\nconst extractContent = (s: string): string => {\n const span = document.createElement('span');\n span.innerHTML = s;\n return span.textContent || span.innerText;\n};\n\nconst GenerateMessageContent = (payload: ChatMessagePayload): JSX.Element => {\n switch (payload.type) {\n case 'text':\n return GenerateTextMessageContent(payload);\n case 'html':\n return GenerateRichTextHTMLMessageContent(payload);\n case 'richtext/html':\n return GenerateRichTextHTMLMessageContent(payload);\n default:\n console.warn('unknown message content type');\n return <></>;\n }\n};\n\nconst GenerateRichTextHTMLMessageContent = (payload: ChatMessagePayload): JSX.Element => {\n const htmlToReactParser = new Parser();\n const liveAuthor = `${payload.senderDisplayName} says `;\n return (\n <div data-ui-status={payload.status}>\n <LiveMessage\n message={`${payload.mine ? '' : liveAuthor} ${extractContent(payload.content || '')}`}\n aria-live=\"polite\"\n />\n {htmlToReactParser.parse(payload.content)}\n </div>\n );\n};\n\nconst GenerateTextMessageContent = (payload: ChatMessagePayload): JSX.Element => {\n const liveAuthor = `${payload.senderDisplayName} says `;\n return (\n <div data-ui-status={payload.status}>\n <LiveMessage message={`${payload.mine ? '' : liveAuthor} ${payload.content}`} aria-live=\"polite\" />\n <Linkify\n componentDecorator={(decoratedHref: string, decoratedText: string, key: number) => {\n return (\n <Link href={decoratedHref} key={key}>\n {decoratedText}\n </Link>\n );\n }}\n >\n {payload.content}\n </Linkify>\n </div>\n );\n};\n\nexport const ChatMessageComponent = (props: ChatMessageProps): JSX.Element => {\n const strings = useLocale().strings.messageThread;\n const ids = useIdentifiers();\n const theme = useTheme();\n\n const { message, onUpdateMessage, onDeleteMessage, editDisabled, showDate, messageContainerStyle } = props;\n const [isEditing, setIsEditing] = useState(false);\n\n const menuClass = mergeStyles(chatActionsCSS, {\n 'ul&': { boxShadow: theme.effects.elevation4, backgroundColor: theme.palette.white }\n });\n\n const actionMenu: MenuProps = useMemo(\n (): MenuProps => ({\n iconOnly: true,\n activeIndex: -1,\n className: menuClass,\n items: [\n {\n children: (\n <MoreMenu\n onEditClick={() => {\n setIsEditing(true);\n }}\n onRemoveClick={async () => {\n onDeleteMessage && message.payload.messageId && (await onDeleteMessage(message.payload.messageId));\n }}\n />\n ),\n\n key: 'menuButton2',\n 'aria-label': 'More options',\n indicator: false\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n }\n ]\n }),\n [menuClass, message.payload.messageId, onDeleteMessage]\n );\n\n if (message.type !== 'chat') {\n return <></>;\n }\n\n const payload: ChatMessagePayload = message.payload;\n\n if (isEditing) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return (\n <EditBox\n initialValue={payload.content ?? ''}\n onSubmit={async (text) => {\n onUpdateMessage && payload.messageId && (await onUpdateMessage(payload.messageId, text));\n setIsEditing(false);\n }}\n onCancel={() => {\n setIsEditing(false);\n }}\n />\n );\n }\n const messageContentItem = GenerateMessageContent(payload);\n return (\n <Chat.Message\n className={mergeStyles(messageContainerStyle as IStyle)}\n content={messageContentItem}\n author={<Text className={chatMessageDateStyle}>{payload.senderDisplayName}</Text>}\n mine={payload.mine}\n timestamp={\n <Text data-ui-id={ids.messageTimestamp}>\n {payload.createdOn\n ? showDate\n ? formatTimestampForChatMessage(payload.createdOn, new Date(), strings)\n : formatTimeForChatMessage(payload.createdOn)\n : undefined}\n </Text>\n }\n positionActionMenu={false}\n actionMenu={\n !editDisabled && message.payload.status !== 'sending' && message.payload.mine ? actionMenu : undefined\n }\n />\n );\n};\n\nconst MoreMenu = ({\n onEditClick,\n onRemoveClick\n}: {\n onEditClick: () => void;\n onRemoveClick: () => void;\n}): JSX.Element => {\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuHidden, setMenuHidden] = useState(true);\n\n const menuItems = useMemo(\n (): IContextualMenuItem[] => [\n {\n key: 'Edit',\n text: 'Edit',\n iconProps: { iconName: 'MessageEdit', styles: menuIconStyleSet },\n onClick: onEditClick\n },\n {\n key: 'Remove',\n text: 'Remove',\n iconProps: {\n iconName: 'MessageRemove',\n styles: menuIconStyleSet\n },\n onClick: onRemoveClick\n }\n ],\n [onEditClick, onRemoveClick]\n );\n\n return (\n <div ref={menuRef}>\n <MoreIcon\n className={iconWrapperStyle}\n onClick={() => setMenuHidden(false)}\n {...{\n outline: true\n }}\n />\n <ContextualMenu\n items={menuItems}\n hidden={menuHidden}\n target={menuRef}\n onDismiss={() => setMenuHidden(true)}\n directionalHint={DirectionalHint.bottomLeftEdge}\n className={chatMessageMenuStyle}\n />\n </div>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Chat, ChatItemProps, Flex, Ref, ShorthandValue } from '@fluentui/react-northstar';\nimport {\n DownIconStyle,\n newMessageButtonContainerStyle,\n messageThreadContainerStyle,\n chatStyle,\n newMessageButtonStyle,\n messageStatusContainerStyle,\n noMessageStatusStyle\n} from './styles/MessageThread.styles';\nimport { Icon, IStyle, mergeStyles, Persona, PersonaSize, PrimaryButton, Stack, IPersona } from '@fluentui/react';\nimport { ComponentSlotStyle } from '@fluentui/react-northstar';\nimport { LiveAnnouncer } from 'react-aria-live';\nimport { delay } from './utils/delay';\nimport {\n BaseCustomStylesProps,\n ChatMessage,\n CustomMessage,\n SystemMessage,\n ChatMessagePayload,\n CommunicationParticipant,\n OnRenderAvatarCallback,\n SystemMessagePayload\n} from '../types';\nimport { MessageStatusIndicator, MessageStatusIndicatorProps } from './MessageStatusIndicator';\nimport { memoizeFnAll, MessageStatus } from '@internal/acs-ui-common';\nimport { SystemMessage as SystemMessageComponent, SystemMessageIconTypes } from './SystemMessage';\nimport { ChatMessageComponent } from './ChatMessageComponent';\nimport { useLocale } from '../localization/LocalizationProvider';\n\nconst NEW_MESSAGES = 'New Messages';\n\nconst isMessageSame = (first: ChatMessagePayload, second: ChatMessagePayload): boolean => {\n return (\n first.messageId === second.messageId &&\n first.content === second.content &&\n first.type === second.type &&\n JSON.stringify(first.createdOn) === JSON.stringify(second.createdOn) &&\n first.senderId === second.senderId &&\n first.senderDisplayName === second.senderDisplayName &&\n first.status === second.status\n );\n};\n\n/**\n * Get the latest message from the message array.\n *\n * @param messages\n */\nconst getLatestChatMessage = (\n messages: (ChatMessage | SystemMessage | CustomMessage)[]\n): ChatMessagePayload | undefined => {\n let latestChatMessage: ChatMessagePayload | undefined = undefined;\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.type === 'chat') {\n const payload: ChatMessagePayload = message.payload;\n if (payload.createdOn !== undefined) {\n latestChatMessage = payload;\n break;\n }\n }\n }\n\n return latestChatMessage;\n};\n\n/**\n * Compare latestMessageFromPreviousMessages & latestMessageFromNewMessages to see if the new message is not from\n * current user.\n *\n * @param latestMessageFromPreviousMessages\n * @param latestMessageFromNewMessages\n * @param userId\n */\nconst isThereNewMessageNotFromCurrentUser = (\n latestMessageFromPreviousMessages: ChatMessagePayload | undefined,\n latestMessageFromNewMessages: ChatMessagePayload | undefined,\n userId: string\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n } else {\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId !== userId;\n } else {\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId !== userId\n );\n }\n }\n};\n\n/**\n * Returns true if the current user sent the latest message and false otherwise. It will ignore messages that have no\n * sender, messages that have failed to send, and messages from the current user that is marked as SEEN. This is meant\n * as an indirect way to detect if user is at bottom of the chat when the component updates with new messages. If we\n * updated this component due to current user sending a message we want to then call scrollToBottom.\n *\n * @param latestMessageFromPreviousMessages\n * @param latestMessageFromNewMessages\n */\nconst didUserSendTheLatestMessage = (\n latestMessageFromPreviousMessages: ChatMessagePayload | undefined,\n latestMessageFromNewMessages: ChatMessagePayload | undefined,\n userId: string\n): boolean => {\n if (latestMessageFromNewMessages === undefined) {\n return false;\n } else {\n if (latestMessageFromPreviousMessages === undefined) {\n return latestMessageFromNewMessages.senderId === userId;\n } else {\n return (\n !isMessageSame(latestMessageFromNewMessages, latestMessageFromPreviousMessages) &&\n latestMessageFromNewMessages.senderId === userId\n );\n }\n }\n};\n\nexport interface MessageThreadStylesProps extends BaseCustomStylesProps {\n /** Styles for load previous messages container. */\n loadPreviousMessagesButtonContainer?: IStyle;\n /** Styles for new message container. */\n newMessageButtonContainer?: IStyle;\n /** Styles for chat container. */\n chatContainer?: ComponentSlotStyle;\n /** Styles for chat message container. */\n chatMessageContainer?: ComponentSlotStyle;\n /** Styles for system message container. */\n systemMessageContainer?: ComponentSlotStyle;\n /** Styles for message status indicator container. */\n messageStatusContainer?: (mine: boolean) => IStyle;\n}\n\n/**\n * Strings of MessageThread that can be overridden\n */\nexport interface MessageThreadStrings {\n /** String for Sunday */\n sunday: string;\n /** String for Monday */\n monday: string;\n /** String for Tuesday */\n tuesday: string;\n /** String for Wednesday */\n wednesday: string;\n /** String for Thursday */\n thursday: string;\n /** String for Friday */\n friday: string;\n /** String for Saturday */\n saturday: string;\n /** String for Yesterday */\n yesterday: string;\n /** String for participants joined */\n participantJoined: string;\n /** String for participants left */\n participantLeft: string;\n}\n\nexport interface JumpToNewMessageButtonProps {\n onClick: () => void;\n}\n\nconst DefaultJumpToNewMessageButton = (props: JumpToNewMessageButtonProps): JSX.Element => {\n const { onClick } = props;\n return (\n <PrimaryButton className={newMessageButtonStyle} onClick={onClick}>\n <Icon iconName=\"Down\" className={DownIconStyle} />\n {NEW_MESSAGES}\n </PrimaryButton>\n );\n};\n\nconst generateParticipantsStr = (participants: CommunicationParticipant[]): string =>\n participants\n .map(\n (participant) =>\n `${!participant.displayName || participant.displayName === '' ? 'No name' : participant.displayName}`\n )\n .join(', ');\n\nexport type DefaultMessageRendererType = (props: MessageProps, ids?: { messageTimestamp?: string }) => JSX.Element;\n\nconst ParticipantSystemMessageComponent = ({\n payload,\n style\n}: {\n payload: SystemMessagePayload<'participantAdded' | 'participantRemoved'>;\n style?: ComponentSlotStyle;\n}): JSX.Element => {\n const { strings } = useLocale();\n const participantsStr = generateParticipantsStr(payload.participants);\n const messageSuffix =\n payload.type === 'participantAdded'\n ? strings.messageThread.participantJoined\n : strings.messageThread.participantLeft;\n\n if (participantsStr !== '') {\n return (\n <SystemMessageComponent\n iconName={(payload.iconName ?? '') as SystemMessageIconTypes}\n content={`${participantsStr} ${messageSuffix}`}\n containerStyle={style}\n />\n );\n }\n return <></>;\n};\n\nconst DefaultSystemMessageRenderer: DefaultMessageRendererType = (props: MessageProps) => {\n if (props.message.type === 'system') {\n const payload = props.message.payload;\n if (payload.type === 'content') {\n return (\n <SystemMessageComponent\n iconName={(payload.iconName ?? '') as SystemMessageIconTypes}\n content={payload.content ?? ''}\n containerStyle={props?.messageContainerStyle}\n />\n );\n }\n if (payload.type === 'participantAdded' || payload.type === 'participantRemoved') {\n return <ParticipantSystemMessageComponent payload={payload} style={props.messageContainerStyle} />;\n }\n }\n return <></>;\n};\n\nconst memoizeAllMessages = memoizeFnAll(\n (\n _messageKey: string,\n message: ChatMessage | SystemMessage | CustomMessage,\n showMessageDate: boolean,\n showMessageStatus: boolean,\n onRenderAvatar: OnRenderAvatarCallback | undefined,\n styles: MessageThreadStylesProps | undefined,\n onRenderMessageStatus:\n | ((messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null)\n | undefined,\n defaultStatusRenderer: (status: MessageStatus) => JSX.Element,\n defaultChatMessageRenderer: (message: MessageProps) => JSX.Element,\n strings: MessageThreadStrings,\n _attached?: boolean | string,\n statusToRender?: MessageStatus,\n onRenderMessage?: (message: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element,\n onUpdateMessage?: (messageId: string, content: string) => Promise<void>,\n onDeleteMessage?: (messageId: string) => Promise<void>\n ): ShorthandValue<ChatItemProps> => {\n const messageProps: MessageProps = {\n message,\n strings,\n showDate: showMessageDate,\n onUpdateMessage,\n onDeleteMessage\n };\n\n if (message.type === 'chat') {\n const payload: ChatMessagePayload = message.payload;\n messageProps.messageContainerStyle = styles?.chatMessageContainer;\n\n const chatMessageComponent =\n onRenderMessage === undefined\n ? defaultChatMessageRenderer(messageProps)\n : onRenderMessage(messageProps, defaultChatMessageRenderer);\n\n const personaOptions: IPersona = {\n text: payload.senderDisplayName,\n hidePersonalDetails: true,\n size: PersonaSize.size32\n };\n\n return {\n gutter: payload.mine ? (\n ''\n ) : onRenderAvatar ? (\n onRenderAvatar(payload.senderId ?? '', personaOptions)\n ) : (\n <Persona {...personaOptions} />\n ),\n contentPosition: payload.mine ? 'end' : 'start',\n message: {\n className: mergeStyles({ width: 'calc(100% - 6.25rem)' }),\n content: (\n <Flex hAlign={payload.mine ? 'end' : undefined} vAlign=\"end\">\n {chatMessageComponent}\n <div\n className={mergeStyles(\n messageStatusContainerStyle(payload.mine ?? false),\n styles?.messageStatusContainer ? styles.messageStatusContainer(payload.mine ?? false) : ''\n )}\n >\n {showMessageStatus && statusToRender ? (\n onRenderMessageStatus ? (\n onRenderMessageStatus({ status: statusToRender })\n ) : (\n defaultStatusRenderer(statusToRender)\n )\n ) : (\n <div className={mergeStyles(noMessageStatusStyle)} />\n )}\n </div>\n </Flex>\n )\n },\n attached: payload.attached,\n key: _messageKey\n };\n } else if (message.type === 'system') {\n messageProps.messageContainerStyle = styles?.systemMessageContainer;\n\n const systemMessageComponent =\n onRenderMessage === undefined ? (\n <DefaultSystemMessageRenderer {...messageProps} />\n ) : (\n onRenderMessage(messageProps, (props) => <DefaultSystemMessageRenderer {...props} />)\n );\n\n return {\n children: systemMessageComponent,\n key: _messageKey\n };\n } else {\n // We do not handle custom type message by default, users can handle custom type by using onRenderMessage function.\n const customMessageComponent = onRenderMessage === undefined ? <></> : onRenderMessage(messageProps);\n return {\n children: customMessageComponent,\n key: _messageKey\n };\n }\n }\n);\n\nconst getLastChatMessageIdWithStatus = (\n messages: (ChatMessage | SystemMessage | CustomMessage)[],\n status: MessageStatus\n): string | undefined => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i];\n if (message.type === 'chat' && message.payload.status === status && message.payload.mine) {\n return message.payload.messageId;\n }\n }\n return undefined;\n};\n\n/**\n * Props for MessageThread component\n */\nexport type MessageThreadProps = {\n /**\n * UserId of the current user.\n */\n userId: string;\n /**\n * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage` or `CustomMessage`.\n */\n messages: (ChatMessage | SystemMessage | CustomMessage)[];\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageThread styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: MessageThreadStylesProps;\n /**\n * Whether the new message button is disabled or not.\n *\n * @defaultValue `false`\n */\n disableJumpToNewMessageButton?: boolean;\n /**\n * Whether the date of each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageDate?: boolean;\n /**\n * Whether the status indicator for each message is displayed or not.\n *\n * @defaultValue `false`\n */\n showMessageStatus?: boolean;\n /**\n * Number of chat messages to reload each time onLoadPreviousChatMessages is called.\n *\n * @defaultValue 0\n */\n numberOfChatMessagesToReload?: number;\n /**\n * Optional callback to override actions on message being seen.\n *\n * @param messageId - message Id\n */\n onMessageSeen?: (messageId: string) => Promise<void>;\n /**\n * Optional callback to override render of the message status indicator.\n *\n * @param messageStatusIndicatorProps - props of type MessageStatusIndicatorProps\n */\n onRenderMessageStatus?: (messageStatusIndicatorProps: MessageStatusIndicatorProps) => JSX.Element | null;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n /**\n * Optional callback to override render of the button for jumping to the new message.\n *\n * @param newMessageButtonProps - button props of type JumpToNewMessageButtonProps\n */\n onRenderJumpToNewMessageButton?: (newMessageButtonProps: JumpToNewMessageButtonProps) => JSX.Element;\n /**\n * Optional callback to override loading of previous messages.\n * It accepts the number of history chat messages that we want to load and return a boolean Promise indicating if we have got all the history messages.\n * If the promise resolves to `true`, we have load all chat messages into the message thread and `loadPreviousMessagesButton` will not be rendered anymore.\n */\n onLoadPreviousChatMessages?: (messagesToLoad: number) => Promise<boolean>;\n /**\n * Optional callback to override render of a message.\n *\n * @param messageProps - props of type MessageProps\n * @param defaultOnRender - default render of type DefaultMessageRendererType\n *\n * @remarks\n * `defaultOnRender` is not provided for `CustomMessage` and thus only available for `ChatMessage` and `SystemMessage`.\n */\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element;\n\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: (messageId: string, content: string) => Promise<void>;\n\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n\n /**\n * Whether disable the editing feature, false by default\n */\n editDisabled?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MessageThreadStrings>;\n};\n\n/**\n * Props for MessageThread component\n */\nexport type MessageProps = {\n /**\n * Message to render. It can type `ChatMessage` or `SystemMessage` or `CustomMessage`.\n */\n message: ChatMessage | SystemMessage | CustomMessage;\n /**\n * Strings from parent MessageThread component\n */\n strings: MessageThreadStrings;\n /**\n * Custom CSS styles for chat message container.\n */\n messageContainerStyle?: ComponentSlotStyle;\n /**\n * Whether the date of a message is displayed or not.\n *\n * @defaultValue `false`\n */\n showDate?: boolean;\n /**\n * Whether edit feature is disabled or not\n */\n editDisabled?: boolean;\n /**\n * Optional callback to edit a message.\n *\n * @param messageId - message id from chatClient\n * @param content - new content of the message\n *\n */\n onUpdateMessage?: (messageId: string, content: string) => Promise<void>;\n\n /**\n * Optional callback to delete a message.\n *\n * @param messageId - message id from chatClient\n *\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n};\n\n/**\n * `MessageThread` allows you to easily create a component for rendering chat messages, handling scrolling behavior of new/old messages and customizing icons & controls inside the chat thread.\n * @param props - of type MessageThreadProps\n *\n * Users will need to provide at least chat messages and userId to render the `MessageThread` component.\n * Users can also customize `MessageThread` by passing in their own Avatar, `MessageStatusIndicator` icon, `JumpToNewMessageButton`, `LoadPreviousMessagesButton` and the behavior of these controls.\n *\n * `MessageThread` internally uses the `Chat` & `Chat.Message` component from `@fluentui/react-northstar`. You can checkout the details about these [two components](https://fluentsite.z22.web.core.windows.net/0.53.0/components/chat/props).\n */\nexport const MessageThread = (props: MessageThreadProps): JSX.Element => {\n const {\n messages: newMessages,\n userId,\n styles,\n disableJumpToNewMessageButton = false,\n showMessageDate = false,\n showMessageStatus = false,\n numberOfChatMessagesToReload = 0,\n onMessageSeen,\n onRenderMessageStatus,\n onRenderAvatar,\n onLoadPreviousChatMessages,\n onRenderJumpToNewMessageButton,\n onRenderMessage,\n onUpdateMessage,\n onDeleteMessage\n } = props;\n\n const [messages, setMessages] = useState<(ChatMessage | SystemMessage | CustomMessage)[]>([]);\n // We need this state to wait for one tick and scroll to bottom after messages have been initialized.\n // Otherwise chatScrollDivRef.current.clientHeight is wrong if we scroll to bottom before messages are initialized.\n const [chatMessagesInitialized, setChatMessagesInitialized] = useState<boolean>(false);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n const [forceUpdate, setForceUpdate] = useState<number>(0);\n\n // Used to decide if should auto scroll to bottom or show \"new message\" button\n const [latestPreviousChatMessage, setLatestPreviousChatMessage] = useState<ChatMessagePayload | undefined>(undefined);\n const [latestCurrentChatMessage, setLatestCurrentChatMessage] = useState<ChatMessagePayload | undefined>(undefined);\n const [existsNewChatMessage, setExistsNewChatMessage] = useState<boolean>(false);\n\n const [lastSeenChatMessage, setLastSeenChatMessage] = useState<string | undefined>(undefined);\n const [lastDeliveredChatMessage, setLastDeliveredChatMessage] = useState<string | undefined>(undefined);\n const [lastSendingChatMessage, setLastSendingChatMessage] = useState<string | undefined>(undefined);\n\n const isAllChatMessagesLoadedRef = useRef(false);\n\n const previousTopRef = useRef<number>(-1);\n const previousHeightRef = useRef<number>(-1);\n\n const messageIdSeenByMeRef = useRef<string>('');\n\n const chatScrollDivRef = useRef<HTMLElement>(null);\n const chatThreadRef = useRef<HTMLElement>(null);\n const isLoadingChatMessagesRef = useRef(false);\n\n const messagesRef = useRef(messages);\n const setMessagesRef = (messagesWithAttachedValue: (ChatMessage | SystemMessage | CustomMessage)[]): void => {\n messagesRef.current = messagesWithAttachedValue;\n setMessages(messagesWithAttachedValue);\n };\n\n const isAtBottomOfScrollRef = useRef(isAtBottomOfScroll);\n const setIsAtBottomOfScrollRef = (isAtBottomOfScrollValue: boolean): void => {\n isAtBottomOfScrollRef.current = isAtBottomOfScrollValue;\n setIsAtBottomOfScroll(isAtBottomOfScrollValue);\n };\n\n const chatMessagesInitializedRef = useRef(chatMessagesInitialized);\n const setChatMessagesInitializedRef = (chatMessagesInitialized: boolean): void => {\n chatMessagesInitializedRef.current = chatMessagesInitialized;\n setChatMessagesInitialized(chatMessagesInitialized);\n };\n\n // we try to only send those message status if user is scrolled to the bottom.\n const sendMessageStatusIfAtBottom = useCallback(async (): Promise<void> => {\n if (\n !isAtBottomOfScrollRef.current ||\n !document.hasFocus() ||\n !messagesRef.current ||\n messagesRef.current.length === 0 ||\n !showMessageStatus\n ) {\n return;\n }\n const messagesWithId = messagesRef.current.filter((message) => {\n return message.type === 'chat' && !message.payload.mine && !!message.payload.messageId;\n });\n if (messagesWithId.length === 0) {\n return;\n }\n const lastMessage: ChatMessage = messagesWithId[messagesWithId.length - 1] as ChatMessage;\n\n try {\n if (\n onMessageSeen &&\n lastMessage &&\n lastMessage.payload.messageId &&\n lastMessage.payload.messageId !== messageIdSeenByMeRef.current\n ) {\n await onMessageSeen(lastMessage.payload.messageId);\n messageIdSeenByMeRef.current = lastMessage.payload.messageId;\n }\n } catch (e) {\n console.log('onMessageSeen Error', lastMessage, e);\n }\n }, [showMessageStatus, onMessageSeen]);\n\n const scrollToBottom = useCallback((): void => {\n if (chatScrollDivRef.current) {\n chatScrollDivRef.current.scrollTop = chatScrollDivRef.current.scrollHeight;\n }\n setExistsNewChatMessage(false);\n setIsAtBottomOfScrollRef(true);\n sendMessageStatusIfAtBottom();\n }, [sendMessageStatusIfAtBottom]);\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n const atBottom =\n Math.floor(chatScrollDivRef.current.scrollTop) >=\n chatScrollDivRef.current.scrollHeight - chatScrollDivRef.current.clientHeight;\n if (atBottom) {\n sendMessageStatusIfAtBottom();\n if (!isAtBottomOfScrollRef.current) {\n scrollToBottom();\n }\n }\n setIsAtBottomOfScrollRef(atBottom);\n }, [scrollToBottom, sendMessageStatusIfAtBottom]);\n\n // Infinite scrolling + threadInitialize function\n const fetchNewMessageWhenAtTop = useCallback(async () => {\n if (chatScrollDivRef.current && !isLoadingChatMessagesRef.current) {\n if (onLoadPreviousChatMessages) {\n isLoadingChatMessagesRef.current = true;\n // Fetch message until scrollTop reach the threshold for fetching new message\n while (!isAllChatMessagesLoadedRef.current && chatScrollDivRef.current.scrollTop <= 500) {\n isAllChatMessagesLoadedRef.current = await onLoadPreviousChatMessages(numberOfChatMessagesToReload);\n // Release CPU resources for 200 milliseconds between each loop.\n await delay(200);\n }\n isLoadingChatMessagesRef.current = false;\n }\n }\n }, [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);\n\n const handleInfiniteScroll = useCallback((): void => {\n if (!chatScrollDivRef.current) {\n return;\n }\n\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n // The below 2 of useEffects are design for fixing infinite scrolling problem\n // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)\n // we need to get previousTop before it prepend contents\n // Execute order [newMessage useEffect] => get previousTop => dom update => [messages useEffect]\n useEffect(() => {\n if (!chatScrollDivRef.current) return;\n previousTopRef.current = chatScrollDivRef.current.scrollTop;\n previousHeightRef.current = chatScrollDivRef.current.scrollHeight;\n }, [newMessages]);\n\n useEffect(() => {\n if (!chatScrollDivRef.current) return;\n if (previousTopRef.current === 0) {\n const currentHeight = chatScrollDivRef.current.scrollHeight;\n chatScrollDivRef.current.scrollTop =\n chatScrollDivRef.current.scrollTop + currentHeight - previousHeightRef.current;\n }\n }, [messages]);\n\n // Fetch more messages to make the scroll bar appear, infinity scroll is then handled in the handleScroll function.\n useEffect(() => {\n fetchNewMessageWhenAtTop();\n }, [fetchNewMessageWhenAtTop]);\n\n /**\n * One time run useEffects. Sets up listeners when component is mounted and tears down listeners when component\n * unmounts unless these function changed\n */\n useEffect(() => {\n window && window.addEventListener('click', sendMessageStatusIfAtBottom);\n window && window.addEventListener('focus', sendMessageStatusIfAtBottom);\n return () => {\n window && window.removeEventListener('click', sendMessageStatusIfAtBottom);\n window && window.removeEventListener('focus', sendMessageStatusIfAtBottom);\n };\n }, [sendMessageStatusIfAtBottom]);\n\n useEffect(() => {\n const chatScrollDiv = chatScrollDivRef.current;\n chatScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.addEventListener('scroll', handleInfiniteScroll);\n\n return () => {\n chatScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n chatScrollDiv?.removeEventListener('scroll', handleInfiniteScroll);\n };\n }, [handleInfiniteScroll, handleScrollToTheBottom]);\n\n /**\n * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the\n * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to\n * trigger a re-render until ClientHeight is initialized. This force re-render should only happen once.\n */\n const clientHeight = chatThreadRef.current?.clientHeight;\n useEffect(() => {\n if (clientHeight === undefined) {\n setForceUpdate(forceUpdate + 1);\n return;\n }\n // Only scroll to bottom if isAtBottomOfScrollRef is true\n isAtBottomOfScrollRef.current && scrollToBottom();\n }, [clientHeight, forceUpdate, scrollToBottom, chatMessagesInitialized]);\n\n /**\n * This needs to run to update latestPreviousChatMessage & latestCurrentChatMessage.\n * These two states are used to manipulate scrollbar\n */\n useEffect(() => {\n setLatestPreviousChatMessage(getLatestChatMessage(messagesRef.current));\n setLatestCurrentChatMessage(getLatestChatMessage(newMessages));\n setMessagesRef(newMessages);\n !chatMessagesInitializedRef.current && setChatMessagesInitializedRef(true);\n setLastDeliveredChatMessage(getLastChatMessageIdWithStatus(newMessages, 'delivered'));\n setLastSeenChatMessage(getLastChatMessageIdWithStatus(newMessages, 'seen'));\n setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));\n }, [newMessages]);\n\n /**\n * This needs to run after messages are rendererd so we can manipulate the scroll bar.\n */\n useEffect(() => {\n // If user just sent the latest message then we assume we can move user to bottom of scroll.\n if (\n isThereNewMessageNotFromCurrentUser(latestPreviousChatMessage, latestCurrentChatMessage, userId) &&\n !isAtBottomOfScrollRef.current\n ) {\n setExistsNewChatMessage(true);\n } else if (\n didUserSendTheLatestMessage(latestPreviousChatMessage, latestCurrentChatMessage, userId) ||\n isAtBottomOfScrollRef.current\n ) {\n scrollToBottom();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messages]);\n\n // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp need to be regenerated)\n const defaultChatMessageRenderer = useCallback(\n (messageProps: MessageProps) => {\n if (messageProps.message.type === 'chat') {\n return <ChatMessageComponent {...messageProps} message={messageProps.message} />;\n }\n return <></>;\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [new Date().toDateString()]\n );\n\n const localeStrings = useLocale().strings.messageThread;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n\n const defaultStatusRenderer: (status: MessageStatus) => JSX.Element = useCallback(\n (status: MessageStatus) => <MessageStatusIndicator status={status} />,\n []\n );\n\n const messagesToDisplay = useMemo(\n () =>\n memoizeAllMessages((memoizedMessageFn) => {\n return messages.map(\n (message: ChatMessage | SystemMessage | CustomMessage, index: number): ShorthandValue<ChatItemProps> => {\n let key: string | undefined = message.payload.messageId;\n if (message.type === 'chat' && (!message.payload.messageId || message.payload.messageId === '')) {\n key = message.payload.clientMessageId;\n }\n\n let statusToRender: MessageStatus | undefined = undefined;\n if (message.type === 'chat') {\n if (showMessageStatus && message.payload.mine) {\n switch (message.payload.messageId) {\n case lastSeenChatMessage: {\n statusToRender = 'seen';\n break;\n }\n case lastSendingChatMessage: {\n statusToRender = 'sending';\n break;\n }\n case lastDeliveredChatMessage: {\n statusToRender = 'delivered';\n break;\n }\n }\n }\n if (message.payload.mine && message.payload.status === 'failed') statusToRender = 'failed';\n }\n\n console.log('function: ' + onUpdateMessage);\n\n return memoizedMessageFn(\n key ?? 'id_' + index,\n message,\n showMessageDate,\n showMessageStatus,\n onRenderAvatar,\n styles,\n onRenderMessageStatus,\n defaultStatusRenderer,\n defaultChatMessageRenderer,\n strings,\n // Temporary solution to make sure we re-render if attach attribute is changed.\n // The proper fix should be in selector.\n message.type === 'chat' ? message.payload.attached : undefined,\n statusToRender,\n onRenderMessage,\n onUpdateMessage,\n onDeleteMessage\n );\n }\n );\n }),\n [\n messages,\n showMessageDate,\n showMessageStatus,\n onRenderAvatar,\n styles,\n onRenderMessageStatus,\n defaultStatusRenderer,\n defaultChatMessageRenderer,\n lastSeenChatMessage,\n lastSendingChatMessage,\n lastDeliveredChatMessage,\n onRenderMessage,\n onUpdateMessage,\n onDeleteMessage,\n strings\n ]\n );\n\n const chatBody = useMemo(() => {\n return (\n <LiveAnnouncer>\n <Chat styles={styles?.chatContainer ?? chatStyle} items={messagesToDisplay} />\n </LiveAnnouncer>\n );\n }, [styles?.chatContainer, messagesToDisplay]);\n\n return (\n <Ref innerRef={chatThreadRef}>\n <Stack className={mergeStyles(messageThreadContainerStyle, styles?.root)} grow>\n <Ref innerRef={chatScrollDivRef}>{chatBody}</Ref>\n {existsNewChatMessage && !disableJumpToNewMessageButton && (\n <div className={mergeStyles(newMessageButtonContainerStyle, styles?.newMessageButtonContainer)}>\n {onRenderJumpToNewMessageButton ? (\n onRenderJumpToNewMessageButton({ onClick: scrollToBottom })\n ) : (\n <DefaultJumpToNewMessageButton onClick={scrollToBottom} />\n )}\n </div>\n )}\n </Stack>\n </Ref>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const mediaContainer = mergeStyles({\n position: 'relative',\n height: '100%',\n width: '100%',\n background: 'transparent',\n display: 'flex',\n '& video': {\n borderRadius: '.25rem'\n }\n});\n\nexport const invertedVideoStyle = mergeStyles(mediaContainer, {\n transform: 'rotateY(180deg)'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useEffect, useRef } from 'react';\nimport { invertedVideoStyle, mediaContainer } from './styles/StreamMedia.styles';\nimport { BaseCustomStylesProps } from '../types';\nimport { mergeStyles } from '@fluentui/react';\n\n/**\n * Props for StreamMedia component\n */\nexport interface StreamMediaProps {\n /** Video stream element to render. */\n videoStreamElement: HTMLElement | null;\n /** Decides whether to mirror the video or not. */\n isMirrored?: boolean;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <StreamMedia styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStylesProps;\n}\n\n/**\n * StreamMedia component converts a HTMLElement to a JSX Element.\n * This component becomes very handy when you get the video stream HTMLElement from the calling sdk and want to render it in components like VideoTile.\n */\nexport const StreamMedia = (props: StreamMediaProps): JSX.Element => {\n const containerEl = useRef<HTMLDivElement>(null);\n const { isMirrored, videoStreamElement, styles } = props;\n\n useEffect(() => {\n const container = containerEl.current;\n if (!container) {\n return;\n }\n\n // If videoStreamElement changes, we clear the container to make sure we don't have duplicate, and replace it with\n // the new videoStreamElement. If videoStreamElement is undefined nothing is appended and container should be empty\n // and we don't render anyting.\n container.innerHTML = '';\n if (videoStreamElement) {\n container.appendChild(videoStreamElement);\n }\n\n return () => {\n container.innerHTML = '';\n };\n }, [videoStreamElement]);\n\n return (\n <div className={mergeStyles(isMirrored ? invertedVideoStyle : mediaContainer, styles?.root)} ref={containerEl} />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const participantItemContainerStyle = mergeStyles({\n paddingTop: '0.25rem',\n paddingBottom: '0.25rem',\n display: 'flex',\n maxWidth: '20rem',\n minWidth: '12rem',\n cursor: 'pointer',\n alignItems: 'center'\n});\n\nexport const menuButtonContainerStyle = mergeStyles({\n root: {\n '&:hover': { background: 'none' },\n '&:active': { background: 'none' }\n }\n});\n\nexport const iconContainerStyle = mergeStyles({\n display: 'flex',\n alignItems: 'center',\n height: '100%',\n overflow: 'hidden'\n});\n\nexport const iconStyles = mergeStyles({ display: 'flex', margin: 'auto' });\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ContextualMenu,\n DirectionalHint,\n Icon,\n IContextualMenuItem,\n IRawStyle,\n IStyle,\n mergeStyles,\n Persona,\n PersonaPresence,\n PersonaSize,\n Stack\n} from '@fluentui/react';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { BaseCustomStylesProps, OnRenderAvatarCallback } from '../types';\nimport {\n iconContainerStyle,\n menuButtonContainerStyle,\n participantItemContainerStyle\n} from './styles/ParticipantItem.styles';\n\nexport interface ParticipantItemStylesProps extends BaseCustomStylesProps {\n /** Styles for the avatar. */\n avatar?: IStyle;\n /** Styles for the (You) string. */\n me?: IStyle;\n /** Styles for the container of the icon. */\n iconContainer?: IStyle;\n /** Styles for the menu. */\n menu?: IStyle;\n}\n\n/**\n * Strings of ParticipantItem that can be overridden\n */\nexport interface ParticipantItemStrings {\n /** String shown when participant is me */\n isMeText: string;\n /** String shown when hovering over menu button */\n menuTitle: string;\n}\n\n/**\n * Props for ParticipantItem component\n */\nexport interface ParticipantItemProps {\n /** Unique User ID of the participant. This `userId` is available in the `onRenderAvatar` callback function */\n userId?: string;\n /** Name of participant. */\n displayName: string;\n /** Optional indicator to show participant is the user. */\n me?: boolean;\n /** Optional callback returning a JSX element to override avatar. */\n onRenderAvatar?: OnRenderAvatarCallback;\n /** Optional array of IContextualMenuItem for contextual menu. */\n menuItems?: IContextualMenuItem[];\n /** Optional callback returning a JSX element rendered on the right portion of the ParticipantItem. Intended for adding icons. */\n onRenderIcon?: (props?: ParticipantItemProps) => JSX.Element | null;\n /** Optional PersonaPresence to show participant presence. This will not have an effect if property avatar is assigned. */\n presence?: PersonaPresence;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <ParticipantItem styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: ParticipantItemStylesProps;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<ParticipantItemStrings>;\n}\n\n/**\n * `ParticipantItem` represents a participant in Calling or Chat. `ParticipantItem` displays a participant's avatar,\n * displayName and status as well as optional icons and context menu.\n */\nexport const ParticipantItem = (props: ParticipantItemProps): JSX.Element => {\n const { userId, displayName, onRenderAvatar, menuItems, onRenderIcon, presence, styles, me } = props;\n const [itemHovered, setItemHovered] = useState<boolean>(false);\n const [menuButtonHovered, setMenuButtonHovered] = useState<boolean>(false);\n const [menuHidden, setMenuHidden] = useState<boolean>(true);\n const containerRef = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const localeStrings = useLocale().strings.participantItem;\n\n const isMeText = props.strings?.isMeText ?? localeStrings.isMeText;\n const menuTitle = props.strings?.menuTitle ?? localeStrings.menuTitle;\n\n const avatarOptions = {\n text: displayName,\n size: PersonaSize.size32,\n presence: presence,\n initialsTextColor: 'white'\n };\n\n const avatar = onRenderAvatar ? (\n onRenderAvatar(userId ?? '', avatarOptions)\n ) : (\n <Persona className={mergeStyles(styles?.avatar)} {...avatarOptions} />\n );\n\n const meTextStyle = useMemo(\n () => mergeStyles({ color: theme.palette.neutralTertiary }, styles?.me),\n [theme.palette.neutralTertiary, styles?.me]\n );\n const contextualMenuStyle = useMemo(\n () => mergeStyles({ background: theme.palette.neutralLighterAlt }, styles?.menu),\n [theme.palette.neutralLighterAlt, styles?.menu]\n );\n const iconsContainerWidth = (styles?.iconContainer as IRawStyle)?.width ?? '3.5rem';\n\n const menuButton = useMemo(\n () => (\n <Stack\n horizontalAlign=\"end\"\n onMouseEnter={() => setMenuButtonHovered(true)}\n onMouseLeave={() => setMenuButtonHovered(false)}\n title={menuTitle}\n className={menuButtonContainerStyle}\n onClick={() => setMenuHidden(false)}\n >\n <Icon iconName={menuButtonHovered ? 'ParticipantItemOptionsHovered' : 'ParticipantItemOptions'} />\n </Stack>\n ),\n [menuButtonHovered, menuTitle]\n );\n\n return (\n <div\n ref={containerRef}\n className={mergeStyles(participantItemContainerStyle, styles?.root)}\n onMouseEnter={() => setItemHovered(true)}\n onMouseLeave={() => setItemHovered(false)}\n >\n <Stack horizontal className={mergeStyles({ width: `calc(100% - ${iconsContainerWidth})`, alignItems: 'center' })}>\n {avatar}\n {me && <Stack className={meTextStyle}>{isMeText}</Stack>}\n </Stack>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={mergeStyles(iconContainerStyle, { width: iconsContainerWidth }, styles?.iconContainer)}\n >\n {menuItems && menuItems.length > 0 && (itemHovered || !menuHidden)\n ? menuButton\n : onRenderIcon && onRenderIcon(props)}\n {menuItems && menuItems.length > 0 && (\n <ContextualMenu\n items={menuItems}\n hidden={menuHidden}\n target={containerRef}\n onItemClick={() => setMenuHidden(true)}\n onDismiss={() => setMenuHidden(true)}\n directionalHint={DirectionalHint.bottomRightEdge}\n className={contextualMenuStyle}\n />\n )}\n </Stack>\n </div>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const participantListStyle = mergeStyles({\n height: '100%',\n paddingLeft: '1.125rem',\n paddingRight: '1.125rem'\n});\n\nexport const iconStyles = mergeStyles({ height: '100%', margin: 'auto' });\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Icon, IContextualMenuItem, mergeStyles, PersonaPresence, Stack } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { useIdentifiers } from '../identifiers';\nimport { CallParticipant, CommunicationParticipant, OnRenderAvatarCallback } from '../types';\nimport { ParticipantItem } from './ParticipantItem';\nimport { participantListStyle } from './styles/ParticipantList.styles';\n\n/**\n * Props for component `ParticipantList`\n */\nexport type ParticipantListProps = {\n /** Participants in user call or chat */\n participants: CommunicationParticipant[];\n /** User ID of user */\n myUserId?: string;\n /**\n * If set to `true`, excludes the local participant from the participant list with use of `myUserId` props (required in this case).\n *\n * @defaultValue `false`\n */\n excludeMe?: boolean;\n /** Optional callback to render each participant. If no callback is provided, each participant will be rendered with `ParticipantItem` */\n onRenderParticipant?: (participant: CommunicationParticipant) => JSX.Element | null;\n /** Optional callback to render the avatar for each participant. This property will have no effect if `onRenderParticipant` is assigned. */\n onRenderAvatar?: OnRenderAvatarCallback;\n /** Optional callback to render the context menu for each participant */\n onParticipantRemove?: (userId: string) => void;\n};\n\nconst onRenderParticipantsDefault = (\n participants: CommunicationParticipant[],\n myUserId?: string,\n onParticipantRemove?: (userId: string) => void,\n onRenderAvatar?: OnRenderAvatarCallback\n): (JSX.Element | null)[] => {\n return participants.map((participant: CommunicationParticipant) => {\n // Try to consider CommunicationParticipant as CallParticipant\n const callingParticipant = participant as CallParticipant;\n\n let presence: PersonaPresence | undefined = undefined;\n if (callingParticipant) {\n if (callingParticipant.state === 'Connected') {\n presence = PersonaPresence.online;\n } else if (callingParticipant.state === 'Idle') {\n presence = PersonaPresence.away;\n }\n }\n\n const menuItems: IContextualMenuItem[] = [];\n if (participant.userId !== myUserId && onParticipantRemove) {\n menuItems.push({\n key: 'Remove',\n text: 'Remove',\n onClick: () => onParticipantRemove(participant.userId)\n });\n }\n\n const iconStyles = mergeStyles({ lineHeight: 0 });\n const onRenderIcon =\n callingParticipant?.isScreenSharing || callingParticipant?.isMuted\n ? () => (\n <Stack horizontal={true} tokens={{ childrenGap: '0.5rem' }}>\n {callingParticipant.isScreenSharing && (\n <Icon iconName=\"ParticipantItemScreenShareStart\" className={iconStyles} />\n )}\n {callingParticipant.isMuted && <Icon iconName=\"ParticipantItemMicOff\" className={iconStyles} />}\n </Stack>\n )\n : () => <></>;\n\n if (participant.displayName) {\n return (\n <ParticipantItem\n key={participant.userId}\n userId={participant.userId}\n displayName={participant.displayName}\n me={myUserId ? participant.userId === myUserId : false}\n menuItems={menuItems}\n presence={presence}\n onRenderIcon={onRenderIcon}\n onRenderAvatar={onRenderAvatar}\n />\n );\n }\n return null;\n });\n};\n\n/**\n * `ParticipantList` renders a list of participants in Calling or Chat. If property `onRenderParticipant` is not\n * assigned then each participant is rendered with `ParticipantItem`.\n */\nexport const ParticipantList = (props: ParticipantListProps): JSX.Element => {\n const { excludeMe = false, myUserId, participants, onParticipantRemove, onRenderAvatar, onRenderParticipant } = props;\n const ids = useIdentifiers();\n\n const allParticipants: CommunicationParticipant[] = useMemo(() => {\n if (participants === undefined) {\n return [];\n }\n\n if (!excludeMe || !myUserId) {\n return [...participants];\n }\n\n const userIndex = participants.map((p) => p.userId).indexOf(myUserId);\n\n if (userIndex === -1) {\n return [...participants];\n }\n\n const remoteParticipants = [...participants];\n remoteParticipants.splice(userIndex, 1);\n\n return remoteParticipants;\n }, [participants, excludeMe, myUserId]);\n\n return (\n <Stack data-ui-id={ids.participantList} className={participantListStyle}>\n {onRenderParticipant\n ? participants.map((participant: CommunicationParticipant) => onRenderParticipant(participant))\n : onRenderParticipantsDefault(allParticipants, myUserId, onParticipantRemove, onRenderAvatar)}\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n mergeStyles,\n getTheme,\n IStackStyles,\n IModalStyleProps,\n IModalStyles,\n IStyleFunctionOrObject\n} from '@fluentui/react';\nimport { VideoTileStylesProps } from '../VideoTile';\n\nconst theme = getTheme();\n\nconst videoBaseStyle = mergeStyles({\n border: 0\n});\n\nexport const gridStyle = mergeStyles(videoBaseStyle, {\n width: '100%',\n height: '100%'\n});\n\nexport const videoGalleryContainerStyle: IStackStyles = { root: { position: 'relative', height: '100%' } };\n\nexport const floatingLocalVideoModalStyle: IStyleFunctionOrObject<IModalStyleProps, IModalStyles> = {\n root: {\n width: '100%',\n height: '100%',\n overflow: 'hidden'\n },\n main: {\n minWidth: '11.25rem',\n minHeight: '7rem',\n boxShadow: theme.effects.elevation8,\n borderRadius: theme.effects.roundedCorner4,\n position: 'absolute',\n bottom: '1rem',\n right: '1rem'\n }\n};\n\nexport const floatingLocalVideoTileStyle: VideoTileStylesProps = {\n root: {\n position: 'absolute',\n zIndex: 1,\n bottom: '0',\n right: '0',\n width: '11.25rem',\n height: '7rem',\n borderRadius: theme.effects.roundedCorner4\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, getTheme, mergeStyles } from '@fluentui/react';\n\nconst theme = getTheme();\n\nexport const rootStyles: IStyle = {\n position: 'relative',\n height: '100%',\n width: '100%',\n borderRadius: theme.effects.roundedCorner4\n};\n\nexport const isSpeakingStyles: IStyle = {\n border: `0.25rem solid ${theme.palette.themePrimary}`\n};\n\nexport const videoContainerStyles: IStyle = {\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n minWidth: '100%',\n minHeight: '100%',\n objectPosition: 'center',\n objectFit: 'cover',\n zIndex: 0\n};\n\nexport const overlayContainerStyles: IStyle = {\n width: '100%',\n height: '100%',\n zIndex: 5\n};\n\nexport const disabledVideoHint = mergeStyles({\n backgroundColor: 'inherit',\n bottom: '0.46875rem',\n boxShadow: 'none',\n textAlign: 'left',\n left: '0.5rem',\n overflow: 'hidden',\n position: 'absolute',\n whiteSpace: 'nowrap',\n maxWidth: '95%',\n borderRadius: theme.effects.roundedCorner4,\n alignItems: 'center',\n padding: '0.15rem'\n});\n\nexport const videoHint = mergeStyles(disabledVideoHint, {\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n padding: '0.15rem'\n});\n\nexport const displayNameStyle: IStyle = {\n padding: '0.1rem',\n fontSize: '0.75rem',\n fontWeight: 600\n};\n\nexport const iconContainerStyle: IStyle = {\n padding: '0.1rem',\n height: '100%',\n alignItems: 'center',\n '& svg': {\n display: 'block'\n }\n};\n\nexport const tileInfoStackItemStyle: IStyle = {\n display: 'flex'\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DefaultPalette as palette, Icon, IStyle, mergeStyles, Persona, Stack, Text } from '@fluentui/react';\nimport { Ref } from '@fluentui/react-northstar';\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { useIdentifiers } from '../identifiers';\nimport { useTheme } from '../theming';\nimport { BaseCustomStylesProps, CustomAvatarOptions, OnRenderAvatarCallback } from '../types';\nimport {\n disabledVideoHint,\n displayNameStyle,\n iconContainerStyle,\n isSpeakingStyles,\n overlayContainerStyles,\n rootStyles,\n tileInfoStackItemStyle,\n videoContainerStyles,\n videoHint\n} from './styles/VideoTile.styles';\n\nexport interface VideoTileStylesProps extends BaseCustomStylesProps {\n /** Styles for video container. */\n videoContainer?: IStyle;\n /** Styles for container overlayed on the video container. */\n overlayContainer?: IStyle;\n /** Styles for displayName on the video container. */\n displayNameContainer?: IStyle;\n}\n\n/**\n * Props for VideoTile component\n */\nexport interface VideoTileProps {\n /** React Child components. Child Components will show as overlay component in the VideoTile. */\n children?: React.ReactNode;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <VideoTile styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: VideoTileStylesProps;\n /** user id for the VideoTile placeholder. */\n userId?: string;\n /** Component with the video stream. */\n renderElement?: JSX.Element | null;\n /** Determines if the video is mirrored or not. */\n isMirrored?: boolean;\n /** Custom render Component function for no video is available. Render a Persona Icon if undefined. */\n onRenderPlaceholder?: OnRenderAvatarCallback;\n /**\n * Whether to display a mute icon beside the user's display name.\n */\n showMuteIndicator?: boolean;\n /**\n * Whether the video is muted or not.\n */\n isMuted?: boolean;\n /**\n * Display Name of the Participant\n */\n displayName?: string;\n /** Optional property to set the aria label of the video tile if there is no available stream. */\n noVideoAvailableAriaLabel?: string;\n /** Whether the participant in the videoTile is speaking. Shows a speaking indicator (border). */\n isSpeaking?: boolean;\n}\n\n// Coin max size is set to 100px (PersonaSize.size100)\nconst personaMaxSize = 200;\n\nconst DefaultPlaceholder = (props: CustomAvatarOptions): JSX.Element => {\n const { text, noVideoAvailableAriaLabel, coinSize, styles, hidePersonaDetails } = props;\n\n return (\n <Stack className={mergeStyles({ position: 'absolute', height: '100%', width: '100%' })}>\n <Persona\n styles={styles}\n coinSize={coinSize}\n hidePersonaDetails={hidePersonaDetails}\n text={text ?? ''}\n initialsTextColor=\"white\"\n aria-label={noVideoAvailableAriaLabel ?? ''}\n />\n </Stack>\n );\n};\n\nconst defaultPersonaStyles = { root: { margin: 'auto', maxHeight: '100%' } };\n\nexport const VideoTile = (props: VideoTileProps): JSX.Element => {\n const {\n children,\n displayName,\n isMirrored,\n isMuted,\n onRenderPlaceholder,\n renderElement,\n showMuteIndicator = true,\n styles,\n userId,\n noVideoAvailableAriaLabel,\n isSpeaking\n } = props;\n\n const [personaSize, setPersonaSize] = useState(100);\n const videoTileRef = useRef<HTMLElement>(null);\n\n const theme = useTheme();\n\n const isVideoRendered = !!renderElement;\n\n useLayoutEffect(() => {\n if (videoTileRef.current && videoTileRef.current) {\n const minSize = Math.min(videoTileRef.current.clientHeight, videoTileRef.current.clientWidth, personaMaxSize);\n setPersonaSize(minSize / 2);\n }\n }, [videoTileRef.current?.clientHeight, videoTileRef.current?.clientWidth]);\n\n const placeholderOptions = {\n userId,\n text: displayName,\n noVideoAvailableAriaLabel,\n coinSize: personaSize,\n styles: defaultPersonaStyles,\n hidePersonaDetails: true\n };\n\n const nametagColorOverride = useMemo(\n () => ({ color: isVideoRendered ? palette.neutralPrimary : theme.palette.neutralPrimary }),\n [isVideoRendered, theme.palette.neutralPrimary]\n );\n\n const tileInfoContainerStyle = useMemo(\n () =>\n mergeStyles(\n isVideoRendered ? videoHint : disabledVideoHint,\n // when video is being rendered, the displayName has a grey-ish background, so no use of theme\n nametagColorOverride,\n styles?.displayNameContainer\n ),\n [isVideoRendered, nametagColorOverride, styles?.displayNameContainer]\n );\n\n const tileInfoDisplayNameStyle = useMemo(\n () => mergeStyles(displayNameStyle, nametagColorOverride),\n [nametagColorOverride]\n );\n\n const ids = useIdentifiers();\n\n return (\n <Ref innerRef={videoTileRef}>\n <Stack\n data-ui-id={ids.videoTile}\n className={mergeStyles(\n rootStyles,\n isSpeaking ? isSpeakingStyles : {},\n { background: theme.palette.neutralLighter },\n styles?.root\n )}\n >\n {isVideoRendered ? (\n <Stack\n className={mergeStyles(\n videoContainerStyles,\n isMirrored && { transform: 'scaleX(-1)' },\n styles?.videoContainer\n )}\n >\n {renderElement}\n </Stack>\n ) : (\n <Stack className={mergeStyles(videoContainerStyles)}>\n {onRenderPlaceholder ? (\n onRenderPlaceholder(userId ?? '', placeholderOptions, DefaultPlaceholder)\n ) : (\n <DefaultPlaceholder {...placeholderOptions} />\n )}\n </Stack>\n )}\n\n {(displayName || (showMuteIndicator && isMuted !== undefined)) && (\n <Stack horizontal className={tileInfoContainerStyle}>\n {displayName && (\n <Stack.Item className={mergeStyles(tileInfoStackItemStyle)}>\n <Text className={tileInfoDisplayNameStyle}>{displayName}</Text>\n </Stack.Item>\n )}\n {showMuteIndicator && isMuted && (\n <Stack.Item className={mergeStyles(iconContainerStyle, tileInfoStackItemStyle)}>\n <Icon iconName=\"VideoTileMicOff\" />\n </Stack.Item>\n )}\n </Stack>\n )}\n\n {children && (\n <Stack className={mergeStyles(overlayContainerStyles, styles?.overlayContainer)}>{children}</Stack>\n )}\n </Stack>\n </Ref>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ContextualMenu, IDragOptions, Modal, Stack } from '@fluentui/react';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { useIdentifiers } from '../identifiers/IdentifierProvider';\nimport {\n BaseCustomStylesProps,\n OnRenderAvatarCallback,\n VideoGalleryLocalParticipant,\n VideoGalleryRemoteParticipant,\n VideoStreamOptions\n} from '../types';\nimport { GridLayout } from './GridLayout';\nimport { StreamMedia } from './StreamMedia';\nimport {\n floatingLocalVideoModalStyle,\n floatingLocalVideoTileStyle,\n gridStyle,\n videoGalleryContainerStyle\n} from './styles/VideoGallery.styles';\nimport { VideoTile, VideoTileStylesProps } from './VideoTile';\n\nconst emptyStyles = {};\n\n/**\n * Props for component `VideoGallery`\n */\nexport interface VideoGalleryProps {\n /**\n * Allows users to pass an object containing custom CSS styles for the gallery container.\n *\n * @Example\n * ```\n * <VideoGallery styles={{ root: { border: 'solid 1px red' } }} />\n * ```\n */\n styles?: BaseCustomStylesProps;\n /** Layout of the video tiles. */\n layout?: 'default' | 'floatingLocalVideo';\n /** Local video particpant */\n localParticipant: VideoGalleryLocalParticipant;\n /** List of remote video particpants */\n remoteParticipants?: VideoGalleryRemoteParticipant[];\n /** Local video view options */\n localVideoViewOption?: VideoStreamOptions;\n /** Remote videos view options */\n remoteVideoViewOption?: VideoStreamOptions;\n /** Callback to create the local video stream view */\n onCreateLocalStreamView?: (options?: VideoStreamOptions) => Promise<void>;\n /** Callback to dispose of the local video stream view */\n onDisposeLocalStreamView?: () => void;\n /** Callback to render the local video tile*/\n onRenderLocalVideoTile?: (localParticipant: VideoGalleryLocalParticipant) => JSX.Element;\n /** Callback to create a remote video stream view */\n onCreateRemoteStreamView?: (userId: string, options?: VideoStreamOptions) => Promise<void>;\n /** Callback to render a remote video tile */\n onRenderRemoteVideoTile?: (remoteParticipant: VideoGalleryRemoteParticipant) => JSX.Element;\n onDisposeRemoteStreamView?: (userId: string) => Promise<void>;\n /** Callback to render a particpant avatar */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Whether to display a mute icon beside the user's display name.\n * @defaultValue `true`\n */\n showMuteIndicator?: boolean;\n}\n\nconst DRAG_OPTIONS: IDragOptions = {\n moveMenuItemText: 'Move',\n closeMenuItemText: 'Close',\n menu: ContextualMenu,\n keepInBounds: true\n};\n\n/**\n * VideoGallery represents a `GridLayout` of video tiles for a specific call.\n * It displays a `VideoTile` for the local user as well as for each remote participants who joined the call.\n *\n * @param props - of type `VideoGalleryProps`\n *\n * @returns a JSX Element\n */\nexport const VideoGallery = (props: VideoGalleryProps): JSX.Element => {\n const {\n localParticipant,\n remoteParticipants,\n localVideoViewOption,\n remoteVideoViewOption,\n onRenderLocalVideoTile,\n onRenderRemoteVideoTile,\n onCreateLocalStreamView,\n onCreateRemoteStreamView,\n onDisposeRemoteStreamView,\n styles,\n layout,\n onRenderAvatar,\n showMuteIndicator\n } = props;\n\n const ids = useIdentifiers();\n\n const shouldFloatLocalVideo = useCallback((): boolean => {\n return !!(layout === 'floatingLocalVideo' && remoteParticipants && remoteParticipants.length > 0);\n }, [layout, remoteParticipants]);\n\n /**\n * Utility function for memoized rendering of LocalParticipant.\n */\n const defaultOnRenderLocalVideoTile = useMemo((): JSX.Element => {\n const localVideoStream = localParticipant?.videoStream;\n\n if (onRenderLocalVideoTile) return onRenderLocalVideoTile(localParticipant);\n\n let localVideoTileStyles: VideoTileStylesProps = {};\n if (shouldFloatLocalVideo()) {\n localVideoTileStyles = floatingLocalVideoTileStyle;\n }\n\n if (localVideoStream && !localVideoStream.renderElement) {\n onCreateLocalStreamView && onCreateLocalStreamView(localVideoViewOption);\n }\n return (\n <VideoTile\n userId={localParticipant.userId}\n renderElement={\n localVideoStream?.renderElement ? (\n <StreamMedia videoStreamElement={localVideoStream.renderElement} />\n ) : undefined\n }\n displayName={localParticipant?.displayName}\n styles={localVideoTileStyles}\n onRenderPlaceholder={onRenderAvatar}\n isMuted={localParticipant.isMuted}\n showMuteIndicator={showMuteIndicator}\n />\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n localParticipant,\n localParticipant.videoStream,\n onCreateLocalStreamView,\n onRenderLocalVideoTile,\n onRenderAvatar,\n shouldFloatLocalVideo\n ]);\n\n /**\n * Utility function for memoized rendering of RemoteParticipants.\n */\n const defaultOnRenderRemoteParticipants = useMemo(() => {\n // If user provided a custom onRender function return that function.\n if (onRenderRemoteVideoTile) {\n return remoteParticipants?.map((participant) => onRenderRemoteVideoTile(participant));\n }\n\n // Else return Remote Stream Video Tiles\n return remoteParticipants?.map((participant): JSX.Element => {\n const remoteVideoStream = participant.videoStream;\n return (\n <RemoteVideoTile\n key={participant.userId}\n userId={participant.userId}\n onCreateRemoteStreamView={onCreateRemoteStreamView}\n onDisposeRemoteStreamView={onDisposeRemoteStreamView}\n isAvailable={remoteVideoStream?.isAvailable}\n isMuted={participant.isMuted}\n isSpeaking={participant.isSpeaking}\n renderElement={remoteVideoStream?.renderElement}\n displayName={participant.displayName}\n remoteVideoViewOption={remoteVideoViewOption}\n onRenderAvatar={onRenderAvatar}\n showMuteIndicator={showMuteIndicator}\n />\n );\n });\n }, [\n remoteParticipants,\n onRenderRemoteVideoTile,\n onCreateRemoteStreamView,\n onDisposeRemoteStreamView,\n remoteVideoViewOption,\n onRenderAvatar,\n showMuteIndicator\n ]);\n\n if (shouldFloatLocalVideo()) {\n const floatingTileHostId = 'UILibraryFloatingTileHost';\n return (\n <Stack id={floatingTileHostId} grow styles={videoGalleryContainerStyle}>\n <Modal\n isOpen={true}\n isModeless={true}\n dragOptions={DRAG_OPTIONS}\n styles={floatingLocalVideoModalStyle}\n layerProps={{ hostId: floatingTileHostId }}\n >\n {localParticipant && defaultOnRenderLocalVideoTile}\n </Modal>\n <GridLayout styles={styles ?? emptyStyles}>{defaultOnRenderRemoteParticipants}</GridLayout>\n </Stack>\n );\n }\n\n return (\n <GridLayout styles={styles ?? emptyStyles}>\n <Stack data-ui-id={ids.videoGallery} horizontalAlign=\"center\" verticalAlign=\"center\" className={gridStyle} grow>\n {localParticipant && defaultOnRenderLocalVideoTile}\n </Stack>\n {defaultOnRenderRemoteParticipants}\n </GridLayout>\n );\n};\n\n// Use React.memo to create memoize cache for each RemoteVideoTile\nconst RemoteVideoTile = React.memo(\n (props: {\n userId: string;\n onCreateRemoteStreamView?: (userId: string, options?: VideoStreamOptions) => Promise<void>;\n onDisposeRemoteStreamView?: (userId: string) => Promise<void>;\n isAvailable?: boolean;\n isMuted?: boolean;\n isSpeaking?: boolean;\n renderElement?: HTMLElement;\n displayName?: string;\n remoteVideoViewOption?: VideoStreamOptions;\n onRenderAvatar?: OnRenderAvatarCallback;\n showMuteIndicator?: boolean;\n }) => {\n const {\n isAvailable,\n isMuted,\n isSpeaking,\n onCreateRemoteStreamView,\n onDisposeRemoteStreamView,\n remoteVideoViewOption,\n renderElement,\n userId,\n displayName,\n onRenderAvatar,\n showMuteIndicator\n } = props;\n\n useEffect(() => {\n if (isAvailable && !renderElement) {\n onCreateRemoteStreamView && onCreateRemoteStreamView(userId, remoteVideoViewOption);\n }\n if (!isAvailable) {\n onDisposeRemoteStreamView && onDisposeRemoteStreamView(userId);\n }\n }, [\n isAvailable,\n onCreateRemoteStreamView,\n onDisposeRemoteStreamView,\n remoteVideoViewOption,\n renderElement,\n userId\n ]);\n\n useEffect(() => {\n return () => {\n onDisposeRemoteStreamView && onDisposeRemoteStreamView(userId);\n };\n }, [onDisposeRemoteStreamView, userId]);\n\n const renderVideoStreamElement = useMemo(() => {\n // Checking if renderElement is well defined or not as calling SDK has a number of video streams limitation which\n // implies that, after their threshold, all streams have no child (blank video)\n if (!renderElement || !renderElement.childElementCount) {\n // Returning `undefined` results in the placeholder with avatar being shown\n return undefined;\n }\n\n return <StreamMedia videoStreamElement={renderElement} />;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderElement, renderElement?.childElementCount]);\n\n return (\n <Stack className={gridStyle} key={userId} grow>\n <VideoTile\n userId={userId}\n renderElement={renderVideoStreamElement}\n displayName={displayName}\n onRenderPlaceholder={onRenderAvatar}\n isMuted={isMuted}\n isSpeaking={isSpeaking}\n showMuteIndicator={showMuteIndicator}\n />\n </Stack>\n );\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getTheme, IStyle, IButtonStyles, IContextualMenuStyles, concatStyleSets } from '@fluentui/react';\n\nconst theme = getTheme();\nconst palette = theme.palette;\n\ninterface IControlBarStyles {\n horizontal: IStyle;\n vertical: IStyle;\n dockedTop: IStyle;\n dockedBottom: IStyle;\n dockedLeft: IStyle;\n dockedRight: IStyle;\n floatingTop: IStyle;\n floatingBottom: IStyle;\n floatingLeft: IStyle;\n floatingRight: IStyle;\n}\n\nexport const controlBarStyles: IControlBarStyles = {\n horizontal: {\n flexFlow: 'row nowrap'\n },\n vertical: {\n flexFlow: 'column nowrap',\n maxWidth: '3.5rem'\n },\n dockedTop: {\n flexFlow: 'row nowrap',\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%'\n },\n dockedBottom: {\n flexFlow: 'row nowrap',\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'absolute',\n bottom: 0,\n left: 0,\n width: '100%'\n },\n dockedLeft: {\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'absolute',\n top: 0,\n left: 0,\n height: '100%'\n },\n dockedRight: {\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'absolute',\n top: 0,\n right: 0,\n height: '100%'\n },\n floatingTop: {\n flexFlow: 'row nowrap',\n justifyContent: 'center',\n boxShadow: theme.effects.elevation16,\n borderRadius: theme.effects.roundedCorner6,\n overflow: 'hidden',\n position: 'absolute',\n top: '1rem',\n left: '50%',\n transform: 'translateX(-50%)',\n zIndex: 10\n },\n floatingBottom: {\n flexFlow: 'row nowrap',\n justifyContent: 'center',\n boxShadow: theme.effects.elevation16,\n borderRadius: theme.effects.roundedCorner6,\n overflow: 'hidden',\n position: 'absolute',\n bottom: '1rem',\n left: '50%',\n transform: 'translateX(-50%)',\n zIndex: 10\n },\n floatingLeft: {\n flexFlow: 'column nowrap',\n justifyContent: 'center',\n boxShadow: theme.effects.elevation16,\n borderRadius: theme.effects.roundedCorner6,\n overflow: 'hidden',\n position: 'absolute',\n top: '50%',\n left: '1rem',\n transform: 'translateY(-50%)',\n zIndex: 10\n },\n floatingRight: {\n flexFlow: 'column nowrap',\n justifyContent: 'center',\n boxShadow: theme.effects.elevation16,\n borderRadius: theme.effects.roundedCorner6,\n overflow: 'hidden',\n position: 'absolute',\n top: '50%',\n right: '1rem',\n transform: 'translateY(-50%)',\n zIndex: 10\n }\n};\n\nexport const controlButtonStyles: IButtonStyles = {\n root: {\n background: 'none',\n border: 'none',\n borderRadius: 0,\n minHeight: '3.5rem',\n minWidth: '3.5rem',\n svg: {\n verticalAlign: 'text-top'\n }\n },\n flexContainer: {\n flexFlow: 'column',\n display: 'contents'\n }\n};\n\nexport const controlButtonLabelStyles: IStyle = {\n fontSize: '0.625rem',\n lineHeight: '1rem',\n cursor: 'pointer'\n};\n\nexport const endCallControlButtonStyles: IButtonStyles = concatStyleSets(controlButtonStyles, {\n root: {\n color: palette.white\n },\n rootHovered: {\n color: palette.white\n },\n rootPressed: {\n color: palette.white\n },\n label: {\n color: palette.white\n }\n});\n\n// making it Partial as IContextualMenuStyles has all its props non-optional and we only need title to be defined here\nexport const participantsButtonMenuPropsStyle: Partial<IContextualMenuStyles> = {\n title: {\n background: 'initial',\n paddingLeft: '.5rem',\n fontWeight: 600,\n fontSize: '.75rem'\n }\n};\n\nexport const defaultParticipantListContainerStyle: IStyle = {\n maxHeight: '20rem'\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { DefaultButton, IButtonProps, IRenderFunction, Label, concatStyleSets, mergeStyles } from '@fluentui/react';\nimport { controlButtonLabelStyles, controlButtonStyles } from './styles/ControlBar.styles';\n\n/**\n * Strings of ControlBarButton that can be overridden\n */\nexport interface ControlBarButtonStrings {\n /**\n * Label of the button. This supersedes onLabel or offLabel if used.\n */\n label?: string;\n /**\n * Label of the button shown when the button is checked.\n */\n onLabel?: string;\n /**\n * Label of the button shown when the button is not checked.\n */\n offLabel?: string;\n}\n\n/**\n * Props for ControlBarButton component\n */\nexport interface ControlBarButtonProps extends IButtonProps {\n /**\n * Whether the label is displayed or not.\n *\n * @defaultValue `false`\n */\n showLabel?: boolean;\n\n /**\n * Key to use for the Label component\n */\n labelKey?: string;\n\n /**\n * Optional strings to override in component.\n */\n strings?: ControlBarButtonStrings;\n\n /**\n * Icon to render when the button is checked.\n */\n onRenderOnIcon?: IRenderFunction<IButtonProps>;\n\n /**\n * Icon to render when the button is not checked.\n */\n onRenderOffIcon?: IRenderFunction<IButtonProps>;\n}\n\nconst DefaultRenderText = (props?: ControlBarButtonProps): JSX.Element => {\n const labelText =\n props?.text ?? props?.strings?.label ?? (props?.checked ? props?.strings?.onLabel : props?.strings?.offLabel);\n return (\n <Label key={props?.labelKey} className={mergeStyles(controlButtonLabelStyles, props?.styles?.label)}>\n {labelText}\n </Label>\n );\n};\n\nconst DefaultRenderIcon = (props?: ControlBarButtonProps): JSX.Element | null => {\n return props?.checked\n ? props?.onRenderOnIcon\n ? props?.onRenderOnIcon()\n : null\n : props?.onRenderOffIcon\n ? props?.onRenderOffIcon()\n : null;\n};\n\n/**\n * Default button styled for the Control Bar. This can be used to create custom buttons that are styled the same as other buttons provided by the UI Library.\n */\nexport const ControlBarButton = (props: ControlBarButtonProps): JSX.Element => {\n const componentStyles = concatStyleSets(controlButtonStyles, props.styles ?? {});\n return (\n <DefaultButton\n {...props}\n styles={componentStyles}\n onRenderText={props.showLabel ? props.onRenderText ?? DefaultRenderText : undefined}\n onRenderIcon={props.onRenderIcon ?? DefaultRenderIcon}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback, useState } from 'react';\nimport { useLocale } from '../localization';\nimport { VideoStreamOptions } from '../types';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\n\nconst defaultLocalVideoViewOption = {\n scalingMode: 'Crop',\n isMirrored: true\n} as VideoStreamOptions;\n\n/**\n * Strings of CameraButton that can be overridden\n */\nexport interface CameraButtonStrings {\n /** Label when button is on. */\n onLabel: string;\n /** Label when button is off. */\n offLabel: string;\n}\n\n/**\n * Props for CameraButton component\n */\nexport interface CameraButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onToggleCamera?: (options?: VideoStreamOptions) => Promise<void>;\n\n /**\n * Options for rendering local video view.\n */\n localVideoViewOption?: VideoStreamOptions;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<CameraButtonStrings>;\n}\n\nconst onRenderCameraOnIcon = (): JSX.Element => <Icon iconName=\"ControlButtonCameraOn\" />;\nconst onRenderCameraOffIcon = (): JSX.Element => <Icon iconName=\"ControlButtonCameraOff\" />;\n\n/**\n * `CameraButton` allows you to easily create a component for rendering a camera button.\n * It can be used in your ControlBar component for example.\n *\n * @param props - of type CameraButtonProps\n */\nexport const CameraButton = (props: CameraButtonProps): JSX.Element => {\n const { localVideoViewOption, onToggleCamera } = props;\n const [waitForCamera, setWaitForCamera] = useState(false);\n\n const localeStrings = useLocale().strings.cameraButton;\n const strings = { ...localeStrings, ...props.strings };\n\n const onToggleClick = useCallback(async () => {\n // Throttle click on camera, need to await onToggleCamera then allow another click\n if (onToggleCamera) {\n setWaitForCamera(true);\n await onToggleCamera(localVideoViewOption ?? defaultLocalVideoViewOption);\n setWaitForCamera(false);\n }\n }, [localVideoViewOption, onToggleCamera]);\n\n return (\n <ControlBarButton\n {...props}\n disabled={props.disabled || waitForCamera}\n onClick={onToggleCamera ? onToggleClick : props.onClick}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderCameraOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderCameraOffIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'cameraButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles, Stack } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { BaseCustomStylesProps } from '../types';\nimport { controlBarStyles } from './styles/ControlBar.styles';\nimport { useTheme } from '../theming';\nimport { isDarkThemed } from '../theming/themeUtils';\n\nconst mainDivStyle: IStyle = { position: 'relative', height: '100%', width: '100%' };\n\nexport type ControlBarLayoutType =\n | 'horizontal'\n | 'vertical'\n | 'dockedTop'\n | 'dockedBottom'\n | 'dockedLeft'\n | 'dockedRight'\n | 'floatingTop'\n | 'floatingBottom'\n | 'floatingLeft'\n | 'floatingRight';\n\n/**\n * Props for ControlBar component.\n */\nexport interface ControlBarProps {\n /** React Child components. */\n children?: React.ReactNode;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <ControlBar styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStylesProps;\n /**\n * Changes the layout of the control bar.\n * Available layouts are `horizontal`, `vertical`, `dockedTop`, `dockedBottom`,\n * `dockedLeft`, `dockedRight`, `floatingTop`, `floatingBottom`, `floatingLeft`,\n * `floatingRight`\n * Defaults to a `horizontal` layout.\n */\n layout?: ControlBarLayoutType;\n}\n\n/**\n * `ControlBar` allows you to easily create a component for call controls using\n * [Button](https://developer.microsoft.com/en-us/fluentui#/controls/web/button) component from\n * Fluent UI. Users will need to provide methods to Button components used inside `ControlBar`\n * for altering call behavior.\n */\nexport const ControlBar = (props: ControlBarProps): JSX.Element => {\n const { styles, layout } = props;\n const theme = useTheme();\n const controlBarClassName = useMemo(() => {\n const controlBarStyle = controlBarStyles[layout ?? 'horizontal'];\n // if theme is dark and layout is floating then use palette.neutralQuaternaryAlt as background, otherwise use palette.white\n const backgroundStyle = {\n background:\n isDarkThemed(theme) && layout?.startsWith('floating') ? theme.palette.neutralQuaternaryAlt : theme.palette.white\n };\n // if rtl is true and layout is either floatingTop or floatingBottom then we need to override the transform-style property\n // to translate 50% to right instead of the left\n const transformOverrideStyle =\n theme.rtl && (layout === 'floatingTop' || layout === 'floatingBottom') ? { transform: 'translateX(50%)' } : {};\n return mergeStyles(controlBarStyle, backgroundStyle, transformOverrideStyle, styles?.root);\n }, [layout, styles?.root, theme]);\n return (\n <div className={mergeStyles(mainDivStyle)}>\n <Stack className={controlBarClassName}>{props.children}</Stack>\n </div>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { concatStyleSets, Icon } from '@fluentui/react';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { darkTheme, lightTheme } from '../theming/themes';\nimport { isDarkThemed } from '../theming/themeUtils';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport { endCallControlButtonStyles } from './styles/ControlBar.styles';\n\n/**\n * Strings of EndCallButton that can be overridden\n */\nexport interface EndCallButtonStrings {\n /**\n * Label of button\n */\n label: string;\n}\n\n/**\n * Props for EndCallButton component\n */\nexport interface EndCallButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onHangUp?: () => Promise<void>;\n\n /**\n * Optional strings to override in component\n */\n strings?: EndCallButtonStrings;\n}\n\nconst onRenderEndCallIcon = (): JSX.Element => <Icon iconName=\"ControlButtonEndCall\" />;\n\n/**\n * `EndCallButton` allows you to easily create a component for rendering a end call button. It can be used in your ControlBar component for example.\n *\n * @param props - of type EndCallButtonProps\n */\nexport const EndCallButton = (props: EndCallButtonProps): JSX.Element => {\n const { styles } = props;\n\n const localeStrings = useLocale().strings.endCallButton;\n const strings = { ...localeStrings, ...props.strings };\n\n const isDarkTheme = isDarkThemed(useTheme());\n const componentStyles = concatStyleSets(\n endCallControlButtonStyles,\n {\n root: {\n background: isDarkTheme ? darkTheme.callingPalette.callRed : lightTheme.callingPalette.callRed\n },\n rootHovered: {\n background: isDarkTheme ? darkTheme.callingPalette.callRedDark : lightTheme.callingPalette.callRedDark\n },\n rootPressed: {\n background: isDarkTheme ? darkTheme.callingPalette.callRedDarker : lightTheme.callingPalette.callRedDarker\n }\n },\n styles ?? {}\n );\n\n return (\n <ControlBarButton\n {...props}\n onClick={props.onHangUp ?? props.onClick}\n styles={componentStyles}\n onRenderIcon={props.onRenderIcon ?? onRenderEndCallIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'endCallButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport { Icon } from '@fluentui/react';\n\n/**\n * Strings of MicrophoneButton that can be overridden\n */\nexport interface MicrophoneButtonStrings {\n /** Label when button is on. */\n onLabel: string;\n /** Label when button is off. */\n offLabel: string;\n}\n\n/**\n * Props for MicrophoneButton component\n */\nexport interface MicrophoneButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onToggleMicrophone?: () => Promise<void>;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<MicrophoneButtonStrings>;\n}\n\nconst onRenderMicOnIcon = (): JSX.Element => <Icon iconName=\"ControlButtonMicOn\" />;\nconst onRenderMicOffIcon = (): JSX.Element => <Icon iconName=\"ControlButtonMicOff\" />;\n\n/**\n * `MicrophoneButton` allows you to easily create a component for rendering an audio button. It can be used in your ControlBar component for example.\n * @param props - of type MicrophoneButtonProps\n */\nexport const MicrophoneButton = (props: MicrophoneButtonProps): JSX.Element => {\n const localeStrings = useLocale().strings.microphoneButton;\n const strings = { ...localeStrings, ...props.strings };\n\n return (\n <ControlBarButton\n {...props}\n onClick={props.onToggleMicrophone ?? props.onClick}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderMicOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderMicOffIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'microphoneButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ContextualMenuItemType, Icon, IContextualMenuItem, IContextualMenuProps } from '@fluentui/react';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\n\n/**\n * Device to represent a camera, microphone, or speaker for component OptionsButton component\n */\nexport interface OptionsDevice {\n /**\n * Device unique identifier\n */\n id: string;\n /**\n * Device name\n */\n name: string;\n}\n\n/**\n * Strings of OptionsButton that can be overridden\n */\nexport interface OptionsButtonStrings {\n /**\n * Label of button\n */\n label: string;\n /**\n * Title of camera menu\n */\n cameraMenuTitle: string;\n /**\n * Title of microphone menu\n */\n microphoneMenuTitle: string;\n /**\n * Title of speaker menu\n */\n speakerMenuTitle: string;\n /**\n * Tooltip of camera menu\n */\n cameraMenuTooltip: string;\n /**\n * Tooltip of microphone menu\n */\n microphoneMenuTooltip: string;\n /**\n * Tooltip of speaker menu\n */\n speakerMenuTooltip: string;\n}\n\n/**\n * Props for OptionsButton component\n */\nexport interface OptionsButtonProps extends ControlBarButtonProps {\n /**\n * Available microphones for selection\n */\n microphones?: OptionsDevice[];\n /**\n * Available speakers for selection\n */\n speakers?: OptionsDevice[];\n /**\n * Available cameras for selection\n */\n cameras?: OptionsDevice[];\n /**\n * Microphone that is shown as currently selected\n */\n selectedMicrophone?: OptionsDevice;\n /**\n * Speaker that is shown as currently selected\n */\n selectedSpeaker?: OptionsDevice;\n /**\n * Camera that is shown as currently selected\n */\n selectedCamera?: OptionsDevice;\n /**\n * Callback when a camera is selected\n */\n onSelectCamera?: (device: OptionsDevice) => Promise<void>;\n /**\n * Callback when a microphone is selected\n */\n onSelectMicrophone?: (device: OptionsDevice) => Promise<void>;\n /**\n * Speaker when a speaker is selected\n */\n onSelectSpeaker?: (device: OptionsDevice) => Promise<void>;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<OptionsButtonStrings>;\n}\n\n/**\n * Generates default menuprops for an OptionsButton if the props contain device\n * information and device change handlers.\n * @param props OptionsButtonProps\n * @returns MenuProps\n */\nconst generateDefaultMenuProps = (\n props: OptionsButtonProps,\n strings: OptionsButtonStrings\n): { items: IContextualMenuItem[] } | undefined => {\n const {\n microphones,\n speakers,\n cameras,\n selectedMicrophone,\n selectedSpeaker,\n selectedCamera,\n onSelectCamera,\n onSelectMicrophone,\n onSelectSpeaker\n } = props;\n\n const defaultMenuProps: IContextualMenuProps = {\n items: [],\n\n // Confine the menu to the parents bounds.\n // More info: https://github.com/microsoft/fluentui/issues/18835\n calloutProps: { styles: { root: { maxWidth: '100%' } } }\n };\n\n if (cameras && selectedCamera && onSelectCamera) {\n defaultMenuProps.items.push({\n key: 'sectionCamera',\n title: strings.cameraMenuTooltip,\n itemType: ContextualMenuItemType.Section,\n sectionProps: {\n title: strings.cameraMenuTitle,\n items: cameras.map((camera) => ({\n key: camera.id,\n text: camera.name,\n title: camera.name,\n iconProps: { iconName: 'OptionsCamera', styles: { root: { lineHeight: 0 } } },\n canCheck: true,\n isChecked: camera.id === selectedCamera?.id,\n onClick: () => {\n if (camera.id !== selectedCamera?.id) {\n onSelectCamera(camera);\n }\n }\n }))\n }\n });\n }\n\n if (microphones && selectedMicrophone && onSelectMicrophone) {\n defaultMenuProps.items.push({\n key: 'sectionMicrophone',\n title: strings.microphoneMenuTooltip,\n itemType: ContextualMenuItemType.Section,\n sectionProps: {\n title: strings.microphoneMenuTitle,\n items: microphones.map((microphone) => ({\n key: microphone.id,\n text: microphone.name,\n title: microphone.name,\n iconProps: { iconName: 'OptionsMic', styles: { root: { lineHeight: 0 } } },\n canCheck: true,\n isChecked: microphone.id === selectedMicrophone?.id,\n onClick: () => {\n if (microphone.id !== selectedMicrophone?.id) {\n onSelectMicrophone(microphone);\n }\n }\n }))\n }\n });\n }\n\n if (speakers && selectedSpeaker && onSelectSpeaker) {\n defaultMenuProps.items.push({\n key: 'sectionSpeaker',\n title: strings.speakerMenuTooltip,\n itemType: ContextualMenuItemType.Section,\n sectionProps: {\n title: strings.speakerMenuTitle,\n items: speakers.map((speaker) => ({\n key: speaker.id,\n text: speaker.name,\n title: speaker.name,\n iconProps: { iconName: 'OptionsSpeaker', styles: { root: { lineHeight: 0 } } },\n canCheck: true,\n isChecked: speaker.id === selectedSpeaker?.id,\n onClick: () => {\n if (speaker.id !== selectedSpeaker?.id) {\n onSelectSpeaker(speaker);\n }\n }\n }))\n }\n });\n }\n\n if (defaultMenuProps.items.length === 0) {\n // Avoids creating an empty context menu.\n return undefined;\n }\n return defaultMenuProps;\n};\n\nconst onRenderOptionsIcon = (): JSX.Element => <Icon iconName=\"ControlButtonOptions\" />;\n\n/**\n * `OptionsButton` allows you to easily create a component for rendering an options button. It can be used in your ControlBar component for example.\n * This button should contain dropdown menu items you can define through its property `menuProps`.\n * This `menuProps` property is of type [IContextualMenuProps](https://developer.microsoft.com/en-us/fluentui#/controls/web/contextualmenu#IContextualMenuProps).\n *\n * @param props - of type OptionsButtonProps\n */\nexport const OptionsButton = (props: OptionsButtonProps): JSX.Element => {\n const { onRenderIcon } = props;\n\n const localeStrings = useLocale().strings.optionsButton;\n const strings = { ...localeStrings, ...props.strings };\n\n const defaultMenuProps = generateDefaultMenuProps(props, strings);\n\n return (\n <ControlBarButton\n {...props}\n menuProps={props.menuProps ?? defaultMenuProps}\n menuIconProps={{ hidden: true }}\n onRenderIcon={onRenderIcon ?? onRenderOptionsIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'optionsButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ContextualMenuItemType,\n IContextualMenuItem,\n IContextualMenuProps,\n IStyle,\n Stack,\n mergeStyles,\n Icon\n} from '@fluentui/react';\nimport copy from 'copy-to-clipboard';\nimport React, { useCallback, useMemo } from 'react';\nimport { ParticipantList, ParticipantListProps } from './ParticipantList';\nimport { defaultParticipantListContainerStyle, participantsButtonMenuPropsStyle } from './styles/ControlBar.styles';\nimport { useLocale } from '../localization';\nimport { formatString } from '../localization/localizationUtils';\nimport { ButtonCustomStylesProps } from '../types';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\n\n/**\n * Styles Props for ParticipantsButton component\n */\nexport interface ParticipantsButtonStylesProps extends ButtonCustomStylesProps {\n /** Styles of ParticipantList container */\n participantListContainerStyle?: IStyle;\n}\n\n/**\n * Strings of ParticipantsButtonStrings that can be overridden\n */\nexport interface ParticipantsButtonStrings {\n /**\n * Label of button\n */\n label: string;\n /**\n * Header of menu pop up\n */\n menuHeader: string;\n /**\n * Label of menu button to show list of participants. Placeholders: [numParticipants]\n */\n participantsListButtonLabel: string;\n /**\n * Label of menu button to copy invite link\n */\n copyInviteLinkButtonLabel: string;\n /**\n * Label of menu button to mute all participants\n */\n muteAllButtonLabel: string;\n}\n\n/**\n * Props for ParticipantsButton component\n */\nexport interface ParticipantsButtonProps extends ControlBarButtonProps, ParticipantListProps {\n /**\n * Optional callback to render the participant list.\n */\n onRenderParticipantList?: (props: ParticipantListProps) => JSX.Element | null;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <ParticipantsButton styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: ParticipantsButtonStylesProps;\n /**\n * URL to invite new participants to the current call\n */\n callInvitationURL?: string;\n /**\n * CallBack to mute all remote participants\n */\n onMuteAll?: () => void;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<ParticipantsButtonStrings>;\n}\n\nconst onRenderPeopleIcon = (): JSX.Element => {\n return <Icon iconName=\"ControlButtonParticipants\" />;\n};\n\n/**\n * `ParticipantsButton` allows you to easily create a component rendering a participants button. It can be used in your ControlBar component for example.\n * This button contains dropdown menu items defined through its property `menuProps`. By default, it can display the number of remote participants with the full list\n * as sub-menu and an option to mute all participants, as well as a copy-to-clipboard button to copy the call invitation URL.\n * This `menuProps` can be fully redefined and its property is of type [IContextualMenuProps](https://developer.microsoft.com/en-us/fluentui#/controls/web/contextualmenu#IContextualMenuProps).\n *\n * @param props - of type ParticipantsButtonProps\n */\nexport const ParticipantsButton = (props: ParticipantsButtonProps): JSX.Element => {\n const { callInvitationURL, styles, onMuteAll, onRenderIcon, onRenderParticipantList } = props;\n\n const onMuteAllCallback = useCallback(() => {\n if (onMuteAll) {\n onMuteAll();\n }\n }, [onMuteAll]);\n\n const { participants, myUserId, excludeMe, onRenderParticipant, onRenderAvatar, onParticipantRemove } = props;\n const defaultParticipantList = useCallback(() => {\n return (\n <Stack className={mergeStyles(defaultParticipantListContainerStyle, styles?.participantListContainerStyle)}>\n <ParticipantList\n participants={participants}\n myUserId={myUserId}\n excludeMe={excludeMe}\n onRenderParticipant={onRenderParticipant}\n onRenderAvatar={onRenderAvatar}\n onParticipantRemove={onParticipantRemove}\n />\n </Stack>\n );\n }, [\n excludeMe,\n myUserId,\n onParticipantRemove,\n onRenderAvatar,\n onRenderParticipant,\n participants,\n styles?.participantListContainerStyle\n ]);\n\n const onCopyCallback = useCallback(() => {\n if (callInvitationURL) {\n return copy(callInvitationURL);\n }\n return false;\n }, [callInvitationURL]);\n\n const localeStrings = useLocale().strings.participantsButton;\n const strings = useMemo(() => ({ ...localeStrings, ...props.strings }), [localeStrings, props.strings]);\n const participantCount = participants.length;\n\n const generateDefaultParticipantsSubMenuProps = useCallback((): IContextualMenuItem[] => {\n const items: IContextualMenuItem[] = [];\n\n if (participantCount > 0) {\n items.push({\n key: 'participantListMenuItemKey',\n onRender: onRenderParticipantList ?? defaultParticipantList\n });\n\n items.push({ key: 'participantsDivider1', itemType: ContextualMenuItemType.Divider });\n\n if (onMuteAll) {\n items.push({\n key: 'muteAllKey',\n text: strings.muteAllButtonLabel,\n title: strings.muteAllButtonLabel,\n iconProps: { iconName: 'MicOff2' },\n onClick: onMuteAllCallback\n });\n }\n }\n\n return items;\n }, [\n participantCount,\n onRenderParticipantList,\n defaultParticipantList,\n onMuteAll,\n strings.muteAllButtonLabel,\n onMuteAllCallback\n ]);\n\n const defaultMenuProps = useMemo((): IContextualMenuProps => {\n const menuProps: IContextualMenuProps = {\n title: strings.menuHeader,\n styles: participantsButtonMenuPropsStyle,\n items: []\n };\n\n if (participantCount > 0) {\n const participantIds = participants.map((p) => p.userId);\n\n let participantCountWithoutMe = participantIds.length;\n if (excludeMe) {\n participantCountWithoutMe -= 1;\n }\n\n menuProps.items.push({\n key: 'participantCountKey',\n name: formatString(strings.participantsListButtonLabel, { numParticipants: `${participantCountWithoutMe}` }),\n iconProps: { iconName: 'People' },\n subMenuProps: {\n items: generateDefaultParticipantsSubMenuProps(),\n\n // Confine the menu to the parents bounds.\n // More info: https://github.com/microsoft/fluentui/issues/18835\n calloutProps: { styles: { root: { maxWidth: '100%' } } }\n }\n });\n }\n\n if (callInvitationURL) {\n menuProps.items.push({\n key: 'InviteLinkKey',\n name: strings.copyInviteLinkButtonLabel,\n title: strings.copyInviteLinkButtonLabel,\n iconProps: { iconName: 'Link' },\n onClick: onCopyCallback\n });\n }\n\n return menuProps;\n }, [\n strings.menuHeader,\n strings.participantsListButtonLabel,\n strings.copyInviteLinkButtonLabel,\n participantCount,\n callInvitationURL,\n participants,\n excludeMe,\n generateDefaultParticipantsSubMenuProps,\n onCopyCallback\n ]);\n\n return (\n <ControlBarButton\n {...props}\n menuProps={props.menuProps ?? defaultMenuProps}\n menuIconProps={{ hidden: true }}\n onRenderIcon={onRenderIcon ?? onRenderPeopleIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'participantsButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\nimport { Icon } from '@fluentui/react';\n\n/**\n * Strings of ScreenShareButton that can be overridden\n */\nexport interface ScreenShareButtonStrings {\n /** Label when button is on. */\n onLabel: string;\n /** Label when button is off. */\n offLabel: string;\n}\n\n/**\n * Props for ScreenShareButton component\n */\nexport interface ScreenShareButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onToggleScreenShare?: () => Promise<void>;\n\n /**\n * Optional strings to override in component\n */\n strings?: Partial<ScreenShareButtonStrings>;\n}\n\nconst onRenderScreenShareOnIcon = (): JSX.Element => <Icon iconName=\"ControlButtonScreenShareStop\" />;\nconst onRenderScreenShareOffIcon = (): JSX.Element => <Icon iconName=\"ControlButtonScreenShareStart\" />;\n\n/**\n * `ScreenShareButton` allows you to easily create a component for rendering a screen-share button.\n * It can be used in your ControlBar component for example.\n *\n * @param props - of type ScreenShareButtonProps\n */\nexport const ScreenShareButton = (props: ScreenShareButtonProps): JSX.Element => {\n const localeStrings = useLocale().strings.screenShareButton;\n const strings = { ...localeStrings, ...props.strings };\n\n return (\n <ControlBarButton\n {...props}\n onClick={props.onToggleScreenShare ?? props.onClick}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderScreenShareOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderScreenShareOffIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'screenShareButtonLabel'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ReactElement, useContext } from 'react';\nimport { StatefulCallClient } from '@internal/calling-stateful-client';\nimport { createDefaultCallingHandlersForComponent } from '../handlers/createHandlers';\nimport { CallClientContext, useCall, useCallAgent, useDeviceManager } from '../providers';\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(component: (props: PropsT) => ReactElement | null) => {\n const callClient: StatefulCallClient = (useContext(CallClientContext) as any)?.callClient;\n const callAgent = useCallAgent();\n const deviceManager = useDeviceManager();\n const call = useCall();\n if (!callClient) return undefined;\n\n return createDefaultCallingHandlersForComponent(callClient, callAgent, deviceManager, call, component);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallClientState, StatefulCallClient } from '@internal/calling-stateful-client';\nimport { CallClientContext, useCall } from '../providers';\n\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\n\nexport const useSelector = <\n SelectorT extends (state: CallClientState, props: any) => any,\n ParamT extends SelectorT | undefined\n>(\n selector: ParamT,\n selectorProps?: Parameters<SelectorT>[1]\n): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const callClient: StatefulCallClient | undefined = useContext(CallClientContext)?.callClient;\n const callId = useCall()?.id;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const callIdConfigProps = useMemo(\n () => ({\n callId\n }),\n [callId]\n );\n\n const [props, setProps] = useState(\n callClient && selector ? selector(callClient.getState(), selectorProps ?? callIdConfigProps) : undefined\n );\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!callClient || !selector) return;\n const onStateChange = (state: CallClientState): void => {\n if (!mounted.current) {\n return;\n }\n const newProps = selector(state, selectorProps ?? callIdConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n callClient.onStateChange(onStateChange);\n return () => {\n callClient.offStateChange(onStateChange);\n };\n }, [callClient, selector, selectorProps, callIdConfigProps, mounted]);\n return selector ? props : undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CameraButton,\n EndCallButton,\n ErrorBar,\n MicrophoneButton,\n OptionsButton,\n ParticipantList,\n ScreenShareButton,\n VideoGallery\n} from '@internal/react-components';\nimport {\n cameraButtonSelector,\n microphoneButtonSelector,\n optionsButtonSelector,\n screenShareButtonSelector\n} from '../callControlSelectors';\nimport { videoGallerySelector } from '../videoGallerySelector';\nimport { participantListSelector } from '../participantListSelector';\nimport { participantsButtonSelector } from '../participantsButtonSelector';\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { Common } from '@internal/acs-ui-common';\nimport { AreEqual } from '@internal/acs-ui-common';\nimport { CallingHandlers } from '../handlers/createHandlers';\nimport { ParticipantsButton } from '@internal/react-components';\nimport { errorBarSelector } from '../errorBarSelector';\n\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> & Common<CallingHandlers, Parameters<Component>[0]>\n : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return { ...props, ...handlers } as any;\n }\n return undefined as any;\n};\n\nexport const emptySelector = (): Record<string, never> => ({});\n\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<\n Component,\n typeof VideoGallery\n> extends true\n ? typeof videoGallerySelector\n : AreEqual<Component, typeof OptionsButton> extends true\n ? typeof optionsButtonSelector\n : AreEqual<Component, typeof MicrophoneButton> extends true\n ? typeof microphoneButtonSelector\n : AreEqual<Component, typeof CameraButton> extends true\n ? typeof cameraButtonSelector\n : AreEqual<Component, typeof ScreenShareButton> extends true\n ? typeof screenShareButtonSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? typeof participantListSelector\n : AreEqual<Component, typeof ParticipantsButton> extends true\n ? typeof participantsButtonSelector\n : AreEqual<Component, typeof EndCallButton> extends true\n ? typeof emptySelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? typeof errorBarSelector\n : undefined;\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n switch (component) {\n case VideoGallery:\n return videoGallerySelector;\n case MicrophoneButton:\n return microphoneButtonSelector;\n case CameraButton:\n return cameraButtonSelector;\n case ScreenShareButton:\n return screenShareButtonSelector;\n case OptionsButton:\n return optionsButtonSelector;\n case ParticipantList:\n return participantListSelector;\n case ParticipantsButton:\n return participantsButtonSelector;\n case EndCallButton:\n return emptySelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatMessage, ChatThreadClient } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n\nexport type ChatHandlers = {\n onSendMessage: (content: string) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onParticipantRemove: (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// Keep all these handlers the same instance(unless client changed) to avoid re-render\nexport const createDefaultChatHandlers = memoizeOne(\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n return {\n onSendMessage: async (content: string) => {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n await chatThreadClient.sendMessage(sendMessageRequest);\n },\n onUpdateMessage: async (messageId: string, content: string) => {\n await chatThreadClient.updateMessage(messageId, { content });\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({ chatMessageId });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onParticipantRemove: 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 }\n\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message.value?.type && message.value.type === 'text') remainingMessagesToGet--;\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n return isAllChatMessagesLoaded;\n }\n };\n }\n);\n\n// These could be shared functions between Chat and Calling\nexport const defaultHandlerCreator =\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) =>\n <Props>(_: (props: Props) => ReactElement | null): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n };\n\nexport const createDefaultChatHandlersForComponent = <Props>(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient,\n _: (props: Props) => ReactElement | null\n): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n\nexport const ChatClientContext = createContext<StatefulChatClient | undefined>(undefined);\n\nexport type ChatClientProviderProps = {\n children: React.ReactNode;\n chatClient: StatefulChatClient;\n};\n\n/**\n * ChatClientProvider requires valid StatefulChatClient. It provides a global access to the\n * stateful chat client for the contoso app\n *\n * @param props - only one parameter StatefulChatClient\n */\nexport const ChatClientProvider = (props: ChatClientProviderProps): JSX.Element => {\n return <ChatClientContext.Provider value={props.chatClient}>{props.children}</ChatClientContext.Provider>;\n};\n\nexport const useChatClient = (): StatefulChatClient => {\n const chatClient = useContext(ChatClientContext);\n if (!chatClient)\n throw 'Please wrap components with ChatClientProvider and initialize a chat client before calling the hook!';\n return chatClient;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport { ChatThreadClient } from '@azure/communication-chat';\n\nexport const ChatThreadClientContext = createContext<ChatThreadClient | undefined>(undefined);\n\nexport type ChatThreadClientProviderProps = {\n children: React.ReactNode;\n chatThreadClient: ChatThreadClient;\n};\n\n/**\n * ChatThreadClientProvider requires valid StatefulChatThreadClient. It provides a global access to the\n * stateful chat thread client for the contoso app\n *\n * @param props - includes one parameter StatefulChatThreadClient\n */\nexport const ChatThreadClientProvider = (props: ChatThreadClientProviderProps): JSX.Element => {\n return (\n <ChatThreadClientContext.Provider value={props.chatThreadClient}>{props.children}</ChatThreadClientContext.Provider>\n );\n};\n\nexport const useChatThreadClient = (): ChatThreadClient => {\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient)\n throw 'Please wrap components with ChatThreadClientProvider and initialize a chat thread client before calling the hook.';\n return chatThreadClient;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createDefaultChatHandlersForComponent } from '../handlers/createHandlers';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\nimport { ReactElement, useContext } from 'react';\nimport { Common } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\n\nexport const useHandlers = <PropsT>(\n component: (props: PropsT) => ReactElement | null\n): Common<ChatHandlers, PropsT> | undefined => {\n const chatClient = useContext(ChatClientContext);\n const chatThreadClient = useContext(ChatThreadClientContext);\n if (!chatThreadClient || !chatClient) {\n return undefined;\n }\n\n return createDefaultChatHandlersForComponent(chatClient, chatThreadClient, component);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatClientState, StatefulChatClient } from '@internal/chat-stateful-client';\nimport { ChatClientContext } from '../providers/ChatClientProvider';\n\nimport { useState, useEffect, useRef, useMemo, useContext } from 'react';\nimport { ChatThreadClientContext } from '../providers/ChatThreadClientProvider';\n\n// This function highly depends on chatClient.onChange event\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\nexport const useSelector = <\n SelectorT extends (state: ChatClientState, props: any) => any,\n ParamT extends SelectorT | undefined\n>(\n selector: ParamT,\n selectorProps?: Parameters<SelectorT>[1]\n): ParamT extends SelectorT ? ReturnType<SelectorT> : undefined => {\n const chatClient: StatefulChatClient | undefined = useContext(ChatClientContext);\n const threadId = useContext(ChatThreadClientContext)?.threadId;\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const threadConfigProps = useMemo(\n () => ({\n threadId\n }),\n [threadId]\n );\n\n const [props, setProps] = useState(\n chatClient && selector ? selector(chatClient.getState(), selectorProps ?? threadConfigProps) : undefined\n );\n const propRef = useRef(props);\n propRef.current = props;\n useEffect(() => {\n if (!chatClient || !selector) return;\n const onStateChange = (state: ChatClientState): void => {\n const newProps = selector(state, selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n chatClient.onStateChange(onStateChange);\n return () => {\n chatClient.offStateChange(onStateChange);\n };\n }, [chatClient, selector, selectorProps, threadConfigProps]);\n return selector ? props : undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatClientState, ChatErrors, ChatMessageWithStatus } from '@internal/chat-stateful-client';\nimport { ChatParticipant, ChatMessageReadReceipt } from '@azure/communication-chat';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { MessageContentType } from '@internal/react-components';\nexport type ChatBaseSelectorProps = {\n threadId: string;\n};\n\nexport const getSelectorProps = <T>(_: ChatClientState, props: T): T => props;\nexport const getUserId = (state: ChatClientState): string => toFlatCommunicationIdentifier(state.userId);\n\nexport const getDisplayName = (state: ChatClientState): string => state.displayName;\nexport const getChatMessages = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n): { [key: string]: ChatMessageWithStatus } => (props.threadId && state.threads[props.threadId]?.chatMessages) || {};\n\nexport const getReadReceipts = (state: ChatClientState, props: ChatBaseSelectorProps): ChatMessageReadReceipt[] =>\n (props.threadId && state.threads[props.threadId]?.readReceipts) || [];\n\nexport const getParticipants = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n): { [key: string]: ChatParticipant } => (props.threadId && state.threads[props.threadId]?.participants) || {};\n\nexport const getIsLargeGroup = (state: ChatClientState, props: ChatBaseSelectorProps): boolean => {\n const participants = state.threads[props.threadId]?.participants;\n return !!participants && Object.values(participants).length > 20;\n};\n\nexport const getLatestReadTime = (state: ChatClientState, props: ChatBaseSelectorProps): Date =>\n (props.threadId && state.threads[props.threadId]?.latestReadTime) || new Date(0);\n\nexport const getTopicName = (state: ChatClientState, props: ChatBaseSelectorProps): string => {\n return state.threads[props.threadId]?.properties?.topic || '';\n};\n\nexport const getTypingIndicators = (\n state: ChatClientState,\n props: ChatBaseSelectorProps\n): TypingIndicatorReceivedEvent[] => {\n return (props.threadId && state.threads[props.threadId]?.typingIndicators) || [];\n};\n\nexport const sanitizedMessageContentType = (type: string): MessageContentType => {\n const lowerCaseType = type.toLowerCase();\n return lowerCaseType === 'text' || lowerCaseType === 'html' || lowerCaseType === 'richtext/html'\n ? lowerCaseType\n : 'unknown';\n};\n\nexport const getLatestErrors = (state: ChatClientState): ChatErrors => state.latestErrors;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSelector } from 'reselect';\nimport { getDisplayName, getUserId } from './baseSelectors';\n\nexport const sendBoxSelector = createSelector([getUserId, getDisplayName], (userId, displayName) => ({\n displayName: displayName,\n userId: userId\n}));\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Message } from '@internal/react-components';\n\nexport const compareMessages = (\n firstMessage: Message<'chat' | 'system' | 'custom'>,\n secondMessage: Message<'chat' | 'system' | 'custom'>\n): number => {\n if (firstMessage.payload.createdOn === undefined) return 1;\n if (secondMessage.payload.createdOn === undefined) return -1;\n const firstDate = new Date(firstMessage.payload.createdOn).getTime();\n const secondDate = new Date(secondMessage.payload.createdOn).getTime();\n // Workaround to get a stable order of message before we can get sequenceId from signaling\n // MessageIds are generated by time order the message persist, a good candidate other than time\n const idDelta =\n firstMessage.payload.messageId && secondMessage.payload.messageId\n ? Number.parseInt(firstMessage.payload.messageId) - Number.parseInt(secondMessage.payload.messageId)\n : 0;\n return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS = 8000;\nexport const PARTICIPANTS_THRESHOLD = 20;\n\n//TODO: Import enum from @azure/communication-chat when ChatMessageType shows up in new release version (or define our type to decouple)\nexport const ACSKnownMessageType = {\n text: 'text' as const,\n html: 'html' as const,\n richtextHtml: 'richtext/html' as const,\n topicUpdated: 'topicUpdated' as const,\n participantAdded: 'participantAdded' as const,\n participantRemoved: 'participantRemoved' as const\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n getChatMessages,\n getIsLargeGroup,\n getLatestReadTime,\n getUserId,\n sanitizedMessageContentType\n} from './baseSelectors';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatMessageWithStatus } from '@internal/chat-stateful-client';\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport { ChatMessage, Message, MessageAttachedStatus, CommunicationParticipant } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { compareMessages } from './utils/compareMessages';\nimport { ACSKnownMessageType } from './utils/constants';\n\nconst memoizedAllConvertChatMessage = memoizeFnAll(\n (\n _key: string,\n chatMessage: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n ): Message<'chat'> | Message<'system'> | Message<'custom'> => {\n const messageType = chatMessage.type.toLowerCase();\n if (messageType === 'text' || messageType === 'richtext/html') {\n return convertToUiChatMessage(chatMessage, userId, isSeen, isLargeGroup);\n } else {\n return convertToUiSystemMessage(chatMessage);\n }\n }\n);\n\nconst convertToUiChatMessage = (\n message: ChatMessageWithStatus,\n userId: string,\n isSeen: boolean,\n isLargeGroup: boolean\n): ChatMessage => {\n return {\n type: 'chat',\n payload: {\n createdOn: message.createdOn,\n content: message.content?.message,\n type: sanitizedMessageContentType(message.type),\n status: !isLargeGroup && message.status === 'delivered' && isSeen ? 'seen' : message.status,\n senderDisplayName: message.senderDisplayName,\n senderId: message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId,\n messageId: message.id,\n clientMessageId: message.clientMessageId\n }\n };\n};\n\nconst convertToUiSystemMessage = (message: ChatMessageWithStatus): Message<'system'> => {\n const systemMessageType = message.type;\n if (systemMessageType === 'participantAdded' || systemMessageType === 'participantRemoved') {\n return {\n type: 'system',\n payload: {\n createdOn: message.createdOn,\n participants:\n message.content?.participants\n // TODO: In our moderator logic, we use undefined name as our displayName for moderator, which should be filtered out\n // Once we have a better solution to identify the moderator, remove this line\n ?.filter((participant) => participant.displayName && participant.displayName !== '')\n .map(\n (participant): CommunicationParticipant => ({\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n })\n ) ?? [],\n type: systemMessageType,\n messageId: message.id,\n iconName: systemMessageType === 'participantAdded' ? 'PeopleAdd' : 'PeopleBlock'\n }\n };\n } else {\n // Only topic updated type left, according to ACSKnown type\n return {\n type: 'system',\n payload: {\n createdOn: message.createdOn,\n topic: message.content?.topic ?? '',\n type: 'topicUpdated',\n messageId: message.id,\n iconName: 'Edit'\n }\n };\n }\n};\n\nexport const messageThreadSelector = createSelector(\n [getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup],\n (userId, chatMessages, latestReadTime, isLargeGroup) => {\n // A function takes parameter above and generate return value\n const convertedMessages = memoizedAllConvertChatMessage((memoizedFn) =>\n Object.values(chatMessages)\n .filter(\n (message) =>\n message.type.toLowerCase() === ACSKnownMessageType.text ||\n message.type.toLowerCase() === ACSKnownMessageType.richtextHtml ||\n message.type.toLowerCase() === ACSKnownMessageType.html ||\n message.type === ACSKnownMessageType.participantAdded ||\n message.type === ACSKnownMessageType.participantRemoved ||\n message.type === ACSKnownMessageType.topicUpdated ||\n message.clientMessageId !== undefined\n )\n .filter((message) => message.content && message.content.message !== '') // TODO: deal with deleted message and remove\n .map((message) =>\n memoizedFn(\n message.id ?? message.clientMessageId,\n message,\n userId,\n message.createdOn <= latestReadTime,\n isLargeGroup\n )\n )\n );\n\n updateMessagesWithAttached(convertedMessages, userId);\n return {\n userId,\n showMessageStatus: !isLargeGroup,\n messages: convertedMessages\n };\n }\n);\n\nexport const updateMessagesWithAttached = (\n chatMessagesWithStatus: (Message<'chat'> | Message<'system'> | Message<'custom'>)[],\n userId: string\n): void => {\n chatMessagesWithStatus.sort(compareMessages);\n\n chatMessagesWithStatus.forEach((message, index, messages) => {\n if (message.type !== 'chat') {\n return;\n }\n const mine = message.payload.senderId === userId;\n /**\n * A block of messages: continuous messages that belong to the same sender and not intercepted by other senders.\n *\n * Attacthed is the index of the last message in the previous block of messages which mine===true.\n * This message's statusToRender will be reset when there's a new block of messages which mine===true. (Because\n * in this case, we only want to show the read statusToRender of last message of the new messages block)\n */\n let attached: boolean | MessageAttachedStatus = false;\n const nextMessage = messages[index + 1];\n if (index === 0) {\n if (index !== messages.length - 1) {\n //the next message has the same sender\n if (message.payload.senderId === message.payload.senderId) {\n attached = 'top';\n }\n }\n } else {\n const previousMessage = messages[index - 1];\n if (previousMessage.type === 'chat' && message.payload.senderId === previousMessage.payload.senderId) {\n //the previous message has the same sender\n if (index !== messages.length - 1 && nextMessage.type === 'chat') {\n if (message.payload.senderId === nextMessage.payload.senderId) {\n //the next message has the same sender\n attached = true;\n } else {\n //the next message has a different sender\n attached = 'bottom';\n }\n } else {\n // this is the last message of the whole messages list or the next message is not a chat message\n attached = 'bottom';\n }\n } else {\n //the previous message has a different sender or is not a chat message\n if (index !== messages.length - 1 && nextMessage.type === 'chat') {\n if (message.payload.senderId === nextMessage.payload.senderId) {\n //the next message has the same sender\n attached = 'top';\n }\n }\n }\n }\n\n message.payload.attached = attached;\n message.payload.mine = mine;\n });\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getTypingIndicators, getParticipants, getUserId } from './baseSelectors';\nimport * as reselect from 'reselect';\nimport { ChatParticipant } from '@azure/communication-chat';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CommunicationParticipant } from '@internal/react-components';\nimport { MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS, PARTICIPANTS_THRESHOLD } from './utils/constants';\n\nconst filterTypingIndicators = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n userId: string\n): TypingIndicatorReceivedEvent[] => {\n const filteredTypingIndicators: TypingIndicatorReceivedEvent[] = [];\n const seen = new Set();\n const date8SecondsAgo = new Date(Date.now() - MINIMUM_TYPING_INTERVAL_IN_MILLISECONDS);\n for (let i = typingIndicators.length - 1; i >= 0; i--) {\n const typingIndicator = typingIndicators[i];\n if (toFlatCommunicationIdentifier(typingIndicator.sender) === userId) {\n continue;\n }\n if (typingIndicator.receivedOn < date8SecondsAgo) {\n continue;\n }\n if (seen.has(toFlatCommunicationIdentifier(typingIndicator.sender))) {\n continue;\n }\n seen.add(toFlatCommunicationIdentifier(typingIndicator.sender));\n filteredTypingIndicators.push(typingIndicator);\n }\n return filteredTypingIndicators;\n};\n\nconst convertSdkTypingIndicatorsToCommunicationParticipants = (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant }\n): CommunicationParticipant[] => {\n return typingIndicators.map((typingIndicator) => ({\n userId: toFlatCommunicationIdentifier(typingIndicator.sender),\n displayName: participants[toFlatCommunicationIdentifier(typingIndicator.sender)]?.displayName\n }));\n};\n\nexport const typingIndicatorSelector = reselect.createSelector(\n [getTypingIndicators, getParticipants, getUserId],\n (\n typingIndicators: TypingIndicatorReceivedEvent[],\n participants: { [key: string]: ChatParticipant },\n userId: string\n ) => {\n // if the participant size reaches the threshold then return no typing users\n if (Object.values(participants).length >= PARTICIPANTS_THRESHOLD) {\n return { typingUsers: [] };\n }\n\n // filter typing indicators to remove those that are from the duplicate users or current user as well as those older than a threshold\n const filteredTypingIndicators = filterTypingIndicators(typingIndicators, userId);\n\n const typingUsers: CommunicationParticipant[] = convertSdkTypingIndicatorsToCommunicationParticipants(\n filteredTypingIndicators,\n participants\n );\n\n return { typingUsers };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getUserId, getDisplayName, getParticipants } from './baseSelectors';\nimport * as reselect from 'reselect';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationParticipant } from '@internal/react-components';\n\nconst convertChatParticipantsToCommunicationParticipants = (\n chatParticipants: ChatParticipant[]\n): CommunicationParticipant[] => {\n return chatParticipants.map((participant: ChatParticipant) => {\n return {\n userId: toFlatCommunicationIdentifier(participant.id),\n displayName: participant.displayName\n };\n });\n};\n\n/**\n * get the index of moderator to help updating its display name if they are the local user or removing them from list of participants otherwise\n */\nconst moderatorIndex = (participants: CommunicationParticipant[]): number => {\n return participants.map((p) => p.displayName).indexOf(undefined);\n};\n\nexport const chatParticipantListSelector = reselect.createSelector(\n [getUserId, getParticipants, getDisplayName],\n (userId, chatParticipants: { [key: string]: ChatParticipant }, displayName) => {\n let participants = convertChatParticipantsToCommunicationParticipants(Object.values(chatParticipants));\n if (0 !== participants.length) {\n const moderatorIdx = moderatorIndex(participants);\n\n if (-1 !== moderatorIdx) {\n const userIndex = participants.map((p) => p.userId).indexOf(userId);\n if (moderatorIdx === userIndex) {\n participants[moderatorIdx].displayName = displayName;\n } else {\n participants = participants.filter((p) => p.displayName);\n }\n }\n }\n\n return {\n myUserId: userId,\n participants: participants\n };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getLatestErrors } from './baseSelectors';\nimport { ActiveError, ErrorType } from '@internal/react-components';\nimport { createSelector } from 'reselect';\nimport { ChatError, ChatErrors, ChatErrorTarget } from '@internal/chat-stateful-client';\n\n/**\n * Select the first fiew active errors from the state for the `ErrorBar` component.\n *\n * In case there are many errors, only a few top errors are returned to avoid\n * filling up the UI with too many errors.\n *\n * Invariants:\n * - `ErrorType` is never repeated in the returned errors.\n * - Errors are returned in a fixed order by `ErrorType`.\n */\nexport const errorBarSelector = createSelector([getLatestErrors], (latestErrors): { activeErrors: ActiveError[] } => {\n // The order in which the errors are returned is significant: The `ErrorBar` shows errors on the UI in that order.\n // There are several options for the ordering:\n // - Sorted by when the errors happened (latest first / oldest first).\n // - Stable sort by error type.\n //\n // We chose to stable sort by error type: We intend to show only a small number of errors on the UI and we do not\n // have timestamps for errors.\n const activeErrors: ActiveError[] = [];\n let specificSendMessageErrorSeen = false;\n {\n const error = latestUnableToReachChatServiceError(latestErrors);\n if (error !== undefined) {\n activeErrors.push(error);\n }\n }\n {\n const error = latestAccessDeniedError(latestErrors);\n if (error !== undefined) {\n activeErrors.push(error);\n }\n }\n\n const sendMessageError = latestErrors['ChatThreadClient.sendMessage'];\n {\n const error = latestNotInThisThreadError(latestErrors);\n if (error !== undefined) {\n if (sendMessageError !== undefined) {\n activeErrors.push({\n type: 'sendMessageNotInThisThread',\n // Set the latest timestamp of all the errors that translated to an active error.\n timestamp: sendMessageError.timestamp > (error.timestamp ?? 0) ? sendMessageError.timestamp : error.timestamp\n });\n specificSendMessageErrorSeen = true;\n } else {\n activeErrors.push(error);\n }\n }\n }\n\n if (!specificSendMessageErrorSeen && sendMessageError !== undefined) {\n activeErrors.push({ type: 'sendMessageGeneric', timestamp: sendMessageError.timestamp });\n }\n\n // We only return the first few errors to avoid filling up the UI with too many `MessageBar`s.\n activeErrors.splice(maxErrorCount);\n return { activeErrors: activeErrors };\n});\n\nconst maxErrorCount = 3;\n\nconst accessErrorTargets: ChatErrorTarget[] = [\n 'ChatThreadClient.getProperties',\n 'ChatThreadClient.listMessages',\n 'ChatThreadClient.listParticipants',\n 'ChatThreadClient.sendMessage',\n 'ChatThreadClient.sendTypingNotification'\n];\n\nconst latestUnableToReachChatServiceError = (latestErrors: ChatErrors): ActiveError | undefined => {\n return latestActiveErrorSatisfying(latestErrors, 'unableToReachChatService', (error: ChatError): boolean => {\n return !!error && !!error.inner && error.inner['code'] === 'REQUEST_SEND_ERROR';\n });\n};\n\nconst latestAccessDeniedError = (latestErrors: ChatErrors): ActiveError | undefined => {\n return latestActiveErrorSatisfying(latestErrors, 'accessDenied', (error: ChatError): boolean => {\n return !!error && !!error.inner && error.inner['statusCode'] === 401;\n });\n};\n\nconst latestNotInThisThreadError = (latestErrors: ChatErrors): ActiveError | undefined => {\n return latestActiveErrorSatisfying(latestErrors, 'userNotInThisThread', (error: ChatError): boolean => {\n if (!error || !error.inner) {\n return false;\n }\n\n // Chat service returns 403 if a user has been removed from a thread.\n // Chat service returns either 400 or 404 if the thread ID is malformed, depending on how the thread ID is malformed.\n return [400, 403, 404].some((statusCode) => error.inner['statusCode'] === statusCode);\n });\n};\n\nconst latestActiveErrorSatisfying = (\n errors: ChatErrors,\n activeErrorType: ErrorType,\n predicate: (error: ChatError) => boolean\n): ActiveError | undefined => {\n const activeErrors: ActiveError[] = [];\n for (const target of accessErrorTargets) {\n const error = errors[target];\n if (predicate(error)) {\n activeErrors.push({ type: activeErrorType, timestamp: error.timestamp });\n }\n }\n\n if (activeErrors.length === 0) {\n return undefined;\n }\n // We're actually sure that both timestamps will always exist, because we set them above.\n activeErrors.sort((a: ActiveError, b: ActiveError) => (a.timestamp?.getTime() ?? 0) - (b.timestamp?.getTime() ?? 0));\n return activeErrors[activeErrors.length - 1];\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorBar, MessageThread, ParticipantList, SendBox, TypingIndicator } from '@internal/react-components';\n\nimport { useHandlers } from './useHandlers';\nimport { useSelector } from './useSelector';\nimport { sendBoxSelector } from '../sendBoxSelector';\nimport { messageThreadSelector } from '../messageThreadSelector';\nimport { typingIndicatorSelector } from '../typingIndicatorSelector';\nimport { Common, AreEqual } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '../handlers/createHandlers';\nimport { chatParticipantListSelector } from '../chatParticipantListSelector';\nimport { errorBarSelector } from '../errorBarSelector';\n\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetSelector<Component> extends (props: any) => any\n ? ReturnType<GetSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]>\n : undefined => {\n const selector = getSelector(component);\n const props = useSelector(selector);\n const handlers = useHandlers<Parameters<Component>[0]>(component);\n if (props !== undefined) {\n return { ...props, ...handlers } as any;\n }\n return undefined as any;\n};\n\nexport type GetSelector<Component extends (props: any) => JSX.Element | undefined> = AreEqual<\n Component,\n typeof SendBox\n> extends true\n ? typeof sendBoxSelector\n : AreEqual<Component, typeof MessageThread> extends true\n ? typeof messageThreadSelector\n : AreEqual<Component, typeof TypingIndicator> extends true\n ? typeof typingIndicatorSelector\n : AreEqual<Component, typeof ParticipantList> extends true\n ? typeof chatParticipantListSelector\n : AreEqual<Component, typeof ErrorBar> extends true\n ? typeof errorBarSelector\n : undefined;\n\nexport const getSelector = <Component extends (props: any) => JSX.Element | undefined>(\n component: Component\n): GetSelector<Component> => {\n return findSelector(component);\n};\n\nconst findSelector = (component: (props: any) => JSX.Element | undefined): any => {\n switch (component) {\n case SendBox:\n return sendBoxSelector;\n case MessageThread:\n return messageThreadSelector;\n case TypingIndicator:\n return typingIndicatorSelector;\n case ParticipantList:\n return chatParticipantListSelector;\n case ErrorBar:\n return errorBarSelector;\n }\n return undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AudioDeviceInfo, DeviceAccess, DeviceManager, VideoDeviceInfo } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\n\n/**\n * Defines the additional methods added by the stateful on top of {@link @azure/communication-calling#DeviceManager}.\n */\nexport interface StatefulDeviceManager extends DeviceManager {\n /**\n * Sets the selectedCamera in the {@link DeviceManagerState}. This is completely developer driven and is not tied in\n * any way to {@link @azure/communication-calling#DeviceManager}. It is entirely contained in\n * {@link StatefulDeviceManager}. See also {@link DeviceManagerState.selectedCamera}.\n */\n selectCamera: (VideoDeviceInfo) => void;\n}\n\n/**\n * ProxyDeviceManager proxies DeviceManager and subscribes to all events that affect device manager state. State updates\n * are set on the provided context. Also any queries for state are proxied and stored in state as well. Only one device\n * manager should exist for a given CallClient so if CallClient.getDeviceManager is called multiple times, either a\n * cached ProxyDeviceManager should be returned or the existing ProxyDeviceManager should be destructed via destructor()\n * and a new ProxyDeviceManager created.\n */\nclass ProxyDeviceManager implements ProxyHandler<DeviceManager> {\n private _deviceManager: DeviceManager;\n private _context: CallContext;\n\n constructor(deviceManager: DeviceManager, context: CallContext) {\n this._deviceManager = deviceManager;\n this._context = context;\n\n this.setDeviceManager();\n this.subscribe();\n }\n\n private setDeviceManager = (): void => {\n // isSpeakerSelectionAvailable, selectedMicrophone, and selectedSpeaker are properties on DeviceManager. Since they\n // are not functions we can't proxy them so we'll update whenever we think they may need updating such as at\n // construction time or when certain events happen.\n this._context.setDeviceManagerIsSpeakerSelectionAvailable(this._deviceManager.isSpeakerSelectionAvailable);\n this._context.setDeviceManagerSelectedMicrophone(this._deviceManager.selectedMicrophone);\n this._context.setDeviceManagerSelectedSpeaker(this._deviceManager.selectedSpeaker);\n };\n\n private subscribe = (): void => {\n this._deviceManager.on('videoDevicesUpdated', this.videoDevicesUpdated);\n this._deviceManager.on('audioDevicesUpdated', this.audioDevicesUpdated);\n this._deviceManager.on('selectedMicrophoneChanged', this.selectedMicrophoneChanged);\n this._deviceManager.on('selectedSpeakerChanged', this.selectedSpeakerChanged);\n };\n\n /**\n * This is used to unsubscribe DeclarativeDeviceManager from the DeviceManager events.\n */\n public unsubscribe = (): void => {\n this._deviceManager.off('videoDevicesUpdated', this.videoDevicesUpdated);\n this._deviceManager.off('audioDevicesUpdated', this.audioDevicesUpdated);\n this._deviceManager.off('selectedMicrophoneChanged', this.selectedMicrophoneChanged);\n this._deviceManager.off('selectedSpeakerChanged', this.selectedSpeakerChanged);\n };\n\n /**\n * Used to set a camera inside the proxy device manager.\n * @param videoDeviceInfo VideoDeviceInfo\n */\n public selectCamera = (videoDeviceInfo: VideoDeviceInfo): void => {\n this._context.setDeviceManagerSelectedCamera(videoDeviceInfo);\n };\n\n private videoDevicesUpdated = async (): Promise<void> => {\n this._context.setDeviceManagerCameras(dedupeById(await this._deviceManager.getCameras()));\n };\n\n private audioDevicesUpdated = async (): Promise<void> => {\n this._context.setDeviceManagerMicrophones(dedupeById(await this._deviceManager.getMicrophones()));\n this._context.setDeviceManagerSpeakers(dedupeById(await this._deviceManager.getSpeakers()));\n };\n\n private selectedMicrophoneChanged = (): void => {\n this._context.setDeviceManagerSelectedMicrophone(this._deviceManager.selectedMicrophone);\n };\n\n private selectedSpeakerChanged = (): void => {\n this._context.setDeviceManagerSelectedSpeaker(this._deviceManager.selectedSpeaker);\n };\n\n public get<P extends keyof DeviceManager>(target: DeviceManager, prop: P): any {\n switch (prop) {\n case 'getCameras': {\n return this._context.withAsyncErrorTeedToState((): Promise<VideoDeviceInfo[]> => {\n return target.getCameras().then((cameras: VideoDeviceInfo[]) => {\n this._context.setDeviceManagerCameras(dedupeById(cameras));\n return cameras;\n });\n }, 'DeviceManager.getCameras');\n }\n case 'getMicrophones': {\n return this._context.withAsyncErrorTeedToState((): Promise<AudioDeviceInfo[]> => {\n return target.getMicrophones().then((microphones: AudioDeviceInfo[]) => {\n this._context.setDeviceManagerMicrophones(dedupeById(microphones));\n return microphones;\n });\n }, 'DeviceManager.getMicrophones');\n }\n case 'getSpeakers': {\n return this._context.withAsyncErrorTeedToState((): Promise<AudioDeviceInfo[]> => {\n return target.getSpeakers().then((speakers: AudioDeviceInfo[]) => {\n this._context.setDeviceManagerSpeakers(dedupeById(speakers));\n return speakers;\n });\n }, 'DeviceManager.getSpeakers');\n }\n case 'selectMicrophone': {\n return this._context.withAsyncErrorTeedToState(\n (...args: Parameters<DeviceManager['selectMicrophone']>): Promise<void> => {\n return target.selectMicrophone(...args).then(() => {\n this._context.setDeviceManagerSelectedMicrophone(target.selectedMicrophone);\n });\n },\n 'DeviceManager.selectMicrophone'\n );\n }\n case 'selectSpeaker': {\n return this._context.withAsyncErrorTeedToState(\n (...args: Parameters<DeviceManager['selectSpeaker']>): Promise<void> => {\n return target.selectSpeaker(...args).then(() => {\n this._context.setDeviceManagerSelectedSpeaker(target.selectedSpeaker);\n });\n },\n 'DeviceManager.selectSpeaker'\n );\n }\n case 'askDevicePermission': {\n return this._context.withAsyncErrorTeedToState(\n (...args: Parameters<DeviceManager['askDevicePermission']>): Promise<DeviceAccess> => {\n return target.askDevicePermission(...args).then((deviceAccess: DeviceAccess) => {\n this._context.setDeviceManagerDeviceAccess(deviceAccess);\n this.setDeviceManager();\n return deviceAccess;\n });\n },\n 'DeviceManager.askDevicePermission'\n );\n }\n default:\n return Reflect.get(target, prop);\n }\n }\n}\n\n// TODO: Remove this when SDK no longer returns duplicate audio and video devices\n/** Helper function to dedupe duplicate audio and video devices obtained from SDK */\nconst dedupeById = <T extends { id: string }>(devices: T[]): T[] => {\n const ids = new Set();\n const uniqueDevices: T[] = [];\n devices.forEach((device: T) => {\n if (!ids.has(device.id)) {\n uniqueDevices.push(device);\n ids.add(device.id);\n }\n });\n return uniqueDevices;\n};\n\n/**\n * Creates a declarative DeviceManager by proxying DeviceManager with ProxyDeviceManager. The declarative DeviceManager\n * will put state updates in the given context.\n *\n * @param deviceManager - DeviceManager from SDK\n * @param context - CallContext from StatefulCallClient\n */\nexport const deviceManagerDeclaratify = (deviceManager: DeviceManager, context: CallContext): DeviceManager => {\n const proxyDeviceManager = new ProxyDeviceManager(deviceManager, context);\n Object.defineProperty(deviceManager, 'unsubscribe', {\n configurable: false,\n value: () => proxyDeviceManager.unsubscribe()\n });\n Object.defineProperty(deviceManager, 'selectCamera', {\n configurable: false,\n value: (videoDeviceInfo: VideoDeviceInfo) => proxyDeviceManager.selectCamera(videoDeviceInfo)\n });\n return new Proxy(deviceManager, proxyDeviceManager) as StatefulDeviceManager;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AudioDeviceInfo,\n CallDirection,\n CallEndReason,\n CallerInfo,\n CallState as CallStatus,\n DeviceAccess,\n DominantSpeakersInfo,\n LatestMediaDiagnostics,\n LatestNetworkDiagnostics,\n MediaStreamType,\n RemoteParticipantState as RemoteParticipantStatus,\n ScalingMode,\n TransferErrorCode,\n TransferState,\n VideoDeviceInfo\n} from '@azure/communication-calling';\nimport {\n CommunicationUserIdentifier,\n CommunicationUserKind,\n MicrosoftTeamsUserKind,\n PhoneNumberIdentifier,\n PhoneNumberKind,\n UnknownIdentifierKind\n} from '@azure/communication-common';\n\n/**\n * State only version of {@link @azure/communication-calling#TransferRequestedEventArgs}. At the time of writing\n * Transfer Call is experimental. Not tested and not ready for consumption.\n */\nexport interface TransferRequest {\n targetParticipant: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#Transfer}. At the time of writing Transfer Call is\n * experimental. Not tested and not ready for consumption.\n * @experimental\n */\nexport interface Transfer {\n /**\n * Added by Declarative and used internally.\n */\n id: number;\n /**\n * Added by {@link StatefulClientClient}, stores the targetParticipant passed to\n * {@link @azure/communication-calling#TransferCallFeature.transfer}\n */\n targetParticipant: CommunicationUserIdentifier | PhoneNumberIdentifier;\n /**\n * Proxy of {@link @azure/communication-calling#Transfer.state}.\n */\n state: TransferState;\n /**\n * Proxy of {@link @azure/communication-calling#Transfer.error}.\n */\n error?: TransferErrorCode;\n}\n\n/**\n * Holds all the state found in {@link @azure/communication-calling#TransferCallFeature} and\n * {@link @azure/communication-calling#Transfer}. At the time of writing Transfer Call is experimental. Not tested and\n * not ready for consumption.\n */\nexport interface TransferCallFeature {\n /**\n * These are requests received in the {@link @azure/communication-calling#TransferCallFeature}'s 'transferRequested'\n * event. Only MAX_TRANSFER_REQUEST_LENGTH number of TransferRequest are kept in this array with the older ones being\n * replaced by newer ones. To accept/reject a transfer request, the {@link @azure/communication-calling#Call} must be\n * used (TODO: do we want to provide an API?).\n */\n receivedTransferRequests: TransferRequest[];\n /**\n * These are requests initiated by the local user using {@link StatefulCallClient.transfer}. Only\n * MAX_TRANSFER_REQUEST_LENGTH number of TransferRequest are kept in this array with the older ones being replaced by\n * newer ones.\n */\n requestedTransfers: Transfer[];\n}\n\n/**\n * State only version of {@link @azure/communication-calling#CallAgent} except calls is moved to be a child directly of\n * {@link CallClientState} and not included here. The reason to have CallAgent's state proxied is to provide access to\n * displayName. We don't flatten CallAgent.displayName and put it in CallClientState because it would be ambiguious that\n * displayName is actually reliant on the creation/existence of CallAgent to be available.\n */\nexport interface CallAgentState {\n /**\n * Proxy of {@link @azure/communication-calling#CallAgent.displayName}.\n */\n displayName?: string;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#TranscriptionCallFeature}. {@link StatefulCallClient} will\n * automatically listen for transcription state of the call and update the state exposed by {@link StatefulCallClient}\n * accordingly.\n */\nexport interface TranscriptionCallFeature {\n /**\n * Proxy of {@link @azure/communication-calling#TranscriptionCallFeature.isTranscriptionActive}.\n */\n isTranscriptionActive: boolean;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#RecordingCallFeature}. {@link StatefulCallClient} will\n * automatically listen for recording state of the call and update the state exposed by {@link StatefulCallClient} accordingly.\n */\nexport interface RecordingCallFeature {\n /**\n * Proxy of {@link @azure/communication-calling#RecordingCallFeature.isRecordingActive}.\n */\n isRecordingActive: boolean;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#LocalVideoStream}.\n */\nexport interface LocalVideoStreamState {\n /**\n * Proxy of {@link @azure/communication-calling#LocalVideoStream.source}.\n */\n source: VideoDeviceInfo;\n /**\n * Proxy of {@link @azure/communication-calling#LocalVideoStream.mediaStreamType}.\n */\n mediaStreamType: MediaStreamType;\n /**\n * {@link VideoStreamRendererView} that is managed by createView/disposeView in {@link StatefulCallClient}\n * API. This can be undefined if the stream has not yet been rendered and defined after createView creates the view.\n */\n view?: VideoStreamRendererViewState;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#RemoteVideoStream}.\n */\nexport interface RemoteVideoStreamState {\n /**\n * Proxy of {@link @azure/communication-calling#RemoteVideoStream.id}.\n */\n id: number;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteVideoStream.mediaStreamType}.\n */\n mediaStreamType: MediaStreamType;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteVideoStream.isAvailable}.\n */\n isAvailable: boolean;\n /**\n * {@link VideoStreamRendererView} that is managed by createView/disposeView in {@link StatefulCallClient}\n * API. This can be undefined if the stream has not yet been rendered and defined after createView creates the view.\n */\n view?: VideoStreamRendererViewState;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#VideoStreamRendererView}. Currently no API is provided to\n * modify scalingMode after the stream as been rendered by {@link StatefulCallClient}. In order to change scalingMode\n * stop rendering the stream and re-start it using the desired scalingMode. This property is added to the state exposed\n * by {@link StatefulCallClient} by {@link StatefulCallClient.createView} and removed by\n * {@link StatefulCallClient.disposeView}.\n */\nexport interface VideoStreamRendererViewState {\n /**\n * Proxy of {@link @azure/communication-calling#VideoStreamRendererView.scalingMode}.\n */\n scalingMode: ScalingMode;\n /**\n * Proxy of {@link @azure/communication-calling#VideoStreamRendererView.isMirrored}.\n */\n isMirrored: boolean;\n /**\n * Proxy of {@link @azure/communication-calling#VideoStreamRendererView.target}.\n */\n target: HTMLElement;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#RemoteParticipant}. {@link StatefulCallClient} will\n * automatically retrieve RemoteParticipants and add their state to the state exposed by {@link StatefulCallClient}.\n */\nexport interface RemoteParticipantState {\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.identifier}.\n */\n identifier: CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.displayName}.\n */\n displayName?: string;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.state}.\n */\n state: RemoteParticipantStatus;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.callEndReason}.\n */\n callEndReason?: CallEndReason;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.videoStreams} as an object with\n * {@link RemoteVideoStream} fields keyed by {@link @azure/communication-calling#RemoteVideoStream.id}.\n */\n videoStreams: { [key: number]: RemoteVideoStreamState };\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.isMuted}.\n */\n isMuted: boolean;\n /**\n * Proxy of {@link @azure/communication-calling#RemoteParticipant.isSpeaking}.\n */\n isSpeaking: boolean;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#Call}. {@link StatefulCallClient} will automatically\n * retrieve Call's state and add it to the state exposed by {@link StatefulCallClient}.\n */\nexport interface CallState {\n /**\n * Proxy of {@link @azure/communication-calling#Call.id}.\n */\n id: string;\n /**\n * Proxy of {@link @azure/communication-calling#Call.callerInfo}.\n */\n callerInfo: CallerInfo;\n /**\n * Proxy of {@link @azure/communication-calling#Call.state}.\n */\n state: CallStatus;\n /**\n * Proxy of {@link @azure/communication-calling#Call.callEndReason}.\n */\n callEndReason?: CallEndReason;\n /**\n * Proxy of {@link @azure/communication-calling#Call.direction}.\n */\n direction: CallDirection;\n /**\n * Proxy of {@link @azure/communication-calling#Call.isMuted}.\n */\n isMuted: boolean;\n /**\n * Proxy of {@link @azure/communication-calling#Call.isScreenSharingOn}.\n */\n isScreenSharingOn: boolean;\n /**\n * Proxy of {@link @azure/communication-calling#DominantSpeakersInfo }.\n */\n dominantSpeakers?: DominantSpeakersInfo;\n /**\n * Proxy of {@link @azure/communication-calling#Call.localVideoStreams}.\n */\n localVideoStreams: LocalVideoStreamState[];\n /**\n * Proxy of {@link @azure/communication-calling#Call.remoteParticipants}.\n * Object with {@link RemoteParticipant} fields keyed by flattened {@link RemoteParticipantState.identifier}.\n * To obtain a flattened {@link RemoteParticipantState.identifier}, use\n * {@link @azure/communication-react#toFlatCommunicationIdentifier}.\n */\n remoteParticipants: { [keys: string]: RemoteParticipantState };\n /**\n * Stores remote participants that have left the call so that the callEndReason could be retrieved.\n * Object with {@link RemoteParticipant} fields keyed by flattened {@link RemoteParticipantState.identifier}.\n * To obtain a flattened {@link RemoteParticipantState.identifier}, use\n * {@link @azure/communication-react#toFlatCommunicationIdentifier}.\n */\n remoteParticipantsEnded: { [keys: string]: RemoteParticipantState };\n /**\n * Proxy of {@link @azure/communication-calling#TranscriptionCallFeature}.\n */\n transcription: TranscriptionCallFeature;\n /**\n * Proxy of {@link @azure/communication-calling#RecordingCallFeature}.\n */\n recording: RecordingCallFeature;\n /**\n * Proxy of {@link @azure/communication-calling#TransferCallFeature} with some differences see\n * {@link TransferCallFeature} for details.\n */\n transfer: TransferCallFeature;\n /**\n * Stores the currently active screenshare participant's key. If there is no screenshare active, then this will be\n * undefined. You can use this key to access the remoteParticipant data in {@link CallState.remoteParticipants} object.\n *\n * Note this only applies to ScreenShare in RemoteParticipant. A local ScreenShare being active will not affect this\n * property.\n *\n * This property is added by the stateful layer and is not a proxy of SDK state\n */\n screenShareRemoteParticipant: string | undefined;\n /**\n * Stores the local date when the call started on the client. This property is added by the stateful layer and is not\n * a proxy of SDK state.\n */\n startTime: Date;\n /**\n * Stores the local date when the call ended on the client. This property is added by the stateful layer and is not\n * a proxy of SDK state.\n */\n endTime: Date | undefined;\n\n /**\n * Stores the latest call diagnostics.\n */\n diagnostics: DiagnosticsCallFeatureState;\n}\n\n/**\n * State only version of {@link @azure/communication-calling#IncomingCall}. {@link StatefulCallClient} will\n * automatically detect incoming calls and add their state to the state exposed by {@link StatefulCallClient}.\n */\nexport interface IncomingCallState {\n /**\n * Proxy of {@link @azure/communication-calling#IncomingCall.id}.\n */\n id: string;\n /**\n * Proxy of {@link @azure/communication-calling#IncomingCall.callerInfo}.\n */\n callerInfo: CallerInfo;\n /**\n * Set to the state returned by 'callEnded' event on {@link @azure/communication-calling#IncomingCall} when received.\n * This property is added by the stateful layer and is not a proxy of SDK state.\n */\n callEndReason?: CallEndReason;\n /**\n * Stores the local date when the call started on the client. This property is added by the stateful layer and is not\n * a proxy of SDK state.\n */\n startTime: Date;\n /**\n * Stores the local date when the call ended on the client. This property is added by the stateful layer and is not a\n * proxy of SDK state. It is undefined if the call is not ended yet.\n */\n endTime: Date | undefined;\n}\n\n/**\n * This type is meant to encapsulate all the state inside {@link @azure/communication-calling#DeviceManager}. For\n * optional parameters they may not be available until permission is granted by the user. The cameras, microphones,\n * speakers, and deviceAccess states will be empty until the corresponding\n * {@link @azure/communication-calling#DeviceManager}'s getCameras, getMicrophones, getSpeakers, and askDevicePermission\n * APIs are called and completed.\n */\nexport type DeviceManagerState = {\n /**\n * Proxy of {@link @azure/communication-calling#DeviceManager.isSpeakerSelectionAvailable}.\n */\n isSpeakerSelectionAvailable: boolean;\n /**\n * Proxy of {@link @azure/communication-calling#DeviceManager.selectedMicrophone}.\n */\n selectedMicrophone?: AudioDeviceInfo;\n /**\n * Proxy of {@link @azure/communication-calling#DeviceManager.selectedSpeaker}.\n */\n selectedSpeaker?: AudioDeviceInfo;\n /**\n * Stores the selected camera device info. This is added by the stateful layer and does not exist in the Calling SDK.\n * It is meant as a convenience to the developer. It must be explicitly set before it has any value and does not\n * persist across instances of the {@link StatefulCallClient}. The developer controls entirely what this value holds\n * at any time.\n */\n selectedCamera?: VideoDeviceInfo;\n /**\n * Stores any cameras data returned from {@link @azure/communication-calling#DeviceManager.getCameras}.\n */\n cameras: VideoDeviceInfo[];\n /**\n * Stores any microphones data returned from {@link @azure/communication-calling#DeviceManager.getMicrophones}.\n */\n microphones: AudioDeviceInfo[];\n /**\n * Stores any speakers data returned from {@link @azure/communication-calling#DeviceManager.getSpeakers}.\n */\n speakers: AudioDeviceInfo[];\n /**\n * Stores deviceAccess data returned from {@link @azure/communication-calling#DeviceManager.askDevicePermission}.\n */\n deviceAccess?: DeviceAccess;\n /**\n * Stores created views that are not associated with any CallState (when {@link StatefulCallClient.createView} is\n * called with undefined callId, undefined participantId, and defined LocalVideoStream).\n *\n * The values in this array are generated internally when {@link StatefulCallClient.createView} is called and are\n * considered immutable.\n */\n unparentedViews: LocalVideoStreamState[];\n};\n\n/**\n * Container for all of the state data proxied by {@link StatefulCallClient}. The calls, callsEnded, incomingCalls, and\n * incomingCallsEnded states will be automatically provided if a callAgent has been created. The deviceManager will be\n * empty initially until populated see {@link DeviceManagerState}. The userId state is provided as a convenience for the\n * developer and is completely controled and set by the developer.\n */\nexport interface CallClientState {\n /**\n * Proxy of {@link @azure/communication-calling#CallAgent.calls} as an object with CallState {@link CallState} fields.\n * It is keyed by {@link @azure/communication-calling#Call.id}. Please note that\n * {@link @azure/communication-calling#Call.id} could change. You should not cache the id itself but the entire\n * {@link @azure/communication-calling#Call} and then use the id contained to look up data in this map.\n */\n calls: { [key: string]: CallState };\n /**\n * Calls that have ended are stored here so the callEndReason could be checked. It is an array of CallState\n * {@link CallState}. Calls are pushed on to the array as they end, meaning this is sorted by endTime ascending. Only\n * {@link MAX_CALL_HISTORY_LENGTH} number of Calls are kept in this array with the older ones being replaced by newer\n * ones.\n */\n callsEnded: CallState[];\n /**\n * Proxy of {@link @azure/communication-calling#IncomingCall} as an object with IncomingCall {@link IncomingCall} fields.\n * It is keyed by {@link @azure/communication-calling#IncomingCall.id}.\n */\n incomingCalls: { [key: string]: IncomingCallState };\n /**\n * Incoming Calls that have ended are stored here so the callEndReason could be checked. It is a array of IncomingCall\n * {@link IncomingCall} received in the event 'incomingCall' emitted by\n * {@link @azure/communication-calling#CallAgent}. IncomingCalls are pushed on to the array as they end, meaning this\n * is sorted by endTime ascending. Only MAX_CALL_HISTORY_LENGTH number of IncomingCalls are kept in this array with\n * the older ones being replaced by newer ones.\n */\n incomingCallsEnded: IncomingCallState[];\n /**\n * Proxy of {@link @azure/communication-calling#DeviceManager}. Please review {@link DeviceManagerState}.\n */\n deviceManager: DeviceManagerState;\n /**\n * Proxy of {@link @azure/communication-calling#CallAgent}. Please review {@link CallAgentState}.\n */\n callAgent?: CallAgentState;\n /**\n * Stores a userId. This is not used by the {@link StatefulCallClient} and is provided here as a convenience for the\n * developer for easier access to userId. Must be passed in at initialization of the {@link StatefulCallClient}.\n * Completely controlled by the developer.\n */\n userId: CommunicationUserKind;\n /**\n * Stores the latest error for each API method.\n *\n * See documentation of {@Link CallErrors} for details.\n */\n latestErrors: CallErrors;\n}\n\n/**\n * Errors teed from API calls to the Calling SDK.\n *\n * Each property in the object stores the latest error for a particular SDK API method.\n *\n * Errors from this object can be cleared using the {@link newClearCallErrorsModifier}.\n * Additionally, errors are automatically cleared when:\n * - The state is cleared.\n * - Subsequent calls to related API methods succeed.\n * See documentation of individual stateful client methods for details on when errors may be automatically cleared.\n */\nexport type CallErrors = {\n [target in CallErrorTarget]: CallError;\n};\n\n/**\n * Error thrown from failed stateful API methods.\n */\nexport class CallError extends Error {\n /**\n * The API method target that failed.\n */\n public target: CallErrorTarget;\n /**\n * Error thrown by the failed SDK method.\n */\n public inner: Error;\n /**\n * Timestamp added to the error by the stateful layer.\n */\n public timestamp: Date;\n\n constructor(target: CallErrorTarget, inner: Error, timestamp?: Date) {\n super();\n this.target = target;\n this.inner = inner;\n // Testing note: It is easier to mock Date::now() than the Date() constructor.\n this.timestamp = timestamp ?? new Date(Date.now());\n this.name = 'CallError';\n this.message = `${this.target}: ${this.inner.message}`;\n }\n}\n\n/**\n * String literal type for all permissible keys in {@Link CallErrors}.\n */\nexport type CallErrorTarget =\n | 'Call.addParticipant'\n | 'Call.api'\n | 'Call.hangUp'\n | 'Call.hold'\n | 'Call.mute'\n | 'Call.off'\n | 'Call.on'\n | 'Call.removeParticipant'\n | 'Call.resume'\n | 'Call.sendDtmf'\n | 'Call.startScreenSharing'\n | 'Call.startVideo'\n | 'Call.stopScreenSharing'\n | 'Call.stopVideo'\n | 'Call.unmute'\n | 'CallAgent.dispose'\n | 'CallAgent.join'\n | 'CallAgent.off'\n | 'CallAgent.on'\n | 'CallAgent.startCall'\n | 'CallClient.createCallAgent'\n | 'CallClient.getDeviceManager'\n | 'DeviceManager.askDevicePermission'\n | 'DeviceManager.getCameras'\n | 'DeviceManager.getMicrophones'\n | 'DeviceManager.getSpeakers'\n | 'DeviceManager.off'\n | 'DeviceManager.on'\n | 'DeviceManager.selectMicrophone'\n | 'DeviceManager.selectSpeaker';\n\n/**\n * State only proxy for {@link @azure/communication-calling#DiagnosticsCallFeature}.\n */\nexport interface DiagnosticsCallFeatureState {\n /**\n * Stores diagnostics related to network conditions.\n */\n network: NetworkDiagnosticsState;\n\n /**\n * Stores diagnostics related to media quality.\n */\n media: MediaDiagnosticsState;\n}\n\n/**\n * State only proxy for {@link @azure/communication-calling#NetworkDiagnostics}.\n */\nexport interface NetworkDiagnosticsState {\n latest: LatestNetworkDiagnostics;\n}\n\n/**\n * State only proxy for {@link @azure/communication-calling#MediaDiagnostics}.\n */\nexport interface MediaDiagnosticsState {\n latest: LatestMediaDiagnostics;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallClientState, CallErrorTarget } from '../CallClientState';\nimport { CallStateModifier } from '../StatefulCallClient';\n\n/**\n * Creates a new {@link CallStateModifier} that clears the latest error for specific targets.\n *\n * Intended to be used with {@link StatefulCallClient.modifyState}.\n *\n * @param targets - CallErrorTarget[] to clear the errors for.\n */\nexport const newClearCallErrorsModifier = (targets: CallErrorTarget[]): CallStateModifier => {\n return (draft: CallClientState): void => {\n for (const target of targets) {\n if (draft.latestErrors[target] !== undefined) {\n delete draft.latestErrors[target];\n }\n }\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommunicationUserKind } from '@azure/communication-common';\nimport {\n AudioDeviceInfo,\n DeviceAccess,\n DominantSpeakersInfo,\n TransferErrorCode,\n TransferState,\n VideoDeviceInfo\n} from '@azure/communication-calling';\nimport EventEmitter from 'events';\nimport { enableMapSet, produce } from 'immer';\nimport {\n CallEndReason,\n CallState as CallStatus,\n RemoteParticipantState as RemoteParticipantStatus\n} from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallState,\n CallClientState,\n LocalVideoStreamState,\n RemoteParticipantState,\n RemoteVideoStreamState,\n IncomingCallState,\n VideoStreamRendererViewState,\n CallAgentState,\n TransferRequest,\n Transfer,\n CallErrors,\n CallErrorTarget,\n CallError\n} from './CallClientState';\nimport { CallStateModifier } from './StatefulCallClient';\nimport { newClearCallErrorsModifier } from './modifiers';\n\nenableMapSet();\n\n// TODO: How can we make this configurable?\nexport const MAX_CALL_HISTORY_LENGTH = 10;\nexport const MAX_TRANSFER_REQUEST_LENGTH = 10;\n\nexport class CallContext {\n private _state: CallClientState;\n private _emitter: EventEmitter;\n private _atomicId: number;\n private _batchMode: boolean;\n\n constructor(userId: CommunicationUserKind, maxListeners = 50) {\n this._state = {\n calls: {},\n callsEnded: [],\n incomingCalls: {},\n incomingCallsEnded: [],\n deviceManager: {\n isSpeakerSelectionAvailable: false,\n cameras: [],\n microphones: [],\n speakers: [],\n unparentedViews: []\n },\n callAgent: undefined,\n userId: userId,\n latestErrors: {} as CallErrors\n };\n this._emitter = new EventEmitter();\n this._emitter.setMaxListeners(maxListeners);\n this._batchMode = false;\n this._atomicId = 0;\n }\n\n public getState(): CallClientState {\n return this._state;\n }\n\n public setState(state: CallClientState): void {\n this._state = state;\n if (!this._batchMode) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public modifyState(modifier: CallStateModifier): void {\n this.batch(() => {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n modifier(draft);\n })\n );\n });\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: CallClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: CallClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n\n // Disposing of the CallAgentDeclarative will not clear the state. If we create a new CallAgentDeclarative, we should\n // make sure the state is clean because any left over state (if previous CallAgentDeclarative was disposed) may be\n // invalid.\n public clearCallRelatedState(): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.calls = {};\n draft.incomingCalls = {};\n draft.callsEnded.splice(0, draft.callsEnded.length);\n draft.incomingCallsEnded.splice(0, draft.incomingCallsEnded.length);\n })\n );\n }\n\n public setCallAgent(callAgent: CallAgentState): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.callAgent = callAgent;\n })\n );\n }\n\n public setCall(call: CallState): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const existingCall = draft.calls[call.id];\n if (existingCall) {\n existingCall.callerInfo = call.callerInfo;\n existingCall.state = call.state;\n existingCall.callEndReason = call.callEndReason;\n existingCall.direction = call.direction;\n existingCall.isMuted = call.isMuted;\n existingCall.isScreenSharingOn = call.isScreenSharingOn;\n existingCall.localVideoStreams = call.localVideoStreams;\n existingCall.remoteParticipants = call.remoteParticipants;\n existingCall.transcription.isTranscriptionActive = call.transcription.isTranscriptionActive;\n existingCall.recording.isRecordingActive = call.recording.isRecordingActive;\n // We don't update the startTime and endTime if we are updating an existing active call\n } else {\n draft.calls[call.id] = call;\n }\n })\n );\n }\n\n public removeCall(callId: string): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n delete draft.calls[callId];\n })\n );\n }\n\n public setCallEnded(callId: string, callEndReason: CallEndReason | undefined): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.endTime = new Date();\n call.callEndReason = callEndReason;\n delete draft.calls[callId];\n if (draft.callsEnded.length >= MAX_CALL_HISTORY_LENGTH) {\n draft.callsEnded.shift();\n }\n draft.callsEnded.push(call);\n }\n })\n );\n }\n\n public setCallState(callId: string, state: CallStatus): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.state = state;\n }\n })\n );\n }\n\n public setCallId(newCallId: string, oldCallId: string): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[oldCallId];\n if (call) {\n delete draft.calls[oldCallId];\n draft.calls[newCallId] = call;\n }\n })\n );\n }\n\n public setCallIsScreenSharingOn(callId: string, isScreenSharingOn: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.isScreenSharingOn = isScreenSharingOn;\n }\n })\n );\n }\n\n public setCallRemoteParticipants(\n callId: string,\n addRemoteParticipant: RemoteParticipantState[],\n removeRemoteParticipant: string[]\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n removeRemoteParticipant.forEach((id: string) => {\n delete call.remoteParticipants[id];\n });\n addRemoteParticipant.forEach((participant: RemoteParticipantState) => {\n call.remoteParticipants[toFlatCommunicationIdentifier(participant.identifier)] = participant;\n });\n }\n })\n );\n }\n\n public setCallRemoteParticipantsEnded(\n callId: string,\n addRemoteParticipant: RemoteParticipantState[],\n removeRemoteParticipant: string[]\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n removeRemoteParticipant.forEach((id: string) => {\n delete call.remoteParticipantsEnded[id];\n });\n addRemoteParticipant.forEach((participant: RemoteParticipantState) => {\n call.remoteParticipantsEnded[toFlatCommunicationIdentifier(participant.identifier)] = participant;\n });\n }\n })\n );\n }\n\n public setCallLocalVideoStream(callId: string, streams: LocalVideoStreamState[]): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.localVideoStreams = streams;\n }\n })\n );\n }\n\n public setCallIsMicrophoneMuted(callId: string, isMicrophoneMuted: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.isMuted = isMicrophoneMuted;\n }\n })\n );\n }\n\n public setCallDominantSpeakers(callId: string, dominantSpeakers: DominantSpeakersInfo): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.dominantSpeakers = dominantSpeakers;\n }\n })\n );\n }\n\n public setCallRecordingActive(callId: string, isRecordingActive: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.recording.isRecordingActive = isRecordingActive;\n }\n })\n );\n }\n\n public setCallTranscriptionActive(callId: string, isTranscriptionActive: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.transcription.isTranscriptionActive = isTranscriptionActive;\n }\n })\n );\n }\n\n public setCallReceivedTransferRequest(callId: string, transfer: TransferRequest): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n if (call.transfer.receivedTransferRequests.length >= MAX_TRANSFER_REQUEST_LENGTH) {\n call.transfer.receivedTransferRequests.shift();\n }\n call.transfer.receivedTransferRequests.push(transfer);\n }\n })\n );\n }\n\n public setCallRequestedTransfer(callId: string, transfer: Transfer): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n if (call.transfer.requestedTransfers.length >= MAX_TRANSFER_REQUEST_LENGTH) {\n call.transfer.requestedTransfers.shift();\n }\n call.transfer.requestedTransfers.push(transfer);\n }\n })\n );\n }\n\n public setCallRequestedTransferState(\n callId: string,\n transferId: number,\n state: TransferState,\n error?: TransferErrorCode\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n for (const requestedTransfer of call.transfer.requestedTransfers) {\n if (requestedTransfer.id === transferId) {\n requestedTransfer.state = state;\n requestedTransfer.error = error;\n break;\n }\n }\n }\n })\n );\n }\n\n public setCallScreenShareParticipant(callId: string, participantKey: string | undefined): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n call.screenShareRemoteParticipant = participantKey;\n }\n })\n );\n }\n\n public setLocalVideoStreamRendererView(callId: string, view: VideoStreamRendererViewState | undefined): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n if (call.localVideoStreams.length > 0) {\n call.localVideoStreams[0].view = view;\n }\n }\n })\n );\n }\n\n public setParticipantState(callId: string, participantKey: string, state: RemoteParticipantStatus): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n participant.state = state;\n }\n }\n })\n );\n }\n\n public setParticipantIsMuted(callId: string, participantKey: string, muted: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n participant.isMuted = muted;\n }\n }\n })\n );\n }\n\n public setParticipantDisplayName(callId: string, participantKey: string, displayName: string): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n participant.displayName = displayName;\n }\n }\n })\n );\n }\n\n public setParticipantIsSpeaking(callId: string, participantKey: string, isSpeaking: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n participant.isSpeaking = isSpeaking;\n }\n }\n })\n );\n }\n\n public setParticipantVideoStream(callId: string, participantKey: string, stream: RemoteVideoStreamState): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n // Set is called by subscriber will not modify any rendered stream so if there is existing stream only\n // modify the values that subscriber has access to.\n const existingStream = participant.videoStreams[stream.id];\n if (existingStream) {\n existingStream.isAvailable = stream.isAvailable;\n existingStream.mediaStreamType = stream.mediaStreamType;\n } else {\n participant.videoStreams[stream.id] = stream;\n }\n }\n }\n })\n );\n }\n\n public setRemoteVideoStreamIsAvailable(\n callId: string,\n participantKey: string,\n streamId: number,\n isAvailable: boolean\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n const stream = participant.videoStreams[streamId];\n if (stream) {\n stream.isAvailable = isAvailable;\n }\n }\n }\n })\n );\n }\n\n public setRemoteVideoStreams(\n callId: string,\n participantKey: string,\n addRemoteVideoStream: RemoteVideoStreamState[],\n removeRemoteVideoStream: number[]\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n for (const id of removeRemoteVideoStream) {\n delete participant.videoStreams[id];\n }\n\n for (const newStream of addRemoteVideoStream) {\n // This should only be called by the subscriber and some properties are add by other components so if the\n // stream already exists, only update the values that subscriber knows about.\n const stream = participant.videoStreams[newStream.id];\n if (stream) {\n stream.mediaStreamType = newStream.mediaStreamType;\n stream.isAvailable = newStream.isAvailable;\n } else {\n participant.videoStreams[newStream.id] = newStream;\n }\n }\n }\n }\n })\n );\n }\n\n public setRemoteVideoStreamRendererView(\n callId: string,\n participantKey: string,\n streamId: number,\n view: VideoStreamRendererViewState | undefined\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.calls[callId];\n if (call) {\n const participant = call.remoteParticipants[participantKey];\n if (participant) {\n const stream = participant.videoStreams[streamId];\n if (stream) {\n stream.view = view;\n }\n }\n }\n })\n );\n }\n\n public setIncomingCall(call: IncomingCallState): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const existingCall = draft.incomingCalls[call.id];\n if (existingCall) {\n existingCall.callerInfo = call.callerInfo;\n } else {\n draft.incomingCalls[call.id] = call;\n }\n })\n );\n }\n\n public removeIncomingCall(callId: string): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n delete draft.incomingCalls[callId];\n })\n );\n }\n\n public setIncomingCallEnded(callId: string, callEndReason: CallEndReason | undefined): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const call = draft.incomingCalls[callId];\n if (call) {\n call.endTime = new Date();\n call.callEndReason = callEndReason;\n delete draft.incomingCalls[callId];\n if (draft.incomingCallsEnded.length >= MAX_CALL_HISTORY_LENGTH) {\n draft.incomingCallsEnded.shift();\n }\n draft.incomingCallsEnded.push(call);\n }\n })\n );\n }\n\n public setDeviceManagerIsSpeakerSelectionAvailable(isSpeakerSelectionAvailable: boolean): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.isSpeakerSelectionAvailable = isSpeakerSelectionAvailable;\n })\n );\n }\n\n public setDeviceManagerSelectedMicrophone(selectedMicrophone?: AudioDeviceInfo): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.selectedMicrophone = selectedMicrophone;\n })\n );\n }\n\n public setDeviceManagerSelectedSpeaker(selectedSpeaker?: AudioDeviceInfo): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.selectedSpeaker = selectedSpeaker;\n })\n );\n }\n\n public setDeviceManagerSelectedCamera(selectedCamera?: VideoDeviceInfo): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.selectedCamera = selectedCamera;\n })\n );\n }\n\n public setDeviceManagerCameras(cameras: VideoDeviceInfo[]): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n /** SDK initializes cameras with one dummy camera with value { id: 'camera:id', name: '', deviceType: 'USBCamera' } immediately after\n * camera permissions are granted. So selectedCamera will have this value before the actual cameras are obtained. Therefore we should reset\n * selectedCamera to the first camera when there are cameras AND when current selectedCamera does not exist in the new array of cameras **/\n if (cameras.length > 0 && !cameras.some((camera) => camera.id === draft.deviceManager.selectedCamera?.id)) {\n draft.deviceManager.selectedCamera = cameras[0];\n }\n draft.deviceManager.cameras = cameras;\n })\n );\n }\n\n public setDeviceManagerMicrophones(microphones: AudioDeviceInfo[]): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.microphones = microphones;\n })\n );\n }\n\n public setDeviceManagerSpeakers(speakers: AudioDeviceInfo[]): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.speakers = speakers;\n })\n );\n }\n\n public setDeviceManagerDeviceAccess(deviceAccess: DeviceAccess): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.deviceAccess = deviceAccess;\n })\n );\n }\n\n public setDeviceManagerUnparentedView(\n localVideoStream: LocalVideoStreamState,\n view: VideoStreamRendererViewState | undefined\n ): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.deviceManager.unparentedViews.push({\n source: localVideoStream.source,\n mediaStreamType: localVideoStream.mediaStreamType,\n view: view\n });\n })\n );\n }\n\n public deleteDeviceManagerUnparentedView(localVideoStream: LocalVideoStreamState): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n const foundIndex = draft.deviceManager.unparentedViews.findIndex(\n (stream) =>\n stream.source.id === localVideoStream.source.id &&\n stream.mediaStreamType === localVideoStream.mediaStreamType\n );\n if (foundIndex !== -1) {\n draft.deviceManager.unparentedViews.splice(foundIndex, 1);\n }\n })\n );\n }\n\n public getAndIncrementAtomicId(): number {\n const id = this._atomicId;\n this._atomicId++;\n return id;\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * If the function succeeds, clears associated errors from the state.\n *\n * @param action Async function to execute.\n * @param target The error target to tee error to.\n * @param clearTargets The error targets to clear errors for if the function succeeds. By default, clears errors for `target`.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n action: (...args: Args) => Promise<R>,\n target: CallErrorTarget,\n clearTargets?: CallErrorTarget[]\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n const ret = await action(...args);\n this.modifyState(newClearCallErrorsModifier(clearTargets !== undefined ? clearTargets : [target]));\n return ret;\n } catch (error) {\n const callError = toCallError(target, error);\n this.setLatestError(target, callError);\n throw callError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * If the function succeeds, clears associated errors from the state.\n *\n * @param action Function to execute.\n * @param target The error target to tee error to.\n * @param clearTargets The error targets to clear errors for if the function succeeds. By default, clears errors for `target`.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n action: (...args: Args) => R,\n target: CallErrorTarget,\n clearTargets?: CallErrorTarget[]\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n const ret = action(...args);\n this.modifyState(newClearCallErrorsModifier(clearTargets !== undefined ? clearTargets : [target]));\n return ret;\n } catch (error) {\n const callError = toCallError(target, error);\n this.setLatestError(target, callError);\n throw callError;\n }\n };\n }\n\n private setLatestError(target: CallErrorTarget, error: CallError): void {\n this.setState(\n produce(this._state, (draft: CallClientState) => {\n draft.latestErrors[target] = error;\n })\n );\n }\n}\n\nconst toCallError = (target: CallErrorTarget, error: unknown): CallError => {\n if (error instanceof Error) {\n return new CallError(target, error);\n }\n return new CallError(target, new Error(error as string));\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Call as SdkCall,\n RemoteParticipant as SdkRemoteParticipant,\n RemoteVideoStream as SdkRemoteVideoStream,\n LocalVideoStream as SdkLocalVideoStream,\n IncomingCall as SdkIncomingCall,\n VideoStreamRendererView,\n TransferRequestedEventArgs,\n Transfer\n} from '@azure/communication-calling';\nimport { CommunicationUserIdentifier, PhoneNumberIdentifier } from '@azure/communication-common';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CallState,\n RemoteParticipantState as DeclarativeRemoteParticipant,\n RemoteVideoStreamState as DeclarativeRemoteVideoStream,\n LocalVideoStreamState as DeclarativeLocalVideoStream,\n IncomingCallState as DeclarativeIncomingCall,\n VideoStreamRendererViewState as DeclarativeVideoStreamRendererView,\n TransferRequest,\n Transfer as DeclarativeTransfer\n} from './CallClientState';\n\nexport function convertSdkLocalStreamToDeclarativeLocalStream(\n stream: SdkLocalVideoStream\n): DeclarativeLocalVideoStream {\n return {\n source: stream.source,\n mediaStreamType: stream.mediaStreamType,\n view: undefined\n };\n}\n\nexport function convertSdkRemoteStreamToDeclarativeRemoteStream(\n stream: SdkRemoteVideoStream\n): DeclarativeRemoteVideoStream {\n return {\n id: stream.id,\n mediaStreamType: stream.mediaStreamType,\n isAvailable: stream.isAvailable,\n view: undefined\n };\n}\n\nexport function convertSdkParticipantToDeclarativeParticipant(\n participant: SdkRemoteParticipant\n): DeclarativeRemoteParticipant {\n const declarativeVideoStreams = {};\n for (const videoStream of participant.videoStreams) {\n declarativeVideoStreams[videoStream.id] = convertSdkRemoteStreamToDeclarativeRemoteStream(videoStream);\n }\n return {\n identifier: participant.identifier,\n displayName: participant.displayName,\n state: participant.state,\n callEndReason: participant.callEndReason,\n videoStreams: declarativeVideoStreams,\n isMuted: participant.isMuted,\n isSpeaking: participant.isSpeaking\n };\n}\n\n// Note at the time of writing only one LocalVideoStream is supported by the SDK.\nexport function convertSdkCallToDeclarativeCall(call: SdkCall): CallState {\n const declarativeRemoteParticipants = {};\n call.remoteParticipants.forEach((participant: SdkRemoteParticipant) => {\n declarativeRemoteParticipants[toFlatCommunicationIdentifier(participant.identifier)] =\n convertSdkParticipantToDeclarativeParticipant(participant);\n });\n return {\n id: call.id,\n callerInfo: call.callerInfo,\n state: call.state,\n callEndReason: call.callEndReason,\n diagnostics: {\n network: {\n latest: {}\n },\n media: {\n latest: {}\n }\n },\n direction: call.direction,\n isMuted: call.isMuted,\n isScreenSharingOn: call.isScreenSharingOn,\n localVideoStreams: call.localVideoStreams.map(convertSdkLocalStreamToDeclarativeLocalStream),\n remoteParticipants: declarativeRemoteParticipants,\n remoteParticipantsEnded: {},\n recording: { isRecordingActive: false },\n transcription: { isTranscriptionActive: false },\n transfer: { receivedTransferRequests: [], requestedTransfers: [] },\n screenShareRemoteParticipant: undefined,\n startTime: new Date(),\n endTime: undefined\n };\n}\n\nexport function convertSdkIncomingCallToDeclarativeIncomingCall(call: SdkIncomingCall): DeclarativeIncomingCall {\n return {\n id: call.id,\n callerInfo: call.callerInfo,\n startTime: new Date(),\n endTime: undefined\n };\n}\n\nexport function convertFromSDKToDeclarativeVideoStreamRendererView(\n view: VideoStreamRendererView\n): DeclarativeVideoStreamRendererView {\n return {\n scalingMode: view.scalingMode,\n isMirrored: view.isMirrored,\n target: view.target\n };\n}\n\nexport function convertSdkTransferRequestedToDeclarativeTransferRequested(\n transferRequested: TransferRequestedEventArgs\n): TransferRequest {\n return {\n targetParticipant: transferRequested.targetParticipant\n };\n}\n\nexport function convertSdkTransferToDeclarativeTransfer(\n transfer: Transfer,\n targetParticipant: CommunicationUserIdentifier | PhoneNumberIdentifier,\n transferId: number\n): DeclarativeTransfer {\n return {\n id: transferId,\n targetParticipant: targetParticipant,\n state: transfer.state,\n error: transfer.error\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Call, Transfer } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\n\n/**\n * Subscribe to 'stateChanged' events in {@link @azure/communication-calling#Transfer}. These are outgoing or sent\n * requests.\n */\nexport class RequestedTransferSubscriber {\n private _call: Call;\n private _context: CallContext;\n private _transfer: Transfer;\n private _transferId: number;\n\n constructor(call: Call, context: CallContext, transfer: Transfer, transferId: number) {\n this._call = call;\n this._context = context;\n this._transfer = transfer;\n this._transferId = transferId;\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._transfer.on('stateChanged', this.stateChanged);\n };\n\n public unsubscribe = (): void => {\n this._transfer.off('stateChanged', this.stateChanged);\n };\n\n private stateChanged = (): void => {\n this._context.setCallRequestedTransferState(\n this._call.id,\n this._transferId,\n this._transfer.state,\n this._transfer.error\n );\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Call,\n Transfer,\n TransferCallFeature,\n TransferToParticipant,\n TransferToParticipantOptions\n} from '@azure/communication-calling';\nimport { CallContext, MAX_TRANSFER_REQUEST_LENGTH } from './CallContext';\nimport { convertSdkTransferToDeclarativeTransfer } from './Converter';\nimport { RequestedTransferSubscriber } from './RequestedTransferSubscriber';\n\nexport interface DeclarativeTransferCallFeature extends TransferCallFeature {\n /**\n * Stop any declarative specific subscriptions and remove declarative subscribers.\n */\n unsubscribe(): void;\n}\n\n/**\n * ProxyTransfer proxies transfer so that the return value from transfer can be subscribed to and its state surfaced.\n */\nclass ProxyTransferCallFeature implements ProxyHandler<TransferCallFeature> {\n private _call: Call;\n private _context: CallContext;\n private _requestedTransferSubscribers: RequestedTransferSubscriber[];\n\n constructor(call: Call, context: CallContext) {\n this._call = call;\n this._context = context;\n this._requestedTransferSubscribers = [];\n }\n\n public unsubscribe(): void {\n for (const requestedTransfer of this._requestedTransferSubscribers) {\n requestedTransfer.unsubscribe();\n }\n this._requestedTransferSubscribers = [];\n }\n\n public get<P extends keyof TransferCallFeature>(target: TransferCallFeature, prop: P): any {\n switch (prop) {\n case 'transfer': {\n return (targetParticipant: TransferToParticipant, transferOptions?: TransferToParticipantOptions): Transfer => {\n const transfer = target.transfer(targetParticipant, transferOptions);\n const transferId = this._context.getAndIncrementAtomicId();\n this._context.setCallRequestedTransfer(\n this._call.id,\n convertSdkTransferToDeclarativeTransfer(transfer, targetParticipant.targetParticipant, transferId)\n );\n\n if (this._requestedTransferSubscribers.length >= MAX_TRANSFER_REQUEST_LENGTH) {\n const subscriber = this._requestedTransferSubscribers.shift();\n subscriber?.unsubscribe();\n }\n this._requestedTransferSubscribers.push(\n new RequestedTransferSubscriber(this._call, this._context, transfer, transferId)\n );\n return transfer;\n };\n }\n default:\n return Reflect.get(target, prop);\n }\n }\n}\n\n/**\n * Creates a declarative TransferCallFeature by proxying TransferCallFeature with ProxyTransferCallFeature which proxy\n * transfer calls to update the state properly.\n *\n * @param transfer - TransferCallFeature from SDK\n * @param context - CallContext from StatefulCallClient\n */\nexport const transferCallFeatureDeclaratify = (\n call: Call,\n transfer: TransferCallFeature,\n context: CallContext\n): TransferCallFeature => {\n const proxyTransferCallFeature = new ProxyTransferCallFeature(call, context);\n Object.defineProperty(transfer, 'unsubscribe', {\n configurable: false,\n value: () => proxyTransferCallFeature.unsubscribe()\n });\n return new Proxy(transfer, proxyTransferCallFeature) as TransferCallFeature;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Call, CallApiFeature, CallFeatureFactoryType } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { transferCallFeatureDeclaratify } from './TransferCallFeatureDeclarative';\n\nexport interface DeclarativeCall extends Call {\n /**\n * Stop any declarative specific subscriptions and remove declarative subscribers.\n */\n unsubscribe(): void;\n}\n\n/**\n * ProxyCall proxies Call in order to intercept the Call.api function to return a DeclarativeTransferCallFeature.\n */\nclass ProxyCall implements ProxyHandler<Call> {\n private _call: Call;\n private _context: CallContext;\n private _transfer: any | undefined;\n\n constructor(call: Call, context: CallContext) {\n this._call = call;\n this._context = context;\n }\n\n public unsubscribe(): void {\n if (this._transfer) {\n this._transfer.unsubscribe();\n }\n }\n\n public get<P extends keyof Call>(target: Call, prop: P): any {\n switch (prop) {\n case 'api': {\n return <TFeature extends CallApiFeature>(cls: CallFeatureFactoryType<TFeature>): TFeature => {\n const feature = target.api(cls) as any;\n if (feature.transfer) {\n if (this._transfer) {\n return this._transfer as TFeature;\n } else {\n this._transfer = transferCallFeatureDeclaratify(this._call, feature, this._context);\n return this._transfer as TFeature;\n }\n } else {\n return feature as TFeature;\n }\n };\n }\n case 'mute': {\n return this._context.withAsyncErrorTeedToState(async function (...args: Parameters<Call['mute']>) {\n return await target.mute(...args);\n }, 'Call.mute');\n }\n case 'unmute': {\n return this._context.withAsyncErrorTeedToState(async function (...args: Parameters<Call['unmute']>) {\n return await target.unmute(...args);\n }, 'Call.unmute');\n }\n case 'startVideo': {\n return this._context.withAsyncErrorTeedToState(async function (...args: Parameters<Call['startVideo']>) {\n return await target.startVideo(...args);\n }, 'Call.startVideo');\n }\n case 'stopVideo': {\n return this._context.withAsyncErrorTeedToState(async function (...args: Parameters<Call['stopVideo']>) {\n return await target.stopVideo(...args);\n }, 'Call.stopVideo');\n }\n case 'startScreenSharing': {\n return this._context.withAsyncErrorTeedToState(async function (\n ...args: Parameters<Call['startScreenSharing']>\n ) {\n return await target.startScreenSharing(...args);\n },\n 'Call.startScreenSharing');\n }\n case 'stopScreenSharing': {\n return this._context.withAsyncErrorTeedToState(async function (...args: Parameters<Call['stopScreenSharing']>) {\n return await target.stopScreenSharing(...args);\n }, 'Call.stopScreenSharing');\n }\n default:\n return Reflect.get(target, prop);\n }\n }\n}\n\n/**\n * Creates a declarative Call by proxying Call with ProxyCall in order to intercept the Call.api function to return a\n * DeclarativeTransferCall. 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 - Call from SDK\n * @param context - CallContext from StatefulCallClient\n */\nexport const callDeclaratify = (call: Call, context: CallContext): DeclarativeCall => {\n const proxyCall = new ProxyCall(call, context);\n Object.defineProperty(call, 'unsubscribe', {\n configurable: false,\n value: () => proxyCall.unsubscribe()\n });\n\n return new Proxy(call, proxyCall) as DeclarativeCall;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TransferCallFeature, TransferRequestedEventArgs } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\nimport { convertSdkTransferRequestedToDeclarativeTransferRequested } from './Converter';\n\n/**\n * Subscribe to 'transferRequested' events. These are incoming or received requests.\n */\nexport class ReceivedTransferSubscriber {\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _transfer: TransferCallFeature;\n\n constructor(callIdRef: CallIdRef, context: CallContext, transfer: TransferCallFeature) {\n this._callIdRef = callIdRef;\n this._context = context;\n this._transfer = transfer;\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._transfer.on('transferRequested', this.transferRequested);\n };\n\n public unsubscribe = (): void => {\n this._transfer.off('transferRequested', this.transferRequested);\n };\n\n private transferRequested = (transferRequested: TransferRequestedEventArgs): void => {\n this._context.setCallReceivedTransferRequest(\n this._callIdRef.callId,\n convertSdkTransferRequestedToDeclarativeTransferRequested(transferRequested)\n );\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RemoteVideoStream } from '@azure/communication-calling';\nimport { RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\n\nexport class RemoteVideoStreamSubscriber {\n private _callIdRef: CallIdRef;\n private _participantKey: string;\n private _remoteVideoStream: RemoteVideoStream;\n private _context: CallContext;\n\n constructor(\n callIdRef: CallIdRef,\n participantKey: string,\n remoteVideoStream: RemoteVideoStream,\n context: CallContext\n ) {\n this._callIdRef = callIdRef;\n this._participantKey = participantKey;\n this._remoteVideoStream = remoteVideoStream;\n this._context = context;\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._remoteVideoStream.on('isAvailableChanged', this.isAvailableChanged);\n this.checkAndUpdateScreenShareState();\n };\n\n public unsubscribe = (): void => {\n this._remoteVideoStream.off('isAvailableChanged', this.isAvailableChanged);\n };\n\n private includesActiveScreenShareStream = (streams: { [key: number]: RemoteVideoStreamState }): boolean => {\n for (const stream of Object.values(streams)) {\n if (stream.mediaStreamType === 'ScreenSharing' && stream.isAvailable) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Update the state with the active screen share stream. If there is an existing stream will overwrite it if this one\n * is active (newer stream takes priority). If there is an existing stream and this one is set to unavailable, and the\n * existing stream is different participant, then don't set the active screen share stream to undefined, else set it\n * to undefined.\n */\n private checkAndUpdateScreenShareState = (): void => {\n if (this._remoteVideoStream.mediaStreamType !== 'ScreenSharing') {\n return;\n }\n\n if (this._remoteVideoStream.isAvailable) {\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, this._participantKey);\n return;\n }\n\n const existingScreenShare = this._context.getState().calls[this._callIdRef.callId]?.screenShareRemoteParticipant;\n\n // If somehow we end up with an event where a RemoteParticipant's ScreenShare stream is set to\n // unavailable but there exists already another different participant actively sharing, and they are still\n // sharing then this event shouldn't set the screenShareRemoteParticipant to undefined.\n if (!existingScreenShare || existingScreenShare === this._participantKey) {\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\n return;\n }\n\n const streams =\n this._context.getState().calls[this._callIdRef.callId]?.remoteParticipants[existingScreenShare]?.videoStreams;\n\n if (!streams) {\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\n return;\n }\n\n // If the existing ScreenShare that is not owned by the current RemoteParticipant is still active, don't\n // overwrite it with undefined. So only overwrite if it is not active.\n if (!this.includesActiveScreenShareStream(streams)) {\n this._context.setCallScreenShareParticipant(this._callIdRef.callId, undefined);\n return;\n }\n };\n\n private isAvailableChanged = (): void => {\n this._context.setRemoteVideoStreamIsAvailable(\n this._callIdRef.callId,\n this._participantKey,\n this._remoteVideoStream.id,\n this._remoteVideoStream.isAvailable\n );\n\n this.checkAndUpdateScreenShareState();\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CreateViewOptions, LocalVideoStream, VideoStreamRenderer } from '@azure/communication-calling';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport {\n convertSdkLocalStreamToDeclarativeLocalStream,\n convertSdkRemoteStreamToDeclarativeRemoteStream,\n convertFromSDKToDeclarativeVideoStreamRendererView\n} from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\n\nasync function createViewRemoteVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n participantId: CommunicationIdentifierKind | string,\n stream: RemoteVideoStreamState,\n options?: CreateViewOptions\n): Promise<void> {\n // Render RemoteVideoStream that is part of a Call\n const streamId = stream.id;\n let participantKey;\n if (typeof participantId === 'string') {\n participantKey = participantId;\n } else {\n participantKey = toFlatCommunicationIdentifier(participantId);\n }\n const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\n\n if (!renderInfo) {\n console.warn('RemoteVideoStream not found in state');\n return;\n }\n\n if (renderInfo.status === 'Rendered') {\n console.warn('RemoteVideoStream is already rendered');\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n console.warn('RemoteVideoStream rendering is already in progress');\n return;\n }\n\n if (renderInfo.status === 'Stopping') {\n console.warn('RemoteVideoStream is in the middle of stopping');\n return;\n }\n\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', undefined);\n\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);\n throw e;\n }\n\n const refreshedRenderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\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 state.\n renderer.dispose();\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\n return;\n }\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 renderer.dispose();\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n refreshedRenderInfo.stream,\n 'NotRendered',\n undefined\n );\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\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 internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n refreshedRenderInfo.stream,\n 'Rendered',\n renderer\n );\n context.setRemoteVideoStreamRendererView(\n callId,\n participantKey,\n streamId,\n convertFromSDKToDeclarativeVideoStreamRendererView(view)\n );\n}\n\nasync function createViewLocalVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n options?: CreateViewOptions\n): Promise<void> {\n // Render LocalVideoStream that is part of a Call\n const renderInfo = internalContext.getLocalRenderInfo(callId);\n\n if (!renderInfo) {\n console.warn('LocalVideoStream not found in state');\n return;\n }\n\n if (renderInfo.status === 'Rendered') {\n console.warn('LocalVideoStream is already rendered');\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n console.warn('LocalVideoStream rendering is already in progress');\n return;\n }\n\n if (renderInfo.status === 'Stopping') {\n console.warn('LocalVideoStream is in the middle of stopping');\n return;\n }\n\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderer);\n\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);\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.getLocalRenderInfo(callId);\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 renderer.dispose();\n context.setLocalVideoStreamRendererView(callId, undefined);\n return;\n }\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 renderer.dispose();\n internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, undefined);\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 internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);\n context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n}\n\nasync function createViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState,\n options?: CreateViewOptions\n): Promise<void> {\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n\n if (renderInfo && renderInfo.status === 'Rendered') {\n console.warn('Unparented LocalVideoStream is already rendered');\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Rendering') {\n console.warn('Unparented LocalVideoStream rendering is already in progress');\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Stopping') {\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\n return;\n }\n\n const localVideoStream = new LocalVideoStream(stream.source);\n const renderer = new VideoStreamRenderer(localVideoStream);\n\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\n\n let view;\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\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\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 context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n}\n\nfunction disposeViewRemoteVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n participantId: CommunicationIdentifierKind | string,\n stream: RemoteVideoStreamState\n): void {\n const streamId = stream.id;\n\n let participantKey;\n if (typeof participantId === 'string') {\n participantKey = participantId;\n } else {\n participantKey = toFlatCommunicationIdentifier(participantId);\n }\n\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\n\n const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);\n if (!renderInfo) {\n return;\n }\n\n // Sets the status and also renderer. I think we need to always set renderer to undefined since in all status when\n // cleaned up should have renderer as undefined. If the status is 'Rendered' and renderer is not defined it should\n // be cleaned up below so we can set it to undefined here.\n if (renderInfo.status === 'Rendering') {\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);\n }\n\n if (renderInfo.renderer) {\n renderInfo.renderer.dispose();\n }\n}\n\nfunction disposeViewLocalVideo(context: CallContext, internalContext: InternalCallContext, callId: string): void {\n context.setLocalVideoStreamRendererView(callId, undefined);\n\n const renderInfo = internalContext.getLocalRenderInfo(callId);\n if (!renderInfo) {\n return;\n }\n\n // Sets the status and also renderer. I think we need to always set renderer to undefined since in all status when\n // cleaned up should have renderer as undefined. If the status is 'Rendered' and renderer is not defined it should\n // be cleaned up below so we can set it to undefined here.\n if (renderInfo.status === 'Rendering') {\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);\n }\n\n if (renderInfo.renderer) {\n renderInfo.renderer.dispose();\n }\n}\n\nfunction disposeViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState\n): void {\n context.deleteDeviceManagerUnparentedView(stream);\n\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!renderInfo) {\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.deleteUnparentedRenderInfo(stream);\n }\n\n if (renderInfo.renderer) {\n renderInfo.renderer.dispose();\n }\n}\n\nexport function createView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState,\n options?: CreateViewOptions\n): Promise<void> {\n if ('id' in stream && callId && participantId) {\n // Render RemoteVideoStream that is part of a Call\n return createViewRemoteVideo(context, internalContext, callId, participantId, stream, options);\n } else if (!('id' in stream) && callId) {\n // Render LocalVideoStream that is part of a Call\n return createViewLocalVideo(context, internalContext, callId, options);\n } else if (!('id' in stream) && !callId) {\n // Render LocalVideoStream that is not part of a Call\n return createViewUnparentedVideo(context, internalContext, stream, options);\n } else {\n console.warn('Invalid combination of parameters');\n return Promise.resolve();\n }\n}\n\nexport function disposeView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState\n): void {\n if ('id' in stream && callId && participantId) {\n // Stop rendering RemoteVideoStream that is part of a Call\n disposeViewRemoteVideo(context, internalContext, callId, participantId, stream);\n } else if (!('id' in stream) && callId) {\n // Stop rendering LocalVideoStream that is part of a Call\n disposeViewLocalVideo(context, internalContext, callId);\n } else if (!('id' in stream) && !callId) {\n // Stop rendering LocalVideoStream that is not part of a Call\n disposeViewUnparentedVideo(context, internalContext, stream);\n } else {\n console.warn('Invalid combination of parameters');\n return;\n }\n}\n\n// Only stops videos that are tied to a Call.\nexport function disposeAllViewsFromCall(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string\n): void {\n const callStreams = internalContext.getRemoteRenderInfoForCall(callId);\n if (callStreams) {\n for (const [participantKey, participantStreams] of callStreams.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(\n context,\n internalContext,\n callId,\n participantKey,\n convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream)\n );\n }\n }\n }\n const localStreamAndRenderer = internalContext.getLocalRenderInfo(callId);\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(\n context,\n internalContext,\n callId,\n undefined,\n convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream)\n );\n }\n}\n\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\n const remoteStreamAndRenderers = internalContext.getRemoteRenderInfos();\n for (const [callId] of remoteStreamAndRenderers.entries()) {\n disposeAllViewsFromCall(context, internalContext, callId);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\nimport { convertSdkRemoteStreamToDeclarativeRemoteStream } from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { RemoteVideoStreamSubscriber } from './RemoteVideoStreamSubscriber';\nimport { disposeView } from './StreamUtils';\n\n/**\n * Keeps track of the listeners assigned to a particular participant because when we get an event from SDK, it doesn't\n * tell us which participant it is for. If we keep track of this then we know which participant in the state that needs\n * an update and also which property of that participant. Also we can use this when unregistering to a participant.\n */\nexport class ParticipantSubscriber {\n private _callIdRef: CallIdRef;\n private _participant: RemoteParticipant;\n private _context: CallContext;\n private _internalContext: InternalCallContext;\n private _participantKey: string;\n private _remoteVideoStreamSubscribers: Map<number, RemoteVideoStreamSubscriber>;\n\n constructor(\n callIdRef: CallIdRef,\n participant: RemoteParticipant,\n context: CallContext,\n internalContext: InternalCallContext\n ) {\n this._callIdRef = callIdRef;\n this._participant = participant;\n this._context = context;\n this._internalContext = internalContext;\n this._participantKey = toFlatCommunicationIdentifier(this._participant.identifier);\n this._remoteVideoStreamSubscribers = new Map<number, RemoteVideoStreamSubscriber>();\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._participant.on('stateChanged', this.stateChanged);\n this._participant.on('isMutedChanged', this.isMutedChanged);\n this._participant.on('displayNameChanged', this.displayNameChanged);\n this._participant.on('isSpeakingChanged', this.isSpeakingChanged);\n this._participant.on('videoStreamsUpdated', this.videoStreamsUpdated);\n\n if (this._participant.videoStreams.length > 0) {\n for (const stream of this._participant.videoStreams) {\n this._internalContext.setRemoteRenderInfo(\n this._callIdRef.callId,\n this._participantKey,\n stream.id,\n stream,\n 'NotRendered',\n undefined\n );\n this.addRemoteVideoStreamSubscriber(stream);\n }\n this._context.setRemoteVideoStreams(\n this._callIdRef.callId,\n this._participantKey,\n this._participant.videoStreams.map(convertSdkRemoteStreamToDeclarativeRemoteStream),\n []\n );\n }\n };\n\n public unsubscribe = (): void => {\n this._participant.off('stateChanged', this.stateChanged);\n this._participant.off('isMutedChanged', this.isMutedChanged);\n this._participant.off('displayNameChanged', this.displayNameChanged);\n this._participant.off('isSpeakingChanged', this.isSpeakingChanged);\n this._participant.off('videoStreamsUpdated', this.videoStreamsUpdated);\n\n // If unsubscribing it means the participant left the call. If they have any rendering streams we should stop them\n // as it doesn't make sense to render for an ended participant.\n if (this._participant.videoStreams.length > 0) {\n for (const stream of this._participant.videoStreams) {\n disposeView(\n this._context,\n this._internalContext,\n this._callIdRef.callId,\n this._participantKey,\n convertSdkRemoteStreamToDeclarativeRemoteStream(stream)\n );\n this._internalContext.deleteRemoteRenderInfo(this._callIdRef.callId, this._participantKey, stream.id);\n }\n }\n };\n\n private addRemoteVideoStreamSubscriber = (remoteVideoStream: RemoteVideoStream): void => {\n this._remoteVideoStreamSubscribers.get(remoteVideoStream.id)?.unsubscribe();\n this._remoteVideoStreamSubscribers.set(\n remoteVideoStream.id,\n new RemoteVideoStreamSubscriber(this._callIdRef, this._participantKey, remoteVideoStream, this._context)\n );\n };\n\n private stateChanged = (): void => {\n this._context.setParticipantState(this._callIdRef.callId, this._participantKey, this._participant.state);\n };\n\n private isMutedChanged = (): void => {\n this._context.setParticipantIsMuted(this._callIdRef.callId, this._participantKey, this._participant.isMuted);\n };\n\n private displayNameChanged = (): void => {\n this._context.setParticipantDisplayName(\n this._callIdRef.callId,\n this._participantKey,\n this._participant.displayName || ''\n );\n };\n\n private isSpeakingChanged = (): void => {\n this._context.setParticipantIsSpeaking(this._callIdRef.callId, this._participantKey, this._participant.isSpeaking);\n };\n\n private videoStreamsUpdated = (event: { added: RemoteVideoStream[]; removed: RemoteVideoStream[] }): void => {\n for (const stream of event.removed) {\n this._remoteVideoStreamSubscribers.get(stream.id)?.unsubscribe();\n disposeView(\n this._context,\n this._internalContext,\n this._callIdRef.callId,\n this._participantKey,\n convertSdkRemoteStreamToDeclarativeRemoteStream(stream)\n );\n this._internalContext.deleteRemoteRenderInfo(this._callIdRef.callId, this._participantKey, stream.id);\n }\n\n for (const stream of event.added) {\n this._internalContext.setRemoteRenderInfo(\n this._callIdRef.callId,\n this._participantKey,\n stream.id,\n stream,\n 'NotRendered',\n undefined\n );\n this.addRemoteVideoStreamSubscriber(stream);\n }\n\n this._context.setRemoteVideoStreams(\n this._callIdRef.callId,\n this._participantKey,\n event.added.map(convertSdkRemoteStreamToDeclarativeRemoteStream),\n event.removed.map((stream: RemoteVideoStream) => stream.id)\n );\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RecordingCallFeature } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\n\nexport class RecordingSubscriber {\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _recording: RecordingCallFeature;\n\n constructor(callIdRef: CallIdRef, context: CallContext, recording: RecordingCallFeature) {\n this._callIdRef = callIdRef;\n this._context = context;\n this._recording = recording;\n\n // If recording as already started when we joined the call, make sure it is reflected in state as there may not\n // be an event for it.\n if (this._recording.isRecordingActive) {\n this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive);\n }\n\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._recording.on('isRecordingActiveChanged', this.isAvailableChanged);\n };\n\n public unsubscribe = (): void => {\n this._recording.off('isRecordingActiveChanged', this.isAvailableChanged);\n };\n\n private isAvailableChanged = (): void => {\n this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive);\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TranscriptionCallFeature } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\n\nexport class TranscriptionSubscriber {\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _transcription: TranscriptionCallFeature;\n\n constructor(callIdRef: CallIdRef, context: CallContext, transcription: TranscriptionCallFeature) {\n this._callIdRef = callIdRef;\n this._context = context;\n this._transcription = transcription;\n\n // If transcription as already started when we joined the call, make sure it is reflected in state as there may not\n // be an event for it.\n if (this._transcription.isTranscriptionActive) {\n this._context.setCallTranscriptionActive(this._callIdRef.callId, this._transcription.isTranscriptionActive);\n }\n\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._transcription.on('isTranscriptionActiveChanged', this.isTranscriptionActiveChanged);\n };\n\n public unsubscribe = (): void => {\n this._transcription.off('isTranscriptionActiveChanged', this.isTranscriptionActiveChanged);\n };\n\n private isTranscriptionActiveChanged = (): void => {\n this._context.setCallTranscriptionActive(this._callIdRef.callId, this._transcription.isTranscriptionActive);\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DiagnosticsCallFeature,\n DiagnosticChangedEventArgs,\n LatestDiagnosticValue,\n MediaDiagnosticChangedEventArgs,\n NetworkDiagnosticChangedEventArgs\n} from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\n\nexport class DiagnosticsSubscriber {\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _diagnostics: DiagnosticsCallFeature;\n\n constructor(callIdRef: CallIdRef, context: CallContext, diagnostics: DiagnosticsCallFeature) {\n this._callIdRef = callIdRef;\n this._context = context;\n this._diagnostics = diagnostics;\n\n this.setInitialDiagnostics();\n this.subscribe();\n }\n\n public unsubscribe = (): void => {\n this._diagnostics.network.off('diagnosticChanged', this.networkDiagnosticsChanged.bind(this));\n this._diagnostics.media.off('diagnosticChanged', this.mediaDiagnosticsChanged.bind(this));\n };\n\n private setInitialDiagnostics(): void {\n const network = this._diagnostics.network.getLatest();\n const media = this._diagnostics.media.getLatest();\n if (Object.entries(network).length === 0 && Object.entries(media).length === 0) {\n return;\n }\n\n this._context.modifyState((state) => {\n const call = state.calls[this._callIdRef.callId];\n if (call === undefined) {\n return;\n }\n call.diagnostics = {\n network: {\n latest: network\n },\n media: {\n latest: media\n }\n };\n });\n }\n\n private subscribe(): void {\n this._diagnostics.network.on('diagnosticChanged', this.networkDiagnosticsChanged.bind(this));\n this._diagnostics.media.on('diagnosticChanged', this.mediaDiagnosticsChanged.bind(this));\n }\n\n private networkDiagnosticsChanged(args: NetworkDiagnosticChangedEventArgs): void {\n this._context.modifyState((state) => {\n const call = state.calls[this._callIdRef.callId];\n if (call === undefined) {\n return;\n }\n const network = call.diagnostics?.network.latest;\n if (network) {\n network[args.diagnostic] = latestFromEvent(args);\n }\n });\n }\n\n private mediaDiagnosticsChanged(args: MediaDiagnosticChangedEventArgs): void {\n this._context.modifyState((state) => {\n const call = state.calls[this._callIdRef.callId];\n if (call === undefined) {\n return;\n }\n const media = call.diagnostics?.media.latest;\n if (media) {\n media[args.diagnostic] = latestFromEvent(args);\n }\n });\n }\n}\n\nconst latestFromEvent = (args: DiagnosticChangedEventArgs): LatestDiagnosticValue => ({\n value: args.value,\n valueType: args.valueType\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Call, Features, LocalVideoStream, RemoteParticipant } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CallContext } from './CallContext';\nimport { CallIdRef } from './CallIdRef';\nimport {\n convertSdkLocalStreamToDeclarativeLocalStream,\n convertSdkParticipantToDeclarativeParticipant\n} from './Converter';\nimport { ReceivedTransferSubscriber } from './ReceivedTransferSubscriber';\nimport { InternalCallContext } from './InternalCallContext';\nimport { ParticipantSubscriber } from './ParticipantSubscriber';\nimport { RecordingSubscriber } from './RecordingSubscriber';\nimport { disposeView } from './StreamUtils';\nimport { TranscriptionSubscriber } from './TranscriptionSubscriber';\nimport { DiagnosticsSubscriber } from './DiagnosticsSubscriber';\n\n/**\n * Keeps track of the listeners assigned to a particular call because when we get an event from SDK, it doesn't tell us\n * which call it is for. If we keep track of this then we know which call in the state that needs an update and also\n * which property of that call. Also we can use this when unregistering to a call.\n */\nexport class CallSubscriber {\n private _call: Call;\n private _callIdRef: CallIdRef;\n private _context: CallContext;\n private _internalContext: InternalCallContext;\n\n private _diagnosticsSubscriber: DiagnosticsSubscriber;\n private _participantSubscribers: Map<string, ParticipantSubscriber>;\n private _receivedTransferSubscriber: ReceivedTransferSubscriber;\n private _recordingSubscriber: RecordingSubscriber;\n private _transcriptionSubscriber: TranscriptionSubscriber;\n\n constructor(call: Call, context: CallContext, internalContext: InternalCallContext) {\n this._call = call;\n this._callIdRef = { callId: call.id };\n this._context = context;\n this._internalContext = internalContext;\n\n this._diagnosticsSubscriber = new DiagnosticsSubscriber(\n this._callIdRef,\n this._context,\n this._call.api(Features.Diagnostics)\n );\n this._participantSubscribers = new Map<string, ParticipantSubscriber>();\n this._receivedTransferSubscriber = new ReceivedTransferSubscriber(\n this._callIdRef,\n this._context,\n this._call.api(Features.Transfer)\n );\n this._recordingSubscriber = new RecordingSubscriber(\n this._callIdRef,\n this._context,\n this._call.api(Features.Recording)\n );\n this._transcriptionSubscriber = new TranscriptionSubscriber(\n this._callIdRef,\n this._context,\n this._call.api(Features.Transcription)\n );\n\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._call.on('stateChanged', this.stateChanged);\n this._call.on('idChanged', this.idChanged);\n this._call.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\n this._call.on('remoteParticipantsUpdated', this.remoteParticipantsUpdated);\n this._call.on('localVideoStreamsUpdated', this.localVideoStreamsUpdated);\n this._call.on('isMutedChanged', this.isMuteChanged);\n this._call.api(Features.DominantSpeakers).on('dominantSpeakersChanged', this.dominantSpeakersChanged);\n\n // At time of writing only one LocalVideoStream is supported by SDK.\n if (this._call.localVideoStreams.length > 0) {\n this._internalContext.setLocalRenderInfo(\n this._callIdRef.callId,\n this._call.localVideoStreams[0],\n 'NotRendered',\n undefined\n );\n }\n\n if (this._call.remoteParticipants.length > 0) {\n this._call.remoteParticipants.forEach((participant: RemoteParticipant) => {\n this.addParticipantListener(participant);\n });\n\n this._context.setCallRemoteParticipants(\n this._callIdRef.callId,\n this._call.remoteParticipants.map(convertSdkParticipantToDeclarativeParticipant),\n []\n );\n }\n };\n\n public unsubscribe = (): void => {\n this._call.off('stateChanged', this.stateChanged);\n this._call.off('idChanged', this.idChanged);\n this._call.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged);\n this._call.off('remoteParticipantsUpdated', this.remoteParticipantsUpdated);\n this._call.off('localVideoStreamsUpdated', this.localVideoStreamsUpdated);\n this._call.off('isMutedChanged', this.isMuteChanged);\n\n this._participantSubscribers.forEach((participantSubscriber: ParticipantSubscriber) => {\n participantSubscriber.unsubscribe();\n });\n this._participantSubscribers.clear();\n\n // If we are unsubscribing that means we no longer want to display any video for this call (callEnded or callAgent\n // disposed) and we should not be updating it any more. So if video is rendering we stop rendering.\n if (this._call.localVideoStreams && this._call.localVideoStreams[0]) {\n disposeView(\n this._context,\n this._internalContext,\n this._callIdRef.callId,\n undefined,\n convertSdkLocalStreamToDeclarativeLocalStream(this._call.localVideoStreams[0])\n );\n }\n\n this._internalContext.deleteLocalRenderInfo(this._callIdRef.callId);\n\n this._diagnosticsSubscriber.unsubscribe();\n this._receivedTransferSubscriber.unsubscribe();\n this._recordingSubscriber.unsubscribe();\n this._transcriptionSubscriber.unsubscribe();\n };\n\n private addParticipantListener(participant: RemoteParticipant): void {\n const participantKey = toFlatCommunicationIdentifier(participant.identifier);\n this._participantSubscribers.get(participantKey)?.unsubscribe();\n this._participantSubscribers.set(\n participantKey,\n new ParticipantSubscriber(this._callIdRef, participant, this._context, this._internalContext)\n );\n }\n\n private removeParticipantListener(participant: RemoteParticipant): void {\n const participantKey = toFlatCommunicationIdentifier(participant.identifier);\n const participantSubscriber = this._participantSubscribers.get(participantKey);\n if (participantSubscriber) {\n participantSubscriber.unsubscribe();\n this._participantSubscribers.delete(participantKey);\n }\n }\n\n private stateChanged = (): void => {\n this._context.setCallState(this._callIdRef.callId, this._call.state);\n };\n\n private idChanged = (): void => {\n this._internalContext.setCallId(this._call.id, this._callIdRef.callId);\n this._context.setCallId(this._call.id, this._callIdRef.callId);\n this._callIdRef.callId = this._call.id;\n };\n\n private isScreenSharingOnChanged = (): void => {\n this._context.setCallIsScreenSharingOn(this._callIdRef.callId, this._call.isScreenSharingOn);\n };\n\n private isMuteChanged = (): void => {\n this._context.setCallIsMicrophoneMuted(this._callIdRef.callId, this._call.isMuted);\n };\n\n private remoteParticipantsUpdated = (event: { added: RemoteParticipant[]; removed: RemoteParticipant[] }): void => {\n event.added.forEach((participant: RemoteParticipant) => {\n this.addParticipantListener(participant);\n });\n event.removed.forEach((participant: RemoteParticipant) => {\n this.removeParticipantListener(participant);\n });\n\n // Remove any added participants from remoteParticipantsEnded if they are there and add any removed participants to\n // remoteParticipantsEnded.\n this._context.setCallRemoteParticipantsEnded(\n this._callIdRef.callId,\n event.removed.map(convertSdkParticipantToDeclarativeParticipant),\n event.added.map((participant: RemoteParticipant) => {\n return toFlatCommunicationIdentifier(participant.identifier);\n })\n );\n\n // Add added participants to remoteParticipants and remove removed participants from remoteParticipants.\n this._context.setCallRemoteParticipants(\n this._callIdRef.callId,\n event.added.map(convertSdkParticipantToDeclarativeParticipant),\n event.removed.map((participant: RemoteParticipant) => {\n return toFlatCommunicationIdentifier(participant.identifier);\n })\n );\n };\n\n private localVideoStreamsUpdated = (event: { added: LocalVideoStream[]; removed: LocalVideoStream[] }): void => {\n // At time of writing only one LocalVideoStream is supported by SDK.\n if (event.added.length > 0) {\n const localVideoStreams = [convertSdkLocalStreamToDeclarativeLocalStream(this._call.localVideoStreams[0])];\n // IMPORTANT: The internalContext should be set before context. This is done to ensure that the internal context\n // has the required data when component re-renders due to external state changes.\n this._internalContext.setLocalRenderInfo(\n this._callIdRef.callId,\n this._call.localVideoStreams[0],\n 'NotRendered',\n undefined\n );\n this._context.setCallLocalVideoStream(this._callIdRef.callId, [...localVideoStreams]);\n }\n if (event.removed.length > 0) {\n disposeView(\n this._context,\n this._internalContext,\n this._callIdRef.callId,\n undefined,\n convertSdkLocalStreamToDeclarativeLocalStream(event.removed[0])\n );\n this._internalContext.deleteLocalRenderInfo(this._callIdRef.callId);\n this._context.setCallLocalVideoStream(this._callIdRef.callId, []);\n }\n };\n\n private dominantSpeakersChanged = (): void => {\n const dominantSpeakers = this._call.api(Features.DominantSpeakers).dominantSpeakers;\n this._context.setCallDominantSpeakers(this._callIdRef.callId, dominantSpeakers);\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallEndReason, IncomingCall } from '@azure/communication-calling';\n\n/**\n * Keeps track of the listeners assigned to a particular incoming call because when we get an event from SDK, it doesn't\n * tell us which incoming call it is for. If we keep track of this then we know which incoming call in the state that\n * needs an update and also which property of that incoming call. Also we can use this when unregistering to a incoming\n * call.\n */\nexport class IncomingCallSubscriber {\n private _incomingCall: IncomingCall;\n private _setIncomingCallEnded: (incomingCallId: string, callEndReason: CallEndReason) => void;\n\n constructor(\n incomingCall: IncomingCall,\n // setIncomingCallEnded callback is used so parent can clean up IncomingCallSubscriber.\n setIncomingCallEnded: (incomingCallId: string, callEndReason: CallEndReason) => void\n ) {\n this._incomingCall = incomingCall;\n this._setIncomingCallEnded = setIncomingCallEnded;\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._incomingCall.on('callEnded', this.callEnded);\n };\n\n public unsubscribe = (): void => {\n this._incomingCall.off('callEnded', this.callEnded);\n };\n\n private callEnded = (event: { callEndReason: CallEndReason }): void => {\n this._setIncomingCallEnded(this._incomingCall.id, event.callEndReason);\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Call, CallAgent, CallEndReason, CollectionUpdatedEvent, IncomingCall } from '@azure/communication-calling';\nimport { CallContext } from './CallContext';\nimport { callDeclaratify, DeclarativeCall } from './CallDeclarative';\nimport { CallSubscriber } from './CallSubscriber';\nimport { convertSdkCallToDeclarativeCall, convertSdkIncomingCallToDeclarativeIncomingCall } from './Converter';\nimport { IncomingCallSubscriber } from './IncomingCallSubscriber';\nimport { InternalCallContext } from './InternalCallContext';\nimport { disposeAllViewsFromCall, disposeAllViews } from './StreamUtils';\n\n/**\n * ProxyCallAgent proxies CallAgent and saves any returned state in the given context. It will subscribe to all state\n * updates in the CallAgent and in the contained Calls and RemoteParticipants. When dispose is called it will\n * unsubscribe from all state updates.\n */\nclass ProxyCallAgent implements ProxyHandler<CallAgent> {\n private _callAgent: CallAgent;\n private _context: CallContext;\n private _internalContext: InternalCallContext;\n private _callSubscribers: Map<Call, CallSubscriber>;\n private _incomingCallSubscribers: Map<string, IncomingCallSubscriber>;\n private _declarativeCalls: Map<Call, DeclarativeCall>;\n private _externalCallsUpdatedListeners: Set<CollectionUpdatedEvent<Call>>;\n\n constructor(callAgent: CallAgent, context: CallContext, internalContext: InternalCallContext) {\n this._callAgent = callAgent;\n this._context = context;\n this._internalContext = internalContext;\n this._callSubscribers = new Map<Call, CallSubscriber>();\n this._incomingCallSubscribers = new Map<string, IncomingCallSubscriber>();\n this._declarativeCalls = new Map<Call, DeclarativeCall>();\n this._externalCallsUpdatedListeners = new Set<CollectionUpdatedEvent<Call>>();\n this.subscribe();\n }\n\n private subscribe = (): void => {\n this._callAgent.on('callsUpdated', this.callsUpdated);\n this._callAgent.on('incomingCall', this.incomingCall);\n\n // There could be scenario that when ProxyCallAgent is created that the given CallAgent already has Calls. In this\n // case we need to make sure to subscribe to those already existing Calls.\n for (const call of this._callAgent.calls) {\n this.addCall(call);\n }\n };\n\n private unsubscribe = (): void => {\n this._callAgent.off('callsUpdated', this.callsUpdated);\n this._callAgent.off('incomingCall', this.incomingCall);\n\n // Unsubscribe is called when CallAgent is disposed. This should mean no more updating of existing call but we don't\n // remove any existing state.\n for (const [_, callSubscriber] of this._callSubscribers.entries()) {\n callSubscriber.unsubscribe();\n }\n this._callSubscribers.clear();\n\n for (const [_, incomingCallSubscriber] of this._incomingCallSubscribers.entries()) {\n incomingCallSubscriber.unsubscribe();\n }\n this._incomingCallSubscribers.clear();\n\n for (const [_, declarativeCall] of this._declarativeCalls.entries()) {\n declarativeCall.unsubscribe();\n }\n this._declarativeCalls.clear();\n };\n\n private callsUpdated = (event: { added: Call[]; removed: Call[] }): void => {\n const addedStatefulCall: DeclarativeCall[] = [];\n for (const call of event.added) {\n const statefulCall = this.addCall(call);\n addedStatefulCall.push(statefulCall);\n }\n const removedStatefulCall: DeclarativeCall[] = [];\n for (const call of event.removed) {\n disposeAllViewsFromCall(this._context, this._internalContext, call.id);\n const callSubscriber = this._callSubscribers.get(call);\n if (callSubscriber) {\n callSubscriber.unsubscribe();\n this._callSubscribers.delete(call);\n }\n this._context.setCallEnded(call.id, call.callEndReason);\n const declarativeCall = this._declarativeCalls.get(call);\n if (declarativeCall) {\n declarativeCall.unsubscribe();\n removedStatefulCall.push(declarativeCall);\n this._declarativeCalls.delete(call);\n } else {\n removedStatefulCall.push(callDeclaratify(call, this._context));\n }\n }\n\n for (const externalCallsUpdatedListener of this._externalCallsUpdatedListeners) {\n externalCallsUpdatedListener({ added: addedStatefulCall, removed: removedStatefulCall });\n }\n };\n\n private setIncomingCallEnded = (incomingCallId: string, callEndReason: CallEndReason): void => {\n const incomingCallSubscriber = this._incomingCallSubscribers.get(incomingCallId);\n if (incomingCallSubscriber) {\n incomingCallSubscriber.unsubscribe();\n this._incomingCallSubscribers.delete(incomingCallId);\n }\n this._context.setIncomingCallEnded(incomingCallId, callEndReason);\n };\n\n private incomingCall = (event: { incomingCall: IncomingCall }): void => {\n // Make sure to not subscribe to the incoming call if we are already subscribed to it.\n if (!this._incomingCallSubscribers.has(event.incomingCall.id)) {\n this._incomingCallSubscribers.set(\n event.incomingCall.id,\n new IncomingCallSubscriber(event.incomingCall, this.setIncomingCallEnded)\n );\n }\n this._context.setIncomingCall(convertSdkIncomingCallToDeclarativeIncomingCall(event.incomingCall));\n };\n\n private addCall = (call: Call): DeclarativeCall => {\n this._callSubscribers.get(call)?.unsubscribe();\n\n // For API extentions we need to have the call in the state when we are subscribing as we may want to update the\n // state during the subscription process in the subscriber so we add the call to state before subscribing.\n this._context.setCall(convertSdkCallToDeclarativeCall(call));\n this._callSubscribers.set(call, new CallSubscriber(call, this._context, this._internalContext));\n return this.getOrCreateDeclarativeCall(call);\n };\n\n private getOrCreateDeclarativeCall = (call: Call): DeclarativeCall => {\n const declarativeCall = this._declarativeCalls.get(call);\n if (declarativeCall) {\n return declarativeCall;\n }\n\n const newDeclarativeCall = callDeclaratify(call, this._context);\n this._declarativeCalls.set(call, newDeclarativeCall as DeclarativeCall);\n return newDeclarativeCall;\n };\n\n public get<P extends keyof CallAgent>(target: CallAgent, prop: P): any {\n switch (prop) {\n case 'startCall': {\n return this._context.withErrorTeedToState((...args: Parameters<CallAgent['startCall']>): Call => {\n const call = target.startCall(...args);\n this.addCall(call);\n return this.getOrCreateDeclarativeCall(call);\n }, 'CallAgent.startCall');\n }\n case 'join': {\n return this._context.withErrorTeedToState((...args: Parameters<CallAgent['join']>): Call => {\n const call = target.join(...args);\n this.addCall(call);\n return this.getOrCreateDeclarativeCall(call);\n }, 'CallAgent.join');\n }\n case 'calls': {\n return Array.from(this._declarativeCalls.values());\n }\n case 'on': {\n return (...args: Parameters<CallAgent['on']>): void => {\n const isCallsUpdated = args[0] === 'callsUpdated';\n if (isCallsUpdated) {\n const listener = args[1];\n this._externalCallsUpdatedListeners.add(listener);\n } else {\n target.on(...args);\n }\n };\n }\n case 'off': {\n return (...args: Parameters<CallAgent['off']>): void => {\n const isCallsUpdated = args[0] === 'callsUpdated';\n if (isCallsUpdated) {\n const listener = args[1];\n this._externalCallsUpdatedListeners.delete(listener);\n } else {\n target.off(...args);\n }\n };\n }\n case 'dispose': {\n return (): Promise<void> => {\n return target.dispose().then(() => {\n this.unsubscribe();\n });\n };\n }\n default:\n return Reflect.get(target, prop);\n }\n }\n}\n\n/**\n * Creates a declarative CallAgent by proxying CallAgent with ProxyCallAgent which will track state updates by updating\n * the given context.\n *\n * @param callAgent - CallAgent from SDK\n * @param context - CallContext from StatefulCallClient\n * @param internalContext- InternalCallContext from StatefulCallClient\n */\nexport const callAgentDeclaratify = (\n callAgent: CallAgent,\n context: CallContext,\n internalContext: InternalCallContext\n): CallAgent => {\n // Make sure there are no existing call data if creating a new CallAgentDeclarative (if creating a new\n // CallAgentDeclarative after disposing of the hold one will mean context have old call state). TODO: should we stop\n // rendering when the previous callAgent is disposed?\n disposeAllViews(context, internalContext);\n\n context.clearCallRelatedState();\n internalContext.clearCallRelatedState();\n return new Proxy(callAgent, new ProxyCallAgent(callAgent, context, internalContext)) as CallAgent;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { LocalVideoStream, RemoteVideoStream, VideoStreamRenderer } from '@azure/communication-calling';\nimport { LocalVideoStreamState } from './CallClientState';\n\n/**\n * Internally tracked render status. Stores the status of a video render of a stream as rendering could take a long\n * time.\n *\n * 'NotRendered' - the stream has not yet been rendered\n * 'Rendering' - the stream is currently rendering\n * 'Rendered' - the stream has been rendered\n * 'Stopping' - the stream is currently rendering but has been signaled to stop\n */\nexport type RenderStatus = 'NotRendered' | 'Rendering' | 'Rendered' | 'Stopping';\n\n/**\n * Internal container to hold common state needed to keep track of renders.\n */\nexport interface RenderInfo {\n status: RenderStatus;\n renderer: VideoStreamRenderer | undefined;\n}\n\n/**\n * Internally used to keep track of the status, renderer, and awaiting promise, associated with a LocalVideoStream.\n */\nexport interface LocalRenderInfo extends RenderInfo {\n stream: LocalVideoStream;\n}\n\n/**\n * Internally used to keep track of the status, renderer, and awaiting promise, associated with a RemoteVideoStream.\n */\nexport interface RemoteRenderInfo extends RenderInfo {\n stream: RemoteVideoStream;\n}\n\n/**\n * Contains internal data used between different Declarative components to share data.\n */\nexport class InternalCallContext {\n // <CallId, <ParticipantKey, <StreamId, RemoteRenderInfo>>\n private _remoteRenderInfos: Map<string, Map<string, Map<number, RemoteRenderInfo>>>;\n\n // <CallId, LocalRenderInfo>.\n private _localRenderInfos: Map<string, LocalRenderInfo>;\n\n // Used for keeping track of rendered LocalVideoStreams that are not part of a Call.\n private _unparentedRenderInfos: Map<LocalVideoStreamState, LocalRenderInfo>;\n\n constructor() {\n this._remoteRenderInfos = new Map<string, Map<string, Map<number, RemoteRenderInfo>>>();\n this._localRenderInfos = new Map<string, LocalRenderInfo>();\n this._unparentedRenderInfos = new Map<LocalVideoStreamState, LocalRenderInfo>();\n }\n\n public setCallId(newCallId: string, oldCallId: string): void {\n const remoteRenderInfos = this._remoteRenderInfos.get(oldCallId);\n if (remoteRenderInfos) {\n this._remoteRenderInfos.delete(oldCallId);\n this._remoteRenderInfos.set(newCallId, remoteRenderInfos);\n }\n\n const localRenderInfos = this._localRenderInfos.get(oldCallId);\n if (localRenderInfos) {\n this._localRenderInfos.delete(oldCallId);\n this._localRenderInfos.set(newCallId, localRenderInfos);\n }\n }\n\n public getRemoteRenderInfos(): Map<string, Map<string, Map<number, RemoteRenderInfo>>> {\n return this._remoteRenderInfos;\n }\n\n public getRemoteRenderInfoForCall(callId: string): Map<string, Map<number, RemoteRenderInfo>> | undefined {\n return this._remoteRenderInfos.get(callId);\n }\n\n public getRemoteRenderInfoForParticipant(\n callId: string,\n participantKey: string,\n streamId: number\n ): RemoteRenderInfo | undefined {\n const callRenderInfos = this._remoteRenderInfos.get(callId);\n if (!callRenderInfos) {\n return undefined;\n }\n const participantRenderInfos = callRenderInfos.get(participantKey);\n if (!participantRenderInfos) {\n return undefined;\n }\n return participantRenderInfos.get(streamId);\n }\n\n public setRemoteRenderInfo(\n callId: string,\n participantKey: string,\n streamId: number,\n stream: RemoteVideoStream,\n status: RenderStatus,\n renderer: VideoStreamRenderer | undefined\n ): void {\n let callRenderInfos = this._remoteRenderInfos.get(callId);\n if (!callRenderInfos) {\n callRenderInfos = new Map<string, Map<number, RemoteRenderInfo>>();\n this._remoteRenderInfos.set(callId, callRenderInfos);\n }\n\n let participantRenderInfos = callRenderInfos.get(participantKey);\n if (!participantRenderInfos) {\n participantRenderInfos = new Map<number, RemoteRenderInfo>();\n callRenderInfos.set(participantKey, participantRenderInfos);\n }\n\n participantRenderInfos.set(streamId, { stream, status, renderer });\n }\n\n public deleteRemoteRenderInfo(callId: string, participantKey: string, streamId: number): void {\n const callRenderInfos = this._remoteRenderInfos.get(callId);\n if (!callRenderInfos) {\n return;\n }\n\n const participantRenderInfos = callRenderInfos.get(participantKey);\n if (!participantRenderInfos) {\n return;\n }\n\n participantRenderInfos.delete(streamId);\n }\n\n public setLocalRenderInfo(\n callId: string,\n stream: LocalVideoStream,\n status: RenderStatus,\n renderer: VideoStreamRenderer | undefined\n ): void {\n this._localRenderInfos.set(callId, { stream, status, renderer });\n }\n\n public getLocalRenderInfo(callId: string): LocalRenderInfo | undefined {\n return this._localRenderInfos.get(callId);\n }\n\n public deleteLocalRenderInfo(callId: string): void {\n this._localRenderInfos.delete(callId);\n }\n\n public getUnparentedRenderInfo(localVideoStream: LocalVideoStreamState): LocalRenderInfo | undefined {\n return this._unparentedRenderInfos.get(localVideoStream);\n }\n\n public setUnparentedRenderInfo(\n statefulStream: LocalVideoStreamState,\n stream: LocalVideoStream,\n status: RenderStatus,\n renderer: VideoStreamRenderer | undefined\n ): void {\n this._unparentedRenderInfos.set(statefulStream, { stream, status, renderer });\n }\n\n public deleteUnparentedRenderInfo(localVideoStream: LocalVideoStreamState): void {\n this._unparentedRenderInfos.delete(localVideoStream);\n }\n\n // UnparentedRenderInfos are not cleared as they are not part of the Call state.\n public clearCallRelatedState(): void {\n this._remoteRenderInfos.clear();\n this._localRenderInfos.clear();\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { deviceManagerDeclaratify } from './DeviceManagerDeclarative';\nimport { CallAgent, CallClient, CreateViewOptions, DeviceManager } from '@azure/communication-calling';\nimport { CallClientState, LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport { callAgentDeclaratify } from './CallAgentDeclarative';\nimport { InternalCallContext } from './InternalCallContext';\nimport { createView, disposeView } from './StreamUtils';\nimport { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';\n\n/**\n * Defines the methods that allow CallClient {@link @azure/communication-calling#CallClient} to be used statefully.\n * The interface provides access to proxied state and also allows registering a handler for state change events. For\n * state definition see {@link CallClientState}.\n *\n * State change events are driven by:\n * - Returned data from {@link @azure/communication-calling#DeviceManager} APIs.\n * - Returned data from {@link @azure/communication-calling#CallAgent} APIs.\n * - Listeners automatically attached to various azure communication-calling objects:\n * - CallAgent 'incomingCall'\n * - CallAgent 'callsUpdated'\n * - DeviceManager 'videoDevicesUpdated'\n * - DeviceManager 'audioDevicesUpdated\n * - DeviceManager 'selectedMicrophoneChanged'\n * - DeviceManager 'selectedSpeakerChanged'\n * - Call 'stateChanged'\n * - Call 'idChanged'\n * - Call 'isMutedChanged'\n * - Call 'isScreenSharingOnChanged'\n * - Call 'remoteParticipantsUpdated'\n * - Call 'localVideoStreamsUpdated'\n * - IncomingCall 'callEnded'\n * - RemoteParticipant 'stateChanged'\n * - RemoteParticipant 'isMutedChanged'\n * - RemoteParticipant 'displayNameChanged'\n * - RemoteParticipant 'isSpeakingChanged'\n * - RemoteParticipant 'videoStreamsUpdated'\n * - RemoteVideoStream 'isAvailableChanged'\n * - TranscriptionCallFeature 'isTranscriptionActiveChanged'\n * - RecordingCallFeature 'isRecordingActiveChanged'\n * - Transfer 'stateChanged'\n * - TransferCallFeature 'transferRequested'\n */\nexport interface StatefulCallClient extends CallClient {\n /**\n * Holds all the state that we could proxy from CallClient {@link @azure/communication-calling#CallClient} as\n * CallClientState {@link CallClientState}.\n */\n getState(): CallClientState;\n /**\n * Modify the internal state of the StatefulCallClient.\n *\n * This is the only way for users of StatefulCallClient to explicitly modify CallClientState.\n *\n * @param modifier - CallStateModifier callback. See documentation for {@Link CallStateModifier}.\n */\n modifyState(modifier: CallStateModifier): void;\n /**\n * Allows a handler to be registered for 'stateChanged' events.\n *\n * @param handler - Callback to receive the state.\n */\n onStateChange(handler: (state: CallClientState) => void): void;\n /**\n * Allows unregistering for 'stateChanged' events.\n *\n * @param handler - Original callback to be unsubscribed.\n */\n offStateChange(handler: (state: CallClientState) => void): void;\n /**\n * Renders a {@link RemoteVideoStreamState} or {@link LocalVideoStreamState} and stores the resulting\n * {@link VideoStreamRendererViewState} under the relevant {@link RemoteVideoStreamState} or\n * {@link LocalVideoStreamState} or as unparented view in the state. Under the hood calls\n * {@link @azure/communication-calling#VideoStreamRenderer.createView}.\n *\n * Scenario 1: Render RemoteVideoStreamState\n * - CallId is required, participantId is required, and stream of type RemoteVideoStreamState is required\n * - Resulting {@link VideoStreamRendererViewState} is stored in the given callId and participantId in\n * {@link CallClientState}\n *\n * Scenario 2: Render LocalVideoStreamState for a call\n * - CallId is required, participantId must be undefined, and stream of type LocalVideoStreamState is required.\n * - The {@link @azure/communication-calling#Call.localVideoStreams} must already be started using\n * {@link @azure/communication-calling#Call.startVideo}.\n * - Resulting {@link VideoStreamRendererViewState} is stored in the given callId {@link CallState.localVideoStreams}\n * in {@link CallClientState}.\n *\n * - Scenario 2: Render LocalVideoStreamState not part of a call (example rendering camera for local preview)\n * - CallId must be undefined, participantId must be undefined, and stream of type LocalVideoStreamState is required.\n * - Resulting {@link VideoStreamRendererViewState} is stored in under the given LocalVideoStreamState in\n * {@link CallClientState.deviceManager.unparentedViews}\n *\n * @param callId - CallId for the given stream. Can be undefined if the stream is not part of any call.\n * @param participantId - {@link RemoteParticipant.identifier} associated with the given RemoteVideoStreamState. Could\n * be undefined if rendering LocalVideoStreamState.\n * @param stream - The LocalVideoStreamState or RemoteVideoStreamState to start rendering.\n * @param options - Options that are passed to the {@link @azure/communication-calling#VideoStreamRenderer}.\n */\n createView(\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState,\n options?: CreateViewOptions\n ): Promise<void>;\n /**\n * Stops rendering a {@link RemoteVideoStreamState} or {@link LocalVideoStreamState} and removes the\n * {@link VideoStreamRendererView} from the relevant {@link RemoteVideoStreamState} in {@link CallClientState} or\n * {@link LocalVideoStream} in {@link CallClientState} or appropriate\n * {@link CallClientState.deviceManager.unparentedViews} Under the hood calls\n * {@link @azure/communication-calling#VideoStreamRenderer.dispose}.\n *\n * Its important to disposeView to clean up resources properly.\n *\n * Scenario 1: Dispose RemoteVideoStreamState\n * - CallId is required, participantId is required, and stream of type RemoteVideoStreamState is required\n *\n * Scenario 2: Dispose LocalVideoStreamState for a call\n * - CallId is required, participantId must be undefined, and stream of type LocalVideoStreamState is required.\n *\n * - Scenario 2: Dispose LocalVideoStreamState not part of a call\n * - CallId must be undefined, participantId must be undefined, and stream of type LocalVideoStreamState is required.\n * - LocalVideoStreamState must be the original one passed to createView.\n *\n * @param callId - CallId for the given stream. Can be undefined if the stream is not part of any call.\n * @param participantId - {@link RemoteParticipant.identifier} associated with the given RemoteVideoStreamState. Could\n * be undefined if disposing LocalVideoStreamState.\n * @param stream - The LocalVideoStreamState or RemoteVideoStreamState to dispose.\n */\n disposeView(\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState\n ): void;\n}\n\n/**\n * A function to modify the state of the StatefulCallClient.\n *\n * Provided as a callback to the {@link StatefulCallClient.modifyState} method.\n *\n * The function must modify the provided state in place as much as possible.\n * Making large modifications can lead to bad performance by causing spurious rerendering of the UI.\n *\n * Consider using commonly used modifier functions exported from this package.\n */\nexport type CallStateModifier = (state: CallClientState) => void;\n\n/**\n * ProxyCallClient proxies CallClient {@link @azure/communication-calling#CallClient} and subscribes to all events that\n * affect state. ProxyCallClient keeps its own copy of the call state and when state is updated, ProxyCallClient emits\n * the event 'stateChanged'.\n */\nclass ProxyCallClient implements ProxyHandler<CallClient> {\n private _context: CallContext;\n private _internalContext: InternalCallContext;\n private _callAgent: CallAgent | undefined;\n private _deviceManager: DeviceManager | undefined;\n private _sdkDeviceManager: DeviceManager | undefined;\n\n constructor(context: CallContext, internalContext: InternalCallContext) {\n this._context = context;\n this._internalContext = internalContext;\n }\n\n public get<P extends keyof CallClient>(target: CallClient, prop: P): any {\n switch (prop) {\n case 'createCallAgent': {\n return this._context.withAsyncErrorTeedToState(async (...args: Parameters<CallClient['createCallAgent']>) => {\n // createCallAgent will throw an exception if the previous callAgent was not disposed. If the previous\n // callAgent was disposed then it would have unsubscribed to events so we can just create a new declarative\n // callAgent if the createCallAgent succeeds.\n const callAgent = await target.createCallAgent(...args);\n this._callAgent = callAgentDeclaratify(callAgent, this._context, this._internalContext);\n this._context.setCallAgent({ displayName: this._callAgent.displayName });\n return this._callAgent;\n }, 'CallClient.createCallAgent');\n }\n case 'getDeviceManager': {\n return this._context.withAsyncErrorTeedToState(async () => {\n // As of writing, the SDK always returns the same instance of DeviceManager so we keep a reference of\n // DeviceManager and if it does not change we return the cached DeclarativeDeviceManager. If it does not we'll\n // throw an error that indicate we need to fix this issue as our implementation has diverged from the SDK.\n const deviceManager = await target.getDeviceManager();\n if (this._sdkDeviceManager) {\n if (this._sdkDeviceManager === deviceManager) {\n return this._deviceManager;\n } else {\n throw new Error(\n 'Multiple DeviceManager not supported. This means a incompatible version of communication-calling is ' +\n 'used OR calling declarative was not properly updated to communication-calling version.'\n );\n }\n } else {\n this._sdkDeviceManager = deviceManager;\n }\n this._deviceManager = deviceManagerDeclaratify(deviceManager, this._context);\n return this._deviceManager;\n }, 'CallClient.getDeviceManager');\n }\n default:\n return Reflect.get(target, prop);\n }\n }\n}\n\n/**\n * Arguments to construct the StatefulCallClient.\n */\nexport type StatefulCallClientArgs = {\n /**\n * UserId from SDK. This is provided for developer convenience to easily access the userId from the\n * state. It is not used by StatefulCallClient.\n */\n userId: CommunicationUserKind;\n};\n\n/**\n * Options to construct the StatefulCallClient with.\n */\nexport type StatefulCallClientOptions = {\n /**\n * Sets the max listeners limit of the 'stateChange' event. Defaults to the node.js EventEmitter.defaultMaxListeners\n * if not specified.\n */\n maxStateChangeListeners?: number;\n};\n\n/**\n * Creates a StatefulCallClient {@link StatefulCallClient} by proxying CallClient\n * {@link @azure/communication-calling#CallClient} with ProxyCallClient {@link ProxyCallClient} which then allows access\n * to state in a declarative way.\n *\n * It is important to use the {@link @azure/communication-calling#DeviceManager} and\n * {@link @azure/communication-calling#CallAgent} and {@link @azure/communication-calling#Call} (and etc.) that are\n * obtained from the StatefulCallClient in order for their state changes to be proxied properly.\n *\n * @param args - {@link StatefulCallClientArgs}\n * @param options - {@link StatefulCallClientOptions}\n * @returns\n */\nexport const createStatefulCallClient = (\n args: StatefulCallClientArgs,\n options?: StatefulCallClientOptions\n): StatefulCallClient => {\n return createStatefulCallClientWithDeps(\n new CallClient(),\n new CallContext(args.userId, options?.maxStateChangeListeners),\n new InternalCallContext()\n );\n};\n\n/**\n * Package-internal version of createStatefulCallClient that allows dependency injection.\n *\n * This function should not be exported from the package.\n */\nexport const createStatefulCallClientWithDeps = (\n callClient: CallClient,\n context: CallContext,\n internalContext: InternalCallContext\n): StatefulCallClient => {\n Object.defineProperty(callClient, 'getState', {\n configurable: false,\n value: () => context.getState()\n });\n Object.defineProperty(callClient, 'modifyState', {\n configurable: false,\n value: (modifier: CallStateModifier) => context?.modifyState(modifier)\n });\n Object.defineProperty(callClient, 'onStateChange', {\n configurable: false,\n value: (handler: (state: CallClientState) => void) => context.onStateChange(handler)\n });\n Object.defineProperty(callClient, 'offStateChange', {\n configurable: false,\n value: (handler: (state: CallClientState) => void) => context.offStateChange(handler)\n });\n Object.defineProperty(callClient, 'createView', {\n configurable: false,\n value: (\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState,\n options?: CreateViewOptions\n ): Promise<void> => {\n return createView(context, internalContext, callId, participantId, stream, options);\n }\n });\n Object.defineProperty(callClient, 'disposeView', {\n configurable: false,\n value: (\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState\n ): void => {\n disposeView(context, internalContext, callId, participantId, stream);\n }\n });\n\n return new Proxy(callClient, new ProxyCallClient(context, internalContext)) as StatefulCallClient;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\n\nexport type ChatClientState = {\n userId: CommunicationIdentifierKind;\n displayName: string;\n /**\n * Chat threads joined by the current user.\n * Object with {@link ChatThreadClientState} fields, keyed by {@link ChatThreadClientState.threadId}.\n */\n threads: { [key: string]: ChatThreadClientState };\n /**\n * Stores the latest error for each API method.\n *\n * See documentation of {@link ChatErrors} for details.\n */\n latestErrors: ChatErrors;\n};\n\nexport type ChatThreadClientState = {\n /**\n * Messages in this thread.\n * Object with {@link ChatMessageWithStatus} entries\n * Local messages are keyed by keyed by {@link ChatMessageWithStatus.clientMessageId}.\n * Remote messages are keyed by {@link @azure/communication-chat#ChatMessage.id}.\n */\n chatMessages: { [key: string]: ChatMessageWithStatus };\n /**\n * Participants of this chat thread.\n *\n * Object with {@link @azure/communication-chat#ChatParticipant} fields,\n * keyed by {@link @azure/communication-chat#ChatParticipant.id}.\n */\n participants: { [key: string]: ChatParticipant };\n threadId: string;\n properties?: ChatThreadProperties;\n readReceipts: ChatMessageReadReceipt[];\n typingIndicators: TypingIndicatorReceivedEvent[];\n latestReadTime: Date;\n};\n\n// @azure/communication-chat exports two interfaces for this concept,\n// and @azure/communication-signaling exports one.\n// In the absence of a common interface for this concept, we define a minimal one\n// that helps us hide the different types used by underlying API.\nexport type ChatThreadProperties = {\n topic?: string;\n};\n\n/**\n * Errors teed from API calls to the Chat SDK.\n *\n * Each property in the object stores the latest error for a particular SDK API method.\n *\n * Errors from this object can be cleared by calling the TODO(implement me) {@link clearError} method.\n * Additionally, errors are automatically cleared when:\n * - The state is cleared.\n * - Subsequent calls to related API methods succeed.\n * See documentation of individual stateful client methods for details on when errors may be automatically cleared.\n */\nexport type ChatErrors = {\n [target in ChatErrorTarget]: ChatError;\n};\n\n/**\n * Error thrown from failed stateful API methods.\n */\nexport class ChatError extends Error {\n /**\n * The API method target that failed.\n */\n public target: ChatErrorTarget;\n /**\n * Error thrown by the failed SDK method.\n */\n public inner: Error;\n /**\n * Timestamp added to the error by the stateful layer.\n */\n public timestamp: Date;\n\n constructor(target: ChatErrorTarget, inner: Error, timestamp?: Date) {\n super();\n this.target = target;\n this.inner = inner;\n // Testing note: It is easier to mock Date::now() than the Date() constructor.\n this.timestamp = timestamp ?? new Date(Date.now());\n this.name = 'ChatError';\n this.message = `${this.target}: ${this.inner.message}`;\n }\n}\n\n/**\n * String literal type for all permissible keys in {@link ChatErrors}.\n */\nexport type ChatErrorTarget =\n | 'ChatClient.createChatThread'\n | 'ChatClient.deleteChatThread'\n | 'ChatClient.getChatThreadClient'\n | 'ChatClient.listChatThreads'\n | 'ChatClient.off'\n | 'ChatClient.on'\n | 'ChatClient.startRealtimeNotifications'\n | 'ChatClient.stopRealtimeNotifications'\n | 'ChatThreadClient.addParticipants'\n | 'ChatThreadClient.deleteMessage'\n | 'ChatThreadClient.getMessage'\n | 'ChatThreadClient.getProperties'\n | 'ChatThreadClient.listMessages'\n | 'ChatThreadClient.listParticipants'\n | 'ChatThreadClient.listReadReceipts'\n | 'ChatThreadClient.removeParticipant'\n | 'ChatThreadClient.sendMessage'\n | 'ChatThreadClient.sendReadReceipt'\n | 'ChatThreadClient.sendTypingNotification'\n | 'ChatThreadClient.updateMessage'\n | 'ChatThreadClient.updateTopic';\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const Constants = {\n TYPING_INDICATOR_MAINTAIN_TIME: 8 * 1000,\n DUMMY_DATE: new Date(0)\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatClientState, ChatErrorTarget } from '../ChatClientState';\nimport { ChatStateModifier } from '../StatefulChatClient';\n\nexport const newClearChatErrorsModifier = (targets: ChatErrorTarget[]): ChatStateModifier => {\n return (draft: ChatClientState): void => {\n for (const target of targets) {\n if (draft.latestErrors[target] !== undefined) {\n delete draft.latestErrors[target];\n }\n }\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport EventEmitter from 'events';\nimport produce from 'immer';\nimport {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget,\n ChatError\n} from './ChatClientState';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { enableMapSet } from 'immer';\nimport { ChatMessageReadReceipt, ChatParticipant } from '@azure/communication-chat';\nimport { CommunicationIdentifierKind, UnknownIdentifierKind } from '@azure/communication-common';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { Constants } from './Constants';\nimport { TypingIndicatorReceivedEvent } from '@azure/communication-signaling';\nimport { ChatStateModifier } from './StatefulChatClient';\nimport { newClearChatErrorsModifier } from './modifiers';\n\nenableMapSet();\n\n// have separated ClientState and ChatThreadState?\nexport class ChatContext {\n private _state: ChatClientState = {\n userId: <UnknownIdentifierKind>{ id: '' },\n displayName: '',\n threads: {},\n latestErrors: {} as ChatErrors\n };\n private _batchMode = false;\n private _emitter: EventEmitter;\n private typingIndicatorInterval: number | undefined = undefined;\n\n constructor(maxListeners?: number) {\n this._emitter = new EventEmitter();\n if (maxListeners) {\n this._emitter.setMaxListeners(maxListeners);\n }\n }\n\n public setState(state: ChatClientState): void {\n this._state = state;\n if (!this._batchMode) {\n this._emitter.emit('stateChanged', this._state);\n }\n }\n\n public getState(): ChatClientState {\n return this._state;\n }\n\n public modifyState(modifier: ChatStateModifier): void {\n this.batch(() => {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n modifier(draft);\n })\n );\n });\n }\n\n public setThread(threadId: string, threadState: ChatThreadClientState): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n draft.threads[threadId] = threadState;\n })\n );\n }\n\n public createThread(threadId: string, properties?: ChatThreadProperties): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n draft.threads[threadId] = {\n chatMessages: {},\n threadId: threadId,\n properties: properties,\n participants: {},\n readReceipts: [],\n typingIndicators: [],\n latestReadTime: new Date(0)\n };\n })\n );\n }\n\n public updateChatConfig(userId: CommunicationIdentifierKind, displayName: string): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n draft.displayName = displayName;\n draft.userId = userId;\n })\n );\n }\n\n public createThreadIfNotExist(threadId: string, properties?: ChatThreadProperties): boolean {\n const exists = Object.prototype.hasOwnProperty.call(this.getState().threads, threadId);\n if (!exists) {\n this.createThread(threadId, properties);\n return true;\n }\n return false;\n }\n\n public updateThread(threadId: string, properties?: ChatThreadProperties): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n thread.properties = properties;\n }\n })\n );\n }\n\n public updateThreadTopic(threadId: string, topic?: string): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n if (topic === undefined) {\n return;\n }\n const thread = draft.threads[threadId];\n if (thread && !thread.properties) {\n thread.properties = { topic: topic };\n } else if (thread && thread.properties) {\n thread.properties.topic = topic;\n }\n })\n );\n }\n\n public deleteThread(threadId: string): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n delete draft.threads[threadId];\n }\n })\n );\n }\n\n public setChatMessages(threadId: string, messages: { [key: string]: ChatMessageWithStatus }): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const threadState = draft.threads[threadId];\n if (threadState) {\n threadState.chatMessages = messages;\n }\n\n // remove typing indicator when receive messages\n const thread = draft.threads[threadId];\n if (thread) {\n for (const message of Object.values(messages)) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n }\n })\n );\n }\n\n public updateChatMessageContent(threadId: string, messagesId: string, content: string | undefined): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const chatMessage = draft.threads[threadId]?.chatMessages[messagesId];\n if (chatMessage) {\n if (!chatMessage.content) {\n chatMessage.content = {};\n }\n chatMessage.content.message = content;\n }\n })\n );\n }\n\n public deleteLocalMessage(threadId: string, localId: string): boolean {\n let localMessageDeleted = false;\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n const message: ChatMessageWithStatus | undefined = chatMessages ? chatMessages[localId] : undefined;\n if (chatMessages && message && message.clientMessageId) {\n delete chatMessages[message.clientMessageId];\n localMessageDeleted = true;\n }\n })\n );\n return localMessageDeleted;\n }\n\n public deleteMessage(threadId: string, id: string): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const chatMessages = draft.threads[threadId]?.chatMessages;\n if (chatMessages) {\n delete chatMessages[id];\n }\n })\n );\n }\n\n public setParticipant(threadId: string, participant: ChatParticipant): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participants[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n })\n );\n }\n\n public setParticipants(threadId: string, participants: ChatParticipant[]): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const participantsMap = draft.threads[threadId]?.participants;\n if (participantsMap) {\n for (const participant of participants) {\n participantsMap[toFlatCommunicationIdentifier(participant.id)] = participant;\n }\n }\n })\n );\n }\n\n public deleteParticipants(threadId: string, participantIds: CommunicationIdentifierKind[]): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n participantIds.forEach((id) => {\n delete participants[toFlatCommunicationIdentifier(id)];\n });\n }\n })\n );\n }\n\n public deleteParticipant(threadId: string, participantId: CommunicationIdentifierKind): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const participants = draft.threads[threadId]?.participants;\n if (participants) {\n delete participants[toFlatCommunicationIdentifier(participantId)];\n }\n })\n );\n }\n\n public addReadReceipt(threadId: string, readReceipt: ChatMessageReadReceipt): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n const readReceipts = thread?.readReceipts;\n if (thread && readReceipts) {\n // TODO(prprabhu): Replace `this.getState()` with `draft`?\n if (readReceipt.sender !== this.getState().userId && thread.latestReadTime < readReceipt.readOn) {\n thread.latestReadTime = readReceipt.readOn;\n }\n readReceipts.push(readReceipt);\n }\n })\n );\n }\n\n private startTypingIndicatorCleanUp(): void {\n if (!this.typingIndicatorInterval) {\n this.typingIndicatorInterval = window.setInterval(() => {\n let isTypingActive = false;\n let isStateChanged = false;\n const newState = produce(this._state, (draft: ChatClientState) => {\n for (const thread of Object.values(draft.threads)) {\n const filteredTypingIndicators = thread.typingIndicators.filter((typingIndicator) => {\n const timeGap = Date.now() - typingIndicator.receivedOn.getTime();\n return timeGap < Constants.TYPING_INDICATOR_MAINTAIN_TIME;\n });\n\n if (thread.typingIndicators.length !== filteredTypingIndicators.length) {\n isStateChanged = true;\n thread.typingIndicators = filteredTypingIndicators;\n }\n if (thread.typingIndicators.length > 0) {\n isTypingActive = true;\n }\n }\n });\n\n if (isStateChanged) {\n this.setState(newState);\n }\n if (!isTypingActive && this.typingIndicatorInterval) {\n window.clearInterval(this.typingIndicatorInterval);\n this.typingIndicatorInterval = undefined;\n }\n }, 1000);\n }\n }\n\n public addTypingIndicator(threadId: string, typingIndicator: TypingIndicatorReceivedEvent): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const thread = draft.threads[threadId];\n if (thread) {\n const typingIndicators = thread.typingIndicators;\n typingIndicators.push(typingIndicator);\n }\n })\n );\n\n // Make sure we only maintain a period of typing indicator for perf purposes\n this.startTypingIndicatorCleanUp();\n }\n\n public setChatMessage(threadId: string, message: ChatMessageWithStatus): void {\n const { id: messageId, clientMessageId } = message;\n if (messageId || clientMessageId) {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n const threadMessages = draft.threads[threadId]?.chatMessages;\n const isLocalIdInMap = threadMessages && clientMessageId && threadMessages[clientMessageId];\n const messageKey = !messageId || isLocalIdInMap ? clientMessageId : messageId;\n\n if (threadMessages && messageKey) {\n threadMessages[messageKey] = message;\n }\n\n // remove typing indicator when receive a message from a user\n const thread = draft.threads[threadId];\n if (thread) {\n this.filterTypingIndicatorForUser(thread, message.sender);\n }\n })\n );\n }\n }\n\n /**\n * Tees any errors encountered in an async function to the state.\n *\n * If the function succeeds, clears associated errors from the state.\n *\n * @param f Async function to execute.\n * @param target The error target to tee error to.\n * @param clearTargets The error targets to clear errors for if the function succeeds. By default, clears errors for `target`.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withAsyncErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => Promise<R>,\n target: ChatErrorTarget,\n clearTargets?: ChatErrorTarget[]\n ): (...args: Args) => Promise<R> {\n return async (...args: Args): Promise<R> => {\n try {\n const ret = await f(...args);\n this.modifyState(newClearChatErrorsModifier(clearTargets !== undefined ? clearTargets : [target]));\n return ret;\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n /**\n * Tees any errors encountered in an function to the state.\n *\n * If the function succeeds, clears associated errors from the state.\n *\n * @param f Function to execute.\n * @param target The error target to tee error to.\n * @param clearTargets The error targets to clear errors for if the function succeeds. By default, clears errors for `target`.\n * @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.\n * @throws ChatError. Exceptions thrown from `f` are tagged with the failed `target.\n */\n public withErrorTeedToState<Args extends unknown[], R>(\n f: (...args: Args) => R,\n target: ChatErrorTarget,\n clearTargets?: ChatErrorTarget[]\n ): (...args: Args) => R {\n return (...args: Args): R => {\n try {\n const ret = f(...args);\n this.modifyState(newClearChatErrorsModifier(clearTargets !== undefined ? clearTargets : [target]));\n return ret;\n } catch (error) {\n const chatError = toChatError(target, error);\n this.setLatestError(target, chatError);\n throw chatError;\n }\n };\n }\n\n private setLatestError(target: ChatErrorTarget, error: ChatError): void {\n this.setState(\n produce(this._state, (draft: ChatClientState) => {\n draft.latestErrors[target] = error;\n })\n );\n }\n\n // This is a mutating function, only use it inside of a produce() function\n private filterTypingIndicatorForUser(thread: ChatThreadClientState, userId?: CommunicationIdentifierKind): void {\n if (!userId) return;\n const typingIndicators = thread.typingIndicators;\n const userIdAsKey = toFlatCommunicationIdentifier(userId);\n const filteredTypingIndicators = typingIndicators.filter(\n (typingIndicator) => toFlatCommunicationIdentifier(typingIndicator.sender) !== userIdAsKey\n );\n if (filteredTypingIndicators.length !== typingIndicators.length) {\n thread.typingIndicators = filteredTypingIndicators;\n }\n }\n\n /**\n * Batch updates to minimize `stateChanged` events across related operations.\n *\n * - A maximum of one `stateChanged` event is emitted, at the end of the operations.\n * - No `stateChanged` event is emitted if the state did not change through the operations.\n * - In case of an exception, state is reset to the prior value and no `stateChanged` event is emitted.\n *\n * All operations finished in this batch should be synchronous.\n * This function is not reentrant -- do not call batch() from within another batch().\n */\n public batch(operations: () => void): void {\n if (this._batchMode) {\n throw new Error('batch() called from within another batch()');\n }\n\n this._batchMode = true;\n const priorState = this._state;\n try {\n operations();\n if (this._state !== priorState) {\n this._emitter.emit('stateChanged', this._state);\n }\n } catch (e) {\n this._state = priorState;\n throw e;\n } finally {\n this._batchMode = false;\n }\n }\n\n public onStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (state: ChatClientState) => void): void {\n this._emitter.off('stateChanged', handler);\n }\n}\n\nconst toChatError = (target: ChatErrorTarget, error: unknown): ChatError => {\n if (error instanceof Error) {\n return new ChatError(target, error);\n }\n return new ChatError(target, new Error(`${error}`));\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatMessage } from '@azure/communication-chat';\nimport { MessageStatus } from '@internal/acs-ui-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\nexport const convertChatMessage = (\n message: ChatMessage,\n status: MessageStatus = 'delivered',\n clientMessageId?: string\n): ChatMessageWithStatus => {\n return {\n ...message,\n clientMessageId: clientMessageId,\n status\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatClient, ChatMessageReadReceipt } from '@azure/communication-chat';\nimport {\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadCreatedEvent,\n ChatThreadDeletedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent,\n TypingIndicatorReceivedEvent\n} from '@azure/communication-signaling';\nimport { ChatContext } from './ChatContext';\nimport { convertChatMessage } from './convertChatMessage';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n\nexport class EventSubscriber {\n private chatClient: ChatClient;\n private chatContext: ChatContext;\n\n constructor(chatClient: ChatClient, chatContext: ChatContext) {\n this.chatClient = chatClient;\n this.chatContext = chatContext;\n this.subscribe();\n }\n\n private convertEventToChatMessage = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent\n ): ChatMessageWithStatus => {\n return convertChatMessage({\n id: event.id,\n version: event.version,\n content: { message: event.message },\n type: event.type,\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '', // Note: there is a bug in chatMessageReceived event that it is missing sequenceId\n createdOn: new Date(event.createdOn),\n editedOn: 'editedOn' in event ? event.editedOn : undefined\n });\n };\n\n private onChatMessageReceived = (event: ChatMessageReceivedEvent): void => {\n const newMessage = this.convertEventToChatMessage(event);\n // Because of bug in chatMessageReceived event, if we already have that particular message in context, we want to\n // make sure to not overwrite the sequenceId when calling setChatMessage.\n const existingMessage = this.chatContext.getState().threads[event.threadId]?.chatMessages[event.id];\n if (existingMessage) {\n newMessage.sequenceId = existingMessage.sequenceId;\n }\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setChatMessage(event.threadId, newMessage);\n });\n };\n\n private onChatMessageDeleted = (event: ChatMessageDeletedEvent): void => {\n this.chatContext.deleteMessage(event.threadId, event.id);\n };\n\n private onChatMessageEdited = (event: ChatMessageEditedEvent): void => {\n const editedMessage = this.convertEventToChatMessage(event);\n this.chatContext.setChatMessage(event.threadId, convertChatMessage(editedMessage));\n };\n\n private onParticipantsAdded = (event: ParticipantsAddedEvent): void => {\n const participantsToAdd = event.participantsAdded.map((participant) => ({\n ...participant,\n shareHistoryTime: participant.shareHistoryTime ? new Date(participant.shareHistoryTime) : undefined\n }));\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.setParticipants(event.threadId, participantsToAdd);\n });\n this.fetchLastParticipantMessage(event.threadId, 'participantAdded');\n };\n\n // This is a hot fix that no participant message is received for onChatMessageReceived event, which should be handled by JS SDK\n private fetchLastParticipantMessage = async (\n threadId: string,\n actionType: 'participantAdded' | 'participantRemoved'\n ): Promise<void> => {\n for await (const message of this.chatClient.getChatThreadClient(threadId).listMessages()) {\n if (message.type === actionType) {\n this.chatContext.setChatMessage(threadId, { ...message, status: 'delivered' });\n break;\n }\n }\n };\n\n private onParticipantsRemoved = (event: ParticipantsRemovedEvent): void => {\n const participantIds = event.participantsRemoved.map((participant) => {\n return participant.id;\n });\n this.chatContext.deleteParticipants(event.threadId, participantIds);\n this.fetchLastParticipantMessage(event.threadId, 'participantRemoved');\n };\n\n private onReadReceiptReceived = (event: ReadReceiptReceivedEvent): void => {\n const readReceipt: ChatMessageReadReceipt = {\n ...event,\n sender: event.sender,\n readOn: new Date(event.readOn)\n };\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(event.threadId);\n this.chatContext.addReadReceipt(event.threadId, readReceipt);\n });\n };\n\n private onTypingIndicatorReceived = (typingIndicator: TypingIndicatorReceivedEvent): void => {\n this.chatContext.batch(() => {\n this.chatContext.createThreadIfNotExist(typingIndicator.threadId);\n this.chatContext.addTypingIndicator(typingIndicator.threadId, typingIndicator);\n });\n };\n\n private onChatThreadCreated = (event: ChatThreadCreatedEvent): void => {\n const properties = {\n topic: event.properties.topic\n };\n if (!this.chatContext.createThreadIfNotExist(event.threadId, properties)) {\n this.chatContext.updateThread(event.threadId, properties);\n }\n };\n\n private onChatThreadDeleted = (event: ChatThreadDeletedEvent): void => {\n this.chatContext.deleteThread(event.threadId);\n };\n\n private onChatThreadPropertiesUpdated = (event: ChatThreadPropertiesUpdatedEvent): void => {\n this.chatContext.updateThread(event.threadId, { topic: event.properties.topic });\n };\n\n public subscribe = (): void => {\n this.chatClient.on('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.on('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.on('chatMessageEdited', this.onChatMessageEdited);\n\n this.chatClient.on('participantsAdded', this.onParticipantsAdded);\n this.chatClient.on('participantsRemoved', this.onParticipantsRemoved);\n\n this.chatClient.on('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.on('typingIndicatorReceived', this.onTypingIndicatorReceived);\n\n this.chatClient.on('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.on('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.on('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n\n public unsubscribe = (): void => {\n this.chatClient.off('chatMessageReceived', this.onChatMessageReceived);\n this.chatClient.off('chatMessageDeleted', this.onChatMessageDeleted);\n this.chatClient.off('chatMessageEdited', this.onChatMessageEdited);\n\n this.chatClient.off('participantsAdded', this.onParticipantsAdded);\n this.chatClient.off('participantsRemoved', this.onParticipantsRemoved);\n\n this.chatClient.off('readReceiptReceived', this.onReadReceiptReceived);\n this.chatClient.off('typingIndicatorReceived', this.onTypingIndicatorReceived);\n\n this.chatClient.off('chatThreadCreated', this.onChatThreadCreated);\n this.chatClient.off('chatThreadDeleted', this.onChatThreadDeleted);\n this.chatClient.off('chatThreadPropertiesUpdated', this.onChatThreadPropertiesUpdated);\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ListPageSettings } from '@azure/communication-chat';\nimport { ChatContext } from '../ChatContext';\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ChatErrorTarget } from '../ChatClientState';\n\ntype IteratorCreatorFn<T, OptionsType, PageT = T[]> = (options?: OptionsType) => PagedAsyncIterableIterator<T, PageT>;\n\n/**\n * Create a decorated iterator\n * returned iterators.\n *\n * @param iteratorCreator the function to create the original iterator\n * @param context chatContext\n * @param decorateFn the function for the decorating behavior\n */\nexport const createDecoratedIterator = <ItemType, OptionsType>(\n iteratorCreator: IteratorCreatorFn<ItemType, OptionsType>,\n context: ChatContext,\n decorateFn: (item: ItemType, context: ChatContext) => void\n) => {\n return (...args: Parameters<IteratorCreatorFn<ItemType, OptionsType>>): PagedAsyncIterableIterator<ItemType> => {\n const threadsIterator = iteratorCreator(...args);\n return {\n async next() {\n const result = await threadsIterator.next();\n if (!result.done && result.value) {\n decorateFn(result.value, context);\n }\n return result;\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}): AsyncIterableIterator<ItemType[]> => {\n const pages = threadsIterator.byPage(settings);\n return {\n async next() {\n const result = await pages.next();\n const page = result.value;\n if (!result.done && result.value) {\n context.batch(() => {\n for (const item of page) {\n decorateFn(item, context);\n }\n });\n }\n return result;\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n }\n };\n };\n};\n\n/**\n *\n * @param iteratorCreator Function that creates the base iteartor\n * @param context The ChatContext that stores all internal state.\n * @param target See {@link ChatContext.asyncTeeErrorToState}.\n * @param clearTargets See {@link ChatContext.asyncTeeErrorToState}.\n * @returns A function to create an iterator that handles errors when iterting over the iterator from `iteratorCreator`.\n */\nexport const createErrorHandlingIterator = <ItemType, OptionsType>(\n iteratorCreator: IteratorCreatorFn<ItemType, OptionsType>,\n context: ChatContext,\n target: ChatErrorTarget,\n clearTargets?: ChatErrorTarget[]\n): IteratorCreatorFn<ItemType, OptionsType> => {\n return (...args: Parameters<IteratorCreatorFn<ItemType, OptionsType>>): PagedAsyncIterableIterator<ItemType> => {\n const innerIter = iteratorCreator(...args);\n return {\n next: context.withAsyncErrorTeedToState(innerIter.next.bind(innerIter), target, clearTargets),\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}): AsyncIterableIterator<ItemType[]> => {\n const pages = innerIter.byPage(settings);\n return {\n next: context.withAsyncErrorTeedToState(pages.next.bind(pages), target, clearTargets),\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n }\n };\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatMessage, ChatThreadClient, RestListMessagesOptions } from '@azure/communication-chat';\nimport { ChatContext } from '../ChatContext';\nimport { convertChatMessage } from '../convertChatMessage';\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\n\nexport const createDecoratedListMessages = (\n chatThreadClient: ChatThreadClient,\n context: ChatContext\n): ((options?: RestListMessagesOptions) => PagedAsyncIterableIterator<ChatMessage>) => {\n const setMessage = (message: ChatMessage, context: ChatContext): void => {\n context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\n };\n return createDecoratedIterator(\n createErrorHandlingIterator(\n context.withErrorTeedToState(\n chatThreadClient.listMessages.bind(chatThreadClient),\n 'ChatThreadClient.listMessages'\n ),\n context,\n 'ChatThreadClient.listMessages'\n ),\n context,\n setMessage\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatThreadClient, ChatMessageReadReceipt, RestListReadReceiptsOptions } from '@azure/communication-chat';\nimport { ChatContext } from '../ChatContext';\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\n\nexport const createDecoratedListReadReceipts = (\n chatThreadClient: ChatThreadClient,\n context: ChatContext\n): ((options?: RestListReadReceiptsOptions | undefined) => PagedAsyncIterableIterator<ChatMessageReadReceipt>) => {\n const setReadReceipt = (readReceipt: ChatMessageReadReceipt, context: ChatContext): void => {\n context.addReadReceipt(chatThreadClient.threadId, {\n ...readReceipt\n });\n };\n return createDecoratedIterator(\n createErrorHandlingIterator(\n context.withErrorTeedToState(\n chatThreadClient.listReadReceipts.bind(chatThreadClient),\n 'ChatThreadClient.listReadReceipts'\n ),\n context,\n 'ChatThreadClient.listReadReceipts'\n ),\n context,\n setReadReceipt\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatParticipant, ChatThreadClient, RestListParticipantsOptions } from '@azure/communication-chat';\nimport { ChatContext } from '../ChatContext';\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\n\nexport const createDecoratedListParticipants = (\n chatThreadClient: ChatThreadClient,\n context: ChatContext\n): ((options?: RestListParticipantsOptions) => PagedAsyncIterableIterator<ChatParticipant>) => {\n const setParticipant = (participant: ChatParticipant, context: ChatContext): void => {\n context.setParticipant(chatThreadClient.threadId, participant);\n };\n return createDecoratedIterator(\n createErrorHandlingIterator(\n context.withErrorTeedToState(\n chatThreadClient.listParticipants.bind(chatThreadClient),\n 'ChatThreadClient.listParticipants'\n ),\n context,\n 'ChatThreadClient.listParticipants'\n ),\n context,\n setParticipant\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatThreadClient, SendChatMessageResult } from '@azure/communication-chat';\nimport { getIdentifierKind } from '@azure/communication-common';\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nimport { ChatContext } from './ChatContext';\nimport { nanoid } from 'nanoid';\nimport { createDecoratedListMessages } from './iterators/createDecoratedListMessages';\nimport { createDecoratedListReadReceipts } from './iterators/createDecoratedListReadReceipts';\nimport { createDecoratedListParticipants } from './iterators/createDecoratedListParticipants';\nimport { convertChatMessage } from './convertChatMessage';\n\nclass ProxyChatThreadClient implements ProxyHandler<ChatThreadClient> {\n private _context: ChatContext;\n\n constructor(context: ChatContext) {\n this._context = context;\n }\n\n public get<P extends keyof ChatThreadClient>(chatThreadClient: ChatThreadClient, prop: P): any {\n switch (prop) {\n case 'listMessages': {\n return createDecoratedListMessages(chatThreadClient, this._context);\n }\n case 'getMessage': {\n return this._context.withAsyncErrorTeedToState(async (...args: Parameters<ChatThreadClient['getMessage']>) => {\n const message = await chatThreadClient.getMessage(...args);\n this._context.setChatMessage(chatThreadClient.threadId, convertChatMessage(message));\n return message;\n }, 'ChatThreadClient.getMessage');\n }\n case 'sendMessage': {\n return this._context.withAsyncErrorTeedToState(async (...args: Parameters<ChatThreadClient['sendMessage']>) => {\n // Retry logic?\n const { content } = args[0];\n const clientMessageId = nanoid(); // Generate a local short uuid for message\n const newMessage: ChatMessageWithStatus = {\n content: { message: content },\n clientMessageId,\n id: '',\n type: 'text',\n sequenceId: '',\n version: '',\n createdOn: new Date(),\n status: 'sending',\n senderDisplayName: this._context.getState().displayName,\n sender: this._context.getState().userId\n };\n this._context.setChatMessage(chatThreadClient.threadId, newMessage);\n\n let result: SendChatMessageResult | undefined = undefined;\n try {\n result = await chatThreadClient.sendMessage(...args);\n } catch (e) {\n this._context.setChatMessage(chatThreadClient.threadId, { ...newMessage, status: 'failed' });\n throw e;\n }\n\n if (result?.id) {\n this._context.batch(() => {\n if (!result) {\n return;\n }\n this._context.setChatMessage(chatThreadClient.threadId, {\n ...newMessage,\n clientMessageId: undefined,\n status: 'delivered',\n id: result.id\n });\n this._context.deleteLocalMessage(chatThreadClient.threadId, clientMessageId);\n });\n }\n return result;\n }, 'ChatThreadClient.sendMessage');\n }\n case 'addParticipants': {\n return this._context.withAsyncErrorTeedToState(\n async (...args: Parameters<ChatThreadClient['addParticipants']>) => {\n const result = await chatThreadClient.addParticipants(...args);\n const [addRequest] = args;\n const participantsToAdd = addRequest.participants;\n this._context.setParticipants(chatThreadClient.threadId, participantsToAdd);\n return result;\n },\n 'ChatThreadClient.addParticipants'\n );\n }\n case 'deleteMessage': {\n return this._context.withAsyncErrorTeedToState(\n async (...args: Parameters<ChatThreadClient['deleteMessage']>) => {\n // DeleteMessage is able to either delete local one(for failed message) or synced message\n const [messageId] = args;\n if (this._context.deleteLocalMessage(chatThreadClient.threadId, messageId)) {\n return {};\n }\n const result = await chatThreadClient.deleteMessage(...args);\n this._context.deleteMessage(chatThreadClient.threadId, messageId);\n return result;\n },\n 'ChatThreadClient.deleteMessage'\n );\n }\n case 'listParticipants': {\n return createDecoratedListParticipants(chatThreadClient, this._context);\n }\n case 'listReadReceipts': {\n return createDecoratedListReadReceipts(chatThreadClient, this._context);\n }\n case 'removeParticipant': {\n return this._context.withAsyncErrorTeedToState(\n async (...args: Parameters<ChatThreadClient['removeParticipant']>) => {\n const result = await chatThreadClient.removeParticipant(...args);\n const [removeIdentifier] = args;\n this._context.deleteParticipant(chatThreadClient.threadId, getIdentifierKind(removeIdentifier));\n return result;\n },\n 'ChatThreadClient.removeParticipant'\n );\n }\n case 'updateMessage': {\n return this._context.withAsyncErrorTeedToState(\n async (...args: Parameters<ChatThreadClient['updateMessage']>) => {\n const result = await chatThreadClient.updateMessage(...args);\n const [messageId, updateOption] = args;\n\n this._context.updateChatMessageContent(chatThreadClient.threadId, messageId, updateOption?.content);\n return result;\n },\n 'ChatThreadClient.updateMessage'\n );\n }\n case 'updateTopic': {\n return this._context.withAsyncErrorTeedToState(async (...args: Parameters<ChatThreadClient['updateTopic']>) => {\n const result = await chatThreadClient.updateTopic(...args);\n const [topic] = args;\n this._context.updateThreadTopic(chatThreadClient.threadId, topic);\n return result;\n }, 'ChatThreadClient.updateTopic');\n }\n case 'getProperties': {\n return this._context.withAsyncErrorTeedToState(\n async (...args: Parameters<ChatThreadClient['getProperties']>) => {\n const result = await chatThreadClient.getProperties(...args);\n this._context.updateThread(chatThreadClient.threadId, result);\n return result;\n },\n 'ChatThreadClient.getProperties'\n );\n }\n default:\n return Reflect.get(chatThreadClient, prop);\n }\n }\n}\n\nexport const chatThreadClientDeclaratify = (\n chatThreadClient: ChatThreadClient,\n context: ChatContext\n): ChatThreadClient => {\n context.createThreadIfNotExist(chatThreadClient.threadId);\n return new Proxy(chatThreadClient, new ProxyChatThreadClient(context)) as ChatThreadClient;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatThreadItem, ChatClient, RestListChatThreadsOptions } from '@azure/communication-chat';\nimport { ChatContext } from '../ChatContext';\nimport { createDecoratedIterator, createErrorHandlingIterator } from './createDecoratedIterator';\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\n\nexport const createDecoratedListThreads = (\n chatClient: ChatClient,\n context: ChatContext\n): ((options?: RestListChatThreadsOptions) => PagedAsyncIterableIterator<ChatThreadItem>) => {\n const setThreadProperties = (chatThreadItem: ChatThreadItem, context: ChatContext): void => {\n const properties = {\n topic: chatThreadItem.topic\n };\n if (!context.createThreadIfNotExist(chatThreadItem.id, properties)) {\n context.updateThread(chatThreadItem.id, properties);\n }\n };\n\n return createDecoratedIterator(\n createErrorHandlingIterator(\n context.withErrorTeedToState(chatClient.listChatThreads.bind(chatClient), 'ChatClient.listChatThreads'),\n context,\n 'ChatClient.listChatThreads'\n ),\n context,\n setThreadProperties\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ChatClient, ChatClientOptions } from '@azure/communication-chat';\nimport { getApplicationId } from '@internal/acs-ui-common';\nimport { ChatContext } from './ChatContext';\nimport { ChatClientState } from './ChatClientState';\nimport { EventSubscriber } from './EventSubscriber';\nimport { chatThreadClientDeclaratify } from './StatefulChatThreadClient';\nimport { createDecoratedListThreads } from './iterators/createDecoratedListThreads';\nimport { CommunicationIdentifierKind, CommunicationTokenCredential } from '@azure/communication-common';\n\nexport interface StatefulChatClient extends ChatClient {\n getState(): ChatClientState;\n onStateChange(handler: (state: ChatClientState) => void): void;\n offStateChange(handler: (state: ChatClientState) => void): void;\n /**\n * Modify the internal state of the StatefulChatClient.\n *\n * This is the only way for users of StatefulChatClient to explicitly modify ChatClientState.\n *\n * @param modifier - ChatStateModifier callback. See documentation for {@Link ChatStateModifier}.\n */\n modifyState(modifier: ChatStateModifier): void;\n}\n\nexport interface StatefulChatClientWithPrivateProps extends StatefulChatClient {\n context: ChatContext;\n eventSubscriber: EventSubscriber | undefined;\n}\n\nconst proxyChatClient: ProxyHandler<ChatClient> = {\n get: function <P extends keyof StatefulChatClientWithPrivateProps>(\n chatClient: ChatClient,\n prop: P,\n receiver: StatefulChatClientWithPrivateProps\n ) {\n // skip receiver.context call to avoid recursive bugs\n if (prop === 'context') {\n return Reflect.get(chatClient, prop);\n }\n\n const context = receiver.context;\n switch (prop) {\n case 'createChatThread': {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['createChatThread']>) {\n const result = await chatClient.createChatThread(...args);\n const thread = result.chatThread;\n if (thread) {\n const [request] = args;\n context.createThread(thread.id, { topic: request.topic });\n }\n return result;\n }, 'ChatClient.createChatThread');\n }\n\n case 'deleteChatThread': {\n return context.withAsyncErrorTeedToState(async function (...args: Parameters<ChatClient['deleteChatThread']>) {\n const result = await chatClient.deleteChatThread(...args);\n context.deleteThread(args[0]);\n return result;\n }, 'ChatClient.deleteChatThread');\n }\n case 'listChatThreads': {\n return createDecoratedListThreads(chatClient, context);\n }\n case 'getChatThreadClient': {\n return function (...args: Parameters<ChatClient['getChatThreadClient']>) {\n const chatThreadClient = chatClient.getChatThreadClient(...args);\n // TODO(prprabhu): Ensure that thread properties are fetched into the ChatContext at this point.\n // A new thread might be created here, but the properties will never be fetched.\n return chatThreadClientDeclaratify(chatThreadClient, context);\n };\n }\n case 'startRealtimeNotifications': {\n return context.withAsyncErrorTeedToState(\n async function (...args: Parameters<ChatClient['startRealtimeNotifications']>) {\n const ret = await chatClient.startRealtimeNotifications(...args);\n if (!receiver.eventSubscriber) {\n receiver.eventSubscriber = new EventSubscriber(chatClient, context);\n }\n return ret;\n },\n 'ChatClient.startRealtimeNotifications',\n ['ChatClient.startRealtimeNotifications', 'ChatClient.stopRealtimeNotifications']\n );\n }\n case 'stopRealtimeNotifications': {\n return context.withAsyncErrorTeedToState(\n async function (...args: Parameters<ChatClient['stopRealtimeNotifications']>) {\n const ret = await chatClient.stopRealtimeNotifications(...args);\n if (receiver.eventSubscriber) {\n receiver.eventSubscriber.unsubscribe();\n receiver.eventSubscriber = undefined;\n }\n return ret;\n },\n 'ChatClient.stopRealtimeNotifications',\n ['ChatClient.stopRealtimeNotifications', 'ChatClient.startRealtimeNotifications']\n );\n }\n default:\n return Reflect.get(chatClient, prop);\n }\n }\n};\n\n/**\n * Required arguments to construct the {@link StatefulChatClient}.\n */\nexport type StatefulChatClientArgs = {\n userId: CommunicationIdentifierKind;\n displayName: string;\n endpoint: string;\n credential: CommunicationTokenCredential;\n};\n\n/**\n * Options to construct the {@link StatefulChatClient} with.\n */\nexport type StatefulChatClientOptions = {\n /**\n * Options to construct the {@link @azure/communication-chat#ChatClient} with.\n */\n chatClientOptions: ChatClientOptions;\n /**\n * Sets the max listeners limit of the 'stateChange' event. Defaults to the node.js EventEmitter.defaultMaxListeners\n * if not specified.\n */\n maxStateChangeListeners?: number;\n};\n\n/**\n * Creates a stateful ChatClient {@link StatefulChatClient} by proxying ChatClient\n * {@link @azure/communication-chat#ChatClient} with ProxyChatClient {@link ProxyChatClient} which then allows access\n * to state in a declarative way.\n */\nexport const createStatefulChatClient = (\n args: StatefulChatClientArgs,\n options?: StatefulChatClientOptions\n): StatefulChatClient => {\n const tweakedOptions = {\n ...options,\n chatClientOptions: {\n ...options?.chatClientOptions,\n userAgentOptions: { userAgentPrefix: getApplicationId() }\n }\n };\n return createStatefulChatClientWithDeps(\n new ChatClient(args.endpoint, args.credential, tweakedOptions.chatClientOptions),\n args,\n tweakedOptions\n );\n};\n\n/**\n * A function to modify the state of the StatefulChatClient.\n *\n * Provided as a callback to the {@link StatefulChatClient.modifyState} method.\n *\n * The function must modify the provided state in place as much as possible.\n * Making large modifications can lead to bad performance by causing spurious rerendering of the UI.\n *\n * Consider using commonly used modifier functions exported from this package.\n */\nexport type ChatStateModifier = (state: ChatClientState) => void;\n\n/**\n * Internal implementation of {@link createStatefulChatClient} for dependency injection.\n *\n * Used by tests. Should not be exported out of this package.\n */\nexport const createStatefulChatClientWithDeps = (\n chatClient: ChatClient,\n args: StatefulChatClientArgs,\n options?: StatefulChatClientOptions\n): StatefulChatClient => {\n const context = new ChatContext(options?.maxStateChangeListeners);\n let eventSubscriber: EventSubscriber;\n\n context.updateChatConfig(args.userId, args.displayName);\n\n const proxy = new Proxy(chatClient, proxyChatClient);\n\n Object.defineProperty(proxy, 'context', {\n configurable: false,\n get: () => context\n });\n\n Object.defineProperty(proxy, 'eventSubscriber', {\n configurable: false,\n get: () => eventSubscriber,\n set: (val: EventSubscriber) => {\n eventSubscriber = val;\n }\n });\n\n Object.defineProperty(proxy, 'getState', {\n configurable: false,\n value: () => context?.getState()\n });\n Object.defineProperty(proxy, 'modifyState', {\n configurable: false,\n value: (modifier: ChatStateModifier) => context?.modifyState(modifier)\n });\n Object.defineProperty(proxy, 'onStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.onStateChange(handler)\n });\n Object.defineProperty(proxy, 'offStateChange', {\n configurable: false,\n value: (handler: (state: ChatClientState) => void) => context?.offStateChange(handler)\n });\n\n return proxy as StatefulChatClient;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n createStatefulChatClient,\n ChatClientState,\n ChatError,\n StatefulChatClient\n} from '@internal/chat-stateful-client';\nimport { ChatHandlers, createDefaultChatHandlers } from '@internal/chat-component-bindings';\nimport { ChatMessage, ChatThreadClient } from '@azure/communication-chat';\nimport { CommunicationTokenCredential, CommunicationIdentifierKind } from '@azure/communication-common';\nimport type {\n ChatMessageReceivedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent\n} from '@azure/communication-signaling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport EventEmitter from 'events';\nimport {\n ChatAdapter,\n ChatEvent,\n ChatAdapterState,\n MessageReadListener,\n MessageReceivedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './ChatAdapter';\nimport { AdapterError } from '../../common/adapters';\n\n// Context of Chat, which is a centralized context for all state updates\nclass ChatContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: ChatAdapterState;\n private threadId: string;\n\n constructor(clientState: ChatClientState, threadId: string) {\n const thread = clientState.threads[threadId];\n this.threadId = threadId;\n if (!thread) throw 'Cannot find threadId, please initialize thread before use!';\n this.state = {\n userId: toFlatCommunicationIdentifier(clientState.userId),\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: ChatAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): ChatAdapterState {\n return this.state;\n }\n\n public setError(error: Error): void {\n this.setState({ ...this.state, error });\n }\n\n public updateClientState(clientState: ChatClientState): void {\n const thread = clientState.threads[this.threadId];\n if (!thread) throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\n this.setState({\n userId: toFlatCommunicationIdentifier(clientState.userId),\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n });\n }\n}\n\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\n private chatClient: StatefulChatClient;\n private chatThreadClient: ChatThreadClient;\n private context: ChatContext;\n private handlers: ChatHandlers;\n private emitter: EventEmitter = new EventEmitter();\n\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\n this.bindAllPublicMethods();\n this.chatClient = chatClient;\n this.chatThreadClient = chatThreadClient;\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\n const onStateChange = (clientState: ChatClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n chatClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\n\n this.chatClient.onStateChange(onStateChange);\n this.subscribeAllEvents();\n }\n\n private bindAllPublicMethods(): void {\n this.onStateChange = this.onStateChange.bind(this);\n this.offStateChange = this.offStateChange.bind(this);\n this.getState = this.getState.bind(this);\n this.dispose = this.dispose.bind(this);\n this.fetchInitialData = this.fetchInitialData.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n this.sendReadReceipt = this.sendReadReceipt.bind(this);\n this.sendTypingIndicator = this.sendTypingIndicator.bind(this);\n this.updateMessage = this.updateMessage.bind(this);\n this.deleteMessage = this.deleteMessage.bind(this);\n this.removeParticipant = this.removeParticipant.bind(this);\n this.setTopic = this.setTopic.bind(this);\n this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n }\n\n dispose(): void {\n this.unsubscribeAllEvents();\n }\n\n async fetchInitialData(): Promise<void> {\n try {\n await this.chatThreadClient.getProperties();\n } catch (e) {\n console.log(e);\n }\n\n // Fetch all participants who joined before the local user.\n try {\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\n // Fetch 100 participants per page by default.\n maxPageSize: 100\n }));\n } catch (e) {\n console.log(e);\n }\n }\n\n getState(): ChatAdapterState {\n return this.context.getState();\n }\n\n onStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n offStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n async sendMessage(content: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSendMessage(content);\n });\n }\n\n async sendReadReceipt(chatMessageId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onMessageSeen(chatMessageId);\n });\n }\n\n async sendTypingIndicator(): Promise<void> {\n await this.handlers.onTyping();\n }\n\n async removeParticipant(userId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onParticipantRemove(userId);\n });\n }\n\n async setTopic(topicName: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.updateThreadTopicName(topicName);\n });\n }\n\n async loadPreviousChatMessages(messagesToLoad: number): Promise<boolean> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\n });\n }\n\n async updateMessage(messageId: string, content: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onUpdateMessage(messageId, content);\n });\n }\n\n async deleteMessage(messageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteMessage(messageId);\n });\n }\n\n private messageReceivedListener(event: ChatMessageReceivedEvent): void {\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageReceived', { message });\n\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\n this.emitter.emit('messageSent', { message });\n }\n }\n\n private messageReadListener({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void {\n const message = this.getState().thread.chatMessages[chatMessageId];\n if (message) {\n this.emitter.emit('messageRead', { message, readBy: recipient });\n }\n }\n\n private participantsAddedListener({ addedBy, participantsAdded }: ParticipantsAddedEvent): void {\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\n }\n\n private participantsRemovedListener({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void {\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\n }\n\n private chatThreadPropertiesUpdatedListener(event: ChatThreadPropertiesUpdatedEvent): void {\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\n }\n\n private subscribeAllEvents(): void {\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.on('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.on('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n private unsubscribeAllEvents(): void {\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.off('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.off('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageSent', listener: MessageReceivedListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: ChatEvent, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageSent', listener: MessageReceivedListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n off(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n off(event: ChatEvent, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isChatError(error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst convertEventToChatMessage = (event: ChatMessageReceivedEvent): ChatMessage => {\n return {\n id: event.id,\n version: event.version,\n content: { message: event.message },\n type: event.type,\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n createdOn: new Date(event.createdOn)\n };\n};\n\nexport type AzureCommunicationChatAdapterArgs = {\n endpointUrl: string;\n userId: CommunicationIdentifierKind;\n displayName: string;\n credential: CommunicationTokenCredential;\n threadId: string;\n};\n\nexport const createAzureCommunicationChatAdapter = async ({\n endpointUrl,\n userId,\n displayName,\n credential,\n threadId\n}: AzureCommunicationChatAdapterArgs): Promise<ChatAdapter> => {\n const chatClient = createStatefulChatClient({\n userId: userId,\n displayName,\n endpoint: endpointUrl,\n credential: credential\n });\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n\n chatClient.startRealtimeNotifications();\n\n const adapter = new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\n return adapter;\n};\n\nconst isChatError = (e: Error): e is ChatError => {\n return e['target'] !== undefined && e['inner'] !== undefined;\n};\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport { PartialDeep } from 'type-fest';\r\nimport {\r\n COMPONENT_LOCALE_EN_US,\r\n COMPONENT_LOCALE_EN_GB,\r\n COMPONENT_LOCALE_DE_DE,\r\n COMPONENT_LOCALE_ES_ES,\r\n COMPONENT_LOCALE_FR_FR,\r\n COMPONENT_LOCALE_IT_IT,\r\n COMPONENT_LOCALE_JA_JP,\r\n COMPONENT_LOCALE_KO_KR,\r\n COMPONENT_LOCALE_NL_NL,\r\n COMPONENT_LOCALE_PT_BR,\r\n COMPONENT_LOCALE_RU_RU,\r\n COMPONENT_LOCALE_TR_TR,\r\n COMPONENT_LOCALE_ZH_CN,\r\n COMPONENT_LOCALE_ZH_TW\r\n} from '@internal/react-components';\r\nimport { CompositeLocale, CompositeStrings } from '../LocalizationProvider';\r\nimport en_US from './en-US/strings.json';\r\nimport en_GB from './en-GB/strings.json';\r\nimport de_DE from './de-DE/strings.json';\r\nimport es_ES from './es-ES/strings.json';\r\nimport fr_FR from './fr-FR/strings.json';\r\nimport it_IT from './it-IT/strings.json';\r\nimport ja_JP from './ja-JP/strings.json';\r\nimport ko_KR from './ko-KR/strings.json';\r\nimport nl_NL from './nl-NL/strings.json';\r\nimport pt_BR from './pt-BR/strings.json';\r\nimport ru_RU from './ru-RU/strings.json';\r\nimport tr_TR from './tr-TR/strings.json';\r\nimport zh_CN from './zh-CN/strings.json';\r\nimport zh_TW from './zh-TW/strings.json';\r\n\r\nconst createCompositeStrings = (localizedStrings: PartialDeep<CompositeStrings>): CompositeStrings => {\r\n const strings: CompositeStrings = { ...en_US };\r\n Object.keys(localizedStrings).forEach((key: string) => {\r\n strings[key] = { ...strings[key], ...localizedStrings[key] };\r\n });\r\n return strings;\r\n};\r\n\r\n/** Locale for English (US) */\r\nexport const COMPOSITE_LOCALE_EN_US: CompositeLocale = {\r\n component: COMPONENT_LOCALE_EN_US,\r\n strings: en_US\r\n};\r\n/** Locale for English (British) */\r\nexport const COMPOSITE_LOCALE_EN_GB: CompositeLocale = {\r\n component: COMPONENT_LOCALE_EN_GB,\r\n strings: createCompositeStrings(en_GB)\r\n};\r\n/** Locale for German (Germany) */\r\nexport const COMPOSITE_LOCALE_DE_DE: CompositeLocale = {\r\n component: COMPONENT_LOCALE_DE_DE,\r\n strings: createCompositeStrings(de_DE)\r\n};\r\n/** Locale for Spanish (Spain) */\r\nexport const COMPOSITE_LOCALE_ES_ES: CompositeLocale = {\r\n component: COMPONENT_LOCALE_ES_ES,\r\n strings: createCompositeStrings(es_ES)\r\n};\r\n/** Locale for French (France) */\r\nexport const COMPOSITE_LOCALE_FR_FR: CompositeLocale = {\r\n component: COMPONENT_LOCALE_FR_FR,\r\n strings: createCompositeStrings(fr_FR)\r\n};\r\n/** Locale for Italian (Italy) */\r\nexport const COMPOSITE_LOCALE_IT_IT: CompositeLocale = {\r\n component: COMPONENT_LOCALE_IT_IT,\r\n strings: createCompositeStrings(it_IT)\r\n};\r\n/** Locale for Japanese (Japan) */\r\nexport const COMPOSITE_LOCALE_JA_JP: CompositeLocale = {\r\n component: COMPONENT_LOCALE_JA_JP,\r\n strings: createCompositeStrings(ja_JP)\r\n};\r\n/** Locale for Korean (South Korea) */\r\nexport const COMPOSITE_LOCALE_KO_KR: CompositeLocale = {\r\n component: COMPONENT_LOCALE_KO_KR,\r\n strings: createCompositeStrings(ko_KR)\r\n};\r\n/** Locale for Dutch (Netherlands) */\r\nexport const COMPOSITE_LOCALE_NL_NL: CompositeLocale = {\r\n component: COMPONENT_LOCALE_NL_NL,\r\n strings: createCompositeStrings(nl_NL)\r\n};\r\n/** Locale for Portuguese (Brazil) */\r\nexport const COMPOSITE_LOCALE_PT_BR: CompositeLocale = {\r\n component: COMPONENT_LOCALE_PT_BR,\r\n strings: createCompositeStrings(pt_BR)\r\n};\r\n/** Locale for Russian (Russia) */\r\nexport const COMPOSITE_LOCALE_RU_RU: CompositeLocale = {\r\n component: COMPONENT_LOCALE_RU_RU,\r\n strings: createCompositeStrings(ru_RU)\r\n};\r\n/** Locale for Turkish (Turkey) */\r\nexport const COMPOSITE_LOCALE_TR_TR: CompositeLocale = {\r\n component: COMPONENT_LOCALE_TR_TR,\r\n strings: createCompositeStrings(tr_TR)\r\n};\r\n/** Locale for Chinese (Mainland China) */\r\nexport const COMPOSITE_LOCALE_ZH_CN: CompositeLocale = {\r\n component: COMPONENT_LOCALE_ZH_CN,\r\n strings: createCompositeStrings(zh_CN)\r\n};\r\n/** Locale for Chinese (Taiwan) */\r\nexport const COMPOSITE_LOCALE_ZH_TW: CompositeLocale = {\r\n component: COMPONENT_LOCALE_ZH_TW,\r\n strings: createCompositeStrings(zh_TW)\r\n};\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\n\nimport { ComponentLocale, LocalizationProvider as ComponentLocalizationProvider } from '@internal/react-components';\n\nimport { COMPOSITE_LOCALE_EN_US } from './locales';\nimport { CallCompositeStrings, ChatCompositeStrings } from '../CallComposite';\n\n/**\n * Data structure for localization\n */\nexport interface CompositeLocale {\n /** Strings used in composites directly\n *\n * Contrast with {@link CompositeLocale.component}, which contains strings used via the component library.\n */\n strings: CompositeStrings;\n\n /** Locale information for the pure Components used by Composites. See {@link communication-react#ComponentLocale}. */\n component: ComponentLocale;\n}\n\n/**\n * Strings used in the composites directly.\n *\n * These strings are used by the composites directly, instead of by the contained components.\n */\nexport interface CompositeStrings {\n /**\n * Strings used by {@link CallComposite}.\n */\n call: CallCompositeStrings;\n /**\n * Strings used by {@link ChatComposite}.\n */\n chat: ChatCompositeStrings;\n}\n\n/**\n * Context for providing localized strings to components\n */\nexport const LocaleContext = createContext<CompositeLocale>(COMPOSITE_LOCALE_EN_US);\n\n/**\n * Props to LocalizationProvider\n */\nexport type LocalizationProviderProps = {\n /** Locale context to provide components */\n locale: CompositeLocale;\n /** Children to provide locale context. */\n children: React.ReactNode;\n};\n\n/**\n * Provider to provide localized strings for this library's composites.\n *\n * This provider is internal. Do not export in public API.\n */\nexport const LocalizationProvider = (props: LocalizationProviderProps): JSX.Element => {\n const { locale, children } = props;\n return (\n <LocaleContext.Provider value={locale}>\n <ComponentLocalizationProvider locale={locale.component}>{children}</ComponentLocalizationProvider>\n </LocaleContext.Provider>\n );\n};\n\n/** React hook to access locale */\nexport const useLocale = (): CompositeLocale => useContext(LocaleContext);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n MicOn20Filled,\n ShareScreenStart20Filled,\n ShareScreenStop20Filled,\n Speaker220Filled,\n Video20Filled,\n VideoOff20Filled\n} from '@fluentui/react-icons';\nimport { ComponentIcons, DEFAULT_COMPONENT_ICONS } from '@internal/react-components';\nimport React from 'react';\n\n/**\n * These icons are composite specific and not being used inside components.\n */\nexport const COMPOSITE_ONLY_ICONS = {\n LocalDeviceSettingsCamera: <Video20Filled />,\n LocalDeviceSettingsMic: <MicOn20Filled />,\n LocalDeviceSettingsSpeaker: <Speaker220Filled />,\n LocalPreviewPlaceholder: <VideoOff20Filled />,\n ScreenSharePopupPresenting: <ShareScreenStart20Filled />,\n ScreenSharePopupStopPresenting: <ShareScreenStop20Filled />\n};\n\n/**\n * The default set of icons that are available to used in the Composites.\n */\nexport const DEFAULT_COMPOSITE_ICONS = {\n ...DEFAULT_COMPONENT_ICONS,\n ...COMPOSITE_ONLY_ICONS\n};\n\nexport type CompositeIcons = ComponentIcons & Record<keyof typeof COMPOSITE_ONLY_ICONS, JSX.Element>;\n\nexport type ChatCompositeIcons = Pick<\n CompositeIcons,\n | 'MessageDelivered'\n | 'MessageFailed'\n | 'MessageSeen'\n | 'MessageSending'\n | 'MessageEdit'\n | 'MessageRemove'\n | 'ParticipantItemOptions'\n | 'ParticipantItemOptionsHovered'\n | 'SendBoxSend'\n | 'SendBoxSendHovered'\n | 'EditBoxCancel'\n | 'EditBoxSubmit'\n>;\n\nexport type CallCompositeIcons = Pick<\n CompositeIcons,\n | 'ControlButtonCameraOff'\n | 'ControlButtonCameraOn'\n | 'ControlButtonEndCall'\n | 'ControlButtonMicOff'\n | 'ControlButtonMicOn'\n | 'ControlButtonOptions'\n | 'ControlButtonParticipants'\n | 'ControlButtonScreenShareStart'\n | 'ControlButtonScreenShareStop'\n | 'OptionsCamera'\n | 'OptionsMic'\n | 'OptionsSpeaker'\n | 'ParticipantItemScreenShareStart'\n | 'ParticipantItemMicOff'\n | 'ParticipantItemOptions'\n | 'ParticipantItemOptionsHovered'\n | 'VideoTileMicOff'\n>;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PartialTheme, registerIcons, Theme } from '@fluentui/react';\nimport { FluentThemeProvider } from '@internal/react-components';\nimport React from 'react';\nimport { ChatCompositeIcons } from '..';\nimport { CompositeLocale, LocalizationProvider } from '../localization';\nimport { AvatarPersonaDataCallback } from './AvatarPersona';\nimport { CallCompositeIcons, DEFAULT_COMPOSITE_ICONS } from './icons';\n\nexport interface BaseCompositeProps<TIcons extends Record<string, JSX.Element>> {\n /**\n * Fluent theme for the composite.\n *\n * @defaultValue light theme\n */\n fluentTheme?: PartialTheme | Theme;\n /**\n * Custom Icon override for the composite.\n * A JSX element can be provided to override the default icon.\n */\n icons?: TIcons;\n /**\n * Locale for the composite.\n *\n * @defaultValue English (US)\n */\n locale?: CompositeLocale;\n /**\n * Whether composite is displayed right-to-left.\n *\n * @defaultValue false\n */\n rtl?: boolean;\n /**\n * A callback function that can be used to provide custom data to Avatars rendered\n * in Composite.\n */\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n}\n\n/**\n * A base class for composites.\n * Provides common wrappers such as FluentThemeProvider, IdentifierProvider and LocalizationProvider.\n */\nexport const BaseComposite = (\n props: BaseCompositeProps<CallCompositeIcons | ChatCompositeIcons> & { children: React.ReactNode }\n): JSX.Element => {\n const { fluentTheme, rtl, locale } = props;\n\n /**\n * We register the default icon mappings merged with custom icons provided through props\n * to ensure all icons render correctly.\n */\n registerIcons({ icons: { ...DEFAULT_COMPOSITE_ICONS, ...props.icons } });\n\n const CompositeElement = (\n <FluentThemeProvider fluentTheme={fluentTheme} rtl={rtl}>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\" />\n {props.children}\n </FluentThemeProvider>\n );\n return locale ? LocalizationProvider({ locale, children: CompositeElement }) : CompositeElement;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport { ChatAdapter } from './ChatAdapter';\n\ntype ChatProviderProps = {\n children: React.ReactNode;\n adapter: ChatAdapter;\n};\n\nconst ChatAdapterContext = createContext<ChatAdapter | undefined>(undefined);\n\nexport const ChatAdapterProvider = (props: ChatProviderProps): JSX.Element => {\n const { adapter } = props;\n return <ChatAdapterContext.Provider value={adapter}>{props.children}</ChatAdapterContext.Provider>;\n};\n\nexport const useAdapter = (): ChatAdapter => {\n const adapter = useContext(ChatAdapterContext);\n if (!adapter) throw 'Cannot find adapter please initialize before usage.';\n return adapter;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { ChatClientState, ChatErrors, ChatThreadClientState } from '@internal/chat-stateful-client';\nimport { useState, useEffect, useRef, useMemo } from 'react';\nimport { ChatAdapterState } from '../adapter/ChatAdapter';\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\nimport memoizeOne from 'memoize-one';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\n\n// This function highly depends on chatClient.onChange event\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\nexport const useAdaptedSelector = <SelectorT extends (state: ChatClientState, props: any) => any>(\n selector: SelectorT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n return useSelectorWithAdaptation(selector, adaptCompositeState, selectorProps);\n};\n\nexport const useSelectorWithAdaptation = <\n SelectorT extends (state: ReturnType<AdaptFuncT>, props: any) => any,\n AdaptFuncT extends (state: ChatAdapterState) => any\n>(\n selector: SelectorT,\n adaptState: AdaptFuncT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n const adapter = useAdapter();\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const threadId = adapter.getState().thread.threadId;\n const threadConfigProps = useMemo(\n () => ({\n threadId\n }),\n [threadId]\n );\n\n const [props, setProps] = useState(selector(adaptState(adapter.getState()), selectorProps ?? threadConfigProps));\n const propRef = useRef(props);\n propRef.current = props;\n\n useEffect(() => {\n const onStateChange = (state: ChatAdapterState): void => {\n if (!mounted.current) {\n return;\n }\n const newProps = selector(adaptState(state), selectorProps ?? threadConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n adapter.onStateChange(onStateChange);\n return () => {\n adapter.offStateChange(onStateChange);\n };\n }, [adaptState, adapter, selector, selectorProps, threadConfigProps]);\n return props;\n};\n\nconst memoizeState = memoizeOne(\n (\n userId: CommunicationIdentifierKind,\n displayName: string,\n threads: { [key: string]: ChatThreadClientState },\n latestErrors: ChatErrors\n ) => ({\n userId,\n displayName,\n threads,\n latestErrors\n })\n);\n\nconst memoizeThreads = memoizeOne((thread: ChatThreadClientState) => ({ [thread.threadId]: thread }));\n\nconst adaptCompositeState = (compositeState: ChatAdapterState): ChatClientState => {\n return memoizeState(\n { kind: 'communicationUser', communicationUserId: compositeState.userId },\n compositeState.displayName,\n memoizeThreads(compositeState.thread),\n // This is an unsafe type expansion.\n // compositeState.latestErrors can contain properties that are not valid in ChatErrors.\n //\n // But there is no way to check for valid property names at runtime:\n // - The set of valid property names is built from types in the @azure/communication-chat.\n // Thus we don't have a literal array of allowed strings at runtime.\n // - Due to minification / uglification, the property names from the objects at runtime can't be used\n // to compare against permissible values inferred from the types.\n //\n // This is not a huge problem -- it simply means that our adapted selector will include some extra operations\n // that are unknown to the UI component and data binding libraries. Generic handling of the errors (e.g.,\n // just displaying them in some UI surface) will continue to work for these operations. Handling of\n // specific operations (e.g., acting on errors related to permission issues) will ignore these operations.\n compositeState.latestErrors as ChatErrors\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonProperties } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '@internal/chat-component-bindings';\n\nimport { ReactElement } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { ChatAdapter } from '../adapter/ChatAdapter';\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\n\n// This will be moved into selector folder when ChatClientProvide when refactor finished\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _component: (props: PropsT) => ReactElement | null\n): Pick<ChatHandlers, CommonProperties<ChatHandlers, PropsT>> => {\n return createCompositeHandlers(useAdapter());\n};\n\nconst createCompositeHandlers = memoizeOne(\n (adapter: ChatAdapter): ChatHandlers => ({\n onSendMessage: adapter.sendMessage,\n onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,\n onMessageSeen: adapter.sendReadReceipt,\n onTyping: adapter.sendTypingIndicator,\n onParticipantRemove: adapter.removeParticipant,\n updateThreadTopicName: adapter.setTopic,\n onUpdateMessage: adapter.updateMessage,\n onDeleteMessage: adapter.deleteMessage\n })\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { getChatSelector, ChatHandlers, GetChatSelector } from '@internal/chat-component-bindings';\n\nimport { useHandlers } from './useHandlers';\nimport { useAdaptedSelector } from './useAdaptedSelector';\nimport { Common } from '@internal/acs-ui-common';\n\ntype Selector = (state: any, props: any) => any;\n\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetChatSelector<Component> extends Selector\n ? ReturnType<GetChatSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]>\n : Record<string, never> => {\n const selector = getChatSelector(component);\n if (!selector) {\n throw new Error(\"Can't find the selector for component, please check supported component list\");\n }\n return { ...useAdaptedSelector(selector as Selector), ...useHandlers(component) };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const chatContainer = mergeStyles({\n height: '100%',\n width: '100%',\n overflow: 'hidden',\n\n '*::-webkit-scrollbar': {\n width: '0.3rem',\n height: '0.3rem'\n },\n '.scroll::-webkit-scrollbar-track': {\n background: 'rgba(150, 150, 150)',\n borderRadius: '0.3rem'\n },\n '*::-webkit-scrollbar-thumb': {\n borderRadius: '10px',\n background: 'rgba(150, 150, 150)'\n }\n});\n\nexport const chatArea = mergeStyles({\n height: '100%',\n width: '100%',\n overflow: 'hidden'\n});\n\nexport const chatWrapper = mergeStyles({\n height: '100%',\n width: '100%',\n overflow: 'auto'\n});\n\nexport const chatHeaderContainerStyle = mergeStyles({\n width: '100%',\n paddingLeft: '1.5rem',\n paddingRight: '1.5rem',\n '@media screen and (max-width: 25rem)': {\n paddingLeft: '5%',\n paddingRight: '5%'\n },\n borderBottom: '0.063rem solid #DDDDDD'\n});\n\nexport const topicNameLabelStyle = mergeStyles({\n fontSize: '1.1rem',\n lineHeight: '2.5rem',\n fontWeight: 600,\n marginRight: '0.125rem',\n textOverflow: 'ellipsis',\n overflowY: 'hidden'\n});\n\nexport const participantListWrapper = mergeStyles({\n boxShadow: '0px 0.3px 0.9px rgba(0, 0, 0, 0.1), 0px 1.6px 3.6px rgba(0, 0, 0, 0.13)',\n width: '15rem',\n height: '100%'\n});\n\nexport const participantListContainerPadding = { childrenGap: '0.5rem' };\n\nexport const listHeader = mergeStyles({\n fontSize: '1rem',\n margin: '1rem'\n});\n\nexport const participantListStack = mergeStyles({\n width: '15rem',\n height: '100%'\n});\n\nexport const participantListStyle = mergeStyles({\n overflowY: 'hidden'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Stack } from '@fluentui/react';\nimport React from 'react';\nimport * as reselect from 'reselect';\nimport { ChatClientState } from '@internal/chat-stateful-client';\nimport { ChatBaseSelectorProps } from '@internal/chat-component-bindings';\nimport { chatHeaderContainerStyle, topicNameLabelStyle } from './styles/Chat.styles';\n\nexport type HeaderProps = {\n topic: string;\n};\n\nexport const ChatHeader = (props: HeaderProps): JSX.Element => {\n return (\n <Stack className={chatHeaderContainerStyle} horizontal>\n <Stack.Item align=\"center\">\n <div className={topicNameLabelStyle}>{props.topic}</div>\n </Stack.Item>\n </Stack>\n );\n};\n\n// TODO: Consider exporting building-block selectors internally to composites.\n// This will avoid code duplication but still keep the public API clean.\nexport const getTopicName = (state: ChatClientState, props: ChatBaseSelectorProps): string => {\n return state.threads[props.threadId]?.properties?.topic || '';\n};\n\nexport const getHeaderProps = reselect.createSelector([getTopicName], (topic): HeaderProps => {\n return { topic: topic };\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IPersonaProps, Persona, PersonaInitialsColor } from '@fluentui/react';\nimport React, { useEffect } from 'react';\n\n/**\n * Custom data attributes for the AvatarPersona component.\n */\nexport type AvatarPersonaData = {\n /**\n * Primary text to display, usually the name of the person.\n */\n text?: string;\n /**\n * Image URL to use, should be a square aspect ratio and big enough to fit in the image area.\n */\n imageUrl?: string;\n /**\n * The user's initials to display in the image area when there is no image.\n * @defaultvalue Derived from `text`\n */\n imageInitials?: string;\n /**\n * The background color when the user's initials are displayed.\n * @defaultvalue Derived from `text`\n */\n initialsColor?: PersonaInitialsColor | string;\n /**\n * The text color when the user's initials are displayed\n * @defaultvalue `white`\n */\n initialsTextColor?: string;\n};\n\n/**\n * Callback function used to provide custom data to the AvatarPersona component.\n */\nexport type AvatarPersonaDataCallback = (userId: string) => Promise<AvatarPersonaData>;\n\nexport interface AvatarPersonaProps extends IPersonaProps {\n /**\n * Azure Communicator user ID.\n */\n userId?: string;\n /**\n * A function that returns a Promise that resolves to the data to be displayed.\n */\n dataProvider?: AvatarPersonaDataCallback;\n}\n\n/**\n * An Avatar component made using the `Persona` component.\n * It allows you to specify a `userId` and a `dataProvider` to retrieve the `AvatarPersonaData`.\n * Read more about `Persona` component at https://developer.microsoft.com/en-us/fluentui#/controls/web/persona\n */\nexport const AvatarPersona = (props: AvatarPersonaProps): JSX.Element => {\n const { userId, dataProvider } = props;\n const [data, setData] = React.useState<AvatarPersonaData | undefined>();\n\n useEffect(() => {\n (async () => {\n if (dataProvider && userId) {\n const data = await dataProvider(userId);\n setData(data);\n }\n })();\n }, [dataProvider, userId]);\n\n return (\n <Persona\n {...props}\n text={data?.text ?? props.text}\n imageUrl={data?.imageUrl ?? props.imageUrl}\n imageInitials={data?.imageInitials ?? props.imageInitials}\n initialsColor={data?.initialsColor ?? props.initialsColor}\n initialsTextColor={data?.initialsTextColor ?? props.initialsTextColor ?? 'white'}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport React, { useCallback, useEffect } from 'react';\nimport {\n CommunicationParticipant,\n DefaultMessageRendererType,\n ErrorBar,\n MessageProps,\n MessageThread,\n ParticipantList,\n SendBox,\n TypingIndicator\n} from '@internal/react-components';\nimport { useAdapter } from './adapter/ChatAdapterProvider';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\nimport { ChatHeader, getHeaderProps } from './ChatHeader';\nimport {\n chatContainer,\n chatWrapper,\n chatArea,\n participantListWrapper,\n listHeader,\n participantListStack,\n participantListStyle,\n participantListContainerPadding\n} from './styles/Chat.styles';\nimport { AvatarPersonaDataCallback, AvatarPersona } from '../common/AvatarPersona';\nimport { useLocale } from '../localization';\n\nexport type ChatScreenProps = {\n showErrorBar?: boolean;\n showParticipantPane?: boolean;\n showTopic?: boolean;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element;\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n};\n\nexport const ChatScreen = (props: ChatScreenProps): JSX.Element => {\n const { onFetchAvatarPersonaData, onRenderMessage, onRenderTypingIndicator, showParticipantPane, showTopic } = props;\n\n const defaultNumberOfChatMessagesToReload = 5;\n const sendBoxParentStyle = mergeStyles({ width: '100%' });\n\n const adapter = useAdapter();\n\n useEffect(() => {\n adapter.fetchInitialData();\n }, [adapter]);\n\n const locale = useLocale();\n const chatListHeader = locale.strings.chat.chatListHeader;\n\n const messageThreadProps = usePropsFor(MessageThread);\n const participantListProps = usePropsFor(ParticipantList);\n const sendBoxProps = usePropsFor(SendBox);\n const typingIndicatorProps = usePropsFor(TypingIndicator);\n const headerProps = useAdaptedSelector(getHeaderProps);\n const errorBarProps = usePropsFor(ErrorBar);\n\n const onRenderAvatarCallback = useCallback(\n (userId, options) => {\n return <AvatarPersona userId={userId} {...options} dataProvider={onFetchAvatarPersonaData} />;\n },\n [onFetchAvatarPersonaData]\n );\n\n return (\n <Stack className={chatContainer} grow>\n {!!showTopic && <ChatHeader {...headerProps} />}\n <Stack className={chatArea} tokens={participantListContainerPadding} horizontal grow>\n <Stack className={chatWrapper} grow>\n {props.showErrorBar ? <ErrorBar {...errorBarProps} /> : <></>}\n <MessageThread\n {...messageThreadProps}\n onRenderAvatar={onRenderAvatarCallback}\n onRenderMessage={onRenderMessage}\n numberOfChatMessagesToReload={defaultNumberOfChatMessagesToReload}\n />\n <Stack.Item align=\"center\" className={sendBoxParentStyle}>\n <div style={{ paddingLeft: '0.5rem', paddingRight: '0.5rem' }}>\n {onRenderTypingIndicator ? (\n onRenderTypingIndicator(typingIndicatorProps.typingUsers)\n ) : (\n <TypingIndicator {...typingIndicatorProps} />\n )}\n </div>\n <SendBox {...sendBoxProps} />\n </Stack.Item>\n </Stack>\n {showParticipantPane && (\n <Stack.Item className={participantListWrapper}>\n <Stack className={participantListStack}>\n <Stack.Item className={listHeader}>{chatListHeader}</Stack.Item>\n <Stack.Item className={participantListStyle}>\n <ParticipantList\n {...participantListProps}\n onRenderAvatar={(userId, options) => (\n <AvatarPersona\n data-ui-id=\"chat-composite-participant-custom-avatar\"\n userId={userId}\n {...options}\n dataProvider={onFetchAvatarPersonaData}\n />\n )}\n />\n </Stack.Item>\n </Stack>\n </Stack.Item>\n )}\n </Stack>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommunicationParticipant, DefaultMessageRendererType, MessageProps } from '@internal/react-components';\nimport React from 'react';\nimport { BaseComposite, BaseCompositeProps } from '../common/Composite';\nimport { ChatCompositeIcons } from '../common/icons';\nimport { ChatAdapter } from './adapter/ChatAdapter';\nimport { ChatAdapterProvider } from './adapter/ChatAdapterProvider';\nimport { ChatScreen } from './ChatScreen';\n\nexport interface ChatCompositeProps extends BaseCompositeProps<ChatCompositeIcons> {\n /**\n * An adapter provides logic and data to the composite.\n * Composite can also be controlled using the adapter.\n */\n adapter: ChatAdapter;\n /**\n * `(messageProps: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element`\n * A callback for customizing the message renderer.\n */\n onRenderMessage?: (messageProps: MessageProps, defaultOnRender?: DefaultMessageRendererType) => JSX.Element;\n /**\n * `(typingUsers: CommunicationParticipant[]) => JSX.Element`\n * A callback for customizing the typing indicator renderer.\n */\n onRenderTypingIndicator?: (typingUsers: CommunicationParticipant[]) => JSX.Element;\n\n /**\n * Flags to enable/disable visual elements of the {@link ChatComposite}.\n */\n visualElements?: ChatCompositeVisualElements;\n}\n\n/**\n * Optional features of the {@linnk ChatComposite}\n */\nexport type ChatCompositeVisualElements = {\n /**\n * Surface Azure Communication Services backend errors in the UI with {@link @azure/communication-react#ErrorBar}.\n *\n * @defaultValue false\n */\n showErrorBar?: boolean;\n /**\n * Choose to show the participant pane\n * @defaultValue false\n */\n showParticipantPane?: boolean;\n /**\n * Choose to show the topic at the top of the chat\n * @defaultValue false\n */\n showTopic?: boolean;\n};\n\nexport const ChatComposite = (props: ChatCompositeProps): JSX.Element => {\n const { adapter, visualElements, onFetchAvatarPersonaData, onRenderTypingIndicator, onRenderMessage } = props;\n\n return (\n <BaseComposite {...props}>\n <ChatAdapterProvider adapter={adapter}>\n <ChatScreen\n showErrorBar={visualElements?.showErrorBar}\n showParticipantPane={visualElements?.showParticipantPane}\n showTopic={visualElements?.showTopic}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n onRenderTypingIndicator={onRenderTypingIndicator}\n onRenderMessage={onRenderMessage}\n />\n </ChatAdapterProvider>\n </BaseComposite>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { createContext, useContext } from 'react';\nimport { CallAdapter } from './CallAdapter';\n\ntype CallProviderProps = {\n children: React.ReactNode;\n adapter: CallAdapter;\n};\n\nconst CallAdapterContext = createContext<CallAdapter | undefined>(undefined);\n\nexport const CallAdapterProvider = (props: CallProviderProps): JSX.Element => {\n const { adapter } = props;\n return <CallAdapterContext.Provider value={adapter}>{props.children}</CallAdapterContext.Provider>;\n};\n\nexport const useAdapter = (): CallAdapter => {\n const adapter = useContext(CallAdapterContext);\n if (!adapter) throw 'Cannot find adapter please initialize before usage.';\n return adapter;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStackItemStyles, IStackStyles, mergeStyles } from '@fluentui/react';\n\nexport const callControlsStyles: IStackItemStyles = {\n root: {\n width: '100%'\n }\n};\n\nexport const callControlsContainer = mergeStyles({\n width: '100%',\n height: '3.875rem',\n padding: '0.0625rem 0',\n\n overflow: 'hidden',\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 2,\n justifyContent: 'center',\n\n '@media screen and (max-width: 30rem)': {\n label: {\n display: 'none'\n }\n }\n});\n\nexport const containerStyles: IStackStyles = {\n root: {\n height: '100%',\n width: '100%',\n position: 'relative'\n }\n};\n\nexport const subContainerStyles: IStackStyles = {\n root: {\n overflow: 'hidden',\n width: '100%',\n height: '100%',\n minHeight: '10rem' // space affordance to ensure media gallery has minimum space allocated\n }\n};\n\nexport const mediaGalleryContainerStyles: IStackItemStyles = {\n root: {\n height: '100%'\n }\n};\n\nexport const bannersContainerStyles: IStackStyles = {\n root: {\n width: '100%',\n position: 'absolute',\n // High enough to be above the video gallary.\n zIndex: 9,\n top: 0,\n left: 0,\n padding: '1rem'\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useState, useEffect, useRef, useMemo } from 'react';\n\nimport memoizeOne from 'memoize-one';\nimport { useAdapter } from '../adapter/CallAdapterProvider';\nimport { CallAdapterState } from '../adapter/CallAdapter';\nimport { CallErrors, CallState, CallClientState, DeviceManagerState } from '@internal/calling-stateful-client';\nimport { CommunicationUserKind } from '@azure/communication-common';\n\n// This function highly depends on chatClient.onChange event\n// It will be moved into selector folder when the ChatClientProvide when refactor finished\nexport const useAdaptedSelector = <SelectorT extends (state: CallClientState, props: any) => any>(\n selector: SelectorT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n return useSelectorWithAdaptation(selector, adaptCompositeState, selectorProps);\n};\n\nexport const useSelectorWithAdaptation = <\n SelectorT extends (state: ReturnType<AdaptFuncT>, props: any) => any,\n AdaptFuncT extends (state: CallAdapterState) => any\n>(\n selector: SelectorT,\n adaptState: AdaptFuncT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n const adapter = useAdapter();\n\n // Keeps track of whether the current component is mounted or not. If it has unmounted, make sure we do not modify the\n // state or it will cause React warnings in the console. https://skype.visualstudio.com/SPOOL/_workitems/edit/2453212\n const mounted = useRef(false);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n });\n\n const callId = adapter.getState().call?.id;\n const callConfigProps = useMemo(\n () => ({\n callId\n }),\n [callId]\n );\n\n const [props, setProps] = useState(selector(adaptState(adapter.getState()), selectorProps ?? callConfigProps));\n const propRef = useRef(props);\n propRef.current = props;\n\n useEffect(() => {\n const onStateChange = (state: CallAdapterState): void => {\n if (!mounted.current) {\n return;\n }\n const newProps = selector(adaptState(state), selectorProps ?? callConfigProps);\n if (propRef.current !== newProps) {\n setProps(newProps);\n }\n };\n adapter.onStateChange(onStateChange);\n return () => {\n adapter.offStateChange(onStateChange);\n };\n }, [adaptState, adapter, selector, selectorProps, callConfigProps]);\n return props;\n};\n\nconst memoizeState = memoizeOne(\n (\n userId: CommunicationUserKind,\n deviceManager: DeviceManagerState,\n calls: { [key: string]: CallState },\n latestErrors: CallErrors,\n displayName?: string\n ): CallClientState => ({\n userId,\n incomingCalls: {},\n incomingCallsEnded: [],\n callsEnded: [],\n deviceManager,\n callAgent: { displayName },\n calls,\n latestErrors\n })\n);\n\nconst memoizeCalls = memoizeOne((call?: CallState): { [key: string]: CallState } => (call ? { [call.id]: call } : {}));\n\nconst adaptCompositeState = (compositeState: CallAdapterState): CallClientState => {\n return memoizeState(\n compositeState.userId,\n compositeState.devices,\n memoizeCalls(compositeState.call),\n // This is an unsafe type expansion.\n // compositeState.latestErrors can contain properties that are not valid in CallErrors.\n //\n // But there is no way to check for valid property names at runtime:\n // - The set of valid property names is built from types in the @azure/communication-calling.\n // Thus we don't have a literal array of allowed strings at runtime.\n // - Due to minification / uglification, the property names from the objects at runtime can't be used\n // to compare against permissible values inferred from the types.\n //\n // This is not a huge problem -- it simply means that our adapted selector will include some extra operations\n // that are unknown to the UI component and data binding libraries. Generic handling of the errors (e.g.,\n // just displaying them in some UI surface) will continue to work for these operations. Handling of\n // specific operations (e.g., acting on errors related to permission issues) will ignore these operations.\n compositeState.latestErrors as CallErrors,\n compositeState.displayName\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { CallAdapterState } from '../adapter/CallAdapter';\nimport { useSelectorWithAdaptation } from './useAdaptedSelector';\n\n// This function highly depends on callClient.onChange event\nexport const useSelector = <SelectorT extends (state: CallAdapterState, props: any) => any>(\n selector: SelectorT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n // use selector with no adaptation\n return useSelectorWithAdaptation(selector, (state) => state, selectorProps);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallingHandlers } from '@internal/calling-component-bindings';\nimport { CommonProperties, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { ReactElement } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { CallAdapter } from '..';\nimport { useAdapter } from '../adapter/CallAdapterProvider';\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _component: (props: PropsT) => ReactElement | null\n): Pick<CallingHandlers, CommonProperties<CallingHandlers, PropsT>> => {\n return createCompositeHandlers(useAdapter());\n};\n\nconst createCompositeHandlers = memoizeOne(\n (adapter: CallAdapter): CallingHandlers => ({\n onCreateLocalStreamView: async (options) => {\n await adapter.createStreamView(undefined, options);\n },\n onCreateRemoteStreamView: async (userId, options) => {\n await adapter.createStreamView(userId, options);\n },\n onHangUp: async () => {\n await adapter.leaveCall();\n },\n onParticipantRemove: async (userId) => {\n await adapter.removeParticipant(userId);\n },\n onSelectCamera: async (deviceInfo, options) => {\n await adapter.setCamera(deviceInfo, options);\n },\n onSelectMicrophone: async (deviceInfo) => {\n await adapter.setMicrophone(deviceInfo);\n },\n onSelectSpeaker: async (deviceInfo) => {\n await adapter.setSpeaker(deviceInfo);\n },\n onStartCall: (participants) => {\n const rawIds = participants.map((participant) => toFlatCommunicationIdentifier(participant));\n return adapter.startCall(rawIds);\n },\n onStartScreenShare: async () => {\n await adapter.startScreenShare();\n },\n onStopScreenShare: async () => {\n await adapter.stopScreenShare();\n },\n onToggleCamera: async (options) => {\n await adapter.onToggleCamera(options);\n },\n onToggleMicrophone: async () => {\n return adapter.getState().call?.isMuted ? await adapter.unmute() : await adapter.mute();\n },\n onToggleScreenShare: async () => {\n return adapter.getState().call?.isScreenSharingOn\n ? await adapter.stopScreenShare()\n : await adapter.startScreenShare();\n },\n onStartLocalVideo: async () => {\n if (adapter.getState().call) {\n return adapter.startCamera();\n }\n },\n onDisposeLocalStreamView: async () => {\n return adapter.disposeStreamView();\n },\n onDisposeRemoteStreamView: async (userId) => {\n return adapter.disposeStreamView(userId);\n }\n })\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { Common } from '@internal/acs-ui-common';\nimport { CallingHandlers, getCallingSelector, GetCallingSelector } from '@internal/calling-component-bindings';\nimport { useAdaptedSelector } from './useAdaptedSelector';\nimport { useHandlers } from './useHandlers';\n\ntype Selector = (state: any, props: any) => any;\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component\n): GetCallingSelector<Component> extends Selector\n ? ReturnType<GetCallingSelector<Component>> & Common<CallingHandlers, Parameters<Component>[0]>\n : Record<string, never> => {\n const selector = getCallingSelector(component);\n if (!selector) {\n throw new Error(\"Can't find the selector for component, please check supported component list\");\n }\n return { ...useAdaptedSelector(selector as Selector), ...useHandlers(component) };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nconst videoBaseStyle = mergeStyles({\n border: 0\n});\n\nexport const gridStyle = mergeStyles(videoBaseStyle, {\n width: '100%',\n height: '100%'\n});\n\nexport const aspectRatioBoxStyle = mergeStyles(videoBaseStyle, {\n width: '100%',\n height: 0,\n position: 'relative',\n paddingTop: '56.25%' /* default to 16:9 Aspect Ratio for now*/\n});\n\nexport const aspectRatioBoxContentStyle = mergeStyles({\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%'\n});\n\nexport const stackContainerStyle = mergeStyles({\n height: '100%',\n width: '15%'\n});\n\nexport const screenShareContainerStyle = mergeStyles({\n height: '100%',\n width: '85%',\n position: 'relative'\n});\n\nexport const stackContainerParticipantVideoStyles = {\n root: { borderRadius: 0 },\n videoContainer: { borderRadius: 0, '& video': { borderRadius: 0 } }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const videoStreamStyle = mergeStyles({\n position: 'absolute',\n bottom: '.25rem',\n right: '.25rem',\n height: 'auto',\n width: '25%'\n});\n\nexport const loadingStyle = mergeStyles({\n height: '100%',\n width: '100%',\n display: 'flex',\n justifyContent: 'center'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { memoizeFnAll } from '@internal/acs-ui-common';\nimport { mergeStyles, Spinner, SpinnerSize, Stack } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport {\n OnRenderAvatarCallback,\n StreamMedia,\n VideoGalleryLocalParticipant,\n VideoGalleryRemoteParticipant,\n VideoStreamOptions,\n VideoTile\n} from '@internal/react-components';\nimport {\n aspectRatioBoxContentStyle,\n aspectRatioBoxStyle,\n screenShareContainerStyle,\n stackContainerStyle,\n stackContainerParticipantVideoStyles\n} from './styles/MediaGallery.styles';\nimport { loadingStyle, videoStreamStyle } from './styles/ScreenShare.styles';\n\nexport type ScreenShareProps = {\n screenShareParticipant: VideoGalleryRemoteParticipant | undefined;\n localParticipant?: VideoGalleryLocalParticipant;\n remoteParticipants: VideoGalleryRemoteParticipant[];\n onCreateLocalStreamView?: () => Promise<void>;\n onCreateRemoteStreamView?: (userId: string, options?: VideoStreamOptions) => Promise<void>;\n};\n\nconst memoizeAllRemoteParticipants = memoizeFnAll(\n (\n userId: string,\n isMuted?: boolean,\n isSpeaking?: boolean,\n renderElement?: HTMLElement,\n displayName?: string\n ): JSX.Element => {\n return (\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle} key={userId}>\n <Stack className={aspectRatioBoxContentStyle}>\n <VideoTile\n styles={stackContainerParticipantVideoStyles}\n userId={userId}\n renderElement={renderElement ? <StreamMedia videoStreamElement={renderElement} /> : undefined}\n displayName={displayName}\n isMuted={isMuted}\n isSpeaking={isSpeaking}\n />\n </Stack>\n </Stack>\n );\n }\n);\n\n// A non-undefined display name is needed for this render, and that is coming from VideoTile props below\nconst onRenderPlaceholder: OnRenderAvatarCallback = (userId, options): JSX.Element => (\n <div className={loadingStyle}>\n <Spinner label={`Loading ${options?.text}'s screen`} size={SpinnerSize.xSmall} />\n </div>\n);\n\nexport const ScreenShare = (props: ScreenShareProps): JSX.Element => {\n const {\n screenShareParticipant,\n localParticipant,\n remoteParticipants,\n onCreateRemoteStreamView,\n onCreateLocalStreamView\n } = props;\n\n const localVideoStream = localParticipant?.videoStream;\n const isScreenShareAvailable =\n screenShareParticipant &&\n screenShareParticipant.screenShareStream &&\n screenShareParticipant.screenShareStream.isAvailable;\n\n const screenShareStreamComponent = useMemo(() => {\n if (!isScreenShareAvailable) {\n return;\n }\n const screenShareStream = screenShareParticipant?.screenShareStream;\n const videoStream = screenShareParticipant?.videoStream;\n if (screenShareStream?.isAvailable && !screenShareStream?.renderElement) {\n screenShareParticipant && onCreateRemoteStreamView && onCreateRemoteStreamView(screenShareParticipant.userId);\n }\n if (videoStream?.isAvailable && !videoStream?.renderElement) {\n screenShareParticipant && onCreateRemoteStreamView && onCreateRemoteStreamView(screenShareParticipant.userId);\n }\n\n return (\n <VideoTile\n displayName={screenShareParticipant?.displayName}\n isMuted={screenShareParticipant?.isMuted}\n isSpeaking={screenShareParticipant?.isSpeaking}\n renderElement={\n screenShareStream?.renderElement ? (\n <StreamMedia videoStreamElement={screenShareStream?.renderElement} />\n ) : undefined\n }\n onRenderPlaceholder={onRenderPlaceholder}\n styles={{\n overlayContainer: videoStreamStyle\n }}\n >\n {videoStream && videoStream.isAvailable && videoStream.renderElement && (\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle}>\n <Stack className={aspectRatioBoxContentStyle}>\n <VideoTile\n displayName={screenShareParticipant?.displayName}\n isMuted={screenShareParticipant?.isMuted}\n renderElement={\n videoStream.renderElement ? <StreamMedia videoStreamElement={videoStream.renderElement} /> : undefined\n }\n />\n </Stack>\n </Stack>\n )}\n </VideoTile>\n );\n }, [isScreenShareAvailable, onCreateRemoteStreamView, screenShareParticipant]);\n\n const sidePanelLocalParticipant = useMemo(() => {\n if (localVideoStream && !localVideoStream?.renderElement) {\n onCreateLocalStreamView && onCreateLocalStreamView();\n }\n\n return (\n <VideoTile\n styles={stackContainerParticipantVideoStyles}\n isMuted={localParticipant?.isMuted}\n renderElement={\n localVideoStream?.renderElement ? (\n <StreamMedia videoStreamElement={localVideoStream?.renderElement} />\n ) : undefined\n }\n displayName={localParticipant?.displayName}\n />\n );\n }, [localParticipant, localVideoStream, onCreateLocalStreamView]);\n\n const sidePanelRemoteParticipants = useMemo(() => {\n return memoizeAllRemoteParticipants((memoizedRemoteParticipantFn) => {\n return remoteParticipants && screenShareParticipant\n ? remoteParticipants\n .filter((remoteParticipant: VideoGalleryRemoteParticipant) => {\n return remoteParticipant.userId !== screenShareParticipant.userId;\n })\n .map((participant: VideoGalleryRemoteParticipant) => {\n const remoteVideoStream = participant.videoStream;\n\n if (remoteVideoStream?.isAvailable && !remoteVideoStream?.renderElement) {\n onCreateRemoteStreamView && onCreateRemoteStreamView(participant.userId);\n }\n\n return memoizedRemoteParticipantFn(\n participant.userId,\n participant.isMuted,\n participant.isSpeaking,\n remoteVideoStream?.renderElement,\n participant.displayName\n );\n })\n : [];\n });\n }, [remoteParticipants, onCreateRemoteStreamView, screenShareParticipant]);\n\n return (\n <Stack horizontal verticalFill>\n <Stack.Item className={stackContainerStyle}>\n <Stack grow className={mergeStyles({ height: '100%', overflow: 'auto' })}>\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" className={aspectRatioBoxStyle}>\n <Stack className={aspectRatioBoxContentStyle}>{sidePanelLocalParticipant}</Stack>\n </Stack>\n {sidePanelRemoteParticipants}\n </Stack>\n </Stack.Item>\n <Stack.Item className={screenShareContainerStyle}>{screenShareStreamComponent}</Stack.Item>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallState as SDKCallStatus } from '@azure/communication-calling';\nimport { toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { CallState, DeviceManagerState, LocalVideoStreamState } from '@internal/calling-stateful-client';\nimport { CallAdapterState, CallCompositePage } from '../adapter/CallAdapter';\n\nexport const getCallId = (state: CallAdapterState): string | undefined => state.call?.id;\nexport const getEndedCall = (state: CallAdapterState): CallState | undefined => state.endedCall;\nexport const getCallStatus = (state: CallAdapterState): SDKCallStatus => state.call?.state ?? 'None';\nexport const getDeviceManager = (state: CallAdapterState): DeviceManagerState => state.devices;\nexport const getIsScreenShareOn = (state: CallAdapterState): boolean => state.call?.isScreenSharingOn ?? false;\nexport const getIsPreviewCameraOn = (state: CallAdapterState): boolean => isPreviewOn(state.devices);\nexport const getPage = (state: CallAdapterState): CallCompositePage => state.page;\nexport const getLocalMicrophoneEnabled = (state: CallAdapterState): boolean => state.isLocalPreviewMicrophoneEnabled;\nexport const getDisplayName = (state: CallAdapterState): string | undefined => state.displayName;\nexport const getIdentifier = (state: CallAdapterState): string => toFlatCommunicationIdentifier(state.userId);\nexport const getLocalVideoStreams = (state: CallAdapterState): LocalVideoStreamState[] | undefined =>\n state.call?.localVideoStreams;\nexport const getIsTranscriptionActive = (state: CallAdapterState): boolean =>\n !!state.call?.transcription.isTranscriptionActive;\nexport const getIsRecordingActive = (state: CallAdapterState): boolean => !!state.call?.recording.isRecordingActive;\n\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\n // handle cases where 'Preview' view is in progress and not necessary completed.\n return deviceManager.unparentedViews.length > 0 && deviceManager.unparentedViews[0].view !== undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useMemo, useState, useEffect } from 'react';\nimport { VideoGallery, VideoStreamOptions, OnRenderAvatarCallback } from '@internal/react-components';\nimport { useSelector } from './hooks/useSelector';\nimport { usePropsFor } from './hooks/usePropsFor';\nimport { ScreenShare } from './ScreenShare';\nimport { getIsPreviewCameraOn } from './selectors/baseSelectors';\nimport { AvatarPersona, AvatarPersonaDataCallback } from '../common/AvatarPersona';\nimport { mergeStyles, Stack } from '@fluentui/react';\n\nconst VideoGalleryStyles = {\n root: {\n height: '100%',\n minHeight: '10rem' // space affordance to ensure media gallery is never collapsed\n }\n};\n\nconst localVideoViewOption = {\n scalingMode: 'Crop',\n isMirrored: true\n} as VideoStreamOptions;\n\nconst remoteVideoViewOption = {\n scalingMode: 'Crop'\n} as VideoStreamOptions;\n\nexport interface MediaGalleryProps {\n isVideoStreamOn?: boolean;\n isMicrophoneChecked?: boolean;\n onStartLocalVideo: () => Promise<void>;\n onRenderAvatar?: OnRenderAvatarCallback;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n}\n\nexport const MediaGallery = (props: MediaGalleryProps): JSX.Element => {\n const videoGalleryProps = usePropsFor(VideoGallery);\n const [isButtonStatusSynced, setIsButtonStatusSynced] = useState(false);\n\n const isPreviewCameraOn = useSelector(getIsPreviewCameraOn);\n const isScreenShareActive = useMemo(() => {\n return videoGalleryProps.screenShareParticipant !== undefined;\n }, [videoGalleryProps]);\n\n useEffect(() => {\n if (isPreviewCameraOn && !props.isVideoStreamOn && !isButtonStatusSynced) {\n props.onStartLocalVideo();\n }\n setIsButtonStatusSynced(true);\n }, [isButtonStatusSynced, isPreviewCameraOn, props]);\n\n const VideoGalleryMemoized = useMemo(() => {\n return (\n <VideoGallery\n {...videoGalleryProps}\n localVideoViewOption={localVideoViewOption}\n remoteVideoViewOption={remoteVideoViewOption}\n styles={VideoGalleryStyles}\n layout=\"floatingLocalVideo\"\n onRenderAvatar={(userId, options) => (\n <Stack className={mergeStyles({ position: 'absolute', height: '100%', width: '100%' })}>\n <AvatarPersona userId={userId} {...options} dataProvider={props.onFetchAvatarPersonaData} />\n </Stack>\n )}\n />\n );\n }, [props.onFetchAvatarPersonaData, videoGalleryProps]);\n\n return isScreenShareActive ? <ScreenShare {...videoGalleryProps} /> : VideoGalleryMemoized;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureCommunicationTokenCredential, CommunicationTokenRefreshOptions } from '@azure/communication-common';\nimport { CallState as CallStatus } from '@azure/communication-calling';\n\nexport const isInCall = (callStatus: CallStatus): boolean => !!(callStatus !== 'None' && callStatus !== 'Disconnected');\n\n// Create AzureCommunicationUserCredential using optional refreshTokenCallback if provided. If callback is provided then\n// identity must also be provided for callback to be used.\nexport const createAzureCommunicationUserCredential = (\n token: string,\n refreshTokenCallback?: (() => Promise<string>) | undefined\n): AzureCommunicationTokenCredential => {\n if (refreshTokenCallback !== undefined) {\n const options: CommunicationTokenRefreshOptions = {\n token: token,\n tokenRefresher: () => refreshTokenCallback(),\n refreshProactively: true\n };\n return new AzureCommunicationTokenCredential(options);\n } else {\n return new AzureCommunicationTokenCredential(token);\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport { getIsRecordingActive, getIsTranscriptionActive } from './baseSelectors';\n\nexport const complianceBannerSelector = reselect.createSelector(\n [getIsTranscriptionActive, getIsRecordingActive],\n (isTranscriptionActive, isRecordingActive) => {\n return {\n callTranscribeState: isTranscriptionActive,\n callRecordState: isRecordingActive\n };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { getCallStatus, getIsScreenShareOn } from './baseSelectors';\nimport { createSelector } from 'reselect';\nimport { CallState as SDKCallStatus } from '@azure/communication-calling';\n\nexport const callStatusSelector = createSelector(\n [getCallStatus, getIsScreenShareOn],\n (callStatus: SDKCallStatus, isScreenShareOn) => {\n return {\n callStatus,\n isScreenShareOn\n };\n }\n);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport { getLocalVideoStreams } from './baseSelectors';\n\nexport const mediaGallerySelector = reselect.createSelector([getLocalVideoStreams], (localVideoStreams) => {\n return {\n isVideoStreamOn: !!localVideoStreams?.find((stream) => stream.mediaStreamType === 'Video')?.view?.target\n };\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const groupCallLeaveButtonStyle = {\n root: {\n border: '0.125rem',\n borderRadius: 2,\n marginRight: '.75rem',\n height: '2.1875rem',\n width: '6.5625rem'\n },\n flexContainer: {\n flexFlow: 'row'\n }\n};\n\nexport const groupCallLeaveButtonCompressedStyle = {\n root: {\n width: '2rem',\n height: '3.75rem',\n border: '0.125rem',\n borderRadius: 2,\n marginRight: '0.4375rem'\n },\n flexContainer: {\n flexFlow: 'row'\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useCallback } from 'react';\nimport {\n CameraButton,\n ControlBar,\n EndCallButton,\n MicrophoneButton,\n OptionsButton,\n ParticipantsButton,\n ScreenShareButton\n} from '@internal/react-components';\nimport { groupCallLeaveButtonCompressedStyle, groupCallLeaveButtonStyle } from './styles/CallControls.styles';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nexport type CallControlsProps = {\n showParticipantsControl: boolean;\n onEndCallClick(): void;\n compressedMode?: boolean;\n callInvitationURL?: string;\n};\n\nexport const CallControls = (props: CallControlsProps): JSX.Element => {\n const { callInvitationURL, compressedMode, onEndCallClick } = props;\n\n const microphoneButtonProps = usePropsFor(MicrophoneButton);\n const cameraButtonProps = usePropsFor(CameraButton);\n const screenShareButtonProps = usePropsFor(ScreenShareButton);\n const participantsButtonProps = usePropsFor(ParticipantsButton);\n const optionsButtonProps = usePropsFor(OptionsButton);\n const hangUpButtonProps = usePropsFor(EndCallButton);\n const onHangUp = useCallback(async () => {\n await hangUpButtonProps.onHangUp();\n onEndCallClick();\n }, [hangUpButtonProps, onEndCallClick]);\n\n return (\n <ControlBar layout=\"dockedBottom\">\n <CameraButton data-ui-id=\"call-composite-camera-button\" {...cameraButtonProps} showLabel={!compressedMode} />\n <MicrophoneButton\n data-ui-id=\"call-composite-microphone-button\"\n {...microphoneButtonProps}\n showLabel={!compressedMode}\n />\n <ScreenShareButton {...screenShareButtonProps} showLabel={!compressedMode} />\n {props.showParticipantsControl && (\n <ParticipantsButton\n data-ui-id=\"call-composite-participants-button\"\n {...participantsButtonProps}\n showLabel={!compressedMode}\n callInvitationURL={callInvitationURL}\n />\n )}\n {/* By setting `persistMenu` to true, we prevent options menu from getting hidden every time a participant joins or leaves. */}\n <OptionsButton persistMenu={true} {...optionsButtonProps} showLabel={!compressedMode} />\n <EndCallButton\n data-ui-id=\"call-composite-hangup-button\"\n {...hangUpButtonProps}\n onHangUp={onHangUp}\n styles={!compressedMode ? groupCallLeaveButtonStyle : groupCallLeaveButtonCompressedStyle}\n showLabel={!compressedMode}\n />\n </ControlBar>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport React, { useEffect, useState } from 'react';\nimport { Link, MessageBar } from '@fluentui/react';\n\nexport type ComplianceBannerProps = {\n callTranscribeState?: boolean;\n callRecordState?: boolean;\n};\nexport const ComplianceBanner = (props: ComplianceBannerProps): JSX.Element => {\n const [previousCallTranscribeState, setPreviousCallTranscribeState] = useState<boolean | undefined>(false);\n const [previousCallRecordState, setPreviousCallRecordState] = useState<boolean | undefined>(false);\n const [variant, setVariant] = useState(0);\n\n const TRANSCRIPTION_STOPPED_STILL_RECORDING = 1;\n const RECORDING_STOPPED_STILL_TRANSCRIBING = 2;\n const RECORDING_AND_TRANSCRIPTION_STOPPED = 3;\n const RECORDING_AND_TRANSCRIPTION_STARTED = 4;\n const TRANSCRIPTION_STARTED = 5;\n const RECORDING_STOPPED = 6;\n const RECORDING_STARTED = 7;\n const RECORDING_STOPPED_AND_SAVED = 8;\n const NO_STATE = 0;\n\n const { callTranscribeState, callRecordState } = props;\n\n useEffect(() => {\n if (previousCallRecordState && previousCallTranscribeState) {\n if (callRecordState && !callTranscribeState) {\n setVariant(TRANSCRIPTION_STOPPED_STILL_RECORDING);\n } else if (!callRecordState && callTranscribeState) {\n setVariant(RECORDING_STOPPED_STILL_TRANSCRIBING);\n } else if (!callRecordState && !callTranscribeState) {\n setVariant(RECORDING_AND_TRANSCRIPTION_STOPPED);\n } else {\n setVariant(NO_STATE);\n }\n } else if (previousCallRecordState && !previousCallTranscribeState) {\n if (callRecordState && callTranscribeState) {\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\n } else if (!callRecordState && callTranscribeState) {\n setVariant(TRANSCRIPTION_STARTED);\n } else if (!callRecordState && !callTranscribeState) {\n setVariant(RECORDING_STOPPED);\n } else {\n setVariant(NO_STATE);\n }\n } else if (!previousCallRecordState && previousCallTranscribeState) {\n if (callRecordState && callTranscribeState) {\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\n } else if (!callRecordState && callTranscribeState) {\n setVariant(RECORDING_STARTED);\n } else if (!callRecordState && !callTranscribeState) {\n setVariant(RECORDING_STOPPED_AND_SAVED);\n } else {\n setVariant(NO_STATE);\n }\n } else if (!previousCallRecordState && !previousCallTranscribeState) {\n if (callRecordState && callTranscribeState) {\n setVariant(RECORDING_AND_TRANSCRIPTION_STARTED);\n } else if (callRecordState && !callTranscribeState) {\n setVariant(RECORDING_STARTED);\n } else if (!callRecordState && callTranscribeState) {\n setVariant(TRANSCRIPTION_STARTED);\n } else {\n setVariant(NO_STATE);\n }\n }\n\n setPreviousCallTranscribeState(callTranscribeState);\n setPreviousCallRecordState(callRecordState);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [callTranscribeState, callRecordState]);\n\n function PrivacyPolicy(): JSX.Element {\n return (\n <Link\n href=\"https://privacy.microsoft.com/en-US/privacystatement#mainnoticetoendusersmodule\"\n target=\"_blank\"\n underline\n >\n Privacy policy\n </Link>\n );\n }\n\n function LearnMore(): JSX.Element {\n return (\n <Link\n href=\"https://support.microsoft.com/en-us/office/record-a-meeting-in-teams-34dfbe7f-b07d-4a27-b4c6-de62f1348c24\"\n target=\"_blank\"\n underline\n >\n Learn more\n </Link>\n );\n }\n\n function getBannerMessage(variant: number): JSX.Element {\n switch (variant) {\n case TRANSCRIPTION_STOPPED_STILL_RECORDING:\n return (\n <>\n <b>Transcription has stopped.</b> You are now only recording this meeting.\n <PrivacyPolicy />\n </>\n );\n case RECORDING_STOPPED_STILL_TRANSCRIBING:\n return (\n <>\n <b>Recording has stopped.</b> You are now only transcribing this meeting.\n <PrivacyPolicy />\n </>\n );\n case RECORDING_AND_TRANSCRIPTION_STOPPED:\n return (\n <>\n <b>Recording and transcription are being saved. </b> Recording and transcription have stopped.\n <LearnMore />\n </>\n );\n case RECORDING_AND_TRANSCRIPTION_STARTED:\n return (\n <>\n <b>Recording and transcription have started.</b> By joining, you are giving consent for this meeting to be\n transcribed.\n <PrivacyPolicy />\n </>\n );\n case TRANSCRIPTION_STARTED:\n return (\n <>\n <b>Transcription has started.</b> By joining, you are giving consent for this meeting to be transcribed.\n <PrivacyPolicy />\n </>\n );\n case RECORDING_STOPPED:\n return (\n <>\n <b>Recording is being saved.</b> Recording has stopped.\n <LearnMore />\n </>\n );\n case RECORDING_STARTED:\n return (\n <>\n <b>Recording has started.</b> By joining, you are giving consent for this meeting to be transcribed.\n <PrivacyPolicy />\n </>\n );\n case RECORDING_STOPPED_AND_SAVED:\n return (\n <>\n <b>Transcription is being saved.</b> Transcription has stopped.\n <LearnMore />\n </>\n );\n }\n return <></>;\n }\n\n return variant === NO_STATE ? (\n <></>\n ) : (\n <MessageBar\n onDismiss={() => {\n setVariant(NO_STATE);\n }}\n dismissButtonAriaLabel=\"Close\"\n >\n {getBannerMessage(variant)}\n </MessageBar>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport { getLocalVideoStreams } from './baseSelectors';\n\nexport const lobbySelector = reselect.createSelector([getLocalVideoStreams], (localVideoStreams) => {\n const localVideoStream = localVideoStreams?.find((i) => i.mediaStreamType === 'Video');\n return {\n localParticipantVideoStream: {\n isAvailable: !!localVideoStream,\n isMirrored: localVideoStream?.view?.isMirrored,\n renderElement: localVideoStream?.view?.target\n }\n };\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport React, { useCallback } from 'react';\nimport {\n CameraButton,\n ControlBar,\n EndCallButton,\n MicrophoneButton,\n OptionsButton,\n useTheme\n} from '@internal/react-components';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nexport interface LobbyCallControlBarProps {\n isMicrophoneChecked?: boolean;\n onEndCallClick(): void;\n}\n\nexport const LobbyCallControlBar = (props: LobbyCallControlBarProps): JSX.Element => {\n const theme = useTheme();\n\n const microphoneButtonProps = usePropsFor(MicrophoneButton);\n const cameraButtonProps = usePropsFor(CameraButton);\n const optionsButtonProps = usePropsFor(OptionsButton);\n const hangUpButtonProps = usePropsFor(EndCallButton);\n const onHangUp = useCallback(async () => {\n await hangUpButtonProps.onHangUp();\n props.onEndCallClick();\n }, [hangUpButtonProps, props]);\n\n return (\n <ControlBar\n layout=\"dockedBottom\"\n styles={{ root: { background: theme.palette.white, minHeight: '4.25rem', alignItems: 'center' } }}\n >\n <CameraButton showLabel={true} {...cameraButtonProps} />\n <MicrophoneButton showLabel={true} {...microphoneButtonProps} checked={props.isMicrophoneChecked} />\n <OptionsButton showLabel={true} {...optionsButtonProps} />\n <EndCallButton showLabel={true} style={{ borderRadius: '0.25rem', marginLeft: '0.25rem' }} onHangUp={onHangUp} />\n </ControlBar>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport React, { useEffect, useState } from 'react';\nimport { StreamMedia, VideoGalleryStream, VideoStreamOptions, VideoTile, useTheme } from '@internal/react-components';\nimport { LobbyCallControlBar } from './LobbyControlBar';\nimport { useSelector } from './hooks/useSelector';\nimport { getIsPreviewCameraOn } from './selectors/baseSelectors';\n\nexport interface LobbyProps {\n callState: string;\n localParticipantVideoStream: VideoGalleryStream;\n localVideoViewOption?: VideoStreamOptions;\n isCameraChecked?: boolean;\n isMicrophoneChecked?: boolean;\n onCreateLocalStreamView?: (options?: VideoStreamOptions) => Promise<void>;\n onStartLocalVideo: () => Promise<void>;\n onEndCallClick: () => void;\n}\n\nconst onRenderEmptyPlaceholder = (): JSX.Element => <></>;\n\nexport const Lobby = (props: LobbyProps): JSX.Element => {\n const theme = useTheme();\n const palette = theme.palette;\n\n const [isButtonStatusSynced, setIsButtonStatusSynced] = useState(false);\n const isPreviewCameraOn = useSelector(getIsPreviewCameraOn);\n\n const videoStream = props.localParticipantVideoStream;\n const isVideoReady = videoStream.isAvailable;\n const renderElement = videoStream.renderElement;\n\n const callStateText = props.callState === 'InLobby' ? 'Waiting to be admitted' : 'Connecting...';\n\n const videoTileStyles = {\n root: { height: '100%', width: '100%' },\n overlayContainer: {}\n };\n\n useEffect(() => {\n if (\n props.callState === 'InLobby' &&\n isPreviewCameraOn &&\n !isButtonStatusSynced &&\n !isVideoReady &&\n !renderElement\n ) {\n props.onStartLocalVideo().catch((err) => console.log('Can not start video', err));\n setIsButtonStatusSynced(true);\n }\n }, [isButtonStatusSynced, isPreviewCameraOn, isVideoReady, props, renderElement]);\n\n useEffect(() => {\n if (videoStream && isVideoReady) {\n props.onCreateLocalStreamView &&\n props\n .onCreateLocalStreamView(props.localVideoViewOption)\n .catch((err) => console.log('Can not render video', err));\n }\n }, [isVideoReady, videoStream, props, renderElement]);\n\n return (\n <VideoTile\n styles={videoTileStyles}\n renderElement={renderElement ? <StreamMedia videoStreamElement={renderElement} /> : undefined}\n onRenderPlaceholder={onRenderEmptyPlaceholder}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n position: 'absolute',\n background: isVideoReady ? '#201f1e' : palette.neutralLight,\n opacity: 0.75\n }}\n />\n\n <div\n style={{\n textAlign: 'center',\n zIndex: 0,\n width: '50%',\n height: '25%',\n overflow: 'none',\n margin: 'auto',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0\n }}\n >\n <p style={{ fontSize: '1.75rem', color: isVideoReady ? 'white' : palette.neutralPrimary }}>\n ☕ <br /> {callStateText}\n </p>\n </div>\n\n <LobbyCallControlBar isMicrophoneChecked={props.isMicrophoneChecked} onEndCallClick={props.onEndCallClick} />\n </VideoTile>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IMessageBarStyleProps, IMessageBarStyles, IStyleFunctionOrObject } from '@fluentui/react';\n\nexport const permissionsBannerContainerStyle = {\n width: '100%'\n};\n\nexport const permissionsBannerMessageBarStyle: IStyleFunctionOrObject<IMessageBarStyleProps, IMessageBarStyles> = {\n root: {\n // Constrain permission banner height if there is a long error message in a narrow space.\n maxHeight: '5rem'\n },\n text: {\n // Ensure the dismiss action button is aligned to the right hand side by allowing text to grow to available space\n flexGrow: '1',\n\n // Allow errors to be multi-line. We use this property instead of `isMultiline={true}` to ensure the action button\n // does not take a new line and is instead placed to the right hand side of the error message.\n span: { whiteSpace: 'normal' }\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { MessageBar, MessageBarButton, MessageBarType } from '@fluentui/react';\nimport { permissionsBannerMessageBarStyle } from '../common/styles/PermissionsBanner.styles';\n\nexport const CAMERA_PERMISSION_DENIED = 'Camera use is blocked by your browser.';\nexport const MICROPHONE_PERMISSION_DENIED = 'Microphone use is blocked by your browser.';\nexport const CAMERA_AND_MICROPHONE_PERMISSION_DENIED = 'Camera and microphone use is blocked by your browser.';\nconst ALLOW_PERMISSIONS_INSTRUCTIONS =\n \"Grant permission by clicking the lock in the address bar and selecting 'Allow'.\";\n\nexport interface PermissionsBannerProps {\n /**\n * If cameraPermission is true or undefined, no banner is shown for camera.\n */\n cameraPermissionGranted: boolean | undefined;\n /**\n * If microphonePermission is true or undefined, no banner is shown for microphone.\n */\n microphonePermissionGranted: boolean | undefined;\n}\n\n/**\n * Returns the appropriate banner message for given states. Returns empty string if no banner message should be\n * displayed.\n *\n * @param cameraPermissionGranted - If permission is granted for camera, undefined if no response to permission ask\n * @param microphonePermissionGranted - If permission is granted for microphone, undefined if no response to permission\n * ask\n * @param dismissedCameraBanner - If camera banner was already dismissed\n * @param dismissedMicrophoneBanner - If microphone banner was already dismissed\n * @returns\n */\nexport const getPermissionsBannerMessage = (\n cameraPermissionGranted: boolean | undefined,\n microphonePermissionGranted: boolean | undefined,\n dismissedCameraBanner: boolean,\n dismissedMicrophoneBanner: boolean\n): string => {\n const showCameraMessage = cameraPermissionGranted !== undefined && !cameraPermissionGranted && !dismissedCameraBanner;\n const showMicrophoneMessage =\n microphonePermissionGranted !== undefined && !microphonePermissionGranted && !dismissedMicrophoneBanner;\n if (showCameraMessage && showMicrophoneMessage) {\n return CAMERA_AND_MICROPHONE_PERMISSION_DENIED;\n } else if (showCameraMessage) {\n return CAMERA_PERMISSION_DENIED;\n } else if (showMicrophoneMessage) {\n return MICROPHONE_PERMISSION_DENIED;\n } else {\n return '';\n }\n};\n\n/**\n * Shows a banner notifying user if camera or microphone permission is denied and also instructions on how to allow the\n * necessary permissions. If either camera or microphone permission is true or undefined then no banner for those items\n * are show. This banner will not show anything if the permission (undefined) has been requested but user has not\n * responded to it. Sample app/composite will always request permission so the case of permission not requested is\n * assumed to not happen by this component. If the banner was dismissed, it will be dismissed for the current state of\n * the props and stay dismissed even if permission change after dismissal.\n *\n * @param props {@link PermissionsBannerProps}\n */\nexport const PermissionsBanner = (props: PermissionsBannerProps): JSX.Element => {\n const { cameraPermissionGranted, microphonePermissionGranted } = props;\n const [dismissedCameraBanner, setDismissedCameraBanner] = useState<boolean>(false);\n const [dismissedMicrophoneBanner, setDismissedMicrophoneBanner] = useState<boolean>(false);\n\n const bannerMessage = useMemo(() => {\n return getPermissionsBannerMessage(\n cameraPermissionGranted,\n microphonePermissionGranted,\n dismissedCameraBanner,\n dismissedMicrophoneBanner\n );\n }, [cameraPermissionGranted, microphonePermissionGranted, dismissedCameraBanner, dismissedMicrophoneBanner]);\n\n const dismissBanner = useCallback(() => {\n if (cameraPermissionGranted !== undefined && !cameraPermissionGranted) {\n setDismissedCameraBanner(true);\n }\n if (microphonePermissionGranted !== undefined && !microphonePermissionGranted) {\n setDismissedMicrophoneBanner(true);\n }\n }, [cameraPermissionGranted, microphonePermissionGranted]);\n\n return bannerMessage === '' ? (\n <></>\n ) : (\n <MessageBar\n styles={permissionsBannerMessageBarStyle}\n messageBarType={MessageBarType.warning}\n isMultiline={false}\n actions={<MessageBarButton onClick={dismissBanner}>Dismiss</MessageBarButton>}\n >\n <b>{bannerMessage}</b>&nbsp;{ALLOW_PERMISSIONS_INSTRUCTIONS}\n </MessageBar>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as reselect from 'reselect';\nimport { getDeviceManager } from './baseSelectors';\n\nexport const devicePermissionSelector = reselect.createSelector([getDeviceManager], (deviceManager) => {\n return {\n video: deviceManager.deviceAccess ? deviceManager.deviceAccess.video : undefined,\n audio: deviceManager.deviceAccess ? deviceManager.deviceAccess.audio : undefined\n };\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IButtonStyles, IModalStyleProps, IModalStyles, IStyleFunctionOrObject, Theme } from '@fluentui/react';\nimport { CSSProperties } from 'react';\n\nexport const getScreenSharePopupModalStyles = (\n theme: Theme\n): IStyleFunctionOrObject<IModalStyleProps, IModalStyles> => {\n return {\n root: { width: '100%', height: '100%' },\n main: {\n boxShadow: theme.effects.elevation8,\n borderRadius: theme.effects.roundedCorner4,\n background: theme.palette.neutralLighterAlt\n }\n };\n};\n\nexport const screenSharePopupModalStackStyles: CSSProperties = {\n width: '18rem',\n height: '11.4375rem',\n paddingBottom: '0.5rem'\n};\n\nexport const screenSharePopupModalLabelStyles: CSSProperties = {\n lineHeight: '1rem',\n fontSize: '0.75rem',\n fontWeight: 'normal'\n};\n\nexport const getScreenSharePopupModalButtonStyles = (theme: Theme): IButtonStyles => {\n return {\n root: {\n padding: '0.375rem 0.75rem',\n border: '0rem',\n boxShadow: theme.effects.elevation4,\n borderRadius: theme.effects.roundedCorner4,\n svg: {\n verticalAlign: 'text-top'\n }\n }\n };\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ContextualMenu,\n DefaultButton,\n FocusTrapCallout,\n Icon,\n IDragOptions,\n Label,\n Modal,\n Stack\n} from '@fluentui/react';\nimport { useTheme } from '@internal/react-components';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n getScreenSharePopupModalButtonStyles,\n getScreenSharePopupModalStyles,\n screenSharePopupModalLabelStyles,\n screenSharePopupModalStackStyles\n} from './styles/ScreenSharePopup.styles';\n\nconst STOP_SCREENSHARE_BUTTON_TEXT = 'Stop presenting';\nconst STOP_SCREENSHARE_LABEL_TEXT = \"You're presenting your screen.\";\nconst onRenderStopScreenShareIcon = (): JSX.Element => {\n return <Icon iconName=\"ScreenSharePopupStopPresenting\" />;\n};\n\nconst DRAG_OPTIONS: IDragOptions = {\n moveMenuItemText: 'Move',\n closeMenuItemText: 'Close',\n menu: ContextualMenu,\n keepInBounds: true\n};\n\nexport interface ScreenSharePopupProps {\n onStopScreenShare: () => Promise<void>;\n\n /**\n * ID of the react element to host the screenshare modal window in.\n * If this is not supplied the modal dialog is hosted in a fixed\n * position element rendered at the end of the document.\n *\n * {@link https://docs.microsoft.com/en-us/javascript/api/react-internal/ilayerprops?view=office-ui-fabric-react-latest#hostId}\n */\n hostId?: string;\n}\n\nexport const ScreenSharePopup = (props: ScreenSharePopupProps): JSX.Element => {\n const { hostId, onStopScreenShare } = props;\n const [stoppingInProgress, setStoppingInProgress] = useState(false);\n\n const theme = useTheme();\n\n const screenSharePopupModalStylesThemed = useMemo(() => {\n return getScreenSharePopupModalStyles(theme);\n }, [theme]);\n\n const screenSharePopupModalButtonStylesThemed = useMemo(() => {\n return getScreenSharePopupModalButtonStyles(theme);\n }, [theme]);\n\n const isMounted = useRef(false);\n\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const onStopScreenShareClicked = useCallback(async () => {\n setStoppingInProgress(true);\n await onStopScreenShare();\n if (isMounted.current) {\n setStoppingInProgress(false);\n }\n }, [onStopScreenShare]);\n\n return (\n <Modal\n layerProps={hostId ? { hostId } : undefined}\n isOpen={true}\n isModeless={true}\n dragOptions={DRAG_OPTIONS}\n styles={screenSharePopupModalStylesThemed}\n >\n <Stack style={screenSharePopupModalStackStyles} horizontalAlign={'center'}>\n <Stack verticalFill={true} verticalAlign={'center'} horizontalAlign={'center'}>\n <Icon iconName=\"ScreenSharePopupPresenting\" />\n <Label style={screenSharePopupModalLabelStyles}>{STOP_SCREENSHARE_LABEL_TEXT}</Label>\n </Stack>\n <DefaultButton\n styles={screenSharePopupModalButtonStylesThemed}\n onRenderIcon={onRenderStopScreenShareIcon}\n onClick={onStopScreenShareClicked}\n text={STOP_SCREENSHARE_BUTTON_TEXT}\n disabled={stoppingInProgress}\n />\n </Stack>\n {/*\n The FocusTrapCallout is a workaround to allow users to tab-navigate out of the Modal. There is an open\n issue here: https://github.com/microsoft/fluentui/issues/18924\n */}\n <FocusTrapCallout\n focusTrapProps={{ isClickableOutsideFocusTrap: true, forceFocusInsideTrap: false }}\n ></FocusTrapCallout>\n </Modal>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Spinner, Stack } from '@fluentui/react';\nimport React, { useEffect, useRef, useState } from 'react';\nimport {\n mediaGalleryContainerStyles,\n containerStyles,\n callControlsStyles,\n subContainerStyles,\n callControlsContainer,\n bannersContainerStyles\n} from './styles/CallScreen.styles';\n\nimport { MediaGallery } from './MediaGallery';\nimport { isInCall } from '../../utils/SDKUtils';\nimport { complianceBannerSelector } from './selectors/complianceBannerSelector';\nimport { useAdapter } from './adapter/CallAdapterProvider';\nimport { useSelector } from './hooks/useSelector';\nimport { getCallId, getEndedCall } from './selectors/baseSelectors';\nimport { callStatusSelector } from './selectors/callStatusSelector';\nimport { mediaGallerySelector } from './selectors/mediaGallerySelector';\nimport { useHandlers } from './hooks/useHandlers';\nimport { ErrorBar, OnRenderAvatarCallback, VideoStreamOptions } from '@internal/react-components';\nimport { CallControls } from './CallControls';\nimport { ComplianceBanner } from './ComplianceBanner';\nimport { lobbySelector } from './selectors/lobbySelector';\nimport { Lobby } from './Lobby';\nimport { AzureCommunicationCallAdapter } from './adapter/AzureCommunicationCallAdapter';\nimport { CallCompositePage } from './adapter/CallAdapter';\nimport { PermissionsBanner } from '../common/PermissionsBanner';\nimport { permissionsBannerContainerStyle } from '../common/styles/PermissionsBanner.styles';\nimport { devicePermissionSelector } from './selectors/devicePermissionSelector';\nimport { ScreenSharePopup } from './ScreenSharePopup';\nimport { AvatarPersonaDataCallback } from '../common/AvatarPersona';\nimport { usePropsFor } from './hooks/usePropsFor';\n\nexport interface CallScreenProps {\n callInvitationURL?: string;\n endCallHandler(): void;\n callErrorHandler(customPage?: CallCompositePage): void;\n onRenderAvatar?: OnRenderAvatarCallback;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n visualElements: {\n showCallControls: boolean;\n showErrorBar: boolean;\n };\n}\n\nconst spinnerLabel = 'Initializing call client...';\n\nexport const CallScreen = (props: CallScreenProps): JSX.Element => {\n const { callInvitationURL, endCallHandler, callErrorHandler, onRenderAvatar, onFetchAvatarPersonaData } = props;\n\n const [joinedCall, setJoinedCall] = useState<boolean>(false);\n\n // To use useProps to get these states, we need to create another file wrapping Call,\n // It seems unnecessary in this case, so we get the updated states using this approach.\n const { callStatus, isScreenShareOn } = useSelector(callStatusSelector);\n const callId = useSelector(getCallId);\n const currentCallId = useRef('');\n\n // Remember last available callId\n if (callId) {\n currentCallId.current = callId;\n }\n\n const mediaGalleryProps = useSelector(mediaGallerySelector);\n const mediaGalleryHandlers = useHandlers(MediaGallery);\n const complianceBannerProps = useSelector(complianceBannerSelector);\n const errorBarProps = usePropsFor(ErrorBar);\n\n const lobbyProps = useSelector(lobbySelector);\n const lobbyHandlers = useHandlers(Lobby);\n\n const devicePermissions = useSelector(devicePermissionSelector);\n\n const localVideoViewOption = {\n scalingMode: 'Crop',\n isMirrored: true\n } as VideoStreamOptions;\n\n const adapter = useAdapter();\n\n useEffect(() => {\n if (!joinedCall) {\n adapter.joinCall();\n }\n setJoinedCall(true);\n }, [adapter, joinedCall]);\n\n const endedCall = useSelector(getEndedCall);\n\n // Handle Call Join Errors\n useEffect(() => {\n if (endedCall && currentCallId.current === endedCall?.id) {\n if (endedCall?.callEndReason?.code === 0 && endedCall?.callEndReason.subCode === 5854) {\n callErrorHandler('errorJoiningTeamsMeeting');\n } else if (endedCall?.callEndReason?.code === 0 && endedCall?.callEndReason?.subCode === 5300) {\n callErrorHandler('removed');\n }\n }\n }, [callErrorHandler, endedCall]);\n\n if ('isTeamsCall' in adapter) {\n const azureAdapter = adapter as AzureCommunicationCallAdapter;\n const callState = azureAdapter.getState().call?.state;\n if (\n azureAdapter.isTeamsCall() &&\n callState !== undefined &&\n azureAdapter.getState().call &&\n ['Connecting', 'Ringing', 'InLobby'].includes(callState)\n ) {\n return (\n <Lobby\n callState={callState}\n {...lobbyProps}\n {...lobbyHandlers}\n onEndCallClick={endCallHandler}\n isMicrophoneChecked={azureAdapter.getState().isLocalPreviewMicrophoneEnabled}\n localVideoViewOption={localVideoViewOption}\n />\n );\n }\n }\n\n const screenShareModalHostId = 'UILibraryMediaGallery';\n return (\n <Stack horizontalAlign=\"center\" verticalAlign=\"center\" styles={containerStyles} grow>\n {isInCall(callStatus ?? 'None') ? (\n <>\n <Stack styles={bannersContainerStyles}>\n <Stack.Item>\n <ComplianceBanner {...complianceBannerProps} />\n </Stack.Item>\n <Stack.Item style={permissionsBannerContainerStyle}>\n <PermissionsBanner\n microphonePermissionGranted={devicePermissions.audio}\n cameraPermissionGranted={devicePermissions.video}\n />\n </Stack.Item>\n {props.visualElements.showErrorBar && (\n <Stack.Item>\n <ErrorBar {...errorBarProps} />\n </Stack.Item>\n )}\n </Stack>\n\n <Stack.Item styles={subContainerStyles} grow>\n {callStatus === 'Connected' && (\n <>\n <Stack styles={containerStyles} grow>\n <Stack.Item id={screenShareModalHostId} grow styles={mediaGalleryContainerStyles}>\n <MediaGallery\n {...mediaGalleryProps}\n {...mediaGalleryHandlers}\n onRenderAvatar={onRenderAvatar}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n />\n </Stack.Item>\n </Stack>\n {isScreenShareOn ? (\n <ScreenSharePopup\n hostId={screenShareModalHostId}\n onStopScreenShare={() => {\n return adapter.stopScreenShare();\n }}\n />\n ) : (\n <></>\n )}\n </>\n )}\n </Stack.Item>\n {props.visualElements.showCallControls && (\n <Stack.Item styles={callControlsStyles}>\n <Stack className={callControlsContainer}>\n <CallControls\n showParticipantsControl={true}\n onEndCallClick={endCallHandler}\n callInvitationURL={callInvitationURL}\n />\n </Stack>\n </Stack.Item>\n )}\n </>\n ) : (\n <Spinner label={spinnerLabel} ariaLive=\"assertive\" labelPosition=\"top\" />\n )}\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IDropdownStyles, IStackTokens, Theme, mergeStyles } from '@fluentui/react';\n\nexport const mainStackTokens: IStackTokens = {\n childrenGap: '1rem'\n};\n\nexport const micStackTokens: IStackTokens = {\n childrenGap: '1rem'\n};\n\nexport const dropDownStyles = (theme: Theme): Partial<IDropdownStyles> => ({\n caretDownWrapper: {\n height: '2.5rem',\n lineHeight: '2.5rem'\n },\n dropdownItem: {\n fontSize: '0.875rem',\n height: '2.5rem',\n background: theme.palette.neutralQuaternaryAlt\n },\n dropdown: {\n height: '2.5rem',\n width: '100%',\n svg: {\n verticalAlign: 'top'\n }\n },\n title: {\n fontSize: '0.875rem',\n height: '2.5rem',\n lineHeight: '2.3125rem'\n },\n label: {\n fontWeight: 600,\n fontSize: '0.875rem'\n },\n errorMessage: {\n fontSize: '0.875rem'\n }\n});\n\nexport const localSettingsContainer = mergeStyles({\n width: '18.75rem',\n minWidth: '12.5rem',\n maxHeight: '19.125rem',\n marginTop: '.313rem'\n});\n\nexport const dropDownTitleIconStyles = mergeStyles({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n minWidth: '0',\n maxWidth: '100%',\n overflowWrap: 'break-word',\n margin: '.063rem'\n});\n\nexport const optionIconStyles = mergeStyles({\n marginRight: '8px',\n verticalAlign: 'text-top'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AudioDeviceInfo, VideoDeviceInfo } from '@azure/communication-calling';\nimport { Dropdown, Icon, IDropdownOption, Stack } from '@fluentui/react';\nimport { useTheme, VideoStreamOptions } from '@internal/react-components';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport {\n dropDownStyles,\n dropDownTitleIconStyles,\n localSettingsContainer,\n mainStackTokens,\n optionIconStyles\n} from './styles/LocalDeviceSettings.styles';\n\ntype iconType = 'Camera' | 'Microphone' | 'Speaker';\n\nconst getDropDownList = (list: Array<VideoDeviceInfo | AudioDeviceInfo>): IDropdownOption[] => {\n // Remove duplicates\n const noDuplicates = new Map<string, VideoDeviceInfo | AudioDeviceInfo>();\n for (const item of list) {\n noDuplicates.set(item.id, item);\n }\n const dropdownList: IDropdownOption[] = [];\n for (const item of noDuplicates.values()) {\n dropdownList.push({\n key: item.id,\n text: item.name === '' ? item.deviceType : item.name\n });\n }\n return dropdownList;\n};\n\nconst getOptionIcon = (type: iconType): JSX.Element | undefined => {\n if (type === 'Camera') {\n return <Icon iconName=\"LocalDeviceSettingsCamera\" className={optionIconStyles} />;\n } else if (type === 'Microphone') {\n return <Icon iconName=\"LocalDeviceSettingsMic\" className={optionIconStyles} />;\n } else if (type === 'Speaker') {\n return <Icon iconName=\"LocalDeviceSettingsSpeaker\" className={optionIconStyles} />;\n } else {\n return undefined;\n }\n};\n\nconst onRenderTitle = (iconType: iconType, props?: IDropdownOption[]): JSX.Element => {\n const icon = props && getOptionIcon(iconType);\n return props ? (\n <div className={dropDownTitleIconStyles}>\n {icon}\n <span>{props[0].text}</span>\n </div>\n ) : (\n <></>\n );\n};\n\nconst localVideoViewOption = {\n scalingMode: 'Crop',\n isMirrored: true\n} as VideoStreamOptions;\n\nexport interface LocalDeviceSettingsType {\n cameras: VideoDeviceInfo[];\n microphones: AudioDeviceInfo[];\n speakers: AudioDeviceInfo[];\n selectedCamera?: VideoDeviceInfo;\n selectedMicrophone?: AudioDeviceInfo;\n selectedSpeaker?: AudioDeviceInfo;\n microphonePermissionGranted: boolean | undefined;\n cameraPermissionGranted: boolean | undefined;\n onSelectCamera: (device: VideoDeviceInfo, options?: VideoStreamOptions) => Promise<void>;\n onSelectMicrophone: (device: AudioDeviceInfo) => Promise<void>;\n onSelectSpeaker: (device: AudioDeviceInfo) => Promise<void>;\n}\n\nexport const LocalDeviceSettings = (props: LocalDeviceSettingsType): JSX.Element => {\n const theme = useTheme();\n const locale = useLocale();\n const defaultPlaceHolder = locale.strings.call.defaultPlaceHolder;\n const cameraLabel = locale.strings.call.cameraLabel;\n const soundLabel = locale.strings.call.soundLabel;\n\n // TODO: speaker permission is tied to microphone permission (when you request 'audio' permission using the SDK) its\n // actually granting access to query both microphone and speaker. However the browser popup asks you explicity for\n // 'microphone'. This needs investigation on how we want to handle this and maybe needs follow up with SDK team.\n\n return (\n <Stack data-ui-id=\"call-composite-device-settings\" className={localSettingsContainer} tokens={mainStackTokens}>\n <Dropdown\n data-ui-id=\"call-composite-local-camera-settings\"\n label={cameraLabel}\n placeholder={defaultPlaceHolder}\n options={\n props.cameraPermissionGranted ? getDropDownList(props.cameras) : [{ key: 'deniedOrUnknown', text: '' }]\n }\n styles={dropDownStyles(theme)}\n disabled={!props.cameraPermissionGranted}\n errorMessage={\n props.cameraPermissionGranted === undefined || props.cameraPermissionGranted\n ? undefined\n : locale.strings.call.cameraPermissionDenied\n }\n defaultSelectedKey={\n props.cameraPermissionGranted\n ? props.selectedCamera\n ? props.selectedCamera.id\n : props.cameras\n ? props.cameras[0]?.id\n : ''\n : 'deniedOrUnknown'\n }\n onChange={(event, option, index) => {\n props.onSelectCamera(props.cameras[index ?? 0], localVideoViewOption);\n }}\n onRenderTitle={(props?: IDropdownOption[]) => onRenderTitle('Camera', props)}\n />\n <Dropdown\n label={soundLabel}\n placeholder={defaultPlaceHolder}\n styles={dropDownStyles(theme)}\n disabled={!props.microphonePermissionGranted}\n errorMessage={\n props.microphonePermissionGranted === undefined || props.microphonePermissionGranted\n ? undefined\n : locale.strings.call.microphonePermissionDenied\n }\n options={\n props.microphonePermissionGranted\n ? getDropDownList(props.microphones)\n : [{ key: 'deniedOrUnknown', text: '' }]\n }\n defaultSelectedKey={\n props.microphonePermissionGranted\n ? props.selectedMicrophone\n ? props.selectedMicrophone.id\n : props.microphones\n ? props.microphones[0]?.id\n : ''\n : 'deniedOrUnknown'\n }\n onChange={(\n event: React.FormEvent<HTMLDivElement>,\n option?: IDropdownOption | undefined,\n index?: number | undefined\n ) => {\n props.onSelectMicrophone(props.microphones[index ?? 0]);\n }}\n onRenderTitle={(props?: IDropdownOption[]) => onRenderTitle('Microphone', props)}\n />\n <Dropdown\n placeholder={defaultPlaceHolder}\n styles={dropDownStyles(theme)}\n disabled={props.speakers.length === 0}\n options={getDropDownList(props.speakers)}\n defaultSelectedKey={\n props.selectedSpeaker ? props.selectedSpeaker.id : props.speakers ? props.speakers[0]?.id : ''\n }\n onChange={(\n event: React.FormEvent<HTMLDivElement>,\n option?: IDropdownOption | undefined,\n index?: number | undefined\n ) => {\n props.onSelectSpeaker(props.speakers[index ?? 0]);\n }}\n onRenderTitle={(props?: IDropdownOption[]) => onRenderTitle('Speaker', props)}\n />\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const videoCameraIconStyle = mergeStyles({\n marginRight: '0.375rem',\n fontSize: '1.375rem'\n});\n\nexport const buttonStyle = mergeStyles({\n fontWeight: 600,\n fontSize: '0.875rem', // 14px\n height: '2.75rem',\n width: '100%',\n marginTop: '1.125rem',\n maxWidth: '18.75rem',\n minWidth: '12.5rem'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PrimaryButton } from '@fluentui/react';\nimport React from 'react';\nimport { buttonStyle, videoCameraIconStyle } from './styles/StartCallButton.styles';\nimport { Video20Filled } from '@fluentui/react-icons';\nimport { useLocale } from '../localization';\n\nexport interface StartCallButtonProps {\n onClickHandler: () => void;\n isDisabled: boolean;\n}\n\nexport const StartCallButton = (props: StartCallButtonProps): JSX.Element => {\n const { isDisabled, onClickHandler } = props;\n const locale = useLocale();\n\n return (\n <PrimaryButton\n data-ui-id=\"call-composite-start-call-button\"\n disabled={isDisabled}\n className={buttonStyle}\n onClick={onClickHandler}\n >\n <Video20Filled primaryFill=\"currentColor\" className={videoCameraIconStyle} />\n {locale.strings.call.startCallButtonText}\n </PrimaryButton>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const titleContainerStyle = mergeStyles({\n fontSize: '1.25rem',\n lineHeight: '1.75rem',\n fontWeight: 600,\n marginBottom: '1.563rem'\n});\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\nimport * as reselect from 'reselect';\r\nimport { getDeviceManager } from './baseSelectors';\r\n\r\nexport const localPreviewSelector = reselect.createSelector([getDeviceManager], (deviceManager) => {\r\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\r\n // handle cases where 'Preview' view is in progress and not necessary completed.\r\n const view = deviceManager.unparentedViews.length > 0 && deviceManager.unparentedViews[0].view;\r\n return {\r\n videoStreamElement: view ? view.target : null\r\n };\r\n});\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { mergeStyles } from '@fluentui/react';\n\nexport const localPreviewContainerStyle = mergeStyles({\n borderRadius: '.25rem',\n width: '25rem',\n height: '18.75rem'\n});\n\nexport const cameraOffLabelStyle = mergeStyles({\n fontFamily: 'Segoe UI Regular',\n fontSize: '0.625rem' // 10px\n});\n\nexport const localPreviewTileStyle = {\n root: {\n borderRadius: '.25rem'\n }\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Icon, mergeStyles, Stack, Text } from '@fluentui/react';\nimport {\n CameraButton,\n ControlBar,\n MicrophoneButton,\n StreamMedia,\n useTheme,\n VideoTile\n} from '@internal/react-components';\nimport React, { useCallback } from 'react';\nimport { useLocale } from '../localization';\nimport { useAdapter } from './adapter/CallAdapterProvider';\nimport { usePropsFor } from './hooks/usePropsFor';\nimport { useSelector } from './hooks/useSelector';\nimport { getLocalMicrophoneEnabled } from './selectors/baseSelectors';\nimport { devicePermissionSelector } from './selectors/devicePermissionSelector';\nimport { localPreviewSelector } from './selectors/localPreviewSelector';\nimport { cameraOffLabelStyle, localPreviewContainerStyle, localPreviewTileStyle } from './styles/LocalPreview.styles';\n\nexport const LocalPreview = (): JSX.Element => {\n const locale = useLocale();\n const cameraButtonProps = usePropsFor(CameraButton);\n const localPreviewProps = useSelector(localPreviewSelector);\n const { audio: microphonePermissionGranted, video: cameraPermissionGranted } = useSelector(devicePermissionSelector);\n\n const isLocalMicrophoneEnabled = useSelector(getLocalMicrophoneEnabled);\n const adapter = useAdapter();\n\n const onToggleMic = useCallback(async () => {\n isLocalMicrophoneEnabled ? adapter.mute() : adapter.unmute();\n }, [adapter, isLocalMicrophoneEnabled]);\n\n const theme = useTheme();\n const onRenderPlaceholder = useCallback((): JSX.Element => {\n return (\n <Stack className={mergeStyles({ width: '100%', height: '100%' })} verticalAlign=\"center\">\n <Stack.Item align=\"center\">\n <Icon\n iconName=\"LocalPreviewPlaceholder\"\n className={mergeStyles(cameraOffLabelStyle, { color: theme.palette.neutralTertiary })}\n />\n </Stack.Item>\n <Stack.Item align=\"center\">\n <Text className={mergeStyles(cameraOffLabelStyle, { color: theme.palette.neutralSecondary })}>\n {locale.strings.call.cameraTurnedOff}\n </Text>\n </Stack.Item>\n </Stack>\n );\n }, [theme, locale.strings.call.cameraTurnedOff]);\n\n return (\n <Stack data-ui-id=\"call-composite-local-preview\" className={localPreviewContainerStyle}>\n <VideoTile\n styles={localPreviewTileStyle}\n renderElement={\n localPreviewProps?.videoStreamElement ? (\n <StreamMedia videoStreamElement={localPreviewProps.videoStreamElement} />\n ) : undefined\n }\n onRenderPlaceholder={onRenderPlaceholder}\n >\n <ControlBar layout=\"floatingBottom\">\n <CameraButton\n data-ui-id=\"call-composite-local-device-settings-camera-button\"\n {...cameraButtonProps}\n showLabel={true}\n disabled={!cameraPermissionGranted}\n />\n <MicrophoneButton\n data-ui-id=\"call-composite-local-device-settings-microphone-button\"\n checked={isLocalMicrophoneEnabled}\n onToggleMicrophone={onToggleMic}\n disabled={!microphonePermissionGranted}\n showLabel={true}\n />\n </ControlBar>\n </VideoTile>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStackTokens } from '@fluentui/react';\nimport { mergeStyles } from '@fluentui/react';\n\nexport const configurationStackTokens: IStackTokens = {\n childrenGap: '3rem'\n};\n\nexport const configurationContainer = mergeStyles({\n // we need offset for the token's childrenGap here\n height: 'calc(100% - 3rem)'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { useAdaptedSelector } from './hooks/useAdaptedSelector';\n// TODO: Next PR should move move provider & hooks into the selector package\n// and we want to make samples and composite both use from selector package.\nimport { useHandlers } from './hooks/useHandlers';\nimport { LocalDeviceSettings } from './LocalDeviceSettings';\nimport { StartCallButton } from './StartCallButton';\nimport { devicePermissionSelector } from './selectors/devicePermissionSelector';\nimport { useSelector } from './hooks/useSelector';\nimport { OptionsButton } from '@internal/react-components';\nimport { getCallingSelector } from '@internal/calling-component-bindings';\nimport { titleContainerStyle } from './styles/ConfigurationScreen.styles';\nimport { Stack } from '@fluentui/react';\nimport { LocalPreview } from './LocalPreview';\nimport { configurationStackTokens, configurationContainer } from './styles/CallConfiguration.styles';\nimport { useLocale } from '../localization';\n\nexport interface ConfigurationScreenProps {\n startCallHandler(): void;\n}\n\nexport const ConfigurationScreen = (props: ConfigurationScreenProps): JSX.Element => {\n const { startCallHandler } = props;\n\n const options = useAdaptedSelector(getCallingSelector(OptionsButton));\n const localDeviceSettingsHandlers = useHandlers(LocalDeviceSettings);\n const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector(devicePermissionSelector);\n\n const locale = useLocale();\n const title = locale.strings.call.configurationPageTitle;\n\n return (\n <Stack verticalAlign=\"center\" className={configurationContainer}>\n <Stack horizontal wrap horizontalAlign=\"center\" verticalAlign=\"center\" tokens={configurationStackTokens}>\n <LocalPreview />\n <Stack>\n <div className={titleContainerStyle}>{title}</div>\n <LocalDeviceSettings\n {...options}\n {...localDeviceSettingsHandlers}\n cameraPermissionGranted={cameraPermissionGranted}\n microphonePermissionGranted={microphonePermissionGranted}\n />\n <div>\n <StartCallButton onClickHandler={startCallHandler} isDisabled={!microphonePermissionGranted} />\n </div>\n </Stack>\n </Stack>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStackTokens, mergeStyles } from '@fluentui/react';\n\nexport const mainStackTokens: IStackTokens = {\n childrenGap: '0.25rem'\n};\nexport const buttonsStackTokens: IStackTokens = {\n childrenGap: '0.75rem'\n};\nexport const upperStackTokens: IStackTokens = {\n childrenGap: '1.5rem'\n};\nexport const bottomStackTokens: IStackTokens = {\n childrenGap: '1.4375rem'\n};\nexport const endCallContainerStyle = mergeStyles({\n width: '20.625rem',\n position: 'absolute',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n margin: 'auto'\n});\nexport const endCallTitleStyle = mergeStyles({\n fontSize: '1.375rem',\n fontWeight: 600\n});\nexport const buttonStyle = mergeStyles({\n fontWeight: 600,\n height: '2.5rem',\n width: '9.875rem',\n fontSize: '0.875rem', // 14px\n padding: 0\n});\nexport const videoCameraIconStyle = mergeStyles({\n marginRight: '0.375rem',\n fontSize: '1.375rem'\n});\nexport const bottomStackFooterStyle = mergeStyles({\n fontSize: '0.875 rem'\n});\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { PrimaryButton, Stack } from '@fluentui/react';\nimport { Video20Filled } from '@fluentui/react-icons';\nimport {\n endCallContainerStyle,\n endCallTitleStyle,\n buttonStyle,\n mainStackTokens,\n buttonsStackTokens,\n upperStackTokens,\n videoCameraIconStyle,\n bottomStackFooterStyle\n} from './styles/Error.styles';\n\nexport interface ErrorProps {\n rejoinHandler(): void;\n title?: string;\n reason?: string;\n}\n\nexport function Error(props: ErrorProps): JSX.Element {\n const title = props.title ?? 'Error joining the Call';\n const rejoinCall = 'Retry Call';\n\n return (\n <Stack verticalAlign=\"center\" tokens={mainStackTokens} className={endCallContainerStyle}>\n <Stack tokens={upperStackTokens}>\n <div className={endCallTitleStyle}>{title}</div>\n <Stack horizontal tokens={buttonsStackTokens}>\n <PrimaryButton className={buttonStyle} onClick={props.rejoinHandler}>\n <Video20Filled primaryFill=\"currentColor\" className={videoCameraIconStyle} />\n {rejoinCall}\n </PrimaryButton>\n </Stack>\n <div className={bottomStackFooterStyle}>\n {props.reason ? (\n props.reason\n ) : (\n <>\n Common reasons for this error:\n <ul>\n <li>Incorrect Teams Meeting URL</li>\n <li>Incorrect Group Call ID</li>\n </ul>\n </>\n )}\n </div>\n </Stack>\n </Stack>\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OnRenderAvatarCallback } from '@internal/react-components';\nimport React, { useEffect } from 'react';\nimport { AvatarPersonaDataCallback } from '../common/AvatarPersona';\nimport { BaseComposite, BaseCompositeProps } from '../common/Composite';\nimport { CallCompositeIcons } from '../common/icons';\nimport { useLocale } from '../localization';\nimport { CallAdapter, CallCompositePage } from './adapter/CallAdapter';\nimport { CallAdapterProvider, useAdapter } from './adapter/CallAdapterProvider';\nimport { CallScreen } from './CallScreen';\nimport { ConfigurationScreen } from './ConfigurationScreen';\nimport { Error } from './Error';\nimport { useSelector } from './hooks/useSelector';\nimport { getPage } from './selectors/baseSelectors';\n\nexport interface CallCompositeProps extends BaseCompositeProps<CallCompositeIcons> {\n /**\n * An adapter provides logic and data to the composite.\n * Composite can also be controlled using the adapter.\n */\n adapter: CallAdapter;\n callInvitationURL?: string;\n\n /**\n * A callback function that can be used to provide custom data to an Avatar.\n */\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n\n /**\n * Flags to enable/disable visual elements of the {@link CallComposite}.\n */\n visualElements?: CallCompositeVisualElements;\n}\n\n/**\n * Optional features of the {@linnk CallComposite}\n */\nexport type CallCompositeVisualElements = {\n /**\n * Surface Azure Communication Services backend errors in the UI with {@link @azure/communication-react#ErrorBar}.\n *\n * @defaultValue false\n */\n showErrorBar?: boolean;\n};\n\ntype MainScreenProps = {\n onRenderAvatar?: OnRenderAvatarCallback;\n callInvitationURL?: string;\n onFetchAvatarPersonaData?: AvatarPersonaDataCallback;\n visualElements: {\n showCallControls: boolean;\n showErrorBar: boolean;\n };\n};\n\nconst MainScreen = (props: MainScreenProps): JSX.Element => {\n const { callInvitationURL, onRenderAvatar, onFetchAvatarPersonaData } = props;\n const page = useSelector(getPage);\n const adapter = useAdapter();\n const locale = useLocale();\n switch (page) {\n case 'configuration':\n return <ConfigurationScreen startCallHandler={(): void => adapter.setPage('call')} />;\n case 'error':\n return <Error rejoinHandler={() => adapter.setPage('configuration')} />;\n case 'errorJoiningTeamsMeeting':\n return (\n <Error\n rejoinHandler={() => adapter.setPage('configuration')}\n title={locale.strings.call.teamsMeetingFailToJoin}\n reason={locale.strings.call.teamsMeetingFailReasonAccessDenied}\n />\n );\n case 'removed':\n return (\n <Error\n rejoinHandler={() => adapter.setPage('configuration')}\n title={locale.strings.call.teamsMeetingFailToJoin}\n reason={locale.strings.call.teamsMeetingFailReasonParticipantRemoved}\n />\n );\n default:\n return (\n <CallScreen\n endCallHandler={async (): Promise<void> => {\n adapter.setPage('configuration');\n }}\n callErrorHandler={(customPage?: CallCompositePage) => {\n customPage ? adapter.setPage(customPage) : adapter.setPage('error');\n }}\n onRenderAvatar={onRenderAvatar}\n callInvitationURL={callInvitationURL}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n visualElements={props.visualElements}\n />\n );\n }\n};\n\nexport const Call = (props: CallCompositeProps): JSX.Element => {\n return (\n <BaseComposite {...props}>\n <CallCompositeInternal {...props} showCallControls={true} />\n </BaseComposite>\n );\n};\n\n/**\n * Props for the internal-only call composite export that has extra customizability points that\n * we are not ready to export publicly.\n * @internal\n */\ninterface CallInternalProps extends CallCompositeProps {\n showCallControls: boolean;\n}\n\n/**\n * An internal-only call composite export.\n * This is used by the meeting composite and has extra customizability points that we are not ready\n * to export publicly.\n * @internal\n */\nexport const CallCompositeInternal = (props: CallInternalProps): JSX.Element => {\n const { adapter, callInvitationURL, onFetchAvatarPersonaData } = props;\n\n useEffect(() => {\n (async () => {\n await adapter.askDevicePermission({ video: true, audio: true });\n adapter.queryCameras();\n adapter.queryMicrophones();\n adapter.querySpeakers();\n })();\n }, [adapter]);\n\n return (\n <CallAdapterProvider adapter={adapter}>\n <MainScreen\n callInvitationURL={callInvitationURL}\n onFetchAvatarPersonaData={onFetchAvatarPersonaData}\n visualElements={{\n showCallControls: props.showCallControls,\n showErrorBar: props.visualElements?.showErrorBar ?? false\n }}\n />\n </CallAdapterProvider>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling';\nimport EventEmitter from 'events';\n\nexport class ParticipantSubscriber {\n private participant: RemoteParticipant;\n private emitter: EventEmitter;\n\n constructor(participant: RemoteParticipant, emitter: EventEmitter) {\n this.participant = participant;\n this.emitter = emitter;\n this.subscribeParticipantEvents();\n }\n\n private isMutedChangedHandler = (): void => {\n this.emitter.emit('isMutedChanged', {\n participantId: this.participant.identifier,\n isMuted: this.participant.isMuted\n });\n };\n\n private displayNameChangedHandler = (): void => {\n this.emitter.emit('displayNameChanged', {\n participantId: this.participant.identifier,\n displayName: this.participant.displayName\n });\n };\n\n private isSpeakingChangedHandler = (): void => {\n this.emitter.emit('isSpeakingChanged', {\n participantId: this.participant.identifier,\n isSpeaking: this.participant.isSpeaking\n });\n };\n\n private videoStreamsUpdatedHandler = (event: { added: RemoteVideoStream[]; removed: RemoteVideoStream[] }): void => {\n this.emitter.emit('videoStreamsUpdated', event);\n };\n\n private subscribeParticipantEvents(): void {\n this.participant.on('isMutedChanged', this.isMutedChangedHandler);\n this.participant.on('displayNameChanged', this.displayNameChangedHandler);\n this.participant.on('isSpeakingChanged', this.isSpeakingChangedHandler);\n this.participant.on('videoStreamsUpdated', this.videoStreamsUpdatedHandler);\n }\n\n public unsubscribeAll(): void {\n this.participant.off('isMutedChanged', this.isMutedChangedHandler);\n this.participant.off('displayNameChanged', this.displayNameChangedHandler);\n this.participant.off('isSpeakingChanged', this.isSpeakingChangedHandler);\n this.participant.off('videoStreamsUpdated', this.videoStreamsUpdatedHandler);\n }\n}\n\nexport type ParticipantEvent = 'isMutedChanged' | 'displayNameChanged' | 'isSpeakingChanged' | 'videoStreamsUpdated';\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallingHandlers, createDefaultCallingHandlers } from '@internal/calling-component-bindings';\nimport {\n CallClientState,\n StatefulDeviceManager,\n StatefulCallClient,\n createStatefulCallClient,\n DeviceManagerState,\n CallError\n} from '@internal/calling-stateful-client';\nimport {\n AudioOptions,\n CallAgent,\n Call,\n GroupCallLocator,\n TeamsMeetingLinkLocator,\n LocalVideoStream as SDKLocalVideoStream,\n AudioDeviceInfo,\n VideoDeviceInfo,\n RemoteParticipant,\n PermissionConstraints\n} from '@azure/communication-calling';\nimport { EventEmitter } from 'events';\nimport {\n CallAdapter,\n CallCompositePage,\n CallEndedListener,\n CallEvent,\n CallIdChangedListener,\n CallAdapterState,\n DisplayNameChangedListener,\n IsMuteChangedListener,\n IsScreenSharingOnChangedListener,\n IsSpeakingChangedListener,\n ParticipantJoinedListener,\n ParticipantLeftListener\n} from './CallAdapter';\nimport { isInCall } from '../../../utils';\nimport { VideoStreamOptions } from '@internal/react-components';\nimport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport {\n CommunicationTokenCredential,\n CommunicationUserIdentifier,\n CommunicationUserKind\n} from '@azure/communication-common';\nimport { ParticipantSubscriber } from './ParticipantSubcriber';\nimport { AdapterError } from '../../common/adapters';\n\n// Context of Chat, which is a centralized context for all state updates\nclass CallContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: CallAdapterState;\n private callId: string | undefined;\n\n constructor(clientState: CallClientState) {\n this.state = {\n isLocalPreviewMicrophoneEnabled: false,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n devices: clientState.deviceManager,\n call: undefined,\n page: 'configuration',\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: CallAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: CallAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): CallAdapterState {\n return this.state;\n }\n\n public setPage(page: CallCompositePage): void {\n this.setState({ ...this.state, page });\n }\n\n public setIsLocalMicrophoneEnabled(isLocalPreviewMicrophoneEnabled: boolean): void {\n this.setState({ ...this.state, isLocalPreviewMicrophoneEnabled });\n }\n\n public setCallId(callId: string | undefined): void {\n this.callId = callId;\n }\n\n public updateClientState(clientState: CallClientState): void {\n const call = this.callId ? clientState.calls[this.callId] : undefined;\n const endedCall =\n clientState.callsEnded.length > 0 ? clientState.callsEnded[clientState.callsEnded.length - 1] : undefined;\n this.setState({\n ...this.state,\n userId: clientState.userId,\n displayName: clientState.callAgent?.displayName,\n call,\n endedCall: endedCall,\n devices: clientState.deviceManager,\n isLocalPreviewMicrophoneEnabled:\n call?.isMuted === undefined ? this.state.isLocalPreviewMicrophoneEnabled : !call?.isMuted,\n latestErrors: clientState.latestErrors\n });\n }\n}\n\nexport class AzureCommunicationCallAdapter implements CallAdapter {\n private callClient: StatefulCallClient;\n private callAgent: CallAgent;\n private deviceManager: StatefulDeviceManager;\n private localStream: SDKLocalVideoStream | undefined;\n private locator: TeamsMeetingLinkLocator | GroupCallLocator;\n private call: Call | undefined;\n private context: CallContext;\n private handlers: CallingHandlers;\n private participantSubscribers = new Map<string, ParticipantSubscriber>();\n private emitter: EventEmitter = new EventEmitter();\n private onClientStateChange: (clientState: CallClientState) => void;\n\n constructor(\n callClient: StatefulCallClient,\n locator: TeamsMeetingLinkLocator | GroupCallLocator,\n callAgent: CallAgent,\n deviceManager: StatefulDeviceManager\n ) {\n this.bindPublicMethods();\n this.callClient = callClient;\n this.callAgent = callAgent;\n this.locator = locator;\n this.deviceManager = deviceManager;\n this.context = new CallContext(callClient.getState());\n const onStateChange = (clientState: CallClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n callClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultCallingHandlers(callClient, callAgent, deviceManager, undefined);\n\n this.onClientStateChange = onStateChange;\n\n this.callClient.onStateChange(onStateChange);\n }\n\n private bindPublicMethods(): void {\n this.onStateChange.bind(this);\n this.offStateChange.bind(this);\n this.getState.bind(this);\n this.dispose.bind(this);\n this.joinCall.bind(this);\n this.leaveCall.bind(this);\n this.setCamera.bind(this);\n this.setMicrophone.bind(this);\n this.setSpeaker.bind(this);\n this.askDevicePermission.bind(this);\n this.queryCameras.bind(this);\n this.queryMicrophones.bind(this);\n this.querySpeakers.bind(this);\n this.startCamera.bind(this);\n this.stopCamera.bind(this);\n this.onToggleCamera.bind(this);\n this.mute.bind(this);\n this.unmute.bind(this);\n this.startCall.bind(this);\n this.startScreenShare.bind(this);\n this.stopScreenShare.bind(this);\n this.removeParticipant.bind(this);\n this.setPage.bind(this);\n this.createStreamView.bind(this);\n this.disposeStreamView.bind(this);\n this.on.bind(this);\n this.off.bind(this);\n }\n\n public dispose(): void {\n this.callClient.offStateChange(this.onClientStateChange);\n this.callAgent.dispose();\n }\n\n public isTeamsCall(): boolean {\n return 'meetingLink' in this.locator;\n }\n\n public async queryCameras(): Promise<VideoDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getCameras();\n });\n }\n\n public async queryMicrophones(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.getMicrophones();\n });\n }\n\n public async querySpeakers(): Promise<AudioDeviceInfo[]> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return this.deviceManager.isSpeakerSelectionAvailable ? this.deviceManager.getSpeakers() : [];\n });\n }\n\n public async askDevicePermission(constrain: PermissionConstraints): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.deviceManager.askDevicePermission(constrain);\n });\n }\n\n public joinCall(microphoneOn?: boolean): Call | undefined {\n if (isInCall(this.getState().call?.state ?? 'None')) {\n throw new Error('You are already in the call!');\n } else {\n const audioOptions: AudioOptions = { muted: microphoneOn ?? !this.getState().isLocalPreviewMicrophoneEnabled };\n // TODO: find a way to expose stream to here\n const videoOptions = { localVideoStreams: this.localStream ? [this.localStream] : undefined };\n\n const isTeamsMeeting = 'groupId' in this.locator;\n\n if (isTeamsMeeting) {\n this.call = this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n });\n } else {\n this.call = this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {\n audioOptions,\n videoOptions\n });\n }\n\n this.context.setCallId(this.call.id);\n // Resync state after callId is set\n this.context.updateClientState(this.callClient.getState());\n this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);\n this.subscribeCallEvents();\n return this.call;\n }\n }\n\n public async createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void> {\n if (remoteUserId === undefined) {\n await this.handlers.onCreateLocalStreamView(options);\n } else {\n await this.handlers.onCreateRemoteStreamView(remoteUserId, options);\n }\n }\n\n public async disposeStreamView(remoteUserId?: string): Promise<void> {\n if (remoteUserId === undefined) {\n await this.handlers.onDisposeLocalStreamView();\n } else {\n await this.handlers.onDisposeRemoteStreamView(remoteUserId);\n }\n }\n\n public async leaveCall(): Promise<void> {\n const callId = this.call?.id;\n await this.handlers.onHangUp();\n this.unsubscribeCallEvents();\n this.call = undefined;\n this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);\n this.context.setCallId(undefined);\n // Resync state after callId is set\n this.context.updateClientState(this.callClient.getState());\n this.stopCamera();\n this.mute();\n this.emitter.emit('callEnded', { callId });\n }\n\n public async setCamera(device: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectCamera(device, options);\n });\n }\n\n public async setMicrophone(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectMicrophone(device);\n });\n }\n\n public async setSpeaker(device: AudioDeviceInfo): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onSelectSpeaker(device);\n });\n }\n\n public async onToggleCamera(options?: VideoStreamOptions): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onToggleCamera(options);\n });\n }\n\n //TODO: seperate onToggleCamera logic in Handler\n public async startCamera(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.isCameraOn()) await this.handlers.onToggleCamera();\n });\n }\n\n public async stopCamera(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (this.isCameraOn()) await this.handlers.onToggleCamera();\n });\n }\n\n private isCameraOn(): boolean {\n if (this.call) {\n const stream = this.call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\n return !!stream;\n } else {\n if (this.callClient.getState().deviceManager.selectedCamera) {\n const previewOn = isPreviewOn(this.callClient.getState().deviceManager);\n return previewOn;\n }\n }\n return false;\n }\n\n public async mute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.call) {\n this.context.setIsLocalMicrophoneEnabled(false);\n }\n await this.call?.mute();\n });\n }\n\n public async unmute(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.call) {\n this.context.setIsLocalMicrophoneEnabled(true);\n }\n await this.call?.unmute();\n });\n }\n\n public async startScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (!this.call?.isScreenSharingOn) await this.handlers.onToggleScreenShare();\n });\n }\n\n public async stopScreenShare(): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n if (this.call?.isScreenSharingOn) await this.handlers.onToggleScreenShare();\n });\n }\n\n //TODO: a better way to expose option parameter\n public startCall(participants: string[]): Call | undefined {\n const idsToAdd = participants.map((participant) => {\n // FIXME: `onStartCall` does not allow a Teams user.\n // Need some way to return an error if a Teams user is provided.\n const backendId = fromFlatCommunicationIdentifier(participant) as CommunicationUserIdentifier;\n return backendId;\n });\n\n return this.handlers.onStartCall(idsToAdd);\n }\n\n public async removeParticipant(userId: string): Promise<void> {\n this.handlers.onParticipantRemove(userId);\n }\n\n public getState(): CallAdapterState {\n return this.context.getState();\n }\n\n public onStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n public offStateChange(handler: (state: CallAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n on(event: 'participantsJoined', listener: ParticipantJoinedListener): void;\n on(event: 'participantsLeft', listener: ParticipantLeftListener): void;\n on(event: 'isMutedChanged', listener: IsMuteChangedListener): void;\n on(event: 'callIdChanged', listener: CallIdChangedListener): void;\n on(event: 'isLocalScreenSharingActiveChanged', listener: IsScreenSharingOnChangedListener): void;\n on(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n on(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n on(event: 'callEnded', listener: CallEndedListener): void;\n on(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public on(event: CallEvent, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n private subscribeCallEvents(): void {\n this.call?.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.on('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.on('idChanged', this.callIdChanged.bind(this));\n }\n\n private unsubscribeCallEvents(): void {\n for (const subscriber of this.participantSubscribers.values()) {\n subscriber.unsubscribeAll();\n }\n this.participantSubscribers.clear();\n this.call?.off('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));\n this.call?.off('isMutedChanged', this.isMyMutedChanged.bind(this));\n this.call?.off('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));\n this.call?.off('idChanged', this.callIdChanged.bind(this));\n }\n\n private isMyMutedChanged = (): void => {\n this.emitter.emit('isMutedChanged', {\n participantId: this.getState().userId,\n isMuted: this.call?.isMuted\n });\n };\n\n public setPage(page: CallCompositePage): void {\n this.context.setPage(page);\n }\n\n private onRemoteParticipantsUpdated({\n added,\n removed\n }: {\n added: RemoteParticipant[];\n removed: RemoteParticipant[];\n }): void {\n if (added && added.length > 0) {\n this.emitter.emit('participantsJoined', added);\n }\n if (removed && removed.length > 0) {\n this.emitter.emit('participantsLeft', removed);\n }\n\n added.forEach((participant) => {\n this.participantSubscribers.set(\n toFlatCommunicationIdentifier(participant.identifier),\n new ParticipantSubscriber(participant, this.emitter)\n );\n });\n\n removed.forEach((participant) => {\n const subscriber = this.participantSubscribers.get(toFlatCommunicationIdentifier(participant.identifier));\n subscriber && subscriber.unsubscribeAll();\n this.participantSubscribers.delete(toFlatCommunicationIdentifier(participant.identifier));\n });\n }\n\n private isScreenSharingOnChanged(): void {\n this.emitter.emit('isLocalScreenSharingActiveChanged', { isScreenSharingOn: this.call?.isScreenSharingOn });\n }\n\n private callIdChanged(): void {\n this.context.setCallId(this.call?.id);\n // Resync state after callId is set\n this.context.updateClientState(this.callClient.getState());\n this.emitter.emit('callIdChanged', { callId: this.callIdChanged.bind(this) });\n }\n\n off(event: 'participantsJoined', listener: ParticipantJoinedListener): void;\n off(event: 'participantsLeft', listener: ParticipantLeftListener): void;\n off(event: 'isMutedChanged', listener: IsMuteChangedListener): void;\n off(event: 'callIdChanged', listener: CallIdChangedListener): void;\n off(event: 'isLocalScreenSharingActiveChanged', listener: IsScreenSharingOnChangedListener): void;\n off(event: 'displayNameChanged', listener: DisplayNameChangedListener): void;\n off(event: 'isSpeakingChanged', listener: IsSpeakingChangedListener): void;\n off(event: 'callEnded', listener: CallEndedListener): void;\n off(event: 'error', errorHandler: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public off(event: CallEvent, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isCallError(error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst isPreviewOn = (deviceManager: DeviceManagerState): boolean => {\n // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also\n // handle cases where 'Preview' view is in progress and not necessary completed.\n return deviceManager.unparentedViews.length > 0 && deviceManager.unparentedViews[0].view !== undefined;\n};\n\nexport type AzureCommunicationCallAdapterArgs = {\n userId: CommunicationUserKind;\n displayName: string;\n credential: CommunicationTokenCredential;\n locator: TeamsMeetingLinkLocator | GroupCallLocator;\n};\n\nexport const createAzureCommunicationCallAdapter = async ({\n userId,\n displayName,\n credential,\n locator\n}: AzureCommunicationCallAdapterArgs): Promise<CallAdapter> => {\n const callClient = createStatefulCallClient({ userId });\n const deviceManager = (await callClient.getDeviceManager()) as StatefulDeviceManager;\n const callAgent = await callClient.createCallAgent(credential, { displayName });\n const adapter = new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);\n return adapter;\n};\n\nconst isCallError = (e: Error): e is CallError => {\n return e['target'] !== undefined && e['inner'] !== undefined;\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IContextualMenuItemStyles, IStackStyles, IStackItemStyles, IStackTokens, getTheme } from '@fluentui/react';\n\nconst theme = getTheme();\nconst palette = theme.palette;\n\nexport const sidePaneContainerStyles: IStackItemStyles = {\n root: {\n height: '100%',\n paddingTop: '0.5rem',\n paddingBottom: '0.5rem',\n width: '21.5rem'\n }\n};\n\nexport const sidePaneContainerHiddenStyles: IStackItemStyles = {\n root: {\n ...sidePaneContainerStyles,\n display: 'none'\n }\n};\n\nexport const sidePaneContainerTokens: IStackTokens = {\n childrenGap: '0.5rem'\n};\n\nexport const sidePaneHeaderStyles: IStackItemStyles = {\n root: {\n fontSize: '0.825rem',\n lineHeight: '1.25rem',\n padding: '0.25rem',\n fontWeight: '600'\n }\n};\n\nexport const sidePaneCloseButtonStyles: Partial<IContextualMenuItemStyles> = {\n icon: { color: palette.neutralSecondary },\n iconHovered: { color: palette.neutralSecondary },\n iconPressed: { color: palette.neutralSecondary }\n};\n\nexport const paneBodyContainer: IStackStyles = { root: { flexDirection: 'column', display: 'flex' } };\nexport const scrollableContainer: IStackStyles = { root: { flexBasis: '0', flexGrow: '1', overflowY: 'auto' } };\nexport const scrollableContainerContents: IStackItemStyles = { root: { flexGrow: '1', flexBasis: '0' } };\n\nexport const peopleSubheadingStyle: IStackItemStyles = {\n root: {\n fontSize: '0.75rem',\n color: palette.neutralSecondary\n }\n};\n\nexport const peoplePaneContainerTokens: IStackTokens = {\n childrenGap: '0.5rem'\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport React, { useMemo } from 'react';\nimport { ChatComposite, ChatAdapter } from '../ChatComposite';\nimport { CommandBarButton, DefaultButton, PartialTheme, Theme, Stack } from '@fluentui/react';\nimport {\n sidePaneCloseButtonStyles,\n sidePaneContainerHiddenStyles,\n sidePaneContainerStyles,\n sidePaneContainerTokens,\n sidePaneHeaderStyles,\n peoplePaneContainerTokens,\n peopleSubheadingStyle,\n paneBodyContainer,\n scrollableContainer,\n scrollableContainerContents\n} from './styles/SidePane.styles';\nimport { ParticipantList } from '@internal/react-components';\nimport copy from 'copy-to-clipboard';\nimport { usePropsFor } from '../CallComposite/hooks/usePropsFor';\nimport { CallAdapter } from '../CallComposite';\n\nconst SidePane = (props: {\n headingText: string;\n children: React.ReactNode;\n onClose: () => void;\n hidden: boolean;\n}): JSX.Element => {\n // We hide the side pane instead of not rendering the entire pane to persist certain elements\n // between renders. An example of this is composing a chat message - a chat message that has been\n // typed but not sent should not be lost if the side panel is closed and then reopened.\n const sidePaneStyles = props.hidden ? sidePaneContainerHiddenStyles : sidePaneContainerStyles;\n return (\n <Stack.Item disableShrink verticalFill styles={sidePaneStyles} tokens={sidePaneContainerTokens}>\n <Stack verticalFill>\n <Stack horizontal horizontalAlign=\"space-between\" styles={sidePaneHeaderStyles}>\n <Stack.Item>{props.headingText}</Stack.Item>\n <CommandBarButton\n styles={sidePaneCloseButtonStyles}\n iconProps={{ iconName: 'cancel' }}\n onClick={props.onClose}\n />\n </Stack>\n <Stack.Item verticalFill grow styles={paneBodyContainer}>\n <Stack horizontal styles={scrollableContainer}>\n <Stack.Item verticalFill styles={scrollableContainerContents}>\n {props.children}\n </Stack.Item>\n </Stack>\n </Stack.Item>\n </Stack>\n </Stack.Item>\n );\n};\n\n/**\n * In a Meeting when a participant is removed, we must remove them from both\n * the call and the chat thread.\n */\nconst removeParticipantFromMeeting = async (\n callAdapter: CallAdapter,\n chatAdapter: ChatAdapter,\n participantId: string\n): Promise<void> => {\n await callAdapter.removeParticipant(participantId);\n await chatAdapter.removeParticipant(participantId);\n};\n\nexport const EmbeddedPeoplePane = (props: {\n inviteLink?: string;\n onClose: () => void;\n hidden: boolean;\n callAdapter: CallAdapter;\n chatAdapter: ChatAdapter;\n}): JSX.Element => {\n const { callAdapter, chatAdapter, inviteLink } = props;\n const participantListDefaultProps = usePropsFor(ParticipantList);\n\n const participantListProps = useMemo(() => {\n const onParticipantRemove = async (participantId: string): Promise<void> =>\n removeParticipantFromMeeting(callAdapter, chatAdapter, participantId);\n return {\n ...participantListDefaultProps,\n onParticipantRemove\n };\n }, [participantListDefaultProps, callAdapter, chatAdapter]);\n\n return (\n <SidePane hidden={props.hidden} headingText={'People'} onClose={props.onClose}>\n <Stack tokens={peoplePaneContainerTokens}>\n {inviteLink && (\n <DefaultButton text=\"Copy invite link\" iconProps={{ iconName: 'Link' }} onClick={() => copy(inviteLink)} />\n )}\n <Stack.Item styles={peopleSubheadingStyle}>In this call</Stack.Item>\n <ParticipantList {...participantListProps} />\n </Stack>\n </SidePane>\n );\n};\n\nexport const EmbeddedChatPane = (props: {\n chatAdapter: ChatAdapter;\n fluentTheme?: PartialTheme | Theme;\n hidden: boolean;\n onClose: () => void;\n}): JSX.Element => {\n return (\n <SidePane hidden={props.hidden} headingText={'Chat'} onClose={props.onClose}>\n <ChatComposite adapter={props.chatAdapter} fluentTheme={props.fluentTheme} />\n </SidePane>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { ControlBarButton, ControlBarButtonProps } from '@internal/react-components';\nimport { Chat20Filled, Chat20Regular } from '@fluentui/react-icons';\n\nconst onRenderOnIcon = (): JSX.Element => <Chat20Filled key={'chatOnIconKey'} primaryFill=\"currentColor\" />;\nconst onRenderOffIcon = (): JSX.Element => <Chat20Regular key={'chatOffIconKey'} primaryFill=\"currentColor\" />;\n\nexport const ChatButton = (props: ControlBarButtonProps): JSX.Element => {\n const strings = { label: 'Chat', ...props.strings };\n\n return (\n <ControlBarButton\n {...props}\n labelKey={'chatButtonLabelKey'}\n strings={strings}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderOffIcon}\n onClick={props.onClick}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { ControlBarButton, ControlBarButtonProps } from '@internal/react-components';\nimport { People20Filled, People20Regular } from '@fluentui/react-icons';\n\nconst onRenderOnIcon = (): JSX.Element => <People20Filled key={'peopleOnIconKey'} primaryFill=\"currentColor\" />;\nconst onRenderOffIcon = (): JSX.Element => <People20Regular key={'peopleOffIconKey'} primaryFill=\"currentColor\" />;\n\nexport const PeopleButton = (props: ControlBarButtonProps): JSX.Element => {\n const strings = { label: 'People', ...props.strings };\n\n return (\n <ControlBarButton\n {...props}\n strings={strings}\n labelKey={'peopleButtonLabelKey'}\n onRenderOnIcon={props.onRenderOnIcon ?? onRenderOnIcon}\n onRenderOffIcon={props.onRenderOffIcon ?? onRenderOffIcon}\n onClick={props.onClick}\n />\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React from 'react';\nimport { CallControls } from '../CallComposite/CallControls';\nimport { CallAdapterProvider } from '../CallComposite/adapter/CallAdapterProvider';\nimport { CallAdapter } from '../CallComposite';\nimport { ChatButton } from './ChatButton';\nimport { PeopleButton } from './PeopleButton';\nimport { Stack } from '@fluentui/react';\n\nexport interface MeetingCallControlBarProps {\n callAdapter: CallAdapter;\n onEndCallClick: () => void;\n chatButtonChecked: boolean;\n peopleButtonChecked: boolean;\n onChatButtonClicked: () => void;\n onPeopleButtonClicked: () => void;\n}\n\nexport const MeetingCallControlBar = (props: MeetingCallControlBarProps): JSX.Element => {\n return (\n <Stack horizontal>\n <Stack.Item grow>\n <CallAdapterProvider adapter={props.callAdapter}>\n <CallControls onEndCallClick={props.onEndCallClick} showParticipantsControl={false} />\n </CallAdapterProvider>\n </Stack.Item>\n <Stack.Item>\n <ChatButton checked={props.chatButtonChecked} showLabel={true} onClick={props.onChatButtonClicked} />\n <PeopleButton checked={props.peopleButtonChecked} showLabel={true} onClick={props.onPeopleButtonClicked} />\n </Stack.Item>\n </Stack>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStackStyles } from '@fluentui/react';\n\nexport const compositeOuterContainerStyles: IStackStyles = { root: { width: '100%' } };\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport React, { useCallback, useState } from 'react';\nimport { PartialTheme, Stack, Theme } from '@fluentui/react';\nimport { CallCompositeInternal } from '../CallComposite/Call';\nimport { CallAdapterProvider } from '../CallComposite/adapter/CallAdapterProvider';\nimport { CallAdapter, CallCompositePage } from '../CallComposite';\nimport { ChatAdapter } from '../ChatComposite';\nimport { EmbeddedChatPane, EmbeddedPeoplePane } from './SidePane';\nimport { MeetingCallControlBar } from './MeetingCallControlBar';\nimport { CallState } from '@azure/communication-calling';\nimport { compositeOuterContainerStyles } from './styles/MeetingCompositeStyles';\nimport { FluentThemeProvider } from '@internal/react-components';\n\n/**\n * Props required for the {@link MeetingComposite}\n * @alpha\n */\nexport type MeetingCompositeProps = {\n callAdapter: CallAdapter;\n chatAdapter: ChatAdapter;\n /**\n * Fluent theme for the composite.\n *\n * Defaults to a light theme if undefined.\n */\n fluentTheme?: PartialTheme | Theme;\n meetingInvitationURL?: string;\n};\n\n/**\n * Meeting Composite brings together key components to provide a full meeting experience out of the box.\n * @alpha\n */\nexport const MeetingComposite = (props: MeetingCompositeProps): JSX.Element => {\n const { callAdapter, chatAdapter, fluentTheme } = props;\n\n const [currentCallState, setCurrentCallState] = useState<CallState>();\n const [currentPage, setCurrentPage] = useState<CallCompositePage>();\n callAdapter.onStateChange((newState) => {\n setCurrentPage(newState.page);\n setCurrentCallState(newState.call?.state);\n });\n const hasJoinedCall = currentPage === 'call' && currentCallState === 'Connected';\n\n const [showChat, setShowChat] = useState(false);\n const [showPeople, setShowPeople] = useState(false);\n\n const closePane = useCallback(() => {\n setShowChat(false);\n setShowPeople(false);\n }, []);\n\n const toggleChat = useCallback(() => {\n setShowPeople(false);\n setShowChat(!showChat);\n }, [showChat]);\n\n const togglePeople = useCallback(() => {\n setShowChat(false);\n setShowPeople(!showPeople);\n }, [showPeople]);\n\n const endCallClick = (): void => {\n callAdapter.setPage('configuration');\n };\n\n return (\n <FluentThemeProvider fluentTheme={props.fluentTheme}>\n <Stack verticalFill grow styles={compositeOuterContainerStyles}>\n <Stack horizontal grow>\n <Stack.Item grow>\n <CallCompositeInternal showCallControls={false} adapter={callAdapter} fluentTheme={fluentTheme} />\n </Stack.Item>\n {chatAdapter && hasJoinedCall && (\n <EmbeddedChatPane\n hidden={!showChat}\n chatAdapter={chatAdapter}\n fluentTheme={props.fluentTheme}\n onClose={closePane}\n />\n )}\n {callAdapter && chatAdapter && hasJoinedCall && (\n <CallAdapterProvider adapter={callAdapter}>\n <EmbeddedPeoplePane\n hidden={!showPeople}\n inviteLink={props.meetingInvitationURL}\n onClose={closePane}\n chatAdapter={chatAdapter}\n callAdapter={callAdapter}\n />\n </CallAdapterProvider>\n )}\n </Stack>\n {hasJoinedCall && (\n <MeetingCallControlBar\n callAdapter={callAdapter}\n chatButtonChecked={showChat}\n onChatButtonClicked={toggleChat}\n peopleButtonChecked={showPeople}\n onPeopleButtonClicked={togglePeople}\n onEndCallClick={endCallClick}\n />\n )}\n </Stack>\n </FluentThemeProvider>\n );\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport {\n CallingHandlers,\n getCallingSelector,\n GetCallingSelector,\n useCallingHandlers,\n useCallingSelector\n} from '@internal/calling-component-bindings';\nimport {\n ChatHandlers,\n getChatSelector,\n GetChatSelector,\n useChatHandlers,\n useChatSelector\n} from '@internal/chat-component-bindings';\nimport { ChatClientState } from '@internal/chat-stateful-client';\nimport { CallClientState } from '@internal/calling-stateful-client';\nimport { Common } from '@internal/acs-ui-common';\n\nexport type ClientState = CallClientState & ChatClientState;\nexport type Selector = (state: ClientState, props: any) => any;\n\n// Because of react hooks rules, hooks can't be conditionally called\n// We call both call and chat hooks and detect current context\n// Return undefined and skip execution when not in that context\nexport const useSelector = <ParamT extends Selector | undefined>(\n selector: ParamT,\n selectorProps?: ParamT extends Selector ? Parameters<ParamT>[1] : undefined,\n type?: 'calling' | 'chat'\n): ParamT extends Selector ? ReturnType<ParamT> : undefined => {\n const callingMode = !type || type === 'calling';\n const chatMode = !type || type === 'chat';\n const callProps = useCallingSelector(callingMode ? (selector as any) : undefined, selectorProps);\n const chatProps = useChatSelector(chatMode ? (selector as any) : undefined, selectorProps);\n return callProps ?? chatProps;\n};\n\nexport type ChatReturnProps<Component extends (props: any) => JSX.Element> = GetChatSelector<Component> extends (\n state: ChatClientState,\n props: any\n) => any\n ? ReturnType<GetChatSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]>\n : never;\n\nexport type CallingReturnProps<Component extends (props: any) => JSX.Element> = GetCallingSelector<Component> extends (\n state: CallClientState,\n props: any\n) => any\n ? ReturnType<GetCallingSelector<Component>> & Common<CallingHandlers, Parameters<Component>[0]>\n : never;\n\nexport const usePropsFor = <Component extends (props: any) => JSX.Element>(\n component: Component,\n type?: 'calling' | 'chat'\n): ChatReturnProps<Component> extends never\n ? CallingReturnProps<Component> extends never\n ? undefined\n : CallingReturnProps<Component>\n : ChatReturnProps<Component> => {\n const callingSelector = type === 'calling' || !type ? getCallingSelector(component) : undefined;\n const chatSelector = type === 'chat' || !type ? getChatSelector(component) : undefined;\n const callProps = useCallingSelector(callingSelector);\n const chatProps = useChatSelector(chatSelector);\n const callingHandlers = useCallingHandlers<Parameters<Component>[0]>(component);\n const chatHandlers = useChatHandlers<Parameters<Component>[0]>(component);\n\n if (chatProps) {\n if (!chatHandlers) {\n throw 'Please initialize chatClient and chatThreadClient first!';\n }\n return { ...chatProps, ...chatHandlers } as any;\n }\n\n if (callProps) {\n if (!callingHandlers) {\n throw 'Please initialize callClient first!';\n }\n return { ...callProps, ...callingHandlers } as any;\n }\n\n throw \"Can't find corresponding selector for this component. Please check the supported components from Azure Communication UI Feature Component List.\";\n};\n"],"names":["isCommunicationUserIdentifier","isMicrosoftTeamsUserIdentifier","isPhoneNumberIdentifier","telemetryVersion['default']","getDeviceManager","getLocalVideoStreams","getDisplayName","getLatestErrors","reselect","memoizeOne","LocalVideoStream","isPreviewOn","createSelector","errorBarSelector","maxErrorCount","createContext","React","useContext","useState","useEffect","CallContext","mergeStyles","en_US","en_GB","de_DE","es_ES","fr_FR","it_IT","ja_JP","ko_KR","nl_NL","pt_BR","ru_RU","tr_TR","zh_CN","zh_TW","LocaleContext","LocalizationProvider","useLocale","Stack","MessageBar","MessageBarType","mergeThemes","getTheme","mergeNorthstarThemes","teamsTheme","ThemeProvider","Provider","VideoOff20Filled","Video20Filled","CallEnd20Filled","MicOff20Filled","MicOn20Filled","MoreHorizontal20Filled","People20Filled","ShareScreenStart20Filled","ShareScreenStop20Filled","CheckmarkCircle20Regular","ErrorCircle20Regular","EyeShow20Filled","Circle20Regular","Video20Regular","MicOn20Regular","Speaker220Regular","MicOff16Filled","MoreHorizontal20Regular","Send20Regular","Send20Filled","Dismiss20Regular","Checkmark20Regular","Edit20Regular","Delete20Regular","FontWeights","concatStyleSets","useCallback","TextField","MAXIMUM_LENGTH_OF_MESSAGE","TEXT_EXCEEDS_LIMIT","useMemo","Icon","TooltipHost","FontIcon","Parser","LiveMessage","Linkify","Link","Chat","Text","useRef","MoreIcon","ContextualMenu","DirectionalHint","PrimaryButton","SystemMessageComponent","PersonaSize","Persona","Flex","LiveAnnouncer","Ref","iconContainerStyle","participantListStyle","PersonaPresence","theme","videoBaseStyle","useLayoutEffect","palette","DRAG_OPTIONS","Modal","Label","DefaultButton","ContextualMenuItemType","copy","useHandlers","useSelector","getSelector","findSelector","enableMapSet","EventEmitter","produce","VideoStreamRenderer","ParticipantSubscriber","Features","CallClient","ChatContext","__asyncValues","nanoid","getIdentifierKind","ChatClient","ComponentLocalizationProvider","Speaker220Filled","registerIcons","useAdapter","useAdaptedSelector","useSelectorWithAdaptation","adaptCompositeState","memoizeState","createCompositeHandlers","usePropsFor","getChatSelector","getCallingSelector","Spinner","SpinnerSize","localVideoViewOption","MessageBarButton","FocusTrapCallout","mainStackTokens","Dropdown","videoCameraIconStyle","buttonStyle","Error","CommandBarButton","onRenderOnIcon","Chat20Filled","onRenderOffIcon","Chat20Regular","People20Regular","useCallingSelector","useChatSelector","useCallingHandlers","useChatHandlers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,OAAO,GAAG,CAAC,KAAgB,EAAE,KAAgB,EAAE,MAAiD;IACpG,OAAO,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC,KAA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