@azure/communication-react 1.5.1-beta.2 → 1.5.1-beta.4

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 (330) hide show
  1. package/CHANGELOG.beta.md +56 -1
  2. package/CHANGELOG.json +494 -0
  3. package/README.md +1 -1
  4. package/dist/communication-react.d.ts +476 -254
  5. package/dist/dist-cjs/communication-react/index.js +5974 -4543
  6. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  9. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +13 -0
  10. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +36 -0
  11. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  12. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.d.ts +49 -0
  13. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +53 -0
  14. package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -0
  15. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +12 -4
  16. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +22 -32
  17. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  18. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +3 -1
  19. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  20. package/dist/dist-esm/calling-component-bindings/src/index.d.ts +3 -0
  21. package/dist/dist-esm/calling-component-bindings/src/index.js +2 -0
  22. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
  23. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +68 -22
  24. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  25. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +8 -3
  26. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +81 -30
  27. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  28. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +57 -0
  29. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  30. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +2 -1
  31. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +19 -21
  32. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  33. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.d.ts +18 -0
  34. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js +38 -0
  35. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js.map +1 -0
  36. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +6 -0
  37. package/dist/dist-esm/calling-stateful-client/src/Converter.js +17 -1
  38. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  39. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.d.ts +0 -9
  40. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +3 -6
  41. package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
  42. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +0 -1
  43. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js +2 -25
  44. package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js.map +1 -1
  45. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +7 -0
  46. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +10 -0
  47. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  48. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +1 -1
  49. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  50. package/dist/dist-esm/calling-stateful-client/src/index.d.ts +1 -0
  51. package/dist/dist-esm/calling-stateful-client/src/index.js +2 -0
  52. package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
  53. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +58 -4
  54. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  55. package/dist/dist-esm/chat-component-bindings/src/utils/constants.d.ts +4 -0
  56. package/dist/dist-esm/chat-component-bindings/src/utils/constants.js +4 -0
  57. package/dist/dist-esm/chat-component-bindings/src/utils/constants.js.map +1 -1
  58. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js +32 -26
  59. package/dist/dist-esm/chat-component-bindings/src/utils/updateMessagesWithAttached.js.map +1 -1
  60. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js +5 -1
  61. package/dist/dist-esm/chat-stateful-client/src/EventSubscriber.js.map +1 -1
  62. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js +6 -1
  63. package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.js.map +1 -1
  64. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +1 -0
  65. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
  66. package/dist/dist-esm/communication-react/src/index.d.ts +7 -2
  67. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/components/CameraButton.d.ts +0 -4
  69. package/dist/dist-esm/react-components/src/components/CameraButton.js +0 -14
  70. package/dist/dist-esm/react-components/src/components/CameraButton.js.map +1 -1
  71. package/dist/dist-esm/react-components/src/components/Caption.d.ts +21 -0
  72. package/dist/dist-esm/react-components/src/components/Caption.js +33 -0
  73. package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -0
  74. package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +1 -0
  75. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +32 -30
  76. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
  77. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.d.ts +37 -0
  78. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +88 -0
  79. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -0
  80. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +16 -1
  81. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js +19 -16
  82. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
  83. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +1 -1
  84. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +4 -2
  85. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
  86. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +11 -1
  87. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +38 -20
  88. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
  89. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +14 -2
  90. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +96 -11
  91. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  92. package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenuItem.d.ts +2 -0
  93. package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenuItem.js +1 -0
  94. package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenuItem.js.map +1 -1
  95. package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +13 -0
  96. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +5 -1
  97. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
  98. package/dist/dist-esm/react-components/src/components/GridLayout.js +1 -1
  99. package/dist/dist-esm/react-components/src/components/GridLayout.js.map +1 -1
  100. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +36 -4
  101. package/dist/dist-esm/react-components/src/components/MessageThread.js +88 -42
  102. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  103. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js +1 -1
  104. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
  105. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js +10 -2
  106. package/dist/dist-esm/react-components/src/components/ScreenShareButton.js.map +1 -1
  107. package/dist/dist-esm/react-components/src/components/StartCaptionsButton.d.ts +70 -0
  108. package/dist/dist-esm/react-components/src/components/StartCaptionsButton.js +52 -0
  109. package/dist/dist-esm/react-components/src/components/StartCaptionsButton.js.map +1 -0
  110. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js +1 -1
  111. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js.map +1 -1
  112. package/dist/dist-esm/react-components/src/components/index.d.ts +4 -1
  113. package/dist/dist-esm/react-components/src/components/index.js +7 -0
  114. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  115. package/dist/dist-esm/react-components/src/components/styles/Captions.style.d.ts +33 -0
  116. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +60 -0
  117. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -0
  118. package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.d.ts +34 -0
  119. package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js +86 -0
  120. package/dist/dist-esm/react-components/src/components/styles/CaptionsSettingsModal.styles.js.map +1 -0
  121. package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +14 -0
  122. package/dist/dist-esm/react-components/src/components/styles/Common.style.js +16 -0
  123. package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +1 -0
  124. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +5 -0
  125. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +28 -0
  126. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  127. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +1 -0
  128. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
  129. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +6 -4
  130. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js +1 -1
  131. package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.js.map +1 -1
  132. package/dist/dist-esm/react-components/src/components/utils.d.ts +4 -0
  133. package/dist/dist-esm/react-components/src/components/utils.js +4 -0
  134. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  135. package/dist/dist-esm/react-components/src/index.d.ts +2 -0
  136. package/dist/dist-esm/react-components/src/index.js.map +1 -1
  137. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +3 -1
  138. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +3 -1
  139. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +5 -2
  140. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +3 -1
  141. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +3 -1
  142. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +3 -1
  143. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +3 -1
  144. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +3 -1
  145. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +3 -1
  146. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +3 -1
  147. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +3 -1
  148. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +3 -1
  149. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +3 -1
  150. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +3 -1
  151. package/dist/dist-esm/react-components/src/permissions/PermissionsProvider.d.ts +1 -1
  152. package/dist/dist-esm/react-components/src/permissions/PermissionsProvider.js.map +1 -1
  153. package/dist/dist-esm/react-components/src/theming/icons.d.ts +5 -1
  154. package/dist/dist-esm/react-components/src/theming/icons.js +18 -4
  155. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  156. package/dist/dist-esm/react-components/src/types/CaptionsAvailableLanguageStrings.d.ts +48 -0
  157. package/dist/dist-esm/react-components/src/types/CaptionsAvailableLanguageStrings.js +4 -0
  158. package/dist/dist-esm/react-components/src/types/CaptionsAvailableLanguageStrings.js.map +1 -0
  159. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +21 -1
  160. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  161. package/dist/dist-esm/react-components/src/types/index.d.ts +1 -0
  162. package/dist/dist-esm/react-components/src/types/index.js +1 -0
  163. package/dist/dist-esm/react-components/src/types/index.js.map +1 -1
  164. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +2 -9
  165. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  166. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +65 -0
  167. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  168. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +13 -4
  169. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +67 -30
  170. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  171. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +43 -32
  172. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  173. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +1 -0
  174. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  175. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +95 -19
  176. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  177. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +1 -1
  178. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  179. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js +3 -3
  180. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js.map +1 -1
  181. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.d.ts +5 -6
  182. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js +1 -3
  183. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.js.map +1 -1
  184. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.d.ts +9 -3
  185. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.js +3 -1
  186. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.js.map +1 -1
  187. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Devices.d.ts +1 -1
  188. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Devices.js.map +1 -1
  189. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.d.ts +1 -1
  190. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js.map +1 -1
  191. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.d.ts +1 -1
  192. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Microphone.js.map +1 -1
  193. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Participants.d.ts +1 -1
  194. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Participants.js.map +1 -1
  195. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.d.ts +1 -1
  196. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/ScreenShare.js.map +1 -1
  197. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +13 -9
  198. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  199. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +3 -3
  200. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  201. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +17 -0
  202. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +41 -0
  203. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  204. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +5 -1
  205. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +20 -0
  206. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
  207. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallControls.styles.js.map +1 -1
  208. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LobbyTile.styles.js +4 -4
  209. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LobbyTile.styles.js.map +1 -1
  210. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.d.ts +20 -0
  211. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js +21 -1
  212. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js.map +1 -1
  213. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.d.ts +5 -87
  214. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.js.map +1 -1
  215. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  216. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +15 -75
  217. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +11 -15
  218. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  219. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.d.ts +12 -0
  220. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.js.map +1 -1
  221. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +17 -5
  222. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +51 -17
  223. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  224. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +24 -14
  225. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  226. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +5 -4
  227. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +15 -9
  228. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  229. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +4 -0
  230. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +6 -0
  231. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  232. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/parseTeamsUrl.js +4 -0
  233. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/parseTeamsUrl.js.map +1 -1
  234. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.d.ts +1 -1
  235. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.js.map +1 -1
  236. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +11 -1
  237. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  238. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +19 -2
  239. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +68 -6
  240. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  241. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +4 -0
  242. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  243. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -0
  244. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  245. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.d.ts +6 -0
  246. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js +60 -0
  247. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBanner.js.map +1 -0
  248. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.d.ts +12 -0
  249. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.js +107 -0
  250. package/dist/dist-esm/react-composites/src/composites/common/CaptionsBannerMoreButton.js.map +1 -0
  251. package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.d.ts +7 -0
  252. package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.js +38 -0
  253. package/dist/dist-esm/react-composites/src/composites/common/CaptionsSettingsModal.js.map +1 -0
  254. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.d.ts +30 -0
  255. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +286 -0
  256. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -0
  257. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common/ControlBar}/CustomButton.d.ts +19 -16
  258. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common/ControlBar}/CustomButton.js +4 -4
  259. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -0
  260. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite/components → common/ControlBar}/DesktopMoreButton.d.ts +4 -2
  261. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +193 -0
  262. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -0
  263. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common/ControlBar}/PeopleButton.d.ts +1 -1
  264. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common/ControlBar}/PeopleButton.js +3 -3
  265. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/PeopleButton.js.map +1 -0
  266. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite/components → common/Drawer}/MoreDrawer.d.ts +15 -2
  267. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite/components → common/Drawer}/MoreDrawer.js +109 -5
  268. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -0
  269. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.d.ts +6 -0
  270. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.js +24 -0
  271. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.styles.js.map +1 -0
  272. package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common/Drawer}/PreparedMoreDrawer.d.ts +3 -2
  273. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js +26 -0
  274. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -0
  275. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.d.ts +20 -0
  276. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.js +55 -0
  277. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.js.map +1 -0
  278. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.d.ts +7 -0
  279. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js +25 -0
  280. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js.map +1 -0
  281. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js +1 -1
  282. package/dist/dist-esm/react-composites/src/composites/common/MoreButton.js.map +1 -1
  283. package/dist/dist-esm/react-composites/src/composites/common/constants.d.ts +9 -0
  284. package/dist/dist-esm/react-composites/src/composites/common/constants.js +11 -0
  285. package/dist/dist-esm/react-composites/src/composites/common/constants.js.map +1 -0
  286. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +7 -2
  287. package/dist/dist-esm/react-composites/src/composites/common/icons.js +4 -10
  288. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  289. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +165 -0
  290. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js +4 -0
  291. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -0
  292. package/dist/dist-esm/react-composites/src/composites/common/utils.d.ts +4 -0
  293. package/dist/dist-esm/react-composites/src/composites/common/utils.js +4 -0
  294. package/dist/dist-esm/react-composites/src/composites/common/utils.js.map +1 -1
  295. package/dist/dist-esm/react-composites/src/composites/index.d.ts +3 -0
  296. package/dist/dist-esm/react-composites/src/composites/index.js.map +1 -1
  297. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +66 -1
  298. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +66 -1
  299. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +66 -1
  300. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +66 -1
  301. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +66 -1
  302. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +66 -1
  303. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +66 -1
  304. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +66 -1
  305. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +66 -1
  306. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +66 -1
  307. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +66 -1
  308. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +66 -1
  309. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +66 -1
  310. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +66 -1
  311. package/package.json +14 -15
  312. package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.d.ts +0 -29
  313. package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js +0 -54
  314. package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js.map +0 -1
  315. package/dist/dist-esm/react-components/src/components/styles/CaptionsBanner.style.d.ts +0 -13
  316. package/dist/dist-esm/react-components/src/components/styles/CaptionsBanner.style.js +0 -35
  317. package/dist/dist-esm/react-components/src/components/styles/CaptionsBanner.style.js.map +0 -1
  318. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.d.ts +0 -28
  319. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.js +0 -194
  320. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.js.map +0 -1
  321. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CustomButton.js.map +0 -1
  322. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/PeopleButton.js.map +0 -1
  323. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/PreparedMoreDrawer.js +0 -22
  324. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/PreparedMoreDrawer.js.map +0 -1
  325. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/components/DesktopMoreButton.js +0 -86
  326. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/components/DesktopMoreButton.js.map +0 -1
  327. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/components/MoreDrawer.js.map +0 -1
  328. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +0 -11
  329. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js +0 -19
  330. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayout.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/GridLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA4B7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,C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AG,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,GAAG,gBAAgB,CAAC;IAC5F,iBAAiB;IACjB,+GAA+G;IAC/G,MAAM,KAAK,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;IAEpD,MAAM,UAAU,GAAG,YAAY;QAC7B,CAAC,CAAC;YACE,mBAAmB,EAAE,UAAU,KAAK,mBAAmB;YACvD,gBAAgB,EAAE,UAAU,MAAM,mBAAmB;YACrD,YAAY,EAAE,KAAK;SACpB;QACH,CAAC,CAAC;YACE,mBAAmB,EAAE,UAAU,MAAM,mBAAmB;YACxD,gBAAgB,EAAE,UAAU,KAAK,mBAAmB;YACpD,YAAY,EAAE,QAAQ;SACvB,CAAC;IAEN,MAAM,cAAc,GAAG,YAAY;QACjC,CAAC,CAAC;YACE,KAAK,EAAE;gBACL,UAAU,EAAE,eAAe,KAAK,GAAG,kBAAkB,EAAE;aACxD;SACF;QACH,CAAC,CAAC;YACE,KAAK,EAAE;gBACL,OAAO,EAAE,eAAe,KAAK,GAAG,kBAAkB,EAAE;aACrD;SACF,CAAC;IAEN,2FAA2F;IAC3F,sFAAsF;IACtF,MAAM,YAAY,GAAG,WAAW;QAC9B,CAAC,CAAC;YACE,CAAC,2BAA2B,WAAW,GAAG,CAAC,EAAE,YAAY;gBACvD,CAAC,CAAC;oBACE,UAAU,EAAE,eAAe,KAAK,GAAG,gBAAgB,EAAE;iBACtD;gBACH,CAAC,CAAC;oBACE,OAAO,EAAE,eAAe,KAAK,GAAG,gBAAgB,EAAE;iBACnD;SACN;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAC/D,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles } from '@fluentui/react';\nimport React, { useRef, useEffect, useState, useMemo } from 'react';\nimport { BaseCustomStyles } from '../types';\nimport { gridLayoutStyle } from './styles/GridLayout.styles';\n\n/**\n * Props for {@link GridLayout}.\n *\n * @public\n */\nexport interface GridLayoutProps {\n children: React.ReactNode;\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?: BaseCustomStyles;\n}\n\n/**\n * {@link GridLayout} Component Styles.\n * @public\n */\nexport interface GridLayoutStyles extends BaseCustomStyles {\n /** Styles for each child of {@link GridLayout} */\n children?: IStyle;\n}\n\n/**\n * A component to lay out audio / video participants tiles in a call.\n *\n * @public\n */\nexport const GridLayout = (props: GridLayoutProps): JSX.Element => {\n const { children, styles } = props;\n const numberOfChildren = React.Children.count(children);\n\n const [currentWidth, setCurrentWidth] = useState(0);\n const [currentHeight, setCurrentHeight] = useState(0);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const observer = useRef(\n new ResizeObserver((entries): void => {\n const { width, height } = entries[0].contentRect;\n setCurrentWidth(width);\n setCurrentHeight(height);\n })\n );\n\n useEffect(() => {\n if (containerRef.current) {\n observer.current.observe(containerRef.current);\n }\n const currentObserver = observer.current;\n return () => currentObserver.disconnect();\n }, [observer, containerRef]);\n\n const gridProps = useMemo(() => {\n return calculateGridProps(numberOfChildren, currentWidth, currentHeight);\n }, [numberOfChildren, currentWidth, currentHeight]);\n\n const cssGridStyles = useMemo(() => createGridStyles(numberOfChildren, gridProps), [numberOfChildren, gridProps]);\n\n return (\n <div ref={containerRef} className={mergeStyles(gridLayoutStyle, cssGridStyles, styles?.root)}>\n {children}\n </div>\n );\n};\n\n/**\n * The cell aspect ratio we aim for in a grid\n */\nconst TARGET_CELL_ASPECT_RATIO = 16 / 9;\n/**\n * The minimum cell aspect ratio we allow\n */\nconst MINIMUM_CELL_ASPECT_RATIO_ALLOWED = 8 / 9;\n\nconst isCloserThan = (a: number, b: number, target: number): boolean => {\n return Math.abs(target - a) < Math.abs(target - b);\n};\n\n/**\n * Properties to describe a grid. The number of rows, number of columns and whether it fills horizontally or vertically.\n *\n * @Example\n * ```\n * ______________________\n * |_______|_______|______|\n * |___________|__________| This grid has 2 rows, 3 columns and fills horizontally.\n * ______________\n * | | | |\n * |____|____| |\n * | | | |\n * |____|____|____| This grid has 2 rows, 3 columns and fills vertically.\n * _______________\n * | | |\n * |_______|_______|\n * | | | If all cells are equal, we default the fill direction as horizontal.\n * |_______|_______| This grid has 2 rows, 2 columns and fills horizontally.\n * ```\n */\ntype GridProps = {\n fillDirection: FillDirection;\n rows: number;\n columns: number;\n};\n\ntype FillDirection = 'horizontal' | 'vertical';\n\n/**\n * Get the best GridProps to place a number of items in a grid as evenly as possible given the width and height of the grid\n * @param numberOfItems - number of items to place in grid\n * @param width - width of grid\n * @param height - height of grid\n * @returns GridProps\n */\nexport const calculateGridProps = (numberOfItems: number, width: number, height: number): GridProps => {\n if (numberOfItems <= 0) {\n return { fillDirection: 'horizontal', rows: 0, columns: 0 };\n }\n // If width or height are 0 then we return rows and column evenly\n if (width <= 0 || height <= 0) {\n return {\n fillDirection: 'horizontal',\n rows: Math.ceil(Math.sqrt(numberOfItems)),\n columns: Math.ceil(Math.sqrt(numberOfItems))\n };\n }\n const aspectRatio = width / height;\n // Approximate how many rows to divide the grid to achieve cells close to the TARGET_CELL_ASPECT_RATIO\n let rows = Math.floor(Math.sqrt((TARGET_CELL_ASPECT_RATIO / aspectRatio) * numberOfItems)) || 1;\n // Make sure rows do not exceed numberOfItems\n rows = Math.min(rows, numberOfItems);\n // Given the rows, get the minimum columns needed to create enough cells for the number of items\n let columns = Math.ceil(numberOfItems / rows);\n\n // Default fill direction to horizontal\n let fillDirection: 'horizontal' | 'vertical' = 'horizontal';\n\n while (rows < numberOfItems) {\n // If cell aspect ratio is less than MINIMUM_CELL_ASPECT_RATIO_ALLOWED then try more rows\n if ((rows / columns) * aspectRatio < MINIMUM_CELL_ASPECT_RATIO_ALLOWED) {\n rows += 1;\n columns = Math.ceil(numberOfItems / rows);\n continue;\n }\n if (numberOfItems < rows * columns) {\n // We need to check that stretching columns vertically will result in only one less cell in stretched columns.\n // Likewise, we need to check that stretching rows horizonally will result in only one less cell in stretched rows.\n // e.g. For 4 rows, 2 columns, but only 6 items, we cannot stretch vertically because that would result in a\n // column of 2 cells which is less by more than 1 compared to the unstretched column.\n // _________\n // |____| |\n // |____|____|\n // |____| |\n // |____|____|\n\n const canStretchVertically = numberOfItems >= rows + (columns - 1) * (rows - 1);\n const canStretchHorizontally = numberOfItems >= columns + (rows - 1) * (columns - 1);\n if (!canStretchVertically && !canStretchHorizontally) {\n rows += 1;\n columns = Math.ceil(numberOfItems / rows);\n continue;\n } else if (!canStretchVertically) {\n break;\n } else if (!canStretchHorizontally) {\n fillDirection = 'vertical';\n break;\n }\n\n // We need to figure out whether the big cells should stretch horizontally or vertically\n // to fill in the empty spaces\n // e.g. For 2 rows, 3 columns, but only 5 items, we need to choose whether to stretch cells\n // horizontally or vertically\n // ______________________ _______________________\n // | | | | | | | |\n // |_______|_______|______| |_______|_______| |\n // | | | | | | |\n // |___________|__________| |_______|_______|_______|\n\n // Calculate the aspect ratio of big cells stretched horizontally\n const horizontallyStretchedCellRatio = (rows / (columns - 1)) * aspectRatio;\n // Calculate the aspect ratio of big cells stretched vertically\n const verticallyStretchedCellRatio = ((rows - 1) / columns) * aspectRatio;\n // We know the horizontally stretched cells aspect ratio is higher than MINIMUM_CELL_ASPECT_RATIO_ALLOWED. If vertically stretched cells\n // is also higher than the MINIMUM_CELL_ASPECT_RATIO_ALLOWED, then choose which aspect ratio is better.\n if (verticallyStretchedCellRatio >= MINIMUM_CELL_ASPECT_RATIO_ALLOWED) {\n // If vertically stetched cell has an aspect ratio closer to TARGET_CELL_ASPECT_RATIO then change the fill direction to vertical\n if (isCloserThan(verticallyStretchedCellRatio, horizontallyStretchedCellRatio, TARGET_CELL_ASPECT_RATIO)) {\n fillDirection = 'vertical';\n }\n }\n }\n break;\n }\n\n return { fillDirection, rows, columns };\n};\n\n/**\n * Creates a styles classname with CSS Grid related styles given GridProps and the number of items to distribute as evenly as possible.\n * @param numberOfItems - number of items to place in grid\n * @param gridProps - GridProps that define the number of rows, number of columns, and the fill direction\n * @returns - classname\n */\nexport const createGridStyles = (numberOfItems: number, gridProps: GridProps): string => {\n const isHorizontal = gridProps.fillDirection === 'horizontal';\n // Blocks are either rows or columns depending on whether we fill horizontally or vertically. Each block may differ in the number of cells.\n const blocks = isHorizontal ? gridProps.rows : gridProps.columns;\n const smallCellsPerBlock = Math.ceil(numberOfItems / blocks);\n const bigCellsPerBlock = Math.floor(numberOfItems / blocks);\n const numBigCells = (gridProps.rows * gridProps.columns - numberOfItems) * bigCellsPerBlock;\n // Get grid units\n // e.g. If some blocks have 2 big cells while others have 3 small cells, we need to work with 6 units per block\n const units = smallCellsPerBlock * bigCellsPerBlock;\n\n const gridStyles = isHorizontal\n ? {\n gridTemplateColumns: `repeat(${units}, minmax(0, 1fr))`,\n gridTemplateRows: `repeat(${blocks}, minmax(0, 1fr))`,\n gridAutoFlow: 'row'\n }\n : {\n gridTemplateColumns: `repeat(${blocks}, minmax(0, 1fr))`,\n gridTemplateRows: `repeat(${units}, minmax(0, 1fr))`,\n gridAutoFlow: 'column'\n };\n\n const smallCellStyle = isHorizontal\n ? {\n '> *': {\n gridColumn: `auto / span ${units / smallCellsPerBlock}`\n }\n }\n : {\n '> *': {\n gridRow: `auto / span ${units / smallCellsPerBlock}`\n }\n };\n\n // If there are big cells, we are choosing to place the latest children into the big cells.\n // That is why we use the '> *:nth-last-child(-n + ${numBigCells})' CSS selector below\n const bigCellStyle = numBigCells\n ? {\n [`> *:nth-last-child(-n + ${numBigCells})`]: isHorizontal\n ? {\n gridColumn: `auto / span ${units / bigCellsPerBlock}`\n }\n : {\n gridRow: `auto / span ${units / bigCellsPerBlock}`\n }\n }\n : {};\n\n return mergeStyles(gridStyles, smallCellStyle, bigCellStyle);\n};\n"]}
1
+ {"version":3,"file":"GridLayout.js","sourceRoot":"","sources":["../../../../../../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tD;gBACH,CAAC,CAAC;oBACE,OAAO,EAAE,eAAe,KAAK,GAAG,gBAAgB,EAAE;iBACnD;SACN;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAC/D,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles } from '@fluentui/react';\nimport React, { useRef, useEffect, useState, useMemo } from 'react';\nimport { BaseCustomStyles } from '../types';\nimport { gridLayoutStyle } from './styles/GridLayout.styles';\n\n/**\n * Props for {@link GridLayout}.\n *\n * @public\n */\nexport interface GridLayoutProps {\n children: React.ReactNode;\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?: BaseCustomStyles;\n}\n\n/**\n * {@link GridLayout} Component Styles.\n * @public\n */\nexport interface GridLayoutStyles extends BaseCustomStyles {\n /** Styles for each child of {@link GridLayout} */\n children?: IStyle;\n}\n\n/**\n * A component to lay out audio / video participants tiles in a call.\n *\n * @public\n */\nexport const GridLayout = (props: GridLayoutProps): JSX.Element => {\n const { children, styles } = props;\n const numberOfChildren = React.Children.count(children);\n\n const [currentWidth, setCurrentWidth] = useState(0);\n const [currentHeight, setCurrentHeight] = useState(0);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const observer = useRef(\n new ResizeObserver((entries): void => {\n const { width, height } = entries[0].contentRect;\n setCurrentWidth(width);\n setCurrentHeight(height);\n })\n );\n\n useEffect(() => {\n if (containerRef.current) {\n observer.current.observe(containerRef.current);\n }\n const currentObserver = observer.current;\n return () => currentObserver.disconnect();\n }, [observer, containerRef]);\n\n const gridProps = useMemo(() => {\n return calculateGridProps(numberOfChildren, currentWidth, currentHeight);\n }, [numberOfChildren, currentWidth, currentHeight]);\n\n const cssGridStyles = useMemo(() => createGridStyles(numberOfChildren, gridProps), [numberOfChildren, gridProps]);\n\n return (\n <div\n ref={containerRef}\n className={mergeStyles(gridLayoutStyle, cssGridStyles, styles?.root)}\n data-ui-id=\"grid-layout\"\n >\n {children}\n </div>\n );\n};\n\n/**\n * The cell aspect ratio we aim for in a grid\n */\nconst TARGET_CELL_ASPECT_RATIO = 16 / 9;\n/**\n * The minimum cell aspect ratio we allow\n */\nconst MINIMUM_CELL_ASPECT_RATIO_ALLOWED = 8 / 9;\n\nconst isCloserThan = (a: number, b: number, target: number): boolean => {\n return Math.abs(target - a) < Math.abs(target - b);\n};\n\n/**\n * Properties to describe a grid. The number of rows, number of columns and whether it fills horizontally or vertically.\n *\n * @Example\n * ```\n * ______________________\n * |_______|_______|______|\n * |___________|__________| This grid has 2 rows, 3 columns and fills horizontally.\n * ______________\n * | | | |\n * |____|____| |\n * | | | |\n * |____|____|____| This grid has 2 rows, 3 columns and fills vertically.\n * _______________\n * | | |\n * |_______|_______|\n * | | | If all cells are equal, we default the fill direction as horizontal.\n * |_______|_______| This grid has 2 rows, 2 columns and fills horizontally.\n * ```\n */\ntype GridProps = {\n fillDirection: FillDirection;\n rows: number;\n columns: number;\n};\n\ntype FillDirection = 'horizontal' | 'vertical';\n\n/**\n * Get the best GridProps to place a number of items in a grid as evenly as possible given the width and height of the grid\n * @param numberOfItems - number of items to place in grid\n * @param width - width of grid\n * @param height - height of grid\n * @returns GridProps\n */\nexport const calculateGridProps = (numberOfItems: number, width: number, height: number): GridProps => {\n if (numberOfItems <= 0) {\n return { fillDirection: 'horizontal', rows: 0, columns: 0 };\n }\n // If width or height are 0 then we return rows and column evenly\n if (width <= 0 || height <= 0) {\n return {\n fillDirection: 'horizontal',\n rows: Math.ceil(Math.sqrt(numberOfItems)),\n columns: Math.ceil(Math.sqrt(numberOfItems))\n };\n }\n const aspectRatio = width / height;\n // Approximate how many rows to divide the grid to achieve cells close to the TARGET_CELL_ASPECT_RATIO\n let rows = Math.floor(Math.sqrt((TARGET_CELL_ASPECT_RATIO / aspectRatio) * numberOfItems)) || 1;\n // Make sure rows do not exceed numberOfItems\n rows = Math.min(rows, numberOfItems);\n // Given the rows, get the minimum columns needed to create enough cells for the number of items\n let columns = Math.ceil(numberOfItems / rows);\n\n // Default fill direction to horizontal\n let fillDirection: 'horizontal' | 'vertical' = 'horizontal';\n\n while (rows < numberOfItems) {\n // If cell aspect ratio is less than MINIMUM_CELL_ASPECT_RATIO_ALLOWED then try more rows\n if ((rows / columns) * aspectRatio < MINIMUM_CELL_ASPECT_RATIO_ALLOWED) {\n rows += 1;\n columns = Math.ceil(numberOfItems / rows);\n continue;\n }\n if (numberOfItems < rows * columns) {\n // We need to check that stretching columns vertically will result in only one less cell in stretched columns.\n // Likewise, we need to check that stretching rows horizonally will result in only one less cell in stretched rows.\n // e.g. For 4 rows, 2 columns, but only 6 items, we cannot stretch vertically because that would result in a\n // column of 2 cells which is less by more than 1 compared to the unstretched column.\n // _________\n // |____| |\n // |____|____|\n // |____| |\n // |____|____|\n\n const canStretchVertically = numberOfItems >= rows + (columns - 1) * (rows - 1);\n const canStretchHorizontally = numberOfItems >= columns + (rows - 1) * (columns - 1);\n if (!canStretchVertically && !canStretchHorizontally) {\n rows += 1;\n columns = Math.ceil(numberOfItems / rows);\n continue;\n } else if (!canStretchVertically) {\n break;\n } else if (!canStretchHorizontally) {\n fillDirection = 'vertical';\n break;\n }\n\n // We need to figure out whether the big cells should stretch horizontally or vertically\n // to fill in the empty spaces\n // e.g. For 2 rows, 3 columns, but only 5 items, we need to choose whether to stretch cells\n // horizontally or vertically\n // ______________________ _______________________\n // | | | | | | | |\n // |_______|_______|______| |_______|_______| |\n // | | | | | | |\n // |___________|__________| |_______|_______|_______|\n\n // Calculate the aspect ratio of big cells stretched horizontally\n const horizontallyStretchedCellRatio = (rows / (columns - 1)) * aspectRatio;\n // Calculate the aspect ratio of big cells stretched vertically\n const verticallyStretchedCellRatio = ((rows - 1) / columns) * aspectRatio;\n // We know the horizontally stretched cells aspect ratio is higher than MINIMUM_CELL_ASPECT_RATIO_ALLOWED. If vertically stretched cells\n // is also higher than the MINIMUM_CELL_ASPECT_RATIO_ALLOWED, then choose which aspect ratio is better.\n if (verticallyStretchedCellRatio >= MINIMUM_CELL_ASPECT_RATIO_ALLOWED) {\n // If vertically stetched cell has an aspect ratio closer to TARGET_CELL_ASPECT_RATIO then change the fill direction to vertical\n if (isCloserThan(verticallyStretchedCellRatio, horizontallyStretchedCellRatio, TARGET_CELL_ASPECT_RATIO)) {\n fillDirection = 'vertical';\n }\n }\n }\n break;\n }\n\n return { fillDirection, rows, columns };\n};\n\n/**\n * Creates a styles classname with CSS Grid related styles given GridProps and the number of items to distribute as evenly as possible.\n * @param numberOfItems - number of items to place in grid\n * @param gridProps - GridProps that define the number of rows, number of columns, and the fill direction\n * @returns - classname\n */\nexport const createGridStyles = (numberOfItems: number, gridProps: GridProps): string => {\n const isHorizontal = gridProps.fillDirection === 'horizontal';\n // Blocks are either rows or columns depending on whether we fill horizontally or vertically. Each block may differ in the number of cells.\n const blocks = isHorizontal ? gridProps.rows : gridProps.columns;\n const smallCellsPerBlock = Math.ceil(numberOfItems / blocks);\n const bigCellsPerBlock = Math.floor(numberOfItems / blocks);\n const numBigCells = (gridProps.rows * gridProps.columns - numberOfItems) * bigCellsPerBlock;\n // Get grid units\n // e.g. If some blocks have 2 big cells while others have 3 small cells, we need to work with 6 units per block\n const units = smallCellsPerBlock * bigCellsPerBlock;\n\n const gridStyles = isHorizontal\n ? {\n gridTemplateColumns: `repeat(${units}, minmax(0, 1fr))`,\n gridTemplateRows: `repeat(${blocks}, minmax(0, 1fr))`,\n gridAutoFlow: 'row'\n }\n : {\n gridTemplateColumns: `repeat(${blocks}, minmax(0, 1fr))`,\n gridTemplateRows: `repeat(${units}, minmax(0, 1fr))`,\n gridAutoFlow: 'column'\n };\n\n const smallCellStyle = isHorizontal\n ? {\n '> *': {\n gridColumn: `auto / span ${units / smallCellsPerBlock}`\n }\n }\n : {\n '> *': {\n gridRow: `auto / span ${units / smallCellsPerBlock}`\n }\n };\n\n // If there are big cells, we are choosing to place the latest children into the big cells.\n // That is why we use the '> *:nth-last-child(-n + ${numBigCells})' CSS selector below\n const bigCellStyle = numBigCells\n ? {\n [`> *:nth-last-child(-n + ${numBigCells})`]: isHorizontal\n ? {\n gridColumn: `auto / span ${units / bigCellsPerBlock}`\n }\n : {\n gridRow: `auto / span ${units / bigCellsPerBlock}`\n }\n }\n : {};\n\n return mergeStyles(gridStyles, smallCellStyle, bigCellStyle);\n};\n"]}
@@ -2,8 +2,11 @@
2
2
  import { IStyle } from '@fluentui/react';
3
3
  import { ComponentSlotStyle } from '@fluentui/react-northstar';
4
4
  import { BaseCustomStyles, ChatMessage, CustomMessage, SystemMessage, OnRenderAvatarCallback, Message, ReadReceiptsBySenderId } from '../types';
5
+ import { BlockedMessage } from '../types';
5
6
  import { MessageStatusIndicatorProps } from './MessageStatusIndicator';
6
- import { FileDownloadHandler, FileMetadata } from './FileDownloadCards';
7
+ import { FileDownloadHandler } from './FileDownloadCards';
8
+ import { FileMetadata } from './FileDownloadCards';
9
+ import { AttachmentDownloadResult } from './FileDownloadCards';
7
10
  /**
8
11
  * Fluent styles for {@link MessageThread}.
9
12
  *
@@ -28,6 +31,8 @@ export interface MessageThreadStyles extends BaseCustomStyles {
28
31
  chatMessageContainer?: ComponentSlotStyle;
29
32
  /** Styles for system message container. */
30
33
  systemMessageContainer?: ComponentSlotStyle;
34
+ /** Styles for blocked message container. */
35
+ blockedMessageContainer?: ComponentSlotStyle;
31
36
  /** Styles for message status indicator container. */
32
37
  messageStatusContainer?: (mine: boolean) => IStyle;
33
38
  }
