@azure/communication-react 1.20.0-alpha-202409200015 → 1.20.0-alpha-202409250016

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 (162) hide show
  1. package/dist/communication-react.d.ts +20 -14
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bi4D1IU3.js → ChatMessageComponentAsRichTextEditBox-Dc9Pr0B5.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-Bi4D1IU3.js.map → ChatMessageComponentAsRichTextEditBox-Dc9Pr0B5.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-C__3v7Bo.js → RichTextSendBoxWrapper-BDmVvOJh.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-C__3v7Bo.js.map → RichTextSendBoxWrapper-BDmVvOJh.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-DHcnNHhY.js → index-DYKLGdvZ.js} +188 -364
  7. package/dist/dist-cjs/communication-react/index-DYKLGdvZ.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.d.ts +2 -2
  12. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  13. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js +1 -3
  14. package/dist/dist-esm/calling-component-bindings/src/callControlSelectors.js.map +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +0 -5
  16. package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
  17. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js +3 -12
  18. package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
  19. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js +2 -7
  20. package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.js.map +1 -1
  21. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +3 -0
  22. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js +8 -22
  23. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  24. package/dist/dist-esm/calling-component-bindings/src/incomingCallStackSelector.js.map +1 -1
  25. package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
  26. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js +3 -8
  27. package/dist/dist-esm/calling-component-bindings/src/participantListSelector.js.map +1 -1
  28. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +7 -3
  29. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js +8 -1
  30. package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.js.map +1 -1
  31. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +3 -2
  32. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +2 -4
  33. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  34. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +1 -6
  35. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  36. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  37. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +3 -3
  38. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  39. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +1 -1
  40. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  41. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +1 -1
  42. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -2
  43. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  44. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +0 -1
  45. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  46. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -1
  47. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +0 -4
  48. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -1
  49. package/dist/dist-esm/calling-stateful-client/src/UserFacingDiagnosticsSubscriber.js +2 -1
  50. package/dist/dist-esm/calling-stateful-client/src/UserFacingDiagnosticsSubscriber.js.map +1 -1
  51. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  52. package/dist/dist-esm/communication-react/src/index.js +0 -2
  53. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  54. package/dist/dist-esm/react-components/src/components/IncomingCallNotification.js +7 -30
  55. package/dist/dist-esm/react-components/src/components/IncomingCallNotification.js.map +1 -1
  56. package/dist/dist-esm/react-components/src/components/IncomingCallStack.js +1 -5
  57. package/dist/dist-esm/react-components/src/components/IncomingCallStack.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/InputBoxButton.d.ts +1 -1
  59. package/dist/dist-esm/react-components/src/components/InputBoxButton.js +8 -9
  60. package/dist/dist-esm/react-components/src/components/InputBoxButton.js.map +1 -1
  61. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +0 -2
  62. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  63. package/dist/dist-esm/react-components/src/components/ParticipantList.js +1 -4
  64. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  65. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +5 -7
  66. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
  67. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +14 -18
  68. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  69. package/dist/dist-esm/react-components/src/components/SendBox.js +11 -21
  70. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  71. package/dist/dist-esm/react-components/src/components/StreamMedia.d.ts +1 -1
  72. package/dist/dist-esm/react-components/src/components/StreamMedia.js +5 -3
  73. package/dist/dist-esm/react-components/src/components/StreamMedia.js.map +1 -1
  74. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +1 -6
  75. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  76. package/dist/dist-esm/react-components/src/components/VideoGallery.js +1 -3
  77. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +2 -0
  79. package/dist/dist-esm/react-components/src/components/VideoTile.js +3 -11
  80. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  81. package/dist/dist-esm/react-components/src/components/index.js +0 -2
  82. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  83. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +1 -4
  84. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +2 -4
  85. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  86. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.d.ts +8 -0
  87. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.js +27 -0
  88. package/dist/dist-esm/react-components/src/components/styles/StreamMedia.styles.js.map +1 -1
  89. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
  90. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +3 -3
  91. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  92. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
  93. package/dist/dist-esm/react-components/src/theming/icons.js +0 -8
  94. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  95. package/dist/dist-esm/react-components/src/types/OnRender.js.map +1 -1
  96. package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.d.ts +1 -1
  97. package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.js.map +1 -1
  98. package/dist/dist-esm/react-components/src/types/VideoGalleryParticipant.js.map +1 -1
  99. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +1 -7
  100. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  101. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  102. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -2
  103. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +2 -10
  104. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  105. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +2 -2
  106. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  107. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +3 -15
  108. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  109. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +2 -11
  110. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  111. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js +8 -23
  112. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/HoldPane.js.map +1 -1
  113. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js +1 -4
  114. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.js.map +1 -1
  115. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +0 -4
  116. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  117. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +0 -2
  118. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  119. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.js.map +1 -1
  120. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.d.ts +7 -8
  121. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.js +1 -7
  122. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.js.map +1 -1
  123. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +0 -3
  124. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  125. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +1 -1
  126. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +1 -8
  127. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  128. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/Strings.js.map +1 -1
  129. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -1
  130. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -15
  131. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  132. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +1 -1
  133. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  134. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +1 -1
  135. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +0 -6
  136. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  137. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +0 -1
  138. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  139. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.d.ts +1 -1
  140. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js +0 -2
  141. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
  142. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +3 -14
  143. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +1 -1
  144. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js +1 -3
  145. package/dist/dist-esm/react-composites/src/composites/common/AvatarPersona.js.map +1 -1
  146. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +1 -7
  147. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +1 -1
  148. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +6 -19
  149. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  150. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js +24 -22
  151. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/DesktopMoreButton.js.map +1 -1
  152. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +7 -5
  153. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  154. package/dist/dist-esm/react-composites/src/composites/common/Drawer/PreparedMoreDrawer.js.map +1 -1
  155. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +2 -13
  156. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  157. package/dist/dist-esm/react-composites/src/composites/common/icons.js +0 -4
  158. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  159. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +9 -4
  160. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
  161. package/package.json +1 -1
  162. package/dist/dist-cjs/communication-react/index-DHcnNHhY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextSendBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextSendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,mDAAmD;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAA8B,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACZ,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAC/B,gEAAgE;AAChE,OAAO,EAAE,qBAAqB,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAErG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO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,0BAA0B,EACrC,SAAS,EAAE,aAAa,CAAC,mBAAmB,EAC5C,cAAc,EAAE,aAAa,CAAC,mBAAmB,EACjD,YAAY,EAAE,gCAAgC,GAC9C,CACH,CAAC;IACJ,CAAC,EAAE,CAAC,gCAAgC,EAAE,aAAa,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEhH,mDAAmD;IACnD,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,2BAA2B,CAAC,WAAW,CAAC,IAAI,8BAA8B,CAAC,WAAW,CAAC,CAAC;IACjG,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,CACL,oBAAC,KAAK;QACJ,oBAAC,qBAAqB,oBAAK,kBAAkB,EAAI;QACjD,oBAAC,yBAAyB,IACxB,eAAe,EAAE,OAAO,CAAC,eAAe,EACxC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,kBAAkB,EAClC,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,UAAU,EAC5B,wBAAwB,EAAE,0BAA0B;YACpD,mDAAmD;YACnD,yBAAyB,EAAE,yBAAyB;YACpD,mDAAmD;YACnD,cAAc,EAAE,oBAAoB;YACpC,gEAAgE;YAChE,OAAO,EAAE,OAAO;YAChB,gEAAgE;YAChE,mBAAmB,EAAE,mBAAmB,GACxC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { RichTextInputBoxComponent } from './RichTextInputBoxComponent';\nimport { Icon, Stack } from '@fluentui/react';\nimport { useLocale } from '../../localization';\nimport { SendBoxStrings } from '../SendBox';\nimport { sendIconStyle } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { useV9CustomStyles } from '../styles/SendBox.styles';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { RichTextSendBoxErrors, RichTextSendBoxErrorsProps } from './RichTextSendBoxErrors';\nimport {\n isMessageTooLong,\n isSendBoxButtonAriaDisabled,\n sanitizeText,\n modifyInlineImagesInContentString\n} from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { hasInlineImageContent, getContentWithUpdatedInlineImagesInfo } from '../utils/SendBoxUtils';\nimport { RichTextEditorComponentRef } from './RichTextEditor';\nimport { useTheme } from '../../theming';\nimport { richTextActionButtonsStyle, sendBoxRichTextEditorStyle } from '../styles/RichTextEditor.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { _AttachmentUploadCards } from '../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport {\n isAttachmentUploadCompleted,\n hasIncompleteAttachmentUploads,\n toAttachmentMetadata\n} from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrorBarError } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { SendBoxErrorBarType } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { attachmentUploadCardsStyles } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { FluentV9ThemeProvider } from '../../theming/FluentV9ThemeProvider';\n\n/**\n * Strings of {@link RichTextSendBox} that can be overridden.\n *\n * @beta\n */\nexport interface RichTextSendBoxStrings extends RichTextStrings, SendBoxStrings {}\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor configuration.\n *\n * @beta\n */\nexport interface RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle paste event.\n */\n onPaste?: (event: { content: DocumentFragment }) => void;\n}\n\n/**\n * Strings of RichText that can be overridden.\n *\n * @beta\n */\nexport interface RichTextStrings {\n /**\n * Tooltip text for the bold button.\n */\n richTextBoldTooltip: string;\n /**\n * Tooltip text for the italic button.\n */\n richTextItalicTooltip: string;\n /**\n * Tooltip text for the underline button.\n */\n richTextUnderlineTooltip: string;\n /**\n * Tooltip text for the bullet list button.\n */\n richTextBulletListTooltip: string;\n /**\n * Tooltip text for the number list button.\n */\n richTextNumberListTooltip: string;\n /**\n * Tooltip text for the increase indent button.\n */\n richTextIncreaseIndentTooltip: string;\n /**\n * Tooltip text for the decrease indent button.\n */\n richTextDecreaseIndentTooltip: string;\n /**\n * Tooltip text insert table button.\n */\n richTextInsertTableTooltip: string;\n /**\n * Tooltip text for the rich text format button button.\n */\n richTextFormatButtonTooltip: string;\n /**\n * Text for the insert menu item.\n */\n richTextInsertRowOrColumnMenu: string;\n /**\n * Title for the insert table menu.\n */\n richTextInsertTableMenuTitle: string;\n /**\n * Text for the insert menu item to insert row above the current selection.\n */\n richTextInsertRowAboveMenu: string;\n /**\n * Text for the insert menu item to insert row below the current selection.\n */\n richTextInsertRowBelowMenu: string;\n /**\n * Text for the insert menu item to insert column to the left from the current selection.\n */\n richTextInsertColumnLeftMenu: string;\n /**\n * Text for the insert menu item to insert column to the right from the current selection.\n */\n richTextInsertColumnRightMenu: string;\n /**\n * Text for the delete row or column menu.\n */\n richTextDeleteRowOrColumnMenu: string;\n /**\n * Text for the delete column menu.\n */\n richTextDeleteColumnMenu: string;\n /**\n * Text for the delete row menu.\n */\n richTextDeleteRowMenu: string;\n /**\n * Text for the delete table menu.\n */\n richTextDeleteTableMenu: string;\n /**\n * Text for the rich text toolbar more button.\n */\n richTextToolbarMoreButtonAriaLabel: string;\n /**\n * Text for announcement when a new bulleted list item is added.\n */\n richTextNewBulletedListItemAnnouncement: string;\n /**\n * Text for announcement when a new numbered list item is added.\n */\n richTextNewNumberedListItemAnnouncement: string;\n /**\n * Text for announcement when the bulleted list style is applied.\n */\n richTextBulletedListAppliedAnnouncement: string;\n /**\n * Text for announcement when the numbered list style is applied.\n */\n richTextNumberedListAppliedAnnouncement: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating image upload is not complete.\n */\n imageUploadsPendingError: string;\n}\n\n/**\n * Props for {@link RichTextSendBox}.\n *\n * @beta\n */\nexport interface RichTextSendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle paste event.\n */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<RichTextSendBoxStrings>;\n /**\n * Optional text for system message above the text box\n */\n systemMessage?: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional array of type {@link AttachmentMetadataInProgress}\n * to render attachments being uploaded in the SendBox.\n * @beta\n */\n attachments?: AttachmentMetadataInProgress[];\n /**\n * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback invoked after inline image is removed from the UI.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].\n * Note that if the src attribute is a local blob url, it has been revoked at this point.\n */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>) => void;\n /**\n * Callback function used when the send button is clicked.\n */\n onSendMessage: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n /**\n * Optional callback called when user is typing\n */\n onTyping?: () => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle an inline image that's inserted in the rich text editor.\n * When not provided, pasting images into rich text editor will be disabled.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']\n */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Array of type {@link AttachmentMetadataInProgress}\n * to render the errorBar for inline images inserted in the RichTextSendBox when:\n * - there is an error provided in the inlineImagesWithProgress\n * - progress is less than 1 when the send button is clicked\n * - content html string is longer than the max allowed length.\n * (Note that the id and the url prop of the inlineImagesWithProgress will be used as the id and src attribute of the content html\n * when calculating the content length, only for the purpose of displaying the content length overflow error.)\n */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n}\n\n/**\n * A component to render SendBox with Rich Text Editor support.\n *\n * @beta\n */\nexport const RichTextSendBox = (props: RichTextSendBoxProps): JSX.Element => {\n const {\n disabled = false,\n systemMessage,\n autoFocus,\n onSendMessage,\n onTyping,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n /* @conditional-compile-remove(file-sharing-acs) */\n onCancelAttachmentUpload,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage\n } = props;\n\n const theme = useTheme();\n const locale = useLocale();\n\n const localeStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return locale.strings.richTextSendBox;\n return locale.strings.sendBox;\n }, [/* @conditional-compile-remove(rich-text-editor) */ locale.strings.richTextSendBox, locale.strings.sendBox]);\n\n const strings = useMemo(() => {\n return { ...localeStrings, ...props.strings };\n }, [localeStrings, props.strings]);\n\n const [contentValue, setContentValue] = useState('');\n const [contentValueOverflow, setContentValueOverflow] = useState(false);\n /* @conditional-compile-remove(file-sharing-acs) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n const editorComponentRef = useRef<RichTextEditorComponentRef>(null);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const customV9Styles = useV9CustomStyles();\n\n const contentTooLongMessage = useMemo(\n () => (contentValueOverflow ? strings.textTooLong : undefined),\n [contentValueOverflow, strings.textTooLong]\n );\n\n const setContent = useCallback((newValue?: string): void => {\n if (newValue === undefined) {\n return;\n }\n\n setContentValueOverflow(isMessageTooLong(newValue.length));\n setContentValue(newValue);\n }, []);\n\n const onChangeHandler = useCallback(\n (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n removedInlineImages?.forEach(\n (removedInlineImage: Record<string, string>) => onRemoveInlineImage && onRemoveInlineImage(removedInlineImage)\n );\n setContent(newValue);\n },\n [setContent, /* @conditional-compile-remove(rich-text-editor-image-upload) */ onRemoveInlineImage]\n );\n\n const hasContent = useMemo(() => {\n // get plain text content from the editor to check if the message is empty\n // as the content may contain tags even when the content is empty\n const plainTextContent = editorComponentRef.current?.getPlainContent();\n const hasPlainText = sanitizeText(contentValue ?? '').length > 0 && sanitizeText(plainTextContent ?? '').length > 0;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasInlineImages = hasInlineImageContent(contentValue);\n return hasPlainText || /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasInlineImages;\n }, [contentValue]);\n\n const sendMessageOnClick = useCallback((): void => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (inlineImagesWithProgress && inlineImagesWithProgress.length > 0) {\n const contentWithUpdatedInlineImagesInfo = getContentWithUpdatedInlineImagesInfo(\n contentValue,\n inlineImagesWithProgress\n );\n const messageTooLong = isMessageTooLong(contentWithUpdatedInlineImagesInfo.length);\n // Set contentValueOverflow state to display the error bar\n setContentValueOverflow(messageTooLong);\n // The change from the setContentValueOverflow in the previous line will not kick in yet.\n // We need to relay on the local value of messageTooLong to return early if the message is too long.\n if (messageTooLong) {\n return;\n }\n }\n if (disabled || contentValueOverflow) {\n return;\n }\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(file-sharing-acs) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasIncompleteImageUploads = hasIncompleteAttachmentUploads(inlineImagesWithProgress);\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (\n /* @conditional-compile-remove(file-sharing-acs) */ hasIncompleteAttachmentUploads(attachments) ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasIncompleteImageUploads\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n let errorMessage = strings.attachmentUploadsPendingError;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (hasIncompleteImageUploads) {\n errorMessage = strings.imageUploadsPendingError || '';\n }\n setAttachmentUploadsPendingError({\n message: errorMessage,\n timestamp: Date.now(),\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n errorBarType: SendBoxErrorBarType.info\n });\n return;\n }\n\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (hasContent || /* @conditional-compile-remove(file-sharing-acs) */ isAttachmentUploadCompleted(attachments)) {\n const sendMessage = (content: string): void => {\n onSendMessage(\n content,\n /* @conditional-compile-remove(file-sharing-acs) */ /* @conditional-compile-remove(rich-text-editor-composite-support) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments: toAttachmentMetadata(attachments),\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n type: 'html'\n }\n );\n setContentValue('');\n editorComponentRef.current?.setEmptyContent();\n editorComponentRef.current?.focus();\n };\n\n modifyInlineImagesInContentString(contentValue, [], (content: string) => {\n sendMessage(content);\n });\n }\n }, [\n disabled,\n contentValueOverflow,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n contentValue,\n hasContent,\n /* @conditional-compile-remove(file-sharing-acs) */\n strings.attachmentUploadsPendingError,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n strings.imageUploadsPendingError,\n onSendMessage\n ]);\n\n const hasErrorMessage = useMemo(() => {\n return (\n !!systemMessage ||\n !!contentTooLongMessage ||\n /* @conditional-compile-remove(file-sharing-acs) */\n !!attachmentUploadsPendingError ||\n /* @conditional-compile-remove(file-sharing-acs) */\n !!attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n !!inlineImagesWithProgress?.filter((image) => image.error).pop()?.error\n );\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n contentTooLongMessage,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError,\n systemMessage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress\n ]);\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) => {\n return (\n <Icon\n iconName={isHover && hasContent ? 'SendBoxSendHovered' : 'SendBoxSend'}\n className={sendIconStyle({\n theme,\n hasText: hasContent,\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachment: false,\n hasErrorMessage: hasErrorMessage,\n defaultTextColor: theme.palette.neutralSecondary,\n disabled: disabled\n })}\n />\n );\n },\n [disabled, hasContent, hasErrorMessage, theme]\n );\n\n const sendBoxErrorsProps: RichTextSendBoxErrorsProps = useMemo(() => {\n /* @conditional-compile-remove(file-sharing-acs) */\n const uploadErrorMessage = attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error?.message;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageUploadErrorMessage = inlineImagesWithProgress?.filter((image) => image.error).pop()?.error?.message;\n /* @conditional-compile-remove(file-sharing-acs) */\n const errorMessage =\n uploadErrorMessage || /* @conditional-compile-remove(rich-text-editor-image-upload) */ imageUploadErrorMessage;\n return {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentProgressError: errorMessage\n ? {\n message: errorMessage,\n timestamp: Date.now(),\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n errorBarType: SendBoxErrorBarType.error\n }\n : undefined,\n systemMessage: systemMessage,\n textTooLongMessage: contentTooLongMessage\n };\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n contentTooLongMessage,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n systemMessage\n ]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme} className={customV9Styles.clearBackground}>\n <_AttachmentUploadCards\n attachments={attachments}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n strings={{\n removeAttachment: strings.removeAttachment,\n uploading: strings.uploading,\n uploadCompleted: strings.uploadCompleted,\n attachmentMoreMenu: strings.attachmentMoreMenu\n }}\n disabled={disabled}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n theme,\n customV9Styles.clearBackground,\n attachments,\n onCancelAttachmentUpload,\n strings.removeAttachment,\n strings.uploading,\n strings.uploadCompleted,\n strings.attachmentMoreMenu,\n disabled\n ]);\n\n const isSendBoxButtonAriaDisabledValue = useMemo(() => {\n return isSendBoxButtonAriaDisabled({\n hasContent,\n /* @conditional-compile-remove(file-sharing-acs) */ hasCompletedAttachmentUploads:\n isAttachmentUploadCompleted(attachments),\n hasError: hasErrorMessage,\n disabled\n });\n }, [/* @conditional-compile-remove(file-sharing-acs) */ attachments, disabled, hasContent, hasErrorMessage]);\n\n const sendButton = useMemo(() => {\n return (\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n sendMessageOnClick();\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n className={richTextActionButtonsStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n ariaDisabled={isSendBoxButtonAriaDisabledValue}\n />\n );\n }, [isSendBoxButtonAriaDisabledValue, localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasAttachmentUploads = useMemo(() => {\n return isAttachmentUploadCompleted(attachments) || hasIncompleteAttachmentUploads(attachments);\n }, [attachments]);\n\n return (\n <Stack>\n <RichTextSendBoxErrors {...sendBoxErrorsProps} />\n <RichTextInputBoxComponent\n placeholderText={strings.placeholderText}\n autoFocus={autoFocus}\n onChange={onChangeHandler}\n onEnterKeyDown={sendMessageOnClick}\n onTyping={onTyping}\n editorComponentRef={editorComponentRef}\n strings={strings}\n disabled={disabled}\n actionComponents={sendButton}\n richTextEditorStyleProps={sendBoxRichTextEditorStyle}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments={hasAttachmentUploads}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={onInsertInlineImage}\n />\n </Stack>\n );\n};\n"]}
1
+ {"version":3,"file":"RichTextSendBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextSendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QA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kB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,UAAU,EAC5B,wBAAwB,EAAE,0BAA0B;YACpD,mDAAmD;YACnD,yBAAyB,EAAE,yBAAyB;YACpD,mDAAmD;YACnD,cAAc,EAAE,oBAAoB;YACpC,gEAAgE;YAChE,OAAO,EAAE,OAAO;YAChB,gEAAgE;YAChE,mBAAmB,EAAE,mBAAmB,GACxC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { RichTextInputBoxComponent } from './RichTextInputBoxComponent';\nimport { Icon, Stack } from '@fluentui/react';\nimport { useLocale } from '../../localization';\nimport { SendBoxStrings } from '../SendBox';\nimport { sendIconStyle } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { useV9CustomStyles } from '../styles/SendBox.styles';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { RichTextSendBoxErrors, RichTextSendBoxErrorsProps } from './RichTextSendBoxErrors';\nimport {\n isMessageTooLong,\n isSendBoxButtonDisabled,\n sanitizeText,\n modifyInlineImagesInContentString\n} from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { hasInlineImageContent, getContentWithUpdatedInlineImagesInfo } from '../utils/SendBoxUtils';\nimport { RichTextEditorComponentRef } from './RichTextEditor';\nimport { useTheme } from '../../theming';\nimport { richTextActionButtonsStyle, sendBoxRichTextEditorStyle } from '../styles/RichTextEditor.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { _AttachmentUploadCards } from '../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport {\n isAttachmentUploadCompleted,\n hasIncompleteAttachmentUploads,\n toAttachmentMetadata\n} from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrorBarError } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { SendBoxErrorBarType } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { attachmentUploadCardsStyles } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { FluentV9ThemeProvider } from '../../theming/FluentV9ThemeProvider';\n\n/**\n * Strings of {@link RichTextSendBox} that can be overridden.\n *\n * @beta\n */\nexport interface RichTextSendBoxStrings extends RichTextStrings, SendBoxStrings {}\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * Options for the rich text editor configuration.\n *\n * @beta\n */\nexport interface RichTextEditorOptions {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle paste event.\n */\n onPaste?: (event: { content: DocumentFragment }) => void;\n}\n\n/**\n * Strings of RichText that can be overridden.\n *\n * @beta\n */\nexport interface RichTextStrings {\n /**\n * Tooltip text for the bold button.\n */\n richTextBoldTooltip: string;\n /**\n * Tooltip text for the italic button.\n */\n richTextItalicTooltip: string;\n /**\n * Tooltip text for the underline button.\n */\n richTextUnderlineTooltip: string;\n /**\n * Tooltip text for the bullet list button.\n */\n richTextBulletListTooltip: string;\n /**\n * Tooltip text for the number list button.\n */\n richTextNumberListTooltip: string;\n /**\n * Tooltip text for the increase indent button.\n */\n richTextIncreaseIndentTooltip: string;\n /**\n * Tooltip text for the decrease indent button.\n */\n richTextDecreaseIndentTooltip: string;\n /**\n * Tooltip text insert table button.\n */\n richTextInsertTableTooltip: string;\n /**\n * Tooltip text for the rich text format button button.\n */\n richTextFormatButtonTooltip: string;\n /**\n * Text for the insert menu item.\n */\n richTextInsertRowOrColumnMenu: string;\n /**\n * Title for the insert table menu.\n */\n richTextInsertTableMenuTitle: string;\n /**\n * Text for the insert menu item to insert row above the current selection.\n */\n richTextInsertRowAboveMenu: string;\n /**\n * Text for the insert menu item to insert row below the current selection.\n */\n richTextInsertRowBelowMenu: string;\n /**\n * Text for the insert menu item to insert column to the left from the current selection.\n */\n richTextInsertColumnLeftMenu: string;\n /**\n * Text for the insert menu item to insert column to the right from the current selection.\n */\n richTextInsertColumnRightMenu: string;\n /**\n * Text for the delete row or column menu.\n */\n richTextDeleteRowOrColumnMenu: string;\n /**\n * Text for the delete column menu.\n */\n richTextDeleteColumnMenu: string;\n /**\n * Text for the delete row menu.\n */\n richTextDeleteRowMenu: string;\n /**\n * Text for the delete table menu.\n */\n richTextDeleteTableMenu: string;\n /**\n * Text for the rich text toolbar more button.\n */\n richTextToolbarMoreButtonAriaLabel: string;\n /**\n * Text for announcement when a new bulleted list item is added.\n */\n richTextNewBulletedListItemAnnouncement: string;\n /**\n * Text for announcement when a new numbered list item is added.\n */\n richTextNewNumberedListItemAnnouncement: string;\n /**\n * Text for announcement when the bulleted list style is applied.\n */\n richTextBulletedListAppliedAnnouncement: string;\n /**\n * Text for announcement when the numbered list style is applied.\n */\n richTextNumberedListAppliedAnnouncement: string;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Error message indicating image upload is not complete.\n */\n imageUploadsPendingError: string;\n}\n\n/**\n * Props for {@link RichTextSendBox}.\n *\n * @beta\n */\nexport interface RichTextSendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle paste event.\n */\n onPaste?: (event: { content: DocumentFragment }) => void;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<RichTextSendBoxStrings>;\n /**\n * Optional text for system message above the text box\n */\n systemMessage?: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional array of type {@link AttachmentMetadataInProgress}\n * to render attachments being uploaded in the SendBox.\n * @beta\n */\n attachments?: AttachmentMetadataInProgress[];\n /**\n * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback invoked after inline image is removed from the UI.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name'].\n * Note that if the src attribute is a local blob url, it has been revoked at this point.\n */\n onRemoveInlineImage?: (imageAttributes: Record<string, string>) => void;\n /**\n * Callback function used when the send button is clicked.\n */\n onSendMessage: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n /**\n * Optional callback called when user is typing\n */\n onTyping?: () => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional callback to handle an inline image that's inserted in the rich text editor.\n * When not provided, pasting images into rich text editor will be disabled.\n * @param imageAttributes - attributes of the image such as id, src, style, etc.\n * It also contains the image file name which can be accessed through imageAttributes['data-image-file-name']\n */\n onInsertInlineImage?: (imageAttributes: Record<string, string>) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Optional Array of type {@link AttachmentMetadataInProgress}\n * to render the errorBar for inline images inserted in the RichTextSendBox when:\n * - there is an error provided in the inlineImagesWithProgress\n * - progress is less than 1 when the send button is clicked\n * - content html string is longer than the max allowed length.\n * (Note that the id and the url prop of the inlineImagesWithProgress will be used as the id and src attribute of the content html\n * when calculating the content length, only for the purpose of displaying the content length overflow error.)\n */\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n}\n\n/**\n * A component to render SendBox with Rich Text Editor support.\n *\n * @beta\n */\nexport const RichTextSendBox = (props: RichTextSendBoxProps): JSX.Element => {\n const {\n disabled = false,\n systemMessage,\n autoFocus,\n onSendMessage,\n onTyping,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n /* @conditional-compile-remove(file-sharing-acs) */\n onCancelAttachmentUpload,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onRemoveInlineImage\n } = props;\n\n const theme = useTheme();\n const locale = useLocale();\n\n const localeStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return locale.strings.richTextSendBox;\n return locale.strings.sendBox;\n }, [/* @conditional-compile-remove(rich-text-editor) */ locale.strings.richTextSendBox, locale.strings.sendBox]);\n\n const strings = useMemo(() => {\n return { ...localeStrings, ...props.strings };\n }, [localeStrings, props.strings]);\n\n const [contentValue, setContentValue] = useState('');\n const [contentValueOverflow, setContentValueOverflow] = useState(false);\n /* @conditional-compile-remove(file-sharing-acs) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n const editorComponentRef = useRef<RichTextEditorComponentRef>(null);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const customV9Styles = useV9CustomStyles();\n\n const contentTooLongMessage = useMemo(\n () => (contentValueOverflow ? strings.textTooLong : undefined),\n [contentValueOverflow, strings.textTooLong]\n );\n\n const setContent = useCallback((newValue?: string): void => {\n if (newValue === undefined) {\n return;\n }\n\n setContentValueOverflow(isMessageTooLong(newValue.length));\n setContentValue(newValue);\n }, []);\n\n const onChangeHandler = useCallback(\n (\n newValue?: string,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ removedInlineImages?: Record<string, string>[]\n ) => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n removedInlineImages?.forEach(\n (removedInlineImage: Record<string, string>) => onRemoveInlineImage && onRemoveInlineImage(removedInlineImage)\n );\n setContent(newValue);\n },\n [setContent, /* @conditional-compile-remove(rich-text-editor-image-upload) */ onRemoveInlineImage]\n );\n\n const hasContent = useMemo(() => {\n // get plain text content from the editor to check if the message is empty\n // as the content may contain tags even when the content is empty\n const plainTextContent = editorComponentRef.current?.getPlainContent();\n const hasPlainText = sanitizeText(contentValue ?? '').length > 0 && sanitizeText(plainTextContent ?? '').length > 0;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasInlineImages = hasInlineImageContent(contentValue);\n return hasPlainText || /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasInlineImages;\n }, [contentValue]);\n\n const sendMessageOnClick = useCallback((): void => {\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (inlineImagesWithProgress && inlineImagesWithProgress.length > 0) {\n const contentWithUpdatedInlineImagesInfo = getContentWithUpdatedInlineImagesInfo(\n contentValue,\n inlineImagesWithProgress\n );\n const messageTooLong = isMessageTooLong(contentWithUpdatedInlineImagesInfo.length);\n // Set contentValueOverflow state to display the error bar\n setContentValueOverflow(messageTooLong);\n // The change from the setContentValueOverflow in the previous line will not kick in yet.\n // We need to relay on the local value of messageTooLong to return early if the message is too long.\n if (messageTooLong) {\n return;\n }\n }\n if (disabled || contentValueOverflow) {\n return;\n }\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(file-sharing-acs) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const hasIncompleteImageUploads = hasIncompleteAttachmentUploads(inlineImagesWithProgress);\n /* @conditional-compile-remove(file-sharing-acs) */\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (\n /* @conditional-compile-remove(file-sharing-acs) */ hasIncompleteAttachmentUploads(attachments) ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */ hasIncompleteImageUploads\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n let errorMessage = strings.attachmentUploadsPendingError;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n if (hasIncompleteImageUploads) {\n errorMessage = strings.imageUploadsPendingError || '';\n }\n setAttachmentUploadsPendingError({\n message: errorMessage,\n timestamp: Date.now(),\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n errorBarType: SendBoxErrorBarType.info\n });\n return;\n }\n\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (hasContent || /* @conditional-compile-remove(file-sharing-acs) */ isAttachmentUploadCompleted(attachments)) {\n const sendMessage = (content: string): void => {\n onSendMessage(\n content,\n /* @conditional-compile-remove(file-sharing-acs) */ /* @conditional-compile-remove(rich-text-editor-composite-support) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments: toAttachmentMetadata(attachments),\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n type: 'html'\n }\n );\n setContentValue('');\n editorComponentRef.current?.setEmptyContent();\n editorComponentRef.current?.focus();\n };\n\n modifyInlineImagesInContentString(contentValue, [], (content: string) => {\n sendMessage(content);\n });\n }\n }, [\n disabled,\n contentValueOverflow,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n contentValue,\n hasContent,\n /* @conditional-compile-remove(file-sharing-acs) */\n strings.attachmentUploadsPendingError,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n strings.imageUploadsPendingError,\n onSendMessage\n ]);\n\n const hasErrorMessage = useMemo(() => {\n return (\n !!systemMessage ||\n !!contentTooLongMessage ||\n /* @conditional-compile-remove(file-sharing-acs) */\n !!attachmentUploadsPendingError ||\n /* @conditional-compile-remove(file-sharing-acs) */\n !!attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error ||\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n !!inlineImagesWithProgress?.filter((image) => image.error).pop()?.error\n );\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n contentTooLongMessage,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError,\n systemMessage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress\n ]);\n\n const isSendBoxButtonDisabledValue = useMemo(() => {\n return isSendBoxButtonDisabled({\n hasContent,\n /* @conditional-compile-remove(file-sharing-acs) */ hasCompletedAttachmentUploads:\n isAttachmentUploadCompleted(attachments),\n hasError: hasErrorMessage,\n disabled\n });\n }, [/* @conditional-compile-remove(file-sharing-acs) */ attachments, disabled, hasContent, hasErrorMessage]);\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) => {\n return (\n <Icon\n iconName={isHover && hasContent ? 'SendBoxSendHovered' : 'SendBoxSend'}\n className={sendIconStyle({\n theme,\n isSendBoxButtonDisabled: isSendBoxButtonDisabledValue,\n defaultTextColor: theme.palette.neutralSecondary\n })}\n />\n );\n },\n [theme, isSendBoxButtonDisabledValue, hasContent]\n );\n\n const sendBoxErrorsProps: RichTextSendBoxErrorsProps = useMemo(() => {\n /* @conditional-compile-remove(file-sharing-acs) */\n const uploadErrorMessage = attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error?.message;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const imageUploadErrorMessage = inlineImagesWithProgress?.filter((image) => image.error).pop()?.error?.message;\n /* @conditional-compile-remove(file-sharing-acs) */\n const errorMessage =\n uploadErrorMessage || /* @conditional-compile-remove(rich-text-editor-image-upload) */ imageUploadErrorMessage;\n return {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentProgressError: errorMessage\n ? {\n message: errorMessage,\n timestamp: Date.now(),\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n errorBarType: SendBoxErrorBarType.error\n }\n : undefined,\n systemMessage: systemMessage,\n textTooLongMessage: contentTooLongMessage\n };\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n contentTooLongMessage,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachmentUploadsPendingError,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n inlineImagesWithProgress,\n systemMessage\n ]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme} className={customV9Styles.clearBackground}>\n <_AttachmentUploadCards\n attachments={attachments}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n strings={{\n removeAttachment: strings.removeAttachment,\n uploading: strings.uploading,\n uploadCompleted: strings.uploadCompleted,\n attachmentMoreMenu: strings.attachmentMoreMenu\n }}\n disabled={disabled}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n theme,\n customV9Styles.clearBackground,\n attachments,\n onCancelAttachmentUpload,\n strings.removeAttachment,\n strings.uploading,\n strings.uploadCompleted,\n strings.attachmentMoreMenu,\n disabled\n ]);\n\n const sendButton = useMemo(() => {\n return (\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n sendMessageOnClick();\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n className={richTextActionButtonsStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n disabled={isSendBoxButtonDisabledValue}\n />\n );\n }, [isSendBoxButtonDisabledValue, localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const hasAttachmentUploads = useMemo(() => {\n return isAttachmentUploadCompleted(attachments) || hasIncompleteAttachmentUploads(attachments);\n }, [attachments]);\n\n return (\n <Stack>\n <RichTextSendBoxErrors {...sendBoxErrorsProps} />\n <RichTextInputBoxComponent\n placeholderText={strings.placeholderText}\n autoFocus={autoFocus}\n onChange={onChangeHandler}\n onEnterKeyDown={sendMessageOnClick}\n onTyping={onTyping}\n editorComponentRef={editorComponentRef}\n strings={strings}\n disabled={disabled}\n actionComponents={sendButton}\n richTextEditorStyleProps={sendBoxRichTextEditorStyle}\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n /* @conditional-compile-remove(file-sharing-acs) */\n hasAttachments={hasAttachmentUploads}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onPaste={onPaste}\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onInsertInlineImage={onInsertInlineImage}\n />\n </Stack>\n );\n};\n"]}
@@ -18,7 +18,7 @@ import { _AttachmentUploadCards } from './Attachment/AttachmentUploadCards';
18
18
  import { attachmentUploadCardsStyles } from './styles/SendBox.styles';
19
19
  /* @conditional-compile-remove(file-sharing-acs) */
20
20
  import { isAttachmentUploadCompleted, hasIncompleteAttachmentUploads, toAttachmentMetadata } from './utils/SendBoxUtils';
21
- import { MAXIMUM_LENGTH_OF_MESSAGE, isMessageTooLong, sanitizeText, isSendBoxButtonAriaDisabled } from './utils/SendBoxUtils';
21
+ import { MAXIMUM_LENGTH_OF_MESSAGE, isMessageTooLong, sanitizeText, isSendBoxButtonDisabled } from './utils/SendBoxUtils';
22
22
  /* @conditional-compile-remove(file-sharing-acs) */
23
23
  import { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';
24
24
  /**
@@ -87,25 +87,8 @@ export const SendBox = (props) => {
87
87
  };
88
88
  const textTooLongMessage = textValueOverflow ? strings.textTooLong : undefined;
89
89
  const errorMessage = systemMessage !== null && systemMessage !== void 0 ? systemMessage : textTooLongMessage;
90
- const mergedSendButtonStyle = useMemo(() => mergeStyles(sendButtonStyle, styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer), [styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer]);
91
- const mergedStyles = useMemo(() => concatStyleSets(styles), [styles]);
92
- const mergedSendIconStyle = useMemo(() => sendIconStyle({
93
- theme,
94
- hasText: sanitizeText(textValue).length > 0,
95
- /* @conditional-compile-remove(file-sharing-acs) */ hasAttachment: isAttachmentUploadCompleted(attachments),
96
- hasErrorMessage: !!errorMessage,
97
- customSendIconStyle: styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon,
98
- disabled: !!disabled
99
- }), [
100
- theme,
101
- textValue,
102
- /* @conditional-compile-remove(file-sharing-acs) */ attachments,
103
- errorMessage,
104
- styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon,
105
- disabled
106
- ]);
107
- const isSendBoxButtonAriaDisabledValue = useMemo(() => {
108
- return isSendBoxButtonAriaDisabled({
90
+ const isSendBoxButtonDisabledValue = useMemo(() => {
91
+ return isSendBoxButtonDisabled({
109
92
  hasContent: sanitizeText(textValue).length > 0,
110
93
  /* @conditional-compile-remove(file-sharing-acs) */ hasCompletedAttachmentUploads: isAttachmentUploadCompleted(attachments),
111
94
  hasError: !!errorMessage,
@@ -118,6 +101,13 @@ export const SendBox = (props) => {
118
101
  errorMessage,
119
102
  textValue
120
103
  ]);
104
+ const mergedSendButtonStyle = useMemo(() => mergeStyles(sendButtonStyle, styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer), [styles === null || styles === void 0 ? void 0 : styles.sendMessageIconContainer]);
105
+ const mergedStyles = useMemo(() => concatStyleSets(styles), [styles]);
106
+ const mergedSendIconStyle = useMemo(() => sendIconStyle({
107
+ theme,
108
+ isSendBoxButtonDisabled: isSendBoxButtonDisabledValue,
109
+ customSendIconStyle: styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon
110
+ }), [theme, isSendBoxButtonDisabledValue, styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon]);
121
111
  const onRenderSendIcon = useCallback((isHover) => onRenderIcon ? (onRenderIcon(isHover)) : (React.createElement(Icon, { iconName: isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend', className: mergedSendIconStyle })), [mergedSendIconStyle, onRenderIcon, textValue]);
122
112
  // Ensure that errors are cleared when there are no attachments in sendBox
123
113
  /* @conditional-compile-remove(file-sharing-acs) */
@@ -188,7 +178,7 @@ export const SendBox = (props) => {
188
178
  sendMessageOnClick();
189
179
  }
190
180
  e.stopPropagation();
191
- }, id: 'sendIconWrapper', className: mergedSendButtonStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel, ariaDisabled: isSendBoxButtonAriaDisabledValue })),
181
+ }, id: 'sendIconWrapper', className: mergedSendButtonStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel, disabled: isSendBoxButtonDisabledValue })),
192
182
  /* @conditional-compile-remove(file-sharing-acs) */
193
183
  onRenderAttachmentUploads())));