@@ -91,6 +96,10 @@ export interface MessageThreadStrings {
91
96
  actionMenuMoreOptions?: string;
92
97
  /** String for download file button in file card */
93
98
  downloadFile: string;
99
+ /** String for policy violation message removal */
100
+ blockedWarningText: string;
101
+ /** String for policy violation message removal details link */
102
+ blockedWarningLinkText: string;
94
103
  }
95
104
  /**
96
105
  * Arguments for {@link MessageThreadProps.onRenderJumpToNewMessageButton}.
@@ -116,6 +125,11 @@ export declare type MessageRenderer = (props: MessageProps) => JSX.Element;
116
125
  export declare type UpdateMessageCallback = (messageId: string, content: string, metadata?: Record<string, string>, options?: {
117
126
  attachedFilesMetadata?: FileMetadata[];
118
127
  }) => Promise<void>;
128
+ /**
129
+ * @public
130
+ * Callback function run when a message edit is cancelled.
131
+ */
132
+ export declare type CancelEditCallback = (messageId: string) => void;
119
133
  /**
120
134
  * Props for {@link MessageThread}.
121
135
  *
@@ -127,9 +141,9 @@ export declare type MessageThreadProps = {
127
141
  */
128
142
  userId: string;
129
143
  /**
130
- * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage` or `CustomMessage`.
144
+ * Messages to render in message thread. A message can be of type `ChatMessage`, `SystemMessage`, `BlockedMessage` or `CustomMessage`.
131
145
  */
132
- messages: (ChatMessage | SystemMessage | CustomMessage)[];
146
+ messages: (ChatMessage | SystemMessage | CustomMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage)[];
133
147
  /**
134
148
  * number of participants in the thread
135
149
  */
@@ -216,6 +230,12 @@ export declare type MessageThreadProps = {
216
230
  * @beta
217
231
  */
218
232
  onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;
233
+ /**
234
+ * Optional callback to retrieve the inline image in a message.
235
+ * @param attachment - FileMetadata object we want to render
236
+ * @beta
237
+ */
238
+ onFetchAttachments?: (attachment: FileMetadata) => Promise<AttachmentDownloadResult[]>;
219
239
  /**
220
240
  * Optional callback to edit a message.
221
241
  *
@@ -224,6 +244,12 @@ export declare type MessageThreadProps = {
224
244
  *
225
245
  */
226
246
  onUpdateMessage?: UpdateMessageCallback;
247
+ /**
248
+ * Optional callback for when a message edit is cancelled.
249
+ *
250
+ * @param messageId - message id from chatClient
251
+ */
252
+ onCancelMessageEdit?: CancelEditCallback;
227
253
  /**
228
254
  * Optional callback to delete a message.
229
255
  *
@@ -273,7 +299,7 @@ export declare type MessageThreadProps = {
273
299
  */
274
300
  export declare type MessageProps = {
275
301
  /**
276
- * Message to render. It can type `ChatMessage` or `SystemMessage` or `CustomMessage`.
302
+ * Message to render. It can type `ChatMessage` or `SystemMessage`, `BlockedMessage` or `CustomMessage`.
277
303
  */
278
304
  message: Message;
279
305
  /**
@@ -305,6 +331,12 @@ export declare type MessageProps = {
305
331
  * @param content - new content of the message
306
332
  */
307
333
  onUpdateMessage?: UpdateMessageCallback;
334
+ /**
335
+ * Optional callback for when a message edit is cancelled.
336
+ *
337
+ * @param messageId - message id from chatClient
338
+ */
339
+ onCancelMessageEdit?: CancelEditCallback;
308
340
  /**
309
341
  * Optional callback to delete a message.
310
342
  *
@@ -12,6 +12,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
12
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { Chat, Flex, Ref, mergeStyles as mergeNorthstarThemes } from '@fluentui/react-northstar';
14
14
  import { DownIconStyle, newMessageButtonContainerStyle, messageThreadContainerStyle, chatStyle, buttonWithIconStyles, newMessageButtonStyle, messageStatusContainerStyle, noMessageStatusStyle, defaultChatItemMessageContainer, defaultMyChatMessageContainer, defaultChatMessageContainer, gutterWithAvatar, gutterWithHiddenAvatar, FailedMyChatMessageContainer } from './styles/MessageThread.styles';
15
+ /* @conditional-compile-remove(data-loss-prevention) */
16
+ import { defaultBlockedMessageStyleContainer } from './styles/MessageThread.styles';
15
17
  import { Icon, mergeStyles, Persona, PersonaSize, PrimaryButton, Stack } from '@fluentui/react';
16
18
  import { LiveAnnouncer } from 'react-aria-live';
17
19
  import { delay } from './utils/delay';
@@ -21,7 +23,7 @@ import { SystemMessage as SystemMessageComponent } from './SystemMessage';
21
23
  import { ChatMessageComponent } from './ChatMessage/ChatMessageComponent';
22
24
  import { useLocale } from '../localization/LocalizationProvider';
23
25
  import { isNarrowWidth, _useContainerWidth } from './utils/responsive';
24
- import { getParticipantsWhoHaveReadMessage } from './utils/getParticipantsWhoHaveReadMessage';
26
+ import getParticipantsWhoHaveReadMessage from './utils/getParticipantsWhoHaveReadMessage';
25
27
  import { useTheme } from '../theming';
26
28
  const isMessageSame = (first, second) => {
27
29
  return (first.messageId === second.messageId &&
@@ -109,51 +111,66 @@ const DefaultSystemMessage = (props) => {
109
111
  }
110
112
  return React.createElement(React.Fragment, null);
111
113
  };
112
- const memoizeAllMessages = memoizeFnAll((_messageKey, message, showMessageDate, showMessageStatus, onRenderAvatar, shouldOverlapAvatarAndMessage, styles, onRenderMessageStatus, defaultStatusRenderer, defaultChatMessageRenderer, strings, theme, _attached, statusToRender, participantCount, readCount, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage, disableEditing) => {
113
- var _a, _b, _c, _d, _e, _f, _g;
114
+ const memoizeAllMessages = memoizeFnAll((_messageKey, message, showMessageDate, showMessageStatus, onRenderAvatar, shouldOverlapAvatarAndMessage, styles, onRenderMessageStatus, defaultStatusRenderer, defaultChatMessageRenderer, strings, theme, _attached, statusToRender, participantCount, readCount, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage, disableEditing) => {
115
+ var _a, _b, _c, _d, _e, _f, _g, _h;
114
116
  const messageProps = {
115
117
  message,
116
118
  strings,
117
119
  showDate: showMessageDate,
118
120
  onUpdateMessage,
121
+ onCancelMessageEdit,
119
122
  onDeleteMessage,
120
123
  onSendMessage,
121
124
  disableEditing
122
125
  };
126
+ const chatMessageItemProps = (message, messageProps) => {
127
+ var _a, _b, _c;
128
+ const chatMessageComponent = onRenderMessage === undefined
129
+ ? defaultChatMessageRenderer(messageProps)
130
+ : onRenderMessage(messageProps, defaultChatMessageRenderer);
131
+ const personaOptions = {
132
+ hidePersonaDetails: true,
133
+ size: PersonaSize.size32,
134
+ text: message.senderDisplayName,
135
+ showOverflowTooltip: false
136
+ };
137
+ const chatItemMessageStyle = (message.mine ? styles === null || styles === void 0 ? void 0 : styles.myChatItemMessageContainer : styles === null || styles === void 0 ? void 0 : styles.chatItemMessageContainer) ||
138
+ defaultChatItemMessageContainer(shouldOverlapAvatarAndMessage);
139
+ const chatGutterStyles = message.attached === 'top' || message.attached === false ? gutterWithAvatar : gutterWithHiddenAvatar;
140
+ return {
141
+ gutter: {
142
+ styles: chatGutterStyles,
143
+ content: message.mine ? ('') : onRenderAvatar ? (onRenderAvatar((_a = message.senderId) !== null && _a !== void 0 ? _a : '', personaOptions)) : (React.createElement(Persona, Object.assign({}, personaOptions)))
144
+ },
145
+ contentPosition: message.mine ? 'end' : 'start',
146
+ message: {
147
+ styles: chatItemMessageStyle,
148
+ content: (React.createElement(Flex, { hAlign: message.mine ? 'end' : undefined, vAlign: "end" },
149
+ chatMessageComponent,
150
+ React.createElement("div", { className: mergeStyles(messageStatusContainerStyle((_b = message.mine) !== null && _b !== void 0 ? _b : false), (styles === null || styles === void 0 ? void 0 : styles.messageStatusContainer) ? styles.messageStatusContainer((_c = message.mine) !== null && _c !== void 0 ? _c : false) : '') }, showMessageStatus && statusToRender ? (onRenderMessageStatus ? (onRenderMessageStatus({ status: statusToRender })) : (defaultStatusRenderer(message, statusToRender, participantCount !== null && participantCount !== void 0 ? participantCount : 0, readCount !== null && readCount !== void 0 ? readCount : 0))) : (React.createElement("div", { className: mergeStyles(noMessageStatusStyle) })))))
151
+ },
152
+ attached: message.attached,
153
+ key: _messageKey
154
+ };
155
+ };
156
+ /* @conditional-compile-remove(data-loss-prevention) */
157
+ // Similar logic as switch statement case 'chat', if statement for conditional compile (merge logic to switch case when stablize)
158
+ if (message.messageType === 'blocked') {
159
+ const myChatMessageStyle = message.status === 'failed'
160
+ ? (_b = (_a = styles === null || styles === void 0 ? void 0 : styles.failedMyChatMessageContainer) !== null && _a !== void 0 ? _a : styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _b !== void 0 ? _b : FailedMyChatMessageContainer
161
+ : (_c = styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _c !== void 0 ? _c : defaultBlockedMessageStyleContainer(theme);
162
+ const blockedMessageStyle = (_d = styles === null || styles === void 0 ? void 0 : styles.blockedMessageContainer) !== null && _d !== void 0 ? _d : defaultBlockedMessageStyleContainer(theme);
163
+ messageProps.messageContainerStyle = message.mine ? myChatMessageStyle : blockedMessageStyle;
164
+ return chatMessageItemProps(message, messageProps);
165
+ }
123
166
  switch (message.messageType) {
124
167
  case 'chat': {
125
168
  const myChatMessageStyle = message.status === 'failed'
126
- ? (_b = (_a = styles === null || styles === void 0 ? void 0 : styles.failedMyChatMessageContainer) !== null && _a !== void 0 ? _a : styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _b !== void 0 ? _b : FailedMyChatMessageContainer
127
- : (_c = styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _c !== void 0 ? _c : defaultMyChatMessageContainer;
128
- const chatMessageStyle = (_d = styles === null || styles === void 0 ? void 0 : styles.chatMessageContainer) !== null && _d !== void 0 ? _d : defaultChatMessageContainer(theme);
169
+ ? (_f = (_e = styles === null || styles === void 0 ? void 0 : styles.failedMyChatMessageContainer) !== null && _e !== void 0 ? _e : styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _f !== void 0 ? _f : FailedMyChatMessageContainer
170
+ : (_g = styles === null || styles === void 0 ? void 0 : styles.myChatMessageContainer) !== null && _g !== void 0 ? _g : defaultMyChatMessageContainer;
171
+ const chatMessageStyle = (_h = styles === null || styles === void 0 ? void 0 : styles.chatMessageContainer) !== null && _h !== void 0 ? _h : defaultChatMessageContainer(theme);
129
172
  messageProps.messageContainerStyle = message.mine ? myChatMessageStyle : chatMessageStyle;
130
- const chatMessageComponent = onRenderMessage === undefined
131
- ? defaultChatMessageRenderer(messageProps)
132
- : onRenderMessage(messageProps, defaultChatMessageRenderer);
133
- const personaOptions = {
134
- hidePersonaDetails: true,
135
- size: PersonaSize.size32,
136
- text: message.senderDisplayName,
137
- showOverflowTooltip: false
138
- };
139
- const chatItemMessageStyle = (message.mine ? styles === null || styles === void 0 ? void 0 : styles.myChatItemMessageContainer : styles === null || styles === void 0 ? void 0 : styles.chatItemMessageContainer) ||
140
- defaultChatItemMessageContainer(shouldOverlapAvatarAndMessage);
141
- const chatGutterStyles = message.attached === 'top' || message.attached === false ? gutterWithAvatar : gutterWithHiddenAvatar;
142
- return {
143
- gutter: {
144
- styles: chatGutterStyles,
145
- content: message.mine ? ('') : onRenderAvatar ? (onRenderAvatar((_e = message.senderId) !== null && _e !== void 0 ? _e : '', personaOptions)) : (React.createElement(Persona, Object.assign({}, personaOptions)))
146
- },
147
- contentPosition: message.mine ? 'end' : 'start',
148
- message: {
149
- styles: chatItemMessageStyle,
150
- content: (React.createElement(Flex, { hAlign: message.mine ? 'end' : undefined, vAlign: "end" },
151
- chatMessageComponent,
152
- React.createElement("div", { className: mergeStyles(messageStatusContainerStyle((_f = message.mine) !== null && _f !== void 0 ? _f : false), (styles === null || styles === void 0 ? void 0 : styles.messageStatusContainer) ? styles.messageStatusContainer((_g = message.mine) !== null && _g !== void 0 ? _g : false) : '') }, showMessageStatus && statusToRender ? (onRenderMessageStatus ? (onRenderMessageStatus({ status: statusToRender })) : (defaultStatusRenderer(message, statusToRender, participantCount !== null && participantCount !== void 0 ? participantCount : 0, readCount !== null && readCount !== void 0 ? readCount : 0))) : (React.createElement("div", { className: mergeStyles(noMessageStatusStyle) })))))
153
- },
154
- attached: message.attached,
155
- key: _messageKey
156
- };
173
+ return chatMessageItemProps(message, messageProps);
157
174
  }
158
175
  case 'system': {
159
176
  messageProps.messageContainerStyle = styles === null || styles === void 0 ? void 0 : styles.systemMessageContainer;
@@ -195,9 +212,11 @@ const getLastChatMessageIdWithStatus = (messages, status) => {
195
212
  */
196
213
  export const MessageThread = (props) => {
197
214
  var _a;
198
- const { messages: newMessages, userId, participantCount, readReceiptsBySenderId, styles, disableJumpToNewMessageButton = false, showMessageDate = false, showMessageStatus = false, numberOfChatMessagesToReload = 5, onMessageSeen, onRenderMessageStatus, onRenderAvatar, onLoadPreviousChatMessages, onRenderJumpToNewMessageButton, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage,
215
+ const { messages: newMessages, userId, participantCount, readReceiptsBySenderId, styles, disableJumpToNewMessageButton = false, showMessageDate = false, showMessageStatus = false, numberOfChatMessagesToReload = 5, onMessageSeen, onRenderMessageStatus, onRenderAvatar, onLoadPreviousChatMessages, onRenderJumpToNewMessageButton, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage,
199
216
  /* @conditional-compile-remove(date-time-customization) */
200
- onDisplayDateTimeString } = props;
217
+ onDisplayDateTimeString,
218
+ /* @conditional-compile-remove(teams-inline-images) */
219
+ onFetchAttachments } = props;
201
220
  const onRenderFileDownloads = onRenderFileDownloadsTrampoline(props);
202
221
  const [messages, setMessages] = useState([]);
203
222
  // We need this state to wait for one tick and scroll to bottom after messages have been initialized.
@@ -214,6 +233,19 @@ export const MessageThread = (props) => {
214
233
  const [lastSendingChatMessage, setLastSendingChatMessage] = useState(undefined);
215
234
  // readCount and participantCount will only need to be updated on-fly when user hover on an indicator
216
235
  const [readCountForHoveredIndicator, setReadCountForHoveredIndicator] = useState(undefined);
236
+ /* @conditional-compile-remove(teams-inline-images) */
237
+ const [inlineAttachments, setInlineAttachments] = useState({});
238
+ /* @conditional-compile-remove(teams-inline-images) */
239
+ const onFetchInlineAttachment = useCallback((attachment) => __awaiter(void 0, void 0, void 0, function* () {
240
+ if (!onFetchAttachments || attachment.id in inlineAttachments) {
241
+ return;
242
+ }
243
+ setInlineAttachments((prev) => (Object.assign(Object.assign({}, prev), { [attachment.id]: '' })));
244
+ const attachmentDownloadResult = yield onFetchAttachments(attachment);
245
+ if (attachmentDownloadResult[0]) {
246
+ setInlineAttachments((prev) => (Object.assign(Object.assign({}, prev), { [attachment.id]: attachmentDownloadResult[0].blobUrl })));
247
+ }
248
+ }), [inlineAttachments, onFetchAttachments]);
217
249
  const isAllChatMessagesLoadedRef = useRef(false);
218
250
  // isAllChatMessagesLoadedRef needs to be updated every time when a new adapter is set in order to display correct data
219
251
  // onLoadPreviousChatMessages is updated when a new adapter is set
@@ -391,7 +423,7 @@ export const MessageThread = (props) => {
391
423
  setLastSendingChatMessage(getLastChatMessageIdWithStatus(newMessages, 'sending'));
392
424
  }, [newMessages]);
393
425
  /**
394
- * This needs to run after messages are rendererd so we can manipulate the scroll bar.
426
+ * This needs to run after messages are rendered so we can manipulate the scroll bar.
395
427
  */
396
428
  useEffect(() => {
397
429
  // If user just sent the latest message then we assume we can move user to bottom of scroll.
@@ -418,12 +450,17 @@ export const MessageThread = (props) => {
418
450
  const strings = useMemo(() => (Object.assign(Object.assign({}, localeStrings), props.strings)), [localeStrings, props.strings]);
419
451
  // To rerender the defaultChatMessageRenderer if app running across days(every new day chat time stamp need to be regenerated)
420
452
  const defaultChatMessageRenderer = useCallback((messageProps) => {
421
- if (messageProps.message.messageType === 'chat') {
453
+ if (messageProps.message.messageType === 'chat' ||
454
+ /* @conditional-compile-remove(data-loss-prevention) */ messageProps.message.messageType === 'blocked') {
422
455
  return (React.createElement(ChatMessageComponent, Object.assign({}, messageProps, { onRenderFileDownloads: onRenderFileDownloads,
423
456
  /* @conditional-compile-remove(file-sharing) */
424
457
  strings: strings, message: messageProps.message, userId: props.userId, remoteParticipantsCount: participantCount ? participantCount - 1 : 0, inlineAcceptRejectEditButtons: !isNarrow, onRenderAvatar: onRenderAvatar, showMessageStatus: showMessageStatus, messageStatus: messageProps.message.status, onActionButtonClick: onActionButtonClickMemo,
425
458
  /* @conditional-compile-remove(date-time-customization) */
426
- onDisplayDateTimeString: onDisplayDateTimeString })));
459
+ onDisplayDateTimeString: onDisplayDateTimeString,
460
+ /* @conditional-compile-remove(teams-inline-images) */
461
+ onFetchAttachments: onFetchInlineAttachment,
462
+ /* @conditional-compile-remove(teams-inline-images) */
463
+ attachmentsMap: inlineAttachments })));
427
464
  }
428
465
  return React.createElement(React.Fragment, null);
429
466
  }, [
@@ -437,7 +474,11 @@ export const MessageThread = (props) => {
437
474
  showMessageStatus,
438
475
  onActionButtonClickMemo,
439
476
  /* @conditional-compile-remove(date-time-customization) */
440
- onDisplayDateTimeString
477
+ onDisplayDateTimeString,
478
+ /* @conditional-compile-remove(teams-inline-images) */
479
+ onFetchInlineAttachment,
480
+ /* @conditional-compile-remove(teams-inline-images) */
481
+ inlineAttachments
441
482
  ]);
442
483
  const defaultStatusRenderer = useCallback((message, status, participantCount, readCount) => {
443
484
  const onToggleToolTip = (isToggled) => {
@@ -457,8 +498,9 @@ export const MessageThread = (props) => {
457
498
  return messages.map((message, index) => {
458
499
  let key = message.messageId;
459
500
  let statusToRender = undefined;
460
- if (message.messageType === 'chat') {
461
- if (!message.messageId || message.messageId === '') {
501
+ if (message.messageType === 'chat' ||
502
+ /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked') {
503
+ if ((!message.messageId || message.messageId === '') && 'clientMessageId' in message) {
462
504
  key = message.clientMessageId;
463
505
  }
464
506
  if (showMessageStatus && message.mine) {
@@ -484,7 +526,10 @@ export const MessageThread = (props) => {
484
526
  return memoizedMessageFn(key !== null && key !== void 0 ? key : 'id_' + index, message, showMessageDate, showMessageStatus, onRenderAvatar, isNarrow, styles, onRenderMessageStatus, defaultStatusRenderer, defaultChatMessageRenderer, strings, theme,
485
527
  // Temporary solution to make sure we re-render if attach attribute is changed.
486
528
  // The proper fix should be in selector.
487
- message.messageType === 'chat' ? message.attached : undefined, statusToRender, participantCount, readCountForHoveredIndicator, onRenderMessage, onUpdateMessage, onDeleteMessage, onSendMessage, props.disableEditing);
529
+ message.messageType === 'chat' ||
530
+ /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked'
531
+ ? message.attached
532
+ : undefined, statusToRender, participantCount, readCountForHoveredIndicator, onRenderMessage, onUpdateMessage, onCancelMessageEdit, onDeleteMessage, onSendMessage, props.disableEditing);
488
533
  });
489
534
  }), [
490
535
  messages,
@@ -502,6 +547,7 @@ export const MessageThread = (props) => {
502
547
  readCountForHoveredIndicator,
503
548
  onRenderMessage,
504
549
  onUpdateMessage,
550
+ onCancelMessageEdit,
505
551
  onDeleteMessage,
506
552
  onSendMessage,
507
553
  lastSeenChatMessage,