194
184
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SendBox.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/SendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAsB,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACxH,mDAAmD;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,mDAAmD;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,mDAAmD;AACnD,OAAO,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ACpC,0CAA0C;gBAC1C,oBAAoB,EAAE,oBAAoB;gBAE1C,oBAAC,cAAc,IACb,YAAY,EAAE,gBAAgB,EAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wBACb,IAAI,CAAC,iBAAiB,EAAE,CAAC;4BACvB,kBAAkB,EAAE,CAAC;wBACvB,CAAC;wBACD,CAAC,CAAC,eAAe,EAAE,CAAC;oBACtB,CAAC,EACD,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,qBAAqB,EAChC,SAAS,EAAE,aAAa,CAAC,mBAAmB,EAC5C,cAAc,EAAE,aAAa,CAAC,mBAAmB,EACjD,YAAY,EAAE,gCAAgC,GAC9C,CACgB;YAElB,mDAAmD;YACnD,yBAAyB,EAAE,CAEvB,CACF,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useMemo, useCallback } from 'react';\nimport { IStyle, ITextField, mergeStyles, concatStyleSets, Icon, Stack } from '@fluentui/react';\nimport { sendButtonStyle, sendIconStyle, sendBoxWrapperStyles, borderAndBoxShadowStyle } from './styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { useV9CustomStyles } from './styles/SendBox.styles';\nimport { BaseCustomStyles } from '../types';\nimport { useTheme } from '../theming';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { InputBoxComponent } from './InputBoxComponent';\nimport { InputBoxButton } from './InputBoxButton';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrors } from './SendBoxErrors';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { _AttachmentUploadCards } from './Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { attachmentUploadCardsStyles } from './styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrorBarError } from './SendBoxErrorBar';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport {\n isAttachmentUploadCompleted,\n hasIncompleteAttachmentUploads,\n toAttachmentMetadata\n} from './utils/SendBoxUtils';\nimport {\n MAXIMUM_LENGTH_OF_MESSAGE,\n isMessageTooLong,\n sanitizeText,\n isSendBoxButtonAriaDisabled\n} from './utils/SendBoxUtils';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from './MentionPopover';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';\n\n/**\n * Fluent styles for {@link Sendbox}.\n *\n * @public\n */\nexport interface SendBoxStylesProps extends BaseCustomStyles {\n /** Styles for the text field. */\n textField?: IStyle;\n /** styles for the text field container */\n textFieldContainer?: 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 {@link SendBox} that can be overridden.\n *\n * @public\n */\nexport interface SendBoxStrings {\n /**\n * Placeholder text in SendBox when there is no user input\n */\n placeholderText: string;\n /**\n * The warning message when send box text length is more than max limit\n */\n textTooLong: string;\n /**\n * Aria label for send message button\n */\n sendButtonAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user when focus is on cancel attachment upload button.\n */\n removeAttachment: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user attachment uploading starts.\n */\n uploading: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user attachment is uploaded.\n */\n uploadCompleted: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user more attachment action menu.\n */\n attachmentMoreMenu: string;\n}\n\n/**\n * Props for {@link SendBox}.\n *\n * @public\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 override behavior on send button click\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup suggestions in the mention scenario.\n * @beta\n */\n mentionLookupOptions?: MentionLookupOptions;\n\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 SendBoxSendHovered icon when mouse over icon and SendBoxSend icon otherwise\n */\n onRenderIcon?: (isHover: 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 * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render uploaded attachments in the SendBox. The sendBox will expand\n * vertically to accommodate the uploaded attachments. Attachment uploads will\n * be rendered below the text area in sendBox.\n * @beta\n */\n onRenderAttachmentUploads?: () => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional array of type {@link AttachmentMetadataInProgress}\n * to render attachments being uploaded in the SendBox.\n * @beta\n */\n attachments?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n}\n\n/**\n * Component for typing and sending messages.\n *\n * Supports sending typing notification when user starts entering text.\n * Supports an optional message below the text input field.\n *\n * @public\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 autoFocus,\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments\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 /* @conditional-compile-remove(file-sharing-acs) */\n const customV9Styles = useV9CustomStyles();\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n\n const sendMessageOnClick = (): void => {\n // don't send a message when disabled\n if (disabled || textValueOverflow) {\n return;\n }\n\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(file-sharing-acs) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n if (hasIncompleteAttachmentUploads(attachments)) {\n setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = textValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(file-sharing-acs) */ isAttachmentUploadCompleted(attachments)\n ) {\n onSendMessage &&\n onSendMessage(\n message,\n /* @conditional-compile-remove(file-sharing-acs) */ /* @conditional-compile-remove(rich-text-editor-composite-support) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments: toAttachmentMetadata(attachments),\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n type: 'text'\n }\n );\n setTextValue('');\n sendTextFieldRef.current?.focus();\n }\n };\n\n const setText = (newValue?: string | undefined): void => {\n if (newValue === undefined) {\n return;\n }\n\n setTextValueOverflow(isMessageTooLong(newValue.length));\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? strings.textTooLong : 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(styles), [styles]);\n\n const mergedSendIconStyle = useMemo(\n () =>\n sendIconStyle({\n theme,\n hasText: sanitizeText(textValue).length > 0,\n /* @conditional-compile-remove(file-sharing-acs) */ hasAttachment: isAttachmentUploadCompleted(attachments),\n hasErrorMessage: !!errorMessage,\n customSendIconStyle: styles?.sendMessageIcon,\n disabled: !!disabled\n }),\n [\n theme,\n textValue,\n /* @conditional-compile-remove(file-sharing-acs) */ attachments,\n errorMessage,\n styles?.sendMessageIcon,\n disabled\n ]\n );\n\n const isSendBoxButtonAriaDisabledValue = useMemo(() => {\n return isSendBoxButtonAriaDisabled({\n hasContent: sanitizeText(textValue).length > 0,\n /* @conditional-compile-remove(file-sharing-acs) */ hasCompletedAttachmentUploads:\n isAttachmentUploadCompleted(attachments),\n hasError: !!errorMessage,\n disabled: !!disabled\n });\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n disabled,\n errorMessage,\n textValue\n ]);\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) =>\n onRenderIcon ? (\n onRenderIcon(isHover)\n ) : (\n <Icon iconName={isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend'} className={mergedSendIconStyle} />\n ),\n [mergedSendIconStyle, onRenderIcon, textValue]\n );\n\n // Ensure that errors are cleared when there are no attachments in sendBox\n /* @conditional-compile-remove(file-sharing-acs) */\n React.useEffect(() => {\n if (!attachments?.filter((upload) => !upload.error).length) {\n setAttachmentUploadsPendingError(undefined);\n }\n }, [attachments]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const sendBoxErrorsProps = useMemo(() => {\n return {\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n attachmentProgressError: attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error\n };\n }, [attachments, attachmentUploadsPendingError]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentUploads = useCallback(() => {\n if (!attachments?.filter((upload) => !upload.error).length) {\n return null;\n }\n return props.onRenderAttachmentUploads ? (\n props.onRenderAttachmentUploads()\n ) : (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme} className={customV9Styles.clearBackground}>\n <_AttachmentUploadCards\n attachments={attachments}\n onCancelAttachmentUpload={props.onCancelAttachmentUpload}\n strings={{\n removeAttachment: props.strings?.removeAttachment ?? localeStrings.removeAttachment,\n uploading: props.strings?.uploading ?? localeStrings.uploading,\n uploadCompleted: props.strings?.uploadCompleted ?? localeStrings.uploadCompleted,\n attachmentMoreMenu: props.strings?.attachmentMoreMenu ?? localeStrings.attachmentMoreMenu\n }}\n disabled={disabled}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n attachments,\n props,\n theme,\n customV9Styles.clearBackground,\n localeStrings.removeAttachment,\n localeStrings.uploading,\n localeStrings.uploadCompleted,\n localeStrings.attachmentMoreMenu,\n disabled\n ]);\n\n return (\n <Stack\n className={mergeStyles(\n sendBoxWrapperStyles,\n { overflow: 'visible' } // This is needed for the mention popup to be visible\n )}\n >\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n <SendBoxErrors\n attachmentProgressError={\n sendBoxErrorsProps.attachmentProgressError\n ? {\n message: sendBoxErrorsProps.attachmentProgressError.message,\n timestamp: Date.now()\n }\n : undefined\n }\n attachmentUploadsPendingError={sendBoxErrorsProps.attachmentUploadsPendingError}\n />\n }\n <Stack\n className={borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: !!errorMessage,\n disabled: !!disabled\n })}\n >\n <InputBoxComponent\n autoFocus={autoFocus}\n data-ui-id={ids.sendboxTextField}\n disabled={disabled}\n errorMessage={onRenderSystemMessage ? onRenderSystemMessage(errorMessage) : errorMessage}\n textFieldRef={sendTextFieldRef}\n id=\"sendbox\"\n placeholderText={strings.placeholderText}\n textValue={textValue}\n onChange={(_, newValue) => setText(newValue)}\n onKeyDown={(ev) => {\n const keyWasSendingMessage = ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline);\n if (!keyWasSendingMessage) {\n onTyping?.();\n }\n }}\n onEnterKeyDown={() => {\n sendMessageOnClick();\n }}\n styles={mergedStyles}\n supportNewline={supportNewline}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\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 ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n ariaDisabled={isSendBoxButtonAriaDisabledValue}\n />\n </InputBoxComponent>\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads()\n }\n </Stack>\n </Stack>\n );\n};\n"]}
1
+ {"version":3,"file":"SendBox.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/SendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9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EAC5C,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE;oBAChB,MAAM,oBAAoB,GAAG,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC9F,IAAI,CAAC,oBAAoB,EAAE,CAAC;wBAC1B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,EAAI,CAAC;oBACf,CAAC;gBACH,CAAC,EACD,cAAc,EAAE,GAAG,EAAE;oBACnB,kBAAkB,EAAE,CAAC;gBACvB,CAAC,EACD,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,yBAAyB;gBACpC,0CAA0C;gBAC1C,oBAAoB,EAAE,oBAAoB;gBAE1C,oBAAC,cAAc,IACb,YAAY,EAAE,gBAAgB,EAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wBACb,IAAI,CAAC,iBAAiB,EAAE,CAAC;4BACvB,kBAAkB,EAAE,CAAC;wBACvB,CAAC;wBACD,CAAC,CAAC,eAAe,EAAE,CAAC;oBACtB,CAAC,EACD,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,qBAAqB,EAChC,SAAS,EAAE,aAAa,CAAC,mBAAmB,EAC5C,cAAc,EAAE,aAAa,CAAC,mBAAmB,EACjD,QAAQ,EAAE,4BAA4B,GACtC,CACgB;YAElB,mDAAmD;YACnD,yBAAyB,EAAE,CAEvB,CACF,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useMemo, useCallback } from 'react';\nimport { IStyle, ITextField, mergeStyles, concatStyleSets, Icon, Stack } from '@fluentui/react';\nimport { sendButtonStyle, sendIconStyle, sendBoxWrapperStyles, borderAndBoxShadowStyle } from './styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { useV9CustomStyles } from './styles/SendBox.styles';\nimport { BaseCustomStyles } from '../types';\nimport { useTheme } from '../theming';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { InputBoxComponent } from './InputBoxComponent';\nimport { InputBoxButton } from './InputBoxButton';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrors } from './SendBoxErrors';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { _AttachmentUploadCards } from './Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { attachmentUploadCardsStyles } from './styles/SendBox.styles';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { SendBoxErrorBarError } from './SendBoxErrorBar';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport {\n isAttachmentUploadCompleted,\n hasIncompleteAttachmentUploads,\n toAttachmentMetadata\n} from './utils/SendBoxUtils';\nimport {\n MAXIMUM_LENGTH_OF_MESSAGE,\n isMessageTooLong,\n sanitizeText,\n isSendBoxButtonDisabled\n} from './utils/SendBoxUtils';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from './MentionPopover';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';\n\n/**\n * Fluent styles for {@link Sendbox}.\n *\n * @public\n */\nexport interface SendBoxStylesProps extends BaseCustomStyles {\n /** Styles for the text field. */\n textField?: IStyle;\n /** styles for the text field container */\n textFieldContainer?: 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 {@link SendBox} that can be overridden.\n *\n * @public\n */\nexport interface SendBoxStrings {\n /**\n * Placeholder text in SendBox when there is no user input\n */\n placeholderText: string;\n /**\n * The warning message when send box text length is more than max limit\n */\n textTooLong: string;\n /**\n * Aria label for send message button\n */\n sendButtonAriaLabel: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user when focus is on cancel attachment upload button.\n */\n removeAttachment: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user attachment uploading starts.\n */\n uploading: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user attachment is uploaded.\n */\n uploadCompleted: string;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Aria label to notify user more attachment action menu.\n */\n attachmentMoreMenu: string;\n}\n\n/**\n * Props for {@link SendBox}.\n *\n * @public\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 override behavior on send button click\n */\n onSendMessage?: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup suggestions in the mention scenario.\n * @beta\n */\n mentionLookupOptions?: MentionLookupOptions;\n\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 SendBoxSendHovered icon when mouse over icon and SendBoxSend icon otherwise\n */\n onRenderIcon?: (isHover: 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 * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to render uploaded attachments in the SendBox. The sendBox will expand\n * vertically to accommodate the uploaded attachments. Attachment uploads will\n * be rendered below the text area in sendBox.\n * @beta\n */\n onRenderAttachmentUploads?: () => JSX.Element;\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional array of type {@link AttachmentMetadataInProgress}\n * to render attachments being uploaded in the SendBox.\n * @beta\n */\n attachments?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(file-sharing-acs) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n}\n\n/**\n * Component for typing and sending messages.\n *\n * Supports sending typing notification when user starts entering text.\n * Supports an optional message below the text input field.\n *\n * @public\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 autoFocus,\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions,\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments\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 /* @conditional-compile-remove(file-sharing-acs) */\n const customV9Styles = useV9CustomStyles();\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n\n const sendMessageOnClick = (): void => {\n // don't send a message when disabled\n if (disabled || textValueOverflow) {\n return;\n }\n\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(file-sharing-acs) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n if (hasIncompleteAttachmentUploads(attachments)) {\n setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = textValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(file-sharing-acs) */ isAttachmentUploadCompleted(attachments)\n ) {\n onSendMessage &&\n onSendMessage(\n message,\n /* @conditional-compile-remove(file-sharing-acs) */ /* @conditional-compile-remove(rich-text-editor-composite-support) */\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments: toAttachmentMetadata(attachments),\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n type: 'text'\n }\n );\n setTextValue('');\n sendTextFieldRef.current?.focus();\n }\n };\n\n const setText = (newValue?: string | undefined): void => {\n if (newValue === undefined) {\n return;\n }\n\n setTextValueOverflow(isMessageTooLong(newValue.length));\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? strings.textTooLong : undefined;\n const errorMessage = systemMessage ?? textTooLongMessage;\n\n const isSendBoxButtonDisabledValue = useMemo(() => {\n return isSendBoxButtonDisabled({\n hasContent: sanitizeText(textValue).length > 0,\n /* @conditional-compile-remove(file-sharing-acs) */ hasCompletedAttachmentUploads:\n isAttachmentUploadCompleted(attachments),\n hasError: !!errorMessage,\n disabled: !!disabled\n });\n }, [\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments,\n disabled,\n errorMessage,\n textValue\n ]);\n\n const mergedSendButtonStyle = useMemo(\n () => mergeStyles(sendButtonStyle, styles?.sendMessageIconContainer),\n [styles?.sendMessageIconContainer]\n );\n\n const mergedStyles = useMemo(() => concatStyleSets(styles), [styles]);\n\n const mergedSendIconStyle = useMemo(\n () =>\n sendIconStyle({\n theme,\n isSendBoxButtonDisabled: isSendBoxButtonDisabledValue,\n customSendIconStyle: styles?.sendMessageIcon\n }),\n [theme, isSendBoxButtonDisabledValue, styles?.sendMessageIcon]\n );\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) =>\n onRenderIcon ? (\n onRenderIcon(isHover)\n ) : (\n <Icon iconName={isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend'} className={mergedSendIconStyle} />\n ),\n [mergedSendIconStyle, onRenderIcon, textValue]\n );\n\n // Ensure that errors are cleared when there are no attachments in sendBox\n /* @conditional-compile-remove(file-sharing-acs) */\n React.useEffect(() => {\n if (!attachments?.filter((upload) => !upload.error).length) {\n setAttachmentUploadsPendingError(undefined);\n }\n }, [attachments]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const sendBoxErrorsProps = useMemo(() => {\n return {\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n attachmentProgressError: attachments?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error\n };\n }, [attachments, attachmentUploadsPendingError]);\n\n /* @conditional-compile-remove(file-sharing-acs) */\n const onRenderAttachmentUploads = useCallback(() => {\n if (!attachments?.filter((upload) => !upload.error).length) {\n return null;\n }\n return props.onRenderAttachmentUploads ? (\n props.onRenderAttachmentUploads()\n ) : (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme} className={customV9Styles.clearBackground}>\n <_AttachmentUploadCards\n attachments={attachments}\n onCancelAttachmentUpload={props.onCancelAttachmentUpload}\n strings={{\n removeAttachment: props.strings?.removeAttachment ?? localeStrings.removeAttachment,\n uploading: props.strings?.uploading ?? localeStrings.uploading,\n uploadCompleted: props.strings?.uploadCompleted ?? localeStrings.uploadCompleted,\n attachmentMoreMenu: props.strings?.attachmentMoreMenu ?? localeStrings.attachmentMoreMenu\n }}\n disabled={disabled}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n attachments,\n props,\n theme,\n customV9Styles.clearBackground,\n localeStrings.removeAttachment,\n localeStrings.uploading,\n localeStrings.uploadCompleted,\n localeStrings.attachmentMoreMenu,\n disabled\n ]);\n\n return (\n <Stack\n className={mergeStyles(\n sendBoxWrapperStyles,\n { overflow: 'visible' } // This is needed for the mention popup to be visible\n )}\n >\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n <SendBoxErrors\n attachmentProgressError={\n sendBoxErrorsProps.attachmentProgressError\n ? {\n message: sendBoxErrorsProps.attachmentProgressError.message,\n timestamp: Date.now()\n }\n : undefined\n }\n attachmentUploadsPendingError={sendBoxErrorsProps.attachmentUploadsPendingError}\n />\n }\n <Stack\n className={borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: !!errorMessage,\n disabled: !!disabled\n })}\n >\n <InputBoxComponent\n autoFocus={autoFocus}\n data-ui-id={ids.sendboxTextField}\n disabled={disabled}\n errorMessage={onRenderSystemMessage ? onRenderSystemMessage(errorMessage) : errorMessage}\n textFieldRef={sendTextFieldRef}\n id=\"sendbox\"\n placeholderText={strings.placeholderText}\n textValue={textValue}\n onChange={(_, newValue) => setText(newValue)}\n onKeyDown={(ev) => {\n const keyWasSendingMessage = ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline);\n if (!keyWasSendingMessage) {\n onTyping?.();\n }\n }}\n onEnterKeyDown={() => {\n sendMessageOnClick();\n }}\n styles={mergedStyles}\n supportNewline={supportNewline}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\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 ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n disabled={isSendBoxButtonDisabledValue}\n />\n </InputBoxComponent>\n {\n /* @conditional-compile-remove(file-sharing-acs) */\n onRenderAttachmentUploads()\n }\n </Stack>\n </Stack>\n );\n};\n"]}
@@ -4,7 +4,7 @@ import { BaseCustomStyles } from '../types';
4
4
  * Whether the stream is loading or not.
5
5
  * @public
6
6
  */
7
- export type LoadingState = 'loading' | 'none';
7
+ export type LoadingState = 'loading' | 'none' | 'reconnecting';
8
8
  /**
9
9
  * Props for {@link StreamMedia}.
10
10
  *
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { mergeStyles, Spinner } from '@fluentui/react';
3
+ import { mergeStyles, Spinner, Text } from '@fluentui/react';
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
- import { invertedVideoInPipStyle, mediaContainer, container, loadingSpinnerContainer, loadSpinnerStyles } from './styles/StreamMedia.styles';
5
+ import { invertedVideoInPipStyle, mediaContainer, container, loadingSpinnerContainer, loadSpinnerStyles, reconnectingContainer, reconnectingText } from './styles/StreamMedia.styles';
6
6
  import { useTheme } from '../theming';
7
7
  /**
8
8
  * Utility component to convert an HTMLElement with a video stream into a JSX element.
@@ -43,6 +43,8 @@ export const StreamMedia = (props) => {
43
43
  return (React.createElement("div", { className: container() },
44
44
  React.createElement("div", { "data-ui-id": "stream-media-container", className: mergeStyles(isMirrored && pipEnabled ? invertedVideoInPipStyle(theme) : mediaContainer(theme), styles === null || styles === void 0 ? void 0 : styles.root), ref: containerEl }),
45
45
  loadingState === 'loading' && (React.createElement("div", { className: loadingSpinnerContainer() },
46
- React.createElement(Spinner, { "data-ui-id": "stream-media-loading-spinner", styles: loadSpinnerStyles })))));
46
+ React.createElement(Spinner, { "data-ui-id": "stream-media-loading-spinner", styles: loadSpinnerStyles }))),
47
+ loadingState === 'reconnecting' && (React.createElement("div", { className: reconnectingContainer() },
48
+ React.createElement(Text, { "data-ui-id": "stream-media-reconnecting", className: reconnectingText(theme) }, "Reconnecting...")))));
47
49
  };
48
50
  //# sourceMappingURL=StreamMedia.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StreamMedia.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/StreamMedia.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA+BtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAe,EAAE;IAClE,MAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;IAChF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,kHAAkH;QAClH,mHAAmH;QACnH,+BAA+B;QAC/B,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;QACzB,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,kBAAkB,EAAE,CAAC;YACvB,kBAAkB,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,GAAG,EAAE;gBAChE,aAAa,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,kBAAkB,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,GAAG,EAAE;gBAChE,aAAa,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;YACzB,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,6BAAK,SAAS,EAAE,SAAS,EAAE;QACzB,2CACa,wBAAwB,EACnC,SAAS,EAAE,WAAW,CACpB,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,EACjF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CACb,EACD,GAAG,EAAE,WAAW,GAChB;QACD,YAAY,KAAK,SAAS,IAAI,CAC7B,6BAAK,SAAS,EAAE,uBAAuB,EAAE;YACvC,oBAAC,OAAO,kBAAY,8BAA8B,EAAC,MAAM,EAAE,iBAAiB,GAAI,CAC5E,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Spinner } from '@fluentui/react';\nimport React, { useEffect, useRef, useState } from 'react';\nimport {\n invertedVideoInPipStyle,\n mediaContainer,\n container,\n loadingSpinnerContainer,\n loadSpinnerStyles\n} from './styles/StreamMedia.styles';\nimport { useTheme } from '../theming';\nimport { BaseCustomStyles } from '../types';\n\n/**\n * Whether the stream is loading or not.\n * @public\n */\nexport type LoadingState = 'loading' | 'none';\n\n/**\n * Props for {@link StreamMedia}.\n *\n * @public\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 /** Whether the stream is loading data */\n loadingState?: LoadingState;\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?: BaseCustomStyles;\n}\n\n/**\n * Utility component to convert an HTMLElement with a video stream into a JSX element.\n *\n * Use to convert an HTMLElement returned by headless calling API into a component that can be rendered as a {@link VideoTile}.\n *\n * @public\n */\nexport const StreamMedia = (props: StreamMediaProps): JSX.Element => {\n const containerEl = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n\n const { isMirrored, videoStreamElement, styles, loadingState = 'none' } = props;\n const [pipEnabled, setPipEnabled] = useState(false);\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 setPipEnabled(false);\n if (videoStreamElement) {\n videoStreamElement.addEventListener('enterpictureinpicture', () => {\n setPipEnabled(true);\n });\n videoStreamElement.addEventListener('leavepictureinpicture', () => {\n setPipEnabled(false);\n });\n container.appendChild(videoStreamElement);\n }\n\n return () => {\n container.innerHTML = '';\n setPipEnabled(false);\n };\n }, [videoStreamElement]);\n\n return (\n <div className={container()}>\n <div\n data-ui-id=\"stream-media-container\"\n className={mergeStyles(\n isMirrored && pipEnabled ? invertedVideoInPipStyle(theme) : mediaContainer(theme),\n styles?.root\n )}\n ref={containerEl}\n />\n {loadingState === 'loading' && (\n <div className={loadingSpinnerContainer()}>\n <Spinner data-ui-id=\"stream-media-loading-spinner\" styles={loadSpinnerStyles} />\n </div>\n )}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"StreamMedia.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/StreamMedia.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,O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,kBAAkB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;YACzB,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,6BAAK,SAAS,EAAE,SAAS,EAAE;QACzB,2CACa,wBAAwB,EACnC,SAAS,EAAE,WAAW,CACpB,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,EACjF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CACb,EACD,GAAG,EAAE,WAAW,GAChB;QACD,YAAY,KAAK,SAAS,IAAI,CAC7B,6BAAK,SAAS,EAAE,uBAAuB,EAAE;YACvC,oBAAC,OAAO,kBAAY,8BAA8B,EAAC,MAAM,EAAE,iBAAiB,GAAI,CAC5E,CACP;QACA,YAAY,KAAK,cAAc,IAAI,CAClC,6BAAK,SAAS,EAAE,qBAAqB,EAAE;YACrC,oBAAC,IAAI,kBAAY,2BAA2B,EAAC,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,sBAExE,CACH,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Spinner, Text } from '@fluentui/react';\nimport React, { useEffect, useRef, useState } from 'react';\nimport {\n invertedVideoInPipStyle,\n mediaContainer,\n container,\n loadingSpinnerContainer,\n loadSpinnerStyles,\n reconnectingContainer,\n reconnectingText\n} from './styles/StreamMedia.styles';\nimport { useTheme } from '../theming';\nimport { BaseCustomStyles } from '../types';\n\n/**\n * Whether the stream is loading or not.\n * @public\n */\nexport type LoadingState = 'loading' | 'none' | 'reconnecting';\n\n/**\n * Props for {@link StreamMedia}.\n *\n * @public\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 /** Whether the stream is loading data */\n loadingState?: LoadingState;\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?: BaseCustomStyles;\n}\n\n/**\n * Utility component to convert an HTMLElement with a video stream into a JSX element.\n *\n * Use to convert an HTMLElement returned by headless calling API into a component that can be rendered as a {@link VideoTile}.\n *\n * @public\n */\nexport const StreamMedia = (props: StreamMediaProps): JSX.Element => {\n const containerEl = useRef<HTMLDivElement>(null);\n const theme = useTheme();\n\n const { isMirrored, videoStreamElement, styles, loadingState = 'none' } = props;\n const [pipEnabled, setPipEnabled] = useState(false);\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 setPipEnabled(false);\n if (videoStreamElement) {\n videoStreamElement.addEventListener('enterpictureinpicture', () => {\n setPipEnabled(true);\n });\n videoStreamElement.addEventListener('leavepictureinpicture', () => {\n setPipEnabled(false);\n });\n container.appendChild(videoStreamElement);\n }\n\n return () => {\n container.innerHTML = '';\n setPipEnabled(false);\n };\n }, [videoStreamElement]);\n\n return (\n <div className={container()}>\n <div\n data-ui-id=\"stream-media-container\"\n className={mergeStyles(\n isMirrored && pipEnabled ? invertedVideoInPipStyle(theme) : mediaContainer(theme),\n styles?.root\n )}\n ref={containerEl}\n />\n {loadingState === 'loading' && (\n <div className={loadingSpinnerContainer()}>\n <Spinner data-ui-id=\"stream-media-loading-spinner\" styles={loadSpinnerStyles} />\n </div>\n )}\n {loadingState === 'reconnecting' && (\n <div className={reconnectingContainer()}>\n <Text data-ui-id=\"stream-media-reconnecting\" className={reconnectingText(theme)}>\n Reconnecting...\n </Text>\n </div>\n )}\n </div>\n );\n};\n"]}
@@ -10,13 +10,9 @@ const DEFAULT_MAX_VIDEO_SREAMS = 4;
10
10
  export const MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;
11
11
  const getOrganizedParticipants = (props) => {
12
12
  const { remoteParticipants = [], dominantSpeakers = [], maxGridParticipants = DEFAULT_MAX_VIDEO_SREAMS, maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS, layout, previousGridParticipants = [], previousOverflowParticipants = [] } = props;
13
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
14
13
  const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' || 'Ringing'));
15
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
16
14
  const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));
17
- let connectedParticipants = remoteParticipants;
18
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
19
- connectedParticipants = connectedParticipants.filter((p) => !callingParticipantsSet.has(p.userId));
15
+ const connectedParticipants = remoteParticipants.filter((p) => !callingParticipantsSet.has(p.userId));
20
16
  const remoteParticipantsOrdered = putVideoParticipantsFirst(connectedParticipants);
21
17
  const videoParticipants = remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; });
22
18
  const participantsForGrid = layout === 'floatingLocalVideo' && videoParticipants.length > 0 ? videoParticipants : remoteParticipantsOrdered;
@@ -43,7 +39,6 @@ const getOrganizedParticipants = (props) => {
43
39
  });
44
40
  let gridParticipants = newGridParticipants;
45
41
  let overflowGalleryParticipants = newOverflowGalleryParticipants;
46
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
47
42
  if (gridParticipants.length + callingParticipants.length <= maxGridParticipants) {
48
43
  gridParticipants = gridParticipants.concat(callingParticipants);
49
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"videoGalleryLayoutUtils.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAgCpE,MAAM,8CAA8C,GAAG,CAAC,CAAC;AACzD,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC;AAEzD,MAAM,wBAAwB,GAAG,CAAC,KAAgC,EAA+B,EAAE;IACjG,MAAM,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,EAAE,EACrB,mBAAmB,GAAG,wBAAwB,EAC9C,kCAAkC,GAAG,8CAA8C,EACnF,MAAM,EACN,wBAAwB,GAAG,EAAE,EAC7B,4BAA4B,GAAG,EAAE,EAClC,GAAG,KAAK,CAAC;IAEV,6CAA6C,CAAC,mDAAmD;IACjG,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC;IACtG,6CAA6C,CAAC,mDAAmD;IACjG,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjF,IAAI,qBAAqB,GAAG,kBAAkB,CAAC;IAC/C,6CAA6C,CAAC,mDAAmD;IACjG,qBAAqB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,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iB,CAAC,aAAa,0CAAE,UAAU,mCAAI,CAAC,CAAC;QAC1D,KAAK,UAAU;YACb,OAAO,MAAA,MAAA,iBAAiB,CAAC,gBAAgB,0CAAE,UAAU,mCAAI,CAAC,CAAC;QAC7D,KAAK,WAAW;YACd,OAAO,MAAA,MAAA,iBAAiB,CAAC,iBAAiB,0CAAE,UAAU,mCAAI,CAAC,CAAC;QAC9D;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { useRef } from 'react';\nimport { smartDominantSpeakerParticipants } from '../../../gallery';\nimport { VideoGalleryParticipant, VideoGalleryRemoteParticipant } from '../../../types';\nimport { ReactionResources } from '../../..';\nimport { VideoGalleryLayout } from '../../VideoGallery';\n\n/**\n * Arguments used to determine a {@link OrganizedParticipantsResult}\n * @private\n */\nexport interface OrganizedParticipantsArgs {\n remoteParticipants: VideoGalleryRemoteParticipant[];\n localParticipant?: VideoGalleryParticipant;\n dominantSpeakers?: string[];\n maxGridParticipants?: number;\n maxOverflowGalleryDominantSpeakers?: number;\n isScreenShareActive?: boolean;\n pinnedParticipantUserIds?: string[];\n layout?: VideoGalleryLayout;\n spotlightedParticipantUserIds?: string[];\n previousGridParticipants?: VideoGalleryRemoteParticipant[];\n previousOverflowParticipants?: VideoGalleryRemoteParticipant[];\n}\n\n/**\n * A result that defines grid participants and overflow gallery participants in the VideoGallery\n * @private\n */\nexport interface OrganizedParticipantsResult {\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n}\n\nconst DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS = 6;\nconst DEFAULT_MAX_VIDEO_SREAMS = 4;\n/**\n * @private\n */\nexport const MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;\n\nconst getOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n const {\n remoteParticipants = [],\n dominantSpeakers = [],\n maxGridParticipants = DEFAULT_MAX_VIDEO_SREAMS,\n maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS,\n layout,\n previousGridParticipants = [],\n previousOverflowParticipants = []\n } = props;\n\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' || 'Ringing'));\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));\n\n let connectedParticipants = remoteParticipants;\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n connectedParticipants = connectedParticipants.filter((p) => !callingParticipantsSet.has(p.userId));\n\n const remoteParticipantsOrdered = putVideoParticipantsFirst(connectedParticipants);\n const videoParticipants = remoteParticipants.filter((p) => p.videoStream?.isAvailable);\n const participantsForGrid =\n layout === 'floatingLocalVideo' && videoParticipants.length > 0 ? videoParticipants : remoteParticipantsOrdered;\n\n let newGridParticipants = smartDominantSpeakerParticipants({\n participants: participantsForGrid,\n dominantSpeakers,\n currentParticipants: previousGridParticipants,\n maxDominantSpeakers: maxGridParticipants\n }).slice(0, maxGridParticipants);\n\n const dominantSpeakerToGrid =\n layout === 'speaker'\n ? dominantSpeakers && dominantSpeakers[0]\n ? newGridParticipants.filter((p) => p.userId === dominantSpeakers[0])\n : [newGridParticipants[0]]\n : [];\n\n if (dominantSpeakerToGrid[0]) {\n newGridParticipants = dominantSpeakerToGrid;\n }\n\n const gridParticipantSet = new Set(newGridParticipants.map((p) => p.userId));\n\n const newOverflowGalleryParticipants = smartDominantSpeakerParticipants({\n participants: remoteParticipantsOrdered.filter((p) => !gridParticipantSet.has(p.userId)),\n dominantSpeakers: dominantSpeakers,\n currentParticipants: previousOverflowParticipants,\n maxDominantSpeakers: maxOverflowGalleryDominantSpeakers\n });\n\n let gridParticipants = newGridParticipants;\n let overflowGalleryParticipants = newOverflowGalleryParticipants;\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n if (gridParticipants.length + callingParticipants.length <= maxGridParticipants) {\n gridParticipants = gridParticipants.concat(callingParticipants);\n } else {\n overflowGalleryParticipants = overflowGalleryParticipants.concat(callingParticipants);\n }\n\n return { gridParticipants, overflowGalleryParticipants };\n};\n\ninterface SortedRemoteParticipants {\n [key: string]: VideoGalleryRemoteParticipant;\n}\n\n/**\n * Hook to determine which participants should be in grid and overflow gallery and their order respectively\n * @private\n */\nexport const useOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n // map remote participants by userId\n const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {\n map[remoteParticipant.userId] = remoteParticipant;\n return map;\n }, {} as SortedRemoteParticipants);\n\n const spotlightedParticipantUserIds = props.spotlightedParticipantUserIds ?? [];\n const pinnedParticipantUserIds = props.pinnedParticipantUserIds ?? [];\n // declare set of focused participant user ids as spotlighted participants user ids followed by\n // pinned participants user ids which is deduplicated while maintaining order\n const focusedParticipantUserIdSet = new Set(\n spotlightedParticipantUserIds.concat(pinnedParticipantUserIds).filter((p) => remoteParticipantMap[p])\n );\n // get focused participants from map of remote participants in the order of the user ids\n const focusedParticipants: VideoGalleryRemoteParticipant[] = [...focusedParticipantUserIdSet].map(\n (p) => remoteParticipantMap[p]\n );\n\n const currentGridParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n const currentOverflowGalleryParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n\n const unfocusedParticipants = props.remoteParticipants.filter((p) => !focusedParticipantUserIdSet.has(p.userId));\n\n const organizedParticipantsArgs: OrganizedParticipantsArgs = {\n ...props,\n // if there are focused participants then leave no room in the grid by setting maxGridParticipants to 0\n maxGridParticipants: focusedParticipants.length > 0 || props.isScreenShareActive ? 0 : props.maxGridParticipants,\n remoteParticipants: unfocusedParticipants,\n previousGridParticipants: currentGridParticipants.current,\n previousOverflowParticipants: currentOverflowGalleryParticipants.current\n };\n\n const organizedParticipants = getOrganizedParticipants(organizedParticipantsArgs);\n\n currentGridParticipants.current = organizedParticipants.gridParticipants;\n currentOverflowGalleryParticipants.current = organizedParticipants.overflowGalleryParticipants;\n\n return focusedParticipants.length > 0\n ? {\n gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,\n overflowGalleryParticipants: props.isScreenShareActive\n ? focusedParticipants.concat(organizedParticipants.overflowGalleryParticipants)\n : organizedParticipants.overflowGalleryParticipants\n }\n : organizedParticipants;\n};\n\nconst putVideoParticipantsFirst = (\n remoteParticipants: VideoGalleryRemoteParticipant[]\n): VideoGalleryRemoteParticipant[] => {\n const videoParticipants: VideoGalleryRemoteParticipant[] = [];\n const audioParticipants: VideoGalleryRemoteParticipant[] = [];\n remoteParticipants.forEach((p) => {\n if (p.videoStream?.isAvailable) {\n videoParticipants.push(p);\n } else {\n audioParticipants.push(p);\n }\n });\n const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);\n return remoteParticipantSortedByVideo;\n};\n\n/**\n * @private\n */\nexport const renderTiles = (\n gridParticipants: VideoGalleryParticipant[],\n onRenderRemoteParticipant: (participant: VideoGalleryRemoteParticipant, isVideoParticipant?: boolean) => JSX.Element,\n maxRemoteVideoStreams: number,\n indexesToRender: number[],\n overflowGalleryParticipants: VideoGalleryParticipant[],\n dominantSpeakers?: string[]\n): { gridTiles: JSX.Element[]; overflowGalleryTiles: JSX.Element[] } => {\n const _dominantSpeakers = dominantSpeakers ?? [];\n let streamsLeftToRender = maxRemoteVideoStreams;\n\n // Render the grid participants\n const participantWithStreamsToRenderInGrid = gridParticipants.filter((p) => p?.videoStream?.isAvailable);\n const dominantSpeakerWithStreamsToRenderInGrid = _dominantSpeakers\n .filter((userId) => participantWithStreamsToRenderInGrid.find((p) => p?.userId === userId))\n .slice(0, streamsLeftToRender);\n streamsLeftToRender = streamsLeftToRender - dominantSpeakerWithStreamsToRenderInGrid.length;\n const gridTiles = gridParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n dominantSpeakerWithStreamsToRenderInGrid.includes(p.userId) ||\n (p.videoStream?.isAvailable && streamsLeftToRender-- > 0)\n );\n });\n\n // Render the overflow participants\n const participantWithStreamsToRenderInOverflow = indexesToRender\n .map((i) => {\n return overflowGalleryParticipants.at(i);\n })\n .filter((p) => p?.videoStream?.isAvailable);\n const dominantSpeakerWithStreamsToRenderInOverflow = _dominantSpeakers\n .filter((userId) => participantWithStreamsToRenderInOverflow.find((p) => p?.userId === userId))\n .slice(0, streamsLeftToRender);\n streamsLeftToRender = streamsLeftToRender - dominantSpeakerWithStreamsToRenderInOverflow.length;\n const overflowGalleryTiles = overflowGalleryParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n dominantSpeakerWithStreamsToRenderInOverflow.includes(p.userId) ||\n (p.videoStream?.isAvailable && streamsLeftToRender-- > 0)\n );\n });\n\n return { gridTiles, overflowGalleryTiles };\n};\n\n/**\n * @private\n */\nexport const getEmojiResource = (reactionName: string, reactionResources: ReactionResources): string | undefined => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.url;\n case 'heart':\n return reactionResources.heartReaction?.url;\n case 'laugh':\n return reactionResources.laughReaction?.url;\n case 'applause':\n return reactionResources.applauseReaction?.url;\n case 'surprised':\n return reactionResources.surprisedReaction?.url;\n }\n return undefined;\n};\n\n/**\n * @private\n */\nexport const getEmojiFrameCount = (reactionName: string, reactionResources: ReactionResources): number => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.frameCount ?? 0;\n case 'heart':\n return reactionResources.heartReaction?.frameCount ?? 0;\n case 'laugh':\n return reactionResources.laughReaction?.frameCount ?? 0;\n case 'applause':\n return reactionResources.applauseReaction?.frameCount ?? 0;\n case 'surprised':\n return reactionResources.surprisedReaction?.frameCount ?? 0;\n default:\n return 0;\n }\n};\n"]}
1
+ {"version":3,"file":"videoGalleryLayoutUtils.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAgCpE,MAAM,8CAA8C,GAAG,CAAC,CAAC;AACzD,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC;AAEzD,MAAM,wBAAwB,GAAG,CAAC,KAAgC,EAA+B,EAAE;IACjG,MAAM,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,EAAE,EACrB,mBAAmB,GAAG,wBAAwB,EAC9C,kCAAkC,GAAG,8CAA8C,EACnF,MAAM,EACN,wBAAwB,GAAG,EAAE,EAC7B,4BAA4B,GAAG,EAAE,EAClC,GAAG,KAAK,CAAC;IAEV,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC;IAEtG,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjF,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtG,MAAM,yBAAyB,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;IACnF,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,M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AiB,0CAAE,UAAU,mCAAI,CAAC,CAAC;QAC9D;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { useRef } from 'react';\nimport { smartDominantSpeakerParticipants } from '../../../gallery';\nimport { VideoGalleryParticipant, VideoGalleryRemoteParticipant } from '../../../types';\nimport { ReactionResources } from '../../..';\nimport { VideoGalleryLayout } from '../../VideoGallery';\n\n/**\n * Arguments used to determine a {@link OrganizedParticipantsResult}\n * @private\n */\nexport interface OrganizedParticipantsArgs {\n remoteParticipants: VideoGalleryRemoteParticipant[];\n localParticipant?: VideoGalleryParticipant;\n dominantSpeakers?: string[];\n maxGridParticipants?: number;\n maxOverflowGalleryDominantSpeakers?: number;\n isScreenShareActive?: boolean;\n pinnedParticipantUserIds?: string[];\n layout?: VideoGalleryLayout;\n spotlightedParticipantUserIds?: string[];\n previousGridParticipants?: VideoGalleryRemoteParticipant[];\n previousOverflowParticipants?: VideoGalleryRemoteParticipant[];\n}\n\n/**\n * A result that defines grid participants and overflow gallery participants in the VideoGallery\n * @private\n */\nexport interface OrganizedParticipantsResult {\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n}\n\nconst DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS = 6;\nconst DEFAULT_MAX_VIDEO_SREAMS = 4;\n/**\n * @private\n */\nexport const MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;\n\nconst getOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n const {\n remoteParticipants = [],\n dominantSpeakers = [],\n maxGridParticipants = DEFAULT_MAX_VIDEO_SREAMS,\n maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS,\n layout,\n previousGridParticipants = [],\n previousOverflowParticipants = []\n } = props;\n\n const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' || 'Ringing'));\n\n const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));\n\n const connectedParticipants = remoteParticipants.filter((p) => !callingParticipantsSet.has(p.userId));\n\n const remoteParticipantsOrdered = putVideoParticipantsFirst(connectedParticipants);\n const videoParticipants = remoteParticipants.filter((p) => p.videoStream?.isAvailable);\n const participantsForGrid =\n layout === 'floatingLocalVideo' && videoParticipants.length > 0 ? videoParticipants : remoteParticipantsOrdered;\n\n let newGridParticipants = smartDominantSpeakerParticipants({\n participants: participantsForGrid,\n dominantSpeakers,\n currentParticipants: previousGridParticipants,\n maxDominantSpeakers: maxGridParticipants\n }).slice(0, maxGridParticipants);\n\n const dominantSpeakerToGrid =\n layout === 'speaker'\n ? dominantSpeakers && dominantSpeakers[0]\n ? newGridParticipants.filter((p) => p.userId === dominantSpeakers[0])\n : [newGridParticipants[0]]\n : [];\n\n if (dominantSpeakerToGrid[0]) {\n newGridParticipants = dominantSpeakerToGrid;\n }\n\n const gridParticipantSet = new Set(newGridParticipants.map((p) => p.userId));\n\n const newOverflowGalleryParticipants = smartDominantSpeakerParticipants({\n participants: remoteParticipantsOrdered.filter((p) => !gridParticipantSet.has(p.userId)),\n dominantSpeakers: dominantSpeakers,\n currentParticipants: previousOverflowParticipants,\n maxDominantSpeakers: maxOverflowGalleryDominantSpeakers\n });\n\n let gridParticipants = newGridParticipants;\n let overflowGalleryParticipants = newOverflowGalleryParticipants;\n if (gridParticipants.length + callingParticipants.length <= maxGridParticipants) {\n gridParticipants = gridParticipants.concat(callingParticipants);\n } else {\n overflowGalleryParticipants = overflowGalleryParticipants.concat(callingParticipants);\n }\n\n return { gridParticipants, overflowGalleryParticipants };\n};\n\ninterface SortedRemoteParticipants {\n [key: string]: VideoGalleryRemoteParticipant;\n}\n\n/**\n * Hook to determine which participants should be in grid and overflow gallery and their order respectively\n * @private\n */\nexport const useOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n // map remote participants by userId\n const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {\n map[remoteParticipant.userId] = remoteParticipant;\n return map;\n }, {} as SortedRemoteParticipants);\n\n const spotlightedParticipantUserIds = props.spotlightedParticipantUserIds ?? [];\n const pinnedParticipantUserIds = props.pinnedParticipantUserIds ?? [];\n // declare set of focused participant user ids as spotlighted participants user ids followed by\n // pinned participants user ids which is deduplicated while maintaining order\n const focusedParticipantUserIdSet = new Set(\n spotlightedParticipantUserIds.concat(pinnedParticipantUserIds).filter((p) => remoteParticipantMap[p])\n );\n // get focused participants from map of remote participants in the order of the user ids\n const focusedParticipants: VideoGalleryRemoteParticipant[] = [...focusedParticipantUserIdSet].map(\n (p) => remoteParticipantMap[p]\n );\n\n const currentGridParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n const currentOverflowGalleryParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n\n const unfocusedParticipants = props.remoteParticipants.filter((p) => !focusedParticipantUserIdSet.has(p.userId));\n\n const organizedParticipantsArgs: OrganizedParticipantsArgs = {\n ...props,\n // if there are focused participants then leave no room in the grid by setting maxGridParticipants to 0\n maxGridParticipants: focusedParticipants.length > 0 || props.isScreenShareActive ? 0 : props.maxGridParticipants,\n remoteParticipants: unfocusedParticipants,\n previousGridParticipants: currentGridParticipants.current,\n previousOverflowParticipants: currentOverflowGalleryParticipants.current\n };\n\n const organizedParticipants = getOrganizedParticipants(organizedParticipantsArgs);\n\n currentGridParticipants.current = organizedParticipants.gridParticipants;\n currentOverflowGalleryParticipants.current = organizedParticipants.overflowGalleryParticipants;\n\n return focusedParticipants.length > 0\n ? {\n gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,\n overflowGalleryParticipants: props.isScreenShareActive\n ? focusedParticipants.concat(organizedParticipants.overflowGalleryParticipants)\n : organizedParticipants.overflowGalleryParticipants\n }\n : organizedParticipants;\n};\n\nconst putVideoParticipantsFirst = (\n remoteParticipants: VideoGalleryRemoteParticipant[]\n): VideoGalleryRemoteParticipant[] => {\n const videoParticipants: VideoGalleryRemoteParticipant[] = [];\n const audioParticipants: VideoGalleryRemoteParticipant[] = [];\n remoteParticipants.forEach((p) => {\n if (p.videoStream?.isAvailable) {\n videoParticipants.push(p);\n } else {\n audioParticipants.push(p);\n }\n });\n const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);\n return remoteParticipantSortedByVideo;\n};\n\n/**\n * @private\n */\nexport const renderTiles = (\n gridParticipants: VideoGalleryParticipant[],\n onRenderRemoteParticipant: (participant: VideoGalleryRemoteParticipant, isVideoParticipant?: boolean) => JSX.Element,\n maxRemoteVideoStreams: number,\n indexesToRender: number[],\n overflowGalleryParticipants: VideoGalleryParticipant[],\n dominantSpeakers?: string[]\n): { gridTiles: JSX.Element[]; overflowGalleryTiles: JSX.Element[] } => {\n const _dominantSpeakers = dominantSpeakers ?? [];\n let streamsLeftToRender = maxRemoteVideoStreams;\n\n // Render the grid participants\n const participantWithStreamsToRenderInGrid = gridParticipants.filter((p) => p?.videoStream?.isAvailable);\n const dominantSpeakerWithStreamsToRenderInGrid = _dominantSpeakers\n .filter((userId) => participantWithStreamsToRenderInGrid.find((p) => p?.userId === userId))\n .slice(0, streamsLeftToRender);\n streamsLeftToRender = streamsLeftToRender - dominantSpeakerWithStreamsToRenderInGrid.length;\n const gridTiles = gridParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n dominantSpeakerWithStreamsToRenderInGrid.includes(p.userId) ||\n (p.videoStream?.isAvailable && streamsLeftToRender-- > 0)\n );\n });\n\n // Render the overflow participants\n const participantWithStreamsToRenderInOverflow = indexesToRender\n .map((i) => {\n return overflowGalleryParticipants.at(i);\n })\n .filter((p) => p?.videoStream?.isAvailable);\n const dominantSpeakerWithStreamsToRenderInOverflow = _dominantSpeakers\n .filter((userId) => participantWithStreamsToRenderInOverflow.find((p) => p?.userId === userId))\n .slice(0, streamsLeftToRender);\n streamsLeftToRender = streamsLeftToRender - dominantSpeakerWithStreamsToRenderInOverflow.length;\n const overflowGalleryTiles = overflowGalleryParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n dominantSpeakerWithStreamsToRenderInOverflow.includes(p.userId) ||\n (p.videoStream?.isAvailable && streamsLeftToRender-- > 0)\n );\n });\n\n return { gridTiles, overflowGalleryTiles };\n};\n\n/**\n * @private\n */\nexport const getEmojiResource = (reactionName: string, reactionResources: ReactionResources): string | undefined => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.url;\n case 'heart':\n return reactionResources.heartReaction?.url;\n case 'laugh':\n return reactionResources.laughReaction?.url;\n case 'applause':\n return reactionResources.applauseReaction?.url;\n case 'surprised':\n return reactionResources.surprisedReaction?.url;\n }\n return undefined;\n};\n\n/**\n * @private\n */\nexport const getEmojiFrameCount = (reactionName: string, reactionResources: ReactionResources): number => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.frameCount ?? 0;\n case 'heart':\n return reactionResources.heartReaction?.frameCount ?? 0;\n case 'laugh':\n return reactionResources.laughReaction?.frameCount ?? 0;\n case 'applause':\n return reactionResources.applauseReaction?.frameCount ?? 0;\n case 'surprised':\n return reactionResources.surprisedReaction?.frameCount ?? 0;\n default:\n return 0;\n }\n};\n"]}
@@ -197,9 +197,7 @@ export const VideoGallery = (props) => {
197
197
  }
198
198
  : remoteVideoViewOptions;
199
199
  };
200
- return (React.createElement(_RemoteVideoTile, { alwaysShowLabelBackground: videoTilesOptions === null || videoTilesOptions === void 0 ? void 0 : videoTilesOptions.alwaysShowLabelBackground, streamId: remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.id, key: participant.userId, userId: participant.userId, remoteParticipant: participant, onCreateRemoteStreamView: isVideoParticipant ? onCreateRemoteStreamView : undefined, onDisposeRemoteStreamView: isVideoParticipant ? onDisposeRemoteVideoStreamView : undefined, isAvailable: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.isAvailable : false, isReceiving: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.isReceiving : false, renderElement: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.renderElement : undefined, remoteVideoViewOptions: createViewOptions(), onRenderAvatar: onRenderAvatar, showMuteIndicator: showMuteIndicator, strings: strings,
201
- /* @conditional-compile-remove(PSTN-calls) */
202
- participantState: participant.state, menuKind: participant.userId === localParticipant.userId
200
+ return (React.createElement(_RemoteVideoTile, { alwaysShowLabelBackground: videoTilesOptions === null || videoTilesOptions === void 0 ? void 0 : videoTilesOptions.alwaysShowLabelBackground, streamId: remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.id, key: participant.userId, userId: participant.userId, remoteParticipant: participant, onCreateRemoteStreamView: isVideoParticipant ? onCreateRemoteStreamView : undefined, onDisposeRemoteStreamView: isVideoParticipant ? onDisposeRemoteVideoStreamView : undefined, isAvailable: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.isAvailable : false, isReceiving: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.isReceiving : false, renderElement: isVideoParticipant ? remoteVideoStream === null || remoteVideoStream === void 0 ? void 0 : remoteVideoStream.renderElement : undefined, remoteVideoViewOptions: createViewOptions(), onRenderAvatar: onRenderAvatar, showMuteIndicator: showMuteIndicator, strings: strings, participantState: participant.state, menuKind: participant.userId === localParticipant.userId
203
201
  ? undefined
204
202
  : remoteVideoTileMenu
205
203
  ? remoteVideoTileMenu.kind === 'drawer'